| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- var X$=Object.defineProperty;var T3=r=>{throw TypeError(r)};var K$=(r,t,e)=>t in r?X$(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var le=(r,t,e)=>K$(r,typeof t!="symbol"?t+"":t,e),Jp=(r,t,e)=>t.has(r)||T3("Cannot "+e);var ki=(r,t,e)=>(Jp(r,t,"read from private field"),e?e.call(r):t.get(r)),Qp=(r,t,e)=>t.has(r)?T3("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),$h=(r,t,e,n)=>(Jp(r,t,"write to private field"),n?n.call(r,e):t.set(r,e),e),tv=(r,t,e)=>(Jp(r,t,"access private method"),e);import Z$ from"./LayoutExperience-C-VNPgom.js";import J$ from"./ContentContainer-DEXtpisW.js";/* empty css */import{m as Q$,c as xx,D as tj}from"./_commonjs-dynamic-modules-Cz918L-p.js";import{u as nw,b as ej}from"./index-Dlwlyumw.js";import{T as nj}from"./index-KVanbtMI.js";import{I as rj}from"./index-B1QCyp7Y.js";/* empty css */import"./index-B5WQwmV3.js";/* empty css */import{T as ij,a as aj,P as cR}from"./index-BxrNW0vL.js";import{S as hR}from"./index-x3lOa5LU.js";import{C as sj}from"./index-CDYLeEdN.js";import{S as tg}from"./index-DI0YraXm.js";import{D as dR}from"./index-C4d4Z4xQ.js";import{d as Ws,c as Ve,o as $t,a as un,n as kc,b as Mr,e as Ze,q as Ex,l as _o,p as dn,y as ve,m as Ds,k as Da,P as oc,X as eg,Y as oj,A as fR,Z as gR,r as Rl,f as ce,O as lj,u as Tc,Q as _x,i as uj,s as cj,B as ae,F as pR,G as uf,V as ps,_ as hj,w as dj,C as fj}from"./vue-vendor-bEvCrXZa.js";import{T as gj}from"./index-DMoSr7HV.js";import{Q as pj}from"./common-Buh1uhle.js";import{_ as $o}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{_ as Gs,a as jo,i as zl,o as ev,b as nv,s as vR,c as mR,I as vj,d as mj,u as yj,B as yR,e as bt,f as bj,h as cf,j as wj,g as ng,k as O3,l as xj,m as jt,n as it,p as Te,q as at,r as Rt,t as Fs,v as bR,w as Ma,x as wR,y as Ej}from"./index-5nNf0lia.js";import{I as _j}from"./index-C2Z30LSu.js";import{R as Sj}from"./resize-observer-DsnIvkyE.js";import{r as C3}from"./responsive-observe-s2CgSoTB.js";import{C as Mj,a as kj}from"./index-D24AM9Tb.js";/* empty css */import{T as Tj}from"./index-vcT21iob.js";import{_ as Oj}from"./Header-CgX5EbRX.js";import{P as Cj}from"./index-NWtquoAr.js";import{q as Aj}from"./rgflow-dify-D24IAChm.js";import{M as xR}from"./index-DQilWOQr.js";import"./index-C8SeSu9E.js";import"./index.es-BW_FzNZC.js";import"./render-function-mdTNSiZi.js";/* empty css */import"./use-logout-CGMNlrWa.js";import"./use-current-user-DAgU0YWn.js";import"./login-DPI1p_mg.js";const Pj=Ws({name:"IconAttachment",props:{size:{type:[Number,String]},strokeWidth:{type:Number,default:4},strokeLinecap:{type:String,default:"butt",validator:r=>["butt","round","square"].includes(r)},strokeLinejoin:{type:String,default:"miter",validator:r=>["arcs","bevel","miter","miter-clip","round"].includes(r)},rotate:Number,spin:Boolean},emits:{click:r=>!0},setup(r,{emit:t}){const e=jo("icon"),n=Ze(()=>[e,`${e}-attachment`,{[`${e}-spin`]:r.spin}]),i=Ze(()=>{const s={};return r.size&&(s.fontSize=zl(r.size)?`${r.size}px`:r.size),r.rotate&&(s.transform=`rotate(${r.rotate}deg)`),s});return{cls:n,innerStyle:i,onClick:s=>{t("click",s)}}}}),Nj=["stroke-width","stroke-linecap","stroke-linejoin"],Rj=un("path",{d:"M29.037 15.236s-9.174 9.267-11.48 11.594c-2.305 2.327-1.646 4.987-.329 6.316 1.317 1.33 3.994 1.953 6.258-.332L37.32 18.851c3.623-3.657 2.092-8.492 0-10.639-2.093-2.147-6.916-3.657-10.54 0L11.3 23.838c-3.623 3.657-3.953 10.638.329 14.96 4.282 4.322 11.115 4.105 14.821.333 3.706-3.773 8.74-8.822 11.224-11.33"},null,-1),Lj=[Rj];function Ij(r,t,e,n,i,a){return $t(),Ve("svg",{viewBox:"0 0 48 48",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",class:Mr(r.cls),style:kc(r.innerStyle),"stroke-width":r.strokeWidth,"stroke-linecap":r.strokeLinecap,"stroke-linejoin":r.strokeLinejoin,onClick:t[0]||(t[0]=(...s)=>r.onClick&&r.onClick(...s))},Lj,14,Nj)}var rv=Gs(Pj,[["render",Ij]]);const Dj=Object.assign(rv,{install:(r,t)=>{var e;const n=(e=t==null?void 0:t.iconPrefix)!=null?e:"";r.component(n+rv.name,rv)}}),Fj=Ws({name:"IconDragDot",props:{size:{type:[Number,String]},strokeWidth:{type:Number,default:4},strokeLinecap:{type:String,default:"butt",validator:r=>["butt","round","square"].includes(r)},strokeLinejoin:{type:String,default:"miter",validator:r=>["arcs","bevel","miter","miter-clip","round"].includes(r)},rotate:Number,spin:Boolean},emits:{click:r=>!0},setup(r,{emit:t}){const e=jo("icon"),n=Ze(()=>[e,`${e}-drag-dot`,{[`${e}-spin`]:r.spin}]),i=Ze(()=>{const s={};return r.size&&(s.fontSize=zl(r.size)?`${r.size}px`:r.size),r.rotate&&(s.transform=`rotate(${r.rotate}deg)`),s});return{cls:n,innerStyle:i,onClick:s=>{t("click",s)}}}}),Bj=["stroke-width","stroke-linecap","stroke-linejoin"],zj=un("path",{d:"M40 17v2h-2v-2h2ZM25 17v2h-2v-2h2ZM10 17v2H8v-2h2ZM40 29v2h-2v-2h2ZM25 29v2h-2v-2h2ZM10 29v2H8v-2h2Z",fill:"currentColor",stroke:"none"},null,-1),$j=un("path",{d:"M40 17v2h-2v-2h2ZM25 17v2h-2v-2h2ZM10 17v2H8v-2h2ZM40 29v2h-2v-2h2ZM25 29v2h-2v-2h2ZM10 29v2H8v-2h2Z"},null,-1),jj=[zj,$j];function qj(r,t,e,n,i,a){return $t(),Ve("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",class:Mr(r.cls),style:kc(r.innerStyle),"stroke-width":r.strokeWidth,"stroke-linecap":r.strokeLinecap,"stroke-linejoin":r.strokeLinejoin,onClick:t[0]||(t[0]=(...s)=>r.onClick&&r.onClick(...s))},jj,14,Bj)}var iv=Gs(Fj,[["render",qj]]);const Wj=Object.assign(iv,{install:(r,t)=>{var e;const n=(e=t==null?void 0:t.iconPrefix)!=null?e:"";r.component(n+iv.name,iv)}}),Gj=Symbol("LayoutSiderInjectionKey"),Vj=Symbol("SiderInjectionKey");var Hj=Ws({name:"ResizeTrigger",components:{ResizeObserver:Sj,IconDragDot:Wj,IconDragDotVertical:_j},props:{prefixCls:{type:String,required:!0},direction:{type:String,default:"horizontal"}},emits:["resize"],setup(r,{emit:t}){const{direction:e,prefixCls:n}=Ex(r),i=Ze(()=>(e==null?void 0:e.value)==="horizontal");return{classNames:Ze(()=>[n.value,{[`${n.value}-horizontal`]:i.value,[`${n.value}-vertical`]:!i.value}]),onResize:o=>{t("resize",o)},isHorizontal:i}}});function Uj(r,t,e,n,i,a){const s=_o("IconDragDot"),o=_o("IconDragDotVertical"),l=_o("ResizeObserver");return $t(),dn(l,{onResize:r.onResize},{default:ve(()=>[un("div",{class:Mr(r.classNames)},[Ds(" @slot 自定义内容 "),Da(r.$slots,"default",{},()=>[un("div",{class:Mr(`${r.prefixCls}-icon-wrapper`)},[Ds(" @slot 自定义 icon "),Da(r.$slots,"icon",{},()=>[r.isHorizontal?($t(),dn(s,{key:0,class:Mr(`${r.prefixCls}-icon`)},null,8,["class"])):($t(),dn(o,{key:1,class:Mr(`${r.prefixCls}-icon`)},null,8,["class"]))])],2)])],2)]),_:3},8,["onResize"])}var Yj=Gs(Hj,[["render",Uj]]),Xj=Object.defineProperty,A3=Object.getOwnPropertySymbols,Kj=Object.prototype.hasOwnProperty,Zj=Object.prototype.propertyIsEnumerable,P3=(r,t,e)=>t in r?Xj(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,av=(r,t)=>{for(var e in t||(t={}))Kj.call(t,e)&&P3(r,e,t[e]);if(A3)for(var e of A3(t))Zj.call(t,e)&&P3(r,e,t[e]);return r};const ER="left",_R="right",Sx="top",Mx="bottom",Jj=[ER,_R,Sx,Mx];function N3(r,t){if(r===0)return 0;const e=r-t;return e<=0?0:e}function sv(r){return[Sx,Mx].indexOf(r)>-1}const Qj=Ws({name:"ResizeBox",components:{ResizeTrigger:Yj},inheritAttrs:!1,props:{width:{type:Number},height:{type:Number},component:{type:String,default:"div"},directions:{type:Array,default:()=>["right"]}},emits:{"update:width":r=>!0,"update:height":r=>!0,movingStart:r=>!0,moving:(r,t)=>!0,movingEnd:r=>!0},setup(r,{emit:t}){const{height:e,width:n,directions:i}=Ex(r),[a,s]=nw(null,Rl({value:n})),[o,l]=nw(null,Rl({value:e})),u=ce(),c=Rl({}),h=jo("resizebox"),d=Ze(()=>[h]),g=Ze(()=>av(av(av({},zl(a.value)?{width:`${a.value}px`}:{}),zl(o.value)?{height:`${o.value}px`}:{}),c)),p=Ze(()=>i.value.filter(_=>Jj.includes(_))),v={direction:"",startPageX:0,startPageY:0,startWidth:0,startHeight:0,moving:!1,padding:{left:0,right:0,top:0,bottom:0}};function m(_){if(!v.moving)return;const{startPageX:S,startPageY:M,startWidth:k,startHeight:T,direction:P}=v;let O=k,A=T;const R=_.pageX-S,L=_.pageY-M;switch(P){case ER:O=k-R,s(O),t("update:width",O);break;case _R:O=k+R,s(O),t("update:width",O);break;case Sx:A=T-L,l(A),t("update:height",A);break;case Mx:A=T+L,l(A),t("update:height",A);break}t("moving",{width:O,height:A},_)}function b(_){v.moving=!1,nv(window,"mousemove",m),nv(window,"mouseup",b),nv(window,"contextmenu",b),document.body.style.cursor="default",t("movingEnd",_)}function w(_,S){var M,k;t("movingStart",S),v.moving=!0,v.startPageX=S.pageX,v.startPageY=S.pageY,v.direction=_;const{top:T,left:P,right:O,bottom:A}=v.padding;v.startWidth=N3(((M=u.value)==null?void 0:M.clientWidth)||0,P+O),v.startHeight=N3(((k=u.value)==null?void 0:k.clientHeight)||0,T+A),ev(window,"mousemove",m),ev(window,"mouseup",b),ev(window,"contextmenu",b),document.body.style.cursor=sv(_)?"row-resize":"col-resize"}function x(_,S){const{width:M,height:k}=S.contentRect,T=sv(_)?k:M;v.padding[_]=T,c[`padding-${_}`]=`${T}px`}return{prefixCls:h,classNames:d,styles:g,wrapperRef:u,onMoveStart:w,isHorizontal:sv,allowDirections:p,onTiggerResize:x}}});function tq(r,t,e,n,i,a){const s=_o("ResizeTrigger");return $t(),dn(gR(r.component),fR({ref:"wrapperRef",class:r.classNames},r.$attrs,{style:r.styles}),{default:ve(()=>[Da(r.$slots,"default"),($t(!0),Ve(oc,null,eg(r.allowDirections,o=>($t(),dn(s,{key:o,"prefix-cls":`${r.prefixCls}-trigger`,class:Mr(`${r.prefixCls}-direction-${o}`),direction:r.isHorizontal(o)?"horizontal":"vertical",onMousedown:l=>{r.onMoveStart(o,l)},onResize:l=>{r.onTiggerResize(o,l)}},oj({default:ve(()=>[r.$slots["resize-trigger"]?Da(r.$slots,"resize-trigger",{key:0,direction:o}):Ds("v-if",!0)]),_:2},[r.$slots["resize-trigger-icon"]?{name:"icon",fn:ve(()=>[Da(r.$slots,"resize-trigger-icon",{direction:o})])}:void 0]),1032,["prefix-cls","class","direction","onMousedown","onResize"]))),128))]),_:3},16,["class","style"])}var ov=Gs(Qj,[["render",tq]]);const eq=Object.assign(ov,{install:(r,t)=>{vR(r,t);const e=mR(t);r.component(e+ov.name,ov)}});function nq(r,t){const e=Ze(()=>lj(r)?r.value:r);let n="";Tc(()=>{n=C3.subscribe((i,a)=>{e.value&&(!a||a===e.value)&&t(!!i[e.value])})}),_x(()=>{n&&C3.unsubscribe(n)})}const rq=(()=>{let r=0;return(t="")=>(r+=1,`${t}${r}`)})();var iq=Ws({name:"LayoutSider",components:{IconLeft:vj,IconRight:rj,ResizeBox:eq},props:{theme:{type:String,default:"light"},collapsed:{type:Boolean,default:void 0},defaultCollapsed:{type:Boolean},collapsible:{type:Boolean},width:{type:Number,default:200},collapsedWidth:{type:Number,default:48},reverseArrow:{type:Boolean},breakpoint:{type:String},resizeDirections:{type:Array,default:void 0},hideTrigger:{type:Boolean}},emits:["collapse","update:collapsed","breakpoint"],setup(r,{emit:t}){const{theme:e,collapsed:n,defaultCollapsed:i,collapsible:a,hideTrigger:s,breakpoint:o,collapsedWidth:l,resizeDirections:u}=Ex(r),[c,h]=nw(i.value,Rl({value:n})),d=Ze(()=>u.value?"ResizeBox":"div"),g=Ze(()=>a.value&&!s.value),p=jo("layout-sider"),v=Ze(()=>[p,{[`${p}-light`]:e.value==="light",[`${p}-has-trigger`]:g.value,[`${p}-collapsed`]:n.value}]),m=Ze(()=>{const{width:S,collapsedWidth:M}=r,k=c.value?M:S;return zl(k)?`${k}px`:String(k)}),b=Ze(()=>[`${p}-trigger`,{[`${p}-trigger-light`]:e.value==="light"}]),w=()=>{const S=!c.value;h(S),t("update:collapsed",S),t("collapse",S,"clickTrigger")};nq(o,S=>{const M=!S;M!==c.value&&(h(M),t("update:collapsed",M),t("collapse",M,"responsive"),t("breakpoint",M))});const x=rq("__arco_layout_sider"),_=uj(Gj,void 0);return Tc(()=>{var S;(S=_==null?void 0:_.onSiderMount)==null||S.call(_,x)}),_x(()=>{var S;(S=_==null?void 0:_.onSiderUnMount)==null||S.call(_,x)}),cj(Vj,Rl({theme:e,collapsed:c,collapsedWidth:l})),{componentTag:d,prefixCls:p,classNames:v,triggerClassNames:b,localCollapsed:c,siderWidth:m,showTrigger:g,toggleTrigger:w}}});const aq={key:0},sq={key:1};function oq(r,t,e,n,i,a){const s=_o("IconLeft"),o=_o("IconRight");return $t(),dn(gR(r.componentTag),fR({class:r.classNames,style:{width:r.siderWidth}},r.resizeDirections?{directions:r.resizeDirections}:{}),{default:ve(()=>[un("div",{class:Mr(`${r.prefixCls}-children`)},[Da(r.$slots,"default")],2),r.showTrigger?($t(),Ve("div",{key:0,class:Mr(r.triggerClassNames),style:kc({width:r.siderWidth}),onClick:t[0]||(t[0]=(...l)=>r.toggleTrigger&&r.toggleTrigger(...l))},[Da(r.$slots,"trigger",{collapsed:r.localCollapsed},()=>[r.reverseArrow?($t(),Ve("div",sq,[r.localCollapsed?($t(),dn(s,{key:0})):($t(),dn(o,{key:1}))])):($t(),Ve("div",aq,[r.localCollapsed?($t(),dn(o,{key:1})):($t(),dn(s,{key:0}))]))])],6)):Ds("v-if",!0)]),_:3},16,["class","style"])}var lq=Gs(iq,[["render",oq]]);const uq=Ws({name:"Skeleton",props:{loading:{type:Boolean,default:!0},animation:{type:Boolean,default:!1}},setup(r){const t=jo("skeleton"),e=Ze(()=>[t,{[`${t}-animation`]:r.animation}]);return{prefixCls:t,cls:e}}});function cq(r,t,e,n,i,a){return $t(),Ve("div",{class:Mr(r.cls)},[r.loading?Da(r.$slots,"default",{key:0}):Da(r.$slots,"content",{key:1})],2)}var lv=Gs(uq,[["render",cq]]);const hq=Ws({name:"SkeletonLine",props:{rows:{type:Number,default:1},widths:{type:Array,default:()=>[]},lineHeight:{type:Number,default:20},lineSpacing:{type:Number,default:15}},setup(r){const t=jo("skeleton-line"),e=[];for(let n=0;n<r.rows;n++){const i={};zl(r.widths[n])?i.width=`${r.widths[n]}px`:mj(r.widths[n])&&(i.width=String(r.widths[n])),i.height=`${r.lineHeight}px`,n>0&&(i.marginTop=`${r.lineSpacing}px`),e.push(i)}return{prefixCls:t,lines:e}}});function dq(r,t,e,n,i,a){return $t(!0),Ve(oc,null,eg(r.lines,(s,o)=>($t(),Ve("ul",{key:o,class:Mr(r.prefixCls)},[un("li",{class:Mr(`${r.prefixCls}-row`),style:kc(s)},null,6)],2))),128)}var Xd=Gs(hq,[["render",dq]]);const fq=Ws({name:"SkeletonShape",props:{shape:{type:String,default:"square"},size:{type:String,default:"medium"}},setup(r){const t=jo("skeleton-shape"),e=Ze(()=>[t,`${t}-${r.shape}`,`${t}-${r.size}`]);return{prefixCls:t,cls:e}}});function gq(r,t,e,n,i,a){return $t(),Ve("div",{class:Mr(r.cls)},null,2)}var uv=Gs(fq,[["render",gq]]);const pq=Object.assign(lv,{Line:Xd,Shape:uv,install:(r,t)=>{vR(r,t);const e=mR(t);r.component(e+lv.name,lv),r.component(e+Xd.name,Xd),r.component(e+uv.name,uv)}}),vq={key:1,class:"no-data"},mq={__name:"Sidebar",emits:["updateCheckedList","initSelectedKeys"],setup(r,{emit:t}){const e=ce(!1),n=ce([]),i=ce([]),a=ce([]),s=t,o=async()=>{e.value=!0;try{const{data:{rows:u}}=await pj();n.value=u,i.value=u.map(c=>c.id),s("initSelectedKeys",["9aa72c1cc2a311ef8d280242ac1b0006","da47dcbaea9711ef94400242ac120006"])}catch(u){console.error(u)}finally{e.value=!1}};Tc(()=>{o()});const l=u=>{i.value=u,s("updateCheckedList",u)};return(u,c)=>{const h=gj,d=hR,g=lq;return $t(),dn(g,{width:"18%"},{default:ve(()=>[ae(d,{loading:e.value},{default:ve(()=>[n.value.length?($t(),dn(h,{key:0,class:"tree",data:n.value,checkable:"","checked-keys":i.value,"selected-keys":a.value,"field-names":{title:"name",key:"id"},onCheck:l},null,8,["data","checked-keys","selected-keys"])):($t(),Ve("div",vq,"暂无数据"))]),_:1},8,["loading"])]),_:1})}}},yq=$o(mq,[["__scopeId","data-v-b1e181e8"]]),bq="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M6.66667%2010H13.3333M6.5%2017.5H13.5C14.9001%2017.5%2015.6002%2017.5%2016.135%2017.2275C16.6054%2016.9878%2016.9878%2016.6054%2017.2275%2016.135C17.5%2015.6002%2017.5%2014.9001%2017.5%2013.5V6.5C17.5%205.09987%2017.5%204.3998%2017.2275%203.86502C16.9878%203.39462%2016.6054%203.01217%2016.135%202.77248C15.6002%202.5%2014.9001%202.5%2013.5%202.5H6.5C5.09987%202.5%204.3998%202.5%203.86502%202.77248C3.39462%203.01217%203.01217%203.39462%202.77248%203.86502C2.5%204.3998%202.5%205.09987%202.5%206.5V13.5C2.5%2014.9001%202.5%2015.6002%202.77248%2016.135C3.01217%2016.6054%203.39462%2016.9878%203.86502%2017.2275C4.3998%2017.5%205.09987%2017.5%206.5%2017.5Z'%20stroke='%237F56D9'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20/%3e%3c/svg%3e",wq=["src"],xq={__name:"RetrievalDocuments",props:{documents:String},emits:"onFilesSelected",setup(r,{emit:t}){const{t:e}=yj(),n=t,i=ce([]),a=ce([]),s=Rl({type:"checkbox",showCheckedAll:!0,onlyCurrent:!1}),o={pageSize:10},l=c=>{i.value=c},u=c=>{n("onFilesSelected",c),l(c)};return(c,h)=>{const d=tg,g=aj,p=_o("icon-eye"),v=yR,m=Tj,b=ij,w=Mj,x=kj;return $t(),dn(x,{class:"selectFilesCollapse"},{default:ve(()=>[($t(),dn(w,{key:1},{"expand-icon":ve(({active:_})=>[un("img",{src:ps(bq),style:kc({transform:_?"rotate(180deg)":"rotate(0deg)"})},null,12,wq)]),header:ve(()=>[ae(d,null,{default:ve(()=>[pR(uf(i.value.length)+"/"+uf(r.documents.length)+" 选定文件 ",1)]),_:1})]),default:ve(()=>[ae(b,{data:r.documents,onSelect:u,rowKey:"doc_id","show-header":!1,bordered:!1,"row-selection":s,selectedKeys:a.value,"onUpdate:selectedKeys":h[0]||(h[0]=_=>a.value=_),pagination:o},{columns:ve(()=>[ae(g,{"data-index":"doc_name"}),ae(g,{"data-index":"count",width:"80"}),ae(g,{width:"80"},{cell:ve(({record:_})=>[ae(m,{content:"预览"},{default:ve(()=>[ae(v,{type:"text"},{default:ve(()=>[ae(p)]),_:1})]),_:1})]),_:1})]),_:1},8,["data","row-selection","selectedKeys"])]),_:1}))]),_:1})}}},Eq=$o(xq,[["__scopeId","data-v-3ab2f0fc"]]),_q={class:"markdown-content"},Sq=["innerHTML"],Mq={__name:"MarkdownContent",props:{content:String},setup(r){const t=r,e=Ze(()=>Q$(t.content||""));return(n,i)=>{const a=Xd,s=tg,o=pq;return $t(),Ve("div",_q,[i[0]||(i[0]=un("div",{class:"header"},[un("img",{src:Oj,alt:"Logo",class:"logo"}),un("h3",null,"智能回答")],-1)),r.content?($t(),Ve("div",{key:0,innerHTML:e.value,class:"content"},null,8,Sq)):($t(),dn(o,{key:1,class:"content",animation:!0},{default:ve(()=>[ae(s,{direction:"vertical",style:{width:"100%"},size:"large"},{default:ve(()=>[ae(a,{rows:3})]),_:1})]),_:1}))])}}},kq=$o(Mq,[["__scopeId","data-v-be9ee3d1"]]),Tq="电力维修",Oq=[{id:"电力维修的资质要求",children:[{id:"资质等级",children:[{id:"分为一级、二级、三级、四级和五级,五级是初级,一级资质最高"}]},{id:"资质申请材料",children:[{id:"包括许可证申请表、法人证明材料和净资产证明材料、主要设备及机具清单、经营场所证明材料、主要负责人的简历、专业技术任职资格证书等有关证明材料、工程技术人员、经济管理人员明细表及其专业技术任职资格证明文件、电工作业人员登记表"}]}]},{id:"申请材料提交",children:[{id:"申请人确定申请事项并根据填报要求网上提交或提供书面申请材料"}]},{id:"申请材料审查",children:[{id:"国家能源局派出机构确定其是否符合法定许可条件和标准,对申请材料进行受理审查"}]},{id:"作出许可决定",children:[{id:"派出机构根据申请材料审查情况,作出准予许可或不予许可的决定"}]},{id:"许可证申请表",children:[{id:"详细填写企业的基本信息、申请的许可证类别和等级、企业的经营范围、技术能力和管理水平等"}]}],Cq={id:Tq,children:Oq};function R3(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),e.push.apply(e,n)}return e}function Ft(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?R3(Object(e),!0).forEach(function(n){bt(r,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):R3(Object(e)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(e,n))})}return r}function qt(r,t,e){return t=cf(t),bj(r,wj()?Reflect.construct(t,e||[],cf(r).constructor):t.apply(r,e))}var SR={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(e=!1));function i(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function a(l,u,c,h,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var g=new i(c,h||l,d),p=e?e+u:u;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],g]:l._events[p].push(g):(l._events[p]=g,l._eventsCount++),l}function s(l,u){--l._eventsCount===0?l._events=new n:delete l._events[u]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],c,h;if(this._eventsCount===0)return u;for(h in c=this._events)t.call(c,h)&&u.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},o.prototype.listeners=function(u){var c=e?e+u:u,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var d=0,g=h.length,p=new Array(g);d<g;d++)p[d]=h[d].fn;return p},o.prototype.listenerCount=function(u){var c=e?e+u:u,h=this._events[c];return h?h.fn?1:h.length:0},o.prototype.emit=function(u,c,h,d,g,p){var v=e?e+u:u;if(!this._events[v])return!1;var m=this._events[v],b=arguments.length,w,x;if(m.fn){switch(m.once&&this.removeListener(u,m.fn,void 0,!0),b){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,c),!0;case 3:return m.fn.call(m.context,c,h),!0;case 4:return m.fn.call(m.context,c,h,d),!0;case 5:return m.fn.call(m.context,c,h,d,g),!0;case 6:return m.fn.call(m.context,c,h,d,g,p),!0}for(x=1,w=new Array(b-1);x<b;x++)w[x-1]=arguments[x];m.fn.apply(m.context,w)}else{var _=m.length,S;for(x=0;x<_;x++)switch(m[x].once&&this.removeListener(u,m[x].fn,void 0,!0),b){case 1:m[x].fn.call(m[x].context);break;case 2:m[x].fn.call(m[x].context,c);break;case 3:m[x].fn.call(m[x].context,c,h);break;case 4:m[x].fn.call(m[x].context,c,h,d);break;default:if(!w)for(S=1,w=new Array(b-1);S<b;S++)w[S-1]=arguments[S];m[x].fn.apply(m[x].context,w)}}return!0},o.prototype.on=function(u,c,h){return a(this,u,c,h,!1)},o.prototype.once=function(u,c,h){return a(this,u,c,h,!0)},o.prototype.removeListener=function(u,c,h,d){var g=e?e+u:u;if(!this._events[g])return this;if(!c)return s(this,g),this;var p=this._events[g];if(p.fn)p.fn===c&&(!d||p.once)&&(!h||p.context===h)&&s(this,g);else{for(var v=0,m=[],b=p.length;v<b;v++)(p[v].fn!==c||d&&!p[v].once||h&&p[v].context!==h)&&m.push(p[v]);m.length?this._events[g]=m.length===1?m[0]:m:s(this,g)}return this},o.prototype.removeAllListeners=function(u){var c;return u?(c=e?e+u:u,this._events[c]&&s(this,c)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=e,o.EventEmitter=o,r.exports=o})(SR);var Aq=SR.exports;const MR=ng(Aq);var Ie=1e-6,gn=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var r=0,t=arguments.length;t--;)r+=arguments[t]*arguments[t];return Math.sqrt(r)});function kR(){var r=new gn(9);return gn!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function Pq(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[4],r[4]=t[5],r[5]=t[6],r[6]=t[8],r[7]=t[9],r[8]=t[10],r}function Nq(r,t,e,n,i,a,s,o,l){var u=new gn(9);return u[0]=r,u[1]=t,u[2]=e,u[3]=n,u[4]=i,u[5]=a,u[6]=s,u[7]=o,u[8]=l,u}function Se(){var r=new gn(16);return gn!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}function TR(r){var t=new gn(16);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t}function $l(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r}function OR(r,t,e,n,i,a,s,o,l,u,c,h,d,g,p,v){var m=new gn(16);return m[0]=r,m[1]=t,m[2]=e,m[3]=n,m[4]=i,m[5]=a,m[6]=s,m[7]=o,m[8]=l,m[9]=u,m[10]=c,m[11]=h,m[12]=d,m[13]=g,m[14]=p,m[15]=v,m}function rw(r,t,e,n,i,a,s,o,l,u,c,h,d,g,p,v,m){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r[4]=a,r[5]=s,r[6]=o,r[7]=l,r[8]=u,r[9]=c,r[10]=h,r[11]=d,r[12]=g,r[13]=p,r[14]=v,r[15]=m,r}function Bs(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function CR(r,t){if(r===t){var e=t[1],n=t[2],i=t[3],a=t[6],s=t[7],o=t[11];r[1]=t[4],r[2]=t[8],r[3]=t[12],r[4]=e,r[6]=t[9],r[7]=t[13],r[8]=n,r[9]=a,r[11]=t[14],r[12]=i,r[13]=s,r[14]=o}else r[0]=t[0],r[1]=t[4],r[2]=t[8],r[3]=t[12],r[4]=t[1],r[5]=t[5],r[6]=t[9],r[7]=t[13],r[8]=t[2],r[9]=t[6],r[10]=t[10],r[11]=t[14],r[12]=t[3],r[13]=t[7],r[14]=t[11],r[15]=t[15];return r}function Zi(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],g=t[11],p=t[12],v=t[13],m=t[14],b=t[15],w=e*o-n*s,x=e*l-i*s,_=e*u-a*s,S=n*l-i*o,M=n*u-a*o,k=i*u-a*l,T=c*v-h*p,P=c*m-d*p,O=c*b-g*p,A=h*m-d*v,R=h*b-g*v,L=d*b-g*m,q=w*L-x*R+_*A+S*O-M*P+k*T;return q?(q=1/q,r[0]=(o*L-l*R+u*A)*q,r[1]=(i*R-n*L-a*A)*q,r[2]=(v*k-m*M+b*S)*q,r[3]=(d*M-h*k-g*S)*q,r[4]=(l*O-s*L-u*P)*q,r[5]=(e*L-i*O+a*P)*q,r[6]=(m*_-p*k-b*x)*q,r[7]=(c*k-d*_+g*x)*q,r[8]=(s*R-o*O+u*T)*q,r[9]=(n*O-e*R-a*T)*q,r[10]=(p*M-v*_+b*w)*q,r[11]=(h*_-c*M-g*w)*q,r[12]=(o*P-s*A-l*T)*q,r[13]=(e*A-n*P+i*T)*q,r[14]=(v*x-p*S-m*w)*q,r[15]=(c*S-h*x+d*w)*q,r):null}function Rq(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],g=t[11],p=t[12],v=t[13],m=t[14],b=t[15];return r[0]=o*(d*b-g*m)-h*(l*b-u*m)+v*(l*g-u*d),r[1]=-(n*(d*b-g*m)-h*(i*b-a*m)+v*(i*g-a*d)),r[2]=n*(l*b-u*m)-o*(i*b-a*m)+v*(i*u-a*l),r[3]=-(n*(l*g-u*d)-o*(i*g-a*d)+h*(i*u-a*l)),r[4]=-(s*(d*b-g*m)-c*(l*b-u*m)+p*(l*g-u*d)),r[5]=e*(d*b-g*m)-c*(i*b-a*m)+p*(i*g-a*d),r[6]=-(e*(l*b-u*m)-s*(i*b-a*m)+p*(i*u-a*l)),r[7]=e*(l*g-u*d)-s*(i*g-a*d)+c*(i*u-a*l),r[8]=s*(h*b-g*v)-c*(o*b-u*v)+p*(o*g-u*h),r[9]=-(e*(h*b-g*v)-c*(n*b-a*v)+p*(n*g-a*h)),r[10]=e*(o*b-u*v)-s*(n*b-a*v)+p*(n*u-a*o),r[11]=-(e*(o*g-u*h)-s*(n*g-a*h)+c*(n*u-a*o)),r[12]=-(s*(h*m-d*v)-c*(o*m-l*v)+p*(o*d-l*h)),r[13]=e*(h*m-d*v)-c*(n*m-i*v)+p*(n*d-i*h),r[14]=-(e*(o*m-l*v)-s*(n*m-i*v)+p*(n*l-i*o)),r[15]=e*(o*d-l*h)-s*(n*d-i*h)+c*(n*l-i*o),r}function AR(r){var t=r[0],e=r[1],n=r[2],i=r[3],a=r[4],s=r[5],o=r[6],l=r[7],u=r[8],c=r[9],h=r[10],d=r[11],g=r[12],p=r[13],v=r[14],m=r[15],b=t*s-e*a,w=t*o-n*a,x=t*l-i*a,_=e*o-n*s,S=e*l-i*s,M=n*l-i*o,k=u*p-c*g,T=u*v-h*g,P=u*m-d*g,O=c*v-h*p,A=c*m-d*p,R=h*m-d*v;return b*R-w*A+x*O+_*P-S*T+M*k}function Jn(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=t[9],g=t[10],p=t[11],v=t[12],m=t[13],b=t[14],w=t[15],x=e[0],_=e[1],S=e[2],M=e[3];return r[0]=x*n+_*o+S*h+M*v,r[1]=x*i+_*l+S*d+M*m,r[2]=x*a+_*u+S*g+M*b,r[3]=x*s+_*c+S*p+M*w,x=e[4],_=e[5],S=e[6],M=e[7],r[4]=x*n+_*o+S*h+M*v,r[5]=x*i+_*l+S*d+M*m,r[6]=x*a+_*u+S*g+M*b,r[7]=x*s+_*c+S*p+M*w,x=e[8],_=e[9],S=e[10],M=e[11],r[8]=x*n+_*o+S*h+M*v,r[9]=x*i+_*l+S*d+M*m,r[10]=x*a+_*u+S*g+M*b,r[11]=x*s+_*c+S*p+M*w,x=e[12],_=e[13],S=e[14],M=e[15],r[12]=x*n+_*o+S*h+M*v,r[13]=x*i+_*l+S*d+M*m,r[14]=x*a+_*u+S*g+M*b,r[15]=x*s+_*c+S*p+M*w,r}function Ll(r,t,e){var n=e[0],i=e[1],a=e[2],s,o,l,u,c,h,d,g,p,v,m,b;return t===r?(r[12]=t[0]*n+t[4]*i+t[8]*a+t[12],r[13]=t[1]*n+t[5]*i+t[9]*a+t[13],r[14]=t[2]*n+t[6]*i+t[10]*a+t[14],r[15]=t[3]*n+t[7]*i+t[11]*a+t[15]):(s=t[0],o=t[1],l=t[2],u=t[3],c=t[4],h=t[5],d=t[6],g=t[7],p=t[8],v=t[9],m=t[10],b=t[11],r[0]=s,r[1]=o,r[2]=l,r[3]=u,r[4]=c,r[5]=h,r[6]=d,r[7]=g,r[8]=p,r[9]=v,r[10]=m,r[11]=b,r[12]=s*n+c*i+p*a+t[12],r[13]=o*n+h*i+v*a+t[13],r[14]=l*n+d*i+m*a+t[14],r[15]=u*n+g*i+b*a+t[15]),r}function PR(r,t,e){var n=e[0],i=e[1],a=e[2];return r[0]=t[0]*n,r[1]=t[1]*n,r[2]=t[2]*n,r[3]=t[3]*n,r[4]=t[4]*i,r[5]=t[5]*i,r[6]=t[6]*i,r[7]=t[7]*i,r[8]=t[8]*a,r[9]=t[9]*a,r[10]=t[10]*a,r[11]=t[11]*a,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r}function Lq(r,t,e,n){var i=n[0],a=n[1],s=n[2],o=Math.hypot(i,a,s),l,u,c,h,d,g,p,v,m,b,w,x,_,S,M,k,T,P,O,A,R,L,q,j;return o<Ie?null:(o=1/o,i*=o,a*=o,s*=o,l=Math.sin(e),u=Math.cos(e),c=1-u,h=t[0],d=t[1],g=t[2],p=t[3],v=t[4],m=t[5],b=t[6],w=t[7],x=t[8],_=t[9],S=t[10],M=t[11],k=i*i*c+u,T=a*i*c+s*l,P=s*i*c-a*l,O=i*a*c-s*l,A=a*a*c+u,R=s*a*c+i*l,L=i*s*c+a*l,q=a*s*c-i*l,j=s*s*c+u,r[0]=h*k+v*T+x*P,r[1]=d*k+m*T+_*P,r[2]=g*k+b*T+S*P,r[3]=p*k+w*T+M*P,r[4]=h*O+v*A+x*R,r[5]=d*O+m*A+_*R,r[6]=g*O+b*A+S*R,r[7]=p*O+w*A+M*R,r[8]=h*L+v*q+x*j,r[9]=d*L+m*q+_*j,r[10]=g*L+b*q+S*j,r[11]=p*L+w*q+M*j,t!==r&&(r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r)}function NR(r,t,e){var n=Math.sin(e),i=Math.cos(e),a=t[4],s=t[5],o=t[6],l=t[7],u=t[8],c=t[9],h=t[10],d=t[11];return t!==r&&(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[4]=a*i+u*n,r[5]=s*i+c*n,r[6]=o*i+h*n,r[7]=l*i+d*n,r[8]=u*i-a*n,r[9]=c*i-s*n,r[10]=h*i-o*n,r[11]=d*i-l*n,r}function RR(r,t,e){var n=Math.sin(e),i=Math.cos(e),a=t[0],s=t[1],o=t[2],l=t[3],u=t[8],c=t[9],h=t[10],d=t[11];return t!==r&&(r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=a*i-u*n,r[1]=s*i-c*n,r[2]=o*i-h*n,r[3]=l*i-d*n,r[8]=a*n+u*i,r[9]=s*n+c*i,r[10]=o*n+h*i,r[11]=l*n+d*i,r}function Iq(r,t,e){var n=Math.sin(e),i=Math.cos(e),a=t[0],s=t[1],o=t[2],l=t[3],u=t[4],c=t[5],h=t[6],d=t[7];return t!==r&&(r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=a*i+u*n,r[1]=s*i+c*n,r[2]=o*i+h*n,r[3]=l*i+d*n,r[4]=u*i-a*n,r[5]=c*i-s*n,r[6]=h*i-o*n,r[7]=d*i-l*n,r}function bs(r,t){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function po(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=t[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function LR(r,t,e){var n=e[0],i=e[1],a=e[2],s=Math.hypot(n,i,a),o,l,u;return s<Ie?null:(s=1/s,n*=s,i*=s,a*=s,o=Math.sin(t),l=Math.cos(t),u=1-l,r[0]=n*n*u+l,r[1]=i*n*u+a*o,r[2]=a*n*u-i*o,r[3]=0,r[4]=n*i*u-a*o,r[5]=i*i*u+l,r[6]=a*i*u+n*o,r[7]=0,r[8]=n*a*u+i*o,r[9]=i*a*u-n*o,r[10]=a*a*u+l,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function IR(r,t){var e=Math.sin(t),n=Math.cos(t);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=n,r[6]=e,r[7]=0,r[8]=0,r[9]=-e,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function DR(r,t){var e=Math.sin(t),n=Math.cos(t);return r[0]=n,r[1]=0,r[2]=-e,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=e,r[9]=0,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function iw(r,t){var e=Math.sin(t),n=Math.cos(t);return r[0]=n,r[1]=e,r[2]=0,r[3]=0,r[4]=-e,r[5]=n,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function FR(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=n+n,l=i+i,u=a+a,c=n*o,h=n*l,d=n*u,g=i*l,p=i*u,v=a*u,m=s*o,b=s*l,w=s*u;return r[0]=1-(g+v),r[1]=h+w,r[2]=d-b,r[3]=0,r[4]=h-w,r[5]=1-(c+v),r[6]=p+m,r[7]=0,r[8]=d+b,r[9]=p-m,r[10]=1-(c+g),r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function Dq(r,t){var e=new gn(3),n=-t[0],i=-t[1],a=-t[2],s=t[3],o=t[4],l=t[5],u=t[6],c=t[7],h=n*n+i*i+a*a+s*s;return h>0?(e[0]=(o*s+c*n+l*a-u*i)*2/h,e[1]=(l*s+c*i+u*n-o*a)*2/h,e[2]=(u*s+c*a+o*i-l*n)*2/h):(e[0]=(o*s+c*n+l*a-u*i)*2,e[1]=(l*s+c*i+u*n-o*a)*2,e[2]=(u*s+c*a+o*i-l*n)*2),FR(r,t,e),r}function hf(r,t){return r[0]=t[12],r[1]=t[13],r[2]=t[14],r}function jl(r,t){var e=t[0],n=t[1],i=t[2],a=t[4],s=t[5],o=t[6],l=t[8],u=t[9],c=t[10];return r[0]=Math.hypot(e,n,i),r[1]=Math.hypot(a,s,o),r[2]=Math.hypot(l,u,c),r}function df(r,t){var e=new gn(3);jl(e,t);var n=1/e[0],i=1/e[1],a=1/e[2],s=t[0]*n,o=t[1]*i,l=t[2]*a,u=t[4]*n,c=t[5]*i,h=t[6]*a,d=t[8]*n,g=t[9]*i,p=t[10]*a,v=s+c+p,m=0;return v>0?(m=Math.sqrt(v+1)*2,r[3]=.25*m,r[0]=(h-g)/m,r[1]=(d-l)/m,r[2]=(o-u)/m):s>c&&s>p?(m=Math.sqrt(1+s-c-p)*2,r[3]=(h-g)/m,r[0]=.25*m,r[1]=(o+u)/m,r[2]=(d+l)/m):c>p?(m=Math.sqrt(1+c-s-p)*2,r[3]=(d-l)/m,r[0]=(o+u)/m,r[1]=.25*m,r[2]=(h+g)/m):(m=Math.sqrt(1+p-s-c)*2,r[3]=(o-u)/m,r[0]=(d+l)/m,r[1]=(h+g)/m,r[2]=.25*m),r}function Fq(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3],l=i+i,u=a+a,c=s+s,h=i*l,d=i*u,g=i*c,p=a*u,v=a*c,m=s*c,b=o*l,w=o*u,x=o*c,_=n[0],S=n[1],M=n[2];return r[0]=(1-(p+m))*_,r[1]=(d+x)*_,r[2]=(g-w)*_,r[3]=0,r[4]=(d-x)*S,r[5]=(1-(h+m))*S,r[6]=(v+b)*S,r[7]=0,r[8]=(g+w)*M,r[9]=(v-b)*M,r[10]=(1-(h+p))*M,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function Ju(r,t,e,n,i){var a=t[0],s=t[1],o=t[2],l=t[3],u=a+a,c=s+s,h=o+o,d=a*u,g=a*c,p=a*h,v=s*c,m=s*h,b=o*h,w=l*u,x=l*c,_=l*h,S=n[0],M=n[1],k=n[2],T=i[0],P=i[1],O=i[2],A=(1-(v+b))*S,R=(g+_)*S,L=(p-x)*S,q=(g-_)*M,j=(1-(d+b))*M,$=(m+w)*M,B=(p+x)*k,F=(m-w)*k,V=(1-(d+v))*k;return r[0]=A,r[1]=R,r[2]=L,r[3]=0,r[4]=q,r[5]=j,r[6]=$,r[7]=0,r[8]=B,r[9]=F,r[10]=V,r[11]=0,r[12]=e[0]+T-(A*T+q*P+B*O),r[13]=e[1]+P-(R*T+j*P+F*O),r[14]=e[2]+O-(L*T+$*P+V*O),r[15]=1,r}function kx(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e+e,o=n+n,l=i+i,u=e*s,c=n*s,h=n*o,d=i*s,g=i*o,p=i*l,v=a*s,m=a*o,b=a*l;return r[0]=1-h-p,r[1]=c+b,r[2]=d-m,r[3]=0,r[4]=c-b,r[5]=1-u-p,r[6]=g+v,r[7]=0,r[8]=d+m,r[9]=g-v,r[10]=1-u-h,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function Bq(r,t,e,n,i,a,s){var o=1/(e-t),l=1/(i-n),u=1/(a-s);return r[0]=a*2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a*2*l,r[6]=0,r[7]=0,r[8]=(e+t)*o,r[9]=(i+n)*l,r[10]=(s+a)*u,r[11]=-1,r[12]=0,r[13]=0,r[14]=s*a*2*u,r[15]=0,r}function BR(r,t,e,n,i){var a=1/Math.tan(t/2),s;return r[0]=a/e,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(s=1/(n-i),r[10]=(i+n)*s,r[14]=2*i*n*s):(r[10]=-1,r[14]=-2*n),r}var zq=BR;function $q(r,t,e,n,i){var a=1/Math.tan(t/2),s;return r[0]=a/e,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(s=1/(n-i),r[10]=i*s,r[14]=i*n*s):(r[10]=-1,r[14]=-n),r}function jq(r,t,e,n){var i=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),s=Math.tan(t.leftDegrees*Math.PI/180),o=Math.tan(t.rightDegrees*Math.PI/180),l=2/(s+o),u=2/(i+a);return r[0]=l,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=u,r[6]=0,r[7]=0,r[8]=-((s-o)*l*.5),r[9]=(i-a)*u*.5,r[10]=n/(e-n),r[11]=-1,r[12]=0,r[13]=0,r[14]=n*e/(e-n),r[15]=0,r}function zR(r,t,e,n,i,a,s){var o=1/(t-e),l=1/(n-i),u=1/(a-s);return r[0]=-2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*u,r[11]=0,r[12]=(t+e)*o,r[13]=(i+n)*l,r[14]=(s+a)*u,r[15]=1,r}var $R=zR;function jR(r,t,e,n,i,a,s){var o=1/(t-e),l=1/(n-i),u=1/(a-s);return r[0]=-2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=u,r[11]=0,r[12]=(t+e)*o,r[13]=(i+n)*l,r[14]=a*u,r[15]=1,r}function qR(r,t,e,n){var i,a,s,o,l,u,c,h,d,g,p=t[0],v=t[1],m=t[2],b=n[0],w=n[1],x=n[2],_=e[0],S=e[1],M=e[2];return Math.abs(p-_)<Ie&&Math.abs(v-S)<Ie&&Math.abs(m-M)<Ie?Bs(r):(c=p-_,h=v-S,d=m-M,g=1/Math.hypot(c,h,d),c*=g,h*=g,d*=g,i=w*d-x*h,a=x*c-b*d,s=b*h-w*c,g=Math.hypot(i,a,s),g?(g=1/g,i*=g,a*=g,s*=g):(i=0,a=0,s=0),o=h*s-d*a,l=d*i-c*s,u=c*a-h*i,g=Math.hypot(o,l,u),g?(g=1/g,o*=g,l*=g,u*=g):(o=0,l=0,u=0),r[0]=i,r[1]=o,r[2]=c,r[3]=0,r[4]=a,r[5]=l,r[6]=h,r[7]=0,r[8]=s,r[9]=u,r[10]=d,r[11]=0,r[12]=-(i*p+a*v+s*m),r[13]=-(o*p+l*v+u*m),r[14]=-(c*p+h*v+d*m),r[15]=1,r)}function qq(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=n[0],l=n[1],u=n[2],c=i-e[0],h=a-e[1],d=s-e[2],g=c*c+h*h+d*d;g>0&&(g=1/Math.sqrt(g),c*=g,h*=g,d*=g);var p=l*d-u*h,v=u*c-o*d,m=o*h-l*c;return g=p*p+v*v+m*m,g>0&&(g=1/Math.sqrt(g),p*=g,v*=g,m*=g),r[0]=p,r[1]=v,r[2]=m,r[3]=0,r[4]=h*m-d*v,r[5]=d*p-c*m,r[6]=c*v-h*p,r[7]=0,r[8]=c,r[9]=h,r[10]=d,r[11]=0,r[12]=i,r[13]=a,r[14]=s,r[15]=1,r}function Wq(r){return"mat4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+", "+r[9]+", "+r[10]+", "+r[11]+", "+r[12]+", "+r[13]+", "+r[14]+", "+r[15]+")"}function Gq(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])}function Vq(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r[3]=t[3]+e[3],r[4]=t[4]+e[4],r[5]=t[5]+e[5],r[6]=t[6]+e[6],r[7]=t[7]+e[7],r[8]=t[8]+e[8],r[9]=t[9]+e[9],r[10]=t[10]+e[10],r[11]=t[11]+e[11],r[12]=t[12]+e[12],r[13]=t[13]+e[13],r[14]=t[14]+e[14],r[15]=t[15]+e[15],r}function WR(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r[3]=t[3]-e[3],r[4]=t[4]-e[4],r[5]=t[5]-e[5],r[6]=t[6]-e[6],r[7]=t[7]-e[7],r[8]=t[8]-e[8],r[9]=t[9]-e[9],r[10]=t[10]-e[10],r[11]=t[11]-e[11],r[12]=t[12]-e[12],r[13]=t[13]-e[13],r[14]=t[14]-e[14],r[15]=t[15]-e[15],r}function Hq(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r[3]=t[3]*e,r[4]=t[4]*e,r[5]=t[5]*e,r[6]=t[6]*e,r[7]=t[7]*e,r[8]=t[8]*e,r[9]=t[9]*e,r[10]=t[10]*e,r[11]=t[11]*e,r[12]=t[12]*e,r[13]=t[13]*e,r[14]=t[14]*e,r[15]=t[15]*e,r}function Uq(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r[2]=t[2]+e[2]*n,r[3]=t[3]+e[3]*n,r[4]=t[4]+e[4]*n,r[5]=t[5]+e[5]*n,r[6]=t[6]+e[6]*n,r[7]=t[7]+e[7]*n,r[8]=t[8]+e[8]*n,r[9]=t[9]+e[9]*n,r[10]=t[10]+e[10]*n,r[11]=t[11]+e[11]*n,r[12]=t[12]+e[12]*n,r[13]=t[13]+e[13]*n,r[14]=t[14]+e[14]*n,r[15]=t[15]+e[15]*n,r}function aw(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]&&r[6]===t[6]&&r[7]===t[7]&&r[8]===t[8]&&r[9]===t[9]&&r[10]===t[10]&&r[11]===t[11]&&r[12]===t[12]&&r[13]===t[13]&&r[14]===t[14]&&r[15]===t[15]}function Yq(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],s=r[4],o=r[5],l=r[6],u=r[7],c=r[8],h=r[9],d=r[10],g=r[11],p=r[12],v=r[13],m=r[14],b=r[15],w=t[0],x=t[1],_=t[2],S=t[3],M=t[4],k=t[5],T=t[6],P=t[7],O=t[8],A=t[9],R=t[10],L=t[11],q=t[12],j=t[13],$=t[14],B=t[15];return Math.abs(e-w)<=Ie*Math.max(1,Math.abs(e),Math.abs(w))&&Math.abs(n-x)<=Ie*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(i-_)<=Ie*Math.max(1,Math.abs(i),Math.abs(_))&&Math.abs(a-S)<=Ie*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(s-M)<=Ie*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(o-k)<=Ie*Math.max(1,Math.abs(o),Math.abs(k))&&Math.abs(l-T)<=Ie*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(u-P)<=Ie*Math.max(1,Math.abs(u),Math.abs(P))&&Math.abs(c-O)<=Ie*Math.max(1,Math.abs(c),Math.abs(O))&&Math.abs(h-A)<=Ie*Math.max(1,Math.abs(h),Math.abs(A))&&Math.abs(d-R)<=Ie*Math.max(1,Math.abs(d),Math.abs(R))&&Math.abs(g-L)<=Ie*Math.max(1,Math.abs(g),Math.abs(L))&&Math.abs(p-q)<=Ie*Math.max(1,Math.abs(p),Math.abs(q))&&Math.abs(v-j)<=Ie*Math.max(1,Math.abs(v),Math.abs(j))&&Math.abs(m-$)<=Ie*Math.max(1,Math.abs(m),Math.abs($))&&Math.abs(b-B)<=Ie*Math.max(1,Math.abs(b),Math.abs(B))}var GR=Jn,Xq=WR;const Kq=Object.freeze(Object.defineProperty({__proto__:null,add:Vq,adjoint:Rq,clone:TR,copy:$l,create:Se,determinant:AR,equals:Yq,exactEquals:aw,frob:Gq,fromQuat:kx,fromQuat2:Dq,fromRotation:LR,fromRotationTranslation:FR,fromRotationTranslationScale:Fq,fromRotationTranslationScaleOrigin:Ju,fromScaling:po,fromTranslation:bs,fromValues:OR,fromXRotation:IR,fromYRotation:DR,fromZRotation:iw,frustum:Bq,getRotation:df,getScaling:jl,getTranslation:hf,identity:Bs,invert:Zi,lookAt:qR,mul:GR,multiply:Jn,multiplyScalar:Hq,multiplyScalarAndAdd:Uq,ortho:$R,orthoNO:zR,orthoZO:jR,perspective:zq,perspectiveFromFieldOfView:jq,perspectiveNO:BR,perspectiveZO:$q,rotate:Lq,rotateX:NR,rotateY:RR,rotateZ:Iq,scale:PR,set:rw,str:Wq,sub:Xq,subtract:WR,targetTo:qq,translate:Ll,transpose:CR},Symbol.toStringTag,{value:"Module"}));function Qt(){var r=new gn(3);return gn!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Ea(r){var t=new gn(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t}function ka(r){var t=r[0],e=r[1],n=r[2];return Math.hypot(t,e,n)}function Ce(r,t,e){var n=new gn(3);return n[0]=r,n[1]=t,n[2]=e,n}function Ji(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r}function Kn(r,t,e,n){return r[0]=t,r[1]=e,r[2]=n,r}function As(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r}function sw(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r}function Zq(r,t,e){return r[0]=t[0]*e[0],r[1]=t[1]*e[1],r[2]=t[2]*e[2],r}function Jq(r,t,e){return r[0]=Math.min(t[0],e[0]),r[1]=Math.min(t[1],e[1]),r[2]=Math.min(t[2],e[2]),r}function Qq(r,t,e){return r[0]=Math.max(t[0],e[0]),r[1]=Math.max(t[1],e[1]),r[2]=Math.max(t[2],e[2]),r}function ff(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r}function tW(r,t){var e=t[0]-r[0],n=t[1]-r[1],i=t[2]-r[2];return Math.hypot(e,n,i)}function So(r,t){var e=t[0],n=t[1],i=t[2],a=e*e+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),r[0]=t[0]*a,r[1]=t[1]*a,r[2]=t[2]*a,r}function Qi(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]}function Kd(r,t,e){var n=t[0],i=t[1],a=t[2],s=e[0],o=e[1],l=e[2];return r[0]=i*l-a*o,r[1]=a*s-n*l,r[2]=n*o-i*s,r}function ow(r,t,e,n){var i=t[0],a=t[1],s=t[2];return r[0]=i+n*(e[0]-i),r[1]=a+n*(e[1]-a),r[2]=s+n*(e[2]-s),r}function Qn(r,t,e){var n=t[0],i=t[1],a=t[2],s=e[3]*n+e[7]*i+e[11]*a+e[15];return s=s||1,r[0]=(e[0]*n+e[4]*i+e[8]*a+e[12])/s,r[1]=(e[1]*n+e[5]*i+e[9]*a+e[13])/s,r[2]=(e[2]*n+e[6]*i+e[10]*a+e[14])/s,r}function eW(r,t,e){var n=t[0],i=t[1],a=t[2];return r[0]=n*e[0]+i*e[3]+a*e[6],r[1]=n*e[1]+i*e[4]+a*e[7],r[2]=n*e[2]+i*e[5]+a*e[8],r}function nW(r,t,e){var n=e[0],i=e[1],a=e[2],s=e[3],o=t[0],l=t[1],u=t[2],c=i*u-a*l,h=a*o-n*u,d=n*l-i*o,g=i*d-a*h,p=a*c-n*d,v=n*h-i*c,m=s*2;return c*=m,h*=m,d*=m,g*=2,p*=2,v*=2,r[0]=o+c+g,r[1]=l+h+p,r[2]=u+d+v,r}function _u(r,t){var e=r[0],n=r[1],i=r[2],a=t[0],s=t[1],o=t[2];return Math.abs(e-a)<=Ie*Math.max(1,Math.abs(e),Math.abs(a))&&Math.abs(n-s)<=Ie*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-o)<=Ie*Math.max(1,Math.abs(i),Math.abs(o))}var rW=sw,L3=tW,VR=ka;(function(){var r=Qt();return function(t,e,n,i,a,s){var o,l;for(e||(e=3),n||(n=0),i?l=Math.min(i*e+n,t.length):l=t.length,o=n;o<l;o+=e)r[0]=t[o],r[1]=t[o+1],r[2]=t[o+2],a(r,r,s),t[o]=r[0],t[o+1]=r[1],t[o+2]=r[2];return t}})();function ta(){var r=new gn(4);return gn!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function Iu(r,t,e,n){var i=new gn(4);return i[0]=r,i[1]=t,i[2]=e,i[3]=n,i}function iW(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r}function aW(r,t,e,n,i){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r}function sW(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e*e+n*n+i*i+a*a;return s>0&&(s=1/Math.sqrt(s)),r[0]=e*s,r[1]=n*s,r[2]=i*s,r[3]=a*s,r}function Pa(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3];return r[0]=e[0]*n+e[4]*i+e[8]*a+e[12]*s,r[1]=e[1]*n+e[5]*i+e[9]*a+e[13]*s,r[2]=e[2]*n+e[6]*i+e[10]*a+e[14]*s,r[3]=e[3]*n+e[7]*i+e[11]*a+e[15]*s,r}(function(){var r=ta();return function(t,e,n,i,a,s){var o,l;for(e||(e=4),n||(n=0),i?l=Math.min(i*e+n,t.length):l=t.length,o=n;o<l;o+=e)r[0]=t[o],r[1]=t[o+1],r[2]=t[o+2],r[3]=t[o+3],a(r,r,s),t[o]=r[0],t[o+1]=r[1],t[o+2]=r[2],t[o+3]=r[3];return t}})();function wn(){var r=new gn(4);return gn!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Es(r,t,e){e=e*.5;var n=Math.sin(e);return r[0]=n*t[0],r[1]=n*t[1],r[2]=n*t[2],r[3]=Math.cos(e),r}function Ps(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=e[0],l=e[1],u=e[2],c=e[3];return r[0]=n*c+s*o+i*u-a*l,r[1]=i*c+s*l+a*o-n*u,r[2]=a*c+s*u+n*l-i*o,r[3]=s*c-n*o-i*l-a*u,r}function cv(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3],l=e[0],u=e[1],c=e[2],h=e[3],d,g,p,v,m;return g=i*l+a*u+s*c+o*h,g<0&&(g=-g,l=-l,u=-u,c=-c,h=-h),1-g>Ie?(d=Math.acos(g),p=Math.sin(d),v=Math.sin((1-n)*d)/p,m=Math.sin(n*d)/p):(v=1-n,m=n),r[0]=v*i+m*l,r[1]=v*a+m*u,r[2]=v*s+m*c,r[3]=v*o+m*h,r}function hv(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e*e+n*n+i*i+a*a,o=s?1/s:0;return r[0]=-e*o,r[1]=-n*o,r[2]=-i*o,r[3]=a*o,r}function oW(r,t){var e=t[0]+t[4]+t[8],n;if(e>0)n=Math.sqrt(e+1),r[3]=.5*n,n=.5/n,r[0]=(t[5]-t[7])*n,r[1]=(t[6]-t[2])*n,r[2]=(t[1]-t[3])*n;else{var i=0;t[4]>t[0]&&(i=1),t[8]>t[i*3+i]&&(i=2);var a=(i+1)%3,s=(i+2)%3;n=Math.sqrt(t[i*3+i]-t[a*3+a]-t[s*3+s]+1),r[i]=.5*n,n=.5/n,r[3]=(t[a*3+s]-t[s*3+a])*n,r[a]=(t[a*3+i]+t[i*3+a])*n,r[s]=(t[s*3+i]+t[i*3+s])*n}return r}function jh(r,t,e,n){var i=.5*Math.PI/180;t*=i,e*=i,n*=i;var a=Math.sin(t),s=Math.cos(t),o=Math.sin(e),l=Math.cos(e),u=Math.sin(n),c=Math.cos(n);return r[0]=a*l*c-s*o*u,r[1]=s*o*c+a*l*u,r[2]=s*l*u-a*o*c,r[3]=s*l*c+a*o*u,r}var lW=Iu,qh=iW,I3=aW,D3=Ps,gf=sW;(function(){var r=Qt(),t=Ce(1,0,0),e=Ce(0,1,0);return function(n,i,a){var s=Qi(i,a);return s<-.999999?(Kd(r,t,i),VR(r)<1e-6&&Kd(r,e,i),So(r,r),Es(n,r,Math.PI),n):s>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Kd(r,i,a),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+s,gf(n,n))}})();(function(){var r=wn(),t=wn();return function(e,n,i,a,s,o){return cv(r,n,s,o),cv(t,i,a,o),cv(e,r,t,2*o*(1-o)),e}})();(function(){var r=kR();return function(t,e,n,i){return r[0]=n[0],r[3]=n[1],r[6]=n[2],r[1]=i[0],r[4]=i[1],r[7]=i[2],r[2]=-e[0],r[5]=-e[1],r[8]=-e[2],gf(t,oW(t,r))}})();function Tx(){var r=new gn(2);return gn!=Float32Array&&(r[0]=0,r[1]=0),r}function uW(r,t){return r[0]=t[0],r[1]=t[1],r}function cW(r,t,e){return r[0]=t,r[1]=e,r}function hW(r,t){var e=t[0],n=t[1],i=e*e+n*n;return i>0&&(i=1/Math.sqrt(i)),r[0]=t[0]*i,r[1]=t[1]*i,r}function dW(r,t){return r[0]*t[0]+r[1]*t[1]}function fW(r,t){return r[0]===t[0]&&r[1]===t[1]}(function(){var r=Tx();return function(t,e,n,i,a,s){var o,l;for(e||(e=2),n||(n=0),i?l=Math.min(i*e+n,t.length):l=t.length,o=n;o<l;o+=e)r[0]=t[o],r[1]=t[o+1],a(r,r,s),t[o]=r[0],t[o+1]=r[1];return t}})();var lc=function(r){return r!==null&&typeof r!="function"&&isFinite(r.length)},gW=function(r,t){return lc(r)?r.indexOf(t)>-1:!1},pW=function(r,t){if(!lc(r))return r;for(var e=[],n=0;n<r.length;n++){var i=r[n];t(i,n)&&e.push(i)}return e},vW=function(r,t){return t===void 0&&(t=[]),pW(r,function(e){return!gW(t,e)})};function Et(r){return typeof r=="function"}function kt(r){return r==null}function Xr(r){return Array.isArray(r)}const an=function(r){var t=typeof r;return r!==null&&t==="object"||t==="function"};function HR(r,t){if(r){var e;if(Xr(r))for(var n=0,i=r.length;n<i&&(e=t(r[n],n),e!==!1);n++);else if(an(r)){for(var a in r)if(r.hasOwnProperty(a)&&(e=t(r[a],a),e===!1))break}}}var lw=function(r){return typeof r=="object"&&r!==null},mW={}.toString,UR=function(r,t){return mW.call(r)==="[object "+t+"]"},ql=function(r){if(!lw(r)||!UR(r,"Object"))return!1;if(Object.getPrototypeOf(r)===null)return!0;for(var t=r;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(r)===t};function pf(r){if(!Array.isArray(r))return-1/0;var t=r.length;if(!t)return-1/0;for(var e=r[0],n=1;n<t;n++)e=Math.max(e,r[n]);return e}const vf=function(r){if(Xr(r))return r.reduce(function(t,e){return Math.min(t,e)},r[0])};var yW=function(r,t,e){if(!Xr(r)&&!ql(r))return r;var n=e;return HR(r,function(i,a){n=t(n,i,a)}),n};function oe(r){return typeof r=="string"}function bW(r,t){t===void 0&&(t=new Map);var e=[];if(Array.isArray(r))for(var n=0,i=r.length;n<i;n++){var a=r[n];t.has(a)||(e.push(a),t.set(a,!0))}return e}var wW=Object.prototype.hasOwnProperty;function rg(r,t){if(!t||!Xr(r))return{};for(var e={},n=Et(t)?t:function(o){return o[t]},i,a=0;a<r.length;a++){var s=r[a];i=n(s),wW.call(e,i)?e[i].push(s):e[i]=[s]}return e}var He=function(r,t,e){return r<t?t:r>e?e:r};function yt(r){return typeof r=="number"}var xW=1e-5;function Qu(r,t,e){return e===void 0&&(e=xW),r===t||Math.abs(r-t)<e}const EW=function(r,t){if(Xr(r)){for(var e,n=-1/0,i=0;i<r.length;i++){var a=r[i],s=Et(t)?t(a):a[t];s>n&&(e=a,n=s)}return e}},_W=function(r,t){if(Xr(r)){for(var e,n=1/0,i=0;i<r.length;i++){var a=r[i],s=Et(t)?t(a):a[t];s<n&&(e=a,n=s)}return e}};var YR=function(r,t){return(r%t+t)%t};const XR=function(r){return kt(r)?"":r.toString()};var SW=function(r){var t=XR(r);return t.charAt(0).toLowerCase()+t.substring(1)};function MW(r,t){return!r||!t?r:r.replace(/\\?\{([^{}]+)\}/g,function(e,n){return e.charAt(0)==="\\"?e.slice(1):t[n]===void 0?"":t[n]})}var mf=function(r){var t=XR(r);return t.charAt(0).toUpperCase()+t.substring(1)},kW={}.toString,TW=function(r){return kW.call(r).replace(/^\[object /,"").replace(/]$/,"")},yf=function(r){return UR(r,"Boolean")};function OW(r){return r instanceof Date}function CW(r){return r===null}var AW=Object.prototype,PW=function(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||AW;return r===e},Pt=function(r){return r===void 0},zs=function(r){if(typeof r!="object"||r===null)return r;var t;if(Xr(r)){t=[];for(var e=0,n=r.length;e<n;e++)typeof r[e]=="object"&&r[e]!=null?t[e]=zs(r[e]):t[e]=r[e]}else{t={};for(var i in r)typeof r[i]=="object"&&r[i]!=null?t[i]=zs(r[i]):t[i]=r[i]}return t};function Oc(r,t,e){var n;return function(){var i=this,a=arguments,s=function(){n=null,e||r.apply(i,a)},o=e&&!n;clearTimeout(n),n=setTimeout(s,t),o&&r.apply(i,a)}}function NW(r){var t,e,n,i=r||1;function a(o,l){++t>i&&(n=e,s(1),++t),e[o]=l}function s(o){t=0,e=Object.create(null),o||(n=Object.create(null))}return s(),{clear:s,has:function(o){return e[o]!==void 0||n[o]!==void 0},get:function(o){var l=e[o];if(l!==void 0)return l;if((l=n[o])!==void 0)return a(o,l),l},set:function(o,l){e[o]!==void 0?e[o]=l:a(o,l)}}}var dv=new Map;function uw(r,t,e){e===void 0&&(e=128);var n=function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var s=t?t.apply(this,i):i[0];dv.has(r)||dv.set(r,NW(e));var o=dv.get(r);if(o.has(s))return o.get(s);var l=r.apply(this,i);return o.set(s,l),l};return n}var RW=5;function LW(r,t){if(Object.hasOwn)return Object.hasOwn(r,t);if(r==null)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(r),t)}function KR(r,t,e,n){e=e||0,n=n||RW;for(var i in t)if(LW(t,i)){var a=t[i];a!==null&&ql(a)?(ql(r[i])||(r[i]={}),e<n?KR(r[i],a,e+1,n):r[i]=t[i]):Xr(a)?(r[i]=[],r[i]=r[i].concat(a)):a!==void 0&&(r[i]=a)}}var cr=function(r){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];for(var n=0;n<t.length;n+=1)KR(r,t[n]);return r},IW=Object.prototype.hasOwnProperty;function Ki(r){if(kt(r))return!0;if(lc(r))return!r.length;var t=TW(r);if(t==="Map"||t==="Set")return!r.size;if(PW(r))return!Object.keys(r).length;for(var e in r)if(IW.call(r,e))return!1;return!0}var Ue=function(r,t){if(r===t)return!0;if(!r||!t||oe(r)||oe(t))return!1;if(lc(r)||lc(t)){if(r.length!==t.length)return!1;for(var e=!0,n=0;n<r.length&&(e=Ue(r[n],t[n]),!!e);n++);return e}if(lw(r)||lw(t)){var i=Object.keys(r),a=Object.keys(t);if(i.length!==a.length)return!1;for(var e=!0,n=0;n<i.length&&(e=Ue(r[i[n]],t[i[n]]),!!e);n++);return e}return!1};const sr=function(r,t,e){for(var n=0,i=oe(t)?t.split("."):t;r&&n<i.length;)r=r[i[n++]];return r===void 0||n<i.length?e:r},uc=function(r,t,e){var n=r,i=oe(t)?t.split("."):t;return i.forEach(function(a,s){s<i.length-1?(an(n[a])||(n[a]=yt(i[s+1])?[]:{}),n=n[a]):n[a]=e}),r};var DW=Object.prototype.hasOwnProperty;const No=function(r,t){if(r===null||!ql(r))return{};var e={};return HR(t,function(n){DW.call(r,n)&&(e[n]=r[n])}),e},Ox=function(r,t){return yW(r,function(e,n,i){return t.includes(i)||(e[i]=n),e},{})},ZR=function(r,t,e){var n,i,a,s,o=0;e||(e={});var l=function(){o=e.leading===!1?0:Date.now(),n=null,s=r.apply(i,a),n||(i=a=null)},u=function(){var c=Date.now();!o&&e.leading===!1&&(o=c);var h=t-(c-o);return i=this,a=arguments,h<=0||h>t?(n&&(clearTimeout(n),n=null),o=c,s=r.apply(i,a),n||(i=a=null)):!n&&e.trailing!==!1&&(n=setTimeout(l,h)),s};return u.cancel=function(){clearTimeout(n),o=0,n=i=a=null},u};var Wh={};const FW=function(r){return r=r||"g",Wh[r]?Wh[r]+=1:Wh[r]=1,r+Wh[r]},fv=function(){},cw=function(r){return r};var hw=function(r,t){return hw=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])},hw(r,t)};function Ht(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");hw(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var et=function(){return et=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a])}return t},et.apply(this,arguments)};function Je(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e}function Vt(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})}function Cc(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function z(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),i,a=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(o){s={error:o}}finally{try{i&&!i.done&&(e=n.return)&&e.call(n)}finally{if(s)throw s.error}}return a}function BW(){for(var r=0,t=0,e=arguments.length;t<e;t++)r+=arguments[t].length;for(var n=Array(r),i=0,t=0;t<e;t++)for(var a=arguments[t],s=0,o=a.length;s<o;s++,i++)n[i]=a[s];return n}function vt(r,t,e){if(e||arguments.length===2)for(var n=0,i=t.length,a;n<i;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))}function gv(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)}var JR={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function zW(r,t,e){if(r[e].length>7){r[e].shift();for(var n=r[e],i=e;n.length;)t[e]="A",r.splice(i+=1,0,["C"].concat(n.splice(0,6)));r.splice(e,1)}}var tc={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function QR(r){return Array.isArray(r)&&r.every(function(t){var e=t[0].toLowerCase();return tc[e]===t.length-1&&"achlmqstvz".includes(e)})}function tL(r){return QR(r)&&r.every(function(t){var e=t[0];return e===e.toUpperCase()})}function eL(r){return tL(r)&&r.every(function(t){var e=t[0];return"ACLMQZ".includes(e)})}function F3(r){for(var t=r.pathValue[r.segmentStart],e=t.toLowerCase(),n=r.data;n.length>=tc[e]&&(e==="m"&&n.length>2?(r.segments.push([t].concat(n.splice(0,2))),e="l",t=t==="m"?"l":"L"):r.segments.push([t].concat(n.splice(0,tc[e]))),!!tc[e]););}function $W(r){var t=r.index,e=r.pathValue,n=e.charCodeAt(t);if(n===48){r.param=0,r.index+=1;return}if(n===49){r.param=1,r.index+=1;return}r.err='[path-util]: invalid Arc flag "'.concat(e[t],'", expecting 0 or 1 at index ').concat(t)}function jW(r){return r>=48&&r<=57||r===43||r===45||r===46}function fl(r){return r>=48&&r<=57}function qW(r){var t=r.max,e=r.pathValue,n=r.index,i=n,a=!1,s=!1,o=!1,l=!1,u;if(i>=t){r.err="[path-util]: Invalid path value at index ".concat(i,', "pathValue" is missing param');return}if(u=e.charCodeAt(i),(u===43||u===45)&&(i+=1,u=e.charCodeAt(i)),!fl(u)&&u!==46){r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(e[i],'" is not a number');return}if(u!==46){if(a=u===48,i+=1,u=e.charCodeAt(i),a&&i<t&&u&&fl(u)){r.err="[path-util]: Invalid path value at index ".concat(n,', "').concat(e[n],'" illegal number');return}for(;i<t&&fl(e.charCodeAt(i));)i+=1,s=!0;u=e.charCodeAt(i)}if(u===46){for(l=!0,i+=1;fl(e.charCodeAt(i));)i+=1,o=!0;u=e.charCodeAt(i)}if(u===101||u===69){if(l&&!s&&!o){r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(e[i],'" invalid float exponent');return}if(i+=1,u=e.charCodeAt(i),(u===43||u===45)&&(i+=1),i<t&&fl(e.charCodeAt(i)))for(;i<t&&fl(e.charCodeAt(i));)i+=1;else{r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(e[i],'" invalid integer exponent');return}}r.index=i,r.param=+r.pathValue.slice(n,i)}function WW(r){var t=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279];return r===10||r===13||r===8232||r===8233||r===32||r===9||r===11||r===12||r===160||r>=5760&&t.includes(r)}function Zd(r){for(var t=r.pathValue,e=r.max;r.index<e&&WW(t.charCodeAt(r.index));)r.index+=1}function GW(r){switch(r|32){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}function VW(r){return(r|32)===97}function HW(r){var t=r.max,e=r.pathValue,n=r.index,i=e.charCodeAt(n),a=tc[e[n].toLowerCase()];if(r.segmentStart=n,!GW(i)){r.err='[path-util]: Invalid path value "'.concat(e[n],'" is not a path command');return}if(r.index+=1,Zd(r),r.data=[],!a){F3(r);return}for(;;){for(var s=a;s>0;s-=1){if(VW(i)&&(s===3||s===4)?$W(r):qW(r),r.err.length)return;r.data.push(r.param),Zd(r),r.index<t&&e.charCodeAt(r.index)===44&&(r.index+=1,Zd(r))}if(r.index>=r.max||!jW(e.charCodeAt(r.index)))break}F3(r)}var UW=function(){function r(t){this.pathValue=t,this.segments=[],this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}return r}();function YW(r){if(QR(r))return[].concat(r);var t=new UW(r);for(Zd(t);t.index<t.max&&!t.err.length;)HW(t);return t.err?t.err:t.segments}function XW(r){if(tL(r))return[].concat(r);var t=YW(r),e=0,n=0,i=0,a=0;return t.map(function(s){var o=s.slice(1).map(Number),l=s[0],u=l.toUpperCase();if(l==="M")return e=o[0],n=o[1],i=e,a=n,["M",e,n];var c;if(l!==u)switch(u){case"A":c=[u,o[0],o[1],o[2],o[3],o[4],o[5]+e,o[6]+n];break;case"V":c=[u,o[0]+n];break;case"H":c=[u,o[0]+e];break;default:{var h=o.map(function(g,p){return g+(p%2?n:e)});c=[u].concat(h)}}else c=[u].concat(o);var d=c.length;switch(u){case"Z":e=i,n=a;break;case"H":e=c[1];break;case"V":n=c[1];break;default:e=c[d-2],n=c[d-1],u==="M"&&(i=e,a=n)}return c})}function KW(r,t){var e=r[0],n=t.x1,i=t.y1,a=t.x2,s=t.y2,o=r.slice(1).map(Number),l=r;if("TQ".includes(e)||(t.qx=null,t.qy=null),e==="H")l=["L",r[1],i];else if(e==="V")l=["L",n,r[1]];else if(e==="S"){var u=n*2-a,c=i*2-s;t.x1=u,t.y1=c,l=["C",u,c].concat(o)}else if(e==="T"){var h=n*2-t.qx,d=i*2-t.qy;t.qx=h,t.qy=d,l=["Q",h,d].concat(o)}else if(e==="Q"){var g=o[0],p=o[1];t.qx=g,t.qy=p}return l}function bf(r){if(eL(r))return[].concat(r);for(var t=XW(r),e=et({},JR),n=0;n<t.length;n+=1){t[n]=KW(t[n],e);var i=t[n],a=i.length;e.x1=+i[a-2],e.y1=+i[a-1],e.x2=+i[a-4]||e.x1,e.y2=+i[a-3]||e.y1}return t}function ZW(r){return eL(r)&&r.every(function(t){var e=t[0];return"MC".includes(e)})}function Gh(r,t,e){var n=r*Math.cos(e)-t*Math.sin(e),i=r*Math.sin(e)+t*Math.cos(e);return{x:n,y:i}}function Cx(r,t,e,n,i,a,s,o,l,u){var c=r,h=t,d=e,g=n,p=o,v=l,m=Math.PI*120/180,b=Math.PI/180*(+i||0),w=[],x,_,S,M,k;if(u)_=u[0],S=u[1],M=u[2],k=u[3];else{x=Gh(c,h,-b),c=x.x,h=x.y,x=Gh(p,v,-b),p=x.x,v=x.y;var T=(c-p)/2,P=(h-v)/2,O=T*T/(d*d)+P*P/(g*g);O>1&&(O=Math.sqrt(O),d*=O,g*=O);var A=d*d,R=g*g,L=(a===s?-1:1)*Math.sqrt(Math.abs((A*R-A*P*P-R*T*T)/(A*P*P+R*T*T)));M=L*d*P/g+(c+p)/2,k=L*-g*T/d+(h+v)/2,_=Math.asin(((h-k)/g*Math.pow(10,9)>>0)/Math.pow(10,9)),S=Math.asin(((v-k)/g*Math.pow(10,9)>>0)/Math.pow(10,9)),_=c<M?Math.PI-_:_,S=p<M?Math.PI-S:S,_<0&&(_=Math.PI*2+_),S<0&&(S=Math.PI*2+S),s&&_>S&&(_-=Math.PI*2),!s&&S>_&&(S-=Math.PI*2)}var q=S-_;if(Math.abs(q)>m){var j=S,$=p,B=v;S=_+m*(s&&S>_?1:-1),p=M+d*Math.cos(S),v=k+g*Math.sin(S),w=Cx(p,v,d,g,i,0,s,$,B,[S,j,M,k])}q=S-_;var F=Math.cos(_),V=Math.sin(_),X=Math.cos(S),K=Math.sin(S),dt=Math.tan(q/4),ct=4/3*d*dt,ht=4/3*g*dt,lt=[c,h],pt=[c+ct*V,h-ht*F],wt=[p+ct*K,v-ht*X],Bt=[p,v];if(pt[0]=2*lt[0]-pt[0],pt[1]=2*lt[1]-pt[1],u)return pt.concat(wt,Bt,w);w=pt.concat(wt,Bt,w);for(var Ut=[],Fe=0,Gn=w.length;Fe<Gn;Fe+=1)Ut[Fe]=Fe%2?Gh(w[Fe-1],w[Fe],b).y:Gh(w[Fe],w[Fe+1],b).x;return Ut}function JW(r,t,e,n,i,a){var s=.3333333333333333,o=2/3;return[s*r+o*e,s*t+o*n,s*i+o*e,s*a+o*n,i,a]}function ms(r,t,e){var n=r[0],i=r[1],a=t[0],s=t[1];return[n+(a-n)*e,i+(s-i)*e]}var B3=function(r,t,e,n){var i=.5,a=ms([r,t],[e,n],i);return vt(vt([],a,!0),[e,n,e,n],!1)};function QW(r,t){var e=r[0],n=r.slice(1).map(Number),i=n[0],a=n[1],s,o=t.x1,l=t.y1,u=t.x,c=t.y;switch("TQ".includes(e)||(t.qx=null,t.qy=null),e){case"M":return t.x=i,t.y=a,r;case"A":return s=[o,l].concat(n),["C"].concat(Cx(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8],s[9]));case"Q":return t.qx=i,t.qy=a,s=[o,l].concat(n),["C"].concat(JW(s[0],s[1],s[2],s[3],s[4],s[5]));case"L":return["C"].concat(B3(o,l,i,a));case"Z":return o===u&&l===c?["C",o,l,u,c,u,c]:["C"].concat(B3(o,l,u,c))}return r}function dw(r,t){if(t===void 0&&(t=!1),ZW(r)){var e=[].concat(r);return t?[e,[]]:e}for(var n=bf(r),i=et({},JR),a=[],s="",o=n.length,l,u,c=[],h=0;h<o;h+=1){n[h]&&(s=n[h][0]),a[h]=s;var d=QW(n[h],i);n[h]=d,zW(n,a,h),o=n.length,s==="Z"&&c.push(h),l=n[h],u=l.length,i.x1=+l[u-2],i.y1=+l[u-1],i.x2=+l[u-4]||i.x1,i.y2=+l[u-3]||i.y1}return t?[n,c]:n}function tG(r){return r.map(function(t){return Array.isArray(t)?[].concat(t):t})}function eG(r){var t=r.slice(1).map(function(e,n,i){return n?i[n-1].slice(-2).concat(e.slice(1)):r[0].slice(1).concat(e.slice(1))}).map(function(e){return e.map(function(n,i){return e[e.length-i-2*(1-i%2)]})}).reverse();return[["M"].concat(t[0].slice(0,2))].concat(t.map(function(e){return["C"].concat(e.slice(2))}))}function wr(r,t){return Math.sqrt((r[0]-t[0])*(r[0]-t[0])+(r[1]-t[1])*(r[1]-t[1]))}function fw(r,t,e,n,i){var a=wr([r,t],[e,n]),s={x:0,y:0};if(typeof i=="number")if(i<=0)s={x:r,y:t};else if(i>=a)s={x:e,y:n};else{var o=ms([r,t],[e,n],i/a),l=o[0],u=o[1];s={x:l,y:u}}return{length:a,point:s,min:{x:Math.min(r,e),y:Math.min(t,n)},max:{x:Math.max(r,e),y:Math.max(t,n)}}}function z3(r,t){var e=r.x,n=r.y,i=t.x,a=t.y,s=e*i+n*a,o=Math.sqrt((Math.pow(e,2)+Math.pow(n,2))*(Math.pow(i,2)+Math.pow(a,2))),l=e*a-n*i<0?-1:1,u=l*Math.acos(s/o);return u}function nG(r,t,e,n,i,a,s,o,l,u){var c=Math.abs,h=Math.sin,d=Math.cos,g=Math.sqrt,p=Math.PI,v=c(e),m=c(n),b=(i%360+360)%360,w=b*(p/180);if(r===o&&t===l)return{x:r,y:t};if(v===0||m===0)return fw(r,t,o,l,u).point;var x=(r-o)/2,_=(t-l)/2,S={x:d(w)*x+h(w)*_,y:-h(w)*x+d(w)*_},M=Math.pow(S.x,2)/Math.pow(v,2)+Math.pow(S.y,2)/Math.pow(m,2);M>1&&(v*=g(M),m*=g(M));var k=Math.pow(v,2)*Math.pow(m,2)-Math.pow(v,2)*Math.pow(S.y,2)-Math.pow(m,2)*Math.pow(S.x,2),T=Math.pow(v,2)*Math.pow(S.y,2)+Math.pow(m,2)*Math.pow(S.x,2),P=k/T;P=P<0?0:P;var O=(a!==s?1:-1)*g(P),A={x:O*(v*S.y/m),y:O*(-(m*S.x)/v)},R={x:d(w)*A.x-h(w)*A.y+(r+o)/2,y:h(w)*A.x+d(w)*A.y+(t+l)/2},L={x:(S.x-A.x)/v,y:(S.y-A.y)/m},q=z3({x:1,y:0},L),j={x:(-S.x-A.x)/v,y:(-S.y-A.y)/m},$=z3(L,j);!s&&$>0?$-=2*p:s&&$<0&&($+=2*p),$%=2*p;var B=q+$*u,F=v*d(B),V=m*h(B),X={x:d(w)*F-h(w)*V+R.x,y:h(w)*F+d(w)*V+R.y};return X}function rG(r,t,e,n,i,a,s,o,l,u,c){var h,d=c.bbox,g=d===void 0?!0:d,p=c.length,v=p===void 0?!0:p,m=c.sampleSize,b=m===void 0?30:m,w=typeof u=="number",x=r,_=t,S=0,M=[x,_,S],k=[x,_],T=0,P={x:0,y:0},O=[{x,y:_}];w&&u<=0&&(P={x,y:_});for(var A=0;A<=b;A+=1){if(T=A/b,h=nG(r,t,e,n,i,a,s,o,l,T),x=h.x,_=h.y,g&&O.push({x,y:_}),v&&(S+=wr(k,[x,_])),k=[x,_],w&&S>=u&&u>M[2]){var R=(S-u)/(S-M[2]);P={x:k[0]*(1-R)+M[0]*R,y:k[1]*(1-R)+M[1]*R}}M=[x,_,S]}return w&&u>=S&&(P={x:o,y:l}),{length:S,point:P,min:{x:Math.min.apply(null,O.map(function(L){return L.x})),y:Math.min.apply(null,O.map(function(L){return L.y}))},max:{x:Math.max.apply(null,O.map(function(L){return L.x})),y:Math.max.apply(null,O.map(function(L){return L.y}))}}}function iG(r,t,e,n,i,a,s,o,l){var u=1-l;return{x:Math.pow(u,3)*r+3*Math.pow(u,2)*l*e+3*u*Math.pow(l,2)*i+Math.pow(l,3)*s,y:Math.pow(u,3)*t+3*Math.pow(u,2)*l*n+3*u*Math.pow(l,2)*a+Math.pow(l,3)*o}}function nL(r,t,e,n,i,a,s,o,l,u){var c,h=u.bbox,d=h===void 0?!0:h,g=u.length,p=g===void 0?!0:g,v=u.sampleSize,m=v===void 0?10:v,b=typeof l=="number",w=r,x=t,_=0,S=[w,x,_],M=[w,x],k=0,T={x:0,y:0},P=[{x:w,y:x}];b&&l<=0&&(T={x:w,y:x});for(var O=0;O<=m;O+=1){if(k=O/m,c=iG(r,t,e,n,i,a,s,o,k),w=c.x,x=c.y,d&&P.push({x:w,y:x}),p&&(_+=wr(M,[w,x])),M=[w,x],b&&_>=l&&l>S[2]){var A=(_-l)/(_-S[2]);T={x:M[0]*(1-A)+S[0]*A,y:M[1]*(1-A)+S[1]*A}}S=[w,x,_]}return b&&l>=_&&(T={x:s,y:o}),{length:_,point:T,min:{x:Math.min.apply(null,P.map(function(R){return R.x})),y:Math.min.apply(null,P.map(function(R){return R.y}))},max:{x:Math.max.apply(null,P.map(function(R){return R.x})),y:Math.max.apply(null,P.map(function(R){return R.y}))}}}function aG(r,t,e,n,i,a,s){var o=1-s;return{x:Math.pow(o,2)*r+2*o*s*e+Math.pow(s,2)*i,y:Math.pow(o,2)*t+2*o*s*n+Math.pow(s,2)*a}}function sG(r,t,e,n,i,a,s,o){var l,u=o.bbox,c=u===void 0?!0:u,h=o.length,d=h===void 0?!0:h,g=o.sampleSize,p=g===void 0?10:g,v=typeof s=="number",m=r,b=t,w=0,x=[m,b,w],_=[m,b],S=0,M={x:0,y:0},k=[{x:m,y:b}];v&&s<=0&&(M={x:m,y:b});for(var T=0;T<=p;T+=1){if(S=T/p,l=aG(r,t,e,n,i,a,S),m=l.x,b=l.y,c&&k.push({x:m,y:b}),d&&(w+=wr(_,[m,b])),_=[m,b],v&&w>=s&&s>x[2]){var P=(w-s)/(w-x[2]);M={x:_[0]*(1-P)+x[0]*P,y:_[1]*(1-P)+x[1]*P}}x=[m,b,w]}return v&&s>=w&&(M={x:i,y:a}),{length:w,point:M,min:{x:Math.min.apply(null,k.map(function(O){return O.x})),y:Math.min.apply(null,k.map(function(O){return O.y}))},max:{x:Math.max.apply(null,k.map(function(O){return O.x})),y:Math.max.apply(null,k.map(function(O){return O.y}))}}}function rL(r,t,e){for(var n,i,a,s,o,l,u=bf(r),c=typeof t=="number",h,d=[],g,p=0,v=0,m=0,b=0,w,x=[],_=[],S=0,M={x:0,y:0},k=M,T=M,P=M,O=0,A=0,R=u.length;A<R;A+=1)w=u[A],g=w[0],h=g==="M",d=h?d:[p,v].concat(w.slice(1)),h?(m=w[1],b=w[2],M={x:m,y:b},k=M,S=0,c&&t<.001&&(P=M)):g==="L"?(n=fw(d[0],d[1],d[2],d[3],(t||0)-O),S=n.length,M=n.min,k=n.max,T=n.point):g==="A"?(i=rG(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],d[8],(t||0)-O,e||{}),S=i.length,M=i.min,k=i.max,T=i.point):g==="C"?(a=nL(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],(t||0)-O,e||{}),S=a.length,M=a.min,k=a.max,T=a.point):g==="Q"?(s=sG(d[0],d[1],d[2],d[3],d[4],d[5],(t||0)-O,e||{}),S=s.length,M=s.min,k=s.max,T=s.point):g==="Z"&&(d=[p,v,m,b],o=fw(d[0],d[1],d[2],d[3],(t||0)-O),S=o.length,M=o.min,k=o.max,T=o.point),c&&O<t&&O+S>=t&&(P=T),_.push(k),x.push(M),O+=S,l=g!=="Z"?w.slice(-2):[m,b],p=l[0],v=l[1];return c&&t>=O&&(P={x:p,y:v}),{length:O,point:P,min:{x:Math.min.apply(null,x.map(function(L){return L.x})),y:Math.min.apply(null,x.map(function(L){return L.y}))},max:{x:Math.max.apply(null,_.map(function(L){return L.x})),y:Math.max.apply(null,_.map(function(L){return L.y}))}}}function oG(r,t){return rL(r,void 0,et(et({},t),{bbox:!1,length:!0})).length}function lG(r){var t=r.length,e=t-1;return r.map(function(n,i){return r.map(function(a,s){var o=i+s,l;return s===0||r[o]&&r[o][0]==="M"?(l=r[o],["M"].concat(l.slice(-2))):(o>=t&&(o-=e),r[o])})})}function uG(r,t){var e=r.length-1,n=[],i=0,a=0,s=lG(r);return s.forEach(function(o,l){r.slice(1).forEach(function(u,c){a+=wr(r[(l+c)%e].slice(-2),t[c%e].slice(-2))}),n[l]=a,a=0}),i=n.indexOf(Math.min.apply(null,n)),s[i]}function cG(r,t,e,n,i,a,s,o){return 3*((o-t)*(e+i)-(s-r)*(n+a)+n*(r-i)-e*(t-a)+o*(i+r/3)-s*(a+t/3))/20}function hG(r){var t=0,e=0,n=0;return dw(r).map(function(i){var a;switch(i[0]){case"M":return t=i[1],e=i[2],0;default:var s=i.slice(1),o=s[0],l=s[1],u=s[2],c=s[3],h=s[4],d=s[5];return n=cG(t,e,o,l,u,c,h,d),a=i.slice(-2),t=a[0],e=a[1],n}}).reduce(function(i,a){return i+a},0)}function $3(r){return hG(r)>=0}function dG(r,t,e){return rL(r,t,et(et({},e),{bbox:!1,length:!0})).point}function fG(r,t){t===void 0&&(t=.5);var e=r.slice(0,2),n=r.slice(2,4),i=r.slice(4,6),a=r.slice(6,8),s=ms(e,n,t),o=ms(n,i,t),l=ms(i,a,t),u=ms(s,o,t),c=ms(o,l,t),h=ms(u,c,t);return[["C"].concat(s,u,h),["C"].concat(c,l,a)]}function j3(r){return r.map(function(t,e,n){var i=e&&n[e-1].slice(-2).concat(t.slice(1)),a=e?nL(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],{bbox:!1}).length:0,s;return e?s=a?fG(i):[t,t]:s=[t],{s:t,ss:s,l:a}})}function iL(r,t,e){var n=j3(r),i=j3(t),a=n.length,s=i.length,o=n.filter(function(m){return m.l}).length,l=i.filter(function(m){return m.l}).length,u=n.filter(function(m){return m.l}).reduce(function(m,b){var w=b.l;return m+w},0)/o||0,c=i.filter(function(m){return m.l}).reduce(function(m,b){var w=b.l;return m+w},0)/l||0,h=e||Math.max(a,s),d=[u,c],g=[h-a,h-s],p=0,v=[n,i].map(function(m,b){return m.l===h?m.map(function(w){return w.s}):m.map(function(w,x){return p=x&&g[b]&&w.l>=d[b],g[b]-=p?1:0,p?w.ss:[w.s]}).flat()});return v[0].length===v[1].length?v:iL(v[0],v[1],h)}function gw(r){var t=document.createElement("div");t.innerHTML=r;var e=t.childNodes[0];return e&&t.contains(e)&&t.removeChild(e),e}function gG(r,t){for(;!{}.hasOwnProperty.call(r,t)&&(r=cf(r))!==null;);return r}function pw(){return pw=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(r,t,e){var n=gG(r,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?r:e):i.value}},pw.apply(null,arguments)}function q3(r,t,e,n){var i=pw(cf(r.prototype),t,e);return typeof i=="function"?function(a){return i.apply(e,a)}:i}function Fa(r,t,e,n){var i=r-e,a=t-n;return Math.sqrt(i*i+a*a)}function aL(r,t){var e=Math.min.apply(Math,vt([],z(r),!1)),n=Math.min.apply(Math,vt([],z(t),!1)),i=Math.max.apply(Math,vt([],z(r),!1)),a=Math.max.apply(Math,vt([],z(t),!1));return{x:e,y:n,width:i-e,height:a-n}}function pG(r,t,e){return Math.atan(-t/r*Math.tan(e))}function vG(r,t,e){return Math.atan(t/(r*Math.tan(e)))}function mG(r,t,e,n,i,a){return e*Math.cos(i)*Math.cos(a)-n*Math.sin(i)*Math.sin(a)+r}function yG(r,t,e,n,i,a){return e*Math.sin(i)*Math.cos(a)+n*Math.cos(i)*Math.sin(a)+t}function bG(r,t,e,n,i,a,s){for(var o=pG(e,n,i),l=1/0,u=-1/0,c=[a,s],h=-Math.PI*2;h<=Math.PI*2;h+=Math.PI){var d=o+h;a<s?a<d&&d<s&&c.push(d):s<d&&d<a&&c.push(d)}for(var h=0;h<c.length;h++){var g=mG(r,t,e,n,i,c[h]);g<l&&(l=g),g>u&&(u=g)}for(var p=vG(e,n,i),v=1/0,m=-1/0,b=[a,s],h=-Math.PI*2;h<=Math.PI*2;h+=Math.PI){var w=p+h;a<s?a<w&&w<s&&b.push(w):s<w&&w<a&&b.push(w)}for(var h=0;h<b.length;h++){var x=yG(r,t,e,n,i,b[h]);x<v&&(v=x),x>m&&(m=x)}return{x:l,y:v,width:u-l,height:m-v}}var wG=1e-4;function sL(r,t,e,n,i,a){var s=-1,o=1/0,l=[e,n],u=20;a&&a>200&&(u=a/10);for(var c=1/u,h=c/10,d=0;d<=u;d++){var g=d*c,p=[i.apply(void 0,vt([],z(r.concat([g])),!1)),i.apply(void 0,vt([],z(t.concat([g])),!1))],v=Fa(l[0],l[1],p[0],p[1]);v<o&&(s=g,o=v)}if(s===0)return{x:r[0],y:t[0]};if(s===1){var m=r.length;return{x:r[m-1],y:t[m-1]}}o=1/0;for(var d=0;d<32&&!(h<wG);d++){var b=s-h,w=s+h,p=[i.apply(void 0,vt([],z(r.concat([b])),!1)),i.apply(void 0,vt([],z(t.concat([b])),!1))],v=Fa(l[0],l[1],p[0],p[1]);if(b>=0&&v<o)s=b,o=v;else{var x=[i.apply(void 0,vt([],z(r.concat([w])),!1)),i.apply(void 0,vt([],z(t.concat([w])),!1))],_=Fa(l[0],l[1],x[0],x[1]);w<=1&&_<o?(s=w,o=_):h*=.5}}return{x:i.apply(void 0,vt([],z(r.concat([s])),!1)),y:i.apply(void 0,vt([],z(t.concat([s])),!1))}}function oL(r,t,e,n){return Fa(r,t,e,n)}function lL(r,t,e,n,i){return{x:(1-i)*r+i*e,y:(1-i)*t+i*n}}function xG(r,t,e,n,i,a){var s=[e-r,n-t];if(fW(s,[0,0]))return Math.sqrt((i-r)*(i-r)+(a-t)*(a-t));var o=[-s[1],s[0]];hW(o,o);var l=[i-r,a-t];return Math.abs(dW(l,o))}function vw(r,t,e,n,i){var a=1-i;return a*a*a*r+3*t*i*a*a+3*e*i*i*a+n*i*i*i}function W3(r,t,e,n){var i=-3*r+9*t-9*e+3*n,a=6*r-12*t+6*e,s=3*t-3*r,o=[],l,u,c;if(Qu(i,0))Qu(a,0)||(l=-s/a,l>=0&&l<=1&&o.push(l));else{var h=a*a-4*i*s;Qu(h,0)?o.push(-a/(2*i)):h>0&&(c=Math.sqrt(h),l=(-a+c)/(2*i),u=(-a-c)/(2*i),l>=0&&l<=1&&o.push(l),u>=0&&u<=1&&o.push(u))}return o}function EG(r,t,e,n,i,a,s,o){for(var l=[r,s],u=[t,o],c=W3(r,e,i,s),h=W3(t,n,a,o),d=0;d<c.length;d++)l.push(vw(r,e,i,s,c[d]));for(var d=0;d<h.length;d++)u.push(vw(t,n,a,o,h[d]));return aL(l,u)}function _G(r,t,e,n,i,a,s,o,l,u,c){return sL([r,e,i,s],[t,n,a,o],l,u,vw,c)}function G3(r,t,e,n,i,a,s,o,l,u,c){var h=_G(r,t,e,n,i,a,s,o,l,u,c);return Fa(h.x,h.y,l,u)}function SG(r){if(r.length<2)return 0;for(var t=0,e=0;e<r.length-1;e++){var n=r[e],i=r[e+1];t+=Fa(n[0],n[1],i[0],i[1])}return t}function MG(r){return SG(r)}function mw(r,t,e,n){var i=1-n;return i*i*r+2*n*i*t+n*n*e}function V3(r,t,e){var n=r+e-2*t;if(Qu(n,0))return[.5];var i=(r-t)/n;return i<=1&&i>=0?[i]:[]}function kG(r,t,e,n,i,a){var s=V3(r,e,i)[0],o=V3(t,n,a)[0],l=[r,i],u=[t,a];return s!==void 0&&l.push(mw(r,e,i,s)),o!==void 0&&u.push(mw(t,n,a,o)),aL(l,u)}function TG(r,t,e,n,i,a,s,o){return sL([r,e,i],[t,n,a],s,o,mw)}function OG(r,t,e,n,i,a,s,o){var l=TG(r,t,e,n,i,a,s,o);return Fa(l.x,l.y,s,o)}function $n(){$n=function(){return t};var r,t={},e=Object.prototype,n=e.hasOwnProperty,i=Object.defineProperty||function($,B,F){$[B]=F.value},a=typeof Symbol=="function"?Symbol:{},s=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u($,B,F){return Object.defineProperty($,B,{value:F,enumerable:!0,configurable:!0,writable:!0}),$[B]}try{u({},"")}catch{u=function(F,V,X){return F[V]=X}}function c($,B,F,V){var X=B&&B.prototype instanceof b?B:b,K=Object.create(X.prototype),dt=new q(V||[]);return i(K,"_invoke",{value:O($,F,dt)}),K}function h($,B,F){try{return{type:"normal",arg:$.call(B,F)}}catch(V){return{type:"throw",arg:V}}}t.wrap=c;var d="suspendedStart",g="suspendedYield",p="executing",v="completed",m={};function b(){}function w(){}function x(){}var _={};u(_,s,function(){return this});var S=Object.getPrototypeOf,M=S&&S(S(j([])));M&&M!==e&&n.call(M,s)&&(_=M);var k=x.prototype=b.prototype=Object.create(_);function T($){["next","throw","return"].forEach(function(B){u($,B,function(F){return this._invoke(B,F)})})}function P($,B){function F(X,K,dt,ct){var ht=h($[X],$,K);if(ht.type!=="throw"){var lt=ht.arg,pt=lt.value;return pt&&O3(pt)=="object"&&n.call(pt,"__await")?B.resolve(pt.__await).then(function(wt){F("next",wt,dt,ct)},function(wt){F("throw",wt,dt,ct)}):B.resolve(pt).then(function(wt){lt.value=wt,dt(lt)},function(wt){return F("throw",wt,dt,ct)})}ct(ht.arg)}var V;i(this,"_invoke",{value:function(K,dt){function ct(){return new B(function(ht,lt){F(K,dt,ht,lt)})}return V=V?V.then(ct,ct):ct()}})}function O($,B,F){var V=d;return function(X,K){if(V===p)throw Error("Generator is already running");if(V===v){if(X==="throw")throw K;return{value:r,done:!0}}for(F.method=X,F.arg=K;;){var dt=F.delegate;if(dt){var ct=A(dt,F);if(ct){if(ct===m)continue;return ct}}if(F.method==="next")F.sent=F._sent=F.arg;else if(F.method==="throw"){if(V===d)throw V=v,F.arg;F.dispatchException(F.arg)}else F.method==="return"&&F.abrupt("return",F.arg);V=p;var ht=h($,B,F);if(ht.type==="normal"){if(V=F.done?v:g,ht.arg===m)continue;return{value:ht.arg,done:F.done}}ht.type==="throw"&&(V=v,F.method="throw",F.arg=ht.arg)}}}function A($,B){var F=B.method,V=$.iterator[F];if(V===r)return B.delegate=null,F==="throw"&&$.iterator.return&&(B.method="return",B.arg=r,A($,B),B.method==="throw")||F!=="return"&&(B.method="throw",B.arg=new TypeError("The iterator does not provide a '"+F+"' method")),m;var X=h(V,$.iterator,B.arg);if(X.type==="throw")return B.method="throw",B.arg=X.arg,B.delegate=null,m;var K=X.arg;return K?K.done?(B[$.resultName]=K.value,B.next=$.nextLoc,B.method!=="return"&&(B.method="next",B.arg=r),B.delegate=null,m):K:(B.method="throw",B.arg=new TypeError("iterator result is not an object"),B.delegate=null,m)}function R($){var B={tryLoc:$[0]};1 in $&&(B.catchLoc=$[1]),2 in $&&(B.finallyLoc=$[2],B.afterLoc=$[3]),this.tryEntries.push(B)}function L($){var B=$.completion||{};B.type="normal",delete B.arg,$.completion=B}function q($){this.tryEntries=[{tryLoc:"root"}],$.forEach(R,this),this.reset(!0)}function j($){if($||$===""){var B=$[s];if(B)return B.call($);if(typeof $.next=="function")return $;if(!isNaN($.length)){var F=-1,V=function X(){for(;++F<$.length;)if(n.call($,F))return X.value=$[F],X.done=!1,X;return X.value=r,X.done=!0,X};return V.next=V}}throw new TypeError(O3($)+" is not iterable")}return w.prototype=x,i(k,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=u(x,l,"GeneratorFunction"),t.isGeneratorFunction=function($){var B=typeof $=="function"&&$.constructor;return!!B&&(B===w||(B.displayName||B.name)==="GeneratorFunction")},t.mark=function($){return Object.setPrototypeOf?Object.setPrototypeOf($,x):($.__proto__=x,u($,l,"GeneratorFunction")),$.prototype=Object.create(k),$},t.awrap=function($){return{__await:$}},T(P.prototype),u(P.prototype,o,function(){return this}),t.AsyncIterator=P,t.async=function($,B,F,V,X){X===void 0&&(X=Promise);var K=new P(c($,B,F,V),X);return t.isGeneratorFunction(B)?K:K.next().then(function(dt){return dt.done?dt.value:K.next()})},T(k),u(k,l,"Generator"),u(k,s,function(){return this}),u(k,"toString",function(){return"[object Generator]"}),t.keys=function($){var B=Object($),F=[];for(var V in B)F.push(V);return F.reverse(),function X(){for(;F.length;){var K=F.pop();if(K in B)return X.value=K,X.done=!1,X}return X.done=!0,X}},t.values=j,q.prototype={constructor:q,reset:function(B){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(L),!B)for(var F in this)F.charAt(0)==="t"&&n.call(this,F)&&!isNaN(+F.slice(1))&&(this[F]=r)},stop:function(){this.done=!0;var B=this.tryEntries[0].completion;if(B.type==="throw")throw B.arg;return this.rval},dispatchException:function(B){if(this.done)throw B;var F=this;function V(lt,pt){return dt.type="throw",dt.arg=B,F.next=lt,pt&&(F.method="next",F.arg=r),!!pt}for(var X=this.tryEntries.length-1;X>=0;--X){var K=this.tryEntries[X],dt=K.completion;if(K.tryLoc==="root")return V("end");if(K.tryLoc<=this.prev){var ct=n.call(K,"catchLoc"),ht=n.call(K,"finallyLoc");if(ct&&ht){if(this.prev<K.catchLoc)return V(K.catchLoc,!0);if(this.prev<K.finallyLoc)return V(K.finallyLoc)}else if(ct){if(this.prev<K.catchLoc)return V(K.catchLoc,!0)}else{if(!ht)throw Error("try statement without catch or finally");if(this.prev<K.finallyLoc)return V(K.finallyLoc)}}}},abrupt:function(B,F){for(var V=this.tryEntries.length-1;V>=0;--V){var X=this.tryEntries[V];if(X.tryLoc<=this.prev&&n.call(X,"finallyLoc")&&this.prev<X.finallyLoc){var K=X;break}}K&&(B==="break"||B==="continue")&&K.tryLoc<=F&&F<=K.finallyLoc&&(K=null);var dt=K?K.completion:{};return dt.type=B,dt.arg=F,K?(this.method="next",this.next=K.finallyLoc,m):this.complete(dt)},complete:function(B,F){if(B.type==="throw")throw B.arg;return B.type==="break"||B.type==="continue"?this.next=B.arg:B.type==="return"?(this.rval=this.arg=B.arg,this.method="return",this.next="end"):B.type==="normal"&&F&&(this.next=F),m},finish:function(B){for(var F=this.tryEntries.length-1;F>=0;--F){var V=this.tryEntries[F];if(V.finallyLoc===B)return this.complete(V.completion,V.afterLoc),L(V),m}},catch:function(B){for(var F=this.tryEntries.length-1;F>=0;--F){var V=this.tryEntries[F];if(V.tryLoc===B){var X=V.completion;if(X.type==="throw"){var K=X.arg;L(V)}return K}}throw Error("illegal catch attempt")},delegateYield:function(B,F,V){return this.delegate={iterator:j(B),resultName:F,nextLoc:V},this.method==="next"&&(this.arg=r),m}},t}function vo(r,t){var e=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!e){if(Array.isArray(r)||(e=xj(r))||t){e&&(r=e);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,s=!0,o=!1;return{s:function(){e=e.call(r)},n:function(){var u=e.next();return s=u.done,u},e:function(u){o=!0,a=u},f:function(){try{s||e.return==null||e.return()}finally{if(o)throw a}}}}function CG(r,t){if(r==null)return{};var e={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(t.indexOf(n)!==-1)continue;e[n]=r[n]}return e}function qo(r,t){if(r==null)return{};var e,n,i=CG(r,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(n=0;n<a.length;n++)e=a[n],t.indexOf(e)===-1&&{}.propertyIsEnumerable.call(r,e)&&(i[e]=r[e])}return i}/*!
- * @antv/g-lite
- * @description A core module for rendering engine implements DOM API.
- * @version 2.2.16
- * @date 1/23/2025, 8:31:51 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var AG=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},uL={exports:{}};(function(r,t){(function(e,n){r.exports=n()})(AG,function(){function e(S,M,k,T,P){n(S,M,k||0,T||S.length-1,P||a)}function n(S,M,k,T,P){for(;T>k;){if(T-k>600){var O=T-k+1,A=M-k+1,R=Math.log(O),L=.5*Math.exp(2*R/3),q=.5*Math.sqrt(R*L*(O-L)/O)*(A-O/2<0?-1:1),j=Math.max(k,Math.floor(M-A*L/O+q)),$=Math.min(T,Math.floor(M+(O-A)*L/O+q));n(S,M,j,$,P)}var B=S[M],F=k,V=T;for(i(S,k,M),P(S[T],B)>0&&i(S,k,T);F<V;){for(i(S,F,V),F++,V--;P(S[F],B)<0;)F++;for(;P(S[V],B)>0;)V--}P(S[k],B)===0?i(S,k,V):(V++,i(S,V,T)),V<=M&&(k=V+1),M<=V&&(T=V-1)}}function i(S,M,k){var T=S[M];S[M]=S[k],S[k]=T}function a(S,M){return S<M?-1:S>M?1:0}var s=function(M){M===void 0&&(M=9),this._maxEntries=Math.max(4,M),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()};s.prototype.all=function(){return this._all(this.data,[])},s.prototype.search=function(M){var k=this.data,T=[];if(!w(M,k))return T;for(var P=this.toBBox,O=[];k;){for(var A=0;A<k.children.length;A++){var R=k.children[A],L=k.leaf?P(R):R;w(M,L)&&(k.leaf?T.push(R):b(M,L)?this._all(R,T):O.push(R))}k=O.pop()}return T},s.prototype.collides=function(M){var k=this.data;if(!w(M,k))return!1;for(var T=[];k;){for(var P=0;P<k.children.length;P++){var O=k.children[P],A=k.leaf?this.toBBox(O):O;if(w(M,A)){if(k.leaf||b(M,A))return!0;T.push(O)}}k=T.pop()}return!1},s.prototype.load=function(M){if(!(M&&M.length))return this;if(M.length<this._minEntries){for(var k=0;k<M.length;k++)this.insert(M[k]);return this}var T=this._build(M.slice(),0,M.length-1,0);if(!this.data.children.length)this.data=T;else if(this.data.height===T.height)this._splitRoot(this.data,T);else{if(this.data.height<T.height){var P=this.data;this.data=T,T=P}this._insert(T,this.data.height-T.height-1,!0)}return this},s.prototype.insert=function(M){return M&&this._insert(M,this.data.height-1),this},s.prototype.clear=function(){return this.data=x([]),this},s.prototype.remove=function(M,k){if(!M)return this;for(var T=this.data,P=this.toBBox(M),O=[],A=[],R,L,q;T||O.length;){if(T||(T=O.pop(),L=O[O.length-1],R=A.pop(),q=!0),T.leaf){var j=o(M,T.children,k);if(j!==-1)return T.children.splice(j,1),O.push(T),this._condense(O),this}!q&&!T.leaf&&b(T,P)?(O.push(T),A.push(R),R=0,L=T,T=T.children[0]):L?(R++,T=L.children[R],q=!1):T=null}return this},s.prototype.toBBox=function(M){return M},s.prototype.compareMinX=function(M,k){return M.minX-k.minX},s.prototype.compareMinY=function(M,k){return M.minY-k.minY},s.prototype.toJSON=function(){return this.data},s.prototype.fromJSON=function(M){return this.data=M,this},s.prototype._all=function(M,k){for(var T=[];M;)M.leaf?k.push.apply(k,M.children):T.push.apply(T,M.children),M=T.pop();return k},s.prototype._build=function(M,k,T,P){var O=T-k+1,A=this._maxEntries,R;if(O<=A)return R=x(M.slice(k,T+1)),l(R,this.toBBox),R;P||(P=Math.ceil(Math.log(O)/Math.log(A)),A=Math.ceil(O/Math.pow(A,P-1))),R=x([]),R.leaf=!1,R.height=P;var L=Math.ceil(O/A),q=L*Math.ceil(Math.sqrt(A));_(M,k,T,q,this.compareMinX);for(var j=k;j<=T;j+=q){var $=Math.min(j+q-1,T);_(M,j,$,L,this.compareMinY);for(var B=j;B<=$;B+=L){var F=Math.min(B+L-1,$);R.children.push(this._build(M,B,F,P-1))}}return l(R,this.toBBox),R},s.prototype._chooseSubtree=function(M,k,T,P){for(;P.push(k),!(k.leaf||P.length-1===T);){for(var O=1/0,A=1/0,R=void 0,L=0;L<k.children.length;L++){var q=k.children[L],j=g(q),$=v(M,q)-j;$<A?(A=$,O=j<O?j:O,R=q):$===A&&j<O&&(O=j,R=q)}k=R||k.children[0]}return k},s.prototype._insert=function(M,k,T){var P=T?M:this.toBBox(M),O=[],A=this._chooseSubtree(P,this.data,k,O);for(A.children.push(M),c(A,P);k>=0&&O[k].children.length>this._maxEntries;)this._split(O,k),k--;this._adjustParentBBoxes(P,O,k)},s.prototype._split=function(M,k){var T=M[k],P=T.children.length,O=this._minEntries;this._chooseSplitAxis(T,O,P);var A=this._chooseSplitIndex(T,O,P),R=x(T.children.splice(A,T.children.length-A));R.height=T.height,R.leaf=T.leaf,l(T,this.toBBox),l(R,this.toBBox),k?M[k-1].children.push(R):this._splitRoot(T,R)},s.prototype._splitRoot=function(M,k){this.data=x([M,k]),this.data.height=M.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},s.prototype._chooseSplitIndex=function(M,k,T){for(var P,O=1/0,A=1/0,R=k;R<=T-k;R++){var L=u(M,0,R,this.toBBox),q=u(M,R,T,this.toBBox),j=m(L,q),$=g(L)+g(q);j<O?(O=j,P=R,A=$<A?$:A):j===O&&$<A&&(A=$,P=R)}return P||T-k},s.prototype._chooseSplitAxis=function(M,k,T){var P=M.leaf?this.compareMinX:h,O=M.leaf?this.compareMinY:d,A=this._allDistMargin(M,k,T,P),R=this._allDistMargin(M,k,T,O);A<R&&M.children.sort(P)},s.prototype._allDistMargin=function(M,k,T,P){M.children.sort(P);for(var O=this.toBBox,A=u(M,0,k,O),R=u(M,T-k,T,O),L=p(A)+p(R),q=k;q<T-k;q++){var j=M.children[q];c(A,M.leaf?O(j):j),L+=p(A)}for(var $=T-k-1;$>=k;$--){var B=M.children[$];c(R,M.leaf?O(B):B),L+=p(R)}return L},s.prototype._adjustParentBBoxes=function(M,k,T){for(var P=T;P>=0;P--)c(k[P],M)},s.prototype._condense=function(M){for(var k=M.length-1,T=void 0;k>=0;k--)M[k].children.length===0?k>0?(T=M[k-1].children,T.splice(T.indexOf(M[k]),1)):this.clear():l(M[k],this.toBBox)};function o(S,M,k){if(!k)return M.indexOf(S);for(var T=0;T<M.length;T++)if(k(S,M[T]))return T;return-1}function l(S,M){u(S,0,S.children.length,M,S)}function u(S,M,k,T,P){P||(P=x(null)),P.minX=1/0,P.minY=1/0,P.maxX=-1/0,P.maxY=-1/0;for(var O=M;O<k;O++){var A=S.children[O];c(P,S.leaf?T(A):A)}return P}function c(S,M){return S.minX=Math.min(S.minX,M.minX),S.minY=Math.min(S.minY,M.minY),S.maxX=Math.max(S.maxX,M.maxX),S.maxY=Math.max(S.maxY,M.maxY),S}function h(S,M){return S.minX-M.minX}function d(S,M){return S.minY-M.minY}function g(S){return(S.maxX-S.minX)*(S.maxY-S.minY)}function p(S){return S.maxX-S.minX+(S.maxY-S.minY)}function v(S,M){return(Math.max(M.maxX,S.maxX)-Math.min(M.minX,S.minX))*(Math.max(M.maxY,S.maxY)-Math.min(M.minY,S.minY))}function m(S,M){var k=Math.max(S.minX,M.minX),T=Math.max(S.minY,M.minY),P=Math.min(S.maxX,M.maxX),O=Math.min(S.maxY,M.maxY);return Math.max(0,P-k)*Math.max(0,O-T)}function b(S,M){return S.minX<=M.minX&&S.minY<=M.minY&&M.maxX<=S.maxX&&M.maxY<=S.maxY}function w(S,M){return M.minX<=S.maxX&&M.minY<=S.maxY&&M.maxX>=S.minX&&M.maxY>=S.minY}function x(S){return{children:S,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function _(S,M,k,T,P){for(var O=[M,k];O.length;)if(k=O.pop(),M=O.pop(),!(k-M<=T)){var A=M+Math.ceil((k-M)/T/2)*T;e(S,A,M,k,P),O.push(M,A,A,k)}}return s})})(uL);var PG=uL.exports,Q=function(r){return r.GROUP="g",r.FRAGMENT="fragment",r.CIRCLE="circle",r.ELLIPSE="ellipse",r.IMAGE="image",r.RECT="rect",r.LINE="line",r.POLYLINE="polyline",r.POLYGON="polygon",r.TEXT="text",r.PATH="path",r.HTML="html",r.MESH="mesh",r}({}),Jd=function(r){return r[r.ZERO=0]="ZERO",r[r.NEGATIVE_ONE=1]="NEGATIVE_ONE",r}({}),Vs=function(){function r(){at(this,r),this.plugins=[]}return it(r,[{key:"addRenderingPlugin",value:function(e){this.plugins.push(e),this.context.renderingPlugins.push(e)}},{key:"removeAllRenderingPlugins",value:function(){var e=this;this.plugins.forEach(function(n){var i=e.context.renderingPlugins.indexOf(n);i>=0&&e.context.renderingPlugins.splice(i,1)})}}])}(),NG=function(){function r(t){at(this,r),this.clipSpaceNearZ=Jd.NEGATIVE_ONE,this.plugins=[],this.config=Ft({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1,enableSizeAttenuation:!0,enableRenderingOptimization:!1},t)}return it(r,[{key:"registerPlugin",value:function(e){var n=this.plugins.findIndex(function(i){return i===e});n===-1&&this.plugins.push(e)}},{key:"unregisterPlugin",value:function(e){var n=this.plugins.findIndex(function(i){return i===e});n>-1&&this.plugins.splice(n,1)}},{key:"getPlugins",value:function(){return this.plugins}},{key:"getPlugin",value:function(e){return this.plugins.find(function(n){return n.name===e})}},{key:"getConfig",value:function(){return this.config}},{key:"setConfig",value:function(e){Object.assign(this.config,e)}}])}(),pv=As,gl=Ji,RG=Qq,LG=Jq,H3=ff,vv=rW,Me=function(){function r(){at(this,r),this.center=[0,0,0],this.halfExtents=[0,0,0],this.min=[0,0,0],this.max=[0,0,0]}return it(r,[{key:"update",value:function(e,n){gl(this.center,e),gl(this.halfExtents,n),vv(this.min,this.center,this.halfExtents),pv(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(e,n){pv(this.center,n,e),H3(this.center,this.center,.5),vv(this.halfExtents,n,e),H3(this.halfExtents,this.halfExtents,.5),gl(this.min,e),gl(this.max,n)}},{key:"getMin",value:function(){return this.min}},{key:"getMax",value:function(){return this.max}},{key:"add",value:function(e){if(!r.isEmpty(e)){if(r.isEmpty(this)){this.setMinMax(e.getMin(),e.getMax());return}var n=this.center,i=n[0],a=n[1],s=n[2],o=this.halfExtents,l=o[0],u=o[1],c=o[2],h=i-l,d=i+l,g=a-u,p=a+u,v=s-c,m=s+c,b=e.center,w=b[0],x=b[1],_=b[2],S=e.halfExtents,M=S[0],k=S[1],T=S[2],P=w-M,O=w+M,A=x-k,R=x+k,L=_-T,q=_+T;P<h&&(h=P),O>d&&(d=O),A<g&&(g=A),R>p&&(p=R),L<v&&(v=L),q>m&&(m=q),n[0]=(h+d)*.5,n[1]=(g+p)*.5,n[2]=(v+m)*.5,o[0]=(d-h)*.5,o[1]=(p-g)*.5,o[2]=(m-v)*.5,this.min[0]=h,this.min[1]=g,this.min[2]=v,this.max[0]=d,this.max[1]=p,this.max[2]=m}}},{key:"setFromTransformedAABB",value:function(e,n){var i=this.center,a=this.halfExtents,s=e.center,o=e.halfExtents,l=n[0],u=n[4],c=n[8],h=n[1],d=n[5],g=n[9],p=n[2],v=n[6],m=n[10],b=Math.abs(l),w=Math.abs(u),x=Math.abs(c),_=Math.abs(h),S=Math.abs(d),M=Math.abs(g),k=Math.abs(p),T=Math.abs(v),P=Math.abs(m);i[0]=n[12]+l*s[0]+u*s[1]+c*s[2],i[1]=n[13]+h*s[0]+d*s[1]+g*s[2],i[2]=n[14]+p*s[0]+v*s[1]+m*s[2],a[0]=b*o[0]+w*o[1]+x*o[2],a[1]=_*o[0]+S*o[1]+M*o[2],a[2]=k*o[0]+T*o[1]+P*o[2],vv(this.min,i,a),pv(this.max,i,a)}},{key:"intersects",value:function(e){var n=this.getMax(),i=this.getMin(),a=e.getMax(),s=e.getMin();return i[0]<=a[0]&&n[0]>=s[0]&&i[1]<=a[1]&&n[1]>=s[1]&&i[2]<=a[2]&&n[2]>=s[2]}},{key:"intersection",value:function(e){if(!this.intersects(e))return null;var n=new r,i=RG([0,0,0],this.getMin(),e.getMin()),a=LG([0,0,0],this.getMax(),e.getMax());return n.setMinMax(i,a),n}},{key:"getNegativeFarPoint",value:function(e){return e.pnVertexFlag===273?gl([0,0,0],this.min):e.pnVertexFlag===272?[this.min[0],this.min[1],this.max[2]]:e.pnVertexFlag===257?[this.min[0],this.max[1],this.min[2]]:e.pnVertexFlag===256?[this.min[0],this.max[1],this.max[2]]:e.pnVertexFlag===17?[this.max[0],this.min[1],this.min[2]]:e.pnVertexFlag===16?[this.max[0],this.min[1],this.max[2]]:e.pnVertexFlag===1?[this.max[0],this.max[1],this.min[2]]:[this.max[0],this.max[1],this.max[2]]}},{key:"getPositiveFarPoint",value:function(e){return e.pnVertexFlag===273?gl([0,0,0],this.max):e.pnVertexFlag===272?[this.max[0],this.max[1],this.min[2]]:e.pnVertexFlag===257?[this.max[0],this.min[1],this.max[2]]:e.pnVertexFlag===256?[this.max[0],this.min[1],this.min[2]]:e.pnVertexFlag===17?[this.min[0],this.max[1],this.max[2]]:e.pnVertexFlag===16?[this.min[0],this.max[1],this.min[2]]:e.pnVertexFlag===1?[this.min[0],this.min[1],this.max[2]]:[this.min[0],this.min[1],this.min[2]]}}],[{key:"isEmpty",value:function(e){return!e||e.halfExtents[0]===0&&e.halfExtents[1]===0&&e.halfExtents[2]===0}}])}(),IG=function(){function r(t,e){at(this,r),this.distance=t||0,this.normal=e||Ce(0,1,0),this.updatePNVertexFlag()}return it(r,[{key:"updatePNVertexFlag",value:function(){this.pnVertexFlag=(+(this.normal[0]>=0)<<8)+(+(this.normal[1]>=0)<<4)+ +(this.normal[2]>=0)}},{key:"distanceToPoint",value:function(e){return Qi(e,this.normal)-this.distance}},{key:"normalize",value:function(){var e=1/VR(this.normal);ff(this.normal,this.normal,e),this.distance*=e}},{key:"intersectsLine",value:function(e,n,i){var a=this.distanceToPoint(e),s=this.distanceToPoint(n),o=a/(a-s),l=o>=0&&o<=1;return l&&i&&ow(i,e,n,o),l}}])}(),pl=function(r){return r[r.OUTSIDE=4294967295]="OUTSIDE",r[r.INSIDE=0]="INSIDE",r[r.INDETERMINATE=2147483647]="INDETERMINATE",r}({}),DG=function(){function r(t){if(at(this,r),this.planes=[],t)this.planes=t;else for(var e=0;e<6;e++)this.planes.push(new IG)}return it(r,[{key:"extractFromVPMatrix",value:function(e){var n=Rt(e,16),i=n[0],a=n[1],s=n[2],o=n[3],l=n[4],u=n[5],c=n[6],h=n[7],d=n[8],g=n[9],p=n[10],v=n[11],m=n[12],b=n[13],w=n[14],x=n[15];Kn(this.planes[0].normal,o-i,h-l,v-d),this.planes[0].distance=x-m,Kn(this.planes[1].normal,o+i,h+l,v+d),this.planes[1].distance=x+m,Kn(this.planes[2].normal,o+a,h+u,v+g),this.planes[2].distance=x+b,Kn(this.planes[3].normal,o-a,h-u,v-g),this.planes[3].distance=x-b,Kn(this.planes[4].normal,o-s,h-c,v-p),this.planes[4].distance=x-w,Kn(this.planes[5].normal,o+s,h+c,v+p),this.planes[5].distance=x+w,this.planes.forEach(function(_){_.normalize(),_.updatePNVertexFlag()})}}])}(),Bn=function(){function r(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;at(this,r),this.x=0,this.y=0,this.x=t,this.y=e}return it(r,[{key:"clone",value:function(){return new r(this.x,this.y)}},{key:"copyFrom",value:function(e){this.x=e.x,this.y=e.y}}])}(),Wl=function(){function r(t,e,n,i){at(this,r),this.x=t,this.y=e,this.width=n,this.height=i,this.left=t,this.right=t+n,this.top=e,this.bottom=e+i}return it(r,[{key:"toJSON",value:function(){}}],[{key:"fromRect",value:function(e){return new r(e.x,e.y,e.width,e.height)}},{key:"applyTransform",value:function(e,n){var i=Iu(e.x,e.y,0,1),a=Iu(e.x+e.width,e.y,0,1),s=Iu(e.x,e.y+e.height,0,1),o=Iu(e.x+e.width,e.y+e.height,0,1),l=ta(),u=ta(),c=ta(),h=ta();Pa(l,i,n),Pa(u,a,n),Pa(c,s,n),Pa(h,o,n);var d=Math.min(l[0],u[0],c[0],h[0]),g=Math.min(l[1],u[1],c[1],h[1]),p=Math.max(l[0],u[0],c[0],h[0]),v=Math.max(l[1],u[1],c[1],h[1]);return r.fromRect({x:d,y:g,width:p-d,height:v-g})}}])}(),pe="Method not implemented.",vl="Use document.documentElement instead.",FG="Cannot append a destroyed element.";function Il(r){return r===void 0?0:r>360||r<-360?r%360:r}var mv=Qt();function ar(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;return Array.isArray(r)&&r.length===3?n?Ea(r):Ji(mv,r):yt(r)?n?Ce(r,t,e):Kn(mv,r,t,e):n?Ce(r[0],r[1]||t,r[2]||e):Kn(mv,r[0],r[1]||t,r[2]||e)}var BG=Math.PI/180;function me(r){return r*BG}var zG=180/Math.PI;function xr(r){return r*zG}function $G(r){return 360*r}var wf=Math.PI/2;function jG(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e*e,o=n*n,l=i*i,u=a*a,c=s+o+l+u,h=e*a-n*i;return h>.499995*c?(r[0]=wf,r[1]=2*Math.atan2(n,e),r[2]=0):h<-.499995*c?(r[0]=-wf,r[1]=2*Math.atan2(n,e),r[2]=0):(r[0]=Math.asin(2*(e*i-a*n)),r[1]=Math.atan2(2*(e*a+n*i),1-2*(l+u)),r[2]=Math.atan2(2*(e*n+i*a),1-2*(o+l))),r}function qG(r,t){var e,n,i=jl(Qt(),t),a=Rt(i,3),s=a[0],o=a[1],l=a[2],u=Math.asin(-t[2]/s);return u<wf?u>-wf?(e=Math.atan2(t[6]/o,t[10]/l),n=Math.atan2(t[1]/s,t[0]/s)):(n=0,e=-Math.atan2(t[4]/o,t[5]/o)):(n=0,e=Math.atan2(t[4]/o,t[5]/o)),r[0]=e,r[1]=u,r[2]=n,r}function yv(r,t){return t.length===16?qG(r,t):jG(r,t)}function WG(r,t,e,n,i){var a=Math.cos(r),s=Math.sin(r);return Nq(n*a,i*s,0,-n*s,i*a,0,t,e,1)}function GG(r,t,e,n,i,a,s){var o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1,l=2*a,u=e-t,c=n-i,h=l/u,d=l/c,g=(e+t)/u,p=(n+i)/c,v,m,b=s-a,w=s*a;return o?(v=-s/b,m=-w/b):(v=-(s+a)/b,m=-2*w/b),r[0]=h,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=d,r[6]=0,r[7]=0,r[8]=g,r[9]=p,r[10]=v,r[11]=-1,r[12]=0,r[13]=0,r[14]=m,r[15]=0,r}function U3(r){var t=r[0],e=r[1],n=r[3],i=r[4],a=Math.sqrt(t*t+e*e),s=Math.sqrt(n*n+i*i),o=t*i-e*n;if(o<0&&(t<i?a=-a:s=-s),a){var l=1/a;t*=l,e*=l}if(s){var u=1/s;n*=u,i*=u}var c=Math.atan2(e,t),h=xr(c);return[r[6],r[7],a,s,h]}var Hi=Se(),Ti=Se(),Su=ta(),At=[Qt(),Qt(),Qt()],Y3=Qt();function VG(r,t,e,n,i,a){if(!HG(Hi,r)||($l(Ti,Hi),Ti[3]=0,Ti[7]=0,Ti[11]=0,Ti[15]=1,Math.abs(AR(Ti))<1e-8))return!1;var s=Hi[3],o=Hi[7],l=Hi[11],u=Hi[12],c=Hi[13],h=Hi[14],d=Hi[15];if(s!==0||o!==0||l!==0){Su[0]=s,Su[1]=o,Su[2]=l,Su[3]=d;var g=Zi(Ti,Ti);if(!g)return!1;CR(Ti,Ti),Pa(i,Su,Ti)}else i[0]=i[1]=i[2]=0,i[3]=1;if(t[0]=u,t[1]=c,t[2]=h,UG(At,Hi),e[0]=ka(At[0]),So(At[0],At[0]),n[0]=Qi(At[0],At[1]),bv(At[1],At[1],At[0],1,-n[0]),e[1]=ka(At[1]),So(At[1],At[1]),n[0]/=e[1],n[1]=Qi(At[0],At[2]),bv(At[2],At[2],At[0],1,-n[1]),n[2]=Qi(At[1],At[2]),bv(At[2],At[2],At[1],1,-n[2]),e[2]=ka(At[2]),So(At[2],At[2]),n[1]/=e[2],n[2]/=e[2],Kd(Y3,At[1],At[2]),Qi(At[0],Y3)<0)for(var p=0;p<3;p++)e[p]*=-1,At[p][0]*=-1,At[p][1]*=-1,At[p][2]*=-1;return a[0]=.5*Math.sqrt(Math.max(1+At[0][0]-At[1][1]-At[2][2],0)),a[1]=.5*Math.sqrt(Math.max(1-At[0][0]+At[1][1]-At[2][2],0)),a[2]=.5*Math.sqrt(Math.max(1-At[0][0]-At[1][1]+At[2][2],0)),a[3]=.5*Math.sqrt(Math.max(1+At[0][0]+At[1][1]+At[2][2],0)),At[2][1]>At[1][2]&&(a[0]=-a[0]),At[0][2]>At[2][0]&&(a[1]=-a[1]),At[1][0]>At[0][1]&&(a[2]=-a[2]),!0}function HG(r,t){var e=t[15];if(e===0)return!1;for(var n=1/e,i=0;i<16;i++)r[i]=t[i]*n;return!0}function UG(r,t){r[0][0]=t[0],r[0][1]=t[1],r[0][2]=t[2],r[1][0]=t[4],r[1][1]=t[5],r[1][2]=t[6],r[2][0]=t[8],r[2][1]=t[9],r[2][2]=t[10]}function bv(r,t,e,n,i){r[0]=t[0]*n+e[0]*i,r[1]=t[1]*n+e[1]*i,r[2]=t[2]*n+e[2]*i}var ge=function(r){return r[r.ORBITING=0]="ORBITING",r[r.EXPLORING=1]="EXPLORING",r[r.TRACKING=2]="TRACKING",r}({}),yw=function(r){return r[r.DEFAULT=0]="DEFAULT",r[r.ROTATIONAL=1]="ROTATIONAL",r[r.TRANSLATIONAL=2]="TRANSLATIONAL",r[r.CINEMATIC=3]="CINEMATIC",r}({}),ci=function(r){return r[r.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",r[r.PERSPECTIVE=1]="PERSPECTIVE",r}({}),cL={UPDATED:"updated"},X3=2e-4,hL=function(){function r(){at(this,r),this.clipSpaceNearZ=Jd.NEGATIVE_ONE,this.eventEmitter=new MR,this.matrix=Se(),this.right=Ce(1,0,0),this.up=Ce(0,1,0),this.forward=Ce(0,0,1),this.position=Ce(0,0,1),this.focalPoint=Ce(0,0,0),this.distanceVector=Ce(0,0,-1),this.distance=1,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.dollyingStep=0,this.maxDistance=1/0,this.minDistance=-1/0,this.zoom=1,this.rotateWorld=!1,this.fov=30,this.near=.1,this.far=1e3,this.aspect=1,this.projectionMatrix=Se(),this.projectionMatrixInverse=Se(),this.jitteredProjectionMatrix=void 0,this.enableUpdate=!0,this.type=ge.EXPLORING,this.trackingMode=yw.DEFAULT,this.projectionMode=ci.PERSPECTIVE,this.frustum=new DG,this.orthoMatrix=Se()}return it(r,[{key:"isOrtho",value:function(){return this.projectionMode===ci.ORTHOGRAPHIC}},{key:"getProjectionMode",value:function(){return this.projectionMode}},{key:"getPerspective",value:function(){return this.jitteredProjectionMatrix||this.projectionMatrix}},{key:"getPerspectiveInverse",value:function(){return this.projectionMatrixInverse}},{key:"getFrustum",value:function(){return this.frustum}},{key:"getPosition",value:function(){return this.position}},{key:"getFocalPoint",value:function(){return this.focalPoint}},{key:"getDollyingStep",value:function(){return this.dollyingStep}},{key:"getNear",value:function(){return this.near}},{key:"getFar",value:function(){return this.far}},{key:"getZoom",value:function(){return this.zoom}},{key:"getOrthoMatrix",value:function(){return this.orthoMatrix}},{key:"getView",value:function(){return this.view}},{key:"setEnableUpdate",value:function(e){this.enableUpdate=e}},{key:"setType",value:function(e,n){return this.type=e,this.type===ge.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===ge.TRACKING&&n!==void 0&&this.setTrackingMode(n),this}},{key:"setProjectionMode",value:function(e){return this.projectionMode=e,this}},{key:"setTrackingMode",value:function(e){if(this.type!==ge.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=e,this}},{key:"setWorldRotation",value:function(e){return this.rotateWorld=e,this._getAngles(),this}},{key:"getViewTransform",value:function(){return Zi(Se(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"jitterProjectionMatrix",value:function(e,n){var i=bs(Se(),[e,n,0]);this.jitteredProjectionMatrix=Jn(Se(),i,this.projectionMatrix)}},{key:"clearJitterProjectionMatrix",value:function(){this.jitteredProjectionMatrix=void 0}},{key:"setMatrix",value:function(e){return this.matrix=e,this._update(),this}},{key:"setProjectionMatrix",value:function(e){this.projectionMatrix=e}},{key:"setFov",value:function(e){return this.setPerspective(this.near,this.far,e,this.aspect),this}},{key:"setAspect",value:function(e){return this.setPerspective(this.near,this.far,this.fov,e),this}},{key:"setNear",value:function(e){return this.projectionMode===ci.PERSPECTIVE?this.setPerspective(e,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,e,this.far),this}},{key:"setFar",value:function(e){return this.projectionMode===ci.PERSPECTIVE?this.setPerspective(this.near,e,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,e),this}},{key:"setViewOffset",value:function(e,n,i,a,s,o){return this.aspect=e/n,this.view===void 0&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=a,this.view.width=s,this.view.height=o,this.projectionMode===ci.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"clearViewOffset",value:function(){return this.view!==void 0&&(this.view.enabled=!1),this.projectionMode===ci.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"setZoom",value:function(e){return this.zoom=e,this.projectionMode===ci.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===ci.PERSPECTIVE&&this.setPerspective(this.near,this.far,this.fov,this.aspect),this}},{key:"setZoomByViewportPoint",value:function(e,n){var i=this.canvas.viewport2Canvas({x:n[0],y:n[1]}),a=i.x,s=i.y,o=this.roll;this.rotate(0,0,-o),this.setPosition(a,s),this.setFocalPoint(a,s),this.setZoom(e),this.rotate(0,0,o);var l=this.canvas.viewport2Canvas({x:n[0],y:n[1]}),u=l.x,c=l.y,h=Ce(u-a,c-s,0),d=Qi(h,this.right)/ka(this.right),g=Qi(h,this.up)/ka(this.up),p=this.getPosition(),v=Rt(p,2),m=v[0],b=v[1],w=this.getFocalPoint(),x=Rt(w,2),_=x[0],S=x[1];return this.setPosition(m-d,b-g),this.setFocalPoint(_-d,S-g),this}},{key:"setPerspective",value:function(e,n,i,a){var s;this.projectionMode=ci.PERSPECTIVE,this.fov=i,this.near=e,this.far=n,this.aspect=a;var o=this.near*Math.tan(me(.5*this.fov))/this.zoom,l=2*o,u=this.aspect*l,c=-.5*u;if((s=this.view)!==null&&s!==void 0&&s.enabled){var h=this.view.fullWidth,d=this.view.fullHeight;c+=this.view.offsetX*u/h,o-=this.view.offsetY*l/d,u*=this.view.width/h,l*=this.view.height/d}return GG(this.projectionMatrix,c,c+u,o-l,o,e,this.far,this.clipSpaceNearZ===Jd.ZERO),Zi(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this}},{key:"setOrthographic",value:function(e,n,i,a,s,o){var l;this.projectionMode=ci.ORTHOGRAPHIC,this.rright=n,this.left=e,this.top=i,this.bottom=a,this.near=s,this.far=o;var u=(this.rright-this.left)/(2*this.zoom),c=(this.top-this.bottom)/(2*this.zoom),h=(this.rright+this.left)/2,d=(this.top+this.bottom)/2,g=h-u,p=h+u,v=d+c,m=d-c;if((l=this.view)!==null&&l!==void 0&&l.enabled){var b=(this.rright-this.left)/this.view.fullWidth/this.zoom,w=(this.top-this.bottom)/this.view.fullHeight/this.zoom;g+=b*this.view.offsetX,p=g+b*this.view.width,v-=w*this.view.offsetY,m=v-w*this.view.height}return this.clipSpaceNearZ===Jd.NEGATIVE_ONE?$R(this.projectionMatrix,g,p,v,m,s,o):jR(this.projectionMatrix,g,p,v,m,s,o),Zi(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.triggerUpdate(),this}},{key:"setPosition",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.position[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.position[2],a=ar(e,n,i);return this._setPosition(a),this.setFocalPoint(this.focalPoint),this.triggerUpdate(),this}},{key:"setFocalPoint",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.focalPoint[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.focalPoint[2],a=Ce(0,1,0);if(this.focalPoint=ar(e,n,i),this.trackingMode===yw.CINEMATIC){var s=sw(Qt(),this.focalPoint,this.position);e=s[0],n=s[1],i=s[2];var o=ka(s),l=xr(Math.asin(n/o)),u=90+xr(Math.atan2(i,e)),c=Se();RR(c,c,me(u)),NR(c,c,me(l)),a=Qn(Qt(),[0,1,0],c)}return Zi(this.matrix,qR(Se(),this.position,this.focalPoint,a)),this._getAxes(),this._getDistance(),this._getAngles(),this.triggerUpdate(),this}},{key:"getDistance",value:function(){return this.distance}},{key:"getDistanceVector",value:function(){return this.distanceVector}},{key:"setDistance",value:function(e){if(this.distance===e||e<0)return this;this.distance=e,this.distance<X3&&(this.distance=X3),this.dollyingStep=this.distance/100;var n=Qt();e=this.distance;var i=this.forward,a=this.focalPoint;return n[0]=e*i[0]+a[0],n[1]=e*i[1]+a[1],n[2]=e*i[2]+a[2],this._setPosition(n),this.triggerUpdate(),this}},{key:"setMaxDistance",value:function(e){return this.maxDistance=e,this}},{key:"setMinDistance",value:function(e){return this.minDistance=e,this}},{key:"setAzimuth",value:function(e){return this.azimuth=Il(e),this.computeMatrix(),this._getAxes(),this.type===ge.ORBITING||this.type===ge.EXPLORING?this._getPosition():this.type===ge.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getAzimuth",value:function(){return this.azimuth}},{key:"setElevation",value:function(e){return this.elevation=Il(e),this.computeMatrix(),this._getAxes(),this.type===ge.ORBITING||this.type===ge.EXPLORING?this._getPosition():this.type===ge.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getElevation",value:function(){return this.elevation}},{key:"setRoll",value:function(e){return this.roll=Il(e),this.computeMatrix(),this._getAxes(),this.type===ge.ORBITING||this.type===ge.EXPLORING?this._getPosition():this.type===ge.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getRoll",value:function(){return this.roll}},{key:"_update",value:function(){this._getAxes(),this._getPosition(),this._getDistance(),this._getAngles(),this._getOrthoMatrix(),this.triggerUpdate()}},{key:"computeMatrix",value:function(){var e=Es(wn(),[0,0,1],me(this.roll));Bs(this.matrix);var n=Es(wn(),[1,0,0],me((this.rotateWorld&&this.type!==ge.TRACKING||this.type===ge.TRACKING?1:-1)*this.elevation)),i=Es(wn(),[0,1,0],me((this.rotateWorld&&this.type!==ge.TRACKING||this.type===ge.TRACKING?1:-1)*this.azimuth)),a=Ps(wn(),i,n);a=Ps(wn(),a,e);var s=kx(Se(),a);this.type===ge.ORBITING||this.type===ge.EXPLORING?(Ll(this.matrix,this.matrix,this.focalPoint),Jn(this.matrix,this.matrix,s),Ll(this.matrix,this.matrix,[0,0,this.distance])):this.type===ge.TRACKING&&(Ll(this.matrix,this.matrix,this.position),Jn(this.matrix,this.matrix,s))}},{key:"_setPosition",value:function(e,n,i){this.position=ar(e,n,i);var a=this.matrix;a[12]=this.position[0],a[13]=this.position[1],a[14]=this.position[2],a[15]=1,this._getOrthoMatrix()}},{key:"_getAxes",value:function(){Ji(this.right,ar(Pa(ta(),[1,0,0,0],this.matrix))),Ji(this.up,ar(Pa(ta(),[0,1,0,0],this.matrix))),Ji(this.forward,ar(Pa(ta(),[0,0,1,0],this.matrix))),So(this.right,this.right),So(this.up,this.up),So(this.forward,this.forward)}},{key:"_getAngles",value:function(){var e=this.distanceVector[0],n=this.distanceVector[1],i=this.distanceVector[2],a=ka(this.distanceVector);if(a===0){this.elevation=0,this.azimuth=0;return}this.type===ge.TRACKING?(this.elevation=xr(Math.asin(n/a)),this.azimuth=xr(Math.atan2(-e,-i))):this.rotateWorld?(this.elevation=xr(Math.asin(n/a)),this.azimuth=xr(Math.atan2(-e,-i))):(this.elevation=-xr(Math.asin(n/a)),this.azimuth=-xr(Math.atan2(-e,-i)))}},{key:"_getPosition",value:function(){Ji(this.position,ar(Pa(ta(),[0,0,0,1],this.matrix))),this._getDistance()}},{key:"_getFocalPoint",value:function(){eW(this.distanceVector,[0,0,-this.distance],Pq(kR(),this.matrix)),As(this.focalPoint,this.position,this.distanceVector),this._getDistance()}},{key:"_getDistance",value:function(){this.distanceVector=sw(Qt(),this.focalPoint,this.position),this.distance=ka(this.distanceVector),this.dollyingStep=this.distance/100}},{key:"_getOrthoMatrix",value:function(){if(this.projectionMode===ci.ORTHOGRAPHIC){var e=this.position,n=Es(wn(),[0,0,1],-this.roll*Math.PI/180);Ju(this.orthoMatrix,n,Ce((this.rright-this.left)/2-e[0],(this.top-this.bottom)/2-e[1],0),Ce(this.zoom,this.zoom,1),e)}}},{key:"triggerUpdate",value:function(){if(this.enableUpdate){var e=this.getViewTransform(),n=Jn(Se(),this.getPerspective(),e);this.getFrustum().extractFromVPMatrix(n),this.eventEmitter.emit(cL.UPDATED)}}},{key:"rotate",value:function(e,n,i){throw new Error(pe)}},{key:"pan",value:function(e,n){throw new Error(pe)}},{key:"dolly",value:function(e){throw new Error(pe)}},{key:"createLandmark",value:function(e,n){throw new Error(pe)}},{key:"gotoLandmark",value:function(e,n){throw new Error(pe)}},{key:"cancelLandmarkAnimation",value:function(){throw new Error(pe)}}])}(),YG=function(r){return r[r.Standard=0]="Standard",r}({}),xf=function(r){return r[r.ADDED=0]="ADDED",r[r.REMOVED=1]="REMOVED",r[r.Z_INDEX_CHANGED=2]="Z_INDEX_CHANGED",r}({}),dL={absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Wl(0,0,0,0)},ft=function(r){return r.COORDINATE="<coordinate>",r.COLOR="<color>",r.PAINT="<paint>",r.NUMBER="<number>",r.ANGLE="<angle>",r.OPACITY_VALUE="<opacity-value>",r.SHADOW_BLUR="<shadow-blur>",r.LENGTH="<length>",r.PERCENTAGE="<percentage>",r.LENGTH_PERCENTAGE="<length> | <percentage>",r.LENGTH_PERCENTAGE_12="[<length> | <percentage>]{1,2}",r.LENGTH_PERCENTAGE_14="[<length> | <percentage>]{1,4}",r.LIST_OF_POINTS="<list-of-points>",r.PATH="<path>",r.FILTER="<filter>",r.Z_INDEX="<z-index>",r.OFFSET_DISTANCE="<offset-distance>",r.DEFINED_PATH="<defined-path>",r.MARKER="<marker>",r.TRANSFORM="<transform>",r.TRANSFORM_ORIGIN="<transform-origin>",r.TEXT="<text>",r.TEXT_TRANSFORM="<text-transform>",r}({});function Ax(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function fL(r,t){var e=Object.create(r.prototype);for(var n in t)e[n]=t[n];return e}function Ac(){}var cc=.7,Ef=1/cc,Dl="\\s*([+-]?\\d+)\\s*",hc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",na="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",XG=/^#([0-9a-f]{3,8})$/,KG=new RegExp(`^rgb\\(${Dl},${Dl},${Dl}\\)$`),ZG=new RegExp(`^rgb\\(${na},${na},${na}\\)$`),JG=new RegExp(`^rgba\\(${Dl},${Dl},${Dl},${hc}\\)$`),QG=new RegExp(`^rgba\\(${na},${na},${na},${hc}\\)$`),tV=new RegExp(`^hsl\\(${hc},${na},${na}\\)$`),eV=new RegExp(`^hsla\\(${hc},${na},${na},${hc}\\)$`),K3={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Ax(Ac,ig,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:Z3,formatHex:Z3,formatHex8:nV,formatHsl:rV,formatRgb:J3,toString:J3});function Z3(){return this.rgb().formatHex()}function nV(){return this.rgb().formatHex8()}function rV(){return gL(this).formatHsl()}function J3(){return this.rgb().formatRgb()}function ig(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=XG.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?Q3(t):e===3?new kr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?Vh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?Vh(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=KG.exec(r))?new kr(t[1],t[2],t[3],1):(t=ZG.exec(r))?new kr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=JG.exec(r))?Vh(t[1],t[2],t[3],t[4]):(t=QG.exec(r))?Vh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=tV.exec(r))?nM(t[1],t[2]/100,t[3]/100,1):(t=eV.exec(r))?nM(t[1],t[2]/100,t[3]/100,t[4]):K3.hasOwnProperty(r)?Q3(K3[r]):r==="transparent"?new kr(NaN,NaN,NaN,0):null}function Q3(r){return new kr(r>>16&255,r>>8&255,r&255,1)}function Vh(r,t,e,n){return n<=0&&(r=t=e=NaN),new kr(r,t,e,n)}function iV(r){return r instanceof Ac||(r=ig(r)),r?(r=r.rgb(),new kr(r.r,r.g,r.b,r.opacity)):new kr}function aV(r,t,e,n){return arguments.length===1?iV(r):new kr(r,t,e,n??1)}function kr(r,t,e,n){this.r=+r,this.g=+t,this.b=+e,this.opacity=+n}Ax(kr,aV,fL(Ac,{brighter(r){return r=r==null?Ef:Math.pow(Ef,r),new kr(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?cc:Math.pow(cc,r),new kr(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new kr(Mo(this.r),Mo(this.g),Mo(this.b),_f(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:tM,formatHex:tM,formatHex8:sV,formatRgb:eM,toString:eM}));function tM(){return`#${yo(this.r)}${yo(this.g)}${yo(this.b)}`}function sV(){return`#${yo(this.r)}${yo(this.g)}${yo(this.b)}${yo((isNaN(this.opacity)?1:this.opacity)*255)}`}function eM(){const r=_f(this.opacity);return`${r===1?"rgb(":"rgba("}${Mo(this.r)}, ${Mo(this.g)}, ${Mo(this.b)}${r===1?")":`, ${r})`}`}function _f(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function Mo(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function yo(r){return r=Mo(r),(r<16?"0":"")+r.toString(16)}function nM(r,t,e,n){return n<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new Pi(r,t,e,n)}function gL(r){if(r instanceof Pi)return new Pi(r.h,r.s,r.l,r.opacity);if(r instanceof Ac||(r=ig(r)),!r)return new Pi;if(r instanceof Pi)return r;r=r.rgb();var t=r.r/255,e=r.g/255,n=r.b/255,i=Math.min(t,e,n),a=Math.max(t,e,n),s=NaN,o=a-i,l=(a+i)/2;return o?(t===a?s=(e-n)/o+(e<n)*6:e===a?s=(n-t)/o+2:s=(t-e)/o+4,o/=l<.5?a+i:2-a-i,s*=60):o=l>0&&l<1?0:s,new Pi(s,o,l,r.opacity)}function oV(r,t,e,n){return arguments.length===1?gL(r):new Pi(r,t,e,n??1)}function Pi(r,t,e,n){this.h=+r,this.s=+t,this.l=+e,this.opacity=+n}Ax(Pi,oV,fL(Ac,{brighter(r){return r=r==null?Ef:Math.pow(Ef,r),new Pi(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?cc:Math.pow(cc,r),new Pi(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,t=isNaN(r)||isNaN(this.s)?0:this.s,e=this.l,n=e+(e<.5?e:1-e)*t,i=2*e-n;return new kr(wv(r>=240?r-240:r+120,i,n),wv(r,i,n),wv(r<120?r+240:r-120,i,n),this.opacity)},clamp(){return new Pi(rM(this.h),Hh(this.s),Hh(this.l),_f(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const r=_f(this.opacity);return`${r===1?"hsl(":"hsla("}${rM(this.h)}, ${Hh(this.s)*100}%, ${Hh(this.l)*100}%${r===1?")":`, ${r})`}`}}));function rM(r){return r=(r||0)%360,r<0?r+360:r}function Hh(r){return Math.max(0,Math.min(1,r||0))}function wv(r,t,e){return(r<60?t+(e-t)*r/60:r<180?e:r<240?t+(e-t)*(240-r)/60:t)*255}function pn(r,t){if(typeof r!="function"||t!=null&&typeof t!="function")throw new TypeError("Expected a function");var e=function(){for(var i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];var o=t?t.apply(this,a):a[0],l=e.cache;if(l.has(o))return l.get(o);var u=r.apply(this,a);return e.cache=l.set(o,u)||l,u};return e.cache=new(pn.Cache||Map),pn.cacheList.push(e.cache),e}pn.Cache=Map;pn.cacheList=[];pn.clearCache=function(){pn.cacheList.forEach(function(r){return r.clear()})};var gt=function(r){return r[r.kUnknown=0]="kUnknown",r[r.kNumber=1]="kNumber",r[r.kPercentage=2]="kPercentage",r[r.kEms=3]="kEms",r[r.kPixels=4]="kPixels",r[r.kRems=5]="kRems",r[r.kDegrees=6]="kDegrees",r[r.kRadians=7]="kRadians",r[r.kGradians=8]="kGradians",r[r.kTurns=9]="kTurns",r[r.kMilliseconds=10]="kMilliseconds",r[r.kSeconds=11]="kSeconds",r[r.kInteger=12]="kInteger",r}({}),Ai=function(r){return r[r.kUNumber=0]="kUNumber",r[r.kUPercent=1]="kUPercent",r[r.kULength=2]="kULength",r[r.kUAngle=3]="kUAngle",r[r.kUTime=4]="kUTime",r[r.kUOther=5]="kUOther",r}({}),lV=function(r){return r[r.kYes=0]="kYes",r[r.kNo=1]="kNo",r}({}),uV=function(r){return r[r.kYes=0]="kYes",r[r.kNo=1]="kNo",r}({}),cV=[{name:"em",unit_type:gt.kEms},{name:"px",unit_type:gt.kPixels},{name:"deg",unit_type:gt.kDegrees},{name:"rad",unit_type:gt.kRadians},{name:"grad",unit_type:gt.kGradians},{name:"ms",unit_type:gt.kMilliseconds},{name:"s",unit_type:gt.kSeconds},{name:"rem",unit_type:gt.kRems},{name:"turn",unit_type:gt.kTurns}],Gl=function(r){return r[r.kUnknownType=0]="kUnknownType",r[r.kUnparsedType=1]="kUnparsedType",r[r.kKeywordType=2]="kKeywordType",r[r.kUnitType=3]="kUnitType",r[r.kSumType=4]="kSumType",r[r.kProductType=5]="kProductType",r[r.kNegateType=6]="kNegateType",r[r.kInvertType=7]="kInvertType",r[r.kMinType=8]="kMinType",r[r.kMaxType=9]="kMaxType",r[r.kClampType=10]="kClampType",r[r.kTransformType=11]="kTransformType",r[r.kPositionType=12]="kPositionType",r[r.kURLImageType=13]="kURLImageType",r[r.kColorType=14]="kColorType",r[r.kUnsupportedColorType=15]="kUnsupportedColorType",r}({}),hV=function(t){return cV.find(function(e){return e.name===t}).unit_type},dV=function(t){return t?t==="number"?gt.kNumber:t==="percent"||t==="%"?gt.kPercentage:hV(t):gt.kUnknown},fV=function(t){switch(t){case gt.kNumber:case gt.kInteger:return Ai.kUNumber;case gt.kPercentage:return Ai.kUPercent;case gt.kPixels:return Ai.kULength;case gt.kMilliseconds:case gt.kSeconds:return Ai.kUTime;case gt.kDegrees:case gt.kRadians:case gt.kGradians:case gt.kTurns:return Ai.kUAngle;default:return Ai.kUOther}},gV=function(t){switch(t){case Ai.kUNumber:return gt.kNumber;case Ai.kULength:return gt.kPixels;case Ai.kUPercent:return gt.kPercentage;case Ai.kUTime:return gt.kSeconds;case Ai.kUAngle:return gt.kDegrees;default:return gt.kUnknown}},iM=function(t){var e=1;switch(t){case gt.kPixels:case gt.kDegrees:case gt.kSeconds:break;case gt.kMilliseconds:e=.001;break;case gt.kRadians:e=180/Math.PI;break;case gt.kGradians:e=.9;break;case gt.kTurns:e=360;break}return e},bw=function(t){switch(t){case gt.kNumber:case gt.kInteger:return"";case gt.kPercentage:return"%";case gt.kEms:return"em";case gt.kRems:return"rem";case gt.kPixels:return"px";case gt.kDegrees:return"deg";case gt.kRadians:return"rad";case gt.kGradians:return"grad";case gt.kMilliseconds:return"ms";case gt.kSeconds:return"s";case gt.kTurns:return"turn"}return""},ag=function(){function r(){at(this,r)}return it(r,[{key:"toString",value:function(){return this.buildCSSText(lV.kNo,uV.kNo,"")}},{key:"isNumericValue",value:function(){return this.getType()>=Gl.kUnitType&&this.getType()<=Gl.kClampType}}],[{key:"isAngle",value:function(e){return e===gt.kDegrees||e===gt.kRadians||e===gt.kGradians||e===gt.kTurns}},{key:"isLength",value:function(e){return e>=gt.kEms&&e<gt.kDegrees}},{key:"isRelativeUnit",value:function(e){return e===gt.kPercentage||e===gt.kEms||e===gt.kRems}},{key:"isTime",value:function(e){return e===gt.kSeconds||e===gt.kMilliseconds}}])}(),pV=function(r){function t(e){var n;return at(this,t),n=qt(this,t),n.colorSpace=e,n}return jt(t,r),it(t,[{key:"getType",value:function(){return Gl.kColorType}},{key:"to",value:function(n){return this}}])}(ag),_s=function(r){return r[r.Constant=0]="Constant",r[r.LinearGradient=1]="LinearGradient",r[r.RadialGradient=2]="RadialGradient",r}({}),Uh=function(r){function t(e,n){var i;return at(this,t),i=qt(this,t),i.type=e,i.value=n,i}return jt(t,r),it(t,[{key:"clone",value:function(){return new t(this.type,this.value)}},{key:"buildCSSText",value:function(n,i,a){return a}},{key:"getType",value:function(){return Gl.kColorType}}])}(ag),pi=function(r){function t(e){var n;return at(this,t),n=qt(this,t),n.value=e,n}return jt(t,r),it(t,[{key:"clone",value:function(){return new t(this.value)}},{key:"getType",value:function(){return Gl.kKeywordType}},{key:"buildCSSText",value:function(n,i,a){return a+this.value}}])}(ag),vV=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n="";return Number.isFinite(t)?n="NaN":t>0?n="infinity":n="-infinity",n+=e},ww=function(t){return gV(fV(t))},Cn=function(r){function t(e){var n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gt.kNumber;at(this,t),n=qt(this,t);var a;return typeof i=="string"?a=dV(i):a=i,n.unit=a,n.value=e,n}return jt(t,r),it(t,[{key:"clone",value:function(){return new t(this.value,this.unit)}},{key:"equals",value:function(n){var i=n;return this.value===i.value&&this.unit===i.unit}},{key:"getType",value:function(){return Gl.kUnitType}},{key:"convertTo",value:function(n){if(this.unit===n)return new t(this.value,this.unit);var i=ww(this.unit);if(i!==ww(n)||i===gt.kUnknown)return null;var a=iM(this.unit)/iM(n);return new t(this.value*a,n)}},{key:"buildCSSText",value:function(n,i,a){var s;switch(this.unit){case gt.kUnknown:break;case gt.kInteger:s=Number(this.value).toFixed(0);break;case gt.kNumber:case gt.kPercentage:case gt.kEms:case gt.kRems:case gt.kPixels:case gt.kDegrees:case gt.kRadians:case gt.kGradians:case gt.kMilliseconds:case gt.kSeconds:case gt.kTurns:{var o=-999999,l=999999,u=this.value,c=bw(this.unit);if(u<o||u>l){var h=bw(this.unit);!Number.isFinite(u)||Number.isNaN(u)?s=vV(u,h):s=u+(h||"")}else s="".concat(u).concat(c)}}return a+=s,a}}])}(ag),Oi=new Cn(0,"px");new Cn(1,"px");var Ro=new Cn(0,"deg"),Px=function(r){function t(e,n,i){var a,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return at(this,t),a=qt(this,t,["rgb"]),a.r=e,a.g=n,a.b=i,a.alpha=s,a.isNone=o,a}return jt(t,r),it(t,[{key:"clone",value:function(){return new t(this.r,this.g,this.b,this.alpha)}},{key:"buildCSSText",value:function(n,i,a){return"".concat(a,"rgba(").concat(this.r,",").concat(this.g,",").concat(this.b,",").concat(this.alpha,")")}}])}(pV),aM=new pi("unset"),mV=new pi("initial"),yV=new pi("inherit"),xv={"":aM,unset:aM,initial:mV,inherit:yV},bV=function(t){return xv[t]||(xv[t]=new pi(t)),xv[t]},pL=new Px(0,0,0,0,!0),vL=new Px(0,0,0,0),wV=pn(function(r,t,e,n){return new Px(r,t,e,n)},function(r,t,e,n){return"rgba(".concat(r,",").concat(t,",").concat(e,",").concat(n,")")}),De=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gt.kNumber;return new Cn(t,e)};new Cn(50,"%");function xV(r){var t=r.type,e=r.value;return t==="hex"?"#".concat(e):t==="literal"?e:t==="rgb"?"rgb(".concat(e.join(","),")"):"rgba(".concat(e.join(","),")")}var EV=function(){var r={linearGradient:/^(linear\-gradient)/i,repeatingLinearGradient:/^(repeating\-linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,repeatingRadialGradient:/^(repeating\-radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},t="";function e(B){throw new Error("".concat(t,": ").concat(B))}function n(){var B=i();return t.length>0&&e("Invalid input not EOF"),B}function i(){return x(a)}function a(){return s("linear-gradient",r.linearGradient,l)||s("repeating-linear-gradient",r.repeatingLinearGradient,l)||s("radial-gradient",r.radialGradient,h)||s("repeating-radial-gradient",r.repeatingRadialGradient,h)||s("conic-gradient",r.conicGradient,h)}function s(B,F,V){return o(F,function(X){var K=V();return K&&(j(r.comma)||e("Missing comma before color stops")),{type:B,orientation:K,colorStops:x(_)}})}function o(B,F){var V=j(B);if(V){j(r.startCall)||e("Missing (");var X=F(V);return j(r.endCall)||e("Missing )"),X}}function l(){return u()||c()}function u(){return q("directional",r.sideOrCorner,1)}function c(){return q("angular",r.angleValue,1)}function h(){var B,F=d(),V;return F&&(B=[],B.push(F),V=t,j(r.comma)&&(F=d(),F?B.push(F):t=V)),B}function d(){var B=g()||p();if(B)B.at=m();else{var F=v();if(F){B=F;var V=m();V&&(B.at=V)}else{var X=b();X&&(B={type:"default-radial",at:X})}}return B}function g(){var B=q("shape",/^(circle)/i,0);return B&&(B.style=L()||v()),B}function p(){var B=q("shape",/^(ellipse)/i,0);return B&&(B.style=A()||v()),B}function v(){return q("extent-keyword",r.extentKeywords,1)}function m(){if(q("position",/^at/,0)){var B=b();return B||e("Missing positioning value"),B}}function b(){var B=w();if(B.x||B.y)return{type:"position",value:B}}function w(){return{x:A(),y:A()}}function x(B){var F=B(),V=[];if(F)for(V.push(F);j(r.comma);)F=B(),F?V.push(F):e("One extra comma");return V}function _(){var B=S();return B||e("Expected color definition"),B.length=A(),B}function S(){return k()||P()||T()||M()}function M(){return q("literal",r.literalColor,0)}function k(){return q("hex",r.hexColor,1)}function T(){return o(r.rgbColor,function(){return{type:"rgb",value:x(O)}})}function P(){return o(r.rgbaColor,function(){return{type:"rgba",value:x(O)}})}function O(){return j(r.number)[1]}function A(){return q("%",r.percentageValue,1)||R()||L()}function R(){return q("position-keyword",r.positionKeywords,1)}function L(){return q("px",r.pixelValue,1)||q("em",r.emValue,1)}function q(B,F,V){var X=j(F);if(X)return{type:B,value:X[V]}}function j(B){var F=/^[\n\r\t\s]+/.exec(t);F&&$(F[0].length);var V=B.exec(t);return V&&$(V[0].length),V}function $(B){t=t.substring(B)}return function(B){return t=B,n()}}();function _V(r,t,e,n){var i=me(n.value),a=0,s=0,o=a+t/2,l=s+e/2,u=Math.abs(t*Math.cos(i))+Math.abs(e*Math.sin(i)),c=r[0]+o-Math.cos(i)*u/2,h=r[1]+l-Math.sin(i)*u/2,d=r[0]+o+Math.cos(i)*u/2,g=r[1]+l+Math.sin(i)*u/2;return{x1:c,y1:h,x2:d,y2:g}}function SV(r,t,e,n,i,a){var s=n.value,o=i.value;n.unit===gt.kPercentage&&(s=n.value/100*t),i.unit===gt.kPercentage&&(o=i.value/100*e);var l=Math.max(wr([0,0],[s,o]),wr([0,e],[s,o]),wr([t,e],[s,o]),wr([t,0],[s,o]));return a&&(a instanceof Cn?l=a.value:a instanceof pi&&(a.value==="closest-side"?l=Math.min(s,t-s,o,e-o):a.value==="farthest-side"?l=Math.max(s,t-s,o,e-o):a.value==="closest-corner"&&(l=Math.min(wr([0,0],[s,o]),wr([0,e],[s,o]),wr([t,e],[s,o]),wr([t,0],[s,o]))))),{x:s+r[0],y:o+r[1],r:l}}var MV=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,kV=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,TV=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,mL=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function OV(r){var t,e=r.length;if(r[e-1].length=(t=r[e-1].length)!==null&&t!==void 0?t:{type:"%",value:"100"},e>1){var n;r[0].length=(n=r[0].length)!==null&&n!==void 0?n:{type:"%",value:"0"}}for(var i=0,a=Number(r[0].length.value),s=1;s<e;s++){var o,l=(o=r[s].length)===null||o===void 0?void 0:o.value;if(!kt(l)&&!kt(a)){for(var u=1;u<s-i;u++)r[i+u].length={type:"%",value:"".concat(a+(Number(l)-a)*u/(s-i))};i=s,a=Number(l)}}}var CV={left:180,top:-90,bottom:90,right:0,"left top":225,"top left":225,"left bottom":135,"bottom left":135,"right top":-45,"top right":-45,"right bottom":45,"bottom right":45},AV=pn(function(r){var t;return r.type==="angular"?t=Number(r.value):t=CV[r.value]||0,De(t,"deg")}),PV=pn(function(r){var t=50,e=50,n="%",i="%";if((r==null?void 0:r.type)==="position"){var a=r.value,s=a.x,o=a.y;(s==null?void 0:s.type)==="position-keyword"&&(s.value==="left"?t=0:s.value==="center"?t=50:s.value==="right"?t=100:s.value==="top"?e=0:s.value==="bottom"&&(e=100)),(o==null?void 0:o.type)==="position-keyword"&&(o.value==="left"?t=0:o.value==="center"?e=50:o.value==="right"?t=100:o.value==="top"?e=0:o.value==="bottom"&&(e=100)),((s==null?void 0:s.type)==="px"||(s==null?void 0:s.type)==="%"||(s==null?void 0:s.type)==="em")&&(n=s==null?void 0:s.type,t=Number(s.value)),((o==null?void 0:o.type)==="px"||(o==null?void 0:o.type)==="%"||(o==null?void 0:o.type)==="em")&&(i=o==null?void 0:o.type,e=Number(o.value))}return{cx:De(t,n),cy:De(e,i)}}),NV=pn(function(r){if(r.indexOf("linear")>-1||r.indexOf("radial")>-1){var t=EV(r);return t.map(function(o){var l=o.type,u=o.orientation,c=o.colorStops;OV(c);var h=c.map(function(x){return{offset:De(Number(x.length.value),"%"),color:xV(x)}});if(l==="linear-gradient")return new Uh(_s.LinearGradient,{angle:u?AV(u):Ro,steps:h});if(l==="radial-gradient"&&(u||(u=[{type:"shape",value:"circle"}]),u[0].type==="shape"&&u[0].value==="circle")){var d=PV(u[0].at),g=d.cx,p=d.cy,v;if(u[0].style){var m=u[0].style,b=m.type,w=m.value;b==="extent-keyword"?v=bV(w):v=De(w,b)}return new Uh(_s.RadialGradient,{cx:g,cy:p,size:v,steps:h})}})}var e=r[0];if(r[1]==="("||r[2]==="("){if(e==="l"){var n=MV.exec(r);if(n){var i,a=((i=n[2].match(mL))===null||i===void 0?void 0:i.map(function(o){return o.split(":")}))||[];return[new Uh(_s.LinearGradient,{angle:De(parseFloat(n[1]),"deg"),steps:a.map(function(o){var l=Rt(o,2),u=l[0],c=l[1];return{offset:De(Number(u)*100,"%"),color:c}})})]}}else if(e==="r"){var s=RV(r);if(s)if(oe(s))r=s;else return[new Uh(_s.RadialGradient,s)]}else if(e==="p")return LV(r)}});function RV(r){var t=kV.exec(r);if(t){var e,n=((e=t[4].match(mL))===null||e===void 0?void 0:e.map(function(i){return i.split(":")}))||[];return{cx:De(50,"%"),cy:De(50,"%"),steps:n.map(function(i){var a=Rt(i,2),s=a[0],o=a[1];return{offset:De(Number(s)*100,"%"),color:o}})}}return null}function LV(r){var t=TV.exec(r);if(t){var e=t[1],n=t[2];switch(e){case"a":e="repeat";break;case"x":e="repeat-x";break;case"y":e="repeat-y";break;case"n":e="no-repeat";break;default:e="no-repeat"}return{image:n,repetition:e}}return null}function Lo(r){return r&&!!r.image}function Sf(r){return r&&!kt(r.r)&&!kt(r.g)&&!kt(r.b)}var ec=pn(function(r){if(Lo(r))return Ft({repetition:"repeat"},r);if(kt(r)&&(r=""),r==="transparent")return vL;if(r==="currentColor")r="black";else if(r==="none")return pL;var t=NV(r);if(t)return t;var e=ig(r),n=[0,0,0,0];return e!==null&&(n[0]=e.r||0,n[1]=e.g||0,n[2]=e.b||0,n[3]=e.opacity),wV.apply(void 0,n)});function IV(r,t){if(!(!Sf(r)||!Sf(t)))return[[Number(r.r),Number(r.g),Number(r.b),Number(r.alpha)],[Number(t.r),Number(t.g),Number(t.b),Number(t.alpha)],function(e){var n=e.slice();if(n[3])for(var i=0;i<3;i++)n[i]=Math.round(He(n[i],0,255));return n[3]=He(n[3],0,1),"rgba(".concat(n.join(","),")")}]}function Pc(r,t){if(kt(t))return De(0,"px");if(t="".concat(t).trim().toLowerCase(),isFinite(Number(t))){if("px".search(r)>=0)return De(Number(t),"px");if("deg".search(r)>=0)return De(Number(t),"deg")}var e=[];t=t.replace(r,function(i){return e.push(i),"U".concat(i)});var n="U(".concat(r.source,")");return e.map(function(i){return De(Number(t.replace(new RegExp("U".concat(i),"g"),"").replace(new RegExp(n,"g"),"*0")),i)})[0]}var yL=function(t){return Pc(new RegExp("px","g"),t)},DV=pn(yL),FV=function(t){return Pc(new RegExp("%","g"),t)};pn(FV);var bL=function(t){return yt(t)||isFinite(Number(t))?De(Number(t)||0,"px"):Pc(new RegExp("px|%|em|rem","g"),t)},xw=pn(bL),wL=function(t){return Pc(new RegExp("deg|rad|grad|turn","g"),t)},BV=pn(wL);function zV(r,t,e,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,a="",s=r.value||0,o=t.value||0,l=ww(r.unit),u=r.convertTo(l),c=t.convertTo(l);return u&&c?(s=u.value,o=c.value,a=bw(r.unit)):(Cn.isLength(r.unit)||Cn.isLength(t.unit))&&(s=Br(r,i,e),o=Br(t,i,e),a="px"),[s,o,function(h){return h+a}]}function Er(r){var t=0;return r.unit===gt.kDegrees?t=r.value:r.unit===gt.kRadians?t=xr(Number(r.value)):r.unit===gt.kTurns?t=$G(Number(r.value)):r.value&&(t=r.value),t}function sM(r,t){var e;return Array.isArray(r)?e=r.map(function(n){return Number(n)}):oe(r)?e=r.split(" ").map(function(n){return Number(n)}):yt(r)&&(e=[r]),t===2?e.length===1?[e[0],e[0]]:[e[0],e[1]]:t===4?e.length===1?[e[0],e[0],e[0],e[0]]:e.length===2?[e[0],e[1],e[0],e[1]]:e.length===3?[e[0],e[1],e[2],e[1]]:[e[0],e[1],e[2],e[3]]:t==="even"&&e.length%2===1?[].concat(Te(e),Te(e)):e}function Br(r,t,e){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r.unit===gt.kPixels)return Number(r.value);if(r.unit===gt.kPercentage&&e){var i=e.nodeName===Q.GROUP?e.getLocalBounds():e.getGeometryBounds();return(n?i.min[t]:0)+r.value/100*i.halfExtents[t]*2}return 0}var $V=function(t){return Pc(/deg|rad|grad|turn|px|%/g,t)},jV=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function qV(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";if(r=r.toLowerCase().trim(),r==="none")return[];for(var t=/\s*([\w-]+)\(([^)]*)\)/g,e=[],n,i=0;n=t.exec(r);){if(n.index!==i)return[];if(i=n.index+n[0].length,jV.indexOf(n[1])>-1&&e.push({name:n[1],params:n[2].split(" ").map(function(a){return $V(a)||ec(a)})}),t.lastIndex===r.length)return e}return[]}function xL(r){return r.toString()}var EL=function(t){return typeof t=="number"?De(t):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?De(Number(t)):De(0)},Ew=pn(EL);pn(function(r){return oe(r)?r.split(" ").map(Ew):r.map(Ew)});function Nx(r,t){return[r,t,xL]}function Rx(r,t){return function(e,n){return[e,n,function(i){return xL(He(i,r,t))}]}}function _L(r,t){if(r.length===t.length)return[r,t,function(e){return e}]}function _w(r){return r.parsedStyle.d.totalLength===0&&(r.parsedStyle.d.totalLength=oG(r.parsedStyle.d.absolutePath)),r.parsedStyle.d.totalLength}function WV(r){return r.parsedStyle.points.totalLength===0&&(r.parsedStyle.points.totalLength=MG(r.parsedStyle.points.points)),r.parsedStyle.points.totalLength}function GV(r){for(var t=0;t<r.length;t++){var e=r[t-1],n=r[t],i=n[0];if(i==="M"&&e){var a=e[0],s=[n[1],n[2]],o=void 0;a==="L"||a==="M"?o=[e[1],e[2]]:(a==="C"||a==="A"||a==="Q")&&(o=[e[e.length-2],e[e.length-1]]),o&&Mf(s,o)&&(r.splice(t,1),t--)}}}function VV(r){for(var t=!1,e=r.length,n=0;n<e;n++){var i=r[n],a=i[0];if(a==="C"||a==="A"||a==="Q"){t=!0;break}}return t}function HV(r){for(var t=[],e=[],n=[],i=0;i<r.length;i++){var a=r[i],s=a[0];s==="M"?(n.length&&(e.push(n),n=[]),n.push([a[1],a[2]])):s==="Z"?n.length&&(t.push(n),n=[]):n.push([a[1],a[2]])}return n.length>0&&e.push(n),{polygons:t,polylines:e}}function Mf(r,t){return r[0]===t[0]&&r[1]===t[1]}function UV(r,t){for(var e=[],n=[],i=[],a=0;a<r.length;a++){var s=r[a],o=s.currentPoint,l=s.params,u=s.prePoint,c=void 0;switch(s.command){case"Q":c=kG(u[0],u[1],l[1],l[2],l[3],l[4]);break;case"C":c=EG(u[0],u[1],l[1],l[2],l[3],l[4],l[5],l[6]);break;case"A":var h=s.arcParams;c=bG(h.cx,h.cy,h.rx,h.ry,h.xRotation,h.startAngle,h.endAngle);break;default:e.push(o[0]),n.push(o[1]);break}c&&(s.box=c,e.push(c.x,c.x+c.width),n.push(c.y,c.y+c.height))}e=e.filter(function(_){return!Number.isNaN(_)&&_!==1/0&&_!==-1/0}),n=n.filter(function(_){return!Number.isNaN(_)&&_!==1/0&&_!==-1/0});var d=vf(e),g=vf(n),p=pf(e),v=pf(n);if(i.length===0)return{x:d,y:g,width:p-d,height:v-g};for(var m=0;m<i.length;m++){var b=i[m],w=b.currentPoint,x=void 0;w[0]===d?(x=Yh(b,t),d-=x.xExtra):w[0]===p&&(x=Yh(b,t),p+=x.xExtra),w[1]===g?(x=Yh(b,t),g-=x.yExtra):w[1]===v&&(x=Yh(b,t),v+=x.yExtra)}return{x:d,y:g,width:p-d,height:v-g}}function Yh(r,t){var e=r.prePoint,n=r.currentPoint,i=r.nextPoint,a=Math.pow(n[0]-e[0],2)+Math.pow(n[1]-e[1],2),s=Math.pow(n[0]-i[0],2)+Math.pow(n[1]-i[1],2),o=Math.pow(e[0]-i[0],2)+Math.pow(e[1]-i[1],2),l=Math.acos((a+s-o)/(2*Math.sqrt(a)*Math.sqrt(s)));if(!l||Math.sin(l)===0||Qu(l,0))return{xExtra:0,yExtra:0};var u=Math.abs(Math.atan2(i[1]-n[1],i[0]-n[0])),c=Math.abs(Math.atan2(i[0]-n[0],i[1]-n[1]));u=u>Math.PI/2?Math.PI-u:u,c=c>Math.PI/2?Math.PI-c:c;var h={xExtra:Math.cos(l/2-u)*(t/2*(1/Math.sin(l/2)))-t/2||0,yExtra:Math.cos(c-l/2)*(t/2*(1/Math.sin(l/2)))-t/2||0};return h}function oM(r,t){return[t[0]+(t[0]-r[0]),t[1]+(t[1]-r[1])]}var lM=function(t,e){var n=t.x*e.x+t.y*e.y,i=Math.sqrt((Math.pow(t.x,2)+Math.pow(t.y,2))*(Math.pow(e.x,2)+Math.pow(e.y,2))),a=t.x*e.y-t.y*e.x<0?-1:1,s=a*Math.acos(n/i);return s},uM=function(t,e,n,i,a,s,o,l){e=Math.abs(e),n=Math.abs(n),i=YR(i,360);var u=me(i);if(t.x===o.x&&t.y===o.y)return{x:t.x,y:t.y,ellipticalArcAngle:0};if(e===0||n===0)return{x:0,y:0,ellipticalArcAngle:0};var c=(t.x-o.x)/2,h=(t.y-o.y)/2,d={x:Math.cos(u)*c+Math.sin(u)*h,y:-Math.sin(u)*c+Math.cos(u)*h},g=Math.pow(d.x,2)/Math.pow(e,2)+Math.pow(d.y,2)/Math.pow(n,2);g>1&&(e*=Math.sqrt(g),n*=Math.sqrt(g));var p=Math.pow(e,2)*Math.pow(n,2)-Math.pow(e,2)*Math.pow(d.y,2)-Math.pow(n,2)*Math.pow(d.x,2),v=Math.pow(e,2)*Math.pow(d.y,2)+Math.pow(n,2)*Math.pow(d.x,2),m=p/v;m=m<0?0:m;var b=(a!==s?1:-1)*Math.sqrt(m),w={x:b*(e*d.y/n),y:b*(-(n*d.x)/e)},x={x:Math.cos(u)*w.x-Math.sin(u)*w.y+(t.x+o.x)/2,y:Math.sin(u)*w.x+Math.cos(u)*w.y+(t.y+o.y)/2},_={x:(d.x-w.x)/e,y:(d.y-w.y)/n},S=lM({x:1,y:0},_),M={x:(-d.x-w.x)/e,y:(-d.y-w.y)/n},k=lM(_,M);!s&&k>0?k-=2*Math.PI:s&&k<0&&(k+=2*Math.PI),k%=2*Math.PI;var T=S+k*l,P=e*Math.cos(T),O=n*Math.sin(T),A={x:Math.cos(u)*P-Math.sin(u)*O+x.x,y:Math.sin(u)*P+Math.cos(u)*O+x.y,ellipticalArcStartAngle:S,ellipticalArcEndAngle:S+k,ellipticalArcAngle:T,ellipticalArcCenter:x,resultantRx:e,resultantRy:n};return A};function YV(r){for(var t=[],e=null,n=null,i=null,a=0,s=r.length,o=0;o<s;o++){var l=r[o];n=r[o+1];var u=l[0],c={command:u,prePoint:e,params:l,startTangent:null,endTangent:null,currentPoint:null,nextPoint:null,arcParams:null,box:null,cubicParams:null};switch(u){case"M":i=[l[1],l[2]],a=o;break;case"A":var h=XV(e,l);c.arcParams=h;break}if(u==="Z")e=i,n=r[a+1];else{var d=l.length;e=[l[d-2],l[d-1]]}n&&n[0]==="Z"&&(n=r[a],t[a]&&(t[a].prePoint=e)),c.currentPoint=e,t[a]&&Mf(e,t[a].currentPoint)&&(t[a].prePoint=c.prePoint);var g=n?[n[n.length-2],n[n.length-1]]:null;c.nextPoint=g;var p=c.prePoint;if(["L","H","V"].includes(u))c.startTangent=[p[0]-e[0],p[1]-e[1]],c.endTangent=[e[0]-p[0],e[1]-p[1]];else if(u==="Q"){var v=[l[1],l[2]];c.startTangent=[p[0]-v[0],p[1]-v[1]],c.endTangent=[e[0]-v[0],e[1]-v[1]]}else if(u==="T"){var m=t[o-1],b=oM(m.currentPoint,p);m.command==="Q"?(c.command="Q",c.startTangent=[p[0]-b[0],p[1]-b[1]],c.endTangent=[e[0]-b[0],e[1]-b[1]]):(c.command="TL",c.startTangent=[p[0]-e[0],p[1]-e[1]],c.endTangent=[e[0]-p[0],e[1]-p[1]])}else if(u==="C"){var w=[l[1],l[2]],x=[l[3],l[4]];c.startTangent=[p[0]-w[0],p[1]-w[1]],c.endTangent=[e[0]-x[0],e[1]-x[1]],c.startTangent[0]===0&&c.startTangent[1]===0&&(c.startTangent=[w[0]-x[0],w[1]-x[1]]),c.endTangent[0]===0&&c.endTangent[1]===0&&(c.endTangent=[x[0]-w[0],x[1]-w[1]])}else if(u==="S"){var _=t[o-1],S=oM(_.currentPoint,p),M=[l[1],l[2]];_.command==="C"?(c.command="C",c.startTangent=[p[0]-S[0],p[1]-S[1]],c.endTangent=[e[0]-M[0],e[1]-M[1]]):(c.command="SQ",c.startTangent=[p[0]-M[0],p[1]-M[1]],c.endTangent=[e[0]-M[0],e[1]-M[1]])}else if(u==="A"){var k=cM(c,0),T=k.x,P=k.y,O=cM(c,1,!1),A=O.x,R=O.y;c.startTangent=[T,P],c.endTangent=[A,R]}t.push(c)}return t}function cM(r,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=r.arcParams,i=n.rx,a=i===void 0?0:i,s=n.ry,o=s===void 0?0:s,l=n.xRotation,u=n.arcFlag,c=n.sweepFlag,h=uM({x:r.prePoint[0],y:r.prePoint[1]},a,o,l,!!u,!!c,{x:r.currentPoint[0],y:r.currentPoint[1]},t),d=uM({x:r.prePoint[0],y:r.prePoint[1]},a,o,l,!!u,!!c,{x:r.currentPoint[0],y:r.currentPoint[1]},e?t+.005:t-.005),g=d.x-h.x,p=d.y-h.y,v=Math.sqrt(g*g+p*p);return{x:-g/v,y:-p/v}}function Xh(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Sw(r,t){return Xh(r)*Xh(t)?(r[0]*t[0]+r[1]*t[1])/(Xh(r)*Xh(t)):1}function hM(r,t){return(r[0]*t[1]<r[1]*t[0]?-1:1)*Math.acos(Sw(r,t))}function XV(r,t){var e=t[1],n=t[2],i=YR(me(t[3]),Math.PI*2),a=t[4],s=t[5],o=r[0],l=r[1],u=t[6],c=t[7],h=Math.cos(i)*(o-u)/2+Math.sin(i)*(l-c)/2,d=-1*Math.sin(i)*(o-u)/2+Math.cos(i)*(l-c)/2,g=h*h/(e*e)+d*d/(n*n);g>1&&(e*=Math.sqrt(g),n*=Math.sqrt(g));var p=e*e*(d*d)+n*n*(h*h),v=p?Math.sqrt((e*e*(n*n)-p)/p):1;a===s&&(v*=-1),isNaN(v)&&(v=0);var m=n?v*e*d/n:0,b=e?v*-n*h/e:0,w=(o+u)/2+Math.cos(i)*m-Math.sin(i)*b,x=(l+c)/2+Math.sin(i)*m+Math.cos(i)*b,_=[(h-m)/e,(d-b)/n],S=[(-1*h-m)/e,(-1*d-b)/n],M=hM([1,0],_),k=hM(_,S);return Sw(_,S)<=-1&&(k=Math.PI),Sw(_,S)>=1&&(k=0),s===0&&k>0&&(k-=2*Math.PI),s===1&&k<0&&(k+=2*Math.PI),{cx:w,cy:x,rx:Mf(r,[u,c])?0:e,ry:Mf(r,[u,c])?0:n,startAngle:M,endAngle:M+k,xRotation:i,arcFlag:a,sweepFlag:s}}var SL=function(t){if(t===""||Array.isArray(t)&&t.length===0)return{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:{x:0,y:0,width:0,height:0}};var e;try{e=bf(t)}catch{e=bf(""),console.error("[g]: Invalid SVG Path definition: ".concat(t))}GV(e);var n=VV(e),i=HV(e),a=i.polygons,s=i.polylines,o=YV(e),l=UV(o,0),u=l.x,c=l.y,h=l.width,d=l.height;return{absolutePath:e,hasArc:n,segments:o,polygons:a,polylines:s,totalLength:0,rect:{x:Number.isFinite(u)?u:0,y:Number.isFinite(c)?c:0,width:Number.isFinite(h)?h:0,height:Number.isFinite(d)?d:0}}},KV=pn(SL);function ML(r){return oe(r)?KV(r):SL(r)}function ZV(r,t,e){var n=r.curve,i=t.curve;(!n||n.length===0)&&(n=dw(r.absolutePath,!1),r.curve=n),(!i||i.length===0)&&(i=dw(t.absolutePath,!1),t.curve=i);var a=[n,i];n.length!==i.length&&(a=iL(n,i));var s=$3(a[0])!==$3(a[1])?eG(a[0]):tG(a[0]);return[s,uG(a[1],s),function(o){return o}]}function JV(r,t){var e;return oe(r)?e=r.split(" ").map(function(n){var i=n.split(","),a=Rt(i,2),s=a[0],o=a[1];return[Number(s),Number(o)]}):e=r,{points:e,totalLength:0,segments:[]}}function QV(r,t){return[r.points,t.points,function(e){return e}]}var Ge=null,Fl=/\s*(\w+)\(([^)]*)\)/g;function mr(r){return function(t){var e=0;return r.map(function(n){return n===Ge?t[e++]:n})}}function lo(r){return r}var dc={matrix:["NNNNNN",[Ge,Ge,0,0,Ge,Ge,0,0,0,0,1,0,Ge,Ge,0,1],lo],matrix3d:["NNNNNNNNNNNNNNNN",lo],rotate:["A"],rotateX:["A"],rotateY:["A"],rotateZ:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",mr([Ge,Ge,new Cn(1)]),lo],scaleX:["N",mr([Ge,new Cn(1),new Cn(1)]),mr([Ge,new Cn(1)])],scaleY:["N",mr([new Cn(1),Ge,new Cn(1)]),mr([new Cn(1),Ge])],scaleZ:["N",mr([new Cn(1),new Cn(1),Ge])],scale3d:["NNN",lo],skew:["Aa",null,lo],skewX:["A",null,mr([Ge,Ro])],skewY:["A",null,mr([Ro,Ge])],translate:["Tt",mr([Ge,Ge,Oi]),lo],translateX:["T",mr([Ge,Oi,Oi]),mr([Ge,Oi])],translateY:["T",mr([Oi,Ge,Oi]),mr([Oi,Ge])],translateZ:["L",mr([Oi,Oi,Ge])],translate3d:["TTL",lo]};function kL(r){for(var t=[],e=r.length,n=0;n<e;n++){var i=r[n],a=i[0],s=i.slice(1);a==="translate"||a==="skew"?s.length===1&&s.push(0):a==="scale"&&s.length===1&&s.push(s[0]);var o=dc[a];if(!o)return[];var l=s.map(function(u){return De(u)});t.push({t:a,d:l})}return t}function TL(r){if(Array.isArray(r))return kL(r);if(r=(r||"none").trim(),r==="none")return[];var t=[],e,n=0;for(Fl.lastIndex=0;e=Fl.exec(r);){if(e.index!==n)return[];n=e.index+e[0].length;var i=e[1],a=dc[i];if(!a)return[];var s=e[2].split(","),o=a[0];if(o.length<s.length)return[];for(var l=[],u=0;u<o.length;u++){var c=s[u],h=o[u],d=void 0;if(c?d={A:function(p){return p.trim()==="0"?Ro:BV(p)},N:Ew,T:xw,L:DV}[h.toUpperCase()](c):d={a:Ro,n:l[0],t:Oi}[h],d===void 0)return[];l.push(d)}if(t.push({t:i,d:l}),Fl.lastIndex===r.length)return t}return[]}function tH(r){if(Array.isArray(r))return kL(r);if(r=(r||"none").trim(),r==="none")return[];var t=[],e,n=0;for(Fl.lastIndex=0;e=Fl.exec(r);){if(e.index!==n)return[];n=e.index+e[0].length;var i=e[1],a=dc[i];if(!a)return[];var s=e[2].split(","),o=a[0];if(o.length<s.length)return[];for(var l=[],u=0;u<o.length;u++){var c=s[u],h=o[u],d=void 0;if(c?d={A:function(p){return p.trim()==="0"?Ro:wL(p)},N:EL,T:bL,L:yL}[h.toUpperCase()](c):d={a:Ro,n:l[0],t:Oi}[h],d===void 0)return[];l.push(d)}if(t.push({t:i,d:l}),Fl.lastIndex===r.length)return t}return[]}function eH(r){var t,e,n,i;switch(r.t){case"rotateX":return i=me(Er(r.d[0])),[1,0,0,0,0,Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1];case"rotateY":return i=me(Er(r.d[0])),[Math.cos(i),0,-Math.sin(i),0,0,1,0,0,Math.sin(i),0,Math.cos(i),0,0,0,0,1];case"rotate":case"rotateZ":return i=me(Er(r.d[0])),[Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1,0,0,0,0,1];case"rotate3d":t=r.d[0].value,e=r.d[1].value,n=r.d[2].value,i=me(Er(r.d[3]));var a=t*t+e*e+n*n;if(a===0)t=1,e=0,n=0;else if(a!==1){var s=Math.sqrt(a);t/=s,e/=s,n/=s}var o=Math.sin(i/2),l=o*Math.cos(i/2),u=o*o;return[1-2*(e*e+n*n)*u,2*(t*e*u+n*l),2*(t*n*u-e*l),0,2*(t*e*u-n*l),1-2*(t*t+n*n)*u,2*(e*n*u+t*l),0,2*(t*n*u+e*l),2*(e*n*u-t*l),1-2*(t*t+e*e)*u,0,0,0,0,1];case"scale":return[r.d[0].value,0,0,0,0,r.d[1].value,0,0,0,0,1,0,0,0,0,1];case"scaleX":return[r.d[0].value,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"scaleY":return[1,0,0,0,0,r.d[0].value,0,0,0,0,1,0,0,0,0,1];case"scaleZ":return[1,0,0,0,0,1,0,0,0,0,r.d[0].value,0,0,0,0,1];case"scale3d":return[r.d[0].value,0,0,0,0,r.d[1].value,0,0,0,0,r.d[2].value,0,0,0,0,1];case"skew":var c=me(Er(r.d[0])),h=me(Er(r.d[1]));return[1,Math.tan(h),0,0,Math.tan(c),1,0,0,0,0,1,0,0,0,0,1];case"skewX":return i=me(Er(r.d[0])),[1,0,0,0,Math.tan(i),1,0,0,0,0,1,0,0,0,0,1];case"skewY":return i=me(Er(r.d[0])),[1,Math.tan(i),0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"translate":return t=Br(r.d[0],0,null)||0,e=Br(r.d[1],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,t,e,0,1];case"translateX":return t=Br(r.d[0],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,t,0,0,1];case"translateY":return e=Br(r.d[0],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,0,e,0,1];case"translateZ":return n=Br(r.d[0],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,n,1];case"translate3d":return t=Br(r.d[0],0,null)||0,e=Br(r.d[1],0,null)||0,n=Br(r.d[2],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,t,e,n,1];case"perspective":var d=Br(r.d[0],0,null)||0,g=d?-1/d:0;return[1,0,0,0,0,1,0,0,0,0,1,g,0,0,0,1];case"matrix":return[r.d[0].value,r.d[1].value,0,0,r.d[2].value,r.d[3].value,0,0,0,0,1,0,r.d[4].value,r.d[5].value,0,1];case"matrix3d":return r.d.map(function(p){return p.value})}}function nH(r,t){return[r[0]*t[0]+r[4]*t[1]+r[8]*t[2]+r[12]*t[3],r[1]*t[0]+r[5]*t[1]+r[9]*t[2]+r[13]*t[3],r[2]*t[0]+r[6]*t[1]+r[10]*t[2]+r[14]*t[3],r[3]*t[0]+r[7]*t[1]+r[11]*t[2]+r[15]*t[3],r[0]*t[4]+r[4]*t[5]+r[8]*t[6]+r[12]*t[7],r[1]*t[4]+r[5]*t[5]+r[9]*t[6]+r[13]*t[7],r[2]*t[4]+r[6]*t[5]+r[10]*t[6]+r[14]*t[7],r[3]*t[4]+r[7]*t[5]+r[11]*t[6]+r[15]*t[7],r[0]*t[8]+r[4]*t[9]+r[8]*t[10]+r[12]*t[11],r[1]*t[8]+r[5]*t[9]+r[9]*t[10]+r[13]*t[11],r[2]*t[8]+r[6]*t[9]+r[10]*t[10]+r[14]*t[11],r[3]*t[8]+r[7]*t[9]+r[11]*t[10]+r[15]*t[11],r[0]*t[12]+r[4]*t[13]+r[8]*t[14]+r[12]*t[15],r[1]*t[12]+r[5]*t[13]+r[9]*t[14]+r[13]*t[15],r[2]*t[12]+r[6]*t[13]+r[10]*t[14]+r[14]*t[15],r[3]*t[12]+r[7]*t[13]+r[11]*t[14]+r[15]*t[15]]}function rH(r){return r.length===0?[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]:r.map(eH).reduce(nH)}function dM(r){var t=[0,0,0],e=[1,1,1],n=[0,0,0],i=[0,0,0,1],a=[0,0,0,1];return VG(rH(r),t,e,n,i,a),[[t,e,n,a,i]]}var iH=function(){function r(n,i){for(var a=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],s=0;s<4;s++)for(var o=0;o<4;o++)for(var l=0;l<4;l++)a[s][o]+=i[s][l]*n[l][o];return a}function t(n){return n[0][2]===0&&n[0][3]===0&&n[1][2]===0&&n[1][3]===0&&n[2][0]===0&&n[2][1]===0&&n[2][2]===1&&n[2][3]===0&&n[3][2]===0&&n[3][3]===1}function e(n,i,a,s,o){for(var l=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],u=0;u<4;u++)l[u][3]=o[u];for(var c=0;c<3;c++)for(var h=0;h<3;h++)l[3][c]+=n[h]*l[h][c];var d=s[0],g=s[1],p=s[2],v=s[3],m=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];m[0][0]=1-2*(g*g+p*p),m[0][1]=2*(d*g-p*v),m[0][2]=2*(d*p+g*v),m[1][0]=2*(d*g+p*v),m[1][1]=1-2*(d*d+p*p),m[1][2]=2*(g*p-d*v),m[2][0]=2*(d*p-g*v),m[2][1]=2*(g*p+d*v),m[2][2]=1-2*(d*d+g*g),l=r(l,m);var b=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];a[2]&&(b[2][1]=a[2],l=r(l,b)),a[1]&&(b[2][1]=0,b[2][0]=a[0],l=r(l,b)),a[0]&&(b[2][0]=0,b[1][0]=a[0],l=r(l,b));for(var w=0;w<3;w++)for(var x=0;x<3;x++)l[w][x]*=i[w];return t(l)?[l[0][0],l[0][1],l[1][0],l[1][1],l[3][0],l[3][1]]:l[0].concat(l[1],l[2],l[3])}return e}();function aH(r){return r.toFixed(6).replace(".000000","")}function Ev(r,t){var e,n;return r.decompositionPair!==t&&(r.decompositionPair=t,e=dM(r)),t.decompositionPair!==r&&(t.decompositionPair=r,n=dM(t)),e[0]===null||n[0]===null?[[!1],[!0],function(i){return i?t[0].d:r[0].d}]:(e[0].push(0),n[0].push(1),[e,n,function(i){var a=oH(e[0][3],n[0][3],i[5]),s=iH(i[0],i[1],i[2],a,i[4]),o=s.map(aH).join(",");return o}])}function sH(r,t){for(var e=0,n=0;n<r.length;n++)e+=r[n]*t[n];return e}function oH(r,t,e){var n=sH(r,t);n=He(n,-1,1);var i=[];if(n===1)i=r;else for(var a=Math.acos(n),s=Math.sin(e*a)*1/Math.sqrt(1-n*n),o=0;o<4;o++)i.push(r[o]*(Math.cos(e*a)-n*s)+t[o]*s);return i}function _v(r){return r.replace(/[XY]/,"")}function Sv(r){return r.replace(/(X|Y|Z|3d)?$/,"3d")}var lH=function(t,e){return t==="perspective"&&e==="perspective"||(t==="matrix"||t==="matrix3d")&&(e==="matrix"||e==="matrix3d")};function uH(r,t,e){var n=!1;if(!r.length||!t.length){r.length||(n=!0,r=t,t=[]);for(var i=function(){var A=r[a],R=A.t,L=A.d,q=R.substring(0,5)==="scale"?1:0;t.push({t:R,d:L.map(function(j){return typeof j=="number"?De(q):De(q,j.unit)})})},a=0;a<r.length;a++)i()}var s=[],o=[],l=[];if(r.length!==t.length){var u=Ev(r,t);s=[u[0]],o=[u[1]],l=[["matrix",[u[2]]]]}else for(var c=0;c<r.length;c++){var h=r[c].t,d=t[c].t,g=r[c].d,p=t[c].d,v=dc[h],m=dc[d],b=void 0;if(lH(h,d)){var w=Ev([r[c]],[t[c]]);s.push(w[0]),o.push(w[1]),l.push(["matrix",[w[2]]]);continue}else if(h===d)b=h;else if(v[2]&&m[2]&&_v(h)===_v(d))b=_v(h),g=v[2](g),p=m[2](p);else if(v[1]&&m[1]&&Sv(h)===Sv(d))b=Sv(h),g=v[1](g),p=m[1](p);else{var x=Ev(r,t);s=[x[0]],o=[x[1]],l=[["matrix",[x[2]]]];break}for(var _=[],S=[],M=[],k=0;k<g.length;k++){var T=zV(g[k],p[k],e,!1,k);_[k]=T[0],S[k]=T[1],M.push(T[2])}s.push(_),o.push(S),l.push([b,M])}if(n){var P=s;s=o,o=P}return[s,o,function(O){return O.map(function(A,R){var L=A.map(function(q,j){return l[R][1][j](q)}).join(",");return l[R][0]==="matrix"&&L.split(",").length===16&&(l[R][0]="matrix3d"),l[R][0]==="matrix3d"&&L.split(",").length===6&&(l[R][0]="matrix"),"".concat(l[R][0],"(").concat(L,")")}).join(" ")}]}var cH=pn(function(r){if(oe(r)){if(r==="text-anchor")return[De(0,"px"),De(0,"px")];var t=r.split(" ");return t.length===1&&(t[0]==="top"||t[0]==="bottom"?(t[1]=t[0],t[0]="center"):t[1]="center"),t.length!==2?null:[xw(fM(t[0])),xw(fM(t[1]))]}return[De(r[0]||0,"px"),De(r[1]||0,"px")]});function fM(r){return r==="center"?"50%":r==="left"||r==="top"?"0%":r==="right"||r==="bottom"?"100%":r}var Lx=[{n:"display",k:["none"]},{n:"opacity",int:!0,inh:!0,d:"1",syntax:ft.OPACITY_VALUE},{n:"fillOpacity",int:!0,inh:!0,d:"1",syntax:ft.OPACITY_VALUE},{n:"strokeOpacity",int:!0,inh:!0,d:"1",syntax:ft.OPACITY_VALUE},{n:"fill",int:!0,k:["none"],d:"none",syntax:ft.PAINT},{n:"fillRule",k:["nonzero","evenodd"],d:"nonzero"},{n:"stroke",int:!0,k:["none"],d:"none",syntax:ft.PAINT,l:!0},{n:"shadowType",k:["inner","outer","both"],d:"outer",l:!0},{n:"shadowColor",int:!0,syntax:ft.COLOR},{n:"shadowOffsetX",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"shadowOffsetY",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"shadowBlur",int:!0,l:!0,d:"0",syntax:ft.SHADOW_BLUR},{n:"lineWidth",int:!0,inh:!0,d:"1",l:!0,a:["strokeWidth"],syntax:ft.LENGTH_PERCENTAGE},{n:"increasedLineWidthForHitTesting",inh:!0,d:"0",l:!0,syntax:ft.LENGTH_PERCENTAGE},{n:"lineJoin",inh:!0,l:!0,a:["strokeLinejoin"],k:["miter","bevel","round"],d:"miter"},{n:"lineCap",inh:!0,l:!0,a:["strokeLinecap"],k:["butt","round","square"],d:"butt"},{n:"lineDash",int:!0,inh:!0,k:["none"],a:["strokeDasharray"],syntax:ft.LENGTH_PERCENTAGE_12},{n:"lineDashOffset",int:!0,inh:!0,d:"0",a:["strokeDashoffset"],syntax:ft.LENGTH_PERCENTAGE},{n:"offsetPath",syntax:ft.DEFINED_PATH},{n:"offsetDistance",int:!0,syntax:ft.OFFSET_DISTANCE},{n:"dx",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"dy",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"zIndex",ind:!0,int:!0,d:"0",k:["auto"],syntax:ft.Z_INDEX},{n:"visibility",k:["visible","hidden"],ind:!0,inh:!0,int:!0,d:"visible"},{n:"pointerEvents",inh:!0,k:["none","auto","stroke","fill","painted","visible","visiblestroke","visiblefill","visiblepainted","all"],d:"auto"},{n:"filter",ind:!0,l:!0,k:["none"],d:"none",syntax:ft.FILTER},{n:"clipPath",syntax:ft.DEFINED_PATH},{n:"textPath",syntax:ft.DEFINED_PATH},{n:"textPathSide",k:["left","right"],d:"left"},{n:"textPathStartOffset",l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"transform",p:100,int:!0,k:["none"],d:"none",syntax:ft.TRANSFORM},{n:"transformOrigin",p:100,d:"0 0",l:!0,syntax:ft.TRANSFORM_ORIGIN},{n:"cx",int:!0,l:!0,d:"0",syntax:ft.COORDINATE},{n:"cy",int:!0,l:!0,d:"0",syntax:ft.COORDINATE},{n:"cz",int:!0,l:!0,d:"0",syntax:ft.COORDINATE},{n:"r",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"rx",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"ry",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"x",int:!0,l:!0,d:"0",syntax:ft.COORDINATE},{n:"y",int:!0,l:!0,d:"0",syntax:ft.COORDINATE},{n:"z",int:!0,l:!0,d:"0",syntax:ft.COORDINATE},{n:"width",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"height",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"radius",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE_14},{n:"x1",int:!0,l:!0,syntax:ft.COORDINATE},{n:"y1",int:!0,l:!0,syntax:ft.COORDINATE},{n:"z1",int:!0,l:!0,syntax:ft.COORDINATE},{n:"x2",int:!0,l:!0,syntax:ft.COORDINATE},{n:"y2",int:!0,l:!0,syntax:ft.COORDINATE},{n:"z2",int:!0,l:!0,syntax:ft.COORDINATE},{n:"d",int:!0,l:!0,d:"",syntax:ft.PATH,p:50},{n:"points",int:!0,l:!0,syntax:ft.LIST_OF_POINTS,p:50},{n:"text",l:!0,d:"",syntax:ft.TEXT,p:50},{n:"textTransform",l:!0,inh:!0,k:["capitalize","uppercase","lowercase","none"],d:"none",syntax:ft.TEXT_TRANSFORM,p:51},{n:"font",l:!0},{n:"fontSize",int:!0,inh:!0,d:"16px",l:!0,syntax:ft.LENGTH_PERCENTAGE},{n:"fontFamily",l:!0,inh:!0,d:"sans-serif"},{n:"fontStyle",l:!0,inh:!0,k:["normal","italic","oblique"],d:"normal"},{n:"fontWeight",l:!0,inh:!0,k:["normal","bold","bolder","lighter"],d:"normal"},{n:"fontVariant",l:!0,inh:!0,k:["normal","small-caps"],d:"normal"},{n:"lineHeight",l:!0,syntax:ft.LENGTH,int:!0,d:"0"},{n:"letterSpacing",l:!0,syntax:ft.LENGTH,int:!0,d:"0"},{n:"miterLimit",l:!0,syntax:ft.NUMBER,d:function(t){return t===Q.PATH||t===Q.POLYGON||t===Q.POLYLINE?"4":"10"}},{n:"wordWrap",l:!0},{n:"wordWrapWidth",l:!0},{n:"maxLines",l:!0},{n:"textOverflow",l:!0,d:"clip"},{n:"leading",l:!0},{n:"textBaseline",l:!0,inh:!0,k:["top","hanging","middle","alphabetic","ideographic","bottom"],d:"alphabetic"},{n:"textAlign",l:!0,inh:!0,k:["start","center","middle","end","left","right"],d:"start"},{n:"markerStart",syntax:ft.MARKER},{n:"markerEnd",syntax:ft.MARKER},{n:"markerMid",syntax:ft.MARKER},{n:"markerStartOffset",syntax:ft.LENGTH,l:!0,int:!0,d:"0"},{n:"markerEndOffset",syntax:ft.LENGTH,l:!0,int:!0,d:"0"}],hH=new Set(Lx.filter(function(r){return!!r.l}).map(function(r){return r.n})),OL={},dH=function(){function r(t){var e=this;at(this,r),this.runtime=t,Lx.forEach(function(n){e.registerMetadata(n)})}return it(r,[{key:"registerMetadata",value:function(e){[e.n].concat(Te(e.a||[])).forEach(function(n){OL[n]=e})}},{key:"getPropertySyntax",value:function(e){return this.runtime.CSSPropertySyntaxFactory[e]}},{key:"processProperties",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{forceUpdateGeometry:!1};Object.assign(e.attributes,n);var a=e.parsedStyle.clipPath,s=e.parsedStyle.offsetPath;fH(e,n);var o=!!i.forceUpdateGeometry;if(!o){for(var l in n)if(hH.has(l)){o=!0;break}}var u=CL(e);u.has("fill")&&n.fill&&(e.parsedStyle.fill=ec(n.fill)),u.has("stroke")&&n.stroke&&(e.parsedStyle.stroke=ec(n.stroke)),u.has("shadowColor")&&n.shadowColor&&(e.parsedStyle.shadowColor=ec(n.shadowColor)),u.has("filter")&&n.filter&&(e.parsedStyle.filter=qV(n.filter)),u.has("radius")&&!kt(n.radius)&&(e.parsedStyle.radius=sM(n.radius,4)),u.has("lineDash")&&!kt(n.lineDash)&&(e.parsedStyle.lineDash=sM(n.lineDash,"even")),u.has("points")&&n.points&&(e.parsedStyle.points=JV(n.points)),u.has("d")&&n.d===""&&(e.parsedStyle.d=Ft({},dL)),u.has("d")&&n.d&&(e.parsedStyle.d=ML(n.d)),u.has("textTransform")&&n.textTransform&&this.runtime.CSSPropertySyntaxFactory[ft.TEXT_TRANSFORM].calculator(null,null,{value:n.textTransform},e,null),u.has("clipPath")&&!Pt(n.clipPath)&&this.runtime.CSSPropertySyntaxFactory[ft.DEFINED_PATH].calculator("clipPath",a,n.clipPath,e,this.runtime),u.has("offsetPath")&&n.offsetPath&&this.runtime.CSSPropertySyntaxFactory[ft.DEFINED_PATH].calculator("offsetPath",s,n.offsetPath,e,this.runtime),u.has("transform")&&n.transform&&(e.parsedStyle.transform=TL(n.transform)),u.has("transformOrigin")&&n.transformOrigin&&(e.parsedStyle.transformOrigin=cH(n.transformOrigin)),u.has("markerStart")&&n.markerStart&&(e.parsedStyle.markerStart=this.runtime.CSSPropertySyntaxFactory[ft.MARKER].calculator(null,n.markerStart,n.markerStart,null,null)),u.has("markerEnd")&&n.markerEnd&&(e.parsedStyle.markerEnd=this.runtime.CSSPropertySyntaxFactory[ft.MARKER].calculator(null,n.markerEnd,n.markerEnd,null,null)),u.has("markerMid")&&n.markerMid&&(e.parsedStyle.markerMid=this.runtime.CSSPropertySyntaxFactory[ft.MARKER].calculator("",n.markerMid,n.markerMid,null,null)),u.has("zIndex")&&!kt(n.zIndex)&&this.runtime.CSSPropertySyntaxFactory[ft.Z_INDEX].postProcessor(e),u.has("offsetDistance")&&!kt(n.offsetDistance)&&this.runtime.CSSPropertySyntaxFactory[ft.OFFSET_DISTANCE].postProcessor(e),u.has("transform")&&n.transform&&this.runtime.CSSPropertySyntaxFactory[ft.TRANSFORM].postProcessor(e),u.has("transformOrigin")&&n.transformOrigin&&this.runtime.CSSPropertySyntaxFactory[ft.TRANSFORM_ORIGIN].postProcessor(e),o&&(e.geometry.dirty=!0,e.renderable.boundsDirty=!0,e.renderable.renderBoundsDirty=!0,i.forceUpdateGeometry||this.runtime.sceneGraphService.dirtifyToRoot(e))}},{key:"updateGeometry",value:function(e){var n=e.nodeName,i=this.runtime.geometryUpdaterFactory[n];if(i){var a=e.geometry;a.contentBounds||(a.contentBounds=new Me),a.renderBounds||(a.renderBounds=new Me);var s=e.parsedStyle,o=i.update(s,e),l=o.cx,u=l===void 0?0:l,c=o.cy,h=c===void 0?0:c,d=o.cz,g=d===void 0?0:d,p=o.hwidth,v=p===void 0?0:p,m=o.hheight,b=m===void 0?0:m,w=o.hdepth,x=w===void 0?0:w,_=[Math.abs(v),Math.abs(b),x],S=s.stroke,M=s.lineWidth,k=M===void 0?1:M,T=s.increasedLineWidthForHitTesting,P=T===void 0?0:T,O=s.shadowType,A=O===void 0?"outer":O,R=s.shadowColor,L=s.filter,q=L===void 0?[]:L,j=s.transformOrigin,$=[u,h,g];a.contentBounds.update($,_);var B=n===Q.POLYLINE||n===Q.POLYGON||n===Q.PATH?Math.SQRT2:.5,F=S&&!S.isNone;if(F){var V=((k||0)+(P||0))*B;_[0]+=V,_[1]+=V}if(a.renderBounds.update($,_),R&&A&&A!=="inner"){var X=a.renderBounds,K=X.min,dt=X.max,ct=s.shadowBlur,ht=s.shadowOffsetX,lt=s.shadowOffsetY,pt=ct||0,wt=ht||0,Bt=lt||0,Ut=K[0]-pt+wt,Fe=dt[0]+pt+wt,Gn=K[1]-pt+Bt,on=dt[1]+pt+Bt;K[0]=Math.min(K[0],Ut),dt[0]=Math.max(dt[0],Fe),K[1]=Math.min(K[1],Gn),dt[1]=Math.max(dt[1],on),a.renderBounds.setMinMax(K,dt)}q.forEach(function(Wt){var Kr=Wt.name,Cr=Wt.params;if(Kr==="blur"){var ji=Cr[0].value;a.renderBounds.update(a.renderBounds.center,As(a.renderBounds.halfExtents,a.renderBounds.halfExtents,[ji,ji,0]))}else if(Kr==="drop-shadow"){var mn=Cr[0].value,Ln=Cr[1].value,Be=Cr[2].value,ha=a.renderBounds,kn=ha.min,wi=ha.max,qi=kn[0]-Be+mn,tr=wi[0]+Be+mn,Za=kn[1]-Be+Ln,Ja=wi[1]+Be+Ln;kn[0]=Math.min(kn[0],qi),wi[0]=Math.max(wi[0],tr),kn[1]=Math.min(kn[1],Za),wi[1]=Math.max(wi[1],Ja),a.renderBounds.setMinMax(kn,wi)}}),e.geometry.dirty=!1;var dr=v<0,Rn=b<0,te=(dr?-1:1)*(j?Br(j[0],0,e,!0):0),bi=(Rn?-1:1)*(j?Br(j[1],1,e,!0):0);(te||bi)&&e.setOrigin(te,bi)}}},{key:"updateSizeAttenuation",value:function(e,n){e.style.isSizeAttenuation?(e.style.rawLineWidth||(e.style.rawLineWidth=e.style.lineWidth),e.style.lineWidth=(e.style.rawLineWidth||1)/n,e.nodeName===Q.CIRCLE&&(e.style.rawR||(e.style.rawR=e.style.r),e.style.r=(e.style.rawR||1)/n)):(e.style.rawLineWidth&&(e.style.lineWidth=e.style.rawLineWidth,delete e.style.rawLineWidth),e.nodeName===Q.CIRCLE&&e.style.rawR&&(e.style.r=e.style.rawR,delete e.style.rawR))}}])}();function fH(r,t){var e=CL(r);for(var n in t)e.has(n)&&(r.parsedStyle[n]=t[n])}function CL(r){return r.constructor.PARSED_STYLE_LIST}var gH=function(){function r(){at(this,r),this.mixer=Nx}return it(r,[{key:"calculator",value:function(e,n,i,a){return Er(i)}}])}(),pH=function(){function r(){at(this,r)}return it(r,[{key:"calculator",value:function(e,n,i,a,s){return i instanceof pi&&(i=null),s.sceneGraphService.updateDisplayObjectDependency(e,n,i,a),e==="clipPath"&&a.forEach(function(o){o.childNodes.length===0&&s.sceneGraphService.dirtifyToRoot(o)}),i}}])}(),vH=function(){function r(){at(this,r),this.parser=ec,this.mixer=IV}return it(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof pi?i.value==="none"?pL:vL:i}}])}(),mH=function(){function r(){at(this,r)}return it(r,[{key:"calculator",value:function(e,n,i){return i instanceof pi?[]:i}}])}();function gM(r){var t=r.parsedStyle,e=t.fontSize;return kt(e)?null:e}var Mw=function(){function r(){at(this,r),this.mixer=Nx}return it(r,[{key:"calculator",value:function(e,n,i,a,s){if(yt(i))return i;if(Cn.isRelativeUnit(i.unit)){if(i.unit===gt.kPercentage)return 0;if(i.unit===gt.kEms){if(a.parentNode){var o=gM(a.parentNode);if(o)return o*=i.value,o}return 0}if(i.unit===gt.kRems){var l;if(a!=null&&(l=a.ownerDocument)!==null&&l!==void 0&&l.documentElement){var u=gM(a.ownerDocument.documentElement);if(u)return u*=i.value,u}return 0}}else return i.value}}])}(),yH=function(){function r(){at(this,r),this.mixer=_L}return it(r,[{key:"calculator",value:function(e,n,i){return i.map(function(a){return a.value})}}])}(),bH=function(){function r(){at(this,r),this.mixer=_L}return it(r,[{key:"calculator",value:function(e,n,i){return i.map(function(a){return a.value})}}])}(),wH=function(){function r(){at(this,r)}return it(r,[{key:"calculator",value:function(e,n,i,a){var s;i instanceof pi&&(i=null);var o=(s=i)===null||s===void 0?void 0:s.cloneNode(!0);return o&&(o.style.isMarker=!0),o}}])}(),xH=function(){function r(){at(this,r),this.mixer=Nx}return it(r,[{key:"calculator",value:function(e,n,i){return i.value}}])}(),EH=function(){function r(){at(this,r),this.mixer=Rx(0,1)}return it(r,[{key:"calculator",value:function(e,n,i){return i.value}},{key:"postProcessor",value:function(e){var n=e.parsedStyle,i=n.offsetPath,a=n.offsetDistance;if(i){var s=i.nodeName;if(s===Q.LINE||s===Q.PATH||s===Q.POLYLINE){var o=i.getPoint(a);o&&e.setLocalPosition(o.x,o.y)}}}}])}(),_H=function(){function r(){at(this,r),this.mixer=Rx(0,1)}return it(r,[{key:"calculator",value:function(e,n,i){return i.value}}])}(),SH=function(){function r(){at(this,r),this.parser=ML,this.mixer=ZV}return it(r,[{key:"calculator",value:function(e,n,i){return i instanceof pi&&i.value==="unset"?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Wl(0,0,0,0)}:i}}])}(),MH=it(function r(){at(this,r),this.mixer=QV}),kH=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.mixer=Rx(0,1/0),e}return jt(t,r),it(t)}(Mw),TH=function(){function r(){at(this,r)}return it(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof pi?i.value==="unset"?"":i.value:"".concat(i)}},{key:"postProcessor",value:function(e){e.nodeValue="".concat(e.parsedStyle.text)||""}}])}(),OH=function(){function r(){at(this,r)}return it(r,[{key:"calculator",value:function(e,n,i,a){var s=a.getAttribute("text");if(s){var o=s;i.value==="capitalize"?o=s.charAt(0).toUpperCase()+s.slice(1):i.value==="lowercase"?o=s.toLowerCase():i.value==="uppercase"&&(o=s.toUpperCase()),a.parsedStyle.text=o}return i.value}}])}(),Mv=new WeakMap;function CH(r,t,e){if(r){var n=typeof r=="string"?document.getElementById(r):r;Mv.has(n)&&Mv.get(n).destroy(e),Mv.set(n,t)}}var Ix=typeof window<"u"&&typeof window.document<"u";function AH(r){return!!r.getAttribute}function PH(r,t){for(var e=0,n=r.length;e<n;){var i=e+n>>>1;AL(r[i],t)<0?e=i+1:n=i}return e}function AL(r,t){var e=Number(r.parsedStyle.zIndex||0),n=Number(t.parsedStyle.zIndex||0);if(e===n){var i=r.parentNode;if(i){var a=i.childNodes||[];return a.indexOf(r)-a.indexOf(t)}}return e-n}function PL(r){var t=r;do{var e,n=(e=t.parsedStyle)===null||e===void 0?void 0:e.clipPath;if(n)return t;t=t.parentElement}while(t!==null);return null}var pM="px";function NH(r,t,e){Ix&&r.style&&(r.style.width=t+pM,r.style.height=e+pM)}function NL(r,t){if(Ix)return document.defaultView.getComputedStyle(r,null).getPropertyValue(t)}function RH(r){var t=NL(r,"width");return t==="auto"?r.offsetWidth:parseFloat(t)}function LH(r){var t=NL(r,"height");return t==="auto"?r.offsetHeight:parseFloat(t)}var IH=1,DH={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},kw=typeof performance=="object"&&performance.now?performance:Date;function kf(r){return r.nodeName===Q.FRAGMENT?!0:r.getRootNode().nodeName===Q.FRAGMENT}function Wo(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"auto",t=arguments.length>1?arguments[1]:void 0,e=arguments.length>2?arguments[2]:void 0,n=!1,i=!1,a=!!t&&!t.isNone,s=!!e&&!e.isNone;return r==="visiblepainted"||r==="painted"||r==="auto"?(n=a,i=s):r==="visiblefill"||r==="fill"?n=!0:r==="visiblestroke"||r==="stroke"?i=!0:(r==="visible"||r==="all")&&(n=!0,i=!0),[n,i]}var FH=1,BH=function(){return FH++},ra=typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:{},zH=Date.now(),$H=function(){return ra.performance&&typeof ra.performance.now=="function"?ra.performance.now():Date.now()-zH},Du={},vM=Date.now(),jH=function(t){if(typeof t!="function")throw new TypeError("".concat(t," is not a function"));var e=Date.now(),n=e-vM,i=n>16?0:16-n,a=BH();return Du[a]=t,Object.keys(Du).length>1||setTimeout(function(){vM=e;var s=Du;Du={},Object.keys(s).forEach(function(o){return s[o]($H())})},i),a},qH=function(t){delete Du[t]},WH=["","webkit","moz","ms","o"],RL=function(t){return typeof t!="string"?jH:t===""?ra.requestAnimationFrame:ra["".concat(t,"RequestAnimationFrame")]},GH=function(t){return typeof t!="string"?qH:t===""?ra.cancelAnimationFrame:ra["".concat(t,"CancelAnimationFrame")]||ra["".concat(t,"CancelRequestAnimationFrame")]},VH=function(t,e){for(var n=0;t[n]!==void 0;){if(e(t[n]))return t[n];n+=1}},LL=VH(WH,function(r){return!!RL(r)}),Dx=RL(LL),IL=GH(LL);ra.requestAnimationFrame=Dx;ra.cancelAnimationFrame=IL;var HH=function(){function r(){at(this,r),this.callbacks=[]}return it(r,[{key:"getCallbacksNum",value:function(){return this.callbacks.length}},{key:"tapPromise",value:function(e,n){this.callbacks.push(n)}},{key:"promise",value:function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return Promise.all(this.callbacks.map(function(a){return a.apply(void 0,n)}))}}])}(),UH=function(){function r(){at(this,r),this.callbacks=[]}return it(r,[{key:"tapPromise",value:function(e,n){this.callbacks.push(n)}},{key:"promise",value:function(){var t=Fs($n().mark(function n(){var i,a,s,o,l=arguments;return $n().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(!this.callbacks.length){c.next=14;break}return c.next=3,(i=this.callbacks)[0].apply(i,l);case 3:a=c.sent,s=0;case 5:if(!(s<this.callbacks.length-1)){c.next=13;break}return o=this.callbacks[s],c.next=9,o(a);case 9:a=c.sent;case 10:s++,c.next=5;break;case 13:return c.abrupt("return",a);case 14:return c.abrupt("return",null);case 15:case"end":return c.stop()}},n,this)}));function e(){return t.apply(this,arguments)}return e}()}])}(),ir=function(){function r(){at(this,r),this.callbacks=[]}return it(r,[{key:"tap",value:function(e,n){this.callbacks.push(n)}},{key:"call",value:function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];var a=arguments;this.callbacks.forEach(function(s){s.apply(void 0,a)})}}])}(),kv=function(){function r(){at(this,r),this.callbacks=[]}return it(r,[{key:"tap",value:function(e,n){this.callbacks.push(n)}},{key:"call",value:function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];if(this.callbacks.length){for(var a=arguments,s=this.callbacks[0].apply(void 0,a),o=0;o<this.callbacks.length-1;o++){var l=this.callbacks[o];s=l(s)}return s}return null}}])}(),YH=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],XH=/([\"\'])[^\'\"]+\1/;function KH(r){for(var t=r.fontSize,e=t===void 0?16:t,n=r.fontFamily,i=n===void 0?"sans-serif":n,a=r.fontStyle,s=a===void 0?"normal":a,o=r.fontVariant,l=o===void 0?"normal":o,u=r.fontWeight,c=u===void 0?"normal":u,h=yt(e)&&"".concat(e,"px")||"16px",d=i.split(","),g=d.length-1;g>=0;g--){var p=d[g].trim();!XH.test(p)&&YH.indexOf(p)<0&&(p='"'.concat(p,'"')),d[g]=p}return"".concat(s," ").concat(l," ").concat(c," ").concat(h," ").concat(d.join(","))}function Tv(r,t,e){return Bs(r),r[4]=Math.tan(t),r[1]=Math.tan(e),r}var rn=Se(),ZH=Se(),JH={scale:function(t){po(rn,[t[0].value,t[1].value,1])},scaleX:function(t){po(rn,[t[0].value,1,1])},scaleY:function(t){po(rn,[1,t[0].value,1])},scaleZ:function(t){po(rn,[1,1,t[0].value])},scale3d:function(t){po(rn,[t[0].value,t[1].value,t[2].value])},translate:function(t){bs(rn,[t[0].value,t[1].value,0])},translateX:function(t){bs(rn,[t[0].value,0,0])},translateY:function(t){bs(rn,[0,t[0].value,0])},translateZ:function(t){bs(rn,[0,0,t[0].value])},translate3d:function(t){bs(rn,[t[0].value,t[1].value,t[2].value])},rotate:function(t){iw(rn,me(Er(t[0])))},rotateX:function(t){IR(rn,me(Er(t[0])))},rotateY:function(t){DR(rn,me(Er(t[0])))},rotateZ:function(t){iw(rn,me(Er(t[0])))},rotate3d:function(t){LR(rn,me(Er(t[3])),[t[0].value,t[1].value,t[2].value])},skew:function(t){Tv(rn,me(t[0].value),me(t[1].value))},skewX:function(t){Tv(rn,me(t[0].value),0)},skewY:function(t){Tv(rn,0,me(t[0].value))},matrix:function(t){rw(rn,t[0].value,t[1].value,0,0,t[2].value,t[3].value,0,0,0,0,1,0,t[4].value,t[5].value,0,1)},matrix3d:function(t){rw.apply(Kq,[rn].concat(Te(t.map(function(e){return e.value}))))}},QH=Ce(1,1,1),tU=Qt(),mM={translate:function(t,e){st.sceneGraphService.setLocalScale(t,QH,!1),st.sceneGraphService.setLocalEulerAngles(t,tU,void 0,void 0,!1),st.sceneGraphService.setLocalPosition(t,[e[0].value,e[1].value,0],!1),st.sceneGraphService.dirtifyLocal(t,t.transformable)}};function DL(r,t){if(r.length){if(r.length===1&&mM[r[0].t]){mM[r[0].t](t,r[0].d);return}for(var e=Bs(ZH),n=0;n<r.length;n++){var i=r[n],a=i.t,s=i.d,o=JH[a];o&&(o(s),GR(e,e,rn))}t.setLocalTransform(e)}else t.resetLocalTransform();return t.getLocalTransform()}var eU=function(){function r(){at(this,r),this.parser=tH,this.mixer=uH}return it(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof pi?[]:i}},{key:"postProcessor",value:function(e){DL(e.parsedStyle.transform,e)}}])}(),nU=function(){function r(){at(this,r)}return it(r,[{key:"postProcessor",value:function(e){var n=e.parsedStyle.transformOrigin;n[0].unit===gt.kPixels&&n[1].unit===gt.kPixels?e.setOrigin(n[0].value,n[1].value):e.getGeometryBounds()}}])}(),rU=function(){function r(){at(this,r)}return it(r,[{key:"calculator",value:function(e,n,i,a){return i.value}},{key:"postProcessor",value:function(e){if(e.parentNode){var n=e.parentNode,i=n.renderable,a=n.sortable;i&&(i.dirty=!0),a&&(a.dirty=!0,a.dirtyReason=xf.Z_INDEX_CHANGED)}}}])}(),iU=function(){function r(){at(this,r)}return it(r,[{key:"update",value:function(e,n){var i=e.cx,a=i===void 0?0:i,s=e.cy,o=s===void 0?0:s,l=e.r,u=l===void 0?0:l;return{cx:a,cy:o,hwidth:u,hheight:u}}}])}(),aU=function(){function r(){at(this,r)}return it(r,[{key:"update",value:function(e,n){var i=e.cx,a=i===void 0?0:i,s=e.cy,o=s===void 0?0:s,l=e.rx,u=l===void 0?0:l,c=e.ry,h=c===void 0?0:c;return{cx:a,cy:o,hwidth:u,hheight:h}}}])}(),sU=function(){function r(){at(this,r)}return it(r,[{key:"update",value:function(e){var n=e.x1,i=e.y1,a=e.x2,s=e.y2,o=Math.min(n,a),l=Math.max(n,a),u=Math.min(i,s),c=Math.max(i,s),h=l-o,d=c-u,g=h/2,p=d/2;return{cx:o+g,cy:u+p,hwidth:g,hheight:p}}}])}(),oU=function(){function r(){at(this,r)}return it(r,[{key:"update",value:function(e){var n=e.d,i=n.rect,a=i.x,s=i.y,o=i.width,l=i.height,u=o/2,c=l/2;return{cx:a+u,cy:s+c,hwidth:u,hheight:c}}}])}(),lU=function(){function r(){at(this,r)}return it(r,[{key:"update",value:function(e){if(e.points&&Xr(e.points.points)){var n=e.points.points,i=Math.min.apply(Math,Te(n.map(function(d){return d[0]}))),a=Math.max.apply(Math,Te(n.map(function(d){return d[0]}))),s=Math.min.apply(Math,Te(n.map(function(d){return d[1]}))),o=Math.max.apply(Math,Te(n.map(function(d){return d[1]}))),l=a-i,u=o-s,c=l/2,h=u/2;return{cx:i+c,cy:s+h,hwidth:c,hheight:h}}return{cx:0,cy:0,hwidth:0,hheight:0}}}])}(),uU=function(){function r(){at(this,r)}return it(r,[{key:"update",value:function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s,l=e.src,u=e.width,c=u===void 0?0:u,h=e.height,d=h===void 0?0:h,g=c,p=d;return l&&!oe(l)&&(g||(g=l.width,e.width=g),p||(p=l.height,e.height=p)),{cx:a+g/2,cy:o+p/2,hwidth:g/2,hheight:p/2}}}])}(),cU=function(){function r(t){at(this,r),this.globalRuntime=t}return it(r,[{key:"isReadyToMeasure",value:function(e,n){var i=e.text;return i}},{key:"update",value:function(e,n){var i,a=e.text,s=e.textAlign,o=s===void 0?"start":s,l=e.lineWidth,u=l===void 0?1:l,c=e.textBaseline,h=c===void 0?"alphabetic":c,d=e.dx,g=d===void 0?0:d,p=e.dy,v=p===void 0?0:p,m=e.x,b=m===void 0?0:m,w=e.y,x=w===void 0?0:w;if(!this.isReadyToMeasure(e,n))return e.metrics={font:"",width:0,height:0,lines:[],lineWidths:[],lineHeight:0,maxLineWidth:0,fontProperties:{ascent:0,descent:0,fontSize:0},lineMetrics:[]},{hwidth:0,hheight:0,cx:0,cy:0};var _=(n==null||(i=n.ownerDocument)===null||i===void 0||(i=i.defaultView)===null||i===void 0?void 0:i.getConfig())||{},S=_.offscreenCanvas,M=this.globalRuntime.textService.measureText(a,e,S);e.metrics=M;var k=M.width,T=M.height,P=k/2,O=T/2,A=b+P;o==="center"||o==="middle"?A+=u/2-P:(o==="right"||o==="end")&&(A+=u-P*2);var R=x-O;return h==="middle"?R+=O:h==="top"||h==="hanging"?R+=O*2:h==="alphabetic"||(h==="bottom"||h==="ideographic")&&(R+=0),g&&(A+=g),v&&(R+=v),{cx:A,cy:R,hwidth:P,hheight:O}}}])}(),hU=function(){function r(){at(this,r)}return it(r,[{key:"update",value:function(e,n){return{cx:0,cy:0,hwidth:0,hheight:0}}}])}(),dU=function(){function r(){at(this,r)}return it(r,[{key:"update",value:function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s,l=e.width,u=l===void 0?0:l,c=e.height,h=c===void 0?0:c;return{cx:a+u/2,cy:o+h/2,hwidth:u/2,hheight:h/2}}}])}(),sg=function(){function r(t){at(this,r),this.eventPhase=r.prototype.NONE,this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.defaultPrevented=!1,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new Bn,this.page=new Bn,this.canvas=new Bn,this.viewport=new Bn,this.composed=!1,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}return it(r,[{key:"name",get:function(){return this.type}},{key:"layerX",get:function(){return this.layer.x}},{key:"layerY",get:function(){return this.layer.y}},{key:"pageX",get:function(){return this.page.x}},{key:"pageY",get:function(){return this.page.y}},{key:"x",get:function(){return this.canvas.x}},{key:"y",get:function(){return this.canvas.y}},{key:"canvasX",get:function(){return this.canvas.x}},{key:"canvasY",get:function(){return this.canvas.y}},{key:"viewportX",get:function(){return this.viewport.x}},{key:"viewportY",get:function(){return this.viewport.y}},{key:"composedPath",value:function(){return this.manager&&(!this.path||this.path[0]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}},{key:"propagationPath",get:function(){return this.composedPath()}},{key:"preventDefault",value:function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}},{key:"stopImmediatePropagation",value:function(){this.propagationImmediatelyStopped=!0}},{key:"stopPropagation",value:function(){this.propagationStopped=!0}},{key:"initEvent",value:function(){}},{key:"initUIEvent",value:function(){}},{key:"clone",value:function(){throw new Error(pe)}}])}(),FL=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.client=new Bn,e.movement=new Bn,e.offset=new Bn,e.global=new Bn,e.screen=new Bn,e}return jt(t,r),it(t,[{key:"clientX",get:function(){return this.client.x}},{key:"clientY",get:function(){return this.client.y}},{key:"movementX",get:function(){return this.movement.x}},{key:"movementY",get:function(){return this.movement.y}},{key:"offsetX",get:function(){return this.offset.x}},{key:"offsetY",get:function(){return this.offset.y}},{key:"globalX",get:function(){return this.global.x}},{key:"globalY",get:function(){return this.global.y}},{key:"screenX",get:function(){return this.screen.x}},{key:"screenY",get:function(){return this.screen.y}},{key:"getModifierState",value:function(n){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(n)}},{key:"initMouseEvent",value:function(){throw new Error(pe)}}])}(sg),Tf=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.width=0,e.height=0,e.isPrimary=!1,e}return jt(t,r),it(t,[{key:"getCoalescedEvents",value:function(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}},{key:"getPredictedEvents",value:function(){throw new Error("getPredictedEvents is not supported!")}},{key:"clone",value:function(){return this.manager.clonePointerEvent(this)}}])}(FL),Tw=function(r){function t(){return at(this,t),qt(this,t,arguments)}return jt(t,r),it(t,[{key:"clone",value:function(){return this.manager.cloneWheelEvent(this)}}])}(FL),cn=function(r){function t(e,n){var i;return at(this,t),i=qt(this,t,[null]),i.type=e,i.detail=n,Object.assign(i,n),i}return jt(t,r),it(t)}(sg),yM=new WeakMap,BL=function(){function r(){at(this,r),this.emitter=new MR}return it(r,[{key:"on",value:function(e,n,i){return this.addEventListener(e,n,i),this}},{key:"addEventListener",value:function(e,n,i){var a=!1,s=!1;if(yf(i))a=i;else if(i){var o=i.capture;a=o===void 0?!1:o;var l=i.once;s=l===void 0?!1:l}a&&(e+="capture"),n=Et(n)?n:n.handleEvent;var u=Et(n)?void 0:n;return s?this.emitter.once(e,n,u):this.emitter.on(e,n,u),this}},{key:"off",value:function(e,n,i){return e?this.removeEventListener(e,n,i):this.removeAllEventListeners(),this}},{key:"removeAllEventListeners",value:function(){var e;(e=this.emitter)===null||e===void 0||e.removeAllListeners()}},{key:"removeEventListener",value:function(e,n,i){var a;if(!this.emitter)return this;var s=yf(i)?i:i==null?void 0:i.capture;s&&(e+="capture"),n=Et(n)?n:(a=n)===null||a===void 0?void 0:a.handleEvent;var o=Et(n)?void 0:n;return this.emitter.off(e,n,o),this}},{key:"emit",value:function(e,n){this.dispatchEvent(new cn(e,n))}},{key:"dispatchEvent",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=yM.get(this);if(!i){var a;this.document?i=this:this.defaultView?i=this.defaultView:i=(a=this.ownerDocument)===null||a===void 0?void 0:a.defaultView,i&&yM.set(this,i)}if(i){if(e.manager=i.getEventService(),!e.manager)return!1;e.defaultPrevented=!1,e.path?e.path.length=0:e.page=[],n||(e.target=this),e.manager.dispatchEvent(e,e.type,n)}else this.emitter.emit(e.type,e);return!e.defaultPrevented}}])}(),$e=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.shadow=!1,e.ownerDocument=null,e.isConnected=!1,e.baseURI="",e.childNodes=[],e.nodeType=0,e.nodeName="",e.nodeValue=null,e.parentNode=null,e}return jt(t,r),it(t,[{key:"textContent",get:function(){var n="";this.nodeName===Q.TEXT&&(n+=this.style.text);var i=vo(this.childNodes),a;try{for(i.s();!(a=i.n()).done;){var s=a.value;s.nodeName===Q.TEXT?n+=s.nodeValue:n+=s.textContent}}catch(o){i.e(o)}finally{i.f()}return n},set:function(n){var i=this;this.childNodes.slice().forEach(function(a){i.removeChild(a)}),this.nodeName===Q.TEXT&&(this.style.text="".concat(n))}},{key:"getRootNode",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.parentNode?this.parentNode.getRootNode(n):n.composed&&this.host?this.host.getRootNode(n):this}},{key:"hasChildNodes",value:function(){return this.childNodes.length>0}},{key:"isDefaultNamespace",value:function(n){throw new Error(pe)}},{key:"lookupNamespaceURI",value:function(n){throw new Error(pe)}},{key:"lookupPrefix",value:function(n){throw new Error(pe)}},{key:"normalize",value:function(){throw new Error(pe)}},{key:"isEqualNode",value:function(n){return this===n}},{key:"isSameNode",value:function(n){return this.isEqualNode(n)}},{key:"parent",get:function(){return this.parentNode}},{key:"parentElement",get:function(){return null}},{key:"nextSibling",get:function(){return null}},{key:"previousSibling",get:function(){return null}},{key:"firstChild",get:function(){return this.childNodes.length>0?this.childNodes[0]:null}},{key:"lastChild",get:function(){return this.childNodes.length>0?this.childNodes[this.childNodes.length-1]:null}},{key:"compareDocumentPosition",value:function(n){if(n===this)return 0;for(var i=n,a=this,s=[i],o=[a];(l=i.parentNode)!==null&&l!==void 0?l:a.parentNode;){var l;i=i.parentNode?(s.push(i.parentNode),i.parentNode):i,a=a.parentNode?(o.push(a.parentNode),a.parentNode):a}if(i!==a)return t.DOCUMENT_POSITION_DISCONNECTED|t.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|t.DOCUMENT_POSITION_PRECEDING;var u=s.length>o.length?s:o,c=u===s?o:s;if(u[u.length-c.length]===c[0])return u===s?t.DOCUMENT_POSITION_CONTAINED_BY|t.DOCUMENT_POSITION_FOLLOWING:t.DOCUMENT_POSITION_CONTAINS|t.DOCUMENT_POSITION_PRECEDING;for(var h=u.length-c.length,d=c.length-1;d>=0;d--){var g=c[d],p=u[h+d];if(p!==g){var v=g.parentNode.childNodes;return v.indexOf(g)<v.indexOf(p)?c===s?t.DOCUMENT_POSITION_PRECEDING:t.DOCUMENT_POSITION_FOLLOWING:u===s?t.DOCUMENT_POSITION_PRECEDING:t.DOCUMENT_POSITION_FOLLOWING}}return t.DOCUMENT_POSITION_FOLLOWING}},{key:"contain",value:function(n){return this.contains(n)}},{key:"contains",value:function(n){for(var i=n;i&&this!==i;)i=i.parentNode;return!!i}},{key:"getAncestor",value:function(n){for(var i=this;n>0&&i;)i=i.parentNode,n--;return i}},{key:"forEach",value:function(n){for(var i=[this];i.length>0;){var a=i.pop(),s=n(a);if(s===!1)break;for(var o=a.childNodes.length-1;o>=0;o--)i.push(a.childNodes[o])}}}],[{key:"isNode",value:function(n){return!!n.childNodes}}])}(BL);$e.DOCUMENT_POSITION_DISCONNECTED=1;$e.DOCUMENT_POSITION_PRECEDING=2;$e.DOCUMENT_POSITION_FOLLOWING=4;$e.DOCUMENT_POSITION_CONTAINS=8;$e.DOCUMENT_POSITION_CONTAINED_BY=16;$e.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;var fU=2048,gU=function(){function r(t,e){var n=this;at(this,r),this.nativeHTMLMap=new WeakMap,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.tmpMatrix=Se(),this.tmpVec3=Qt(),this.onPointerDown=function(i){var a=n.createPointerEvent(i);if(n.dispatchEvent(a,"pointerdown"),a.pointerType==="touch")n.dispatchEvent(a,"touchstart");else if(a.pointerType==="mouse"||a.pointerType==="pen"){var s=a.button===2;n.dispatchEvent(a,s?"rightdown":"mousedown")}var o=n.trackingData(i.pointerId);o.pressTargetsByButton[i.button]=a.composedPath(),n.freeEvent(a)},this.onPointerUp=function(i){var a=kw.now(),s=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);if(n.dispatchEvent(s,"pointerup"),s.pointerType==="touch")n.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var o=s.button===2;n.dispatchEvent(s,o?"rightup":"mouseup")}var l=n.trackingData(i.pointerId),u=n.findMountedTarget(l.pressTargetsByButton[i.button]),c=u;if(u&&!s.composedPath().includes(u)){for(var h=u;h&&!s.composedPath().includes(h);){if(s.currentTarget=h,n.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")n.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var d=s.button===2;n.notifyTarget(s,d?"rightupoutside":"mouseupoutside")}$e.isNode(h)&&(h=h.parentNode)}delete l.pressTargetsByButton[i.button],c=h}if(c){var g,p=n.clonePointerEvent(s,"click");p.target=c,p.path=[],l.clicksByButton[i.button]||(l.clicksByButton[i.button]={clickCount:0,target:p.target,timeStamp:a});var v=n.context.renderingContext.root.ownerDocument.defaultView,m=l.clicksByButton[i.button];m.target===p.target&&a-m.timeStamp<v.getConfig().dblClickSpeed?++m.clickCount:m.clickCount=1,m.target=p.target,m.timeStamp=a,p.detail=m.clickCount,(g=s.detail)!==null&&g!==void 0&&g.preventClick||(!n.context.config.useNativeClickEvent&&(p.pointerType==="mouse"||p.pointerType==="touch")&&n.dispatchEvent(p,"click"),n.dispatchEvent(p,"pointertap")),n.freeEvent(p)}n.freeEvent(s)},this.onPointerMove=function(i){var a=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0),s=a.pointerType==="mouse"||a.pointerType==="pen",o=n.trackingData(i.pointerId),l=n.findMountedTarget(o.overTargets);if(o.overTargets&&l!==a.target){var u=i.type==="mousemove"?"mouseout":"pointerout",c=n.createPointerEvent(i,u,l||void 0);if(n.dispatchEvent(c,"pointerout"),s&&n.dispatchEvent(c,"mouseout"),!a.composedPath().includes(l)){var h=n.createPointerEvent(i,"pointerleave",l||void 0);for(h.eventPhase=h.AT_TARGET;h.target&&!a.composedPath().includes(h.target);)h.currentTarget=h.target,n.notifyTarget(h),s&&n.notifyTarget(h,"mouseleave"),$e.isNode(h.target)&&(h.target=h.target.parentNode);n.freeEvent(h)}n.freeEvent(c)}if(l!==a.target){var d=i.type==="mousemove"?"mouseover":"pointerover",g=n.clonePointerEvent(a,d);n.dispatchEvent(g,"pointerover"),s&&n.dispatchEvent(g,"mouseover");for(var p=l&&$e.isNode(l)&&l.parentNode;p&&p!==($e.isNode(n.rootTarget)&&n.rootTarget.parentNode)&&p!==a.target;)p=p.parentNode;var v=!p||p===($e.isNode(n.rootTarget)&&n.rootTarget.parentNode);if(v){var m=n.clonePointerEvent(a,"pointerenter");for(m.eventPhase=m.AT_TARGET;m.target&&m.target!==l&&m.target!==($e.isNode(n.rootTarget)&&n.rootTarget.parentNode);)m.currentTarget=m.target,n.notifyTarget(m),s&&n.notifyTarget(m,"mouseenter"),$e.isNode(m.target)&&(m.target=m.target.parentNode);n.freeEvent(m)}n.freeEvent(g)}n.dispatchEvent(a,"pointermove"),a.pointerType==="touch"&&n.dispatchEvent(a,"touchmove"),s&&(n.dispatchEvent(a,"mousemove"),n.cursor=n.getCursor(a.target)),o.overTargets=a.composedPath(),n.freeEvent(a)},this.onPointerOut=function(i){var a=n.trackingData(i.pointerId);if(a.overTargets){var s=i.pointerType==="mouse"||i.pointerType==="pen",o=n.findMountedTarget(a.overTargets),l=n.createPointerEvent(i,"pointerout",o||void 0);n.dispatchEvent(l),s&&n.dispatchEvent(l,"mouseout");var u=n.createPointerEvent(i,"pointerleave",o||void 0);for(u.eventPhase=u.AT_TARGET;u.target&&u.target!==($e.isNode(n.rootTarget)&&n.rootTarget.parentNode);)u.currentTarget=u.target,n.notifyTarget(u),s&&n.notifyTarget(u,"mouseleave"),$e.isNode(u.target)&&(u.target=u.target.parentNode);a.overTargets=null,n.freeEvent(l),n.freeEvent(u)}n.cursor=null},this.onPointerOver=function(i){var a=n.trackingData(i.pointerId),s=n.createPointerEvent(i),o=s.pointerType==="mouse"||s.pointerType==="pen";n.dispatchEvent(s,"pointerover"),o&&n.dispatchEvent(s,"mouseover"),s.pointerType==="mouse"&&(n.cursor=n.getCursor(s.target));var l=n.clonePointerEvent(s,"pointerenter");for(l.eventPhase=l.AT_TARGET;l.target&&l.target!==($e.isNode(n.rootTarget)&&n.rootTarget.parentNode);)l.currentTarget=l.target,n.notifyTarget(l),o&&n.notifyTarget(l,"mouseenter"),$e.isNode(l.target)&&(l.target=l.target.parentNode);a.overTargets=s.composedPath(),n.freeEvent(s),n.freeEvent(l)},this.onPointerUpOutside=function(i){var a=n.trackingData(i.pointerId),s=n.findMountedTarget(a.pressTargetsByButton[i.button]),o=n.createPointerEvent(i);if(s){for(var l=s;l;)o.currentTarget=l,n.notifyTarget(o,"pointerupoutside"),o.pointerType==="touch"||(o.pointerType==="mouse"||o.pointerType==="pen")&&n.notifyTarget(o,o.button===2?"rightupoutside":"mouseupoutside"),$e.isNode(l)&&(l=l.parentNode);delete a.pressTargetsByButton[i.button]}n.freeEvent(o)},this.onWheel=function(i){var a=n.createWheelEvent(i);n.dispatchEvent(a),n.freeEvent(a)},this.onClick=function(i){if(n.context.config.useNativeClickEvent){var a=n.createPointerEvent(i);n.dispatchEvent(a),n.freeEvent(a)}},this.onPointerCancel=function(i){var a=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);n.dispatchEvent(a),n.freeEvent(a)},this.globalRuntime=t,this.context=e}return it(r,[{key:"init",value:function(){this.rootTarget=this.context.renderingContext.root.parentNode,this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointercancel",this.onPointerCancel),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel),this.addEventMapping("click",this.onClick)}},{key:"destroy",value:function(){this.mappingTable={},this.mappingState={},this.eventPool.clear()}},{key:"getScale",value:function(){var e=this.context.contextService.getBoundingClientRect(),n=1,i=1,a=this.context.contextService.getDomElement();if(a&&e){var s=a.offsetWidth,o=a.offsetHeight;s&&o&&(n=e.width/s,i=e.height/o)}return{scaleX:n,scaleY:i,bbox:e}}},{key:"client2Viewport",value:function(e){var n=this.getScale(),i=n.scaleX,a=n.scaleY,s=n.bbox;return new Bn((e.x-((s==null?void 0:s.left)||0))/i,(e.y-((s==null?void 0:s.top)||0))/a)}},{key:"viewport2Client",value:function(e){var n=this.getScale(),i=n.scaleX,a=n.scaleY,s=n.bbox;return new Bn((e.x+((s==null?void 0:s.left)||0))*i,(e.y+((s==null?void 0:s.top)||0))*a)}},{key:"viewport2Canvas",value:function(e){var n=e.x,i=e.y,a=this.rootTarget.defaultView,s=a.getCamera(),o=this.context.config,l=o.width,u=o.height,c=s.getPerspectiveInverse(),h=s.getWorldTransform(),d=Jn(this.tmpMatrix,h,c),g=Kn(this.tmpVec3,n/l*2-1,(1-i/u)*2-1,0);return Qn(g,g,d),new Bn(g[0],g[1])}},{key:"canvas2Viewport",value:function(e){var n=this.rootTarget.defaultView,i=n.getCamera(),a=i.getPerspective(),s=i.getViewTransform(),o=Jn(this.tmpMatrix,a,s),l=Kn(this.tmpVec3,e.x,e.y,0);Qn(this.tmpVec3,this.tmpVec3,o);var u=this.context.config,c=u.width,h=u.height;return new Bn((l[0]+1)/2*c,(1-(l[1]+1)/2)*h)}},{key:"setPickHandler",value:function(e){this.pickHandler=e}},{key:"addEventMapping",value:function(e,n){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:n,priority:0}),this.mappingTable[e].sort(function(i,a){return i.priority-a.priority})}},{key:"mapEvent",value:function(e){if(this.rootTarget){var n=this.mappingTable[e.type];if(n)for(var i=0,a=n.length;i<a;i++)n[i].fn(e);else console.warn("[EventService]: Event mapping not defined for ".concat(e.type))}}},{key:"dispatchEvent",value:function(e,n,i){if(!i)e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,n);else{e.eventPhase=e.AT_TARGET;var a=this.rootTarget.defaultView||null;e.currentTarget=a,this.notifyListeners(e,n)}}},{key:"propagate",value:function(e,n){if(e.target){var i=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(var a=i.length-1;a>=1;a--)if(e.currentTarget=i[a],this.notifyTarget(e,n),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,n),!(e.propagationStopped||e.propagationImmediatelyStopped)){var s=i.indexOf(e.currentTarget);e.eventPhase=e.BUBBLING_PHASE;for(var o=s+1;o<i.length;o++)if(e.currentTarget=i[o],this.notifyTarget(e,n),e.propagationStopped||e.propagationImmediatelyStopped)return}}}},{key:"propagationPath",value:function(e){var n=[e],i=this.rootTarget.defaultView||null;if(i&&i===e)return n.unshift(i.document),n;for(var a=0;a<fU&&e!==this.rootTarget;a++)$e.isNode(e)&&e.parentNode&&(n.push(e.parentNode),e=e.parentNode);return i&&n.push(i),n}},{key:"hitTest",value:function(e){var n=e.viewportX,i=e.viewportY,a=this.context.config,s=a.width,o=a.height,l=a.disableHitTesting;return n<0||i<0||n>s||i>o?null:!l&&this.pickHandler(e)||this.rootTarget||null}},{key:"isNativeEventFromCanvas",value:function(e,n){var i,a=n==null?void 0:n.target;if((i=a)!==null&&i!==void 0&&i.shadowRoot&&(a=n.composedPath()[0]),a){if(a===e)return!0;if(e&&e.contains)return e.contains(a)}return n!=null&&n.composedPath?n.composedPath().indexOf(e)>-1:!1}},{key:"getExistedHTML",value:function(e){if(e.nativeEvent.composedPath)for(var n=0,i=e.nativeEvent.composedPath();n<i.length;n++){var a=i[n],s=this.nativeHTMLMap.get(a);if(s)return s}return null}},{key:"pickTarget",value:function(e){return this.hitTest({clientX:e.clientX,clientY:e.clientY,viewportX:e.viewportX,viewportY:e.viewportY,x:e.canvasX,y:e.canvasY})}},{key:"createPointerEvent",value:function(e,n,i,a){var s=this.allocateEvent(Tf);this.copyPointerData(e,s),this.copyMouseData(e,s),this.copyData(e,s),s.nativeEvent=e.nativeEvent,s.originalEvent=e;var o=this.getExistedHTML(s),l=this.context.contextService.getDomElement();return s.target=i??(o||this.isNativeEventFromCanvas(l,s.nativeEvent)&&this.pickTarget(s)||a),typeof n=="string"&&(s.type=n),s}},{key:"createWheelEvent",value:function(e){var n=this.allocateEvent(Tw);this.copyWheelData(e,n),this.copyMouseData(e,n),this.copyData(e,n),n.nativeEvent=e.nativeEvent,n.originalEvent=e;var i=this.getExistedHTML(n),a=this.context.contextService.getDomElement();return n.target=i||this.isNativeEventFromCanvas(a,n.nativeEvent)&&this.pickTarget(n),n}},{key:"trackingData",value:function(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}},{key:"cloneWheelEvent",value:function(e){var n=this.allocateEvent(Tw);return n.nativeEvent=e.nativeEvent,n.originalEvent=e.originalEvent,this.copyWheelData(e,n),this.copyMouseData(e,n),this.copyData(e,n),n.target=e.target,n.path=e.composedPath().slice(),n.type=e.type,n}},{key:"clonePointerEvent",value:function(e,n){var i=this.allocateEvent(Tf);return i.nativeEvent=e.nativeEvent,i.originalEvent=e.originalEvent,this.copyPointerData(e,i),this.copyMouseData(e,i),this.copyData(e,i),i.target=e.target,i.path=e.composedPath().slice(),i.type=n??i.type,i}},{key:"copyPointerData",value:function(e,n){n.pointerId=e.pointerId,n.width=e.width,n.height=e.height,n.isPrimary=e.isPrimary,n.pointerType=e.pointerType,n.pressure=e.pressure,n.tangentialPressure=e.tangentialPressure,n.tiltX=e.tiltX,n.tiltY=e.tiltY,n.twist=e.twist}},{key:"copyMouseData",value:function(e,n){n.altKey=e.altKey,n.button=e.button,n.buttons=e.buttons,n.ctrlKey=e.ctrlKey,n.metaKey=e.metaKey,n.shiftKey=e.shiftKey,n.client.copyFrom(e.client),n.movement.copyFrom(e.movement),n.canvas.copyFrom(e.canvas),n.screen.copyFrom(e.screen),n.global.copyFrom(e.global),n.offset.copyFrom(e.offset)}},{key:"copyWheelData",value:function(e,n){n.deltaMode=e.deltaMode,n.deltaX=e.deltaX,n.deltaY=e.deltaY,n.deltaZ=e.deltaZ}},{key:"copyData",value:function(e,n){n.isTrusted=e.isTrusted,n.timeStamp=kw.now(),n.type=e.type,n.detail=e.detail,n.view=e.view,n.page.copyFrom(e.page),n.viewport.copyFrom(e.viewport)}},{key:"allocateEvent",value:function(e){this.eventPool.has(e)||this.eventPool.set(e,[]);var n=this.eventPool.get(e).pop()||new e(this);return n.eventPhase=n.NONE,n.currentTarget=null,n.path=[],n.target=null,n}},{key:"freeEvent",value:function(e){if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var n=e.constructor;this.eventPool.has(n)||this.eventPool.set(n,[]),this.eventPool.get(n).push(e)}},{key:"notifyTarget",value:function(e,n){n=n??e.type;var i=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?"".concat(n,"capture"):n;this.notifyListeners(e,i),e.eventPhase===e.AT_TARGET&&this.notifyListeners(e,n)}},{key:"notifyListeners",value:function(e,n){var i=e.currentTarget.emitter,a=i._events[n];if(a)if("fn"in a)a.once&&i.removeListener(n,a.fn,void 0,!0),a.fn.call(e.currentTarget||a.context,e);else for(var s=0;s<a.length&&!e.propagationImmediatelyStopped;s++)a[s].once&&i.removeListener(n,a[s].fn,void 0,!0),a[s].fn.call(e.currentTarget||a[s].context,e)}},{key:"findMountedTarget",value:function(e){if(!e)return null;for(var n=e[e.length-1],i=e.length-2;i>=0;i--){var a=e[i];if(a===this.rootTarget||$e.isNode(a)&&a.parentNode===n)n=e[i];else break}return n}},{key:"getCursor",value:function(e){for(var n=e;n;){var i=AH(n)&&n.getAttribute("cursor");if(i)return i;n=$e.isNode(n)&&n.parentNode}}}])}(),Fx=function(){function r(){at(this,r)}return it(r,[{key:"getOrCreateCanvas",value:function(e,n){if(this.canvas)return this.canvas;if(e||st.offscreenCanvas)this.canvas=e||st.offscreenCanvas,this.context=this.canvas.getContext("2d",Ft({willReadFrequently:!0},n));else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",Ft({willReadFrequently:!0},n)),(!this.context||!this.context.measureText)&&(this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"))}catch{this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d",Ft({willReadFrequently:!0},n))}return this.canvas.width=10,this.canvas.height=10,this.canvas}},{key:"getOrCreateContext",value:function(e,n){return this.context?this.context:(this.getOrCreateCanvas(e,n),this.context)}}],[{key:"createCanvas",value:function(){try{return new window.OffscreenCanvas(0,0)}catch{}try{return document.createElement("canvas")}catch{}return null}}])}(),Bl=function(r){return r[r.CAMERA_CHANGED=0]="CAMERA_CHANGED",r[r.DISPLAY_OBJECT_CHANGED=1]="DISPLAY_OBJECT_CHANGED",r[r.NONE=2]="NONE",r}({}),pU=function(){function r(t,e){at(this,r),this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.hooks={init:new ir,initAsync:new HH,dirtycheck:new kv,cull:new kv,beginFrame:new ir,beforeRender:new ir,render:new ir,afterRender:new ir,endFrame:new ir,destroy:new ir,pick:new UH,pickSync:new kv,pointerDown:new ir,pointerUp:new ir,pointerMove:new ir,pointerOut:new ir,pointerOver:new ir,pointerWheel:new ir,pointerCancel:new ir,click:new ir},this.globalRuntime=t,this.context=e}return it(r,[{key:"init",value:function(e){var n=this,i=Ft(Ft({},this.globalRuntime),this.context);this.context.renderingPlugins.forEach(function(a){a.apply(i,n.globalRuntime)}),this.hooks.init.call(),this.hooks.initAsync.getCallbacksNum()===0?(this.inited=!0,e()):this.hooks.initAsync.promise().then(function(){n.inited=!0,e()}).catch(function(a){})}},{key:"getStats",value:function(){return this.stats}},{key:"disableDirtyRectangleRendering",value:function(){var e=this.context.config.renderer,n=e.getConfig(),i=n.enableDirtyRectangleRendering;return!i||this.context.renderingContext.renderReasons.has(Bl.CAMERA_CHANGED)}},{key:"render",value:function(e,n,i){var a=this;this.stats.total=0,this.stats.rendered=0,this.zIndexCounter=0;var s=this.context.renderingContext;if(this.globalRuntime.sceneGraphService.syncHierarchy(s.root),this.globalRuntime.sceneGraphService.triggerPendingEvents(),s.renderReasons.size&&this.inited){s.dirtyRectangleRenderingDisabled=this.disableDirtyRectangleRendering();var o=s.renderReasons.size===1&&s.renderReasons.has(Bl.CAMERA_CHANGED),l=!e.disableRenderHooks||!(e.disableRenderHooks&&o);l&&this.renderDisplayObject(s.root,e,s),this.hooks.beginFrame.call(n),l&&s.renderListCurrentFrame.forEach(function(u){a.hooks.beforeRender.call(u),a.hooks.render.call(u),a.hooks.afterRender.call(u)}),this.hooks.endFrame.call(n),s.renderListCurrentFrame=[],s.renderReasons.clear(),i()}}},{key:"renderDisplayObject",value:function(e,n,i){var a=this,s=n.renderer.getConfig(),o=s.enableDirtyCheck,l=s.enableCulling;function u(p){var v=p.renderable,m=p.sortable,b=o?v.dirty||i.dirtyRectangleRenderingDisabled?p:null:p;if(b){var w=l?a.hooks.cull.call(b,a.context.camera):b;w&&(a.stats.rendered+=1,i.renderListCurrentFrame.push(w))}v.dirty=!1,m.renderOrder=a.zIndexCounter,a.zIndexCounter+=1,a.stats.total+=1,m.dirty&&(a.sort(p,m),m.dirty=!1,m.dirtyChildren=[],m.dirtyReason=void 0)}for(var c=[e];c.length>0;){var h=c.pop();u(h);for(var d=h.sortable.sorted||h.childNodes,g=d.length-1;g>=0;g--)c.push(d[g])}}},{key:"sort",value:function(e,n){n.sorted&&n.dirtyReason!==xf.Z_INDEX_CHANGED?n.dirtyChildren.forEach(function(i){var a=e.childNodes.indexOf(i);if(a===-1){var s=n.sorted.indexOf(i);s>=0&&n.sorted.splice(s,1)}else if(n.sorted.length===0)n.sorted.push(i);else{var o=PH(n.sorted,i);n.sorted.splice(o,0,i)}}):n.sorted=e.childNodes.slice().sort(AL)}},{key:"destroy",value:function(){this.inited=!1,this.hooks.destroy.call(),this.globalRuntime.sceneGraphService.clearPendingEvents()}},{key:"dirtify",value:function(){this.context.renderingContext.renderReasons.add(Bl.DISPLAY_OBJECT_CHANGED)}}])}(),vU=/\[\s*(.*)=(.*)\s*\]/,mU=function(){function r(){at(this,r)}return it(r,[{key:"selectOne",value:function(e,n){var i=this;if(e.startsWith("."))return n.find(function(l){return((l==null?void 0:l.classList)||[]).indexOf(i.getIdOrClassname(e))>-1});if(e.startsWith("#"))return n.find(function(l){return l.id===i.getIdOrClassname(e)});if(e.startsWith("[")){var a=this.getAttribute(e),s=a.name,o=a.value;return s?n.find(function(l){return n!==l&&(s==="name"?l.name===o:i.attributeToString(l,s)===o)}):null}return n.find(function(l){return n!==l&&l.nodeName===e})}},{key:"selectAll",value:function(e,n){var i=this;if(e.startsWith("."))return n.findAll(function(l){return n!==l&&((l==null?void 0:l.classList)||[]).indexOf(i.getIdOrClassname(e))>-1});if(e.startsWith("#"))return n.findAll(function(l){return n!==l&&l.id===i.getIdOrClassname(e)});if(e.startsWith("[")){var a=this.getAttribute(e),s=a.name,o=a.value;return s?n.findAll(function(l){return n!==l&&(s==="name"?l.name===o:i.attributeToString(l,s)===o)}):[]}return n.findAll(function(l){return n!==l&&l.nodeName===e})}},{key:"is",value:function(e,n){if(e.startsWith("."))return n.className===this.getIdOrClassname(e);if(e.startsWith("#"))return n.id===this.getIdOrClassname(e);if(e.startsWith("[")){var i=this.getAttribute(e),a=i.name,s=i.value;return a==="name"?n.name===s:this.attributeToString(n,a)===s}return n.nodeName===e}},{key:"getIdOrClassname",value:function(e){return e.substring(1)}},{key:"getAttribute",value:function(e){var n=e.match(vU),i="",a="";return n&&n.length>2&&(i=n[1].replace(/"/g,""),a=n[2].replace(/"/g,"")),{name:i,value:a}}},{key:"attributeToString",value:function(e,n){if(!e.getAttribute)return"";var i=e.getAttribute(n);return kt(i)?"":i.toString?i.toString():""}}])}(),Xt=function(r){return r.ATTR_MODIFIED="DOMAttrModified",r.INSERTED="DOMNodeInserted",r.MOUNTED="DOMNodeInsertedIntoDocument",r.REMOVED="removed",r.UNMOUNTED="DOMNodeRemovedFromDocument",r.REPARENT="reparent",r.DESTROY="destroy",r.BOUNDS_CHANGED="bounds-changed",r.CULLED="culled",r}({}),ia=function(r){function t(e,n,i,a,s,o,l,u){var c;return at(this,t),c=qt(this,t,[null]),c.relatedNode=n,c.prevValue=i,c.newValue=a,c.attrName=s,c.attrChange=o,c.prevParsedValue=l,c.newParsedValue=u,c.type=e,c}return jt(t,r),it(t)}(sg);ia.ADDITION=2;ia.MODIFICATION=1;ia.REMOVAL=3;function bM(r){var t=r.renderable;t&&(t.renderBoundsDirty=!0,t.boundsDirty=!0)}var yU=new ia(Xt.REPARENT,null,"","","",0,"",""),bU=Tx(),Kh=Qt(),wU=Ce(1,1,1),xU=Se(),EU=Tx(),ls=Qt(),ml=Se(),us=wn(),_U=Qt(),SU=wn(),MU=Qt(),Mu=Qt(),uo=Qt(),Zh=Se(),wM=wn(),xM=wn(),Jh=wn(),Ov={affectChildren:!0},kU=function(){function r(t){at(this,r),this.pendingEvents=new Map,this.boundsChangedEvent=new cn(Xt.BOUNDS_CHANGED),this.displayObjectDependencyMap=new WeakMap,this.runtime=t}return it(r,[{key:"matches",value:function(e,n){return this.runtime.sceneGraphSelector.is(e,n)}},{key:"querySelector",value:function(e,n){return this.runtime.sceneGraphSelector.selectOne(e,n)}},{key:"querySelectorAll",value:function(e,n){return this.runtime.sceneGraphSelector.selectAll(e,n)}},{key:"attach",value:function(e,n,i){var a,s=!1;e.parentNode&&(s=e.parentNode!==n,this.detach(e));var o=e.nodeName===Q.FRAGMENT,l=kf(n);e.parentNode=n;var u=o?e.childNodes:[e];yt(i)?u.forEach(function(g){n.childNodes.splice(i,0,g),g.parentNode=n}):u.forEach(function(g){n.childNodes.push(g),g.parentNode=n});var c=n,h=c.sortable;if((h!=null&&(a=h.sorted)!==null&&a!==void 0&&a.length||e.parsedStyle.zIndex)&&(h.dirtyChildren.indexOf(e)===-1&&h.dirtyChildren.push(e),h.dirty=!0,h.dirtyReason=xf.ADDED),!l){if(o)this.dirtifyFragment(e);else{var d=e.transformable;d&&this.dirtifyWorld(e,d)}s&&e.dispatchEvent(yU)}}},{key:"detach",value:function(e){if(e.parentNode){var n,i,a=e.transformable,s=e.parentNode,o=s.sortable;(o!=null&&(n=o.sorted)!==null&&n!==void 0&&n.length||(i=e.style)!==null&&i!==void 0&&i.zIndex)&&(o.dirtyChildren.indexOf(e)===-1&&o.dirtyChildren.push(e),o.dirty=!0,o.dirtyReason=xf.REMOVED);var l=e.parentNode.childNodes.indexOf(e);l>-1&&e.parentNode.childNodes.splice(l,1),a&&this.dirtifyWorld(e,a),e.parentNode=null}}},{key:"getOrigin",value:function(e){return e.getGeometryBounds(),e.transformable.origin}},{key:"setOrigin",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=[n,i,a]);var s=e.transformable;if(!(n[0]===s.origin[0]&&n[1]===s.origin[1]&&n[2]===s.origin[2])){var o=s.origin;o[0]=n[0],o[1]=n[1],o[2]=n[2]||0,this.dirtifyLocal(e,s)}}},{key:"rotate",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Ce(n,i,a));var s=e.transformable;if(e.parentNode===null||!e.parentNode.transformable)this.rotateLocal(e,n);else{var o=us;jh(o,n[0],n[1],n[2]);var l=this.getRotation(e),u=this.getRotation(e.parentNode);qh(Jh,u),hv(Jh,Jh),Ps(o,Jh,o),Ps(s.localRotation,o,l),gf(s.localRotation,s.localRotation),this.dirtifyLocal(e,s)}}},{key:"rotateLocal",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Ce(n,i,a));var s=e.transformable;jh(xM,n[0],n[1],n[2]),D3(s.localRotation,s.localRotation,xM),this.dirtifyLocal(e,s)}},{key:"setEulerAngles",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Ce(n,i,a));var s=e.transformable;if(e.parentNode===null||!e.parentNode.transformable)this.setLocalEulerAngles(e,n);else{jh(s.localRotation,n[0],n[1],n[2]);var o=this.getRotation(e.parentNode);qh(wM,hv(us,o)),D3(s.localRotation,s.localRotation,wM),this.dirtifyLocal(e,s)}}},{key:"setLocalEulerAngles",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;typeof n=="number"&&(n=Ce(n,i,a));var o=e.transformable;jh(o.localRotation,n[0],n[1],n[2]),s&&this.dirtifyLocal(e,o)}},{key:"translateLocal",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Ce(n,i,a));var s=e.transformable;_u(n,Kh)||(nW(n,n,s.localRotation),As(s.localPosition,s.localPosition,n),this.dirtifyLocal(e,s))}},{key:"setPosition",value:function(e,n){var i,a=e.transformable;if(uo[0]=n[0],uo[1]=n[1],uo[2]=(i=n[2])!==null&&i!==void 0?i:0,!_u(this.getPosition(e),uo)){if(Ji(a.position,uo),e.parentNode===null||!e.parentNode.transformable)Ji(a.localPosition,uo);else{var s=e.parentNode.transformable;$l(Zh,s.worldTransform),Zi(Zh,Zh),Qn(a.localPosition,uo,Zh)}this.dirtifyLocal(e,a)}}},{key:"setLocalPosition",value:function(e,n){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=e.transformable;Mu[0]=n[0],Mu[1]=n[1],Mu[2]=(i=n[2])!==null&&i!==void 0?i:0,!_u(s.localPosition,Mu)&&(Ji(s.localPosition,Mu),a&&this.dirtifyLocal(e,s))}},{key:"scaleLocal",value:function(e,n){var i,a=e.transformable;Zq(a.localScale,a.localScale,Kn(ls,n[0],n[1],(i=n[2])!==null&&i!==void 0?i:1)),this.dirtifyLocal(e,a)}},{key:"setLocalScale",value:function(e,n){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=e.transformable;Kn(ls,n[0],n[1],(i=n[2])!==null&&i!==void 0?i:s.localScale[2]),!_u(ls,s.localScale)&&(Ji(s.localScale,ls),a&&this.dirtifyLocal(e,s))}},{key:"translate",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Kn(ls,n,i,a)),!_u(n,Kh)&&(As(ls,this.getPosition(e),n),this.setPosition(e,ls))}},{key:"setRotation",value:function(e,n,i,a,s){var o=e.transformable;if(typeof n=="number"&&(n=lW(n,i,a,s)),e.parentNode===null||!e.parentNode.transformable)this.setLocalRotation(e,n);else{var l=this.getRotation(e.parentNode);qh(us,l),hv(us,us),Ps(o.localRotation,us,n),gf(o.localRotation,o.localRotation),this.dirtifyLocal(e,o)}}},{key:"setLocalRotation",value:function(e,n,i,a,s){var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;typeof n=="number"&&(n=I3(us,n,i,a,s));var l=e.transformable;qh(l.localRotation,n),o&&this.dirtifyLocal(e,l)}},{key:"setLocalSkew",value:function(e,n,i){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;typeof n=="number"&&(n=cW(EU,n,i));var s=e.transformable;uW(s.localSkew,n),a&&this.dirtifyLocal(e,s)}},{key:"dirtifyLocal",value:function(e,n){kf(e)||n.localDirtyFlag||(n.localDirtyFlag=!0,n.dirtyFlag||this.dirtifyWorld(e,n))}},{key:"dirtifyWorld",value:function(e,n){n.dirtyFlag||this.unfreezeParentToRoot(e),this.dirtifyWorldInternal(e,n),this.dirtifyToRoot(e,!0)}},{key:"dirtifyFragment",value:function(e){var n=e.transformable;n&&(n.frozen=!1,n.dirtyFlag=!0,n.localDirtyFlag=!0);var i=e.renderable;i&&(i.renderBoundsDirty=!0,i.boundsDirty=!0,i.dirty=!0);for(var a=e.childNodes.length,s=0;s<a;s++)this.dirtifyFragment(e.childNodes[s]);e.nodeName===Q.FRAGMENT&&this.pendingEvents.set(e,!1)}},{key:"triggerPendingEvents",value:function(){var e=this,n=new Set,i=function(s,o){!s.isConnected||n.has(s)||s.nodeName===Q.FRAGMENT||(e.boundsChangedEvent.detail=o,e.boundsChangedEvent.target=s,s.isMutationObserved?s.dispatchEvent(e.boundsChangedEvent):s.ownerDocument.defaultView.dispatchEvent(e.boundsChangedEvent,!0),n.add(s))};this.pendingEvents.forEach(function(a,s){s.nodeName!==Q.FRAGMENT&&(Ov.affectChildren=a,a?s.forEach(function(o){i(o,Ov)}):i(s,Ov))}),n.clear(),this.clearPendingEvents()}},{key:"clearPendingEvents",value:function(){this.pendingEvents.clear()}},{key:"dirtifyToRoot",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=e;for(i.renderable&&(i.renderable.dirty=!0);i;)bM(i),i=i.parentNode;n&&e.forEach(function(a){bM(a)}),this.informDependentDisplayObjects(e),this.pendingEvents.set(e,n)}},{key:"updateDisplayObjectDependency",value:function(e,n,i,a){if(n&&n!==i){var s=this.displayObjectDependencyMap.get(n);if(s&&s[e]){var o=s[e].indexOf(a);s[e].splice(o,1)}}if(i){var l=this.displayObjectDependencyMap.get(i);l||(this.displayObjectDependencyMap.set(i,{}),l=this.displayObjectDependencyMap.get(i)),l[e]||(l[e]=[]),l[e].push(a)}}},{key:"informDependentDisplayObjects",value:function(e){var n=this,i=this.displayObjectDependencyMap.get(e);i&&Object.keys(i).forEach(function(a){i[a].forEach(function(s){n.dirtifyToRoot(s,!0),s.dispatchEvent(new ia(Xt.ATTR_MODIFIED,s,n,n,a,ia.MODIFICATION,n,n)),s.isCustomElement&&s.isConnected&&s.attributeChangedCallback&&s.attributeChangedCallback(a,n,n)})})}},{key:"getPosition",value:function(e){var n=e.transformable;return hf(n.position,this.getWorldTransform(e,n))}},{key:"getRotation",value:function(e){var n=e.transformable;return df(n.rotation,this.getWorldTransform(e,n))}},{key:"getScale",value:function(e){var n=e.transformable;return jl(n.scaling,this.getWorldTransform(e,n))}},{key:"getWorldTransform",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e.transformable;return!n.localDirtyFlag&&!n.dirtyFlag||(e.parentNode&&e.parentNode.transformable&&this.getWorldTransform(e.parentNode),this.sync(e,n)),n.worldTransform}},{key:"getLocalPosition",value:function(e){return e.transformable.localPosition}},{key:"getLocalRotation",value:function(e){return e.transformable.localRotation}},{key:"getLocalScale",value:function(e){return e.transformable.localScale}},{key:"getLocalSkew",value:function(e){return e.transformable.localSkew}},{key:"calcLocalTransform",value:function(e){var n=e.localSkew[0]!==0||e.localSkew[1]!==0;if(n){Ju(e.localTransform,e.localRotation,e.localPosition,Ce(1,1,1),e.origin),(e.localSkew[0]!==0||e.localSkew[1]!==0)&&(Bs(ml),ml[4]=Math.tan(e.localSkew[0]),ml[1]=Math.tan(e.localSkew[1]),Jn(e.localTransform,e.localTransform,ml));var i=Ju(ml,I3(us,0,0,0,1),Kn(ls,1,1,1),e.localScale,e.origin);Jn(e.localTransform,e.localTransform,i)}else{var a=e.localTransform,s=e.localPosition,o=e.localRotation,l=e.localScale,u=e.origin,c=s[0]!==0||s[1]!==0||s[2]!==0,h=o[3]!==1||o[0]!==0||o[1]!==0||o[2]!==0,d=l[0]!==1||l[1]!==1||l[2]!==1,g=u[0]!==0||u[1]!==0||u[2]!==0;!h&&!d&&!g?c?bs(a,s):Bs(a):Ju(a,o,s,l,u)}}},{key:"getLocalTransform",value:function(e){var n=e.transformable;return n.localDirtyFlag&&(this.calcLocalTransform(n),n.localDirtyFlag=!1),n.localTransform}},{key:"setLocalTransform",value:function(e,n){var i=hf(_U,n),a=df(SU,n),s=jl(MU,n);this.setLocalScale(e,s,!1),this.setLocalPosition(e,i,!1),this.setLocalRotation(e,a,void 0,void 0,void 0,!1),this.dirtifyLocal(e,e.transformable)}},{key:"resetLocalTransform",value:function(e){this.setLocalScale(e,wU,!1),this.setLocalPosition(e,Kh,!1),this.setLocalEulerAngles(e,Kh,void 0,void 0,!1),this.setLocalSkew(e,bU,void 0,!1),this.dirtifyLocal(e,e.transformable)}},{key:"getTransformedGeometryBounds",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2?arguments[2]:void 0,a=this.getGeometryBounds(e,n);if(!Me.isEmpty(a)){var s=i||new Me;return s.setFromTransformedAABB(a,this.getWorldTransform(e)),s}return null}},{key:"getGeometryBounds",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=e,a=i.geometry;a.dirty&&st.styleValueRegistry.updateGeometry(e);var s=n?a.renderBounds:a.contentBounds||null;return s||new Me}},{key:"getBounds",value:function(e){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=e,s=a.renderable;if(!s.boundsDirty&&!i&&s.bounds)return s.bounds;if(!s.renderBoundsDirty&&i&&s.renderBounds)return s.renderBounds;var o=i?s.renderBounds:s.bounds,l=this.getTransformedGeometryBounds(e,i,o),u=e.childNodes;if(u.forEach(function(d){var g=n.getBounds(d,i);g&&(l?l.add(g):(l=o||new Me,l.update(g.center,g.halfExtents)))}),l||(l=new Me),i){var c=PL(e);if(c){var h=c.parsedStyle.clipPath.getBounds(i);l?h&&(l=h.intersection(l)):l.update(h.center,h.halfExtents)}}return i?(s.renderBounds=l,s.renderBoundsDirty=!1):(s.bounds=l,s.boundsDirty=!1),l}},{key:"getLocalBounds",value:function(e){if(e.parentNode){var n=xU;e.parentNode.transformable&&(n=Zi(ml,this.getWorldTransform(e.parentNode)));var i=this.getBounds(e);if(!Me.isEmpty(i)){var a=new Me;return a.setFromTransformedAABB(i,n),a}}return this.getBounds(e)}},{key:"getBoundingClientRect",value:function(e){var n,i,a=this.getGeometryBounds(e);Me.isEmpty(a)||(i=new Me,i.setFromTransformedAABB(a,this.getWorldTransform(e)));var s=(n=e.ownerDocument)===null||n===void 0||(n=n.defaultView)===null||n===void 0?void 0:n.getContextService().getBoundingClientRect();if(i){var o=i.getMin(),l=Rt(o,2),u=l[0],c=l[1],h=i.getMax(),d=Rt(h,2),g=d[0],p=d[1];return new Wl(u+((s==null?void 0:s.left)||0),c+((s==null?void 0:s.top)||0),g-u,p-c)}return new Wl((s==null?void 0:s.left)||0,(s==null?void 0:s.top)||0,0,0)}},{key:"dirtifyWorldInternal",value:function(e,n){var i=this;if(!n.dirtyFlag){n.dirtyFlag=!0,n.frozen=!1,e.childNodes.forEach(function(o){var l=o.transformable;l.dirtyFlag||i.dirtifyWorldInternal(o,l)});var a=e,s=a.renderable;s&&(s.renderBoundsDirty=!0,s.boundsDirty=!0,s.dirty=!0)}}},{key:"syncHierarchy",value:function(e){var n=e.transformable;if(!n.frozen){n.frozen=!0,(n.localDirtyFlag||n.dirtyFlag)&&this.sync(e,n);for(var i=e.childNodes,a=0;a<i.length;a++)this.syncHierarchy(i[a])}}},{key:"sync",value:function(e,n){if(n.localDirtyFlag&&(this.calcLocalTransform(n),n.localDirtyFlag=!1),n.dirtyFlag){var i=e.parentNode,a=i&&i.transformable;i===null||!a?$l(n.worldTransform,n.localTransform):Jn(n.worldTransform,a.worldTransform,n.localTransform),n.dirtyFlag=!1}}},{key:"unfreezeParentToRoot",value:function(e){for(var n=e.parentNode;n;){var i=n.transformable;i&&(i.frozen=!1),n=n.parentNode}}}])}(),co={MetricsString:"|ÉqÅ",BaselineSymbol:"M",BaselineMultiplier:1.4,HeightMultiplier:2,Newlines:[10,13],BreakingSpaces:[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]},EM=/[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff!"#$%&'()*+,-./:;]/,TU=/[!%),.:;?\]}¢°·'""†‡›℃∶、。〃〆〕〗〞﹚﹜!"%'),.:;?!]}~]/,OU=/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/,CU=/[!),.:;?\]}¢·–—'"•"、。〆〞〕〉》」︰︱︲︳﹐﹑﹒﹔﹕﹖﹘﹚﹜!),.:;?︶︸︺︼︾﹀﹂﹗]|}、]/,AU=/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/,PU=/[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、:;,。.]/,NU=/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/,RU=/[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/,LU=/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/,IU=new RegExp("".concat(TU.source,"|").concat(CU.source,"|").concat(PU.source,"|").concat(RU.source)),DU=new RegExp("".concat(OU.source,"|").concat(AU.source,"|").concat(NU.source,"|").concat(LU.source)),FU=function(){function r(t){var e=this;at(this,r),this.fontMetricsCache={},this.shouldBreakByKinsokuShorui=function(n,i){return e.isBreakingSpace(i)?!1:!!(n&&(DU.exec(i)||IU.exec(n)))},this.trimByKinsokuShorui=function(n){var i=Te(n),a=i[i.length-2];if(!a)return n;var s=a[a.length-1];return i[i.length-2]=a.slice(0,-1),i[i.length-1]=s+i[i.length-1],i},this.runtime=t}return it(r,[{key:"measureFont",value:function(e,n){if(this.fontMetricsCache[e])return this.fontMetricsCache[e];var i={ascent:0,descent:0,fontSize:0},a=this.runtime.offscreenCanvasCreator.getOrCreateCanvas(n),s=this.runtime.offscreenCanvasCreator.getOrCreateContext(n,{willReadFrequently:!0});s.font=e;var o=co.MetricsString+co.BaselineSymbol,l=Math.ceil(s.measureText(o).width),u=Math.ceil(s.measureText(co.BaselineSymbol).width),c=co.HeightMultiplier*u;u=u*co.BaselineMultiplier|0,a.width=l,a.height=c,s.fillStyle="#f00",s.fillRect(0,0,l,c),s.font=e,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(o,0,u);var h=s.getImageData(0,0,l||1,c||1).data,d=h.length,g=l*4,p=0,v=0,m=!1;for(p=0;p<u;++p){for(var b=0;b<g;b+=4)if(h[v+b]!==255){m=!0;break}if(!m)v+=g;else break}for(i.ascent=u-p,v=d-g,m=!1,p=c;p>u;--p){for(var w=0;w<g;w+=4)if(h[v+w]!==255){m=!0;break}if(!m)v-=g;else break}return i.descent=p-u,i.fontSize=i.ascent+i.descent,this.fontMetricsCache[e]=i,i}},{key:"measureText",value:function(e,n,i){var a=n.fontSize,s=a===void 0?16:a,o=n.wordWrap,l=o===void 0?!1:o,u=n.lineHeight,c=n.lineWidth,h=c===void 0?1:c,d=n.textBaseline,g=d===void 0?"alphabetic":d,p=n.textAlign,v=p===void 0?"start":p,m=n.letterSpacing,b=m===void 0?0:m,w=n.textPath;n.textPathSide,n.textPathStartOffset;var x=n.leading,_=x===void 0?0:x,S=KH(n),M=this.measureFont(S,i);M.fontSize===0&&(M.fontSize=s,M.ascent=s);var k=this.runtime.offscreenCanvasCreator.getOrCreateContext(i);k.font=S,n.isOverflowing=!1;var T=l?this.wordWrap(e,n,i):e,P=T.split(/(?:\r\n|\r|\n)/),O=new Array(P.length),A=0;if(w){w.getTotalLength();for(var R=0;R<P.length;R++)k.measureText(P[R]).width+(P[R].length-1)*b}else{for(var L=0;L<P.length;L++){var q=k.measureText(P[L]).width+(P[L].length-1)*b;O[L]=q,A=Math.max(A,q)}var j=A+h,$=u||M.fontSize+h,B=Math.max($,M.fontSize+h)+(P.length-1)*($+_);$+=_;var F=0;return g==="middle"?F=-B/2:g==="bottom"||g==="alphabetic"||g==="ideographic"?F=-B:(g==="top"||g==="hanging")&&(F=0),{font:S,width:j,height:B,lines:P,lineWidths:O,lineHeight:$,maxLineWidth:A,fontProperties:M,lineMetrics:O.map(function(V,X){var K=0;return v==="center"||v==="middle"?K-=V/2:(v==="right"||v==="end")&&(K-=V),new Wl(K-h/2,F+X*$,V+h,$)})}}}},{key:"wordWrap",value:function(e,n,i){var a=this,s=this,o=n.wordWrapWidth,l=o===void 0?0:o,u=n.letterSpacing,c=u===void 0?0:u,h=n.maxLines,d=h===void 0?1/0:h,g=n.textOverflow,p=this.runtime.offscreenCanvasCreator.getOrCreateContext(i),v=l+c,m="";g==="ellipsis"?m="...":g&&g!=="clip"&&(m=g);var b=Array.from(e),w=[],x=0,_=0,S=0,M={},k=function(F){return a.getFromCache(F,c,M,p)},T=k(m);function P(B,F,V,X){for(;k(B)<X&&F<b.length-1&&!s.isNewline(b[F+1]);)F+=1,B+=b[F];for(;k(B)>X&&F>V;)F-=1,B=B.slice(0,-1);return{lineTxt:B,txtLastCharIndex:F}}function O(B,F){if(!(T<=0||T>v)){if(!w[B]){w[B]=m;return}var V=P(w[B],F,S+1,v-T);w[B]=V.lineTxt+m}}for(var A=0;A<b.length;A++){var R=b[A],L=b[A-1],q=b[A+1],j=k(R);if(this.isNewline(R)){if(x+1>=d){n.isOverflowing=!0,A<b.length-1&&O(x,A-1);break}S=A-1,x+=1,_=0,w[x]="";continue}if(_>0&&_+j>v){var $=P(w[x],A-1,S+1,v);if($.txtLastCharIndex!==A-1){if(w[x]=$.lineTxt,$.txtLastCharIndex===b.length-1)break;A=$.txtLastCharIndex+1,R=b[A],L=b[A-1],q=b[A+1],j=k(R)}if(x+1>=d){n.isOverflowing=!0,O(x,A-1);break}if(S=A-1,x+=1,_=0,w[x]="",this.isBreakingSpace(R))continue;this.canBreakInLastChar(R)||(w=this.trimToBreakable(w),_=this.sumTextWidthByCache(w[x]||"",k)),this.shouldBreakByKinsokuShorui(R,q)&&(w=this.trimByKinsokuShorui(w),_+=k(L||""))}_+=j,w[x]=(w[x]||"")+R}return w.join(`
- `)}},{key:"isBreakingSpace",value:function(e){return typeof e!="string"?!1:co.BreakingSpaces.indexOf(e.charCodeAt(0))>=0}},{key:"isNewline",value:function(e){return typeof e!="string"?!1:co.Newlines.indexOf(e.charCodeAt(0))>=0}},{key:"trimToBreakable",value:function(e){var n=Te(e),i=n[n.length-2],a=this.findBreakableIndex(i);if(a===-1||!i)return n;var s=i.slice(a,a+1),o=this.isBreakingSpace(s),l=a+1,u=a+(o?0:1);return n[n.length-1]+=i.slice(l,i.length),n[n.length-2]=i.slice(0,u),n}},{key:"canBreakInLastChar",value:function(e){return!(e&&EM.test(e))}},{key:"sumTextWidthByCache",value:function(e,n){return e.split("").reduce(function(i,a){return i+n(a)},0)}},{key:"findBreakableIndex",value:function(e){for(var n=e.length-1;n>=0;n--)if(!EM.test(e[n]))return n;return-1}},{key:"getFromCache",value:function(e,n,i,a){var s=i[e];if(typeof s!="number"){var o=e.length*n,l=a.measureText(e);s=l.width+o,i[e]=s}return s}}])}(),st={},BU=function(r){var t=new uU,e=new lU;return r={},bt(bt(bt(bt(bt(bt(bt(bt(bt(bt(r,Q.FRAGMENT,null),Q.CIRCLE,new iU),Q.ELLIPSE,new aU),Q.RECT,t),Q.IMAGE,t),Q.GROUP,new hU),Q.LINE,new sU),Q.TEXT,new cU(st)),Q.POLYLINE,e),Q.POLYGON,e),bt(bt(bt(r,Q.PATH,new oU),Q.HTML,new dU),Q.MESH,null)}(),zU=function(r){var t=new vH,e=new Mw;return r={},bt(bt(bt(bt(bt(bt(bt(bt(bt(bt(r,ft.PERCENTAGE,null),ft.NUMBER,new xH),ft.ANGLE,new gH),ft.DEFINED_PATH,new pH),ft.PAINT,t),ft.COLOR,t),ft.FILTER,new mH),ft.LENGTH,e),ft.LENGTH_PERCENTAGE,e),ft.LENGTH_PERCENTAGE_12,new yH),bt(bt(bt(bt(bt(bt(bt(bt(bt(bt(r,ft.LENGTH_PERCENTAGE_14,new bH),ft.COORDINATE,new Mw),ft.OFFSET_DISTANCE,new EH),ft.OPACITY_VALUE,new _H),ft.PATH,new SH),ft.LIST_OF_POINTS,new MH),ft.SHADOW_BLUR,new kH),ft.TEXT,new TH),ft.TEXT_TRANSFORM,new OH),ft.TRANSFORM,new eU),bt(bt(bt(r,ft.TRANSFORM_ORIGIN,new nU),ft.Z_INDEX,new rU),ft.MARKER,new wH)}(),$U=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}};st.CameraContribution=hL;st.AnimationTimeline=null;st.EasingFunction=null;st.offscreenCanvasCreator=new Fx;st.sceneGraphSelector=new mU;st.sceneGraphService=new kU(st);st.textService=new FU(st);st.geometryUpdaterFactory=BU;st.CSSPropertySyntaxFactory=zU;st.styleValueRegistry=new dH(st);st.layoutRegistry=null;st.globalThis=$U();st.enableStyleSyntax=!0;st.enableSizeAttenuation=!1;var jU=0,Ow=new ia(Xt.INSERTED,null,"","","",0,"",""),Cw=new ia(Xt.REMOVED,null,"","","",0,"",""),zL=new cn(Xt.DESTROY),qU=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.entity=jU++,e.renderable={bounds:void 0,boundsDirty:!0,renderBounds:void 0,renderBoundsDirty:!0,dirtyRenderBounds:void 0,dirty:!1},e.cullable={strategy:YG.Standard,visibilityPlaneMask:-1,visible:!0,enable:!0},e.transformable={dirtyFlag:!1,localDirtyFlag:!1,frozen:!1,localPosition:[0,0,0],localRotation:[0,0,0,1],localScale:[1,1,1],localTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],localSkew:[0,0],position:[0,0,0],rotation:[0,0,0,1],scaling:[1,1,1],worldTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],origin:[0,0,0]},e.sortable={dirty:!1,sorted:void 0,renderOrder:0,dirtyChildren:[],dirtyReason:void 0},e.geometry={contentBounds:void 0,renderBounds:void 0,dirty:!0},e.rBushNode={aabb:void 0},e.namespaceURI="g",e.scrollLeft=0,e.scrollTop=0,e.clientTop=0,e.clientLeft=0,e.destroyed=!1,e.style={},e.computedStyle={},e.parsedStyle={},e.attributes={},e}return jt(t,r),it(t,[{key:"className",get:function(){return this.getAttribute("class")||""},set:function(n){this.setAttribute("class",n)}},{key:"classList",get:function(){return this.className.split(" ").filter(function(n){return n!==""})}},{key:"tagName",get:function(){return this.nodeName}},{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"parentElement",get:function(){return this.parentNode}},{key:"nextSibling",get:function(){if(this.parentNode){var n=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[n+1]||null}return null}},{key:"previousSibling",get:function(){if(this.parentNode){var n=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[n-1]||null}return null}},{key:"cloneNode",value:function(n){throw new Error(pe)}},{key:"appendChild",value:function(n,i){var a;if(n.destroyed)throw new Error(FG);return st.sceneGraphService.attach(n,this,i),(a=this.ownerDocument)!==null&&a!==void 0&&a.defaultView&&(!kf(this)&&n.nodeName===Q.FRAGMENT?this.ownerDocument.defaultView.mountFragment(n):this.ownerDocument.defaultView.mountChildren(n)),this.isMutationObserved&&(Ow.relatedNode=this,n.dispatchEvent(Ow)),n}},{key:"insertBefore",value:function(n,i){if(!i)this.appendChild(n);else{n.parentElement&&n.parentElement.removeChild(n);var a=this.childNodes.indexOf(i);a===-1?this.appendChild(n):this.appendChild(n,a)}return n}},{key:"replaceChild",value:function(n,i){var a=this.childNodes.indexOf(i);return this.removeChild(i),this.appendChild(n,a),i}},{key:"removeChild",value:function(n){var i;return Cw.relatedNode=this,n.dispatchEvent(Cw),(i=n.ownerDocument)!==null&&i!==void 0&&i.defaultView&&n.ownerDocument.defaultView.unmountChildren(n),st.sceneGraphService.detach(n),n}},{key:"removeChildren",value:function(){for(var n=this.childNodes.length-1;n>=0;n--){var i=this.childNodes[n];this.removeChild(i)}}},{key:"destroyChildren",value:function(){for(var n=this.childNodes.length-1;n>=0;n--){var i=this.childNodes[n];i.childNodes.length>0&&i.destroyChildren(),i.destroy()}}},{key:"matches",value:function(n){return st.sceneGraphService.matches(n,this)}},{key:"getElementById",value:function(n){return st.sceneGraphService.querySelector("#".concat(n),this)}},{key:"getElementsByName",value:function(n){return st.sceneGraphService.querySelectorAll('[name="'.concat(n,'"]'),this)}},{key:"getElementsByClassName",value:function(n){return st.sceneGraphService.querySelectorAll(".".concat(n),this)}},{key:"getElementsByTagName",value:function(n){return st.sceneGraphService.querySelectorAll(n,this)}},{key:"querySelector",value:function(n){return st.sceneGraphService.querySelector(n,this)}},{key:"querySelectorAll",value:function(n){return st.sceneGraphService.querySelectorAll(n,this)}},{key:"closest",value:function(n){var i=this;do{if(st.sceneGraphService.matches(n,i))return i;i=i.parentElement}while(i!==null);return null}},{key:"find",value:function(n){var i=this,a=null;return this.forEach(function(s){return s!==i&&n(s)?(a=s,!1):!0}),a}},{key:"findAll",value:function(n){var i=this,a=[];return this.forEach(function(s){s!==i&&n(s)&&a.push(s)}),a}},{key:"after",value:function(){var n=this;if(this.parentNode){for(var i=this.parentNode.childNodes.indexOf(this),a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];s.forEach(function(l,u){var c;return(c=n.parentNode)===null||c===void 0?void 0:c.appendChild(l,i+u+1)})}}},{key:"before",value:function(){if(this.parentNode){for(var n,i=this.parentNode.childNodes.indexOf(this),a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];var l=s[0],u=s.slice(1);this.parentNode.appendChild(l,i),(n=l).after.apply(n,Te(u))}}},{key:"replaceWith",value:function(){this.after.apply(this,arguments),this.remove()}},{key:"append",value:function(){for(var n=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];a.forEach(function(o){return n.appendChild(o)})}},{key:"prepend",value:function(){for(var n=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];a.forEach(function(o,l){return n.appendChild(o,l)})}},{key:"replaceChildren",value:function(){for(;this.childNodes.length&&this.firstChild;)this.removeChild(this.firstChild);this.append.apply(this,arguments)}},{key:"remove",value:function(){return this.parentNode?this.parentNode.removeChild(this):this}},{key:"destroy",value:function(){this.destroyChildren(),this.dispatchEvent(zL),this.remove(),this.emitter.removeAllListeners(),this.destroyed=!0}},{key:"getGeometryBounds",value:function(){return st.sceneGraphService.getGeometryBounds(this)}},{key:"getRenderBounds",value:function(){return st.sceneGraphService.getBounds(this,!0)}},{key:"getBounds",value:function(){return st.sceneGraphService.getBounds(this)}},{key:"getLocalBounds",value:function(){return st.sceneGraphService.getLocalBounds(this)}},{key:"getBoundingClientRect",value:function(){return st.sceneGraphService.getBoundingClientRect(this)}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"computedStyleMap",value:function(){return new Map(Object.entries(this.computedStyle))}},{key:"getAttributeNames",value:function(){return Object.keys(this.attributes)}},{key:"getAttribute",value:function(n){if(typeof n!="symbol"){var i=this.attributes[n];return i}}},{key:"hasAttribute",value:function(n){return this.getAttributeNames().includes(n)}},{key:"hasAttributes",value:function(){return!!this.getAttributeNames().length}},{key:"removeAttribute",value:function(n){this.setAttribute(n,null),delete this.attributes[n]}},{key:"setAttribute",value:function(n,i,a,s){this.attributes[n]=i}},{key:"getAttributeNS",value:function(n,i){throw new Error(pe)}},{key:"getAttributeNode",value:function(n){throw new Error(pe)}},{key:"getAttributeNodeNS",value:function(n,i){throw new Error(pe)}},{key:"hasAttributeNS",value:function(n,i){throw new Error(pe)}},{key:"removeAttributeNS",value:function(n,i){throw new Error(pe)}},{key:"removeAttributeNode",value:function(n){throw new Error(pe)}},{key:"setAttributeNS",value:function(n,i,a){throw new Error(pe)}},{key:"setAttributeNode",value:function(n){throw new Error(pe)}},{key:"setAttributeNodeNS",value:function(n){throw new Error(pe)}},{key:"toggleAttribute",value:function(n,i){throw new Error(pe)}}])}($e);function se(r){return!!(r!=null&&r.nodeName)}var WU=st.globalThis.Proxy?st.globalThis.Proxy:function(){},Xi=new ia(Xt.ATTR_MODIFIED,null,null,null,null,ia.MODIFICATION,null,null),ku=Qt(),GU=wn(),Pe=function(r){function t(e){var n;return at(this,t),n=qt(this,t),n.isCustomElement=!1,n.isMutationObserved=!1,n.activeAnimations=[],n.config=e,n.id=e.id||"",n.name=e.name||"",(e.className||e.class)&&(n.className=e.className||e.class),n.nodeName=e.type||Q.GROUP,e.initialParsedStyle&&Object.assign(n.parsedStyle,e.initialParsedStyle),n.initAttributes(e.style),st.enableStyleSyntax&&(n.style=new WU({setProperty:function(a,s){n.setAttribute(a,s)},getPropertyValue:function(a){return n.getAttribute(a)},removeProperty:function(a){n.removeAttribute(a)},item:function(){return""}},{get:function(a,s){return a[s]!==void 0?a[s]:n.getAttribute(s)},set:function(a,s,o){return n.setAttribute(s,o),!0}})),n}return jt(t,r),it(t,[{key:"destroy",value:function(){q3(t,"destroy",this)([]),this.getAnimations().forEach(function(n){n.cancel()})}},{key:"cloneNode",value:function(n,i){var a=Ft({},this.attributes);for(var s in a){var o=a[s];se(o)&&s!=="clipPath"&&s!=="offsetPath"&&s!=="textPath"&&(a[s]=o.cloneNode(n)),i&&(a[s]=i(s,o))}var l=new this.constructor(Ft(Ft({},this.config),{},{style:a}));return l.setLocalTransform(this.getLocalTransform()),n&&this.children.forEach(function(u){if(!u.style.isMarker){var c=u.cloneNode(n);l.appendChild(c)}}),l}},{key:"initAttributes",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i={forceUpdateGeometry:!0};st.styleValueRegistry.processProperties(this,n,i),this.renderable.dirty=!0}},{key:"setAttribute",value:function(n,i){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;Pt(i)||(a||i!==this.attributes[n])&&(this.internalSetAttribute(n,i,{memoize:s}),q3(t,"setAttribute",this)([n,i]))}},{key:"internalSetAttribute",value:function(n,i){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=this.renderable,o=this.attributes[n],l=this.parsedStyle[n];st.styleValueRegistry.processProperties(this,bt({},n,i),a),s.dirty=!0;var u=this.parsedStyle[n];if(this.isConnected&&(Xi.relatedNode=this,Xi.prevValue=o,Xi.newValue=i,Xi.attrName=n,Xi.prevParsedValue=l,Xi.newParsedValue=u,this.isMutationObserved?this.dispatchEvent(Xi):(Xi.target=this,this.ownerDocument.defaultView.dispatchEvent(Xi,!0))),this.isCustomElement&&this.isConnected||!this.isCustomElement){var c,h;(c=(h=this).attributeChangedCallback)===null||c===void 0||c.call(h,n,o,i,l,u)}}},{key:"getBBox",value:function(){var n=this.getBounds(),i=n.getMin(),a=Rt(i,2),s=a[0],o=a[1],l=n.getMax(),u=Rt(l,2),c=u[0],h=u[1];return new Wl(s,o,c-s,h-o)}},{key:"setOrigin",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return st.sceneGraphService.setOrigin(this,ar(n,i,a,!1)),this}},{key:"getOrigin",value:function(){return st.sceneGraphService.getOrigin(this)}},{key:"setPosition",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return st.sceneGraphService.setPosition(this,ar(n,i,a,!1)),this}},{key:"setLocalPosition",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return st.sceneGraphService.setLocalPosition(this,ar(n,i,a,!1)),this}},{key:"translate",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return st.sceneGraphService.translate(this,ar(n,i,a,!1)),this}},{key:"translateLocal",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return st.sceneGraphService.translateLocal(this,ar(n,i,a,!1)),this}},{key:"getPosition",value:function(){return st.sceneGraphService.getPosition(this)}},{key:"getLocalPosition",value:function(){return st.sceneGraphService.getLocalPosition(this)}},{key:"scale",value:function(n,i,a){return this.scaleLocal(n,i,a)}},{key:"scaleLocal",value:function(n,i,a){return typeof n=="number"&&(i=i||n,a=a||n,n=ar(n,i,a,!1)),st.sceneGraphService.scaleLocal(this,n),this}},{key:"setLocalScale",value:function(n,i,a){return typeof n=="number"&&(i=i||n,a=a||n,n=ar(n,i,a,!1)),st.sceneGraphService.setLocalScale(this,n),this}},{key:"getLocalScale",value:function(){return st.sceneGraphService.getLocalScale(this)}},{key:"getScale",value:function(){return st.sceneGraphService.getScale(this)}},{key:"getEulerAngles",value:function(){var n=yv(ku,st.sceneGraphService.getWorldTransform(this)),i=Rt(n,3),a=i[2];return xr(a)}},{key:"getLocalEulerAngles",value:function(){var n=yv(ku,st.sceneGraphService.getLocalRotation(this)),i=Rt(n,3),a=i[2];return xr(a)}},{key:"setEulerAngles",value:function(n){return st.sceneGraphService.setEulerAngles(this,0,0,n),this}},{key:"setLocalEulerAngles",value:function(n){return st.sceneGraphService.setLocalEulerAngles(this,0,0,n),this}},{key:"rotateLocal",value:function(n,i,a){return kt(i)&&kt(a)?st.sceneGraphService.rotateLocal(this,0,0,n):st.sceneGraphService.rotateLocal(this,n,i,a),this}},{key:"rotate",value:function(n,i,a){return kt(i)&&kt(a)?st.sceneGraphService.rotate(this,0,0,n):st.sceneGraphService.rotate(this,n,i,a),this}},{key:"setRotation",value:function(n,i,a,s){return st.sceneGraphService.setRotation(this,n,i,a,s),this}},{key:"setLocalRotation",value:function(n,i,a,s){return st.sceneGraphService.setLocalRotation(this,n,i,a,s),this}},{key:"setLocalSkew",value:function(n,i){return st.sceneGraphService.setLocalSkew(this,n,i),this}},{key:"getRotation",value:function(){return st.sceneGraphService.getRotation(this)}},{key:"getLocalRotation",value:function(){return st.sceneGraphService.getLocalRotation(this)}},{key:"getLocalSkew",value:function(){return st.sceneGraphService.getLocalSkew(this)}},{key:"getLocalTransform",value:function(){return st.sceneGraphService.getLocalTransform(this)}},{key:"getWorldTransform",value:function(){return st.sceneGraphService.getWorldTransform(this)}},{key:"setLocalTransform",value:function(n){return st.sceneGraphService.setLocalTransform(this,n),this}},{key:"resetLocalTransform",value:function(){st.sceneGraphService.resetLocalTransform(this)}},{key:"getAnimations",value:function(){return this.activeAnimations}},{key:"animate",value:function(n,i){var a,s=(a=this.ownerDocument)===null||a===void 0?void 0:a.timeline;return s?s.play(this,n,i):null}},{key:"isVisible",value:function(){var n;return((n=this.parsedStyle)===null||n===void 0?void 0:n.visibility)!=="hidden"}},{key:"interactive",get:function(){return this.isInteractive()},set:function(n){this.style.pointerEvents=n?"auto":"none"}},{key:"isInteractive",value:function(){var n;return((n=this.parsedStyle)===null||n===void 0?void 0:n.pointerEvents)!=="none"}},{key:"isCulled",value:function(){return!!(this.cullable&&this.cullable.enable&&!this.cullable.visible)}},{key:"toFront",value:function(){return this.parentNode&&(this.style.zIndex=Math.max.apply(Math,Te(this.parentNode.children.map(function(n){return Number(n.style.zIndex)})))+1),this}},{key:"toBack",value:function(){return this.parentNode&&(this.style.zIndex=Math.min.apply(Math,Te(this.parentNode.children.map(function(n){return Number(n.style.zIndex)})))-1),this}},{key:"getConfig",value:function(){return this.config}},{key:"attr",value:function(){for(var n=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];var o=a[0],l=a[1];return o?an(o)?(Object.keys(o).forEach(function(u){n.setAttribute(u,o[u])}),this):a.length===2?(this.setAttribute(o,l),this):this.attributes[o]:this.attributes}},{key:"getMatrix",value:function(n){var i=n||this.getWorldTransform(),a=hf(ku,i),s=Rt(a,2),o=s[0],l=s[1],u=jl(ku,i),c=Rt(u,2),h=c[0],d=c[1],g=df(GU,i),p=yv(ku,g),v=Rt(p,3),m=v[0],b=v[2];return WG(m||b,o,l,h,d)}},{key:"getLocalMatrix",value:function(){return this.getMatrix(this.getLocalTransform())}},{key:"setMatrix",value:function(n){var i=U3(n),a=Rt(i,5),s=a[0],o=a[1],l=a[2],u=a[3],c=a[4];this.setEulerAngles(c).setPosition(s,o).setLocalScale(l,u)}},{key:"setLocalMatrix",value:function(n){var i=U3(n),a=Rt(i,5),s=a[0],o=a[1],l=a[2],u=a[3],c=a[4];this.setLocalEulerAngles(c).setLocalPosition(s,o).setLocalScale(l,u)}},{key:"show",value:function(){this.forEach(function(n){n.style.visibility="visible"})}},{key:"hide",value:function(){this.forEach(function(n){n.style.visibility="hidden"})}},{key:"getCount",value:function(){return this.childElementCount}},{key:"getParent",value:function(){return this.parentElement}},{key:"getChildren",value:function(){return this.children}},{key:"getFirst",value:function(){return this.firstElementChild}},{key:"getLast",value:function(){return this.lastElementChild}},{key:"getChildByIndex",value:function(n){return this.children[n]||null}},{key:"add",value:function(n,i){return this.appendChild(n,i)}},{key:"set",value:function(n,i){this.config[n]=i}},{key:"get",value:function(n){return this.config[n]}},{key:"moveTo",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return this.setPosition(n,i,a),this}},{key:"move",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return this.setPosition(n,i,a),this}},{key:"setZIndex",value:function(n){return this.style.zIndex=n,this}}])}(qU);Pe.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","display","draggable","droppable","fill","fillOpacity","fillRule","filter","increasedLineWidthForHitTesting","lineCap","lineDash","lineDashOffset","lineJoin","lineWidth","miterLimit","hitArea","offsetDistance","offsetPath","offsetX","offsetY","opacity","pointerEvents","shadowColor","shadowType","shadowBlur","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","strokeWidth","strokeLinecap","strokeLineJoin","strokeDasharray","strokeDashoffset","transform","transformOrigin","textTransform","visibility","zIndex"]);var Ha=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return at(this,t),qt(this,t,[Ft({type:Q.CIRCLE},e)])}return jt(t,r),it(t)}(Pe);Ha.PARSED_STYLE_LIST=new Set([].concat(Te(Pe.PARSED_STYLE_LIST),["cx","cy","cz","r","isBillboard","isSizeAttenuation"]));var VU=["style"],Bx=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=qo(n,VU);return at(this,t),e=qt(this,t,[Ft({style:i},a)]),e.isCustomElement=!0,e}return jt(t,r),it(t)}(Pe);Bx.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var Nc=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return at(this,t),qt(this,t,[Ft({type:Q.ELLIPSE},e)])}return jt(t,r),it(t)}(Pe);Nc.PARSED_STYLE_LIST=new Set([].concat(Te(Pe.PARSED_STYLE_LIST),["cx","cy","cz","rx","ry","isBillboard","isSizeAttenuation"]));var HU=function(r){function t(){return at(this,t),qt(this,t,[{type:Q.FRAGMENT}])}return jt(t,r),it(t)}(Pe);HU.PARSED_STYLE_LIST=new Set(["class","className"]);var _n=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return at(this,t),qt(this,t,[Ft({type:Q.GROUP},e)])}return jt(t,r),it(t)}(Pe);_n.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var UU=["style"],Rc=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=qo(n,UU);return at(this,t),e=qt(this,t,[Ft({type:Q.HTML,style:i},a)]),e.cullable.enable=!1,e}return jt(t,r),it(t,[{key:"getDomElement",value:function(){return this.parsedStyle.$el}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"getLocalBounds",value:function(){if(this.parentNode){var n=Zi(Se(),this.parentNode.getWorldTransform()),i=this.getBounds();if(!Me.isEmpty(i)){var a=new Me;return a.setFromTransformedAABB(i,n),a}}return this.getBounds()}}])}(Pe);Rc.PARSED_STYLE_LIST=new Set([].concat(Te(Pe.PARSED_STYLE_LIST),["x","y","$el","innerHTML","width","height"]));var Lc=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return at(this,t),qt(this,t,[Ft({type:Q.IMAGE},e)])}return jt(t,r),it(t)}(Pe);Lc.PARSED_STYLE_LIST=new Set([].concat(Te(Pe.PARSED_STYLE_LIST),["x","y","z","src","width","height","isBillboard","billboardRotation","isSizeAttenuation","keepAspectRatio"]));var YU=["style"],Io=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=qo(n,YU);at(this,t),e=qt(this,t,[Ft({type:Q.LINE,style:Ft({x1:0,y1:0,x2:0,y2:0,z1:0,z2:0},i)},a)]),e.markerStartAngle=0,e.markerEndAngle=0;var s=e.parsedStyle,o=s.markerStart,l=s.markerEnd;return o&&se(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),l&&se(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return jt(t,r),it(t,[{key:"attributeChangedCallback",value:function(n,i,a,s,o){n==="x1"||n==="y1"||n==="x2"||n==="y2"||n==="markerStartOffset"||n==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):n==="markerStart"?(s&&se(s)&&(this.markerStartAngle=0,s.remove()),o&&se(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"&&(s&&se(s)&&(this.markerEndAngle=0,s.remove()),o&&se(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1)))}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,l=i.markerEndOffset,u=i.x1,c=i.x2,h=i.y1,d=i.y2,g=n?a:s;if(!(!g||!se(g))){var p=0,v,m,b,w,x,_;n?(b=u,w=h,v=c-u,m=d-h,x=o||0,_=this.markerStartAngle):(b=c,w=d,v=u-c,m=h-d,x=l||0,_=this.markerEndAngle),p=Math.atan2(m,v),g.setLocalEulerAngles(p*180/Math.PI+_),g.setLocalPosition(b+Math.cos(p)*x,w+Math.sin(p)*x)}}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle,s=a.x1,o=a.y1,l=a.x2,u=a.y2,c=lL(s,o,l,u,n),h=c.x,d=c.y,g=Qn(Qt(),Ce(h,d,0),i?this.getWorldTransform():this.getLocalTransform());return new Bn(g[0],g[1])}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPoint(n/this.getTotalLength(),i)}},{key:"getTotalLength",value:function(){var n=this.parsedStyle,i=n.x1,a=n.y1,s=n.x2,o=n.y2;return oL(i,a,s,o)}}])}(Pe);Io.PARSED_STYLE_LIST=new Set([].concat(Te(Pe.PARSED_STYLE_LIST),["x1","y1","x2","y2","z1","z2","isBillboard","isSizeAttenuation","markerStart","markerEnd","markerStartOffset","markerEndOffset"]));var XU=["style"],qr=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=qo(n,XU);at(this,t),e=qt(this,t,[Ft({type:Q.PATH,style:i,initialParsedStyle:{miterLimit:4,d:Ft({},dL)}},a)]),e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[];var s=e.parsedStyle,o=s.markerStart,l=s.markerEnd,u=s.markerMid;return o&&se(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),u&&se(u)&&e.placeMarkerMid(u),l&&se(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return jt(t,r),it(t,[{key:"attributeChangedCallback",value:function(n,i,a,s,o){n==="d"?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):n==="markerStartOffset"||n==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):n==="markerStart"?(s&&se(s)&&(this.markerStartAngle=0,s.remove()),o&&se(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"?(s&&se(s)&&(this.markerEndAngle=0,s.remove()),o&&se(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1))):n==="markerMid"&&this.placeMarkerMid(o)}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,l=i.markerEndOffset,u=n?a:s;if(!(!u||!se(u))){var c=0,h,d,g,p,v,m;if(n){var b=this.getStartTangent(),w=Rt(b,2),x=w[0],_=w[1];g=_[0],p=_[1],h=x[0]-_[0],d=x[1]-_[1],v=o||0,m=this.markerStartAngle}else{var S=this.getEndTangent(),M=Rt(S,2),k=M[0],T=M[1];g=T[0],p=T[1],h=k[0]-T[0],d=k[1]-T[1],v=l||0,m=this.markerEndAngle}c=Math.atan2(d,h),u.setLocalEulerAngles(c*180/Math.PI+m),u.setLocalPosition(g+Math.cos(c)*v,p+Math.sin(c)*v)}}},{key:"placeMarkerMid",value:function(n){var i=this.parsedStyle.d.segments;if(this.markerMidList.forEach(function(c){c.remove()}),n&&se(n))for(var a=1;a<i.length-1;a++){var s=Rt(i[a].currentPoint,2),o=s[0],l=s[1],u=a===1?n:n.cloneNode(!0);this.markerMidList.push(u),this.appendChild(u),u.setLocalPosition(o,l)}}},{key:"getTotalLength",value:function(){return _w(this)}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle.d.absolutePath,s=dG(a,n),o=s.x,l=s.y,u=Qn(Qt(),Ce(o,l,0),i?this.getWorldTransform():this.getLocalTransform());return new Bn(u[0],u[1])}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPointAtLength(n*_w(this),i)}},{key:"getStartTangent",value:function(){var n=this.parsedStyle.d.segments,i=[];if(n.length>1){var a=n[0].currentPoint,s=n[1].currentPoint,o=n[1].startTangent;i=[],o?(i.push([a[0]-o[0],a[1]-o[1]]),i.push([a[0],a[1]])):(i.push([s[0],s[1]]),i.push([a[0],a[1]]))}return i}},{key:"getEndTangent",value:function(){var n=this.parsedStyle.d.segments,i=n.length,a=[];if(i>1){var s=n[i-2].currentPoint,o=n[i-1].currentPoint,l=n[i-1].endTangent;a=[],l?(a.push([o[0]-l[0],o[1]-l[1]]),a.push([o[0],o[1]])):(a.push([s[0],s[1]]),a.push([o[0],o[1]]))}return a}}])}(Pe);qr.PARSED_STYLE_LIST=new Set([].concat(Te(Pe.PARSED_STYLE_LIST),["d","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard","isSizeAttenuation"]));var KU=["style"],Go=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=qo(n,KU);at(this,t),e=qt(this,t,[Ft({type:Q.POLYGON,style:i,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!0}},a)]),e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[];var s=e.parsedStyle,o=s.markerStart,l=s.markerEnd,u=s.markerMid;return o&&se(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),u&&se(u)&&e.placeMarkerMid(u),l&&se(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return jt(t,r),it(t,[{key:"attributeChangedCallback",value:function(n,i,a,s,o){n==="points"?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):n==="markerStartOffset"||n==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):n==="markerStart"?(s&&se(s)&&(this.markerStartAngle=0,s.remove()),o&&se(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"?(s&&se(s)&&(this.markerEndAngle=0,s.remove()),o&&se(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1))):n==="markerMid"&&this.placeMarkerMid(o)}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,l=i.markerEndOffset,u=i.points,c=u||{},h=c.points,d=n?a:s;if(!(!d||!se(d)||!h)){var g=0,p,v,m,b,w,x;if(m=h[0][0],b=h[0][1],n)p=h[1][0]-h[0][0],v=h[1][1]-h[0][1],w=o||0,x=this.markerStartAngle;else{var _=h.length;this.parsedStyle.isClosed?(p=h[_-1][0]-h[0][0],v=h[_-1][1]-h[0][1]):(m=h[_-1][0],b=h[_-1][1],p=h[_-2][0]-h[_-1][0],v=h[_-2][1]-h[_-1][1]),w=l||0,x=this.markerEndAngle}g=Math.atan2(v,p),d.setLocalEulerAngles(g*180/Math.PI+x),d.setLocalPosition(m+Math.cos(g)*w,b+Math.sin(g)*w)}}},{key:"placeMarkerMid",value:function(n){var i=this.parsedStyle.points,a=i||{},s=a.points;if(this.markerMidList.forEach(function(h){h.remove()}),this.markerMidList=[],n&&se(n)&&s)for(var o=1;o<(this.parsedStyle.isClosed?s.length:s.length-1);o++){var l=s[o][0],u=s[o][1],c=o===1?n:n.cloneNode(!0);this.markerMidList.push(c),this.appendChild(c),c.setLocalPosition(l,u)}}}])}(Pe);Go.PARSED_STYLE_LIST=new Set([].concat(Te(Pe.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isClosed","isBillboard","isSizeAttenuation"]));var ZU=["style"],og=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.style,i=qo(e,ZU);return at(this,t),qt(this,t,[Ft({type:Q.POLYLINE,style:n,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!1}},i)])}return jt(t,r),it(t,[{key:"getTotalLength",value:function(){return WV(this)}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPoint(n/this.getTotalLength(),i)}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle.points.points;if(this.parsedStyle.points.segments.length===0){var s=[],o=0,l,u,c=this.getTotalLength();a.forEach(function(b,w){a[w+1]&&(l=[0,0],l[0]=o/c,u=oL(b[0],b[1],a[w+1][0],a[w+1][1]),o+=u,l[1]=o/c,s.push(l))}),this.parsedStyle.points.segments=s}var h=0,d=0;this.parsedStyle.points.segments.forEach(function(b,w){n>=b[0]&&n<=b[1]&&(h=(n-b[0])/(b[1]-b[0]),d=w)});var g=lL(a[d][0],a[d][1],a[d+1][0],a[d+1][1],h),p=g.x,v=g.y,m=Qn(Qt(),Ce(p,v,0),i?this.getWorldTransform():this.getLocalTransform());return new Bn(m[0],m[1])}},{key:"getStartTangent",value:function(){var n=this.parsedStyle.points.points,i=[];return i.push([n[1][0],n[1][1]]),i.push([n[0][0],n[0][1]]),i}},{key:"getEndTangent",value:function(){var n=this.parsedStyle.points.points,i=n.length-1,a=[];return a.push([n[i-1][0],n[i-1][1]]),a.push([n[i][0],n[i][1]]),a}}])}(Go);og.PARSED_STYLE_LIST=new Set([].concat(Te(Go.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard"]));var Sn=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return at(this,t),qt(this,t,[Ft({type:Q.RECT},e)])}return jt(t,r),it(t)}(Pe);Sn.PARSED_STYLE_LIST=new Set([].concat(Te(Pe.PARSED_STYLE_LIST),["x","y","z","width","height","isBillboard","isSizeAttenuation","radius"]));var JU=["style"],Hs=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.style,i=qo(e,JU);return at(this,t),qt(this,t,[Ft({type:Q.TEXT,style:Ft({fill:"black"},n)},i)])}return jt(t,r),it(t,[{key:"getComputedTextLength",value:function(){var n;return this.getGeometryBounds(),((n=this.parsedStyle.metrics)===null||n===void 0?void 0:n.maxLineWidth)||0}},{key:"getLineBoundingRects",value:function(){var n;return this.getGeometryBounds(),((n=this.parsedStyle.metrics)===null||n===void 0?void 0:n.lineMetrics)||[]}},{key:"isOverflowing",value:function(){return this.getGeometryBounds(),!!this.parsedStyle.isOverflowing}}])}(Pe);Hs.PARSED_STYLE_LIST=new Set([].concat(Te(Pe.PARSED_STYLE_LIST),["x","y","z","isBillboard","billboardRotation","isSizeAttenuation","text","textAlign","textBaseline","fontStyle","fontSize","fontFamily","fontWeight","fontVariant","lineHeight","letterSpacing","leading","wordWrap","wordWrapWidth","maxLines","textOverflow","isOverflowing","textPath","textDecorationLine","textDecorationColor","textDecorationStyle","textPathSide","textPathStartOffset","metrics","dx","dy"]));var QU=function(){function r(){at(this,r),this.registry={},this.define(Q.CIRCLE,Ha),this.define(Q.ELLIPSE,Nc),this.define(Q.RECT,Sn),this.define(Q.IMAGE,Lc),this.define(Q.LINE,Io),this.define(Q.GROUP,_n),this.define(Q.PATH,qr),this.define(Q.POLYGON,Go),this.define(Q.POLYLINE,og),this.define(Q.TEXT,Hs),this.define(Q.HTML,Rc)}return it(r,[{key:"define",value:function(e,n){this.registry[e]=n}},{key:"get",value:function(e){return this.registry[e]}}])}(),$L=function(r){function t(){var e;at(this,t),e=qt(this,t),e.defaultView=null,e.ownerDocument=null,e.nodeName="document";try{e.timeline=new st.AnimationTimeline(e)}catch{}var n={};return Lx.forEach(function(i){var a=i.n,s=i.inh,o=i.d;s&&o&&(n[a]=Et(o)?o(Q.GROUP):o)}),e.documentElement=new _n({id:"g-root",style:n}),e.documentElement.ownerDocument=e,e.documentElement.parentNode=e,e.childNodes=[e.documentElement],e}return jt(t,r),it(t,[{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"createElement",value:function(n,i){if(n==="svg")return this.documentElement;var a=this.defaultView.customElements.get(n);a||(console.warn("Unsupported tagName: ",n),a=n==="tspan"?Hs:_n);var s=new a(i);return s.ownerDocument=this,s}},{key:"createElementNS",value:function(n,i,a){return this.createElement(i,a)}},{key:"cloneNode",value:function(n){throw new Error(pe)}},{key:"destroy",value:function(){try{this.documentElement.destroyChildren(),this.timeline.destroy()}catch{}}},{key:"elementsFromBBox",value:function(n,i,a,s){var o=this.defaultView.context.rBushRoot,l=o.search({minX:n,minY:i,maxX:a,maxY:s}),u=[];return l.forEach(function(c){var h=c.displayObject,d=h.parsedStyle.pointerEvents,g=d===void 0?"auto":d,p=["auto","visiblepainted","visiblefill","visiblestroke","visible"].includes(g);(!p||p&&h.isVisible())&&!h.isCulled()&&h.isInteractive()&&u.push(h)}),u.sort(function(c,h){return h.sortable.renderOrder-c.sortable.renderOrder}),u}},{key:"elementFromPointSync",value:function(n,i){var a=this.defaultView.canvas2Viewport({x:n,y:i}),s=a.x,o=a.y,l=this.defaultView.getConfig(),u=l.width,c=l.height;if(s<0||o<0||s>u||o>c)return null;var h=this.defaultView.viewport2Client({x:s,y:o}),d=h.x,g=h.y,p=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!0,position:{x:n,y:i,viewportX:s,viewportY:o,clientX:d,clientY:g},picked:[]}),v=p.picked;return v&&v[0]||this.documentElement}},{key:"elementFromPoint",value:function(){var e=Fs($n().mark(function i(a,s){var o,l,u,c,h,d,g,p,v,m,b;return $n().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:if(o=this.defaultView.canvas2Viewport({x:a,y:s}),l=o.x,u=o.y,c=this.defaultView.getConfig(),h=c.width,d=c.height,!(l<0||u<0||l>h||u>d)){x.next=4;break}return x.abrupt("return",null);case 4:return g=this.defaultView.viewport2Client({x:l,y:u}),p=g.x,v=g.y,x.next=7,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!0,position:{x:a,y:s,viewportX:l,viewportY:u,clientX:p,clientY:v},picked:[]});case 7:return m=x.sent,b=m.picked,x.abrupt("return",b&&b[0]||this.documentElement);case 10:case"end":return x.stop()}},i,this)}));function n(i,a){return e.apply(this,arguments)}return n}()},{key:"elementsFromPointSync",value:function(n,i){var a=this.defaultView.canvas2Viewport({x:n,y:i}),s=a.x,o=a.y,l=this.defaultView.getConfig(),u=l.width,c=l.height;if(s<0||o<0||s>u||o>c)return[];var h=this.defaultView.viewport2Client({x:s,y:o}),d=h.x,g=h.y,p=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!1,position:{x:n,y:i,viewportX:s,viewportY:o,clientX:d,clientY:g},picked:[]}),v=p.picked;return v[v.length-1]!==this.documentElement&&v.push(this.documentElement),v}},{key:"elementsFromPoint",value:function(){var e=Fs($n().mark(function i(a,s){var o,l,u,c,h,d,g,p,v,m,b;return $n().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:if(o=this.defaultView.canvas2Viewport({x:a,y:s}),l=o.x,u=o.y,c=this.defaultView.getConfig(),h=c.width,d=c.height,!(l<0||u<0||l>h||u>d)){x.next=4;break}return x.abrupt("return",[]);case 4:return g=this.defaultView.viewport2Client({x:l,y:u}),p=g.x,v=g.y,x.next=7,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!1,position:{x:a,y:s,viewportX:l,viewportY:u,clientX:p,clientY:v},picked:[]});case 7:return m=x.sent,b=m.picked,b[b.length-1]!==this.documentElement&&b.push(this.documentElement),x.abrupt("return",b);case 11:case"end":return x.stop()}},i,this)}));function n(i,a){return e.apply(this,arguments)}return n}()},{key:"appendChild",value:function(n,i){throw new Error(vl)}},{key:"insertBefore",value:function(n,i){throw new Error(vl)}},{key:"removeChild",value:function(n,i){throw new Error(vl)}},{key:"replaceChild",value:function(n,i,a){throw new Error(vl)}},{key:"append",value:function(){throw new Error(vl)}},{key:"prepend",value:function(){throw new Error(vl)}},{key:"getElementById",value:function(n){return this.documentElement.getElementById(n)}},{key:"getElementsByName",value:function(n){return this.documentElement.getElementsByName(n)}},{key:"getElementsByTagName",value:function(n){return this.documentElement.getElementsByTagName(n)}},{key:"getElementsByClassName",value:function(n){return this.documentElement.getElementsByClassName(n)}},{key:"querySelector",value:function(n){return this.documentElement.querySelector(n)}},{key:"querySelectorAll",value:function(n){return this.documentElement.querySelectorAll(n)}},{key:"find",value:function(n){return this.documentElement.find(n)}},{key:"findAll",value:function(n){return this.documentElement.findAll(n)}}])}($e),jL=function(){function r(t){at(this,r),this.strategies=t}return it(r,[{key:"apply",value:function(e){var n=e.camera,i=e.renderingService,a=e.renderingContext,s=this.strategies;i.hooks.cull.tap(r.tag,function(o){if(o){var l=o.cullable;return s.length===0?l.visible=a.unculledEntities.indexOf(o.entity)>-1:l.visible=s.every(function(u){return u.isVisible(n,o)}),!o.isCulled()&&o.isVisible()?o:(o.dispatchEvent(new cn(Xt.CULLED)),null)}return o}),i.hooks.afterRender.tap(r.tag,function(o){o.cullable.visibilityPlaneMask=-1})}}])}();jL.tag="Culling";var qL=function(){function r(){var t=this;at(this,r),this.autoPreventDefault=!1,this.rootPointerEvent=new Tf(null),this.rootWheelEvent=new Tw(null),this.onPointerMove=function(e){var n,i=(n=t.context.renderingContext.root)===null||n===void 0||(n=n.ownerDocument)===null||n===void 0?void 0:n.defaultView;if(!(i.supportsTouchEvents&&e.pointerType==="touch")){var a=t.normalizeToPointerEvent(e,i),s=vo(a),o;try{for(s.s();!(o=s.n()).done;){var l=o.value,u=t.bootstrapEvent(t.rootPointerEvent,l,i,e);t.context.eventService.mapEvent(u)}}catch(c){s.e(c)}finally{s.f()}t.setCursor(t.context.eventService.cursor)}},this.onClick=function(e){var n,i=(n=t.context.renderingContext.root)===null||n===void 0||(n=n.ownerDocument)===null||n===void 0?void 0:n.defaultView,a=t.normalizeToPointerEvent(e,i),s=vo(a),o;try{for(s.s();!(o=s.n()).done;){var l=o.value,u=t.bootstrapEvent(t.rootPointerEvent,l,i,e);t.context.eventService.mapEvent(u)}}catch(c){s.e(c)}finally{s.f()}t.setCursor(t.context.eventService.cursor)}}return it(r,[{key:"apply",value:function(e){var n=this;this.context=e;var i=e.renderingService,a=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler(function(s){var o=n.context.renderingService.hooks.pickSync.call({position:s,picked:[],topmost:!0}),l=o.picked;return l[0]||null}),i.hooks.pointerWheel.tap(r.tag,function(s){var o=n.normalizeWheelEvent(s);n.context.eventService.mapEvent(o)}),i.hooks.pointerDown.tap(r.tag,function(s){if(!(a.supportsTouchEvents&&s.pointerType==="touch")){var o=n.normalizeToPointerEvent(s,a);if(n.autoPreventDefault&&o[0].isNormalized){var l=s.cancelable||!("cancelable"in s);l&&s.preventDefault()}var u=vo(o),c;try{for(u.s();!(c=u.n()).done;){var h=c.value,d=n.bootstrapEvent(n.rootPointerEvent,h,a,s);n.context.eventService.mapEvent(d)}}catch(g){u.e(g)}finally{u.f()}n.setCursor(n.context.eventService.cursor)}}),i.hooks.pointerUp.tap(r.tag,function(s){if(!(a.supportsTouchEvents&&s.pointerType==="touch")){var o=n.context.contextService.getDomElement(),l=n.context.eventService.isNativeEventFromCanvas(o,s),u=l?"":"outside",c=n.normalizeToPointerEvent(s,a),h=vo(c),d;try{for(h.s();!(d=h.n()).done;){var g=d.value,p=n.bootstrapEvent(n.rootPointerEvent,g,a,s);p.type+=u,n.context.eventService.mapEvent(p)}}catch(v){h.e(v)}finally{h.f()}n.setCursor(n.context.eventService.cursor)}}),i.hooks.pointerMove.tap(r.tag,this.onPointerMove),i.hooks.pointerOver.tap(r.tag,this.onPointerMove),i.hooks.pointerOut.tap(r.tag,this.onPointerMove),i.hooks.click.tap(r.tag,this.onClick),i.hooks.pointerCancel.tap(r.tag,function(s){var o=n.normalizeToPointerEvent(s,a),l=vo(o),u;try{for(l.s();!(u=l.n()).done;){var c=u.value,h=n.bootstrapEvent(n.rootPointerEvent,c,a,s);n.context.eventService.mapEvent(h)}}catch(d){l.e(d)}finally{l.f()}n.setCursor(n.context.eventService.cursor)})}},{key:"bootstrapEvent",value:function(e,n,i,a){e.view=i,e.originalEvent=null,e.nativeEvent=a,e.pointerId=n.pointerId,e.width=n.width,e.height=n.height,e.isPrimary=n.isPrimary,e.pointerType=n.pointerType,e.pressure=n.pressure,e.tangentialPressure=n.tangentialPressure,e.tiltX=n.tiltX,e.tiltY=n.tiltY,e.twist=n.twist,this.transferMouseData(e,n);var s=this.context.eventService.client2Viewport({x:n.clientX,y:n.clientY}),o=s.x,l=s.y;e.viewport.x=o,e.viewport.y=l;var u=this.context.eventService.viewport2Canvas(e.viewport),c=u.x,h=u.y;return e.canvas.x=c,e.canvas.y=h,e.global.copyFrom(e.canvas),e.offset.copyFrom(e.canvas),e.isTrusted=a.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=DH[e.type]||e.type),e}},{key:"normalizeWheelEvent",value:function(e){var n=this.rootWheelEvent;this.transferMouseData(n,e),n.deltaMode=e.deltaMode,n.deltaX=e.deltaX,n.deltaY=e.deltaY,n.deltaZ=e.deltaZ;var i=this.context.eventService.client2Viewport({x:e.clientX,y:e.clientY}),a=i.x,s=i.y;n.viewport.x=a,n.viewport.y=s;var o=this.context.eventService.viewport2Canvas(n.viewport),l=o.x,u=o.y;return n.canvas.x=l,n.canvas.y=u,n.global.copyFrom(n.canvas),n.offset.copyFrom(n.canvas),n.nativeEvent=e,n.type=e.type,n}},{key:"transferMouseData",value:function(e,n){e.isTrusted=n.isTrusted,e.srcElement=n.srcElement,e.timeStamp=kw.now(),e.type=n.type,e.altKey=n.altKey,e.metaKey=n.metaKey,e.shiftKey=n.shiftKey,e.ctrlKey=n.ctrlKey,e.button=n.button,e.buttons=n.buttons,e.client.x=n.clientX,e.client.y=n.clientY,e.movement.x=n.movementX,e.movement.y=n.movementY,e.page.x=n.pageX,e.page.y=n.pageY,e.screen.x=n.screenX,e.screen.y=n.screenY,e.relatedTarget=null}},{key:"setCursor",value:function(e){this.context.contextService.applyCursorStyle(e||this.context.config.cursor||"default")}},{key:"normalizeToPointerEvent",value:function(e,n){var i=[];if(n.isTouchEvent(e))for(var a=0;a<e.changedTouches.length;a++){var s=e.changedTouches[a];Pt(s.button)&&(s.button=0),Pt(s.buttons)&&(s.buttons=1),Pt(s.isPrimary)&&(s.isPrimary=e.touches.length===1&&e.type==="touchstart"),Pt(s.width)&&(s.width=s.radiusX||1),Pt(s.height)&&(s.height=s.radiusY||1),Pt(s.tiltX)&&(s.tiltX=0),Pt(s.tiltY)&&(s.tiltY=0),Pt(s.pointerType)&&(s.pointerType="touch"),Pt(s.pointerId)&&(s.pointerId=s.identifier||0),Pt(s.pressure)&&(s.pressure=s.force||.5),Pt(s.twist)&&(s.twist=0),Pt(s.tangentialPressure)&&(s.tangentialPressure=0),s.isNormalized=!0,s.type=e.type,i.push(s)}else if(n.isMouseEvent(e)){var o=e;Pt(o.isPrimary)&&(o.isPrimary=!0),Pt(o.width)&&(o.width=1),Pt(o.height)&&(o.height=1),Pt(o.tiltX)&&(o.tiltX=0),Pt(o.tiltY)&&(o.tiltY=0),Pt(o.pointerType)&&(o.pointerType="mouse"),Pt(o.pointerId)&&(o.pointerId=IH),Pt(o.pressure)&&(o.pressure=.5),Pt(o.twist)&&(o.twist=0),Pt(o.tangentialPressure)&&(o.tangentialPressure=0),o.isNormalized=!0,i.push(o)}else i.push(e);return i}}])}();qL.tag="Event";var tY=[Q.CIRCLE,Q.ELLIPSE,Q.IMAGE,Q.RECT,Q.LINE,Q.POLYLINE,Q.POLYGON,Q.TEXT,Q.PATH,Q.HTML],eY=function(){function r(){at(this,r)}return it(r,[{key:"isVisible",value:function(e,n){var i,a=n.cullable;if(!a.enable)return!0;var s=n.getRenderBounds();if(Me.isEmpty(s))return!1;var o=e.getFrustum(),l=(i=n.parentNode)===null||i===void 0||(i=i.cullable)===null||i===void 0?void 0:i.visibilityPlaneMask;return a.visibilityPlaneMask=this.computeVisibilityWithPlaneMask(n,s,l||pl.INDETERMINATE,o.planes),a.visible=a.visibilityPlaneMask!==pl.OUTSIDE,a.visible}},{key:"computeVisibilityWithPlaneMask",value:function(e,n,i,a){if(i===pl.OUTSIDE||i===pl.INSIDE)return i;for(var s=pl.INSIDE,o=tY.indexOf(e.nodeName)>-1,l=0,u=a.length;l<u;++l){var c=1<<l;if(i&c&&!(o&&(l===4||l===5))){var h=a[l],d=h.normal,g=h.distance;if(Qi(d,n.getPositiveFarPoint(a[l]))+g<0)return pl.OUTSIDE;Qi(d,n.getNegativeFarPoint(a[l]))+g<0&&(s|=c)}}return s}}])}(),WL=function(){function r(){at(this,r),this.syncTasks=new Map,this.isFirstTimeRendering=!0,this.syncing=!1,this.isFirstTimeRenderingFinished=!1}return it(r,[{key:"apply",value:function(e){var n=this,i,a=e.renderingService,s=e.renderingContext,o=e.rBushRoot,l=s.root.ownerDocument.defaultView;this.rBush=o;var u=function(v){var m=v.target;m.renderable.dirty=!0,a.dirtify()},c=function(v){n.syncTasks.set(v.target,v.detail.affectChildren),a.dirtify()},h=function(v){var m=v.target;st.enableSizeAttenuation&&st.styleValueRegistry.updateSizeAttenuation(m,l.getCamera().getZoom())},d=function(v){var m=v.target,b=m.rBushNode;b.aabb&&n.rBush.remove(b.aabb),n.syncTasks.delete(m),st.sceneGraphService.dirtifyToRoot(m),a.dirtify()};a.hooks.init.tap(r.tag,function(){l.addEventListener(Xt.MOUNTED,h),l.addEventListener(Xt.UNMOUNTED,d),l.addEventListener(Xt.ATTR_MODIFIED,u),l.addEventListener(Xt.BOUNDS_CHANGED,c)}),a.hooks.destroy.tap(r.tag,function(){l.removeEventListener(Xt.MOUNTED,h),l.removeEventListener(Xt.UNMOUNTED,d),l.removeEventListener(Xt.ATTR_MODIFIED,u),l.removeEventListener(Xt.BOUNDS_CHANGED,c),n.syncTasks.clear()});var g=(i=st.globalThis.requestIdleCallback)!==null&&i!==void 0?i:Dx.bind(st.globalThis);a.hooks.endFrame.tap(r.tag,function(){n.isFirstTimeRendering?(n.isFirstTimeRendering=!1,n.syncing=!0,g(function(){n.syncRTree(!0),n.isFirstTimeRenderingFinished=!0})):n.syncRTree()})}},{key:"syncNode",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e.isConnected){var i=e.rBushNode;i.aabb&&this.rBush.remove(i.aabb);var a=e.getRenderBounds();if(a){var s=e.renderable;n&&(s.dirtyRenderBounds||(s.dirtyRenderBounds=new Me),s.dirtyRenderBounds.update(a.center,a.halfExtents));var o=a.getMin(),l=Rt(o,2),u=l[0],c=l[1],h=a.getMax(),d=Rt(h,2),g=d[0],p=d[1];i.aabb||(i.aabb={}),i.aabb.displayObject=e,i.aabb.minX=u,i.aabb.minY=c,i.aabb.maxX=g,i.aabb.maxY=p}if(i.aabb&&!isNaN(i.aabb.maxX)&&!isNaN(i.aabb.maxX)&&!isNaN(i.aabb.minX)&&!isNaN(i.aabb.minY))return i.aabb}}},{key:"syncRTree",value:function(){var e=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!(!n&&(this.syncing||this.syncTasks.size===0))){this.syncing=!0;var i=[],a=new Set,s=function(l){if(!a.has(l)&&l.renderable){var u=e.syncNode(l,n);u&&(i.push(u),a.add(l))}};this.syncTasks.forEach(function(o,l){o&&l.forEach(s);for(var u=l;u;)s(u),u=u.parentElement}),this.rBush.load(i),i.length=0,this.syncing=!1}}}])}();WL.tag="Prepare";var $r=function(r){return r.READY="ready",r.BEFORE_RENDER="beforerender",r.RERENDER="rerender",r.AFTER_RENDER="afterrender",r.BEFORE_DESTROY="beforedestroy",r.AFTER_DESTROY="afterdestroy",r.RESIZE="resize",r.DIRTY_RECTANGLE="dirtyrectangle",r.RENDERER_CHANGED="rendererchanged",r}({}),_M=500,nY=.1,rY=1e3,Qh=new cn(Xt.MOUNTED),td=new cn(Xt.UNMOUNTED),Cv=new cn($r.BEFORE_RENDER),SM=new cn($r.RERENDER),Av=new cn($r.AFTER_RENDER),Aw=function(r){function t(e){var n;at(this,t),n=qt(this,t),n.Element=Pe,n.inited=!1,n.context={};var i=e.container,a=e.canvas,s=e.renderer,o=e.width,l=e.height,u=e.background,c=e.cursor,h=e.supportsMutipleCanvasesInOneContainer,d=e.cleanUpOnDestroy,g=d===void 0?!0:d,p=e.offscreenCanvas,v=e.devicePixelRatio,m=e.requestAnimationFrame,b=e.cancelAnimationFrame,w=e.createImage,x=e.supportsTouchEvents,_=e.supportsPointerEvents,S=e.isTouchEvent,M=e.isMouseEvent,k=e.dblClickSpeed,T=o,P=l,O=v||Ix&&window.devicePixelRatio||1;return O=O>=1?Math.ceil(O):1,a&&(T=o||RH(a)||a.width/O,P=l||LH(a)||a.height/O),n.customElements=new QU,n.devicePixelRatio=O,n.requestAnimationFrame=m??Dx.bind(st.globalThis),n.cancelAnimationFrame=b??IL.bind(st.globalThis),n.supportsTouchEvents=x??"ontouchstart"in st.globalThis,n.supportsPointerEvents=_??!!st.globalThis.PointerEvent,n.isTouchEvent=S??function(A){return n.supportsTouchEvents&&A instanceof st.globalThis.TouchEvent},n.isMouseEvent=M??function(A){return!st.globalThis.MouseEvent||A instanceof st.globalThis.MouseEvent&&(!n.supportsPointerEvents||!(A instanceof st.globalThis.PointerEvent))},p&&(st.offscreenCanvas=p),n.document=new $L,n.document.defaultView=n,h||CH(i,n,g),n.initRenderingContext(Ft(Ft({},e),{},{width:T,height:P,background:u??"transparent",cursor:c??"default",cleanUpOnDestroy:g,devicePixelRatio:O,requestAnimationFrame:n.requestAnimationFrame,cancelAnimationFrame:n.cancelAnimationFrame,supportsTouchEvents:n.supportsTouchEvents,supportsPointerEvents:n.supportsPointerEvents,isTouchEvent:n.isTouchEvent,isMouseEvent:n.isMouseEvent,dblClickSpeed:k??200,createImage:w??function(){return new window.Image}})),n.initDefaultCamera(T,P,s.clipSpaceNearZ),n.initRenderer(s,!0),n}return jt(t,r),it(t,[{key:"initRenderingContext",value:function(n){this.context.config=n,this.context.renderingContext={root:this.document.documentElement,renderListCurrentFrame:[],unculledEntities:[],renderReasons:new Set,force:!1,dirty:!1}}},{key:"initDefaultCamera",value:function(n,i,a){var s=this,o=new st.CameraContribution;o.clipSpaceNearZ=a,o.setType(ge.EXPLORING,yw.DEFAULT).setPosition(n/2,i/2,_M).setFocalPoint(n/2,i/2,0).setOrthographic(n/-2,n/2,i/2,i/-2,nY,rY),o.canvas=this,o.eventEmitter.on(cL.UPDATED,function(){s.context.renderingContext.renderReasons.add(Bl.CAMERA_CHANGED),st.enableSizeAttenuation&&s.getConfig().renderer.getConfig().enableSizeAttenuation&&s.updateSizeAttenuation()}),this.context.camera=o}},{key:"updateSizeAttenuation",value:function(){var n=this.getCamera().getZoom();this.document.documentElement.forEach(function(i){st.styleValueRegistry.updateSizeAttenuation(i,n)})}},{key:"getConfig",value:function(){return this.context.config}},{key:"getRoot",value:function(){return this.document.documentElement}},{key:"getCamera",value:function(){return this.context.camera}},{key:"getContextService",value:function(){return this.context.contextService}},{key:"getEventService",value:function(){return this.context.eventService}},{key:"getRenderingService",value:function(){return this.context.renderingService}},{key:"getRenderingContext",value:function(){return this.context.renderingContext}},{key:"getStats",value:function(){return this.getRenderingService().getStats()}},{key:"ready",get:function(){var n=this;return this.readyPromise||(this.readyPromise=new Promise(function(i){n.resolveReadyPromise=function(){i(n)}}),this.inited&&this.resolveReadyPromise()),this.readyPromise}},{key:"destroy",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,i=arguments.length>1?arguments[1]:void 0;pn.clearCache(),i||this.dispatchEvent(new cn($r.BEFORE_DESTROY)),this.frameId&&this.cancelAnimationFrame(this.frameId);var a=this.getRoot();n&&(this.unmountChildren(a),this.document.destroy(),this.getEventService().destroy()),this.getRenderingService().destroy(),this.getContextService().destroy(),this.context.rBushRoot&&this.context.rBushRoot.clear(),i||this.dispatchEvent(new cn($r.AFTER_DESTROY));var s=function(l){l.currentTarget=null,l.manager=null,l.target=null,l.relatedNode=null};s(Qh),s(td),s(Cv),s(SM),s(Av),s(Xi),s(Ow),s(Cw),s(zL)}},{key:"changeSize",value:function(n,i){this.resize(n,i)}},{key:"resize",value:function(n,i){var a=this.context.config;a.width=n,a.height=i,this.getContextService().resize(n,i);var s=this.context.camera,o=s.getProjectionMode();s.setPosition(n/2,i/2,_M).setFocalPoint(n/2,i/2,0),o===ci.ORTHOGRAPHIC?s.setOrthographic(n/-2,n/2,i/2,i/-2,s.getNear(),s.getFar()):s.setAspect(n/i),this.dispatchEvent(new cn($r.RESIZE,{width:n,height:i}))}},{key:"appendChild",value:function(n,i){return this.document.documentElement.appendChild(n,i)}},{key:"insertBefore",value:function(n,i){return this.document.documentElement.insertBefore(n,i)}},{key:"removeChild",value:function(n){return this.document.documentElement.removeChild(n)}},{key:"removeChildren",value:function(){this.document.documentElement.removeChildren()}},{key:"destroyChildren",value:function(){this.document.documentElement.destroyChildren()}},{key:"render",value:function(n){var i=this;n&&(Cv.detail=n,Av.detail=n),this.dispatchEvent(Cv);var a=this.getRenderingService();a.render(this.getConfig(),n,function(){i.dispatchEvent(SM)}),this.dispatchEvent(Av)}},{key:"run",value:function(){var n=this,i=function(s,o){n.render(o),n.frameId=n.requestAnimationFrame(i)};i()}},{key:"initRenderer",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!n)throw new Error("Renderer is required.");this.inited=!1,this.readyPromise=void 0,this.context.rBushRoot=new PG,this.context.renderingPlugins=[],this.context.renderingPlugins.push(new qL,new WL,new jL([new eY])),this.loadRendererContainerModule(n),this.context.contextService=new this.context.ContextService(Ft(Ft({},st),this.context)),this.context.renderingService=new pU(st,this.context),this.context.eventService=new gU(st,this.context),this.context.eventService.init(),this.context.contextService.init?(this.context.contextService.init(),this.initRenderingService(n,a,!0)):this.context.contextService.initAsync().then(function(){i.initRenderingService(n,a)}).catch(function(s){console.error(s)})}},{key:"initRenderingService",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.context.renderingService.init(function(){i.inited=!0,a?s?i.requestAnimationFrame(function(){i.dispatchEvent(new cn($r.READY))}):i.dispatchEvent(new cn($r.READY)):i.dispatchEvent(new cn($r.RENDERER_CHANGED)),i.readyPromise&&i.resolveReadyPromise(),a||i.getRoot().forEach(function(o){var l=o,u=l.renderable;u&&(u.renderBoundsDirty=!0,u.boundsDirty=!0,u.dirty=!0)}),i.mountChildren(i.getRoot()),n.getConfig().enableAutoRendering&&i.run()})}},{key:"loadRendererContainerModule",value:function(n){var i=this,a=n.getPlugins();a.forEach(function(s){s.context=i.context,s.init(st)})}},{key:"setRenderer",value:function(n){var i=this.getConfig();if(i.renderer!==n){var a=i.renderer;i.renderer=n,this.destroy(!1,!0),Te((a==null?void 0:a.getPlugins())||[]).reverse().forEach(function(s){s.destroy(st)}),this.initRenderer(n)}}},{key:"setCursor",value:function(n){var i=this.getConfig();i.cursor=n,this.getContextService().applyCursorStyle(n)}},{key:"unmountChildren",value:function(n){var i=this;n.childNodes.forEach(function(a){i.unmountChildren(a)}),this.inited&&(n.isMutationObserved?n.dispatchEvent(td):(td.target=n,this.dispatchEvent(td,!0)),n!==this.document.documentElement&&(n.ownerDocument=null),n.isConnected=!1),n.isCustomElement&&n.disconnectedCallback&&n.disconnectedCallback()}},{key:"mountChildren",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kf(n);this.inited?n.isConnected||(n.ownerDocument=this.document,n.isConnected=!0,a||(n.isMutationObserved?n.dispatchEvent(Qh):(Qh.target=n,this.dispatchEvent(Qh,!0)))):console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.","appended child: ",n.nodeName),n.childNodes.forEach(function(s){i.mountChildren(s,a)}),n.isCustomElement&&n.connectedCallback&&n.connectedCallback()}},{key:"mountFragment",value:function(n){this.mountChildren(n,!1)}},{key:"client2Viewport",value:function(n){return this.getEventService().client2Viewport(n)}},{key:"viewport2Client",value:function(n){return this.getEventService().viewport2Client(n)}},{key:"viewport2Canvas",value:function(n){return this.getEventService().viewport2Canvas(n)}},{key:"canvas2Viewport",value:function(n){return this.getEventService().canvas2Viewport(n)}},{key:"getPointByClient",value:function(n,i){return this.client2Viewport({x:n,y:i})}},{key:"getClientByPoint",value:function(n,i){return this.viewport2Client({x:n,y:i})}}])}(BL);/*!
- * @antv/g-camera-api
- * @description A simple implementation of Camera API.
- * @version 2.0.35
- * @date 1/23/2025, 8:32:08 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var iY=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.landmarks=[],e}return jt(t,r),it(t,[{key:"rotate",value:function(n,i,a){if(this.relElevation=Il(i),this.relAzimuth=Il(n),this.relRoll=Il(a),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.type===ge.EXPLORING){var s=Es(wn(),[1,0,0],me((this.rotateWorld?1:-1)*this.relElevation)),o=Es(wn(),[0,1,0],me((this.rotateWorld?1:-1)*this.relAzimuth)),l=Es(wn(),[0,0,1],me(this.relRoll)),u=Ps(wn(),o,s);u=Ps(wn(),u,l);var c=kx(Se(),u);Ll(this.matrix,this.matrix,[0,0,-this.distance]),Jn(this.matrix,this.matrix,c),Ll(this.matrix,this.matrix,[0,0,this.distance])}else{if(Math.abs(this.elevation)>90)return this;this.computeMatrix()}return this._getAxes(),this.type===ge.ORBITING||this.type===ge.EXPLORING?this._getPosition():this.type===ge.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(n,i){var a=ar(n,i,0),s=Ea(this.position);return As(s,s,ff(Qt(),this.right,a[0])),As(s,s,ff(Qt(),this.up,a[1])),this._setPosition(s),this.triggerUpdate(),this}},{key:"dolly",value:function(n){var i=this.forward,a=Ea(this.position),s=n*this.dollyingStep,o=this.distance+n*this.dollyingStep;return s=Math.max(Math.min(o,this.maxDistance),this.minDistance)-this.distance,a[0]+=s*i[0],a[1]+=s*i[1],a[2]+=s*i[2],this._setPosition(a),this.type===ge.ORBITING||this.type===ge.EXPLORING?this._getDistance():this.type===ge.TRACKING&&As(this.focalPoint,a,this.distanceVector),this.triggerUpdate(),this}},{key:"cancelLandmarkAnimation",value:function(){this.landmarkAnimationID!==void 0&&this.canvas.cancelAnimationFrame(this.landmarkAnimationID)}},{key:"createLandmark",value:function(n){var i,a,s,o,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=l.position,c=u===void 0?this.position:u,h=l.focalPoint,d=h===void 0?this.focalPoint:h,g=l.roll,p=l.zoom,v=new st.CameraContribution;v.setType(this.type,void 0),v.setPosition(c[0],(i=c[1])!==null&&i!==void 0?i:this.position[1],(a=c[2])!==null&&a!==void 0?a:this.position[2]),v.setFocalPoint(d[0],(s=d[1])!==null&&s!==void 0?s:this.focalPoint[1],(o=d[2])!==null&&o!==void 0?o:this.focalPoint[2]),v.setRoll(g??this.roll),v.setZoom(p??this.zoom);var m={name:n,matrix:TR(v.getWorldTransform()),right:Ea(v.right),up:Ea(v.up),forward:Ea(v.forward),position:Ea(v.getPosition()),focalPoint:Ea(v.getFocalPoint()),distanceVector:Ea(v.getDistanceVector()),distance:v.getDistance(),dollyingStep:v.getDollyingStep(),azimuth:v.getAzimuth(),elevation:v.getElevation(),roll:v.getRoll(),relAzimuth:v.relAzimuth,relElevation:v.relElevation,relRoll:v.relRoll,zoom:v.getZoom()};return this.landmarks.push(m),m}},{key:"gotoLandmark",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=oe(n)?this.landmarks.find(function(A){return A.name===n}):n;if(s){var o=yt(a)?{duration:a}:a,l=o.easing,u=l===void 0?"linear":l,c=o.duration,h=c===void 0?100:c,d=o.easingFunction,g=d===void 0?void 0:d,p=o.onfinish,v=p===void 0?void 0:p,m=o.onframe,b=m===void 0?void 0:m,w=.01;this.cancelLandmarkAnimation();var x=s.position,_=s.focalPoint,S=s.zoom,M=s.roll,k=g||st.EasingFunction(u),T,P=function(){i.setFocalPoint(_),i.setPosition(x),i.setRoll(M),i.setZoom(S),i.computeMatrix(),i.triggerUpdate(),v==null||v()};if(h===0)return P();var O=function(R){T===void 0&&(T=R);var L=R-T;if(L>=h){P();return}var q=k(L/h),j=Qt(),$=Qt(),B=1,F=0;ow(j,i.focalPoint,_,q),ow($,i.position,x,q),F=i.roll*(1-q)+M*q,B=i.zoom*(1-q)+S*q,i.setFocalPoint(j),i.setPosition($),i.setRoll(F),i.setZoom(B);var V=L3(j,_)+L3($,x);if(V<=w&&S===void 0&&M===void 0)return P();i.computeMatrix(),i.triggerUpdate(),L<h&&(b==null||b(q),i.landmarkAnimationID=i.canvas.requestAnimationFrame(O))};this.canvas.requestAnimationFrame(O)}}}])}(hL);st.CameraContribution=iY;/*!
- * @antv/g-web-animations-api
- * @description A simple implementation of Web Animations API.
- * @version 2.1.21
- * @date 1/23/2025, 8:33:55 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var Pv=function(r){function t(e,n,i,a){var s;return at(this,t),s=qt(this,t,[e]),s.currentTime=i,s.timelineTime=a,s.target=n,s.type="finish",s.bubbles=!1,s.currentTarget=n,s.defaultPrevented=!1,s.eventPhase=s.AT_TARGET,s.timeStamp=Date.now(),s.currentTime=i,s.timelineTime=a,s}return jt(t,r),it(t)}(sg),aY=0,sY=function(){function r(t,e){var n;at(this,r),this.currentTimePending=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._playbackRate=1,this._inTimeline=!0,this.effect=t,t.animation=this,this.timeline=e,this.id="".concat(aY++),this._inEffect=!!this.effect.update(0),this._totalDuration=Number((n=this.effect)===null||n===void 0?void 0:n.getComputedTiming().endTime),this._holdTime=0,this._paused=!1,this.oldPlayState="idle",this.updatePromises()}return it(r,[{key:"pending",get:function(){return this._startTime===null&&!this._paused&&this.playbackRate!==0||this.currentTimePending}},{key:"playState",get:function(){return this._idle?"idle":this._isFinished?"finished":this._paused?"paused":"running"}},{key:"ready",get:function(){var e=this;return this.readyPromise||(this.timeline.animationsWithPromises.indexOf(this)===-1&&this.timeline.animationsWithPromises.push(this),this.readyPromise=new Promise(function(n,i){e.resolveReadyPromise=function(){n(e)},e.rejectReadyPromise=function(){i(new Error)}}),this.pending||this.resolveReadyPromise()),this.readyPromise}},{key:"finished",get:function(){var e=this;return this.finishedPromise||(this.timeline.animationsWithPromises.indexOf(this)===-1&&this.timeline.animationsWithPromises.push(this),this.finishedPromise=new Promise(function(n,i){e.resolveFinishedPromise=function(){n(e)},e.rejectFinishedPromise=function(){i(new Error)}}),this.playState==="finished"&&this.resolveFinishedPromise()),this.finishedPromise}},{key:"currentTime",get:function(){return this.updatePromises(),this._idle||this.currentTimePending?null:this._currentTime},set:function(e){if(e=Number(e),!isNaN(e)){if(this.timeline.restart(),!this._paused&&this._startTime!==null){var n;this._startTime=Number((n=this.timeline)===null||n===void 0?void 0:n.currentTime)-e/this.playbackRate}this.currentTimePending=!1,this._currentTime!==e&&(this._idle&&(this._idle=!1,this._paused=!0),this.tickCurrentTime(e,!0),this.timeline.applyDirtiedAnimation(this))}}},{key:"startTime",get:function(){return this._startTime},set:function(e){if(e!==null){if(this.updatePromises(),e=Number(e),isNaN(e)||this._paused||this._idle)return;this._startTime=e,this.tickCurrentTime((Number(this.timeline.currentTime)-this._startTime)*this.playbackRate),this.timeline.applyDirtiedAnimation(this),this.updatePromises()}}},{key:"playbackRate",get:function(){return this._playbackRate},set:function(e){if(e!==this._playbackRate){this.updatePromises();var n=this.currentTime;this._playbackRate=e,this.startTime=null,this.playState!=="paused"&&this.playState!=="idle"&&(this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this)),n!==null&&(this.currentTime=n),this.updatePromises()}}},{key:"_isFinished",get:function(){return!this._idle&&(this._playbackRate>0&&Number(this._currentTime)>=this._totalDuration||this._playbackRate<0&&Number(this._currentTime)<=0)}},{key:"totalDuration",get:function(){return this._totalDuration}},{key:"_needsTick",get:function(){return this.pending||this.playState==="running"||!this._finishedFlag}},{key:"updatePromises",value:function(){var e=this.oldPlayState,n=this.pending?"pending":this.playState;return this.readyPromise&&n!==e&&(n==="idle"?(this.rejectReadyPromise(),this.readyPromise=void 0):e==="pending"?this.resolveReadyPromise():n==="pending"&&(this.readyPromise=void 0)),this.finishedPromise&&n!==e&&(n==="idle"?(this.rejectFinishedPromise(),this.finishedPromise=void 0):n==="finished"?this.resolveFinishedPromise():e==="finished"&&(this.finishedPromise=void 0)),this.oldPlayState=n,this.readyPromise||this.finishedPromise}},{key:"play",value:function(){this.updatePromises(),this._paused=!1,(this._isFinished||this._idle)&&(this.rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this),this.timeline.animations.indexOf(this)===-1&&this.timeline.animations.push(this),this.updatePromises()}},{key:"pause",value:function(){this.updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),!this._isFinished&&!this._paused&&!this._idle?this.currentTimePending=!0:this._idle&&(this.rewind(),this._idle=!1),this._startTime=null,this._paused=!0,this.updatePromises()}},{key:"finish",value:function(){this.updatePromises(),!this._idle&&(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this.currentTimePending=!1,this.timeline.applyDirtiedAnimation(this),this.updatePromises())}},{key:"cancel",value:function(){var e=this;if(this.updatePromises(),!!this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises(),this.oncancel)){var n=new Pv(null,this,this.currentTime,null);setTimeout(function(){e.oncancel(n)})}}},{key:"reverse",value:function(){this.updatePromises();var e=this.currentTime;this.playbackRate*=-1,this.play(),e!==null&&(this.currentTime=e),this.updatePromises()}},{key:"updatePlaybackRate",value:function(e){this.playbackRate=e}},{key:"targetAnimations",value:function(){var e,n=(e=this.effect)===null||e===void 0?void 0:e.target;return n.getAnimations()}},{key:"markTarget",value:function(){var e=this.targetAnimations();e.indexOf(this)===-1&&e.push(this)}},{key:"unmarkTarget",value:function(){var e=this.targetAnimations(),n=e.indexOf(this);n!==-1&&e.splice(n,1)}},{key:"tick",value:function(e,n){!this._idle&&!this._paused&&(this._startTime===null?n&&(this.startTime=e-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((e-this._startTime)*this.playbackRate)),n&&(this.currentTimePending=!1,this.fireEvents(e))}},{key:"rewind",value:function(){if(this.playbackRate>=0)this.currentTime=0;else if(this._totalDuration<1/0)this.currentTime=this._totalDuration;else throw new Error("Unable to rewind negative playback rate animation with infinite duration")}},{key:"persist",value:function(){throw new Error(pe)}},{key:"addEventListener",value:function(e,n,i){throw new Error(pe)}},{key:"removeEventListener",value:function(e,n,i){throw new Error(pe)}},{key:"dispatchEvent",value:function(e){throw new Error(pe)}},{key:"commitStyles",value:function(){throw new Error(pe)}},{key:"ensureAlive",value:function(){if(this.playbackRate<0&&this.currentTime===0){var e;this._inEffect=!!((e=this.effect)!==null&&e!==void 0&&e.update(-1))}else{var n;this._inEffect=!!((n=this.effect)!==null&&n!==void 0&&n.update(this.currentTime))}!this._inTimeline&&(this._inEffect||!this._finishedFlag)&&(this._inTimeline=!0,this.timeline.animations.push(this))}},{key:"tickCurrentTime",value:function(e,n){e!==this._currentTime&&(this._currentTime=e,this._isFinished&&!n&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this.ensureAlive())}},{key:"fireEvents",value:function(e){var n=this;if(this._isFinished){if(!this._finishedFlag){if(this.onfinish){var i=new Pv(null,this,this.currentTime,e);setTimeout(function(){n.onfinish&&n.onfinish(i)})}this._finishedFlag=!0}}else{if(this.onframe&&this.playState==="running"){var a=new Pv(null,this,this.currentTime,e);this.onframe(a)}this._finishedFlag=!1}}}])}(),oY=4,lY=.001,uY=1e-7,cY=10,Fu=11,ed=1/(Fu-1),hY=typeof Float32Array=="function",GL=function(t,e){return 1-3*e+3*t},VL=function(t,e){return 3*e-6*t},HL=function(t){return 3*t},Of=function(t,e,n){return((GL(e,n)*t+VL(e,n))*t+HL(e))*t},UL=function(t,e,n){return 3*GL(e,n)*t*t+2*VL(e,n)*t+HL(e)},dY=function(t,e,n,i,a){var s,o,l=0;do o=e+(n-e)/2,s=Of(o,i,a)-t,s>0?n=o:e=o;while(Math.abs(s)>uY&&++l<cY);return o},fY=function(t,e,n,i){for(var a=0;a<oY;++a){var s=UL(e,n,i);if(s===0)return e;var o=Of(e,n,i)-t;e-=o/s}return e},zx=function(t,e,n,i){if(!(t>=0&&t<=1&&n>=0&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&n===i)return function(l){return l};for(var a=hY?new Float32Array(Fu):new Array(Fu),s=0;s<Fu;++s)a[s]=Of(s*ed,t,n);var o=function(u){for(var c=0,h=1,d=Fu-1;h!==d&&a[h]<=u;++h)c+=ed;--h;var g=(u-a[h])/(a[h+1]-a[h]),p=c+g*ed,v=UL(p,t,n);return v>=lY?fY(u,p,t,n):v===0?p:dY(u,c,c+ed,t,n)};return function(l){return l===0||l===1?l:Of(o(l),e,i)}},gY=function(t){return t=t.replace(/([A-Z])/g,function(e){return"-".concat(e.toLowerCase())}),t.charAt(0)==="-"?t.substring(1):t},nd=function(t){return Math.pow(t,2)},rd=function(t){return Math.pow(t,3)},id=function(t){return Math.pow(t,4)},ad=function(t){return Math.pow(t,5)},sd=function(t){return Math.pow(t,6)},od=function(t){return 1-Math.cos(t*Math.PI/2)},ld=function(t){return 1-Math.sqrt(1-t*t)},ud=function(t){return t*t*(3*t-2)},cd=function(t){for(var e,n=4;t<((e=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((e*3-2)/22-t,2)},hd=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=Rt(e,2),i=n[0],a=i===void 0?1:i,s=n[1],o=s===void 0?.5:s,l=He(Number(a),1,10),u=He(Number(o),.1,2);return t===0||t===1?t:-l*Math.pow(2,10*(t-1))*Math.sin((t-1-u/(Math.PI*2)*Math.asin(1/l))*(Math.PI*2)/u)},Tu=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,i=Rt(e,4),a=i[0],s=a===void 0?1:a,o=i[1],l=o===void 0?100:o,u=i[2],c=u===void 0?10:u,h=i[3],d=h===void 0?0:h;s=He(s,.1,1e3),l=He(l,.1,1e3),c=He(c,.1,1e3),d=He(d,.1,1e3);var g=Math.sqrt(l/s),p=c/(2*Math.sqrt(l*s)),v=p<1?g*Math.sqrt(1-p*p):0,m=1,b=p<1?(p*g+-d)/v:-d+g,w=n?n*t/1e3:t;return p<1?w=Math.exp(-w*p*g)*(m*Math.cos(v*w)+b*Math.sin(v*w)):w=(m+b*w)*Math.exp(-w*g),t===0||t===1?t:1-w},Nv=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=e,i=Rt(n,2),a=i[0],s=a===void 0?10:a,o=i[1],l=o==="start"?Math.ceil:Math.floor;return l(He(t,0,1)*s)/s},MM=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=Rt(e,4),i=n[0],a=n[1],s=n[2],o=n[3];return zx(i,a,s,o)(t)},dd=zx(.42,0,1,1),si=function(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return 1-t(1-e,n,i)}},oi=function(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return e<.5?t(e*2,n,i)/2:1-t(e*-2+2,n,i)/2}},li=function(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return e<.5?(1-t(1-e*2,n,i))/2:(t(e*2-1,n,i)+1)/2}},kM={steps:Nv,"step-start":function(t){return Nv(t,[1,"start"])},"step-end":function(t){return Nv(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":MM,ease:function(t){return MM(t,[.25,.1,.25,1])},in:dd,out:si(dd),"in-out":oi(dd),"out-in":li(dd),"in-quad":nd,"out-quad":si(nd),"in-out-quad":oi(nd),"out-in-quad":li(nd),"in-cubic":rd,"out-cubic":si(rd),"in-out-cubic":oi(rd),"out-in-cubic":li(rd),"in-quart":id,"out-quart":si(id),"in-out-quart":oi(id),"out-in-quart":li(id),"in-quint":ad,"out-quint":si(ad),"in-out-quint":oi(ad),"out-in-quint":li(ad),"in-expo":sd,"out-expo":si(sd),"in-out-expo":oi(sd),"out-in-expo":li(sd),"in-sine":od,"out-sine":si(od),"in-out-sine":oi(od),"out-in-sine":li(od),"in-circ":ld,"out-circ":si(ld),"in-out-circ":oi(ld),"out-in-circ":li(ld),"in-back":ud,"out-back":si(ud),"in-out-back":oi(ud),"out-in-back":li(ud),"in-bounce":cd,"out-bounce":si(cd),"in-out-bounce":oi(cd),"out-in-bounce":li(cd),"in-elastic":hd,"out-elastic":si(hd),"in-out-elastic":oi(hd),"out-in-elastic":li(hd),spring:Tu,"spring-in":Tu,"spring-out":si(Tu),"spring-in-out":oi(Tu),"spring-out-in":li(Tu)},pY=function(t){return gY(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()},vY=function(t){return kM[pY(t)]||kM.linear},mY=function(t){return t},yY=1,bY=.5,TM=0;function OM(r,t){return function(e){if(e>=1)return 1;var n=1/r;return e+=t*n,e-e%n}}var fd="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",wY=new RegExp("cubic-bezier\\(".concat(fd,",").concat(fd,",").concat(fd,",").concat(fd,"\\)")),xY=/steps\(\s*(\d+)\s*\)/,EY=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function $x(r){var t=wY.exec(r);if(t)return zx.apply(void 0,Te(t.slice(1).map(Number)));var e=xY.exec(r);if(e)return OM(Number(e[1]),TM);var n=EY.exec(r);return n?OM(Number(n[1]),{start:yY,middle:bY,end:TM}[n[2]]):vY(r)}function _Y(r){return Math.abs(SY(r)/(r.playbackRate||1))}function SY(r){var t;return r.duration===0||r.iterations===0?0:(r.duration==="auto"?0:Number(r.duration))*((t=r.iterations)!==null&&t!==void 0?t:1)}var YL=0,jx=1,lg=2,XL=3;function MY(r,t,e){if(t===null)return YL;var n=e.endTime;return t<Math.min(e.delay,n)?jx:t>=Math.min(e.delay+r+e.endDelay,n)?lg:XL}function kY(r,t,e,n,i){switch(n){case jx:return t==="backwards"||t==="both"?0:null;case XL:return e-i;case lg:return t==="forwards"||t==="both"?r:null;case YL:return null}}function TY(r,t,e,n,i){var a=i;return r===0?t!==jx&&(a+=e):a+=n/r,a}function OY(r,t,e,n,i,a){var s=r===1/0?t%1:r%1;return s===0&&e===lg&&n!==0&&(i!==0||a===0)&&(s=1),s}function CY(r,t,e,n){return r===lg&&t===1/0?1/0:e===1?Math.floor(n)-1:Math.floor(n)}function AY(r,t,e){var n=r;if(r!=="normal"&&r!=="reverse"){var i=t;r==="alternate-reverse"&&(i+=1),n="normal",i!==1/0&&i%2!==0&&(n="reverse")}return n==="normal"?e:1-e}function PY(r,t,e){var n=MY(r,t,e),i=kY(r,e.fill,t,n,e.delay);if(i===null)return null;var a=e.duration==="auto"?0:e.duration,s=TY(a,n,e.iterations,i,e.iterationStart),o=OY(s,e.iterationStart,n,e.iterations,i,a),l=CY(n,e.iterations,o,s),u=AY(e.direction,l,o);return e.currentIteration=l,e.progress=u,e.easingFunction(u)}function NY(r,t,e){var n=RY(r,t),i=LY(n,e);return function(a,s){if(s!==null)i.filter(function(l){return s>=l.applyFrom&&s<l.applyTo}).forEach(function(l){var u=s-l.startOffset,c=l.endOffset-l.startOffset,h=c===0?0:u/c;a.setAttribute(l.property,l.interpolation(h),!1,!1)});else for(var o in n)KL(o)&&a.setAttribute(o,null)}}function KL(r){return r!=="offset"&&r!=="easing"&&r!=="composite"&&r!=="computedOffset"}function RY(r,t){for(var e={},n=0;n<r.length;n++)for(var i in r[n])if(KL(i)){var a={offset:r[n].offset,computedOffset:r[n].computedOffset,easing:r[n].easing,easingFunction:$x(r[n].easing)||t.easingFunction,value:r[n][i]};e[i]=e[i]||[],e[i].push(a)}return e}function LY(r,t){var e=[];for(var n in r)for(var i=r[n],a=0;a<i.length-1;a++){var s=a,o=a+1,l=i[s].computedOffset,u=i[o].computedOffset,c=l,h=u;a===0&&(c=-1/0,u===0&&(o=s)),a===i.length-2&&(h=1/0,l===1&&(s=o)),e.push({applyFrom:c,applyTo:h,startOffset:i[s].computedOffset,endOffset:i[o].computedOffset,easingFunction:i[s].easingFunction,property:n,interpolation:IY(n,i[s].value,i[o].value,t)})}return e.sort(function(d,g){return d.startOffset-g.startOffset}),e}var CM=function(t,e,n){return function(i){var a=ZL(t,e,i);return yt(a)?a:n(a)}};function IY(r,t,e,n){var i=OL[r];if(i&&i.syntax&&i.int){var a=st.styleValueRegistry.getPropertySyntax(i.syntax);if(a){var s=a.parser,o=s?s(t,n):t,l=s?s(e,n):e,u=a.mixer(o,l,n);if(u){var c=CM.apply(void 0,Te(u));return function(h){return h===0?t:h===1?e:c(h)}}}}return CM(!1,!0,function(h){return h?e:t})}function ZL(r,t,e){if(typeof r=="number"&&typeof t=="number")return r*(1-e)+t*e;if(typeof r=="boolean"&&typeof t=="boolean"||typeof r=="string"&&typeof t=="string")return e<.5?r:t;if(Array.isArray(r)&&Array.isArray(t)){for(var n=r.length,i=t.length,a=Math.max(n,i),s=[],o=0;o<a;o++)s.push(ZL(r[o<n?o:n-1],t[o<i?o:i-1],e));return s}throw new Error("Mismatched interpolation arguments ".concat(r,":").concat(t))}var DY=function(){function r(){at(this,r),this.delay=0,this.direction="normal",this.duration="auto",this._easing="linear",this.easingFunction=mY,this.endDelay=0,this.fill="auto",this.iterationStart=0,this.iterations=1,this.currentIteration=null,this.progress=null}return it(r,[{key:"easing",get:function(){return this._easing},set:function(e){this.easingFunction=$x(e),this._easing=e}}])}();function FY(r){var t=[];for(var e in r)if(!(e in["easing","offset","composite"])){var n=r[e];Array.isArray(n)||(n=[n]);for(var i=n.length,a=0;a<i;a++){if(!t[a]){var s={};"offset"in r&&(s.offset=Number(r.offset)),"easing"in r&&(s.easing=r.easing),"composite"in r&&(s.composite=r.composite),t[a]=s}n[a]!==void 0&&n[a]!==null&&(t[a][e]=n[a])}}return t.sort(function(o,l){return(o.computedOffset||0)-(l.computedOffset||0)}),t}function AM(r,t){if(r===null)return[];Array.isArray(r)||(r=FY(r));for(var e=r.map(function(l){var u={};t!=null&&t.composite&&(u.composite="auto");for(var c in l){var h=l[c];if(c==="offset"){if(h!==null){if(h=Number(h),!isFinite(h))throw new Error("Keyframe offsets must be numbers.");if(h<0||h>1)throw new Error("Keyframe offsets must be between 0 and 1.");u.computedOffset=h}}else if(c==="composite"&&["replace","add","accumulate","auto"].indexOf(h)===-1)throw new Error("".concat(h," compositing is not supported"));u[c]=h}return u.offset===void 0&&(u.offset=null),u.easing===void 0&&(u.easing=(t==null?void 0:t.easing)||"linear"),u.composite===void 0&&(u.composite="auto"),u}),n=!0,i=-1/0,a=0;a<e.length;a++){var s=e[a].offset;if(kt(s))n=!1;else{if(s<i)throw new TypeError("Keyframes are not loosely sorted by offset. Sort or specify offsets.");i=s}}e=e.filter(function(l){return Number(l.offset)>=0&&Number(l.offset)<=1});function o(){var l,u=e,c=u.length;if(e[c-1].computedOffset=Number((l=e[c-1].offset)!==null&&l!==void 0?l:1),c>1){var h;e[0].computedOffset=Number((h=e[0].offset)!==null&&h!==void 0?h:0)}for(var d=0,g=Number(e[0].computedOffset),p=1;p<c;p++){var v=e[p].computedOffset;if(!kt(v)&&!kt(g)){for(var m=1;m<p-d;m++)e[d+m].computedOffset=g+(Number(v)-g)*m/(p-d);d=p,g=Number(v)}}}return n||o(),e}var BY="backwards|forwards|both|none".split("|"),zY="reverse|alternate|alternate-reverse".split("|");function $Y(r,t){var e=new DY;return typeof r=="number"&&!isNaN(r)?e.duration=r:r!==void 0&&Object.keys(r).forEach(function(n){if(r[n]!==void 0&&r[n]!==null&&r[n]!=="auto"){if((typeof e[n]=="number"||n==="duration")&&(typeof r[n]!="number"||isNaN(r[n]))||n==="fill"&&BY.indexOf(r[n])===-1||n==="direction"&&zY.indexOf(r[n])===-1)return;e[n]=r[n]}}),e}function jY(r,t){return r=qY(r??{duration:"auto"}),$Y(r)}function qY(r){return typeof r=="number"&&(isNaN(r)?r={duration:"auto"}:r={duration:r}),r}var WY=function(){function r(t,e,n){var i=this;at(this,r),this.composite="replace",this.iterationComposite="replace",this.target=t,this.timing=jY(n),this.timing.effect=this,this.timing.activeDuration=_Y(this.timing),this.timing.endTime=Math.max(0,this.timing.delay+this.timing.activeDuration+this.timing.endDelay),this.normalizedKeyframes=AM(e,this.timing),this.interpolations=NY(this.normalizedKeyframes,this.timing,this.target);var a=st.globalThis.Proxy;this.computedTiming=a?new a(this.timing,{get:function(o,l){return l==="duration"?o.duration==="auto"?0:o.duration:l==="fill"?o.fill==="auto"?"none":o.fill:l==="localTime"?i.animation&&i.animation.currentTime||null:l==="currentIteration"?!i.animation||i.animation.playState!=="running"?null:o.currentIteration||0:l==="progress"?!i.animation||i.animation.playState!=="running"?null:o.progress||0:o[l]},set:function(){return!0}}):this.timing}return it(r,[{key:"applyInterpolations",value:function(){this.interpolations(this.target,Number(this.timeFraction))}},{key:"update",value:function(e){return e===null?!1:(this.timeFraction=PY(this.timing.activeDuration,e,this.timing),this.timeFraction!==null)}},{key:"getKeyframes",value:function(){return this.normalizedKeyframes}},{key:"setKeyframes",value:function(e){this.normalizedKeyframes=AM(e)}},{key:"getComputedTiming",value:function(){return this.computedTiming}},{key:"getTiming",value:function(){return this.timing}},{key:"updateTiming",value:function(e){var n=this;Object.keys(e||{}).forEach(function(i){n.timing[i]=e[i]})}}])}();function PM(r,t){return Number(r.id)-Number(t.id)}var GY=function(){function r(t){var e=this;at(this,r),this.animations=[],this.ticking=!1,this.timelineTicking=!1,this.hasRestartedThisFrame=!1,this.animationsWithPromises=[],this.inTick=!1,this.pendingEffects=[],this.currentTime=null,this.rafId=0,this.rafCallbacks=[],this.webAnimationsNextTick=function(n){e.currentTime=n,e.discardAnimations(),e.animations.length===0?e.timelineTicking=!1:e.requestAnimationFrame(e.webAnimationsNextTick)},this.processRafCallbacks=function(n){var i=e.rafCallbacks;e.rafCallbacks=[],n<Number(e.currentTime)&&(n=Number(e.currentTime)),e.animations.sort(PM),e.animations=e.tick(n,!0,e.animations)[0],i.forEach(function(a){a[1](n)}),e.applyPendingEffects()},this.document=t}return it(r,[{key:"getAnimations",value:function(){return this.discardAnimations(),this.animations.slice()}},{key:"isTicking",value:function(){return this.inTick}},{key:"play",value:function(e,n,i){var a=new WY(e,n,i),s=new sY(a,this);return this.animations.push(s),this.restartWebAnimationsNextTick(),s.updatePromises(),s.play(),s.updatePromises(),s}},{key:"applyDirtiedAnimation",value:function(e){var n=this;if(!this.inTick){e.markTarget();var i=e.targetAnimations();i.sort(PM);var a=this.tick(Number(this.currentTime),!1,i.slice())[1];a.forEach(function(s){var o=n.animations.indexOf(s);o!==-1&&n.animations.splice(o,1)}),this.applyPendingEffects()}}},{key:"restart",value:function(){return this.ticking||(this.ticking=!0,this.requestAnimationFrame(function(){}),this.hasRestartedThisFrame=!0),this.hasRestartedThisFrame}},{key:"destroy",value:function(){this.document.defaultView.cancelAnimationFrame(this.frameId)}},{key:"applyPendingEffects",value:function(){this.pendingEffects.forEach(function(e){e==null||e.applyInterpolations()}),this.pendingEffects=[]}},{key:"updateAnimationsPromises",value:function(){this.animationsWithPromises=this.animationsWithPromises.filter(function(e){return e.updatePromises()})}},{key:"discardAnimations",value:function(){this.updateAnimationsPromises(),this.animations=this.animations.filter(function(e){return e.playState!=="finished"&&e.playState!=="idle"})}},{key:"restartWebAnimationsNextTick",value:function(){this.timelineTicking||(this.timelineTicking=!0,this.requestAnimationFrame(this.webAnimationsNextTick))}},{key:"rAF",value:function(e){var n=this.rafId++;return this.rafCallbacks.length===0&&(this.frameId=this.document.defaultView.requestAnimationFrame(this.processRafCallbacks)),this.rafCallbacks.push([n,e]),n}},{key:"requestAnimationFrame",value:function(e){var n=this;return this.rAF(function(i){n.updateAnimationsPromises(),e(i),n.updateAnimationsPromises()})}},{key:"tick",value:function(e,n,i){var a=this,s,o;this.inTick=!0,this.hasRestartedThisFrame=!1,this.currentTime=e,this.ticking=!1;var l=[],u=[],c=[],h=[];return i.forEach(function(d){d.tick(e,n),d._inEffect?(u.push(d.effect),d.markTarget()):(l.push(d.effect),d.unmarkTarget()),d._needsTick&&(a.ticking=!0);var g=d._inEffect||d._needsTick;d._inTimeline=g,g?c.push(d):h.push(d)}),(s=this.pendingEffects).push.apply(s,l),(o=this.pendingEffects).push.apply(o,u),this.ticking&&this.requestAnimationFrame(function(){}),this.inTick=!1,[c,h]}}])}();st.EasingFunction=$x;st.AnimationTimeline=GY;const VY={duration:500},HY={duration:1e3,easing:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",iterations:1,fill:"both"};var Le;(function(r){r.NodeAdded="NodeAdded",r.NodeUpdated="NodeUpdated",r.NodeRemoved="NodeRemoved",r.EdgeAdded="EdgeAdded",r.EdgeUpdated="EdgeUpdated",r.EdgeRemoved="EdgeRemoved",r.ComboAdded="ComboAdded",r.ComboUpdated="ComboUpdated",r.ComboRemoved="ComboRemoved"})(Le||(Le={}));var br;(function(r){r.DRAW="draw",r.COLLAPSE="collapse",r.EXPAND="expand",r.TRANSFORM="transform"})(br||(br={}));var $a;(function(r){r.CLICK="canvas:click",r.DBLCLICK="canvas:dblclick",r.POINTER_OVER="canvas:pointerover",r.POINTER_LEAVE="canvas:pointerleave",r.POINTER_ENTER="canvas:pointerenter",r.POINTER_MOVE="canvas:pointermove",r.POINTER_OUT="canvas:pointerout",r.POINTER_DOWN="canvas:pointerdown",r.POINTER_UP="canvas:pointerup",r.CONTEXT_MENU="canvas:contextmenu",r.DRAG_START="canvas:dragstart",r.DRAG="canvas:drag",r.DRAG_END="canvas:dragend",r.DRAG_ENTER="canvas:dragenter",r.DRAG_OVER="canvas:dragover",r.DRAG_LEAVE="canvas:dragleave",r.DROP="canvas:drop",r.WHEEL="canvas:wheel"})($a||($a={}));var bo;(function(r){r.CLICK="combo:click",r.DBLCLICK="combo:dblclick",r.POINTER_OVER="combo:pointerover",r.POINTER_LEAVE="combo:pointerleave",r.POINTER_ENTER="combo:pointerenter",r.POINTER_MOVE="combo:pointermove",r.POINTER_OUT="combo:pointerout",r.POINTER_DOWN="combo:pointerdown",r.POINTER_UP="combo:pointerup",r.CONTEXT_MENU="combo:contextmenu",r.DRAG_START="combo:dragstart",r.DRAG="combo:drag",r.DRAG_END="combo:dragend",r.DRAG_ENTER="combo:dragenter",r.DRAG_OVER="combo:dragover",r.DRAG_LEAVE="combo:dragleave",r.DROP="combo:drop"})(bo||(bo={}));var J;(function(r){r.CLICK="click",r.DBLCLICK="dblclick",r.POINTER_OVER="pointerover",r.POINTER_LEAVE="pointerleave",r.POINTER_ENTER="pointerenter",r.POINTER_MOVE="pointermove",r.POINTER_OUT="pointerout",r.POINTER_DOWN="pointerdown",r.POINTER_UP="pointerup",r.CONTEXT_MENU="contextmenu",r.DRAG_START="dragstart",r.DRAG="drag",r.DRAG_END="dragend",r.DRAG_ENTER="dragenter",r.DRAG_OVER="dragover",r.DRAG_LEAVE="dragleave",r.DROP="drop",r.KEY_DOWN="keydown",r.KEY_UP="keyup",r.WHEEL="wheel",r.PINCH="pinch"})(J||(J={}));var Al;(function(r){r.KEY_DOWN="keydown",r.KEY_UP="keyup"})(Al||(Al={}));var Cf;(function(r){r.CLICK="edge:click",r.DBLCLICK="edge:dblclick",r.POINTER_OVER="edge:pointerover",r.POINTER_LEAVE="edge:pointerleave",r.POINTER_ENTER="edge:pointerenter",r.POINTER_MOVE="edge:pointermove",r.POINTER_OUT="edge:pointerout",r.POINTER_DOWN="edge:pointerdown",r.POINTER_UP="edge:pointerup",r.CONTEXT_MENU="edge:contextmenu",r.DRAG_ENTER="edge:dragenter",r.DRAG_OVER="edge:dragover",r.DRAG_LEAVE="edge:dragleave",r.DROP="edge:drop"})(Cf||(Cf={}));var ut;(function(r){r.BEFORE_CANVAS_INIT="beforecanvasinit",r.AFTER_CANVAS_INIT="aftercanvasinit",r.BEFORE_SIZE_CHANGE="beforesizechange",r.AFTER_SIZE_CHANGE="aftersizechange",r.BEFORE_ELEMENT_CREATE="beforeelementcreate",r.AFTER_ELEMENT_CREATE="afterelementcreate",r.BEFORE_ELEMENT_UPDATE="beforeelementupdate",r.AFTER_ELEMENT_UPDATE="afterelementupdate",r.BEFORE_ELEMENT_DESTROY="beforeelementdestroy",r.AFTER_ELEMENT_DESTROY="afterelementdestroy",r.BEFORE_ELEMENT_TRANSLATE="beforeelementtranslate",r.AFTER_ELEMENT_TRANSLATE="afterelementtranslate",r.BEFORE_DRAW="beforedraw",r.AFTER_DRAW="afterdraw",r.BEFORE_RENDER="beforerender",r.AFTER_RENDER="afterrender",r.BEFORE_ANIMATE="beforeanimate",r.AFTER_ANIMATE="afteranimate",r.BEFORE_LAYOUT="beforelayout",r.AFTER_LAYOUT="afterlayout",r.BEFORE_STAGE_LAYOUT="beforestagelayout",r.AFTER_STAGE_LAYOUT="afterstagelayout",r.BEFORE_TRANSFORM="beforetransform",r.AFTER_TRANSFORM="aftertransform",r.BATCH_START="batchstart",r.BATCH_END="batchend",r.BEFORE_DESTROY="beforedestroy",r.AFTER_DESTROY="afterdestroy",r.BEFORE_RENDERER_CHANGE="beforerendererchange",r.AFTER_RENDERER_CHANGE="afterrendererchange"})(ut||(ut={}));var ys;(function(r){r.UNDO="undo",r.REDO="redo",r.CANCEL="cancel",r.ADD="add",r.CLEAR="clear",r.CHANGE="change"})(ys||(ys={}));var Zn;(function(r){r.CLICK="node:click",r.DBLCLICK="node:dblclick",r.POINTER_OVER="node:pointerover",r.POINTER_LEAVE="node:pointerleave",r.POINTER_ENTER="node:pointerenter",r.POINTER_MOVE="node:pointermove",r.POINTER_OUT="node:pointerout",r.POINTER_DOWN="node:pointerdown",r.POINTER_UP="node:pointerup",r.CONTEXT_MENU="node:contextmenu",r.DRAG_START="node:dragstart",r.DRAG="node:drag",r.DRAG_END="node:dragend",r.DRAG_ENTER="node:dragenter",r.DRAG_OVER="node:dragover",r.DRAG_LEAVE="node:dragleave",r.DROP="node:drop"})(Zn||(Zn={}));const we="combo",jr="tree";var Na;(function(r){r.NODE="node",r.EDGE="edge",r.COMBO="combo",r.THEME="theme",r.PALETTE="palette",r.LAYOUT="layout",r.BEHAVIOR="behavior",r.PLUGIN="plugin",r.ANIMATION="animation",r.TRANSFORM="transform",r.SHAPE="shape"})(Na||(Na={}));const Pw={animation:{},behavior:{},combo:{},edge:{},layout:{},node:{},palette:{},theme:{},plugin:{},transform:{},shape:{}};function ja(r,t){var e;const n=(e=Pw[r])===null||e===void 0?void 0:e[t];if(n)return n}const UY="5.0.43",YY="G6";function Ra(r){return`[${YY} v${UY}] ${r}`}const sa={mute:!1,debug:r=>{console.debug(Ra(r))},info:r=>{console.info(Ra(r))},warn:r=>{console.warn(Ra(r))},error:r=>{console.error(Ra(r))}};function JL(r){const{theme:t}=r;if(!t)return{};const e=ja(Na.THEME,t);return e||(sa.warn(`The theme of ${t} is not registered.`),{})}function qx(r,t){if(Array.isArray(r)&&r.length===0)return null;const e=Array.isArray(r)?r[0]:r,n=Array.isArray(r)?r.slice(1):t||[];return new Proxy(e,{get(i,a){return typeof i[a]=="function"&&!["onframe","onfinish"].includes(a)?(...s)=>{i[a](...s),n.forEach(o=>{var l;return(l=o[a])===null||l===void 0?void 0:l.call(o,...s)})}:a==="finished"?Promise.all([e.finished,...n.map(s=>s.finished)]):Reflect.get(i,a)},set(i,a,s){return["onframe","onfinish"].includes(a)||n.forEach(o=>{o[a]=s}),Reflect.set(i,a,s)}})}function Nw(r){const t=r.reduce((n,i)=>(Object.entries(i).forEach(([a,s])=>{n[a]===void 0?n[a]=[s]:n[a].push(s)}),n),{});Object.entries(t).forEach(([n,i])=>{(i.length!==r.length||i.some(a=>kt(a))||i.every(a=>!["sourceNode","targetNode","childrenNode"].includes(n)&&Ue(a,i[0])))&&delete t[n]});const e=Object.entries(t).reduce((n,[i,a])=>(a.forEach((s,o)=>{n[o]?n[o][i]=s:n[o]={[i]:s}}),n),[]);return r.length!==0&&e.length===0&&e.push({_:0},{_:0}),e}function fc(r){switch(r){case"opacity":return 1;case"x":case"y":case"z":case"zIndex":return 0;case"visibility":return"visible";case"collapsed":return!1;case"states":return[];default:return}}function QL(r,t){const{animation:e}=r;if(e===!1||t===!1)return!1;const n=Object.assign({},VY);return an(e)&&Object.assign(n,e),an(t)&&Object.assign(n,t),n}function XY(r){if(typeof r=="string"){const t=ja(Na.ANIMATION,r);return t||(sa.warn(`The animation of ${r} is not registered.`),[])}return r}function KY(r,t,e,n){var i,a;const{animation:s}=r;if(s===!1||n===!1)return[];const o=(i=r==null?void 0:r[t])===null||i===void 0?void 0:i.animation;if(o===!1)return[];const l=o==null?void 0:o[e];if(l===!1)return[];const u=(a=JL(r)[t])===null||a===void 0?void 0:a.animation,c=(d=[])=>XY(d).map(g=>Object.assign(Object.assign(Object.assign(Object.assign({},HY),an(s)&&s),g),an(n)&&n));if(l)return c(l);if(!u)return[];const h=u[e];return h===!1?[]:c(h)}function tI(r,t,e,n=[]){if(!n&&r===0&&t===0&&e===0)return null;if(Array.isArray(n)){let a=-1;const s=[];for(let o=0;o<n.length;o++){const l=n[o];if(l[0]==="translate"){if(l[1]===r&&l[2]===t)return null;a=o,s.push(["translate",r,t])}else if(l[0]==="translate3d"){if(l[1]===r&&l[2]===t&&l[3]===e)return null;a=o,s.push(["translate3d",r,t,e??0])}else s.push(l)}return a===-1&&s.splice(0,0,yt(e)?["translate3d",r,t,e??0]:["translate",r,t]),s.length===0?null:s}const i=n?n.replace(/translate(3d)?\([^)]*\)/g,""):"";return e===0?`translate(${r}, ${t})${i}`:`translate3d(${r}, ${t}, ${e})${i}`}var ZY=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};const JY=(r,t,e)=>{if(!e.length)return null;const[n,i]=t,a=u=>{var c;if(u){const h=r.getShape(u);if(!h)return null;const d=`get${mf(u)}Style`,g=((c=r==null?void 0:r[d])===null||c===void 0?void 0:c.bind(r))||(m=>m),p=(g==null?void 0:g(n))||{},v=(g==null?void 0:g(i))||{};return{shape:h,fromStyle:p,toStyle:v}}else return{shape:r,fromStyle:n,toStyle:i}};let s;const o=e.map(u=>{var{fields:c,shape:h,states:d}=u,g=ZY(u,["fields","shape","states"]);const p=a(h);if(!p)return null;const{shape:v,fromStyle:m,toStyle:b}=p,w=[{},{}];if(c.forEach(_=>{var S,M;Object.assign(w[0],{[_]:(S=m[_])!==null&&S!==void 0?S:fc(_)}),Object.assign(w[1],{[_]:(M=b[_])!==null&&M!==void 0?M:fc(_)})}),w.some(_=>Object.keys(_).some(S=>["x","y","z"].includes(S)))){const{x:_=0,y:S=0,z:M,transform:k=""}=v.attributes||{};w.forEach(T=>{var P,O,A;T.transform=tI((P=T.x)!==null&&P!==void 0?P:_,(O=T.y)!==null&&O!==void 0?O:S,(A=T.z)!==null&&A!==void 0?A:M,k)})}const x=v.animate(Nw(w),g);return h===void 0&&(s=x),x}).filter(Boolean),l=s||(o==null?void 0:o[0]);return l?qx(l,o.filter(u=>u!==u)):null},QY=[{fields:["opacity"]}],tX=[{fields:["x","y"]}],eI=[{fields:["x","y"]}],eX=eI,nI=[{fields:["sourceNode","targetNode"]}],nX=nI,rI=[{fields:["childrenNode","x","y"]}],rX=rI;function iX(r){return"source"in r&&"target"in r}function aX(r){return r.length===2}function Vl(r){return r instanceof Float32Array?!0:Array.isArray(r)&&(r.length===2||r.length===3)?r.every(t=>typeof t=="number"):!1}function aa(r,t,e){return r>=t&&r<=e}function oa(r=0){if(Array.isArray(r)){const[t=0,e=t,n=t,i=e]=r;return[t,e,n,i]}return[r,r,r,r]}function sX(r=0){const t=oa(r);return t[0]+t[2]}function la(r){return r.max[0]-r.min[0]}function ua(r){return r.max[1]-r.min[1]}function Us(r){return[la(r),ua(r)]}function Ss(r,t){const e=Vl(r)?Wx(r):r.getShape("key").getBounds();return t?Ys(e,t):e}function Wx(r){const[t,e,n=0]=r,i=new Me;return i.setMinMax([t,e,n],[t,e,n]),i}function Ys(r,t){const[e,n,i,a]=oa(t),[s,o,l]=r.min,[u,c,h]=r.max,d=new Me;return d.setMinMax([s-a,o-e,l],[u+n,c+i,h]),d}function Ic(r){if(r.length===0)return new Me;if(r.length===1)return r[0];const t=new Me;t.setMinMax(r[0].min,r[0].max);for(let e=1;e<r.length;e++){const n=r[e];t.setMinMax([Math.min(t.min[0],n.min[0]),Math.min(t.min[1],n.min[1]),Math.min(t.min[2],n.min[2])],[Math.max(t.max[0],n.max[0]),Math.max(t.max[1],n.max[1]),Math.max(t.max[2],n.max[2])])}return t}function oX(r,t){const[e,n]=r.min,[i,a]=r.max,[s,o]=t.min,[l,u]=t.max;return e>=s&&i<=l&&n>=o&&a<=u}function Ii(r,t){return aa(r[0],t.min[0],t.max[0])&&aa(r[1],t.min[1],t.max[1])}function iI(r,t,e=!1){const{min:[n,i],max:[a,s]}=t,o=(r[1]===i||r[1]===s)&&(e||aa(r[0],n,a)),l=(r[0]===n||r[0]===a)&&(e||aa(r[1],i,s));return o||l}function lX(r,t){return!Ii(r,t)}function Af(r,t){const{center:e}=t;return r[0]===e[0]&&r[1]===e[1]}function nc(r,t){const[e,n]=r,[i,a]=t.min,[s,o]=t.max,l=e-i,u=s-e,c=n-a,h=o-n,d=Math.min(l,u,c,h);return d===l?"left":d===u?"right":d===c?"top":d===h?"bottom":"left"}function ko(r,t){const e=zs(r);if(Ii(r,t))switch(nc(r,t)){case"left":e[0]=t.min[0];break;case"right":e[0]=t.max[0];break;case"top":e[1]=t.min[1];break;case"bottom":e[1]=t.max[1];break}else{const[n,i]=r,[a,s]=t.min,[o,l]=t.max;e[0]=aa(n,a,o)?n:n<a?a:o,e[1]=aa(i,s,l)?i:i<s?s:l}return e}function uX(r,t){const{center:e}=r,[n,i]=Us(r),a=t==="up"||t==="down"?e[0]:t==="right"?e[0]-n/6:e[0]+n/6,s=t==="left"||t==="right"?e[1]:t==="down"?e[1]-i/6:e[1]+i/6;return[a,s]}function cX(r,t){let[e,n]=Us(r);return[e,n]=t==="up"||t==="down"?[e,n]:[n,e],(Math.pow(n,2)-Math.pow(Math.sqrt(Math.pow(e/2,2)+Math.pow(n,2))-e/2,2))/(2*n)}function hX(r){const{min:[t,e],max:[n,i]}=r,a=[t,i],s=[n,i],o=[n,e],l=[t,e];return[[a,s],[s,o],[o,l],[l,a]]}var dX=function(t,e){return t===e},NM=function(){function r(t,e){e===void 0&&(e=null),this.value=t,this.next=e}return r.prototype.toString=function(t){return t?t(this.value):"".concat(this.value)},r}(),fX=function(){function r(t){t===void 0&&(t=dX),this.head=null,this.tail=null,this.compare=t}return r.prototype.prepend=function(t){var e=new NM(t,this.head);return this.head=e,this.tail||(this.tail=e),this},r.prototype.append=function(t){var e=new NM(t);return this.head?(this.tail.next=e,this.tail=e,this):(this.head=e,this.tail=e,this)},r.prototype.delete=function(t){if(!this.head)return null;for(var e=null;this.head&&this.compare(this.head.value,t);)e=this.head,this.head=this.head.next;var n=this.head;if(n!==null)for(;n.next;)this.compare(n.next.value,t)?(e=n.next,n.next=n.next.next):n=n.next;return this.compare(this.tail.value,t)&&(this.tail=n),e},r.prototype.find=function(t){var e=t.value,n=e===void 0?void 0:e,i=t.callback,a=i===void 0?void 0:i;if(!this.head)return null;for(var s=this.head;s;){if(a&&a(s.value)||n!==void 0&&this.compare(s.value,n))return s;s=s.next}return null},r.prototype.deleteTail=function(){var t=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,t;for(var e=this.head;e.next;)e.next.next?e=e.next:e.next=null;return this.tail=e,t},r.prototype.deleteHead=function(){if(!this.head)return null;var t=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),t},r.prototype.fromArray=function(t){var e=this;return t.forEach(function(n){return e.append(n)}),this},r.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},r.prototype.reverse=function(){for(var t=this.head,e=null,n=null;t;)n=t.next,t.next=e,e=t,t=n;this.tail=this.head,this.head=e},r.prototype.toString=function(t){return t===void 0&&(t=void 0),this.toArray().map(function(e){return e.toString(t)}).toString()},r}(),gX=function(t,e,n){e===void 0&&(e=[]);var i=e.filter(function(l){return l.source===t||l.target===t});if(n==="target"){var a=function(u){return u.source===t};return i.filter(a).map(function(l){return l.target})}if(n==="source"){var s=function(u){return u.target===t};return i.filter(s).map(function(l){return l.source})}var o=function(u){return u.source===t?u.target:u.source};return i.map(o)},pX=function(t,e){return e.filter(function(n){return n.source===t})},vX=function(t,e){return e.filter(function(n){return n.source===t||n.target===t})},mX=function(t){var e={},n=t.nodes,i=n===void 0?[]:n,a=t.edges,s=a===void 0?[]:a;return i.forEach(function(o){e[o.id]={degree:0,inDegree:0,outDegree:0}}),s.forEach(function(o){e[o.source].degree++,e[o.source].outDegree++,e[o.target].degree++,e[o.target].inDegree++}),e},yX={}.toString,Gx=function(r,t){return yX.call(r)==="[object "+t+"]"};const aI=function(r){return Gx(r,"Function")},sI=function(r){return Array.isArray?Array.isArray(r):Gx(r,"Array")},bX=function(r){var t=typeof r;return r!==null&&t==="object"||t==="function"};function wX(r,t){if(r){var e;if(sI(r))for(var n=0,i=r.length;n<i&&(e=t(r[n],n),e!==!1);n++);else if(bX(r)){for(var a in r)if(r.hasOwnProperty(a)&&(e=t(r[a],a),e===!1))break}}}const xX=function(r){return Gx(r,"String")};var EX=Object.values?function(r){return Object.values(r)}:function(r){var t=[];return wX(r,function(e,n){aI(r)&&n==="prototype"||t.push(e)}),t};const _X=function(r,t){if(!aI(r))throw new TypeError("Expected a function");var e=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=t?t.apply(this,n):n[0],s=e.cache;if(s.has(a))return s.get(a);var o=r.apply(this,n);return s.set(a,o),o};return e.cache=new Map,e};var gd;_X(function(r,t){t===void 0&&(t={});var e=t.fontSize,n=t.fontFamily,i=t.fontWeight,a=t.fontStyle,s=t.fontVariant;return gd||(gd=document.createElement("canvas").getContext("2d")),gd.font=[a,s,i,e+"px",n].join(" "),gd.measureText(xX(r)?r:"").width},function(r,t){return t===void 0&&(t={}),BW([r],EX(t)).join("")});var SX=function(t,e,n){for(var i=1/0,a,s=0;s<e.length;s++){var o=e[s].id;!n[o]&&t[o]<=i&&(i=t[o],a=e[s])}return a},MX=function(t,e,n,i){var a=t.nodes,s=a===void 0?[]:a,o=t.edges,l=o===void 0?[]:o,u={},c={},h={};s.forEach(function(w,x){var _=w.id;c[_]=1/0,_===e&&(c[_]=0)});for(var d=s.length,g=function(x){var _=SX(c,s,u),S=_.id;if(u[S]=!0,c[S]===1/0)return"continue";var M=[];n?M=pX(S,l):M=vX(S,l),M.forEach(function(k){var T=k.target,P=k.source,O=T===S?P:T,A=i&&k[i]?k[i]:1;c[O]>c[_.id]+A?(c[O]=c[_.id]+A,h[O]=[_.id]):c[O]===c[_.id]+A&&h[O].push(_.id)})},p=0;p<d;p++)g();h[e]=[e];var v={};for(var m in c)c[m]!==1/0&&oI(e,m,h,v);var b={};for(var m in v)b[m]=v[m][0];return{length:c,path:b,allPath:v}};function oI(r,t,e,n){if(r===t)return[r];if(n[t])return n[t];for(var i=[],a=0,s=e[t];a<s.length;a++){var o=s[a],l=oI(r,o,e,n);if(!l)return;for(var u=0,c=l;u<c.length;u++){var h=c[u];sI(h)?i.push(vt(vt([],h,!0),[t],!1)):i.push([h,t])}}return n[t]=i,n[t]}var lI=function(t,e,n,i,a){var s=MX(t,e,i,a),o=s.length,l=s.path,u=s.allPath;return{length:o[n],path:l[n],allPath:u[n]}},RM;(function(r){r.EuclideanDistance="euclideanDistance"})(RM||(RM={}));var kX=function(t,e,n){typeof e!="number"&&(e=1e-6),typeof n!="number"&&(n=.85);for(var i=1,a=0,s=1e3,o=t.nodes,l=o===void 0?[]:o,u=t.edges,c=u===void 0?[]:u,h=l.length,d,g={},p={},v=0;v<h;++v){var m=l[v],b=m.id;g[b]=1/h,p[b]=1/h}for(var w=mX(t);s>0&&i>e;){a=0;for(var v=0;v<h;++v){var m=l[v],b=m.id;if(d=0,w[m.id].inDegree===0)g[b]=0;else{for(var x=gX(b,c,"source"),_=0;_<x.length;++_){var S=x[_],M=w[S].outDegree;M>0&&(d+=p[S]/M)}g[b]=n*d,a+=g[b]}}a=(1-a)/h,i=0;for(var v=0;v<h;++v){var m=l[v],b=m.id;d=g[b]+a,i+=Math.abs(d-p[b]),p[b]=d}s-=1}return p};(function(){function r(t){t===void 0&&(t=10),this.linkedList=new fX,this.maxStep=t}return Object.defineProperty(r.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),r.prototype.isEmpty=function(){return!this.linkedList.head},r.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},r.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},r.prototype.push=function(t){this.linkedList.prepend(t),this.length>this.maxStep&&this.linkedList.deleteTail()},r.prototype.pop=function(){var t=this.linkedList.deleteHead();return t?t.value:null},r.prototype.toArray=function(){return this.linkedList.toArray().map(function(t){return t.value})},r.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},r})();function H(r){if(r.id!==void 0)return r.id;if(r.source!==void 0&&r.target!==void 0)return`${r.source}-${r.target}`;throw new Error(Ra("The datum does not have available id."))}function pd(r){return r.combo}function uI(r,t){const e={nodes:(r.nodes||[]).map(H),edges:(r.edges||[]).map(H),combos:(r.combos||[]).map(H)};return t?Object.values(e).flat():e}const cI=(r,t,e)=>{var n;switch(e.type){case"degree":{const i=new Map;return(n=r.nodes)===null||n===void 0||n.forEach(a=>{const s=t(H(a),e.direction).length;i.set(H(a),s)}),i}case"betweenness":return TX(r,e.directed,e.weightPropertyName);case"closeness":return OX(r,e.directed,e.weightPropertyName);case"eigenvector":return AX(r,e.directed);case"pagerank":return CX(r,e.epsilon,e.linkProb);default:return hI(r)}},hI=r=>{var t;const e=new Map;return(t=r.nodes)===null||t===void 0||t.forEach(n=>{e.set(H(n),0)}),e},TX=(r,t,e)=>{const n=hI(r),{nodes:i=[]}=r;return i.forEach(a=>{i.forEach(s=>{if(a!==s){const{allPath:o}=lI(r,H(a),H(s),t,e),l=o.length;o.flat().forEach(u=>{u!==H(a)&&u!==H(s)&&n.set(u,n.get(u)+1/l)})}})}),n},OX=(r,t,e)=>{const n=new Map,{nodes:i=[]}=r;return i.forEach(a=>{const s=i.reduce((o,l)=>{if(a!==l){const{length:u}=lI(r,H(a),H(l),t,e);o+=u}return o},0);n.set(H(a),1/s)}),n},CX=(r,t,e)=>{var n;const i=new Map,a=kX(r,t,e);return(n=r.nodes)===null||n===void 0||n.forEach(s=>{i.set(H(s),a[H(s)])}),i},AX=(r,t)=>{const{nodes:e=[]}=r,n=PX(r,t),i=NX(n,e.length),a=new Map;return e.forEach((s,o)=>{a.set(H(s),i[o])}),a},PX=(r,t)=>{const{nodes:e=[],edges:n=[]}=r,i=Array(e.length).fill(null).map(()=>Array(e.length).fill(0));return n.forEach(({source:a,target:s})=>{const o=e.findIndex(u=>H(u)===a),l=e.findIndex(u=>H(u)===s);t?i[o][l]=1:(i[o][l]=1,i[l][o]=1)}),i},NX=(r,t,e=100,n=1e-6)=>{let i=Array(t).fill(1),a=1/0;for(let s=0;s<e&&a>n;s++){const o=Array(t).fill(0);for(let u=0;u<t;u++)for(let c=0;c<t;c++)o[u]+=r[u][c]*i[c];const l=Math.sqrt(o.reduce((u,c)=>u+c*c,0));for(let u=0;u<t;u++)o[u]/=l;a=Math.sqrt(o.reduce((u,c,h)=>u+(c-i[h])*c,0)),i=o}return i};function Ns(r,t,e,n=Ue){const i=new Map(r.map(d=>[e(d),d])),a=new Map(t.map(d=>[e(d),d])),s=new Set(i.keys()),o=new Set(a.keys()),l=[],u=[],c=[],h=[];return o.forEach(d=>{s.has(d)?n(i.get(d),a.get(d))?h.push(a.get(d)):u.push(a.get(d)):l.push(a.get(d))}),s.forEach(d=>{o.has(d)||c.push(i.get(d))}),{enter:l,exit:c,keep:h,update:u}}function Do(r,t,e){const n=i=>{e&&!e(i)||(i.style.visibility=t)};r.forEach(i=>{n(i)})}function RX(r,t,e){const n={},i=a=>(a in n||(n[a]=0),`${t}-${a}-${n[a]++}`);return e.map(a=>typeof a=="string"?{type:a,key:i(a)}:typeof a=="function"?a.call(r):a.key?a:Object.assign(Object.assign({},a),{key:i(a.type)}))}class Vx{constructor(t){this.extensions=[],this.extensionMap={},this.context=t}setExtensions(t){const e=RX(this.context.graph,this.category,t),{enter:n,update:i,exit:a,keep:s}=Ns(this.extensions,e,o=>o.key);this.createExtensions(n),this.updateExtensions([...i,...s]),this.destroyExtensions(a),this.extensions=e}createExtension(t){const{category:e}=this,{key:n,type:i}=t,a=ja(e,i);if(!a)return sa.warn(`The extension ${i} of ${e} is not registered.`);const s=new a(this.context,t);this.extensionMap[n]=s}createExtensions(t){t.forEach(e=>this.createExtension(e))}updateExtension(t){const{key:e}=t,n=this.extensionMap[e];n&&n.update(t)}updateExtensions(t){t.forEach(e=>this.updateExtension(e))}destroyExtension(t){const e=this.extensionMap[t];e&&(e.destroy(),delete this.extensionMap[t])}destroyExtensions(t){t.forEach(({key:e})=>this.destroyExtension(e))}destroy(){Object.values(this.extensionMap).forEach(t=>t.destroy()),this.context={},this.extensions=[],this.extensionMap={}}}class Hx{constructor(t,e){this.events=[],this.destroyed=!1,this.context=t,this.options=e}update(t){this.options=Object.assign(this.options,t)}destroy(){this.context={},this.options={},this.destroyed=!0}}class Or extends Hx{}class ug extends Or{constructor(t,e){super(t,Object.assign({},ug.defaultOptions,e)),this.isOverlapping=(n,i)=>i.some(a=>n.intersects(a)),this.occupiedBounds=[],this.detectLabelCollision=n=>{const i=this.context.viewport,a={show:[],hide:[]};return this.occupiedBounds=[],n.forEach(s=>{const o=s.getShape("label").getRenderBounds();i.isInViewport(o,!0)&&!this.isOverlapping(o,this.occupiedBounds)?(a.show.push(s),this.occupiedBounds.push(Ys(o,this.options.padding))):a.hide.push(s)}),a},this.hideLabelIfExceedViewport=(n,i)=>{const{exit:a}=Ns(n,i,s=>s.id);a==null||a.forEach(this.hideLabel)},this.nodeCentralities=new Map,this.sortNodesByCentrality=(n,i)=>{const{model:a}=this.context,s=a.getData(),o=a.getRelatedEdgesData.bind(a);return n.map(u=>(this.nodeCentralities.has(u.id)||(this.nodeCentralities=cI(s,o,i)),{node:u,centrality:this.nodeCentralities.get(u.id)})).sort((u,c)=>c.centrality-u.centrality).map(u=>u.node)},this.sortLabelElementsInView=n=>{const{sort:i,sortNode:a,sortCombo:s,sortEdge:o}=this.options,{model:l}=this.context;if(Et(i))return n.sort((v,m)=>i(l.getElementDataById(v.id),l.getElementDataById(m.id)));const{node:u=[],edge:c=[],combo:h=[]}=rg(n,v=>v.type),d=Et(s)?h.sort((v,m)=>s(...l.getComboData([v.id,m.id]))):h,g=Et(a)?u.sort((v,m)=>a(...l.getNodeData([v.id,m.id]))):this.sortNodesByCentrality(u,a),p=Et(o)?c.sort((v,m)=>o(...l.getEdgeData([v.id,m.id]))):c;return[...d,...g,...p]},this.labelElementsInView=[],this.isFirstRender=!0,this.onToggleVisibility=n=>{var i;if(((i=n.data)===null||i===void 0?void 0:i.stage)==="zIndex")return;if(!this.validate(n)){this.hiddenElements.size>0&&(this.hiddenElements.forEach(this.showLabel),this.hiddenElements.clear());return}const a=this.isFirstRender?this.getLabelElements():this.getLabelElementsInView();this.hideLabelIfExceedViewport(this.labelElementsInView,a),this.labelElementsInView=a;const s=this.sortLabelElementsInView(this.labelElementsInView),{show:o,hide:l}=this.detectLabelCollision(s);for(let u=o.length-1;u>=0;u--)this.showLabel(o[u]);l.forEach(this.hideLabel)},this.hiddenElements=new Map,this.hideLabel=n=>{const i=n.getShape("label");i&&Do(i,"hidden"),this.hiddenElements.set(n.id,n)},this.showLabel=n=>{const i=n.getShape("label");i&&Do(i,"visible"),n.toFront(),this.hiddenElements.delete(n.id)},this.onTransform=ZR(this.onToggleVisibility,this.options.throttle,{leading:!0}),this.enableToggle=!0,this.toggle=n=>{this.enableToggle&&this.onToggleVisibility(n)},this.onBeforeRender=()=>{this.enableToggle=!1},this.onAfterRender=n=>{this.onToggleVisibility(n),this.enableToggle=!0},this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents(),this.onToggleVisibility({})}getLabelElements(){const{elementMap:t}=this.context.element,e=[];for(const n in t){const i=t[n];i.isVisible()&&i.getShape("label")&&e.push(i)}return e}getLabelElementsInView(){const t=this.context.viewport;return this.getLabelElements().filter(e=>t.isInViewport(e.getShape("key").getRenderBounds()))}bindEvents(){const{graph:t}=this.context;t.on(ut.BEFORE_RENDER,this.onBeforeRender),t.on(ut.AFTER_RENDER,this.onAfterRender),t.on(ut.AFTER_DRAW,this.toggle),t.on(ut.AFTER_LAYOUT,this.toggle),t.on(ut.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:t}=this.context;t.off(ut.BEFORE_RENDER,this.onBeforeRender),t.off(ut.AFTER_RENDER,this.onAfterRender),t.off(ut.AFTER_DRAW,this.toggle),t.off(ut.AFTER_LAYOUT,this.toggle),t.off(ut.AFTER_TRANSFORM,this.onTransform)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}ug.defaultOptions={enable:!0,throttle:100,padding:0,sortNode:{type:"degree"}};const LM=[0,0,0];function Lt(r,t){return r.map((e,n)=>e+t[n])}function be(r,t){return r.map((e,n)=>e-t[n])}function Ta(r,t){return typeof t=="number"?r.map(e=>e*t):r.map((e,n)=>e*t[n])}function Di(r,t){return typeof t=="number"?r.map(e=>e/t):r.map((e,n)=>e/t[n])}function LX(r,t){return r.reduce((e,n,i)=>e+n*t[i],0)}function IX(r,t){const e=gc(r),n=gc(t);return[e[1]*n[2]-e[2]*n[1],e[2]*n[0]-e[0]*n[2],e[0]*n[1]-e[1]*n[0]]}function Ms(r,t){return r.map(e=>e*t)}function Ae(r,t){return Math.sqrt(r.reduce((e,n,i)=>e+Math.pow(n-t[i]||0,2),0))}function Pf(r,t){return r.reduce((e,n,i)=>e+Math.abs(n-t[i]),0)}function Ba(r){const t=r.reduce((e,n)=>e+Math.pow(n,2),0);return r.map(e=>e/Math.sqrt(t))}function Ux(r,t,e=!1){const n=r[0]*t[1]-r[1]*t[0];let i=Math.acos(Ta(r,t).reduce((a,s)=>a+s,0)/(Ae(r,LM)*Ae(t,LM)));return e&&n<0&&(i=2*Math.PI-i),i}function cg(r,t=!0){return t?[-r[1],r[0]]:[r[1],-r[0]]}function DX(r,t){return r.map(e=>e%t)}function Fo(r){return[r[0],r[1]]}function gc(r){return aX(r)?[r[0],r[1],0]:r}function dI(r){const[t,e]=r;return!t&&!e?0:Math.atan2(e,t)}function fI(r,t){const[e,n]=r,[i,a]=t,s=be(e,n),o=be(i,a);return IX(s,o).every(l=>l===0)}function Yx(r,t,e=!1){if(fI(r,t))return;const[n,i]=r,[a,s]=t,o=((n[0]-a[0])*(a[1]-s[1])-(n[1]-a[1])*(a[0]-s[0]))/((n[0]-i[0])*(a[1]-s[1])-(n[1]-i[1])*(a[0]-s[0])),l=s[0]-a[0]?(n[0]-a[0]+o*(i[0]-n[0]))/(s[0]-a[0]):(n[1]-a[1]+o*(i[1]-n[1]))/(s[1]-a[1]);if(!(!e&&(!aa(o,0,1)||!aa(l,0,1))))return[n[0]+o*(i[0]-n[0]),n[1]+o*(i[1]-n[1])]}function gI(r){if(Array.isArray(r))return aa(r[0],0,1)&&aa(r[1],0,1)?r:[.5,.5];const t=r.split("-"),e=t.includes("left")?0:t.includes("right")?1:.5,n=t.includes("top")?0:t.includes("bottom")?1:.5;return[e,n]}function sn(r){const{x:t=0,y:e=0,z:n=0}=r.style||{};return[+t,+e,+n]}function FX(r){const{x:t,y:e,z:n}=r.style||{};return t!==void 0||e!==void 0||n!==void 0}function BX(r,t){const[e,n]=t,{min:i,max:a}=r;return[i[0]+e*(a[0]-i[0]),i[1]+n*(a[1]-i[1])]}function Oa(r,t="center"){const e=gI(t);return BX(r,e)}function zn(r){var t;return[r.x,r.y,(t=r.z)!==null&&t!==void 0?t:0]}function Ni(r){var t;return{x:r[0],y:r[1],z:(t=r[2])!==null&&t!==void 0?t:0}}function Ou(r,t=0){return r.map(e=>parseFloat(e.toFixed(t)))}function Rs(r,t,e,n=!1){if(Ue(r,t))return r;const i=n?be(r,t):be(t,r),a=Ba(i),s=[a[0]*e,a[1]*e];return Lt(Fo(r),s)}function pI(r,t){return r[1]===t[1]}function zX(r,t){return r[0]===t[0]}function $X(r,t){return pI(r,t)||zX(r,t)}function vI(r,t,e){return fI([r,t],[t,e])}function mI(r,t){return[2*t[0]-r[0],2*t[1]-r[1]]}function yI(r,t,e,n=!0,i=!1){for(let a=0;a<e.length;a++){let s=e[a],o=e[(a+1)%e.length];n&&(s=Lt(t,s),o=Lt(t,o));const l=i?mI(r,t):r,u=Yx([t,l],[s,o]);if(u)return{point:u,line:[s,o]}}return{point:t,line:void 0}}function jX(r,t,e,n){const i=r[0],a=r[1];let s=!1;e===void 0&&(e=0),n===void 0&&(n=t.length);const o=n-e;for(let l=0,u=o-1;l<o;u=l++){const c=t[l+e][0],h=t[l+e][1],d=t[u+e][0],g=t[u+e][1];h>a!=g>a&&i<(d-c)*(a-h)/(g-h)+c&&(s=!s)}return s}function qX(r,t,e=!1){const n=Oa(t,"center"),i=[Oa(t,"left-top"),Oa(t,"right-top"),Oa(t,"right-bottom"),Oa(t,"left-bottom")];return yI(r,n,i,!1,e).point}function hg(r,t,e=!1){const n=t.center,i=e?mI(r,n):r,a=be(i,t.center),s=Math.atan2(a[1],a[0]);if(isNaN(s))return n;const o=la(t)/2,l=ua(t)/2,u=n[0]+o*Math.cos(s),c=n[1]+l*Math.sin(s);return[u,c]}function WX(r,t){let e=1/0,n=[r[0],t[0]];return r.forEach(i=>{t.forEach(a=>{const s=Ae(i,a);s<e&&(e=s,n=[i,a])})}),n}function GX(r,t){let e=1/0,n=[[0,0],[0,0]];return t.forEach(i=>{const a=VX(r,i);a<e&&(e=a,n=i)}),n}function VX(r,t){const e=bI(r,t);return Ae(r,e)}function bI(r,t){const[e,n]=t[0],[i,a]=t[1],[s,o]=r,l=i-e,u=a-n;if(l===0&&u===0)return[e,n];let c=((s-e)*l+(o-n)*u)/(l*l+u*u);c>1?c=1:c<0&&(c=0);const h=e+c*l,d=n+c*u;return[h,d]}function HX(r){const t=r.reduce((e,n)=>Lt(e,n),[0,0]);return Di(t,r.length)}function Xx(r,t=!0){const e=HX(r);return r.sort(([n,i],[a,s])=>{const o=Math.atan2(i-e[1],n-e[0]),l=Math.atan2(s-e[1],a-e[0]);return t?l-o:o-l})}function IM(r,t){return[r,[r[0],t[1]],t,[t[0],r[1]]]}class UX{constructor(t,e){this.callback=e,this.pointerByTouch=[],this.initialDistance=null,this.emitter=t,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.bindEvents()}bindEvents(){const{emitter:t}=this;t.on(J.POINTER_DOWN,this.onPointerDown),t.on(J.POINTER_MOVE,this.onPointerMove),t.on(J.POINTER_UP,this.onPointerUp)}updatePointerPosition(t,e,n){const i=this.pointerByTouch.findIndex(a=>a.pointerId===t);i>=0&&(this.pointerByTouch[i]={x:e,y:n,pointerId:t})}onPointerDown(t){const{x:e,y:n}=t.client;if(!(e===void 0||n===void 0)&&(this.pointerByTouch.push({x:e,y:n,pointerId:t.pointerId}),t.pointerType==="touch"&&this.pointerByTouch.length===2)){const i=this.pointerByTouch[0].x-this.pointerByTouch[1].x,a=this.pointerByTouch[0].y-this.pointerByTouch[1].y;this.initialDistance=Math.sqrt(i*i+a*a)}}onPointerMove(t){if(this.pointerByTouch.length!==2||this.initialDistance===null)return;const{x:e,y:n}=t.client;if(e===void 0||n===void 0)return;this.updatePointerPosition(t.pointerId,e,n);const i=this.pointerByTouch[0].x-this.pointerByTouch[1].x,a=this.pointerByTouch[0].y-this.pointerByTouch[1].y,o=Math.sqrt(i*i+a*a)/this.initialDistance;this.callback(t,{scale:(o-1)*5})}onPointerUp(){this.initialDistance=null,this.pointerByTouch=[]}destroy(){this.emitter.off(J.POINTER_DOWN,this.onPointerDown),this.emitter.off(J.POINTER_MOVE,this.onPointerMove),this.emitter.off(J.POINTER_UP,this.onPointerUp)}}const DM=r=>r.map(t=>oe(t)?t.toLocaleLowerCase():t);class Xl{constructor(t){this.map=new Map,this.recordKey=new Set,this.onKeyDown=e=>{e!=null&&e.key&&(this.recordKey.add(e.key),this.trigger(e))},this.onKeyUp=e=>{e!=null&&e.key&&this.recordKey.delete(e.key)},this.onWheel=e=>{this.triggerExtendKey(J.WHEEL,e)},this.onDrag=e=>{this.triggerExtendKey(J.DRAG,e)},this.handlePinch=(e,n)=>{this.triggerExtendKey(J.PINCH,Object.assign(Object.assign({},e),n))},this.onFocus=()=>{this.recordKey.clear()},this.emitter=t,this.bindEvents()}bind(t,e){t.length!==0&&(t.includes(J.PINCH)&&!this.pinchHandler&&(this.pinchHandler=new UX(this.emitter,this.handlePinch.bind(this))),this.map.set(t,e))}unbind(t,e){this.map.forEach((n,i)=>{Ue(i,t)&&(!e||e===n)&&this.map.delete(i)})}unbindAll(){this.map.clear()}match(t){const e=DM(Array.from(this.recordKey)).sort(),n=DM(t).sort();return Ue(e,n)}bindEvents(){var t;const{emitter:e}=this;e.on(J.KEY_DOWN,this.onKeyDown),e.on(J.KEY_UP,this.onKeyUp),e.on(J.WHEEL,this.onWheel),e.on(J.DRAG,this.onDrag),(t=globalThis.addEventListener)===null||t===void 0||t.call(globalThis,"focus",this.onFocus)}trigger(t){this.map.forEach((e,n)=>{this.match(n)&&e(t)})}triggerExtendKey(t,e){this.map.forEach((n,i)=>{i.includes(t)&&Ue(Array.from(this.recordKey),i.filter(a=>a!==t))&&n(e)})}destroy(){var t,e;this.unbindAll(),this.emitter.off(J.KEY_DOWN,this.onKeyDown),this.emitter.off(J.KEY_UP,this.onKeyUp),this.emitter.off(J.WHEEL,this.onWheel),this.emitter.off(J.DRAG,this.onDrag),(t=this.pinchHandler)===null||t===void 0||t.destroy(),(e=globalThis.removeEventListener)===null||e===void 0||e.call(globalThis,"blur",this.onFocus)}}class Dc extends Or{constructor(t,e){super(t,cr({},Dc.defaultOptions,e)),this.shortcut=new Xl(t.graph),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.clearStates=this.clearStates.bind(this),this.bindEvents()}onPointerDown(t){if(!this.validate(t)||!this.isKeydown()||this.startPoint)return;const{canvas:e,graph:n}=this.context,i=Object.assign({},this.options.style);this.options.style.lineWidth&&(i.lineWidth=+this.options.style.lineWidth/n.getZoom()),this.rectShape=new Sn({id:"g6-brush-select",style:i}),e.appendChild(this.rectShape),this.startPoint=[t.canvas.x,t.canvas.y]}onPointerMove(t){var e;if(!this.startPoint)return;const{immediately:n,mode:i}=this.options;this.endPoint=Nf(t),(e=this.rectShape)===null||e===void 0||e.attr({x:Math.min(this.endPoint[0],this.startPoint[0]),y:Math.min(this.endPoint[1],this.startPoint[1]),width:Math.abs(this.endPoint[0]-this.startPoint[0]),height:Math.abs(this.endPoint[1]-this.startPoint[1])}),n&&i==="default"&&this.updateElementsStates(IM(this.startPoint,this.endPoint))}onPointerUp(t){if(this.startPoint){if(!this.endPoint){this.clearBrush();return}this.endPoint=Nf(t),this.updateElementsStates(IM(this.startPoint,this.endPoint)),this.clearBrush()}}clearStates(){this.endPoint||this.clearElementsStates()}clearElementsStates(){const{graph:t}=this.context,e=Object.values(t.getData()).reduce((n,i)=>Object.assign({},n,i.reduce((a,s)=>(a[H(s)]=[],a),{})),{});t.setElementState(e,this.options.animation)}updateElementsStates(t){const{graph:e}=this.context,{enableElements:n,state:i,mode:a,onSelect:s}=this.options,o=this.selector(e,t,n);let l={};switch(a){case"union":o.forEach(u=>{l[u]=[...e.getElementState(u),i]});break;case"diff":o.forEach(u=>{const c=e.getElementState(u);l[u]=c.includes(i)?c.filter(h=>h!==i):[...c,i]});break;case"intersect":o.forEach(u=>{const c=e.getElementState(u);l[u]=c.includes(i)?[i]:[]});break;case"default":default:o.forEach(u=>{l[u]=[i]});break}Et(s)&&(l=s(l)),e.setElementState(l,this.options.animation)}selector(t,e,n){if(!n||n.length===0)return[];const i=[],a=t.getData();if(n.forEach(s=>{a[`${s}s`].forEach(o=>{const l=H(o);t.getElementVisibility(l)!=="hidden"&&jX(t.getElementPosition(l),e)&&i.push(l)})}),n.includes("edge")){const s=a.edges;s==null||s.forEach(o=>{const{source:l,target:u}=o;i.includes(l)&&i.includes(u)&&i.push(H(o))})}return i}clearBrush(){var t;(t=this.rectShape)===null||t===void 0||t.remove(),this.rectShape=void 0,this.startPoint=void 0,this.endPoint=void 0}isKeydown(){const{trigger:t}=this.options,e=Array.isArray(t)?t:[t];return this.shortcut.match(e.filter(n=>n!=="drag"))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}bindEvents(){const{graph:t}=this.context;t.on(J.POINTER_DOWN,this.onPointerDown),t.on(J.POINTER_MOVE,this.onPointerMove),t.on(J.POINTER_UP,this.onPointerUp),t.on($a.CLICK,this.clearStates)}unbindEvents(){const{graph:t}=this.context;t.off(J.POINTER_DOWN,this.onPointerDown),t.off(J.POINTER_MOVE,this.onPointerMove),t.off(J.POINTER_UP,this.onPointerUp),t.off($a.CLICK,this.clearStates)}update(t){this.unbindEvents(),this.options=cr(this.options,t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}Dc.defaultOptions={animation:!1,enable:!0,enableElements:["node","combo","edge"],immediately:!1,mode:"default",state:"selected",trigger:["shift"],style:{width:0,height:0,lineWidth:1,fill:"#1677FF",stroke:"#1677FF",fillOpacity:.1,zIndex:2,pointerEvents:"none"}};const Nf=r=>[r.canvas.x,r.canvas.y],qa=.8,Bo=["node","edge","combo"];function To(r,t,e,n,i=0){n==="TB"&&t(r,i);const a=e(r);if(a)for(const s of a)To(s,t,e,n,i+1);n==="BT"&&t(r,i)}function YX(r,t,e){const n=[[r,0]];for(;n.length;){const[i,a]=n.shift();t(i,a);const s=e(i);if(s)for(const o of s)n.push([o,a+1])}}function wI(r,t,e,n,i="both"){if(t==="combo"||t==="node")return Rv(r,e,n,i);const a=r.getEdgeData(e);if(!a)return[];const s=Rv(r,a.source,n-1,i),o=Rv(r,a.target,n-1,i);return Array.from(new Set([...s,...o,e]))}function Rv(r,t,e,n="both"){const i=new Set,a=new Set,s=new Set;return YX(t,(o,l)=>{l>e||(s.add(o),r.getRelatedEdgesData(o,n).forEach(u=>{const c=H(u);!a.has(c)&&l<e&&(s.add(c),a.add(c))}))},o=>r.getRelatedEdgesData(o,n).map(l=>l.source===o?l.target:l.source).filter(l=>i.has(l)?!1:(i.add(l),!0))),Array.from(s)}function Lv(r){return r.states||[]}var vd=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class dg extends Or{constructor(t,e){super(t,Object.assign({},dg.defaultOptions,e)),this.onClickSelect=n=>vd(this,void 0,void 0,function*(){var i,a;this.validate(n)&&(yield this.updateState(n),(a=(i=this.options).onClick)===null||a===void 0||a.call(i,n))}),this.onClickCanvas=n=>vd(this,void 0,void 0,function*(){var i,a;this.validate(n)&&(yield this.clearState(),(a=(i=this.options).onClick)===null||a===void 0||a.call(i,n))}),this.shortcut=new Xl(t.graph),this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),Bo.forEach(e=>{t.on(`${e}:${J.CLICK}`,this.onClickSelect)}),t.on($a.CLICK,this.onClickCanvas)}get isMultipleSelect(){const{multiple:t,trigger:e}=this.options;return t&&this.shortcut.match(e)}getNeighborIds(t){const{target:e,targetType:n}=t,{graph:i}=this.context,{degree:a}=this.options;return wI(i,n,e.id,typeof a=="function"?a(t):a).filter(s=>s!==e.id)}updateState(t){return vd(this,void 0,void 0,function*(){const{state:e,unselectedState:n,neighborState:i,animation:a}=this.options;if(!e&&!i&&!n)return;const{target:s}=t,{graph:o}=this.context,l=o.getElementData(s.id),u=Lv(l).includes(e)?"unselect":"select",c={},h=this.isMultipleSelect,d=[s.id],g=this.getNeighborIds(t);if(h)if(Object.assign(c,this.getDataStates()),u==="select"){const p=(v,m)=>{v.forEach(b=>{const w=new Set(o.getElementState(b));w.add(m),w.delete(n),c[b]=Array.from(w)})};p(d,e),p(g,i),n&&Object.keys(c).forEach(v=>{const m=c[v];!m.includes(e)&&!m.includes(i)&&!m.includes(n)&&c[v].push(n)})}else{const p=c[s.id];c[s.id]=p.filter(v=>v!==e&&v!==i),p.includes(n)||c[s.id].push(n),g.forEach(v=>{c[v]=c[v].filter(m=>m!==i),c[v].includes(e)||c[v].push(n)})}else if(u==="select"){Object.assign(c,this.getClearStates(!!n));const p=(v,m)=>{v.forEach(b=>{c[b]||(c[b]=o.getElementState(b)),c[b].push(m)})};p(d,e),p(g,i),n&&Object.keys(c).forEach(v=>{!d.includes(v)&&!g.includes(v)&&c[v].push(n)})}else Object.assign(c,this.getClearStates());yield o.setElementState(c,a)})}getDataStates(){const{graph:t}=this.context,{nodes:e,edges:n,combos:i}=t.getData(),a={};return[...e,...n,...i].forEach(s=>{a[H(s)]=Lv(s)}),a}getClearStates(t=!1){const{graph:e}=this.context,{state:n,unselectedState:i,neighborState:a}=this.options,s=new Set([n,i,a]),{nodes:o,edges:l,combos:u}=e.getData(),c={};return[...o,...l,...u].forEach(h=>{const d=Lv(h),g=d.filter(p=>!s.has(p));(t||g.length!==d.length)&&(c[H(h)]=g)}),c}clearState(){return vd(this,void 0,void 0,function*(){const{graph:t}=this.context;yield t.setElementState(this.getClearStates(),this.options.animation)})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;Bo.forEach(e=>{t.off(`${e}:${J.CLICK}`,this.onClickSelect)}),t.off($a.CLICK,this.onClickCanvas)}destroy(){this.unbindEvents(),super.destroy()}}dg.defaultOptions={animation:!0,enable:!0,multiple:!1,trigger:["shift"],state:"selected",neighborState:"selected",unselectedState:void 0,degree:0};function Sr(r){var t;return!!(!((t=r.style)===null||t===void 0)&&t.collapsed)}function Rf(r,t){if(!r.startsWith(t))return!1;const e=r[t.length];return e>="A"&&e<="Z"}function XX(r,t){return`${t}${mf(r)}`}function KX(r,t,e=!0){if(!t||!Rf(r,t))return r;const n=r.slice(t.length);return e?SW(n):n}function fn(r,t){const e=Object.entries(r).reduce((n,[i,a])=>(i==="className"||i==="class"||Rf(i,t)&&Object.assign(n,{[KX(i,t)]:a}),n),{});if("opacity"in r){const n=XX("opacity",t),i=r.opacity;if(n in r){const a=r[n];Object.assign(e,{opacity:i*a})}else Object.assign(e,{opacity:i})}return e}function Rw(r,t){const e=t.length;return Object.keys(r).reduce((n,i)=>{if(i.startsWith(t)){const a=i.slice(e);n[a]=r[i]}return n},{})}function xI(r,t){const e=typeof t=="string"?[t]:t,n={};return Object.keys(r).forEach(i=>{e.find(a=>i.startsWith(a))||(n[i]=r[i])}),n}function Hr(r=0){if(typeof r=="number")return[r,r,r];const[t,e=t,n=t]=r;return[t,e,n]}var ZX=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};function FM(r,t){const{datum:e,graph:n}=t;return typeof r=="function"?r.call(n,e):Object.fromEntries(Object.entries(r).map(([i,a])=>typeof a=="function"?[i,a.call(n,e)]:[i,a]))}function Nn(r,t){const e=(r==null?void 0:r.style)||{},n=(t==null?void 0:t.style)||{};for(const i in e)i in n||(n[i]=e[i]);return Object.assign({},r,t,{style:n})}function JX(r){const{x:t,y:e,z:n,class:i,className:a,transform:s,transformOrigin:o,zIndex:l,visibility:u}=r;return ZX(r,["x","y","z","class","className","transform","transformOrigin","zIndex","visibility"])}function QX(r,t){const e=Hr(r);let n={};return t.text&&!t.fontSize&&(n={fontSize:Math.min(...e)*.5}),t.src&&(!t.width||!t.height)&&(n={width:e[0]*.5,height:e[1]*.5}),n}function BM(r){if(r)return typeof r=="string"||typeof r=="function"||Array.isArray(r)?{type:"group",field:t=>t.id,color:r,invert:!1}:r}function tK(r,t){if(!t)return{};const{type:e,color:n,field:i,invert:a}=t,s=l=>{const u=typeof n=="string"?ja("palette",n):n;if(typeof u=="function"){const c={};return l.forEach(([h,d])=>{c[h]=u(a?1-d:d)}),c}else if(Array.isArray(u)){const c=a?[...u].reverse():u,h={};return l.forEach(([d,g])=>{h[d]=c[g%u.length]}),h}return{}},o=(l,u)=>{var c;return typeof l=="string"?(c=u.data)===null||c===void 0?void 0:c[l]:l==null?void 0:l(u)};if(e==="group"){const l=rg(r,d=>{if(!i)return"default";const g=o(i,d);return g?String(g):"default"}),u=Object.keys(l),c=s(u.map((d,g)=>[d,g])),h={};return Object.entries(l).forEach(([d,g])=>{g.forEach(p=>{h[H(p)]=c[d]})}),h}else if(e==="value"){const[l,u]=r.reduce(([h,d],g)=>{const p=o(i,g);if(typeof p!="number")throw new Error(Ra(`Palette field ${i} is not a number`));return[Math.min(h,p),Math.max(d,p)]},[1/0,-1/0]),c=u-l;return s(r.map(h=>[h.id,(o(i,h)-l)/c]))}}function EI(r){const t=typeof r=="string"?ja("palette",r):r;if(typeof t!="function")return t}function _I(r,t){let e=2*r;return typeof t=="string"?e=r*Number(t.replace("%",""))/100:typeof t=="number"&&(e=t),isNaN(e)&&(e=2*r),e}function SI(r,t,e=1,n=!1){const i=n?e:1,a=(r.max[0]-r.min[0])*i;return _I(a,t)}function eK(r,t,e=1){const n=Ae(r[0],r[1])*e;return _I(n,t)}class Fc extends Bx{constructor(t){zM(t.style),super(t),this.shapeMap={},this.animateMap={},this.render(this.attributes,this),this.setVisibility(),this.bindEvents()}get parsedAttributes(){return this.attributes}upsert(t,e,n,i,a){var s,o,l,u,c,h,d,g;const p=this.shapeMap[t];if(n===!1){p&&((s=a==null?void 0:a.beforeDestroy)===null||s===void 0||s.call(a,p),i.removeChild(p),delete this.shapeMap[t],(o=a==null?void 0:a.afterDestroy)===null||o===void 0||o.call(a,p));return}const v=typeof e=="string"?ja(Na.SHAPE,e):e;if(!v)throw new Error(Ra(`Shape ${e} not found`));if(!p||p.destroyed||!(p instanceof v)){p&&((l=a==null?void 0:a.beforeDestroy)===null||l===void 0||l.call(a,p),p==null||p.destroy(),(u=a==null?void 0:a.afterDestroy)===null||u===void 0||u.call(a,p)),(c=a==null?void 0:a.beforeCreate)===null||c===void 0||c.call(a);const m=new v({className:t,style:n});return i.appendChild(m),this.shapeMap[t]=m,(h=a==null?void 0:a.afterCreate)===null||h===void 0||h.call(a,m),m}return(d=a==null?void 0:a.beforeUpdate)===null||d===void 0||d.call(a,p),jw(p,n),(g=a==null?void 0:a.afterUpdate)===null||g===void 0||g.call(a,p),p}update(t={}){const e=Object.assign({},this.attributes,t);zM(e),KZ(this,e),this.render(e,this),this.setVisibility()}bindEvents(){}getGraphicStyle(t){return JX(t)}get compositeShapes(){return[["badges","badge-"],["ports","port-"]]}animate(t,e){if(t.length===0)return null;const n=[];if(t[0].x!==void 0||t[0].y!==void 0||t[0].z!==void 0){const{x:a=0,y:s=0,z:o=0}=this.attributes;t.forEach(l=>{const{x:u=a,y:c=s,z:h=o}=l;Object.assign(l,{transform:h?[["translate3d",u,c,h]]:[["translate",u,c]]})})}const i=super.animate(t,e);if(i&&(Iv(this,i),n.push(i)),Array.isArray(t)&&t.length>0){const a=["transform","transformOrigin","x","y","z","zIndex"];if(Object.keys(t[0]).some(s=>!a.includes(s))){Object.entries(this.shapeMap).forEach(([o,l])=>{const u=`get${mf(o)}Style`,c=this[u];if(Et(c)){const h=t.map(g=>c.call(this,Object.assign(Object.assign({},this.attributes),g))),d=l.animate(Nw(h),e);d&&(Iv(l,d),n.push(d))}});const s=(o,l)=>{if(!Ki(o)){const u=`get${mf(l)}Style`,c=this[u];if(Et(c)){const h=t.map(d=>c.call(this,Object.assign(Object.assign({},this.attributes),d)));Object.entries(h[0]).map(([d])=>{const g=h.map(v=>v[d]),p=o[d];if(p){const v=p.animate(Nw(g),e);v&&(Iv(p,v),n.push(v))}})}}};this.compositeShapes.forEach(([o,l])=>{const u=Rw(this.shapeMap,l);s(u,o)})}}return qx(n)}getShape(t){return this.shapeMap[t]}setVisibility(){const{visibility:t}=this.attributes;Do(this,t)}destroy(){this.shapeMap={},this.animateMap={},super.destroy()}}function Iv(r,t){t==null||t.finished.then(()=>{const e=r.activeAnimations.findIndex(n=>n===t);e>-1&&r.activeAnimations.splice(e,1)})}function zM(r){if(!r)return{};if("x"in r||"y"in r||"z"in r){const{x:t=0,y:e=0,z:n,transform:i}=r,a=tI(t,e,n,i);a&&(r.transform=a)}return r}var nK=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class Xs extends Fc{constructor(t){super(Nn({style:Xs.defaultStyleProps},t))}isTextStyle(t){return Rf(t,"label")}isBackgroundStyle(t){return Rf(t,"background")}getTextStyle(t){const e=this.getGraphicStyle(t),{padding:n}=e,i=nK(e,["padding"]);return xI(i,"background")}getBackgroundStyle(t){if(t.background===!1)return!1;const e=this.getGraphicStyle(t),{wordWrap:n,wordWrapWidth:i,padding:a}=e,s=fn(e,"background"),{min:[o,l],center:[u,c],halfExtents:[h,d]}=this.shapeMap.text.getGeometryBounds(),[g,p,v,m]=oa(a),b=h*2+m+p,{width:w,height:x}=s;w&&x?Object.assign(s,{x:u-Number(w)/2,y:c-Number(x)/2}):Object.assign(s,{x:o-m,y:l-g,width:n?Math.min(b,i+m+p):b,height:d*2+g+v});const{radius:_}=s;if(typeof _=="string"&&_.endsWith("%")){const S=Number(_.replace("%",""))/100;s.radius=Math.min(+s.width,+s.height)*S}return s}render(t=this.parsedAttributes,e=this){this.upsert("text",Hs,this.getTextStyle(t),e),this.upsert("background",Sn,this.getBackgroundStyle(t),e)}getGeometryBounds(){return(this.getShape("background")||this.getShape("text")).getGeometryBounds()}}Xs.defaultStyleProps={padding:0,fontSize:12,fontFamily:"system-ui, sans-serif",wordWrap:!0,maxLines:1,wordWrapWidth:128,textOverflow:"...",textBaseline:"middle",backgroundOpacity:.75,backgroundZIndex:-1,backgroundLineWidth:0};class za extends Fc{constructor(t){super(Nn({style:za.defaultStyleProps},t))}getBadgeStyle(t){return this.getGraphicStyle(t)}render(t=this.parsedAttributes,e=this){this.upsert("label",Xs,this.getBadgeStyle(t),e)}getGeometryBounds(){const t=this.getShape("label");return(t.getShape("background")||t.getShape("text")).getGeometryBounds()}}za.defaultStyleProps={padding:[2,4,2,4],fontSize:10,wordWrap:!1,backgroundRadius:"50%",backgroundOpacity:1};function rK(r,t=!0){const e=[];return r.forEach((n,i)=>{e.push([i===0?"M":"L",...n])}),t&&e.push(["Z"]),e}const $M={M:["x","y"],m:["dx","dy"],H:["x"],h:["dx"],V:["y"],v:["dy"],L:["x","y"],l:["dx","dy"],Z:[],z:[],C:["x1","y1","x2","y2","x","y"],c:["dx1","dy1","dx2","dy2","dx","dy"],S:["x2","y2","x","y"],s:["dx2","dy2","dx","dy"],Q:["x1","y1","x","y"],q:["dx1","dy1","dx","dy"],T:["x","y"],t:["dx","dy"],A:["rx","ry","rotation","large-arc","sweep","x","y"],a:["rx","ry","rotation","large-arc","sweep","dx","dy"]};function iK(r){const t=r.replace(/[\n\r]/g,"").replace(/-/g," -").replace(/(\d*\.)(\d+)(?=\.)/g,"$1$2 ").trim().split(/\s*,|\s+/),e=[];let n="",i={};for(;t.length>0;){let a=t.shift();a in $M?n=a:t.unshift(a),i={type:n},$M[n].forEach(l=>{a=t.shift(),i[l]=a}),n==="M"?n="L":n==="m"&&(n="l");const[s,...o]=Object.values(i);e.push([s,...o.map(Number)])}return e}function aK(r){const t=[];return(typeof r=="string"?iK(r):r).forEach(n=>{const i=n[0];if(i==="Z"){t.push(t[0]);return}if(i!=="A")for(let a=1;a<n.length;a=a+2)t.push([n[a],n[a+1],0]);else{const a=n.length;t.push([n[a-2],n[a-1],0])}}),t}const MI=r=>{if(r.length<2)return[["M",0,0],["L",0,0]];const t=r[0],e=r[1],n=r[r.length-1],i=r[r.length-2];r.unshift(i,n),r.push(t,e);const a=[["M",n[0],n[1]]];for(let s=1;s<r.length-2;s+=1){const[o,l]=r[s-1],[u,c]=r[s],[h,d]=r[s+1],[g,p]=s!==r.length-2?r[s+2]:[h,d],v=u+(h-o)/6,m=c+(d-l)/6,b=h-(g-u)/6,w=d-(p-c)/6;a.push(["C",v,m,b,w,h,d])}return a};function sK(r,t,e,n,i,a,s){const[o,l]=Oa(r,t),u={textAlign:t==="left"?"right":t==="right"?"left":"center",textBaseline:t==="top"?"bottom":t==="bottom"?"top":"middle",transform:[["translate",o+e,l+n]]};if(t==="center"||!i)return u;const c=aK(a);if(!c||c.length<=3)return u;const h=c.map((p,v)=>{const m=p,b=c[(v+1)%c.length];return Ue(m,b)?null:[m,b]}).filter(Boolean),d=GX([o,l],h),g=bI([o,l],d);if(g&&d&&(u.transform=[["translate",g[0]+e,g[1]+n]],s)){const p=Math.atan((d[0][1]-d[1][1])/(d[0][0]-d[1][0]));u.transform.push(["rotate",p/Math.PI*180]),u.textAlign="center",(t==="right"||t==="left")&&(p>0?u.textBaseline=t==="right"?"bottom":"top":u.textBaseline=t==="right"?"top":"bottom")}return u}var oK=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class Bc extends Fc{constructor(t){super(Nn({style:Bc.defaultStyleProps},t))}getLabelStyle(t){if(!t.label||!t.d||t.d.length===0)return!1;const e=fn(this.getGraphicStyle(t),"label"),{maxWidth:n,offsetX:i,offsetY:a,autoRotate:s,placement:o,closeToPath:l}=e,u=oK(e,["maxWidth","offsetX","offsetY","autoRotate","placement","closeToPath"]),c=this.shapeMap.key,h=c==null?void 0:c.getRenderBounds();return Object.assign(sK(h,o,i,a,l,t.d,s),{wordWrapWidth:SI(h,n)},u)}getKeyStyle(t){return this.getGraphicStyle(t)}render(t,e){this.upsert("key",qr,this.getKeyStyle(t),e),this.upsert("label",Xs,this.getLabelStyle(t),e)}}Bc.defaultStyleProps={label:!0,labelPlacement:"bottom",labelCloseToPath:!0,labelAutoRotate:!0,labelOffsetX:0,labelOffsetY:0};function lK(r){const t=[],e=n=>{n!=null&&n.children.length&&n.children.forEach(i=>{t.push(i),e(i)})};return e(r),t}function uK(r){const t=[];let e=r.parentNode;for(;e;)t.push(e),e=e.parentNode;return t}let Kx=class extends Lc{constructor(t){super(t),this.onMounted=()=>{this.handleRadius()},this.onAttrModified=()=>{this.handleRadius()},Ml=this,this.isMutationObserved=!0,this.addEventListener(Xt.MOUNTED,this.onMounted),this.addEventListener(Xt.ATTR_MODIFIED,this.onAttrModified)}handleRadius(){const{radius:t,clipPath:e,width:n=0,height:i=0}=this.attributes;if(t&&n&&i){const[a,s]=this.getBounds().min,o={x:a,y:s,radius:t,width:n,height:i};if(e)Object.assign(this.parsedStyle.clipPath.style,o);else{const l=new Sn({style:o});this.style.clipPath=l}}else e&&(this.style.clipPath=null)}};const Lw=new WeakMap;let Ml=null;const Zx=r=>{if(Ml&&uK(Ml).includes(r)){const t=Lw.get(r);t?t.includes(Ml)||t.push(Ml):Lw.set(r,[Ml])}},Jx=r=>{const t=Lw.get(r);t&&t.forEach(e=>e.handleRadius())};class kI extends Fc{constructor(t){super(t)}isImage(){const{src:t}=this.attributes;return!!t}getIconStyle(t=this.attributes){const{width:e=0,height:n=0}=t,i=this.getGraphicStyle(t);return this.isImage()?Object.assign({x:-e/2,y:-n/2},i):Object.assign({textBaseline:"middle",textAlign:"center"},i)}render(t=this.attributes,e=this){this.upsert("icon",this.isImage()?Kx:Hs,this.getIconStyle(t),e)}}class TI extends Fc{get context(){return this.config.context}get parsedAttributes(){return this.attributes}onframe(){}animate(t,e){const n=super.animate(t,e);return n&&(n.onframe=()=>this.onframe(),n.finished.then(()=>this.onframe())),n}}var md=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class vi extends TI{constructor(t){super(Nn({style:vi.defaultStyleProps},t)),this.type="node"}getSize(t=this.attributes){const{size:e}=t;return Hr(e)}getKeyStyle(t){const e=this.getGraphicStyle(t);return Object.assign(xI(e,["label","halo","icon","badge","port"]))}getLabelStyle(t){if(t.label===!1||!t.labelText)return!1;const e=fn(this.getGraphicStyle(t),"label"),{placement:n,maxWidth:i,offsetX:a,offsetY:s}=e,o=md(e,["placement","maxWidth","offsetX","offsetY"]),l=this.getShape("key").getLocalBounds();return Object.assign(nk(l,n,a,s),{wordWrapWidth:SI(l,i)},o)}getHaloStyle(t){if(t.halo===!1)return!1;const e=this.getKeyStyle(t),{fill:n}=e,i=md(e,["fill"]),a=fn(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign(Object.assign({},i),{stroke:n}),a)}getIconStyle(t){if(t.icon===!1||!t.iconText&&!t.iconSrc)return!1;const e=fn(this.getGraphicStyle(t),"icon");return Object.assign(QX(t.size,e),e)}getBadgesStyle(t){var e;const n=Rw(this.shapeMap,"badge-"),i={};if(Object.keys(n).forEach(h=>{i[h]=!1}),t.badge===!1||!(!((e=t.badges)===null||e===void 0)&&e.length))return i;const{badges:a=[],badgePalette:s,opacity:o=1}=t,l=md(t,["badges","badgePalette","opacity"]),u=EI(s),c=fn(this.getGraphicStyle(l),"badge");return a.forEach((h,d)=>{i[d]=Object.assign(Object.assign({backgroundFill:u?u[d%(u==null?void 0:u.length)]:void 0,opacity:o},c),this.getBadgeStyle(h))}),i}getBadgeStyle(t){const e=this.getShape("key"),{placement:n="top",offsetX:i,offsetY:a}=t,s=md(t,["placement","offsetX","offsetY"]),o=nk(e.getLocalBounds(),n,i,a,!0);return Object.assign(Object.assign({},o),s)}getPortsStyle(t){var e;const n=this.getPorts(),i={};if(Object.keys(n).forEach(o=>{i[o]=!1}),t.port===!1||!(!((e=t.ports)===null||e===void 0)&&e.length))return i;const a=fn(this.getGraphicStyle(t),"port"),{ports:s=[]}=t;return s.forEach((o,l)=>{const u=o.key||l,c=Object.assign(Object.assign({},a),o);if(YI(c))i[u]=!1;else{const[h,d]=this.getPortXY(t,o);i[u]=Object.assign({transform:[["translate",h,d]]},c)}}),i}getPortXY(t,e){const{placement:n="left"}=e,i=this.getShape("key");return rE(cK(this.context,i),n)}getPorts(){return Rw(this.shapeMap,"port-")}getCenter(){return this.getShape("key").getBounds().center}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return qX(t,n,e)}drawHaloShape(t,e){const n=this.getHaloStyle(t),i=this.getShape("key");this.upsert("halo",i.constructor,n,e)}drawIconShape(t,e){const n=this.getIconStyle(t);this.upsert("icon",kI,n,e),Zx(this)}drawBadgeShapes(t,e){const n=this.getBadgesStyle(t);Object.keys(n).forEach(i=>{const a=n[i];this.upsert(`badge-${i}`,za,a,e)})}drawPortShapes(t,e){const n=this.getPortsStyle(t);Object.keys(n).forEach(i=>{const a=n[i],s=`port-${i}`;this.upsert(s,Ha,a,e)})}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",Xs,n,e)}_drawKeyShape(t,e){return this.drawKeyShape(t,e)}render(t=this.parsedAttributes,e=this){this._drawKeyShape(t,e),this.getShape("key")&&(this.drawHaloShape(t,e),this.drawIconShape(t,e),this.drawBadgeShapes(t,e),this.drawLabelShape(t,e),this.drawPortShapes(t,e))}update(t){super.update(t),t&&("x"in t||"y"in t||"z"in t)&&Jx(this)}onframe(){this.drawBadgeShapes(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this)}}vi.defaultStyleProps={x:0,y:0,size:32,droppable:!0,draggable:!0,port:!0,ports:[],portZIndex:2,portLinkToCenter:!1,badge:!0,badges:[],badgeZIndex:3,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloStrokeOpacity:.25,haloPointerEvents:"none",haloZIndex:-1,icon:!0,iconZIndex:1,label:!0,labelIsBillboard:!0,labelMaxWidth:"200%",labelPlacement:"bottom",labelWordWrap:!1,labelZIndex:0};function cK(r,t){if(!r)return t.getLocalBounds();const e=r.canvas.getLayer(),n=t.cloneNode();Do(n,"hidden"),e.appendChild(n);const i=n.getLocalBounds();return n.destroy(),i}let zc=class OI extends vi{constructor(t){super(Nn({style:OI.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",Ha,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t);return Object.assign(Object.assign({},e),{r:Math.min(...this.getSize(t))/2})}getIconStyle(t){const e=super.getIconStyle(t),{r:n}=this.getShape("key").attributes,i=n*2*qa;return e?Object.assign({width:i,height:i},e):!1}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return hg(t,n,e)}};zc.defaultStyleProps={size:32};class fg extends vi{constructor(t){super(t)}get parsedAttributes(){return this.attributes}drawKeyShape(t,e){return this.upsert("key",Go,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t);return Object.assign(Object.assign({},e),{points:this.getPoints(t)})}getIntersectPoint(t,e=!1){var n,i;const{points:a}=this.getShape("key").attributes,s=[+(((n=this.attributes)===null||n===void 0?void 0:n.x)||0),+(((i=this.attributes)===null||i===void 0?void 0:i.y)||0)];return yI(t,s,a,!0,e).point}}class hK extends fg{constructor(t){super(t)}getPoints(t){const[e,n]=this.getSize(t);return YZ(e,n)}}var dK=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class gg extends zc{constructor(t){super(Nn({style:gg.defaultStyleProps},t))}parseOuterR(){const{size:t}=this.parsedAttributes;return Math.min(...Hr(t))/2}parseInnerR(){const{innerR:t}=this.parsedAttributes;return oe(t)?parseInt(t)/100*this.parseOuterR():t}drawDonutShape(t,e){const{donuts:n}=t;if(!(n!=null&&n.length))return;const i=n.map(h=>yt(h)?{value:h}:h),a=fn(this.getGraphicStyle(t),"donut"),s=EI(t.donutPalette);if(!s)return;const o=i.reduce((h,d)=>{var g;return h+((g=d.value)!==null&&g!==void 0?g:0)},0),l=this.parseOuterR(),u=this.parseInnerR();let c=0;i.forEach((h,d)=>{const{value:g=0,color:p=s[d%s.length]}=h,v=dK(h,["value","color"]),m=(o===0?1/i.length:g/o)*360;this.upsert(`round${d}`,qr,Object.assign(Object.assign(Object.assign({},a),{d:pK(l,u,c,c+m),fill:p}),v),e),c+=m})}render(t,e=this){super.render(t,e),this.drawDonutShape(t,e)}}gg.defaultStyleProps={innerR:"50%",donuts:[],donutPalette:"tableau"};const yd=(r,t,e,n)=>[r+Math.sin(n)*e,t-Math.cos(n)*e],fK=(r,t,e,n)=>n<=0||e<=n?[["M",r-e,t],["A",e,e,0,1,1,r+e,t],["A",e,e,0,1,1,r-e,t],["Z"]]:[["M",r-e,t],["A",e,e,0,1,1,r+e,t],["A",e,e,0,1,1,r-e,t],["Z"],["M",r+n,t],["A",n,n,0,1,0,r-n,t],["A",n,n,0,1,0,r+n,t],["Z"]],gK=(r,t,e,n,i,a)=>{const[s,o]=[i/360*2*Math.PI,a/360*2*Math.PI],l=[yd(r,t,n,s),yd(r,t,e,s),yd(r,t,e,o),yd(r,t,n,o)],u=o-s>Math.PI?1:0;return[["M",l[0][0],l[0][1]],["L",l[1][0],l[1][1]],["A",e,e,0,u,1,l[2][0],l[2][1]],["L",l[3][0],l[3][1]],["A",n,n,0,u,0,l[0][0],l[0][1]],["Z"]]},pK=(r=0,t=0,e,n)=>{const[i,a]=[0,0];return Math.abs(e-n)%360<1e-6?fK(i,a,r,t):gK(i,a,r,t,e,n)};class pg extends vi{constructor(t){super(Nn({style:pg.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",Nc,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,i]=this.getSize(t);return Object.assign(Object.assign({},e),{rx:n/2,ry:i/2})}getIconStyle(t){const e=super.getIconStyle(t),{rx:n,ry:i}=this.getShape("key").attributes,a=Math.min(+n,+i)*2*qa;return e?Object.assign({width:a,height:a},e):!1}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return hg(t,n,e)}}pg.defaultStyleProps={size:[45,35]};class vK extends fg{constructor(t){super(t)}getOuterR(t){return t.outerR||Math.min(...this.getSize(t))/2}getPoints(t){return ZZ(this.getOuterR(t))}getIconStyle(t){const e=super.getIconStyle(t),n=this.getOuterR(t)*qa;return e?Object.assign({width:n,height:n},e):!1}}/*!
- * @antv/g-plugin-canvas-path-generator
- * @description A G plugin of path generator with Canvas2D API
- * @version 2.1.16
- * @date 1/23/2025, 8:32:57 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */function mK(r,t){var e=t.cx,n=e===void 0?0:e,i=t.cy,a=i===void 0?0:i,s=t.r;r.arc(n,a,s,0,Math.PI*2,!1)}function yK(r,t){var e=t.cx,n=e===void 0?0:e,i=t.cy,a=i===void 0?0:i,s=t.rx,o=t.ry;if(r.ellipse)r.ellipse(n,a,s,o,0,0,Math.PI*2,!1);else{var l=s>o?s:o,u=s>o?1:s/o,c=s>o?o/s:1;r.save(),r.scale(u,c),r.arc(n,a,l,0,Math.PI*2)}}function bK(r,t){var e=t.x1,n=t.y1,i=t.x2,a=t.y2,s=t.markerStart,o=t.markerEnd,l=t.markerStartOffset,u=t.markerEndOffset,c=0,h=0,d=0,g=0,p=0,v,m;s&&se(s)&&l&&(v=i-e,m=a-n,p=Math.atan2(m,v),c=Math.cos(p)*(l||0),h=Math.sin(p)*(l||0)),o&&se(o)&&u&&(v=e-i,m=n-a,p=Math.atan2(m,v),d=Math.cos(p)*(u||0),g=Math.sin(p)*(u||0)),r.moveTo(e+c,n+h),r.lineTo(i+d,a+g)}function wK(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.d,o=s.absolutePath,l=s.segments,u=0,c=0,h=0,d=0,g=0,p,v;if(e&&se(e)&&i){var m=e.parentNode.getStartTangent(),b=Rt(m,2),w=b[0],x=b[1];p=w[0]-x[0],v=w[1]-x[1],g=Math.atan2(v,p),u=Math.cos(g)*(i||0),c=Math.sin(g)*(i||0)}if(n&&se(n)&&a){var _=n.parentNode.getEndTangent(),S=Rt(_,2),M=S[0],k=S[1];p=M[0]-k[0],v=M[1]-k[1],g=Math.atan2(v,p),h=Math.cos(g)*(a||0),d=Math.sin(g)*(a||0)}for(var T=0;T<o.length;T++){var P=o[T],O=P[0],A=o[T+1],R=T===0&&(u!==0||c!==0),L=(T===o.length-1||A&&(A[0]==="M"||A[0]==="Z"))&&h!==0&&d!==0,q=R?[u,c]:[0,0],j=Rt(q,2),$=j[0],B=j[1],F=L?[h,d]:[0,0],V=Rt(F,2),X=V[0],K=V[1];switch(O){case"M":r.moveTo(P[1]+$,P[2]+B);break;case"L":r.lineTo(P[1]+X,P[2]+K);break;case"Q":r.quadraticCurveTo(P[1],P[2],P[3]+X,P[4]+K);break;case"C":r.bezierCurveTo(P[1],P[2],P[3],P[4],P[5]+X,P[6]+K);break;case"A":{var dt=l[T].arcParams,ct=dt.cx,ht=dt.cy,lt=dt.rx,pt=dt.ry,wt=dt.startAngle,Bt=dt.endAngle,Ut=dt.xRotation,Fe=dt.sweepFlag;if(r.ellipse)r.ellipse(ct,ht,lt,pt,Ut,wt,Bt,!!(1-Fe));else{var Gn=lt>pt?lt:pt,on=lt>pt?1:lt/pt,dr=lt>pt?pt/lt:1;r.translate(ct,ht),r.rotate(Ut),r.scale(on,dr),r.arc(0,0,Gn,wt,Bt,!!(1-Fe)),r.scale(1/on,1/dr),r.rotate(-Ut),r.translate(-ct,-ht)}L&&r.lineTo(P[6]+h,P[7]+d);break}case"Z":r.closePath();break}}}function xK(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.points.points,o=s.length,l=s[0][0],u=s[0][1],c=s[o-1][0],h=s[o-1][1],d=0,g=0,p=0,v=0,m=0,b,w;e&&se(e)&&i&&(b=s[1][0]-s[0][0],w=s[1][1]-s[0][1],m=Math.atan2(w,b),d=Math.cos(m)*(i||0),g=Math.sin(m)*(i||0)),n&&se(n)&&a&&(b=s[o-1][0]-s[0][0],w=s[o-1][1]-s[0][1],m=Math.atan2(w,b),p=Math.cos(m)*(a||0),v=Math.sin(m)*(a||0)),r.moveTo(l+(d||p),u+(g||v));for(var x=1;x<o-1;x++){var _=s[x];r.lineTo(_[0],_[1])}r.lineTo(c,h)}function EK(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.points.points,o=s.length,l=s[0][0],u=s[0][1],c=s[o-1][0],h=s[o-1][1],d=0,g=0,p=0,v=0,m=0,b,w;e&&se(e)&&i&&(b=s[1][0]-s[0][0],w=s[1][1]-s[0][1],m=Math.atan2(w,b),d=Math.cos(m)*(i||0),g=Math.sin(m)*(i||0)),n&&se(n)&&a&&(b=s[o-2][0]-s[o-1][0],w=s[o-2][1]-s[o-1][1],m=Math.atan2(w,b),p=Math.cos(m)*(a||0),v=Math.sin(m)*(a||0)),r.moveTo(l+d,u+g);for(var x=1;x<o-1;x++){var _=s[x];r.lineTo(_[0],_[1])}r.lineTo(c+p,h+v)}function _K(r,t){var e=t.x,n=e===void 0?0:e,i=t.y,a=i===void 0?0:i,s=t.radius,o=t.width,l=t.height,u=o,c=l,h=s&&s.some(function(S){return S!==0});if(!h)r.rect(n,a,u,c);else{var d=o>0?1:-1,g=l>0?1:-1,p=d+g===0,v=s.map(function(S){return He(S,0,Math.min(Math.abs(u)/2,Math.abs(c)/2))}),m=Rt(v,4),b=m[0],w=m[1],x=m[2],_=m[3];r.moveTo(d*b+n,a),r.lineTo(u-d*w+n,a),w!==0&&r.arc(u-d*w+n,g*w+a,w,-g*Math.PI/2,d>0?0:Math.PI,p),r.lineTo(u+n,c-g*x+a),x!==0&&r.arc(u-d*x+n,c-g*x+a,x,d>0?0:Math.PI,g>0?Math.PI/2:1.5*Math.PI,p),r.lineTo(d*_+n,c+a),_!==0&&r.arc(d*_+n,c-g*_+a,_,g>0?Math.PI/2:-Math.PI/2,d>0?Math.PI:0,p),r.lineTo(n,g*b+a),b!==0&&r.arc(d*b+n,g*b+a,b,d>0?Math.PI:0,g>0?Math.PI*1.5:Math.PI/2,p)}}var SK=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.name="canvas-path-generator",e}return jt(t,r),it(t,[{key:"init",value:function(){var n,i=(n={},bt(bt(bt(bt(bt(bt(bt(bt(bt(bt(n,Q.CIRCLE,mK),Q.ELLIPSE,yK),Q.RECT,_K),Q.LINE,bK),Q.POLYLINE,EK),Q.POLYGON,xK),Q.PATH,wK),Q.TEXT,void 0),Q.GROUP,void 0),Q.IMAGE,void 0),bt(bt(bt(n,Q.HTML,void 0),Q.MESH,void 0),Q.FRAGMENT,void 0));this.context.pathGeneratorFactory=i}},{key:"destroy",value:function(){delete this.context.pathGeneratorFactory}}])}(Vs);/*!
- * @antv/g-plugin-canvas-picker
- * @description A G plugin for picking in canvas
- * @version 2.1.18
- * @date 1/23/2025, 8:35:03 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var MK=Qt(),kK=Qt(),TK=Qt(),OK=Se(),CI=function(){function r(){var t=this;at(this,r),this.isHit=function(e,n,i,a){var s=t.context.pointInPathPickerFactory[e.nodeName];if(s){var o=Zi(OK,i),l=Qn(kK,Kn(TK,n[0],n[1],0),o);if(s(e,new Bn(l[0],l[1]),a,t.isPointInPath,t.context,t.runtime))return!0}return!1},this.isPointInPath=function(e,n){var i=t.runtime.offscreenCanvasCreator.getOrCreateContext(t.context.config.offscreenCanvas),a=t.context.pathGeneratorFactory[e.nodeName];return a&&(i.beginPath(),a(i,e.parsedStyle),i.closePath()),i.isPointInPath(n.x,n.y)}}return it(r,[{key:"apply",value:function(e,n){var i,a=this,s=e.renderingService,o=e.renderingContext;this.context=e,this.runtime=n;var l=(i=o.root)===null||i===void 0?void 0:i.ownerDocument;s.hooks.pick.tapPromise(r.tag,function(){var u=Fs($n().mark(function c(h){return $n().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return g.abrupt("return",a.pick(l,h));case 1:case"end":return g.stop()}},c)}));return function(c){return u.apply(this,arguments)}}()),s.hooks.pickSync.tap(r.tag,function(u){return a.pick(l,u)})}},{key:"pick",value:function(e,n){var i=n.topmost,a=n.position,s=a.x,o=a.y,l=Kn(MK,s,o,0),u=e.elementsFromBBox(l[0],l[1],l[0],l[1]),c=[],h=vo(u),d;try{for(h.s();!(d=h.n()).done;){var g=d.value,p=g.getWorldTransform(),v=this.isHit(g,l,p,!1);if(v){var m=PL(g);if(m){var b=m.parsedStyle.clipPath,w=this.isHit(b,l,b.getWorldTransform(),!0);if(w){if(i)return n.picked=[g],n;c.push(g)}}else{if(i)return n.picked=[g],n;c.push(g)}}}}catch(x){h.e(x)}finally{h.f()}return n.picked=c,n}}])}();CI.tag="CanvasPicker";function CK(r,t,e){var n=r.parsedStyle,i=n.cx,a=i===void 0?0:i,s=n.cy,o=s===void 0?0:s,l=n.r,u=n.fill,c=n.stroke,h=n.lineWidth,d=h===void 0?1:h,g=n.increasedLineWidthForHitTesting,p=g===void 0?0:g,v=n.pointerEvents,m=v===void 0?"auto":v,b=(d+p)/2,w=Fa(a,o,t.x,t.y),x=Wo(m,u,c),_=Rt(x,2),S=_[0],M=_[1];return S&&M||e?w<=l+b:S?w<=l:M?w>=l-b&&w<=l+b:!1}function bd(r,t,e,n){return r/(e*e)+t/(n*n)}function AK(r,t,e){var n=r.parsedStyle,i=n.cx,a=i===void 0?0:i,s=n.cy,o=s===void 0?0:s,l=n.rx,u=n.ry,c=n.fill,h=n.stroke,d=n.lineWidth,g=d===void 0?1:d,p=n.increasedLineWidthForHitTesting,v=p===void 0?0:p,m=n.pointerEvents,b=m===void 0?"auto":m,w=t.x,x=t.y,_=Wo(b,c,h),S=Rt(_,2),M=S[0],k=S[1],T=(g+v)/2,P=(w-a)*(w-a),O=(x-o)*(x-o);return M&&k||e?bd(P,O,l+T,u+T)<=1:M?bd(P,O,l,u)<=1:k?bd(P,O,l-T,u-T)>=1&&bd(P,O,l+T,u+T)<=1:!1}function wo(r,t,e,n,i,a){return i>=r&&i<=r+e&&a>=t&&a<=t+n}function PK(r,t,e,n,i,a,s){var o=i/2;return wo(r-o,t-o,e,i,a,s)||wo(r+e-o,t-o,i,n,a,s)||wo(r+o,t+n-o,e,i,a,s)||wo(r-o,t+o,i,n,a,s)}function wd(r,t,e,n,i,a,s,o){var l=(Math.atan2(o-t,s-r)+Math.PI*2)%(Math.PI*2),u={x:r+e*Math.cos(l),y:t+e*Math.sin(l)};return Fa(u.x,u.y,s,o)<=a/2}function ks(r,t,e,n,i,a,s){var o=Math.min(r,e),l=Math.max(r,e),u=Math.min(t,n),c=Math.max(t,n),h=i/2;return a>=o-h&&a<=l+h&&s>=u-h&&s<=c+h?xG(r,t,e,n,a,s)<=i/2:!1}function AI(r,t,e,n,i){var a=r.length;if(a<2)return!1;for(var s=0;s<a-1;s++){var o=r[s][0],l=r[s][1],u=r[s+1][0],c=r[s+1][1];if(ks(o,l,u,c,t,e,n))return!0}if(i){var h=r[0],d=r[a-1];if(ks(h[0],h[1],d[0],d[1],t,e,n))return!0}return!1}var NK=1e-6;function Dv(r){return Math.abs(r)<NK?0:r<0?-1:1}function RK(r,t,e){return(e[0]-r[0])*(t[1]-r[1])===(t[0]-r[0])*(e[1]-r[1])&&Math.min(r[0],t[0])<=e[0]&&e[0]<=Math.max(r[0],t[0])&&Math.min(r[1],t[1])<=e[1]&&e[1]<=Math.max(r[1],t[1])}function PI(r,t,e){var n=!1,i=r.length;if(i<=2)return!1;for(var a=0;a<i;a++){var s=r[a],o=r[(a+1)%i];if(RK(s,o,[t,e]))return!0;Dv(s[1]-e)>0!=Dv(o[1]-e)>0&&Dv(t-(e-s[1])*(s[0]-o[0])/(s[1]-o[1])-s[0])<0&&(n=!n)}return n}function jM(r,t,e){for(var n=!1,i=0;i<r.length;i++){var a=r[i];if(n=PI(a,t,e),n)break}return n}function LK(r,t,e){var n=r.parsedStyle,i=n.x1,a=n.y1,s=n.x2,o=n.y2,l=n.lineWidth,u=l===void 0?1:l,c=n.increasedLineWidthForHitTesting,h=c===void 0?0:c,d=n.pointerEvents,g=d===void 0?"auto":d,p=n.fill,v=n.stroke,m=Wo(g,p,v),b=Rt(m,2),w=b[1];return!w&&!e||!u?!1:ks(i,a,s,o,u+h,t.x,t.y)}function IK(r,t,e,n,i){for(var a=!1,s=t/2,o=0;o<r.length;o++){var l=r[o],u=l.currentPoint,c=l.params,h=l.prePoint,d=l.box;if(!(d&&!wo(d.x-s,d.y-s,d.width+t,d.height+t,e,n)))switch(l.command){case"L":case"Z":if(a=ks(h[0],h[1],u[0],u[1],t,e,n),a)return!0;break;case"Q":var g=OG(h[0],h[1],c[1],c[2],c[3],c[4],e,n);if(a=g<=t/2,a)return!0;break;case"C":var p=G3(h[0],h[1],c[1],c[2],c[3],c[4],c[5],c[6],e,n,i);if(a=p<=t/2,a)return!0;break;case"A":l.cubicParams||(l.cubicParams=Cx(h[0],h[1],c[1],c[2],c[3],c[4],c[5],c[6],c[7],void 0));for(var v=l.cubicParams,m=h,b=0;b<v.length;b+=6){var w=G3(m[0],m[1],v[b],v[b+1],v[b+2],v[b+3],v[b+4],v[b+5],e,n,i);if(m=[v[b+4],v[b+5]],a=w<=t/2,a)return!0}break}}return a}function DK(r,t,e,n,i,a){var s=r.parsedStyle,o=s.lineWidth,l=o===void 0?1:o,u=s.increasedLineWidthForHitTesting,c=u===void 0?0:u,h=s.stroke,d=s.fill,g=s.d,p=s.pointerEvents,v=p===void 0?"auto":p,m=g.segments,b=g.hasArc,w=g.polylines,x=g.polygons,_=Wo(v,(x==null?void 0:x.length)&&d,h),S=Rt(_,2),M=S[0],k=S[1],T=_w(r),P=!1;return M||e?(b?P=n(r,t):P=jM(x,t.x,t.y)||jM(w,t.x,t.y),P):((k||e)&&(P=IK(m,l+c,t.x,t.y,T)),P)}function FK(r,t,e){var n=r.parsedStyle,i=n.stroke,a=n.fill,s=n.lineWidth,o=s===void 0?1:s,l=n.increasedLineWidthForHitTesting,u=l===void 0?0:l,c=n.points,h=n.pointerEvents,d=h===void 0?"auto":h,g=Wo(d,a,i),p=Rt(g,2),v=p[0],m=p[1],b=!1;return(m||e)&&(b=AI(c.points,o+u,t.x,t.y,!0)),!b&&(v||e)&&(b=PI(c.points,t.x,t.y)),b}function BK(r,t,e){var n=r.parsedStyle,i=n.lineWidth,a=i===void 0?1:i,s=n.increasedLineWidthForHitTesting,o=s===void 0?0:s,l=n.points,u=n.pointerEvents,c=u===void 0?"auto":u,h=n.fill,d=n.stroke,g=Wo(c,h,d),p=Rt(g,2),v=p[1];return!v&&!e||!a?!1:AI(l.points,a+o,t.x,t.y,!1)}function zK(r,t,e,n,i){var a=r.parsedStyle,s=a.radius,o=a.fill,l=a.stroke,u=a.lineWidth,c=u===void 0?1:u,h=a.increasedLineWidthForHitTesting,d=h===void 0?0:h,g=a.x,p=g===void 0?0:g,v=a.y,m=v===void 0?0:v,b=a.width,w=a.height,x=a.pointerEvents,_=x===void 0?"auto":x,S=Wo(_,o,l),M=Rt(S,2),k=M[0],T=M[1],P=s&&s.some(function(L){return L!==0}),O=c+d;if(P){var R=!1;return(T||e)&&(R=$K(p,m,b,w,s.map(function(L){return He(L,0,Math.min(Math.abs(b)/2,Math.abs(w)/2))}),O,t.x,t.y)),!R&&(k||e)&&(R=n(r,t)),R}else{var A=O/2;if(k&&T||e)return wo(p-A,m-A,b+A,w+A,t.x,t.y);if(k)return wo(p,m,b,w,t.x,t.y);if(T)return PK(p,m,b,w,O,t.x,t.y)}return!1}function $K(r,t,e,n,i,a,s,o){var l=Rt(i,4),u=l[0],c=l[1],h=l[2],d=l[3];return ks(r+u,t,r+e-c,t,a,s,o)||ks(r+e,t+c,r+e,t+n-h,a,s,o)||ks(r+e-h,t+n,r+d,t+n,a,s,o)||ks(r,t+n-d,r,t+u,a,s,o)||wd(r+e-c,t+c,c,1.5*Math.PI,2*Math.PI,a,s,o)||wd(r+e-h,t+n-h,h,0,.5*Math.PI,a,s,o)||wd(r+d,t+n-d,d,.5*Math.PI,Math.PI,a,s,o)||wd(r+u,t+u,u,Math.PI,1.5*Math.PI,a,s,o)}function jK(r,t,e,n,i,a){var s=r.parsedStyle,o=s.pointerEvents,l=o===void 0?"auto":o,u=s.x,c=u===void 0?0:u,h=s.y,d=h===void 0?0:h,g=s.width,p=s.height;if(l==="non-transparent-pixel"){var v=i.config.offscreenCanvas,m=a.offscreenCanvasCreator.getOrCreateCanvas(v),b=a.offscreenCanvasCreator.getOrCreateContext(v,{willReadFrequently:!0});m.width=g,m.height=p,i.defaultStyleRendererFactory[Q.IMAGE].render(b,Ft(Ft({},r.parsedStyle),{},{x:0,y:0}),r,void 0,void 0,void 0);var w=b.getImageData(t.x-c,t.y-d,1,1).data;return w.every(function(x){return x!==0})}return!0}function qK(r,t,e,n){var i=r.getGeometryBounds();return t.x>=i.min[0]&&t.y>=i.min[1]&&t.x<=i.max[0]&&t.y<=i.max[1]}var WK=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.name="canvas-picker",e}return jt(t,r),it(t,[{key:"init",value:function(){var n,i=(n={},bt(bt(bt(bt(bt(bt(bt(bt(bt(bt(n,Q.CIRCLE,CK),Q.ELLIPSE,AK),Q.RECT,zK),Q.LINE,LK),Q.POLYLINE,BK),Q.POLYGON,FK),Q.PATH,DK),Q.TEXT,qK),Q.GROUP,null),Q.IMAGE,jK),bt(bt(n,Q.HTML,null),Q.MESH,null));this.context.pointInPathPickerFactory=i,this.addRenderingPlugin(new CI)}},{key:"destroy",value:function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()}}])}(Vs);function Ui(r,t){if(!{}.hasOwnProperty.call(r,t))throw new TypeError("attempted to use private field on non-instance");return r}var GK=0;function VK(r){return"__private_"+GK+++"_"+r}/*!
- * @antv/g-plugin-image-loader
- * @description A G plugin for loading image
- * @version 2.1.18
- * @date 1/23/2025, 8:33:24 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var HK=function(){function r(){at(this,r),this.cacheStore=new Map}return it(r,[{key:"onRefAdded",value:function(e){}},{key:"has",value:function(e){return this.cacheStore.has(e)}},{key:"put",value:function(e,n,i){return this.cacheStore.has(e)?!1:(this.cacheStore.set(e,{value:n,counter:new Set([i])}),this.onRefAdded(i),!0)}},{key:"get",value:function(e,n){var i=this.cacheStore.get(e);return i?(i.counter.has(n)||(i.counter.add(n),this.onRefAdded(n)),i.value):null}},{key:"update",value:function(e,n,i){var a=this.cacheStore.get(e);return a?(a.value=Ft(Ft({},a.value),n),a.counter.has(i)||(a.counter.add(i),this.onRefAdded(i)),!0):!1}},{key:"release",value:function(e,n){var i=this.cacheStore.get(e);return i?(i.counter.delete(n),i.counter.size<=0&&this.cacheStore.delete(e),!0):!1}},{key:"releaseRef",value:function(e){var n=this;Array.from(this.cacheStore.keys()).forEach(function(i){n.release(i,e)})}},{key:"getSize",value:function(){return this.cacheStore.size}},{key:"clear",value:function(){this.cacheStore.clear()}}])}(),Fv=[],Bv=[],Iw=function(){function r(){at(this,r)}return it(r,null,[{key:"stop",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:r.api;r.rafId&&(e.cancelAnimationFrame(r.rafId),r.rafId=null)}},{key:"executeTask",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:r.api;Fv.length<=0&&Bv.length<=0||(Bv.forEach(function(n){return n()}),Bv=Fv.splice(0,r.TASK_NUM_PER_FRAME),r.rafId=e.requestAnimationFrame(function(){r.executeTask(e)}))}},{key:"sliceImage",value:function(e,n,i,a){for(var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:r.api,l=e.naturalWidth||e.width,u=e.naturalHeight||e.height,c=n-s,h=i-s,d=Math.ceil(l/c),g=Math.ceil(u/h),p={tileSize:[n,i],gridSize:[g,d],tiles:Array(g).fill(null).map(function(){return Array(d).fill(null)})},v=function(w){for(var x=function(M){Fv.push(function(){var k=M*c,T=w*h,P=[Math.min(n,l-k),Math.min(i,u-T)],O=P[0],A=P[1],R=o.createCanvas();R.width=n,R.height=i;var L=R.getContext("2d");L.drawImage(e,k,T,O,A,0,0,O,A),p.tiles[w][M]={x:k,y:T,tileX:M,tileY:w,data:R},a()})},_=0;_<d;_++)x(_)},m=0;m<g;m++)v(m);return r.stop(),r.executeTask(),p}}])}();Iw.TASK_NUM_PER_FRAME=10;var Dr=new HK;Dr.onRefAdded=function(t){var e=this;t.addEventListener(Xt.DESTROY,function(){e.releaseRef(t)},{once:!0})};var Qx=function(){function r(t,e){at(this,r),this.gradientCache={},this.patternCache={},this.context=t,this.runtime=e}return it(r,[{key:"getImageSync",value:function(e,n,i){var a=oe(e)?e:e.src;if(Dr.has(a)){var s=Dr.get(a,n);if(s.img.complete)return i==null||i(s),s}return this.getOrCreateImage(e,n).then(function(o){i==null||i(o)}).catch(function(){}),null}},{key:"getOrCreateImage",value:function(e,n){var i=this,a=oe(e)?e:e.src;if(!oe(e)&&!Dr.has(a)){var s={img:e,size:[e.naturalWidth||e.width,e.naturalHeight||e.height],tileSize:xd(e)};Dr.put(a,s,n)}if(Dr.has(a)){var o=Dr.get(a,n);return o.img.complete?Promise.resolve(o):new Promise(function(l,u){o.img.addEventListener("load",function(){o.size=[o.img.naturalWidth||o.img.width,o.img.naturalHeight||o.img.height],o.tileSize=xd(o.img),l(o)}),o.img.addEventListener("error",function(c){u(c)})})}return new Promise(function(l,u){var c=i.context.config.createImage();if(c){var h={img:c,size:[0,0],tileSize:xd(c)};Dr.put(a,h,n),c.onload=function(){h.size=[c.naturalWidth||c.width,c.naturalHeight||c.height],h.tileSize=xd(h.img),l(h)},c.onerror=function(d){u(d)},c.crossOrigin="Anonymous",c.src=a}})}},{key:"createDownSampledImage",value:function(){var t=Fs($n().mark(function n(i,a){var s,o,l,u,c,h,d,g,p,v,m,b,w,x;return $n().wrap(function(S){for(;;)switch(S.prev=S.next){case 0:return S.next=2,this.getOrCreateImage(i,a);case 2:if(s=S.sent,!(typeof s.downSamplingRate<"u")){S.next=5;break}return S.abrupt("return",s);case 5:if(o=this.context.config.enableLargeImageOptimization,l=typeof o=="boolean"?{}:o,u=l.maxDownSampledImageSize,c=u===void 0?2048:u,h=l.downSamplingRateThreshold,d=h===void 0?.5:h,g=this.runtime.globalThis.createImageBitmap,p=Rt(s.size,2),v=p[0],m=p[1],b=s.img,w=Math.min((c+c)/(v+m),Math.max(.01,Math.min(d,.5))),x=Ft(Ft({},s),{},{downSamplingRate:w}),Dr.update(s.img.src,x,a),!g){S.next=25;break}return S.prev=14,S.next=17,g(s.img,{resizeWidth:v*w,resizeHeight:m*w});case 17:b=S.sent,S.next=23;break;case 20:S.prev=20,S.t0=S.catch(14),w=1;case 23:S.next=26;break;case 25:w=1;case 26:return x=Ft(Ft({},this.getImageSync(i,a)),{},{downSampled:b,downSamplingRate:w}),Dr.update(s.img.src,x,a),S.abrupt("return",x);case 29:case"end":return S.stop()}},n,this,[[14,20]])}));function e(n,i){return t.apply(this,arguments)}return e}()},{key:"createImageTiles",value:function(){var t=Fs($n().mark(function n(i,a,s,o){var l,u,c,h,d;return $n().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,this.getOrCreateImage(i,o);case 2:return l=p.sent,u=o.ownerDocument.defaultView,c=u.requestAnimationFrame,h=u.cancelAnimationFrame,Iw.api={requestAnimationFrame:c,cancelAnimationFrame:h,createCanvas:function(){return Fx.createCanvas()}},d=Ft(Ft({},l),Iw.sliceImage(l.img,l.tileSize[0],l.tileSize[0],s)),Dr.update(l.img.src,d,o),p.abrupt("return",d);case 8:case"end":return p.stop()}},n,this)}));function e(n,i,a,s){return t.apply(this,arguments)}return e}()},{key:"releaseImage",value:function(e,n){Dr.release(oe(e)?e:e.src,n)}},{key:"releaseImageRef",value:function(e){Dr.releaseRef(e)}},{key:"getOrCreatePatternSync",value:function(e,n,i,a,s,o,l){var u=this.generatePatternKey(n);if(u&&this.patternCache[u])return this.patternCache[u];var c=n.image,h=n.repetition,d=n.transform,g,p=!1;if(oe(c)){var v=this.getImageSync(c,e,l);g=v==null?void 0:v.img}else a?(g=a,p=!0):g=c;var m=g&&i.createPattern(g,h);if(m){var b;d?b=DL(TL(d),new Pe({})):b=Bs(Se()),p&&PR(b,b,[1/s,1/s,1]),m.setTransform({a:b[0],b:b[1],c:b[4],d:b[5],e:b[12]+o[0],f:b[13]+o[1]})}return u&&m&&(this.patternCache[u]=m),m}},{key:"getOrCreateGradient",value:function(e,n){var i=this.generateGradientKey(e),a=e.type,s=e.steps,o=e.min,l=e.width,u=e.height,c=e.angle,h=e.cx,d=e.cy,g=e.size;if(this.gradientCache[i])return this.gradientCache[i];var p=null;if(a===_s.LinearGradient){var v=_V(o,l,u,c),m=v.x1,b=v.y1,w=v.x2,x=v.y2;p=n.createLinearGradient(m,b,w,x)}else if(a===_s.RadialGradient){var _=SV(o,l,u,h,d,g),S=_.x,M=_.y,k=_.r;p=n.createRadialGradient(S,M,0,S,M,k)}return p&&(s.forEach(function(T){var P=T.offset,O=T.color;if(P.unit===gt.kPercentage){var A;(A=p)===null||A===void 0||A.addColorStop(P.value/100,O.toString())}}),this.gradientCache[i]=p),this.gradientCache[i]}},{key:"generateGradientKey",value:function(e){var n=e.type,i=e.min,a=e.width,s=e.height,o=e.steps,l=e.angle,u=e.cx,c=e.cy,h=e.size;return"gradient-".concat(n,"-").concat((l==null?void 0:l.toString())||0,"-").concat((u==null?void 0:u.toString())||0,"-").concat((c==null?void 0:c.toString())||0,"-").concat((h==null?void 0:h.toString())||0,"-").concat(i[0],"-").concat(i[1],"-").concat(a,"-").concat(s,"-").concat(o.map(function(d){var g=d.offset,p=d.color;return"".concat(g).concat(p)}).join("-"))}},{key:"generatePatternKey",value:function(e){var n=e.image,i=e.repetition;if(oe(n))return"pattern-".concat(n,"-").concat(i);if(n.nodeName==="rect")return"pattern-".concat(n.entity,"-").concat(i)}}])}();Qx.isSupportTile=!!Fx.createCanvas();function xd(r){if(!r.complete)return[0,0];var t=r.naturalWidth||r.width,e=r.naturalHeight||r.height,n=256;return[256,512].forEach(function(i){var a=Math.ceil(e/i),s=Math.ceil(t/i);a*s<1e3&&(n=i)}),[n,n]}var NI=function(){function r(){at(this,r)}return it(r,[{key:"apply",value:function(e){var n=e.renderingService,i=e.renderingContext,a=e.imagePool,s=i.root.ownerDocument.defaultView,o=function(h,d,g){var p=h.parsedStyle,v=p.width,m=p.height;v&&!m?h.setAttribute("height",g/d*v):!v&&m&&h.setAttribute("width",d/g*m)},l=function(h){var d=h.target,g=d.nodeName,p=d.attributes;if(g===Q.IMAGE){var v=p.src,m=p.keepAspectRatio;a.getImageSync(v,d,function(b){var w=b.img,x=w.width,_=w.height;m&&o(d,x,_),d.renderable.dirty=!0,n.dirtify()})}},u=function(h){var d=h.target,g=h.attrName,p=h.prevValue,v=h.newValue;d.nodeName!==Q.IMAGE||g!=="src"||(p!==v&&a.releaseImage(p,d),oe(v)&&a.getOrCreateImage(v,d).then(function(m){var b=m.img,w=b.width,x=b.height;d.attributes.keepAspectRatio&&o(d,w,x),d.renderable.dirty=!0,n.dirtify()}).catch(function(){}))};n.hooks.init.tap(r.tag,function(){s.addEventListener(Xt.MOUNTED,l),s.addEventListener(Xt.ATTR_MODIFIED,u)}),n.hooks.destroy.tap(r.tag,function(){s.removeEventListener(Xt.MOUNTED,l),s.removeEventListener(Xt.ATTR_MODIFIED,u)})}}])}();NI.tag="LoadImage";var UK=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.name="image-loader",e}return jt(t,r),it(t,[{key:"init",value:function(n){this.context.imagePool=new Qx(this.context,n),this.addRenderingPlugin(new NI)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(Vs);/*!
- * @antv/g-plugin-canvas-renderer
- * @description A G plugin of renderer implementation with Canvas2D API
- * @version 2.2.18
- * @date 1/23/2025, 8:34:11 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var nn=VK("renderState"),RI=function(){function r(t){at(this,r),this.removedRBushNodeAABBs=[],this.renderQueue=[],Object.defineProperty(this,nn,{writable:!0,value:{restoreStack:[],prevObject:null,currentContext:new Map}}),this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=Se(),this.dprMatrix=Se(),this.tmpMat4=Se(),this.vec3a=Qt(),this.vec3b=Qt(),this.vec3c=Qt(),this.vec3d=Qt(),this.canvasRendererPluginOptions=t}return it(r,[{key:"apply",value:function(e,n){var i=this;this.context=e;var a=this.context,s=a.config,o=a.camera,l=a.renderingService,u=a.renderingContext,c=a.rBushRoot,h=a.pathGeneratorFactory,d=s.renderer.getConfig().enableRenderingOptimization;s.renderer.getConfig().enableDirtyCheck=!1,s.renderer.getConfig().enableDirtyRectangleRendering=!1,this.rBush=c,this.pathGeneratorFactory=h;var g=e.contextService,p=u.root.ownerDocument.defaultView,v=function(x){var _=x.target,S=_.rBushNode;S.aabb&&i.removedRBushNodeAABBs.push(S.aabb)},m=function(x){var _=x.target,S=_.rBushNode;S.aabb&&i.removedRBushNodeAABBs.push(S.aabb)};l.hooks.init.tap(r.tag,function(){p.addEventListener(Xt.UNMOUNTED,v),p.addEventListener(Xt.CULLED,m);var w=g.getDPR(),x=s.width,_=s.height,S=g.getContext();i.clearRect(S,0,0,x*w,_*w,s.background)}),l.hooks.destroy.tap(r.tag,function(){p.removeEventListener(Xt.UNMOUNTED,v),p.removeEventListener(Xt.CULLED,m),i.renderQueue=[],i.removedRBushNodeAABBs=[],Ui(i,nn)[nn]={restoreStack:[],prevObject:null,currentContext:null}}),l.hooks.beginFrame.tap(r.tag,function(){var w,x=g.getContext(),_=g.getDPR(),S=s.width,M=s.height,k=i.canvasRendererPluginOptions,T=k.dirtyObjectNumThreshold,P=k.dirtyObjectRatioThreshold,O=l.getStats(),A=O.total,R=O.rendered,L=R/A;i.clearFullScreen=i.clearFullScreenLastFrame||!((w=p.context.renderingPlugins[1])!==null&&w!==void 0&&w.isFirstTimeRenderingFinished)||l.disableDirtyRectangleRendering()||R>T&&L>P,x&&(typeof x.resetTransform=="function"?x.resetTransform():x.setTransform(1,0,0,1,0,0),i.clearFullScreen&&i.clearRect(x,0,0,S*_,M*_,s.background))});var b=function(x,_){for(var S=[x];S.length>0;){var M=S.pop();M.isVisible()&&!M.isCulled()&&(d?i.renderDisplayObjectOptimized(M,_,i.context,Ui(i,nn)[nn],n):i.renderDisplayObject(M,_,i.context,Ui(i,nn)[nn],n));for(var k=M.sortable.sorted||M.childNodes,T=k.length-1;T>=0;T--)S.push(k[T])}};l.hooks.endFrame.tap(r.tag,function(){if(u.root.childNodes.length===0){i.clearFullScreenLastFrame=!0;return}d=s.renderer.getConfig().enableRenderingOptimization,Ui(i,nn)[nn]={restoreStack:[],prevObject:null,currentContext:Ui(i,nn)[nn].currentContext},Ui(i,nn)[nn].currentContext.clear(),i.clearFullScreenLastFrame=!1;var w=g.getContext(),x=g.getDPR();if(po(i.dprMatrix,[x,x,1]),Jn(i.vpMatrix,i.dprMatrix,o.getOrthoMatrix()),i.clearFullScreen)d?(w.save(),b(u.root,w),w.restore()):b(u.root,w),i.removedRBushNodeAABBs=[];else{var _=i.safeMergeAABB.apply(i,[i.mergeDirtyAABBs(i.renderQueue)].concat(Te(i.removedRBushNodeAABBs.map(function(lt){var pt=lt.minX,wt=lt.minY,Bt=lt.maxX,Ut=lt.maxY,Fe=new Me;return Fe.setMinMax([pt,wt,0],[Bt,Ut,0]),Fe}))));if(i.removedRBushNodeAABBs=[],Me.isEmpty(_)){i.renderQueue=[];return}var S=i.convertAABB2Rect(_),M=S.x,k=S.y,T=S.width,P=S.height,O=Qn(i.vec3a,[M,k,0],i.vpMatrix),A=Qn(i.vec3b,[M+T,k,0],i.vpMatrix),R=Qn(i.vec3c,[M,k+P,0],i.vpMatrix),L=Qn(i.vec3d,[M+T,k+P,0],i.vpMatrix),q=Math.min(O[0],A[0],L[0],R[0]),j=Math.min(O[1],A[1],L[1],R[1]),$=Math.max(O[0],A[0],L[0],R[0]),B=Math.max(O[1],A[1],L[1],R[1]),F=Math.floor(q),V=Math.floor(j),X=Math.ceil($-q),K=Math.ceil(B-j);w.save(),i.clearRect(w,F,V,X,K,s.background),w.beginPath(),w.rect(F,V,X,K),w.clip(),w.setTransform(i.vpMatrix[0],i.vpMatrix[1],i.vpMatrix[4],i.vpMatrix[5],i.vpMatrix[12],i.vpMatrix[13]);var dt=s.renderer.getConfig(),ct=dt.enableDirtyRectangleRenderingDebug;ct&&p.dispatchEvent(new cn($r.DIRTY_RECTANGLE,{dirtyRect:{x:F,y:V,width:X,height:K}}));var ht=i.searchDirtyObjects(_);ht.sort(function(lt,pt){return lt.sortable.renderOrder-pt.sortable.renderOrder}).forEach(function(lt){lt&<.isVisible()&&!lt.isCulled()&&i.renderDisplayObject(lt,w,i.context,Ui(i,nn)[nn],n)}),w.restore(),i.renderQueue.forEach(function(lt){i.saveDirtyAABB(lt)}),i.renderQueue=[]}Ui(i,nn)[nn].restoreStack.forEach(function(){w.restore()}),Ui(i,nn)[nn].restoreStack=[]}),l.hooks.render.tap(r.tag,function(w){i.clearFullScreen||i.renderQueue.push(w)})}},{key:"clearRect",value:function(e,n,i,a,s,o){e.clearRect(n,i,a,s),o&&(e.fillStyle=o,e.fillRect(n,i,a,s))}},{key:"renderDisplayObjectOptimized",value:function(e,n,i,a,s){var o=e.nodeName,l=!1,u=!1,c=this.context.styleRendererFactory[o],h=this.pathGeneratorFactory[o],d=e.parsedStyle.clipPath;if(d){l=!a.prevObject||!aw(d.getWorldTransform(),a.prevObject.getWorldTransform()),l&&(this.applyWorldTransform(n,d),a.prevObject=null);var g=this.pathGeneratorFactory[d.nodeName];g&&(n.save(),u=!0,n.beginPath(),g(n,d.parsedStyle),n.closePath(),n.clip())}if(c){l=!a.prevObject||!aw(e.getWorldTransform(),a.prevObject.getWorldTransform()),l&&this.applyWorldTransform(n,e);var p=!a.prevObject;if(!p){var v=a.prevObject.nodeName;o===Q.TEXT?p=v!==Q.TEXT:o===Q.IMAGE?p=v!==Q.IMAGE:p=v===Q.TEXT||v===Q.IMAGE}c.applyStyleToContext(n,e,p,a),a.prevObject=e}h&&(n.beginPath(),h(n,e.parsedStyle),o!==Q.LINE&&o!==Q.PATH&&o!==Q.POLYLINE&&n.closePath()),c&&c.drawToContext(n,e,Ui(this,nn)[nn],this,s),u&&n.restore(),e.renderable.dirty=!1}},{key:"renderDisplayObject",value:function(e,n,i,a,s){var o=e.nodeName,l=a.restoreStack[a.restoreStack.length-1];l&&!(e.compareDocumentPosition(l)&$e.DOCUMENT_POSITION_CONTAINS)&&(n.restore(),a.restoreStack.pop());var u=this.context.styleRendererFactory[o],c=this.pathGeneratorFactory[o],h=e.parsedStyle.clipPath;if(h){this.applyWorldTransform(n,h);var d=this.pathGeneratorFactory[h.nodeName];d&&(n.save(),a.restoreStack.push(e),n.beginPath(),d(n,h.parsedStyle),n.closePath(),n.clip())}u&&(this.applyWorldTransform(n,e),n.save(),this.applyAttributesToContext(n,e)),c&&(n.beginPath(),c(n,e.parsedStyle),o!==Q.LINE&&o!==Q.PATH&&o!==Q.POLYLINE&&n.closePath()),u&&(u.render(n,e.parsedStyle,e,i,this,s),n.restore()),e.renderable.dirty=!1}},{key:"applyAttributesToContext",value:function(e,n){var i=n.parsedStyle,a=i.stroke,s=i.fill,o=i.opacity,l=i.lineDash,u=i.lineDashOffset;l&&e.setLineDash(l),kt(u)||(e.lineDashOffset=u),kt(o)||(e.globalAlpha*=o),!kt(a)&&!Array.isArray(a)&&!a.isNone&&(e.strokeStyle=n.attributes.stroke),!kt(s)&&!Array.isArray(s)&&!s.isNone&&(e.fillStyle=n.attributes.fill)}},{key:"convertAABB2Rect",value:function(e){var n=e.getMin(),i=e.getMax(),a=Math.floor(n[0]),s=Math.floor(n[1]),o=Math.ceil(i[0]),l=Math.ceil(i[1]),u=o-a,c=l-s;return{x:a,y:s,width:u,height:c}}},{key:"mergeDirtyAABBs",value:function(e){var n=new Me;return e.forEach(function(i){var a=i.getRenderBounds();n.add(a);var s=i.renderable.dirtyRenderBounds;s&&n.add(s)}),n}},{key:"searchDirtyObjects",value:function(e){var n=e.getMin(),i=Rt(n,2),a=i[0],s=i[1],o=e.getMax(),l=Rt(o,2),u=l[0],c=l[1],h=this.rBush.search({minX:a,minY:s,maxX:u,maxY:c});return h.map(function(d){var g=d.displayObject;return g})}},{key:"saveDirtyAABB",value:function(e){var n=e.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new Me);var i=e.getRenderBounds();i&&n.dirtyRenderBounds.update(i.center,i.halfExtents)}},{key:"applyWorldTransform",value:function(e,n,i){i?($l(this.tmpMat4,n.getLocalTransform()),Jn(this.tmpMat4,i,this.tmpMat4),Jn(this.tmpMat4,this.vpMatrix,this.tmpMat4)):($l(this.tmpMat4,n.getWorldTransform()),Jn(this.tmpMat4,this.vpMatrix,this.tmpMat4)),e.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])}},{key:"safeMergeAABB",value:function(){for(var e=new Me,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return i.forEach(function(s){e.add(s)}),e}}])}();RI.tag="CanvasRenderer";function Lf(r,t,e,n,i,a,s){var o,l;if(r.image.nodeName==="rect"){var u=r.image.parsedStyle,c=u.width,h=u.height;l=n.contextService.getDPR();var d=n.config.offscreenCanvas;o=a.offscreenCanvasCreator.getOrCreateCanvas(d),o.width=c*l,o.height=h*l;var g=a.offscreenCanvasCreator.getOrCreateContext(d),p={restoreStack:[],prevObject:null,currentContext:new Map};r.image.forEach(function(m){i.renderDisplayObject(m,g,n,p,a)}),p.restoreStack.forEach(function(){g.restore()})}var v=s.getOrCreatePatternSync(t,r,e,o,l,t.getGeometryBounds().min,function(){t.renderable.dirty=!0,n.renderingService.dirtify()});return v}function If(r,t,e,n){var i;if(r.type===_s.LinearGradient||r.type===_s.RadialGradient){var a=t.getGeometryBounds(),s=a&&a.halfExtents[0]*2||1,o=a&&a.halfExtents[1]*2||1,l=a&&a.min||[0,0];i=n.getOrCreateGradient(Ft(Ft({type:r.type},r.value),{},{min:l,width:s,height:o}),e)}return i}var Ed=["shadowBlur","shadowOffsetX","shadowOffsetY"],qM=["lineCap","lineJoin","miterLimit"],ln={globalAlpha:1,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",filter:"none",globalCompositeOperation:"source-over",strokeStyle:"#000",strokeOpacity:1,lineWidth:1,lineDash:[],lineDashOffset:0,lineCap:"butt",lineJoin:"miter",miterLimit:10,fillStyle:"#000",fillOpacity:1},WM={};function We(r,t,e,n){var i=n.has(t)?n.get(t):ln[t];return i!==e&&(t==="lineDash"?r.setLineDash(e):r[t]=e,n.set(t,e)),i}var YK=function(){function r(t){at(this,r),this.imagePool=t}return it(r,[{key:"applyAttributesToContext",value:function(e,n){}},{key:"render",value:function(e,n,i,a,s,o){}},{key:"applyCommonStyleToContext",value:function(e,n,i,a){var s=i?WM:a.prevObject.parsedStyle,o=n.parsedStyle;(i||o.opacity!==s.opacity)&&We(e,"globalAlpha",kt(o.opacity)?ln.globalAlpha:o.opacity,a.currentContext),(i||o.blend!==s.blend)&&We(e,"globalCompositeOperation",kt(o.blend)?ln.globalCompositeOperation:o.blend,a.currentContext)}},{key:"applyStrokeFillStyleToContext",value:function(e,n,i,a){var s=i?WM:a.prevObject.parsedStyle,o=n.parsedStyle,l=o.lineWidth,u=l===void 0?ln.lineWidth:l,c=o.fill&&!o.fill.isNone,h=o.stroke&&!o.stroke.isNone&&u>0;if(h){if(i||n.attributes.stroke!==a.prevObject.attributes.stroke){var d=!kt(o.stroke)&&!Array.isArray(o.stroke)&&!o.stroke.isNone?n.attributes.stroke:ln.strokeStyle;We(e,"strokeStyle",d,a.currentContext)}(i||o.lineWidth!==s.lineWidth)&&We(e,"lineWidth",kt(o.lineWidth)?ln.lineWidth:o.lineWidth,a.currentContext),(i||o.lineDash!==s.lineDash)&&We(e,"lineDash",o.lineDash||ln.lineDash,a.currentContext),(i||o.lineDashOffset!==s.lineDashOffset)&&We(e,"lineDashOffset",kt(o.lineDashOffset)?ln.lineDashOffset:o.lineDashOffset,a.currentContext);for(var g=0;g<qM.length;g++){var p=qM[g];(i||o[p]!==s[p])&&We(e,p,kt(o[p])?ln[p]:o[p],a.currentContext)}}if(c&&(i||n.attributes.fill!==a.prevObject.attributes.fill)){var v=!kt(o.fill)&&!Array.isArray(o.fill)&&!o.fill.isNone?n.attributes.fill:ln.fillStyle;We(e,"fillStyle",v,a.currentContext)}}},{key:"applyStyleToContext",value:function(e,n,i,a){var s=n.nodeName;this.applyCommonStyleToContext(e,n,i,a),s===Q.IMAGE||this.applyStrokeFillStyleToContext(e,n,i,a)}},{key:"applyShadowAndFilterStyleToContext",value:function(e,n,i,a){var s=n.parsedStyle;if(i){We(e,"shadowColor",s.shadowColor.toString(),a.currentContext);for(var o=0;o<Ed.length;o++){var l=Ed[o];We(e,l,s[l]||ln[l],a.currentContext)}}s.filter&&s.filter.length&&We(e,"filter",n.attributes.filter,a.currentContext)}},{key:"clearShadowAndFilterStyleForContext",value:function(e,n,i,a){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(n){We(e,"shadowColor",ln.shadowColor,a.currentContext);for(var o=0;o<Ed.length;o++){var l=Ed[o];We(e,l,ln[l],a.currentContext)}}if(i)if(n&&s){var u=e.filter;!kt(u)&&u.indexOf("drop-shadow")>-1&&We(e,"filter",u.replace(/drop-shadow\([^)]*\)/,"").trim()||ln.filter,a.currentContext)}else We(e,"filter",ln.filter,a.currentContext)}},{key:"fillToContext",value:function(e,n,i,a,s){var o=this,l=n.parsedStyle,u=l.fill,c=l.fillRule,h=null;if(Array.isArray(u)&&u.length>0)u.forEach(function(g){var p=We(e,"fillStyle",If(g,n,e,o.imagePool),i.currentContext);h=h??p,c?e.fill(c):e.fill()});else{if(Lo(u)){var d=Lf(u,n,e,n.ownerDocument.defaultView.context,a,s,this.imagePool);d&&(e.fillStyle=d,h=!0)}c?e.fill(c):e.fill()}h!==null&&We(e,"fillStyle",h,i.currentContext)}},{key:"strokeToContext",value:function(e,n,i,a,s){var o=this,l=n.parsedStyle.stroke,u=null;if(Array.isArray(l)&&l.length>0)l.forEach(function(d){var g=We(e,"strokeStyle",If(d,n,e,o.imagePool),i.currentContext);u=u??g,e.stroke()});else{if(Lo(l)){var c=Lf(l,n,e,n.ownerDocument.defaultView.context,a,s,this.imagePool);if(c){var h=We(e,"strokeStyle",c,i.currentContext);u=u??h}}e.stroke()}u!==null&&We(e,"strokeStyle",u,i.currentContext)}},{key:"drawToContext",value:function(e,n,i,a,s){var o,l=n.nodeName,u=n.parsedStyle,c=u.opacity,h=c===void 0?ln.globalAlpha:c,d=u.fillOpacity,g=d===void 0?ln.fillOpacity:d,p=u.strokeOpacity,v=p===void 0?ln.strokeOpacity:p,m=u.lineWidth,b=m===void 0?ln.lineWidth:m,w=u.fill&&!u.fill.isNone,x=u.stroke&&!u.stroke.isNone&&b>0;if(!(!w&&!x)){var _=!kt(u.shadowColor)&&u.shadowBlur>0,S=u.shadowType==="inner",M=((o=u.fill)===null||o===void 0?void 0:o.alpha)===0,k=!!(u.filter&&u.filter.length),T=_&&x&&(l===Q.PATH||l===Q.LINE||l===Q.POLYLINE||M||S),P=null;if(w){T||this.applyShadowAndFilterStyleToContext(e,n,_,i);var O=h*g;P=We(e,"globalAlpha",O,i.currentContext),this.fillToContext(e,n,i,a,s),T||this.clearShadowAndFilterStyleForContext(e,_,k,i)}if(x){var A=!1,R=h*v,L=We(e,"globalAlpha",R,i.currentContext);if(P=w?P:L,T&&(this.applyShadowAndFilterStyleToContext(e,n,_,i),A=!0,S)){var q=e.globalCompositeOperation;e.globalCompositeOperation="source-atop",this.strokeToContext(e,n,i,a,s),e.globalCompositeOperation=q,this.clearShadowAndFilterStyleForContext(e,_,k,i,!0)}this.strokeToContext(e,n,i,a,s),A&&this.clearShadowAndFilterStyleForContext(e,_,k,i)}P!==null&&We(e,"globalAlpha",P,i.currentContext)}}}])}(),tE=function(r){function t(){return at(this,t),qt(this,t,arguments)}return jt(t,r),it(t,[{key:"render",value:function(n,i,a,s,o,l){var u=i.fill,c=i.fillRule,h=i.opacity,d=h===void 0?1:h,g=i.fillOpacity,p=g===void 0?1:g,v=i.stroke,m=i.strokeOpacity,b=m===void 0?1:m,w=i.lineWidth,x=w===void 0?1:w,_=i.lineCap,S=i.lineJoin,M=i.shadowType,k=i.shadowColor,T=i.shadowBlur,P=i.filter,O=i.miterLimit,A=u&&!u.isNone,R=v&&!v.isNone&&x>0,L=(u==null?void 0:u.alpha)===0,q=!!(P&&P.length),j=!kt(k)&&T>0,$=a.nodeName,B=M==="inner",F=R&&j&&($===Q.PATH||$===Q.LINE||$===Q.POLYLINE||L||B);A&&(n.globalAlpha=d*p,F||Df(a,n,j),LI(n,a,u,c,s,o,l,this.imagePool),F||this.clearShadowAndFilter(n,q,j)),R&&(n.globalAlpha=d*b,n.lineWidth=x,kt(O)||(n.miterLimit=O),kt(_)||(n.lineCap=_),kt(S)||(n.lineJoin=S),F&&(B&&(n.globalCompositeOperation="source-atop"),Df(a,n,!0),B&&(Dw(n,a,v,s,o,l,this.imagePool),n.globalCompositeOperation=ln.globalCompositeOperation,this.clearShadowAndFilter(n,q,!0))),Dw(n,a,v,s,o,l,this.imagePool))}},{key:"clearShadowAndFilter",value:function(n,i,a){if(a&&(n.shadowColor="transparent",n.shadowBlur=0),i){var s=n.filter;!kt(s)&&s.indexOf("drop-shadow")>-1&&(n.filter=s.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}}}])}(YK);function Df(r,t,e){var n=r.parsedStyle,i=n.filter,a=n.shadowColor,s=n.shadowBlur,o=n.shadowOffsetX,l=n.shadowOffsetY;i&&i.length&&(t.filter=r.style.filter),e&&(t.shadowColor=a.toString(),t.shadowBlur=s||0,t.shadowOffsetX=o||0,t.shadowOffsetY=l||0)}function LI(r,t,e,n,i,a,s,o){var l=arguments.length>8&&arguments[8]!==void 0?arguments[8]:!1;Array.isArray(e)?e.forEach(function(u){r.fillStyle=If(u,t,r,o),l||(n?r.fill(n):r.fill())}):(Lo(e)&&(r.fillStyle=Lf(e,t,r,i,a,s,o)),l||(n?r.fill(n):r.fill()))}function Dw(r,t,e,n,i,a,s){var o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1;Array.isArray(e)?e.forEach(function(l){r.strokeStyle=If(l,t,r,s),o||r.stroke()}):(Lo(e)&&(r.strokeStyle=Lf(e,t,r,n,i,a,s)),o||r.stroke())}function XK(r,t){var e=Rt(r,4),n=e[0],i=e[1],a=e[2],s=e[3],o=Rt(t,4),l=o[0],u=o[1],c=o[2],h=o[3],d=Math.max(n,l),g=Math.max(i,u),p=Math.min(n+a,l+c),v=Math.min(i+s,u+h);return p<=d||v<=g?null:[d,g,p-d,v-g]}function KK(r,t){var e=Qn(Qt(),[r[0],r[1],0],t),n=Qn(Qt(),[r[0]+r[2],r[1],0],t),i=Qn(Qt(),[r[0],r[1]+r[3],0],t),a=Qn(Qt(),[r[0]+r[2],r[1]+r[3],0],t);return[Math.min(e[0],n[0],i[0],a[0]),Math.min(e[1],n[1],i[1],a[1]),Math.max(e[0],n[0],i[0],a[0])-Math.min(e[0],n[0],i[0],a[0]),Math.max(e[1],n[1],i[1],a[1])-Math.min(e[1],n[1],i[1],a[1])]}var ZK=function(r){function t(){return at(this,t),qt(this,t,arguments)}return jt(t,r),it(t,[{key:"renderDownSampled",value:function(n,i,a,s){var o=s.src,l=s.imageCache;if(!l.downSampled){this.imagePool.createDownSampledImage(o,a).then(function(u){a.renderable.dirty=!0,a.ownerDocument.defaultView.context.renderingService.dirtify()}).catch(function(){});return}n.drawImage(l.downSampled,Math.floor(s.drawRect[0]),Math.floor(s.drawRect[1]),Math.ceil(s.drawRect[2]),Math.ceil(s.drawRect[3]))}},{key:"renderTile",value:function(n,i,a,s){var o=s.src,l=s.imageCache,u=s.imageRect,c=s.drawRect,h=l.size,d=n.getTransform(),g=d.a,p=d.b,v=d.c,m=d.d,b=d.e,w=d.f;if(n.resetTransform(),!(l!=null&&l.gridSize)){this.imagePool.createImageTiles(o,[],function(){a.renderable.dirty=!0,a.ownerDocument.defaultView.context.renderingService.dirtify()},a).catch(function(){});return}for(var x=[h[0]/u[2],h[1]/u[3]],_=[l.tileSize[0]/x[0],l.tileSize[1]/x[1]],S=[Math.floor((c[0]-u[0])/_[0]),Math.ceil((c[0]+c[2]-u[0])/_[0])],M=S[0],k=S[1],T=[Math.floor((c[1]-u[1])/_[1]),Math.ceil((c[1]+c[3]-u[1])/_[1])],P=T[0],O=T[1],A=P;A<=O;A++)for(var R=M;R<=k;R++){var L=l.tiles[A][R];if(L){var q=[Math.floor(u[0]+L.tileX*_[0]),Math.floor(u[1]+L.tileY*_[1]),Math.ceil(_[0]),Math.ceil(_[1])];n.drawImage(L.data,q[0],q[1],q[2],q[3])}}n.setTransform(g,p,v,m,b,w)}},{key:"render",value:function(n,i,a){var s=i.x,o=s===void 0?0:s,l=i.y,u=l===void 0?0:l,c=i.width,h=i.height,d=i.src,g=i.shadowColor,p=i.shadowBlur,v=this.imagePool.getImageSync(d,a),m=v==null?void 0:v.img,b=c,w=h;if(m){b||(b=m.width),w||(w=m.height);var x=!kt(g)&&p>0;Df(a,n,x);try{var _=a.ownerDocument.defaultView.getContextService().getDomElement(),S=_.width,M=_.height,k=n.getTransform(),T=k.a,P=k.b,O=k.c,A=k.d,R=k.e,L=k.f,q=OR(T,O,0,0,P,A,0,0,0,0,1,0,R,L,0,1),j=KK([o,u,b,w],q),$=XK([0,0,S,M],j);if(!$)return;if(!a.ownerDocument.defaultView.getConfig().enableLargeImageOptimization){t.renderFull(n,i,a,{image:m,drawRect:[o,u,b,w]});return}var B=j[2]/v.size[0];if(B<(v.downSamplingRate||.5)){this.renderDownSampled(n,i,a,{src:d,imageCache:v,drawRect:[o,u,b,w]});return}if(!Qx.isSupportTile){t.renderFull(n,i,a,{image:m,drawRect:[o,u,b,w]});return}this.renderTile(n,i,a,{src:d,imageCache:v,imageRect:j,drawRect:$})}catch{}}}},{key:"drawToContext",value:function(n,i,a,s,o){this.render(n,i.parsedStyle,i)}}],[{key:"renderFull",value:function(n,i,a,s){n.drawImage(s.image,Math.floor(s.drawRect[0]),Math.floor(s.drawRect[1]),Math.ceil(s.drawRect[2]),Math.ceil(s.drawRect[3]))}}])}(tE),JK=function(r){function t(){return at(this,t),qt(this,t,arguments)}return jt(t,r),it(t,[{key:"render",value:function(n,i,a,s,o,l){a.getBounds();var u=i.lineWidth,c=u===void 0?1:u,h=i.textAlign,d=h===void 0?"start":h,g=i.textBaseline,p=g===void 0?"alphabetic":g,v=i.lineJoin,m=v===void 0?"miter":v,b=i.miterLimit,w=b===void 0?10:b,x=i.letterSpacing,_=x===void 0?0:x,S=i.stroke,M=i.fill,k=i.fillRule,T=i.fillOpacity,P=T===void 0?1:T,O=i.strokeOpacity,A=O===void 0?1:O,R=i.opacity,L=R===void 0?1:R,q=i.metrics,j=i.x,$=j===void 0?0:j,B=i.y,F=B===void 0?0:B,V=i.dx,X=i.dy,K=i.shadowColor,dt=i.shadowBlur,ct=q.font,ht=q.lines,lt=q.height,pt=q.lineHeight,wt=q.lineMetrics;n.font=ct,n.lineWidth=c,n.textAlign=d==="middle"?"center":d;var Bt=p;Bt==="alphabetic"&&(Bt="bottom"),n.lineJoin=m,kt(w)||(n.miterLimit=w);var Ut=F;p==="middle"?Ut+=-lt/2-pt/2:p==="bottom"||p==="alphabetic"||p==="ideographic"?Ut+=-lt:(p==="top"||p==="hanging")&&(Ut+=-pt);var Fe=$+(V||0);Ut+=X||0,ht.length===1&&(Bt==="bottom"?(Bt="middle",Ut-=.5*lt):Bt==="top"&&(Bt="middle",Ut+=.5*lt)),n.textBaseline=Bt;var Gn=!kt(K)&&dt>0;Df(a,n,Gn);for(var on=0;on<ht.length;on++){var dr=c/2+Fe;Ut+=pt,!kt(S)&&!S.isNone&&c&&this.drawLetterSpacing(n,a,ht[on],wt[on],d,dr,Ut,_,M,k,P,S,A,L,!0,s,o,l),kt(M)||this.drawLetterSpacing(n,a,ht[on],wt[on],d,dr,Ut,_,M,k,P,S,A,L,!1,s,o,l)}}},{key:"drawLetterSpacing",value:function(n,i,a,s,o,l,u,c,h,d,g,p,v,m,b,w,x,_){if(c===0){b?this.strokeText(n,i,a,l,u,p,v,w,x,_):this.fillText(n,i,a,l,u,h,d,g,m,w,x,_);return}var S=n.textAlign;n.textAlign="left";var M=l;o==="center"||o==="middle"?M=l-s.width/2:(o==="right"||o==="end")&&(M=l-s.width);for(var k=Array.from(a),T=n.measureText(a).width,P=0,O=0;O<k.length;++O){var A=k[O];b?this.strokeText(n,i,A,M,u,p,v,w,x,_):this.fillText(n,i,A,M,u,h,d,g,m,w,x,_),P=n.measureText(a.substring(O+1)).width,M+=T-P+c,T=P}n.textAlign=S}},{key:"fillText",value:function(n,i,a,s,o,l,u,c,h,d,g,p){LI(n,i,l,u,d,g,p,this.imagePool,!0);var v,m=!kt(c)&&c!==1;m&&(v=n.globalAlpha,n.globalAlpha=c*h),n.fillText(a,s,o),m&&(n.globalAlpha=v)}},{key:"strokeText",value:function(n,i,a,s,o,l,u,c,h,d){Dw(n,i,l,c,h,d,this.imagePool,!0);var g,p=!kt(u)&&u!==1;p&&(g=n.globalAlpha,n.globalAlpha=u),n.strokeText(a,s,o),p&&(n.globalAlpha=g)}},{key:"drawToContext",value:function(n,i,a,s,o){this.render(n,i.parsedStyle,i,i.ownerDocument.defaultView.context,s,o)}}])}(tE),QK=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return at(this,t),e=qt(this,t),e.name="canvas-renderer",e.options=n,e}return jt(t,r),it(t,[{key:"init",value:function(){var n,i=Ft({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),a=this.context.imagePool,s=new tE(a),o=(n={},bt(bt(bt(bt(bt(bt(bt(bt(bt(bt(n,Q.CIRCLE,s),Q.ELLIPSE,s),Q.RECT,s),Q.IMAGE,new ZK(a)),Q.TEXT,new JK(a)),Q.LINE,s),Q.POLYLINE,s),Q.POLYGON,s),Q.PATH,s),Q.GROUP,void 0),bt(bt(bt(n,Q.HTML,void 0),Q.MESH,void 0),Q.FRAGMENT,void 0));this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new RI(i))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory}}])}(Vs);/*!
- * @antv/g-plugin-dom-interaction
- * @description A G plugin
- * @version 2.1.21
- * @date 1/23/2025, 8:33:09 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var II=function(){function r(){at(this,r)}return it(r,[{key:"apply",value:function(e,n){var i=this,a=e.renderingService,s=e.renderingContext,o=e.config;this.context=e;var l=s.root.ownerDocument.defaultView,u=function(T){a.hooks.pointerMove.call(T)},c=function(T){a.hooks.pointerUp.call(T)},h=function(T){a.hooks.pointerDown.call(T)},d=function(T){a.hooks.pointerOver.call(T)},g=function(T){a.hooks.pointerOut.call(T)},p=function(T){a.hooks.pointerCancel.call(T)},v=function(T){a.hooks.pointerWheel.call(T)},m=function(T){a.hooks.click.call(T)},b=function(T){n.globalThis.document.addEventListener("pointermove",u,!0),T.addEventListener("pointerdown",h,!0),T.addEventListener("pointerleave",g,!0),T.addEventListener("pointerover",d,!0),n.globalThis.addEventListener("pointerup",c,!0),n.globalThis.addEventListener("pointercancel",p,!0)},w=function(T){T.addEventListener("touchstart",h,!0),T.addEventListener("touchend",c,!0),T.addEventListener("touchmove",u,!0),T.addEventListener("touchcancel",p,!0)},x=function(T){n.globalThis.document.addEventListener("mousemove",u,!0),T.addEventListener("mousedown",h,!0),T.addEventListener("mouseout",g,!0),T.addEventListener("mouseover",d,!0),n.globalThis.addEventListener("mouseup",c,!0)},_=function(T){n.globalThis.document.removeEventListener("pointermove",u,!0),T.removeEventListener("pointerdown",h,!0),T.removeEventListener("pointerleave",g,!0),T.removeEventListener("pointerover",d,!0),n.globalThis.removeEventListener("pointerup",c,!0),n.globalThis.removeEventListener("pointercancel",p,!0)},S=function(T){T.removeEventListener("touchstart",h,!0),T.removeEventListener("touchend",c,!0),T.removeEventListener("touchmove",u,!0),T.removeEventListener("touchcancel",p,!0)},M=function(T){n.globalThis.document.removeEventListener("mousemove",u,!0),T.removeEventListener("mousedown",h,!0),T.removeEventListener("mouseout",g,!0),T.removeEventListener("mouseover",d,!0),n.globalThis.removeEventListener("mouseup",c,!0)};a.hooks.init.tap(r.tag,function(){var k=i.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(k.style.msContentZooming="none",k.style.msTouchAction="none"):l.supportsPointerEvents&&(k.style.touchAction="none"),l.supportsPointerEvents?b(k):x(k),l.supportsTouchEvents&&w(k),o.useNativeClickEvent&&k.addEventListener("click",m,!0),k.addEventListener("wheel",v,{passive:!0,capture:!0})}),a.hooks.destroy.tap(r.tag,function(){var k=i.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(k.style.msContentZooming="",k.style.msTouchAction=""):l.supportsPointerEvents&&(k.style.touchAction=""),l.supportsPointerEvents?_(k):M(k),l.supportsTouchEvents&&S(k),o.useNativeClickEvent&&k.removeEventListener("click",m,!0),k.removeEventListener("wheel",v,!0)})}}])}();II.tag="DOMInteraction";var tZ=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.name="dom-interaction",e}return jt(t,r),it(t,[{key:"init",value:function(){this.addRenderingPlugin(new II)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(Vs);/*!
- * @antv/g-plugin-html-renderer
- * @description A G plugin for rendering HTML
- * @version 2.1.21
- * @date 1/23/2025, 8:33:20 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var eZ="g-canvas-camera",DI=function(){function r(){at(this,r),this.displayObjectHTMLElementMap=new WeakMap}return it(r,[{key:"joinTransformMatrix",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0];return"matrix(".concat([e[0],e[1],e[4],e[5],e[12]+n[0],e[13]+n[1]].join(","),")")}},{key:"apply",value:function(e,n){var i=this,a=e.camera,s=e.renderingContext,o=e.renderingService;this.context=e;var l=s.root.ownerDocument.defaultView,u=l.context.eventService.nativeHTMLMap,c=function(b,w){w.style.transform=i.joinTransformMatrix(b.getWorldTransform(),b.getOrigin())},h=function(b){var w=b.target;if(w.nodeName===Q.HTML){i.$camera||(i.$camera=i.createCamera(a));var x=i.getOrCreateEl(w);i.$camera.appendChild(x),Object.keys(w.attributes).forEach(function(_){i.updateAttribute(_,w)}),c(w,x),u.set(x,w)}},d=function(b){var w=b.target;if(w.nodeName===Q.HTML&&i.$camera){var x=i.getOrCreateEl(w);x&&(x.remove(),u.delete(x))}},g=function(b){var w=b.target;if(w.nodeName===Q.HTML){var x=b.attrName;i.updateAttribute(x,w)}},p=function(b){var w=b.target,x=w.nodeName===Q.FRAGMENT?w.childNodes:[w];x.forEach(function(_){if(_.nodeName===Q.HTML){var S=i.getOrCreateEl(_);c(_,S)}})},v=function(){if(i.$camera){var b=i.context.config,w=b.width,x=b.height;i.$camera.parentElement.style.width="".concat(w||0,"px"),i.$camera.parentElement.style.height="".concat(x||0,"px")}};o.hooks.init.tap(r.tag,function(){l.addEventListener($r.RESIZE,v),l.addEventListener(Xt.MOUNTED,h),l.addEventListener(Xt.UNMOUNTED,d),l.addEventListener(Xt.ATTR_MODIFIED,g),l.addEventListener(Xt.BOUNDS_CHANGED,p)}),o.hooks.endFrame.tap(r.tag,function(){i.$camera&&s.renderReasons.has(Bl.CAMERA_CHANGED)&&(i.$camera.style.transform=i.joinTransformMatrix(a.getOrthoMatrix()))}),o.hooks.destroy.tap(r.tag,function(){i.$camera&&i.$camera.remove(),l.removeEventListener($r.RESIZE,v),l.removeEventListener(Xt.MOUNTED,h),l.removeEventListener(Xt.UNMOUNTED,d),l.removeEventListener(Xt.ATTR_MODIFIED,g),l.removeEventListener(Xt.BOUNDS_CHANGED,p)})}},{key:"createCamera",value:function(e){var n=this.context.config,i=n.document,a=n.width,s=n.height,o=this.context.contextService.getDomElement(),l=o.parentNode;if(l){var u=eZ,c=l.querySelector("#".concat(u));if(!c){var h=(i||document).createElement("div");h.style.overflow="hidden",h.style.pointerEvents="none",h.style.position="absolute",h.style.left="0px",h.style.top="0px",h.style.width="".concat(a||0,"px"),h.style.height="".concat(s||0,"px");var d=(i||document).createElement("div");c=d,d.id=u,d.style.position="absolute",d.style.left="".concat(o.offsetLeft||0,"px"),d.style.top="".concat(o.offsetTop||0,"px"),d.style.transformOrigin="left top",d.style.transform=this.joinTransformMatrix(e.getOrthoMatrix()),d.style.pointerEvents="none",d.style.width="100%",d.style.height="100%",h.appendChild(d),l.appendChild(h)}return c}return null}},{key:"getOrCreateEl",value:function(e){var n=this.context.config.document,i=this.displayObjectHTMLElementMap.get(e);return i||(i=(n||document).createElement("div"),e.parsedStyle.$el=i,this.displayObjectHTMLElementMap.set(e,i),e.id&&(i.id=e.id),e.name&&i.setAttribute("name",e.name),e.className&&(i.className=e.className),i.style.position="absolute",i.style["will-change"]="transform",i.style.transform=this.joinTransformMatrix(e.getWorldTransform(),e.getOrigin())),i}},{key:"updateAttribute",value:function(e,n){var i=this.getOrCreateEl(n);switch(e){case"innerHTML":var a=n.parsedStyle.innerHTML;oe(a)?i.innerHTML=a:(i.innerHTML="",i.appendChild(a));break;case"x":i.style.left="".concat(n.parsedStyle.x,"px");break;case"y":i.style.top="".concat(n.parsedStyle.y,"px");break;case"transformOrigin":var s=n.parsedStyle.transformOrigin;i.style["transform-origin"]="".concat(s[0].buildCSSText(null,null,"")," ").concat(s[1].buildCSSText(null,null,""));break;case"width":var o=n.parsedStyle.width;i.style.width=yt(o)?"".concat(o,"px"):o.toString();break;case"height":var l=n.parsedStyle.height;i.style.height=yt(l)?"".concat(l,"px"):l.toString();break;case"zIndex":var u=n.parsedStyle.zIndex;i.style["z-index"]="".concat(u);break;case"visibility":var c=n.parsedStyle.visibility;i.style.visibility=c;break;case"pointerEvents":var h=n.parsedStyle.pointerEvents,d=h===void 0?"auto":h;i.style.pointerEvents=d;break;case"opacity":var g=n.parsedStyle.opacity;i.style.opacity="".concat(g);break;case"fill":var p=n.parsedStyle.fill,v="";Sf(p)?p.isNone?v="transparent":v=n.getAttribute("fill"):Array.isArray(p)?v=n.getAttribute("fill"):Lo(p),i.style.background=v;break;case"stroke":var m=n.parsedStyle.stroke,b="";Sf(m)?m.isNone?b="transparent":b=n.getAttribute("stroke"):Array.isArray(m)?b=n.getAttribute("stroke"):Lo(m),i.style["border-color"]=b,i.style["border-style"]="solid";break;case"lineWidth":var w=n.parsedStyle.lineWidth;i.style["border-width"]="".concat(w||0,"px");break;case"lineDash":i.style["border-style"]="dashed";break;case"filter":var x=n.style.filter;i.style.filter=x;break;default:!kt(n.style[e])&&n.style[e]!==""&&(i.style[e]=n.style[e])}}}])}();DI.tag="HTMLRendering";var nZ=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.name="html-renderer",e}return jt(t,r),it(t,[{key:"init",value:function(){this.addRenderingPlugin(new DI)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(Vs);/*!
- * @antv/g-canvas
- * @description A renderer implemented by Canvas 2D API
- * @version 2.0.39
- * @date 1/23/2025, 8:35:49 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var rZ=function(){function r(t){at(this,r),this.renderingContext=t.renderingContext,this.canvasConfig=t.config}return it(r,[{key:"init",value:function(){var e=this.canvasConfig,n=e.container,i=e.canvas;if(i)this.$canvas=i,n&&i.parentElement!==n&&n.appendChild(i),this.$container=i.parentElement,this.canvasConfig.container=this.$container;else if(n&&(this.$container=oe(n)?document.getElementById(n):n,this.$container)){var a=document.createElement("canvas");this.$container.appendChild(a),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=a}this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height)}},{key:"getContext",value:function(){return this.context}},{key:"getDomElement",value:function(){return this.$canvas}},{key:"getDPR",value:function(){return this.dpr}},{key:"getBoundingClientRect",value:function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()}},{key:"destroy",value:function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)}},{key:"resize",value:function(e,n){var i=this.canvasConfig.devicePixelRatio;this.dpr=i,this.$canvas&&(this.$canvas.width=this.dpr*e,this.$canvas.height=this.dpr*n,NH(this.$canvas,e,n)),this.renderingContext.renderReasons.add(Bl.CAMERA_CHANGED)}},{key:"applyCursorStyle",value:function(e){this.$container&&this.$container.style&&(this.$container.style.cursor=e)}},{key:"toDataURL",value:function(){var t=Fs($n().mark(function n(){var i,a,s,o=arguments;return $n().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return i=o.length>0&&o[0]!==void 0?o[0]:{},a=i.type,s=i.encoderOptions,u.abrupt("return",this.context.canvas.toDataURL(a,s));case 3:case"end":return u.stop()}},n,this)}));function e(){return t.apply(this,arguments)}return e}()}])}(),iZ=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=qt(this,t,[].concat(i)),e.name="canvas-context-register",e}return jt(t,r),it(t,[{key:"init",value:function(){this.context.ContextService=rZ}},{key:"destroy",value:function(){delete this.context.ContextService}}])}(Vs),pc=function(r){function t(e){var n;return at(this,t),n=qt(this,t,[e]),n.registerPlugin(new iZ),n.registerPlugin(new UK),n.registerPlugin(new SK),n.registerPlugin(new QK),n.registerPlugin(new tZ),n.registerPlugin(new WK),n.registerPlugin(new nZ),n}return jt(t,r),it(t)}(NG),aZ=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class vg extends vi{constructor(t){super(Object.assign(Object.assign({},t),{style:Object.assign({},vg.defaultStyleProps,t.style)})),this.rootPointerEvent=new Tf(null),this.forwardEvents=e=>{const n=this.context.canvas,i=n.context.renderingContext.root.ownerDocument.defaultView;this.normalizeToPointerEvent(e,i).forEach(s=>{const o=this.bootstrapEvent(this.rootPointerEvent,s,i,e);uc(n.context.eventService,"mappingTable.pointerupoutside",[]),n.context.eventService.mapEvent(o)})}}get eventService(){return this.context.canvas.context.eventService}get events(){return[J.CLICK,J.POINTER_DOWN,J.POINTER_MOVE,J.POINTER_UP,J.POINTER_OVER,J.POINTER_LEAVE]}getDomElement(){return this.getShape("key").getDomElement()}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e),this.drawPortShapes(t,e)}getKeyStyle(t){const e=No(t,["dx","dy","innerHTML","pointerEvents","cursor"]),{dx:n=0,dy:i=0}=e,a=aZ(e,["dx","dy"]),[s,o]=this.getSize(t);return Object.assign(Object.assign({x:n,y:i},a),{width:s,height:o})}drawKeyShape(t,e){const n=this.getKeyStyle(t),{x:i,y:a,width:s=0,height:o=0}=n,l=this.upsert("key-container",Sn,{x:i,y:a,width:s,height:o,opacity:0},e);return this.upsert("key",Rc,n,l)}connectedCallback(){if(!(this.context.canvas.getRenderer("main")instanceof pc))return;const n=this.getDomElement();this.events.forEach(i=>{n.addEventListener(i,this.forwardEvents)})}attributeChangedCallback(t,e,n){t==="zIndex"&&e!==n&&(this.getDomElement().style.zIndex=n)}destroy(){const t=this.getDomElement();this.events.forEach(e=>{t.removeEventListener(e,this.forwardEvents)}),super.destroy()}normalizeToPointerEvent(t,e){const n=[];if(e.isTouchEvent(t))for(let i=0;i<t.changedTouches.length;i++){const a=t.changedTouches[i];Pt(a.button)&&(a.button=0),Pt(a.buttons)&&(a.buttons=1),Pt(a.isPrimary)&&(a.isPrimary=t.touches.length===1&&t.type==="touchstart"),Pt(a.width)&&(a.width=a.radiusX||1),Pt(a.height)&&(a.height=a.radiusY||1),Pt(a.tiltX)&&(a.tiltX=0),Pt(a.tiltY)&&(a.tiltY=0),Pt(a.pointerType)&&(a.pointerType="touch"),Pt(a.pointerId)&&(a.pointerId=a.identifier||0),Pt(a.pressure)&&(a.pressure=a.force||.5),Pt(a.twist)&&(a.twist=0),Pt(a.tangentialPressure)&&(a.tangentialPressure=0),a.isNormalized=!0,a.type=t.type,n.push(a)}else if(e.isMouseEvent(t)){const i=t;Pt(i.isPrimary)&&(i.isPrimary=!0),Pt(i.width)&&(i.width=1),Pt(i.height)&&(i.height=1),Pt(i.tiltX)&&(i.tiltX=0),Pt(i.tiltY)&&(i.tiltY=0),Pt(i.pointerType)&&(i.pointerType="mouse"),Pt(i.pointerId)&&(i.pointerId=1),Pt(i.pressure)&&(i.pressure=.5),Pt(i.twist)&&(i.twist=0),Pt(i.tangentialPressure)&&(i.tangentialPressure=0),i.isNormalized=!0,n.push(i)}else n.push(t);return n}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.metaKey=e.metaKey,t.shiftKey=e.shiftKey,t.ctrlKey=e.ctrlKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.screen.x=e.screenX,t.screen.y=e.screenY,t.relatedTarget=null}bootstrapEvent(t,e,n,i){t.view=n,t.originalEvent=null,t.nativeEvent=i,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e);const{x:a,y:s}=this.getViewportXY(e);t.viewport.x=a,t.viewport.y=s;const[o,l]=this.context.canvas.getCanvasByViewport([a,s]);return t.canvas.x=o,t.canvas.y=l,t.global.copyFrom(t.canvas),t.offset.copyFrom(t.canvas),t.isTrusted=i.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t}getViewportXY(t){let e,n;const{offsetX:i,offsetY:a,clientX:s,clientY:o}=t;if(!kt(i)&&!kt(a))e=i,n=a;else{const l=this.eventService.client2Viewport({x:s,y:o});e=l.x,n=l.y}return{x:e,y:n}}onframe(){super.onframe();const{opacity:t}=this.attributes;this.getDomElement().style.opacity=`${t}`}}vg.defaultStyleProps={size:[160,80],halo:!1,icon:!1,label:!1,pointerEvents:"auto"};var GM=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};let FI=class BI extends vi{constructor(t){super(Nn({style:BI.defaultStyleProps},t))}getKeyStyle(t){const[e,n]=this.getSize(t),i=super.getKeyStyle(t),{fillOpacity:a,opacity:s=a}=i,o=GM(i,["fillOpacity","opacity"]);return Object.assign(Object.assign({opacity:s},o),{width:e,height:n,x:-e/2,y:-n/2})}getHaloStyle(t){if(t.halo===!1)return!1;const e=this.getShape("key").attributes,{fill:n,stroke:i}=e;GM(e,["fill","stroke"]);const a=fn(this.getGraphicStyle(t),"halo"),s=Number(a.lineWidth),[o,l]=Lt(this.getSize(t),[s,s]);return Object.assign(Object.assign({},a),{width:o,height:l,fill:"transparent",x:-o/2,y:-l/2})}getIconStyle(t){const e=super.getIconStyle(t),[n,i]=this.getSize(t);return e?Object.assign({width:n*qa,height:i*qa},e):!1}drawKeyShape(t,e){const n=this.upsert("key",Kx,this.getKeyStyle(t),e);return Zx(this),n}drawHaloShape(t,e){this.upsert("halo",Sn,this.getHaloStyle(t),e)}update(t){super.update(t),t&&("x"in t||"y"in t||"z"in t)&&Jx(this)}};FI.defaultStyleProps={size:32};class sZ extends vi{constructor(t){super(t)}getKeyStyle(t){const[e,n]=this.getSize(t);return Object.assign(Object.assign({},super.getKeyStyle(t)),{width:e,height:n,x:-e/2,y:-n/2})}getIconStyle(t){const e=super.getIconStyle(t),{width:n,height:i}=this.getShape("key").attributes;return e?Object.assign({width:n*qa,height:i*qa},e):!1}drawKeyShape(t,e){return this.upsert("key",Sn,this.getKeyStyle(t),e)}}class oZ extends fg{constructor(t){super(t)}getInnerR(t){return t.innerR||this.getOuterR(t)*3/8}getOuterR(t){return Math.min(...this.getSize(t))/2}getPoints(t){return GZ(this.getOuterR(t),this.getInnerR(t))}getIconStyle(t){const e=super.getIconStyle(t),n=this.getInnerR(t)*2*qa;return e?Object.assign({width:n,height:n},e):!1}getPortXY(t,e){const{placement:n="top"}=e,i=this.getShape("key").getLocalBounds(),a=VZ(this.getOuterR(t),this.getInnerR(t));return rE(i,n,a,!1)}}class mg extends fg{constructor(t){super(Nn({style:mg.defaultStyleProps},t))}getPoints(t){const{direction:e}=t,[n,i]=this.getSize(t);return HZ(n,i,e)}getPortXY(t,e){const{direction:n}=t,{placement:i="top"}=e,a=this.getShape("key").getLocalBounds(),[s,o]=this.getSize(t),l=UZ(s,o,n);return rE(a,i,l,!1)}getIconStyle(t){const{icon:e,iconText:n,iconSrc:i,direction:a}=t;if(e===!1||Ki(n||i))return!1;const s=fn(this.getGraphicStyle(t),"icon"),o=this.getShape("key").getLocalBounds(),[l,u]=uX(o,a),c=cX(o,a)*2*qa;return Object.assign({x:l,y:u,width:c,height:c},s)}}mg.defaultStyleProps={size:40,direction:"up"};var VM=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class Kl extends vi{constructor(t){super(Nn({style:Kl.defaultStyleProps},t)),this.type="combo",this.updateComboPosition(this.parsedAttributes)}getKeySize(t){const{collapsed:e,childrenNode:n=[]}=t;return n.length===0?this.getEmptyKeySize(t):e?this.getCollapsedKeySize(t):this.getExpandedKeySize(t)}getEmptyKeySize(t){const{padding:e,collapsedSize:n}=t,[i,a,s,o]=oa(e);return Lt(Hr(n),[o+a,i+s,0])}getCollapsedKeySize(t){return Hr(t.collapsedSize)}getExpandedKeySize(t){const e=this.getContentBBox(t);return[la(e),ua(e),0]}getContentBBox(t){const{childrenNode:e=[],padding:n}=t,i=e.map(s=>this.context.element.getElement(s)).filter(Boolean);if(i.length===0){const s=new Me,{x:o=0,y:l=0,size:u}=t,[c,h]=Hr(u);return s.setMinMax([o-c/2,l-h/2,0],[o+c/2,l+h/2,0]),s}const a=Ic(i.map(s=>s.getBounds()));return n?Ys(a,n):a}drawCollapsedMarkerShape(t,e){const n=this.getCollapsedMarkerStyle(t);this.upsert("collapsed-marker",kI,n,e),Zx(this)}getCollapsedMarkerStyle(t){if(!t.collapsed||!t.collapsedMarker)return!1;const e=fn(this.getGraphicStyle(t),"collapsedMarker"),{type:n}=e,i=VM(e,["type"]),a=this.getShape("key"),[s,o]=Oa(a.getLocalBounds(),"center"),l=Object.assign(Object.assign({},i),{x:s,y:o});if(n){const u=this.getCollapsedMarkerText(n,t);Object.assign(l,{text:u})}return l}getCollapsedMarkerText(t,e){const{childrenData:n=[]}=e,{model:i}=this.context;return t==="descendant-count"?i.getDescendantsData(this.id).length.toString():t==="child-count"?n.length.toString():t==="node-count"?i.getDescendantsData(this.id).filter(a=>i.getElementType(H(a))==="node").length.toString():Et(t)?t(n):""}getComboPosition(t){const{x:e=0,y:n=0,collapsed:i,childrenData:a=[]}=t;if(a.length===0)return[+e,+n,0];if(i){const{model:s}=this.context,o=s.getDescendantsData(this.id).filter(l=>!s.isCombo(H(l)));if(o.length>0&&o.some(FX)){const l=o.reduce((u,c)=>Lt(u,sn(c)),[0,0,0]);return Di(l,o.length)}return[+e,+n,0]}return this.getContentBBox(t).center}getComboStyle(t){const[e,n]=this.getComboPosition(t);return{x:e,y:n,transform:[["translate",e,n]]}}updateComboPosition(t){const e=this.getComboStyle(t);Object.assign(this.style,e);const{x:n,y:i}=e;this.context.model.syncNodeLikeDatum({id:this.id,style:{x:n,y:i}}),Jx(this)}render(t,e=this){super.render(t,e),this.drawCollapsedMarkerShape(t,e)}update(t={}){super.update(t),this.updateComboPosition(this.parsedAttributes)}onframe(){super.onframe(),this.attributes.collapsed||this.updateComboPosition(this.parsedAttributes),this.drawKeyShape(this.parsedAttributes,this)}animate(t,e){const n=super.animate(this.attributes.collapsed?t:t.map(i=>{var{x:a,y:s,z:o,transform:l}=i,u=VM(i,["x","y","z","transform"]);return u}),e);return n&&new Proxy(n,{set:(i,a,s)=>(a==="currentTime"&&Promise.resolve().then(()=>this.onframe()),Reflect.set(i,a,s))})}}Kl.defaultStyleProps={childrenNode:[],droppable:!0,draggable:!0,collapsed:!1,collapsedSize:32,collapsedMarker:!0,collapsedMarkerZIndex:1,collapsedMarkerFontSize:12,collapsedMarkerTextAlign:"center",collapsedMarkerTextBaseline:"middle",collapsedMarkerType:"child-count"};class lZ extends Kl{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",Ha,this.getKeyStyle(t),e)}getKeyStyle(t){const{collapsed:e}=t,n=super.getKeyStyle(t),[i]=this.getKeySize(t);return Object.assign(Object.assign(Object.assign({},n),e&&fn(n,"collapsed")),{r:i/2})}getCollapsedKeySize(t){const[e,n]=Hr(t.collapsedSize),i=Math.max(e,n)/2;return[i*2,i*2,0]}getExpandedKeySize(t){const e=this.getContentBBox(t),[n,i]=Us(e),a=Math.sqrt(Math.pow(n,2)+Math.pow(i,2))/2;return[a*2,a*2,0]}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return hg(t,n,e)}}class uZ extends Kl{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",Sn,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,i]=this.getKeySize(t);return Object.assign(Object.assign(Object.assign({},e),t.collapsed&&fn(e,"collapsed")),{width:n,height:i,x:-n/2,y:-i/2})}}const cZ={padding:10};function HM(r,t,e,n,i,a){const{padding:s}=Object.assign(cZ,a),o=Ss(e,s),l=Ss(n,s),u=[r,...i,t];let c=null;const h=[];for(let d=0,g=u.length;d<g-1;d++){const p=d+1,v=u[d],m=u[p],b=$X(v,m);let w=null;if(d===0)if(p===g-1)if(o.intersects(l))w=zv(v,m,o,l);else if(!Af(v,o)&&!Af(m,l)){const x=ko(v,o),_=ko(m,l);w=YM(x,_,lr(x,_)),w.points.unshift(x),w.points.push(_)}else b||(w=dZ(v,m,o,l));else Ii(m,o)?w=zv(v,m,o,Ss(m,s),c):b||(w=Qd(v,m,o));else p===g-1?Ii(v,l)?w=zv(v,m,Ss(v,s),l,c):b||(w=zI(v,m,l,c)):b||(w=YM(v,m,c));w?(h.push(...w.points),c=w.direction):c=lr(v,m),p<g-1&&h.push(m)}return h.map(Fo)}const hZ={N:"S",S:"N",W:"E",E:"W"},UM={N:-Math.PI/2,S:Math.PI/2,E:0,W:Math.PI};function lr(r,t){const[e,n]=r,[i,a]=t;return e===i?n>a?"N":"S":n===a?e>i?"W":"E":null}function Fw(r,t){return t==="N"||t==="S"?ua(r):la(r)}function YM(r,t,e){const n=[r[0],t[1]],i=[t[0],r[1]],a=lr(r,n),s=lr(r,i),o=e?hZ[e]:null,l=a===e||a!==o&&s!==e?n:i;return{points:[l],direction:lr(l,t)}}function Qd(r,t,e){if(Af(r,e)){const n=vc(r,t,e);return{points:[n],direction:lr(n,t)}}else{const n=ko(r,e),a=["left","right"].includes(nc(r,e))?[t[0],n[1]]:[n[0],t[1]];return{points:[a],direction:lr(a,t)}}}function zI(r,t,e,n){const i=Af(t,e)?t:ko(t,e),a=[[i[0],r[1]],[r[0],i[1]]],s=a.filter(l=>lX(l,e)&&!iI(l,e,!0)),o=s.filter(l=>lr(l,r)!==n);if(o.length>0){const l=o.find(u=>lr(r,u)===n)||o[0];return{points:[l],direction:lr(l,t)}}else{const l=vW(a,s)[0],u=Rs(t,l,Fw(e,n)/2);return{points:[vc(u,r,e),u],direction:lr(u,t)}}}function dZ(r,t,e,n){let i=Qd(r,t,e);const a=gc(i.points[0]);if(Ii(a,n)){i=Qd(t,r,n);const s=gc(i.points[0]);if(Ii(s,e)){const o=Rs(r,a,Fw(e,lr(r,a))/2),l=Rs(t,s,Fw(n,lr(t,s))/2),u=[(o[0]+l[0])/2,(o[1]+l[1])/2],c=Qd(r,u,e),h=zI(u,t,n,c.direction);i.points=[c.points[0],h.points[0]],i.direction=h.direction}}return i}function zv(r,t,e,n,i){const s=Ic([e,n]),o=Ae(t,s.center)>Ae(r,s.center),[l,u]=o?[t,r]:[r,t],c=ua(s)+la(s);let h;if(i){const p=[l[0]+c*Math.cos(UM[i]),l[1]+c*Math.sin(UM[i])];h=Rs(ko(p,s),p,.01)}else h=Rs(ko(l,s),l,-.01);let d=vc(h,u,s),g=[Ou(h,2),Ou(d,2)];if(Ue(Ou(h),Ou(d))){const p=Ux(be(h,l),[1,0,0])+Math.PI/2;d=[u[0]+c*Math.cos(p),u[1]+c*Math.sin(p),0],d=Ou(Rs(ko(d,s),u,-.01),2);const v=vc(h,d,s);g=[h,v,d]}return{points:o?g.reverse():g,direction:lr(o?h:d,t)}}function vc(r,t,e){let n=[r[0],t[1]];return Ii(n,e)&&(n=[t[0],r[1]]),n}function $I(r,t,e,n,i){let l=typeof t=="number"?t:.5;t==="start"&&(l=0),t==="end"&&(l=.99);const u=zn(r.getPoint(l)),c=zn(r.getPoint(l+.01));let h=t==="start"?"left":t==="end"?"right":"center";if(pI(u,c)||!e){const[b,w]=XM(r,l,n,i);return{transform:[["translate",b,w]],textAlign:h}}let d=Math.atan2(c[1]-u[1],c[0]-u[0]);c[0]<u[0]&&(h=h==="center"?h:h==="left"?"right":"left",n*=-1,d+=Math.PI);const[p,v]=XM(r,l,n,i,d),m=[["translate",p,v],["rotate",d/Math.PI*180]];return{textAlign:h,transform:m}}function fZ(r,t,e,n,i){var a,s;const o=((a=r.badge)===null||a===void 0?void 0:a.getGeometryBounds().halfExtents[0])*2||0,l=((s=r.label)===null||s===void 0?void 0:s.getGeometryBounds().halfExtents[0])*2||0;return $I(r.key,e,!0,(l?(l/2+o/2)*(t==="suffix"?1:-1):0)+n,i)}function XM(r,t,e,n,i){const[a,s]=zn(r.getPoint(t));let o=e,l=n;return i&&(o=e*Math.cos(i)-n*Math.sin(i),l=e*Math.sin(i)+n*Math.cos(i)),[a+o,s+l]}function Bw(r,t,e,n){if(Ue(r,t))return r;const i=be(t,r),a=[r[0]+e*i[0],r[1]+e*i[1]],s=Ba(cg(i,!1));return a[0]+=n*s[0],a[1]+=n*s[1],a}function gZ(r){return yt(r)?[r,-r]:r}function pZ(r){return yt(r)?[r,1-r]:r}function vZ(r,t,e){return[["M",r[0],r[1]],["Q",e[0],e[1],t[0],t[1]]]}function jI(r,t,e){return[["M",r[0],r[1]],["C",e[0][0],e[0][1],e[1][0],e[1][1],t[0],t[1]]]}function eE(r,t=0,e=!1){const n=r[0],i=r[r.length-1],a=r.slice(1,r.length-1),s=[["M",n[0],n[1]]];return a.forEach((o,l)=>{const u=a[l-1]||n,c=a[l+1]||i;if(!vI(u,o,c)&&t){const[h,d]=mZ(u,o,c,t);s.push(["L",h[0],h[1]],["Q",o[0],o[1],d[0],d[1]],["L",d[0],d[1]])}else s.push(["L",o[0],o[1]])}),s.push(["L",i[0],i[1]]),e&&s.push(["Z"]),s}function mZ(r,t,e,n){const i=Pf(r,t),a=Pf(e,t),s=Math.min(n,Math.min(i,a)/2),o=[t[0]-s/i*(t[0]-r[0]),t[1]-s/i*(t[1]-r[1])],l=[t[0]-s/a*(t[0]-e[0]),t[1]-s/a*(t[1]-e[1])];return[o,l]}const yZ=r=>{const t=Math.PI/2,e=ua(r)/2,n=la(r)/2,i=Math.atan2(e,n)/2,a=Math.atan2(n,e)/2;return{top:[-t-a,-t+a],"top-right":[-t+a,-i],"right-top":[-t+a,-i],right:[-i,i],"bottom-right":[i,t-a],"right-bottom":[i,t-a],bottom:[t-a,t+a],"bottom-left":[t+a,Math.PI-i],"left-bottom":[t+a,Math.PI-i],left:[Math.PI-i,Math.PI+i],"top-left":[Math.PI+i,-t-a],"left-top":[Math.PI+i,-t-a]}};function qI(r,t,e,n,i){const a=Ss(r),s=r.getCenter();let o=n&&$s(n),l=i&&$s(i);if(!o||!l){const u=yZ(a),c=u[t][0],h=u[t][1],[d,g]=Us(a),p=Math.max(d,g),v=Lt(s,[p*Math.cos(c),p*Math.sin(c),0]),m=Lt(s,[p*Math.cos(h),p*Math.sin(h),0]);o=$w(r,v),l=$w(r,m),e||([o,l]=[l,o])}return[o,l]}function bZ(r,t,e,n,i,a){const s=r.getPorts()[i||a],o=r.getPorts()[a||i];let[l,u]=qI(r,t,e,s,o);const c=wZ(r,l,u,n);return s&&(l=mc(s,c[0])),o&&(u=mc(o,c[c.length-1])),jI(l,u,c)}function wZ(r,t,e,n){const i=r.getCenter();if(Ue(t,e)){const a=be(t,i),s=[n*Math.sign(a[0])||n/2,n*Math.sign(a[1])||-n/2,0];return[Lt(t,s),Lt(e,Ta(s,[1,-1,1]))]}return[Rs(i,t,Ae(i,t)+n),Rs(i,e,Ae(i,e)+n)]}function xZ(r,t,e,n,i,a,s){const o=iE(r),l=o[a||s],u=o[s||a];let[c,h]=qI(r,e,n,l,u);const d=EZ(r,c,h,i);return l&&(c=mc(l,d[0])),u&&(h=mc(u,d[d.length-1])),eE([c,...d,h],t)}function EZ(r,t,e,n){const i=[],a=Ss(r);if(Ue(t,e))switch(nc(t,a)){case"left":i.push([t[0]-n,t[1]]),i.push([t[0]-n,t[1]+n]),i.push([t[0],t[1]+n]);break;case"right":i.push([t[0]+n,t[1]]),i.push([t[0]+n,t[1]+n]),i.push([t[0],t[1]+n]);break;case"top":i.push([t[0],t[1]-n]),i.push([t[0]+n,t[1]-n]),i.push([t[0]+n,t[1]]);break;case"bottom":i.push([t[0],t[1]+n]),i.push([t[0]+n,t[1]+n]),i.push([t[0]+n,t[1]]);break}else{const s=nc(t,a),o=nc(e,a);if(s===o){const l=s;let u,c;switch(l){case"left":u=Math.min(t[0],e[0])-n,i.push([u,t[1]]),i.push([u,e[1]]);break;case"right":u=Math.max(t[0],e[0])+n,i.push([u,t[1]]),i.push([u,e[1]]);break;case"top":c=Math.min(t[1],e[1])-n,i.push([t[0],c]),i.push([e[0],c]);break;case"bottom":c=Math.max(t[1],e[1])+n,i.push([t[0],c]),i.push([e[0],c]);break}}else{const l=(d,g)=>({left:[g[0]-n,g[1]],right:[g[0]+n,g[1]],top:[g[0],g[1]-n],bottom:[g[0],g[1]+n]})[d],u=l(s,t),c=l(o,e),h=vc(u,c,a);i.push(u,h,c)}}return i}function zw(r,t){const e=new Set,n=new Set,i=new Set;return r.forEach(a=>{t(a).forEach(o=>{e.add(o),r.includes(o.source)&&r.includes(o.target)?n.add(o):i.add(o)})}),{edges:Array.from(e),internal:Array.from(n),external:Array.from(i)}}function KM(r,t){const e=[];let n=r;for(;n;){e.push(n);const i=t(H(n));if(i)n=i;else break}if(e.some(i=>{var a;return(a=i.style)===null||a===void 0?void 0:a.collapsed})){const i=e.reverse().findIndex(Sr);return e[i]||e.at(-1)}return r}function _Z(r,t){return t||(r<4?10:r===4?12:r*2.5)}const SZ=(r,t)=>{const e=Math.max(r,t)/2;return[["M",-r/2,0],["A",e,e,0,1,0,2*e-r/2,0],["A",e,e,0,1,0,-r/2,0],["Z"]]},WI=(r,t)=>[["M",-r/2,0],["L",r/2,-t/2],["L",r/2,t/2],["Z"]],MZ=(r,t)=>[["M",-r/2,0],["L",0,-t/2],["L",r/2,0],["L",0,t/2],["Z"]],kZ=(r,t)=>[["M",-r/2,0],["L",r/2,-t/2],["L",4*r/5-r/2,0],["L",r/2,t/2],["Z"]],TZ=(r,t)=>[["M",-r/2,-t/2],["L",r/2,-t/2],["L",r/2,t/2],["L",-r/2,t/2],["Z"]],OZ=(r,t)=>{const e=r/2,n=r/7,i=r-n;return[["M",-e,0],["L",0,-t/2],["L",0,t/2],["Z"],["M",i-e,-t/2],["L",i+n-e,-t/2],["L",i+n-e,t/2],["L",i-e,t/2],["Z"]]},CZ=(r,t)=>[["M",r/2,-t/2],["L",-r/2,0],["L",r/2,0],["L",-r/2,0],["L",r/2,t/2]],AZ=Object.freeze(Object.defineProperty({__proto__:null,circle:SZ,diamond:MZ,rect:TZ,simple:CZ,triangle:WI,triangleRect:OZ,vee:kZ},Symbol.toStringTag,{value:"Module"}));var _d=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class Ks extends TI{constructor(t){super(Nn({style:Ks.defaultStyleProps},t)),this.type="edge"}get sourceNode(){const{sourceNode:t}=this.parsedAttributes;return this.context.element.getElement(t)}get targetNode(){const{targetNode:t}=this.parsedAttributes;return this.context.element.getElement(t)}getKeyStyle(t){const e=this.getGraphicStyle(t),{loop:n}=e,i=_d(e,["loop"]),{sourceNode:a,targetNode:s}=this,l={d:n&&$Z(a,s)?this.getLoopPath(t):this.getKeyPath(t)};return qr.PARSED_STYLE_LIST.forEach(u=>{u in i&&(l[u]=i[u])}),l}getLoopPath(t){const{sourcePort:e,targetPort:n}=t,i=this.sourceNode,a=Ss(i),s=Math.max(la(a),ua(a)),{placement:o,clockwise:l,dist:u=s}=fn(this.getGraphicStyle(t),"loop");return bZ(i,o,l,u,e,n)}getEndpoints(t,e=!0,n=[]){const{sourcePort:i,targetPort:a}=t,{sourceNode:s,targetNode:o}=this,[l,u]=qZ(s,o,i,a);if(!e){const g=l?$s(l):s.getCenter(),p=u?$s(u):o.getCenter();return[g,p]}const c=typeof n=="function"?n():n,h=ek(l||s,c[0]||u||o),d=ek(u||o,c[c.length-1]||l||s);return[h,d]}getHaloStyle(t){if(t.halo===!1)return!1;const e=this.getKeyStyle(t),n=fn(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign({},e),n)}getLabelStyle(t){if(t.label===!1||!t.labelText)return!1;const e=fn(this.getGraphicStyle(t),"label"),{placement:n,offsetX:i,offsetY:a,autoRotate:s,maxWidth:o}=e,l=_d(e,["placement","offsetX","offsetY","autoRotate","maxWidth"]),u=$I(this.shapeMap.key,n,s,i,a),c=this.shapeMap.key.getLocalBounds(),h=eK([c.min,c.max],o);return Object.assign({wordWrapWidth:h},u,l)}getBadgeStyle(t){if(t.badge===!1||!t.badgeText)return!1;const e=fn(t,"badge"),{offsetX:n,offsetY:i,placement:a}=e,s=_d(e,["offsetX","offsetY","placement"]);return Object.assign(s,fZ(this.shapeMap,a,t.labelPlacement,n,i))}drawArrow(t,e){var n;const i=e==="start",s=t[e==="start"?"startArrow":"endArrow"],o=this.shapeMap.key;if(s){const l=this.getArrowStyle(t,i),[u,c,h]=i?["markerStart","markerStartOffset","startArrowOffset"]:["markerEnd","markerEndOffset","endArrowOffset"],d=o.parsedStyle[u];if(d)d.attr(l);else{const g=l.src?Lc:qr,p=new g({style:l});o.style[u]=p}o.style[c]=t[h]||l.width/2+ +l.lineWidth}else{const l=i?"markerStart":"markerEnd";(n=o.style[l])===null||n===void 0||n.destroy(),o.style[l]=null}}getArrowStyle(t,e){const n=this.getShape("key").attributes,i=e?"startArrow":"endArrow",a=fn(this.getGraphicStyle(t),i),{size:s,type:o}=a,l=_d(a,["size","type"]),[u,c]=Hr(_Z(n.lineWidth,s)),d=(Et(o)?o:AZ[o]||WI)(u,c);return Object.assign(No(n,["stroke","strokeOpacity","fillOpacity"]),{width:u,height:c},Object.assign({},d&&{d,fill:o==="simple"?"":n.stroke}),l)}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",Xs,n,e)}drawHaloShape(t,e){const n=this.getHaloStyle(t);this.upsert("halo",qr,n,e)}drawBadgeShape(t,e){const n=this.getBadgeStyle(t);this.upsert("badge",za,n,e)}drawSourceArrow(t){this.drawArrow(t,"start")}drawTargetArrow(t){this.drawArrow(t,"end")}drawKeyShape(t,e){const n=this.getKeyStyle(t);return this.upsert("key",qr,n,e)}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e),this.getShape("key")&&(this.drawSourceArrow(t),this.drawTargetArrow(t),this.drawLabelShape(t,e),this.drawHaloShape(t,e),this.drawBadgeShape(t,e))}onframe(){this.drawKeyShape(this.parsedAttributes,this),this.drawSourceArrow(this.parsedAttributes),this.drawTargetArrow(this.parsedAttributes),this.drawHaloShape(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this),this.drawBadgeShape(this.parsedAttributes,this)}animate(t,e){const n=super.animate(t,e);return n&&new Proxy(n,{set:(i,a,s)=>(a==="currentTime"&&Promise.resolve().then(()=>this.onframe()),Reflect.set(i,a,s))})}}Ks.defaultStyleProps={badge:!0,badgeOffsetX:0,badgeOffsetY:0,badgePlacement:"suffix",isBillboard:!0,label:!0,labelAutoRotate:!0,labelIsBillboard:!0,labelMaxWidth:"80%",labelOffsetX:4,labelOffsetY:0,labelPlacement:"center",labelTextBaseline:"middle",labelWordWrap:!1,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloPointerEvents:"none",haloStrokeOpacity:.25,haloZIndex:-1,loop:!0,startArrow:!1,startArrowLineDash:0,startArrowLineJoin:"round",startArrowLineWidth:1,startArrowTransformOrigin:"center",startArrowType:"vee",endArrow:!1,endArrowLineDash:0,endArrowLineJoin:"round",endArrowLineWidth:1,endArrowTransformOrigin:"center",endArrowType:"vee",loopPlacement:"top",loopClockwise:!0};class Vo extends Ks{constructor(t){super(Nn({style:Vo.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t),{controlPoints:i,curvePosition:a,curveOffset:s}=t,o=this.getControlPoints(e,n,pZ(a),gZ(s),i);return jI(e,n,o)}getControlPoints(t,e,n,i,a){return(a==null?void 0:a.length)===2?a:[Bw(t,e,n[0],i[0]),Bw(t,e,n[1],i[1])]}}Vo.defaultStyleProps={curvePosition:.5,curveOffset:20};class $c extends Vo{constructor(t){super(Nn({style:$c.defaultStyleProps},t))}getControlPoints(t,e,n,i){const a=e[0]-t[0];return[[t[0]+a*n[0]+i[0],t[1]],[e[0]-a*n[1]+i[1],e[1]]]}}$c.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};class yg extends Vo{constructor(t){super(Nn({style:yg.defaultStyleProps},t))}get ref(){return this.context.model.getRootsData()[0]}getEndpoints(t){if(this.sourceNode.id===this.ref.id)return super.getEndpoints(t);const e=sn(this.ref),n=this.sourceNode.getIntersectPoint(e,!0),i=this.targetNode.getIntersectPoint(e);return[n,i]}toRadialCoordinate(t){const e=sn(this.ref),n=Ae(t,e),i=dI(be(t,e));return[n,i]}getControlPoints(t,e,n,i){const[a,s]=this.toRadialCoordinate(t),[o]=this.toRadialCoordinate(e),l=o-a;return[[t[0]+(l*n[0]+i[0])*Math.cos(s),t[1]+(l*n[0]+i[0])*Math.sin(s)],[e[0]-(l*n[1]-i[0])*Math.cos(s),e[1]-(l*n[1]-i[0])*Math.sin(s)]]}}yg.defaultStyleProps={curvePosition:.5,curveOffset:20};class bg extends Vo{constructor(t){super(Nn({style:bg.defaultStyleProps},t))}getControlPoints(t,e,n,i){const a=e[1]-t[1];return[[t[0],t[1]+a*n[0]+i[0]],[e[0],e[1]-a*n[1]+i[1]]]}}bg.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};let GI=class VI extends Ks{constructor(t){super(Nn({style:VI.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t);return[["M",e[0],e[1]],["L",n[0],n[1]]]}};GI.defaultStyleProps={};const PZ={enableObstacleAvoidance:!1,offset:10,maxAllowedDirectionChange:Math.PI/2,maximumLoops:3e3,gridSize:5,startDirections:["top","right","bottom","left"],endDirections:["top","right","bottom","left"],directionMap:{right:{stepX:1,stepY:0},left:{stepX:-1,stepY:0},bottom:{stepX:0,stepY:1},top:{stepX:0,stepY:-1}},penalties:{0:0,90:0},distFunc:Pf},_a=r=>`${Math.round(r[0])}|||${Math.round(r[1])}`;function xo(r,t){const e=n=>Math.round(n/t);return yt(r)?e(r):r.map(e)}function NZ(r,t){const e=Math.abs(r-t);return e>Math.PI?2*Math.PI-e:e}function ZM(r,t){const e=t[0]-r[0],n=t[1]-r[1];return!e&&!n?0:Math.atan2(n,e)}function HI(r,t,e,n){const i=ZM(r,t),a=e[_a(r)],o=ZM(a||n,r);return NZ(o,i)}const RZ=(r,t)=>{const{offset:e,gridSize:n}=t,i={};return r.forEach(a=>{if(!a||a.destroyed||!a.isVisible())return;const s=Ys(a.getRenderBounds(),e);for(let o=xo(s.min[0],n);o<=xo(s.max[0],n);o+=1)for(let l=xo(s.min[1],n);l<=xo(s.max[1],n);l+=1)i[`${o}|||${l}`]=!0}),i};function JM(r,t,e){return Math.min(...t.map(n=>e(r,n)))}function LZ(r,t,e){let n=r[0],i=e(r[0],t);for(let a=0;a<r.length;a++){const s=r[a],o=e(s,t);o<i&&(n=s,i=o)}return n}const QM=(r,t,e,n)=>{if(!t)return[r];const{directionMap:i,offset:a}=n,s=Ys(t.getRenderBounds(),a),o=Object.keys(i).reduce((l,u)=>{if(e.includes(u)){const c=i[u],[h,d]=Us(s),g=[r[0]+c.stepX*h,r[1]+c.stepY*d],p=hX(s);for(let v=0;v<p.length;v++){const m=Yx([r,g],p[v]);m&&iI(m,s)&&l.push(m)}}return l},[]);return Ii(r,s)||o.push(r),o.map(l=>xo(l,n.gridSize))},IZ=(r,t,e,n,i,a,s)=>{const o=[];let l=[a[0]===n[0]?n[0]:r[0]*s,a[1]===n[1]?n[1]:r[1]*s];o.unshift(l);let u=r,c=t[_a(u)];for(;c;){const g=c,p=u;HI(g,p,t,e)&&(l=[g[0]===p[0]?l[0]:g[0]*s,g[1]===p[1]?l[1]:g[1]*s],o.unshift(l)),c=t[_a(g)],u=g}const h=i.map(g=>[g[0]*s,g[1]*s]),d=LZ(h,l,Pf);return o.unshift(d),o};function DZ(r,t,e,n){const i=Fo(r.getCenter()),a=Fo(t.getCenter()),s=Object.assign(PZ,n),{gridSize:o}=s,l=s.enableObstacleAvoidance?e:[r,t],u=RZ(l,s),c=xo(i,o),h=xo(a,o),d=QM(i,r,s.startDirections,s),g=QM(a,t,s.endDirections,s);d.forEach(T=>delete u[_a(T)]),g.forEach(T=>delete u[_a(T)]);const p={},v={},m={},b={},w={},x=new FZ;for(let T=0;T<d.length;T++){const P=d[T],O=_a(P);p[O]=P,b[O]=0,w[O]=JM(P,g,s.distFunc),x.add({id:O,value:w[O]})}const _=g.map(T=>_a(T));let S=s.maximumLoops,M,k=1/0;for(const[T,P]of Object.entries(p))w[T]<=k&&(k=w[T],M=P);for(;Object.keys(p).length>0&&S>0;){const T=x.minId(!1);if(T)M=p[T];else break;const P=_a(M);if(_.includes(P))return IZ(M,m,c,a,d,h,o);delete p[P],x.remove(P),v[P]=!0;for(const O of Object.values(s.directionMap)){const A=Lt(M,[O.stepX,O.stepY]),R=_a(A);if(v[R])continue;const L=HI(M,A,m,c);if(L>s.maxAllowedDirectionChange||u[R])continue;p[R]||(p[R]=A);const q=s.penalties[L],j=s.distFunc(M,A)+(isNaN(q)?o:q),$=b[P]+j,B=b[R];B&&$>=B||(m[R]=M,b[R]=$,w[R]=$+JM(A,g,s.distFunc),x.add({id:R,value:w[R]}))}S-=1}return[]}class FZ{constructor(){this.arr=[],this.map={},this.arr=[],this.map={}}_innerAdd(t,e){let n=0,i=e-1;for(;i-n>1;){const a=Math.floor((n+i)/2);if(this.arr[a].value>t.value)i=a;else if(this.arr[a].value<t.value)n=a;else{this.arr.splice(a,0,t),this.map[t.id]=!0;return}}this.arr.splice(i,0,t),this.map[t.id]=!0}add(t){delete this.map[t.id];const e=this.arr.length;if(!e||this.arr[e-1].value<t.value){this.arr.push(t),this.map[t.id]=!0;return}this._innerAdd(t,e)}remove(t){this.map[t]&&delete this.map[t]}_clearAndGetMinId(){let t;for(let e=this.arr.length-1;e>=0;e--)this.map[this.arr[e].id]?t=this.arr[e].id:this.arr.splice(e,1);return t}_findFirstId(){for(;this.arr.length;){const t=this.arr.shift();if(this.map[t.id])return t.id}}minId(t){return t?this._clearAndGetMinId():this._findFirstId()}}class wg extends Ks{constructor(t){super(Nn({style:wg.defaultStyleProps},t))}getControlPoints(t){const{router:e}=t,{sourceNode:n,targetNode:i}=this,[a,s]=this.getEndpoints(t,!1);let o=[];if(!e)o=t.controlPoints;else if(e.type==="shortest-path"){const l=this.context.element.getNodes();o=DZ(n,i,l,e),o.length||(o=HM(a,s,n,i,t.controlPoints,{padding:e.offset}))}else e.type==="orth"&&(o=HM(a,s,n,i,t.controlPoints,e));return o}getPoints(t){const e=this.getControlPoints(t),[n,i]=this.getEndpoints(t,!0,e);return[n,...e,i]}getKeyPath(t){const e=this.getPoints(t);return eE(e,t.radius)}getLoopPath(t){const{sourcePort:e,targetPort:n,radius:i}=t,a=this.sourceNode,s=Ss(a),o=Math.max(la(s),ua(s))/4,{placement:l,clockwise:u,dist:c=o}=fn(this.getGraphicStyle(t),"loop");return xZ(a,i,l,u,c,e,n)}}wg.defaultStyleProps={radius:0,controlPoints:[],router:!1};class xg extends Ks{constructor(t){super(Nn({style:xg.defaultStyleProps},t))}getKeyPath(t){const{curvePosition:e,curveOffset:n}=t,[i,a]=this.getEndpoints(t),s=t.controlPoint||Bw(i,a,e,n);return vZ(i,a,s)}}xg.defaultStyleProps={curvePosition:.5,curveOffset:30};var BZ=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};function jc(r){return r instanceof vi&&r.type==="node"}function UI(r){return r instanceof Ks}function nE(r){return r instanceof Kl}function zZ(r){return jc(r)||UI(r)||nE(r)}function $Z(r,t){return!r||!t?!1:r===t}const jZ={top:[.5,0],right:[1,.5],bottom:[.5,1],left:[0,.5],default:[.5,.5]};function rE(r,t,e=jZ,n=!0){const i=[.5,.5],a=oe(t)?sr(e,t.toLocaleLowerCase(),i):t;if(!n&&oe(t))return a;const[s,o]=a||i;return[r.min[0]+la(r)*s,r.min[1]+ua(r)*o]}function iE(r){if(!r)return{};const t=r.getPorts();return(r.attributes.ports||[]).forEach((n,i)=>{var a;const{key:s,placement:o}=n;YI(n)&&(t[a=s||i]||(t[a]=Oa(r.getShape("key").getBounds(),o)))}),t}function YI(r){const{r:t}=r;return!t||Number(t)===0}function $s(r){return Vl(r)?r:r.getPosition()}function qZ(r,t,e,n){const i=tk(r,t,e,n),a=tk(t,r,n,e);return[i,a]}function tk(r,t,e,n){const i=iE(r);if(e)return i[e];const a=Object.values(i);if(a.length===0)return;const s=a.map(u=>$s(u)),o=WZ(t,n),[l]=WX(s,o);return a.find(u=>$s(u)===l)}function WZ(r,t){const e=iE(r);if(t)return[$s(e[t])];const n=Object.values(e);return n.length>0?n.map(i=>$s(i)):[r.getCenter()]}function ek(r,t){return nE(r)||jc(r)?$w(r,t):mc(r,t)}function mc(r,t){if(!r||!t)return[0,0,0];if(Vl(r))return r;if(r.attributes.linkToCenter)return r.getPosition();const e=Vl(t)?t:jc(t)?t.getCenter():t.getPosition();return hg(e,r.getBounds())}function $w(r,t){if(!r||!t)return[0,0,0];const e=Vl(t)?t:jc(t)?t.getCenter():t.getPosition();return r.getIntersectPoint(e)||r.getCenter()}function nk(r,t="bottom",e=0,n=0,i=!1){const a=t.split("-"),[s,o]=Oa(r,t),l=a.includes("left")?"right":a.includes("right")?"left":"center";let u=a.includes("top")?"bottom":a.includes("bottom")?"top":"middle";return i&&(u=u==="top"?"bottom":u==="bottom"?"top":u),{transform:[["translate",s+e,o+n]],textBaseline:u,textAlign:l}}function GZ(r,t){return[[0,-r],[t*Math.cos(3*Math.PI/10),-t*Math.sin(3*Math.PI/10)],[r*Math.cos(Math.PI/10),-r*Math.sin(Math.PI/10)],[t*Math.cos(Math.PI/10),t*Math.sin(Math.PI/10)],[r*Math.cos(3*Math.PI/10),r*Math.sin(3*Math.PI/10)],[0,t],[-r*Math.cos(3*Math.PI/10),r*Math.sin(3*Math.PI/10)],[-t*Math.cos(Math.PI/10),t*Math.sin(Math.PI/10)],[-r*Math.cos(Math.PI/10),-r*Math.sin(Math.PI/10)],[-t*Math.cos(3*Math.PI/10),-t*Math.sin(3*Math.PI/10)]]}function VZ(r,t){const e={};return e.top=[0,-r],e.left=[-r*Math.cos(Math.PI/10),-r*Math.sin(Math.PI/10)],e["left-bottom"]=[-r*Math.cos(3*Math.PI/10),r*Math.sin(3*Math.PI/10)],e.bottom=[0,t],e["right-bottom"]=[r*Math.cos(3*Math.PI/10),r*Math.sin(3*Math.PI/10)],e.right=e.default=[r*Math.cos(Math.PI/10),-r*Math.sin(Math.PI/10)],e}function HZ(r,t,e){const n=t/2,i=r/2,a={up:[[-i,n],[i,n],[0,-n]],left:[[-i,0],[i,n],[i,-n]],right:[[-i,n],[-i,-n],[i,0]],down:[[-i,-n],[i,-n],[0,n]]};return a[e]||a.up}function UZ(r,t,e){const n=t/2,i=r/2,a={};return e==="down"?(a.bottom=a.default=[0,n],a.right=[i,-n],a.left=[-i,-n]):e==="left"?(a.top=[i,-n],a.bottom=[i,n],a.left=a.default=[-i,0]):e==="right"?(a.top=[-i,-n],a.bottom=[-i,n],a.right=a.default=[i,0]):(a.left=[-i,n],a.top=a.default=[0,-n],a.right=[i,n]),a}function YZ(r,t){return[[0,-t/2],[r/2,0],[0,t/2],[-r/2,0]]}function XZ(r){return sr(r,["style","visibility"])!=="hidden"}function KZ(r,t){const{zIndex:e,transform:n,transformOrigin:i,visibility:a,cursor:s,clipPath:o,component:l}=t,u=BZ(t,["zIndex","transform","transformOrigin","visibility","cursor","clipPath","component"]);Object.assign(r.attributes,u),n&&r.setAttribute("transform",n),yt(e)&&r.setAttribute("zIndex",e),i&&r.setAttribute("transformOrigin",i),a&&r.setAttribute("visibility",a),s&&r.setAttribute("cursor",s),o&&r.setAttribute("clipPath",o),l&&r.setAttribute("component",l)}function jw(r,t){"update"in r?r.update(t):r.attr(t)}function ZZ(r){return[[0,r],[r*Math.sqrt(3)/2,r/2],[r*Math.sqrt(3)/2,-r/2],[0,-r],[-r*Math.sqrt(3)/2,-r/2],[-r*Math.sqrt(3)/2,r/2]]}function JZ(r){uc(r,"__to_be_destroyed__",!0)}function Eg(r){return sr(r,"__to_be_destroyed__",!1)}var QZ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class _g extends Or{constructor(t,e){super(t,Object.assign({},_g.defaultOptions,e)),this.onCollapseExpand=n=>QZ(this,void 0,void 0,function*(){if(!this.validate(n))return;const{target:i}=n;if(!zZ(i))return;const a=i.id,{model:s,graph:o}=this.context,l=s.getElementDataById(a);if(!l)return!1;const{onCollapse:u,onExpand:c,animation:h,align:d}=this.options;Sr(l)?(yield o.expandElement(a,{animation:h,align:d}),c==null||c(a)):(yield o.collapseElement(a,{animation:h,align:d}),u==null||u(a))}),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`node:${e}`,this.onCollapseExpand),t.on(`combo:${e}`,this.onCollapseExpand)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`node:${e}`,this.onCollapseExpand),t.off(`combo:${e}`,this.onCollapseExpand)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}_g.defaultOptions={enable:!0,animation:!0,trigger:J.DBLCLICK,align:!0};var Sd=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};const tJ="g6-create-edge-assist-edge-id",Md="g6-create-edge-assist-node-id";class Sg extends Or{constructor(t,e){super(t,Object.assign({},Sg.defaultOptions,e)),this.drop=n=>Sd(this,void 0,void 0,function*(){const{targetType:i}=n;["combo","node"].includes(i)&&this.source?yield this.handleCreateEdge(n):yield this.cancelEdge()}),this.handleCreateEdge=n=>Sd(this,void 0,void 0,function*(){var i,a,s;if(!this.validate(n))return;const{graph:o,canvas:l,batch:u,element:c}=this.context,{style:h}=this.options;if(this.source){this.createEdge(n),yield this.cancelEdge();return}u.startBatch(),l.setCursor("crosshair"),this.source=this.getSelectedNodeIDs([n.target.id])[0];const d=o.getElementData(this.source);o.addNodeData([{id:Md,style:{visibility:"hidden",ports:[{key:"port-1",placement:[.5,.5]}],x:(i=d.style)===null||i===void 0?void 0:i.x,y:(a=d.style)===null||a===void 0?void 0:a.y}}]),o.addEdgeData([{id:tJ,source:this.source,target:Md,style:Object.assign({pointerEvents:"none"},h)}]),yield(s=c.draw({animation:!1}))===null||s===void 0?void 0:s.finished}),this.updateAssistEdge=n=>Sd(this,void 0,void 0,function*(){var i;if(!this.source)return;const{model:a,element:s}=this.context;a.translateNodeTo(Md,[n.canvas.x,n.canvas.y]),yield(i=s.draw({animation:!1,silence:!0}))===null||i===void 0?void 0:i.finished}),this.createEdge=n=>{var i,a;const{graph:s}=this.context,{style:o,onFinish:l,onCreate:u}=this.options;if(((i=n.target)===null||i===void 0?void 0:i.id)===void 0||this.source===void 0)return;const h=(a=this.getSelectedNodeIDs([n.target.id]))===null||a===void 0?void 0:a[0],d=`${this.source}-${h}-${FW()}`,g=u({id:d,source:this.source,target:h,style:o});s.addEdgeData([g]),l(g)},this.cancelEdge=()=>Sd(this,void 0,void 0,function*(){var n;if(!this.source)return;const{graph:i,element:a,batch:s}=this.context;i.removeNodeData([Md]),this.source=void 0,yield(n=a.draw({animation:!1}))===null||n===void 0?void 0:n.finished,s.endBatch()}),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;this.unbindEvents(),e==="click"?(t.on(Zn.CLICK,this.handleCreateEdge),t.on(bo.CLICK,this.handleCreateEdge),t.on($a.CLICK,this.cancelEdge),t.on(Cf.CLICK,this.cancelEdge)):(t.on(Zn.DRAG_START,this.handleCreateEdge),t.on(bo.DRAG_START,this.handleCreateEdge),t.on(J.POINTER_UP,this.drop)),t.on(J.POINTER_MOVE,this.updateAssistEdge)}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map(e=>e.id).concat(t)))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;t.off(Zn.CLICK,this.handleCreateEdge),t.off(bo.CLICK,this.handleCreateEdge),t.off($a.CLICK,this.cancelEdge),t.off(Cf.CLICK,this.cancelEdge),t.off(Zn.DRAG_START,this.handleCreateEdge),t.off(bo.DRAG_START,this.handleCreateEdge),t.off(J.POINTER_UP,this.drop),t.off(J.POINTER_MOVE,this.updateAssistEdge)}destroy(){this.unbindEvents(),super.destroy()}}Sg.defaultOptions={animation:!0,enable:!0,style:{},trigger:"drag",onCreate:r=>r,onFinish:()=>{}};var rk=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Mg extends Or{constructor(t,e){super(t,Object.assign({},Mg.defaultOptions,e)),this.isDragging=!1,this.onDragStart=n=>{this.validate(n)&&(this.isDragging=!0,this.context.canvas.setCursor("grabbing"))},this.onDrag=n=>{var i,a,s,o;if(!this.isDragging)return;const l=(a=(i=n.movement)===null||i===void 0?void 0:i.x)!==null&&a!==void 0?a:n.dx,u=(o=(s=n.movement)===null||s===void 0?void 0:s.y)!==null&&o!==void 0?o:n.dy;l|u&&this.translate([l,u],!1)},this.onDragEnd=()=>{var n,i;this.isDragging=!1,this.context.canvas.setCursor(this.defaultCursor),(i=(n=this.options).onFinish)===null||i===void 0||i.call(n)},this.invokeOnFinish=Oc(()=>{var n,i;(i=(n=this.options).onFinish)===null||i===void 0||i.call(n)},300),this.shortcut=new Xl(t.graph),this.bindEvents(),this.defaultCursor=this.context.canvas.getConfig().cursor||"default"}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{trigger:t}=this.options;if(an(t)){const{up:e=[],down:n=[],left:i=[],right:a=[]}=t;this.shortcut.bind(e,s=>this.onTranslate([0,1],s)),this.shortcut.bind(n,s=>this.onTranslate([0,-1],s)),this.shortcut.bind(i,s=>this.onTranslate([1,0],s)),this.shortcut.bind(a,s=>this.onTranslate([-1,0],s))}else{const{graph:e}=this.context;e.on(J.DRAG_START,this.onDragStart),e.on(J.DRAG,this.onDrag),e.on(J.DRAG_END,this.onDragEnd)}}onTranslate(t,e){return rk(this,void 0,void 0,function*(){if(!this.validate(e))return;const{sensitivity:n}=this.options,i=n*-1;yield this.translate(Ta(t,i),this.options.animation),this.invokeOnFinish()})}translate(t,e){return rk(this,void 0,void 0,function*(){t=this.clampByDirection(t),t=this.clampByRange(t),yield this.context.graph.translateBy(t,e)})}clampByDirection([t,e]){const{direction:n}=this.options;return n==="x"?e=0:n==="y"&&(t=0),[t,e]}clampByRange([t,e]){const{viewport:n,canvas:i}=this.context,[a,s]=i.getSize(),[o,l,u,c]=oa(this.options.range),h=[s*o,a*l,s*u,a*c],d=Ys(Wx(n.getCanvasCenter()),h),g=be(n.getViewportCenter(),[t,e,0]);if(!Ii(g,d)){const{min:[p,v],max:[m,b]}=d;(g[0]<p&&t>0||g[0]>m&&t<0)&&(t=0),(g[1]<v&&e>0||g[1]>b&&e<0)&&(e=0)}return[t,e]}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return typeof e=="function"?e(t):!!e}unbindEvents(){this.shortcut.unbindAll();const{graph:t}=this.context;t.off(J.DRAG_START,this.onDragStart),t.off(J.DRAG,this.onDrag),t.off(J.DRAG_END,this.onDragEnd)}destroy(){this.shortcut.destroy(),this.unbindEvents(),this.context.canvas.setCursor(this.defaultCursor),super.destroy()}}Mg.defaultOptions={enable:r=>"targetType"in r?r.targetType==="canvas":!0,sensitivity:10,direction:"both",range:1/0};var ik=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class qc extends Or{constructor(t,e){super(t,Object.assign({},qc.defaultOptions,e)),this.enable=!1,this.enableElements=["node","combo"],this.target=[],this.shadowOrigin=[0,0],this.hiddenEdges=[],this.isDragging=!1,this.onDrop=n=>ik(this,void 0,void 0,function*(){var i;if(this.options.dropEffect!=="link")return;const{model:a,element:s}=this.context,o=n.target.id;this.target.forEach(l=>{const u=a.getParentData(l,we);u&&H(u)===o&&a.refreshComboData(o),a.setParent(l,o,we)}),yield(i=s==null?void 0:s.draw({animation:!0}))===null||i===void 0?void 0:i.finished}),this.setCursor=n=>{if(this.isDragging)return;const{type:i}=n,{canvas:a}=this.context,{cursor:s}=this.options;i===J.POINTER_ENTER?a.setCursor((s==null?void 0:s.grab)||"grab"):a.setCursor((s==null?void 0:s.default)||"default")},this.onDragStart=this.onDragStart.bind(this),this.onDrag=this.onDrag.bind(this),this.onDragEnd=this.onDragEnd.bind(this),this.onDrop=this.onDrop.bind(this),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{graph:t,canvas:e}=this.context,n=e.getLayer().getContextService().$canvas;n&&(n.addEventListener("blur",this.onDragEnd),n.addEventListener("contextmenu",this.onDragEnd)),this.enableElements.forEach(i=>{t.on(`${i}:${J.DRAG_START}`,this.onDragStart),t.on(`${i}:${J.DRAG}`,this.onDrag),t.on(`${i}:${J.DRAG_END}`,this.onDragEnd),t.on(`${i}:${J.POINTER_ENTER}`,this.setCursor),t.on(`${i}:${J.POINTER_LEAVE}`,this.setCursor)}),["link"].includes(this.options.dropEffect)&&(t.on(bo.DROP,this.onDrop),t.on($a.DROP,this.onDrop))}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map(e=>e.id).concat(t)))}getDelta(t){const e=this.context.graph.getZoom();return Di([t.dx,t.dy],e)}onDragStart(t){var e;if(this.enable=this.validate(t),!this.enable)return;const{batch:n,canvas:i,graph:a}=this.context;i.setCursor(((e=this.options.cursor)===null||e===void 0?void 0:e.grabbing)||"grabbing"),this.isDragging=!0,n.startBatch();const s=t.target.id;a.getElementState(s).includes(this.options.state)?this.target=this.getSelectedNodeIDs([s]):this.target=[s],this.hideEdge(),this.context.graph.frontElement(this.target),this.options.shadow&&this.createShadow(this.target)}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.options.shadow?this.moveShadow(e):this.moveElement(this.target,e)}onDragEnd(){var t,e,n;if(this.enable=!1,this.options.shadow){if(!this.shadow)return;this.shadow.style.visibility="hidden";const{x:s=0,y:o=0}=this.shadow.attributes,[l,u]=be([+s,+o],this.shadowOrigin);this.moveElement(this.target,[l,u])}this.showEdges(),(e=(t=this.options).onFinish)===null||e===void 0||e.call(t,this.target);const{batch:i,canvas:a}=this.context;i.endBatch(),a.setCursor(((n=this.options.cursor)===null||n===void 0?void 0:n.grab)||"grab"),this.isDragging=!1,this.target=[]}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}moveElement(t,e){return ik(this,void 0,void 0,function*(){const{graph:n,model:i}=this.context,{dropEffect:a}=this.options;a==="move"&&t.forEach(s=>i.refreshComboData(s)),n.translateElementBy(Object.fromEntries(t.map(s=>[s,e])),!1)})}moveShadow(t){if(!this.shadow)return;const{x:e=0,y:n=0}=this.shadow.attributes,[i,a]=t;this.shadow.attr({x:+e+i,y:+n+a})}createShadow(t){const e=fn(this.options,"shadow"),n=Ic(t.map(u=>this.context.element.getElement(u).getBounds())),[i,a]=n.min;this.shadowOrigin=[i,a];const[s,o]=Us(n),l={width:s,height:o,x:i,y:a};this.shadow?this.shadow.attr(Object.assign(Object.assign(Object.assign({},e),l),{visibility:"visible"})):(this.shadow=new Sn({style:Object.assign(Object.assign(Object.assign({$layer:"transient"},e),l),{pointerEvents:"none"})}),this.context.canvas.appendChild(this.shadow))}showEdges(){this.options.shadow||this.hiddenEdges.length===0||(this.context.graph.showElement(this.hiddenEdges),this.hiddenEdges=[])}hideEdge(){const{hideEdge:t,shadow:e}=this.options;if(t==="none"||e)return;const{graph:n}=this.context;t==="all"?this.hiddenEdges=n.getEdgeData().map(H):this.hiddenEdges=Array.from(new Set(this.target.map(i=>n.getRelatedEdgesData(i,t).map(H)).flat())),n.hideElement(this.hiddenEdges)}unbindEvents(){const{graph:t,canvas:e}=this.context,n=e.getLayer().getContextService().$canvas;n&&(n.removeEventListener("blur",this.onDragEnd),n.removeEventListener("contextmenu",this.onDragEnd)),this.enableElements.forEach(i=>{t.off(`${i}:${J.DRAG_START}`,this.onDragStart),t.off(`${i}:${J.DRAG}`,this.onDrag),t.off(`${i}:${J.DRAG_END}`,this.onDragEnd),t.off(`${i}:${J.POINTER_ENTER}`,this.setCursor),t.off(`${i}:${J.POINTER_LEAVE}`,this.setCursor)}),t.off(`combo:${J.DROP}`,this.onDrop),t.off(`canvas:${J.DROP}`,this.onDrop)}destroy(){var t;this.unbindEvents(),(t=this.shadow)===null||t===void 0||t.destroy(),super.destroy()}}qc.defaultOptions={animation:!0,enable:r=>["node","combo"].includes(r.targetType),dropEffect:"move",state:"selected",hideEdge:"none",shadow:!1,shadowZIndex:100,shadowFill:"#F3F9FF",shadowFillOpacity:.5,shadowStroke:"#1890FF",shadowStrokeOpacity:.9,shadowLineDash:[5,5],cursor:{default:"default",grab:"grab",grabbing:"grabbing"}};var eJ="*",kg=function(){function r(){this._events={}}return r.prototype.on=function(t,e,n){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!n}),this},r.prototype.once=function(t,e){return this.on(t,e,!0)},r.prototype.emit=function(t){for(var e=this,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var a=this._events[t]||[],s=this._events[eJ]||[],o=function(l){for(var u=l.length,c=0;c<u;c++)if(l[c]){var h=l[c],d=h.callback,g=h.once;g&&(l.splice(c,1),l.length===0&&delete e._events[t],u--,c--),d.apply(e,n)}};o(a),o(s)},r.prototype.off=function(t,e){if(!t)this._events={};else if(!e)delete this._events[t];else{for(var n=this._events[t]||[],i=n.length,a=0;a<i;a++)n[a].callback===e&&(n.splice(a,1),i--,a--);n.length===0&&delete this._events[t]}return this},r.prototype.getEvents=function(){return this._events},r}();function qw(r,t,e,n){for(;r.length;){const i=r.shift();if(e(i))return!0;t.add(i.id),n(i.id).forEach(s=>{t.has(s.id)||(t.add(s.id),r.push(s))})}return!1}function Ff(r,t,e,n){if(e(r))return!0;t.add(r.id);for(const a of n(r.id))if(!t.has(a.id)&&Ff(a,t,e,n))return!0;return!1}const ak=()=>!0;class nJ{constructor(t){le(this,"graph");le(this,"nodeFilter");le(this,"edgeFilter");le(this,"cacheEnabled");le(this,"inEdgesMap",new Map);le(this,"outEdgesMap",new Map);le(this,"bothEdgesMap",new Map);le(this,"allNodesMap",new Map);le(this,"allEdgesMap",new Map);le(this,"clearCache",()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()});le(this,"refreshCache",()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map(t=>t.id))});le(this,"updateCache",t=>{const e=new Set;t.forEach(n=>{const i=this.bothEdgesMap.get(n);if(i&&i.forEach(a=>e.add(a.id)),!this.hasNode(n))this.inEdgesMap.delete(n),this.outEdgesMap.delete(n),this.bothEdgesMap.delete(n),this.allNodesMap.delete(n);else{const a=this.graph.getRelatedEdges(n,"in").filter(this.edgeFilter),s=this.graph.getRelatedEdges(n,"out").filter(this.edgeFilter),o=Array.from(new Set([...a,...s]));o.forEach(l=>e.add(l.id)),this.inEdgesMap.set(n,a),this.outEdgesMap.set(n,s),this.bothEdgesMap.set(n,o),this.allNodesMap.set(n,this.graph.getNode(n))}}),e.forEach(n=>{this.hasEdge(n)?this.allEdgesMap.set(n,this.graph.getEdge(n)):this.allEdgesMap.delete(n)})});le(this,"handleGraphChanged",t=>{const e=new Set;t.changes.forEach(n=>{switch(n.type){case"NodeAdded":e.add(n.value.id);break;case"NodeDataUpdated":e.add(n.id);break;case"EdgeAdded":e.add(n.value.source),e.add(n.value.target);break;case"EdgeUpdated":(n.propertyName==="source"||n.propertyName==="target")&&(e.add(n.oldValue),e.add(n.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(n.id)){const i=t.graph.getEdge(n.id);e.add(i.source),e.add(i.target)}break;case"EdgeRemoved":e.add(n.value.source),e.add(n.value.target);break;case"NodeRemoved":e.add(n.value.id);break}}),this.updateCache(e)});this.graph=t.graph;const e=t.nodeFilter||ak,n=t.edgeFilter||ak;this.nodeFilter=e,this.edgeFilter=i=>{const{source:a,target:s}=this.graph.getEdgeDetail(i.id);return!e(a)||!e(s)?!1:n(i,a,s)},t.cache==="auto"?(this.cacheEnabled=!0,this.startAutoCache()):t.cache==="manual"?this.cacheEnabled=!0:this.cacheEnabled=!1}startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some(n=>n.id===t)}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){return this.checkNodeExistence(t),this.cacheEnabled?e==="in"?this.inEdgesMap.get(t):e==="out"?this.outEdgesMap.get(t):this.bothEdgesMap.get(t):this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const n=this.getRelatedEdges(t,"out").map(i=>this.getNode(i.target));return Array.from(new Set(n))}getPredecessors(t){const n=this.getRelatedEdges(t,"in").map(i=>this.getNode(i.source));return Array.from(new Set(n))}getNeighbors(t){const e=this.getPredecessors(t),n=this.getSuccessors(t);return Array.from(new Set([...e,...n]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const n=this.graph.getParent(t,e);return!n||!this.nodeFilter(n)?null:n}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,n="out"){const i={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];qw([this.getNode(t)],new Set,e,i)}dfs(t,e,n="out"){const i={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];Ff(this.getNode(t),new Set,e,i)}}let Mn=class XI extends kg{constructor(e){super();le(this,"nodeMap",new Map);le(this,"edgeMap",new Map);le(this,"inEdgesMap",new Map);le(this,"outEdgesMap",new Map);le(this,"bothEdgesMap",new Map);le(this,"treeIndices",new Map);le(this,"changes",[]);le(this,"batchCount",0);le(this,"onChanged",()=>{});le(this,"batch",e=>{this.batchCount+=1,e(),this.batchCount-=1,this.batchCount||this.commit()});e&&(e.nodes&&this.addNodes(e.nodes),e.edges&&this.addEdges(e.edges),e.tree&&this.addTree(e.tree),e.onChanged&&(this.onChanged=e.onChanged))}commit(){const e=this.changes;this.changes=[];const n={graph:this,changes:e};this.emit("changed",n),this.onChanged(n)}reduceChanges(e){let n=[];return e.forEach(i=>{switch(i.type){case"NodeRemoved":{let a=!1;n=n.filter(s=>{if(s.type==="NodeAdded"){const o=s.value.id===i.value.id;return o&&(a=!0),!o}else{if(s.type==="NodeDataUpdated")return s.id!==i.value.id;if(s.type==="TreeStructureChanged")return s.nodeId!==i.value.id}return!0}),a||n.push(i);break}case"EdgeRemoved":{let a=!1;n=n.filter(s=>{if(s.type==="EdgeAdded"){const o=s.value.id===i.value.id;return o&&(a=!0),!o}else if(s.type==="EdgeDataUpdated"||s.type==="EdgeUpdated")return s.id!==i.value.id;return!0}),a||n.push(i);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const a=n.findIndex(o=>o.type===i.type&&o.id===i.id&&(i.propertyName===void 0||o.propertyName===i.propertyName)),s=n[a];s?i.propertyName!==void 0?s.newValue=i.newValue:(n.splice(a,1),n.push(i)):n.push(i);break}case"TreeStructureDetached":{n=n.filter(a=>a.type==="TreeStructureAttached"||a.type==="TreeStructureChanged"?a.treeKey!==i.treeKey:!0),n.push(i);break}case"TreeStructureChanged":{const a=n.find(s=>s.type==="TreeStructureChanged"&&s.treeKey===i.treeKey&&s.nodeId===i.nodeId);a?a.newParentId=i.newParentId:n.push(i);break}default:n.push(i);break}}),n}checkNodeExistence(e){this.getNode(e)}hasNode(e){return this.nodeMap.has(e)}areNeighbors(e,n){return this.getNeighbors(n).some(i=>i.id===e)}getNode(e){const n=this.nodeMap.get(e);if(!n)throw new Error("Node not found for id: "+e);return n}getRelatedEdges(e,n){if(this.checkNodeExistence(e),n==="in"){const i=this.inEdgesMap.get(e);return Array.from(i)}else if(n==="out"){const i=this.outEdgesMap.get(e);return Array.from(i)}else{const i=this.bothEdgesMap.get(e);return Array.from(i)}}getDegree(e,n){return this.getRelatedEdges(e,n).length}getSuccessors(e){const i=this.getRelatedEdges(e,"out").map(a=>this.getNode(a.target));return Array.from(new Set(i))}getPredecessors(e){const i=this.getRelatedEdges(e,"in").map(a=>this.getNode(a.source));return Array.from(new Set(i))}getNeighbors(e){const n=this.getPredecessors(e),i=this.getSuccessors(e);return Array.from(new Set([...n,...i]))}doAddNode(e){if(this.hasNode(e.id))throw new Error("Node already exists: "+e.id);this.nodeMap.set(e.id,e),this.inEdgesMap.set(e.id,new Set),this.outEdgesMap.set(e.id,new Set),this.bothEdgesMap.set(e.id,new Set),this.treeIndices.forEach(n=>{n.childrenMap.set(e.id,new Set)}),this.changes.push({type:"NodeAdded",value:e})}addNodes(e){this.batch(()=>{for(const n of e)this.doAddNode(n)})}addNode(e){this.addNodes([e])}doRemoveNode(e){const n=this.getNode(e),i=this.bothEdgesMap.get(e);i==null||i.forEach(a=>this.doRemoveEdge(a.id)),this.nodeMap.delete(e),this.treeIndices.forEach(a=>{var o,l;(o=a.childrenMap.get(e))==null||o.forEach(u=>{a.parentMap.delete(u.id)});const s=a.parentMap.get(e);s&&((l=a.childrenMap.get(s.id))==null||l.delete(n)),a.parentMap.delete(e),a.childrenMap.delete(e)}),this.bothEdgesMap.delete(e),this.inEdgesMap.delete(e),this.outEdgesMap.delete(e),this.changes.push({type:"NodeRemoved",value:n})}removeNodes(e){this.batch(()=>{e.forEach(n=>this.doRemoveNode(n))})}removeNode(e){this.removeNodes([e])}updateNodeDataProperty(e,n,i){const a=this.getNode(e);this.batch(()=>{const s=a.data[n],o=i;a.data[n]=o,this.changes.push({type:"NodeDataUpdated",id:e,propertyName:n,oldValue:s,newValue:o})})}mergeNodeData(e,n){this.batch(()=>{Object.entries(n).forEach(([i,a])=>{this.updateNodeDataProperty(e,i,a)})})}updateNodeData(...e){const n=e[0],i=this.getNode(n);if(typeof e[1]=="string"){this.updateNodeDataProperty(n,e[1],e[2]);return}let a;if(typeof e[1]=="function"){const s=e[1];a=s(i.data)}else typeof e[1]=="object"&&(a=e[1]);this.batch(()=>{const s=i.data,o=a;i.data=a,this.changes.push({type:"NodeDataUpdated",id:n,oldValue:s,newValue:o})})}checkEdgeExistence(e){if(!this.hasEdge(e))throw new Error("Edge not found for id: "+e)}hasEdge(e){return this.edgeMap.has(e)}getEdge(e){return this.checkEdgeExistence(e),this.edgeMap.get(e)}getEdgeDetail(e){const n=this.getEdge(e);return{edge:n,source:this.getNode(n.source),target:this.getNode(n.target)}}doAddEdge(e){if(this.hasEdge(e.id))throw new Error("Edge already exists: "+e.id);this.checkNodeExistence(e.source),this.checkNodeExistence(e.target),this.edgeMap.set(e.id,e);const n=this.inEdgesMap.get(e.target),i=this.outEdgesMap.get(e.source),a=this.bothEdgesMap.get(e.source),s=this.bothEdgesMap.get(e.target);n.add(e),i.add(e),a.add(e),s.add(e),this.changes.push({type:"EdgeAdded",value:e})}addEdges(e){this.batch(()=>{for(const n of e)this.doAddEdge(n)})}addEdge(e){this.addEdges([e])}doRemoveEdge(e){const n=this.getEdge(e),i=this.outEdgesMap.get(n.source),a=this.inEdgesMap.get(n.target),s=this.bothEdgesMap.get(n.source),o=this.bothEdgesMap.get(n.target);i.delete(n),a.delete(n),s.delete(n),o.delete(n),this.edgeMap.delete(e),this.changes.push({type:"EdgeRemoved",value:n})}removeEdges(e){this.batch(()=>{e.forEach(n=>this.doRemoveEdge(n))})}removeEdge(e){this.removeEdges([e])}updateEdgeSource(e,n){const i=this.getEdge(e);this.checkNodeExistence(n);const a=i.source,s=n;this.outEdgesMap.get(a).delete(i),this.bothEdgesMap.get(a).delete(i),this.outEdgesMap.get(s).add(i),this.bothEdgesMap.get(s).add(i),i.source=n,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:e,propertyName:"source",oldValue:a,newValue:s})})}updateEdgeTarget(e,n){const i=this.getEdge(e);this.checkNodeExistence(n);const a=i.target,s=n;this.inEdgesMap.get(a).delete(i),this.bothEdgesMap.get(a).delete(i),this.inEdgesMap.get(s).add(i),this.bothEdgesMap.get(s).add(i),i.target=n,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:e,propertyName:"target",oldValue:a,newValue:s})})}updateEdgeDataProperty(e,n,i){const a=this.getEdge(e);this.batch(()=>{const s=a.data[n],o=i;a.data[n]=o,this.changes.push({type:"EdgeDataUpdated",id:e,propertyName:n,oldValue:s,newValue:o})})}updateEdgeData(...e){const n=e[0],i=this.getEdge(n);if(typeof e[1]=="string"){this.updateEdgeDataProperty(n,e[1],e[2]);return}let a;if(typeof e[1]=="function"){const s=e[1];a=s(i.data)}else typeof e[1]=="object"&&(a=e[1]);this.batch(()=>{const s=i.data,o=a;i.data=a,this.changes.push({type:"EdgeDataUpdated",id:n,oldValue:s,newValue:o})})}mergeEdgeData(e,n){this.batch(()=>{Object.entries(n).forEach(([i,a])=>{this.updateEdgeDataProperty(e,i,a)})})}checkTreeExistence(e){if(!this.hasTreeStructure(e))throw new Error("Tree structure not found for treeKey: "+e)}hasTreeStructure(e){return this.treeIndices.has(e)}attachTreeStructure(e){this.treeIndices.has(e)||(this.treeIndices.set(e,{parentMap:new Map,childrenMap:new Map}),this.batch(()=>{this.changes.push({type:"TreeStructureAttached",treeKey:e})}))}detachTreeStructure(e){this.checkTreeExistence(e),this.treeIndices.delete(e),this.batch(()=>{this.changes.push({type:"TreeStructureDetached",treeKey:e})})}addTree(e,n){this.batch(()=>{this.attachTreeStructure(n);const i=[],a=Array.isArray(e)?e:[e];for(;a.length;){const s=a.shift();i.push(s),s.children&&a.push(...s.children)}this.addNodes(i),i.forEach(s=>{var o;(o=s.children)==null||o.forEach(l=>{this.setParent(l.id,s.id,n)})})})}getRoots(e){return this.checkTreeExistence(e),this.getAllNodes().filter(n=>!this.getParent(n.id,e))}getChildren(e,n){this.checkNodeExistence(e),this.checkTreeExistence(n);const a=this.treeIndices.get(n).childrenMap.get(e);return Array.from(a||[])}getParent(e,n){return this.checkNodeExistence(e),this.checkTreeExistence(n),this.treeIndices.get(n).parentMap.get(e)||null}getAncestors(e,n){const i=[];let a=this.getNode(e),s;for(;s=this.getParent(a.id,n);)i.push(s),a=s;return i}setParent(e,n,i){var c,h;this.checkTreeExistence(i);const a=this.treeIndices.get(i);if(!a)return;const s=this.getNode(e),o=a.parentMap.get(e);if((o==null?void 0:o.id)===n)return;if(n==null){o&&((c=a.childrenMap.get(o.id))==null||c.delete(s)),a.parentMap.delete(e);return}const l=this.getNode(n);a.parentMap.set(e,l),o&&((h=a.childrenMap.get(o.id))==null||h.delete(s));let u=a.childrenMap.get(l.id);u||(u=new Set,a.childrenMap.set(l.id,u)),u.add(s),this.batch(()=>{this.changes.push({type:"TreeStructureChanged",treeKey:i,nodeId:e,oldParentId:o==null?void 0:o.id,newParentId:l.id})})}dfsTree(e,n,i){const a=s=>this.getChildren(s,i);return Ff(this.getNode(e),new Set,n,a)}bfsTree(e,n,i){const a=s=>this.getChildren(s,i);return qw([this.getNode(e)],new Set,n,a)}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(e,n,i="out"){const a={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[i];return qw([this.getNode(e)],new Set,n,a)}dfs(e,n,i="out"){const a={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[i];return Ff(this.getNode(e),new Set,n,a)}clone(){const e=this.getAllNodes().map(a=>({...a,data:{...a.data}})),n=this.getAllEdges().map(a=>({...a,data:{...a.data}})),i=new XI({nodes:e,edges:n});return this.treeIndices.forEach(({parentMap:a,childrenMap:s},o)=>{const l=new Map;a.forEach((c,h)=>{l.set(h,i.getNode(c.id))});const u=new Map;s.forEach((c,h)=>{u.set(h,new Set(Array.from(c).map(d=>i.getNode(d.id))))}),i.treeIndices.set(o,{parentMap:l,childrenMap:u})}),i}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(e){return new nJ({graph:this,...e})}};class Tg{constructor(t,e){this.context=t,this.options=e||{}}}var rJ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},iJ=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};function aJ(r){const{type:t}=r;return["compact-box","mindmap","dendrogram","indented"].includes(t)}function sJ(r){return!Array.isArray(r)&&(r==null?void 0:r.preLayout)}function tf(r){const{nodes:t,edges:e}=r,n={nodes:[],edges:[],combos:[]};return t.forEach(i=>{const a=i.data._isCombo?n.combos:n.nodes,{x:s,y:o,z:l=0}=i.data;a==null||a.push({id:i.id,style:{x:s,y:o,z:l}})}),e.forEach(i=>{const{id:a,source:s,target:o,data:{points:l=[],controlPoints:u=l.slice(1,l.length-1)}}=i;n.edges.push({id:a,source:s,target:o,style:Object.assign({},u!=null&&u.length?{controlPoints:u.map(zn)}:{})})}),n}function oJ(r,t){class e extends Tg{constructor(i,a){if(super(i,a),this.instance=new r({}),this.id=this.instance.id,"stop"in this.instance&&"tick"in this.instance){const s=this.instance;this.stop=s.stop.bind(s),this.tick=o=>{const l=s.tick(o);return tf(l)}}}execute(i,a){return rJ(this,void 0,void 0,function*(){return tf(yield this.instance.execute(this.graphData2LayoutModel(i),this.transformOptions(cr({},this.options,a))))})}transformOptions(i){const{onTick:a}=i;return a&&(i.onTick=s=>a(tf(s))),i}graphData2LayoutModel(i){const{nodes:a=[],edges:s=[],combos:o=[]}=i,l=a.map(g=>{const p=H(g),{data:v,style:m,combo:b}=g,w=iJ(g,["data","style","combo"]),x={id:p,data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},v),{data:v}),b?{parentId:b}:{}),{style:m}),w)};return m!=null&&m.x&&Object.assign(x.data,{x:m.x}),m!=null&&m.y&&Object.assign(x.data,{y:m.y}),m!=null&&m.z&&Object.assign(x.data,{z:m.z}),x}),u=new Map(l.map(g=>[g.id,g])),c=s.filter(g=>{const{source:p,target:v}=g;return u.has(p)&&u.has(v)}).map(g=>{const{source:p,target:v,data:m,style:b}=g;return{id:H(g),source:p,target:v,data:Object.assign({},m),style:Object.assign({},b)}}),h=o.map(g=>({id:H(g),data:Object.assign({_isCombo:!0},g.data),style:Object.assign({},g.style)})),d=new Mn({nodes:[...l,...h],edges:c});return t.model.model.hasTreeStructure(we)&&(d.attachTreeStructure(we),l.forEach(g=>{const p=t.model.model.getParent(g.id,we);p&&d.hasNode(p.id)&&d.setParent(g.id,p.id,we)})),d}}return e}function $v(r,t,...e){if(t in r)return r[t](...e);if("instance"in r){const n=r.instance;if(t in n)return n[t](...e)}return null}function sk(r,t){if(t in r)return r[t];if("instance"in r){const e=r.instance;if(t in e)return e[t]}return null}var lJ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class uJ extends qc{get forceLayoutInstance(){return this.context.layout.getLayoutInstance().find(t=>["d3-force","d3-force-3d"].includes(t==null?void 0:t.id))}validate(t){return this.context.layout?this.forceLayoutInstance?super.validate(t):(sa.warn("DragElementForce only works with d3-force or d3-force-3d layout"),!1):!1}moveElement(t,e){return lJ(this,void 0,void 0,function*(){const n=this.forceLayoutInstance;this.context.graph.getNodeData(t).forEach((i,a)=>{const{x:s=0,y:o=0}=i.style||{};n&&$v(n,"setFixedPosition",t[a],[...Lt([+s,+o],e)])})})}onDragStart(t){if(this.enable=this.validate(t),!this.enable)return;this.target=this.getSelectedNodeIDs([t.target.id]),this.hideEdge(),this.context.graph.frontElement(this.target);const e=this.forceLayoutInstance;e&&sk(e,"simulation").alphaTarget(.3).restart(),this.context.graph.getNodeData(this.target).forEach(n=>{const{x:i=0,y:a=0}=n.style||{};e&&$v(e,"setFixedPosition",H(n),[+i,+a])})}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.moveElement(this.target,e)}onDragEnd(){const t=this.forceLayoutInstance;t&&sk(t,"simulation").alphaTarget(0),!this.options.fixed&&this.context.graph.getNodeData(this.target).forEach(e=>{t&&$v(t,"setFixedPosition",H(e),[null,null,null])})}}var ok=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Og extends Or{constructor(t,e){super(t,Object.assign({},Og.defaultOptions,e)),this.isZoomEvent=n=>!!(n.data&&"scale"in n.data),this.relatedEdgeToUpdate=new Set,this.zoom=this.context.graph.getZoom(),this.fixElementSize=n=>ok(this,void 0,void 0,function*(){if(!this.validate(n))return;const{graph:i}=this.context,{state:a,nodeFilter:s,edgeFilter:o,comboFilter:l}=this.options,u=(a?i.getElementDataByState("node",a):i.getNodeData()).filter(s),c=(a?i.getElementDataByState("edge",a):i.getEdgeData()).filter(o),h=(a?i.getElementDataByState("combo",a):i.getComboData()).filter(l),d=this.isZoomEvent(n)?this.zoom=Math.max(.01,Math.min(n.data.scale,10)):this.zoom,g=[...u,...h];g.length>0&&g.forEach(p=>this.fixNodeLike(p,d)),this.updateRelatedEdges(),c.length>0&&c.forEach(p=>this.fixEdge(p,d))}),this.cachedStyles=new Map,this.getOriginalFieldValue=(n,i,a)=>{var s;const o=this.cachedStyles.get(n)||[],l=((s=o.find(u=>u.shape===i))===null||s===void 0?void 0:s.style)||{};return a in l||(l[a]=i.attributes[a],this.cachedStyles.set(n,[...o.filter(u=>u.shape!==i),{shape:i,style:l}])),l[a]},this.scaleEntireElement=(n,i,a)=>{i.setLocalScale(1/a);const s=this.cachedStyles.get(n)||[];s.push({shape:i}),this.cachedStyles.set(n,s)},this.scaleSpecificShapes=(n,i,a)=>{const s=lK(n);(Array.isArray(a)?a:[a]).forEach(l=>{const{shape:u,fields:c}=l,h=typeof u=="function"?u(s):n.getShape(u);if(h){if(!c){this.scaleEntireElement(n.id,h,i);return}c.forEach(d=>{const g=this.getOriginalFieldValue(n.id,h,d);yt(g)&&(h.style[d]=g/i)})}})},this.skipIfExceedViewport=n=>{const{viewport:i}=this.context;return!(i!=null&&i.isInViewport(n.getRenderBounds(),!1,30))},this.fixNodeLike=(n,i)=>{const a=H(n),{element:s,model:o}=this.context,l=s.getElement(a);if(!l||this.skipIfExceedViewport(l))return;o.getRelatedEdgesData(a).forEach(h=>this.relatedEdgeToUpdate.add(H(h)));const c=this.options[l.type];if(!c){this.scaleEntireElement(a,l,i);return}this.scaleSpecificShapes(l,i,c)},this.fixEdge=(n,i)=>{const a=H(n),s=this.context.element.getElement(a);if(!s||this.skipIfExceedViewport(s))return;const o=this.options.edge;if(!o){s.style.transformOrigin="center",this.scaleEntireElement(a,s,i);return}this.scaleSpecificShapes(s,i,o)},this.updateRelatedEdges=()=>{const{element:n}=this.context;this.relatedEdgeToUpdate.size>0&&this.relatedEdgeToUpdate.forEach(i=>{const a=n.getElement(i);a==null||a.update({})}),this.relatedEdgeToUpdate.clear()},this.resetTransform=n=>ok(this,void 0,void 0,function*(){var i;!((i=n.data)===null||i===void 0)&&i.firstRender||(this.options.reset?this.restoreCachedStyles():this.fixElementSize({data:{scale:this.zoom}}))}),this.bindEvents()}restoreCachedStyles(){if(this.cachedStyles.size>0){this.cachedStyles.forEach(i=>{i.forEach(({shape:a,style:s})=>{if(Ki(s))a.setLocalScale(1);else{if(this.options.state)return;Object.entries(s).forEach(([o,l])=>a.style[o]=l)}})});const{graph:t,element:e}=this.context,n=Object.keys(Object.fromEntries(this.cachedStyles)).filter(i=>i&&t.getElementType(i)==="node");if(n.length>0){const i=new Set;n.forEach(a=>{t.getRelatedEdgesData(a).forEach(s=>i.add(H(s)))}),i.forEach(a=>{const s=e==null?void 0:e.getElement(a);s==null||s.update({})})}}}bindEvents(){const{graph:t}=this.context;t.on(ut.AFTER_DRAW,this.resetTransform),t.on(ut.AFTER_TRANSFORM,this.fixElementSize)}unbindEvents(){const{graph:t}=this.context;t.off(ut.AFTER_DRAW,this.resetTransform),t.off(ut.AFTER_TRANSFORM,this.fixElementSize)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}Og.defaultOptions={enable:r=>r.data.scale<1,nodeFilter:()=>!0,edgeFilter:()=>!0,comboFilter:()=>!0,edge:[{shape:"key",fields:["lineWidth"]},{shape:"halo",fields:["lineWidth"]},{shape:"label"}],reset:!1};var cJ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Cg extends Or{constructor(t,e){super(t,Object.assign({},Cg.defaultOptions,e)),this.focus=n=>cJ(this,void 0,void 0,function*(){if(!this.validate(n))return;const{graph:i}=this.context;yield i.focusElement(n.target.id,this.options.animation)}),this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),Bo.forEach(e=>{t.on(`${e}:${J.CLICK}`,this.focus)})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;Bo.forEach(e=>{t.off(`${e}:${J.CLICK}`,this.focus)})}destroy(){this.unbindEvents(),super.destroy()}}Cg.defaultOptions={animation:{easing:"ease-in",duration:500},enable:!0};class Ag extends Or{constructor(t,e){super(t,Object.assign({},Ag.defaultOptions,e)),this.isFrozen=!1,this.toggleFrozen=n=>{this.isFrozen=n.type==="dragstart"},this.hoverElement=n=>{if(!this.validate(n))return;const i=n.type===J.POINTER_ENTER;this.updateElementsState(n,i);const{onHover:a,onHoverEnd:s}=this.options;i?a==null||a(n):s==null||s(n)},this.updateElementsState=(n,i)=>{if(!this.options.state&&!this.options.inactiveState)return;const{graph:a}=this.context,{state:s,animation:o,inactiveState:l}=this.options,u=this.getActiveIds(n),c={};if(s&&Object.assign(c,this.getElementsState(u,s,i)),l){const h=uI(a.getData(),!0).filter(d=>!u.includes(d));Object.assign(c,this.getElementsState(h,l,i))}a.setElementState(c,o)},this.getElementsState=(n,i,a)=>{const{graph:s}=this.context,o={};return n.forEach(l=>{const u=s.getElementState(l);a?o[l]=u.includes(i)?u:[...u,i]:o[l]=u.filter(c=>c!==i)}),o},this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),Bo.forEach(n=>{t.on(`${n}:${J.POINTER_ENTER}`,this.hoverElement),t.on(`${n}:${J.POINTER_LEAVE}`,this.hoverElement)});const e=this.context.canvas.document;e.addEventListener(`${J.DRAG_START}`,this.toggleFrozen),e.addEventListener(`${J.DRAG_END}`,this.toggleFrozen)}getActiveIds(t){const{graph:e}=this.context,{degree:n,direction:i}=this.options,a=t.target.id;return n?wI(e,t.targetType,a,typeof n=="function"?n(t):n,i):[a]}validate(t){if(this.destroyed||this.isFrozen||Eg(t.target)||this.context.graph.isCollapsingExpanding)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;Bo.forEach(n=>{t.off(`${n}:${J.POINTER_ENTER}`,this.hoverElement),t.off(`${n}:${J.POINTER_LEAVE}`,this.hoverElement)});const e=this.context.canvas.document;e.removeEventListener(`${J.DRAG_START}`,this.toggleFrozen),e.removeEventListener(`${J.DRAG_END}`,this.toggleFrozen)}destroy(){this.unbindEvents(),super.destroy()}}Ag.defaultOptions={animation:!1,enable:!0,degree:0,direction:"both",state:"active",inactiveState:void 0};class hJ extends Dc{onPointerDown(t){if(!super.validate(t)||!super.isKeydown()||this.points)return;const{canvas:e}=this.context;this.pathShape=new qr({id:"g6-lasso-select",style:this.options.style}),e.appendChild(this.pathShape),this.points=[Nf(t)]}onPointerMove(t){var e;if(!this.points)return;const{immediately:n,mode:i}=this.options;this.points.push(Nf(t)),(e=this.pathShape)===null||e===void 0||e.setAttribute("d",rK(this.points)),n&&i==="default"&&this.points.length>2&&super.updateElementsStates(this.points)}onPointerUp(){if(this.points){if(this.points.length<2){this.clearLasso();return}super.updateElementsStates(this.points),this.clearLasso()}}clearLasso(){var t;(t=this.pathShape)===null||t===void 0||t.remove(),this.pathShape=void 0,this.points=void 0}}class Pg extends Or{constructor(t,e){super(t,Object.assign({},Pg.defaultOptions,e)),this.hiddenShapes=[],this.isVisible=!0,this.setElementsVisibility=(n,i,a)=>{n.filter(Boolean).forEach(s=>{i==="hidden"&&!s.isVisible()?this.hiddenShapes.push(s):i==="visible"&&this.hiddenShapes.includes(s)?this.hiddenShapes.splice(this.hiddenShapes.indexOf(s),1):Do(s,i,a)})},this.filterShapes=(n,i)=>{if(Et(i))return s=>!i(n,s);const a=i==null?void 0:i[n];return s=>s.className?!(a!=null&&a.includes(s.className)):!0},this.hideShapes=n=>{if(!this.validate(n)||!this.isVisible)return;const{element:i}=this.context,{shapes:a={}}=this.options;this.setElementsVisibility(i.getNodes(),"hidden",this.filterShapes("node",a)),this.setElementsVisibility(i.getEdges(),"hidden",this.filterShapes("edge",a)),this.setElementsVisibility(i.getCombos(),"hidden",this.filterShapes("combo",a)),this.isVisible=!1},this.showShapes=Oc(n=>{if(!this.validate(n)||this.isVisible)return;const{element:i}=this.context;this.setElementsVisibility(i.getNodes(),"visible"),this.setElementsVisibility(i.getEdges(),"visible"),this.setElementsVisibility(i.getCombos(),"visible"),this.isVisible=!0},this.options.debounce),this.bindEvents()}bindEvents(){const{graph:t}=this.context;t.on(ut.BEFORE_TRANSFORM,this.hideShapes),t.on(ut.AFTER_TRANSFORM,this.showShapes)}unbindEvents(){const{graph:t}=this.context;t.off(ut.BEFORE_TRANSFORM,this.hideShapes),t.off(ut.AFTER_TRANSFORM,this.showShapes)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}Pg.defaultOptions={enable:!0,debounce:200,shapes:r=>r==="node"};var lk=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Ng extends Or{constructor(t,e){super(t,Object.assign({},Ng.defaultOptions,e)),this.onWheel=n=>lk(this,void 0,void 0,function*(){this.options.preventDefault&&n.preventDefault();const i=n.deltaX,a=n.deltaY;yield this.scroll([-i,-a],n)}),this.shortcut=new Xl(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){var t,e;const{trigger:n}=this.options;if(this.shortcut.unbindAll(),an(n)){(t=this.graphDom)===null||t===void 0||t.removeEventListener(J.WHEEL,this.onWheel);const{up:i=[],down:a=[],left:s=[],right:o=[]}=n;this.shortcut.bind(i,l=>this.scroll([0,-10],l)),this.shortcut.bind(a,l=>this.scroll([0,10],l)),this.shortcut.bind(s,l=>this.scroll([-10,0],l)),this.shortcut.bind(o,l=>this.scroll([10,0],l))}else(e=this.graphDom)===null||e===void 0||e.addEventListener(J.WHEEL,this.onWheel,{passive:!1})}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}formatDisplacement(t){const{sensitivity:e}=this.options;return t=Ta(t,e),t=this.clampByDirection(t),t=this.clampByRange(t),t}clampByDirection([t,e]){const{direction:n}=this.options;return n==="x"?e=0:n==="y"&&(t=0),[t,e]}clampByRange([t,e]){const{viewport:n,canvas:i}=this.context,[a,s]=i.getSize(),[o,l,u,c]=oa(this.options.range),h=[s*o,a*l,s*u,a*c],d=Ys(Wx(n.getCanvasCenter()),h),g=be(n.getViewportCenter(),[t,e,0]);if(!Ii(g,d)){const{min:[p,v],max:[m,b]}=d;(g[0]<p&&t>0||g[0]>m&&t<0)&&(t=0),(g[1]<v&&e>0||g[1]>b&&e<0)&&(e=0)}return[t,e]}scroll(t,e){return lk(this,void 0,void 0,function*(){if(!this.validate(e))return;const{onFinish:n}=this.options,i=this.context.graph,a=this.formatDisplacement(t);yield i.translateBy(a,!1),n==null||n()})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}destroy(){var t;this.shortcut.destroy(),(t=this.graphDom)===null||t===void 0||t.removeEventListener(J.WHEEL,this.onWheel),super.destroy()}}Ng.defaultOptions={enable:!0,sensitivity:1,preventDefault:!0,range:1/0};var uk=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Rg extends Or{constructor(t,e){super(t,Object.assign({},Rg.defaultOptions,e)),this.zoom=(n,i,a)=>uk(this,void 0,void 0,function*(){if(!this.validate(i))return;const{graph:s}=this.context;let o;"viewport"in i&&(o=zn(i.viewport));const{sensitivity:l,onFinish:u}=this.options,c=1+He(n,-50,50)*l/100,h=s.getZoom();yield s.zoomTo(h*c,a,o),u==null||u()}),this.onReset=()=>uk(this,void 0,void 0,function*(){yield this.context.graph.zoomTo(1,this.options.animation)}),this.preventDefault=n=>{this.options.preventDefault&&n.preventDefault()},this.shortcut=new Xl(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{trigger:t}=this.options;if(this.shortcut.unbindAll(),Array.isArray(t))if(t.includes(J.PINCH))this.shortcut.bind([J.PINCH],e=>{this.zoom(e.scale,e,!1)});else{const e=this.context.canvas.getContainer();e==null||e.addEventListener(J.WHEEL,this.preventDefault),this.shortcut.bind([...t,J.WHEEL],n=>{const{deltaX:i,deltaY:a}=n;this.zoom(-(a??i),n,!1)})}if(typeof t=="object"){const{zoomIn:e=[],zoomOut:n=[],reset:i=[]}=t;this.shortcut.bind(e,a=>this.zoom(10,a,this.options.animation)),this.shortcut.bind(n,a=>this.zoom(-10,a,this.options.animation)),this.shortcut.bind(i,this.onReset)}}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}destroy(){var t;this.shortcut.destroy(),(t=this.context.canvas.getContainer())===null||t===void 0||t.removeEventListener(J.WHEEL,this.preventDefault),super.destroy()}}Rg.defaultOptions={animation:{duration:200},enable:!0,sensitivity:1,trigger:[],preventDefault:!0};function dJ(r,t,e,n){return n===void 0&&(n="height"),e==="center"?(r[n]+t[n])/2:r.height}var Zs={assign:Object.assign,getHeight:dJ},KI=Zs,aE=18,fJ=aE*2,ck=aE,gJ={getId:function(t){return t.id||t.name},getPreH:function(t){return t.preH||0},getPreV:function(t){return t.preV||0},getHGap:function(t){return t.hgap||ck},getVGap:function(t){return t.vgap||ck},getChildren:function(t){return t.children},getHeight:function(t){return t.height||fJ},getWidth:function(t){var e=t.label||" ";return t.width||e.split("").length*aE}};function Bf(r,t){var e=this;if(e.vgap=e.hgap=0,r instanceof Bf)return r;e.data=r;var n=t.getHGap(r),i=t.getVGap(r);return e.preH=t.getPreH(r),e.preV=t.getPreV(r),e.width=t.getWidth(r),e.height=t.getHeight(r),e.width+=e.preH,e.height+=e.preV,e.id=t.getId(r),e.x=e.y=0,e.depth=0,e.children||(e.children=[]),e.addGap(n,i),e}KI.assign(Bf.prototype,{isRoot:function(){return this.depth===0},isLeaf:function(){return this.children.length===0},addGap:function(t,e){var n=this;n.hgap+=t,n.vgap+=e,n.width+=2*t,n.height+=2*e},eachNode:function(t){for(var e=this,n=[e],i;i=n.shift();)t(i),n=i.children.concat(n)},DFTraverse:function(t){this.eachNode(t)},BFTraverse:function(t){for(var e=this,n=[e],i;i=n.shift();)t(i),n=n.concat(i.children)},getBoundingBox:function(){var t={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(function(e){t.left=Math.min(t.left,e.x),t.top=Math.min(t.top,e.y),t.width=Math.max(t.width,e.x+e.width),t.height=Math.max(t.height,e.y+e.height)}),t},translate:function(t,e){t===void 0&&(t=0),e===void 0&&(e=0),this.eachNode(function(n){n.x+=t,n.y+=e,n.x+=n.preH,n.y+=n.preV})},right2left:function(){var t=this,e=t.getBoundingBox();t.eachNode(function(n){n.x=n.x-(n.x-e.left)*2-n.width}),t.translate(e.width,0)},bottom2top:function(){var t=this,e=t.getBoundingBox();t.eachNode(function(n){n.y=n.y-(n.y-e.top)*2-n.height}),t.translate(0,e.height)}});function pJ(r,t,e){t===void 0&&(t={}),t=KI.assign({},gJ,t);var n=new Bf(r,t),i=[n],a;if(!e&&!r.collapsed){for(;a=i.shift();)if(!a.data.collapsed){var s=t.getChildren(a.data),o=s?s.length:0;if(a.children=new Array(o),s&&o)for(var l=0;l<o;l++){var u=new Bf(s[l],t);a.children[l]=u,i.push(u),u.parent=a,u.depth=a.depth+1}}}return n}var ZI=pJ,vJ=ZI,mJ=function(){function r(e,n){n===void 0&&(n={});var i=this;i.options=n,i.rootNode=vJ(e,n)}var t=r.prototype;return t.execute=function(){throw new Error("please override this method")},r}(),Lg=mJ;function Bu(r,t,e,n){n===void 0&&(n=[]);var i=this;i.w=r||0,i.h=t||0,i.y=e||0,i.x=0,i.c=n||[],i.cs=n.length,i.prelim=0,i.mod=0,i.shift=0,i.change=0,i.tl=null,i.tr=null,i.el=null,i.er=null,i.msel=0,i.mser=0}Bu.fromNode=function(r,t){if(!r)return null;var e=[];return r.children.forEach(function(n){e.push(Bu.fromNode(n,t))}),t?new Bu(r.height,r.width,r.x,e):new Bu(r.width,r.height,r.y,e)};function JI(r,t,e){e?r.y+=t:r.x+=t,r.children.forEach(function(n){JI(n,t,e)})}function QI(r,t){var e=t?r.y:r.x;return r.children.forEach(function(n){e=Math.min(QI(n,t),e)}),e}function yJ(r,t){var e=QI(r,t);JI(r,-e,t)}function tD(r,t,e){e?t.y=r.x:t.x=r.x,r.c.forEach(function(n,i){tD(n,t.children[i],e)})}function eD(r,t,e){e===void 0&&(e=0),t?(r.x=e,e+=r.width):(r.y=e,e+=r.height),r.children.forEach(function(n){eD(n,t,e)})}var bJ=function(r,t){t===void 0&&(t={});var e=t.isHorizontal;function n(w){if(w.cs===0){i(w);return}n(w.c[0]);for(var x=m(u(w.c[0].el),0,null),_=1;_<w.cs;++_){n(w.c[_]);var S=u(w.c[_].er);a(w,_,x),x=m(S,_,x)}d(w),i(w)}function i(w){w.cs===0?(w.el=w,w.er=w,w.msel=w.mser=0):(w.el=w.c[0].el,w.msel=w.c[0].msel,w.er=w.c[w.cs-1].er,w.mser=w.c[w.cs-1].mser)}function a(w,x,_){for(var S=w.c[x-1],M=S.mod,k=w.c[x],T=k.mod;S!==null&&k!==null;){u(S)>_.low&&(_=_.nxt);var P=M+S.prelim+S.w-(T+k.prelim);P>0&&(T+=P,s(w,x,_.index,P));var O=u(S),A=u(k);O<=A&&(S=l(S),S!==null&&(M+=S.mod)),O>=A&&(k=o(k),k!==null&&(T+=k.mod))}!S&&k?c(w,x,k,T):S&&!k&&h(w,x,S,M)}function s(w,x,_,S){w.c[x].mod+=S,w.c[x].msel+=S,w.c[x].mser+=S,p(w,x,_,S)}function o(w){return w.cs===0?w.tl:w.c[0]}function l(w){return w.cs===0?w.tr:w.c[w.cs-1]}function u(w){return w.y+w.h}function c(w,x,_,S){var M=w.c[0].el;M.tl=_;var k=S-_.mod-w.c[0].msel;M.mod+=k,M.prelim-=k,w.c[0].el=w.c[x].el,w.c[0].msel=w.c[x].msel}function h(w,x,_,S){var M=w.c[x].er;M.tr=_;var k=S-_.mod-w.c[x].mser;M.mod+=k,M.prelim-=k,w.c[x].er=w.c[x-1].er,w.c[x].mser=w.c[x-1].mser}function d(w){w.prelim=(w.c[0].prelim+w.c[0].mod+w.c[w.cs-1].mod+w.c[w.cs-1].prelim+w.c[w.cs-1].w)/2-w.w/2}function g(w,x){x+=w.mod,w.x=w.prelim+x,v(w);for(var _=0;_<w.cs;_++)g(w.c[_],x)}function p(w,x,_,S){if(_!==x-1){var M=x-_;w.c[_+1].shift+=S/M,w.c[x].shift-=S/M,w.c[x].change-=S-S/M}}function v(w){for(var x=0,_=0,S=0;S<w.cs;S++)x+=w.c[S].shift,_+=x+w.c[S].change,w.c[S].mod+=_}function m(w,x,_){for(;_!==null&&w>=_.low;)_=_.nxt;return{low:w,index:x,nxt:_}}eD(r,e);var b=Bu.fromNode(r,e);return n(b),g(b,0),tD(b,r,e),yJ(r,e),r},hk=ZI,nD=function(r,t){for(var e=hk(r.data,t,!0),n=hk(r.data,t,!0),i=r.children.length,a=Math.round(i/2),s=t.getSide||function(c,h){return h<a?"right":"left"},o=0;o<i;o++){var l=r.children[o],u=s(l,o);u==="right"?n.children.push(l):e.children.push(l)}return e.eachNode(function(c){c.isRoot()||(c.side="left")}),n.eachNode(function(c){c.isRoot()||(c.side="right")}),{left:e,right:n}},wJ=nD,vs=["LR","RL","TB","BT","H","V"],xJ=["LR","RL","H"],EJ=function(t){return xJ.indexOf(t)>-1},_J=vs[0],sE=function(r,t,e){var n=t.direction||_J;if(t.isHorizontal=EJ(n),vs.indexOf(n)===-1)throw new TypeError("Invalid direction: "+n);if(n===vs[0])e(r,t);else if(n===vs[1])e(r,t),r.right2left();else if(n===vs[2])e(r,t);else if(n===vs[3])e(r,t),r.bottom2top();else if(n===vs[4]||n===vs[5]){var i=wJ(r,t),a=i.left,s=i.right;e(a,t),e(s,t),t.isHorizontal?a.right2left():a.bottom2top(),s.translate(a.x-s.x,a.y-s.y),r.x=a.x,r.y=s.y;var o=r.getBoundingBox();t.isHorizontal?o.top<0&&r.translate(0,-o.top):o.left<0&&r.translate(-o.left,0)}var l=t.fixedRoot;return l===void 0&&(l=!0),l&&r.translate(-(r.x+r.width/2+r.hgap),-(r.y+r.height/2+r.vgap)),SJ(r,t),r};function SJ(r,t){if(t.radial){var e=t.isHorizontal?["x","y"]:["y","x"],n=e[0],i=e[1],a={x:1/0,y:1/0},s={x:-1/0,y:-1/0},o=0;r.DFTraverse(function(c){o++;var h=c.x,d=c.y;a.x=Math.min(a.x,h),a.y=Math.min(a.y,d),s.x=Math.max(s.x,h),s.y=Math.max(s.y,d)});var l=s[i]-a[i];if(l===0)return;var u=Math.PI*2/o;r.DFTraverse(function(c){var h=(c[i]-a[i])/l*(Math.PI*2-u)+u,d=c[n]-r[n];c.x=Math.cos(h)*d,c.y=Math.sin(h)*d})}}function MJ(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,Ww(r,t)}function Ww(r,t){return Ww=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Ww(r,t)}var kJ=Lg,TJ=bJ,OJ=sE,CJ=Zs,AJ=function(r){function t(){return r.apply(this,arguments)||this}MJ(t,r);var e=t.prototype;return e.execute=function(){var i=this;return OJ(i.rootNode,i.options,TJ)},t}(kJ),PJ={};function NJ(r,t){return t=CJ.assign({},PJ,t),new AJ(r,t).execute()}var RJ=NJ,LJ=Zs;function IJ(r,t){t===void 0&&(t=[]);var e=this;e.x=e.y=0,e.leftChild=e.rightChild=null,e.height=0,e.children=t}var DJ={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function rD(r,t,e){e?(t.x=r.x,t.y=r.y):(t.x=r.y,t.y=r.x),r.children.forEach(function(n,i){rD(n,t.children[i],e)})}var FJ=function(r,t){t===void 0&&(t={}),t=LJ.assign({},DJ,t);var e=0;function n(l){if(!l)return null;l.width=0,l.depth&&l.depth>e&&(e=l.depth);var u=l.children,c=u.length,h=new IJ(l.height,[]);return u.forEach(function(d,g){var p=n(d);h.children.push(p),g===0&&(h.leftChild=p),g===c-1&&(h.rightChild=p)}),h.originNode=l,h.isLeaf=l.isLeaf(),h}function i(l){if(l.isLeaf||l.children.length===0)l.drawingDepth=e;else{var u=l.children.map(function(h){return i(h)}),c=Math.min.apply(null,u);l.drawingDepth=c-1}return l.drawingDepth}var a;function s(l){l.x=l.drawingDepth*t.rankSep,l.isLeaf?(l.y=0,a&&(l.y=a.y+a.height+t.nodeSep,l.originNode.parent!==a.originNode.parent&&(l.y+=t.subTreeSep)),a=l):(l.children.forEach(function(u){s(u)}),l.y=(l.leftChild.y+l.rightChild.y)/2)}var o=n(r);return i(o),s(o),rD(o,r,t.isHorizontal),r};function BJ(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,Gw(r,t)}function Gw(r,t){return Gw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Gw(r,t)}var zJ=Lg,$J=FJ,jJ=sE,qJ=Zs,WJ=function(r){function t(){return r.apply(this,arguments)||this}BJ(t,r);var e=t.prototype;return e.execute=function(){var i=this;return i.rootNode.width=0,jJ(i.rootNode,i.options,$J)},t}(zJ),GJ={};function VJ(r,t){return t=qJ.assign({},GJ,t),new WJ(r,t).execute()}var HJ=VJ,dk=Zs;function UJ(r,t,e,n,i){var a=(typeof e=="function"?e(r):e)*r.depth;if(!n)try{if(r.id===r.parent.children[0].id){r.x+=a,r.y=t?t.y:0;return}}catch{}if(r.x+=a,t){if(r.y=t.y+dk.getHeight(t,r,i),t.parent&&r.parent.id!==t.parent.id){var s=t.parent,o=s.y+dk.getHeight(s,r,i);r.y=o>r.y?o:r.y}}else r.y=0}var YJ=function(r,t,e,n){var i=null;r.eachNode(function(a){UJ(a,i,t,e,n),i=a})};function XJ(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,Vw(r,t)}function Vw(r,t){return Vw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Vw(r,t)}var KJ=Lg,kd=YJ,ZJ=nD,JJ=Zs,zu=["LR","RL","H"],QJ=zu[0],tQ=function(r){function t(){return r.apply(this,arguments)||this}XJ(t,r);var e=t.prototype;return e.execute=function(){var i=this,a=i.options,s=i.rootNode;a.isHorizontal=!0;var o=a.indent,l=o===void 0?20:o,u=a.dropCap,c=u===void 0?!0:u,h=a.direction,d=h===void 0?QJ:h,g=a.align;if(d&&zu.indexOf(d)===-1)throw new TypeError("Invalid direction: "+d);if(d===zu[0])kd(s,l,c,g);else if(d===zu[1])kd(s,l,c,g),s.right2left();else if(d===zu[2]){var p=ZJ(s,a),v=p.left,m=p.right;kd(v,l,c,g),v.right2left(),kd(m,l,c,g);var b=v.getBoundingBox();m.translate(b.width,0),s.x=m.x-s.width/2}return s},t}(KJ),eQ={};function nQ(r,t){return t=JJ.assign({},eQ,t),new tQ(r,t).execute()}var rQ=nQ,iQ=Zs;function iD(r,t){var e=0;return r.children.length?r.children.forEach(function(n){e+=iD(n,t)}):e=r.height,r._subTreeSep=t.getSubTreeSep(r.data),r.totalHeight=Math.max(r.height,e)+2*r._subTreeSep,r.totalHeight}function aD(r){var t=r.children,e=t.length;if(e){t.forEach(function(l){aD(l)});var n=t[0],i=t[e-1],a=i.y-n.y+i.height,s=0;if(t.forEach(function(l){s+=l.totalHeight}),a>r.height)r.y=n.y+a/2-r.height/2;else if(t.length!==1||r.height>s){var o=r.y+(r.height-a)/2-n.y;t.forEach(function(l){l.translate(0,o)})}else r.y=(n.y+n.height/2+i.y+i.height/2)/2-r.height/2}}var aQ={getSubTreeSep:function(){return 0}},sQ=function(r,t){t===void 0&&(t={}),t=iQ.assign({},aQ,t),r.parent={x:0,width:0,height:0,y:0},r.BFTraverse(function(e){e.x=e.parent.x+e.parent.width}),r.parent=null,iD(r,t),r.startY=0,r.y=r.totalHeight/2-r.height/2,r.eachNode(function(e){var n=e.children,i=n.length;if(i){var a=n[0];if(a.startY=e.startY+e._subTreeSep,i===1)a.y=e.y+e.height/2-a.height/2;else{a.y=a.startY+a.totalHeight/2-a.height/2;for(var s=1;s<i;s++){var o=n[s];o.startY=n[s-1].startY+n[s-1].totalHeight,o.y=o.startY+o.totalHeight/2-o.height/2}}}}),aD(r)};function oQ(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,Hw(r,t)}function Hw(r,t){return Hw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Hw(r,t)}var lQ=Lg,uQ=sQ,cQ=sE,hQ=Zs,dQ=function(r){function t(){return r.apply(this,arguments)||this}oQ(t,r);var e=t.prototype;return e.execute=function(){var i=this;return cQ(i.rootNode,i.options,uQ)},t}(lQ),fQ={};function gQ(r,t){return t=hQ.assign({},fQ,t),new dQ(r,t).execute()}var pQ=gQ,vQ={compactBox:RJ,dendrogram:HJ,indented:rQ,mindmap:pQ},Td=vQ;const mQ=(r,t)=>{if(r!=="next"&&r!=="prev")return t},fk=r=>{r.prev.next=r.next,r.next.prev=r.prev,delete r.next,delete r.prev};let yQ=class{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return fk(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&fk(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let n=e.prev;for(;n!==e;)t.push(JSON.stringify(n,mQ)),n=n==null?void 0:n.prev;return`[${t.join(", ")}]`}},bQ=class extends yQ{};const wQ=()=>1,xQ=(r,t)=>{var e;if(r.getAllNodes().length<=1)return[];const n=_Q(r,t||wQ);return(e=EQ(n.graph,n.buckets,n.zeroIdx).map(a=>r.getRelatedEdges(a.v,"out").filter(({target:s})=>s===a.w)))===null||e===void 0?void 0:e.flat()},EQ=(r,t,e)=>{let n=[];const i=t[t.length-1],a=t[0];let s;for(;r.getAllNodes().length;){for(;s=a.dequeue();)jv(r,t,e,s);for(;s=i.dequeue();)jv(r,t,e,s);if(r.getAllNodes().length){for(let o=t.length-2;o>0;--o)if(s=t[o].dequeue(),s){n=n.concat(jv(r,t,e,s,!0));break}}}return n},jv=(r,t,e,n,i)=>{var a,s;const o=[];return r.hasNode(n.v)&&((a=r.getRelatedEdges(n.v,"in"))===null||a===void 0||a.forEach(l=>{const u=l.data.weight,c=r.getNode(l.source);i&&o.push({v:l.source,w:l.target,in:0,out:0}),c.data.out===void 0&&(c.data.out=0),c.data.out-=u,Uw(t,e,Object.assign({v:c.id},c.data))}),(s=r.getRelatedEdges(n.v,"out"))===null||s===void 0||s.forEach(l=>{const u=l.data.weight,c=l.target,h=r.getNode(c);h.data.in===void 0&&(h.data.in=0),h.data.in-=u,Uw(t,e,Object.assign({v:h.id},h.data))}),r.removeNode(n.v)),i?o:void 0},_Q=(r,t)=>{const e=new Mn;let n=0,i=0;r.getAllNodes().forEach(l=>{e.addNode({id:l.id,data:{v:l.id,in:0,out:0}})}),r.getAllEdges().forEach(l=>{const u=e.getRelatedEdges(l.source,"out").find(h=>h.target===l.target),c=(t==null?void 0:t(l))||1;u?e.updateEdgeData(u==null?void 0:u.id,Object.assign(Object.assign({},u.data),{weight:u.data.weight+c})):e.addEdge({id:l.id,source:l.source,target:l.target,data:{weight:c}}),i=Math.max(i,e.getNode(l.source).data.out+=c),n=Math.max(n,e.getNode(l.target).data.in+=c)});const a=[],s=i+n+3;for(let l=0;l<s;l++)a.push(new bQ);const o=n+1;return e.getAllNodes().forEach(l=>{Uw(a,o,Object.assign({v:l.id},e.getNode(l.id).data))}),{buckets:a,zeroIdx:o,graph:e}},Uw=(r,t,e)=>{e.out?e.in?r[e.out-e.in+t].enqueue(e):r[r.length-1].enqueue(e):r[0].enqueue(e)},SQ=(r,t)=>{const n=xQ(r,(i=>a=>a.data.weight||1)());n==null||n.forEach(i=>{const a=i.data;r.removeEdge(i.id),a.forwardName=i.data.name,a.reversed=!0,r.addEdge({id:i.id,source:i.target,target:i.source,data:Object.assign({},a)})})},MQ=r=>{r.getAllEdges().forEach(t=>{const e=t.data;if(e.reversed){r.removeEdge(t.id);const n=e.forwardName;delete e.reversed,delete e.forwardName,r.addEdge({id:t.id,source:t.target,target:t.source,data:Object.assign(Object.assign({},e),{forwardName:n})})}})},kQ=(r,t)=>Number(r)-Number(t),Zl=(r,t,e,n)=>{let i;do i=`${n}${Math.random()}`;while(r.hasNode(i));return e.dummy=t,r.addNode({id:i,data:e}),i},TQ=r=>{const t=new Mn;return r.getAllNodes().forEach(e=>{t.addNode(Object.assign({},e))}),r.getAllEdges().forEach(e=>{const n=t.getRelatedEdges(e.source,"out").find(i=>i.target===e.target);n?t.updateEdgeData(n==null?void 0:n.id,Object.assign(Object.assign({},n.data),{weight:n.data.weight+e.data.weight||0,minlen:Math.max(n.data.minlen,e.data.minlen||1)})):t.addEdge({id:e.id,source:e.source,target:e.target,data:{weight:e.data.weight||0,minlen:e.data.minlen||1}})}),t},sD=r=>{const t=new Mn;return r.getAllNodes().forEach(e=>{r.getChildren(e.id).length||t.addNode(Object.assign({},e))}),r.getAllEdges().forEach(e=>{t.addEdge(e)}),t},OQ=(r,t)=>r==null?void 0:r.reduce((e,n,i)=>(e[n]=t[i],e),{}),gk=(r,t)=>{const e=Number(r.x),n=Number(r.y),i=Number(t.x)-e,a=Number(t.y)-n;let s=Number(r.width)/2,o=Number(r.height)/2;if(!i&&!a)return{x:0,y:0};let l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,u=o):(i<0&&(s=-s),l=s,u=s*a/i),{x:e+l,y:n+u}},yc=r=>{const t=[],e=oD(r)+1;for(let n=0;n<e;n++)t.push([]);r.getAllNodes().forEach(n=>{const i=n.data.rank;i!==void 0&&t[i]&&t[i].push(n.id)});for(let n=0;n<e;n++)t[n]=t[n].sort((i,a)=>kQ(r.getNode(i).data.order,r.getNode(a).data.order));return t},CQ=r=>{const t=r.getAllNodes().filter(n=>n.data.rank!==void 0).map(n=>n.data.rank),e=Math.min(...t);r.getAllNodes().forEach(n=>{n.data.hasOwnProperty("rank")&&e!==1/0&&(n.data.rank-=e)})},AQ=(r,t=0)=>{const e=r.getAllNodes(),n=e.filter(o=>o.data.rank!==void 0).map(o=>o.data.rank),i=Math.min(...n),a=[];e.forEach(o=>{const l=(o.data.rank||0)-i;a[l]||(a[l]=[]),a[l].push(o.id)});let s=0;for(let o=0;o<a.length;o++){const l=a[o];l===void 0?o%t!==0&&(s-=1):s&&(l==null||l.forEach(u=>{const c=r.getNode(u);c&&(c.data.rank=c.data.rank||0,c.data.rank+=s)}))}},pk=(r,t,e,n)=>{const i={width:0,height:0};return yt(e)&&yt(n)&&(i.rank=e,i.order=n),Zl(r,"border",i,t)},oD=r=>{let t;return r.getAllNodes().forEach(e=>{const n=e.data.rank;n!==void 0&&(t===void 0||n>t)&&(t=n)}),t||(t=0),t},PQ=(r,t)=>{const e={lhs:[],rhs:[]};return r==null||r.forEach(n=>{t(n)?e.lhs.push(n):e.rhs.push(n)}),e},oE=(r,t)=>r.reduce((e,n)=>{const i=t(e),a=t(n);return i>a?n:e}),lD=(r,t,e,n,i,a)=>{n.includes(t.id)||(n.push(t.id),e||a.push(t.id),i(t.id).forEach(s=>lD(r,s,e,n,i,a)),e&&a.push(t.id))},uD=(r,t,e,n)=>{const i=Array.isArray(t)?t:[t],a=l=>r.getNeighbors(l),s=[],o=[];return i.forEach(l=>{if(r.hasNode(l.id))lD(r,l,e==="post",o,a,s);else throw new Error(`Graph does not have node: ${l}`)}),s},NQ=r=>{const t=e=>{const n=r.getChildren(e),i=r.getNode(e);if(n!=null&&n.length&&n.forEach(a=>t(a.id)),i.data.hasOwnProperty("minRank")){i.data.borderLeft=[],i.data.borderRight=[];for(let a=i.data.minRank,s=i.data.maxRank+1;a<s;a+=1)vk(r,"borderLeft","_bl",e,i,a),vk(r,"borderRight","_br",e,i,a)}};r.getRoots().forEach(e=>t(e.id))},vk=(r,t,e,n,i,a)=>{const s={rank:a,borderType:t,width:0,height:0},o=i.data[t][a-1],l=Zl(r,"border",s,e);i.data[t][a]=l,r.setParent(l,n),o&&r.addEdge({id:`e${Math.random()}`,source:o,target:l,data:{weight:1}})},RQ=(r,t)=>{const e=t.toLowerCase();(e==="lr"||e==="rl")&&cD(r)},LQ=(r,t)=>{const e=t.toLowerCase();(e==="bt"||e==="rl")&&IQ(r),(e==="lr"||e==="rl")&&(DQ(r),cD(r))},cD=r=>{r.getAllNodes().forEach(t=>{mk(t)}),r.getAllEdges().forEach(t=>{mk(t)})},mk=r=>{const t=r.data.width;r.data.width=r.data.height,r.data.height=t},IQ=r=>{r.getAllNodes().forEach(t=>{qv(t.data)}),r.getAllEdges().forEach(t=>{var e;(e=t.data.points)===null||e===void 0||e.forEach(n=>qv(n)),t.data.hasOwnProperty("y")&&qv(t.data)})},qv=r=>{r!=null&&r.y&&(r.y=-r.y)},DQ=r=>{r.getAllNodes().forEach(t=>{Wv(t.data)}),r.getAllEdges().forEach(t=>{var e;(e=t.data.points)===null||e===void 0||e.forEach(n=>Wv(n)),t.data.hasOwnProperty("x")&&Wv(t.data)})},Wv=r=>{const t=r.x;r.x=r.y,r.y=t},FQ=r=>{const t=Zl(r,"root",{},"_root"),e=BQ(r);let n=Math.max(...Object.values(e));Math.abs(n)===1/0&&(n=1);const i=n-1,a=2*i+1;r.getAllEdges().forEach(o=>{o.data.minlen*=a});const s=zQ(r)+1;return r.getRoots().forEach(o=>{hD(r,t,a,s,i,e,o.id)}),{nestingRoot:t,nodeRankFactor:a}},hD=(r,t,e,n,i,a,s)=>{const o=r.getChildren(s);if(!(o!=null&&o.length)){s!==t&&r.addEdge({id:`e${Math.random()}`,source:t,target:s,data:{weight:0,minlen:e}});return}const l=pk(r,"_bt"),u=pk(r,"_bb"),c=r.getNode(s);r.setParent(l,s),c.data.borderTop=l,r.setParent(u,s),c.data.borderBottom=u,o==null||o.forEach(h=>{hD(r,t,e,n,i,a,h.id);const d=h.data.borderTop?h.data.borderTop:h.id,g=h.data.borderBottom?h.data.borderBottom:h.id,p=h.data.borderTop?n:2*n,v=d!==g?1:i-a[s]+1;r.addEdge({id:`e${Math.random()}`,source:l,target:d,data:{minlen:v,weight:p,nestingEdge:!0}}),r.addEdge({id:`e${Math.random()}`,source:g,target:u,data:{minlen:v,weight:p,nestingEdge:!0}})}),r.getParent(s)||r.addEdge({id:`e${Math.random()}`,source:t,target:l,data:{weight:0,minlen:i+a[s]}})},BQ=r=>{const t={},e=(n,i)=>{const a=r.getChildren(n);a==null||a.forEach(s=>e(s.id,i+1)),t[n]=i};return r.getRoots().forEach(n=>e(n.id,1)),t},zQ=r=>{let t=0;return r.getAllEdges().forEach(e=>{t+=e.data.weight}),t},$Q=(r,t)=>{t&&r.removeNode(t),r.getAllEdges().forEach(e=>{e.data.nestingEdge&&r.removeEdge(e.id)})},jQ="edge",dD="edge-label",qQ=(r,t)=>{r.getAllEdges().forEach(e=>WQ(r,e,t))},WQ=(r,t,e)=>{let n=t.source,i=r.getNode(n).data.rank;const a=t.target,s=r.getNode(a).data.rank,o=t.data.labelRank;if(s===i+1)return;r.removeEdge(t.id);let l,u,c;for(c=0,++i;i<s;++c,++i)t.data.points=[],u={originalEdge:t,width:0,height:0,rank:i},l=Zl(r,jQ,u,"_d"),i===o&&(u.width=t.data.width,u.height=t.data.height,u.dummy=dD,u.labelpos=t.data.labelpos),r.addEdge({id:`e${Math.random()}`,source:n,target:l,data:{weight:t.data.weight}}),c===0&&e.push(l),n=l;r.addEdge({id:`e${Math.random()}`,source:n,target:a,data:{weight:t.data.weight}})},GQ=(r,t)=>{t.forEach(e=>{let n=r.getNode(e);const{data:i}=n,a=i.originalEdge;let s;a&&r.addEdge(a);let o=e;for(;n.data.dummy;)s=r.getSuccessors(o)[0],r.removeNode(o),a.data.points.push({x:n.data.x,y:n.data.y}),n.data.dummy===dD&&(a.data.x=n.data.x,a.data.y=n.data.y,a.data.width=n.data.width,a.data.height=n.data.height),o=s.id,n=r.getNode(o)})},VQ=(r,t,e)=>{const n={};let i;e==null||e.forEach(a=>{let s=r.getParent(a),o,l;for(;s;){if(o=r.getParent(s.id),o?(l=n[o.id],n[o.id]=s.id):(l=i,i=s.id),l&&l!==s.id){t.hasNode(l)||t.addNode({id:l,data:{}}),t.hasNode(s.id)||t.addNode({id:s.id,data:{}}),t.hasEdge(`e${l}-${s.id}`)||t.addEdge({id:`e${l}-${s.id}`,source:l,target:s.id,data:{}});return}s=o}})},HQ=(r,t,e)=>{const n=UQ(r),i=new Mn({tree:[{id:n,children:[],data:{}}]});return r.getAllNodes().forEach(a=>{const s=r.getParent(a.id);(a.data.rank===t||a.data.minRank<=t&&t<=a.data.maxRank)&&(i.hasNode(a.id)||i.addNode(Object.assign({},a)),s!=null&&s.id&&!i.hasNode(s==null?void 0:s.id)&&i.addNode(Object.assign({},s)),i.setParent(a.id,(s==null?void 0:s.id)||n),r.getRelatedEdges(a.id,e).forEach(o=>{const l=o.source===a.id?o.target:o.source;i.hasNode(l)||i.addNode(Object.assign({},r.getNode(l)));const u=i.getRelatedEdges(l,"out").find(({target:h})=>h===a.id),c=u!==void 0?u.data.weight:0;u?i.updateEdgeData(u.id,Object.assign(Object.assign({},u.data),{weight:o.data.weight+c})):i.addEdge({id:o.id,source:l,target:a.id,data:{weight:o.data.weight+c}})}),a.data.hasOwnProperty("minRank")&&i.updateNodeData(a.id,Object.assign(Object.assign({},a.data),{borderLeft:a.data.borderLeft[t],borderRight:a.data.borderRight[t]})))}),i},UQ=r=>{let t;for(;r.hasNode(t=`_root${Math.random()}`););return t},YQ=(r,t,e)=>{const n=OQ(e,e.map((c,h)=>h)),a=t.map(c=>{const h=r.getRelatedEdges(c,"out").map(d=>({pos:n[d.target]||0,weight:d.data.weight}));return h==null?void 0:h.sort((d,g)=>d.pos-g.pos)}).flat().filter(c=>c!==void 0);let s=1;for(;s<e.length;)s<<=1;const o=2*s-1;s-=1;const l=Array(o).fill(0,0,o);let u=0;return a==null||a.forEach(c=>{if(c){let h=c.pos+s;l[h]+=c.weight;let d=0;for(;h>0;)h%2&&(d+=l[h+1]),h=h-1>>1,l[h]+=c.weight;u+=c.weight*d}}),u},yk=(r,t)=>{let e=0;for(let n=1;n<(t==null?void 0:t.length);n+=1)e+=YQ(r,t[n-1],t[n]);return e},bk=r=>{const t={},e=r.getAllNodes(),n=e.map(u=>{var c;return(c=u.data.rank)!==null&&c!==void 0?c:-1/0}),i=Math.max(...n),a=[];for(let u=0;u<i+1;u++)a.push([]);const s=e.sort((u,c)=>r.getNode(u.id).data.rank-r.getNode(c.id).data.rank),l=s.filter(u=>r.getNode(u.id).data.fixorder!==void 0).sort((u,c)=>r.getNode(u.id).data.fixorder-r.getNode(c.id).data.fixorder);return l==null||l.forEach(u=>{isNaN(r.getNode(u.id).data.rank)||a[r.getNode(u.id).data.rank].push(u.id),t[u.id]=!0}),s==null||s.forEach(u=>r.dfsTree(u.id,c=>{if(t.hasOwnProperty(c.id))return!0;t[c.id]=!0,isNaN(c.data.rank)||a[c.data.rank].push(c.id)})),a},XQ=(r,t)=>t.map(e=>{const n=r.getRelatedEdges(e,"in");if(!(n!=null&&n.length))return{v:e};const i={sum:0,weight:0};return n==null||n.forEach(a=>{const s=r.getNode(a.source);i.sum+=a.data.weight*s.data.order,i.weight+=a.data.weight}),{v:e,barycenter:i.sum/i.weight,weight:i.weight}}),KQ=(r,t)=>{var e,n,i;const a={};r==null||r.forEach((o,l)=>{a[o.v]={i:l,indegree:0,in:[],out:[],vs:[o.v]};const u=a[o.v];o.barycenter!==void 0&&(u.barycenter=o.barycenter,u.weight=o.weight)}),(e=t.getAllEdges())===null||e===void 0||e.forEach(o=>{const l=a[o.source],u=a[o.target];l!==void 0&&u!==void 0&&(u.indegree++,l.out.push(a[o.target]))});const s=(i=(n=Object.values(a)).filter)===null||i===void 0?void 0:i.call(n,o=>!o.indegree);return ZQ(s)},ZQ=r=>{var t,e;const n=[],i=l=>u=>{u.merged||(u.barycenter===void 0||l.barycenter===void 0||u.barycenter>=l.barycenter)&&JQ(l,u)},a=l=>u=>{u.in.push(l),--u.indegree===0&&r.push(u)};for(;r!=null&&r.length;){const l=r.pop();n.push(l),(t=l.in.reverse())===null||t===void 0||t.forEach(u=>i(l)(u)),(e=l.out)===null||e===void 0||e.forEach(u=>a(l)(u))}const s=n.filter(l=>!l.merged),o=["vs","i","barycenter","weight"];return s.map(l=>{const u={};return o==null||o.forEach(c=>{l[c]!==void 0&&(u[c]=l[c])}),u})},JQ=(r,t)=>{var e;let n=0,i=0;r.weight&&(n+=r.barycenter*r.weight,i+=r.weight),t.weight&&(n+=t.barycenter*t.weight,i+=t.weight),r.vs=(e=t.vs)===null||e===void 0?void 0:e.concat(r.vs),r.barycenter=n/i,r.weight=i,r.i=Math.min(t.i,r.i),t.merged=!0},QQ=(r,t,e,n)=>{const i=PQ(r,d=>{const g=d.hasOwnProperty("fixorder")&&!isNaN(d.fixorder);return n?!g&&d.hasOwnProperty("barycenter"):g||d.hasOwnProperty("barycenter")}),a=i.lhs,s=i.rhs.sort((d,g)=>-d.i- -g.i),o=[];let l=0,u=0,c=0;a==null||a.sort(ttt(!!t,!!e)),c=wk(o,s,c),a==null||a.forEach(d=>{var g;c+=(g=d.vs)===null||g===void 0?void 0:g.length,o.push(d.vs),l+=d.barycenter*d.weight,u+=d.weight,c=wk(o,s,c)});const h={vs:o.flat()};return u&&(h.barycenter=l/u,h.weight=u),h},wk=(r,t,e)=>{let n=e,i;for(;t.length&&(i=t[t.length-1]).i<=n;)t.pop(),r==null||r.push(i.vs),n++;return n},ttt=(r,t)=>(e,n)=>{if(e.fixorder!==void 0&&n.fixorder!==void 0)return e.fixorder-n.fixorder;if(e.barycenter<n.barycenter)return-1;if(e.barycenter>n.barycenter)return 1;if(t&&e.order!==void 0&&n.order!==void 0){if(e.order<n.order)return-1;if(e.order>n.order)return 1}return r?n.i-e.i:e.i-n.i},fD=(r,t,e,n,i,a)=>{var s,o,l,u;let c=r.getChildren(t).map(w=>w.id);const h=r.getNode(t),d=h?h.data.borderLeft:void 0,g=h?h.data.borderRight:void 0,p={};d&&(c=c==null?void 0:c.filter(w=>w!==d&&w!==g));const v=XQ(r,c||[]);v==null||v.forEach(w=>{var x;if(!((x=r.getChildren(w.v))===null||x===void 0)&&x.length){const _=fD(r,w.v,e,n,a);p[w.v]=_,_.hasOwnProperty("barycenter")&&ntt(w,_)}});const m=KQ(v,e);ett(m,p),(s=m.filter(w=>w.vs.length>0))===null||s===void 0||s.forEach(w=>{const x=r.getNode(w.vs[0]);x&&(w.fixorder=x.data.fixorder,w.order=x.data.order)});const b=QQ(m,n,i,a);if(d&&(b.vs=[d,b.vs,g].flat(),!((o=r.getPredecessors(d))===null||o===void 0)&&o.length)){const w=r.getNode(((l=r.getPredecessors(d))===null||l===void 0?void 0:l[0].id)||""),x=r.getNode(((u=r.getPredecessors(g))===null||u===void 0?void 0:u[0].id)||"");b.hasOwnProperty("barycenter")||(b.barycenter=0,b.weight=0),b.barycenter=(b.barycenter*b.weight+w.data.order+x.data.order)/(b.weight+2),b.weight+=2}return b},ett=(r,t)=>{r==null||r.forEach(e=>{var n;const i=(n=e.vs)===null||n===void 0?void 0:n.map(a=>t[a]?t[a].vs:a);e.vs=i.flat()})},ntt=(r,t)=>{r.barycenter!==void 0?(r.barycenter=(r.barycenter*r.weight+t.barycenter*t.weight)/(r.weight+t.weight),r.weight+=t.weight):(r.barycenter=t.barycenter,r.weight=t.weight)},rtt=(r,t)=>{const e=oD(r),n=[],i=[];for(let c=1;c<e+1;c++)n.push(c);for(let c=e-1;c>-1;c--)i.push(c);const a=xk(r,n,"in"),s=xk(r,i,"out");let o=bk(r);Gv(r,o);let l=Number.POSITIVE_INFINITY,u;for(let c=0,h=0;h<4;++c,++h){Ek(c%2?a:s,c%4>=2,!1,t),o=yc(r);const d=yk(r,o);d<l&&(h=0,u=zs(o),l=d)}o=bk(r),Gv(r,o);for(let c=0,h=0;h<4;++c,++h){Ek(c%2?a:s,c%4>=2,!0,t),o=yc(r);const d=yk(r,o);d<l&&(h=0,u=zs(o),l=d)}Gv(r,u)},xk=(r,t,e)=>t.map(n=>HQ(r,n,e)),Ek=(r,t,e,n)=>{const i=new Mn;r==null||r.forEach(a=>{var s;const o=a.getRoots()[0].id,l=fD(a,o,i,t,e,n);for(let u=0;u<((s=l.vs)===null||s===void 0?void 0:s.length);u++){const c=a.getNode(l.vs[u]);c&&(c.data.order=u)}VQ(a,i,l.vs)})},Gv=(r,t)=>{t==null||t.forEach(e=>{e==null||e.forEach((n,i)=>{r.getNode(n).data.order=i})})},itt=(r,t)=>{const n=r.getAllNodes().filter(s=>{var o;return!(!((o=r.getChildren(s.id))===null||o===void 0)&&o.length)}).map(s=>s.data.rank),i=Math.max(...n),a=[];for(let s=0;s<i+1;s++)a[s]=[];t==null||t.forEach(s=>{const o=r.getNode(s);!o||o.data.dummy||isNaN(o.data.rank)||(o.data.fixorder=a[o.data.rank].length,a[o.data.rank].push(s))})},att=r=>{const t={};let e=0;const n=i=>{const a=e;r.getChildren(i).forEach(s=>n(s.id)),t[i]={low:a,lim:e++}};return r.getRoots().forEach(i=>n(i.id)),t},stt=(r,t,e,n)=>{var i,a;const s=[],o=[],l=Math.min(t[e].low,t[n].low),u=Math.max(t[e].lim,t[n].lim);let c,h;c=e;do c=(i=r.getParent(c))===null||i===void 0?void 0:i.id,s.push(c);while(c&&(t[c].low>l||u>t[c].lim));for(h=c,c=n;c&&c!==h;)o.push(c),c=(a=r.getParent(c))===null||a===void 0?void 0:a.id;return{lca:h,path:s.concat(o.reverse())}},ott=(r,t)=>{const e=att(r);t.forEach(n=>{var i,a;let s=n,o=r.getNode(s);const l=o.data.originalEdge;if(!l)return;const u=stt(r,e,l.source,l.target),c=u.path,h=u.lca;let d=0,g=c[d],p=!0;for(;s!==l.target;){if(o=r.getNode(s),p){for(;g!==h&&((i=r.getNode(g))===null||i===void 0?void 0:i.data.maxRank)<o.data.rank;)d++,g=c[d];g===h&&(p=!1)}if(!p){for(;d<c.length-1&&((a=r.getNode(c[d+1]))===null||a===void 0?void 0:a.data.minRank)<=o.data.rank;)d++;g=c[d]}r.hasNode(g)&&r.setParent(s,g),s=r.getSuccessors(s)[0].id}})},ltt=(r,t)=>{const e={},n=(i,a)=>{let s=0,o=0;const l=i.length,u=a==null?void 0:a[(a==null?void 0:a.length)-1];return a==null||a.forEach((c,h)=>{var d;const g=ctt(r,c),p=g?r.getNode(g.id).data.order:l;(g||c===u)&&((d=a.slice(o,h+1))===null||d===void 0||d.forEach(v=>{var m;(m=r.getPredecessors(v))===null||m===void 0||m.forEach(b=>{var w;const x=r.getNode(b.id),_=x.data.order;(_<s||p<_)&&!(x.data.dummy&&(!((w=r.getNode(v))===null||w===void 0)&&w.data.dummy))&&gD(e,b.id,v)})}),o=h+1,s=p)}),a};return t!=null&&t.length&&t.reduce(n),e},utt=(r,t)=>{const e={};function n(o,l,u,c,h){var d,g;let p;for(let v=l;v<u;v++)p=o[v],!((d=r.getNode(p))===null||d===void 0)&&d.data.dummy&&((g=r.getPredecessors(p))===null||g===void 0||g.forEach(m=>{const b=r.getNode(m.id);b.data.dummy&&(b.data.order<c||b.data.order>h)&&gD(e,m.id,p)}))}function i(o){return JSON.stringify(o.slice(1))}function a(o,l){const u=i(o);l.get(u)||(n(...o),l.set(u,!0))}const s=(o,l)=>{let u=-1,c,h=0;const d=new Map;return l==null||l.forEach((g,p)=>{var v;if(((v=r.getNode(g))===null||v===void 0?void 0:v.data.dummy)==="border"){const m=r.getPredecessors(g)||[];m.length&&(c=r.getNode(m[0].id).data.order,a([l,h,p,u,c],d),h=p,u=c)}a([l,h,l.length,c,o.length],d)}),l};return t!=null&&t.length&&t.reduce(s),e},ctt=(r,t)=>{var e,n;if(!((e=r.getNode(t))===null||e===void 0)&&e.data.dummy)return(n=r.getPredecessors(t))===null||n===void 0?void 0:n.find(i=>r.getNode(i.id).data.dummy)},gD=(r,t,e)=>{let n=t,i=e;if(n>i){const s=n;n=i,i=s}let a=r[n];a||(r[n]=a={}),a[i]=!0},htt=(r,t,e)=>{let n=t,i=e;if(n>i){const a=t;n=i,i=a}return!!r[n]},dtt=(r,t,e,n)=>{const i={},a={},s={};return t==null||t.forEach(o=>{o==null||o.forEach((l,u)=>{i[l]=l,a[l]=l,s[l]=u})}),t==null||t.forEach(o=>{let l=-1;o==null||o.forEach(u=>{let c=n(u).map(h=>h.id);if(c.length){c=c.sort((d,g)=>s[d]-s[g]);const h=(c.length-1)/2;for(let d=Math.floor(h),g=Math.ceil(h);d<=g;++d){const p=c[d];a[u]===u&&l<s[p]&&!htt(e,u,p)&&(a[p]=u,a[u]=i[u]=i[p],l=s[p])}}})}),{root:i,align:a}},ftt=(r,t,e,n,i,a,s)=>{var o;const l={},u=gtt(r,t,e,i,a,s),c=s?"borderLeft":"borderRight",h=(p,v)=>{let m=u.getAllNodes(),b=m.pop();const w={};for(;b;)w[b.id]?p(b.id):(w[b.id]=!0,m.push(b),m=m.concat(v(b.id))),b=m.pop()},d=p=>{l[p]=(u.getRelatedEdges(p,"in")||[]).reduce((v,m)=>Math.max(v,(l[m.source]||0)+m.data.weight),0)},g=p=>{const v=(u.getRelatedEdges(p,"out")||[]).reduce((b,w)=>Math.min(b,(l[w.target]||0)-w.data.weight),Number.POSITIVE_INFINITY),m=r.getNode(p);v!==Number.POSITIVE_INFINITY&&m.data.borderType!==c&&(l[p]=Math.max(l[p],v))};return h(d,u.getPredecessors.bind(u)),h(g,u.getSuccessors.bind(u)),(o=Object.values(n))===null||o===void 0||o.forEach(p=>{l[p]=l[e[p]]}),l},gtt=(r,t,e,n,i,a)=>{const s=new Mn,o=ytt(n,i,a);return t==null||t.forEach(l=>{let u;l==null||l.forEach(c=>{const h=e[c];if(s.hasNode(h)||s.addNode({id:h,data:{}}),u){const d=e[u],g=s.getRelatedEdges(d,"out").find(p=>p.target===h);g?s.updateEdgeData(g.id,Object.assign(Object.assign({},g.data),{weight:Math.max(o(r,c,u),g.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:d,target:h,data:{weight:Math.max(o(r,c,u),0)}})}u=c})}),s},ptt=(r,t)=>oE(Object.values(t),e=>{var n;let i=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return(n=Object.keys(e))===null||n===void 0||n.forEach(s=>{const o=e[s],l=btt(r,s)/2;i=Math.max(o+l,i),a=Math.min(o-l,a)}),i-a});function vtt(r,t){const e=Object.values(t),n=Math.min(...e),i=Math.max(...e);["u","d"].forEach(a=>{["l","r"].forEach(s=>{const o=a+s,l=r[o];let u;if(l===t)return;const c=Object.values(l);u=s==="l"?n-Math.min(...c):i-Math.max(...c),u&&(r[o]={},Object.keys(l).forEach(h=>{r[o][h]=l[h]+u}))})})}const mtt=(r,t)=>{const e={};return Object.keys(r.ul).forEach(n=>{if(t)e[n]=r[t.toLowerCase()][n];else{const i=Object.values(r).map(a=>a[n]);e[n]=(i[0]+i[1])/2}}),e},ytt=(r,t,e)=>(n,i,a)=>{const s=n.getNode(i),o=n.getNode(a);let l=0,u=0;if(l+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":u=-s.data.width/2;break;case"r":u=s.data.width/2;break}if(u&&(l+=e?u:-u),u=0,l+=(s.data.dummy?t:r)/2,l+=(o.data.dummy?t:r)/2,l+=o.data.width/2,o.data.labelpos)switch((o.data.labelpos||"").toLowerCase()){case"l":u=o.data.width/2;break;case"r":u=-o.data.width/2;break}return u&&(l+=e?u:-u),u=0,l},btt=(r,t)=>r.getNode(t).data.width||0,wtt=(r,t)=>{const{ranksep:e=0}=t||{},n=yc(r);let i=0;n==null||n.forEach(a=>{const s=a.map(l=>r.getNode(l).data.height),o=Math.max(...s,0);a==null||a.forEach(l=>{r.getNode(l).data.y=i+o/2}),i+=o+e})},xtt=(r,t)=>{const{align:e,nodesep:n=0,edgesep:i=0}=t||{},a=yc(r),s=Object.assign(ltt(r,a),utt(r,a)),o={};let l=[];["u","d"].forEach(c=>{l=c==="u"?a:Object.values(a).reverse(),["l","r"].forEach(h=>{h==="r"&&(l=l.map(v=>Object.values(v).reverse()));const d=(c==="u"?r.getPredecessors:r.getSuccessors).bind(r),g=dtt(r,l,s,d),p=ftt(r,l,g.root,g.align,n,i,h==="r");h==="r"&&Object.keys(p).forEach(v=>p[v]=-p[v]),o[c+h]=p})});const u=ptt(r,o);return u&&vtt(o,u),mtt(o,e)},Ett=(r,t)=>{var e;const n=sD(r);wtt(n,t);const i=xtt(n,t);(e=Object.keys(i))===null||e===void 0||e.forEach(a=>{n.getNode(a).data.x=i[a]})},pD=r=>{const t={},e=n=>{var i;const a=r.getNode(n);if(!a)return 0;if(t[n])return a.data.rank;t[n]=!0;let s;return(i=r.getRelatedEdges(n,"out"))===null||i===void 0||i.forEach(o=>{const l=e(o.target),u=o.data.minlen,c=l-u;c&&(s===void 0||c<s)&&(s=c)}),s||(s=0),a.data.rank=s,s};r.getAllNodes().filter(n=>r.getRelatedEdges(n.id,"in").length===0).forEach(n=>e(n.id))},_tt=r=>{const t={};let e;const n=s=>{var o;const l=r.getNode(s);if(!l)return 0;if(t[s])return l.data.rank;t[s]=!0;let u;return(o=r.getRelatedEdges(s,"out"))===null||o===void 0||o.forEach(c=>{const h=n(c.target),d=c.data.minlen,g=h-d;g&&(u===void 0||g<u)&&(u=g)}),u||(u=0),(e===void 0||u<e)&&(e=u),l.data.rank=u,u};r.getAllNodes().filter(s=>r.getRelatedEdges(s.id,"in").length===0).forEach(s=>{s&&n(s.id)}),e===void 0&&(e=0);const i={},a=(s,o)=>{var l;const u=r.getNode(s),c=isNaN(u.data.layer)?o:u.data.layer;(u.data.rank===void 0||u.data.rank<c)&&(u.data.rank=c),!i[s]&&(i[s]=!0,(l=r.getRelatedEdges(s,"out"))===null||l===void 0||l.forEach(h=>{a(h.target,c+h.data.minlen)}))};r.getAllNodes().forEach(s=>{const o=s.data;o&&(isNaN(o.layer)?o.rank-=e:a(s.id,o.layer))})},js=(r,t)=>r.getNode(t.target).data.rank-r.getNode(t.source).data.rank-t.data.minlen,Stt=r=>{const t=new Mn({tree:[]}),e=r.getAllNodes()[0],n=r.getAllNodes().length;t.addNode(e);let i,a;for(;Mtt(t,r)<n;)i=vD(t,r),a=t.hasNode(i.source)?js(r,i):-js(r,i),mD(t,r,a);return t},Mtt=(r,t)=>{const e=n=>{t.getRelatedEdges(n,"both").forEach(i=>{const a=i.source,s=n===a?i.target:a;!r.hasNode(s)&&!js(t,i)&&(r.addNode({id:s,data:{}}),r.addEdge({id:i.id,source:n,target:s,data:{}}),e(s))})};return r.getAllNodes().forEach(n=>e(n.id)),r.getAllNodes().length},ktt=r=>{const t=new Mn({tree:[]}),e=r.getAllNodes()[0],n=r.getAllNodes().length;t.addNode(e);let i,a;for(;Ttt(t,r)<n;)i=vD(t,r),a=t.hasNode(i.source)?js(r,i):-js(r,i),mD(t,r,a);return t},Ttt=(r,t)=>{const e=n=>{var i;(i=t.getRelatedEdges(n,"both"))===null||i===void 0||i.forEach(a=>{const s=a.source,o=n===s?a.target:s;!r.hasNode(o)&&(t.getNode(o).data.layer!==void 0||!js(t,a))&&(r.addNode({id:o,data:{}}),r.addEdge({id:a.id,source:n,target:o,data:{}}),e(o))})};return r.getAllNodes().forEach(n=>e(n.id)),r.getAllNodes().length},vD=(r,t)=>oE(t.getAllEdges(),e=>r.hasNode(e.source)!==r.hasNode(e.target)?js(t,e):1/0),mD=(r,t,e)=>{r.getAllNodes().forEach(n=>{const i=t.getNode(n.id);i.data.rank||(i.data.rank=0),i.data.rank+=e})},Ott=r=>{const t=TQ(r);pD(t);const e=Stt(t);bD(e),yD(e,t);let n,i;for(;n=Ptt(e);)i=Ntt(e,t,n),Rtt(e,t,n,i)},yD=(r,t)=>{let e=uD(r,r.getAllNodes(),"post");e=e.slice(0,(e==null?void 0:e.length)-1),e.forEach(n=>{Ctt(r,t,n)})},Ctt=(r,t,e)=>{const i=r.getNode(e).data.parent,a=r.getRelatedEdges(e,"both").find(s=>s.target===i||s.source===i);a.data.cutvalue=Att(r,t,e)},Att=(r,t,e)=>{const i=r.getNode(e).data.parent;let a=!0,s=t.getRelatedEdges(e,"out").find(l=>l.target===i),o=0;return s||(a=!1,s=t.getRelatedEdges(i,"out").find(l=>l.target===e)),o=s.data.weight,t.getRelatedEdges(e,"both").forEach(l=>{const u=l.source===e,c=u?l.target:l.source;if(c!==i){const h=u===a,d=l.data.weight;if(o+=h?d:-d,Itt(r,e,c)){const g=r.getRelatedEdges(e,"both").find(p=>p.source===c||p.target===c).data.cutvalue;o+=h?-g:g}}}),o},bD=(r,t=r.getAllNodes()[0].id)=>{wD(r,{},1,t)},wD=(r,t,e,n,i)=>{var a;const s=e;let o=e;const l=r.getNode(n);return t[n]=!0,(a=r.getNeighbors(n))===null||a===void 0||a.forEach(u=>{t[u.id]||(o=wD(r,t,o,u.id,n))}),l.data.low=s,l.data.lim=o++,i?l.data.parent=i:delete l.data.parent,o},Ptt=r=>r.getAllEdges().find(t=>t.data.cutvalue<0),Ntt=(r,t,e)=>{let n=e.source,i=e.target;t.getRelatedEdges(n,"out").find(c=>c.target===i)||(n=e.target,i=e.source);const a=r.getNode(n),s=r.getNode(i);let o=a,l=!1;a.data.lim>s.data.lim&&(o=s,l=!0);const u=t.getAllEdges().filter(c=>l===_k(r.getNode(c.source),o)&&l!==_k(r.getNode(c.target),o));return oE(u,c=>js(t,c))},Rtt=(r,t,e,n)=>{const i=r.getRelatedEdges(e.source,"both").find(a=>a.source===e.target||a.target===e.target);i&&r.removeEdge(i.id),r.addEdge({id:`e${Math.random()}`,source:n.source,target:n.target,data:{}}),bD(r),yD(r,t),Ltt(r,t)},Ltt=(r,t)=>{const e=r.getAllNodes().find(i=>!i.data.parent);let n=uD(r,e,"pre");n=n.slice(1),n.forEach(i=>{const a=r.getNode(i).data.parent;let s=t.getRelatedEdges(i,"out").find(l=>l.target===a),o=!1;!s&&t.hasNode(a)&&(s=t.getRelatedEdges(a,"out").find(l=>l.target===i),o=!0),t.getNode(i).data.rank=(t.hasNode(a)&&t.getNode(a).data.rank||0)+(o?s==null?void 0:s.data.minlen:-(s==null?void 0:s.data.minlen))})},Itt=(r,t,e)=>r.getRelatedEdges(t,"both").find(n=>n.source===e||n.target===e),_k=(r,t)=>t.data.low<=r.data.lim&&r.data.lim<=t.data.lim,Dtt=(r,t)=>{switch(t){case"network-simplex":Btt(r);break;case"tight-tree":Sk(r);break;case"longest-path":Ftt(r);break;default:Sk(r)}},Ftt=pD,Sk=r=>{_tt(r),ktt(r)},Btt=r=>{Ott(r)},ztt=(r,t)=>{const{edgeLabelSpace:e,keepNodeOrder:n,prevGraph:i,rankdir:a,ranksep:s}=t;!n&&i&&jtt(r,i);const o=Utt(r);e&&(t.ranksep=Ytt(o,{rankdir:a,ranksep:s}));let l;try{l=$tt(o,t)}catch(u){if(u.message==="Not possible to find intersection inside of the rectangle"){console.error(`The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:
- `,u);return}throw u}return qtt(r,o),l},$tt=(r,t)=>{const{ranker:e,rankdir:n="tb",nodeOrder:i,keepNodeOrder:a,align:s,nodesep:o=50,edgesep:l=20,ranksep:u=50}=t;ret(r),SQ(r);const{nestingRoot:c,nodeRankFactor:h}=FQ(r);Dtt(sD(r),e),Xtt(r),AQ(r,h),$Q(r,c),CQ(r),Ktt(r),Ztt(r);const d=[];qQ(r,d),ott(r,d),NQ(r),a&&itt(r,i),rtt(r,a),iet(r),RQ(r,n),Ett(r,{align:s,nodesep:o,edgesep:l,ranksep:u}),aet(r),net(r),GQ(r,d),tet(r),LQ(r,n);const{width:g,height:p}=Jtt(r);return Qtt(r),eet(r),MQ(r),{width:g,height:p}},jtt=(r,t)=>{r.getAllNodes().forEach(e=>{const n=r.getNode(e.id);if(t.hasNode(e.id)){const i=t.getNode(e.id);n.data.fixorder=i.data._order,delete i.data._order}else delete n.data.fixorder})},qtt=(r,t)=>{r.getAllNodes().forEach(e=>{var n;const i=r.getNode(e.id);if(i){const a=t.getNode(e.id);i.data.x=a.data.x,i.data.y=a.data.y,i.data._order=a.data.order,i.data._rank=a.data.rank,!((n=t.getChildren(e.id))===null||n===void 0)&&n.length&&(i.data.width=a.data.width,i.data.height=a.data.height)}}),r.getAllEdges().forEach(e=>{const n=r.getEdge(e.id),i=t.getEdge(e.id);n.data.points=i?i.data.points:[],i&&i.data.hasOwnProperty("x")&&(n.data.x=i.data.x,n.data.y=i.data.y)})},Wtt=["width","height","layer","fixorder"],Gtt={width:0,height:0},Vtt=["minlen","weight","width","height","labeloffset"],Htt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Vv=["labelpos"],Utt=r=>{const t=new Mn({tree:[]});return r.getAllNodes().forEach(e=>{const n=kk(r.getNode(e.id).data),i=Object.assign(Object.assign({},Gtt),n),a=Mk(i,Wtt);t.hasNode(e.id)||t.addNode({id:e.id,data:Object.assign({},a)});const s=r.hasTreeStructure("combo")?r.getParent(e.id,"combo"):r.getParent(e.id);kt(s)||(t.hasNode(s.id)||t.addNode(Object.assign({},s)),t.setParent(e.id,s.id))}),r.getAllEdges().forEach(e=>{const n=kk(r.getEdge(e.id).data),i={};Vv==null||Vv.forEach(a=>{n[a]!==void 0&&(i[a]=n[a])}),t.addEdge({id:e.id,source:e.source,target:e.target,data:Object.assign({},Htt,Mk(n,Vtt),i)})}),t},Ytt=(r,t)=>{const{ranksep:e=0,rankdir:n}=t;return r.getAllNodes().forEach(i=>{isNaN(i.data.layer)||i.data.layer||(i.data.layer=0)}),r.getAllEdges().forEach(i=>{var a;i.data.minlen*=2,((a=i.data.labelpos)===null||a===void 0?void 0:a.toLowerCase())!=="c"&&(n==="TB"||n==="BT"?i.data.width+=i.data.labeloffset:i.data.height+=i.data.labeloffset)}),e/2},Xtt=r=>{r.getAllEdges().forEach(t=>{if(t.data.width&&t.data.height){const e=r.getNode(t.source),n=r.getNode(t.target),i={e:t,rank:(n.data.rank-e.data.rank)/2+e.data.rank};Zl(r,"edge-proxy",i,"_ep")}})},Ktt=r=>{let t=0;return r.getAllNodes().forEach(e=>{var n,i;e.data.borderTop&&(e.data.minRank=(n=r.getNode(e.data.borderTop))===null||n===void 0?void 0:n.data.rank,e.data.maxRank=(i=r.getNode(e.data.borderBottom))===null||i===void 0?void 0:i.data.rank,t=Math.max(t,e.data.maxRank||-1/0))}),t},Ztt=r=>{r.getAllNodes().forEach(t=>{t.data.dummy==="edge-proxy"&&(r.getEdge(t.data.e.id).data.labelRank=t.data.rank,r.removeNode(t.id))})},Jtt=(r,t)=>{let e,n=0,i,a=0;const{marginx:s=0,marginy:o=0}={},l=u=>{if(!u.data)return;const c=u.data.x,h=u.data.y,d=u.data.width,g=u.data.height;!isNaN(c)&&!isNaN(d)&&(e===void 0&&(e=c-d/2),e=Math.min(e,c-d/2),n=Math.max(n,c+d/2)),!isNaN(h)&&!isNaN(g)&&(i===void 0&&(i=h-g/2),i=Math.min(i,h-g/2),a=Math.max(a,h+g/2))};return r.getAllNodes().forEach(u=>{l(u)}),r.getAllEdges().forEach(u=>{u!=null&&u.data.hasOwnProperty("x")&&l(u)}),e-=s,i-=o,r.getAllNodes().forEach(u=>{u.data.x-=e,u.data.y-=i}),r.getAllEdges().forEach(u=>{var c;(c=u.data.points)===null||c===void 0||c.forEach(h=>{h.x-=e,h.y-=i}),u.data.hasOwnProperty("x")&&(u.data.x-=e),u.data.hasOwnProperty("y")&&(u.data.y-=i)}),{width:n-e+s,height:a-i+o}},Qtt=r=>{r.getAllEdges().forEach(t=>{const e=r.getNode(t.source),n=r.getNode(t.target);let i,a;t.data.points?(i=t.data.points[0],a=t.data.points[t.data.points.length-1]):(t.data.points=[],i={x:n.data.x,y:n.data.y},a={x:e.data.x,y:e.data.y}),t.data.points.unshift(gk(e.data,i)),t.data.points.push(gk(n.data,a))})},tet=r=>{r.getAllEdges().forEach(t=>{if(t.data.hasOwnProperty("x"))switch((t.data.labelpos==="l"||t.data.labelpos==="r")&&(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset;break}})},eet=r=>{r.getAllEdges().forEach(t=>{var e;t.data.reversed&&((e=t.data.points)===null||e===void 0||e.reverse())})},net=r=>{r.getAllNodes().forEach(t=>{var e,n,i;if(!((e=r.getChildren(t.id))===null||e===void 0)&&e.length){const a=r.getNode(t.id),s=r.getNode(a.data.borderTop),o=r.getNode(a.data.borderBottom),l=r.getNode(a.data.borderLeft[((n=a.data.borderLeft)===null||n===void 0?void 0:n.length)-1]),u=r.getNode(a.data.borderRight[((i=a.data.borderRight)===null||i===void 0?void 0:i.length)-1]);a.data.width=Math.abs((u==null?void 0:u.data.x)-(l==null?void 0:l.data.x))||10,a.data.height=Math.abs((o==null?void 0:o.data.y)-(s==null?void 0:s.data.y))||10,a.data.x=((l==null?void 0:l.data.x)||0)+a.data.width/2,a.data.y=((s==null?void 0:s.data.y)||0)+a.data.height/2}}),r.getAllNodes().forEach(t=>{t.data.dummy==="border"&&r.removeNode(t.id)})},ret=r=>{r.getAllEdges().forEach(t=>{if(t.source===t.target){const e=r.getNode(t.source);e.data.selfEdges||(e.data.selfEdges=[]),e.data.selfEdges.push(t),r.removeEdge(t.id)}})},iet=r=>{const t=yc(r);t==null||t.forEach(e=>{let n=0;e==null||e.forEach((i,a)=>{var s;const o=r.getNode(i);o.data.order=a+n,(s=o.data.selfEdges)===null||s===void 0||s.forEach(l=>{Zl(r,"selfedge",{width:l.data.width,height:l.data.height,rank:o.data.rank,order:a+ ++n,e:l},"_se")}),delete o.data.selfEdges})})},aet=r=>{r.getAllNodes().forEach(t=>{const e=r.getNode(t.id);if(e.data.dummy==="selfedge"){const n=r.getNode(e.data.e.source),i=n.data.x+n.data.width/2,a=n.data.y,s=e.data.x-i,o=n.data.height/2;r.hasEdge(e.data.e.id)?r.updateEdgeData(e.data.e.id,e.data.e.data):r.addEdge({id:e.data.e.id,source:e.data.e.source,target:e.data.e.target,data:e.data.e.data}),r.removeNode(t.id),e.data.e.data.points=[{x:i+2*s/3,y:a-o},{x:i+5*s/6,y:a-o},{y:a,x:i+s},{x:i+5*s/6,y:a+o},{x:i+2*s/3,y:a+o}],e.data.e.data.x=e.data.x,e.data.e.data.y=e.data.y}})},Mk=(r,t)=>{const e={};return t==null||t.forEach(n=>{r[n]!==void 0&&(e[n]=+r[n])}),e},kk=(r={})=>{const t={};return Object.keys(r).forEach(e=>{t[e.toLowerCase()]=r[e]}),t},Ca=Array.isArray,xD=r=>{const t=[],e=r.length;for(let n=0;n<e;n+=1){t[n]=[];for(let i=0;i<e;i+=1)n===i?t[n][i]=0:r[n][i]===0||!r[n][i]?t[n][i]=1/0:t[n][i]=r[n][i]}for(let n=0;n<e;n+=1)for(let i=0;i<e;i+=1)for(let a=0;a<e;a+=1)t[i][a]>t[i][n]+t[n][a]&&(t[i][a]=t[i][n]+t[n][a]);return t},ED=(r,t)=>{const{nodes:e,edges:n}=r,i=[],a={};if(!e)throw new Error("invalid nodes data!");return e&&e.forEach((s,o)=>{a[s.id]=o;const l=[];i.push(l)}),n==null||n.forEach(s=>{const{source:o,target:l}=s,u=a[o],c=a[l];u===void 0||c===void 0||(i[u][c]=1,i[c][u]=1)}),i},set=(r,t)=>{const e=[];return r.forEach(n=>{const i=[];n.forEach(a=>{i.push(a*t)}),e.push(i)}),e},oet=r=>{let t=1/0,e=1/0,n=-1/0,i=-1/0;return r.forEach(a=>{let s=a.data.size;Ca(s)?s.length===1&&(s=[s[0],s[0]]):yt(s)?s=[s,s]:(s===void 0||isNaN(s))&&(s=[30,30]);const o=[s[0]/2,s[1]/2],l=a.data.x-o[0],u=a.data.x+o[0],c=a.data.y-o[1],h=a.data.y+o[1];t>l&&(t=l),e>c&&(e=c),n<u&&(n=u),i<h&&(i=h)}),{minX:t,minY:e,maxX:n,maxY:i}},Tk=(r,t)=>Math.sqrt((r.x-t.x)*(r.x-t.x)+(r.y-t.y)*(r.y-t.y)),Yw=(r,t,e,n="TB",i,a={})=>{if(!(t!=null&&t.length))return;const{stopBranchFn:s,stopAllFn:o}=a;for(let l=0;l<t.length;l++){const u=t[l];if(r.hasNode(u.id)&&!(s!=null&&s(u))){if(o!=null&&o(u))return;n==="TB"&&e(u),Yw(r,r.getChildren(u.id,i),e,n,i,a),n!=="TB"&&e(u)}}},Xw=r=>{if(r===null)return r;if(r instanceof Date)return new Date(r.getTime());if(r instanceof Array){const t=[];return r.forEach(e=>{t.push(e)}),t.map(e=>Xw(e))}if(typeof r=="object"){const t={};return Object.keys(r).forEach(e=>{t[e]=Xw(r[e])}),t}return r},Wr=(r,t)=>{const e=Xw(r);return e.data=e.data||{},t&&(yt(e.data.x)||(e.data.x=Math.random()*t[0]),yt(e.data.y)||(e.data.y=Math.random()*t[1])),e};function Wc(r){if(!r)return[0,0,0];if(yt(r))return[r,r,r];if(r.length===0)return[0,0,0];const[t,e=t,n=t]=r;return[t,e,n]}function Oo(r,t){let e;return Et(t)?e=t:yt(t)?e=()=>t:e=()=>r,e}function lE(r,t,e=!0){return!t&&t!==0?n=>{const{size:i}=n.data||{};return i?Array.isArray(i)?e?Math.max(...i)||r:i:an(i)&&i.width&&i.height?e?Math.max(i.width,i.height)||r:[i.width,i.height]:i:r}:Et(t)?t:yt(t)?()=>t:Array.isArray(t)?()=>e?Math.max(...t)||r:t:an(t)&&t.width&&t.height?()=>e?Math.max(t.width,t.height)||r:[t.width,t.height]:()=>r}const uE=(r,t,e=10)=>{let n;const i=typeof t=="function"?t:()=>t||0;return r?Array.isArray(r)?n=s=>r:Et(r)?n=r:n=s=>r:n=s=>{var o,l,u;if(!((o=s.data)===null||o===void 0)&&o.bboxSize)return(l=s.data)===null||l===void 0?void 0:l.bboxSize;if(!((u=s.data)===null||u===void 0)&&u.size){const c=s.data.size;return Array.isArray(c)?c:an(c)?[c.width,c.height]:c}return e},s=>{const o=n(s),l=i(s);return Math.max(...Wc(o))+l}},uet={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};class cet{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},uet),t)}execute(t,e){return Vt(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,e)})}assign(t,e){return Vt(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,e)})}genericDagreLayout(t,e,n){return Vt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{nodeSize:a,align:s,rankdir:o="TB",ranksep:l,nodesep:u,ranksepFunc:c,nodesepFunc:h,edgeLabelSpace:d,ranker:g,nodeOrder:p,begin:v,controlPoints:m,radial:b,sortByCombo:w,preset:x}=i,_=new Mn({tree:[]}),S=Oo(l||50,c),M=Oo(u||50,h);let k=M,T=S;(o==="LR"||o==="RL")&&(k=S,T=M);const P=lE(10,a,!1),O=e.getAllNodes(),A=e.getAllEdges();O.forEach(F=>{const V=Wc(P(F)),X=T(F),K=k(F),dt=V[0]+2*K,ct=V[1]+2*X,ht=F.data.layer;yt(ht)?_.addNode({id:F.id,data:{width:dt,height:ct,layer:ht}}):_.addNode({id:F.id,data:{width:dt,height:ct}})}),w&&(_.attachTreeStructure("combo"),O.forEach(F=>{const{parentId:V}=F.data;V!==void 0&&_.hasNode(V)&&_.setParent(F.id,V,"combo")})),A.forEach(F=>{_.addEdge({id:F.id,source:F.source,target:F.target,data:{weight:F.data.weight||1}})});let R;x!=null&&x.length&&(R=new Mn({nodes:x})),ztt(_,{prevGraph:R,edgeLabelSpace:d,keepNodeOrder:!!p,nodeOrder:p||[],acyclicer:"greedy",ranker:g,rankdir:o,nodesep:u,align:s});const L=[0,0];if(v){let F=1/0,V=1/0;_.getAllNodes().forEach(X=>{F>X.data.x&&(F=X.data.x),V>X.data.y&&(V=X.data.y)}),_.getAllEdges().forEach(X=>{var K;(K=X.data.points)===null||K===void 0||K.forEach(dt=>{F>dt.x&&(F=dt.x),V>dt.y&&(V=dt.y)})}),L[0]=v[0]-F,L[1]=v[1]-V}const q=o==="LR"||o==="RL";if(!b){const F=new Set,X=o==="BT"||o==="RL"?(ht,lt)=>lt-ht:(ht,lt)=>ht-lt;_.getAllNodes().forEach(ht=>{ht.data.x=ht.data.x+L[0],ht.data.y=ht.data.y+L[1],F.add(q?ht.data.x:ht.data.y)});const K=Array.from(F).sort(X),dt=q?(ht,lt)=>ht.x!==lt.x:(ht,lt)=>ht.y!==lt.y,ct=q?(ht,lt,pt)=>{const wt=Math.max(lt.y,pt.y),Bt=Math.min(lt.y,pt.y);return ht.filter(Ut=>Ut.y<=wt&&Ut.y>=Bt)}:(ht,lt,pt)=>{const wt=Math.max(lt.x,pt.x),Bt=Math.min(lt.x,pt.x);return ht.filter(Ut=>Ut.x<=wt&&Ut.x>=Bt)};_.getAllEdges().forEach((ht,lt)=>{var pt;d&&m&&ht.data.type!=="loop"&&(ht.data.controlPoints=het((pt=ht.data.points)===null||pt===void 0?void 0:pt.map(({x:wt,y:Bt})=>({x:wt+L[0],y:Bt+L[1]})),_.getNode(ht.source),_.getNode(ht.target),K,q,dt,ct))})}let j=[];j=_.getAllNodes().map(F=>Wr(F));const $=_.getAllEdges();return t&&(j.forEach(F=>{e.mergeNodeData(F.id,{x:F.data.x,y:F.data.y})}),$.forEach(F=>{e.mergeEdgeData(F.id,{controlPoints:F.data.controlPoints})})),{nodes:j,edges:$}})}}const het=(r,t,e,n,i,a,s)=>{let o=(r==null?void 0:r.slice(1,r.length-1))||[];if(t&&e){let{x:l,y:u}=t.data,{x:c,y:h}=e.data;if(i&&(l=t.data.y,u=t.data.x,c=e.data.y,h=e.data.x),h!==u&&l!==c){const d=n.indexOf(u),g=n[d+1];if(g){const m=o[0],b=i?{x:(u+g)/2,y:(m==null?void 0:m.y)||c}:{x:(m==null?void 0:m.x)||c,y:(u+g)/2};(!m||a(m,b))&&o.unshift(b)}const p=n.indexOf(h),v=Math.abs(p-d);if(v===1)o=s(o,t.data,e.data),o.length||o.push(i?{x:(u+h)/2,y:l}:{x:l,y:(u+h)/2});else if(v>1){const m=n[p-1];if(m){const b=o[o.length-1],w=i?{x:(h+m)/2,y:(b==null?void 0:b.y)||c}:{x:(b==null?void 0:b.x)||l,y:(h+m)/2};(!b||a(b,w))&&o.push(w)}}}}return o},Ho=(r,t,e)=>{const n=r.getAllNodes(),i=r.getAllEdges();if(!(n!=null&&n.length))return{nodes:[],edges:i};if(n.length===1)return t&&r.mergeNodeData(n[0].id,{x:e[0],y:e[1]}),{nodes:[Object.assign(Object.assign({},n[0]),{data:Object.assign(Object.assign({},n[0].data),{x:e[0],y:e[1]})})],edges:i}},det={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};class fet{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},det),t)}execute(t,e){return Vt(this,void 0,void 0,function*(){return this.genericCircularLayout(!1,t,e)})}assign(t,e){return Vt(this,void 0,void 0,function*(){yield this.genericCircularLayout(!0,t,e)})}genericCircularLayout(t,e,n){return Vt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,divisions:l,startAngle:u=0,endAngle:c=2*Math.PI,angleRatio:h,ordering:d,clockwise:g,nodeSpacing:p,nodeSize:v}=i,m=e.getAllNodes(),b=e.getAllEdges(),[w,x,_]=pet(a,s,o),S=m==null?void 0:m.length;if(!S||S===1)return Ho(e,t,_);const M=(c-u)/S;let{radius:k,startRadius:T,endRadius:P}=i;if(p){const q=Oo(10,p),j=lE(10,v);let $=-1/0;m.forEach(F=>{const V=j(F);$<V&&($=V)});let B=0;m.forEach((F,V)=>{V===0?B+=$||10:B+=(q(F)||0)+($||10)}),k=B/(2*Math.PI)}else!k&&!T&&!P?k=Math.min(x,w)/2:!T&&P?T=P:T&&!P&&(P=T);const O=M*h;let A=[];d==="topology"?A=Ok(e,m):d==="topology-directed"?A=Ok(e,m,!0):d==="degree"?A=get(e,m):A=m.map(q=>Wr(q));const R=Math.ceil(S/l);for(let q=0;q<S;++q){let j=k;!j&&T!==null&&P!==null&&(j=T+q*(P-T)/(S-1)),j||(j=10+q*100/(S-1));let $=u+q%R*O+2*Math.PI/l*Math.floor(q/R);g||($=c-q%R*O-2*Math.PI/l*Math.floor(q/R)),A[q].data.x=_[0]+Math.cos($)*j,A[q].data.y=_[1]+Math.sin($)*j}return t&&A.forEach(q=>{e.mergeNodeData(q.id,{x:q.data.x,y:q.data.y})}),{nodes:A,edges:b}})}}const Ok=(r,t,e=!1)=>{const n=[Wr(t[0])],i={},a=t.length;i[t[0].id]=!0;let s=0;return t.forEach((o,l)=>{if(l!==0)if((l===a-1||r.getDegree(o.id,"both")!==r.getDegree(t[l+1].id,"both")||r.areNeighbors(n[s].id,o.id))&&!i[o.id])n.push(Wr(o)),i[o.id]=!0,s++;else{const u=e?r.getSuccessors(n[s].id):r.getNeighbors(n[s].id);let c=!1;for(let d=0;d<u.length;d++){const g=u[d];if(r.getDegree(g.id)===r.getDegree(o.id)&&!i[g.id]){n.push(Wr(g)),i[g.id]=!0,c=!0;break}}let h=0;for(;!c&&(i[t[h].id]||(n.push(Wr(t[h])),i[t[h].id]=!0,c=!0),h++,h!==a););}}),n};function get(r,t){const e=[];return t.forEach((n,i)=>{e.push(Wr(n))}),e.sort((n,i)=>r.getDegree(n.id,"both")-r.getDegree(i.id,"both")),e}const pet=(r,t,e)=>{let n=r,i=t,a=e;return!n&&typeof window<"u"&&(n=window.innerWidth),!i&&typeof window<"u"&&(i=window.innerHeight),a||(a=[n/2,i/2]),[n,i,a]},vet={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:3/2*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class Kw{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},vet),t)}execute(t,e){return Vt(this,void 0,void 0,function*(){return this.genericConcentricLayout(!1,t,e)})}assign(t,e){return Vt(this,void 0,void 0,function*(){yield this.genericConcentricLayout(!0,t,e)})}genericConcentricLayout(t,e,n){return Vt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o,sortBy:l,maxLevelDiff:u,sweep:c,clockwise:h,equidistant:d,preventOverlap:g,startAngle:p=3/2*Math.PI,nodeSize:v,nodeSpacing:m}=i,b=e.getAllNodes(),w=e.getAllEdges(),x=!s&&typeof window<"u"?window.innerWidth:s,_=!o&&typeof window<"u"?window.innerHeight:o,S=a||[x/2,_/2];if(!(b!=null&&b.length)||b.length===1)return Ho(e,t,S);const M=[];let k,T=0;Ca(v)?k=Math.max(v[0],v[1]):Et(v)?(k=-1/0,b.forEach(F=>{const V=Math.max(...Wc(v(F)));V>k&&(k=V)})):k=v,Ca(m)?T=Math.max(m[0],m[1]):yt(m)&&(T=m),b.forEach(F=>{const V=Wr(F);M.push(V);let X=k;const{data:K}=V;Ca(K.size)?X=Math.max(K.size[0],K.size[1]):yt(K.size)?X=K.size:an(K.size)&&(X=Math.max(K.size.width,K.size.height)),k=Math.max(k,X),Et(m)&&(T=Math.max(m(F),T))});const P={};M.forEach((F,V)=>{P[F.id]=V});let O=l;(!oe(O)||M[0].data[O]===void 0)&&(O="degree"),O==="degree"?M.sort((F,V)=>e.getDegree(V.id,"both")-e.getDegree(F.id,"both")):M.sort((F,V)=>V.data[O]-F.data[O]);const A=M[0],R=(u||(O==="degree"?e.getDegree(A.id,"both"):A.data[O]))/4,L=[{nodes:[]}];let q=L[0];M.forEach(F=>{if(q.nodes.length>0){const V=Math.abs(O==="degree"?e.getDegree(q.nodes[0].id,"both")-e.getDegree(F.id,"both"):q.nodes[0].data[O]-F.data[O]);R&&V>=R&&(q={nodes:[]},L.push(q))}q.nodes.push(F)});let j=k+T;if(!g){const F=L.length>0&&L[0].nodes.length>1,X=(Math.min(x,_)/2-j)/(L.length+(F?1:0));j=Math.min(j,X)}let $=0;if(L.forEach(F=>{const V=c===void 0?2*Math.PI-2*Math.PI/F.nodes.length:c;if(F.dTheta=V/Math.max(1,F.nodes.length-1),F.nodes.length>1&&g){const X=Math.cos(F.dTheta)-Math.cos(0),K=Math.sin(F.dTheta)-Math.sin(0),dt=Math.sqrt(j*j/(X*X+K*K));$=Math.max(dt,$)}F.r=$,$+=j}),d){let F=0,V=0;for(let X=0;X<L.length;X++){const dt=(L[X].r||0)-V;F=Math.max(F,dt)}V=0,L.forEach((X,K)=>{K===0&&(V=X.r||0),X.r=V,V+=F})}return L.forEach(F=>{const V=F.dTheta||0,X=F.r||0;F.nodes.forEach((K,dt)=>{const ct=p+(h?1:-1)*V*dt;K.data.x=S[0]+X*Math.cos(ct),K.data.y=S[1]+X*Math.sin(ct)})}),t&&M.forEach(F=>e.mergeNodeData(F.id,{x:F.data.x,y:F.data.y})),{nodes:M,edges:w}})}}function met(r){const t=+this._x.call(null,r),e=+this._y.call(null,r);return _D(this.cover(t,e),t,e,r)}function _D(r,t,e,n){if(isNaN(t)||isNaN(e))return r;var i,a=r._root,s={data:n},o=r._x0,l=r._y0,u=r._x1,c=r._y1,h,d,g,p,v,m,b,w;if(!a)return r._root=s,r;for(;a.length;)if((v=t>=(h=(o+u)/2))?o=h:u=h,(m=e>=(d=(l+c)/2))?l=d:c=d,i=a,!(a=a[b=m<<1|v]))return i[b]=s,r;if(g=+r._x.call(null,a.data),p=+r._y.call(null,a.data),t===g&&e===p)return s.next=a,i?i[b]=s:r._root=s,r;do i=i?i[b]=new Array(4):r._root=new Array(4),(v=t>=(h=(o+u)/2))?o=h:u=h,(m=e>=(d=(l+c)/2))?l=d:c=d;while((b=m<<1|v)===(w=(p>=d)<<1|g>=h));return i[w]=a,i[b]=s,r}function yet(r){var t,e,n=r.length,i,a,s=new Array(n),o=new Array(n),l=1/0,u=1/0,c=-1/0,h=-1/0;for(e=0;e<n;++e)isNaN(i=+this._x.call(null,t=r[e]))||isNaN(a=+this._y.call(null,t))||(s[e]=i,o[e]=a,i<l&&(l=i),i>c&&(c=i),a<u&&(u=a),a>h&&(h=a));if(l>c||u>h)return this;for(this.cover(l,u).cover(c,h),e=0;e<n;++e)_D(this,s[e],o[e],r[e]);return this}function bet(r,t){if(isNaN(r=+r)||isNaN(t=+t))return this;var e=this._x0,n=this._y0,i=this._x1,a=this._y1;if(isNaN(e))i=(e=Math.floor(r))+1,a=(n=Math.floor(t))+1;else{for(var s=i-e||1,o=this._root,l,u;e>r||r>=i||n>t||t>=a;)switch(u=(t<n)<<1|r<e,l=new Array(4),l[u]=o,o=l,s*=2,u){case 0:i=e+s,a=n+s;break;case 1:e=i-s,a=n+s;break;case 2:i=e+s,n=a-s;break;case 3:e=i-s,n=a-s;break}this._root&&this._root.length&&(this._root=o)}return this._x0=e,this._y0=n,this._x1=i,this._y1=a,this}function wet(){var r=[];return this.visit(function(t){if(!t.length)do r.push(t.data);while(t=t.next)}),r}function xet(r){return arguments.length?this.cover(+r[0][0],+r[0][1]).cover(+r[1][0],+r[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function or(r,t,e,n,i){this.node=r,this.x0=t,this.y0=e,this.x1=n,this.y1=i}function Eet(r,t,e){var n,i=this._x0,a=this._y0,s,o,l,u,c=this._x1,h=this._y1,d=[],g=this._root,p,v;for(g&&d.push(new or(g,i,a,c,h)),e==null?e=1/0:(i=r-e,a=t-e,c=r+e,h=t+e,e*=e);p=d.pop();)if(!(!(g=p.node)||(s=p.x0)>c||(o=p.y0)>h||(l=p.x1)<i||(u=p.y1)<a))if(g.length){var m=(s+l)/2,b=(o+u)/2;d.push(new or(g[3],m,b,l,u),new or(g[2],s,b,m,u),new or(g[1],m,o,l,b),new or(g[0],s,o,m,b)),(v=(t>=b)<<1|r>=m)&&(p=d[d.length-1],d[d.length-1]=d[d.length-1-v],d[d.length-1-v]=p)}else{var w=r-+this._x.call(null,g.data),x=t-+this._y.call(null,g.data),_=w*w+x*x;if(_<e){var S=Math.sqrt(e=_);i=r-S,a=t-S,c=r+S,h=t+S,n=g.data}}return n}function _et(r){if(isNaN(c=+this._x.call(null,r))||isNaN(h=+this._y.call(null,r)))return this;var t,e=this._root,n,i,a,s=this._x0,o=this._y0,l=this._x1,u=this._y1,c,h,d,g,p,v,m,b;if(!e)return this;if(e.length)for(;;){if((p=c>=(d=(s+l)/2))?s=d:l=d,(v=h>=(g=(o+u)/2))?o=g:u=g,t=e,!(e=e[m=v<<1|p]))return this;if(!e.length)break;(t[m+1&3]||t[m+2&3]||t[m+3&3])&&(n=t,b=m)}for(;e.data!==r;)if(i=e,!(e=e.next))return this;return(a=e.next)&&delete e.next,i?(a?i.next=a:delete i.next,this):t?(a?t[m]=a:delete t[m],(e=t[0]||t[1]||t[2]||t[3])&&e===(t[3]||t[2]||t[1]||t[0])&&!e.length&&(n?n[b]=e:this._root=e),this):(this._root=a,this)}function Met(r){for(var t=0,e=r.length;t<e;++t)this.remove(r[t]);return this}function ket(){return this._root}function Tet(){var r=0;return this.visit(function(t){if(!t.length)do++r;while(t=t.next)}),r}function Oet(r){var t=[],e,n=this._root,i,a,s,o,l;for(n&&t.push(new or(n,this._x0,this._y0,this._x1,this._y1));e=t.pop();)if(!r(n=e.node,a=e.x0,s=e.y0,o=e.x1,l=e.y1)&&n.length){var u=(a+o)/2,c=(s+l)/2;(i=n[3])&&t.push(new or(i,u,c,o,l)),(i=n[2])&&t.push(new or(i,a,c,u,l)),(i=n[1])&&t.push(new or(i,u,s,o,c)),(i=n[0])&&t.push(new or(i,a,s,u,c))}return this}function Cet(r){var t=[],e=[],n;for(this._root&&t.push(new or(this._root,this._x0,this._y0,this._x1,this._y1));n=t.pop();){var i=n.node;if(i.length){var a,s=n.x0,o=n.y0,l=n.x1,u=n.y1,c=(s+l)/2,h=(o+u)/2;(a=i[0])&&t.push(new or(a,s,o,c,h)),(a=i[1])&&t.push(new or(a,c,o,l,h)),(a=i[2])&&t.push(new or(a,s,h,c,u)),(a=i[3])&&t.push(new or(a,c,h,l,u))}e.push(n)}for(;n=e.pop();)r(n.node,n.x0,n.y0,n.x1,n.y1);return this}function Aet(r){return r[0]}function Pet(r){return arguments.length?(this._x=r,this):this._x}function Net(r){return r[1]}function Ret(r){return arguments.length?(this._y=r,this):this._y}function Ig(r,t,e){var n=new cE(t??Aet,e??Net,NaN,NaN,NaN,NaN);return r==null?n:n.addAll(r)}function cE(r,t,e,n,i,a){this._x=r,this._y=t,this._x0=e,this._y0=n,this._x1=i,this._y1=a,this._root=void 0}function Ck(r){for(var t={data:r.data},e=t;r=r.next;)e=e.next={data:r.data};return t}var hr=Ig.prototype=cE.prototype;hr.copy=function(){var r=new cE(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,e,n;if(!t)return r;if(!t.length)return r._root=Ck(t),r;for(e=[{source:t,target:r._root=new Array(4)}];t=e.pop();)for(var i=0;i<4;++i)(n=t.source[i])&&(n.length?e.push({source:n,target:t.target[i]=new Array(4)}):t.target[i]=Ck(n));return r};hr.add=met;hr.addAll=yet;hr.cover=bet;hr.data=wet;hr.extent=xet;hr.find=Eet;hr.remove=_et;hr.removeAll=Met;hr.root=ket;hr.size=Tet;hr.visit=Oet;hr.visitAfter=Cet;hr.x=Pet;hr.y=Ret;function Let(r){const t=+this._x.call(null,r),e=+this._y.call(null,r),n=+this._z.call(null,r);return SD(this.cover(t,e,n),t,e,n,r)}function SD(r,t,e,n,i){if(isNaN(t)||isNaN(e)||isNaN(n))return r;var a,s=r._root,o={data:i},l=r._x0,u=r._y0,c=r._z0,h=r._x1,d=r._y1,g=r._z1,p,v,m,b,w,x,_,S,M,k,T;if(!s)return r._root=o,r;for(;s.length;)if((_=t>=(p=(l+h)/2))?l=p:h=p,(S=e>=(v=(u+d)/2))?u=v:d=v,(M=n>=(m=(c+g)/2))?c=m:g=m,a=s,!(s=s[k=M<<2|S<<1|_]))return a[k]=o,r;if(b=+r._x.call(null,s.data),w=+r._y.call(null,s.data),x=+r._z.call(null,s.data),t===b&&e===w&&n===x)return o.next=s,a?a[k]=o:r._root=o,r;do a=a?a[k]=new Array(8):r._root=new Array(8),(_=t>=(p=(l+h)/2))?l=p:h=p,(S=e>=(v=(u+d)/2))?u=v:d=v,(M=n>=(m=(c+g)/2))?c=m:g=m;while((k=M<<2|S<<1|_)===(T=(x>=m)<<2|(w>=v)<<1|b>=p));return a[T]=s,a[k]=o,r}function Iet(r){Array.isArray(r)||(r=Array.from(r));const t=r.length,e=new Float64Array(t),n=new Float64Array(t),i=new Float64Array(t);let a=1/0,s=1/0,o=1/0,l=-1/0,u=-1/0,c=-1/0;for(let h=0,d,g,p,v;h<t;++h)isNaN(g=+this._x.call(null,d=r[h]))||isNaN(p=+this._y.call(null,d))||isNaN(v=+this._z.call(null,d))||(e[h]=g,n[h]=p,i[h]=v,g<a&&(a=g),g>l&&(l=g),p<s&&(s=p),p>u&&(u=p),v<o&&(o=v),v>c&&(c=v));if(a>l||s>u||o>c)return this;this.cover(a,s,o).cover(l,u,c);for(let h=0;h<t;++h)SD(this,e[h],n[h],i[h],r[h]);return this}function Det(r,t,e){if(isNaN(r=+r)||isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,i=this._y0,a=this._z0,s=this._x1,o=this._y1,l=this._z1;if(isNaN(n))s=(n=Math.floor(r))+1,o=(i=Math.floor(t))+1,l=(a=Math.floor(e))+1;else{for(var u=s-n||1,c=this._root,h,d;n>r||r>=s||i>t||t>=o||a>e||e>=l;)switch(d=(e<a)<<2|(t<i)<<1|r<n,h=new Array(8),h[d]=c,c=h,u*=2,d){case 0:s=n+u,o=i+u,l=a+u;break;case 1:n=s-u,o=i+u,l=a+u;break;case 2:s=n+u,i=o-u,l=a+u;break;case 3:n=s-u,i=o-u,l=a+u;break;case 4:s=n+u,o=i+u,a=l-u;break;case 5:n=s-u,o=i+u,a=l-u;break;case 6:s=n+u,i=o-u,a=l-u;break;case 7:n=s-u,i=o-u,a=l-u;break}this._root&&this._root.length&&(this._root=c)}return this._x0=n,this._y0=i,this._z0=a,this._x1=s,this._y1=o,this._z1=l,this}function Fet(){var r=[];return this.visit(function(t){if(!t.length)do r.push(t.data);while(t=t.next)}),r}function Bet(r){return arguments.length?this.cover(+r[0][0],+r[0][1],+r[0][2]).cover(+r[1][0],+r[1][1],+r[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function ke(r,t,e,n,i,a,s){this.node=r,this.x0=t,this.y0=e,this.z0=n,this.x1=i,this.y1=a,this.z1=s}function zet(r,t,e,n){var i,a=this._x0,s=this._y0,o=this._z0,l,u,c,h,d,g,p=this._x1,v=this._y1,m=this._z1,b=[],w=this._root,x,_;for(w&&b.push(new ke(w,a,s,o,p,v,m)),n==null?n=1/0:(a=r-n,s=t-n,o=e-n,p=r+n,v=t+n,m=e+n,n*=n);x=b.pop();)if(!(!(w=x.node)||(l=x.x0)>p||(u=x.y0)>v||(c=x.z0)>m||(h=x.x1)<a||(d=x.y1)<s||(g=x.z1)<o))if(w.length){var S=(l+h)/2,M=(u+d)/2,k=(c+g)/2;b.push(new ke(w[7],S,M,k,h,d,g),new ke(w[6],l,M,k,S,d,g),new ke(w[5],S,u,k,h,M,g),new ke(w[4],l,u,k,S,M,g),new ke(w[3],S,M,c,h,d,k),new ke(w[2],l,M,c,S,d,k),new ke(w[1],S,u,c,h,M,k),new ke(w[0],l,u,c,S,M,k)),(_=(e>=k)<<2|(t>=M)<<1|r>=S)&&(x=b[b.length-1],b[b.length-1]=b[b.length-1-_],b[b.length-1-_]=x)}else{var T=r-+this._x.call(null,w.data),P=t-+this._y.call(null,w.data),O=e-+this._z.call(null,w.data),A=T*T+P*P+O*O;if(A<n){var R=Math.sqrt(n=A);a=r-R,s=t-R,o=e-R,p=r+R,v=t+R,m=e+R,i=w.data}}return i}const $et=(r,t,e,n,i,a)=>Math.sqrt((r-n)**2+(t-i)**2+(e-a)**2);function jet(r,t,e,n){const i=[],a=r-n,s=t-n,o=e-n,l=r+n,u=t+n,c=e+n;return this.visit((h,d,g,p,v,m,b)=>{if(!h.length)do{const w=h.data;$et(r,t,e,this._x(w),this._y(w),this._z(w))<=n&&i.push(w)}while(h=h.next);return d>l||g>u||p>c||v<a||m<s||b<o}),i}function qet(r){if(isNaN(d=+this._x.call(null,r))||isNaN(g=+this._y.call(null,r))||isNaN(p=+this._z.call(null,r)))return this;var t,e=this._root,n,i,a,s=this._x0,o=this._y0,l=this._z0,u=this._x1,c=this._y1,h=this._z1,d,g,p,v,m,b,w,x,_,S,M;if(!e)return this;if(e.length)for(;;){if((w=d>=(v=(s+u)/2))?s=v:u=v,(x=g>=(m=(o+c)/2))?o=m:c=m,(_=p>=(b=(l+h)/2))?l=b:h=b,t=e,!(e=e[S=_<<2|x<<1|w]))return this;if(!e.length)break;(t[S+1&7]||t[S+2&7]||t[S+3&7]||t[S+4&7]||t[S+5&7]||t[S+6&7]||t[S+7&7])&&(n=t,M=S)}for(;e.data!==r;)if(i=e,!(e=e.next))return this;return(a=e.next)&&delete e.next,i?(a?i.next=a:delete i.next,this):t?(a?t[S]=a:delete t[S],(e=t[0]||t[1]||t[2]||t[3]||t[4]||t[5]||t[6]||t[7])&&e===(t[7]||t[6]||t[5]||t[4]||t[3]||t[2]||t[1]||t[0])&&!e.length&&(n?n[M]=e:this._root=e),this):(this._root=a,this)}function Wet(r){for(var t=0,e=r.length;t<e;++t)this.remove(r[t]);return this}function Get(){return this._root}function Vet(){var r=0;return this.visit(function(t){if(!t.length)do++r;while(t=t.next)}),r}function Het(r){var t=[],e,n=this._root,i,a,s,o,l,u,c;for(n&&t.push(new ke(n,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=t.pop();)if(!r(n=e.node,a=e.x0,s=e.y0,o=e.z0,l=e.x1,u=e.y1,c=e.z1)&&n.length){var h=(a+l)/2,d=(s+u)/2,g=(o+c)/2;(i=n[7])&&t.push(new ke(i,h,d,g,l,u,c)),(i=n[6])&&t.push(new ke(i,a,d,g,h,u,c)),(i=n[5])&&t.push(new ke(i,h,s,g,l,d,c)),(i=n[4])&&t.push(new ke(i,a,s,g,h,d,c)),(i=n[3])&&t.push(new ke(i,h,d,o,l,u,g)),(i=n[2])&&t.push(new ke(i,a,d,o,h,u,g)),(i=n[1])&&t.push(new ke(i,h,s,o,l,d,g)),(i=n[0])&&t.push(new ke(i,a,s,o,h,d,g))}return this}function Uet(r){var t=[],e=[],n;for(this._root&&t.push(new ke(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=t.pop();){var i=n.node;if(i.length){var a,s=n.x0,o=n.y0,l=n.z0,u=n.x1,c=n.y1,h=n.z1,d=(s+u)/2,g=(o+c)/2,p=(l+h)/2;(a=i[0])&&t.push(new ke(a,s,o,l,d,g,p)),(a=i[1])&&t.push(new ke(a,d,o,l,u,g,p)),(a=i[2])&&t.push(new ke(a,s,g,l,d,c,p)),(a=i[3])&&t.push(new ke(a,d,g,l,u,c,p)),(a=i[4])&&t.push(new ke(a,s,o,p,d,g,h)),(a=i[5])&&t.push(new ke(a,d,o,p,u,g,h)),(a=i[6])&&t.push(new ke(a,s,g,p,d,c,h)),(a=i[7])&&t.push(new ke(a,d,g,p,u,c,h))}e.push(n)}for(;n=e.pop();)r(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this}function Yet(r){return r[0]}function Xet(r){return arguments.length?(this._x=r,this):this._x}function Ket(r){return r[1]}function Zet(r){return arguments.length?(this._y=r,this):this._y}function Jet(r){return r[2]}function Qet(r){return arguments.length?(this._z=r,this):this._z}function MD(r,t,e,n){var i=new hE(t??Yet,e??Ket,n??Jet,NaN,NaN,NaN,NaN,NaN,NaN);return r==null?i:i.addAll(r)}function hE(r,t,e,n,i,a,s,o,l){this._x=r,this._y=t,this._z=e,this._x0=n,this._y0=i,this._z0=a,this._x1=s,this._y1=o,this._z1=l,this._root=void 0}function Ak(r){for(var t={data:r.data},e=t;r=r.next;)e=e.next={data:r.data};return t}var qn=MD.prototype=hE.prototype;qn.copy=function(){var r=new hE(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),t=this._root,e,n;if(!t)return r;if(!t.length)return r._root=Ak(t),r;for(e=[{source:t,target:r._root=new Array(8)}];t=e.pop();)for(var i=0;i<8;++i)(n=t.source[i])&&(n.length?e.push({source:n,target:t.target[i]=new Array(8)}):t.target[i]=Ak(n));return r};qn.add=Let;qn.addAll=Iet;qn.cover=Det;qn.data=Fet;qn.extent=Bet;qn.find=zet;qn.findAllWithinRadius=jet;qn.remove=qet;qn.removeAll=Wet;qn.root=Get;qn.size=Vet;qn.visit=Het;qn.visitAfter=Uet;qn.x=Xet;qn.y=Zet;qn.z=Qet;const tnt=.81,Hv=.1;function ent(r,t,e,n,i=2){const a=t/e,s=r.getAllNodes(),o=s.map((c,h)=>{const{nodeStrength:d,x:g,y:p,z:v,size:m}=c.data;return{x:g,y:p,z:v,size:m,index:h,id:c.id,vx:0,vy:0,vz:0,weight:a*d}}),l=(i===2?Ig(o,c=>c.x,c=>c.y):MD(o,c=>c.x,c=>c.y,c=>c.z)).visitAfter(nnt),u=new Map;return o.forEach(c=>{u.set(c.id,c),int(c,l,i)}),o.map((c,h)=>{const{id:d,data:g}=s[h],{mass:p=1}=g;n[d]={x:c.vx/p,y:c.vy/p,z:c.vz/p}}),n}function nnt(r){let t=0,e=0,n=0,i=0,a=0;const s=r.length;if(s){for(let o=0;o<s;o++){const l=r[o];l&&l.weight&&(t+=l.weight,e+=l.x*l.weight,n+=l.y*l.weight,i+=l.z*l.weight,a+=l.size*l.weight)}r.x=e/t,r.y=n/t,r.z=i/t,r.size=a/t,r.weight=t}else{const o=r;r.x=o.data.x,r.y=o.data.y,r.z=o.data.z,r.size=o.data.size,r.weight=o.data.weight}}const rnt=(r,t,e,n,i,a,s)=>{var o;if(((o=r.data)===null||o===void 0?void 0:o.id)===a.id)return;const l=[e,n,i][s-1],u=a.x-r.x||Hv,c=a.y-r.y||Hv,h=a.z-r.z||Hv,d=[u,c,h],g=l-t;let p=0;for(let b=0;b<s;b++)p+=d[b]*d[b];const m=Math.sqrt(p)*p;if(g*g*tnt<p){const b=r.weight/m;return a.vx+=u*b,a.vy+=c*b,a.vz+=h*b,!0}if(r.length)return!1;if(r.data!==a){const b=r.data.weight/m;a.vx+=u*b,a.vy+=c*b,a.vz+=h*b}};function int(r,t,e){t.visit((n,i,a,s,o)=>rnt(n,i,a,s,o,r,e))}const ant={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class kD{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},ant),t)}execute(t,e){return Vt(this,void 0,void 0,function*(){return this.genericForceLayout(!1,t,e)})}assign(t,e){return Vt(this,void 0,void 0,function*(){yield this.genericForceLayout(!0,t,e)})}stop(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let n=0;(this.judgingDistance>this.lastOptions.minMovement||n<1)&&n<t;n++)this.runOneStep(this.lastCalcGraph,this.lastGraph,n,this.lastVelMap,this.lastOptions),this.updatePosition(this.lastGraph,this.lastCalcGraph,this.lastVelMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach(n=>this.lastGraph.mergeNodeData(n.id,{x:n.data.x,y:n.data.y,z:this.options.dimensions===3?n.data.z:void 0})),e}genericForceLayout(t,e,n){return Vt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),a=e.getAllNodes(),s=e.getAllEdges(),o=this.formatOptions(i,e),{dimensions:l,width:u,height:c,nodeSize:h,getMass:d,nodeStrength:g,edgeStrength:p,linkDistance:v}=o,m=a.map((T,P)=>Object.assign(Object.assign({},T),{data:Object.assign(Object.assign({},T.data),{x:yt(T.data.x)?T.data.x:Math.random()*u,y:yt(T.data.y)?T.data.y:Math.random()*c,z:yt(T.data.z)?T.data.z:Math.random()*Math.sqrt(u*c),size:h(T)||30,mass:d(T),nodeStrength:g(T)})})),b=s.map(T=>Object.assign(Object.assign({},T),{data:Object.assign(Object.assign({},T.data),{edgeStrength:p(T),linkDistance:v(T,e.getNode(T.source),e.getNode(T.target))})}));if(!(a!=null&&a.length))return this.lastResult={nodes:[],edges:s},{nodes:[],edges:s};const w={};a.forEach((T,P)=>{w[T.id]={x:0,y:0,z:0}});const x=new Mn({nodes:m,edges:b});this.formatCentripetal(o,x);const{maxIteration:_,minMovement:S,onTick:M}=o;if(this.lastLayoutNodes=m,this.lastLayoutEdges=b,this.lastAssign=t,this.lastGraph=e,this.lastCalcGraph=x,this.lastOptions=o,this.lastVelMap=w,typeof window>"u")return;let k=0;return new Promise(T=>{this.timeInterval=window.setInterval(()=>{(!a||!this.running)&&T({nodes:Uv(e,m),edges:s}),this.runOneStep(x,e,k,w,o),this.updatePosition(e,x,w,o),t&&m.forEach(P=>e.mergeNodeData(P.id,{x:P.data.x,y:P.data.y,z:l===3?P.data.z:void 0})),M==null||M({nodes:Uv(e,m),edges:s}),k++,(k>=_||this.judgingDistance<S)&&(window.clearInterval(this.timeInterval),T({nodes:Uv(e,m),edges:s}))},0),this.running=!0})})}formatOptions(t,e){const n=Object.assign({},t),{width:i,height:a,getMass:s}=t;n.width=!i&&typeof window<"u"?window.innerWidth:i,n.height=!a&&typeof window<"u"?window.innerHeight:a,t.center||(n.center=[n.width/2,n.height/2]),s||(n.getMass=l=>{let u=1;yt(l==null?void 0:l.data.mass)&&(u=l==null?void 0:l.data.mass);const c=e.getDegree(l.id,"both");return!c||c<5?u:c*5*u}),n.nodeSize=uE(t.nodeSize,t.nodeSpacing);const o=t.linkDistance?Oo(1,t.linkDistance):l=>1+n.nodeSize(e.getNode(l.source))+n.nodeSize(e.getNode(l.target));return n.linkDistance=o,n.nodeStrength=Oo(1,t.nodeStrength),n.edgeStrength=Oo(1,t.edgeStrength),n}formatCentripetal(t,e){const{dimensions:n,centripetalOptions:i,center:a,clusterNodeStrength:s,leafCluster:o,clustering:l,nodeClusterBy:u}=t,c=e.getAllNodes(),h=i||{leaf:2,single:2,others:1,center:b=>({x:a[0],y:a[1],z:n===3?a[2]:void 0})};typeof s!="function"&&(t.clusterNodeStrength=b=>s);let d,g;if(o&&u&&(d=Pk(e,u),g=Array.from(new Set(c==null?void 0:c.map(b=>b.data[u])))||[],t.centripetalOptions=Object.assign(h,{single:100,leaf:b=>{const{siblingLeaves:w,sameTypeLeaves:x}=d[b.id]||{};return(x==null?void 0:x.length)===(w==null?void 0:w.length)||(g==null?void 0:g.length)===1?1:t.clusterNodeStrength(b)},others:1,center:b=>{const w=e.getDegree(b.id,"both");if(!w)return{x:100,y:100,z:0};let x;if(w===1){const{sameTypeLeaves:_=[]}=d[b.id]||{};_.length===1?x=void 0:_.length>1&&(x=Nk(_))}else x=void 0;return{x:x==null?void 0:x.x,y:x==null?void 0:x.y,z:x==null?void 0:x.z}}})),l&&u){d||(d=Pk(e,u)),g||(g=Array.from(new Set(c.map(w=>w.data[u])))),g=g.filter(w=>w!==void 0);const b={};g.forEach(w=>{const x=c.filter(_=>_.data[u]===w).map(_=>e.getNode(_.id));b[w]=Nk(x)}),t.centripetalOptions=Object.assign(h,{single:w=>t.clusterNodeStrength(w),leaf:w=>t.clusterNodeStrength(w),others:w=>t.clusterNodeStrength(w),center:w=>{const x=b[w.data[u]];return{x:x==null?void 0:x.x,y:x==null?void 0:x.y,z:x==null?void 0:x.z}}})}const{leaf:p,single:v,others:m}=t.centripetalOptions||{};p&&typeof p!="function"&&(t.centripetalOptions.leaf=()=>p),v&&typeof v!="function"&&(t.centripetalOptions.single=()=>v),m&&typeof m!="function"&&(t.centripetalOptions.others=()=>m)}runOneStep(t,e,n,i,a){const s={},o=t.getAllNodes(),l=t.getAllEdges();if(!(o!=null&&o.length))return;const{monitor:u}=a;if(this.calRepulsive(t,s,a),l&&this.calAttractive(t,s,a),this.calGravity(t,e,s,a),this.updateVelocity(t,s,i,a),u){const c=this.calTotalEnergy(s,o);u({energy:c,nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:n})}}calTotalEnergy(t,e){if(!(e!=null&&e.length))return 0;let n=0;return e.forEach((i,a)=>{const s=t[i.id].x,o=t[i.id].y,l=this.options.dimensions===3?t[i.id].z:0,u=s*s+o*o+l*l,{mass:c=1}=i.data;n+=c*u*.5}),n}calRepulsive(t,e,n){const{dimensions:i,factor:a,coulombDisScale:s}=n;ent(t,a,s*s,e,i)}calAttractive(t,e,n){const{dimensions:i,nodeSize:a}=n;t.getAllEdges().forEach((s,o)=>{const{source:l,target:u}=s,c=t.getNode(l),h=t.getNode(u);if(!c||!h)return;let d=h.data.x-c.data.x,g=h.data.y-c.data.y,p=i===3?h.data.z-c.data.z:0;!d&&!g&&(d=Math.random()*.01,g=Math.random()*.01,i===3&&!p&&(p=Math.random()*.01));const v=Math.sqrt(d*d+g*g+p*p);if(v<a(c)+a(h))return;const m=d/v,b=g/v,w=p/v,{linkDistance:x=200,edgeStrength:_=200}=s.data||{},M=(x-v)*_,k=c.data.mass||1,T=h.data.mass||1,P=1/k,O=1/T,A=m*M,R=b*M,L=w*M;e[l].x-=A*P,e[l].y-=R*P,e[l].z-=L*P,e[u].x+=A*O,e[u].y+=R*O,e[u].z+=L*O})}calGravity(t,e,n,i){const{getCenter:a}=i,s=t.getAllNodes(),o=e.getAllNodes(),l=e.getAllEdges(),{width:u,height:c,center:h,gravity:d,centripetalOptions:g}=i;s&&s.forEach(p=>{const{id:v,data:m}=p,{mass:b,x:w,y:x,z:_}=m,S=e.getNode(v);let M=0,k=0,T=0,P=d;const O=t.getDegree(v,"in"),A=t.getDegree(v,"out"),R=t.getDegree(v,"both"),L=a==null?void 0:a(S,R);if(L){const[q,j,$]=L;M=w-q,k=x-j,P=$}else M=w-h[0],k=x-h[1],T=_-h[2];if(P&&(n[v].x-=P*M/b,n[v].y-=P*k/b,n[v].z-=P*T/b),g){const{leaf:q,single:j,others:$,center:B}=g,{x:F,y:V,z:X,centerStrength:K}=(B==null?void 0:B(S,o,l,u,c))||{x:0,y:0,z:0,centerStrength:0};if(!yt(F)||!yt(V))return;const dt=(w-F)/b,ct=(x-V)/b,ht=(_-X)/b;if(K&&(n[v].x-=K*dt,n[v].y-=K*ct,n[v].z-=K*ht),R===0){const pt=j(S);if(!pt)return;n[v].x-=pt*dt,n[v].y-=pt*ct,n[v].z-=pt*ht;return}if(O===0||A===0){const pt=q(S,o,l);if(!pt)return;n[v].x-=pt*dt,n[v].y-=pt*ct,n[v].z-=pt*ht;return}const lt=$(S);if(!lt)return;n[v].x-=lt*dt,n[v].y-=lt*ct,n[v].z-=lt*ht}})}updateVelocity(t,e,n,i){const{damping:a,maxSpeed:s,interval:o,dimensions:l}=i,u=t.getAllNodes();u!=null&&u.length&&u.forEach(c=>{const{id:h}=c;let d=(n[h].x+e[h].x*o)*a||.01,g=(n[h].y+e[h].y*o)*a||.01,p=l===3?(n[h].z+e[h].z*o)*a||.01:0;const v=Math.sqrt(d*d+g*g+p*p);if(v>s){const m=s/v;d=m*d,g=m*g,p=m*p}n[h]={x:d,y:g,z:p}})}updatePosition(t,e,n,i){const{distanceThresholdMode:a,interval:s,dimensions:o}=i,l=e.getAllNodes();if(!(l!=null&&l.length)){this.judgingDistance=0;return}let u=0;a==="max"?this.judgingDistance=-1/0:a==="min"&&(this.judgingDistance=1/0),l.forEach(c=>{const{id:h}=c,d=t.getNode(h);if(yt(d.data.fx)&&yt(d.data.fy)){e.mergeNodeData(h,{x:d.data.fx,y:d.data.fy,z:o===3?d.data.fz:void 0});return}const g=n[h].x*s,p=n[h].y*s,v=o===3?n[h].z*s:0;e.mergeNodeData(h,{x:c.data.x+g,y:c.data.y+p,z:c.data.z+v});const m=Math.sqrt(g*g+p*p+v*v);switch(a){case"max":this.judgingDistance<m&&(this.judgingDistance=m);break;case"min":this.judgingDistance>m&&(this.judgingDistance=m);break;default:u=u+m;break}}),(!a||a==="mean")&&(this.judgingDistance=u/l.length)}}const Pk=(r,t)=>{const e=r.getAllNodes();if(!(e!=null&&e.length))return{};const n={};return e.forEach((i,a)=>{r.getDegree(i.id,"both")===1&&(n[i.id]=snt(r,"leaf",i,t))}),n},snt=(r,t,e,n)=>{const i=r.getDegree(e.id,"in"),a=r.getDegree(e.id,"out");let s=e,o=[];i===0?(s=r.getSuccessors(e.id)[0],o=r.getNeighbors(s.id)):a===0&&(s=r.getPredecessors(e.id)[0],o=r.getNeighbors(s.id)),o=o.filter(u=>r.getDegree(u.id,"in")===0||r.getDegree(u.id,"out")===0);const l=ont(r,t,n,e,o);return{coreNode:s,siblingLeaves:o,sameTypeLeaves:l}},ont=(r,t,e,n,i)=>{const a=n.data[e]||"";let s=(i==null?void 0:i.filter(o=>o.data[e]===a))||[];return s=s.filter(o=>r.getDegree(o.id,"in")===0||r.getDegree(o.id,"out")===0),s},Nk=r=>{const t={x:0,y:0};r.forEach(n=>{const{x:i,y:a}=n.data;t.x+=i||0,t.y+=a||0});const e=r.length||1;return{x:t.x/e,y:t.y/e}},Uv=(r,t)=>t.map(e=>{const{id:n,data:i}=e,a=r.getNode(n);return Object.assign(Object.assign({},a),{data:Object.assign(Object.assign({},a.data),{x:i.x,y:i.y,z:i.z})})});var ne={};const lnt=Object.prototype.toString;function bc(r){const t=lnt.call(r);return t.endsWith("Array]")&&!t.includes("Big")}const unt=Object.freeze(Object.defineProperty({__proto__:null,isAnyArray:bc},Symbol.toStringTag,{value:"Module"})),cnt=bR(unt);function hnt(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!bc(r))throw new TypeError("input must be an array");if(r.length===0)throw new TypeError("input must not be empty");var e=t.fromIndex,n=e===void 0?0:e,i=t.toIndex,a=i===void 0?r.length:i;if(n<0||n>=r.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(a<=n||a>r.length||!Number.isInteger(a))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=r[n],o=n+1;o<a;o++)r[o]>s&&(s=r[o]);return s}function dnt(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!bc(r))throw new TypeError("input must be an array");if(r.length===0)throw new TypeError("input must not be empty");var e=t.fromIndex,n=e===void 0?0:e,i=t.toIndex,a=i===void 0?r.length:i;if(n<0||n>=r.length||!Number.isInteger(n))throw new Error("fromIndex must be a positive integer smaller than length");if(a<=n||a>r.length||!Number.isInteger(a))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var s=r[n],o=n+1;o<a;o++)r[o]<s&&(s=r[o]);return s}function fnt(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(bc(r)){if(r.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var e;if(t.output!==void 0){if(!bc(t.output))throw new TypeError("output option must be an array if specified");e=t.output}else e=new Array(r.length);var n=dnt(r),i=hnt(r);if(n===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var a=t.min,s=a===void 0?t.autoMinMax?n:0:a,o=t.max,l=o===void 0?t.autoMinMax?i:1:o;if(s>=l)throw new RangeError("min option must be smaller than max option");for(var u=(l-s)/(i-n),c=0;c<r.length;c++)e[c]=(r[c]-n)*u+s;return e}const gnt=Object.freeze(Object.defineProperty({__proto__:null,default:fnt},Symbol.toStringTag,{value:"Module"})),pnt=bR(gnt);Object.defineProperty(ne,"__esModule",{value:!0});var _r=cnt,Rk=pnt;const Od=" ".repeat(2),TD=" ".repeat(4);function vnt(){return OD(this)}function OD(r,t={}){const{maxRows:e=15,maxColumns:n=10,maxNumSize:i=8,padMinus:a="auto"}=t;return`${r.constructor.name} {
- ${Od}[
- ${TD}${mnt(r,e,n,i,a)}
- ${Od}]
- ${Od}rows: ${r.rows}
- ${Od}columns: ${r.columns}
- }`}function mnt(r,t,e,n,i){const{rows:a,columns:s}=r,o=Math.min(a,t),l=Math.min(s,e),u=[];if(i==="auto"){i=!1;t:for(let c=0;c<o;c++)for(let h=0;h<l;h++)if(r.get(c,h)<0){i=!0;break t}}for(let c=0;c<o;c++){let h=[];for(let d=0;d<l;d++)h.push(ynt(r.get(c,d),n,i));u.push(`${h.join(" ")}`)}return l!==s&&(u[u.length-1]+=` ... ${s-e} more columns`),o!==a&&u.push(`... ${a-t} more rows`),u.join(`
- ${TD}`)}function ynt(r,t,e){return(r>=0&&e?` ${Lk(r,t-1)}`:Lk(r,t)).padEnd(t)}function Lk(r,t){let e=r.toString();if(e.length<=t)return e;let n=r.toFixed(t);if(n.length>t&&(n=r.toFixed(Math.max(0,t-(n.length-t)))),n.length<=t&&!n.startsWith("0.000")&&!n.startsWith("-0.000"))return n;let i=r.toExponential(t);return i.length>t&&(i=r.toExponential(Math.max(0,t-(i.length-t)))),i.slice(0)}function bnt(r,t){r.prototype.add=function(n){return typeof n=="number"?this.addS(n):this.addM(n)},r.prototype.addS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)+n);return this},r.prototype.addM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)+n.get(i,a));return this},r.add=function(n,i){return new t(n).add(i)},r.prototype.sub=function(n){return typeof n=="number"?this.subS(n):this.subM(n)},r.prototype.subS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)-n);return this},r.prototype.subM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)-n.get(i,a));return this},r.sub=function(n,i){return new t(n).sub(i)},r.prototype.subtract=r.prototype.sub,r.prototype.subtractS=r.prototype.subS,r.prototype.subtractM=r.prototype.subM,r.subtract=r.sub,r.prototype.mul=function(n){return typeof n=="number"?this.mulS(n):this.mulM(n)},r.prototype.mulS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)*n);return this},r.prototype.mulM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)*n.get(i,a));return this},r.mul=function(n,i){return new t(n).mul(i)},r.prototype.multiply=r.prototype.mul,r.prototype.multiplyS=r.prototype.mulS,r.prototype.multiplyM=r.prototype.mulM,r.multiply=r.mul,r.prototype.div=function(n){return typeof n=="number"?this.divS(n):this.divM(n)},r.prototype.divS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)/n);return this},r.prototype.divM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)/n.get(i,a));return this},r.div=function(n,i){return new t(n).div(i)},r.prototype.divide=r.prototype.div,r.prototype.divideS=r.prototype.divS,r.prototype.divideM=r.prototype.divM,r.divide=r.div,r.prototype.mod=function(n){return typeof n=="number"?this.modS(n):this.modM(n)},r.prototype.modS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)%n);return this},r.prototype.modM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)%n.get(i,a));return this},r.mod=function(n,i){return new t(n).mod(i)},r.prototype.modulus=r.prototype.mod,r.prototype.modulusS=r.prototype.modS,r.prototype.modulusM=r.prototype.modM,r.modulus=r.mod,r.prototype.and=function(n){return typeof n=="number"?this.andS(n):this.andM(n)},r.prototype.andS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)&n);return this},r.prototype.andM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)&n.get(i,a));return this},r.and=function(n,i){return new t(n).and(i)},r.prototype.or=function(n){return typeof n=="number"?this.orS(n):this.orM(n)},r.prototype.orS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)|n);return this},r.prototype.orM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)|n.get(i,a));return this},r.or=function(n,i){return new t(n).or(i)},r.prototype.xor=function(n){return typeof n=="number"?this.xorS(n):this.xorM(n)},r.prototype.xorS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)^n);return this},r.prototype.xorM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)^n.get(i,a));return this},r.xor=function(n,i){return new t(n).xor(i)},r.prototype.leftShift=function(n){return typeof n=="number"?this.leftShiftS(n):this.leftShiftM(n)},r.prototype.leftShiftS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)<<n);return this},r.prototype.leftShiftM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)<<n.get(i,a));return this},r.leftShift=function(n,i){return new t(n).leftShift(i)},r.prototype.signPropagatingRightShift=function(n){return typeof n=="number"?this.signPropagatingRightShiftS(n):this.signPropagatingRightShiftM(n)},r.prototype.signPropagatingRightShiftS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>n);return this},r.prototype.signPropagatingRightShiftM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>n.get(i,a));return this},r.signPropagatingRightShift=function(n,i){return new t(n).signPropagatingRightShift(i)},r.prototype.rightShift=function(n){return typeof n=="number"?this.rightShiftS(n):this.rightShiftM(n)},r.prototype.rightShiftS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>>n);return this},r.prototype.rightShiftM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>>n.get(i,a));return this},r.rightShift=function(n,i){return new t(n).rightShift(i)},r.prototype.zeroFillRightShift=r.prototype.rightShift,r.prototype.zeroFillRightShiftS=r.prototype.rightShiftS,r.prototype.zeroFillRightShiftM=r.prototype.rightShiftM,r.zeroFillRightShift=r.rightShift,r.prototype.not=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,~this.get(n,i));return this},r.not=function(n){return new t(n).not()},r.prototype.abs=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.abs(this.get(n,i)));return this},r.abs=function(n){return new t(n).abs()},r.prototype.acos=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.acos(this.get(n,i)));return this},r.acos=function(n){return new t(n).acos()},r.prototype.acosh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.acosh(this.get(n,i)));return this},r.acosh=function(n){return new t(n).acosh()},r.prototype.asin=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.asin(this.get(n,i)));return this},r.asin=function(n){return new t(n).asin()},r.prototype.asinh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.asinh(this.get(n,i)));return this},r.asinh=function(n){return new t(n).asinh()},r.prototype.atan=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.atan(this.get(n,i)));return this},r.atan=function(n){return new t(n).atan()},r.prototype.atanh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.atanh(this.get(n,i)));return this},r.atanh=function(n){return new t(n).atanh()},r.prototype.cbrt=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.cbrt(this.get(n,i)));return this},r.cbrt=function(n){return new t(n).cbrt()},r.prototype.ceil=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.ceil(this.get(n,i)));return this},r.ceil=function(n){return new t(n).ceil()},r.prototype.clz32=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.clz32(this.get(n,i)));return this},r.clz32=function(n){return new t(n).clz32()},r.prototype.cos=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.cos(this.get(n,i)));return this},r.cos=function(n){return new t(n).cos()},r.prototype.cosh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.cosh(this.get(n,i)));return this},r.cosh=function(n){return new t(n).cosh()},r.prototype.exp=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.exp(this.get(n,i)));return this},r.exp=function(n){return new t(n).exp()},r.prototype.expm1=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.expm1(this.get(n,i)));return this},r.expm1=function(n){return new t(n).expm1()},r.prototype.floor=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.floor(this.get(n,i)));return this},r.floor=function(n){return new t(n).floor()},r.prototype.fround=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.fround(this.get(n,i)));return this},r.fround=function(n){return new t(n).fround()},r.prototype.log=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log(this.get(n,i)));return this},r.log=function(n){return new t(n).log()},r.prototype.log1p=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log1p(this.get(n,i)));return this},r.log1p=function(n){return new t(n).log1p()},r.prototype.log10=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log10(this.get(n,i)));return this},r.log10=function(n){return new t(n).log10()},r.prototype.log2=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log2(this.get(n,i)));return this},r.log2=function(n){return new t(n).log2()},r.prototype.round=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.round(this.get(n,i)));return this},r.round=function(n){return new t(n).round()},r.prototype.sign=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sign(this.get(n,i)));return this},r.sign=function(n){return new t(n).sign()},r.prototype.sin=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sin(this.get(n,i)));return this},r.sin=function(n){return new t(n).sin()},r.prototype.sinh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sinh(this.get(n,i)));return this},r.sinh=function(n){return new t(n).sinh()},r.prototype.sqrt=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sqrt(this.get(n,i)));return this},r.sqrt=function(n){return new t(n).sqrt()},r.prototype.tan=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.tan(this.get(n,i)));return this},r.tan=function(n){return new t(n).tan()},r.prototype.tanh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.tanh(this.get(n,i)));return this},r.tanh=function(n){return new t(n).tanh()},r.prototype.trunc=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.trunc(this.get(n,i)));return this},r.trunc=function(n){return new t(n).trunc()},r.pow=function(n,i){return new t(n).pow(i)},r.prototype.pow=function(n){return typeof n=="number"?this.powS(n):this.powM(n)},r.prototype.powS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)**n);return this},r.prototype.powM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)**n.get(i,a));return this}}function di(r,t,e){let n=e?r.rows:r.rows-1;if(t<0||t>n)throw new RangeError("Row index out of range")}function fi(r,t,e){let n=e?r.columns:r.columns-1;if(t<0||t>n)throw new RangeError("Column index out of range")}function kl(r,t){if(t.to1DArray&&(t=t.to1DArray()),t.length!==r.columns)throw new RangeError("vector size must be the same as the number of columns");return t}function Tl(r,t){if(t.to1DArray&&(t=t.to1DArray()),t.length!==r.rows)throw new RangeError("vector size must be the same as the number of rows");return t}function dE(r,t){if(!_r.isAnyArray(t))throw new TypeError("row indices must be an array");for(let e=0;e<t.length;e++)if(t[e]<0||t[e]>=r.rows)throw new RangeError("row indices are out of range")}function fE(r,t){if(!_r.isAnyArray(t))throw new TypeError("column indices must be an array");for(let e=0;e<t.length;e++)if(t[e]<0||t[e]>=r.columns)throw new RangeError("column indices are out of range")}function Zw(r,t,e,n,i){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(Cd("startRow",t),Cd("endRow",e),Cd("startColumn",n),Cd("endColumn",i),t>e||n>i||t<0||t>=r.rows||e<0||e>=r.rows||n<0||n>=r.columns||i<0||i>=r.columns)throw new RangeError("Submatrix indices are out of range")}function Dg(r,t=0){let e=[];for(let n=0;n<r;n++)e.push(t);return e}function Cd(r,t){if(typeof t!="number")throw new TypeError(`${r} must be a number`)}function yl(r){if(r.isEmpty())throw new Error("Empty matrix has no elements to index")}function wnt(r){let t=Dg(r.rows);for(let e=0;e<r.rows;++e)for(let n=0;n<r.columns;++n)t[e]+=r.get(e,n);return t}function xnt(r){let t=Dg(r.columns);for(let e=0;e<r.rows;++e)for(let n=0;n<r.columns;++n)t[n]+=r.get(e,n);return t}function Ent(r){let t=0;for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)t+=r.get(e,n);return t}function _nt(r){let t=Dg(r.rows,1);for(let e=0;e<r.rows;++e)for(let n=0;n<r.columns;++n)t[e]*=r.get(e,n);return t}function Snt(r){let t=Dg(r.columns,1);for(let e=0;e<r.rows;++e)for(let n=0;n<r.columns;++n)t[n]*=r.get(e,n);return t}function Mnt(r){let t=1;for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)t*=r.get(e,n);return t}function knt(r,t,e){const n=r.rows,i=r.columns,a=[];for(let s=0;s<n;s++){let o=0,l=0,u=0;for(let c=0;c<i;c++)u=r.get(s,c)-e[s],o+=u,l+=u*u;t?a.push((l-o*o/i)/(i-1)):a.push((l-o*o/i)/i)}return a}function Tnt(r,t,e){const n=r.rows,i=r.columns,a=[];for(let s=0;s<i;s++){let o=0,l=0,u=0;for(let c=0;c<n;c++)u=r.get(c,s)-e[s],o+=u,l+=u*u;t?a.push((l-o*o/n)/(n-1)):a.push((l-o*o/n)/n)}return a}function Ont(r,t,e){const n=r.rows,i=r.columns,a=n*i;let s=0,o=0,l=0;for(let u=0;u<n;u++)for(let c=0;c<i;c++)l=r.get(u,c)-e,s+=l,o+=l*l;return t?(o-s*s/a)/(a-1):(o-s*s/a)/a}function Cnt(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)-t[e])}function Ant(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)-t[n])}function Pnt(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)-t)}function Nnt(r){const t=[];for(let e=0;e<r.rows;e++){let n=0;for(let i=0;i<r.columns;i++)n+=r.get(e,i)**2/(r.columns-1);t.push(Math.sqrt(n))}return t}function Rnt(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)/t[e])}function Lnt(r){const t=[];for(let e=0;e<r.columns;e++){let n=0;for(let i=0;i<r.rows;i++)n+=r.get(i,e)**2/(r.rows-1);t.push(Math.sqrt(n))}return t}function Int(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)/t[n])}function Dnt(r){const t=r.size-1;let e=0;for(let n=0;n<r.columns;n++)for(let i=0;i<r.rows;i++)e+=r.get(i,n)**2/t;return Math.sqrt(e)}function Fnt(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)/t)}class Gt{static from1DArray(t,e,n){if(t*e!==n.length)throw new RangeError("data length does not match given dimensions");let a=new mt(t,e);for(let s=0;s<t;s++)for(let o=0;o<e;o++)a.set(s,o,n[s*e+o]);return a}static rowVector(t){let e=new mt(1,t.length);for(let n=0;n<t.length;n++)e.set(0,n,t[n]);return e}static columnVector(t){let e=new mt(t.length,1);for(let n=0;n<t.length;n++)e.set(n,0,t[n]);return e}static zeros(t,e){return new mt(t,e)}static ones(t,e){return new mt(t,e).fill(1)}static rand(t,e,n={}){if(typeof n!="object")throw new TypeError("options must be an object");const{random:i=Math.random}=n;let a=new mt(t,e);for(let s=0;s<t;s++)for(let o=0;o<e;o++)a.set(s,o,i());return a}static randInt(t,e,n={}){if(typeof n!="object")throw new TypeError("options must be an object");const{min:i=0,max:a=1e3,random:s=Math.random}=n;if(!Number.isInteger(i))throw new TypeError("min must be an integer");if(!Number.isInteger(a))throw new TypeError("max must be an integer");if(i>=a)throw new RangeError("min must be smaller than max");let o=a-i,l=new mt(t,e);for(let u=0;u<t;u++)for(let c=0;c<e;c++){let h=i+Math.round(s()*o);l.set(u,c,h)}return l}static eye(t,e,n){e===void 0&&(e=t),n===void 0&&(n=1);let i=Math.min(t,e),a=this.zeros(t,e);for(let s=0;s<i;s++)a.set(s,s,n);return a}static diag(t,e,n){let i=t.length;e===void 0&&(e=i),n===void 0&&(n=e);let a=Math.min(i,e,n),s=this.zeros(e,n);for(let o=0;o<a;o++)s.set(o,o,t[o]);return s}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,i=t.columns,a=new mt(n,i);for(let s=0;s<n;s++)for(let o=0;o<i;o++)a.set(s,o,Math.min(t.get(s,o),e.get(s,o)));return a}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,i=t.columns,a=new this(n,i);for(let s=0;s<n;s++)for(let o=0;o<i;o++)a.set(s,o,Math.max(t.get(s,o),e.get(s,o)));return a}static checkMatrix(t){return Gt.isMatrix(t)?t:new mt(t)}static isMatrix(t){return t!=null&&t.klass==="Matrix"}get size(){return this.rows*this.columns}apply(t){if(typeof t!="function")throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.call(this,e,n);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let n=0;n<this.columns;n++)t[e].push(this.get(e,n))}return t}toJSON(){return this.to2DArray()}isRowVector(){return this.rows===1}isColumnVector(){return this.columns===1}isVector(){return this.rows===1||this.columns===1}isSquare(){return this.rows===this.columns}isEmpty(){return this.rows===0||this.columns===0}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(this.get(t,t)!==0)return!1;return!0}isEchelonForm(){let t=0,e=0,n=-1,i=!0,a=!1;for(;t<this.rows&&i;){for(e=0,a=!1;e<this.columns&&a===!1;)this.get(t,e)===0?e++:this.get(t,e)===1&&e>n?(a=!0,n=e):(i=!1,a=!0);t++}return i}isReducedEchelonForm(){let t=0,e=0,n=-1,i=!0,a=!1;for(;t<this.rows&&i;){for(e=0,a=!1;e<this.columns&&a===!1;)this.get(t,e)===0?e++:this.get(t,e)===1&&e>n?(a=!0,n=e):(i=!1,a=!0);for(let s=e+1;s<this.rows;s++)this.get(t,s)!==0&&(i=!1);t++}return i}echelonForm(){let t=this.clone(),e=0,n=0;for(;e<t.rows&&n<t.columns;){let i=e;for(let a=e;a<t.rows;a++)t.get(a,n)>t.get(i,n)&&(i=a);if(t.get(i,n)===0)n++;else{t.swapRows(e,i);let a=t.get(e,n);for(let s=n;s<t.columns;s++)t.set(e,s,t.get(e,s)/a);for(let s=e+1;s<t.rows;s++){let o=t.get(s,n)/t.get(e,n);t.set(s,n,0);for(let l=n+1;l<t.columns;l++)t.set(s,l,t.get(s,l)-t.get(e,l)*o)}e++,n++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,n=t.rows,i=n-1;for(;i>=0;)if(t.maxRow(i)===0)i--;else{let a=0,s=!1;for(;a<n&&s===!1;)t.get(i,a)===1?s=!0:a++;for(let o=0;o<i;o++){let l=t.get(o,a);for(let u=a;u<e;u++){let c=t.get(o,u)-l*t.get(i,u);t.set(o,u,c)}}i--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{rows:e=1,columns:n=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(n)||n<=0)throw new TypeError("columns must be a positive integer");let i=new mt(this.rows*e,this.columns*n);for(let a=0;a<e;a++)for(let s=0;s<n;s++)i.setSubMatrix(this,this.rows*a,this.columns*s);return i}fill(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,t);return this}neg(){return this.mulS(-1)}getRow(t){di(this,t);let e=[];for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}getRowVector(t){return mt.rowVector(this.getRow(t))}setRow(t,e){di(this,t),e=kl(this,e);for(let n=0;n<this.columns;n++)this.set(t,n,e[n]);return this}swapRows(t,e){di(this,t),di(this,e);for(let n=0;n<this.columns;n++){let i=this.get(t,n);this.set(t,n,this.get(e,n)),this.set(e,n,i)}return this}getColumn(t){fi(this,t);let e=[];for(let n=0;n<this.rows;n++)e.push(this.get(n,t));return e}getColumnVector(t){return mt.columnVector(this.getColumn(t))}setColumn(t,e){fi(this,t),e=Tl(this,e);for(let n=0;n<this.rows;n++)this.set(n,t,e[n]);return this}swapColumns(t,e){fi(this,t),fi(this,e);for(let n=0;n<this.rows;n++){let i=this.get(n,t);this.set(n,t,this.get(n,e)),this.set(n,e,i)}return this}addRowVector(t){t=kl(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[n]);return this}subRowVector(t){t=kl(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[n]);return this}mulRowVector(t){t=kl(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[n]);return this}divRowVector(t){t=kl(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[n]);return this}addColumnVector(t){t=Tl(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[e]);return this}subColumnVector(t){t=Tl(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[e]);return this}mulColumnVector(t){t=Tl(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[e]);return this}divColumnVector(t){t=Tl(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[e]);return this}mulRow(t,e){di(this,t);for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e);return this}mulColumn(t,e){fi(this,t);for(let n=0;n<this.rows;n++)this.set(n,t,this.get(n,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const e=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>e[n]&&(e[n]=this.get(n,i));return e}case"column":{const e=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>e[i]&&(e[i]=this.get(n,i));return e}case void 0:{let e=this.get(0,0);for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>e&&(e=this.get(n,i));return e}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){yl(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>t&&(t=this.get(n,i),e[0]=n,e[1]=i);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const e=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)<e[n]&&(e[n]=this.get(n,i));return e}case"column":{const e=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)<e[i]&&(e[i]=this.get(n,i));return e}case void 0:{let e=this.get(0,0);for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)<e&&(e=this.get(n,i));return e}default:throw new Error(`invalid option: ${t}`)}}minIndex(){yl(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)<t&&(t=this.get(n,i),e[0]=n,e[1]=i);return e}maxRow(t){if(di(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n));return e}maxRowIndex(t){di(this,t),yl(this);let e=this.get(t,0),n=[t,0];for(let i=1;i<this.columns;i++)this.get(t,i)>e&&(e=this.get(t,i),n[1]=i);return n}minRow(t){if(di(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n));return e}minRowIndex(t){di(this,t),yl(this);let e=this.get(t,0),n=[t,0];for(let i=1;i<this.columns;i++)this.get(t,i)<e&&(e=this.get(t,i),n[1]=i);return n}maxColumn(t){if(fi(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t));return e}maxColumnIndex(t){fi(this,t),yl(this);let e=this.get(0,t),n=[0,t];for(let i=1;i<this.rows;i++)this.get(i,t)>e&&(e=this.get(i,t),n[0]=i);return n}minColumn(t){if(fi(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t));return e}minColumnIndex(t){fi(this,t),yl(this);let e=this.get(0,t),n=[0,t];for(let i=1;i<this.rows;i++)this.get(i,t)<e&&(e=this.get(i,t),n[0]=i);return n}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let n=0;n<t;n++)e.push(this.get(n,n));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t+=this.get(e,n),this.set(e,n,t);return this}dot(t){Gt.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let n=0;for(let i=0;i<e.length;i++)n+=e[i]*t[i];return n}mmul(t){t=mt.checkMatrix(t);let e=this.rows,n=this.columns,i=t.columns,a=new mt(e,i),s=new Float64Array(n);for(let o=0;o<i;o++){for(let l=0;l<n;l++)s[l]=t.get(l,o);for(let l=0;l<e;l++){let u=0;for(let c=0;c<n;c++)u+=this.get(l,c)*s[c];a.set(l,o,u)}}return a}mpow(t){if(!this.isSquare())throw new RangeError("Matrix must be square");if(!Number.isInteger(t)||t<0)throw new RangeError("Exponent must be a non-negative integer");let e=mt.eye(this.rows),n=this;for(let i=t;i>1;i/=2)i&1&&(e=e.mmul(n)),n=n.mmul(n);return e}strassen2x2(t){t=mt.checkMatrix(t);let e=new mt(2,2);const n=this.get(0,0),i=t.get(0,0),a=this.get(0,1),s=t.get(0,1),o=this.get(1,0),l=t.get(1,0),u=this.get(1,1),c=t.get(1,1),h=(n+u)*(i+c),d=(o+u)*i,g=n*(s-c),p=u*(l-i),v=(n+a)*c,m=(o-n)*(i+s),b=(a-u)*(l+c),w=h+p-v+b,x=g+v,_=d+p,S=h-d+g+m;return e.set(0,0,w),e.set(0,1,x),e.set(1,0,_),e.set(1,1,S),e}strassen3x3(t){t=mt.checkMatrix(t);let e=new mt(3,3);const n=this.get(0,0),i=this.get(0,1),a=this.get(0,2),s=this.get(1,0),o=this.get(1,1),l=this.get(1,2),u=this.get(2,0),c=this.get(2,1),h=this.get(2,2),d=t.get(0,0),g=t.get(0,1),p=t.get(0,2),v=t.get(1,0),m=t.get(1,1),b=t.get(1,2),w=t.get(2,0),x=t.get(2,1),_=t.get(2,2),S=(n+i+a-s-o-c-h)*m,M=(n-s)*(-g+m),k=o*(-d+g+v-m-b-w+_),T=(-n+s+o)*(d-g+m),P=(s+o)*(-d+g),O=n*d,A=(-n+u+c)*(d-p+b),R=(-n+u)*(p-b),L=(u+c)*(-d+p),q=(n+i+a-o-l-u-c)*b,j=c*(-d+p+v-m-b-w+x),$=(-a+c+h)*(m+w-x),B=(a-h)*(m-x),F=a*w,V=(c+h)*(-w+x),X=(-a+o+l)*(b+w-_),K=(a-l)*(b-_),dt=(o+l)*(-w+_),ct=i*v,ht=l*x,lt=s*p,pt=u*g,wt=h*_,Bt=O+F+ct,Ut=S+T+P+O+$+F+V,Fe=O+A+L+q+F+X+dt,Gn=M+k+T+O+F+X+K,on=M+T+P+O+ht,dr=F+X+K+dt+lt,Rn=O+A+R+j+$+B+F,te=$+B+F+V+pt,bi=O+A+R+L+wt;return e.set(0,0,Bt),e.set(0,1,Ut),e.set(0,2,Fe),e.set(1,0,Gn),e.set(1,1,on),e.set(1,2,dr),e.set(2,0,Rn),e.set(2,1,te),e.set(2,2,bi),e}mmulStrassen(t){t=mt.checkMatrix(t);let e=this.clone(),n=e.rows,i=e.columns,a=t.rows,s=t.columns;i!==a&&console.warn(`Multiplying ${n} x ${i} and ${a} x ${s} matrix: dimensions do not match.`);function o(h,d,g){let p=h.rows,v=h.columns;if(p===d&&v===g)return h;{let m=Gt.zeros(d,g);return m=m.setSubMatrix(h,0,0),m}}let l=Math.max(n,a),u=Math.max(i,s);e=o(e,l,u),t=o(t,l,u);function c(h,d,g,p){if(g<=512||p<=512)return h.mmul(d);g%2===1&&p%2===1?(h=o(h,g+1,p+1),d=o(d,g+1,p+1)):g%2===1?(h=o(h,g+1,p),d=o(d,g+1,p)):p%2===1&&(h=o(h,g,p+1),d=o(d,g,p+1));let v=parseInt(h.rows/2,10),m=parseInt(h.columns/2,10),b=h.subMatrix(0,v-1,0,m-1),w=d.subMatrix(0,v-1,0,m-1),x=h.subMatrix(0,v-1,m,h.columns-1),_=d.subMatrix(0,v-1,m,d.columns-1),S=h.subMatrix(v,h.rows-1,0,m-1),M=d.subMatrix(v,d.rows-1,0,m-1),k=h.subMatrix(v,h.rows-1,m,h.columns-1),T=d.subMatrix(v,d.rows-1,m,d.columns-1),P=c(Gt.add(b,k),Gt.add(w,T),v,m),O=c(Gt.add(S,k),w,v,m),A=c(b,Gt.sub(_,T),v,m),R=c(k,Gt.sub(M,w),v,m),L=c(Gt.add(b,x),T,v,m),q=c(Gt.sub(S,b),Gt.add(w,_),v,m),j=c(Gt.sub(x,k),Gt.add(M,T),v,m),$=Gt.add(P,R);$.sub(L),$.add(j);let B=Gt.add(A,L),F=Gt.add(O,R),V=Gt.sub(P,O);V.add(A),V.add(q);let X=Gt.zeros(2*$.rows,2*$.columns);return X=X.setSubMatrix($,0,0),X=X.setSubMatrix(B,$.rows,0),X=X.setSubMatrix(F,0,$.columns),X=X.setSubMatrix(V,$.rows,$.columns),X.subMatrix(0,g-1,0,p-1)}return c(e,t,l,u)}scaleRows(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let i=new mt(this.rows,this.columns);for(let a=0;a<this.rows;a++){const s=this.getRow(a);s.length>0&&Rk(s,{min:e,max:n,output:s}),i.setRow(a,s)}return i}scaleColumns(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let i=new mt(this.rows,this.columns);for(let a=0;a<this.columns;a++){const s=this.getColumn(a);s.length&&Rk(s,{min:e,max:n,output:s}),i.setColumn(a,s)}return i}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let n=0;n<t;n++){let i=this.get(e,n),a=this.get(e,this.columns-1-n);this.set(e,n,a),this.set(e,this.columns-1-n,i)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let n=0;n<t;n++){let i=this.get(n,e),a=this.get(this.rows-1-n,e);this.set(n,e,a),this.set(this.rows-1-n,e,i)}return this}kroneckerProduct(t){t=mt.checkMatrix(t);let e=this.rows,n=this.columns,i=t.rows,a=t.columns,s=new mt(e*i,n*a);for(let o=0;o<e;o++)for(let l=0;l<n;l++)for(let u=0;u<i;u++)for(let c=0;c<a;c++)s.set(i*o+u,a*l+c,this.get(o,l)*t.get(u,c));return s}kroneckerSum(t){if(t=mt.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,n=t.rows,i=this.kroneckerProduct(mt.eye(n,n)),a=mt.eye(e,e).kroneckerProduct(t);return i.add(a)}transpose(){let t=new mt(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.set(n,e,this.get(e,n));return t}sortRows(t=Ik){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=Ik){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,n,i){Zw(this,t,e,n,i);let a=new mt(e-t+1,i-n+1);for(let s=t;s<=e;s++)for(let o=n;o<=i;o++)a.set(s-t,o-n,this.get(s,o));return a}subMatrixRow(t,e,n){if(e===void 0&&(e=0),n===void 0&&(n=this.columns-1),e>n||e<0||e>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let i=new mt(t.length,n-e+1);for(let a=0;a<t.length;a++)for(let s=e;s<=n;s++){if(t[a]<0||t[a]>=this.rows)throw new RangeError(`Row index out of range: ${t[a]}`);i.set(a,s-e,this.get(t[a],s))}return i}subMatrixColumn(t,e,n){if(e===void 0&&(e=0),n===void 0&&(n=this.rows-1),e>n||e<0||e>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let i=new mt(n-e+1,t.length);for(let a=0;a<t.length;a++)for(let s=e;s<=n;s++){if(t[a]<0||t[a]>=this.columns)throw new RangeError(`Column index out of range: ${t[a]}`);i.set(s-e,a,this.get(s,t[a]))}return i}setSubMatrix(t,e,n){if(t=mt.checkMatrix(t),t.isEmpty())return this;let i=e+t.rows-1,a=n+t.columns-1;Zw(this,e,i,n,a);for(let s=0;s<t.rows;s++)for(let o=0;o<t.columns;o++)this.set(e+s,n+o,t.get(s,o));return this}selection(t,e){dE(this,t),fE(this,e);let n=new mt(t.length,e.length);for(let i=0;i<t.length;i++){let a=t[i];for(let s=0;s<e.length;s++){let o=e[s];n.set(i,s,this.get(a,o))}}return n}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let n=0;n<t;n++)e+=this.get(n,n);return e}clone(){return this.constructor.copy(this,new mt(this.rows,this.columns))}static copy(t,e){for(const[n,i,a]of t.entries())e.set(n,i,a);return e}sum(t){switch(t){case"row":return wnt(this);case"column":return xnt(this);case void 0:return Ent(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return _nt(this);case"column":return Snt(this);case void 0:return Mnt(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":{for(let n=0;n<this.rows;n++)e[n]/=this.columns;return e}case"column":{for(let n=0;n<this.columns;n++)e[n]/=this.rows;return e}case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");const{unbiased:n=!0,mean:i=this.mean(t)}=e;if(typeof n!="boolean")throw new TypeError("unbiased must be a boolean");switch(t){case"row":{if(!_r.isAnyArray(i))throw new TypeError("mean must be an array");return knt(this,n,i)}case"column":{if(!_r.isAnyArray(i))throw new TypeError("mean must be an array");return Tnt(this,n,i)}case void 0:{if(typeof i!="number")throw new TypeError("mean must be a number");return Ont(this,n,i)}default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){typeof t=="object"&&(e=t,t=void 0);const n=this.variance(t,e);if(t===void 0)return Math.sqrt(n);for(let i=0;i<n.length;i++)n[i]=Math.sqrt(n[i]);return n}center(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");const{center:n=this.mean(t)}=e;switch(t){case"row":{if(!_r.isAnyArray(n))throw new TypeError("center must be an array");return Cnt(this,n),this}case"column":{if(!_r.isAnyArray(n))throw new TypeError("center must be an array");return Ant(this,n),this}case void 0:{if(typeof n!="number")throw new TypeError("center must be a number");return Pnt(this,n),this}default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");let n=e.scale;switch(t){case"row":{if(n===void 0)n=Nnt(this);else if(!_r.isAnyArray(n))throw new TypeError("scale must be an array");return Rnt(this,n),this}case"column":{if(n===void 0)n=Lnt(this);else if(!_r.isAnyArray(n))throw new TypeError("scale must be an array");return Int(this,n),this}case void 0:{if(n===void 0)n=Dnt(this);else if(typeof n!="number")throw new TypeError("scale must be a number");return Fnt(this,n),this}default:throw new Error(`invalid option: ${t}`)}}toString(t){return OD(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}Gt.prototype.klass="Matrix";typeof Symbol<"u"&&(Gt.prototype[Symbol.for("nodejs.util.inspect.custom")]=vnt);function Ik(r,t){return r-t}function Bnt(r){return r.every(t=>typeof t=="number")}Gt.random=Gt.rand;Gt.randomInt=Gt.randInt;Gt.diagonal=Gt.diag;Gt.prototype.diagonal=Gt.prototype.diag;Gt.identity=Gt.eye;Gt.prototype.negate=Gt.prototype.neg;Gt.prototype.tensorProduct=Gt.prototype.kroneckerProduct;var Mc,Jw,Po;let mt=(Po=class extends Gt{constructor(e,n){super();Qp(this,Mc);le(this,"data");if(Po.isMatrix(e))tv(this,Mc,Jw).call(this,e.rows,e.columns),Po.copy(e,this);else if(Number.isInteger(e)&&e>=0)tv(this,Mc,Jw).call(this,e,n);else if(_r.isAnyArray(e)){const i=e;if(e=i.length,n=e?i[0].length:0,typeof n!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let a=0;a<e;a++){if(i[a].length!==n)throw new RangeError("Inconsistent array dimensions");if(!Bnt(i[a]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(i[a]))}this.rows=e,this.columns=n}else throw new TypeError("First argument must be a positive number or an array")}set(e,n,i){return this.data[e][n]=i,this}get(e,n){return this.data[e][n]}removeRow(e){return di(this,e),this.data.splice(e,1),this.rows-=1,this}addRow(e,n){return n===void 0&&(n=e,e=this.rows),di(this,e,!0),n=Float64Array.from(kl(this,n)),this.data.splice(e,0,n),this.rows+=1,this}removeColumn(e){fi(this,e);for(let n=0;n<this.rows;n++){const i=new Float64Array(this.columns-1);for(let a=0;a<e;a++)i[a]=this.data[n][a];for(let a=e+1;a<this.columns;a++)i[a-1]=this.data[n][a];this.data[n]=i}return this.columns-=1,this}addColumn(e,n){typeof n>"u"&&(n=e,e=this.columns),fi(this,e,!0),n=Tl(this,n);for(let i=0;i<this.rows;i++){const a=new Float64Array(this.columns+1);let s=0;for(;s<e;s++)a[s]=this.data[i][s];for(a[s++]=n[i];s<this.columns+1;s++)a[s]=this.data[i][s-1];this.data[i]=a}return this.columns+=1,this}},Mc=new WeakSet,Jw=function(e,n){if(this.data=[],Number.isInteger(n)&&n>=0)for(let i=0;i<e;i++)this.data.push(new Float64Array(n));else throw new TypeError("nColumns must be a positive integer");this.rows=e,this.columns=n},Po);bnt(Gt,mt);var Yn;const Qf=class Qf extends Gt{constructor(e){super();Qp(this,Yn);if(mt.isMatrix(e)){if(!e.isSymmetric())throw new TypeError("not symmetric data");$h(this,Yn,mt.copy(e,new mt(e.rows,e.rows)))}else if(Number.isInteger(e)&&e>=0)$h(this,Yn,new mt(e,e));else if($h(this,Yn,new mt(e)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return ki(this,Yn).size}get rows(){return ki(this,Yn).rows}get columns(){return ki(this,Yn).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(e){return mt.isMatrix(e)&&e.klassType==="SymmetricMatrix"}static zeros(e){return new this(e)}static ones(e){return new this(e).fill(1)}clone(){const e=new Qf(this.diagonalSize);for(const[n,i,a]of this.upperRightEntries())e.set(n,i,a);return e}toMatrix(){return new mt(this)}get(e,n){return ki(this,Yn).get(e,n)}set(e,n,i){return ki(this,Yn).set(e,n,i),ki(this,Yn).set(n,e,i),this}removeCross(e){return ki(this,Yn).removeRow(e),ki(this,Yn).removeColumn(e),this}addCross(e,n){n===void 0&&(n=e,e=this.diagonalSize);const i=n.slice();return i.splice(e,1),ki(this,Yn).addRow(e,i),ki(this,Yn).addColumn(e,n),this}applyMask(e){if(e.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const n=[];for(const[i,a]of e.entries())a||n.push(i);n.reverse();for(const i of n)this.removeCross(i);return this}toCompact(){const{diagonalSize:e}=this,n=new Array(e*(e+1)/2);for(let i=0,a=0,s=0;s<n.length;s++)n[s]=this.get(a,i),++i>=e&&(i=++a);return n}static fromCompact(e){const n=e.length,i=(Math.sqrt(8*n+1)-1)/2;if(!Number.isInteger(i))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(e)}`);const a=new Qf(i);for(let s=0,o=0,l=0;l<n;l++)a.set(s,o,e[l]),++s>=i&&(s=++o);return a}*upperRightEntries(){for(let e=0,n=0;e<this.diagonalSize;void 0){const i=this.get(e,n);yield[e,n,i],++n>=this.diagonalSize&&(n=++e)}}*upperRightValues(){for(let e=0,n=0;e<this.diagonalSize;void 0)yield this.get(e,n),++n>=this.diagonalSize&&(n=++e)}};Yn=new WeakMap;let Co=Qf;Co.prototype.klassType="SymmetricMatrix";class Fg extends Co{static isDistanceMatrix(t){return Co.isSymmetricMatrix(t)&&t.klassSubType==="DistanceMatrix"}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,n){return t===e&&(n=0),super.set(t,e,n)}addCross(t,e){return e===void 0&&(e=t,t=this.diagonalSize),e=e.slice(),e[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new Co(this)}clone(){const t=new Fg(this.diagonalSize);for(const[e,n,i]of this.upperRightEntries())e!==n&&t.set(e,n,i);return t}toCompact(){const{diagonalSize:t}=this,e=(t-1)*t/2,n=new Array(e);for(let i=1,a=0,s=0;s<n.length;s++)n[s]=this.get(a,i),++i>=t&&(i=++a+1);return n}static fromCompact(t){const e=t.length;if(e===0)return new this(0);const n=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(n))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);const i=new this(n);for(let a=1,s=0,o=0;o<e;o++)i.set(a,s,t[o]),++a>=n&&(a=++s+1);return i}}Fg.prototype.klassSubType="DistanceMatrix";class Ua extends Gt{constructor(t,e,n){super(),this.matrix=t,this.rows=e,this.columns=n}}class znt extends Ua{constructor(t,e){fi(t,e),super(t,t.rows,1),this.column=e}set(t,e,n){return this.matrix.set(t,this.column,n),this}get(t){return this.matrix.get(t,this.column)}}class $nt extends Ua{constructor(t,e){fE(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,n){return this.matrix.set(t,this.columnIndices[e],n),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}}class jnt extends Ua{constructor(t){super(t,t.rows,t.columns)}set(t,e,n){return this.matrix.set(t,this.columns-e-1,n),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}}class qnt extends Ua{constructor(t){super(t,t.rows,t.columns)}set(t,e,n){return this.matrix.set(this.rows-t-1,e,n),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}}class Wnt extends Ua{constructor(t,e){di(t,e),super(t,1,t.columns),this.row=e}set(t,e,n){return this.matrix.set(this.row,e,n),this}get(t,e){return this.matrix.get(this.row,e)}}class Gnt extends Ua{constructor(t,e){dE(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,n){return this.matrix.set(this.rowIndices[t],e,n),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}}class ef extends Ua{constructor(t,e,n){dE(t,e),fE(t,n),super(t,e.length,n.length),this.rowIndices=e,this.columnIndices=n}set(t,e,n){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],n),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class Vnt extends Ua{constructor(t,e,n,i,a){Zw(t,e,n,i,a),super(t,n-e+1,a-i+1),this.startRow=e,this.startColumn=i}set(t,e,n){return this.matrix.set(this.startRow+t,this.startColumn+e,n),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}}class Hnt extends Ua{constructor(t){super(t,t.columns,t.rows)}set(t,e,n){return this.matrix.set(e,t,n),this}get(t,e){return this.matrix.get(e,t)}}class CD extends Gt{constructor(t,e={}){const{rows:n=1}=e;if(t.length%n!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=n,this.columns=t.length/n,this.data=t}set(t,e,n){let i=this._calculateIndex(t,e);return this.data[i]=n,this}get(t,e){let n=this._calculateIndex(t,e);return this.data[n]}_calculateIndex(t,e){return t*this.columns+e}}class Yr extends Gt{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}}function Unt(r,t){if(_r.isAnyArray(r))return r[0]&&_r.isAnyArray(r[0])?new Yr(r):new CD(r,t);throw new Error("the argument is not an array")}class Bg{constructor(t){t=Yr.checkMatrix(t);let e=t.clone(),n=e.rows,i=e.columns,a=new Float64Array(n),s=1,o,l,u,c,h,d,g,p,v;for(o=0;o<n;o++)a[o]=o;for(p=new Float64Array(n),l=0;l<i;l++){for(o=0;o<n;o++)p[o]=e.get(o,l);for(o=0;o<n;o++){for(v=Math.min(o,l),h=0,u=0;u<v;u++)h+=e.get(o,u)*p[u];p[o]-=h,e.set(o,l,p[o])}for(c=l,o=l+1;o<n;o++)Math.abs(p[o])>Math.abs(p[c])&&(c=o);if(c!==l){for(u=0;u<i;u++)d=e.get(c,u),e.set(c,u,e.get(l,u)),e.set(l,u,d);g=a[c],a[c]=a[l],a[l]=g,s=-s}if(l<n&&e.get(l,l)!==0)for(o=l+1;o<n;o++)e.set(o,l,e.get(o,l)/e.get(l,l))}this.LU=e,this.pivotVector=a,this.pivotSign=s}isSingular(){let t=this.LU,e=t.columns;for(let n=0;n<e;n++)if(t.get(n,n)===0)return!0;return!1}solve(t){t=mt.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let i=t.columns,a=t.subMatrixRow(this.pivotVector,0,i-1),s=e.columns,o,l,u;for(u=0;u<s;u++)for(o=u+1;o<s;o++)for(l=0;l<i;l++)a.set(o,l,a.get(o,l)-a.get(u,l)*e.get(o,u));for(u=s-1;u>=0;u--){for(l=0;l<i;l++)a.set(u,l,a.get(u,l)/e.get(u,u));for(o=0;o<u;o++)for(l=0;l<i;l++)a.set(o,l,a.get(o,l)-a.get(u,l)*e.get(o,u))}return a}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,n=t.columns;for(let i=0;i<n;i++)e*=t.get(i,i);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,i=new mt(e,n);for(let a=0;a<e;a++)for(let s=0;s<n;s++)a>s?i.set(a,s,t.get(a,s)):a===s?i.set(a,s,1):i.set(a,s,0);return i}get upperTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,i=new mt(e,n);for(let a=0;a<e;a++)for(let s=0;s<n;s++)a<=s?i.set(a,s,t.get(a,s)):i.set(a,s,0);return i}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function Sa(r,t){let e=0;return Math.abs(r)>Math.abs(t)?(e=t/r,Math.abs(r)*Math.sqrt(1+e*e)):t!==0?(e=r/t,Math.abs(t)*Math.sqrt(1+e*e)):0}class gE{constructor(t){t=Yr.checkMatrix(t);let e=t.clone(),n=t.rows,i=t.columns,a=new Float64Array(i),s,o,l,u;for(l=0;l<i;l++){let c=0;for(s=l;s<n;s++)c=Sa(c,e.get(s,l));if(c!==0){for(e.get(l,l)<0&&(c=-c),s=l;s<n;s++)e.set(s,l,e.get(s,l)/c);for(e.set(l,l,e.get(l,l)+1),o=l+1;o<i;o++){for(u=0,s=l;s<n;s++)u+=e.get(s,l)*e.get(s,o);for(u=-u/e.get(l,l),s=l;s<n;s++)e.set(s,o,e.get(s,o)+u*e.get(s,l))}}a[l]=-c}this.QR=e,this.Rdiag=a}solve(t){t=mt.checkMatrix(t);let e=this.QR,n=e.rows;if(t.rows!==n)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let i=t.columns,a=t.clone(),s=e.columns,o,l,u,c;for(u=0;u<s;u++)for(l=0;l<i;l++){for(c=0,o=u;o<n;o++)c+=e.get(o,u)*a.get(o,l);for(c=-c/e.get(u,u),o=u;o<n;o++)a.set(o,l,a.get(o,l)+c*e.get(o,u))}for(u=s-1;u>=0;u--){for(l=0;l<i;l++)a.set(u,l,a.get(u,l)/this.Rdiag[u]);for(o=0;o<u;o++)for(l=0;l<i;l++)a.set(o,l,a.get(o,l)-a.get(u,l)*e.get(o,u))}return a.subMatrix(0,s-1,0,i-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(this.Rdiag[e]===0)return!1;return!0}get upperTriangularMatrix(){let t=this.QR,e=t.columns,n=new mt(e,e),i,a;for(i=0;i<e;i++)for(a=0;a<e;a++)i<a?n.set(i,a,t.get(i,a)):i===a?n.set(i,a,this.Rdiag[i]):n.set(i,a,0);return n}get orthogonalMatrix(){let t=this.QR,e=t.rows,n=t.columns,i=new mt(e,n),a,s,o,l;for(o=n-1;o>=0;o--){for(a=0;a<e;a++)i.set(a,o,0);for(i.set(o,o,1),s=o;s<n;s++)if(t.get(o,o)!==0){for(l=0,a=o;a<e;a++)l+=t.get(a,o)*i.get(a,s);for(l=-l/t.get(o,o),a=o;a<e;a++)i.set(a,s,i.get(a,s)+l*t.get(a,o))}}return i}}let Jl=class{constructor(t,e={}){if(t=Yr.checkMatrix(t),t.isEmpty())throw new Error("Matrix must be non-empty");let n=t.rows,i=t.columns;const{computeLeftSingularVectors:a=!0,computeRightSingularVectors:s=!0,autoTranspose:o=!1}=e;let l=!!a,u=!!s,c=!1,h;if(n<i)if(!o)h=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{h=t.transpose(),n=h.rows,i=h.columns,c=!0;let O=l;l=u,u=O}else h=t.clone();let d=Math.min(n,i),g=Math.min(n+1,i),p=new Float64Array(g),v=new mt(n,d),m=new mt(i,i),b=new Float64Array(i),w=new Float64Array(n),x=new Float64Array(g);for(let O=0;O<g;O++)x[O]=O;let _=Math.min(n-1,i),S=Math.max(0,Math.min(i-2,n)),M=Math.max(_,S);for(let O=0;O<M;O++){if(O<_){p[O]=0;for(let A=O;A<n;A++)p[O]=Sa(p[O],h.get(A,O));if(p[O]!==0){h.get(O,O)<0&&(p[O]=-p[O]);for(let A=O;A<n;A++)h.set(A,O,h.get(A,O)/p[O]);h.set(O,O,h.get(O,O)+1)}p[O]=-p[O]}for(let A=O+1;A<i;A++){if(O<_&&p[O]!==0){let R=0;for(let L=O;L<n;L++)R+=h.get(L,O)*h.get(L,A);R=-R/h.get(O,O);for(let L=O;L<n;L++)h.set(L,A,h.get(L,A)+R*h.get(L,O))}b[A]=h.get(O,A)}if(l&&O<_)for(let A=O;A<n;A++)v.set(A,O,h.get(A,O));if(O<S){b[O]=0;for(let A=O+1;A<i;A++)b[O]=Sa(b[O],b[A]);if(b[O]!==0){b[O+1]<0&&(b[O]=0-b[O]);for(let A=O+1;A<i;A++)b[A]/=b[O];b[O+1]+=1}if(b[O]=-b[O],O+1<n&&b[O]!==0){for(let A=O+1;A<n;A++)w[A]=0;for(let A=O+1;A<n;A++)for(let R=O+1;R<i;R++)w[A]+=b[R]*h.get(A,R);for(let A=O+1;A<i;A++){let R=-b[A]/b[O+1];for(let L=O+1;L<n;L++)h.set(L,A,h.get(L,A)+R*w[L])}}if(u)for(let A=O+1;A<i;A++)m.set(A,O,b[A])}}let k=Math.min(i,n+1);if(_<i&&(p[_]=h.get(_,_)),n<k&&(p[k-1]=0),S+1<k&&(b[S]=h.get(S,k-1)),b[k-1]=0,l){for(let O=_;O<d;O++){for(let A=0;A<n;A++)v.set(A,O,0);v.set(O,O,1)}for(let O=_-1;O>=0;O--)if(p[O]!==0){for(let A=O+1;A<d;A++){let R=0;for(let L=O;L<n;L++)R+=v.get(L,O)*v.get(L,A);R=-R/v.get(O,O);for(let L=O;L<n;L++)v.set(L,A,v.get(L,A)+R*v.get(L,O))}for(let A=O;A<n;A++)v.set(A,O,-v.get(A,O));v.set(O,O,1+v.get(O,O));for(let A=0;A<O-1;A++)v.set(A,O,0)}else{for(let A=0;A<n;A++)v.set(A,O,0);v.set(O,O,1)}}if(u)for(let O=i-1;O>=0;O--){if(O<S&&b[O]!==0)for(let A=O+1;A<i;A++){let R=0;for(let L=O+1;L<i;L++)R+=m.get(L,O)*m.get(L,A);R=-R/m.get(O+1,O);for(let L=O+1;L<i;L++)m.set(L,A,m.get(L,A)+R*m.get(L,O))}for(let A=0;A<i;A++)m.set(A,O,0);m.set(O,O,1)}let T=k-1,P=Number.EPSILON;for(;k>0;){let O,A;for(O=k-2;O>=-1&&O!==-1;O--){const R=Number.MIN_VALUE+P*Math.abs(p[O]+Math.abs(p[O+1]));if(Math.abs(b[O])<=R||Number.isNaN(b[O])){b[O]=0;break}}if(O===k-2)A=4;else{let R;for(R=k-1;R>=O&&R!==O;R--){let L=(R!==k?Math.abs(b[R]):0)+(R!==O+1?Math.abs(b[R-1]):0);if(Math.abs(p[R])<=P*L){p[R]=0;break}}R===O?A=3:R===k-1?A=1:(A=2,O=R)}switch(O++,A){case 1:{let R=b[k-2];b[k-2]=0;for(let L=k-2;L>=O;L--){let q=Sa(p[L],R),j=p[L]/q,$=R/q;if(p[L]=q,L!==O&&(R=-$*b[L-1],b[L-1]=j*b[L-1]),u)for(let B=0;B<i;B++)q=j*m.get(B,L)+$*m.get(B,k-1),m.set(B,k-1,-$*m.get(B,L)+j*m.get(B,k-1)),m.set(B,L,q)}break}case 2:{let R=b[O-1];b[O-1]=0;for(let L=O;L<k;L++){let q=Sa(p[L],R),j=p[L]/q,$=R/q;if(p[L]=q,R=-$*b[L],b[L]=j*b[L],l)for(let B=0;B<n;B++)q=j*v.get(B,L)+$*v.get(B,O-1),v.set(B,O-1,-$*v.get(B,L)+j*v.get(B,O-1)),v.set(B,L,q)}break}case 3:{const R=Math.max(Math.abs(p[k-1]),Math.abs(p[k-2]),Math.abs(b[k-2]),Math.abs(p[O]),Math.abs(b[O])),L=p[k-1]/R,q=p[k-2]/R,j=b[k-2]/R,$=p[O]/R,B=b[O]/R,F=((q+L)*(q-L)+j*j)/2,V=L*j*(L*j);let X=0;(F!==0||V!==0)&&(F<0?X=0-Math.sqrt(F*F+V):X=Math.sqrt(F*F+V),X=V/(F+X));let K=($+L)*($-L)+X,dt=$*B;for(let ct=O;ct<k-1;ct++){let ht=Sa(K,dt);ht===0&&(ht=Number.MIN_VALUE);let lt=K/ht,pt=dt/ht;if(ct!==O&&(b[ct-1]=ht),K=lt*p[ct]+pt*b[ct],b[ct]=lt*b[ct]-pt*p[ct],dt=pt*p[ct+1],p[ct+1]=lt*p[ct+1],u)for(let wt=0;wt<i;wt++)ht=lt*m.get(wt,ct)+pt*m.get(wt,ct+1),m.set(wt,ct+1,-pt*m.get(wt,ct)+lt*m.get(wt,ct+1)),m.set(wt,ct,ht);if(ht=Sa(K,dt),ht===0&&(ht=Number.MIN_VALUE),lt=K/ht,pt=dt/ht,p[ct]=ht,K=lt*b[ct]+pt*p[ct+1],p[ct+1]=-pt*b[ct]+lt*p[ct+1],dt=pt*b[ct+1],b[ct+1]=lt*b[ct+1],l&&ct<n-1)for(let wt=0;wt<n;wt++)ht=lt*v.get(wt,ct)+pt*v.get(wt,ct+1),v.set(wt,ct+1,-pt*v.get(wt,ct)+lt*v.get(wt,ct+1)),v.set(wt,ct,ht)}b[k-2]=K;break}case 4:{if(p[O]<=0&&(p[O]=p[O]<0?-p[O]:0,u))for(let R=0;R<=T;R++)m.set(R,O,-m.get(R,O));for(;O<T&&!(p[O]>=p[O+1]);){let R=p[O];if(p[O]=p[O+1],p[O+1]=R,u&&O<i-1)for(let L=0;L<i;L++)R=m.get(L,O+1),m.set(L,O+1,m.get(L,O)),m.set(L,O,R);if(l&&O<n-1)for(let L=0;L<n;L++)R=v.get(L,O+1),v.set(L,O+1,v.get(L,O)),v.set(L,O,R);O++}k--;break}}}if(c){let O=m;m=v,v=O}this.m=n,this.n=i,this.s=p,this.U=v,this.V=m}solve(t){let e=t,n=this.threshold,i=this.s.length,a=mt.zeros(i,i);for(let d=0;d<i;d++)Math.abs(this.s[d])<=n?a.set(d,d,0):a.set(d,d,1/this.s[d]);let s=this.U,o=this.rightSingularVectors,l=o.mmul(a),u=o.rows,c=s.rows,h=mt.zeros(u,c);for(let d=0;d<u;d++)for(let g=0;g<c;g++){let p=0;for(let v=0;v<i;v++)p+=l.get(d,v)*s.get(g,v);h.set(d,g,p)}return h.mmul(e)}solveForDiagonal(t){return this.solve(mt.diag(t))}inverse(){let t=this.V,e=this.threshold,n=t.rows,i=t.columns,a=new mt(n,this.s.length);for(let c=0;c<n;c++)for(let h=0;h<i;h++)Math.abs(this.s[h])>e&&a.set(c,h,t.get(c,h)/this.s[h]);let s=this.U,o=s.rows,l=s.columns,u=new mt(n,o);for(let c=0;c<n;c++)for(let h=0;h<o;h++){let d=0;for(let g=0;g<l;g++)d+=a.get(c,g)*s.get(h,g);u.set(c,h,d)}return u}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,n=this.s;for(let i=0,a=n.length;i<a;i++)n[i]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return mt.diag(this.s)}};function Ynt(r,t=!1){return r=Yr.checkMatrix(r),t?new Jl(r).inverse():AD(r,mt.eye(r.rows))}function AD(r,t,e=!1){return r=Yr.checkMatrix(r),t=Yr.checkMatrix(t),e?new Jl(r).solve(t):r.isSquare()?new Bg(r).solve(t):new gE(r).solve(t)}function nf(r){if(r=mt.checkMatrix(r),r.isSquare()){if(r.columns===0)return 1;let t,e,n,i;if(r.columns===2)return t=r.get(0,0),e=r.get(0,1),n=r.get(1,0),i=r.get(1,1),t*i-e*n;if(r.columns===3){let a,s,o;return a=new ef(r,[1,2],[1,2]),s=new ef(r,[1,2],[0,2]),o=new ef(r,[1,2],[0,1]),t=r.get(0,0),e=r.get(0,1),n=r.get(0,2),t*nf(a)-e*nf(s)+n*nf(o)}else return new Bg(r).determinant}else throw Error("determinant can only be calculated for a square matrix")}function Xnt(r,t){let e=[];for(let n=0;n<r;n++)n!==t&&e.push(n);return e}function Knt(r,t,e,n=1e-9,i=1e-9){if(r>i)return new Array(t.rows+1).fill(0);{let a=t.addRow(e,[0]);for(let s=0;s<a.rows;s++)Math.abs(a.get(s,0))<n&&a.set(s,0,0);return a.to1DArray()}}function Znt(r,t={}){const{thresholdValue:e=1e-9,thresholdError:n=1e-9}=t;r=mt.checkMatrix(r);let i=r.rows,a=new mt(i,i);for(let s=0;s<i;s++){let o=mt.columnVector(r.getRow(s)),l=r.subMatrixRow(Xnt(i,s)).transpose(),c=new Jl(l).solve(o),h=mt.sub(o,l.mmul(c)).abs().max();a.setRow(s,Knt(h,c,s,e,n))}return a}function Jnt(r,t=Number.EPSILON){if(r=mt.checkMatrix(r),r.isEmpty())return r.transpose();let e=new Jl(r,{autoTranspose:!0}),n=e.leftSingularVectors,i=e.rightSingularVectors,a=e.diagonal;for(let s=0;s<a.length;s++)Math.abs(a[s])>t?a[s]=1/a[s]:a[s]=0;return i.mmul(mt.diag(a).mmul(n.transpose()))}function Qnt(r,t=r,e={}){r=new mt(r);let n=!1;if(typeof t=="object"&&!mt.isMatrix(t)&&!_r.isAnyArray(t)?(e=t,t=r,n=!0):t=new mt(t),r.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=e;i&&(r=r.center("column"),n||(t=t.center("column")));const a=r.transpose().mmul(t);for(let s=0;s<a.rows;s++)for(let o=0;o<a.columns;o++)a.set(s,o,a.get(s,o)*(1/(r.rows-1)));return a}function trt(r,t=r,e={}){r=new mt(r);let n=!1;if(typeof t=="object"&&!mt.isMatrix(t)&&!_r.isAnyArray(t)?(e=t,t=r,n=!0):t=new mt(t),r.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0,scale:a=!0}=e;i&&(r.center("column"),n||t.center("column")),a&&(r.scale("column"),n||t.scale("column"));const s=r.standardDeviation("column",{unbiased:!0}),o=n?s:t.standardDeviation("column",{unbiased:!0}),l=r.transpose().mmul(t);for(let u=0;u<l.rows;u++)for(let c=0;c<l.columns;c++)l.set(u,c,l.get(u,c)*(1/(s[u]*o[c]))*(1/(r.rows-1)));return l}class PD{constructor(t,e={}){const{assumeSymmetric:n=!1}=e;if(t=Yr.checkMatrix(t),!t.isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let i=t.columns,a=new mt(i,i),s=new Float64Array(i),o=new Float64Array(i),l=t,u,c,h=!1;if(n?h=!0:h=t.isSymmetric(),h){for(u=0;u<i;u++)for(c=0;c<i;c++)a.set(u,c,l.get(u,c));ert(i,o,s,a),nrt(i,o,s,a)}else{let d=new mt(i,i),g=new Float64Array(i);for(c=0;c<i;c++)for(u=0;u<i;u++)d.set(u,c,l.get(u,c));rrt(i,d,g,a),irt(i,o,s,a,d)}this.n=i,this.e=o,this.d=s,this.V=a}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t=this.n,e=this.e,n=this.d,i=new mt(t,t),a,s;for(a=0;a<t;a++){for(s=0;s<t;s++)i.set(a,s,0);i.set(a,a,n[a]),e[a]>0?i.set(a,a+1,e[a]):e[a]<0&&i.set(a,a-1,e[a])}return i}}function ert(r,t,e,n){let i,a,s,o,l,u,c,h;for(l=0;l<r;l++)e[l]=n.get(r-1,l);for(o=r-1;o>0;o--){for(h=0,s=0,u=0;u<o;u++)h=h+Math.abs(e[u]);if(h===0)for(t[o]=e[o-1],l=0;l<o;l++)e[l]=n.get(o-1,l),n.set(o,l,0),n.set(l,o,0);else{for(u=0;u<o;u++)e[u]/=h,s+=e[u]*e[u];for(i=e[o-1],a=Math.sqrt(s),i>0&&(a=-a),t[o]=h*a,s=s-i*a,e[o-1]=i-a,l=0;l<o;l++)t[l]=0;for(l=0;l<o;l++){for(i=e[l],n.set(l,o,i),a=t[l]+n.get(l,l)*i,u=l+1;u<=o-1;u++)a+=n.get(u,l)*e[u],t[u]+=n.get(u,l)*i;t[l]=a}for(i=0,l=0;l<o;l++)t[l]/=s,i+=t[l]*e[l];for(c=i/(s+s),l=0;l<o;l++)t[l]-=c*e[l];for(l=0;l<o;l++){for(i=e[l],a=t[l],u=l;u<=o-1;u++)n.set(u,l,n.get(u,l)-(i*t[u]+a*e[u]));e[l]=n.get(o-1,l),n.set(o,l,0)}}e[o]=s}for(o=0;o<r-1;o++){if(n.set(r-1,o,n.get(o,o)),n.set(o,o,1),s=e[o+1],s!==0){for(u=0;u<=o;u++)e[u]=n.get(u,o+1)/s;for(l=0;l<=o;l++){for(a=0,u=0;u<=o;u++)a+=n.get(u,o+1)*n.get(u,l);for(u=0;u<=o;u++)n.set(u,l,n.get(u,l)-a*e[u])}}for(u=0;u<=o;u++)n.set(u,o+1,0)}for(l=0;l<r;l++)e[l]=n.get(r-1,l),n.set(r-1,l,0);n.set(r-1,r-1,1),t[0]=0}function nrt(r,t,e,n){let i,a,s,o,l,u,c,h,d,g,p,v,m,b,w,x;for(s=1;s<r;s++)t[s-1]=t[s];t[r-1]=0;let _=0,S=0,M=Number.EPSILON;for(u=0;u<r;u++){for(S=Math.max(S,Math.abs(e[u])+Math.abs(t[u])),c=u;c<r&&!(Math.abs(t[c])<=M*S);)c++;if(c>u)do{for(i=e[u],h=(e[u+1]-i)/(2*t[u]),d=Sa(h,1),h<0&&(d=-d),e[u]=t[u]/(h+d),e[u+1]=t[u]*(h+d),g=e[u+1],a=i-e[u],s=u+2;s<r;s++)e[s]-=a;for(_=_+a,h=e[c],p=1,v=p,m=p,b=t[u+1],w=0,x=0,s=c-1;s>=u;s--)for(m=v,v=p,x=w,i=p*t[s],a=p*h,d=Sa(h,t[s]),t[s+1]=w*d,w=t[s]/d,p=h/d,h=p*e[s]-w*i,e[s+1]=a+w*(p*i+w*e[s]),l=0;l<r;l++)a=n.get(l,s+1),n.set(l,s+1,w*n.get(l,s)+p*a),n.set(l,s,p*n.get(l,s)-w*a);h=-w*x*m*b*t[u]/g,t[u]=w*h,e[u]=p*h}while(Math.abs(t[u])>M*S);e[u]=e[u]+_,t[u]=0}for(s=0;s<r-1;s++){for(l=s,h=e[s],o=s+1;o<r;o++)e[o]<h&&(l=o,h=e[o]);if(l!==s)for(e[l]=e[s],e[s]=h,o=0;o<r;o++)h=n.get(o,s),n.set(o,s,n.get(o,l)),n.set(o,l,h)}}function rrt(r,t,e,n){let i=0,a=r-1,s,o,l,u,c,h,d;for(h=i+1;h<=a-1;h++){for(d=0,u=h;u<=a;u++)d=d+Math.abs(t.get(u,h-1));if(d!==0){for(l=0,u=a;u>=h;u--)e[u]=t.get(u,h-1)/d,l+=e[u]*e[u];for(o=Math.sqrt(l),e[h]>0&&(o=-o),l=l-e[h]*o,e[h]=e[h]-o,c=h;c<r;c++){for(s=0,u=a;u>=h;u--)s+=e[u]*t.get(u,c);for(s=s/l,u=h;u<=a;u++)t.set(u,c,t.get(u,c)-s*e[u])}for(u=0;u<=a;u++){for(s=0,c=a;c>=h;c--)s+=e[c]*t.get(u,c);for(s=s/l,c=h;c<=a;c++)t.set(u,c,t.get(u,c)-s*e[c])}e[h]=d*e[h],t.set(h,h-1,d*o)}}for(u=0;u<r;u++)for(c=0;c<r;c++)n.set(u,c,u===c?1:0);for(h=a-1;h>=i+1;h--)if(t.get(h,h-1)!==0){for(u=h+1;u<=a;u++)e[u]=t.get(u,h-1);for(c=h;c<=a;c++){for(o=0,u=h;u<=a;u++)o+=e[u]*n.get(u,c);for(o=o/e[h]/t.get(h,h-1),u=h;u<=a;u++)n.set(u,c,n.get(u,c)+o*e[u])}}}function irt(r,t,e,n,i){let a=r-1,s=0,o=r-1,l=Number.EPSILON,u=0,c=0,h=0,d=0,g=0,p=0,v=0,m=0,b,w,x,_,S,M,k,T,P,O,A,R,L,q,j;for(b=0;b<r;b++)for((b<s||b>o)&&(e[b]=i.get(b,b),t[b]=0),w=Math.max(b-1,0);w<r;w++)c=c+Math.abs(i.get(b,w));for(;a>=s;){for(_=a;_>s&&(p=Math.abs(i.get(_-1,_-1))+Math.abs(i.get(_,_)),p===0&&(p=c),!(Math.abs(i.get(_,_-1))<l*p));)_--;if(_===a)i.set(a,a,i.get(a,a)+u),e[a]=i.get(a,a),t[a]=0,a--,m=0;else if(_===a-1){if(k=i.get(a,a-1)*i.get(a-1,a),h=(i.get(a-1,a-1)-i.get(a,a))/2,d=h*h+k,v=Math.sqrt(Math.abs(d)),i.set(a,a,i.get(a,a)+u),i.set(a-1,a-1,i.get(a-1,a-1)+u),T=i.get(a,a),d>=0){for(v=h>=0?h+v:h-v,e[a-1]=T+v,e[a]=e[a-1],v!==0&&(e[a]=T-k/v),t[a-1]=0,t[a]=0,T=i.get(a,a-1),p=Math.abs(T)+Math.abs(v),h=T/p,d=v/p,g=Math.sqrt(h*h+d*d),h=h/g,d=d/g,w=a-1;w<r;w++)v=i.get(a-1,w),i.set(a-1,w,d*v+h*i.get(a,w)),i.set(a,w,d*i.get(a,w)-h*v);for(b=0;b<=a;b++)v=i.get(b,a-1),i.set(b,a-1,d*v+h*i.get(b,a)),i.set(b,a,d*i.get(b,a)-h*v);for(b=s;b<=o;b++)v=n.get(b,a-1),n.set(b,a-1,d*v+h*n.get(b,a)),n.set(b,a,d*n.get(b,a)-h*v)}else e[a-1]=T+h,e[a]=T+h,t[a-1]=v,t[a]=-v;a=a-2,m=0}else{if(T=i.get(a,a),P=0,k=0,_<a&&(P=i.get(a-1,a-1),k=i.get(a,a-1)*i.get(a-1,a)),m===10){for(u+=T,b=s;b<=a;b++)i.set(b,b,i.get(b,b)-T);p=Math.abs(i.get(a,a-1))+Math.abs(i.get(a-1,a-2)),T=P=.75*p,k=-.4375*p*p}if(m===30&&(p=(P-T)/2,p=p*p+k,p>0)){for(p=Math.sqrt(p),P<T&&(p=-p),p=T-k/((P-T)/2+p),b=s;b<=a;b++)i.set(b,b,i.get(b,b)-p);u+=p,T=P=k=.964}for(m=m+1,S=a-2;S>=_&&(v=i.get(S,S),g=T-v,p=P-v,h=(g*p-k)/i.get(S+1,S)+i.get(S,S+1),d=i.get(S+1,S+1)-v-g-p,g=i.get(S+2,S+1),p=Math.abs(h)+Math.abs(d)+Math.abs(g),h=h/p,d=d/p,g=g/p,!(S===_||Math.abs(i.get(S,S-1))*(Math.abs(d)+Math.abs(g))<l*(Math.abs(h)*(Math.abs(i.get(S-1,S-1))+Math.abs(v)+Math.abs(i.get(S+1,S+1))))));)S--;for(b=S+2;b<=a;b++)i.set(b,b-2,0),b>S+2&&i.set(b,b-3,0);for(x=S;x<=a-1&&(q=x!==a-1,x!==S&&(h=i.get(x,x-1),d=i.get(x+1,x-1),g=q?i.get(x+2,x-1):0,T=Math.abs(h)+Math.abs(d)+Math.abs(g),T!==0&&(h=h/T,d=d/T,g=g/T)),T!==0);x++)if(p=Math.sqrt(h*h+d*d+g*g),h<0&&(p=-p),p!==0){for(x!==S?i.set(x,x-1,-p*T):_!==S&&i.set(x,x-1,-i.get(x,x-1)),h=h+p,T=h/p,P=d/p,v=g/p,d=d/h,g=g/h,w=x;w<r;w++)h=i.get(x,w)+d*i.get(x+1,w),q&&(h=h+g*i.get(x+2,w),i.set(x+2,w,i.get(x+2,w)-h*v)),i.set(x,w,i.get(x,w)-h*T),i.set(x+1,w,i.get(x+1,w)-h*P);for(b=0;b<=Math.min(a,x+3);b++)h=T*i.get(b,x)+P*i.get(b,x+1),q&&(h=h+v*i.get(b,x+2),i.set(b,x+2,i.get(b,x+2)-h*g)),i.set(b,x,i.get(b,x)-h),i.set(b,x+1,i.get(b,x+1)-h*d);for(b=s;b<=o;b++)h=T*n.get(b,x)+P*n.get(b,x+1),q&&(h=h+v*n.get(b,x+2),n.set(b,x+2,n.get(b,x+2)-h*g)),n.set(b,x,n.get(b,x)-h),n.set(b,x+1,n.get(b,x+1)-h*d)}}}if(c!==0){for(a=r-1;a>=0;a--)if(h=e[a],d=t[a],d===0)for(_=a,i.set(a,a,1),b=a-1;b>=0;b--){for(k=i.get(b,b)-h,g=0,w=_;w<=a;w++)g=g+i.get(b,w)*i.get(w,a);if(t[b]<0)v=k,p=g;else if(_=b,t[b]===0?i.set(b,a,k!==0?-g/k:-g/(l*c)):(T=i.get(b,b+1),P=i.get(b+1,b),d=(e[b]-h)*(e[b]-h)+t[b]*t[b],M=(T*p-v*g)/d,i.set(b,a,M),i.set(b+1,a,Math.abs(T)>Math.abs(v)?(-g-k*M)/T:(-p-P*M)/v)),M=Math.abs(i.get(b,a)),l*M*M>1)for(w=b;w<=a;w++)i.set(w,a,i.get(w,a)/M)}else if(d<0)for(_=a-1,Math.abs(i.get(a,a-1))>Math.abs(i.get(a-1,a))?(i.set(a-1,a-1,d/i.get(a,a-1)),i.set(a-1,a,-(i.get(a,a)-h)/i.get(a,a-1))):(j=Ad(0,-i.get(a-1,a),i.get(a-1,a-1)-h,d),i.set(a-1,a-1,j[0]),i.set(a-1,a,j[1])),i.set(a,a-1,0),i.set(a,a,1),b=a-2;b>=0;b--){for(O=0,A=0,w=_;w<=a;w++)O=O+i.get(b,w)*i.get(w,a-1),A=A+i.get(b,w)*i.get(w,a);if(k=i.get(b,b)-h,t[b]<0)v=k,g=O,p=A;else if(_=b,t[b]===0?(j=Ad(-O,-A,k,d),i.set(b,a-1,j[0]),i.set(b,a,j[1])):(T=i.get(b,b+1),P=i.get(b+1,b),R=(e[b]-h)*(e[b]-h)+t[b]*t[b]-d*d,L=(e[b]-h)*2*d,R===0&&L===0&&(R=l*c*(Math.abs(k)+Math.abs(d)+Math.abs(T)+Math.abs(P)+Math.abs(v))),j=Ad(T*g-v*O+d*A,T*p-v*A-d*O,R,L),i.set(b,a-1,j[0]),i.set(b,a,j[1]),Math.abs(T)>Math.abs(v)+Math.abs(d)?(i.set(b+1,a-1,(-O-k*i.get(b,a-1)+d*i.get(b,a))/T),i.set(b+1,a,(-A-k*i.get(b,a)-d*i.get(b,a-1))/T)):(j=Ad(-g-P*i.get(b,a-1),-p-P*i.get(b,a),v,d),i.set(b+1,a-1,j[0]),i.set(b+1,a,j[1]))),M=Math.max(Math.abs(i.get(b,a-1)),Math.abs(i.get(b,a))),l*M*M>1)for(w=b;w<=a;w++)i.set(w,a-1,i.get(w,a-1)/M),i.set(w,a,i.get(w,a)/M)}for(b=0;b<r;b++)if(b<s||b>o)for(w=b;w<r;w++)n.set(b,w,i.get(b,w));for(w=r-1;w>=s;w--)for(b=s;b<=o;b++){for(v=0,x=s;x<=Math.min(w,o);x++)v=v+n.get(b,x)*i.get(x,w);n.set(b,w,v)}}}function Ad(r,t,e,n){let i,a;return Math.abs(e)>Math.abs(n)?(i=n/e,a=e+i*n,[(r+i*t)/a,(t-i*r)/a]):(i=e/n,a=n+i*e,[(i*r+t)/a,(i*t-r)/a])}class ND{constructor(t){if(t=Yr.checkMatrix(t),!t.isSymmetric())throw new Error("Matrix is not symmetric");let e=t,n=e.rows,i=new mt(n,n),a=!0,s,o,l;for(o=0;o<n;o++){let u=0;for(l=0;l<o;l++){let c=0;for(s=0;s<l;s++)c+=i.get(l,s)*i.get(o,s);c=(e.get(o,l)-c)/i.get(l,l),i.set(o,l,c),u=u+c*c}for(u=e.get(o,o)-u,a&&(a=u>0),i.set(o,o,Math.sqrt(Math.max(u,0))),l=o+1;l<n;l++)i.set(o,l,0)}this.L=i,this.positiveDefinite=a}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=Yr.checkMatrix(t);let e=this.L,n=e.rows;if(t.rows!==n)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");let i=t.columns,a=t.clone(),s,o,l;for(l=0;l<n;l++)for(o=0;o<i;o++){for(s=0;s<l;s++)a.set(l,o,a.get(l,o)-a.get(s,o)*e.get(l,s));a.set(l,o,a.get(l,o)/e.get(l,l))}for(l=n-1;l>=0;l--)for(o=0;o<i;o++){for(s=l+1;s<n;s++)a.set(l,o,a.get(l,o)-a.get(s,o)*e.get(s,l));a.set(l,o,a.get(l,o)/e.get(l,l))}return a}get lowerTriangularMatrix(){return this.L}}class RD{constructor(t,e={}){t=Yr.checkMatrix(t);let{Y:n}=e;const{scaleScores:i=!1,maxIterations:a=1e3,terminationCriteria:s=1e-10}=e;let o;if(n){if(_r.isAnyArray(n)&&typeof n[0]=="number"?n=mt.columnVector(n):n=Yr.checkMatrix(n),n.rows!==t.rows)throw new Error("Y should have the same number of rows as X");o=n.getColumnVector(0)}else o=t.getColumnVector(0);let l=1,u,c,h,d;for(let g=0;g<a&&l>s;g++)h=t.transpose().mmul(o).div(o.transpose().mmul(o).get(0,0)),h=h.div(h.norm()),u=t.mmul(h).div(h.transpose().mmul(h).get(0,0)),g>0&&(l=u.clone().sub(d).pow(2).sum()),d=u.clone(),n?(c=n.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),c=c.div(c.norm()),o=n.mmul(c).div(c.transpose().mmul(c).get(0,0))):o=u;if(n){let g=t.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0));g=g.div(g.norm());let p=t.clone().sub(u.clone().mmul(g.transpose())),v=o.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),m=n.clone().sub(u.clone().mulS(v.get(0,0)).mmul(c.transpose()));this.t=u,this.p=g.transpose(),this.w=h.transpose(),this.q=c,this.u=o,this.s=u.transpose().mmul(u),this.xResidual=p,this.yResidual=m,this.betas=v}else this.w=h.transpose(),this.s=u.transpose().mmul(u).sqrt(),i?this.t=u.clone().div(this.s.get(0,0)):this.t=u,this.xResidual=t.sub(u.mmul(h.transpose()))}}ne.AbstractMatrix=Gt;ne.CHO=ND;ne.CholeskyDecomposition=ND;ne.DistanceMatrix=Fg;ne.EVD=PD;ne.EigenvalueDecomposition=PD;ne.LU=Bg;ne.LuDecomposition=Bg;var LD=ne.Matrix=mt;ne.MatrixColumnSelectionView=$nt;ne.MatrixColumnView=znt;ne.MatrixFlipColumnView=jnt;ne.MatrixFlipRowView=qnt;ne.MatrixRowSelectionView=Gnt;ne.MatrixRowView=Wnt;ne.MatrixSelectionView=ef;ne.MatrixSubView=Vnt;ne.MatrixTransposeView=Hnt;ne.NIPALS=RD;ne.Nipals=RD;ne.QR=gE;ne.QrDecomposition=gE;ne.SVD=Jl;var art=ne.SingularValueDecomposition=Jl;ne.SymmetricMatrix=Co;ne.WrapperMatrix1D=CD;ne.WrapperMatrix2D=Yr;ne.correlation=trt;ne.covariance=Qnt;var Dk=ne.default=mt;ne.determinant=nf;ne.inverse=Ynt;ne.linearDependencies=Znt;ne.pseudoInverse=Jnt;ne.solve=AD;ne.wrap=Unt;const Ts=LD,ID=art;Dk.Matrix&&Dk.Matrix;const srt={center:[0,0],linkDistance:50};class DD{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},srt),t)}execute(t,e){return Vt(this,void 0,void 0,function*(){return this.genericMDSLayout(!1,t,e)})}assign(t,e){return Vt(this,void 0,void 0,function*(){yield this.genericMDSLayout(!0,t,e)})}genericMDSLayout(t,e,n){return Vt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a=[0,0],linkDistance:s=50}=i,o=e.getAllNodes(),l=e.getAllEdges();if(!(o!=null&&o.length)||o.length===1)return Ho(e,t,a);const u=ED({nodes:o,edges:l}),c=xD(u);ort(c);const h=set(c,s),d=lrt(h),g=[];return d.forEach((v,m)=>{const b=Wr(o[m]);b.data.x=v[0]+a[0],b.data.y=v[1]+a[1],g.push(b)}),t&&g.forEach(v=>e.mergeNodeData(v.id,{x:v.data.x,y:v.data.y})),{nodes:g,edges:l}})}}const ort=r=>{let t=-999999;r.forEach(e=>{e.forEach(n=>{n!==1/0&&t<n&&(t=n)})}),r.forEach((e,n)=>{e.forEach((i,a)=>{i===1/0&&(r[n][a]=t)})})},lrt=r=>{const e=Ts.mul(Ts.pow(r,2),-.5),n=e.mean("row"),i=e.mean("column"),a=e.mean();e.add(a).subRowVector(n).subColumnVector(i);const s=new ID(e),o=Ts.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map(l=>Ts.mul([l],[o]).toJSON()[0].splice(0,2))};function Qw(r){return!!r.tick&&!!r.stop}const urt={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},crt={center:[0,0],comboPadding:10,treeKey:"combo"};class hrt{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},crt),t)}execute(t,e){return Vt(this,void 0,void 0,function*(){return this.genericComboCombinedLayout(!1,t,e)})}assign(t,e){return Vt(this,void 0,void 0,function*(){yield this.genericComboCombinedLayout(!0,t,e)})}genericComboCombinedLayout(t,e,n){return Vt(this,void 0,void 0,function*(){const i=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:a,treeKey:s,outerLayout:o}=i,l=e.getAllNodes().filter(T=>!T.data._isCombo),u=e.getAllNodes().filter(T=>T.data._isCombo),c=e.getAllEdges(),h=l==null?void 0:l.length;if(!h||h===1)return Ho(e,t,a);const d=[],g=new Map;l.forEach(T=>{g.set(T.id,T)});const p=new Map;u.forEach(T=>{p.set(T.id,T)});const v=new Map,m=this.getInnerGraphs(e,s,g,p,c,i,v);yield Promise.all(m);const b=new Map,w=[],x=new Map;let _=!0;e.getRoots(s).forEach(T=>{const P=v.get(T.id),O=p.get(T.id)||g.get(T.id),A={id:T.id,data:Object.assign(Object.assign({},T.data),{x:P.data.x||O.data.x,y:P.data.y||O.data.y,fx:P.data.fx||O.data.fx,fy:P.data.fy||O.data.fy,mass:P.data.mass||O.data.mass,size:P.data.size})};w.push(A),b.set(T.id,!0),!isNaN(A.data.x)&&A.data.x!==0&&!isNaN(A.data.y)&&A.data.y!==0?_=!1:(A.data.x=Math.random()*100,A.data.y=Math.random()*100),Yw(e,[T],R=>{R.id!==T.id&&x.set(R.id,T.id)},"TB",s)});const S=[];c.forEach(T=>{const P=x.get(T.source)||T.source,O=x.get(T.target)||T.target;P!==O&&b.has(P)&&b.has(O)&&S.push({id:T.id,source:P,target:O,data:{}})});let M;if(w!=null&&w.length){if(w.length===1)w[0].data.x=a[0],w[0].data.y=a[1];else{const T=new Mn({nodes:w,edges:S}),P=o||new kD;_&&urt[P.id]&&(yield(w.length<100?new DD:new Kw).assign(T));const O=Object.assign({center:a,kg:5,preventOverlap:!0,animate:!1},P.id==="force"?{gravity:1,factor:4,linkDistance:(A,R,L)=>{const q=Math.max(...R.data.size)||32,j=Math.max(...L.data.size)||32;return q/2+j/2+200}}:{});M=yield Fk(P,T,O)}v.forEach(T=>{var P;const O=M.nodes.find(L=>L.id===T.id);if(O){const{x:L,y:q}=O.data;T.data.visited=!0,T.data.x=L,T.data.y=q,d.push({id:T.id,data:{x:L,y:q}})}const{x:A,y:R}=T.data;(P=T.data.nodes)===null||P===void 0||P.forEach(L=>{d.push({id:L.id,data:{x:L.data.x+A,y:L.data.y+R}})})}),v.forEach(({data:T})=>{const{x:P,y:O,visited:A,nodes:R}=T;R==null||R.forEach(L=>{if(!A){const q=d.find(j=>j.id===L.id);q.data.x+=P||0,q.data.y+=O||0}})})}return t&&d.forEach(T=>{e.mergeNodeData(T.id,{x:T.data.x,y:T.data.y})}),{nodes:d,edges:c}})}initVals(t){const e=Object.assign({},t),{nodeSize:n,spacing:i,comboPadding:a}=t;let s,o;if(yt(i)?o=()=>i:Et(i)?o=i:o=()=>0,e.spacing=o,!n)s=u=>{const c=o(u);return u.size?Ca(u.size)?((u.size[0]>u.size[1]?u.size[0]:u.size[1])+c)/2:an(u.size)?((u.size.width>u.size.height?u.size.width:u.size.height)+c)/2:(u.size+c)/2:32+c/2};else if(Et(n))s=u=>{const c=n(u),h=o(u);return Ca(u.size)?((u.size[0]>u.size[1]?u.size[0]:u.size[1])+h)/2:((c||32)+h)/2};else if(Ca(n)){const c=(n[0]>n[1]?n[0]:n[1])/2;s=h=>c+o(h)/2}else{const u=n/2;s=c=>u+o(c)/2}e.nodeSize=s;let l;return yt(a)?l=()=>a:Ca(a)?l=()=>Math.max.apply(null,a):Et(a)?l=a:l=()=>0,e.comboPadding=l,e}getInnerGraphs(t,e,n,i,a,s,o){const{nodeSize:l,comboPadding:u,spacing:c,innerLayout:h}=s,d=h||new Kw({}),g={center:[0,0],preventOverlap:!0,nodeSpacing:c},p=[],v=m=>{let b=(u==null?void 0:u(m))||10;return Ca(b)&&(b=Math.max(...b)),{size:b?[b*2,b*2]:[30,30],padding:b}};return t.getRoots(e).forEach(m=>{o.set(m.id,{id:m.id,data:{nodes:[],size:v(m).size}});let b=Promise.resolve();Yw(t,[m],w=>{var x;if(!w.data._isCombo)return;const{size:_,padding:S}=v(w);if(!(!((x=t.getChildren(w.id,e))===null||x===void 0)&&x.length))o.set(w.id,{id:w.id,data:Object.assign(Object.assign({},w.data),{size:_})});else{const M=o.get(w.id);o.set(w.id,{id:w.id,data:Object.assign({nodes:[]},M==null?void 0:M.data)});const k=new Map,T=t.getChildren(w.id,e).map(A=>{if(A.data._isCombo)return o.has(A.id)||o.set(A.id,{id:A.id,data:Object.assign({},A.data)}),k.set(A.id,!0),o.get(A.id);const R=n.get(A.id)||i.get(A.id);return k.set(A.id,!0),{id:A.id,data:Object.assign(Object.assign({},R.data),A.data)}}),P={nodes:T,edges:a.filter(A=>k.has(A.source)&&k.has(A.target))};let O=1/0;T.forEach(A=>{var R;let{size:L}=A.data;L||(L=((R=o.get(A.id))===null||R===void 0?void 0:R.data.size)||(l==null?void 0:l(A))||[30,30]),yt(L)&&(L=[L,L]);const[q,j]=L;O>q&&(O=q),O>j&&(O=j),A.data.size=L}),b=b.then(()=>Vt(this,void 0,void 0,function*(){const A=new Mn(P);yield Fk(d,A,g,!0);const{minX:R,minY:L,maxX:q,maxY:j}=oet(T),$={x:(q+R)/2,y:(j+L)/2};P.nodes.forEach(F=>{F.data.x-=$.x,F.data.y-=$.y});const B=[Math.max(q-R,O)+S*2,Math.max(j-L,O)+S*2];o.get(w.id).data.size=B,o.get(w.id).data.nodes=T}))}return!0},"BT",e),p.push(b)}),p}}function Fk(r,t,e,n){var i;return Vt(this,void 0,void 0,function*(){return Qw(r)?(r.execute(t,e),r.stop(),r.tick((i=e.iterations)!==null&&i!==void 0?i:300)):n?yield r.assign(t,e):yield r.execute(t,e)})}function drt(r,t){var e,n=1;r==null&&(r=0),t==null&&(t=0);function i(){var a,s=e.length,o,l=0,u=0;for(a=0;a<s;++a)o=e[a],l+=o.x,u+=o.y;for(l=(l/s-r)*n,u=(u/s-t)*n,a=0;a<s;++a)o=e[a],o.x-=l,o.y-=u}return i.initialize=function(a){e=a},i.x=function(a){return arguments.length?(r=+a,i):r},i.y=function(a){return arguments.length?(t=+a,i):t},i.strength=function(a){return arguments.length?(n=+a,i):n},i}function En(r){return function(){return r}}function Os(r){return(r()-.5)*1e-6}function frt(r){return r.x+r.vx}function grt(r){return r.y+r.vy}function prt(r){var t,e,n,i=1,a=1;typeof r!="function"&&(r=En(r==null?1:+r));function s(){for(var u,c=t.length,h,d,g,p,v,m,b=0;b<a;++b)for(h=Ig(t,frt,grt).visitAfter(o),u=0;u<c;++u)d=t[u],v=e[d.index],m=v*v,g=d.x+d.vx,p=d.y+d.vy,h.visit(w);function w(x,_,S,M,k){var T=x.data,P=x.r,O=v+P;if(T){if(T.index>d.index){var A=g-T.x-T.vx,R=p-T.y-T.vy,L=A*A+R*R;L<O*O&&(A===0&&(A=Os(n),L+=A*A),R===0&&(R=Os(n),L+=R*R),L=(O-(L=Math.sqrt(L)))/L*i,d.vx+=(A*=L)*(O=(P*=P)/(m+P)),d.vy+=(R*=L)*O,T.vx-=A*(O=1-O),T.vy-=R*O)}return}return _>g+O||M<g-O||S>p+O||k<p-O}}function o(u){if(u.data)return u.r=e[u.data.index];for(var c=u.r=0;c<4;++c)u[c]&&u[c].r>u.r&&(u.r=u[c].r)}function l(){if(t){var u,c=t.length,h;for(e=new Array(c),u=0;u<c;++u)h=t[u],e[h.index]=+r(h,u,t)}}return s.initialize=function(u,c){t=u,n=c,l()},s.iterations=function(u){return arguments.length?(a=+u,s):a},s.strength=function(u){return arguments.length?(i=+u,s):i},s.radius=function(u){return arguments.length?(r=typeof u=="function"?u:En(+u),l(),s):r},s}function vrt(r){return r.index}function Bk(r,t){var e=r.get(t);if(!e)throw new Error("node not found: "+t);return e}function mrt(r){var t=vrt,e=h,n,i=En(30),a,s,o,l,u,c=1;r==null&&(r=[]);function h(m){return 1/Math.min(o[m.source.index],o[m.target.index])}function d(m){for(var b=0,w=r.length;b<c;++b)for(var x=0,_,S,M,k,T,P,O;x<w;++x)_=r[x],S=_.source,M=_.target,k=M.x+M.vx-S.x-S.vx||Os(u),T=M.y+M.vy-S.y-S.vy||Os(u),P=Math.sqrt(k*k+T*T),P=(P-a[x])/P*m*n[x],k*=P,T*=P,M.vx-=k*(O=l[x]),M.vy-=T*O,S.vx+=k*(O=1-O),S.vy+=T*O}function g(){if(s){var m,b=s.length,w=r.length,x=new Map(s.map((S,M)=>[t(S,M,s),S])),_;for(m=0,o=new Array(b);m<w;++m)_=r[m],_.index=m,typeof _.source!="object"&&(_.source=Bk(x,_.source)),typeof _.target!="object"&&(_.target=Bk(x,_.target)),o[_.source.index]=(o[_.source.index]||0)+1,o[_.target.index]=(o[_.target.index]||0)+1;for(m=0,l=new Array(w);m<w;++m)_=r[m],l[m]=o[_.source.index]/(o[_.source.index]+o[_.target.index]);n=new Array(w),p(),a=new Array(w),v()}}function p(){if(s)for(var m=0,b=r.length;m<b;++m)n[m]=+e(r[m],m,r)}function v(){if(s)for(var m=0,b=r.length;m<b;++m)a[m]=+i(r[m],m,r)}return d.initialize=function(m,b){s=m,u=b,g()},d.links=function(m){return arguments.length?(r=m,g(),d):r},d.id=function(m){return arguments.length?(t=m,d):t},d.iterations=function(m){return arguments.length?(c=+m,d):c},d.strength=function(m){return arguments.length?(e=typeof m=="function"?m:En(+m),p(),d):e},d.distance=function(m){return arguments.length?(i=typeof m=="function"?m:En(+m),v(),d):i},d}var yrt={value:()=>{}};function FD(){for(var r=0,t=arguments.length,e={},n;r<t;++r){if(!(n=arguments[r]+"")||n in e||/[\s.]/.test(n))throw new Error("illegal type: "+n);e[n]=[]}return new rf(e)}function rf(r){this._=r}function brt(r,t){return r.trim().split(/^|\s+/).map(function(e){var n="",i=e.indexOf(".");if(i>=0&&(n=e.slice(i+1),e=e.slice(0,i)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}})}rf.prototype=FD.prototype={constructor:rf,on:function(r,t){var e=this._,n=brt(r+"",e),i,a=-1,s=n.length;if(arguments.length<2){for(;++a<s;)if((i=(r=n[a]).type)&&(i=wrt(e[i],r.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<s;)if(i=(r=n[a]).type)e[i]=zk(e[i],r.name,t);else if(t==null)for(i in e)e[i]=zk(e[i],r.name,null);return this},copy:function(){var r={},t=this._;for(var e in t)r[e]=t[e].slice();return new rf(r)},call:function(r,t){if((i=arguments.length-2)>0)for(var e=new Array(i),n=0,i,a;n<i;++n)e[n]=arguments[n+2];if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(a=this._[r],n=0,i=a.length;n<i;++n)a[n].value.apply(t,e)},apply:function(r,t,e){if(!this._.hasOwnProperty(r))throw new Error("unknown type: "+r);for(var n=this._[r],i=0,a=n.length;i<a;++i)n[i].value.apply(t,e)}};function wrt(r,t){for(var e=0,n=r.length,i;e<n;++e)if((i=r[e]).name===t)return i.value}function zk(r,t,e){for(var n=0,i=r.length;n<i;++n)if(r[n].name===t){r[n]=yrt,r=r.slice(0,n).concat(r.slice(n+1));break}return e!=null&&r.push({name:t,value:e}),r}var Hl=0,$u=0,Cu=0,BD=1e3,zf,ju,$f=0,zo=0,zg=0,wc=typeof performance=="object"&&performance.now?performance:Date,zD=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function $D(){return zo||(zD(xrt),zo=wc.now()+zg)}function xrt(){zo=0}function tx(){this._call=this._time=this._next=null}tx.prototype=jD.prototype={constructor:tx,restart:function(r,t,e){if(typeof r!="function")throw new TypeError("callback is not a function");e=(e==null?$D():+e)+(t==null?0:+t),!this._next&&ju!==this&&(ju?ju._next=this:zf=this,ju=this),this._call=r,this._time=e,ex()},stop:function(){this._call&&(this._call=null,this._time=1/0,ex())}};function jD(r,t,e){var n=new tx;return n.restart(r,t,e),n}function Ert(){$D(),++Hl;for(var r=zf,t;r;)(t=zo-r._time)>=0&&r._call.call(void 0,t),r=r._next;--Hl}function $k(){zo=($f=wc.now())+zg,Hl=$u=0;try{Ert()}finally{Hl=0,Srt(),zo=0}}function _rt(){var r=wc.now(),t=r-$f;t>BD&&(zg-=t,$f=r)}function Srt(){for(var r,t=zf,e,n=1/0;t;)t._call?(n>t._time&&(n=t._time),r=t,t=t._next):(e=t._next,t._next=null,t=r?r._next=e:zf=e);ju=r,ex(n)}function ex(r){if(!Hl){$u&&($u=clearTimeout($u));var t=r-zo;t>24?(r<1/0&&($u=setTimeout($k,r-wc.now()-zg)),Cu&&(Cu=clearInterval(Cu))):(Cu||($f=wc.now(),Cu=setInterval(_rt,BD)),Hl=1,zD($k))}}const Mrt=1664525,krt=1013904223,jk=4294967296;function Trt(){let r=1;return()=>(r=(Mrt*r+krt)%jk)/jk}function Ort(r){return r.x}function Crt(r){return r.y}var Art=10,Prt=Math.PI*(3-Math.sqrt(5));function Nrt(r){var t,e=1,n=.001,i=1-Math.pow(n,1/300),a=0,s=.6,o=new Map,l=jD(h),u=FD("tick","end"),c=Trt();r==null&&(r=[]);function h(){d(),u.call("tick",t),e<n&&(l.stop(),u.call("end",t))}function d(v){var m,b=r.length,w;v===void 0&&(v=1);for(var x=0;x<v;++x)for(e+=(a-e)*i,o.forEach(function(_){_(e)}),m=0;m<b;++m)w=r[m],w.fx==null?w.x+=w.vx*=s:(w.x=w.fx,w.vx=0),w.fy==null?w.y+=w.vy*=s:(w.y=w.fy,w.vy=0);return t}function g(){for(var v=0,m=r.length,b;v<m;++v){if(b=r[v],b.index=v,b.fx!=null&&(b.x=b.fx),b.fy!=null&&(b.y=b.fy),isNaN(b.x)||isNaN(b.y)){var w=Art*Math.sqrt(.5+v),x=v*Prt;b.x=w*Math.cos(x),b.y=w*Math.sin(x)}(isNaN(b.vx)||isNaN(b.vy))&&(b.vx=b.vy=0)}}function p(v){return v.initialize&&v.initialize(r,c),v}return g(),t={tick:d,restart:function(){return l.restart(h),t},stop:function(){return l.stop(),t},nodes:function(v){return arguments.length?(r=v,g(),o.forEach(p),t):r},alpha:function(v){return arguments.length?(e=+v,t):e},alphaMin:function(v){return arguments.length?(n=+v,t):n},alphaDecay:function(v){return arguments.length?(i=+v,t):+i},alphaTarget:function(v){return arguments.length?(a=+v,t):a},velocityDecay:function(v){return arguments.length?(s=1-v,t):1-s},randomSource:function(v){return arguments.length?(c=v,o.forEach(p),t):c},force:function(v,m){return arguments.length>1?(m==null?o.delete(v):o.set(v,p(m)),t):o.get(v)},find:function(v,m,b){var w=0,x=r.length,_,S,M,k,T;for(b==null?b=1/0:b*=b,w=0;w<x;++w)k=r[w],_=v-k.x,S=m-k.y,M=_*_+S*S,M<b&&(T=k,b=M);return T},on:function(v,m){return arguments.length>1?(u.on(v,m),t):u.on(v)}}}function Rrt(){var r,t,e,n,i=En(-30),a,s=1,o=1/0,l=.81;function u(g){var p,v=r.length,m=Ig(r,Ort,Crt).visitAfter(h);for(n=g,p=0;p<v;++p)t=r[p],m.visit(d)}function c(){if(r){var g,p=r.length,v;for(a=new Array(p),g=0;g<p;++g)v=r[g],a[v.index]=+i(v,g,r)}}function h(g){var p=0,v,m,b=0,w,x,_;if(g.length){for(w=x=_=0;_<4;++_)(v=g[_])&&(m=Math.abs(v.value))&&(p+=v.value,b+=m,w+=m*v.x,x+=m*v.y);g.x=w/b,g.y=x/b}else{v=g,v.x=v.data.x,v.y=v.data.y;do p+=a[v.data.index];while(v=v.next)}g.value=p}function d(g,p,v,m){if(!g.value)return!0;var b=g.x-t.x,w=g.y-t.y,x=m-p,_=b*b+w*w;if(x*x/l<_)return _<o&&(b===0&&(b=Os(e),_+=b*b),w===0&&(w=Os(e),_+=w*w),_<s&&(_=Math.sqrt(s*_)),t.vx+=b*g.value*n/_,t.vy+=w*g.value*n/_),!0;if(g.length||_>=o)return;(g.data!==t||g.next)&&(b===0&&(b=Os(e),_+=b*b),w===0&&(w=Os(e),_+=w*w),_<s&&(_=Math.sqrt(s*_)));do g.data!==t&&(x=a[g.data.index]*n/_,t.vx+=b*x,t.vy+=w*x);while(g=g.next)}return u.initialize=function(g,p){r=g,e=p,c()},u.strength=function(g){return arguments.length?(i=typeof g=="function"?g:En(+g),c(),u):i},u.distanceMin=function(g){return arguments.length?(s=g*g,u):Math.sqrt(s)},u.distanceMax=function(g){return arguments.length?(o=g*g,u):Math.sqrt(o)},u.theta=function(g){return arguments.length?(l=g*g,u):Math.sqrt(l)},u}function Lrt(r,t,e){var n,i=En(.1),a,s;typeof r!="function"&&(r=En(+r)),t==null&&(t=0),e==null&&(e=0);function o(u){for(var c=0,h=n.length;c<h;++c){var d=n[c],g=d.x-t||1e-6,p=d.y-e||1e-6,v=Math.sqrt(g*g+p*p),m=(s[c]-v)*a[c]*u/v;d.vx+=g*m,d.vy+=p*m}}function l(){if(n){var u,c=n.length;for(a=new Array(c),s=new Array(c),u=0;u<c;++u)s[u]=+r(n[u],u,n),a[u]=isNaN(s[u])?0:+i(n[u],u,n)}}return o.initialize=function(u){n=u,l()},o.strength=function(u){return arguments.length?(i=typeof u=="function"?u:En(+u),l(),o):i},o.radius=function(u){return arguments.length?(r=typeof u=="function"?u:En(+u),l(),o):r},o.x=function(u){return arguments.length?(t=+u,o):t},o.y=function(u){return arguments.length?(e=+u,o):e},o}function Irt(r){var t=En(.1),e,n,i;typeof r!="function"&&(r=En(r==null?0:+r));function a(o){for(var l=0,u=e.length,c;l<u;++l)c=e[l],c.vx+=(i[l]-c.x)*n[l]*o}function s(){if(e){var o,l=e.length;for(n=new Array(l),i=new Array(l),o=0;o<l;++o)n[o]=isNaN(i[o]=+r(e[o],o,e))?0:+t(e[o],o,e)}}return a.initialize=function(o){e=o,s()},a.strength=function(o){return arguments.length?(t=typeof o=="function"?o:En(+o),s(),a):t},a.x=function(o){return arguments.length?(r=typeof o=="function"?o:En(+o),s(),a):r},a}function Drt(r){var t=En(.1),e,n,i;typeof r!="function"&&(r=En(r==null?0:+r));function a(o){for(var l=0,u=e.length,c;l<u;++l)c=e[l],c.vy+=(i[l]-c.y)*n[l]*o}function s(){if(e){var o,l=e.length;for(n=new Array(l),i=new Array(l),o=0;o<l;++o)n[o]=isNaN(i[o]=+r(e[o],o,e))?0:+t(e[o],o,e)}}return a.initialize=function(o){e=o,s()},a.strength=function(o){return arguments.length?(t=typeof o=="function"?o:En(+o),s(),a):t},a.y=function(o){return arguments.length?(r=typeof o=="function"?o:En(+o),s(),a):r},a}class Frt{constructor(t){this.id="d3-force",this.config={inputNodeAttrs:["x","y","vx","vy","fx","fy"],outputNodeAttrs:["x","y","vx","vy"],simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.forceMap={link:mrt,manyBody:Rrt,center:drt,collide:prt,radial:Lrt,x:Irt,y:Drt},this.options={link:{id:e=>e.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},cr(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(t,e){return Vt(this,void 0,void 0,function*(){return this.genericLayout(!1,t,e)})}assign(t,e){return Vt(this,void 0,void 0,function*(){yield this.genericLayout(!0,t,e)})}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(t,e){const n=this.context.nodes.find(i=>i.id===t);n&&e.forEach((i,a)=>{if(typeof i=="number"||i===null){const s=["fx","fy","fz"][a];n[s]=i}})}getOptions(t){var e,n;const i=cr({},this.options,t);return i.collide&&((e=i.collide)===null||e===void 0?void 0:e.radius)===void 0&&(i.collide=i.collide||{},i.collide.radius=(n=i.nodeSize)!==null&&n!==void 0?n:10),i.iterations===void 0&&(i.link&&i.link.iterations===void 0&&(i.iterations=i.link.iterations),i.collide&&i.collide.iterations===void 0&&(i.iterations=i.collide.iterations)),this.context.options=i,i}genericLayout(t,e,n){var i;return Vt(this,void 0,void 0,function*(){const a=this.getOptions(n),s=e.getAllNodes().map(({id:c,data:h})=>Object.assign(Object.assign({id:c},h),No(h.data,this.config.inputNodeAttrs))),o=e.getAllEdges().map(c=>Object.assign({},c));Object.assign(this.context,{assign:t,nodes:s,edges:o,graph:e});const l=new Promise(c=>{this.resolver=c}),u=this.setSimulation(a);return u.nodes(s),(i=u.force("link"))===null||i===void 0||i.links(o),l})}getResult(){const{assign:t,nodes:e,edges:n,graph:i}=this.context,a=e.map(o=>({id:o.id,data:Object.assign(Object.assign({},o.data),No(o,this.config.outputNodeAttrs))})),s=n.map(({id:o,source:l,target:u,data:c})=>({id:o,source:typeof l=="object"?l.id:l,target:typeof u=="object"?u.id:u,data:c}));return t&&a.forEach(o=>i.mergeNodeData(o.id,o.data)),{nodes:a,edges:s}}initSimulation(){return Nrt()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",()=>{var n;return(n=t.onTick)===null||n===void 0?void 0:n.call(t,this.getResult())}).on("end",()=>{var n;return(n=this.resolver)===null||n===void 0?void 0:n.call(this,this.getResult())})),qk(e,this.config.simulationAttrs.map(n=>[n,t[n]])),Object.entries(this.forceMap).forEach(([n,i])=>{const a=n;if(t[n]){let s=e.force(a);s||(s=i(),e.force(a,s)),qk(s,Object.entries(t[a]))}else e.force(a,null)}),e}}const qk=(r,t)=>t.reduce((e,[n,i])=>!e[n]||i===void 0?e:e[n].call(r,i),r);var Yv,Wk;function Brt(){if(Wk)return Yv;Wk=1;function r(){this.__data__=[],this.size=0}return Yv=r,Yv}var Xv,Gk;function Ql(){if(Gk)return Xv;Gk=1;function r(t,e){return t===e||t!==t&&e!==e}return Xv=r,Xv}var Kv,Vk;function $g(){if(Vk)return Kv;Vk=1;var r=Ql();function t(e,n){for(var i=e.length;i--;)if(r(e[i][0],n))return i;return-1}return Kv=t,Kv}var Zv,Hk;function zrt(){if(Hk)return Zv;Hk=1;var r=$g(),t=Array.prototype,e=t.splice;function n(i){var a=this.__data__,s=r(a,i);if(s<0)return!1;var o=a.length-1;return s==o?a.pop():e.call(a,s,1),--this.size,!0}return Zv=n,Zv}var Jv,Uk;function $rt(){if(Uk)return Jv;Uk=1;var r=$g();function t(e){var n=this.__data__,i=r(n,e);return i<0?void 0:n[i][1]}return Jv=t,Jv}var Qv,Yk;function jrt(){if(Yk)return Qv;Yk=1;var r=$g();function t(e){return r(this.__data__,e)>-1}return Qv=t,Qv}var tm,Xk;function qrt(){if(Xk)return tm;Xk=1;var r=$g();function t(e,n){var i=this.__data__,a=r(i,e);return a<0?(++this.size,i.push([e,n])):i[a][1]=n,this}return tm=t,tm}var em,Kk;function jg(){if(Kk)return em;Kk=1;var r=Brt(),t=zrt(),e=$rt(),n=jrt(),i=qrt();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=e,a.prototype.has=n,a.prototype.set=i,em=a,em}var nm,Zk;function Wrt(){if(Zk)return nm;Zk=1;var r=jg();function t(){this.__data__=new r,this.size=0}return nm=t,nm}var rm,Jk;function Grt(){if(Jk)return rm;Jk=1;function r(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}return rm=r,rm}var im,Qk;function Vrt(){if(Qk)return im;Qk=1;function r(t){return this.__data__.get(t)}return im=r,im}var am,tT;function Hrt(){if(tT)return am;tT=1;function r(t){return this.__data__.has(t)}return am=r,am}var sm,eT;function qD(){if(eT)return sm;eT=1;var r=typeof Ma=="object"&&Ma&&Ma.Object===Object&&Ma;return sm=r,sm}var om,nT;function Fi(){if(nT)return om;nT=1;var r=qD(),t=typeof self=="object"&&self&&self.Object===Object&&self,e=r||t||Function("return this")();return om=e,om}var lm,rT;function tu(){if(rT)return lm;rT=1;var r=Fi(),t=r.Symbol;return lm=t,lm}var um,iT;function Urt(){if(iT)return um;iT=1;var r=tu(),t=Object.prototype,e=t.hasOwnProperty,n=t.toString,i=r?r.toStringTag:void 0;function a(s){var o=e.call(s,i),l=s[i];try{s[i]=void 0;var u=!0}catch{}var c=n.call(s);return u&&(o?s[i]=l:delete s[i]),c}return um=a,um}var cm,aT;function Yrt(){if(aT)return cm;aT=1;var r=Object.prototype,t=r.toString;function e(n){return t.call(n)}return cm=e,cm}var hm,sT;function Uo(){if(sT)return hm;sT=1;var r=tu(),t=Urt(),e=Yrt(),n="[object Null]",i="[object Undefined]",a=r?r.toStringTag:void 0;function s(o){return o==null?o===void 0?i:n:a&&a in Object(o)?t(o):e(o)}return hm=s,hm}var dm,oT;function mi(){if(oT)return dm;oT=1;function r(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}return dm=r,dm}var fm,lT;function Gc(){if(lT)return fm;lT=1;var r=Uo(),t=mi(),e="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function s(o){if(!t(o))return!1;var l=r(o);return l==n||l==i||l==e||l==a}return fm=s,fm}var gm,uT;function Xrt(){if(uT)return gm;uT=1;var r=Fi(),t=r["__core-js_shared__"];return gm=t,gm}var pm,cT;function Krt(){if(cT)return pm;cT=1;var r=Xrt(),t=function(){var n=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function e(n){return!!t&&t in n}return pm=e,pm}var vm,hT;function WD(){if(hT)return vm;hT=1;var r=Function.prototype,t=r.toString;function e(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return vm=e,vm}var mm,dT;function Zrt(){if(dT)return mm;dT=1;var r=Gc(),t=Krt(),e=mi(),n=WD(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,l=s.toString,u=o.hasOwnProperty,c=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function h(d){if(!e(d)||t(d))return!1;var g=r(d)?c:a;return g.test(n(d))}return mm=h,mm}var ym,fT;function Jrt(){if(fT)return ym;fT=1;function r(t,e){return t==null?void 0:t[e]}return ym=r,ym}var bm,gT;function Yo(){if(gT)return bm;gT=1;var r=Zrt(),t=Jrt();function e(n,i){var a=t(n,i);return r(a)?a:void 0}return bm=e,bm}var wm,pT;function pE(){if(pT)return wm;pT=1;var r=Yo(),t=Fi(),e=r(t,"Map");return wm=e,wm}var xm,vT;function qg(){if(vT)return xm;vT=1;var r=Yo(),t=r(Object,"create");return xm=t,xm}var Em,mT;function Qrt(){if(mT)return Em;mT=1;var r=qg();function t(){this.__data__=r?r(null):{},this.size=0}return Em=t,Em}var _m,yT;function tit(){if(yT)return _m;yT=1;function r(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}return _m=r,_m}var Sm,bT;function eit(){if(bT)return Sm;bT=1;var r=qg(),t="__lodash_hash_undefined__",e=Object.prototype,n=e.hasOwnProperty;function i(a){var s=this.__data__;if(r){var o=s[a];return o===t?void 0:o}return n.call(s,a)?s[a]:void 0}return Sm=i,Sm}var Mm,wT;function nit(){if(wT)return Mm;wT=1;var r=qg(),t=Object.prototype,e=t.hasOwnProperty;function n(i){var a=this.__data__;return r?a[i]!==void 0:e.call(a,i)}return Mm=n,Mm}var km,xT;function rit(){if(xT)return km;xT=1;var r=qg(),t="__lodash_hash_undefined__";function e(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=r&&i===void 0?t:i,this}return km=e,km}var Tm,ET;function iit(){if(ET)return Tm;ET=1;var r=Qrt(),t=tit(),e=eit(),n=nit(),i=rit();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=e,a.prototype.has=n,a.prototype.set=i,Tm=a,Tm}var Om,_T;function ait(){if(_T)return Om;_T=1;var r=iit(),t=jg(),e=pE();function n(){this.size=0,this.__data__={hash:new r,map:new(e||t),string:new r}}return Om=n,Om}var Cm,ST;function sit(){if(ST)return Cm;ST=1;function r(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}return Cm=r,Cm}var Am,MT;function Wg(){if(MT)return Am;MT=1;var r=sit();function t(e,n){var i=e.__data__;return r(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Am=t,Am}var Pm,kT;function oit(){if(kT)return Pm;kT=1;var r=Wg();function t(e){var n=r(this,e).delete(e);return this.size-=n?1:0,n}return Pm=t,Pm}var Nm,TT;function lit(){if(TT)return Nm;TT=1;var r=Wg();function t(e){return r(this,e).get(e)}return Nm=t,Nm}var Rm,OT;function uit(){if(OT)return Rm;OT=1;var r=Wg();function t(e){return r(this,e).has(e)}return Rm=t,Rm}var Lm,CT;function cit(){if(CT)return Lm;CT=1;var r=Wg();function t(e,n){var i=r(this,e),a=i.size;return i.set(e,n),this.size+=i.size==a?0:1,this}return Lm=t,Lm}var Im,AT;function vE(){if(AT)return Im;AT=1;var r=ait(),t=oit(),e=lit(),n=uit(),i=cit();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=e,a.prototype.has=n,a.prototype.set=i,Im=a,Im}var Dm,PT;function hit(){if(PT)return Dm;PT=1;var r=jg(),t=pE(),e=vE(),n=200;function i(a,s){var o=this.__data__;if(o instanceof r){var l=o.__data__;if(!t||l.length<n-1)return l.push([a,s]),this.size=++o.size,this;o=this.__data__=new e(l)}return o.set(a,s),this.size=o.size,this}return Dm=i,Dm}var Fm,NT;function Gg(){if(NT)return Fm;NT=1;var r=jg(),t=Wrt(),e=Grt(),n=Vrt(),i=Hrt(),a=hit();function s(o){var l=this.__data__=new r(o);this.size=l.size}return s.prototype.clear=t,s.prototype.delete=e,s.prototype.get=n,s.prototype.has=i,s.prototype.set=a,Fm=s,Fm}var Bm,RT;function mE(){if(RT)return Bm;RT=1;function r(t,e){for(var n=-1,i=t==null?0:t.length;++n<i&&e(t[n],n,t)!==!1;);return t}return Bm=r,Bm}var zm,LT;function GD(){if(LT)return zm;LT=1;var r=Yo(),t=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch{}}();return zm=t,zm}var $m,IT;function Vg(){if(IT)return $m;IT=1;var r=GD();function t(e,n,i){n=="__proto__"&&r?r(e,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[n]=i}return $m=t,$m}var jm,DT;function Hg(){if(DT)return jm;DT=1;var r=Vg(),t=Ql(),e=Object.prototype,n=e.hasOwnProperty;function i(a,s,o){var l=a[s];(!(n.call(a,s)&&t(l,o))||o===void 0&&!(s in a))&&r(a,s,o)}return jm=i,jm}var qm,FT;function Vc(){if(FT)return qm;FT=1;var r=Hg(),t=Vg();function e(n,i,a,s){var o=!a;a||(a={});for(var l=-1,u=i.length;++l<u;){var c=i[l],h=s?s(a[c],n[c],c,a,n):void 0;h===void 0&&(h=n[c]),o?t(a,c,h):r(a,c,h)}return a}return qm=e,qm}var Wm,BT;function dit(){if(BT)return Wm;BT=1;function r(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}return Wm=r,Wm}var Gm,zT;function ca(){if(zT)return Gm;zT=1;function r(t){return t!=null&&typeof t=="object"}return Gm=r,Gm}var Vm,$T;function fit(){if($T)return Vm;$T=1;var r=Uo(),t=ca(),e="[object Arguments]";function n(i){return t(i)&&r(i)==e}return Vm=n,Vm}var Hm,jT;function Hc(){if(jT)return Hm;jT=1;var r=fit(),t=ca(),e=Object.prototype,n=e.hasOwnProperty,i=e.propertyIsEnumerable,a=r(function(){return arguments}())?r:function(s){return t(s)&&n.call(s,"callee")&&!i.call(s,"callee")};return Hm=a,Hm}var Um,qT;function vn(){if(qT)return Um;qT=1;var r=Array.isArray;return Um=r,Um}var qu={exports:{}},Ym,WT;function git(){if(WT)return Ym;WT=1;function r(){return!1}return Ym=r,Ym}qu.exports;var GT;function eu(){return GT||(GT=1,function(r,t){var e=Fi(),n=git(),i=t&&!t.nodeType&&t,a=i&&!0&&r&&!r.nodeType&&r,s=a&&a.exports===i,o=s?e.Buffer:void 0,l=o?o.isBuffer:void 0,u=l||n;r.exports=u}(qu,qu.exports)),qu.exports}var Xm,VT;function Ug(){if(VT)return Xm;VT=1;var r=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function e(n,i){var a=typeof n;return i=i??r,!!i&&(a=="number"||a!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<i}return Xm=e,Xm}var Km,HT;function yE(){if(HT)return Km;HT=1;var r=9007199254740991;function t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=r}return Km=t,Km}var Zm,UT;function pit(){if(UT)return Zm;UT=1;var r=Uo(),t=yE(),e=ca(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",s="[object Date]",o="[object Error]",l="[object Function]",u="[object Map]",c="[object Number]",h="[object Object]",d="[object RegExp]",g="[object Set]",p="[object String]",v="[object WeakMap]",m="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",_="[object Int8Array]",S="[object Int16Array]",M="[object Int32Array]",k="[object Uint8Array]",T="[object Uint8ClampedArray]",P="[object Uint16Array]",O="[object Uint32Array]",A={};A[w]=A[x]=A[_]=A[S]=A[M]=A[k]=A[T]=A[P]=A[O]=!0,A[n]=A[i]=A[m]=A[a]=A[b]=A[s]=A[o]=A[l]=A[u]=A[c]=A[h]=A[d]=A[g]=A[p]=A[v]=!1;function R(L){return e(L)&&t(L.length)&&!!A[r(L)]}return Zm=R,Zm}var Jm,YT;function Yg(){if(YT)return Jm;YT=1;function r(t){return function(e){return t(e)}}return Jm=r,Jm}var Wu={exports:{}};Wu.exports;var XT;function bE(){return XT||(XT=1,function(r,t){var e=qD(),n=t&&!t.nodeType&&t,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,s=a&&e.process,o=function(){try{var l=i&&i.require&&i.require("util").types;return l||s&&s.binding&&s.binding("util")}catch{}}();r.exports=o}(Wu,Wu.exports)),Wu.exports}var Qm,KT;function Uc(){if(KT)return Qm;KT=1;var r=pit(),t=Yg(),e=bE(),n=e&&e.isTypedArray,i=n?t(n):r;return Qm=i,Qm}var ty,ZT;function VD(){if(ZT)return ty;ZT=1;var r=dit(),t=Hc(),e=vn(),n=eu(),i=Ug(),a=Uc(),s=Object.prototype,o=s.hasOwnProperty;function l(u,c){var h=e(u),d=!h&&t(u),g=!h&&!d&&n(u),p=!h&&!d&&!g&&a(u),v=h||d||g||p,m=v?r(u.length,String):[],b=m.length;for(var w in u)(c||o.call(u,w))&&!(v&&(w=="length"||g&&(w=="offset"||w=="parent")||p&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||i(w,b)))&&m.push(w);return m}return ty=l,ty}var ey,JT;function Xg(){if(JT)return ey;JT=1;var r=Object.prototype;function t(e){var n=e&&e.constructor,i=typeof n=="function"&&n.prototype||r;return e===i}return ey=t,ey}var ny,QT;function HD(){if(QT)return ny;QT=1;function r(t,e){return function(n){return t(e(n))}}return ny=r,ny}var ry,tO;function vit(){if(tO)return ry;tO=1;var r=HD(),t=r(Object.keys,Object);return ry=t,ry}var iy,eO;function wE(){if(eO)return iy;eO=1;var r=Xg(),t=vit(),e=Object.prototype,n=e.hasOwnProperty;function i(a){if(!r(a))return t(a);var s=[];for(var o in Object(a))n.call(a,o)&&o!="constructor"&&s.push(o);return s}return iy=i,iy}var ay,nO;function Ya(){if(nO)return ay;nO=1;var r=Gc(),t=yE();function e(n){return n!=null&&t(n.length)&&!r(n)}return ay=e,ay}var sy,rO;function Js(){if(rO)return sy;rO=1;var r=VD(),t=wE(),e=Ya();function n(i){return e(i)?r(i):t(i)}return sy=n,sy}var oy,iO;function mit(){if(iO)return oy;iO=1;var r=Vc(),t=Js();function e(n,i){return n&&r(i,t(i),n)}return oy=e,oy}var ly,aO;function yit(){if(aO)return ly;aO=1;function r(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}return ly=r,ly}var uy,sO;function bit(){if(sO)return uy;sO=1;var r=mi(),t=Xg(),e=yit(),n=Object.prototype,i=n.hasOwnProperty;function a(s){if(!r(s))return e(s);var o=t(s),l=[];for(var u in s)u=="constructor"&&(o||!i.call(s,u))||l.push(u);return l}return uy=a,uy}var cy,oO;function Xo(){if(oO)return cy;oO=1;var r=VD(),t=bit(),e=Ya();function n(i){return e(i)?r(i,!0):t(i)}return cy=n,cy}var hy,lO;function wit(){if(lO)return hy;lO=1;var r=Vc(),t=Xo();function e(n,i){return n&&r(i,t(i),n)}return hy=e,hy}var Gu={exports:{}};Gu.exports;var uO;function UD(){return uO||(uO=1,function(r,t){var e=Fi(),n=t&&!t.nodeType&&t,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,s=a?e.Buffer:void 0,o=s?s.allocUnsafe:void 0;function l(u,c){if(c)return u.slice();var h=u.length,d=o?o(h):new u.constructor(h);return u.copy(d),d}r.exports=l}(Gu,Gu.exports)),Gu.exports}var dy,cO;function YD(){if(cO)return dy;cO=1;function r(t,e){var n=-1,i=t.length;for(e||(e=Array(i));++n<i;)e[n]=t[n];return e}return dy=r,dy}var fy,hO;function XD(){if(hO)return fy;hO=1;function r(t,e){for(var n=-1,i=t==null?0:t.length,a=0,s=[];++n<i;){var o=t[n];e(o,n,t)&&(s[a++]=o)}return s}return fy=r,fy}var gy,dO;function KD(){if(dO)return gy;dO=1;function r(){return[]}return gy=r,gy}var py,fO;function xE(){if(fO)return py;fO=1;var r=XD(),t=KD(),e=Object.prototype,n=e.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(s){return s==null?[]:(s=Object(s),r(i(s),function(o){return n.call(s,o)}))}:t;return py=a,py}var vy,gO;function xit(){if(gO)return vy;gO=1;var r=Vc(),t=xE();function e(n,i){return r(n,t(n),i)}return vy=e,vy}var my,pO;function EE(){if(pO)return my;pO=1;function r(t,e){for(var n=-1,i=e.length,a=t.length;++n<i;)t[a+n]=e[n];return t}return my=r,my}var yy,vO;function Kg(){if(vO)return yy;vO=1;var r=HD(),t=r(Object.getPrototypeOf,Object);return yy=t,yy}var by,mO;function ZD(){if(mO)return by;mO=1;var r=EE(),t=Kg(),e=xE(),n=KD(),i=Object.getOwnPropertySymbols,a=i?function(s){for(var o=[];s;)r(o,e(s)),s=t(s);return o}:n;return by=a,by}var wy,yO;function Eit(){if(yO)return wy;yO=1;var r=Vc(),t=ZD();function e(n,i){return r(n,t(n),i)}return wy=e,wy}var xy,bO;function JD(){if(bO)return xy;bO=1;var r=EE(),t=vn();function e(n,i,a){var s=i(n);return t(n)?s:r(s,a(n))}return xy=e,xy}var Ey,wO;function QD(){if(wO)return Ey;wO=1;var r=JD(),t=xE(),e=Js();function n(i){return r(i,e,t)}return Ey=n,Ey}var _y,xO;function _it(){if(xO)return _y;xO=1;var r=JD(),t=ZD(),e=Xo();function n(i){return r(i,e,t)}return _y=n,_y}var Sy,EO;function Sit(){if(EO)return Sy;EO=1;var r=Yo(),t=Fi(),e=r(t,"DataView");return Sy=e,Sy}var My,_O;function Mit(){if(_O)return My;_O=1;var r=Yo(),t=Fi(),e=r(t,"Promise");return My=e,My}var ky,SO;function t6(){if(SO)return ky;SO=1;var r=Yo(),t=Fi(),e=r(t,"Set");return ky=e,ky}var Ty,MO;function kit(){if(MO)return Ty;MO=1;var r=Yo(),t=Fi(),e=r(t,"WeakMap");return Ty=e,Ty}var Oy,kO;function nu(){if(kO)return Oy;kO=1;var r=Sit(),t=pE(),e=Mit(),n=t6(),i=kit(),a=Uo(),s=WD(),o="[object Map]",l="[object Object]",u="[object Promise]",c="[object Set]",h="[object WeakMap]",d="[object DataView]",g=s(r),p=s(t),v=s(e),m=s(n),b=s(i),w=a;return(r&&w(new r(new ArrayBuffer(1)))!=d||t&&w(new t)!=o||e&&w(e.resolve())!=u||n&&w(new n)!=c||i&&w(new i)!=h)&&(w=function(x){var _=a(x),S=_==l?x.constructor:void 0,M=S?s(S):"";if(M)switch(M){case g:return d;case p:return o;case v:return u;case m:return c;case b:return h}return _}),Oy=w,Oy}var Cy,TO;function Tit(){if(TO)return Cy;TO=1;var r=Object.prototype,t=r.hasOwnProperty;function e(n){var i=n.length,a=new n.constructor(i);return i&&typeof n[0]=="string"&&t.call(n,"index")&&(a.index=n.index,a.input=n.input),a}return Cy=e,Cy}var Ay,OO;function e6(){if(OO)return Ay;OO=1;var r=Fi(),t=r.Uint8Array;return Ay=t,Ay}var Py,CO;function _E(){if(CO)return Py;CO=1;var r=e6();function t(e){var n=new e.constructor(e.byteLength);return new r(n).set(new r(e)),n}return Py=t,Py}var Ny,AO;function Oit(){if(AO)return Ny;AO=1;var r=_E();function t(e,n){var i=n?r(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}return Ny=t,Ny}var Ry,PO;function Cit(){if(PO)return Ry;PO=1;var r=/\w*$/;function t(e){var n=new e.constructor(e.source,r.exec(e));return n.lastIndex=e.lastIndex,n}return Ry=t,Ry}var Ly,NO;function Ait(){if(NO)return Ly;NO=1;var r=tu(),t=r?r.prototype:void 0,e=t?t.valueOf:void 0;function n(i){return e?Object(e.call(i)):{}}return Ly=n,Ly}var Iy,RO;function n6(){if(RO)return Iy;RO=1;var r=_E();function t(e,n){var i=n?r(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}return Iy=t,Iy}var Dy,LO;function Pit(){if(LO)return Dy;LO=1;var r=_E(),t=Oit(),e=Cit(),n=Ait(),i=n6(),a="[object Boolean]",s="[object Date]",o="[object Map]",l="[object Number]",u="[object RegExp]",c="[object Set]",h="[object String]",d="[object Symbol]",g="[object ArrayBuffer]",p="[object DataView]",v="[object Float32Array]",m="[object Float64Array]",b="[object Int8Array]",w="[object Int16Array]",x="[object Int32Array]",_="[object Uint8Array]",S="[object Uint8ClampedArray]",M="[object Uint16Array]",k="[object Uint32Array]";function T(P,O,A){var R=P.constructor;switch(O){case g:return r(P);case a:case s:return new R(+P);case p:return t(P,A);case v:case m:case b:case w:case x:case _:case S:case M:case k:return i(P,A);case o:return new R;case l:case h:return new R(P);case u:return e(P);case c:return new R;case d:return n(P)}}return Dy=T,Dy}var Fy,IO;function r6(){if(IO)return Fy;IO=1;var r=mi(),t=Object.create,e=function(){function n(){}return function(i){if(!r(i))return{};if(t)return t(i);n.prototype=i;var a=new n;return n.prototype=void 0,a}}();return Fy=e,Fy}var By,DO;function i6(){if(DO)return By;DO=1;var r=r6(),t=Kg(),e=Xg();function n(i){return typeof i.constructor=="function"&&!e(i)?r(t(i)):{}}return By=n,By}var zy,FO;function Nit(){if(FO)return zy;FO=1;var r=nu(),t=ca(),e="[object Map]";function n(i){return t(i)&&r(i)==e}return zy=n,zy}var $y,BO;function Rit(){if(BO)return $y;BO=1;var r=Nit(),t=Yg(),e=bE(),n=e&&e.isMap,i=n?t(n):r;return $y=i,$y}var jy,zO;function Lit(){if(zO)return jy;zO=1;var r=nu(),t=ca(),e="[object Set]";function n(i){return t(i)&&r(i)==e}return jy=n,jy}var qy,$O;function Iit(){if($O)return qy;$O=1;var r=Lit(),t=Yg(),e=bE(),n=e&&e.isSet,i=n?t(n):r;return qy=i,qy}var Wy,jO;function a6(){if(jO)return Wy;jO=1;var r=Gg(),t=mE(),e=Hg(),n=mit(),i=wit(),a=UD(),s=YD(),o=xit(),l=Eit(),u=QD(),c=_it(),h=nu(),d=Tit(),g=Pit(),p=i6(),v=vn(),m=eu(),b=Rit(),w=mi(),x=Iit(),_=Js(),S=Xo(),M=1,k=2,T=4,P="[object Arguments]",O="[object Array]",A="[object Boolean]",R="[object Date]",L="[object Error]",q="[object Function]",j="[object GeneratorFunction]",$="[object Map]",B="[object Number]",F="[object Object]",V="[object RegExp]",X="[object Set]",K="[object String]",dt="[object Symbol]",ct="[object WeakMap]",ht="[object ArrayBuffer]",lt="[object DataView]",pt="[object Float32Array]",wt="[object Float64Array]",Bt="[object Int8Array]",Ut="[object Int16Array]",Fe="[object Int32Array]",Gn="[object Uint8Array]",on="[object Uint8ClampedArray]",dr="[object Uint16Array]",Rn="[object Uint32Array]",te={};te[P]=te[O]=te[ht]=te[lt]=te[A]=te[R]=te[pt]=te[wt]=te[Bt]=te[Ut]=te[Fe]=te[$]=te[B]=te[F]=te[V]=te[X]=te[K]=te[dt]=te[Gn]=te[on]=te[dr]=te[Rn]=!0,te[L]=te[q]=te[ct]=!1;function bi(Wt,Kr,Cr,ji,mn,Ln){var Be,ha=Kr&M,kn=Kr&k,wi=Kr&T;if(Cr&&(Be=mn?Cr(Wt,ji,mn,Ln):Cr(Wt)),Be!==void 0)return Be;if(!w(Wt))return Wt;var qi=v(Wt);if(qi){if(Be=d(Wt),!ha)return s(Wt,Be)}else{var tr=h(Wt),Za=tr==q||tr==j;if(m(Wt))return a(Wt,ha);if(tr==F||tr==P||Za&&!mn){if(Be=kn||Za?{}:p(Wt),!ha)return kn?l(Wt,i(Be,Wt)):o(Wt,n(Be,Wt))}else{if(!te[tr])return mn?Wt:{};Be=g(Wt,tr,ha)}}Ln||(Ln=new r);var Ja=Ln.get(Wt);if(Ja)return Ja;Ln.set(Wt,Be),x(Wt)?Wt.forEach(function(Zr){Be.add(bi(Zr,Kr,Cr,Zr,Wt,Ln))}):b(Wt)&&Wt.forEach(function(Zr,xi){Be.set(xi,bi(Zr,Kr,Cr,xi,Wt,Ln))});var ou=wi?kn?c:u:kn?S:_,Jo=qi?void 0:ou(Wt);return t(Jo||Wt,function(Zr,xi){Jo&&(xi=Zr,Zr=Wt[xi]),e(Be,xi,bi(Zr,Kr,Cr,xi,Wt,Ln))}),Be}return Wy=bi,Wy}var Gy,qO;function Dit(){if(qO)return Gy;qO=1;var r=a6(),t=4;function e(n){return r(n,t)}return Gy=e,Gy}var Vy,WO;function SE(){if(WO)return Vy;WO=1;function r(t){return function(){return t}}return Vy=r,Vy}var Hy,GO;function Fit(){if(GO)return Hy;GO=1;function r(t){return function(e,n,i){for(var a=-1,s=Object(e),o=i(e),l=o.length;l--;){var u=o[t?l:++a];if(n(s[u],u,s)===!1)break}return e}}return Hy=r,Hy}var Uy,VO;function ME(){if(VO)return Uy;VO=1;var r=Fit(),t=r();return Uy=t,Uy}var Yy,HO;function kE(){if(HO)return Yy;HO=1;var r=ME(),t=Js();function e(n,i){return n&&r(n,i,t)}return Yy=e,Yy}var Xy,UO;function Bit(){if(UO)return Xy;UO=1;var r=Ya();function t(e,n){return function(i,a){if(i==null)return i;if(!r(i))return e(i,a);for(var s=i.length,o=n?s:-1,l=Object(i);(n?o--:++o<s)&&a(l[o],o,l)!==!1;);return i}}return Xy=t,Xy}var Ky,YO;function Zg(){if(YO)return Ky;YO=1;var r=kE(),t=Bit(),e=t(r);return Ky=e,Ky}var Zy,XO;function Ko(){if(XO)return Zy;XO=1;function r(t){return t}return Zy=r,Zy}var Jy,KO;function s6(){if(KO)return Jy;KO=1;var r=Ko();function t(e){return typeof e=="function"?e:r}return Jy=t,Jy}var Qy,ZO;function o6(){if(ZO)return Qy;ZO=1;var r=mE(),t=Zg(),e=s6(),n=vn();function i(a,s){var o=n(a)?r:t;return o(a,e(s))}return Qy=i,Qy}var t1,JO;function l6(){return JO||(JO=1,t1=o6()),t1}var e1,QO;function zit(){if(QO)return e1;QO=1;var r=Zg();function t(e,n){var i=[];return r(e,function(a,s,o){n(a,s,o)&&i.push(a)}),i}return e1=t,e1}var n1,tC;function $it(){if(tC)return n1;tC=1;var r="__lodash_hash_undefined__";function t(e){return this.__data__.set(e,r),this}return n1=t,n1}var r1,eC;function jit(){if(eC)return r1;eC=1;function r(t){return this.__data__.has(t)}return r1=r,r1}var i1,nC;function u6(){if(nC)return i1;nC=1;var r=vE(),t=$it(),e=jit();function n(i){var a=-1,s=i==null?0:i.length;for(this.__data__=new r;++a<s;)this.add(i[a])}return n.prototype.add=n.prototype.push=t,n.prototype.has=e,i1=n,i1}var a1,rC;function qit(){if(rC)return a1;rC=1;function r(t,e){for(var n=-1,i=t==null?0:t.length;++n<i;)if(e(t[n],n,t))return!0;return!1}return a1=r,a1}var s1,iC;function c6(){if(iC)return s1;iC=1;function r(t,e){return t.has(e)}return s1=r,s1}var o1,aC;function h6(){if(aC)return o1;aC=1;var r=u6(),t=qit(),e=c6(),n=1,i=2;function a(s,o,l,u,c,h){var d=l&n,g=s.length,p=o.length;if(g!=p&&!(d&&p>g))return!1;var v=h.get(s),m=h.get(o);if(v&&m)return v==o&&m==s;var b=-1,w=!0,x=l&i?new r:void 0;for(h.set(s,o),h.set(o,s);++b<g;){var _=s[b],S=o[b];if(u)var M=d?u(S,_,b,o,s,h):u(_,S,b,s,o,h);if(M!==void 0){if(M)continue;w=!1;break}if(x){if(!t(o,function(k,T){if(!e(x,T)&&(_===k||c(_,k,l,u,h)))return x.push(T)})){w=!1;break}}else if(!(_===S||c(_,S,l,u,h))){w=!1;break}}return h.delete(s),h.delete(o),w}return o1=a,o1}var l1,sC;function Wit(){if(sC)return l1;sC=1;function r(t){var e=-1,n=Array(t.size);return t.forEach(function(i,a){n[++e]=[a,i]}),n}return l1=r,l1}var u1,oC;function TE(){if(oC)return u1;oC=1;function r(t){var e=-1,n=Array(t.size);return t.forEach(function(i){n[++e]=i}),n}return u1=r,u1}var c1,lC;function Git(){if(lC)return c1;lC=1;var r=tu(),t=e6(),e=Ql(),n=h6(),i=Wit(),a=TE(),s=1,o=2,l="[object Boolean]",u="[object Date]",c="[object Error]",h="[object Map]",d="[object Number]",g="[object RegExp]",p="[object Set]",v="[object String]",m="[object Symbol]",b="[object ArrayBuffer]",w="[object DataView]",x=r?r.prototype:void 0,_=x?x.valueOf:void 0;function S(M,k,T,P,O,A,R){switch(T){case w:if(M.byteLength!=k.byteLength||M.byteOffset!=k.byteOffset)return!1;M=M.buffer,k=k.buffer;case b:return!(M.byteLength!=k.byteLength||!A(new t(M),new t(k)));case l:case u:case d:return e(+M,+k);case c:return M.name==k.name&&M.message==k.message;case g:case v:return M==k+"";case h:var L=i;case p:var q=P&s;if(L||(L=a),M.size!=k.size&&!q)return!1;var j=R.get(M);if(j)return j==k;P|=o,R.set(M,k);var $=n(L(M),L(k),P,O,A,R);return R.delete(M),$;case m:if(_)return _.call(M)==_.call(k)}return!1}return c1=S,c1}var h1,uC;function Vit(){if(uC)return h1;uC=1;var r=QD(),t=1,e=Object.prototype,n=e.hasOwnProperty;function i(a,s,o,l,u,c){var h=o&t,d=r(a),g=d.length,p=r(s),v=p.length;if(g!=v&&!h)return!1;for(var m=g;m--;){var b=d[m];if(!(h?b in s:n.call(s,b)))return!1}var w=c.get(a),x=c.get(s);if(w&&x)return w==s&&x==a;var _=!0;c.set(a,s),c.set(s,a);for(var S=h;++m<g;){b=d[m];var M=a[b],k=s[b];if(l)var T=h?l(k,M,b,s,a,c):l(M,k,b,a,s,c);if(!(T===void 0?M===k||u(M,k,o,l,c):T)){_=!1;break}S||(S=b=="constructor")}if(_&&!S){var P=a.constructor,O=s.constructor;P!=O&&"constructor"in a&&"constructor"in s&&!(typeof P=="function"&&P instanceof P&&typeof O=="function"&&O instanceof O)&&(_=!1)}return c.delete(a),c.delete(s),_}return h1=i,h1}var d1,cC;function Hit(){if(cC)return d1;cC=1;var r=Gg(),t=h6(),e=Git(),n=Vit(),i=nu(),a=vn(),s=eu(),o=Uc(),l=1,u="[object Arguments]",c="[object Array]",h="[object Object]",d=Object.prototype,g=d.hasOwnProperty;function p(v,m,b,w,x,_){var S=a(v),M=a(m),k=S?c:i(v),T=M?c:i(m);k=k==u?h:k,T=T==u?h:T;var P=k==h,O=T==h,A=k==T;if(A&&s(v)){if(!s(m))return!1;S=!0,P=!1}if(A&&!P)return _||(_=new r),S||o(v)?t(v,m,b,w,x,_):e(v,m,k,b,w,x,_);if(!(b&l)){var R=P&&g.call(v,"__wrapped__"),L=O&&g.call(m,"__wrapped__");if(R||L){var q=R?v.value():v,j=L?m.value():m;return _||(_=new r),x(q,j,b,w,_)}}return A?(_||(_=new r),n(v,m,b,w,x,_)):!1}return d1=p,d1}var f1,hC;function d6(){if(hC)return f1;hC=1;var r=Hit(),t=ca();function e(n,i,a,s,o){return n===i?!0:n==null||i==null||!t(n)&&!t(i)?n!==n&&i!==i:r(n,i,a,s,e,o)}return f1=e,f1}var g1,dC;function Uit(){if(dC)return g1;dC=1;var r=Gg(),t=d6(),e=1,n=2;function i(a,s,o,l){var u=o.length,c=u,h=!l;if(a==null)return!c;for(a=Object(a);u--;){var d=o[u];if(h&&d[2]?d[1]!==a[d[0]]:!(d[0]in a))return!1}for(;++u<c;){d=o[u];var g=d[0],p=a[g],v=d[1];if(h&&d[2]){if(p===void 0&&!(g in a))return!1}else{var m=new r;if(l)var b=l(p,v,g,a,s,m);if(!(b===void 0?t(v,p,e|n,l,m):b))return!1}}return!0}return g1=i,g1}var p1,fC;function f6(){if(fC)return p1;fC=1;var r=mi();function t(e){return e===e&&!r(e)}return p1=t,p1}var v1,gC;function Yit(){if(gC)return v1;gC=1;var r=f6(),t=Js();function e(n){for(var i=t(n),a=i.length;a--;){var s=i[a],o=n[s];i[a]=[s,o,r(o)]}return i}return v1=e,v1}var m1,pC;function g6(){if(pC)return m1;pC=1;function r(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}return m1=r,m1}var y1,vC;function Xit(){if(vC)return y1;vC=1;var r=Uit(),t=Yit(),e=g6();function n(i){var a=t(i);return a.length==1&&a[0][2]?e(a[0][0],a[0][1]):function(s){return s===i||r(s,i,a)}}return y1=n,y1}var b1,mC;function ru(){if(mC)return b1;mC=1;var r=Uo(),t=ca(),e="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&r(i)==e}return b1=n,b1}var w1,yC;function OE(){if(yC)return w1;yC=1;var r=vn(),t=ru(),e=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,s){if(r(a))return!1;var o=typeof a;return o=="number"||o=="symbol"||o=="boolean"||a==null||t(a)?!0:n.test(a)||!e.test(a)||s!=null&&a in Object(s)}return w1=i,w1}var x1,bC;function Kit(){if(bC)return x1;bC=1;var r=vE(),t="Expected a function";function e(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var s=arguments,o=i?i.apply(this,s):s[0],l=a.cache;if(l.has(o))return l.get(o);var u=n.apply(this,s);return a.cache=l.set(o,u)||l,u};return a.cache=new(e.Cache||r),a}return e.Cache=r,x1=e,x1}var E1,wC;function Zit(){if(wC)return E1;wC=1;var r=Kit(),t=500;function e(n){var i=r(n,function(s){return a.size===t&&a.clear(),s}),a=i.cache;return i}return E1=e,E1}var _1,xC;function Jit(){if(xC)return _1;xC=1;var r=Zit(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,e=/\\(\\)?/g,n=r(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(s,o,l,u){a.push(l?u.replace(e,"$1"):o||s)}),a});return _1=n,_1}var S1,EC;function Jg(){if(EC)return S1;EC=1;function r(t,e){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=e(t[n],n,t);return a}return S1=r,S1}var M1,_C;function Qit(){if(_C)return M1;_C=1;var r=tu(),t=Jg(),e=vn(),n=ru(),i=r?r.prototype:void 0,a=i?i.toString:void 0;function s(o){if(typeof o=="string")return o;if(e(o))return t(o,s)+"";if(n(o))return a?a.call(o):"";var l=o+"";return l=="0"&&1/o==-1/0?"-0":l}return M1=s,M1}var k1,SC;function p6(){if(SC)return k1;SC=1;var r=Qit();function t(e){return e==null?"":r(e)}return k1=t,k1}var T1,MC;function Qg(){if(MC)return T1;MC=1;var r=vn(),t=OE(),e=Jit(),n=p6();function i(a,s){return r(a)?a:t(a,s)?[a]:e(n(a))}return T1=i,T1}var O1,kC;function Yc(){if(kC)return O1;kC=1;var r=ru();function t(e){if(typeof e=="string"||r(e))return e;var n=e+"";return n=="0"&&1/e==-1/0?"-0":n}return O1=t,O1}var C1,TC;function t0(){if(TC)return C1;TC=1;var r=Qg(),t=Yc();function e(n,i){i=r(i,n);for(var a=0,s=i.length;n!=null&&a<s;)n=n[t(i[a++])];return a&&a==s?n:void 0}return C1=e,C1}var A1,OC;function tat(){if(OC)return A1;OC=1;var r=t0();function t(e,n,i){var a=e==null?void 0:r(e,n);return a===void 0?i:a}return A1=t,A1}var P1,CC;function eat(){if(CC)return P1;CC=1;function r(t,e){return t!=null&&e in Object(t)}return P1=r,P1}var N1,AC;function v6(){if(AC)return N1;AC=1;var r=Qg(),t=Hc(),e=vn(),n=Ug(),i=yE(),a=Yc();function s(o,l,u){l=r(l,o);for(var c=-1,h=l.length,d=!1;++c<h;){var g=a(l[c]);if(!(d=o!=null&&u(o,g)))break;o=o[g]}return d||++c!=h?d:(h=o==null?0:o.length,!!h&&i(h)&&n(g,h)&&(e(o)||t(o)))}return N1=s,N1}var R1,PC;function m6(){if(PC)return R1;PC=1;var r=eat(),t=v6();function e(n,i){return n!=null&&t(n,i,r)}return R1=e,R1}var L1,NC;function nat(){if(NC)return L1;NC=1;var r=d6(),t=tat(),e=m6(),n=OE(),i=f6(),a=g6(),s=Yc(),o=1,l=2;function u(c,h){return n(c)&&i(h)?a(s(c),h):function(d){var g=t(d,c);return g===void 0&&g===h?e(d,c):r(h,g,o|l)}}return L1=u,L1}var I1,RC;function y6(){if(RC)return I1;RC=1;function r(t){return function(e){return e==null?void 0:e[t]}}return I1=r,I1}var D1,LC;function rat(){if(LC)return D1;LC=1;var r=t0();function t(e){return function(n){return r(n,e)}}return D1=t,D1}var F1,IC;function iat(){if(IC)return F1;IC=1;var r=y6(),t=rat(),e=OE(),n=Yc();function i(a){return e(a)?r(n(a)):t(a)}return F1=i,F1}var B1,DC;function Xa(){if(DC)return B1;DC=1;var r=Xit(),t=nat(),e=Ko(),n=vn(),i=iat();function a(s){return typeof s=="function"?s:s==null?e:typeof s=="object"?n(s)?t(s[0],s[1]):r(s):i(s)}return B1=a,B1}var z1,FC;function b6(){if(FC)return z1;FC=1;var r=XD(),t=zit(),e=Xa(),n=vn();function i(a,s){var o=n(a)?r:t;return o(a,e(s,3))}return z1=i,z1}var $1,BC;function aat(){if(BC)return $1;BC=1;var r=Object.prototype,t=r.hasOwnProperty;function e(n,i){return n!=null&&t.call(n,i)}return $1=e,$1}var j1,zC;function w6(){if(zC)return j1;zC=1;var r=aat(),t=v6();function e(n,i){return n!=null&&t(n,i,r)}return j1=e,j1}var q1,$C;function sat(){if($C)return q1;$C=1;var r=wE(),t=nu(),e=Hc(),n=vn(),i=Ya(),a=eu(),s=Xg(),o=Uc(),l="[object Map]",u="[object Set]",c=Object.prototype,h=c.hasOwnProperty;function d(g){if(g==null)return!0;if(i(g)&&(n(g)||typeof g=="string"||typeof g.splice=="function"||a(g)||o(g)||e(g)))return!g.length;var p=t(g);if(p==l||p==u)return!g.size;if(s(g))return!r(g).length;for(var v in g)if(h.call(g,v))return!1;return!0}return q1=d,q1}var W1,jC;function x6(){if(jC)return W1;jC=1;function r(t){return t===void 0}return W1=r,W1}var G1,qC;function E6(){if(qC)return G1;qC=1;var r=Zg(),t=Ya();function e(n,i){var a=-1,s=t(n)?Array(n.length):[];return r(n,function(o,l,u){s[++a]=i(o,l,u)}),s}return G1=e,G1}var V1,WC;function _6(){if(WC)return V1;WC=1;var r=Jg(),t=Xa(),e=E6(),n=vn();function i(a,s){var o=n(a)?r:e;return o(a,t(s,3))}return V1=i,V1}var H1,GC;function oat(){if(GC)return H1;GC=1;function r(t,e,n,i){var a=-1,s=t==null?0:t.length;for(i&&s&&(n=t[++a]);++a<s;)n=e(n,t[a],a,t);return n}return H1=r,H1}var U1,VC;function lat(){if(VC)return U1;VC=1;function r(t,e,n,i,a){return a(t,function(s,o,l){n=i?(i=!1,s):e(n,s,o,l)}),n}return U1=r,U1}var Y1,HC;function S6(){if(HC)return Y1;HC=1;var r=oat(),t=Zg(),e=Xa(),n=lat(),i=vn();function a(s,o,l){var u=i(s)?r:n,c=arguments.length<3;return u(s,e(o,4),l,c,t)}return Y1=a,Y1}var X1,UC;function uat(){if(UC)return X1;UC=1;var r=Uo(),t=vn(),e=ca(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&e(a)&&r(a)==n}return X1=i,X1}var K1,YC;function cat(){if(YC)return K1;YC=1;var r=y6(),t=r("length");return K1=t,K1}var Z1,XC;function hat(){if(XC)return Z1;XC=1;var r="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+e+n,a="\\ufe0e\\ufe0f",s="\\u200d",o=RegExp("["+s+r+i+a+"]");function l(u){return o.test(u)}return Z1=l,Z1}var J1,KC;function dat(){if(KC)return J1;KC=1;var r="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+e+n,a="\\ufe0e\\ufe0f",s="["+r+"]",o="["+i+"]",l="\\ud83c[\\udffb-\\udfff]",u="(?:"+o+"|"+l+")",c="[^"+r+"]",h="(?:\\ud83c[\\udde6-\\uddff]){2}",d="[\\ud800-\\udbff][\\udc00-\\udfff]",g="\\u200d",p=u+"?",v="["+a+"]?",m="(?:"+g+"(?:"+[c,h,d].join("|")+")"+v+p+")*",b=v+p+m,w="(?:"+[c+o+"?",o,h,d,s].join("|")+")",x=RegExp(l+"(?="+l+")|"+w+b,"g");function _(S){for(var M=x.lastIndex=0;x.test(S);)++M;return M}return J1=_,J1}var Q1,ZC;function fat(){if(ZC)return Q1;ZC=1;var r=cat(),t=hat(),e=dat();function n(i){return t(i)?e(i):r(i)}return Q1=n,Q1}var t2,JC;function gat(){if(JC)return t2;JC=1;var r=wE(),t=nu(),e=Ya(),n=uat(),i=fat(),a="[object Map]",s="[object Set]";function o(l){if(l==null)return 0;if(e(l))return n(l)?i(l):l.length;var u=t(l);return u==a||u==s?l.size:r(l).length}return t2=o,t2}var e2,QC;function pat(){if(QC)return e2;QC=1;var r=mE(),t=r6(),e=kE(),n=Xa(),i=Kg(),a=vn(),s=eu(),o=Gc(),l=mi(),u=Uc();function c(h,d,g){var p=a(h),v=p||s(h)||u(h);if(d=n(d,4),g==null){var m=h&&h.constructor;v?g=p?new m:[]:l(h)?g=o(m)?t(i(h)):{}:g={}}return(v?r:e)(h,function(b,w,x){return d(g,b,w,x)}),g}return e2=c,e2}var n2,tA;function vat(){if(tA)return n2;tA=1;var r=tu(),t=Hc(),e=vn(),n=r?r.isConcatSpreadable:void 0;function i(a){return e(a)||t(a)||!!(n&&a&&a[n])}return n2=i,n2}var r2,eA;function CE(){if(eA)return r2;eA=1;var r=EE(),t=vat();function e(n,i,a,s,o){var l=-1,u=n.length;for(a||(a=t),o||(o=[]);++l<u;){var c=n[l];i>0&&a(c)?i>1?e(c,i-1,a,s,o):r(o,c):s||(o[o.length]=c)}return o}return r2=e,r2}var i2,nA;function mat(){if(nA)return i2;nA=1;function r(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}return i2=r,i2}var a2,rA;function M6(){if(rA)return a2;rA=1;var r=mat(),t=Math.max;function e(n,i,a){return i=t(i===void 0?n.length-1:i,0),function(){for(var s=arguments,o=-1,l=t(s.length-i,0),u=Array(l);++o<l;)u[o]=s[i+o];o=-1;for(var c=Array(i+1);++o<i;)c[o]=s[o];return c[i]=a(u),r(n,this,c)}}return a2=e,a2}var s2,iA;function yat(){if(iA)return s2;iA=1;var r=SE(),t=GD(),e=Ko(),n=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:r(a),writable:!0})}:e;return s2=n,s2}var o2,aA;function bat(){if(aA)return o2;aA=1;var r=800,t=16,e=Date.now;function n(i){var a=0,s=0;return function(){var o=e(),l=t-(o-s);if(s=o,l>0){if(++a>=r)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return o2=n,o2}var l2,sA;function k6(){if(sA)return l2;sA=1;var r=yat(),t=bat(),e=t(r);return l2=e,l2}var u2,oA;function e0(){if(oA)return u2;oA=1;var r=Ko(),t=M6(),e=k6();function n(i,a){return e(t(i,a,r),i+"")}return u2=n,u2}var c2,lA;function T6(){if(lA)return c2;lA=1;function r(t,e,n,i){for(var a=t.length,s=n+(i?1:-1);i?s--:++s<a;)if(e(t[s],s,t))return s;return-1}return c2=r,c2}var h2,uA;function wat(){if(uA)return h2;uA=1;function r(t){return t!==t}return h2=r,h2}var d2,cA;function xat(){if(cA)return d2;cA=1;function r(t,e,n){for(var i=n-1,a=t.length;++i<a;)if(t[i]===e)return i;return-1}return d2=r,d2}var f2,hA;function Eat(){if(hA)return f2;hA=1;var r=T6(),t=wat(),e=xat();function n(i,a,s){return a===a?e(i,a,s):r(i,t,s)}return f2=n,f2}var g2,dA;function _at(){if(dA)return g2;dA=1;var r=Eat();function t(e,n){var i=e==null?0:e.length;return!!i&&r(e,n,0)>-1}return g2=t,g2}var p2,fA;function Sat(){if(fA)return p2;fA=1;function r(t,e,n){for(var i=-1,a=t==null?0:t.length;++i<a;)if(n(e,t[i]))return!0;return!1}return p2=r,p2}var v2,gA;function Mat(){if(gA)return v2;gA=1;function r(){}return v2=r,v2}var m2,pA;function kat(){if(pA)return m2;pA=1;var r=t6(),t=Mat(),e=TE(),n=1/0,i=r&&1/e(new r([,-0]))[1]==n?function(a){return new r(a)}:t;return m2=i,m2}var y2,vA;function Tat(){if(vA)return y2;vA=1;var r=u6(),t=_at(),e=Sat(),n=c6(),i=kat(),a=TE(),s=200;function o(l,u,c){var h=-1,d=t,g=l.length,p=!0,v=[],m=v;if(c)p=!1,d=e;else if(g>=s){var b=u?null:i(l);if(b)return a(b);p=!1,d=n,m=new r}else m=u?[]:v;t:for(;++h<g;){var w=l[h],x=u?u(w):w;if(w=c||w!==0?w:0,p&&x===x){for(var _=m.length;_--;)if(m[_]===x)continue t;u&&m.push(x),v.push(w)}else d(m,x,c)||(m!==v&&m.push(x),v.push(w))}return v}return y2=o,y2}var b2,mA;function O6(){if(mA)return b2;mA=1;var r=Ya(),t=ca();function e(n){return t(n)&&r(n)}return b2=e,b2}var w2,yA;function Oat(){if(yA)return w2;yA=1;var r=CE(),t=e0(),e=Tat(),n=O6(),i=t(function(a){return e(r(a,1,n,!0))});return w2=i,w2}var x2,bA;function Cat(){if(bA)return x2;bA=1;var r=Jg();function t(e,n){return r(n,function(i){return e[i]})}return x2=t,x2}var E2,wA;function C6(){if(wA)return E2;wA=1;var r=Cat(),t=Js();function e(n){return n==null?[]:r(n,t(n))}return E2=e,E2}var _2,xA;function yi(){if(xA)return _2;xA=1;var r;if(typeof xx=="function")try{r={clone:Dit(),constant:SE(),each:l6(),filter:b6(),has:w6(),isArray:vn(),isEmpty:sat(),isFunction:Gc(),isUndefined:x6(),keys:Js(),map:_6(),reduce:S6(),size:gat(),transform:pat(),union:Oat(),values:C6()}}catch{}return r||(r=window._),_2=r,_2}var S2,EA;function AE(){if(EA)return S2;EA=1;var r=yi();S2=i;var t="\0",e="\0",n="";function i(c){this._isDirected=r.has(c,"directed")?c.directed:!0,this._isMultigraph=r.has(c,"multigraph")?c.multigraph:!1,this._isCompound=r.has(c,"compound")?c.compound:!1,this._label=void 0,this._defaultNodeLabelFn=r.constant(void 0),this._defaultEdgeLabelFn=r.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[e]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(c){return this._label=c,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(c){return r.isFunction(c)||(c=r.constant(c)),this._defaultNodeLabelFn=c,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return r.keys(this._nodes)},i.prototype.sources=function(){var c=this;return r.filter(this.nodes(),function(h){return r.isEmpty(c._in[h])})},i.prototype.sinks=function(){var c=this;return r.filter(this.nodes(),function(h){return r.isEmpty(c._out[h])})},i.prototype.setNodes=function(c,h){var d=arguments,g=this;return r.each(c,function(p){d.length>1?g.setNode(p,h):g.setNode(p)}),this},i.prototype.setNode=function(c,h){return r.has(this._nodes,c)?(arguments.length>1&&(this._nodes[c]=h),this):(this._nodes[c]=arguments.length>1?h:this._defaultNodeLabelFn(c),this._isCompound&&(this._parent[c]=e,this._children[c]={},this._children[e][c]=!0),this._in[c]={},this._preds[c]={},this._out[c]={},this._sucs[c]={},++this._nodeCount,this)},i.prototype.node=function(c){return this._nodes[c]},i.prototype.hasNode=function(c){return r.has(this._nodes,c)},i.prototype.removeNode=function(c){var h=this;if(r.has(this._nodes,c)){var d=function(g){h.removeEdge(h._edgeObjs[g])};delete this._nodes[c],this._isCompound&&(this._removeFromParentsChildList(c),delete this._parent[c],r.each(this.children(c),function(g){h.setParent(g)}),delete this._children[c]),r.each(r.keys(this._in[c]),d),delete this._in[c],delete this._preds[c],r.each(r.keys(this._out[c]),d),delete this._out[c],delete this._sucs[c],--this._nodeCount}return this},i.prototype.setParent=function(c,h){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(r.isUndefined(h))h=e;else{h+="";for(var d=h;!r.isUndefined(d);d=this.parent(d))if(d===c)throw new Error("Setting "+h+" as parent of "+c+" would create a cycle");this.setNode(h)}return this.setNode(c),this._removeFromParentsChildList(c),this._parent[c]=h,this._children[h][c]=!0,this},i.prototype._removeFromParentsChildList=function(c){delete this._children[this._parent[c]][c]},i.prototype.parent=function(c){if(this._isCompound){var h=this._parent[c];if(h!==e)return h}},i.prototype.children=function(c){if(r.isUndefined(c)&&(c=e),this._isCompound){var h=this._children[c];if(h)return r.keys(h)}else{if(c===e)return this.nodes();if(this.hasNode(c))return[]}},i.prototype.predecessors=function(c){var h=this._preds[c];if(h)return r.keys(h)},i.prototype.successors=function(c){var h=this._sucs[c];if(h)return r.keys(h)},i.prototype.neighbors=function(c){var h=this.predecessors(c);if(h)return r.union(h,this.successors(c))},i.prototype.isLeaf=function(c){var h;return this.isDirected()?h=this.successors(c):h=this.neighbors(c),h.length===0},i.prototype.filterNodes=function(c){var h=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});h.setGraph(this.graph());var d=this;r.each(this._nodes,function(v,m){c(m)&&h.setNode(m,v)}),r.each(this._edgeObjs,function(v){h.hasNode(v.v)&&h.hasNode(v.w)&&h.setEdge(v,d.edge(v))});var g={};function p(v){var m=d.parent(v);return m===void 0||h.hasNode(m)?(g[v]=m,m):m in g?g[m]:p(m)}return this._isCompound&&r.each(h.nodes(),function(v){h.setParent(v,p(v))}),h},i.prototype.setDefaultEdgeLabel=function(c){return r.isFunction(c)||(c=r.constant(c)),this._defaultEdgeLabelFn=c,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return r.values(this._edgeObjs)},i.prototype.setPath=function(c,h){var d=this,g=arguments;return r.reduce(c,function(p,v){return g.length>1?d.setEdge(p,v,h):d.setEdge(p,v),v}),this},i.prototype.setEdge=function(){var c,h,d,g,p=!1,v=arguments[0];typeof v=="object"&&v!==null&&"v"in v?(c=v.v,h=v.w,d=v.name,arguments.length===2&&(g=arguments[1],p=!0)):(c=v,h=arguments[1],d=arguments[3],arguments.length>2&&(g=arguments[2],p=!0)),c=""+c,h=""+h,r.isUndefined(d)||(d=""+d);var m=o(this._isDirected,c,h,d);if(r.has(this._edgeLabels,m))return p&&(this._edgeLabels[m]=g),this;if(!r.isUndefined(d)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(c),this.setNode(h),this._edgeLabels[m]=p?g:this._defaultEdgeLabelFn(c,h,d);var b=l(this._isDirected,c,h,d);return c=b.v,h=b.w,Object.freeze(b),this._edgeObjs[m]=b,a(this._preds[h],c),a(this._sucs[c],h),this._in[h][m]=b,this._out[c][m]=b,this._edgeCount++,this},i.prototype.edge=function(c,h,d){var g=arguments.length===1?u(this._isDirected,arguments[0]):o(this._isDirected,c,h,d);return this._edgeLabels[g]},i.prototype.hasEdge=function(c,h,d){var g=arguments.length===1?u(this._isDirected,arguments[0]):o(this._isDirected,c,h,d);return r.has(this._edgeLabels,g)},i.prototype.removeEdge=function(c,h,d){var g=arguments.length===1?u(this._isDirected,arguments[0]):o(this._isDirected,c,h,d),p=this._edgeObjs[g];return p&&(c=p.v,h=p.w,delete this._edgeLabels[g],delete this._edgeObjs[g],s(this._preds[h],c),s(this._sucs[c],h),delete this._in[h][g],delete this._out[c][g],this._edgeCount--),this},i.prototype.inEdges=function(c,h){var d=this._in[c];if(d){var g=r.values(d);return h?r.filter(g,function(p){return p.v===h}):g}},i.prototype.outEdges=function(c,h){var d=this._out[c];if(d){var g=r.values(d);return h?r.filter(g,function(p){return p.w===h}):g}},i.prototype.nodeEdges=function(c,h){var d=this.inEdges(c,h);if(d)return d.concat(this.outEdges(c,h))};function a(c,h){c[h]?c[h]++:c[h]=1}function s(c,h){--c[h]||delete c[h]}function o(c,h,d,g){var p=""+h,v=""+d;if(!c&&p>v){var m=p;p=v,v=m}return p+n+v+n+(r.isUndefined(g)?t:g)}function l(c,h,d,g){var p=""+h,v=""+d;if(!c&&p>v){var m=p;p=v,v=m}var b={v:p,w:v};return g&&(b.name=g),b}function u(c,h){return o(c,h.v,h.w,h.name)}return S2}var M2,_A;function Aat(){return _A||(_A=1,M2="2.1.8"),M2}var k2,SA;function Pat(){return SA||(SA=1,k2={Graph:AE(),version:Aat()}),k2}var T2,MA;function Nat(){if(MA)return T2;MA=1;var r=yi(),t=AE();T2={write:e,read:a};function e(s){var o={options:{directed:s.isDirected(),multigraph:s.isMultigraph(),compound:s.isCompound()},nodes:n(s),edges:i(s)};return r.isUndefined(s.graph())||(o.value=r.clone(s.graph())),o}function n(s){return r.map(s.nodes(),function(o){var l=s.node(o),u=s.parent(o),c={v:o};return r.isUndefined(l)||(c.value=l),r.isUndefined(u)||(c.parent=u),c})}function i(s){return r.map(s.edges(),function(o){var l=s.edge(o),u={v:o.v,w:o.w};return r.isUndefined(o.name)||(u.name=o.name),r.isUndefined(l)||(u.value=l),u})}function a(s){var o=new t(s.options).setGraph(s.value);return r.each(s.nodes,function(l){o.setNode(l.v,l.value),l.parent&&o.setParent(l.v,l.parent)}),r.each(s.edges,function(l){o.setEdge({v:l.v,w:l.w,name:l.name},l.value)}),o}return T2}var O2,kA;function Rat(){if(kA)return O2;kA=1;var r=yi();O2=t;function t(e){var n={},i=[],a;function s(o){r.has(n,o)||(n[o]=!0,a.push(o),r.each(e.successors(o),s),r.each(e.predecessors(o),s))}return r.each(e.nodes(),function(o){a=[],s(o),a.length&&i.push(a)}),i}return O2}var C2,TA;function A6(){if(TA)return C2;TA=1;var r=yi();C2=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(e){return e.key})},t.prototype.has=function(e){return r.has(this._keyIndices,e)},t.prototype.priority=function(e){var n=this._keyIndices[e];if(n!==void 0)return this._arr[n].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(e,n){var i=this._keyIndices;if(e=String(e),!r.has(i,e)){var a=this._arr,s=a.length;return i[e]=s,a.push({key:e,priority:n}),this._decrease(s),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},t.prototype.decrease=function(e,n){var i=this._keyIndices[e];if(n>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[i].priority+" New: "+n);this._arr[i].priority=n,this._decrease(i)},t.prototype._heapify=function(e){var n=this._arr,i=2*e,a=i+1,s=e;i<n.length&&(s=n[i].priority<n[s].priority?i:s,a<n.length&&(s=n[a].priority<n[s].priority?a:s),s!==e&&(this._swap(e,s),this._heapify(s)))},t.prototype._decrease=function(e){for(var n=this._arr,i=n[e].priority,a;e!==0&&(a=e>>1,!(n[a].priority<i));)this._swap(e,a),e=a},t.prototype._swap=function(e,n){var i=this._arr,a=this._keyIndices,s=i[e],o=i[n];i[e]=o,i[n]=s,a[o.key]=e,a[s.key]=n},C2}var A2,OA;function P6(){if(OA)return A2;OA=1;var r=yi(),t=A6();A2=n;var e=r.constant(1);function n(a,s,o,l){return i(a,String(s),o||e,l||function(u){return a.outEdges(u)})}function i(a,s,o,l){var u={},c=new t,h,d,g=function(p){var v=p.v!==h?p.v:p.w,m=u[v],b=o(p),w=d.distance+b;if(b<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+p+" Weight: "+b);w<m.distance&&(m.distance=w,m.predecessor=h,c.decrease(v,w))};for(a.nodes().forEach(function(p){var v=p===s?0:Number.POSITIVE_INFINITY;u[p]={distance:v},c.add(p,v)});c.size()>0&&(h=c.removeMin(),d=u[h],d.distance!==Number.POSITIVE_INFINITY);)l(h).forEach(g);return u}return A2}var P2,CA;function Lat(){if(CA)return P2;CA=1;var r=P6(),t=yi();P2=e;function e(n,i,a){return t.transform(n.nodes(),function(s,o){s[o]=r(n,o,i,a)},{})}return P2}var N2,AA;function N6(){if(AA)return N2;AA=1;var r=yi();N2=t;function t(e){var n=0,i=[],a={},s=[];function o(l){var u=a[l]={onStack:!0,lowlink:n,index:n++};if(i.push(l),e.successors(l).forEach(function(d){r.has(a,d)?a[d].onStack&&(u.lowlink=Math.min(u.lowlink,a[d].index)):(o(d),u.lowlink=Math.min(u.lowlink,a[d].lowlink))}),u.lowlink===u.index){var c=[],h;do h=i.pop(),a[h].onStack=!1,c.push(h);while(l!==h);s.push(c)}}return e.nodes().forEach(function(l){r.has(a,l)||o(l)}),s}return N2}var R2,PA;function Iat(){if(PA)return R2;PA=1;var r=yi(),t=N6();R2=e;function e(n){return r.filter(t(n),function(i){return i.length>1||i.length===1&&n.hasEdge(i[0],i[0])})}return R2}var L2,NA;function Dat(){if(NA)return L2;NA=1;var r=yi();L2=e;var t=r.constant(1);function e(i,a,s){return n(i,a||t,s||function(o){return i.outEdges(o)})}function n(i,a,s){var o={},l=i.nodes();return l.forEach(function(u){o[u]={},o[u][u]={distance:0},l.forEach(function(c){u!==c&&(o[u][c]={distance:Number.POSITIVE_INFINITY})}),s(u).forEach(function(c){var h=c.v===u?c.w:c.v,d=a(c);o[u][h]={distance:d,predecessor:u}})}),l.forEach(function(u){var c=o[u];l.forEach(function(h){var d=o[h];l.forEach(function(g){var p=d[u],v=c[g],m=d[g],b=p.distance+v.distance;b<m.distance&&(m.distance=b,m.predecessor=v.predecessor)})})}),o}return L2}var I2,RA;function R6(){if(RA)return I2;RA=1;var r=yi();I2=t,t.CycleException=e;function t(n){var i={},a={},s=[];function o(l){if(r.has(a,l))throw new e;r.has(i,l)||(a[l]=!0,i[l]=!0,r.each(n.predecessors(l),o),delete a[l],s.push(l))}if(r.each(n.sinks(),o),r.size(i)!==n.nodeCount())throw new e;return s}function e(){}return e.prototype=new Error,I2}var D2,LA;function Fat(){if(LA)return D2;LA=1;var r=R6();D2=t;function t(e){try{r(e)}catch(n){if(n instanceof r.CycleException)return!1;throw n}return!0}return D2}var F2,IA;function L6(){if(IA)return F2;IA=1;var r=yi();F2=t;function t(n,i,a){r.isArray(i)||(i=[i]);var s=(n.isDirected()?n.successors:n.neighbors).bind(n),o=[],l={};return r.each(i,function(u){if(!n.hasNode(u))throw new Error("Graph does not have node: "+u);e(n,u,a==="post",l,s,o)}),o}function e(n,i,a,s,o,l){r.has(s,i)||(s[i]=!0,a||l.push(i),r.each(o(i),function(u){e(n,u,a,s,o,l)}),a&&l.push(i))}return F2}var B2,DA;function Bat(){if(DA)return B2;DA=1;var r=L6();B2=t;function t(e,n){return r(e,n,"post")}return B2}var z2,FA;function zat(){if(FA)return z2;FA=1;var r=L6();z2=t;function t(e,n){return r(e,n,"pre")}return z2}var $2,BA;function $at(){if(BA)return $2;BA=1;var r=yi(),t=AE(),e=A6();$2=n;function n(i,a){var s=new t,o={},l=new e,u;function c(d){var g=d.v===u?d.w:d.v,p=l.priority(g);if(p!==void 0){var v=a(d);v<p&&(o[g]=u,l.decrease(g,v))}}if(i.nodeCount()===0)return s;r.each(i.nodes(),function(d){l.add(d,Number.POSITIVE_INFINITY),s.setNode(d)}),l.decrease(i.nodes()[0],0);for(var h=!1;l.size()>0;){if(u=l.removeMin(),r.has(o,u))s.setEdge(u,o[u]);else{if(h)throw new Error("Input graph is not connected: "+i);h=!0}i.nodeEdges(u).forEach(c)}return s}return $2}var j2,zA;function jat(){return zA||(zA=1,j2={components:Rat(),dijkstra:P6(),dijkstraAll:Lat(),findCycles:Iat(),floydWarshall:Dat(),isAcyclic:Fat(),postorder:Bat(),preorder:zat(),prim:$at(),tarjan:N6(),topsort:R6()}),j2}var q2,$A;function qat(){if($A)return q2;$A=1;var r=Pat();return q2={Graph:r.Graph,json:Nat(),alg:jat(),version:r.version},q2}var jf;if(typeof xx=="function")try{jf=qat()}catch{}jf||(jf=window.graphlib);var Bi=jf,W2,jA;function Wat(){if(jA)return W2;jA=1;var r=a6(),t=1,e=4;function n(i){return r(i,t|e)}return W2=n,W2}var G2,qA;function n0(){if(qA)return G2;qA=1;var r=Ql(),t=Ya(),e=Ug(),n=mi();function i(a,s,o){if(!n(o))return!1;var l=typeof s;return(l=="number"?t(o)&&e(s,o.length):l=="string"&&s in o)?r(o[s],a):!1}return G2=i,G2}var V2,WA;function Gat(){if(WA)return V2;WA=1;var r=e0(),t=Ql(),e=n0(),n=Xo(),i=Object.prototype,a=i.hasOwnProperty,s=r(function(o,l){o=Object(o);var u=-1,c=l.length,h=c>2?l[2]:void 0;for(h&&e(l[0],l[1],h)&&(c=1);++u<c;)for(var d=l[u],g=n(d),p=-1,v=g.length;++p<v;){var m=g[p],b=o[m];(b===void 0||t(b,i[m])&&!a.call(o,m))&&(o[m]=d[m])}return o});return V2=s,V2}var H2,GA;function Vat(){if(GA)return H2;GA=1;var r=Xa(),t=Ya(),e=Js();function n(i){return function(a,s,o){var l=Object(a);if(!t(a)){var u=r(s,3);a=e(a),s=function(h){return u(l[h],h,l)}}var c=i(a,s,o);return c>-1?l[u?a[c]:c]:void 0}}return H2=n,H2}var U2,VA;function Hat(){if(VA)return U2;VA=1;var r=/\s/;function t(e){for(var n=e.length;n--&&r.test(e.charAt(n)););return n}return U2=t,U2}var Y2,HA;function Uat(){if(HA)return Y2;HA=1;var r=Hat(),t=/^\s+/;function e(n){return n&&n.slice(0,r(n)+1).replace(t,"")}return Y2=e,Y2}var X2,UA;function Yat(){if(UA)return X2;UA=1;var r=Uat(),t=mi(),e=ru(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;function l(u){if(typeof u=="number")return u;if(e(u))return n;if(t(u)){var c=typeof u.valueOf=="function"?u.valueOf():u;u=t(c)?c+"":c}if(typeof u!="string")return u===0?u:+u;u=r(u);var h=a.test(u);return h||s.test(u)?o(u.slice(2),h?2:8):i.test(u)?n:+u}return X2=l,X2}var K2,YA;function I6(){if(YA)return K2;YA=1;var r=Yat(),t=1/0,e=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=r(i),i===t||i===-1/0){var a=i<0?-1:1;return a*e}return i===i?i:0}return K2=n,K2}var Z2,XA;function Xat(){if(XA)return Z2;XA=1;var r=I6();function t(e){var n=r(e),i=n%1;return n===n?i?n-i:n:0}return Z2=t,Z2}var J2,KA;function Kat(){if(KA)return J2;KA=1;var r=T6(),t=Xa(),e=Xat(),n=Math.max;function i(a,s,o){var l=a==null?0:a.length;if(!l)return-1;var u=o==null?0:e(o);return u<0&&(u=n(l+u,0)),r(a,t(s,3),u)}return J2=i,J2}var Q2,ZA;function Zat(){if(ZA)return Q2;ZA=1;var r=Vat(),t=Kat(),e=r(t);return Q2=e,Q2}var tb,JA;function D6(){if(JA)return tb;JA=1;var r=CE();function t(e){var n=e==null?0:e.length;return n?r(e,1):[]}return tb=t,tb}var eb,QA;function Jat(){if(QA)return eb;QA=1;var r=ME(),t=s6(),e=Xo();function n(i,a){return i==null?i:r(i,t(a),e)}return eb=n,eb}var nb,tP;function Qat(){if(tP)return nb;tP=1;function r(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}return nb=r,nb}var rb,eP;function tst(){if(eP)return rb;eP=1;var r=Vg(),t=kE(),e=Xa();function n(i,a){var s={};return a=e(a,3),t(i,function(o,l,u){r(s,l,a(o,l,u))}),s}return rb=n,rb}var ib,nP;function PE(){if(nP)return ib;nP=1;var r=ru();function t(e,n,i){for(var a=-1,s=e.length;++a<s;){var o=e[a],l=n(o);if(l!=null&&(u===void 0?l===l&&!r(l):i(l,u)))var u=l,c=o}return c}return ib=t,ib}var ab,rP;function est(){if(rP)return ab;rP=1;function r(t,e){return t>e}return ab=r,ab}var sb,iP;function nst(){if(iP)return sb;iP=1;var r=PE(),t=est(),e=Ko();function n(i){return i&&i.length?r(i,e,t):void 0}return sb=n,sb}var ob,aP;function F6(){if(aP)return ob;aP=1;var r=Vg(),t=Ql();function e(n,i,a){(a!==void 0&&!t(n[i],a)||a===void 0&&!(i in n))&&r(n,i,a)}return ob=e,ob}var lb,sP;function rst(){if(sP)return lb;sP=1;var r=Uo(),t=Kg(),e=ca(),n="[object Object]",i=Function.prototype,a=Object.prototype,s=i.toString,o=a.hasOwnProperty,l=s.call(Object);function u(c){if(!e(c)||r(c)!=n)return!1;var h=t(c);if(h===null)return!0;var d=o.call(h,"constructor")&&h.constructor;return typeof d=="function"&&d instanceof d&&s.call(d)==l}return lb=u,lb}var ub,oP;function B6(){if(oP)return ub;oP=1;function r(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}return ub=r,ub}var cb,lP;function ist(){if(lP)return cb;lP=1;var r=Vc(),t=Xo();function e(n){return r(n,t(n))}return cb=e,cb}var hb,uP;function ast(){if(uP)return hb;uP=1;var r=F6(),t=UD(),e=n6(),n=YD(),i=i6(),a=Hc(),s=vn(),o=O6(),l=eu(),u=Gc(),c=mi(),h=rst(),d=Uc(),g=B6(),p=ist();function v(m,b,w,x,_,S,M){var k=g(m,w),T=g(b,w),P=M.get(T);if(P){r(m,w,P);return}var O=S?S(k,T,w+"",m,b,M):void 0,A=O===void 0;if(A){var R=s(T),L=!R&&l(T),q=!R&&!L&&d(T);O=T,R||L||q?s(k)?O=k:o(k)?O=n(k):L?(A=!1,O=t(T,!0)):q?(A=!1,O=e(T,!0)):O=[]:h(T)||a(T)?(O=k,a(k)?O=p(k):(!c(k)||u(k))&&(O=i(T))):A=!1}A&&(M.set(T,O),_(O,T,x,S,M),M.delete(T)),r(m,w,O)}return hb=v,hb}var db,cP;function sst(){if(cP)return db;cP=1;var r=Gg(),t=F6(),e=ME(),n=ast(),i=mi(),a=Xo(),s=B6();function o(l,u,c,h,d){l!==u&&e(u,function(g,p){if(d||(d=new r),i(g))n(l,u,p,c,o,h,d);else{var v=h?h(s(l,p),g,p+"",l,u,d):void 0;v===void 0&&(v=g),t(l,p,v)}},a)}return db=o,db}var fb,hP;function ost(){if(hP)return fb;hP=1;var r=e0(),t=n0();function e(n){return r(function(i,a){var s=-1,o=a.length,l=o>1?a[o-1]:void 0,u=o>2?a[2]:void 0;for(l=n.length>3&&typeof l=="function"?(o--,l):void 0,u&&t(a[0],a[1],u)&&(l=o<3?void 0:l,o=1),i=Object(i);++s<o;){var c=a[s];c&&n(i,c,s,l)}return i})}return fb=e,fb}var gb,dP;function lst(){if(dP)return gb;dP=1;var r=sst(),t=ost(),e=t(function(n,i,a){r(n,i,a)});return gb=e,gb}var pb,fP;function z6(){if(fP)return pb;fP=1;function r(t,e){return t<e}return pb=r,pb}var vb,gP;function ust(){if(gP)return vb;gP=1;var r=PE(),t=z6(),e=Ko();function n(i){return i&&i.length?r(i,e,t):void 0}return vb=n,vb}var mb,pP;function cst(){if(pP)return mb;pP=1;var r=PE(),t=Xa(),e=z6();function n(i,a){return i&&i.length?r(i,t(a,2),e):void 0}return mb=n,mb}var yb,vP;function hst(){if(vP)return yb;vP=1;var r=Fi(),t=function(){return r.Date.now()};return yb=t,yb}var bb,mP;function dst(){if(mP)return bb;mP=1;var r=Hg(),t=Qg(),e=Ug(),n=mi(),i=Yc();function a(s,o,l,u){if(!n(s))return s;o=t(o,s);for(var c=-1,h=o.length,d=h-1,g=s;g!=null&&++c<h;){var p=i(o[c]),v=l;if(p==="__proto__"||p==="constructor"||p==="prototype")return s;if(c!=d){var m=g[p];v=u?u(m,p,g):void 0,v===void 0&&(v=n(m)?m:e(o[c+1])?[]:{})}r(g,p,v),g=g[p]}return s}return bb=a,bb}var wb,yP;function fst(){if(yP)return wb;yP=1;var r=t0(),t=dst(),e=Qg();function n(i,a,s){for(var o=-1,l=a.length,u={};++o<l;){var c=a[o],h=r(i,c);s(h,c)&&t(u,e(c,i),h)}return u}return wb=n,wb}var xb,bP;function gst(){if(bP)return xb;bP=1;var r=fst(),t=m6();function e(n,i){return r(n,i,function(a,s){return t(n,s)})}return xb=e,xb}var Eb,wP;function pst(){if(wP)return Eb;wP=1;var r=D6(),t=M6(),e=k6();function n(i){return e(t(i,void 0,r),i+"")}return Eb=n,Eb}var _b,xP;function vst(){if(xP)return _b;xP=1;var r=gst(),t=pst(),e=t(function(n,i){return n==null?{}:r(n,i)});return _b=e,_b}var Sb,EP;function mst(){if(EP)return Sb;EP=1;var r=Math.ceil,t=Math.max;function e(n,i,a,s){for(var o=-1,l=t(r((i-n)/(a||1)),0),u=Array(l);l--;)u[s?l:++o]=n,n+=a;return u}return Sb=e,Sb}var Mb,_P;function yst(){if(_P)return Mb;_P=1;var r=mst(),t=n0(),e=I6();function n(i){return function(a,s,o){return o&&typeof o!="number"&&t(a,s,o)&&(s=o=void 0),a=e(a),s===void 0?(s=a,a=0):s=e(s),o=o===void 0?a<s?1:-1:e(o),r(a,s,o,i)}}return Mb=n,Mb}var kb,SP;function bst(){if(SP)return kb;SP=1;var r=yst(),t=r();return kb=t,kb}var Tb,MP;function wst(){if(MP)return Tb;MP=1;function r(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}return Tb=r,Tb}var Ob,kP;function xst(){if(kP)return Ob;kP=1;var r=ru();function t(e,n){if(e!==n){var i=e!==void 0,a=e===null,s=e===e,o=r(e),l=n!==void 0,u=n===null,c=n===n,h=r(n);if(!u&&!h&&!o&&e>n||o&&l&&c&&!u&&!h||a&&l&&c||!i&&c||!s)return 1;if(!a&&!o&&!h&&e<n||h&&i&&s&&!a&&!o||u&&i&&s||!l&&s||!c)return-1}return 0}return Ob=t,Ob}var Cb,TP;function Est(){if(TP)return Cb;TP=1;var r=xst();function t(e,n,i){for(var a=-1,s=e.criteria,o=n.criteria,l=s.length,u=i.length;++a<l;){var c=r(s[a],o[a]);if(c){if(a>=u)return c;var h=i[a];return c*(h=="desc"?-1:1)}}return e.index-n.index}return Cb=t,Cb}var Ab,OP;function _st(){if(OP)return Ab;OP=1;var r=Jg(),t=t0(),e=Xa(),n=E6(),i=wst(),a=Yg(),s=Est(),o=Ko(),l=vn();function u(c,h,d){h.length?h=r(h,function(v){return l(v)?function(m){return t(m,v.length===1?v[0]:v)}:v}):h=[o];var g=-1;h=r(h,a(e));var p=n(c,function(v,m,b){var w=r(h,function(x){return x(v)});return{criteria:w,index:++g,value:v}});return i(p,function(v,m){return s(v,m,d)})}return Ab=u,Ab}var Pb,CP;function Sst(){if(CP)return Pb;CP=1;var r=CE(),t=_st(),e=e0(),n=n0(),i=e(function(a,s){if(a==null)return[];var o=s.length;return o>1&&n(a,s[0],s[1])?s=[]:o>2&&n(s[0],s[1],s[2])&&(s=[s[0]]),t(a,r(s,1),[])});return Pb=i,Pb}var Nb,AP;function Mst(){if(AP)return Nb;AP=1;var r=p6(),t=0;function e(n){var i=++t;return r(n)+i}return Nb=e,Nb}var Rb,PP;function kst(){if(PP)return Rb;PP=1;function r(t,e,n){for(var i=-1,a=t.length,s=e.length,o={};++i<a;){var l=i<s?e[i]:void 0;n(o,t[i],l)}return o}return Rb=r,Rb}var Lb,NP;function Tst(){if(NP)return Lb;NP=1;var r=Hg(),t=kst();function e(n,i){return t(n||[],i||[],r)}return Lb=e,Lb}var qf;if(typeof xx=="function")try{qf={cloneDeep:Wat(),constant:SE(),defaults:Gat(),each:l6(),filter:b6(),find:Zat(),flatten:D6(),forEach:o6(),forIn:Jat(),has:w6(),isUndefined:x6(),last:Qat(),map:_6(),mapValues:tst(),max:nst(),merge:lst(),min:ust(),minBy:cst(),now:hst(),pick:vst(),range:bst(),reduce:S6(),sortBy:Sst(),uniqueId:Mst(),values:C6(),zipObject:Tst()}}catch{}qf||(qf=window._);var je=qf,Ost=r0;function r0(){var r={};r._next=r._prev=r,this._sentinel=r}r0.prototype.dequeue=function(){var r=this._sentinel,t=r._prev;if(t!==r)return $6(t),t};r0.prototype.enqueue=function(r){var t=this._sentinel;r._prev&&r._next&&$6(r),r._next=t._next,t._next._prev=r,t._next=r,r._prev=t};r0.prototype.toString=function(){for(var r=[],t=this._sentinel,e=t._prev;e!==t;)r.push(JSON.stringify(e,Cst)),e=e._prev;return"["+r.join(", ")+"]"};function $6(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function Cst(r,t){if(r!=="_next"&&r!=="_prev")return t}var La=je,Ast=Bi.Graph,Pst=Ost,Nst=Lst,Rst=La.constant(1);function Lst(r,t){if(r.nodeCount()<=1)return[];var e=Dst(r,t||Rst),n=Ist(e.graph,e.buckets,e.zeroIdx);return La.flatten(La.map(n,function(i){return r.outEdges(i.v,i.w)}),!0)}function Ist(r,t,e){for(var n=[],i=t[t.length-1],a=t[0],s;r.nodeCount();){for(;s=a.dequeue();)Ib(r,t,e,s);for(;s=i.dequeue();)Ib(r,t,e,s);if(r.nodeCount()){for(var o=t.length-2;o>0;--o)if(s=t[o].dequeue(),s){n=n.concat(Ib(r,t,e,s,!0));break}}}return n}function Ib(r,t,e,n,i){var a=i?[]:void 0;return La.forEach(r.inEdges(n.v),function(s){var o=r.edge(s),l=r.node(s.v);i&&a.push({v:s.v,w:s.w}),l.out-=o,nx(t,e,l)}),La.forEach(r.outEdges(n.v),function(s){var o=r.edge(s),l=s.w,u=r.node(l);u.in-=o,nx(t,e,u)}),r.removeNode(n.v),a}function Dst(r,t){var e=new Ast,n=0,i=0;La.forEach(r.nodes(),function(o){e.setNode(o,{v:o,in:0,out:0})}),La.forEach(r.edges(),function(o){var l=e.edge(o.v,o.w)||0,u=t(o),c=l+u;e.setEdge(o.v,o.w,c),i=Math.max(i,e.node(o.v).out+=u),n=Math.max(n,e.node(o.w).in+=u)});var a=La.range(i+n+3).map(function(){return new Pst}),s=n+1;return La.forEach(e.nodes(),function(o){nx(a,s,e.node(o))}),{graph:e,buckets:a,zeroIdx:s}}function nx(r,t,e){e.out?e.in?r[e.out-e.in+t].enqueue(e):r[r.length-1].enqueue(e):r[0].enqueue(e)}var Eo=je,Fst=Nst,Bst={run:zst,undo:jst};function zst(r){var t=r.graph().acyclicer==="greedy"?Fst(r,e(r)):$st(r);Eo.forEach(t,function(n){var i=r.edge(n);r.removeEdge(n),i.forwardName=n.name,i.reversed=!0,r.setEdge(n.w,n.v,i,Eo.uniqueId("rev"))});function e(n){return function(i){return n.edge(i).weight}}}function $st(r){var t=[],e={},n={};function i(a){Eo.has(n,a)||(n[a]=!0,e[a]=!0,Eo.forEach(r.outEdges(a),function(s){Eo.has(e,s.w)?t.push(s):i(s.w)}),delete e[a])}return Eo.forEach(r.nodes(),i),t}function jst(r){Eo.forEach(r.edges(),function(t){var e=r.edge(t);if(e.reversed){r.removeEdge(t);var n=e.forwardName;delete e.reversed,delete e.forwardName,r.setEdge(t.w,t.v,e,n)}})}var he=je,j6=Bi.Graph,Tr={addDummyNode:q6,simplify:qst,asNonCompoundGraph:Wst,successorWeights:Gst,predecessorWeights:Vst,intersectRect:Hst,buildLayerMatrix:Ust,normalizeRanks:Yst,removeEmptyRanks:Xst,addBorderNode:Kst,maxRank:W6,partition:Zst,time:Jst,notime:Qst};function q6(r,t,e,n){var i;do i=he.uniqueId(n);while(r.hasNode(i));return e.dummy=t,r.setNode(i,e),i}function qst(r){var t=new j6().setGraph(r.graph());return he.forEach(r.nodes(),function(e){t.setNode(e,r.node(e))}),he.forEach(r.edges(),function(e){var n=t.edge(e.v,e.w)||{weight:0,minlen:1},i=r.edge(e);t.setEdge(e.v,e.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),t}function Wst(r){var t=new j6({multigraph:r.isMultigraph()}).setGraph(r.graph());return he.forEach(r.nodes(),function(e){r.children(e).length||t.setNode(e,r.node(e))}),he.forEach(r.edges(),function(e){t.setEdge(e,r.edge(e))}),t}function Gst(r){var t=he.map(r.nodes(),function(e){var n={};return he.forEach(r.outEdges(e),function(i){n[i.w]=(n[i.w]||0)+r.edge(i).weight}),n});return he.zipObject(r.nodes(),t)}function Vst(r){var t=he.map(r.nodes(),function(e){var n={};return he.forEach(r.inEdges(e),function(i){n[i.v]=(n[i.v]||0)+r.edge(i).weight}),n});return he.zipObject(r.nodes(),t)}function Hst(r,t){var e=r.x,n=r.y,i=t.x-e,a=t.y-n,s=r.width/2,o=r.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");var l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,u=o):(i<0&&(s=-s),l=s,u=s*a/i),{x:e+l,y:n+u}}function Ust(r){var t=he.map(he.range(W6(r)+1),function(){return[]});return he.forEach(r.nodes(),function(e){var n=r.node(e),i=n.rank;he.isUndefined(i)||(t[i][n.order]=e)}),t}function Yst(r){var t=he.min(he.map(r.nodes(),function(e){return r.node(e).rank}));he.forEach(r.nodes(),function(e){var n=r.node(e);he.has(n,"rank")&&(n.rank-=t)})}function Xst(r){var t=he.min(he.map(r.nodes(),function(a){return r.node(a).rank})),e=[];he.forEach(r.nodes(),function(a){var s=r.node(a).rank-t;e[s]||(e[s]=[]),e[s].push(a)});var n=0,i=r.graph().nodeRankFactor;he.forEach(e,function(a,s){he.isUndefined(a)&&s%i!==0?--n:n&&he.forEach(a,function(o){r.node(o).rank+=n})})}function Kst(r,t,e,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=e,i.order=n),q6(r,"border",i,t)}function W6(r){return he.max(he.map(r.nodes(),function(t){var e=r.node(t).rank;if(!he.isUndefined(e))return e}))}function Zst(r,t){var e={lhs:[],rhs:[]};return he.forEach(r,function(n){t(n)?e.lhs.push(n):e.rhs.push(n)}),e}function Jst(r,t){var e=he.now();try{return t()}finally{console.log(r+" time: "+(he.now()-e)+"ms")}}function Qst(r,t){return t()}var G6=je,tot=Tr,eot={run:not,undo:iot};function not(r){r.graph().dummyChains=[],G6.forEach(r.edges(),function(t){rot(r,t)})}function rot(r,t){var e=t.v,n=r.node(e).rank,i=t.w,a=r.node(i).rank,s=t.name,o=r.edge(t),l=o.labelRank;if(a!==n+1){r.removeEdge(t);var u,c,h;for(h=0,++n;n<a;++h,++n)o.points=[],c={width:0,height:0,edgeLabel:o,edgeObj:t,rank:n},u=tot.addDummyNode(r,"edge",c,"_d"),n===l&&(c.width=o.width,c.height=o.height,c.dummy="edge-label",c.labelpos=o.labelpos),r.setEdge(e,u,{weight:o.weight},s),h===0&&r.graph().dummyChains.push(u),e=u;r.setEdge(e,i,{weight:o.weight},s)}}function iot(r){G6.forEach(r.graph().dummyChains,function(t){var e=r.node(t),n=e.edgeLabel,i;for(r.setEdge(e.edgeObj,n);e.dummy;)i=r.successors(t)[0],r.removeNode(t),n.points.push({x:e.x,y:e.y}),e.dummy==="edge-label"&&(n.x=e.x,n.y=e.y,n.width=e.width,n.height=e.height),t=i,e=r.node(t)})}var Pd=je,i0={longestPath:aot,slack:sot};function aot(r){var t={};function e(n){var i=r.node(n);if(Pd.has(t,n))return i.rank;t[n]=!0;var a=Pd.min(Pd.map(r.outEdges(n),function(s){return e(s.w)-r.edge(s).minlen}));return(a===Number.POSITIVE_INFINITY||a===void 0||a===null)&&(a=0),i.rank=a}Pd.forEach(r.sources(),e)}function sot(r,t){return r.node(t.w).rank-r.node(t.v).rank-r.edge(t).minlen}var Wf=je,oot=Bi.Graph,Gf=i0.slack,V6=lot;function lot(r){var t=new oot({directed:!1}),e=r.nodes()[0],n=r.nodeCount();t.setNode(e,{});for(var i,a;uot(t,r)<n;)i=cot(t,r),a=t.hasNode(i.v)?Gf(r,i):-Gf(r,i),hot(t,r,a);return t}function uot(r,t){function e(n){Wf.forEach(t.nodeEdges(n),function(i){var a=i.v,s=n===a?i.w:a;!r.hasNode(s)&&!Gf(t,i)&&(r.setNode(s,{}),r.setEdge(n,s,{}),e(s))})}return Wf.forEach(r.nodes(),e),r.nodeCount()}function cot(r,t){return Wf.minBy(t.edges(),function(e){if(r.hasNode(e.v)!==r.hasNode(e.w))return Gf(t,e)})}function hot(r,t,e){Wf.forEach(r.nodes(),function(n){t.node(n).rank+=e})}var Wa=je,dot=V6,fot=i0.slack,got=i0.longestPath,pot=Bi.alg.preorder,vot=Bi.alg.postorder,mot=Tr.simplify,yot=Zo;Zo.initLowLimValues=RE;Zo.initCutValues=NE;Zo.calcCutValue=H6;Zo.leaveEdge=Y6;Zo.enterEdge=X6;Zo.exchangeEdges=K6;function Zo(r){r=mot(r),got(r);var t=dot(r);RE(t),NE(t,r);for(var e,n;e=Y6(t);)n=X6(t,r,e),K6(t,r,e,n)}function NE(r,t){var e=vot(r,r.nodes());e=e.slice(0,e.length-1),Wa.forEach(e,function(n){bot(r,t,n)})}function bot(r,t,e){var n=r.node(e),i=n.parent;r.edge(e,i).cutvalue=H6(r,t,e)}function H6(r,t,e){var n=r.node(e),i=n.parent,a=!0,s=t.edge(e,i),o=0;return s||(a=!1,s=t.edge(i,e)),o=s.weight,Wa.forEach(t.nodeEdges(e),function(l){var u=l.v===e,c=u?l.w:l.v;if(c!==i){var h=u===a,d=t.edge(l).weight;if(o+=h?d:-d,xot(r,e,c)){var g=r.edge(e,c).cutvalue;o+=h?-g:g}}}),o}function RE(r,t){arguments.length<2&&(t=r.nodes()[0]),U6(r,{},1,t)}function U6(r,t,e,n,i){var a=e,s=r.node(n);return t[n]=!0,Wa.forEach(r.neighbors(n),function(o){Wa.has(t,o)||(e=U6(r,t,e,o,n))}),s.low=a,s.lim=e++,i?s.parent=i:delete s.parent,e}function Y6(r){return Wa.find(r.edges(),function(t){return r.edge(t).cutvalue<0})}function X6(r,t,e){var n=e.v,i=e.w;t.hasEdge(n,i)||(n=e.w,i=e.v);var a=r.node(n),s=r.node(i),o=a,l=!1;a.lim>s.lim&&(o=s,l=!0);var u=Wa.filter(t.edges(),function(c){return l===RP(r,r.node(c.v),o)&&l!==RP(r,r.node(c.w),o)});return Wa.minBy(u,function(c){return fot(t,c)})}function K6(r,t,e,n){var i=e.v,a=e.w;r.removeEdge(i,a),r.setEdge(n.v,n.w,{}),RE(r),NE(r,t),wot(r,t)}function wot(r,t){var e=Wa.find(r.nodes(),function(i){return!t.node(i).parent}),n=pot(r,e);n=n.slice(1),Wa.forEach(n,function(i){var a=r.node(i).parent,s=t.edge(i,a),o=!1;s||(s=t.edge(a,i),o=!0),t.node(i).rank=t.node(a).rank+(o?s.minlen:-s.minlen)})}function xot(r,t,e){return r.hasEdge(t,e)}function RP(r,t,e){return e.low<=t.lim&&t.lim<=e.lim}var Eot=i0,Z6=Eot.longestPath,_ot=V6,Sot=yot,Mot=kot;function kot(r){switch(r.graph().ranker){case"network-simplex":LP(r);break;case"tight-tree":Oot(r);break;case"longest-path":Tot(r);break;default:LP(r)}}var Tot=Z6;function Oot(r){Z6(r),_ot(r)}function LP(r){Sot(r)}var rx=je,Cot=Aot;function Aot(r){var t=Not(r);rx.forEach(r.graph().dummyChains,function(e){for(var n=r.node(e),i=n.edgeObj,a=Pot(r,t,i.v,i.w),s=a.path,o=a.lca,l=0,u=s[l],c=!0;e!==i.w;){if(n=r.node(e),c){for(;(u=s[l])!==o&&r.node(u).maxRank<n.rank;)l++;u===o&&(c=!1)}if(!c){for(;l<s.length-1&&r.node(u=s[l+1]).minRank<=n.rank;)l++;u=s[l]}r.setParent(e,u),e=r.successors(e)[0]}})}function Pot(r,t,e,n){var i=[],a=[],s=Math.min(t[e].low,t[n].low),o=Math.max(t[e].lim,t[n].lim),l,u;l=e;do l=r.parent(l),i.push(l);while(l&&(t[l].low>s||o>t[l].lim));for(u=l,l=n;(l=r.parent(l))!==u;)a.push(l);return{path:i.concat(a.reverse()),lca:u}}function Not(r){var t={},e=0;function n(i){var a=e;rx.forEach(r.children(i),n),t[i]={low:a,lim:e++}}return rx.forEach(r.children(),n),t}var Ia=je,ix=Tr,Rot={run:Lot,cleanup:Fot};function Lot(r){var t=ix.addDummyNode(r,"root",{},"_root"),e=Iot(r),n=Ia.max(Ia.values(e))-1,i=2*n+1;r.graph().nestingRoot=t,Ia.forEach(r.edges(),function(s){r.edge(s).minlen*=i});var a=Dot(r)+1;Ia.forEach(r.children(),function(s){J6(r,t,i,a,n,e,s)}),r.graph().nodeRankFactor=i}function J6(r,t,e,n,i,a,s){var o=r.children(s);if(!o.length){s!==t&&r.setEdge(t,s,{weight:0,minlen:e});return}var l=ix.addBorderNode(r,"_bt"),u=ix.addBorderNode(r,"_bb"),c=r.node(s);r.setParent(l,s),c.borderTop=l,r.setParent(u,s),c.borderBottom=u,Ia.forEach(o,function(h){J6(r,t,e,n,i,a,h);var d=r.node(h),g=d.borderTop?d.borderTop:h,p=d.borderBottom?d.borderBottom:h,v=d.borderTop?n:2*n,m=g!==p?1:i-a[s]+1;r.setEdge(l,g,{weight:v,minlen:m,nestingEdge:!0}),r.setEdge(p,u,{weight:v,minlen:m,nestingEdge:!0})}),r.parent(s)||r.setEdge(t,l,{weight:0,minlen:i+a[s]})}function Iot(r){var t={};function e(n,i){var a=r.children(n);a&&a.length&&Ia.forEach(a,function(s){e(s,i+1)}),t[n]=i}return Ia.forEach(r.children(),function(n){e(n,1)}),t}function Dot(r){return Ia.reduce(r.edges(),function(t,e){return t+r.edge(e).weight},0)}function Fot(r){var t=r.graph();r.removeNode(t.nestingRoot),delete t.nestingRoot,Ia.forEach(r.edges(),function(e){var n=r.edge(e);n.nestingEdge&&r.removeEdge(e)})}var Db=je,Bot=Tr,zot=$ot;function $ot(r){function t(e){var n=r.children(e),i=r.node(e);if(n.length&&Db.forEach(n,t),Db.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,s=i.maxRank+1;a<s;++a)IP(r,"borderLeft","_bl",e,i,a),IP(r,"borderRight","_br",e,i,a)}}Db.forEach(r.children(),t)}function IP(r,t,e,n,i,a){var s={width:0,height:0,rank:a,borderType:t},o=i[t][a-1],l=Bot.addDummyNode(r,"border",s,e);i[t][a]=l,r.setParent(l,n),o&&r.setEdge(o,l,{weight:1})}var ea=je,jot={adjust:qot,undo:Wot};function qot(r){var t=r.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&Q6(r)}function Wot(r){var t=r.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&Got(r),(t==="lr"||t==="rl")&&(Vot(r),Q6(r))}function Q6(r){ea.forEach(r.nodes(),function(t){DP(r.node(t))}),ea.forEach(r.edges(),function(t){DP(r.edge(t))})}function DP(r){var t=r.width;r.width=r.height,r.height=t}function Got(r){ea.forEach(r.nodes(),function(t){Fb(r.node(t))}),ea.forEach(r.edges(),function(t){var e=r.edge(t);ea.forEach(e.points,Fb),ea.has(e,"y")&&Fb(e)})}function Fb(r){r.y=-r.y}function Vot(r){ea.forEach(r.nodes(),function(t){Bb(r.node(t))}),ea.forEach(r.edges(),function(t){var e=r.edge(t);ea.forEach(e.points,Bb),ea.has(e,"x")&&Bb(e)})}function Bb(r){var t=r.x;r.x=r.y,r.y=t}var xa=je,Hot=Uot;function Uot(r){var t={},e=xa.filter(r.nodes(),function(o){return!r.children(o).length}),n=xa.max(xa.map(e,function(o){return r.node(o).rank})),i=xa.map(xa.range(n+1),function(){return[]});function a(o){if(!xa.has(t,o)){t[o]=!0;var l=r.node(o);i[l.rank].push(o),xa.forEach(r.successors(o),a)}}var s=xa.sortBy(e,function(o){return r.node(o).rank});return xa.forEach(s,a),i}var cs=je,Yot=Xot;function Xot(r,t){for(var e=0,n=1;n<t.length;++n)e+=Kot(r,t[n-1],t[n]);return e}function Kot(r,t,e){for(var n=cs.zipObject(e,cs.map(e,function(u,c){return c})),i=cs.flatten(cs.map(t,function(u){return cs.sortBy(cs.map(r.outEdges(u),function(c){return{pos:n[c.w],weight:r.edge(c).weight}}),"pos")}),!0),a=1;a<e.length;)a<<=1;var s=2*a-1;a-=1;var o=cs.map(new Array(s),function(){return 0}),l=0;return cs.forEach(i.forEach(function(u){var c=u.pos+a;o[c]+=u.weight;for(var h=0;c>0;)c%2&&(h+=o[c+1]),c=c-1>>1,o[c]+=u.weight;l+=u.weight*h})),l}var FP=je,Zot=Jot;function Jot(r,t){return FP.map(t,function(e){var n=r.inEdges(e);if(n.length){var i=FP.reduce(n,function(a,s){var o=r.edge(s),l=r.node(s.v);return{sum:a.sum+o.weight*l.order,weight:a.weight+o.weight}},{sum:0,weight:0});return{v:e,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:e}})}var zr=je,Qot=tlt;function tlt(r,t){var e={};zr.forEach(r,function(i,a){var s=e[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};zr.isUndefined(i.barycenter)||(s.barycenter=i.barycenter,s.weight=i.weight)}),zr.forEach(t.edges(),function(i){var a=e[i.v],s=e[i.w];!zr.isUndefined(a)&&!zr.isUndefined(s)&&(s.indegree++,a.out.push(e[i.w]))});var n=zr.filter(e,function(i){return!i.indegree});return elt(n)}function elt(r){var t=[];function e(a){return function(s){s.merged||(zr.isUndefined(s.barycenter)||zr.isUndefined(a.barycenter)||s.barycenter>=a.barycenter)&&nlt(a,s)}}function n(a){return function(s){s.in.push(a),--s.indegree===0&&r.push(s)}}for(;r.length;){var i=r.pop();t.push(i),zr.forEach(i.in.reverse(),e(i)),zr.forEach(i.out,n(i))}return zr.map(zr.filter(t,function(a){return!a.merged}),function(a){return zr.pick(a,["vs","i","barycenter","weight"])})}function nlt(r,t){var e=0,n=0;r.weight&&(e+=r.barycenter*r.weight,n+=r.weight),t.weight&&(e+=t.barycenter*t.weight,n+=t.weight),r.vs=t.vs.concat(r.vs),r.barycenter=e/n,r.weight=n,r.i=Math.min(t.i,r.i),t.merged=!0}var Vu=je,rlt=Tr,ilt=alt;function alt(r,t){var e=rlt.partition(r,function(c){return Vu.has(c,"barycenter")}),n=e.lhs,i=Vu.sortBy(e.rhs,function(c){return-c.i}),a=[],s=0,o=0,l=0;n.sort(slt(!!t)),l=BP(a,i,l),Vu.forEach(n,function(c){l+=c.vs.length,a.push(c.vs),s+=c.barycenter*c.weight,o+=c.weight,l=BP(a,i,l)});var u={vs:Vu.flatten(a,!0)};return o&&(u.barycenter=s/o,u.weight=o),u}function BP(r,t,e){for(var n;t.length&&(n=Vu.last(t)).i<=e;)t.pop(),r.push(n.vs),e++;return e}function slt(r){return function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:r?e.i-t.i:t.i-e.i}}var ws=je,olt=Zot,llt=Qot,ult=ilt,clt=t4;function t4(r,t,e,n){var i=r.children(t),a=r.node(t),s=a?a.borderLeft:void 0,o=a?a.borderRight:void 0,l={};s&&(i=ws.filter(i,function(p){return p!==s&&p!==o}));var u=olt(r,i);ws.forEach(u,function(p){if(r.children(p.v).length){var v=t4(r,p.v,e,n);l[p.v]=v,ws.has(v,"barycenter")&&dlt(p,v)}});var c=llt(u,e);hlt(c,l);var h=ult(c,n);if(s&&(h.vs=ws.flatten([s,h.vs,o],!0),r.predecessors(s).length)){var d=r.node(r.predecessors(s)[0]),g=r.node(r.predecessors(o)[0]);ws.has(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+d.order+g.order)/(h.weight+2),h.weight+=2}return h}function hlt(r,t){ws.forEach(r,function(e){e.vs=ws.flatten(e.vs.map(function(n){return t[n]?t[n].vs:n}),!0)})}function dlt(r,t){ws.isUndefined(r.barycenter)?(r.barycenter=t.barycenter,r.weight=t.weight):(r.barycenter=(r.barycenter*r.weight+t.barycenter*t.weight)/(r.weight+t.weight),r.weight+=t.weight)}var Hu=je,flt=Bi.Graph,glt=plt;function plt(r,t,e){var n=vlt(r),i=new flt({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return r.node(a)});return Hu.forEach(r.nodes(),function(a){var s=r.node(a),o=r.parent(a);(s.rank===t||s.minRank<=t&&t<=s.maxRank)&&(i.setNode(a),i.setParent(a,o||n),Hu.forEach(r[e](a),function(l){var u=l.v===a?l.w:l.v,c=i.edge(u,a),h=Hu.isUndefined(c)?0:c.weight;i.setEdge(u,a,{weight:r.edge(l).weight+h})}),Hu.has(s,"minRank")&&i.setNode(a,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))}),i}function vlt(r){for(var t;r.hasNode(t=Hu.uniqueId("_root")););return t}var mlt=je,ylt=blt;function blt(r,t,e){var n={},i;mlt.forEach(e,function(a){for(var s=r.parent(a),o,l;s;){if(o=r.parent(s),o?(l=n[o],n[o]=s):(l=i,i=s),l&&l!==s){t.setEdge(l,s);return}s=o}})}var Ls=je,wlt=Hot,xlt=Yot,Elt=clt,_lt=glt,Slt=ylt,Mlt=Bi.Graph,zP=Tr,klt=Tlt;function Tlt(r){var t=zP.maxRank(r),e=$P(r,Ls.range(1,t+1),"inEdges"),n=$P(r,Ls.range(t-1,-1,-1),"outEdges"),i=wlt(r);jP(r,i);for(var a=Number.POSITIVE_INFINITY,s,o=0,l=0;l<4;++o,++l){Olt(o%2?e:n,o%4>=2),i=zP.buildLayerMatrix(r);var u=xlt(r,i);u<a&&(l=0,s=Ls.cloneDeep(i),a=u)}jP(r,s)}function $P(r,t,e){return Ls.map(t,function(n){return _lt(r,n,e)})}function Olt(r,t){var e=new Mlt;Ls.forEach(r,function(n){var i=n.graph().root,a=Elt(n,i,e,t);Ls.forEach(a.vs,function(s,o){n.node(s).order=o}),Slt(n,e,a.vs)})}function jP(r,t){Ls.forEach(t,function(e){Ls.forEach(e,function(n,i){r.node(n).order=i})})}var Dt=je,Clt=Bi.Graph,Alt=Tr,Plt={positionX:qlt};function Nlt(r,t){var e={};function n(i,a){var s=0,o=0,l=i.length,u=Dt.last(a);return Dt.forEach(a,function(c,h){var d=Llt(r,c),g=d?r.node(d).order:l;(d||c===u)&&(Dt.forEach(a.slice(o,h+1),function(p){Dt.forEach(r.predecessors(p),function(v){var m=r.node(v),b=m.order;(b<s||g<b)&&!(m.dummy&&r.node(p).dummy)&&e4(e,v,p)})}),o=h+1,s=g)}),a}return Dt.reduce(t,n),e}function Rlt(r,t){var e={};function n(a,s,o,l,u){var c;Dt.forEach(Dt.range(s,o),function(h){c=a[h],r.node(c).dummy&&Dt.forEach(r.predecessors(c),function(d){var g=r.node(d);g.dummy&&(g.order<l||g.order>u)&&e4(e,d,c)})})}function i(a,s){var o=-1,l,u=0;return Dt.forEach(s,function(c,h){if(r.node(c).dummy==="border"){var d=r.predecessors(c);d.length&&(l=r.node(d[0]).order,n(s,u,h,o,l),u=h,o=l)}n(s,u,s.length,l,a.length)}),s}return Dt.reduce(t,i),e}function Llt(r,t){if(r.node(t).dummy)return Dt.find(r.predecessors(t),function(e){return r.node(e).dummy})}function e4(r,t,e){if(t>e){var n=t;t=e,e=n}var i=r[t];i||(r[t]=i={}),i[e]=!0}function Ilt(r,t,e){if(t>e){var n=t;t=e,e=n}return Dt.has(r[t],e)}function Dlt(r,t,e,n){var i={},a={},s={};return Dt.forEach(t,function(o){Dt.forEach(o,function(l,u){i[l]=l,a[l]=l,s[l]=u})}),Dt.forEach(t,function(o){var l=-1;Dt.forEach(o,function(u){var c=n(u);if(c.length){c=Dt.sortBy(c,function(v){return s[v]});for(var h=(c.length-1)/2,d=Math.floor(h),g=Math.ceil(h);d<=g;++d){var p=c[d];a[u]===u&&l<s[p]&&!Ilt(e,u,p)&&(a[p]=u,a[u]=i[u]=i[p],l=s[p])}}})}),{root:i,align:a}}function Flt(r,t,e,n,i){var a={},s=Blt(r,t,e,i),o=i?"borderLeft":"borderRight";function l(h,d){for(var g=s.nodes(),p=g.pop(),v={};p;)v[p]?h(p):(v[p]=!0,g.push(p),g=g.concat(d(p))),p=g.pop()}function u(h){a[h]=s.inEdges(h).reduce(function(d,g){return Math.max(d,a[g.v]+s.edge(g))},0)}function c(h){var d=s.outEdges(h).reduce(function(p,v){return Math.min(p,a[v.w]-s.edge(v))},Number.POSITIVE_INFINITY),g=r.node(h);d!==Number.POSITIVE_INFINITY&&g.borderType!==o&&(a[h]=Math.max(a[h],d))}return l(u,s.predecessors.bind(s)),l(c,s.successors.bind(s)),Dt.forEach(n,function(h){a[h]=a[e[h]]}),a}function Blt(r,t,e,n){var i=new Clt,a=r.graph(),s=Wlt(a.nodesep,a.edgesep,n);return Dt.forEach(t,function(o){var l;Dt.forEach(o,function(u){var c=e[u];if(i.setNode(c),l){var h=e[l],d=i.edge(h,c);i.setEdge(h,c,Math.max(s(r,u,l),d||0))}l=u})}),i}function zlt(r,t){return Dt.minBy(Dt.values(t),function(e){var n=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return Dt.forIn(e,function(a,s){var o=Glt(r,s)/2;n=Math.max(a+o,n),i=Math.min(a-o,i)}),n-i})}function $lt(r,t){var e=Dt.values(t),n=Dt.min(e),i=Dt.max(e);Dt.forEach(["u","d"],function(a){Dt.forEach(["l","r"],function(s){var o=a+s,l=r[o],u;if(l!==t){var c=Dt.values(l);u=s==="l"?n-Dt.min(c):i-Dt.max(c),u&&(r[o]=Dt.mapValues(l,function(h){return h+u}))}})})}function jlt(r,t){return Dt.mapValues(r.ul,function(e,n){if(t)return r[t.toLowerCase()][n];var i=Dt.sortBy(Dt.map(r,n));return(i[1]+i[2])/2})}function qlt(r){var t=Alt.buildLayerMatrix(r),e=Dt.merge(Nlt(r,t),Rlt(r,t)),n={},i;Dt.forEach(["u","d"],function(s){i=s==="u"?t:Dt.values(t).reverse(),Dt.forEach(["l","r"],function(o){o==="r"&&(i=Dt.map(i,function(h){return Dt.values(h).reverse()}));var l=(s==="u"?r.predecessors:r.successors).bind(r),u=Dlt(r,i,e,l),c=Flt(r,i,u.root,u.align,o==="r");o==="r"&&(c=Dt.mapValues(c,function(h){return-h})),n[s+o]=c})});var a=zlt(r,n);return $lt(n,a),jlt(n,r.graph().align)}function Wlt(r,t,e){return function(n,i,a){var s=n.node(i),o=n.node(a),l=0,u;if(l+=s.width/2,Dt.has(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=-s.width/2;break;case"r":u=s.width/2;break}if(u&&(l+=e?u:-u),u=0,l+=(s.dummy?t:r)/2,l+=(o.dummy?t:r)/2,l+=o.width/2,Dt.has(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=o.width/2;break;case"r":u=-o.width/2;break}return u&&(l+=e?u:-u),u=0,l}}function Glt(r,t){return r.node(t).width}var Uu=je,n4=Tr,Vlt=Plt.positionX,Hlt=Ult;function Ult(r){r=n4.asNonCompoundGraph(r),Ylt(r),Uu.forEach(Vlt(r),function(t,e){r.node(e).x=t})}function Ylt(r){var t=n4.buildLayerMatrix(r),e=r.graph().ranksep,n=0;Uu.forEach(t,function(i){var a=Uu.max(Uu.map(i,function(s){return r.node(s).height}));Uu.forEach(i,function(s){r.node(s).y=n+a/2}),n+=a+e})}var Jt=je,qP=Bst,WP=eot,Xlt=Mot,Klt=Tr.normalizeRanks,Zlt=Cot,Jlt=Tr.removeEmptyRanks,GP=Rot,Qlt=zot,VP=jot,tut=klt,eut=Hlt,qs=Tr,nut=Bi.Graph,rut=iut;function iut(r,t){var e=t&&t.debugTiming?qs.time:qs.notime;e("layout",function(){var n=e(" buildLayoutGraph",function(){return put(r)});e(" runLayout",function(){aut(n,e)}),e(" updateInputGraph",function(){sut(r,n)})})}function aut(r,t){t(" makeSpaceForEdgeLabels",function(){vut(r)}),t(" removeSelfEdges",function(){Mut(r)}),t(" acyclic",function(){qP.run(r)}),t(" nestingGraph.run",function(){GP.run(r)}),t(" rank",function(){Xlt(qs.asNonCompoundGraph(r))}),t(" injectEdgeLabelProxies",function(){mut(r)}),t(" removeEmptyRanks",function(){Jlt(r)}),t(" nestingGraph.cleanup",function(){GP.cleanup(r)}),t(" normalizeRanks",function(){Klt(r)}),t(" assignRankMinMax",function(){yut(r)}),t(" removeEdgeLabelProxies",function(){but(r)}),t(" normalize.run",function(){WP.run(r)}),t(" parentDummyChains",function(){Zlt(r)}),t(" addBorderSegments",function(){Qlt(r)}),t(" order",function(){tut(r)}),t(" insertSelfEdges",function(){kut(r)}),t(" adjustCoordinateSystem",function(){VP.adjust(r)}),t(" position",function(){eut(r)}),t(" positionSelfEdges",function(){Tut(r)}),t(" removeBorderNodes",function(){Sut(r)}),t(" normalize.undo",function(){WP.undo(r)}),t(" fixupEdgeLabelCoords",function(){Eut(r)}),t(" undoCoordinateSystem",function(){VP.undo(r)}),t(" translateGraph",function(){wut(r)}),t(" assignNodeIntersects",function(){xut(r)}),t(" reversePoints",function(){_ut(r)}),t(" acyclic.undo",function(){qP.undo(r)})}function sut(r,t){Jt.forEach(r.nodes(),function(e){var n=r.node(e),i=t.node(e);n&&(n.x=i.x,n.y=i.y,t.children(e).length&&(n.width=i.width,n.height=i.height))}),Jt.forEach(r.edges(),function(e){var n=r.edge(e),i=t.edge(e);n.points=i.points,Jt.has(i,"x")&&(n.x=i.x,n.y=i.y)}),r.graph().width=t.graph().width,r.graph().height=t.graph().height}var out=["nodesep","edgesep","ranksep","marginx","marginy"],lut={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},uut=["acyclicer","ranker","rankdir","align"],cut=["width","height"],hut={width:0,height:0},dut=["minlen","weight","width","height","labeloffset"],fut={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},gut=["labelpos"];function put(r){var t=new nut({multigraph:!0,compound:!0}),e=$b(r.graph());return t.setGraph(Jt.merge({},lut,zb(e,out),Jt.pick(e,uut))),Jt.forEach(r.nodes(),function(n){var i=$b(r.node(n));t.setNode(n,Jt.defaults(zb(i,cut),hut)),t.setParent(n,r.parent(n))}),Jt.forEach(r.edges(),function(n){var i=$b(r.edge(n));t.setEdge(n,Jt.merge({},fut,zb(i,dut),Jt.pick(i,gut)))}),t}function vut(r){var t=r.graph();t.ranksep/=2,Jt.forEach(r.edges(),function(e){var n=r.edge(e);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function mut(r){Jt.forEach(r.edges(),function(t){var e=r.edge(t);if(e.width&&e.height){var n=r.node(t.v),i=r.node(t.w),a={rank:(i.rank-n.rank)/2+n.rank,e:t};qs.addDummyNode(r,"edge-proxy",a,"_ep")}})}function yut(r){var t=0;Jt.forEach(r.nodes(),function(e){var n=r.node(e);n.borderTop&&(n.minRank=r.node(n.borderTop).rank,n.maxRank=r.node(n.borderBottom).rank,t=Jt.max(t,n.maxRank))}),r.graph().maxRank=t}function but(r){Jt.forEach(r.nodes(),function(t){var e=r.node(t);e.dummy==="edge-proxy"&&(r.edge(e.e).labelRank=e.rank,r.removeNode(t))})}function wut(r){var t=Number.POSITIVE_INFINITY,e=0,n=Number.POSITIVE_INFINITY,i=0,a=r.graph(),s=a.marginx||0,o=a.marginy||0;function l(u){var c=u.x,h=u.y,d=u.width,g=u.height;t=Math.min(t,c-d/2),e=Math.max(e,c+d/2),n=Math.min(n,h-g/2),i=Math.max(i,h+g/2)}Jt.forEach(r.nodes(),function(u){l(r.node(u))}),Jt.forEach(r.edges(),function(u){var c=r.edge(u);Jt.has(c,"x")&&l(c)}),t-=s,n-=o,Jt.forEach(r.nodes(),function(u){var c=r.node(u);c.x-=t,c.y-=n}),Jt.forEach(r.edges(),function(u){var c=r.edge(u);Jt.forEach(c.points,function(h){h.x-=t,h.y-=n}),Jt.has(c,"x")&&(c.x-=t),Jt.has(c,"y")&&(c.y-=n)}),a.width=e-t+s,a.height=i-n+o}function xut(r){Jt.forEach(r.edges(),function(t){var e=r.edge(t),n=r.node(t.v),i=r.node(t.w),a,s;e.points?(a=e.points[0],s=e.points[e.points.length-1]):(e.points=[],a=i,s=n),e.points.unshift(qs.intersectRect(n,a)),e.points.push(qs.intersectRect(i,s))})}function Eut(r){Jt.forEach(r.edges(),function(t){var e=r.edge(t);if(Jt.has(e,"x"))switch((e.labelpos==="l"||e.labelpos==="r")&&(e.width-=e.labeloffset),e.labelpos){case"l":e.x-=e.width/2+e.labeloffset;break;case"r":e.x+=e.width/2+e.labeloffset;break}})}function _ut(r){Jt.forEach(r.edges(),function(t){var e=r.edge(t);e.reversed&&e.points.reverse()})}function Sut(r){Jt.forEach(r.nodes(),function(t){if(r.children(t).length){var e=r.node(t),n=r.node(e.borderTop),i=r.node(e.borderBottom),a=r.node(Jt.last(e.borderLeft)),s=r.node(Jt.last(e.borderRight));e.width=Math.abs(s.x-a.x),e.height=Math.abs(i.y-n.y),e.x=a.x+e.width/2,e.y=n.y+e.height/2}}),Jt.forEach(r.nodes(),function(t){r.node(t).dummy==="border"&&r.removeNode(t)})}function Mut(r){Jt.forEach(r.edges(),function(t){if(t.v===t.w){var e=r.node(t.v);e.selfEdges||(e.selfEdges=[]),e.selfEdges.push({e:t,label:r.edge(t)}),r.removeEdge(t)}})}function kut(r){var t=qs.buildLayerMatrix(r);Jt.forEach(t,function(e){var n=0;Jt.forEach(e,function(i,a){var s=r.node(i);s.order=a+n,Jt.forEach(s.selfEdges,function(o){qs.addDummyNode(r,"selfedge",{width:o.label.width,height:o.label.height,rank:s.rank,order:a+ ++n,e:o.e,label:o.label},"_se")}),delete s.selfEdges})})}function Tut(r){Jt.forEach(r.nodes(),function(t){var e=r.node(t);if(e.dummy==="selfedge"){var n=r.node(e.e.v),i=n.x+n.width/2,a=n.y,s=e.x-i,o=n.height/2;r.setEdge(e.e,e.label),r.removeNode(t),e.label.points=[{x:i+2*s/3,y:a-o},{x:i+5*s/6,y:a-o},{x:i+s,y:a},{x:i+5*s/6,y:a+o},{x:i+2*s/3,y:a+o}],e.label.x=e.x,e.label.y=e.y}})}function zb(r,t){return Jt.mapValues(Jt.pick(r,t),Number)}function $b(r){var t={};return Jt.forEach(r,function(e,n){t[n.toLowerCase()]=e}),t}var Nd=je,Out=Tr,Cut=Bi.Graph,Aut={debugOrdering:Put};function Put(r){var t=Out.buildLayerMatrix(r),e=new Cut({compound:!0,multigraph:!0}).setGraph({});return Nd.forEach(r.nodes(),function(n){e.setNode(n,{label:n}),e.setParent(n,"layer"+r.node(n).rank)}),Nd.forEach(r.edges(),function(n){e.setEdge(n.v,n.w,{},n.name)}),Nd.forEach(t,function(n,i){var a="layer"+i;e.setNode(a,{rank:"same"}),Nd.reduce(n,function(s,o){return e.setEdge(s,o,{style:"invis"}),o})}),e}var Nut="0.8.5",r4={graphlib:Bi,layout:rut,debug:Aut,util:{time:Tr.time,notime:Tr.notime},version:Nut};const Rut=ng(r4);class a0{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,a0.defaultOptions,t)}execute(t,e){return Vt(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),e))})}assign(t,e){return Vt(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,Object.assign(Object.assign({},this.options),e))})}genericDagreLayout(t,e,n){return Vt(this,void 0,void 0,function*(){const{nodeSize:i}=n,a=new r4.graphlib.Graph;a.setGraph(n),a.setDefaultEdgeLabel(()=>({}));const s=e.getAllNodes(),o=e.getAllEdges();[...s,...o].some(({id:u})=>yt(u))&&console.error("Dagre layout only support string id, it will convert number to string."),e.getAllNodes().forEach(u=>{const{id:c}=u,h=Object.assign({},u.data);if(i!==void 0){const[d,g]=Wc(Et(i)?i(u):i);Object.assign(h,{width:d,height:g})}a.setNode(c.toString(),h)}),e.getAllEdges().forEach(({id:u,source:c,target:h})=>{a.setEdge(c.toString(),h.toString(),{id:u})}),Rut.layout(a);const l={nodes:[],edges:[]};return a.nodes().forEach(u=>{const c=a.node(u);l.nodes.push({id:u,data:c}),t&&e.mergeNodeData(u,c)}),a.edges().forEach(u=>{const c=a.edge(u),{id:h}=c,d=Je(c,["id"]),{v:g,w:p}=u;l.edges.push({id:h,source:g,target:p,data:d}),t&&e.mergeEdgeData(h,d)}),l})}}a0.defaultOptions={};class LE{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,n=this.ry-t.ry;return Math.hypot(e,n)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,n=t.ry-this.ry;let i=Math.hypot(e,n);i=i<1e-4?1e-4:i;const a=this.g*(this.degree+1)*(t.degree+1)/i;this.fx+=a*e/i,this.fy+=a*n/i}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,n=(this.rx*this.mass+t.rx*t.mass)/e,i=(this.ry*this.mass+t.ry*t.mass)/e,a=this.degree+t.degree,s={rx:n,ry:i,mass:e,degree:a};return new LE(s)}}class Pl{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const n=this.length/2;return t<=this.xmid+n&&t>=this.xmid-n&&e<=this.ymid+n&&e>=this.ymid-n}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n};return new Pl(i)}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n};return new Pl(i)}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n};return new Pl(i)}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n};return new Pl(i)}}class Nl{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,t!=null&&(this.quad=t)}insert(t){if(this.body==null){this.body=t;return}this._isExternal()?(this.quad&&(this.NW=new Nl(this.quad.NW()),this.NE=new Nl(this.quad.NE()),this.SW=new Nl(this.quad.SW()),this.SE=new Nl(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t))}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null}updateForce(t){if(!(this.body==null||t===this.body))if(this._isExternal())t.addForce(this.body);else{const e=this.quad?this.quad.getLength():0,n=this.body.distanceTo(t);e/n<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t))}}}const Lut={center:[0,0],width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1};class Iut{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},Lut),t)}execute(t,e){return Vt(this,void 0,void 0,function*(){return this.genericForceAtlas2Layout(!1,t,e)})}assign(t,e){return Vt(this,void 0,void 0,function*(){yield this.genericForceAtlas2Layout(!0,t,e)})}genericForceAtlas2Layout(t,e,n){return Vt(this,void 0,void 0,function*(){const i=e.getAllEdges(),a=e.getAllNodes(),s=this.formatOptions(n,a.length),{width:o,height:l,prune:u,maxIteration:c,nodeSize:h,center:d}=s;if(!(a!=null&&a.length)||a.length===1)return Ho(e,t,d);const g=a.map(b=>Wr(b,[o,l])),p=i.filter(b=>{const{source:w,target:x}=b;return w!==x}),v=new Mn({nodes:g,edges:p}),m=this.getSizes(v,h);if(this.run(v,e,c,m,t,s),u){for(let w=0;w<p.length;w+=1){const{source:x,target:_}=p[w],S=v.getDegree(x),M=v.getDegree(x);if(S<=1){const k=v.getNode(_);v.mergeNodeData(x,{x:k.data.x,y:k.data.y})}else if(M<=1){const k=v.getNode(x);v.mergeNodeData(_,{x:k.data.x,y:k.data.y})}}const b=Object.assign(Object.assign({},s),{prune:!1,barnesHut:!1});this.run(v,e,100,m,t,b)}return{nodes:g,edges:i}})}getSizes(t,e){const n=t.getAllNodes(),i={};for(let a=0;a<n.length;a+=1){const s=n[a];i[s.id]=uE(e,void 0)(s)}return i}formatOptions(t={},e){const n=Object.assign(Object.assign({},this.options),t),{center:i,width:a,height:s,barnesHut:o,prune:l,maxIteration:u,kr:c,kg:h}=n;return n.width=!a&&typeof window<"u"?window.innerWidth:a,n.height=!s&&typeof window<"u"?window.innerHeight:s,n.center=i||[n.width/2,n.height/2],o===void 0&&e>250&&(n.barnesHut=!0),l===void 0&&e>100&&(n.prune=!0),u===0&&!l?(n.maxIteration=250,e<=200&&e>100?n.maxIteration=1e3:e>200&&(n.maxIteration=1200)):u===0&&l&&(n.maxIteration=100,e<=200&&e>100?n.maxIteration=500:e>200&&(n.maxIteration=950)),c||(n.kr=50,e>100&&e<=500?n.kr=20:e>500&&(n.kr=1)),h||(n.kg=20,e>100&&e<=500?n.kg=10:e>500&&(n.kg=1)),n}run(t,e,n,i,a,s){const{kr:o,barnesHut:l,onTick:u}=s,c=t.getAllNodes();let h=0,d=n;const g={},p={},v={};for(let m=0;m<c.length;m+=1){const{data:b,id:w}=c[m];if(g[w]=[0,0],l){const x={id:m,rx:b.x,ry:b.y,mass:1,g:o,degree:t.getDegree(w)};v[w]=new LE(x)}}for(;d>0;)h=this.oneStep(t,{iter:d,preventOverlapIters:50,krPrime:100,sg:h,forces:g,preForces:p,bodies:v,sizes:i},s),d--,u==null||u({nodes:c,edges:e.getAllEdges()});return t}oneStep(t,e,n){const{iter:i,preventOverlapIters:a,krPrime:s,sg:o,preForces:l,bodies:u,sizes:c}=e;let{forces:h}=e;const{preventOverlap:d,barnesHut:g}=n,p=t.getAllNodes();for(let v=0;v<p.length;v+=1){const{id:m}=p[v];l[m]=[...h[m]],h[m]=[0,0]}return h=this.getAttrForces(t,i,a,c,h,n),g&&(d&&i>a||!d)?h=this.getOptRepGraForces(t,h,u,n):h=this.getRepGraForces(t,i,a,h,s,c,n),this.updatePos(t,h,l,o,n)}getAttrForces(t,e,n,i,a,s){const{preventOverlap:o,dissuadeHubs:l,mode:u,prune:c}=s,h=t.getAllEdges();for(let d=0;d<h.length;d+=1){const{source:g,target:p}=h[d],v=t.getNode(g),m=t.getNode(p),b=t.getDegree(g),w=t.getDegree(p);if(c&&(b<=1||w<=1))continue;const x=[m.data.x-v.data.x,m.data.y-v.data.y];let _=Math.hypot(x[0],x[1]);_=_<1e-4?1e-4:_,x[0]=x[0]/_,x[1]=x[1]/_,o&&e<n&&(_=_-i[g]-i[p]);let S=_,M=S;u==="linlog"&&(S=Math.log(1+_),M=S),l&&(S=_/b,M=_/w),o&&e<n&&_<=0?(S=0,M=0):o&&e<n&&_>0&&(S=_,M=_),a[g][0]+=S*x[0],a[p][0]-=M*x[0],a[g][1]+=S*x[1],a[p][1]-=M*x[1]}return a}getOptRepGraForces(t,e,n,i){const{kg:a,center:s,prune:o}=i,l=t.getAllNodes(),u=l.length;let c=9e10,h=-9e10,d=9e10,g=-9e10;for(let w=0;w<u;w+=1){const{id:x,data:_}=l[w];o&&t.getDegree(x)<=1||(n[x].setPos(_.x,_.y),_.x>=h&&(h=_.x),_.x<=c&&(c=_.x),_.y>=g&&(g=_.y),_.y<=d&&(d=_.y))}const p=Math.max(h-c,g-d),v={xmid:(h+c)/2,ymid:(g+d)/2,length:p,massCenter:s,mass:u},m=new Pl(v),b=new Nl(m);for(let w=0;w<u;w+=1){const{id:x}=l[w];o&&t.getDegree(x)<=1||n[x].in(m)&&b.insert(n[x])}for(let w=0;w<u;w+=1){const{id:x,data:_}=l[w],S=t.getDegree(x);if(o&&S<=1)continue;n[x].resetForce(),b.updateForce(n[x]),e[x][0]-=n[x].fx,e[x][1]-=n[x].fy;const M=[_.x-s[0],_.y-s[1]];let k=Math.hypot(M[0],M[1]);k=k<1e-4?1e-4:k,M[0]=M[0]/k,M[1]=M[1]/k;const T=a*(S+1);e[x][0]-=T*M[0],e[x][1]-=T*M[1]}return e}getRepGraForces(t,e,n,i,a,s,o){const{preventOverlap:l,kr:u,kg:c,center:h,prune:d}=o,g=t.getAllNodes(),p=g.length;for(let v=0;v<p;v+=1){const m=g[v],b=t.getDegree(m.id);for(let S=v+1;S<p;S+=1){const M=g[S],k=t.getDegree(M.id);if(d&&(b<=1||k<=1))continue;const T=[M.data.x-m.data.x,M.data.y-m.data.y];let P=Math.hypot(T[0],T[1]);P=P<1e-4?1e-4:P,T[0]=T[0]/P,T[1]=T[1]/P,l&&e<n&&(P=P-s[m.id]-s[M.id]);let O=u*(b+1)*(k+1)/P;l&&e<n&&P<0?O=a*(b+1)*(k+1):l&&e<n&&P===0?O=0:l&&e<n&&P>0&&(O=u*(b+1)*(k+1)/P),i[m.id][0]-=O*T[0],i[M.id][0]+=O*T[0],i[m.id][1]-=O*T[1],i[M.id][1]+=O*T[1]}const w=[m.data.x-h[0],m.data.y-h[1]],x=Math.hypot(w[0],w[1]);w[0]=w[0]/x,w[1]=w[1]/x;const _=c*(b+1);i[m.id][0]-=_*w[0],i[m.id][1]-=_*w[1]}return i}updatePos(t,e,n,i,a){const{ks:s,tao:o,prune:l,ksmax:u}=a,c=t.getAllNodes(),h=c.length,d=[],g=[];let p=0,v=0,m=i;for(let w=0;w<h;w+=1){const{id:x}=c[w],_=t.getDegree(x);if(l&&_<=1)continue;const S=[e[x][0]-n[x][0],e[x][1]-n[x][1]],M=Math.hypot(S[0],S[1]),k=[e[x][0]+n[x][0],e[x][1]+n[x][1]],T=Math.hypot(k[0],k[1]);d[w]=M,g[w]=T/2,p+=(_+1)*d[w],v+=(_+1)*g[w]}const b=m;m=o*v/p,b!==0&&(m=m>1.5*b?1.5*b:m);for(let w=0;w<h;w+=1){const{id:x,data:_}=c[w],S=t.getDegree(x);if(l&&S<=1||yt(_.fx)&&yt(_.fy))continue;let M=s*m/(1+m*Math.sqrt(d[w])),k=Math.hypot(e[x][0],e[x][1]);k=k<1e-4?1e-4:k;const T=u/k;M=M>T?T:M;const P=M*e[x][0],O=M*e[x][1];t.mergeNodeData(x,{x:_.x+P,y:_.y+O})}return m}}const Dut={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},Fut=800;class But{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},Dut),t)}execute(t,e){return Vt(this,void 0,void 0,function*(){return this.genericFruchtermanLayout(!1,t,e)})}assign(t,e){return Vt(this,void 0,void 0,function*(){yield this.genericFruchtermanLayout(!0,t,e)})}stop(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let n=0;n<t;n++)this.runOneStep(this.lastGraph,this.lastClusterMap,this.lastOptions);const e={nodes:this.lastLayoutNodes,edges:this.lastLayoutEdges};return this.lastAssign&&e.nodes.forEach(n=>this.lastGraph.mergeNodeData(n.id,{x:n.data.x,y:n.data.y,z:this.options.dimensions===3?n.data.z:void 0})),e}genericFruchtermanLayout(t,e,n){return Vt(this,void 0,void 0,function*(){if(this.running)return;const i=this.formatOptions(n),{dimensions:a,width:s,height:o,center:l,clustering:u,nodeClusterBy:c,maxIteration:h,onTick:d}=i,g=e.getAllNodes(),p=e.getAllEdges();if(!(g!=null&&g.length)){const x={nodes:[],edges:p};return this.lastResult=x,x}if(g.length===1){t&&e.mergeNodeData(g[0].id,{x:l[0],y:l[1],z:a===3?l[2]:void 0});const x={nodes:[Object.assign(Object.assign({},g[0]),{data:Object.assign(Object.assign({},g[0].data),{x:l[0],y:l[1],z:a===3?l[2]:void 0})})],edges:p};return this.lastResult=x,x}const v=g.map(x=>Wr(x,[s,o])),m=new Mn({nodes:v,edges:p}),b={};if(u&&v.forEach(x=>{const _=x.data[c];b[_]||(b[_]={name:_,cx:0,cy:0,count:0})}),this.lastLayoutNodes=v,this.lastLayoutEdges=p,this.lastAssign=t,this.lastGraph=m,this.lastOptions=i,this.lastClusterMap=b,typeof window>"u")return;let w=0;return new Promise(x=>{this.timeInterval=window.setInterval(()=>{if(!this.running){x({nodes:v,edges:p});return}this.runOneStep(m,b,i),t&&v.forEach(({id:_,data:S})=>e.mergeNodeData(_,{x:S.x,y:S.y,z:a===3?S.z:void 0})),d==null||d({nodes:v,edges:p}),w++,w>=h&&(window.clearInterval(this.timeInterval),x({nodes:v,edges:p}))},0),this.running=!0})})}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:n,nodeClusterBy:i}=e,{center:a,width:s,height:o}=e;return e.width=!s&&typeof window<"u"?window.innerWidth:s,e.height=!o&&typeof window<"u"?window.innerHeight:o,e.center=a||[e.width/2,e.height/2],e.clustering=n&&!!i,e}runOneStep(t,e,n){const{dimensions:i,height:a,width:s,gravity:o,center:l,speed:u,clustering:c,nodeClusterBy:h,clusterGravity:d}=n,g=a*s,p=Math.sqrt(g)/10,v=t.getAllNodes(),m=g/(v.length+1),b=Math.sqrt(m),w={};if(this.applyCalculate(t,w,b,m),c){for(const _ in e)e[_].cx=0,e[_].cy=0,e[_].count=0;v.forEach(_=>{const{data:S}=_,M=e[S[h]];yt(S.x)&&(M.cx+=S.x),yt(S.y)&&(M.cy+=S.y),M.count++});for(const _ in e)e[_].cx/=e[_].count,e[_].cy/=e[_].count;const x=d||o;v.forEach((_,S)=>{const{id:M,data:k}=_;if(!yt(k.x)||!yt(k.y))return;const T=e[k[h]],P=Math.sqrt((k.x-T.cx)*(k.x-T.cx)+(k.y-T.cy)*(k.y-T.cy)),O=b*x;w[M].x-=O*(k.x-T.cx)/P,w[M].y-=O*(k.y-T.cy)/P})}v.forEach((x,_)=>{const{id:S,data:M}=x;if(!yt(M.x)||!yt(M.y))return;const k=.01*b*o;w[S].x-=k*(M.x-l[0]),w[S].y-=k*(M.y-l[1]),i===3&&(w[S].z-=k*(M.z-l[2]))}),v.forEach((x,_)=>{const{id:S,data:M}=x;if(yt(M.fx)&&yt(M.fy)){M.x=M.fx,M.y=M.fy,i===3&&(M.z=M.fz);return}if(!yt(M.x)||!yt(M.y))return;const k=Math.sqrt(w[S].x*w[S].x+w[S].y*w[S].y+(i===3?w[S].z*w[S].z:0));if(k>0){const T=Math.min(p*(u/Fut),k);t.mergeNodeData(S,{x:M.x+w[S].x/k*T,y:M.y+w[S].y/k*T,z:i===3?M.z+w[S].z/k*T:void 0})}})}applyCalculate(t,e,n,i){this.calRepulsive(t,e,i),this.calAttractive(t,e,n)}calRepulsive(t,e,n){const i=t.getAllNodes();i.forEach(({data:a,id:s},o)=>{e[s]={x:0,y:0,z:0},i.forEach(({data:l,id:u},c)=>{if(o<=c||!yt(a.x)||!yt(l.x)||!yt(a.y)||!yt(l.y))return;let h=a.x-l.x,d=a.y-l.y,g=this.options.dimensions===3?a.z-l.z:0,p=h*h+d*d+g*g;p===0&&(p=1,h=.01,d=.01,g=.01);const v=n/p,m=h*v,b=d*v,w=g*v;e[s].x+=m,e[s].y+=b,e[u].x-=m,e[u].y-=b,this.options.dimensions===3&&(e[s].z+=w,e[u].z-=w)})})}calAttractive(t,e,n){t.getAllEdges().forEach(a=>{const{source:s,target:o}=a;if(!s||!o||s===o)return;const{data:l}=t.getNode(s),{data:u}=t.getNode(o);if(!yt(u.x)||!yt(l.x)||!yt(u.y)||!yt(l.y))return;const c=u.x-l.x,h=u.y-l.y,d=this.options.dimensions===3?u.z-l.z:0,g=Math.sqrt(c*c+h*h+d*d)/n,p=c*g,v=h*g,m=d*g;e[s].x+=p,e[s].y+=v,e[o].x-=p,e[o].y-=v,this.options.dimensions===3&&(e[s].z+=m,e[o].z-=m)})}}const zut={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300};class $ut{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},zut),t)}execute(t,e){return Vt(this,void 0,void 0,function*(){return this.genericGridLayout(!1,t,e)})}assign(t,e){return Vt(this,void 0,void 0,function*(){yield this.genericGridLayout(!0,t,e)})}genericGridLayout(t,e,n){return Vt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{begin:a=[0,0],condense:s,preventOverlapPadding:o,preventOverlap:l,rows:u,cols:c,nodeSpacing:h,nodeSize:d,width:g,height:p,position:v}=i;let{sortBy:m}=i;const b=e.getAllNodes(),w=e.getAllEdges(),x=b==null?void 0:b.length;if(!x||x===1)return Ho(e,t,a);const _=b.map(j=>Wr(j));m!=="id"&&(!oe(m)||_[0].data[m]===void 0)&&(m="degree"),m==="degree"?_.sort((j,$)=>e.getDegree($.id,"both")-e.getDegree(j.id,"both")):m==="id"?_.sort((j,$)=>yt($.id)&&yt(j.id)?$.id-j.id:`${j.id}`.localeCompare(`${$.id}`)):_.sort((j,$)=>$.data[m]-j.data[m]);const S=!g&&typeof window<"u"?window.innerWidth:g,M=!p&&typeof window<"u"?window.innerHeight:p,k=x,T={rows:u,cols:c};if(u!=null&&c!=null)T.rows=u,T.cols=c;else if(u!=null&&c==null)T.rows=u,T.cols=Math.ceil(k/T.rows);else if(u==null&&c!=null)T.cols=c,T.rows=Math.ceil(k/T.cols);else{const j=Math.sqrt(k*M/S);T.rows=Math.round(j),T.cols=Math.round(S/M*j)}if(T.rows=Math.max(T.rows,1),T.cols=Math.max(T.cols,1),T.cols*T.rows>k){const j=Rd(T),$=Ld(T);(j-1)*$>=k?Rd(T,j-1):($-1)*j>=k&&Ld(T,$-1)}else for(;T.cols*T.rows<k;){const j=Rd(T),$=Ld(T);($+1)*j>=k?Ld(T,$+1):Rd(T,j+1)}let P=s?0:S/T.cols,O=s?0:M/T.rows;if(l||h){const j=Oo(10,h),$=lE(30,d,!1);_.forEach(B=>{(!B.data.x||!B.data.y)&&(B.data.x=0,B.data.y=0);const F=e.getNode(B.id),[V,X]=Wc($(F)||30),K=j!==void 0?j(B):o,dt=V+K,ct=X+K;P=Math.max(P,dt),O=Math.max(O,ct)})}const A={},R={row:0,col:0},L={};for(let j=0;j<_.length;j++){const $=_[j];let B;if(v&&(B=v(e.getNode($.id))),B&&(B.row!==void 0||B.col!==void 0)){const F={row:B.row,col:B.col};if(F.col===void 0)for(F.col=0;ax(A,F);)F.col++;else if(F.row===void 0)for(F.row=0;ax(A,F);)F.row++;L[$.id]=F,i4(A,F)}jut($,a,P,O,L,T,R,A)}const q={nodes:_,edges:w};return t&&_.forEach(j=>{e.mergeNodeData(j.id,{x:j.data.x,y:j.data.y})}),q})}}const Rd=(r,t)=>{let e;const n=r.rows||5,i=r.cols||5;return t==null?e=Math.min(n,i):Math.min(n,i)===r.rows?r.rows=t:r.cols=t,e},Ld=(r,t)=>{let e;const n=r.rows||5,i=r.cols||5;return t==null?e=Math.max(n,i):Math.max(n,i)===r.rows?r.rows=t:r.cols=t,e},ax=(r,t)=>r[`c-${t.row}-${t.col}`]||!1,i4=(r,t)=>r[`c-${t.row}-${t.col}`]=!0,HP=(r,t)=>{const e=r.cols||5;t.col++,t.col>=e&&(t.col=0,t.row++)},jut=(r,t,e,n,i,a,s,o)=>{let l,u;const c=i[r.id];if(c)l=c.col*e+e/2+t[0],u=c.row*n+n/2+t[1];else{for(;ax(o,s);)HP(a,s);l=s.col*e+e/2+t[0],u=s.row*n+n/2+t[1],i4(o,s),HP(a,s)}r.data.x=l,r.data.y=u},qut=(r,t,e)=>{try{const n=Ts.mul(Ts.pow(t,2),-.5),i=n.mean("row"),a=n.mean("column"),s=n.mean();n.add(s).subRowVector(i).subColumnVector(a);const o=new ID(n),l=Ts.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map(u=>Ts.mul([u],[l]).toJSON()[0].splice(0,r))}catch{const i=[];for(let a=0;a<t.length;a++){const s=Math.random()*e,o=Math.random()*e;i.push([s,o])}return i}},Wut=800,Gut={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},Vut=(r,t)=>{const e=Object.assign(Object.assign({},Gut),t),{positions:n,iterations:i,width:a,k:s,speed:o=100,strictRadial:l,focusIdx:u,radii:c=[],nodeSizeFunc:h}=e,d=r.getAllNodes(),g=[],p=a/10;for(let v=0;v<i;v++)n.forEach((m,b)=>{g[b]={x:0,y:0}}),Hut(d,n,g,s,c,h),Uut(n,g,o,l,u,p,a,c);return n},Hut=(r,t,e,n,i,a)=>{t.forEach((s,o)=>{e[o]={x:0,y:0},t.forEach((l,u)=>{if(o===u||i[o]!==i[u])return;let c=s.x-l.x,h=s.y-l.y,d=Math.sqrt(c*c+h*h);if(d===0){d=1;const g=o>u?1:-1;c=.01*g,h=.01*g}if(d<a(r[o])/2+a(r[u])/2){const g=n*n/d;e[o].x+=c/d*g,e[o].y+=h/d*g}})})},Uut=(r,t,e,n,i,a,s,o)=>{const l=a||s/10;return n&&t.forEach((u,c)=>{const h=r[c].x-r[i].x,d=r[c].y-r[i].y,g=Math.sqrt(h*h+d*d);let p=d/g,v=-h/g;const m=Math.sqrt(u.x*u.x+u.y*u.y);let b=Math.acos((p*u.x+v*u.y)/m);b>Math.PI/2&&(b-=Math.PI/2,p*=-1,v*=-1);const w=Math.cos(b)*m;u.x=p*w,u.y=v*w}),r.forEach((u,c)=>{if(c===i)return;const h=Math.sqrt(t[c].x*t[c].x+t[c].y*t[c].y);if(h>0&&c!==i){const d=Math.min(l*(e/Wut),h);if(u.x+=t[c].x/h*d,u.y+=t[c].y/h*d,n){let g=u.x-r[i].x,p=u.y-r[i].y;const v=Math.sqrt(g*g+p*p);g=g/v*o[c],p=p/v*o[c],u.x=r[i].x+g,u.y=r[i].y+p}}}),r},Yut={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class Xut{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},Yut),t)}execute(t,e){return Vt(this,void 0,void 0,function*(){return this.genericRadialLayout(!1,t,e)})}assign(t,e){return Vt(this,void 0,void 0,function*(){yield this.genericRadialLayout(!0,t,e)})}genericRadialLayout(t,e,n){return Vt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,focusNode:l,unitRadius:u,nodeSize:c,nodeSpacing:h,strictRadial:d,preventOverlap:g,maxPreventOverlapIteration:p,sortBy:v,linkDistance:m=50,sortStrength:b=10,maxIteration:w=1e3}=i,x=e.getAllNodes(),_=e.getAllEdges(),S=!a&&typeof window<"u"?window.innerWidth:a,M=!s&&typeof window<"u"?window.innerHeight:s,k=o||[S/2,M/2];if(!(x!=null&&x.length)||x.length===1)return Ho(e,t,k);let T=x[0];if(oe(l)){for(let wt=0;wt<x.length;wt++)if(x[wt].id===l){T=x[wt];break}}else T=l||x[0];const P=Jut(x,T.id),O=ED({nodes:x,edges:_}),A=xD(O),R=tct(A,P);Qut(A,P,R+1);const L=A[P];let q=S-k[0]>k[0]?k[0]:S-k[0],j=M-k[1]>k[1]?k[1]:M-k[1];q===0&&(q=S/2),j===0&&(j=M/2);const $=Math.min(q,j),B=Math.max(...L),F=[],V=u||$/B;L.forEach((wt,Bt)=>{F[Bt]=wt*V});const X=Kut(x,A,m,F,V,v,b),K=Zut(X),dt=qut(m,X,m);let ct=dt.map(([wt,Bt])=>({x:(isNaN(wt)?Math.random()*m:wt)-dt[P][0],y:(isNaN(Bt)?Math.random()*m:Bt)-dt[P][1]}));this.run(w,ct,K,X,F,P);let ht;if(g){ht=uE(c,h);const wt={nodes:x,nodeSizeFunc:ht,positions:ct,radii:F,height:M,width:S,strictRadial:!!d,focusIdx:P,iterations:p||200,k:ct.length/4.5};ct=Vut(e,wt)}const lt=[];return ct.forEach((wt,Bt)=>{const Ut=Wr(x[Bt]);Ut.data.x=wt.x+k[0],Ut.data.y=wt.y+k[1],lt.push(Ut)}),t&<.forEach(wt=>e.mergeNodeData(wt.id,{x:wt.data.x,y:wt.data.y})),{nodes:lt,edges:_}})}run(t,e,n,i,a,s){for(let o=0;o<=t;o++){const l=o/t;this.oneIteration(l,e,a,i,n,s)}}oneIteration(t,e,n,i,a,s){const o=1-t;e.forEach((l,u)=>{const c=Tk(l,{x:0,y:0}),h=c===0?0:1/c;if(u===s)return;let d=0,g=0,p=0;e.forEach((m,b)=>{if(u===b)return;const w=Tk(l,m),x=w===0?0:1/w,_=i[b][u];p+=a[u][b],d+=a[u][b]*(m.x+_*(l.x-m.x)*x),g+=a[u][b]*(m.y+_*(l.y-m.y)*x)});const v=n[u]===0?0:1/n[u];p*=o,p+=t*v*v,d*=o,d+=t*v*l.x*h,l.x=d/p,g*=o,g+=t*v*l.y*h,l.y=g/p})}}const Kut=(r,t,e,n,i,a,s)=>{if(!r)return[];const o=[];if(t){const l={};t.forEach((u,c)=>{const h=[];u.forEach((d,g)=>{var p,v;if(c===g)h.push(0);else if(n[c]===n[g])if(a==="data")h.push(d*(Math.abs(c-g)*s)/(n[c]/i));else if(a){let m,b;if(l[r[c].id])m=l[r[c].id];else{const w=(a==="id"?r[c].id:(p=r[c].data)===null||p===void 0?void 0:p[a])||0;oe(w)?m=w.charCodeAt(0):m=w,l[r[c].id]=m}if(l[r[g].id])b=l[r[g].id];else{const w=(a==="id"?r[g].id:(v=r[g].data)===null||v===void 0?void 0:v[a])||0;oe(w)?b=w.charCodeAt(0):b=w,l[r[g].id]=b}h.push(d*(Math.abs(m-b)*s)/(n[c]/i))}else h.push(d*e/(n[c]/i));else{const m=(e+i)/2;h.push(d*m)}}),o.push(h)})}return o},Zut=r=>{const t=r.length,e=r[0].length,n=[];for(let i=0;i<t;i++){const a=[];for(let s=0;s<e;s++)r[i][s]!==0?a.push(1/(r[i][s]*r[i][s])):a.push(0);n.push(a)}return n},Jut=(r,t)=>{let e=-1;return r.forEach((n,i)=>{n.id===t&&(e=i)}),Math.max(e,0)},Qut=(r,t,e)=>{const n=r.length;for(let i=0;i<n;i++)if(r[t][i]===1/0){r[t][i]=e,r[i][t]=e;for(let a=0;a<n;a++)r[i][a]!==1/0&&r[t][a]===1/0&&(r[t][a]=e+r[i][a],r[a][t]=e+r[i][a])}for(let i=0;i<n;i++)if(i!==t){for(let a=0;a<n;a++)if(r[i][a]===1/0){let s=Math.abs(r[t][i]-r[t][a]);s=s===0?1:s,r[i][a]=s}}},tct=(r,t)=>{let e=0;for(let n=0;n<r[t].length;n++)r[t][n]!==1/0&&(e=r[t][n]>e?r[t][n]:e);return e},ect={center:[0,0],width:300,height:300};class nct{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},ect),t)}execute(t,e){return Vt(this,void 0,void 0,function*(){return this.genericRandomLayout(!1,t,e)})}assign(t,e){return Vt(this,void 0,void 0,function*(){yield this.genericRandomLayout(!0,t,e)})}genericRandomLayout(t,e,n){return Vt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o}=i,l=e.getAllNodes(),u=.9,c=!s&&typeof window<"u"?window.innerWidth:s,h=!o&&typeof window<"u"?window.innerHeight:o,d=a||[c/2,h/2],g=[];return l&&l.forEach(v=>{g.push({id:v.id,data:{x:(Math.random()-.5)*u*c+d[0],y:(Math.random()-.5)*u*h+d[1]}})}),t&&g.forEach(v=>e.mergeNodeData(v.id,{x:v.data.x,y:v.data.y})),{nodes:g,edges:e.getAllEdges()}})}}/**
- * @license
- * Copyright 2019 Google LLC
- * SPDX-License-Identifier: Apache-2.0
- */const a4=Symbol("Comlink.proxy"),rct=Symbol("Comlink.endpoint"),s4=Symbol("Comlink.releaseProxy"),jb=Symbol("Comlink.finalizer"),af=Symbol("Comlink.thrown"),o4=r=>typeof r=="object"&&r!==null||typeof r=="function",ict={canHandle:r=>o4(r)&&r[a4],serialize(r){const{port1:t,port2:e}=new MessageChannel;return u4(r,t),[e,[e]]},deserialize(r){return r.start(),h4(r)}},act={canHandle:r=>o4(r)&&af in r,serialize({value:r}){let t;return r instanceof Error?t={isError:!0,value:{message:r.message,name:r.name,stack:r.stack}}:t={isError:!1,value:r},[t,[]]},deserialize(r){throw r.isError?Object.assign(new Error(r.value.message),r.value):r.value}},l4=new Map([["proxy",ict],["throw",act]]);function sct(r,t){for(const e of r)if(t===e||e==="*"||e instanceof RegExp&&e.test(t))return!0;return!1}function u4(r,t=globalThis,e=["*"]){t.addEventListener("message",function n(i){if(!i||!i.data)return;if(!sct(e,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:s,path:o}=Object.assign({path:[]},i.data),l=(i.data.argumentList||[]).map(mo);let u;try{const c=o.slice(0,-1).reduce((d,g)=>d[g],r),h=o.reduce((d,g)=>d[g],r);switch(s){case"GET":u=h;break;case"SET":c[o.slice(-1)[0]]=mo(i.data.value),u=!0;break;case"APPLY":u=h.apply(c,l);break;case"CONSTRUCT":{const d=new h(...l);u=dct(d)}break;case"ENDPOINT":{const{port1:d,port2:g}=new MessageChannel;u4(r,g),u=hct(d,[d])}break;case"RELEASE":u=void 0;break;default:return}}catch(c){u={value:c,[af]:0}}Promise.resolve(u).catch(c=>({value:c,[af]:0})).then(c=>{const[h,d]=Uf(c);t.postMessage(Object.assign(Object.assign({},h),{id:a}),d),s==="RELEASE"&&(t.removeEventListener("message",n),c4(t),jb in r&&typeof r[jb]=="function"&&r[jb]())}).catch(c=>{const[h,d]=Uf({value:new TypeError("Unserializable return value"),[af]:0});t.postMessage(Object.assign(Object.assign({},h),{id:a}),d)})}),t.start&&t.start()}function oct(r){return r.constructor.name==="MessagePort"}function c4(r){oct(r)&&r.close()}function h4(r,t){const e=new Map;return r.addEventListener("message",function(i){const{data:a}=i;if(!a||!a.id)return;const s=e.get(a.id);if(s)try{s(a)}finally{e.delete(a.id)}}),sx(r,e,[],t)}function Id(r){if(r)throw new Error("Proxy has been released and is not useable")}function d4(r){return Ol(r,new Map,{type:"RELEASE"}).then(()=>{c4(r)})}const Vf=new WeakMap,Hf="FinalizationRegistry"in globalThis&&new FinalizationRegistry(r=>{const t=(Vf.get(r)||0)-1;Vf.set(r,t),t===0&&d4(r)});function lct(r,t){const e=(Vf.get(t)||0)+1;Vf.set(t,e),Hf&&Hf.register(r,t,r)}function uct(r){Hf&&Hf.unregister(r)}function sx(r,t,e=[],n=function(){}){let i=!1;const a=new Proxy(n,{get(s,o){if(Id(i),o===s4)return()=>{uct(a),d4(r),t.clear(),i=!0};if(o==="then"){if(e.length===0)return{then:()=>a};const l=Ol(r,t,{type:"GET",path:e.map(u=>u.toString())}).then(mo);return l.then.bind(l)}return sx(r,t,[...e,o])},set(s,o,l){Id(i);const[u,c]=Uf(l);return Ol(r,t,{type:"SET",path:[...e,o].map(h=>h.toString()),value:u},c).then(mo)},apply(s,o,l){Id(i);const u=e[e.length-1];if(u===rct)return Ol(r,t,{type:"ENDPOINT"}).then(mo);if(u==="bind")return sx(r,t,e.slice(0,-1));const[c,h]=UP(l);return Ol(r,t,{type:"APPLY",path:e.map(d=>d.toString()),argumentList:c},h).then(mo)},construct(s,o){Id(i);const[l,u]=UP(o);return Ol(r,t,{type:"CONSTRUCT",path:e.map(c=>c.toString()),argumentList:l},u).then(mo)}});return lct(a,r),a}function cct(r){return Array.prototype.concat.apply([],r)}function UP(r){const t=r.map(Uf);return[t.map(e=>e[0]),cct(t.map(e=>e[1]))]}const f4=new WeakMap;function hct(r,t){return f4.set(r,t),r}function dct(r){return Object.assign(r,{[a4]:!0})}function Uf(r){for(const[t,e]of l4)if(e.canHandle(r)){const[n,i]=e.serialize(r);return[{type:"HANDLER",name:t,value:n},i]}return[{type:"RAW",value:r},f4.get(r)||[]]}function mo(r){switch(r.type){case"HANDLER":return l4.get(r.name).deserialize(r.value);case"RAW":return r.value}}function Ol(r,t,e,n){return new Promise(i=>{const a=fct();t.set(a,i),r.start&&r.start(),r.postMessage(Object.assign({id:a},e),n)})}function fct(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class gct extends kg{constructor(t,e,n){super(),this.graph=t,this.layout=e,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=h4(new Worker(new URL("/assets/worker-oDIEKZfz.js",import.meta.url),{type:"module"})),this.running&&(this.running=!1,this.execute())}execute(){var t;return Vt(this,void 0,void 0,function*(){if(this.running)return this;this.running=!0;const e=this.layout.options,{onTick:n}=e,i=Je(e,["onTick"]),a={};Object.keys(i).forEach(u=>{Et(i[u])||(a[u]=i[u])});const s={layout:{id:this.layout.id,options:a,iterations:(t=this.options)===null||t===void 0?void 0:t.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},o=new Float32Array([0]),[l]=yield this.proxy.calculateLayout(s,[o]);return l})}stop(){return this.running=!1,this.proxy.stopLayout(),this}kill(){this.proxy[s4]()}isRunning(){return this.running}}var pct=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class s0 extends Tg{constructor(){super(...arguments),this.id="fishbone"}getRoot(){const t=this.context.model.getRootsData();if(!(Ki(t)||t.length>2))return t[0]}formatSize(t){const e=typeof t=="function"?t:()=>t;return n=>Hr(e(n))}doLayout(t,e){const{hGap:n,getRibSep:i,vGap:a,nodeSize:s,height:o}=e,{model:l}=this.context,u=this.formatSize(s);let c=u(t)[0]+i(t);const h=(x,_=0)=>{var S;return _+=n*((x.children||[]).length+1),(S=x.children)===null||S===void 0||S.forEach(M=>{var k;(k=l.getNodeLikeDatum(M).children)===null||k===void 0||k.forEach(P=>{const O=l.getNodeLikeDatum(P);_=h(O,_)})}),_},d=x=>{if(x.depth===1)return c;const _=l.getParentData(x.id,"tree");if(bl(x)){const S=l.getParentData(_.id,"tree"),M=v(x)-v(S);return d(_)+M*n/a}else{const S=(_.children||[]).indexOf(x.id),M=l.getNodeData((_.children||[]).slice(S));return g(_)-M.reduce((k,T)=>k+h(T),0)-u(_)[0]/2}},g=uw(x=>{if(qb(x))return u(x)[0]/2;const _=l.getParentData(x.id,"tree");if(bl(x))return d(x)+h(x)+u(x)[0]/2;{const S=v(x)-v(_),M=n/a;return d(x)+S*M}},x=>x.id),p=x=>v(l.getParentData(x,"tree")),v=uw(x=>{if(qb(x))return o/2;if(bl(x)){const _=l.getParentData(x.id,"tree"),S=_.children.indexOf(x.id);if(S===0)return p(_.id)+a;const M=l.getNodeLikeDatum(_.children[S-1]);if(Ki(M.children))return v(M)+a;const k=l.getDescendantsData(M.id);return Math.max(...k.map(T=>bl(T)?p(T.id):v(T)))+a}else{if(Ki(x.children))return p(x.id)+a;const _=l.getNodeLikeDatum(x.children.slice(-1)[0]);if(Ki(_.children))return v(_)+a;const S=l.getDescendantsData(x.id).slice(-1)[0];return(bl(S)?p(S.id):v(S))+a}},x=>x.id);let m=0;const b={nodes:[],edges:[]},w=x=>{var _;(_=x.children)===null||_===void 0||_.forEach(P=>w(l.getNodeLikeDatum(P)));const S=v(x),M=g(x);if(b.nodes.push({id:x.id,x:M,y:S}),qb(x))return;const k=l.getRelatedEdgesData(x.id,"in")[0],T=[d(x),bl(x)?S:p(x.id)];b.edges.push({id:H(k),controlPoints:[T],relatedNodeId:x.id}),m=Math.max(m,M+i(x)),x.depth===1&&(c=m)};return w(t),b}placeAlterative(t,e){const n=(e.children||[]).filter((o,l)=>l%2!==0);if(n.length===0)return t;const{model:i}=this.context,a=t.nodes.find(o=>o.id===e.id).y,s=o=>{const l=i.getAncestorsData(o,"tree");if(Ki(l))return!1;const u=l.length===1?o:l[l.length-2].id;return n.includes(u)};t.nodes.forEach(o=>{s(o.id)&&(o.y=2*a-o.y)}),t.edges.forEach(o=>{s(o.relatedNodeId)&&(o.controlPoints=o.controlPoints.map(l=>[l[0],2*a-l[1]]))})}rightToLeft(t,e){return t.nodes.forEach(n=>n.x=e.width-n.x),t.edges.forEach(n=>{n.controlPoints=n.controlPoints.map(i=>[e.width-i[0],i[1]])}),t}execute(t,e){return pct(this,void 0,void 0,function*(){const n=Object.assign(Object.assign(Object.assign({},s0.defaultOptions),this.options),e),{direction:i,nodeSize:a}=n,s=this.getRoot();if(!s)return t;const o=this.formatSize(a);n.vGap||(n.vGap=Math.max(...(t.nodes||[]).map(d=>o(d)[1]))),n.hGap||(n.hGap=Math.max(...(t.nodes||[]).map(d=>o(d)[0])));let l=this.doLayout(s,n);this.placeAlterative(l,s),i==="RL"&&(l=this.rightToLeft(l,n));const{model:u}=this.context,c=[],h=[];return l.nodes.forEach(d=>{const{id:g,x:p,y:v}=d,m=u.getNodeLikeDatum(g);c.push(YP(m,{x:p,y:v}))}),l.edges.forEach(d=>{const{id:g,controlPoints:p}=d,v=u.getEdgeDatum(g);h.push(YP(v,{controlPoints:p}))}),{nodes:c,edges:h}})}}s0.defaultOptions={direction:"RL",getRibSep:()=>60};const YP=(r,t)=>Object.assign(Object.assign({},r),{style:Object.assign(Object.assign({},r.style||{}),t)}),qb=r=>r.depth===0,bl=r=>(r.depth||(r.depth=0))%2===0;var vct=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class o0 extends Tg{constructor(){super(...arguments),this.id="snake"}formatSize(t,e){const n=typeof e=="function"?e:()=>e;return t.reduce((i,a)=>{const[s,o]=Hr(n(a))||[0,0];return[Math.max(i[0],s),Math.max(i[1],o)]},[0,0])}validate(t){const{nodes:e=[],edges:n=[]}=t,i={},a={},s={};e.forEach(d=>{i[d.id]=0,a[d.id]=0,s[d.id]=[]}),n.forEach(d=>{i[d.target]++,a[d.source]++,s[d.source].push(d.target)});const o=new Set,l=d=>{o.has(d)||(o.add(d),s[d].forEach(l))};if(l(e[0].id),o.size!==e.length)return!1;const u=e.filter(d=>i[d.id]===0),c=e.filter(d=>a[d.id]===0);return!(u.length!==1||c.length!==1||e.filter(d=>i[d.id]===1&&a[d.id]===1).length!==e.length-2)}execute(t,e){return vct(this,void 0,void 0,function*(){var n;if(!this.validate(t))return t;const{nodeSize:i,padding:a,sortBy:s,cols:o,colGap:l,rowGap:u,clockwise:c,width:h,height:d}=Object.assign({},o0.defaultOptions,this.options,e),[g,p,v,m]=oa(a),b=this.formatSize(t.nodes||[],i),w=Math.ceil((t.nodes||[]).length/o);let x=l||(h-m-p-o*b[0])/(o-1),_=u||(d-g-v-w*b[1])/(w-1);return(_===1/0||_<0)&&(_=0),(x===1/0||x<0)&&(x=0),{nodes:((s?(n=t.nodes)===null||n===void 0?void 0:n.sort(s):mct(t))||[]).map((k,T)=>{const P=Math.floor(T/o),O=T%o,A=c?P%2===0?O:o-1-O:P%2===0?o-1-O:O,R=m+A*(b[0]+x)+b[0]/2,L=g+P*(b[1]+_)+b[1]/2;return{id:k.id,style:{x:R,y:L}}})}})}}o0.defaultOptions={padding:0,cols:5,clockwise:!0};function mct(r){const{nodes:t=[],edges:e=[]}=r,n={},i={};t.forEach(o=>{n[o.id]=0,i[o.id]=[]}),e.forEach(o=>{n[o.target]++,i[o.source].push(o.target)});const a=[],s=[];for(t.forEach(o=>{n[o.id]===0&&a.push(o.id)});a.length>0;){const o=a.shift(),l=t.find(u=>u.id===o);s.push(l),i[o].forEach(u=>{n[u]--,n[u]===0&&a.push(u)})}return s}const yct=["rgb(158, 1, 66)","rgb(213, 62, 79)","rgb(244, 109, 67)","rgb(253, 174, 97)","rgb(254, 224, 139)","rgb(255, 255, 191)","rgb(230, 245, 152)","rgb(171, 221, 164)","rgb(102, 194, 165)","rgb(50, 136, 189)","rgb(94, 79, 162)"],bct=["rgb(78, 121, 167)","rgb(242, 142, 44)","rgb(225, 87, 89)","rgb(118, 183, 178)","rgb(89, 161, 79)","rgb(237, 201, 73)","rgb(175, 122, 161)","rgb(255, 157, 167)","rgb(156, 117, 95)","rgb(186, 176, 171)"],wct=["rgb(255, 245, 235)","rgb(254, 230, 206)","rgb(253, 208, 162)","rgb(253, 174, 107)","rgb(253, 141, 60)","rgb(241, 105, 19)","rgb(217, 72, 1)","rgb(166, 54, 3)","rgb(127, 39, 4)"],xct=["rgb(247, 252, 245)","rgb(229, 245, 224)","rgb(199, 233, 192)","rgb(161, 217, 155)","rgb(116, 196, 118)","rgb(65, 171, 93)","rgb(35, 139, 69)","rgb(0, 109, 44)","rgb(0, 68, 27)"],Ect=["rgb(247, 251, 255)","rgb(222, 235, 247)","rgb(198, 219, 239)","rgb(158, 202, 225)","rgb(107, 174, 214)","rgb(66, 146, 198)","rgb(33, 113, 181)","rgb(8, 81, 156)","rgb(8, 48, 107)"];class Wn extends Hx{}function iu(r,t=!0,e){const n=document.createElement("div");return n.setAttribute("class",`g6-${r}`),Object.assign(n.style,{position:"absolute",display:"block"}),t&&Object.assign(n.style,{position:"unset",gridArea:"1 / 1 / 2 / 2",inset:"0px",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none"}),e&&Object.assign(n.style,e),n}function ox(r,t="div",e={},n="",i=document.body){const a=document.getElementById(r);a&&a.remove();const s=document.createElement(t);return s.innerHTML=n,s.id=r,Object.assign(s.style,e),i.appendChild(s),s}var _ct=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class l0 extends Wn{constructor(t,e){super(t,Object.assign({},l0.defaultOptions,e)),this.$element=iu("background"),this.context.canvas.getContainer().prepend(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return _ct(this,void 0,void 0,function*(){e.update.call(this,t),Object.assign(this.$element.style,Ox(this.options,["key","type"]))})}destroy(){super.destroy(),this.$element.remove()}}l0.defaultOptions={transition:"background 0.5s",backgroundSize:"cover",zIndex:"-1"};function IE(r,t,e,n,i,a){const s=r,o=t,l=e-s,u=n-o;let c=i-s,h=a-o,d=c*l+h*u,g=0;d<=0?g=0:(c=l-c,h=u-h,d=c*l+h*u,d<=0?g=0:g=d*d/(l*l+u*u));const p=c*c+h*h-g;return p<0?0:p}function Cs(r,t,e,n){return(r-e)*(r-e)+(t-n)*(t-n)}function XP(r,t,e,n,i){return Cs(r,t,e,n)<i*i}function Sct(r){if(!Number.isFinite(r))return e=>e;if(r===0)return Math.round;const t=Math.pow(10,r);return e=>Math.round(e*t)/t}function g4(r){const t=Math.min(r.x1,r.x2),e=Math.max(r.x1,r.x2),n=Math.min(r.y1,r.y2),i=Math.max(r.y1,r.y2);return{x:t,y:n,x2:e,y2:i,width:e-t,height:i-n}}class An{constructor(t,e,n,i){this.x1=t,this.y1=e,this.x2=n,this.y2=i}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}draw(t){t.moveTo(this.x1,this.y1),t.lineTo(this.x2,this.y2)}toString(){return`Line(from=(${this.x1},${this.y1}),to=(${this.x2},${this.y2}))`}static from(t){return new An(t.x1,t.y1,t.x2,t.y2)}cuts(t,e){if(this.y1===this.y2||e<this.y1&&e<=this.y2||e>this.y1&&e>=this.y2||t>this.x1&&t>=this.x2)return!1;if(t<this.x1&&t<=this.x2)return!0;const n=this.x1+(e-this.y1)*(this.x2-this.x1)/(this.y2-this.y1);return t<=n}distSquare(t,e){return IE(this.x1,this.y1,this.x2,this.y2,t,e)}ptClose(t,e,n){if(this.x1<this.x2){if(t<this.x1-n||t>this.x2+n)return!1}else if(t<this.x2-n||t>this.x1+n)return!1;if(this.y1<this.y2){if(e<this.y1-n||e>this.y2+n)return!1}else if(e<this.y2-n||e>this.y1+n)return!1;return!0}}var Xe;(function(r){r[r.POINT=1]="POINT",r[r.PARALLEL=2]="PARALLEL",r[r.COINCIDENT=3]="COINCIDENT",r[r.NONE=4]="NONE"})(Xe||(Xe={}));class Wb{constructor(t,e=0,n=0){this.state=t,this.x=e,this.y=n}}function Dd(r,t){const e=(t.x2-t.x1)*(r.y1-t.y1)-(t.y2-t.y1)*(r.x1-t.x1),n=(r.x2-r.x1)*(r.y1-t.y1)-(r.y2-r.y1)*(r.x1-t.x1),i=(t.y2-t.y1)*(r.x2-r.x1)-(t.x2-t.x1)*(r.y2-r.y1);if(i){const a=e/i,s=n/i;return 0<=a&&a<=1&&0<=s&&s<=1?new Wb(Xe.POINT,r.x1+a*(r.x2-r.x1),r.y1+a*(r.y2-r.y1)):new Wb(Xe.NONE)}return new Wb(e===0||n===0?Xe.COINCIDENT:Xe.PARALLEL)}function p4(r,t){const e=(t.x2-t.x1)*(r.y1-t.y1)-(t.y2-t.y1)*(r.x1-t.x1),n=(r.x2-r.x1)*(r.y1-t.y1)-(r.y2-r.y1)*(r.x1-t.x1),i=(t.y2-t.y1)*(r.x2-r.x1)-(t.x2-t.x1)*(r.y2-r.y1);if(i){const a=e/i,s=n/i;if(0<=a&&a<=1&&0<=s&&s<=1)return a}return Number.POSITIVE_INFINITY}function Mct(r,t){function e(i,a,s,o){let l=p4(t,new An(i,a,s,o));return l=Math.abs(l-.5),l>=0&&l<=1?1:0}let n=e(r.x,r.y,r.x2,r.y);return n+=e(r.x,r.y,r.x,r.y2),n>1||(n+=e(r.x,r.y2,r.x2,r.y2),n>1)?!0:(n+=e(r.x2,r.y,r.x2,r.y2),n>0)}var Ke;(function(r){r[r.LEFT=0]="LEFT",r[r.TOP=1]="TOP",r[r.RIGHT=2]="RIGHT",r[r.BOTTOM=3]="BOTTOM"})(Ke||(Ke={}));function sf(r,t,e){const n=new Set;return r.width<=0?(n.add(Ke.LEFT),n.add(Ke.RIGHT)):t<r.x?n.add(Ke.LEFT):t>r.x+r.width&&n.add(Ke.RIGHT),r.height<=0?(n.add(Ke.TOP),n.add(Ke.BOTTOM)):e<r.y?n.add(Ke.TOP):e>r.y+r.height&&n.add(Ke.BOTTOM),n}function v4(r,t){let e=t.x1,n=t.y1;const i=t.x2,a=t.y2,s=Array.from(sf(r,i,a));if(s.length===0)return!0;let o=sf(r,e,n);for(;o.size!==0;){for(const l of s)if(o.has(l))return!1;if(o.has(Ke.RIGHT)||o.has(Ke.LEFT)){let l=r.x;o.has(Ke.RIGHT)&&(l+=r.width),n=n+(l-e)*(a-n)/(i-e),e=l}else{let l=r.y;o.has(Ke.BOTTOM)&&(l+=r.height),e=e+(l-n)*(i-e)/(a-n),n=l}o=sf(r,e,n)}return!0}function kct(r,t){let e=Number.POSITIVE_INFINITY,n=0;function i(a,s,o,l){let u=p4(t,new An(a,s,o,l));u=Math.abs(u-.5),u>=0&&u<=1&&(n++,u<e&&(e=u))}return i(r.x,r.y,r.x2,r.y),i(r.x,r.y,r.x,r.y2),n>1||(i(r.x,r.y2,r.x2,r.y2),n>1)?e:(i(r.x2,r.y,r.x2,r.y2),n===0?-1:e)}function Tct(r,t){let e=0;const n=Dd(r,new An(t.x,t.y,t.x2,t.y));e+=n.state===Xe.POINT?1:0;const i=Dd(r,new An(t.x,t.y,t.x,t.y2));e+=i.state===Xe.POINT?1:0;const a=Dd(r,new An(t.x,t.y2,t.x2,t.y2));e+=a.state===Xe.POINT?1:0;const s=Dd(r,new An(t.x2,t.y,t.x2,t.y2));return e+=s.state===Xe.POINT?1:0,{top:n,left:i,bottom:a,right:s,count:e}}class Xn{constructor(t,e,n,i){this.x=t,this.y=e,this.width=n,this.height=i}get x2(){return this.x+this.width}get y2(){return this.y+this.height}get cx(){return this.x+this.width/2}get cy(){return this.y+this.height/2}get radius(){return Math.max(this.width,this.height)/2}static from(t){return new Xn(t.x,t.y,t.width,t.height)}equals(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}clone(){return new Xn(this.x,this.y,this.width,this.height)}add(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x2,t.x+t.width),a=Math.max(this.y2,t.y+t.height);this.x=e,this.y=n,this.width=i-e,this.height=a-n}addPoint(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x2,t.x),a=Math.max(this.y2,t.y);this.x=e,this.y=n,this.width=i-e,this.height=a-n}toString(){return`Rectangle[x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height}]`}draw(t){t.rect(this.x,this.y,this.width,this.height)}containsPt(t,e){return t>=this.x&&t<=this.x2&&e>=this.y&&e<=this.y2}get area(){return this.width*this.height}intersects(t){return this.area<=0||t.width<=0||t.height<=0?!1:t.x+t.width>this.x&&t.y+t.height>this.y&&t.x<this.x2&&t.y<this.y2}distSquare(t,e){if(this.containsPt(t,e))return 0;const n=sf(this,t,e);return n.has(Ke.TOP)?n.has(Ke.LEFT)?Cs(t,e,this.x,this.y):n.has(Ke.RIGHT)?Cs(t,e,this.x2,this.y):(this.y-e)*(this.y-e):n.has(Ke.BOTTOM)?n.has(Ke.LEFT)?Cs(t,e,this.x,this.y2):n.has(Ke.RIGHT)?Cs(t,e,this.x2,this.y2):(e-this.y2)*(e-this.y2):n.has(Ke.LEFT)?(this.x-t)*(this.x-t):n.has(Ke.RIGHT)?(t-this.x2)*(t-this.x2):0}}function Oct(r){if(r.length===0)return null;const t=r[0],e=new Xn(t.x,t.y,0,0);for(const n of r)e.addPoint(n);return e}class Yf{constructor(t,e,n){this.cx=t,this.cy=e,this.radius=n}get x(){return this.cx-this.radius}get x2(){return this.cx+this.radius}get width(){return this.radius*2}get y(){return this.cy-this.radius}get y2(){return this.cy+this.radius}get height(){return this.radius*2}static from(t){return new Yf(t.cx,t.cy,t.radius)}containsPt(t,e){return Cs(this.cx,this.cy,t,e)<this.radius*this.radius}distSquare(t,e){const n=Cs(this.cx,this.cy,t,e);if(n<this.radius*this.radius)return 0;const i=Math.sqrt(n)-this.radius;return i*i}draw(t){t.ellipse(this.cx,this.cy,this.radius,this.radius,0,0,Math.PI*2)}}class Ao{constructor(t,e=0,n=0,i=0,a=0,s=10,o=10,l=new Float32Array(Math.max(0,s*o)).fill(0)){this.pixelGroup=t,this.i=e,this.j=n,this.pixelX=i,this.pixelY=a,this.width=s,this.height=o,this.area=l}createSub(t,e){return new Ao(this.pixelGroup,t.x,t.y,e.x,e.y,t.width,t.height)}static fromPixelRegion(t,e){return new Ao(e,0,0,t.x,t.y,Math.ceil(t.width/e),Math.ceil(t.height/e))}copy(t,e){return new Ao(this.pixelGroup,this.scaleX(e.x),this.scaleY(e.y),e.x,e.y,t.width,t.height,t.area)}boundX(t){return t<this.i?this.i:t>=this.width?this.width-1:t}boundY(t){return t<this.j?this.j:t>=this.height?this.height-1:t}scaleX(t){return this.boundX(Math.floor((t-this.pixelX)/this.pixelGroup))}scaleY(t){return this.boundY(Math.floor((t-this.pixelY)/this.pixelGroup))}scale(t){const e=this.scaleX(t.x),n=this.scaleY(t.y),i=this.boundX(Math.ceil((t.x+t.width-this.pixelX)/this.pixelGroup)),a=this.boundY(Math.ceil((t.y+t.height-this.pixelY)/this.pixelGroup)),s=i-e,o=a-n;return new Xn(e,n,s,o)}invertScaleX(t){return Math.round(t*this.pixelGroup+this.pixelX)}invertScaleY(t){return Math.round(t*this.pixelGroup+this.pixelY)}addPadding(t,e){const n=Math.ceil(e/this.pixelGroup),i=this.boundX(t.x-n),a=this.boundY(t.y-n),s=this.boundX(t.x2+n),o=this.boundY(t.y2+n),l=s-i,u=o-a;return new Xn(i,a,l,u)}get(t,e){return t<0||e<0||t>=this.width||e>=this.height?Number.NaN:this.area[t+e*this.width]}inc(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]+=n)}set(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]=n)}incArea(t,e){if(t.width<=0||t.height<=0||e===0)return;const n=this.width,i=t.width,a=Math.max(0,t.i),s=Math.max(0,t.j),o=Math.min(t.i+t.width,n),l=Math.min(t.j+t.height,this.height);if(!(l<=0||o<=0||a>=n||l>=this.height))for(let u=s;u<l;u++){const c=(u-t.j)*i,h=u*n;for(let d=a;d<o;d++){const g=t.area[d-t.i+c];g!==0&&(this.area[d+h]+=e*g)}}}fill(t){this.area.fill(t)}fillArea(t,e){const n=t.x+t.y*this.width;for(let i=0;i<t.height;i++){const a=n+i*this.width;this.area.fill(e,a,a+t.width)}}fillHorizontalLine(t,e,n,i){const a=t+e*this.width;this.area.fill(i,a,a+n)}fillVerticalLine(t,e,n,i){const a=t+e*this.width;for(let s=0;s<n;s++)this.area[a+s*this.width]=i}clear(){this.area.fill(0)}toString(){let t="";for(let e=0;e<this.height;e++){const n=e*this.width;for(let i=0;i<this.width;i++){const a=this.area[n+i];t+=a.toFixed(1).padStart(6),t+=" "}t+=`
- `}return t}draw(t,e=!0){if(this.width<=0||this.height<=0)return;t.save(),e&&t.translate(this.pixelX,this.pixelY);const n=this.area.reduce((s,o)=>Math.min(s,o),Number.POSITIVE_INFINITY),i=this.area.reduce((s,o)=>Math.max(s,o),Number.NEGATIVE_INFINITY),a=s=>(s-n)/(i-n);t.scale(this.pixelGroup,this.pixelGroup);for(let s=0;s<this.width;s++)for(let o=0;o<this.height;o++){const l=this.area[s+o*this.width];t.fillStyle=`rgba(0, 0, 0, ${a(l)})`,t.fillRect(s,o,1,1)}t.restore()}drawThreshold(t,e,n=!0){if(!(this.width<=0||this.height<=0)){t.save(),n&&t.translate(this.pixelX,this.pixelY),t.scale(this.pixelGroup,this.pixelGroup);for(let i=0;i<this.width;i++)for(let a=0;a<this.height;a++){const s=this.area[i+a*this.width];t.fillStyle=s>e?"black":"white",t.fillRect(i,a,1,1)}t.restore()}}}function m4(r,t){const e=n=>({x:n.x-t,y:n.y-t,width:n.width+2*t,height:n.height+2*t});return Array.isArray(r)?r.map(e):e(r)}function KP(r,t,e){return y4(Object.assign(g4(r),{distSquare:(n,i)=>IE(r.x1,r.y1,r.x2,r.y2,n,i)}),t,e)}function y4(r,t,e){const n=m4(r,e),i=t.scale(n),a=t.createSub(i,n);return Cct(a,t,e,(s,o)=>r.distSquare(s,o)),a}function Cct(r,t,e,n){const i=e*e;for(let a=0;a<r.height;a++)for(let s=0;s<r.width;s++){const o=t.invertScaleX(r.i+s),l=t.invertScaleY(r.j+a),u=n(o,l);if(u===0){r.set(s,a,i);continue}if(u<i){const c=e-Math.sqrt(u);r.set(s,a,c*c)}}return r}function Act(r,t,e){const n=t.scale(r),i=t.addPadding(n,e),a=t.createSub(i,{x:r.x-e,y:r.y-e}),s=n.x-i.x,o=n.y-i.y,l=i.x2-n.x2,u=i.y2-n.y2,c=i.width-s-l,h=i.height-o-u,d=e*e;a.fillArea({x:s,y:o,width:c+1,height:h+1},d);const g=[0],p=Math.max(o,s,l,u);{const w=t.invertScaleX(n.x+n.width/2);for(let x=1;x<p;x++){const _=t.invertScaleY(n.y-x),S=r.distSquare(w,_);if(S<d){const M=e-Math.sqrt(S);g.push(M*M)}else break}}const v=[],m=Math.max(s,l),b=Math.max(o,l);for(let w=1;w<m;w++){const x=t.invertScaleX(n.x-w),_=[];for(let S=1;S<b;S++){const M=t.invertScaleY(n.y-S),k=r.distSquare(x,M);if(k<d){const T=e-Math.sqrt(k);_.push(T*T)}else _.push(0)}v.push(_)}for(let w=1;w<Math.min(o,g.length);w++){const x=g[w];a.fillHorizontalLine(s,o-w,c+1,x)}for(let w=1;w<Math.min(u,g.length);w++){const x=g[w];a.fillHorizontalLine(s,o+h+w,c+1,x)}for(let w=1;w<Math.min(s,g.length);w++){const x=g[w];a.fillVerticalLine(s-w,o,h+1,x)}for(let w=1;w<Math.min(u,g.length);w++){const x=g[w];a.fillVerticalLine(s+c+w,o,h+1,x)}for(let w=1;w<s;w++){const x=v[w-1],_=s-w;for(let S=1;S<o;S++)a.set(_,o-S,x[S-1]);for(let S=1;S<u;S++)a.set(_,o+h+S,x[S-1])}for(let w=1;w<l;w++){const x=v[w-1],_=s+c+w;for(let S=1;S<o;S++)a.set(_,o-S,x[S-1]);for(let S=1;S<u;S++)a.set(_,o+h+S,x[S-1])}return a}function Re(r,t){return{x:r,y:t}}function Pct(r,t,e,n){if(r.length===0)return[];const i=Dct(r);return i.map((a,s)=>{const o=i.slice(0,s);return Nct(t,a,o,e,n)}).flat()}function Nct(r,t,e,n,i){const a=Re(t.cx,t.cy),s=Ict(a,e,r);if(s==null)return[];const o=new An(a.x,a.y,s.cx,s.cy),l=Rct(o,r,n,i);return Lct(l,r)}function Rct(r,t,e,n){const i=[],a=[];a.push(r);let s=!0;for(let o=0;o<e&&s;o++)for(s=!1;!s&&a.length>0;){const l=a.pop(),u=b4(t,l),c=u?Tct(l,u):null;if(!u||!c||c.count!==2){s||i.push(l);continue}let h=n,d=Bd(u,h,c,!0),g=hs(d,a)||hs(d,i),p=Fd(d,t);for(;!g&&p&&h>=1;)h/=1.5,d=Bd(u,h,c,!0),g=hs(d,a)||hs(d,i),p=Fd(d,t);if(d&&!g&&!p&&(a.push(new An(l.x1,l.y1,d.x,d.y)),a.push(new An(d.x,d.y,l.x2,l.y2)),s=!0),s)continue;h=n,d=Bd(u,h,c,!1);let v=hs(d,a)||hs(d,i);for(p=Fd(d,t);!v&&p&&h>=1;)h/=1.5,d=Bd(u,h,c,!1),v=hs(d,a)||hs(d,i),p=Fd(d,t);d&&!v&&(a.push(new An(l.x1,l.y1,d.x,d.y)),a.push(new An(d.x,d.y,l.x2,l.y2)),s=!0),s||i.push(l)}for(;a.length>0;)i.push(a.pop());return i}function Lct(r,t){const e=[];for(;r.length>0;){const n=r.pop();if(r.length===0){e.push(n);break}const i=r.pop(),a=new An(n.x1,n.y1,i.x2,i.y2);b4(t,a)?(e.push(n),r.push(i)):r.push(a)}return e}function Ict(r,t,e){let n=Number.POSITIVE_INFINITY;return t.reduce((i,a)=>{const s=Cs(r.x,r.y,a.cx,a.cy);if(s>n)return i;const o=new An(r.x,r.y,a.cx,a.cy),l=Fct(e,o);return s*(l+1)*(l+1)<n&&(i=a,n=s*(l+1)*(l+1)),i},null)}function Dct(r){if(r.length<2)return r;let t=0,e=0;return r.forEach(n=>{t+=n.cx,e+=n.cy}),t/=r.length,e/=r.length,r.map(n=>{const i=t-n.cx,a=e-n.cy,s=i*i+a*a;return[n,s]}).sort((n,i)=>n[1]-i[1]).map(n=>n[0])}function Fd(r,t){return t.some(e=>e.containsPt(r.x,r.y))}function hs(r,t){return t.some(e=>!!(XP(e.x1,e.y1,r.x,r.y,.001)||XP(e.x2,e.y2,r.x,r.y,.001)))}function b4(r,t){let e=Number.POSITIVE_INFINITY,n=null;for(const i of r){if(!v4(i,t))continue;const a=kct(i,t);a>=0&&a<e&&(n=i,e=a)}return n}function Fct(r,t){return r.reduce((e,n)=>v4(n,t)&&Mct(n,t)?e+1:e,0)}function Bd(r,t,e,n){const i=e.top,a=e.left,s=e.bottom,o=e.right;if(n){if(a.state===Xe.POINT){if(i.state===Xe.POINT)return Re(r.x-t,r.y-t);if(s.state===Xe.POINT)return Re(r.x-t,r.y2+t);const d=r.width*r.height;return r.width*((a.y-r.y+(o.y-r.y))*.5)<d*.5?a.y>o.y?Re(r.x-t,r.y-t):Re(r.x2+t,r.y-t):a.y<o.y?Re(r.x-t,r.y2+t):Re(r.x2+t,r.y2+t)}if(o.state===Xe.POINT){if(i.state===Xe.POINT)return Re(r.x2+t,r.y-t);if(s.state===Xe.POINT)return Re(r.x2+t,r.y2+t)}const c=r.height*r.width;return r.height*((i.x-r.x+(o.x-r.x))*.5)<c*.5?i.x>s.x?Re(r.x-t,r.y-t):Re(r.x-t,r.y2+t):i.x<s.x?Re(r.x2+t,r.y-t):Re(r.x2+t,r.y2+t)}if(a.state===Xe.POINT){if(i.state===Xe.POINT)return Re(r.x2+t,r.y2+t);if(s.state===Xe.POINT)return Re(r.x2+t,r.y-t);const c=r.height*r.width;return r.width*((a.y-r.y+(o.y-r.y))*.5)<c*.5?a.y>o.y?Re(r.x2+t,r.y2+t):Re(r.x-t,r.y2+t):a.y<o.y?Re(r.x2+t,r.y-t):Re(r.x-t,r.y-t)}if(o.state===Xe.POINT){if(i.state===Xe.POINT)return Re(r.x-t,r.y2+t);if(s.state===Xe.POINT)return Re(r.x-t,r.y-t)}const l=r.height*r.width;return r.height*((i.x-r.x+(o.x-r.x))*.5)<l*.5?i.x>s.x?Re(r.x2+t,r.y2+t):Re(r.x2+t,r.y-t):i.x<s.x?Re(r.x-t,r.y2+t):Re(r.x-t,r.y-t)}function Bct(r,t,e,n){if(!(r.closed?e<r.length:e<r.length-1))return!1;const a=r.get(t),s=r.get(e+1);for(let o=t+1;o<=e;o++){const l=r.get(o);if(IE(a.x,a.y,s.x,s.y,l.x,l.y)>n)return!1}return!0}function zct(r=0){return t=>{if(r<0||t.length<3)return t;const e=[];let n=0;const i=r*r;for(;n<t.length;){let a=n+1;for(;Bct(t,n,a,i);)a++;e.push(t.get(n)),n=a}return new au(e)}}function $ct(r,t){switch(r){case-2:return(((-t+3)*t-3)*t+1)/6;case-1:return((3*t-6)*t*t+4)/6;case 0:return(((-3*t+3)*t+3)*t+1)/6;case 1:return t*t*t/6;default:throw new Error("unknown error")}}function jct(r=6){function a(s,o,l){let u=0,c=0;for(let h=-2;h<=1;h++){const d=s.get(o+h),g=$ct(h,l);u+=g*d.x,c+=g*d.y}return{x:u,y:c}}return s=>{if(s.length<3)return s;const o=[],l=s.closed,u=s.length+3-1+(l?0:2);o.push(a(s,2-(l?0:2),0));for(let c=2-(l?0:2);c<u;c++)for(let h=1;h<=r;h++)o.push(a(s,c,h/r));return new au(o)}}function qct(r=8){return t=>{let e=r,n=t.length;if(e>1)for(n=Math.floor(t.length/e);n<3&&e>1;)e-=1,n=Math.floor(t.length/e);const i=[];for(let a=0,s=0;s<n;s++,a+=e)i.push(t.get(a));return new au(i)}}class au{constructor(t=[],e=!0){this.points=t,this.closed=e}get(t){const e=t,n=this.points.length;return t<0?this.closed?this.get(t+n):this.points[0]:t>=n?this.closed?this.get(t-n):this.points[n-1]:this.points[e]}get length(){return this.points.length}toString(t=1/0){const e=this.points;if(e.length===0)return"";const n=typeof t=="function"?t:Sct(t);let i="M";for(const a of e)i+=`${n(a.x)},${n(a.y)} L`;return i=i.slice(0,-1),this.closed&&(i+=" Z"),i}draw(t){const e=this.points;if(e.length!==0){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(const n of e)t.lineTo(n.x,n.y);this.closed&&t.closePath()}}sample(t){return qct(t)(this)}simplify(t){return zct(t)(this)}bSplines(t){return jct(t)(this)}apply(t){return t(this)}containsElements(t){const e=Oct(this.points);return e?t.every(n=>e.containsPt(n.cx,n.cy)&&this.withinArea(n.cx,n.cy)):!1}withinArea(t,e){if(this.length===0)return!1;let n=0;const i=this.points[0],a=new An(i.x,i.y,i.x,i.y);for(let s=1;s<this.points.length;s++){const o=this.points[s];a.x1=a.x2,a.y1=a.y2,a.x2=o.x,a.y2=o.y,a.cuts(t,e)&&n++}return a.x1=a.x2,a.y1=a.y2,a.x2=i.x,a.y2=i.y,a.cuts(t,e)&&n++,n%2===1}}class Wct{constructor(t=0){this.count=0,this.arr=[],this.set=new Set,this.arr.length=t}add(t){this.set.add(`${t.x}x${t.y}`),this.arr[this.count++]=t}contains(t){return this.set.has(`${t.x}x${t.y}`)}isFirst(t){if(this.count===0)return!1;const e=this.arr[0];return e!=null&&e.x===t.x&&e.y===t.y}path(){return new au(this.arr.slice(0,this.count))}clear(){this.set.clear(),this.count=0}get(t){return this.arr[t]}get length(){return this.count}}const Au=0,zd=1,$d=2,Gb=3;function Gct(r,t){const e=(Math.floor(r.width)+Math.floor(r.height))*2,n=new Wct(e);function i(l,u,c,h){const d=r.get(l,u);return Number.isNaN(d)?Number.NaN:d>t?c+h:c}function a(l,u){let c=Au;return c=i(l,u,c,1),c=i(l+1,u,c,2),c=i(l,u+1,c,4),c=i(l+1,u+1,c,8),Number.isNaN(c)?-1:c}let s=zd;function o(l,u){let c=l,h=u,d=r.invertScaleX(c),g=r.invertScaleY(h);for(let p=0;p<r.width*r.height;p++){const v={x:d,y:g};if(n.contains(v)){if(n.isFirst(v))return!0}else n.add(v);const m=a(c,h);switch(m){case-1:return!0;case 0:case 3:case 2:case 7:s=$d;break;case 12:case 14:case 4:s=Gb;break;case 6:s=s===Au?Gb:$d;break;case 1:case 13:case 5:s=Au;break;case 9:s=s===$d?Au:zd;break;case 10:case 8:case 11:s=zd;break;default:return console.warn("Marching squares invalid state: "+m),!0}switch(s){case Au:h--,g-=r.pixelGroup;break;case zd:h++,g+=r.pixelGroup;break;case Gb:c--,d-=r.pixelGroup;break;case $d:c++,d+=r.pixelGroup;break;default:return console.warn("Marching squares invalid state: "+m),!0}}return!0}for(let l=0;l<r.width;l++)for(let u=0;u<r.height;u++){if(r.get(l,u)<=t)continue;const c=a(l,u);if(!(c<0||c===15)&&o(l,u))return n.path()}return null}const u0={maxRoutingIterations:100,maxMarchingIterations:20,pixelGroup:4,edgeR0:10,edgeR1:20,nodeR0:15,nodeR1:50,morphBuffer:10,threshold:1,memberInfluenceFactor:1,edgeInfluenceFactor:1,nonMemberInfluenceFactor:-.8,virtualEdges:!0};function rc(r){return r!=null&&typeof r.radius=="number"}function ZP(r,t){if(rc(r)!==rc(t))return!1;if(rc(r)){const n=t;return r.cx===n.cx&&r.cy===n.cy&&r.radius===n.radius}const e=t;return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}var Ci;(function(r){r[r.MEMBERS=0]="MEMBERS",r[r.NON_MEMBERS=1]="NON_MEMBERS",r[r.EDGES=2]="EDGES"})(Ci||(Ci={}));let JP=class{constructor(t={}){this.dirty=new Set,this.members=[],this.nonMembers=[],this.virtualEdges=[],this.edges=[],this.activeRegion=new Xn(0,0,0,0),this.potentialArea=new Ao(1,0,0,0,0,0,0),this.o=Object.assign({},u0,t)}pushMember(...t){if(t.length!==0){this.dirty.add(Ci.MEMBERS);for(const e of t)this.members.push({raw:e,obj:rc(e)?Yf.from(e):Xn.from(e),area:null})}}removeMember(t){const e=this.members.findIndex(n=>ZP(n.raw,t));return e<0?!1:(this.members.splice(e,1),this.dirty.add(Ci.MEMBERS),!0)}removeNonMember(t){const e=this.nonMembers.findIndex(n=>ZP(n.raw,t));return e<0?!1:(this.nonMembers.splice(e,1),this.dirty.add(Ci.NON_MEMBERS),!0)}removeEdge(t){const e=this.edges.findIndex(n=>n.obj.equals(t));return e<0?!1:(this.edges.splice(e,1),this.dirty.add(Ci.NON_MEMBERS),!0)}pushNonMember(...t){if(t.length!==0){this.dirty.add(Ci.NON_MEMBERS);for(const e of t)this.nonMembers.push({raw:e,obj:rc(e)?Yf.from(e):Xn.from(e),area:null})}}pushEdge(...t){if(t.length!==0){this.dirty.add(Ci.EDGES);for(const e of t)this.edges.push({raw:e,obj:An.from(e),area:null})}}update(){const t=this.dirty.has(Ci.MEMBERS),e=this.dirty.has(Ci.NON_MEMBERS);let n=this.dirty.has(Ci.EDGES);this.dirty.clear();const i=this.members.map(u=>u.obj);if(this.o.virtualEdges&&(t||e)){const u=this.nonMembers.map(d=>d.obj),c=Pct(i,u,this.o.maxRoutingIterations,this.o.morphBuffer),h=new Map(this.virtualEdges.map(d=>[d.obj.toString(),d.area]));this.virtualEdges=c.map(d=>{var g;return{raw:d,obj:d,area:(g=h.get(d.toString()))!==null&&g!==void 0?g:null}}),n=!0}let a=!1;if(t||n){const u=this.virtualEdges.concat(this.edges).map(g=>g.obj),c=Hct(i,u),h=Math.max(this.o.edgeR1,this.o.nodeR1)+this.o.morphBuffer,d=Xn.from(m4(c,h));d.equals(this.activeRegion)||(a=!0,this.activeRegion=d)}if(a){const u=Math.ceil(this.activeRegion.width/this.o.pixelGroup),c=Math.ceil(this.activeRegion.height/this.o.pixelGroup);this.activeRegion.x!==this.potentialArea.pixelX||this.activeRegion.y!==this.potentialArea.pixelY?(this.potentialArea=Ao.fromPixelRegion(this.activeRegion,this.o.pixelGroup),this.members.forEach(h=>h.area=null),this.nonMembers.forEach(h=>h.area=null),this.edges.forEach(h=>h.area=null),this.virtualEdges.forEach(h=>h.area=null)):(u!==this.potentialArea.width||c!==this.potentialArea.height)&&(this.potentialArea=Ao.fromPixelRegion(this.activeRegion,this.o.pixelGroup))}const s=new Map,o=u=>{if(u.area){const c=`${u.obj.width}x${u.obj.height}x${u.obj instanceof Xn?"R":"C"}`;s.set(c,u.area)}},l=u=>{if(u.area)return;const c=`${u.obj.width}x${u.obj.height}x${u.obj instanceof Xn?"R":"C"}`;if(s.has(c)){const d=s.get(c);u.area=this.potentialArea.copy(d,{x:u.obj.x-this.o.nodeR1,y:u.obj.y-this.o.nodeR1});return}const h=u.obj instanceof Xn?Act(u.obj,this.potentialArea,this.o.nodeR1):y4(u.obj,this.potentialArea,this.o.nodeR1);u.area=h,s.set(c,h)};this.members.forEach(o),this.nonMembers.forEach(o),this.members.forEach(l),this.nonMembers.forEach(u=>{this.activeRegion.intersects(u.obj)?l(u):u.area=null}),this.edges.forEach(u=>{u.area||(u.area=KP(u.obj,this.potentialArea,this.o.edgeR1))}),this.virtualEdges.forEach(u=>{u.area||(u.area=KP(u.obj,this.potentialArea,this.o.edgeR1))})}drawMembers(t){for(const e of this.members)e.obj.draw(t)}drawNonMembers(t){for(const e of this.nonMembers)e.obj.draw(t)}drawEdges(t){for(const e of this.edges)e.obj.draw(t)}drawPotentialArea(t,e=!0){this.potentialArea.draw(t,e)}compute(){if(this.members.length===0)return new au([]);this.dirty.size>0&&this.update();const{o:t,potentialArea:e}=this,n=this.members.map(o=>o.area),i=this.virtualEdges.concat(this.edges).map(o=>o.area),a=this.nonMembers.filter(o=>o.area!=null).map(o=>o.area),s=this.members.map(o=>o.obj);return Vct(e,n,i,a,o=>o.containsElements(s),t)}};function Vct(r,t,e,n,i,a={}){const s=Object.assign({},u0,a);let o=s.threshold,l=s.memberInfluenceFactor,u=s.edgeInfluenceFactor,c=s.nonMemberInfluenceFactor;const h=(s.nodeR0-s.nodeR1)*(s.nodeR0-s.nodeR1),d=(s.edgeR0-s.edgeR1)*(s.edgeR0-s.edgeR1);for(let g=0;g<s.maxMarchingIterations;g++){if(r.clear(),l!==0){const v=l/h;for(const m of t)r.incArea(m,v)}if(u!==0){const v=u/d;for(const m of e)r.incArea(m,v)}if(c!==0){const v=c/h;for(const m of n)r.incArea(m,v)}const p=Gct(r,o);if(p&&i(p))return p;if(o*=.95,g<=s.maxMarchingIterations*.5)l*=1.2,u*=1.2;else if(c!==0&&n.length>0)c*=.8;else break}return new au([])}function Hct(r,t){if(r.length===0)return new Xn(0,0,0,0);const e=Xn.from(r[0]);for(const n of r)e.add(n);for(const n of t)e.add(g4(n));return e}var Uct=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class c0 extends Wn{constructor(t,e){super(t,cr({},c0.defaultOptions,e)),this.members=new Map,this.avoidMembers=new Map,this.bubbleSetOptions={},this.drawBubbleSets=()=>{const{style:n,bubbleSetOptions:i}=this.parseOptions();Ue(this.bubbleSetOptions,i)||this.init(),this.bubbleSetOptions=Object.assign({},i);const a=Object.assign(Object.assign({},n),{d:this.getPath()});this.shape?this.shape.update(a):(this.shape=new Bc({style:a}),this.context.canvas.appendChild(this.shape))},this.updateBubbleSetsPath=n=>{if(!this.shape)return;const i=H(n.data);[...this.options.members,...this.options.avoidMembers].includes(i)&&this.shape.update(Object.assign(Object.assign({},this.parseOptions().style),{d:this.getPath(i)}))},this.getPath=n=>{const{graph:i}=this.context,a=this.options.members,s=[...this.members.keys()],o=this.options.avoidMembers,l=[...this.avoidMembers.keys()];if(!n&&Ue(a,s)&&Ue(o,l))return this.path;const{enter:u=[],exit:c=[]}=Ns(s,a,m=>m),{enter:h=[],exit:d=[]}=Ns(l,o,m=>m);n&&(c.push(n),u.push(n));const g=(m,b,w)=>{m.forEach(x=>{const _=w?this.members:this.avoidMembers,S=w?"pushMember":"pushNonMember",M=w?"removeMember":"removeNonMember";if(b){let k;i.getElementType(x)==="edge"?([k]=Xct(i,x),this.bubbleSets.pushEdge(k)):([k]=Yct(i,x),this.bubbleSets[S](k)),_.set(x,k)}else{const k=_.get(x);k&&(i.getElementType(x)==="edge"?this.bubbleSets.removeEdge(k):this.bubbleSets[M](k),_.delete(x))}})};g(c,!1,!0),g(u,!0,!0),g(d,!1,!1),g(h,!0,!1);const v=this.bubbleSets.compute().sample(8).simplify(0).bSplines().simplify(0);return this.path=MI(v.points.map(zn)),this.path},this.bindEvents(),this.bubbleSets=new JP(this.options)}bindEvents(){this.context.graph.on(ut.AFTER_RENDER,this.drawBubbleSets),this.context.graph.on(ut.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath)}init(){this.bubbleSets=new JP(this.options),this.members=new Map,this.avoidMembers=new Map}parseOptions(){const t=this.options,{type:e,key:n,members:i,avoidMembers:a}=t,s=Uct(t,["type","key","members","avoidMembers"]),o=Object.keys(s).reduce((l,u)=>(u in u0?l.bubbleSetOptions[u]=s[u]:l.style[u]=s[u],l),{style:{},bubbleSetOptions:{}});return Object.assign({type:e,key:n,members:i,avoidMembers:a},o)}addMember(t){const e=Array.isArray(t)?t:[t];e.some(n=>this.options.avoidMembers.includes(n))&&(this.options.avoidMembers=this.options.avoidMembers.filter(n=>!e.includes(n))),this.options.members=[...new Set([...this.options.members,...e])],this.drawBubbleSets()}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter(n=>!e.includes(n)),this.drawBubbleSets()}updateMember(t){this.options.members=Et(t)?t(this.options.members):t,this.drawBubbleSets()}getMember(){return this.options.members}addAvoidMember(t){const e=Array.isArray(t)?t:[t];e.some(n=>this.options.members.includes(n))&&(this.options.members=this.options.members.filter(n=>!e.includes(n))),this.options.avoidMembers=[...new Set([...this.options.avoidMembers,...e])],this.drawBubbleSets()}removeAvoidMember(t){const e=Array.isArray(t)?t:[t];this.options.avoidMembers.some(n=>e.includes(n))&&(this.options.avoidMembers=this.options.avoidMembers.filter(n=>!e.includes(n)),this.drawBubbleSets())}updateAvoidMember(t){this.options.avoidMembers=Array.isArray(t)?t:[t],this.drawBubbleSets()}getAvoidMember(){return this.options.avoidMembers}destroy(){this.context.graph.off(ut.AFTER_RENDER,this.drawBubbleSets),this.context.graph.off(ut.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath),this.shape.destroy(),super.destroy()}}c0.defaultOptions=Object.assign({members:[],avoidMembers:[],fill:"lightblue",fillOpacity:.2,stroke:"blue",strokeOpacity:.2},u0);const Yct=(r,t)=>(Array.isArray(t)?t:[t]).map(n=>{const i=r.getElementRenderBounds(n);return new Xn(i.min[0],i.min[1],la(i),ua(i))}),Xct=(r,t)=>(Array.isArray(t)?t:[t]).map(n=>{const i=r.getEdgeData(n),a=r.getElementPosition(i.source),s=r.getElementPosition(i.target);return An.from({x1:a[0],y1:a[1],x2:s[0],y2:s[1]})});function Kct(r){return`
- <ul class="g6-contextmenu-ul">
- ${r.map(t=>`<li class="g6-contextmenu-li" value="${t.value}">${t.name}</li>`).join("")}
- </ul>
- `}const Zct=`
- .g6-contextmenu {
- font-size: 12px;
- background-color: rgba(255, 255, 255, 0.96);
- border-radius: 4px;
- overflow: hidden;
- box-shadow: rgba(0, 0, 0, 0.12) 0px 6px 12px 0px;
- transition: visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1) 0s, left 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s, top 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s;
- }
- .g6-contextmenu-ul {
- max-width: 256px;
- min-width: 96px;
- list-style: none;
- padding: 0;
- margin: 0;
- }
- .g6-contextmenu-li {
- padding: 8px 12px;
- cursor: pointer;
- user-select: none;
- }
- .g6-contextmenu-li:hover {
- background-color: #f5f5f5;
- cursor: pointer;
- }
- `;var QP=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class h0 extends Wn{constructor(t,e){super(t,Object.assign({},h0.defaultOptions,e)),this.targetElement=null,this.onTriggerEvent=n=>{var i;(i=n.preventDefault)===null||i===void 0||i.call(n),this.show(n)},this.onMenuItemClick=n=>{const{onClick:i,trigger:a}=this.options;if(n.target instanceof HTMLElement&&n.target.className.includes("g6-contextmenu-li")){const s=n.target.getAttribute("value");i==null||i(s,n.target,this.targetElement),this.hide()}a!=="click"&&this.hide()},this.initElement(),this.update(e)}initElement(){this.$element=iu("contextmenu",!1,{zIndex:"99"});const{className:t}=this.options;t&&this.$element.classList.add(t),this.context.canvas.getContainer().appendChild(this.$element),ox("g6-contextmenu-css","style",{},Zct,document.head)}show(t){return QP(this,void 0,void 0,function*(){const{enable:e,offset:n}=this.options;if(typeof e=="function"&&!e(t)||!e){this.hide();return}const i=yield this.getDOMContent(t);i instanceof HTMLElement?(this.$element.innerHTML="",this.$element.appendChild(i)):this.$element.innerHTML=i;const a=this.context.graph.getCanvas().getContainer().getBoundingClientRect();this.$element.style.left=`${t.client.x-a.left+n[0]}px`,this.$element.style.top=`${t.client.y-a.top+n[1]}px`,this.$element.style.display="block",this.targetElement=t.target})}hide(){this.$element.style.display="none",this.targetElement=null}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.$element.remove()}getDOMContent(t){return QP(this,void 0,void 0,function*(){const{getContent:e,getItems:n}=this.options;return n?Kct(yield n(t)):yield e(t)})}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`canvas:${e}`,this.onTriggerEvent),t.on(`node:${e}`,this.onTriggerEvent),t.on(`edge:${e}`,this.onTriggerEvent),t.on(`combo:${e}`,this.onTriggerEvent),document.addEventListener("click",this.onMenuItemClick)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`canvas:${e}`,this.onTriggerEvent),t.off(`node:${e}`,this.onTriggerEvent),t.off(`edge:${e}`,this.onTriggerEvent),t.off(`combo:${e}`,this.onTriggerEvent),document.removeEventListener("click",this.onMenuItemClick)}}h0.defaultOptions={trigger:"contextmenu",offset:[4,4],loadingContent:'<div class="g6-contextmenu-loading">Loading...</div>',getContent:()=>"It is a empty context menu.",enable:()=>!0};class d0 extends Wn{constructor(t,e){super(t,Object.assign({},d0.defaultOptions,e)),this.edgeBundles={},this.edgePoints={},this.onBundle=()=>{const{model:n,element:i}=this.context,a=n.getEdgeData();this.divideEdges(this.options.divisions);const{cycles:s,iterRate:o,divRate:l}=this.options;let{lambda:u,divisions:c,iterations:h}=this.options;for(let d=0;d<s;d++){for(let g=0;g<h;g++){const p={};a.forEach(v=>{var m;if(v.source===v.target)return;const b=H(v);p[b]=this.getEdgeForces(v,c,u);for(let w=0;w<c+1;w++)(m=this.edgePoints)[b]||(m[b]=[]),this.edgePoints[b][w]=Lt(this.edgePoints[b][w],p[b][w])})}u/=2,c*=l,h*=o,this.divideEdges(c)}a.forEach(d=>{const g=H(d),p=i.getElement(g);p==null||p.update({d:eE(this.edgePoints[g])})})},this.bindEvents()}get nodeMap(){const t=this.context.model.getNodeData();return Object.fromEntries(t.map(e=>[H(e),Fo(sn(e))]))}divideEdges(t){this.context.model.getEdgeData().forEach(n=>{var i;const a=H(n);(i=this.edgePoints)[a]||(i[a]=[]);const s=this.nodeMap[n.source],o=this.nodeMap[n.target];if(t===1)this.edgePoints[a].push(s),this.edgePoints[a].push(Di(Lt(s,o),2)),this.edgePoints[a].push(o);else{const u=(this.edgePoints[a].length===0?Ae(s,o):nht(this.edgePoints[a]))/(t+1);let c=u;const h=[s];for(let d=1;d<this.edgePoints[a].length;d++){const g=this.edgePoints[a][d-1],p=this.edgePoints[a][d];let v=Ae(p,g);for(;v>c;){const m=c/v,b=Lt(g,Ta(be(p,g),m));h.push(b),v-=c,c=u}c-=v}h.push(o),this.edgePoints[a]=h}})}getVectorPosition(t){const e=this.nodeMap[t.source],n=this.nodeMap[t.target],[i,a]=be(n,e),s=Ae(e,n);return{source:e,target:n,vx:i,vy:a,length:s}}measureEdgeCompatibility(t,e){const n=this.getVectorPosition(t),i=this.getVectorPosition(e),a=Jct(n,i),s=Qct(n,i),o=tht(n,i),l=eht(n,i);return a*s*o*l}getEdgeBundles(){const t={},e=this.options.bundleThreshold,n=this.context.model.getEdgeData();return n.forEach((i,a)=>{n.forEach((s,o)=>{var l,u;if(o<=a)return;this.measureEdgeCompatibility(i,s)>=e&&(t[l=H(i)]||(t[l]=[]),t[H(i)].push(s),t[u=H(s)]||(t[u]=[]),t[H(s)].push(i))})}),t}getSpringForce(t,e){const{pre:n,cur:i,next:a}=t;return Ta(be(Lt(n,a),Ta(i,2)),e)}getElectrostaticForce(t,e){Ki(this.edgeBundles)&&(this.edgeBundles=this.getEdgeBundles());const n=this.edgeBundles[H(e)];let i=[0,0];return n==null||n.forEach(a=>{const s=this.edgePoints[H(a)][t],o=this.edgePoints[H(e)][t],l=be(s,o),u=Ae(s,o);i=Lt(i,Ta(l,1/u))}),i}getEdgeForces(t,e,n){const i=this.nodeMap[t.source],a=this.nodeMap[t.target],s=this.options.K/(Ae(i,a)*(e+1)),o=[[0,0]],l=H(t);for(let u=1;u<e;u++){const c=this.getSpringForce({pre:this.edgePoints[l][u-1],cur:this.edgePoints[l][u],next:this.edgePoints[l][u+1]||[0,0]},s),h=this.getElectrostaticForce(u,t);o.push(Ta(Lt(c,h),n))}return o.push([0,0]),o}bindEvents(){const{graph:t}=this.context;t.on(ut.AFTER_RENDER,this.onBundle)}unbindEvents(){const{graph:t}=this.context;t.off(ut.AFTER_RENDER,this.onBundle)}destroy(){this.unbindEvents(),super.destroy()}}d0.defaultOptions={K:.1,lambda:.1,divisions:1,divRate:2,cycles:6,iterations:90,iterRate:2/3,bundleThreshold:.6};const Jct=(r,t)=>Math.abs(LX([r.vx,r.vy],[t.vx,t.vy])/(r.length*t.length)),Qct=(r,t)=>{const e=(r.length+t.length)/2;return 2/(e/Math.min(r.length,t.length)+Math.max(r.length,t.length)/e)},tht=(r,t)=>{const e=(r.length+t.length)/2,n=Di(Lt(r.source,r.target),2),i=Di(Lt(t.source,t.target),2);return e/(e+Ae(n,i))},tN=(r,t)=>{if(t.source[0]===t.target[0])return[t.source[0],r[1]];if(t.source[1]===t.target[1])return[r[0],t.source[1]];const e=(t.source[1]-t.target[1])/(t.source[0]-t.target[0]),n=(e*e*t.source[0]+e*(r[1]-t.source[1])+r[0])/(e*e+1),i=e*(n-t.source[0])+t.source[1];return[n,i]},eN=(r,t)=>{const e=tN(t.source,r),n=tN(t.target,r),i=Di(Lt(e,n),2),a=Di(Lt(r.source,r.target),2);return Ae(e,n)===0?0:Math.max(0,1-2*Ae(a,i)/Ae(e,n))},eht=(r,t)=>Math.min(eN(r,t),eN(t,r)),nht=r=>{let t=0;for(let e=1;e<r.length;e++)t+=Ae(r[e],r[e-1]);return t},rht={fill:"#fff",fillOpacity:1,lineWidth:1,stroke:"#000",strokeOpacity:.8,zIndex:-1/0},nN=.05;class f0 extends Wn{constructor(t,e){super(t,Object.assign({},f0.defaultOptions,e)),this.shapes=new Map,this.r=this.options.r,this.onEdgeFilter=n=>{if(this.options.trigger==="drag"&&this.isLensOn)return;const i=zn(n.canvas);this.renderLens(i),this.renderFocusElements()},this.renderLens=n=>{const i=Object.assign({},rht,this.options.style);this.isLensOn||(this.lens=new zc({style:i}),this.canvas.appendChild(this.lens)),Object.assign(i,Ni(n),{size:this.r*2}),this.lens.update(i)},this.getFilterData=()=>{const{filter:n}=this.options,{model:i}=this.context,a=i.getData();if(!n)return a;const{nodes:s,edges:o,combos:l}=a;return{nodes:s.filter(u=>n(H(u),"node")),edges:o.filter(u=>n(H(u),"edge")),combos:l.filter(u=>n(H(u),"combo"))}},this.getFocusElements=n=>{const{nodes:i,edges:a}=this.getFilterData(),s=i.filter(u=>Ae(sn(u),n)<this.r),o=s.map(u=>H(u)),l=a.filter(u=>{const{source:c,target:h}=u,d=o.includes(c),g=o.includes(h);switch(this.options.nodeType){case"both":return d&&g;case"either":return d!==g;case"source":return d&&!g;case"target":return!d&&g;default:return!1}});return{nodes:s,edges:l}},this.renderFocusElements=()=>{const{element:n,graph:i}=this.context;if(!this.isLensOn)return;const a=this.lens.getCenter(),{nodes:s,edges:o}=this.getFocusElements(a),l=new Set,u=c=>{const h=H(c);l.add(h);const d=n.getElement(h);if(!d)return;const g=this.shapes.get(h)||d.cloneNode();g.setPosition(d.getPosition()),g.id=d.id,this.shapes.has(h)?Object.entries(d.attributes).forEach(([m,b])=>{g.style[m]!==b&&(g.style[m]=b)}):(this.canvas.appendChild(g),this.shapes.set(h,g));const p=i.getElementType(h),v=this.getElementStyle(p,c);g.update(v)};s.forEach(u),o.forEach(u),this.shapes.forEach((c,h)=>{l.has(h)||(c.destroy(),this.shapes.delete(h))})},this.scaleRByWheel=n=>{var i;this.options.preventDefault&&n.preventDefault();const{clientX:a,clientY:s,deltaX:o,deltaY:l}=n,{graph:u,canvas:c}=this.context,h=u.getCanvasByClient([a,s]),d=(i=this.lens)===null||i===void 0?void 0:i.getCenter();if(!this.isLensOn||Ae(h,d)>this.r)return;const{maxR:g,minR:p}=this.options,v=o+l>0?1/(1-nN):1-nN,m=Math.min(...c.getSize())/2;this.r=Math.max(p||0,Math.min(g||m,this.r*v)),this.renderLens(d),this.renderFocusElements()},this.isLensDragging=!1,this.onDragStart=n=>{var i;const a=zn(n.canvas),s=(i=this.lens)===null||i===void 0?void 0:i.getCenter();!this.isLensOn||Ae(a,s)>this.r||(this.isLensDragging=!0)},this.onDrag=n=>{if(!this.isLensDragging)return;const i=zn(n.canvas);this.renderLens(i),this.renderFocusElements()},this.onDragEnd=()=>{this.isLensDragging=!1},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}getElementStyle(t,e){const n=t==="node"?this.options.nodeStyle:this.options.edgeStyle;return typeof n=="function"?n(e):n}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i}=this.options,a=e.getCanvas().getLayer();["click","drag"].includes(n)&&a.addEventListener(J.CLICK,this.onEdgeFilter),n==="pointermove"?a.addEventListener(J.POINTER_MOVE,this.onEdgeFilter):n==="drag"&&(a.addEventListener(J.DRAG_START,this.onDragStart),a.addEventListener(J.DRAG,this.onDrag),a.addEventListener(J.DRAG_END,this.onDragEnd)),i==="wheel"&&((t=this.graphDom)===null||t===void 0||t.addEventListener(J.WHEEL,this.scaleRByWheel,{passive:!1}))}unbindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i}=this.options,a=e.getCanvas().getLayer();["click","drag"].includes(n)&&a.removeEventListener(J.CLICK,this.onEdgeFilter),n==="pointermove"?a.removeEventListener(J.POINTER_MOVE,this.onEdgeFilter):n==="drag"&&(a.removeEventListener(J.DRAG_START,this.onDragStart),a.removeEventListener(J.DRAG,this.onDrag),a.removeEventListener(J.DRAG_END,this.onDragEnd)),i==="wheel"&&((t=this.graphDom)===null||t===void 0||t.removeEventListener(J.WHEEL,this.scaleRByWheel))}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),this.isLensOn&&this.lens.destroy(),this.shapes.forEach((t,e)=>{t.destroy(),this.shapes.delete(e)}),super.destroy()}}f0.defaultOptions={trigger:"pointermove",r:60,nodeType:"both",filter:()=>!0,style:{lineWidth:2},nodeStyle:{label:!1},edgeStyle:{label:!0},scaleRBy:"wheel",preventDefault:!0};const iht={fill:"#ccc",fillOpacity:.1,lineWidth:2,stroke:"#000",strokeOpacity:.8,labelFontSize:12},rN=.05,iN=.1;class g0 extends Wn{constructor(t,e){super(t,Object.assign({},g0.defaultOptions,e)),this.r=this.options.r,this.d=this.options.d,this.onCreateFisheye=n=>{if(this.options.trigger==="drag"&&this.isLensOn)return;const i=zn(n.canvas);this.onMagnify(i)},this.onMagnify=n=>{n.some(isNaN)||(this.renderLens(n),this.renderFocusElements())},this.renderLens=n=>{const i=Object.assign({},iht,this.options.style);this.isLensOn||(this.lens=new zc({style:i}),this.canvas.appendChild(this.lens)),Object.assign(i,Ni(n),{size:this.r*2,label:this.options.showDPercent,labelText:this.getDPercent()}),this.lens.update(i)},this.getDPercent=()=>{const{minD:n,maxD:i}=this.options;return`${Math.round((this.d-n)/(i-n)*100)}%`},this.prevMagnifiedStyleMap=new Map,this.prevOriginStyleMap=new Map,this.renderFocusElements=()=>{if(!this.isLensOn)return;const{graph:n}=this.context,i=this.lens.getCenter(),a=(this.d+1)*this.r,s=new Map,o=new Map;n.getNodeData().forEach(u=>{const c=sn(u),h=Ae(c,i);if(h>this.r)return;const d=a*h/(this.d*h+this.r),[g,p]=c,[v,m]=i,b=(g-v)/h,w=(p-m)/h,x=[v+d*b,m+d*w],_=H(u),S=this.getNodeStyle(u),M=No(n.getElementRenderStyle(_),Object.keys(S));s.set(_,Object.assign(Object.assign({},Ni(x)),S)),o.set(_,Object.assign(Object.assign({},Ni(c)),M))}),this.updateStyle(s,o)},this.getNodeStyle=n=>{const{nodeStyle:i}=this.options;return typeof i=="function"?i(n):i},this.updateStyle=(n,i)=>{const{graph:a,element:s}=this.context,{enter:o,exit:l,keep:u}=Ns(Array.from(this.prevMagnifiedStyleMap.keys()),Array.from(n.keys()),d=>d),c=new Set,h=(d,g)=>{const p=s.getElement(d);p==null||p.update(g),a.getRelatedEdgesData(d).forEach(v=>{c.add(H(v))})};[...o,...u].forEach(d=>{h(d,n.get(d))}),l.forEach(d=>{h(d,this.prevOriginStyleMap.get(d)),this.prevOriginStyleMap.delete(d)}),c.forEach(d=>{const g=s.getElement(d);g==null||g.update({})}),this.prevMagnifiedStyleMap=n,i.forEach((d,g)=>{this.prevOriginStyleMap.has(g)||this.prevOriginStyleMap.set(g,d)})},this.isWheelValid=n=>{if(this.options.preventDefault&&n.preventDefault(),!this.isLensOn)return!1;const{clientX:i,clientY:a}=n,s=this.context.graph.getCanvasByClient([i,a]),o=this.lens.getCenter();return!(Ae(s,o)>this.r)},this.scaleR=n=>{const{maxR:i,minR:a}=this.options,s=n?1/(1-rN):1-rN,o=Math.min(...this.context.canvas.getSize())/2;this.r=Math.max(a||0,Math.min(i||o,this.r*s))},this.scaleD=n=>{const{maxD:i,minD:a}=this.options,s=n?this.d+iN:this.d-iN;this.d=Math.max(a,Math.min(i,s))},this.scaleRByWheel=n=>{if(!this.isWheelValid(n))return;const{deltaX:i,deltaY:a}=n;this.scaleR(i+a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.scaleDByWheel=n=>{if(!this.isWheelValid(n))return;const{deltaX:i,deltaY:a}=n;this.scaleD(i+a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.isDragValid=n=>{if(this.options.preventDefault&&n.preventDefault(),!this.isLensOn)return!1;const i=zn(n.canvas),a=this.lens.getCenter();return!(Ae(i,a)>this.r)},this.isLensDragging=!1,this.onDragStart=n=>{this.isDragValid(n)&&(this.isLensDragging=!0)},this.onDrag=n=>{if(!this.isLensDragging)return;const i=zn(n.canvas);this.onMagnify(i)},this.onDragEnd=()=>{this.isLensDragging=!1},this.scaleRByDrag=n=>{if(!this.isLensDragging)return;const{dx:i,dy:a}=n;this.scaleR(i-a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.scaleDByDrag=n=>{if(!this.isLensDragging)return;const{dx:i,dy:a}=n;this.scaleD(i-a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i,scaleDBy:a}=this.options,s=e.getCanvas().getLayer();if(["click","drag"].includes(n)&&s.addEventListener(J.CLICK,this.onCreateFisheye),n==="pointermove"&&s.addEventListener(J.POINTER_MOVE,this.onCreateFisheye),n==="drag"||i==="drag"||a==="drag"){s.addEventListener(J.DRAG_START,this.onDragStart),s.addEventListener(J.DRAG_END,this.onDragEnd);const o=n==="drag"?this.onDrag:i==="drag"?this.scaleRByDrag:this.scaleDByDrag;s.addEventListener(J.DRAG,o)}if(i==="wheel"||a==="wheel"){const o=i==="wheel"?this.scaleRByWheel:this.scaleDByWheel;(t=this.graphDom)===null||t===void 0||t.addEventListener(J.WHEEL,o,{passive:!1})}}unbindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i,scaleDBy:a}=this.options,s=e.getCanvas().getLayer();if(["click","drag"].includes(n)&&s.removeEventListener(J.CLICK,this.onCreateFisheye),n==="pointermove"&&s.removeEventListener(J.POINTER_MOVE,this.onCreateFisheye),n==="drag"||i==="drag"||a==="drag"){s.removeEventListener(J.DRAG_START,this.onDragStart),s.removeEventListener(J.DRAG_END,this.onDragEnd);const o=n==="drag"?this.onDrag:i==="drag"?this.scaleRByDrag:this.scaleDByDrag;s.removeEventListener(J.DRAG,o)}if(i==="wheel"||a==="wheel"){const o=i==="wheel"?this.scaleRByWheel:this.scaleDByWheel;(t=this.graphDom)===null||t===void 0||t.removeEventListener(J.WHEEL,o)}}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){var t;this.unbindEvents(),this.isLensOn&&((t=this.lens)===null||t===void 0||t.destroy()),this.prevMagnifiedStyleMap.clear(),this.prevOriginStyleMap.clear(),super.destroy()}}g0.defaultOptions={trigger:"pointermove",r:120,d:1.5,maxD:5,minD:0,showDPercent:!0,style:{},nodeStyle:{label:!0},preventDefault:!0};class p0 extends Wn{constructor(t,e){super(t,Object.assign({},p0.defaultOptions,e)),this.$el=this.context.canvas.getContainer(),this.graphSize=[0,0],this.onFullscreenChange=()=>{var n,i,a,s;const o=!!document.fullscreenElement;this.options.autoFit&&this.setGraphSize(o),o?(i=(n=this.options).onEnter)===null||i===void 0||i.call(n):(s=(a=this.options).onExit)===null||s===void 0||s.call(a)},this.shortcut=new Xl(t.graph),this.bindEvents(),this.style=document.createElement("style"),document.head.appendChild(this.style),this.style.innerHTML=`
- :not(:root):fullscreen::backdrop {
- background: transparent;
- }
- `}bindEvents(){this.unbindEvents(),this.shortcut.unbindAll();const{request:t=[],exit:e=[]}=this.options.trigger;this.shortcut.bind(t,this.request),this.shortcut.bind(e,this.exit),["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach(i=>{document.addEventListener(i,this.onFullscreenChange,!1)})}unbindEvents(){this.shortcut.unbindAll(),["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach(e=>{document.removeEventListener(e,this.onFullscreenChange,!1)})}setGraphSize(t=!0){var e,n;let i,a;t?(i=((e=globalThis.screen)===null||e===void 0?void 0:e.width)||0,a=((n=globalThis.screen)===null||n===void 0?void 0:n.height)||0,this.graphSize=this.context.graph.getSize()):[i,a]=this.graphSize,this.context.graph.setSize(i,a),this.context.graph.render()}request(){document.fullscreenElement||!aht()||this.$el.requestFullscreen().catch(t=>{sa.warn(`Error attempting to enable full-screen: ${t.message} (${t.name})`)})}exit(){document.fullscreenElement&&document.exitFullscreen()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.exit(),this.style.remove(),super.destroy()}}p0.defaultOptions={trigger:{},autoFit:!0};function aht(){return document.fullscreenEnabled||Reflect.get(document,"webkitFullscreenEnabled")||Reflect.get(document,"mozFullscreenEnabled")||Reflect.get(document,"msFullscreenEnabled")}class v0 extends Wn{constructor(t,e){super(t,Object.assign({},v0.defaultOptions,e)),this.$element=iu("grid-line",!0),this.offset=[0,0],this.onTransform=i=>{if(!this.options.follow)return;const{data:{translate:a}}=i;a&&this.updateOffset(a)},this.context.canvas.getContainer().prepend(this.$element),this.updateStyle(),this.bindEvents()}update(t){super.update(t),this.updateStyle()}bindEvents(){const{graph:t}=this.context;t.on(ut.AFTER_TRANSFORM,this.onTransform)}updateStyle(){const{size:t,stroke:e,lineWidth:n,border:i,borderLineWidth:a,borderStroke:s,borderStyle:o}=this.options;Object.assign(this.$element.style,{border:i?`${a}px ${o} ${s}`:"none",backgroundImage:`linear-gradient(${e} ${n}px, transparent ${n}px), linear-gradient(90deg, ${e} ${n}px, transparent ${n}px)`,backgroundSize:`${t}px ${t}px`,backgroundRepeat:"repeat"})}updateOffset(t){this.offset=DX(Lt(this.offset,t),this.options.size),this.$element.style.backgroundPosition=`${this.offset[0]}px ${this.offset[1]}px`}destroy(){this.context.graph.off(ut.AFTER_TRANSFORM,this.onTransform),this.$element.remove(),super.destroy()}}v0.defaultOptions={border:!0,borderLineWidth:1,borderStroke:"#eee",borderStyle:"solid",lineWidth:1,size:20,stroke:"#eee"};function DE(r){const t={Added:new Map,Updated:new Map,Removed:new Map};return r.forEach(e=>{const{type:n,value:i}=e,a=H(i);if(n==="NodeAdded"||n==="EdgeAdded"||n==="ComboAdded")t.Added.set(a,e);else if(n==="NodeUpdated"||n==="EdgeUpdated"||n==="ComboUpdated")if(t.Added.has(a))t.Added.set(a,{type:n.replace("Updated","Added"),value:i});else if(t.Updated.has(a)){const{original:s}=t.Updated.get(a);t.Updated.set(a,{type:n,value:i,original:s})}else t.Removed.has(a)||t.Updated.set(a,e);else(n==="NodeRemoved"||n==="EdgeRemoved"||n==="ComboRemoved")&&(t.Added.has(a)?t.Added.delete(a):(t.Updated.has(a)&&t.Updated.delete(a),t.Removed.set(a,e)))}),[...Array.from(t.Added.values()),...Array.from(t.Updated.values()),...Array.from(t.Removed.values())]}function w4(r){const{NodeAdded:t=[],NodeUpdated:e=[],NodeRemoved:n=[],EdgeAdded:i=[],EdgeUpdated:a=[],EdgeRemoved:s=[],ComboAdded:o=[],ComboUpdated:l=[],ComboRemoved:u=[]}=rg(r,c=>c.type);return{add:{nodes:t,edges:i,combos:o},update:{nodes:e,edges:a,combos:l},remove:{nodes:n,edges:s,combos:u}}}function x4(r,t){for(const e in r)an(r[e])&&!Array.isArray(r[e])&&r[e]!==null?(t[e]||(t[e]={}),x4(r[e],t[e])):t[e]===void 0&&(t[e]=fc(e))}function sht(r,t=!1,e){const n={animation:t,current:{add:{},update:{},remove:{}},original:{add:{},update:{},remove:{}}},{add:i,update:a,remove:s}=w4(DE(r));return["nodes","edges","combos"].forEach(o=>{a[o]&&a[o].forEach(l=>{var u,c;const h=Object.assign({},l.value);let d=Object.assign({},l.original);if(e){const g=e.graph.getElementType(H(l.original)),p=g==="edge"?"stroke":"fill",v=e.element.getElementComputedStyle(g,l.original);d=Object.assign(Object.assign({},l.original),{style:Object.assign({[p]:v[p]},l.original.style)})}x4(h,d),(u=n.current.update)[o]||(u[o]=[]),n.current.update[o].push(h),(c=n.original.update)[o]||(c[o]=[]),n.original.update[o].push(d)}),i[o]&&i[o].forEach(l=>{var u,c;const h=Object.assign({},l.value);(u=n.current.add)[o]||(u[o]=[]),n.current.add[o].push(h),(c=n.original.remove)[o]||(c[o]=[]),n.original.remove[o].push(h)}),s[o]&&s[o].forEach(l=>{var u,c;const h=Object.assign({},l.value);(u=n.current.remove)[o]||(u[o]=[]),n.current.remove[o].push(h),(c=n.original.add)[o]||(c[o]=[]),n.original.add[o].push(h)})}),n}class m0 extends Wn{constructor(t,e){super(t,Object.assign({},m0.defaultOptions,e)),this.batchChanges=null,this.batchAnimation=!1,this.undoStack=[],this.redoStack=[],this.freezed=!1,this.executeCommand=(i,a=!0)=>{var s,o,l;this.freezed=!0,(o=(s=this.options).executeCommand)===null||o===void 0||o.call(s,i);const u=a?i.original:i.current;this.context.graph.addData(u.add),this.context.graph.updateData(u.update),this.context.graph.removeData(uI(u.remove,!1)),(l=this.context.element)===null||l===void 0||l.draw({silence:!0,animation:i.animation}),this.freezed=!1},this.addCommand=i=>{var a;if(!this.freezed){if(i.type===ut.AFTER_DRAW){const{dataChanges:s=[],animation:o=!0}=i.data;if(!((a=this.context.batch)===null||a===void 0)&&a.isBatching){if(!this.batchChanges)return;this.batchChanges.push(s),this.batchAnimation&&(this.batchAnimation=o);return}this.batchChanges=[s],this.batchAnimation=o}this.undoStackPush(sht(this.batchChanges.flat(),this.batchAnimation,this.context)),this.notify(ys.ADD,this.undoStack[this.undoStack.length-1])}},this.initBatchCommand=i=>{const{initiate:a}=i.data;this.batchAnimation=!1,a?this.batchChanges=[]:this.undoStack.pop()||(this.batchChanges=null)},this.emitter=new kg;const{graph:n}=this.context;n.on(ut.AFTER_DRAW,this.addCommand),n.on(ut.BATCH_START,this.initBatchCommand),n.on(ut.BATCH_END,this.addCommand)}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}undo(){var t,e,n,i;const a=this.undoStack.pop();if(a){if(this.executeCommand(a),((e=(t=this.options).beforeAddCommand)===null||e===void 0?void 0:e.call(t,a,!1))===!1)return;this.redoStack.push(a),(i=(n=this.options).afterAddCommand)===null||i===void 0||i.call(n,a,!1),this.notify(ys.UNDO,a)}return this}redo(){const t=this.redoStack.pop();return t&&(this.executeCommand(t,!1),this.undoStackPush(t),this.notify(ys.REDO,t)),this}undoAndCancel(){const t=this.undoStack.pop();return t&&(this.executeCommand(t,!1),this.redoStack=[],this.notify(ys.CANCEL,t)),this}undoStackPush(t){var e,n,i,a;const{stackSize:s}=this.options;s!==0&&this.undoStack.length>=s&&this.undoStack.shift(),((n=(e=this.options).beforeAddCommand)===null||n===void 0?void 0:n.call(e,t,!0))!==!1&&(this.undoStack.push(t),(a=(i=this.options).afterAddCommand)===null||a===void 0||a.call(i,t,!0))}clear(){this.undoStack=[],this.redoStack=[],this.batchChanges=null,this.batchAnimation=!1,this.notify(ys.CLEAR,null)}notify(t,e){this.emitter.emit(t,{cmd:e}),this.emitter.emit(ys.CHANGE,{cmd:e})}on(t,e){this.emitter.on(t,e)}destroy(){const{graph:t}=this.context;t.off(ut.AFTER_DRAW,this.addCommand),t.off(ut.BATCH_START,this.initBatchCommand),t.off(ut.BATCH_END,this.addCommand),this.emitter.off(),super.destroy(),this.undoStack=[],this.redoStack=[]}}m0.defaultOptions={stackSize:0};function jd(r,t,e,n,i,a){const s=(a-t)*(e-r)-(n-t)*(i-r);return s>0?!0:!(s<0)}function oht(r,t){const e=r[0][0],n=r[0][1],i=r[1][0],a=r[1][1],s=t[0][0],o=t[0][1],l=t[1][0],u=t[1][1];return jd(e,n,s,o,l,u)!==jd(i,a,s,o,l,u)&&jd(e,n,i,a,s,o)!==jd(e,n,i,a,l,u)}var lht=oht;function E4(r,t){this._cells=[],this._cellSize=t,this._reverseCellSize=1/t;for(let e=0;e<r.length;e++){const n=r[e],i=this.coordToCellNum(n[0]),a=this.coordToCellNum(n[1]);if(this._cells[i])this._cells[i][a]?this._cells[i][a].push(n):this._cells[i][a]=[n];else{const s=[];s[a]=[n],this._cells[i]=s}}}E4.prototype={cellPoints:function(r,t){return this._cells[r]!==void 0&&this._cells[r][t]!==void 0?this._cells[r][t]:[]},rangePoints:function(r){const t=this.coordToCellNum(r[0]),e=this.coordToCellNum(r[1]),n=this.coordToCellNum(r[2]),i=this.coordToCellNum(r[3]),a=[];for(let s=t;s<=n;s++)for(let o=e;o<=i;o++)for(let l=0;l<this.cellPoints(s,o).length;l++)a.push(this.cellPoints(s,o)[l]);return a},removePoint:function(r){const t=this.coordToCellNum(r[0]),e=this.coordToCellNum(r[1]),n=this._cells[t][e];let i;for(let a=0;a<n.length;a++)if(n[a][0]===r[0]&&n[a][1]===r[1]){i=a;break}return n.splice(i,1),n},trunc:Math.trunc||function(r){return r-r%1},coordToCellNum:function(r){return this.trunc(r*this._reverseCellSize)},extendBbox:function(r,t){return[r[0]-t*this._cellSize,r[1]-t*this._cellSize,r[2]+t*this._cellSize,r[3]+t*this._cellSize]}};function uht(r,t){return new E4(r,t)}var cht=uht,hht={toXy:function(r,t){return t===void 0?r.slice():r.map(function(e){return new Function("pt","return [pt"+t[0]+",pt"+t[1]+"];")(e)})},fromXy:function(r,t){return t===void 0?r.slice():r.map(function(e){return new Function("pt","const o = {}; o"+t[0]+"= pt[0]; o"+t[1]+"= pt[1]; return o;")(e)})}};function _4(r,t,e){return(t[0]-r[0])*(e[1]-r[1])-(t[1]-r[1])*(e[0]-r[0])}function dht(r){const t=[];for(let e=0;e<r.length;e++){for(;t.length>=2&&_4(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}return t.pop(),t}function fht(r){const t=r.reverse(),e=[];for(let n=0;n<t.length;n++){for(;e.length>=2&&_4(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}return e.pop(),e}function ght(r){const t=dht(r),n=fht(r).concat(t);return n.push(r[0]),n}var pht=ght;const vht=lht,mht=cht,Vb=hht,yht=pht;function bht(r){const t=[r[0]];let e=r[0];for(let n=1;n<r.length;n++){const i=r[n];(e[0]!==i[0]||e[1]!==i[1])&&t.push(i),e=i}return t}function wht(r){return r.sort(function(t,e){return t[0]-e[0]||t[1]-e[1]})}function lx(r,t){return Math.pow(t[0]-r[0],2)+Math.pow(t[1]-r[1],2)}function aN(r,t,e){const n=[t[0]-r[0],t[1]-r[1]],i=[e[0]-r[0],e[1]-r[1]],a=lx(r,t),s=lx(r,e);return(n[0]*i[0]+n[1]*i[1])/Math.sqrt(a*s)}function sN(r,t){for(let e=0;e<t.length-1;e++){const n=[t[e],t[e+1]];if(!(r[0][0]===n[0][0]&&r[0][1]===n[0][1]||r[0][0]===n[1][0]&&r[0][1]===n[1][1])&&vht(r,n))return!0}return!1}function xht(r){let t=1/0,e=1/0,n=-1/0,i=-1/0;for(let a=r.length-1;a>=0;a--)r[a][0]<t&&(t=r[a][0]),r[a][1]<e&&(e=r[a][1]),r[a][0]>n&&(n=r[a][0]),r[a][1]>i&&(i=r[a][1]);return[n-t,i-e]}function Eht(r){return[Math.min(r[0][0],r[1][0]),Math.min(r[0][1],r[1][1]),Math.max(r[0][0],r[1][0]),Math.max(r[0][1],r[1][1])]}function _ht(r,t,e){let n=null,i=oN,a=oN,s,o;for(let l=0;l<t.length;l++)s=aN(r[0],r[1],t[l]),o=aN(r[1],r[0],t[l]),s>i&&o>a&&!sN([r[0],t[l]],e)&&!sN([r[1],t[l]],e)&&(i=s,a=o,n=t[l]);return n}function S4(r,t,e,n,i){let a=!1;for(let s=0;s<r.length-1;s++){const o=[r[s],r[s+1]],l=o[0][0]+","+o[0][1]+","+o[1][0]+","+o[1][1];if(lx(o[0],o[1])<t||i.has(l))continue;let u=0,c=Eht(o),h,d,g;do c=n.extendBbox(c,u),h=c[2]-c[0],d=c[3]-c[1],g=_ht(o,n.rangePoints(c),r),u++;while(g===null&&(e[0]>h||e[1]>d));h>=e[0]&&d>=e[1]&&i.add(l),g!==null&&(r.splice(s+1,0,g),n.removePoint(g),a=!0)}return a?S4(r,t,e,n,i):r}function Sht(r,t,e){let n=t||20;const i=bht(wht(Vb.toXy(r,e)));if(i.length<4){const h=i.concat([i[0]]);return e?Vb.fromXy(h,e):h}const a=xht(i),s=[a[0]*lN,a[1]*lN],o=yht(i),l=i.filter(function(h){return o.indexOf(h)<0}),u=Math.ceil(1/(i.length/(a[0]*a[1]))),c=S4(o,Math.pow(n,2),s,mht(l,u),new Set);return e?Vb.fromXy(c,e):c}const oN=Math.cos(90/(180/Math.PI)),lN=.6;var Mht=Sht;const kht=ng(Mht);function Tht(r,t,e){if(r.length===1)return Oht(r[0],t,e);if(r.length===2)return uN(r,t,e);if(r.length===3){const[n,i,a]=Xx(r);if(vI(n,i,a))return uN([n,a],t,e)}switch(e){case"smooth":return Aht(r,t);case"sharp":return Pht(r,t);case"rounded":default:return Cht(r,t)}}const Oht=(r,t,e)=>{if(e==="sharp")return[["M",r[0]-t,r[1]-t],["L",r[0]+t,r[1]-t],["L",r[0]+t,r[1]+t],["L",r[0]-t,r[1]+t],["Z"]];const n=[t,t,0,0,0];return[["M",r[0],r[1]-t],["A",...n,r[0],r[1]+t],["A",...n,r[0],r[1]-t]]},uN=(r,t,e)=>{const n=[t,t,0,0,0],i=e==="sharp"?Lt(r[0],Ms(Ba(be(r[0],r[1])),t)):r[0],a=e==="sharp"?Lt(r[1],Ms(Ba(be(r[1],r[0])),t)):r[1],s=Ms(Ba(cg(be(i,a),!1)),t),o=Ms(s,-1),l=Lt(i,s),u=Lt(a,s),c=Lt(a,o),h=Lt(i,o);return e==="sharp"?[["M",l[0],l[1]],["L",u[0],u[1]],["L",c[0],c[1]],["L",h[0],h[1]],["Z"]]:[["M",l[0],l[1]],["L",u[0],u[1]],["A",...n,c[0],c[1]],["L",h[0],h[1]],["A",...n,l[0],l[1]]]},Cht=(r,t)=>{const e=Xx(r).map((o,l)=>{const u=(l-2+r.length)%r.length,c=(l-1+r.length)%r.length,h=(l+1)%r.length,d=r[u],g=r[c],p=r[h],v=be(d,g),m=be(g,o),b=be(o,p),w=(k,T)=>Ux(k,T,!0)<Math.PI,x=w(v,m),_=w(m,b),S=k=>Ms(Ba(cg(k,!1)),t),M=S(m);return[{p:Fo(x?Lt(g,S(v)):Lt(g,M)),concave:x&&g},{p:Fo(_?Lt(o,S(b)):Lt(o,M)),concave:_&&o}]}),n=[t,t,0,0,0],i=e.findIndex((o,l)=>!e[(l-1+e.length)%e.length][0].concave&&!e[(l-1+e.length)%e.length][1].concave&&!o[0].concave&&!o[0].concave&&!o[1].concave),a=e.slice(i).concat(e.slice(0,i));let s=[];return a.flatMap((o,l)=>{const u=[],c=a[e.length-1];return l===0&&u.push(["M",...c[1].p]),o[0].concave?s.push(o[0].p,o[1].p):u.push(["A",...n,...o[0].p]),o[1].concave?s.unshift(o[1].p):u.push(["L",...o[1].p]),s.length===3&&(u.pop(),u.push(["C",...s.flat()]),s=[]),u})},Aht=(r,t)=>{const e=Xx(r).map((n,i)=>{const a=r[(i+1)%r.length];return{p:n,v:Ba(be(a,n))}});return e.forEach((n,i)=>{const a=i>0?i-1:r.length-1,s=e[a].v,o=Ba(Lt(s,Ms(n.v,Ux(s,n.v,!0)<Math.PI?1:-1)));n.p=Lt(n.p,Ms(o,t))}),MI(e.map(n=>n.p))},Pht=(r,t)=>{const n=r.map((a,s)=>{const o=r[s===0?r.length-1:s-1],l=gc(Ms(Ba(cg(be(o,a),!1)),t));return[Lt(o,l),Lt(a,l)]}).flat();return n.map((a,s)=>{if(s%2===0)return null;const o=[n[(s-1)%n.length],n[s%n.length]],l=[n[(s+1)%n.length],n[(s+2)%n.length]];return Yx(o,l,!0)}).filter(Boolean).map((a,s)=>[s===0?"M":"L",a[0],a[1]]).concat([["Z"]])};var Nht=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class y0 extends Wn{constructor(t,e){super(t,Object.assign({},y0.defaultOptions,e)),this.hullMemberIds=[],this.drawHull=()=>{if(!this.shape)this.shape=new Bc({style:this.getHullStyle()}),this.context.canvas.appendChild(this.shape);else{const n=!Ue(this.optionsCache,this.options);this.shape.update(this.getHullStyle(n))}this.optionsCache=Object.assign({},this.options)},this.updateHullPath=n=>{this.shape&&this.options.members.includes(H(n.data))&&this.shape.update({d:this.getHullPath(!0)})},this.getHullPath=(n=!1)=>{const{graph:i}=this.context,a=this.getMember();if(a.length===0)return"";const s=a.map(u=>i.getNodeData(u)),o=kht(s.map(sn),this.options.concavity).slice(1).reverse(),l=o.flatMap(u=>s.filter(c=>Ue(sn(c),u)).map(H));return Ue(l,this.hullMemberIds)&&!n?this.path:(this.hullMemberIds=l,this.path=Tht(o,this.getPadding(),this.options.corner),this.path)},this.bindEvents()}bindEvents(){this.context.graph.on(ut.AFTER_RENDER,this.drawHull),this.context.graph.on(ut.AFTER_ELEMENT_UPDATE,this.updateHullPath)}getHullStyle(t){const e=this.options,{members:n,padding:i,corner:a}=e,s=Nht(e,["members","padding","corner"]);return Object.assign(Object.assign({},s),{d:this.getHullPath(t)})}getPadding(){const{graph:t}=this.context;return this.hullMemberIds.reduce((n,i)=>{const{halfExtents:a}=t.getElementRenderBounds(i),s=Math.max(a[0],a[1]);return Math.max(n,s)},0)+this.options.padding}addMember(t){const e=Array.isArray(t)?t:[t];this.options.members=[...new Set([...this.options.members,...e])],this.shape.update({d:this.getHullPath()})}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter(n=>!e.includes(n)),e.some(n=>this.hullMemberIds.includes(n))&&this.shape.update({d:this.getHullPath()})}updateMember(t){this.options.members=Et(t)?t(this.options.members):t,this.shape.update(this.getHullStyle(!0))}getMember(){return this.options.members}destroy(){this.context.graph.off(ut.AFTER_DRAW,this.drawHull),this.shape.destroy(),this.hullMemberIds=[],super.destroy()}}y0.defaultOptions={members:[],padding:10,corner:"rounded",concavity:1/0,fill:"lightblue",fillOpacity:.2,labelOpacity:1,stroke:"blue",strokeOpacity:.2};function M4(r,t){t(r),r.children&&r.children.forEach(function(e){e&&M4(e,t)})}function Xc(r){b0(r,!0)}function Ri(r){b0(r,!1)}function b0(r,t){var e=t?"visible":"hidden";M4(r,function(n){n.attr("visibility",e)})}var Rht=function(r){Ht(t,r);function t(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=r.apply(this,vt([],z(e),!1))||this;return i.isMutationObserved=!0,i.addEventListener(Xt.INSERTED,function(){Ri(i)}),i}return t}(_n);function k4(r){var t=r.appendChild(new Rht({class:"offscreen"}));return Ri(t),t}function Lht(r){for(var t=r;t;){if(t.className==="offscreen")return!0;t=t.parent}return!1}var FE=function(r){Ht(t,r);function t(e){e===void 0&&(e={});var n=e.style,i=Je(e,["style"]);return r.call(this,et({style:et({text:"",fill:"black",fontFamily:"sans-serif",fontSize:16,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",lineWidth:1,textAlign:"start",textBaseline:"middle"},n)},i))||this}return Object.defineProperty(t.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=k4(this)),this._offscreen},enumerable:!1,configurable:!0}),t.prototype.disconnectedCallback=function(){var e;(e=this._offscreen)===null||e===void 0||e.destroy()},t}(Hs);function Ul(r){return r*Math.PI/180}function T4(r){return Number((r*180/Math.PI).toPrecision(5))}var ur=function(){function r(t,e,n,i){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0),i===void 0&&(i=0),this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=n,this.height=i}return Object.defineProperty(r.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),r.fromRect=function(t){return new r(t.x,t.y,t.width,t.height)},r.prototype.toJSON=function(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.top,right:this.right,bottom:this.bottom,left:this.left}},r.prototype.isPointIn=function(t,e){return t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom},r}();function gi(r,t){return Et(r)?r.apply(void 0,vt([],z(t),!1)):r}var zi=function(r,t){var e=function(i){return"".concat(t,"-").concat(i)},n=Object.fromEntries(Object.entries(r).map(function(i){var a=z(i,2),s=a[0],o=a[1],l=e(o);return[s,{name:l,class:".".concat(l),id:"#".concat(l),toString:function(){return l}}]}));return Object.assign(n,{prefix:e}),n},Iht=5,O4=function(r,t,e,n){e===void 0&&(e=0),n===void 0&&(n=Iht),Object.entries(t).forEach(function(i){var a=z(i,2),s=a[0],o=a[1],l=r;Object.prototype.hasOwnProperty.call(t,s)&&(o?ql(o)?(ql(r[s])||(l[s]={}),e<n?O4(r[s],o,e+1,n):l[s]=t[s]):Xr(o)?(l[s]=[],l[s]=l[s].concat(o)):l[s]=o:l[s]=o)})},Pn=function(r){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];for(var n=0;n<t.length;n+=1)O4(r,t[n]);return r},C4=function(r){return r!==void 0&&r!=null&&!Number.isNaN(r)},qd,Dht=uw(function(r,t){var e=t.fontSize,n=t.fontFamily,i=t.fontWeight,a=t.fontStyle,s=t.fontVariant;return qd||(qd=st.offscreenCanvasCreator.getOrCreateContext(void 0)),qd.font=[a,s,i,"".concat(e,"px"),n].join(" "),qd.measureText(r).width},function(r,t){return[r,Object.values(t||A4(r)).join()].join("")},4096),A4=function(r){var t=r.style.fontFamily||"sans-serif",e=r.style.fontWeight||"normal",n=r.style.fontStyle||"normal",i=r.style.fontVariant,a=r.style.fontSize;return a=typeof a=="object"?a.value:a,{fontSize:a,fontFamily:t,fontWeight:e,fontStyle:n,fontVariant:i}};function P4(r){return r.nodeName==="text"?r:r.nodeName==="g"&&r.children.length===1&&r.children[0].nodeName==="text"?r.children[0]:null}function N4(r,t){var e=P4(r);e&&e.attr(t)}function ux(r,t,e){e===void 0&&(e="..."),N4(r,{wordWrap:!0,wordWrapWidth:t,maxLines:1,textOverflow:e})}function Fht(r,t,e,n){e===void 0&&(e=2),n===void 0&&(n="top"),N4(r,{wordWrap:!0,wordWrapWidth:t,maxLines:e,textBaseline:n})}function cN(r){var t=r.canvas,e=r.touches,n=r.offsetX,i=r.offsetY;if(t){var a=t.x,s=t.y;return[a,s]}if(e){var o=e[0],l=o.clientX,u=o.clientY;return[l,u]}return n&&i?[n,i]:[0,0]}function Ga(r){return typeof r=="function"?r():oe(r)||yt(r)?new FE({style:{text:String(r)}}):r}function Bht(r,t){return r.reduce(function(e,n){return(e[n[t]]=e[n[t]]||[]).push(n),e},{})}function Ur(r,t,e,n,i){return n===void 0&&(n=!0),i===void 0&&(i=function(a){a.node().removeChildren()}),r?e(t):(n&&i(t),null)}function Fn(r,t,e,n,i){return n===void 0&&(n=!0),i===void 0&&(i=!1),n&&r===t||i&&r===e?!0:r>t&&r<e}var zht=function(r,t){return function(e){return r*(1-e)+t*e}};function $ht(r,t){var e=t?t.length:0,n=r?Math.min(e,r.length):0;return function(i){var a=new Array(n),s=new Array(e),o=0;for(o=0;o<n;++o)a[o]=BE(r[o],t[o]);for(;o<e;++o)s[o]=t[o];for(o=0;o<n;++o)s[o]=a[o](i);return s}}function jht(r,t){r===void 0&&(r={}),t===void 0&&(t={});var e={},n={};return Object.entries(t).forEach(function(i){var a=z(i,2),s=a[0],o=a[1];s in r?e[s]=BE(r[s],o):n[s]=o}),function(i){return Object.entries(e).forEach(function(a){var s=z(a,2),o=s[0],l=s[1];return n[o]=l(i)}),n}}function BE(r,t){return typeof r=="number"&&typeof t=="number"?zht(r,t):Array.isArray(r)&&Array.isArray(t)?$ht(r,t):typeof r=="object"&&typeof t=="object"?jht(r,t):function(e){return r}}function qht(r,t,e,n){if(!n)return r.attr("__keyframe_data__",e),null;var i=n.duration,a=i===void 0?0:i,s=BE(t,e),o=Math.ceil(+a/16),l=new Array(o).fill(0).map(function(u,c,h){return{__keyframe_data__:s(c/(h.length-1))}});return r.animate(l,et({fill:"both"},n))}function Aa(r,t){return[r[0]*t,r[1]*t]}function Yu(r,t){return[r[0]+t[0],r[1]+t[1]]}function Hb(r,t){return[r[0]-t[0],r[1]-t[1]]}function ho(r,t){return[Math.min(r[0],t[0]),Math.min(r[1],t[1])]}function fo(r,t){return[Math.max(r[0],t[0]),Math.max(r[1],t[1])]}function xc(r,t){return Math.sqrt(Math.pow(r[0]-t[0],2)+Math.pow(r[1]-t[1],2))}function R4(r){if(r[0]===0&&r[1]===0)return[0,0];var t=Math.sqrt(Math.pow(r[0],2)+Math.pow(r[1],2));return[r[0]/t,r[1]/t]}function Wht(r,t){return t?[r[1],-r[0]]:[-r[1],r[0]]}function hN(r,t){return+r.toPrecision(t)}function dN(r,t){var e={},n=Array.isArray(t)?t:[t];for(var i in r)n.includes(i)||(e[i]=r[i]);return e}function Ght(r,t,e,n){var i,a=[],s=!!n,o,l,u=[1/0,1/0],c=[-1/0,-1/0],h,d,g;if(s){i=z(n,2),u=i[0],c=i[1];for(var p=0,v=r.length;p<v;p+=1){var m=r[p];u=ho(u,m),c=fo(c,m)}}for(var p=0,b=r.length;p<b;p+=1){var m=r[p];if(p===0)g=m;else if(p===b-1)d=m,a.push(g),a.push(d);else{var w=[p?p-1:b-1,p-1][1];o=r[w],l=r[p+1];var x=[0,0];x=Hb(l,o),x=Aa(x,t);var _=xc(m,o),S=xc(m,l),M=_+S;M!==0&&(_/=M,S/=M);var k=Aa(x,-_),T=Aa(x,S);d=Yu(m,k),h=Yu(m,T),h=ho(h,fo(l,m)),h=fo(h,ho(l,m)),k=Hb(h,m),k=Aa(k,-_/S),d=Yu(m,k),d=ho(d,fo(o,m)),d=fo(d,ho(o,m)),T=Hb(m,d),T=Aa(T,S/_),h=Yu(m,T),s&&(d=fo(d,u),d=ho(d,c),h=fo(h,u),h=ho(h,c)),a.push(g),a.push(d),g=h}}return a}function Vht(r,t,e){e===void 0&&(e=[[0,0],[1,1]]);for(var n=!1,i=[],a=0,s=r.length;a<s;a+=2)i.push([r[a],r[a+1]]);for(var o=Ght(i,.4,n,e),l=i.length,u=[],c,h,d,a=0;a<l-1;a+=1)c=o[a*2],h=o[a*2+1],d=i[a+1],u.push(["C",c[0],c[1],h[0],h[1],d[0],d[1]]);return u}var Hht=["$el","cx","cy","d","dx","dy","fill","fillOpacity","filter","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","height","img","increasedLineWidthForHitTesting","innerHTML","isBillboard","billboardRotation","isSizeAttenuation","isClosed","isOverflowing","leading","letterSpacing","lineDash","lineHeight","lineWidth","markerEnd","markerEndOffset","markerMid","markerStart","markerStartOffset","maxLines","metrics","miterLimit","offsetX","offsetY","opacity","path","points","r","radius","rx","ry","shadowColor","src","stroke","strokeOpacity","text","textAlign","textBaseline","textDecorationColor","textDecorationLine","textDecorationStyle","textOverflow","textPath","textPathSide","textPathStartOffset","transform","transformOrigin","visibility","width","wordWrap","wordWrapWidth","x","x1","x2","y","y1","y2","z1","z2","zIndex"];function Uht(r){return Hht.includes(r)}function fN(r){var t={};for(var e in r)Uht(e)&&(t[e]=r[e]);return t}function Yht(r,t){if(r.length<=t)return r;for(var e=Math.floor(r.length/t),n=[],i=0;i<r.length;i+=e)n.push(r[i]);return n}function zE(r,t,e){var n=r.getBBox(),i=n.width,a=n.height,s=t/Math.max(i,a);return r.style.transform="scale(".concat(s,")"),s}function Xht(r,t){var e=new Map;return r.forEach(function(n){var i=t(n);e.has(i)||e.set(i,[]),e.get(i).push(n)}),e}function Kht(r){throw new Error(r)}var Zht=function(){function r(i,a,s,o,l,u,c){i===void 0&&(i=null),a===void 0&&(a=null),s===void 0&&(s=null),o===void 0&&(o=null),l===void 0&&(l=[null,null,null,null,null]),u===void 0&&(u=[]),c===void 0&&(c=[]),t.add(this),this._elements=Array.from(i),this._data=a,this._parent=s,this._document=o,this._enter=l[0],this._update=l[1],this._exit=l[2],this._merge=l[3],this._split=l[4],this._transitions=u,this._facetElements=c}r.prototype.selectAll=function(i){var a=typeof i=="string"?this._parent.querySelectorAll(i):i;return new e(a,null,this._elements[0],this._document)},r.prototype.selectFacetAll=function(i){var a=typeof i=="string"?this._parent.querySelectorAll(i):i;return new e(this._elements,null,this._parent,this._document,void 0,void 0,a)},r.prototype.select=function(i){var a=typeof i=="string"?this._parent.querySelectorAll(i)[0]||null:i;return new e([a],null,a,this._document)},r.prototype.append=function(i){var a=this,s=typeof i=="function"?i:function(){return a.createElement(i)},o=[];if(this._data!==null){for(var l=0;l<this._data.length;l++){var u=this._data[l],c=z(Array.isArray(u)?u:[u,null],2),h=c[0],d=c[1],g=s(h,l);g.__data__=h,d!==null&&(g.__fromElements__=d),this._parent.appendChild(g),o.push(g)}return new e(o,null,this._parent,this._document)}for(var l=0;l<this._elements.length;l++){var p=this._elements[l],h=p.__data__,g=s(h,l);p.appendChild(g),o.push(g)}return new e(o,null,o[0],this._document)},r.prototype.maybeAppend=function(i,a){var s=gv(this,t,"m",n).call(this,i[0]==="#"?i:"#".concat(i),a);return s.attr("id",i),s},r.prototype.maybeAppendByClassName=function(i,a){var s=i.toString(),o=gv(this,t,"m",n).call(this,s[0]==="."?s:".".concat(s),a);return o.attr("className",s),o},r.prototype.maybeAppendByName=function(i,a){var s=gv(this,t,"m",n).call(this,'[name="'.concat(i,'"]'),a);return s.attr("name",i),s},r.prototype.data=function(i,a,s){var o,l;a===void 0&&(a=function(O){return O}),s===void 0&&(s=function(){return null});for(var u=[],c=[],h=new Set(this._elements),d=[],g=new Set,p=new Map(this._elements.map(function(O,A){return[a(O.__data__,A),O]})),v=new Map(this._facetElements.map(function(O,A){return[a(O.__data__,A),O]})),m=Xht(this._elements,function(O){return s(O.__data__)}),b=0;b<i.length;b++){var w=i[b],x=a(w,b),_=s(w,b);if(p.has(x)){var S=p.get(x);S.__data__=w,S.__facet__=!1,c.push(S),h.delete(S),p.delete(x)}else if(v.has(x)){var S=v.get(x);S.__data__=w,S.__facet__=!0,c.push(S),v.delete(x)}else if(m.has(x)){var M=m.get(x);d.push([w,M]);try{for(var k=(o=void 0,Cc(M)),T=k.next();!T.done;T=k.next()){var S=T.value;h.delete(S)}}catch(O){o={error:O}}finally{try{T&&!T.done&&(l=k.return)&&l.call(k)}finally{if(o)throw o.error}}m.delete(x)}else if(p.has(_)){var S=p.get(_);S.__toData__?S.__toData__.push(w):S.__toData__=[w],g.add(S),h.delete(S)}else u.push(w)}var P=[new e([],u,this._parent,this._document),new e(c,null,this._parent,this._document),new e(h,null,this._parent,this._document),new e([],d,this._parent,this._document),new e(g,null,this._parent,this._document)];return new e(this._elements,null,this._parent,this._document,P)},r.prototype.merge=function(i){var a=vt(vt([],z(this._elements),!1),z(i._elements),!1),s=vt(vt([],z(this._transitions),!1),z(i._transitions),!1);return new e(a,null,this._parent,this._document,void 0,s)},r.prototype.createElement=function(i){if(this._document)return this._document.createElement(i,{});var a=e.registry[i];return a?new a:Kht("Unknown node type: ".concat(i))},r.prototype.join=function(i,a,s,o,l){i===void 0&&(i=function(p){return p}),a===void 0&&(a=function(p){return p}),s===void 0&&(s=function(p){return p.remove()}),o===void 0&&(o=function(p){return p}),l===void 0&&(l=function(p){return p.remove()});var u=i(this._enter),c=a(this._update),h=s(this._exit),d=o(this._merge),g=l(this._split);return c.merge(u).merge(h).merge(d).merge(g)},r.prototype.remove=function(){for(var i=function(o){var l=a._elements[o],u=a._transitions[o];u?u.then(function(){return l.remove()}):l.remove()},a=this,s=0;s<this._elements.length;s++)i(s);return new e([],null,this._parent,this._document,void 0,this._transitions)},r.prototype.each=function(i){for(var a=0;a<this._elements.length;a++){var s=this._elements[a],o=s.__data__;i.call(s,o,a)}return this},r.prototype.attr=function(i,a){var s=typeof a!="function"?function(){return a}:a;return this.each(function(o,l){a!==void 0&&(this[i]=s.call(this,o,l))})},r.prototype.style=function(i,a,s){s===void 0&&(s=!0);var o=typeof a!="function"||!s?function(){return a}:a;return this.each(function(l,u){a!==void 0&&(this.style[i]=o.call(this,l,u))})},r.prototype.styles=function(i,a){return i===void 0&&(i={}),a===void 0&&(a=!0),this.each(function(s,o){var l=this;Object.entries(i).forEach(function(u){var c=z(u,2),h=c[0],d=c[1],g=typeof d!="function"||!a?function(){return d}:d;d!==void 0&&l.attr(h,g.call(l,s,o))})})},r.prototype.update=function(i,a){a===void 0&&(a=!0);var s=typeof i!="function"||!a?function(){return i}:i;return this.each(function(o,l){i&&this.update&&this.update(s.call(this,o,l))})},r.prototype.maybeUpdate=function(i,a){a===void 0&&(a=!0);var s=typeof i!="function"||!a?function(){return i}:i;return this.each(function(o,l){i&&this.update&&this.update(s.call(this,o,l))})},r.prototype.transition=function(i){var a=this._transitions;return this.each(function(s,o){a[o]=i.call(this,s,o)})},r.prototype.on=function(i,a){return this.each(function(){this.addEventListener(i,a)}),this},r.prototype.call=function(i){for(var a=[],s=1;s<arguments.length;s++)a[s-1]=arguments[s];return i.call.apply(i,vt([this._parent,this],z(a),!1)),this},r.prototype.node=function(){return this._elements[0]},r.prototype.nodes=function(){return this._elements},r.prototype.transitions=function(){return this._transitions.filter(function(i){return!!i})},r.prototype.parent=function(){return this._parent};var t,e,n;return e=r,t=new WeakSet,n=function(a,s){var o=this._elements[0],l=o.querySelector(a);if(l)return new e([l],null,this._parent,this._document);var u=typeof s=="string"?this.createElement(s):s();return o.appendChild(u),new e([u],null,this._parent,this._document)},r.registry={g:_n,rect:Sn,circle:Ha,path:qr,text:FE,ellipse:Nc,image:Lc,line:Io,polygon:Go,polyline:og,html:Rc},r}();function _t(r){return new Zht([r],null,r,r.ownerDocument)}function Jht(r,t,e){return r.querySelector(t)?_t(r).select(t):_t(r).append(e)}function jn(r){if(yt(r))return[r,r,r,r];if(Xr(r)){var t=r.length;if(t===1)return[r[0],r[0],r[0],r[0]];if(t===2)return[r[0],r[1],r[0],r[1]];if(t===3)return[r[0],r[1],r[2],r[1]];if(t===4)return r}return[0,0,0,0]}function gN(r){var t=r.getLocalBounds(),e=t.min,n=t.max,i=z([e,n],2),a=z(i[0],2),s=a[0],o=a[1],l=z(i[1],2),u=l[0],c=l[1];return{x:s,y:o,width:u-s,height:c-o,left:s,bottom:c,top:o,right:u}}function Qht(r,t){var e=z(r,2),n=e[0],i=e[1],a=z(t,2),s=a[0],o=a[1];return n!==s&&i===o}function tdt(r,t){var e,n,i=t.attributes;try{for(var a=Cc(Object.entries(i)),s=a.next();!s.done;s=a.next()){var o=z(s.value,2),l=o[0],u=o[1];l!=="id"&&l!=="className"&&r.attr(l,u)}}catch(c){e={error:c}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}}function $E(r){return r.toString().charAt(0).toUpperCase()+r.toString().slice(1)}function edt(r){return r.toString().charAt(0).toLowerCase()+r.toString().slice(1)}function ndt(r,t){return"".concat(t).concat($E(r))}function pN(r,t,e){var n;e===void 0&&(e=!0);var i=t||((n=r.match(/^([a-z][a-z0-9]+)/))===null||n===void 0?void 0:n[0])||"",a=r.replace(new RegExp("^(".concat(i,")")),"");return e?edt(a):a}function rdt(r,t){Object.entries(t).forEach(function(e){var n=z(e,2),i=n[0],a=n[1];vt([r],z(r.querySelectorAll(i)),!1).filter(function(s){return s.matches(i)}).forEach(function(s){if(s){var o=s;o.style.cssText+=Object.entries(a).reduce(function(l,u){return"".concat(l).concat(u.join(":"),";")},"")}})})}var Wd=function(r,t){if(!(r!=null&&r.startsWith(t)))return!1;var e=r[t.length];return e>="A"&&e<="Z"};function Nt(r,t,e){e===void 0&&(e=!1);var n={};return Object.entries(r).forEach(function(i){var a=z(i,2),s=a[0],o=a[1];if(!(s==="className"||s==="class")){if(Wd(s,"show")&&Wd(pN(s,"show"),t)!==e)s===ndt(t,"show")?n[s]=o:n[s.replace(new RegExp($E(t)),"")]=o;else if(!Wd(s,"show")&&Wd(s,t)!==e){var l=pN(s,t);l==="filter"&&typeof o=="function"||(n[l]=o)}}}),n}function Cl(r,t){return Object.entries(r).reduce(function(e,n){var i=z(n,2),a=i[0],s=i[1];return a.startsWith("show")?e["show".concat(t).concat(a.slice(4))]=s:e["".concat(t).concat($E(a))]=s,e},{})}function Va(r,t){t===void 0&&(t=["x","y","class","className"]);var e=["transform","transformOrigin","anchor","visibility","pointerEvents","zIndex","cursor","clipPath","clipPathTargets","offsetPath","offsetPathTargets","offsetDistance","draggable","droppable"],n={},i={};return Object.entries(r).forEach(function(a){var s=z(a,2),o=s[0],l=s[1];t.includes(o)||(e.indexOf(o)!==-1?i[o]=l:n[o]=l)}),[n,i]}function yr(r,t){var e={YYYY:r.getFullYear(),MM:r.getMonth()+1,DD:r.getDate(),HH:r.getHours(),mm:r.getMinutes(),ss:r.getSeconds()},n=t;return Object.keys(e).forEach(function(i){var a=e[i];n=n.replace(i,i==="YYYY"?"".concat(a):"".concat(a).padStart(2,"0"))}),n}function idt(r,t,e){var n=r.getBBox(),i=n.width,a=n.height,s=z([t,e].map(function(u,c){var h;return u.includes("%")?parseFloat(((h=u.match(/[+-]?([0-9]*[.])?[0-9]+/))===null||h===void 0?void 0:h[0])||"0")/100*(c===0?i:a):u}),2),o=s[0],l=s[1];return[o,l]}function L4(r,t){if(t)try{var e=/translate\(([+-]*[\d]+[%]*),[ ]*([+-]*[\d]+[%]*)\)/g,n=t.replace(e,function(i,a,s){return"translate(".concat(idt(r,a,s),")")});r.attr("transform",n)}catch{}}function adt(r){var t;return((t=r[0])===null||t===void 0?void 0:t.map(function(e,n){return r.map(function(i){return i[n]})}))||[]}var vN=function(r,t){if(t==null){r.innerHTML="";return}r.replaceChildren?Array.isArray(t)?r.replaceChildren.apply(r,vt([],z(t),!1)):r.replaceChildren(t):(r.innerHTML="",Array.isArray(t)?t.forEach(function(e){return r.appendChild(e)}):r.appendChild(t))};function sdt(){b0(this,this.attributes.visibility!=="hidden")}var Qe=function(r){Ht(t,r);function t(e,n){n===void 0&&(n={});var i=r.call(this,Pn({},{style:n},e))||this;return i.initialized=!1,i._defaultOptions=n,i}return Object.defineProperty(t.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=k4(this)),this._offscreen},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"defaultOptions",{get:function(){return this._defaultOptions},enumerable:!1,configurable:!0}),t.prototype.connectedCallback=function(){this.render(this.attributes,this),this.bindEvents(this.attributes,this),this.initialized=!0},t.prototype.disconnectedCallback=function(){var e;(e=this._offscreen)===null||e===void 0||e.destroy()},t.prototype.attributeChangedCallback=function(e){e==="visibility"&&sdt.call(this)},t.prototype.update=function(e,n){var i;return this.attr(Pn({},this.attributes,e||{})),(i=this.render)===null||i===void 0?void 0:i.call(this,this.attributes,this,n)},t.prototype.clear=function(){this.removeChildren()},t.prototype.bindEvents=function(e,n){},t.prototype.getSubShapeStyle=function(e){e.x,e.y,e.transform,e.transformOrigin,e.class,e.className,e.zIndex;var n=Je(e,["x","y","transform","transformOrigin","class","className","zIndex"]);return n},t}(Bx),I4=function(r,t,e){return[["M",r-e,t],["A",e,e,0,1,0,r+e,t],["A",e,e,0,1,0,r-e,t],["Z"]]},odt=I4,ldt=function(r,t,e){return[["M",r-e,t-e],["L",r+e,t-e],["L",r+e,t+e],["L",r-e,t+e],["Z"]]},udt=function(r,t,e){return[["M",r-e,t],["L",r,t-e],["L",r+e,t],["L",r,t+e],["Z"]]},cdt=function(r,t,e){var n=e*Math.sin(.3333333333333333*Math.PI);return[["M",r-e,t+n],["L",r,t-n],["L",r+e,t+n],["Z"]]},hdt=function(r,t,e){var n=e*Math.sin(.3333333333333333*Math.PI);return[["M",r-e,t-n],["L",r+e,t-n],["L",r,t+n],["Z"]]},ddt=function(r,t,e){var n=e/2*Math.sqrt(3);return[["M",r,t-e],["L",r+n,t-e/2],["L",r+n,t+e/2],["L",r,t+e],["L",r-n,t+e/2],["L",r-n,t-e/2],["Z"]]},fdt=function(r,t,e){var n=e-1.5;return[["M",r-e,t-n],["L",r+e,t+n],["L",r+e,t-n],["L",r-e,t+n],["Z"]]},D4=function(r,t,e){return[["M",r,t+e],["L",r,t-e]]},gdt=function(r,t,e){return[["M",r-e,t-e],["L",r+e,t+e],["M",r+e,t-e],["L",r-e,t+e]]},pdt=function(r,t,e){return[["M",r-e/2,t-e],["L",r+e/2,t-e],["M",r,t-e],["L",r,t+e],["M",r-e/2,t+e],["L",r+e/2,t+e]]},vdt=function(r,t,e){return[["M",r-e,t],["L",r+e,t],["M",r,t-e],["L",r,t+e]]},mdt=function(r,t,e){return[["M",r-e,t],["L",r+e,t]]},F4=function(r,t,e){return[["M",r-e,t],["L",r+e,t]]},ydt=F4,bdt=function(r,t,e){return[["M",r-e,t],["A",e/2,e/2,0,1,1,r,t],["A",e/2,e/2,0,1,0,r+e,t]]},wdt=function(r,t,e){return[["M",r-e-1,t-2.5],["L",r,t-2.5],["L",r,t+2.5],["L",r+e+1,t+2.5]]},xdt=function(r,t,e){return[["M",r-e-1,t+2.5],["L",r,t+2.5],["L",r,t-2.5],["L",r+e+1,t-2.5]]},Edt=function(r,t,e){return[["M",r-(e+1),t+2.5],["L",r-e/2,t+2.5],["L",r-e/2,t-2.5],["L",r+e/2,t-2.5],["L",r+e/2,t+2.5],["L",r+e+1,t+2.5]]};function _dt(r,t){return[["M",r-5,t+2.5],["L",r-5,t],["L",r,t],["L",r,t-3],["L",r,t+3],["L",r+6.5,t+3]]}var Sdt=function(r,t,e){return[["M",r-e,t-e],["L",r+e,t],["L",r-e,t+e],["Z"]]};function Mdt(r){var t="default";if(an(r)&&r instanceof Image)t="image";else if(Et(r))t="symbol";else if(oe(r)){var e=new RegExp("data:(image|text)");r.match(e)?t="base64":/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(r)?t="url":t="symbol"}return t}function kdt(r){var t=Mdt(r);return["base64","url","image"].includes(t)?"image":r&&t==="symbol"?"path":null}var xe=function(r){Ht(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s,l=this.getSubShapeStyle(e),u=l.symbol,c=l.size,h=c===void 0?16:c,d=Je(l,["symbol","size"]),g=kdt(u);Ur(!!g,_t(n),function(p){p.maybeAppendByClassName("marker",g).attr("className","marker ".concat(g,"-marker")).call(function(v){if(g==="image"){var m=h*2;v.styles({img:u,width:m,height:m,x:a-h,y:o-h})}else{var m=h/2,b=Et(u)?u:t.getSymbol(u);v.styles(et({d:b==null?void 0:b(a,o,m)},d))}})})},t.MARKER_SYMBOL_MAP=new Map,t.registerSymbol=function(e,n){t.MARKER_SYMBOL_MAP.set(e,n)},t.getSymbol=function(e){return t.MARKER_SYMBOL_MAP.get(e)},t.getSymbols=function(){return Array.from(t.MARKER_SYMBOL_MAP.keys())},t}(Qe);xe.registerSymbol("cross",gdt);xe.registerSymbol("hyphen",mdt);xe.registerSymbol("line",D4);xe.registerSymbol("plus",vdt);xe.registerSymbol("tick",pdt);xe.registerSymbol("circle",I4);xe.registerSymbol("point",odt);xe.registerSymbol("bowtie",fdt);xe.registerSymbol("hexagon",ddt);xe.registerSymbol("square",ldt);xe.registerSymbol("diamond",udt);xe.registerSymbol("triangle",cdt);xe.registerSymbol("triangle-down",hdt);xe.registerSymbol("line",D4);xe.registerSymbol("dot",F4);xe.registerSymbol("dash",ydt);xe.registerSymbol("smooth",bdt);xe.registerSymbol("hv",wdt);xe.registerSymbol("vh",xdt);xe.registerSymbol("hvh",Edt);xe.registerSymbol("vhv",_dt);function Xf(r,...t){return t.reduce((e,n)=>i=>e(n(i)),r)}function cx(r,t){return t-r?e=>(e-r)/(t-r):e=>.5}function Tdt(r,t){const e=t<r?t:r,n=r>t?r:t;return i=>Math.min(Math.max(e,i),n)}function Odt(r,t,e,n,i){let a=e,s=n||r.length;const o=l=>l;for(;a<s;){const l=Math.floor((a+s)/2);o(r[l])>t?s=l:a=l+1}return a}const mN=Math.sqrt(50),yN=Math.sqrt(10),bN=Math.sqrt(2);function of(r,t,e){const n=(t-r)/Math.max(0,e),i=Math.floor(Math.log(n)/Math.LN10),a=n/10**i;return i>=0?(a>=mN?10:a>=yN?5:a>=bN?2:1)*10**i:-(10**-i)/(a>=mN?10:a>=yN?5:a>=bN?2:1)}const Cdt=(r,t,e=5)=>{const n=[r,t];let i=0,a=n.length-1,s=n[i],o=n[a],l;return o<s&&([s,o]=[o,s],[i,a]=[a,i]),l=of(s,o,e),l>0?(s=Math.floor(s/l)*l,o=Math.ceil(o/l)*l,l=of(s,o,e)):l<0&&(s=Math.ceil(s*l)/l,o=Math.floor(o*l)/l,l=of(s,o,e)),l>0?(n[i]=Math.floor(s/l)*l,n[a]=Math.ceil(o/l)*l):l<0&&(n[i]=Math.ceil(s*l)/l,n[a]=Math.floor(o*l)/l),n};function wN(r){return!Pt(r)&&!CW(r)&&!Number.isNaN(r)}var B4={exports:{}},Adt={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},z4={exports:{}},Pdt=function(t){return!t||typeof t=="string"?!1:t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&t.constructor.name!=="String")},Ndt=Pdt,Rdt=Array.prototype.concat,Ldt=Array.prototype.slice,xN=z4.exports=function(t){for(var e=[],n=0,i=t.length;n<i;n++){var a=t[n];Ndt(a)?e=Rdt.call(e,Ldt.call(a)):e.push(a)}return e};xN.wrap=function(r){return function(){return r(xN(arguments))}};var Idt=z4.exports,ic=Adt,Kc=Idt,$4=Object.hasOwnProperty,j4=Object.create(null);for(var Ub in ic)$4.call(ic,Ub)&&(j4[ic[Ub]]=Ub);var Gr=B4.exports={to:{},get:{}};Gr.get=function(r){var t=r.substring(0,3).toLowerCase(),e,n;switch(t){case"hsl":e=Gr.get.hsl(r),n="hsl";break;case"hwb":e=Gr.get.hwb(r),n="hwb";break;default:e=Gr.get.rgb(r),n="rgb";break}return e?{model:n,value:e}:null};Gr.get.rgb=function(r){if(!r)return null;var t=/^#([a-f0-9]{3,4})$/i,e=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,n=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,i=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,a=/^(\w+)$/,s=[0,0,0,1],o,l,u;if(o=r.match(e)){for(u=o[2],o=o[1],l=0;l<3;l++){var c=l*2;s[l]=parseInt(o.slice(c,c+2),16)}u&&(s[3]=parseInt(u,16)/255)}else if(o=r.match(t)){for(o=o[1],u=o[3],l=0;l<3;l++)s[l]=parseInt(o[l]+o[l],16);u&&(s[3]=parseInt(u+u,16)/255)}else if(o=r.match(n)){for(l=0;l<3;l++)s[l]=parseInt(o[l+1],0);o[4]&&(o[5]?s[3]=parseFloat(o[4])*.01:s[3]=parseFloat(o[4]))}else if(o=r.match(i)){for(l=0;l<3;l++)s[l]=Math.round(parseFloat(o[l+1])*2.55);o[4]&&(o[5]?s[3]=parseFloat(o[4])*.01:s[3]=parseFloat(o[4]))}else return(o=r.match(a))?o[1]==="transparent"?[0,0,0,0]:$4.call(ic,o[1])?(s=ic[o[1]],s[3]=1,s):null:null;for(l=0;l<3;l++)s[l]=Is(s[l],0,255);return s[3]=Is(s[3],0,1),s};Gr.get.hsl=function(r){if(!r)return null;var t=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,e=r.match(t);if(e){var n=parseFloat(e[4]),i=(parseFloat(e[1])%360+360)%360,a=Is(parseFloat(e[2]),0,100),s=Is(parseFloat(e[3]),0,100),o=Is(isNaN(n)?1:n,0,1);return[i,a,s,o]}return null};Gr.get.hwb=function(r){if(!r)return null;var t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,e=r.match(t);if(e){var n=parseFloat(e[4]),i=(parseFloat(e[1])%360+360)%360,a=Is(parseFloat(e[2]),0,100),s=Is(parseFloat(e[3]),0,100),o=Is(isNaN(n)?1:n,0,1);return[i,a,s,o]}return null};Gr.to.hex=function(){var r=Kc(arguments);return"#"+Gd(r[0])+Gd(r[1])+Gd(r[2])+(r[3]<1?Gd(Math.round(r[3]*255)):"")};Gr.to.rgb=function(){var r=Kc(arguments);return r.length<4||r[3]===1?"rgb("+Math.round(r[0])+", "+Math.round(r[1])+", "+Math.round(r[2])+")":"rgba("+Math.round(r[0])+", "+Math.round(r[1])+", "+Math.round(r[2])+", "+r[3]+")"};Gr.to.rgb.percent=function(){var r=Kc(arguments),t=Math.round(r[0]/255*100),e=Math.round(r[1]/255*100),n=Math.round(r[2]/255*100);return r.length<4||r[3]===1?"rgb("+t+"%, "+e+"%, "+n+"%)":"rgba("+t+"%, "+e+"%, "+n+"%, "+r[3]+")"};Gr.to.hsl=function(){var r=Kc(arguments);return r.length<4||r[3]===1?"hsl("+r[0]+", "+r[1]+"%, "+r[2]+"%)":"hsla("+r[0]+", "+r[1]+"%, "+r[2]+"%, "+r[3]+")"};Gr.to.hwb=function(){var r=Kc(arguments),t="";return r.length>=4&&r[3]!==1&&(t=", "+r[3]),"hwb("+r[0]+", "+r[1]+"%, "+r[2]+"%"+t+")"};Gr.to.keyword=function(r){return j4[r.slice(0,3)]};function Is(r,t,e){return Math.min(Math.max(t,r),e)}function Gd(r){var t=Math.round(r).toString(16).toUpperCase();return t.length<2?"0"+t:t}var Ddt=B4.exports;const Fdt=ng(Ddt);function Yb(r,t,e){let n=e;return n<0&&(n+=1),n>1&&(n-=1),n<1/6?r+(t-r)*6*n:n<1/2?t:n<2/3?r+(t-r)*(2/3-n)*6:r}function Bdt(r){const t=r[0]/360,e=r[1]/100,n=r[2]/100,i=r[3];if(e===0)return[n*255,n*255,n*255,i];const a=n<.5?n*(1+e):n+e-n*e,s=2*n-a,o=Yb(s,a,t+1/3),l=Yb(s,a,t),u=Yb(s,a,t-1/3);return[o*255,l*255,u*255,i]}function EN(r){const t=Fdt.get(r);if(!t)return null;const{model:e,value:n}=t;return e==="rgb"?n:e==="hsl"?Bdt(n):null}const Kf=(r,t)=>e=>r*(1-e)+t*e,zdt=(r,t)=>{const e=EN(r),n=EN(t);return e===null||n===null?e?()=>r:()=>t:i=>{const a=new Array(4);for(let c=0;c<4;c+=1){const h=e[c],d=n[c];a[c]=h*(1-i)+d*i}const[s,o,l,u]=a;return`rgba(${Math.round(s)}, ${Math.round(o)}, ${Math.round(l)}, ${u})`}},$dt=(r,t)=>typeof r=="number"&&typeof t=="number"?Kf(r,t):typeof r=="string"&&typeof t=="string"?zdt(r,t):()=>r,jdt=(r,t)=>{const e=Kf(r,t);return n=>Math.round(e(n))};function _N({map:r,initKey:t},e){const n=t(e);return r.has(n)?r.get(n):e}function qdt({map:r,initKey:t},e){const n=t(e);return r.has(n)?r.get(n):(r.set(n,e),e)}function Wdt({map:r,initKey:t},e){const n=t(e);return r.has(n)&&(e=r.get(n),r.delete(n)),e}function Gdt(r){return typeof r=="object"?r.valueOf():r}class SN extends Map{constructor(t){if(super(),this.map=new Map,this.initKey=Gdt,t!==null)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(_N({map:this.map,initKey:this.initKey},t))}has(t){return super.has(_N({map:this.map,initKey:this.initKey},t))}set(t,e){return super.set(qdt({map:this.map,initKey:this.initKey},t),e)}delete(t){return super.delete(Wdt({map:this.map,initKey:this.initKey},t))}}class q4{constructor(t){this.options=cr({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=cr({},this.options,t),this.rescale(t)}rescale(t){}}const jE=Symbol("defaultUnknown");function MN(r,t,e){for(let n=0;n<t.length;n+=1)r.has(t[n])||r.set(e(t[n]),n)}function kN(r){const{value:t,from:e,to:n,mapper:i,notFoundReturn:a}=r;let s=i.get(t);if(s===void 0){if(a!==jE)return a;s=e.push(t)-1,i.set(t,s)}return n[s%n.length]}function TN(r){return r instanceof Date?t=>`${t}`:typeof r=="object"?t=>JSON.stringify(t):t=>t}class qE extends q4{getDefaultOptions(){return{domain:[],range:[],unknown:jE}}constructor(t){super(t)}map(t){return this.domainIndexMap.size===0&&MN(this.domainIndexMap,this.getDomain(),this.domainKey),kN({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return this.rangeIndexMap.size===0&&MN(this.rangeIndexMap,this.getRange(),this.rangeKey),kN({value:this.rangeKey(t),mapper:this.rangeIndexMap,from:this.getRange(),to:this.getDomain(),notFoundReturn:this.options.unknown})}rescale(t){const[e]=this.options.domain,[n]=this.options.range;if(this.domainKey=TN(e),this.rangeKey=TN(n),!this.rangeIndexMap){this.rangeIndexMap=new Map,this.domainIndexMap=new Map;return}(!t||t.range)&&this.rangeIndexMap.clear(),(!t||t.domain||t.compare)&&(this.domainIndexMap.clear(),this.sortedDomain=void 0)}clone(){return new qE(this.options)}getRange(){return this.options.range}getDomain(){if(this.sortedDomain)return this.sortedDomain;const{domain:t,compare:e}=this.options;return this.sortedDomain=e?[...t].sort(e):t,this.sortedDomain}}function Vdt(r){const t=Math.min(...r);return r.map(e=>e/t)}function Hdt(r,t){const e=r.length,n=t-e;return n>0?[...r,...new Array(n).fill(1)]:n<0?r.slice(0,t):r}function Udt(r){return Math.round(r*1e12)/1e12}function Ydt(r){const{domain:t,range:e,paddingOuter:n,paddingInner:i,flex:a,round:s,align:o}=r,l=t.length,u=Hdt(a,l),[c,h]=e,d=h-c,g=2/l*n+1-1/l*i,p=d/g,v=p*i/l,m=p-l*v,b=Vdt(u),w=b.reduce((R,L)=>R+L),x=m/w,_=new SN(t.map((R,L)=>{const q=b[L]*x;return[R,s?Math.floor(q):q]})),S=new SN(t.map((R,L)=>{const j=b[L]*x+v;return[R,s?Math.floor(j):j]})),M=Array.from(S.values()).reduce((R,L)=>R+L),T=(d-(M-M/l*i))*o,P=c+T;let O=s?Math.round(P):P;const A=new Array(l);for(let R=0;R<l;R+=1){A[R]=Udt(O);const L=t[R];O+=S.get(L)}return{valueBandWidth:_,valueStep:S,adjustedRange:A}}function Xdt(r){var t;const{domain:e}=r,n=e.length;if(n===0)return{valueBandWidth:void 0,valueStep:void 0,adjustedRange:[]};if(!!(!((t=r.flex)===null||t===void 0)&&t.length))return Ydt(r);const{range:a,paddingOuter:s,paddingInner:o,round:l,align:u}=r;let c,h,d=a[0];const p=a[1]-d,v=s*2,m=n-o;c=p/Math.max(1,v+m),l&&(c=Math.floor(c)),d+=(p-c*(n-o))*u,h=c*(1-o),l&&(d=Math.round(d),h=Math.round(h));const b=new Array(n).fill(0).map((w,x)=>d+x*c);return{valueStep:c,valueBandWidth:h,adjustedRange:b}}class WE extends qE{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:jE,flex:[]}}constructor(t){super(t)}clone(){return new WE(this.options)}getStep(t){return this.valueStep===void 0?1:typeof this.valueStep=="number"?this.valueStep:t===void 0?Array.from(this.valueStep.values())[0]:this.valueStep.get(t)}getBandWidth(t){return this.valueBandWidth===void 0?1:typeof this.valueBandWidth=="number"?this.valueBandWidth:t===void 0?Array.from(this.valueBandWidth.values())[0]:this.valueBandWidth.get(t)}getRange(){return this.adjustedRange}getPaddingInner(){const{padding:t,paddingInner:e}=this.options;return t>0?t:e}getPaddingOuter(){const{padding:t,paddingOuter:e}=this.options;return t>0?t:e}rescale(){super.rescale();const{align:t,domain:e,range:n,round:i,flex:a}=this.options,{adjustedRange:s,valueBandWidth:o,valueStep:l}=Xdt({align:t,range:n,round:i,flex:a,paddingInner:this.getPaddingInner(),paddingOuter:this.getPaddingOuter(),domain:e});this.valueStep=l,this.valueBandWidth=o,this.adjustedRange=s}}const Kdt=(r,t,e)=>{let n,i,a=r,s=t;if(a===s&&e>0)return[a];let o=of(a,s,e);if(o===0||!Number.isFinite(o))return[];if(o>0){a=Math.ceil(a/o),s=Math.floor(s/o),i=new Array(n=Math.ceil(s-a+1));for(let l=0;l<n;l+=1)i[l]=(a+l)*o}else{o=-o,a=Math.ceil(a*o),s=Math.floor(s*o),i=new Array(n=Math.ceil(s-a+1));for(let l=0;l<n;l+=1)i[l]=(a+l)/o}return i},Zdt=(r,t,e)=>{const[n,i]=r,[a,s]=t;let o,l;return n<i?(o=cx(n,i),l=e(a,s)):(o=cx(i,n),l=e(s,a)),Xf(l,o)},Jdt=(r,t,e)=>{const n=Math.min(r.length,t.length)-1,i=new Array(n),a=new Array(n),s=r[0]>r[n],o=s?[...r].reverse():r,l=s?[...t].reverse():t;for(let u=0;u<n;u+=1)i[u]=cx(o[u],o[u+1]),a[u]=e(l[u],l[u+1]);return u=>{const c=Odt(r,u,1,n)-1,h=i[c],d=a[c];return Xf(d,h)(u)}},ON=(r,t,e,n)=>(Math.min(r.length,t.length)>2?Jdt:Zdt)(r,t,n?jdt:e);class Qdt extends q4{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:Kf,tickCount:5}}map(t){return wN(t)?this.output(t):this.options.unknown}invert(t){return wN(t)?this.input(t):this.options.unknown}nice(){if(!this.options.nice)return;const[t,e,n,...i]=this.getTickMethodOptions();this.options.domain=this.chooseNice()(t,e,n,...i)}getTicks(){const{tickMethod:t}=this.options,[e,n,i,...a]=this.getTickMethodOptions();return t(e,n,i,...a)}getTickMethodOptions(){const{domain:t,tickCount:e}=this.options,n=t[0],i=t[t.length-1];return[n,i,e]}chooseNice(){return Cdt}rescale(){this.nice();const[t,e]=this.chooseTransforms();this.composeOutput(t,this.chooseClamp(t)),this.composeInput(t,e,this.chooseClamp(e))}chooseClamp(t){const{clamp:e,range:n}=this.options,i=this.options.domain.map(t),a=Math.min(i.length,n.length);return e?Tdt(i[0],i[a-1]):cw}composeOutput(t,e){const{domain:n,range:i,round:a,interpolate:s}=this.options,o=ON(n.map(t),i,s,a);this.output=Xf(o,e,t)}composeInput(t,e,n){const{domain:i,range:a}=this.options,s=ON(a,i.map(t),Kf);this.input=Xf(e,n,s)}}class ac extends Qdt{getDefaultOptions(){return{domain:[0,1],range:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolate:$dt,tickMethod:Kdt,tickCount:5}}chooseTransforms(){return[cw,cw]}clone(){return new ac(this.options)}}var tft=function(r){Ht(t,r);function t(e){var n=this,i=e.style,a=Je(e,["style"]);return n=r.call(this,cr({},{type:"column"},et({style:i},a)))||this,n.columnsGroup=new _n({name:"columns"}),n.appendChild(n.columnsGroup),n.render(),n}return t.prototype.render=function(){var e=this.attributes,n=e.columns,i=e.x,a=e.y;this.columnsGroup.style.transform="translate(".concat(i,", ").concat(a,")"),_t(this.columnsGroup).selectAll(".column").data(n.flat()).join(function(s){return s.append("rect").attr("className","column").each(function(o){this.attr(o)})},function(s){return s.each(function(o){this.attr(o)})},function(s){return s.remove()})},t.prototype.update=function(e){this.attr(Pn({},this.attributes,e)),this.render()},t.prototype.clear=function(){this.removeChildren()},t}(Pe),eft=function(r){Ht(t,r);function t(e){var n=this,i=e.style,a=Je(e,["style"]);return n=r.call(this,cr({},{type:"lines"},et({style:i},a)))||this,n.linesGroup=n.appendChild(new _n),n.areasGroup=n.appendChild(new _n),n.render(),n}return t.prototype.render=function(){var e=this.attributes,n=e.lines,i=e.areas,a=e.x,s=e.y;this.style.transform="translate(".concat(a,", ").concat(s,")"),n&&this.renderLines(n),i&&this.renderAreas(i)},t.prototype.clear=function(){this.linesGroup.removeChildren(),this.areasGroup.removeChildren()},t.prototype.update=function(e){this.attr(Pn({},this.attributes,e)),this.render()},t.prototype.renderLines=function(e){_t(this.linesGroup).selectAll(".line").data(e).join(function(n){return n.append("path").attr("className","line").each(function(i){this.attr(i)})},function(n){return n.each(function(i){this.attr(i)})},function(n){return n.remove()})},t.prototype.renderAreas=function(e){_t(this.linesGroup).selectAll(".area").data(e).join(function(n){return n.append("path").attr("className","area").each(function(i){this.attr(i)})},function(n){return n.each(function(i){this.style(i)})},function(n){return n.remove()})},t}(Pe);function nft(r,t){var e,n=t.x,i=t.y,a=z(i.getOptions().range||[0,0],2),s=a[0],o=a[1];return o>s&&(e=z([s,o],2),o=e[0],s=e[1]),r.map(function(l){var u=l.map(function(c,h){return[n.map(h),He(i.map(c),o,s)]});return u})}function Ec(r,t){t===void 0&&(t=!1);var e=t?r.length-1:0,n=r.map(function(i,a){return vt([a===e?"M":"L"],z(i),!1)});return t?n.reverse():n}function Zf(r,t){if(t===void 0&&(t=!1),r.length<=2)return Ec(r);for(var e=[],n=r.length,i=0;i<n;i+=1){var a=t?r[n-i-1]:r[i];Ue(a,e.slice(-2))||e.push.apply(e,vt([],z(a),!1))}var s=Vht(e);return t?s.unshift(vt(["M"],z(r[n-1]),!1)):s.unshift(vt(["M"],z(r[0]),!1)),s}function GE(r,t,e){var n=zs(r);return n.push(["L",t,e],["L",0,e],["Z"]),n}function rft(r,t,e,n){return r.map(function(i){return GE(t?Zf(i):Ec(i),e,n)})}function ift(r,t,e){for(var n=[],i=r.length-1;i>=0;i-=1){var a=r[i],s=Ec(a),o=void 0;if(i===0)o=GE(s,t,e);else{var l=r[i-1],u=Ec(l,!0);u[0][0]="L",o=vt(vt(vt([],z(s),!1),z(u),!1),[["Z"]],!1)}n.push(o)}return n}function aft(r,t,e){for(var n=[],i=r.length-1;i>=0;i-=1){var a=r[i],s=Zf(a),o=void 0;if(i===0)o=GE(s,t,e);else{var l=r[i-1],u=Zf(l,!0),c=a[0];u[0][0]="L",o=vt(vt(vt([],z(s),!1),z(u),!1),[vt(["M"],z(c),!1),["Z"]],!1)}n.push(o)}return n}function CN(r){return r.length===0?[0,0]:[vf(_W(r,function(t){return vf(t)||0})),pf(EW(r,function(t){return pf(t)||0}))]}function AN(r){for(var t=zs(r),e=t[0].length,n=z([Array(e).fill(0),Array(e).fill(0)],2),i=n[0],a=n[1],s=0;s<t.length;s+=1)for(var o=t[s],l=0;l<e;l+=1)o[l]>=0?(o[l]+=i[l],i[l]=o[l]):(o[l]+=a[l],a[l]=o[l]);return t}var sft=function(r){Ht(t,r);function t(e){return r.call(this,e,{type:"line",x:0,y:0,width:200,height:20,isStack:!1,color:["#83daad","#edbf45","#d2cef9","#e290b3","#6f63f4"],smooth:!0,lineLineWidth:1,areaOpacity:0,isGroup:!1,columnLineWidth:1,columnStroke:"#fff",scale:1,spacing:0})||this}return Object.defineProperty(t.prototype,"rawData",{get:function(){var e=this.attributes.data;if(!e||(e==null?void 0:e.length)===0)return[[]];var n=zs(e);return yt(n[0])?[n]:n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this.attributes.isStack?AN(this.rawData):this.rawData},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scales",{get:function(){return this.createScales(this.data)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"baseline",{get:function(){var e=this.scales.y,n=z(e.getOptions().domain||[0,0],2),i=n[0],a=n[1];return a<0?e.map(a):e.map(i<0?0:i)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"containerShape",{get:function(){var e=this.attributes,n=e.width,i=e.height;return{width:n,height:i}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linesStyle",{get:function(){var e=this,n=this.attributes,i=n.type,a=n.isStack,s=n.smooth;if(i!=="line")throw new Error("linesStyle can only be used in line type");var o=Nt(this.attributes,"area"),l=Nt(this.attributes,"line"),u=this.containerShape.width,c=this.data;if(c[0].length===0)return{lines:[],areas:[]};var h=this.scales,d=h.x,g=h.y,p=nft(c,{x:d,y:g}),v=[];if(o){var m=this.baseline;a?v=s?aft(p,u,m):ift(p,u,m):v=rft(p,s,u,m)}return{lines:p.map(function(b,w){return et({stroke:e.getColor(w),d:s?Zf(b):Ec(b)},l)}),areas:v.map(function(b,w){return et({d:b,fill:e.getColor(w)},o)})}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"columnsStyle",{get:function(){var e=this,n=Nt(this.attributes,"column"),i=this.attributes,a=i.isStack,s=i.type,o=i.scale;if(s!=="column")throw new Error("columnsStyle can only be used in column type");var l=this.containerShape.height,u=this.rawData;if(!u)return{columns:[]};a&&(u=AN(u));var c=this.createScales(u),h=c.x,d=c.y,g=z(CN(u),2),p=g[0],v=g[1],m=new ac({domain:[0,v-(p>0?0:p)],range:[0,l*o]}),b=h.getBandWidth(),w=this.rawData;return{columns:u.map(function(x,_){return x.map(function(S,M){var k=b/u.length,T=function(){return{x:h.map(M)+k*_,y:S>=0?d.map(S):d.map(0),width:k,height:m.map(Math.abs(S))}},P=function(){return{x:h.map(M),y:d.map(S),width:b,height:m.map(w[_][M])}};return et(et({fill:e.getColor(_)},n),a?P():T())})})}},enumerable:!1,configurable:!0}),t.prototype.render=function(e,n){Jht(n,".container","rect").attr("className","container").node();var i=e.type,a=e.x,s=e.y,o="spark".concat(i),l=et({x:a,y:s},i==="line"?this.linesStyle:this.columnsStyle);_t(n).selectAll(".spark").data([i]).join(function(u){return u.append(function(c){return c==="line"?new eft({className:o,style:l}):new tft({className:o,style:l})}).attr("className","spark ".concat(o))},function(u){return u.update(l)},function(u){return u.remove()})},t.prototype.getColor=function(e){var n=this.attributes.color;return Xr(n)?n[e%n.length]:Et(n)?n.call(null,e):n},t.prototype.createScales=function(e){var n,i,a=this.attributes,s=a.type,o=a.scale,l=a.range,u=l===void 0?[]:l,c=a.spacing,h=this.containerShape,d=h.width,g=h.height,p=z(CN(e),2),v=p[0],m=p[1],b=new ac({domain:[(n=u[0])!==null&&n!==void 0?n:v,(i=u[1])!==null&&i!==void 0?i:m],range:[g,g*(1-o)]});return s==="line"?{type:s,x:new ac({domain:[0,e[0].length-1],range:[0,d]}),y:b}:{type:s,x:new WE({domain:e[0].map(function(w,x){return x}),range:[0,d],paddingInner:c,paddingOuter:c/2,align:.5}),y:b}},t.tag="sparkline",t}(Qe);function oft(r){return typeof r=="boolean"?!1:"enter"in r&&"update"in r&&"exit"in r}function PN(r){if(!r)return{enter:!1,update:!1,exit:!1};var t=["enter","update","exit"],e=Object.fromEntries(Object.entries(r).filter(function(n){var i=z(n,1),a=i[0];return!t.includes(a)}));return Object.fromEntries(t.map(function(n){return oft(r)?r[n]===!1?[n,!1]:[n,et(et({},r[n]),e)]:[n,e]}))}function su(r,t){r?r.finished.then(t):t()}function lft(r,t){r.length===0?t():Promise.all(r.map(function(e){return e==null?void 0:e.finished})).then(t)}function W4(r,t){"update"in r?r.update(t):r.attr(t)}function G4(r,t,e){if(t.length===0)return null;if(!e){var n=t.slice(-1)[0];return W4(r,{style:n}),null}return r.animate(t,e)}function uft(r,t){return!(r.nodeName!=="text"||t.nodeName!=="text"||r.attributes.text!==t.attributes.text)}function cft(r,t,e,n){if(n===void 0&&(n="destroy"),uft(r,t))return r.remove(),[null];var i=function(){n==="destroy"?r.destroy():n==="hide"&&Ri(r),t.isVisible()&&Xc(t)};if(!e)return i(),[null];var a=e.duration,s=a===void 0?0:a,o=e.delay,l=o===void 0?0:o,u=Math.ceil(+s/2),c=+s/4,h=z(r.getGeometryBounds().center,2),d=h[0],g=h[1],p=z(t.getGeometryBounds().center,2),v=p[0],m=p[1],b=z([(d+v)/2-d,(g+m)/2-g],2),w=b[0],x=b[1],_=r.style.opacity,S=_===void 0?1:_,M=t.style.opacity,k=M===void 0?1:M,T=r.style.transform||"",P=t.style.transform||"",O=r.animate([{opacity:S,transform:"translate(0, 0) ".concat(T)},{opacity:0,transform:"translate(".concat(w,", ").concat(x,") ").concat(T)}],et(et({fill:"both"},e),{duration:l+u+c})),A=t.animate([{opacity:0,transform:"translate(".concat(-w,", ").concat(-x,") ").concat(P),offset:.01},{opacity:k,transform:"translate(0, 0) ".concat(P)}],et(et({fill:"both"},e),{duration:u+c,delay:l+u-c}));return su(A,i),[O,A]}function Li(r,t,e){var n={},i={};return Object.entries(t).forEach(function(a){var s=z(a,2),o=s[0],l=s[1];if(!kt(l)){var u=r.style[o]||r.parsedStyle[o]||0;u!==l&&(n[o]=u,i[o]=l)}}),e?G4(r,[n,i],et({fill:"both"},e)):(W4(r,i),null)}function w0(r,t){return r.style.opacity||(r.style.opacity=1),Li(r,{opacity:0},t)}var V4={fill:"#fff",lineWidth:1,radius:2,size:10,stroke:"#bfbfbf",strokeOpacity:1,zIndex:0},H4={fill:"#000",fillOpacity:.45,fontSize:12,textAlign:"center",textBaseline:"middle",zIndex:1},U4={x:0,y:0,orientation:"horizontal",showLabel:!0,type:"start"},Yi=zi({foreground:"foreground",handle:"handle",selection:"selection",sparkline:"sparkline",sparklineGroup:"sparkline-group",track:"track",brushArea:"brush-area"},"slider"),xs=zi({labelGroup:"label-group",label:"label",iconGroup:"icon-group",icon:"icon",iconRect:"icon-rect",iconLine:"icon-line"},"handle"),hft=function(r){Ht(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(e,n){var i=e.x,a=e.y,s=e.size,o=s===void 0?10:s,l=e.radius,u=l===void 0?o/4:l,c=e.orientation,h=Je(e,["x","y","size","radius","orientation"]),d=o,g=d*2.4,p=_t(n).maybeAppendByClassName(xs.iconRect,"rect").styles(et(et({},h),{width:d,height:g,radius:u,x:i-d/2,y:a-g/2,transformOrigin:"center"})),v=i+1/3*d-d/2,m=i+2/3*d-d/2,b=a+1/4*g-g/2,w=a+3/4*g-g/2;p.maybeAppendByClassName("".concat(xs.iconLine,"-1"),"line").styles(et({x1:v,x2:v,y1:b,y2:w},h)),p.maybeAppendByClassName("".concat(xs.iconLine,"-2"),"line").styles(et({x1:m,x2:m,y1:b,y2:w},h)),c==="vertical"&&(p.node().style.transform="rotate(90)")},t}(Qe),dft=function(r){Ht(t,r);function t(e){return r.call(this,e,U4)||this}return t.prototype.renderLabel=function(e){var n=this,i=this.attributes,a=i.x,s=i.y,o=i.showLabel,l=Nt(this.attributes,"label"),u=l.x,c=u===void 0?0:u,h=l.y,d=h===void 0?0:h,g=l.transform,p=l.transformOrigin,v=Je(l,["x","y","transform","transformOrigin"]),m=z(Va(v,[]),2),b=m[0],w=m[1],x=_t(e).maybeAppendByClassName(xs.labelGroup,"g").styles(w),_=et(et({},H4),b),S=_.text,M=Je(_,["text"]);Ur(!!o,x,function(k){n.label=k.maybeAppendByClassName(xs.label,"text").styles(et(et({},M),{x:a+c,y:s+d,transform:g,transformOrigin:p,text:"".concat(S)})),n.label.on("mousedown",function(T){T.stopPropagation()}),n.label.on("touchstart",function(T){T.stopPropagation()})})},t.prototype.renderIcon=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.orientation,o=n.type,l=et(et({x:i,y:a,orientation:s},V4),Nt(this.attributes,"icon")),u=this.attributes.iconShape,c=u===void 0?function(){return new hft({style:l})}:u,h=_t(e).maybeAppendByClassName(xs.iconGroup,"g");h.selectAll(xs.icon.class).data([c]).join(function(d){return d.append(typeof c=="string"?c:function(){return c(o)}).attr("className",xs.icon.name)},function(d){return d.update(l)},function(d){return d.remove()})},t.prototype.render=function(e,n){this.renderIcon(n),this.renderLabel(n)},t}(Qe),fft=function(r){Ht(t,r);function t(e){var n=r.call(this,e,et(et(et({x:0,y:0,animate:{duration:100,fill:"both"},brushable:!0,formatter:function(i){return i.toString()},handleSpacing:2,orientation:"horizontal",padding:0,autoFitLabel:!0,scrollable:!0,selectionFill:"#5B8FF9",selectionFillOpacity:.45,selectionZIndex:2,showHandle:!0,showLabel:!0,slidable:!0,trackFill:"#416180",trackLength:200,trackOpacity:.05,trackSize:20,trackZIndex:-1,values:[0,1],type:"range",selectionType:"select",handleIconOffset:0},Cl(U4,"handle")),Cl(V4,"handleIcon")),Cl(H4,"handleLabel")))||this;return n.range=[0,1],n.onDragStart=function(i){return function(a){a.stopPropagation(),n.target=i,n.prevPos=n.getOrientVal(cN(a));var s=n.availableSpace,o=s.x,l=s.y,u=n.getBBox(),c=u.x,h=u.y;n.selectionStartPos=n.getRatio(n.prevPos-n.getOrientVal([o,l])-n.getOrientVal([+c,+h])),n.selectionWidth=0,document.addEventListener("pointermove",n.onDragging),document.addEventListener("pointerup",n.onDragEnd)}},n.onDragging=function(i){var a=n.attributes,s=a.slidable,o=a.brushable,l=a.type;i.stopPropagation();var u=n.getOrientVal(cN(i)),c=u-n.prevPos;if(c){var h=n.getRatio(c);switch(n.target){case"start":s&&n.setValuesOffset(h);break;case"end":s&&n.setValuesOffset(0,h);break;case"selection":s&&n.setValuesOffset(h,h);break;case"track":if(!o)return;n.selectionWidth+=h,l==="range"?n.innerSetValues([n.selectionStartPos,n.selectionStartPos+n.selectionWidth].sort(),!0):n.innerSetValues([0,n.selectionStartPos+n.selectionWidth],!0);break}n.prevPos=u}},n.onDragEnd=function(){document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointerup",n.onDragEnd),n.target="",n.updateHandlesPosition(!1)},n.onValueChange=function(i){var a=n.attributes,s=a.onChange,o=a.type,l=o==="range"?i:i[1],u=o==="range"?n.getValues():n.getValues()[1],c=new cn("valuechange",{detail:{oldValue:l,value:u}});n.dispatchEvent(c),s==null||s(u)},n.selectionStartPos=0,n.selectionWidth=0,n.prevPos=0,n.target="",n}return Object.defineProperty(t.prototype,"values",{get:function(){return this.attributes.values},set:function(e){this.attributes.values=this.clampValues(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sparklineStyle",{get:function(){var e=this.attributes.orientation;if(e!=="horizontal")return null;var n=Nt(this.attributes,"sparkline");return et(et({zIndex:0},this.availableSpace),n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shape",{get:function(){var e=this.attributes,n=e.trackLength,i=e.trackSize,a=z(this.getOrientVal([[n,i],[i,n]]),2),s=a[0],o=a[1];return{width:s,height:o}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"availableSpace",{get:function(){var e=this.attributes;e.x,e.y;var n=e.padding,i=z(jn(n),4),a=i[0],s=i[1],o=i[2],l=i[3],u=this.shape,c=u.width,h=u.height;return{x:l,y:a,width:c-(l+s),height:h-(a+o)}},enumerable:!1,configurable:!0}),t.prototype.getValues=function(){return this.values},t.prototype.setValues=function(e,n){e===void 0&&(e=[0,0]),n===void 0&&(n=!1),this.attributes.values=e;var i=n===!1?!1:this.attributes.animate;this.updateSelectionArea(i),this.updateHandlesPosition(i)},t.prototype.updateSelectionArea=function(e){var n=this.calcSelectionArea();this.foregroundGroup.selectAll(Yi.selection.class).each(function(i,a){Li(this,n[a],e)})},t.prototype.updateHandlesPosition=function(e){this.attributes.showHandle&&(this.startHandle&&Li(this.startHandle,this.getHandleStyle("start"),e),this.endHandle&&Li(this.endHandle,this.getHandleStyle("end"),e))},t.prototype.innerSetValues=function(e,n){e===void 0&&(e=[0,0]),n===void 0&&(n=!1);var i=this.values,a=this.clampValues(e);this.attributes.values=a,this.setValues(a),n&&this.onValueChange(i)},t.prototype.renderTrack=function(e){var n=this.attributes,i=n.x,a=n.y,s=Nt(this.attributes,"track");this.trackShape=_t(e).maybeAppendByClassName(Yi.track,"rect").styles(et(et({x:i,y:a},this.shape),s))},t.prototype.renderBrushArea=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.brushable;this.brushArea=_t(e).maybeAppendByClassName(Yi.brushArea,"rect").styles(et({x:i,y:a,fill:"transparent",cursor:s?"crosshair":"default"},this.shape))},t.prototype.renderSparkline=function(e){var n=this,i=this.attributes,a=i.x,s=i.y,o=i.orientation,l=_t(e).maybeAppendByClassName(Yi.sparklineGroup,"g");Ur(o==="horizontal",l,function(u){var c=et(et({},n.sparklineStyle),{x:a,y:s});u.maybeAppendByClassName(Yi.sparkline,function(){return new sft({style:c})}).update(c)})},t.prototype.renderHandles=function(){var e=this,n,i=this.attributes,a=i.showHandle,s=i.type,o=s==="range"?["start","end"]:["end"],l=a?o:[],u=this;(n=this.foregroundGroup)===null||n===void 0||n.selectAll(Yi.handle.class).data(l.map(function(c){return{type:c}}),function(c){return c.type}).join(function(c){return c.append(function(h){var d=h.type;return new dft({style:e.getHandleStyle(d)})}).each(function(h){var d=h.type;this.attr("class","".concat(Yi.handle.name," ").concat(d,"-handle"));var g="".concat(d,"Handle");u[g]=this,this.addEventListener("pointerdown",u.onDragStart(d))})},function(c){return c.each(function(h){var d=h.type;this.update(u.getHandleStyle(d))})},function(c){return c.each(function(h){var d=h.type,g="".concat(d,"Handle");u[g]=void 0}).remove()})},t.prototype.renderSelection=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.type,o=n.selectionType;this.foregroundGroup=_t(e).maybeAppendByClassName(Yi.foreground,"g");var l=Nt(this.attributes,"selection"),u=function(h){return h.style("visibility",function(d){return d.show?"visible":"hidden"}).style("cursor",function(d){return o==="select"?"grab":o==="invert"?"crosshair":"default"}).styles(et(et({},l),{transform:"translate(".concat(i,", ").concat(a,")")}))},c=this;this.foregroundGroup.selectAll(Yi.selection.class).data(s==="value"?[]:this.calcSelectionArea().map(function(h,d){return{style:et({},h),index:d,show:o==="select"?d===1:d!==1}}),function(h){return h.index}).join(function(h){return h.append("rect").attr("className",Yi.selection.name).call(u).each(function(d,g){var p=this;g===1?(c.selectionShape=_t(this),this.on("pointerdown",function(v){p.attr("cursor","grabbing"),c.onDragStart("selection")(v)}),c.dispatchCustomEvent(this,"pointerenter","selectionMouseenter"),c.dispatchCustomEvent(this,"pointerleave","selectionMouseleave"),c.dispatchCustomEvent(this,"click","selectionClick"),this.addEventListener("pointerdown",function(){p.attr("cursor","grabbing")}),this.addEventListener("pointerup",function(){p.attr("cursor","pointer")}),this.addEventListener("pointerover",function(){p.attr("cursor","pointer")})):this.on("pointerdown",c.onDragStart("track"))})},function(h){return h.call(u)},function(h){return h.remove()}),this.updateSelectionArea(!1),this.renderHandles()},t.prototype.render=function(e,n){this.renderTrack(n),this.renderSparkline(n),this.renderBrushArea(n),this.renderSelection(n)},t.prototype.clampValues=function(e,n){var i;n===void 0&&(n=4);var a=z(this.range,2),s=a[0],o=a[1],l=z(this.getValues().map(function(m){return hN(m,n)}),2),u=l[0],c=l[1],h=Array.isArray(e)?e:[u,e??c],d=z((h||[u,c]).map(function(m){return hN(m,n)}),2),g=d[0],p=d[1];if(this.attributes.type==="value")return[0,He(p,s,o)];g>p&&(i=z([p,g],2),g=i[0],p=i[1]);var v=p-g;return v>o-s?[s,o]:g<s?u===s&&c===p?[s,p]:[s,v+s]:p>o?c===o&&u===g?[g,o]:[o-v,o]:[g,p]},t.prototype.calcSelectionArea=function(e){var n=z(this.clampValues(e),2),i=n[0],a=n[1],s=this.availableSpace,o=s.x,l=s.y,u=s.width,c=s.height;return this.getOrientVal([[{y:l,height:c,x:o,width:i*u},{y:l,height:c,x:i*u+o,width:(a-i)*u},{y:l,height:c,x:a*u,width:(1-a)*u}],[{x:o,width:u,y:l,height:i*c},{x:o,width:u,y:i*c+l,height:(a-i)*c},{x:o,width:u,y:a*c,height:(1-a)*c}]])},t.prototype.calcHandlePosition=function(e){var n=this.attributes.handleIconOffset,i=this.availableSpace,a=i.x,s=i.y,o=i.width,l=i.height,u=z(this.clampValues(),2),c=u[0],h=u[1],d=e==="start"?-n:n,g=(e==="start"?c:h)*this.getOrientVal([o,l])+d;return{x:a+this.getOrientVal([g,o/2]),y:s+this.getOrientVal([l/2,g])}},t.prototype.inferTextStyle=function(e){var n=this.attributes.orientation;return n==="horizontal"?{}:e==="start"?{transformOrigin:"left center",transform:"rotate(90)",textAlign:"start"}:e==="end"?{transformOrigin:"right center",transform:"rotate(90)",textAlign:"end"}:{}},t.prototype.calcHandleText=function(e){var n,i=this.attributes,a=i.type,s=i.orientation,o=i.formatter,l=i.autoFitLabel,u=Nt(this.attributes,"handle"),c=Nt(u,"label"),h=u.spacing,d=this.getHandleSize(),g=this.clampValues(),p=e==="start"?g[0]:g[1],v=o(p),m=new FE({style:et(et(et({},c),this.inferTextStyle(e)),{text:v})}),b=m.getBBox(),w=b.width,x=b.height;if(m.destroy(),!l){if(a==="value")return{text:v,x:0,y:-x-h};var _=h+d+(s==="horizontal"?w/2:0);return n={text:v},n[s==="horizontal"?"x":"y"]=e==="start"?-_:_,n}var S=0,M=0,k=this.availableSpace,T=k.width,P=k.height,O=this.calcSelectionArea()[1],A=O.x,R=O.y,L=O.width,q=O.height,j=h+d;if(s==="horizontal"){var $=j+w/2;if(e==="start"){var B=A-j-w;S=B>0?-$:$}else{var F=T-A-L-j>w;S=F?$:-$}}else{var V=j,X=x+j;e==="start"?M=R-d>x?-X:V:M=P-(R+q)-d>x?X:-V}return{x:S,y:M,text:v}},t.prototype.getHandleLabelStyle=function(e){var n=Nt(this.attributes,"handleLabel");return et(et(et({},n),this.calcHandleText(e)),this.inferTextStyle(e))},t.prototype.getHandleIconStyle=function(){var e=this.attributes.handleIconShape,n=Nt(this.attributes,"handleIcon"),i=this.getOrientVal(["ew-resize","ns-resize"]),a=this.getHandleSize();return et({cursor:i,shape:e,size:a},n)},t.prototype.getHandleStyle=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.showLabel,o=n.showLabelOnInteraction,l=n.orientation,u=this.calcHandlePosition(e),c=u.x,h=u.y,d=this.calcHandleText(e),g=s;return!s&&o&&(this.target?g=!0:g=!1),et(et(et({},Cl(this.getHandleIconStyle(),"icon")),Cl(et(et({},this.getHandleLabelStyle(e)),d),"label")),{transform:"translate(".concat(c+i,", ").concat(h+a,")"),orientation:l,showLabel:g,type:e,zIndex:3})},t.prototype.getHandleSize=function(){var e=this.attributes,n=e.handleIconSize,i=e.width,a=e.height;return n||Math.floor((this.getOrientVal([+a,+i])+4)/2.4)},t.prototype.getOrientVal=function(e){var n=z(e,2),i=n[0],a=n[1],s=this.attributes.orientation;return s==="horizontal"?i:a},t.prototype.setValuesOffset=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var a=this.attributes.type,s=z(this.getValues(),2),o=s[0],l=s[1],u=a==="range"?e:0,c=[o+u,l+n].sort();i?this.setValues(c):this.innerSetValues(c,!0)},t.prototype.getRatio=function(e){var n=this.availableSpace,i=n.width,a=n.height;return e/this.getOrientVal([i,a])},t.prototype.dispatchCustomEvent=function(e,n,i){var a=this;e.on(n,function(s){s.stopPropagation(),a.dispatchEvent(new cn(i,{detail:s}))})},t.prototype.bindEvents=function(){this.addEventListener("wheel",this.onScroll);var e=this.brushArea;this.dispatchCustomEvent(e,"click","trackClick"),this.dispatchCustomEvent(e,"pointerenter","trackMouseenter"),this.dispatchCustomEvent(e,"pointerleave","trackMouseleave"),e.on("pointerdown",this.onDragStart("track"))},t.prototype.onScroll=function(e){var n=this.attributes.scrollable;if(n){var i=e.deltaX,a=e.deltaY,s=a||i,o=this.getRatio(s);this.setValuesOffset(o,o,!0)}},t.tag="slider",t}(Qe),VE={data:[],animate:{enter:!1,update:{duration:100,easing:"ease-in-out-sine",fill:"both"},exit:{duration:100,fill:"both"}},showArrow:!0,showGrid:!0,showLabel:!0,showLine:!0,showTick:!0,showTitle:!0,showTrunc:!1,dataThreshold:100,lineLineWidth:1,lineStroke:"black",crossPadding:10,titleFill:"black",titleFontSize:12,titlePosition:"lb",titleSpacing:0,titleTextAlign:"center",titleTextBaseline:"middle",lineArrow:function(){return new qr({style:{d:[["M",10,10],["L",-10,0],["L",10,-10],["L",0,0],["L",10,10],["Z"]],fill:"black",transformOrigin:"center"}})},labelAlign:"parallel",labelDirection:"positive",labelFontSize:12,labelSpacing:0,gridConnect:"line",gridControlAngles:[],gridDirection:"positive",gridLength:0,gridType:"segment",lineArrowOffset:15,lineArrowSize:10,tickDirection:"positive",tickLength:5,tickLineWidth:1,tickStroke:"black",labelOverlap:[]};cr({},VE,{style:{type:"arc"}});cr({},VE,{style:{}});var ye=zi({mainGroup:"main-group",gridGroup:"grid-group",grid:"grid",lineGroup:"line-group",line:"line",tickGroup:"tick-group",tick:"tick",tickItem:"tick-item",labelGroup:"label-group",label:"label",labelItem:"label-item",titleGroup:"title-group",title:"title",lineFirst:"line-first",lineSecond:"line-second"},"axis"),Yl=zi({lineGroup:"line-group",line:"line",regionGroup:"region-group",region:"region"},"grid");function Y4(r){return r.reduce(function(t,e,n){return t.push(vt([n===0?"M":"L"],z(e),!1)),t},[])}function gft(r,t,e){var n=t.connect,i=n===void 0?"line":n,a=t.center;if(i==="line")return Y4(r);if(!a)return[];var s=xc(r[0],a),o=e?0:1;return r.reduce(function(l,u,c){return c===0?l.push(vt(["M"],z(u),!1)):l.push(vt(["A",s,s,0,0,o],z(u),!1)),l},[])}function hx(r,t,e){return t.type==="surround"?gft(r,t,e):Y4(r)}function pft(r,t,e){var n=e.type,i=e.connect,a=e.center,s=e.closed,o=s?[["Z"]]:[],l=z([hx(r,e),hx(t.slice().reverse(),e,!0)],2),u=l[0],c=l[1],h=z([r[0],t.slice(-1)[0]],2),d=h[0],g=h[1],p=function(w,x){return[u,w,c,x,o].flat()};if(i==="line"||n==="surround")return p([vt(["L"],z(g),!1)],[vt(["L"],z(d),!1)]);if(!a)throw new Error("Arc grid need to specified center");var v=z([xc(g,a),xc(d,a)],2),m=v[0],b=v[1];return p([vt(["A",m,m,0,0,1],z(g),!1),vt(["L"],z(g),!1)],[vt(["A",b,b,0,0,0],z(d),!1),vt(["L"],z(d),!1)])}function vft(r,t,e,n){var i=e.animate,a=e.isBillboard,s=t.map(function(o,l){return{id:o.id||"grid-line-".concat(l),d:hx(o.points,e)}});return r.selectAll(Yl.line.class).data(s,function(o){return o.id}).join(function(o){return o.append("path").each(function(l,u){var c=gi(fN(et({d:l.d},n)),[l,u,s]);this.attr(et({class:Yl.line.name,stroke:"#D9D9D9",lineWidth:1,lineDash:[4,4],isBillboard:a},c))})},function(o){return o.transition(function(l,u){var c=gi(fN(et({d:l.d},n)),[l,u,s]);return Li(this,c,i.update)})},function(o){return o.transition(function(){var l=this,u=w0(this,i.exit);return su(u,function(){return l.remove()}),u})}).transitions()}function mft(r,t,e){var n=e.animate,i=e.connect,a=e.areaFill;if(t.length<2||!a||!i)return[];for(var s=Array.isArray(a)?a:[a,"transparent"],o=function(p){return s[p%s.length]},l=[],u=0;u<t.length-1;u++){var c=z([t[u].points,t[u+1].points],2),h=c[0],d=c[1],g=pft(h,d,e);l.push({d:g,fill:o(u)})}return r.selectAll(Yl.region.class).data(l,function(p,v){return v}).join(function(p){return p.append("path").each(function(v,m){var b=gi(v,[v,m,l]);this.attr(b)}).attr("className",Yl.region.name)},function(p){return p.transition(function(v,m){var b=gi(v,[v,m,l]);return Li(this,b,n.update)})},function(p){return p.transition(function(){var v=this,m=w0(this,n.exit);return su(m,function(){return v.remove()}),m})}).transitions()}function yft(r){var t=r.data,e=t===void 0?[]:t,n=r.closed;return n?e.map(function(i){var a=i.points,s=z(a,1),o=s[0];return et(et({},i),{points:vt(vt([],z(a),!1),[o],!1)})}):e}var bft=function(r){Ht(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(e,n){e.type,e.center,e.areaFill,e.closed;var i=Je(e,["type","center","areaFill","closed"]),a=yft(e),s=_t(n).maybeAppendByClassName(Yl.lineGroup,"g"),o=_t(n).maybeAppendByClassName(Yl.regionGroup,"g"),l=vft(s,a,e,i),u=mft(o,a,e);return vt(vt([],z(l),!1),z(u),!1)},t}(Qe);function X4(r,t){return Object.fromEntries(Object.entries(r).map(function(e){var n=z(e,2),i=n[0],a=n[1];return[i,gi(a,t)]}))}function HE(r,t){return t&&Et(t)?r.filter(t):r}function K4(r,t){var e=t.startAngle,n=t.endAngle;return(n-e)*r+e}function x0(r,t){if(t.type==="linear"){var e=z(t.startPos,2),n=e[0],i=e[1],a=z(t.endPos,2),s=a[0],o=a[1],l=z([s-n,o-i],2),u=l[0],c=l[1];return R4([u,c])}var h=Ul(K4(r,t));return[-Math.sin(h),Math.cos(h)]}function UE(r,t,e){var n=x0(r,e);return Wht(n,t!=="positive")}function Zc(r,t){return UE(r,t.labelDirection,t)}function wft(r,t){var e=z(t.startPos,2),n=e[0],i=e[1],a=z(t.endPos,2),s=a[0],o=a[1],l=z([s-n,o-i],2),u=l[0],c=l[1];return[n+u*r,i+c*r]}function xft(r,t){var e=t.radius,n=z(t.center,2),i=n[0],a=n[1],s=Ul(K4(r,t));return[i+e*Math.cos(s),a+e*Math.sin(s)]}function E0(r,t){return t.type==="linear"?wft(r,t):xft(r,t)}function Z4(r){return x0(0,r)[1]===0}function J4(r){return x0(0,r)[0]===0}function Q4(r,t){return t-r===360}function NN(r,t,e,n,i){var a=t-r,s=z([i,i],2),o=s[0],l=s[1],u=z([Ul(r),Ul(t)],2),c=u[0],h=u[1],d=function(P){return[e+i*Math.cos(P),n+i*Math.sin(P)]},g=z(d(c),2),p=g[0],v=g[1],m=z(d(h),2),b=m[0],w=m[1];if(Q4(r,t)){var x=(h+c)/2,_=z(d(x),2),S=_[0],M=_[1];return[["M",p,v],["A",o,l,0,1,0,S,M],["A",o,l,0,1,0,b,w]]}var k=a>180?1:0,T=r>t?0:1;return"M".concat(p,",").concat(v,",A").concat(o,",").concat(l,",0,").concat(k,",").concat(T,",").concat(b,",").concat(w)}function Eft(r){var t=r.attributes,e=t.startAngle,n=t.endAngle,i=t.center,a=t.radius;return vt(vt([e,n],z(i),!1),[a],!1)}function _ft(r,t,e,n){var i=t.startAngle,a=t.endAngle,s=t.center,o=t.radius;return r.selectAll(ye.line.class).data([{d:NN.apply(void 0,vt(vt([i,a],z(s),!1),[o],!1))}],function(l,u){return u}).join(function(l){return l.append("path").attr("className",ye.line.name).styles(t).styles({d:function(u){return u.d}})},function(l){return l.transition(function(){var u=this,c=qht(this,Eft(this),vt(vt([i,a],z(s),!1),[o],!1),n.update);if(c){var h=function(){var d=sr(u.attributes,"__keyframe_data__");u.style.d=NN.apply(void 0,vt([],z(d),!1))};c.onframe=h,c.onfinish=h}return c}).styles(t)},function(l){return l.remove()}).styles(e).transitions()}function Sft(r,t){t.truncRange,t.truncShape,t.lineExtension}function Mft(r,t,e){e===void 0&&(e=[0,0]);var n=z([r,t,e],3),i=z(n[0],2),a=i[0],s=i[1],o=z(n[1],2),l=o[0],u=o[1],c=z(n[2],2),h=c[0],d=c[1],g=z([l-a,u-s],2),p=g[0],v=g[1],m=Math.sqrt(Math.pow(p,2)+Math.pow(v,2)),b=z([-h/m,d/m],2),w=b[0],x=b[1];return[w*p,w*v,x*p,x*v]}function RN(r){var t=z(r,2),e=z(t[0],2),n=e[0],i=e[1],a=z(t[1],2),s=a[0],o=a[1];return{x1:n,y1:i,x2:s,y2:o}}function kft(r,t,e,n){var i=t.showTrunc,a=t.startPos,s=t.endPos,o=t.truncRange,l=t.lineExtension,u=z([a,s],2),c=z(u[0],2),h=c[0],d=c[1],g=z(u[1],2),p=g[0],v=g[1],m=z(l?Mft(a,s,l):new Array(4).fill(0),4),b=m[0],w=m[1],x=m[2],_=m[3],S=function(F){return r.selectAll(ye.line.class).data(F,function(V,X){return X}).join(function(V){return V.append("line").attr("className",function(X){return"".concat(ye.line.name," ").concat(X.className)}).styles(e).transition(function(X){return Li(this,RN(X.line),!1)})},function(V){return V.styles(e).transition(function(X){var K=X.line;return Li(this,RN(K),n.update)})},function(V){return V.remove()}).transitions()};if(!i||!o)return S([{line:[[h+b,d+w],[p+x,v+_]],className:ye.line.name}]);var M=z(o,2),k=M[0],T=M[1],P=p-h,O=v-d,A=z([h+P*k,d+O*k],2),R=A[0],L=A[1],q=z([h+P*T,d+O*T],2),j=q[0],$=q[1],B=S([{line:[[h+b,d+w],[R,L]],className:ye.lineFirst.name},{line:[[j,$],[p+x,v+_]],className:ye.lineSecond.name}]);return Sft(r,t),B}function Tft(r,t,e,n){var i=e.showArrow,a=e.showTrunc,s=e.lineArrow,o=e.lineArrowOffset,l=e.lineArrowSize,u;if(t==="arc"?u=r.select(ye.line.class):a?u=r.select(ye.lineSecond.class):u=r.select(ye.line.class),!i||!s||e.type==="arc"&&Q4(e.startAngle,e.endAngle)){var c=u.node();c&&(c.style.markerEnd=void 0);return}var h=Ga(s);h.attr(n),zE(h,l),u.style("markerEnd",h).style("markerEndOffset",-o)}function Oft(r,t,e){var n=t.type,i,a=Nt(t,"line");return n==="linear"?i=kft(r,t,dN(a,"arrow"),e):i=_ft(r,t,dN(a,"arrow"),e),Tft(r,n,t,a),i}function Cft(r,t){return UE(r,t.gridDirection,t)}function t5(r){var t=r.type,e=r.gridCenter;return t==="linear"?e:e||r.center}function Aft(r,t){var e=t.gridLength;return r.map(function(n,i){var a=n.value,s=z(E0(a,t),2),o=s[0],l=s[1],u=z(Aa(Cft(a,t),e),2),c=u[0],h=u[1];return{id:i,points:[[o,l],[o+c,l+h]]}})}function Pft(r,t){var e=t.gridControlAngles,n=t5(t);if(!n)throw new Error("grid center is not provide");if(r.length<2)throw new Error("Invalid grid data");if(!e||e.length===0)throw new Error("Invalid gridControlAngles");var i=z(n,2),a=i[0],s=i[1];return r.map(function(o,l){var u=o.value,c=z(E0(u,t),2),h=c[0],d=c[1],g=z([h-a,d-s],2),p=g[0],v=g[1],m=[];return e.forEach(function(b){var w=Ul(b),x=z([Math.cos(w),Math.sin(w)],2),_=x[0],S=x[1],M=p*_-v*S+a,k=p*S+v*_+s;m.push([M,k])}),{points:m,id:l}})}function Nft(r,t,e,n){var i=Nt(e,"grid"),a=i.type,s=i.areaFill,o=t5(e),l=HE(t,e.gridFilter),u=a==="segment"?Aft(l,e):Pft(l,e),c=et(et({},i),{center:o,areaFill:Et(s)?l.map(function(h,d){return gi(s,[h,d,l])}):s,animate:n,data:u});return r.selectAll(ye.grid.class).data([1]).join(function(h){return h.append(function(){return new bft({style:c})}).attr("className",ye.grid.name)},function(h){return h.transition(function(){return this.update(c)})},function(h){return h.remove()}).transitions()}var dx=function(){function r(t,e,n,i){this.set(t,e,n,i)}return Object.defineProperty(r.prototype,"left",{get:function(){return this.x1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"top",{get:function(){return this.y1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"right",{get:function(){return this.x2},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bottom",{get:function(){return this.y2},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"width",{get:function(){return this.defined("x2")&&this.defined("x1")?this.x2-this.x1:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.defined("y2")&&this.defined("y1")?this.y2-this.y1:void 0},enumerable:!1,configurable:!0}),r.prototype.rotatedPoints=function(t,e,n){var i=this,a=i.x1,s=i.y1,o=i.x2,l=i.y2,u=Math.cos(t),c=Math.sin(t),h=e-e*u+n*c,d=n-e*c-n*u,g=[[u*a-c*l+h,c*a+u*l+d],[u*o-c*l+h,c*o+u*l+d],[u*a-c*s+h,c*a+u*s+d],[u*o-c*s+h,c*o+u*s+d]];return g},r.prototype.set=function(t,e,n,i){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),i<e?(this.y2=e,this.y1=i):(this.y1=e,this.y2=i),this},r.prototype.defined=function(t){return this[t]!==Number.MAX_VALUE&&this[t]!==-Number.MAX_VALUE},r}();function fx(r,t){var e=r.getEulerAngles()||0;r.setEulerAngles(0);var n=r.getBounds(),i=z(n.min,2),a=i[0],s=i[1],o=z(n.max,2),l=o[0],u=o[1],c=r.getBBox(),h=c.width,d=c.height,g=d,p=0,v=0,m=a,b=s,w=P4(r);if(w){g-=1.5;var x=w.style.textAlign,_=w.style.textBaseline;x==="center"?m=(a+l)/2:(x==="right"||x==="end")&&(m=l),_==="middle"?b=(s+u)/2:_==="bottom"&&(b=u)}var S=z(jn(t),4),M=S[0],k=M===void 0?0:M,T=S[1],P=T===void 0?0:T,O=S[2],A=O===void 0?k:O,R=S[3],L=R===void 0?P:R,q=new dx((p+=a)-L,(v+=s)-k,p+h+P,v+g+A);return r.setEulerAngles(e),q.rotatedPoints(Ul(e),m,b)}function Xu(r,t){return t[0]<=Math.max(r[0][0],r[1][0])&&t[0]<=Math.min(r[0][0],r[1][0])&&t[1]<=Math.max(r[0][1],r[1][1])&&t[1]<=Math.min(r[0][1],r[1][1])}function Ku(r,t,e){var n=(t[1]-r[1])*(e[0]-t[0])-(t[0]-r[0])*(e[1]-t[1]);return n===0?0:n<0?2:1}function Rft(r,t){var e=Ku(r[0],r[1],t[0]),n=Ku(r[0],r[1],t[1]),i=Ku(t[0],t[1],r[0]),a=Ku(t[0],t[1],r[1]);return!!(e!==n&&i!==a||e===0&&Xu(r,t[0])||n===0&&Xu(r,t[1])||i===0&&Xu(t,r[0])||a===0&&Xu(t,r[1]))}function Lft(r,t){var e=r.length;if(e<3)return!1;var n=[t,[9999,t[1]]],i=0,a=0;do{var s=[r[a],r[(a+1)%e]];if(Rft(s,n)){if(Ku(s[0],t,s[1])===0)return Xu(s,t);i++}a=(a+1)%e}while(a!==0);return!!(i&1)}function Ift(r,t){return t.every(function(e){return Lft(r,e)})}function Dft(r,t,e){var n=r.x1,i=r.x2,a=r.y1,s=r.y2,o=[[n,a],[i,a],[i,s],[n,s]],l=fx(t,e);return Ift(o,l)}function Fft(r,t){var e=z(r,4),n=e[0],i=e[1],a=e[2],s=e[3],o=z(t,4),l=o[0],u=o[1],c=o[2],h=o[3],d=a-n,g=s-i,p=c-l,v=h-u,m=d*v-p*g;if(m===0)return!1;var b=m>0,w=n-l,x=i-u,_=d*x-g*w;if(_<0===b)return!1;var S=p*x-v*w;return!(S<0===b||_>m===b||S>m===b)}function Bft(r,t){var e=[[r[0],r[1],r[2],r[3]],[r[2],r[3],r[4],r[5]],[r[4],r[5],r[6],r[7]],[r[6],r[7],r[0],r[1]]];return e.some(function(n){return Fft(t,n)})}function zft(r,t,e){var n,i,a=fx(r,e).flat(1),s=fx(t,e).flat(1),o=[[a[0],a[1],a[2],a[3]],[a[0],a[1],a[4],a[5]],[a[4],a[5],a[6],a[7]],[a[2],a[3],a[6],a[7]]];try{for(var l=Cc(o),u=l.next();!u.done;u=l.next()){var c=u.value;if(Bft(s,c))return!0}}catch(h){n={error:h}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}return!1}function $ft(r,t){var e=r.type,n=r.labelDirection,i=r.crossSize;if(!i)return!1;if(e==="arc"){var a=r.center,s=r.radius,o=z(a,2),l=o[0],u=o[1],c=n==="negative"?0:i,h=-s-c,d=s+c,g=z(jn(t),4),p=g[0],v=g[1],m=g[2],b=g[3];return new dx(l+h-b,u+h-p,l+d+v,u+d+m)}var w=z(r.startPos,2),x=w[0],_=w[1],S=z(r.endPos,2),M=S[0],k=S[1],T=z(J4(r)?[-t,0,t,0]:[0,t,0,-t],4),P=T[0],O=T[1],A=T[2],R=T[3],L=Zc(0,r),q=Aa(L,i),j=new dx(x,_,M,k);return j.x1+=R,j.y1+=P,j.x2+=O+q[0],j.y2+=A+q[1],j}function _0(r,t,e){var n,i,a=t.crossPadding,s=new Set,o=null,l=$ft(t,a),u=function(p){return l?Dft(l,p):!0},c=function(p,v){return!p||!p.firstChild?!0:!zft(p.firstChild,v.firstChild,jn(e))};try{for(var h=Cc(r),d=h.next();!d.done;d=h.next()){var g=d.value;u(g)?!o||c(o,g)?o=g:(s.add(o),s.add(g)):s.add(g)}}catch(p){n={error:p}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return Array.from(s)}function Xb(r,t){return t===void 0&&(t={}),kt(r)?0:typeof r=="number"?r:Math.floor(Dht(r,t))}function jft(r,t,e,n){if(!(r.length<=1)){var i=t.suffix,a=i===void 0?"...":i,s=t.minLength,o=t.maxLength,l=o===void 0?1/0:o,u=t.step,c=u===void 0?" ":u,h=t.margin,d=h===void 0?[0,0,0,0]:h,g=A4(n.getTextShape(r[0])),p=Xb(c,g),v=s?Xb(s,g):p,m=Xb(l,g);(kt(m)||m===1/0)&&(m=Math.max.apply(null,r.map(function(M){return M.getBBox().width})));var b=r.slice(),w=z(d,4);w[0],w[1],w[2],w[3];for(var x=function(M){if(b.forEach(function(k){n.ellipsis(n.getTextShape(k),M,a)}),b=_0(r,e,d),b.length<1)return{value:void 0}},_=m;_>v+p;_-=p){var S=x(_);if(typeof S=="object")return S.value}}}var qft={parity:function(r,t){var e=t.seq,n=e===void 0?2:e;return r.filter(function(i,a){return a%n?(Ri(i),!1):!0})}},Wft=function(r){return r.filter(C4)};function Gft(r,t,e,n){var i=r.length,a=t.keepHeader,s=t.keepTail;if(!(i<=1||i===2&&a&&s)){var o=qft.parity,l=function(x){return x.forEach(n.show),x},u=2,c=r.slice(),h=r.slice(),d=Math.min.apply(Math,vt([1],z(r.map(function(x){return x.getBBox().width})),!1));if(e.type==="linear"&&(Z4(e)||J4(e))){var g=gN(r[0]).left,p=gN(r[i-1]).right,v=Math.abs(p-g)||1;u=Math.max(Math.floor(i*d/v),u)}var m,b;for(a&&(m=c.splice(0,1)[0]),s&&(b=c.splice(-1,1)[0],c.reverse()),l(c);u<r.length&&_0(Wft(b?vt(vt([b],z(h),!1),[m],!1):vt([m],z(h),!1)),e,t==null?void 0:t.margin).length;){if(b&&!m&&u%2===0){var w=c.splice(0,1);w.forEach(n.hide)}else if(b&&m){var w=c.splice(0,1);w.forEach(n.hide)}h=o(l(c),{seq:u}),u++}}}function Vft(r,t,e,n){var i,a,s=t.optionalAngles,o=s===void 0?[0,45,90]:s,l=t.margin,u=t.recoverWhenFailed,c=u===void 0?!0:u,h=r.map(function(b){return b.getLocalEulerAngles()}),d=function(){return _0(r,e,l).length<1},g=function(b){return r.forEach(function(w,x){var _=Array.isArray(b)?b[x]:b;n.rotate(w,+_)})};try{for(var p=Cc(o),v=p.next();!v.done;v=p.next()){var m=v.value;if(g(m),d())return}}catch(b){i={error:b}}finally{try{v&&!v.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}c&&g(h)}function Hft(r){var t=r.type,e=r.labelDirection;return t==="linear"&&Z4(r)?e==="negative"?"bottom":"top":"middle"}function Uft(r,t,e,n){var i=t.wordWrapWidth,a=i===void 0?50:i,s=t.maxLines,o=s===void 0?3:s,l=t.recoverWhenFailed,u=l===void 0?!0:l,c=t.margin,h=c===void 0?[0,0,0,0]:c,d=r.map(function(w){return w.attr("maxLines")||1}),g=Math.min.apply(Math,vt([],z(d),!1)),p=function(){return _0(r,e,h).length<1},v=Hft(e),m=function(w){return r.forEach(function(x,_){var S=Array.isArray(w)?w[_]:w;n.wrap(x,a,S,v)})};if(!(g>o)){for(var b=g;b<=o;b++)if(m(b),p())return;u&&m(d)}}var Yft=new Map([["hide",Gft],["rotate",Vft],["ellipsis",jft],["wrap",Uft]]);function Xft(r,t,e){return t.labelOverlap.length<1?!1:e==="hide"?!Lht(r[0]):e==="rotate"?!r.some(function(n){var i;return!!(!((i=n.attr("transform"))===null||i===void 0)&&i.includes("rotate"))}):e==="ellipsis"||e==="wrap"?r.filter(function(n){return n.querySelector("text")}).length>1:!0}function Kft(r,t,e){var n=t.labelOverlap,i=n===void 0?[]:n;i.length&&i.forEach(function(a){var s=a.type,o=Yft.get(s);Xft(r,t,s)&&(o==null||o(r,a,t,e))})}function Zft(){for(var r=[],t=0;t<arguments.length;t++)r[t]=arguments[t];var e=function(n){return n==="positive"?-1:1};return r.reduce(function(n,i){return n*e(i)},1)}function LN(r){for(var t=r;t<0;)t+=360;return Math.round(t%360)}function gx(r,t){var e=z(r,2),n=e[0],i=e[1],a=z(t,2),s=a[0],o=a[1],l=z([n*s+i*o,n*o-i*s],2),u=l[0],c=l[1];return Math.atan2(c,u)}function Jft(r){var t=(r+360)%180;return Fn(t,-90,90)||(t+=180),t}function Qft(r,t,e){var n,i=e.labelAlign,a=(n=t.style.transform)===null||n===void 0?void 0:n.includes("rotate");if(a)return t.getLocalEulerAngles();var s=0,o=Zc(r.value,e),l=x0(r.value,e);return i==="horizontal"?0:(i==="perpendicular"?s=gx([1,0],o):s=gx([l[0]<0?-1:1,0],l),Jft(T4(s)))}function e5(r,t,e){var n=e.type,i=e.labelAlign,a=Zc(r,e),s=LN(t),o=LN(T4(gx([1,0],a))),l="center",u="middle";return n==="linear"?[90,270].includes(o)&&s===0?(l="center",u=a[1]===1?"top":"bottom"):!(o%180)&&[90,270].includes(s)?l="center":o===0?(Fn(s,0,90,!1,!0)||Fn(s,0,90)||Fn(s,270,360))&&(l="start"):o===90?Fn(s,0,90,!1,!0)?l="start":(Fn(s,90,180)||Fn(s,270,360))&&(l="end"):o===270?Fn(s,0,90,!1,!0)?l="end":(Fn(s,90,180)||Fn(s,270,360))&&(l="start"):o===180&&(s===90?l="start":(Fn(s,0,90)||Fn(s,270,360))&&(l="end")):i==="parallel"?Fn(o,0,180,!0)?u="top":u="bottom":i==="horizontal"?Fn(o,90,270,!1)?l="end":(Fn(o,270,360,!1)||Fn(o,0,90))&&(l="start"):i==="perpendicular"&&(Fn(o,90,270)?l="end":l="start"),{textAlign:l,textBaseline:u}}function tgt(r,t,e){t.setLocalEulerAngles(r);var n=t.__data__.value,i=e5(n,r,e),a=t.querySelector(ye.labelItem.class);a&&n5(a,i)}function IN(r,t,e){var n=e.showTick,i=e.tickLength,a=e.tickDirection,s=e.labelDirection,o=e.labelSpacing,l=t.indexOf(r),u=gi(o,[r,l,t]),c=z([Zc(r.value,e),Zft(s,a)],2),h=c[0],d=c[1],g=d===1?gi(n?i:0,[r,l,t]):0,p=z(Yu(Aa(h,u+g),E0(r.value,e)),2),v=p[0],m=p[1];return{x:v,y:m}}function egt(r,t,e,n){var i=n.labelFormatter,a=Et(i)?function(){return Ga(gi(i,[r,t,e,Zc(r.value,n)]))}:function(){return Ga(r.label||"")};return a}function n5(r,t){r.nodeName==="text"&&r.attr(t)}function DN(r){Kft(this.node().childNodes,r,{hide:Ri,show:Xc,rotate:function(t,e){tgt(+e,t,r)},ellipsis:function(t,e,n){t&&ux(t,e||1/0,n)},wrap:function(t,e,n){t&&Fht(t,e,n)},getTextShape:function(t){return t.querySelector("text")}})}function FN(r,t,e,n,i){var a=e.indexOf(t),s=_t(r).append(egt(t,a,e,i)).attr("className",ye.labelItem.name).node(),o=z(Va(X4(n,[t,a,e])),2),l=o[0],u=o[1],c=u.transform,h=Je(u,["transform"]);L4(s,c);var d=Qft(t,s,i);return s.getLocalEulerAngles()||s.setLocalEulerAngles(d),n5(s,et(et({},e5(t.value,d,i)),l)),r.attr(h),s}function ngt(r,t,e,n){var i=HE(t,e.labelFilter),a=Nt(e,"label");return r.selectAll(ye.label.class).data(i,function(s,o){return o}).join(function(s){return s.append("g").attr("className",ye.label.name).transition(function(o){FN(this,o,t,a,e);var l=IN(o,t,e),u=l.x,c=l.y;return this.style.transform="translate(".concat(u,", ").concat(c,")"),null}).call(function(){DN.call(r,e)})},function(s){return s.transition(function(o){var l=this.querySelector(ye.labelItem.class),u=FN(this,o,t,a,e),c=cft(l,u,n.update),h=IN(o,t,e),d=h.x,g=h.y,p=Li(this,{transform:"translate(".concat(d,", ").concat(g,")")},n.update);return vt(vt([],z(c),!1),[p],!1)}).call(function(o){var l=sr(o,"_transitions").flat().filter(C4);lft(l,function(){DN.call(r,e)})})},function(s){return s.transition(function(){var o=this,l=w0(this.childNodes[0],n.exit);return su(l,function(){return _t(o).remove()}),l})}).transitions()}function r5(r,t){return UE(r,t.tickDirection,t)}function rgt(r,t){var e=z(r,2),n=e[0],i=e[1];return[[0,0],[n*t,i*t]]}function igt(r,t,e,n,i){var a=i.tickLength,s=z(rgt(n,gi(a,[r,t,e])),2),o=z(s[0],2),l=o[0],u=o[1],c=z(s[1],2),h=c[0],d=c[1];return{x1:l,x2:h,y1:u,y2:d}}function agt(r,t,e,n,i){var a=i.tickFormatter,s=r5(t.value,i),o="line";return Et(a)&&(o=function(){return gi(a,[t,e,n,s])}),r.append(o).attr("className",ye.tickItem.name)}function sgt(r,t,e,n,i,a,s){var o=r5(r.value,a),l=igt(r,t,e,o,a),u=l.x1,c=l.x2,h=l.y1,d=l.y2,g=z(Va(X4(s,[r,t,e,o])),2),p=g[0],v=g[1];n.node().nodeName==="line"&&n.styles(et({x1:u,x2:c,y1:h,y2:d},p)),i.attr(v),n.styles(p)}function BN(r,t,e,n,i,a){var s=agt(_t(this),r,t,e,n);sgt(r,t,e,s,this,n,i);var o=z(E0(r.value,n),2),l=o[0],u=o[1];return Li(this,{transform:"translate(".concat(l,", ").concat(u,")")},a)}function ogt(r,t,e,n){var i=HE(t,e.tickFilter),a=Nt(e,"tick");return r.selectAll(ye.tick.class).data(i,function(s){return s.id||s.label}).join(function(s){return s.append("g").attr("className",ye.tick.name).transition(function(o,l){return BN.call(this,o,l,i,e,a,!1)})},function(s){return s.transition(function(o,l){return this.removeChildren(),BN.call(this,o,l,i,e,a,n.update)})},function(s){return s.transition(function(){var o=this,l=w0(this.childNodes[0],n.exit);return su(l,function(){return o.remove()}),l})}).transitions()}var zN=zi({text:"text"},"title");function S0(r){return/\S+-\S+/g.test(r)?r.split("-").map(function(t){return t[0]}):r.length>2?[r[0]]:r.split("")}function lgt(r,t){var e=r.attributes,n=e.position,i=e.spacing,a=e.inset,s=e.text,o=r.getBBox(),l=t.getBBox(),u=S0(n),c=z(jn(s?i:0),4),h=c[0],d=c[1],g=c[2],p=c[3],v=z(jn(a),4),m=v[0],b=v[1],w=v[2],x=v[3],_=z([p+d,h+g],2),S=_[0],M=_[1],k=z([x+b,m+w],2),T=k[0],P=k[1];if(u[0]==="l")return new ur(o.x,o.y,l.width+o.width+S+T,Math.max(l.height+P,o.height));if(u[0]==="t")return new ur(o.x,o.y,Math.max(l.width+T,o.width),l.height+o.height+M+P);var O=z([t.attributes.width||l.width,t.attributes.height||l.height],2),A=O[0],R=O[1];return new ur(l.x,l.y,A+o.width+S+T,R+o.height+M+P)}function ugt(r,t){var e=Object.entries(t).reduce(function(n,i){var a=z(i,2),s=a[0],o=a[1],l=r.node().attr(s);return l||(n[s]=o),n},{});r.styles(e)}function cgt(r){var t,e,n,i,a=r,s=a.width,o=a.height,l=a.position,u=z([+s/2,+o/2],2),c=u[0],h=u[1],d=z([+c,+h,"center","middle"],4),g=d[0],p=d[1],v=d[2],m=d[3],b=S0(l);return b.includes("l")&&(t=z([0,"start"],2),g=t[0],v=t[1]),b.includes("r")&&(e=z([+s,"end"],2),g=e[0],v=e[1]),b.includes("t")&&(n=z([0,"top"],2),p=n[0],m=n[1]),b.includes("b")&&(i=z([+o,"bottom"],2),p=i[0],m=i[1]),{x:g,y:p,textAlign:v,textBaseline:m}}var hgt=function(r){Ht(t,r);function t(e){return r.call(this,e,{text:"",width:0,height:0,fill:"#4a505a",fontWeight:"bold",fontSize:12,fontFamily:"sans-serif",inset:0,spacing:0,position:"top-left"})||this}return t.prototype.getAvailableSpace=function(){var e=this,n=this.attributes,i=n.width,a=n.height,s=n.position,o=n.spacing,l=n.inset,u=e.querySelector(zN.text.class);if(!u)return new ur(0,0,+i,+a);var c=u.getBBox(),h=c.width,d=c.height,g=z(jn(o),4),p=g[0],v=g[1],m=g[2],b=g[3],w=z([0,0,+i,+a],4),x=w[0],_=w[1],S=w[2],M=w[3],k=S0(s);if(k.includes("i"))return new ur(x,_,S,M);k.forEach(function($,B){var F,V,X,K;$==="t"&&(F=z(B===0?[d+m,+a-d-m]:[0,+a],2),_=F[0],M=F[1]),$==="r"&&(V=z([+i-h-b],1),S=V[0]),$==="b"&&(X=z([+a-d-p],1),M=X[0]),$==="l"&&(K=z(B===0?[h+v,+i-h-v]:[0,+i],2),x=K[0],S=K[1])});var T=z(jn(l),4),P=T[0],O=T[1],A=T[2],R=T[3],L=z([R+O,P+A],2),q=L[0],j=L[1];return new ur(x+R,_+P,S-q,M-j)},t.prototype.getBBox=function(){return this.title?this.title.getBBox():new ur(0,0,0,0)},t.prototype.render=function(e,n){var i=this;e.width,e.height,e.position,e.spacing;var a=Je(e,["width","height","position","spacing"]),s=z(Va(a),1),o=s[0],l=cgt(e),u=l.x,c=l.y,h=l.textAlign,d=l.textBaseline;Ur(!!a.text,_t(n),function(g){i.title=g.maybeAppendByClassName(zN.text,"text").styles(o).call(ugt,{x:u,y:c,textAlign:h,textBaseline:d}).node()})},t}(Qe);function dgt(r,t,e){var n=e.titlePosition,i=n===void 0?"lb":n,a=e.titleSpacing,s=S0(i),o=r.node().getLocalBounds(),l=z(o.min,2),u=l[0],c=l[1],h=z(o.halfExtents,2),d=h[0],g=h[1],p=z(t.node().getLocalBounds().halfExtents,2),v=p[0],m=p[1],b=z([u+d,c+g],2),w=b[0],x=b[1],_=z(jn(a),4),S=_[0],M=_[1],k=_[2],T=_[3];if(["start","end"].includes(i)&&e.type==="linear"){var P=e.startPos,O=e.endPos,A=z(i==="start"?[P,O]:[O,P],2),R=A[0],L=A[1],q=R4([-L[0]+R[0],-L[1]+R[1]]),j=z(Aa(q,S),2),$=j[0],B=j[1];return{x:R[0]+$,y:R[1]+B}}return s.includes("t")&&(x-=g+m+S),s.includes("r")&&(w+=d+v+M),s.includes("l")&&(w-=d+v+T),s.includes("b")&&(x+=g+m+k),{x:w,y:x}}function fgt(r,t,e){var n=r.getGeometryBounds().halfExtents,i=n[1]*2;if(t==="vertical"){if(e==="left")return"rotate(-90) translate(0, ".concat(i/2,")");if(e==="right")return"rotate(-90) translate(0, -".concat(i/2,")")}return""}function $N(r,t,e,n,i){var a=Nt(n,"title"),s=z(Va(a),2),o=s[0],l=s[1],u=l.transform,c=l.transformOrigin,h=Je(l,["transform","transformOrigin"]);t.styles(h);var d=u||fgt(r.node(),o.direction,o.position);r.styles(et(et({},o),{transformOrigin:c})),L4(r.node(),d);var g=dgt(_t(e._offscreen||e.querySelector(ye.mainGroup.class)),t,n),p=g.x,v=g.y,m=Li(t.node(),{transform:"translate(".concat(p,", ").concat(v,")")},i);return m}function ggt(r,t,e,n){var i=e.titleText;return r.selectAll(ye.title.class).data([{title:i}].filter(function(a){return!!a.title}),function(a,s){return a.title}).join(function(a){return a.append(function(){return Ga(i)}).attr("className",ye.title.name).transition(function(){return $N(_t(this),r,t,e,n.enter)})},function(a){return a.transition(function(){return $N(_t(this),r,t,e,n.update)})},function(a){return a.remove()}).transitions()}function jN(r,t,e,n){var i=r.showLine,a=r.showTick,s=r.showLabel,o=t.maybeAppendByClassName(ye.lineGroup,"g"),l=Ur(i,o,function(g){return Oft(g,r,n)})||[],u=t.maybeAppendByClassName(ye.tickGroup,"g"),c=Ur(a,u,function(g){return ogt(g,e,r,n)})||[],h=t.maybeAppendByClassName(ye.labelGroup,"g"),d=Ur(s,h,function(g){return ngt(g,e,r,n)})||[];return vt(vt(vt([],z(l),!1),z(c),!1),z(d),!1).filter(function(g){return!!g})}var pgt=function(r){Ht(t,r);function t(e){return r.call(this,e,VE)||this}return t.prototype.render=function(e,n,i){var a=this,s=e.titleText,o=e.data,l=e.animate,u=e.showTitle,c=e.showGrid,h=e.dataThreshold,d=e.truncRange,g=Yht(o,h).filter(function(S){var M=S.value;return!(d&&M>d[0]&&M<d[1])}),p=PN(i===void 0?l:i),v=_t(n).maybeAppendByClassName(ye.gridGroup,"g"),m=Ur(c,v,function(S){return Nft(S,g,e,p)})||[],b=_t(n).maybeAppendByClassName(ye.mainGroup,"g");s&&(!this.initialized&&p.enter||this.initialized&&p.update)&&jN(e,_t(this.offscreenGroup),g,PN(!1));var w=jN(e,_t(b.node()),g,p),x=_t(n).maybeAppendByClassName(ye.titleGroup,"g"),_=Ur(u,x,function(S){return ggt(S,a,e,p)})||[];return vt(vt(vt([],z(m),!1),z(w),!1),z(_),!1).flat().filter(function(S){return!!S})},t}(Qe),ui=zi({prevBtnGroup:"prev-btn-group",prevBtn:"prev-btn",nextBtnGroup:"next-btn-group",nextBtn:"next-btn",pageInfoGroup:"page-info-group",pageInfo:"page-info",playWindow:"play-window",contentGroup:"content-group",controller:"controller",clipPath:"clip-path"},"navigator"),vgt=function(r){Ht(t,r);function t(e){var n=r.call(this,e,{x:0,y:0,animate:{easing:"linear",duration:200,fill:"both"},buttonCursor:"pointer",buttonFill:"black",buttonD:Sdt(0,0,6),buttonSize:12,controllerPadding:5,controllerSpacing:5,formatter:function(i,a){return"".concat(i,"/").concat(a)},defaultPage:0,loop:!1,orientation:"horizontal",pageNumFill:"black",pageNumFontSize:12,pageNumTextAlign:"start",pageNumTextBaseline:"middle"})||this;return n.playState="idle",n.contentGroup=n.appendChild(new _n({class:ui.contentGroup.name})),n.playWindow=n.contentGroup.appendChild(new _n({class:ui.playWindow.name})),n.innerCurrPage=n.defaultPage,n}return Object.defineProperty(t.prototype,"defaultPage",{get:function(){var e=this.attributes.defaultPage;return He(e,0,Math.max(this.pageViews.length-1,0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageViews",{get:function(){return this.playWindow.children},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"controllerShape",{get:function(){return this.totalPages>1?{width:55,height:0}:{width:0,height:0}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageShape",{get:function(){var e=this.pageViews,n=z(adt(e.map(function(h){var d=h.getBBox(),g=d.width,p=d.height;return[g,p]})).map(function(h){return Math.max.apply(Math,vt([],z(h),!1))}),2),i=n[0],a=n[1],s=this.attributes,o=s.pageWidth,l=o===void 0?i:o,u=s.pageHeight,c=u===void 0?a:u;return{pageWidth:l,pageHeight:c}},enumerable:!1,configurable:!0}),t.prototype.getContainer=function(){return this.playWindow},Object.defineProperty(t.prototype,"totalPages",{get:function(){return this.pageViews.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currPage",{get:function(){return this.innerCurrPage},enumerable:!1,configurable:!0}),t.prototype.getBBox=function(){var e=r.prototype.getBBox.call(this),n=e.x,i=e.y,a=this.controllerShape,s=this.pageShape,o=s.pageWidth,l=s.pageHeight;return new ur(n,i,o+a.width,l)},t.prototype.goTo=function(e){var n=this,i=this.attributes.animate,a=this,s=a.currPage,o=a.playState,l=a.playWindow,u=a.pageViews;if(o!=="idle"||e<0||u.length<=0||e>=u.length)return null;u[s].setLocalPosition(0,0),this.prepareFollowingPage(e);var c=z(this.getFollowingPageDiff(e),2),h=c[0],d=c[1];this.playState="running";var g=G4(l,[{transform:"translate(0, 0)"},{transform:"translate(".concat(-h,", ").concat(-d,")")}],i);return su(g,function(){n.innerCurrPage=e,n.playState="idle",n.setVisiblePages([e]),n.updatePageInfo()}),g},t.prototype.prev=function(){var e=this.attributes.loop,n=this.pageViews.length,i=this.currPage;if(!e&&i<=0)return null;var a=e?(i-1+n)%n:He(i-1,0,n);return this.goTo(a)},t.prototype.next=function(){var e=this.attributes.loop,n=this.pageViews.length,i=this.currPage;if(!e&&i>=n-1)return null;var a=e?(i+1)%n:He(i+1,0,n);return this.goTo(a)},t.prototype.renderClipPath=function(e){var n=this.pageShape,i=n.pageWidth,a=n.pageHeight;if(!i||!a){this.contentGroup.style.clipPath=void 0;return}this.clipPath=e.maybeAppendByClassName(ui.clipPath,"rect").styles({width:i,height:a}),this.contentGroup.attr("clipPath",this.clipPath.node())},t.prototype.setVisiblePages=function(e){this.playWindow.children.forEach(function(n,i){e.includes(i)?Xc(n):Ri(n)})},t.prototype.adjustControllerLayout=function(){var e=this,n=e.prevBtnGroup,i=e.nextBtnGroup,a=e.pageInfoGroup,s=this.attributes,o=s.orientation,l=s.controllerPadding,u=a.getBBox(),c=u.width;u.height;var h=z(o==="horizontal"?[-180,0]:[-90,90],2),d=h[0],g=h[1];n.setLocalEulerAngles(d),i.setLocalEulerAngles(g);var p=n.getBBox(),v=p.width,m=p.height,b=i.getBBox(),w=b.width,x=b.height,_=Math.max(v,c,w),S=o==="horizontal"?{offset:[[0,0],[v/2+l,0],[v+c+l*2,0]],textAlign:"start"}:{offset:[[_/2,-m-l],[_/2,0],[_/2,x+l]],textAlign:"center"},M=z(S.offset,3),k=z(M[0],2),T=k[0],P=k[1],O=z(M[1],2),A=O[0],R=O[1],L=z(M[2],2),q=L[0],j=L[1],$=S.textAlign,B=a.querySelector("text");B&&(B.style.textAlign=$),n.setLocalPosition(T,P),a.setLocalPosition(A,R),i.setLocalPosition(q,j)},t.prototype.updatePageInfo=function(){var e,n=this,i=n.currPage,a=n.pageViews,s=n.attributes.formatter;a.length<2||((e=this.pageInfoGroup.querySelector(ui.pageInfo.class))===null||e===void 0||e.attr("text",s(i+1,a.length)),this.adjustControllerLayout())},t.prototype.getFollowingPageDiff=function(e){var n=this.currPage;if(n===e)return[0,0];var i=this.attributes.orientation,a=this.pageShape,s=a.pageWidth,o=a.pageHeight,l=e<n?-1:1;return i==="horizontal"?[l*s,0]:[0,l*o]},t.prototype.prepareFollowingPage=function(e){var n=this,i=n.currPage,a=n.pageViews;if(this.setVisiblePages([e,i]),e!==i){var s=z(this.getFollowingPageDiff(e),2),o=s[0],l=s[1];a[e].setLocalPosition(o,l)}},t.prototype.renderController=function(e){var n=this,i=this.attributes.controllerSpacing,a=this.pageShape,s=a.pageWidth,o=a.pageHeight,l=this.pageViews.length>=2,u=e.maybeAppendByClassName(ui.controller,"g");if(b0(u.node(),l),!!l){var c=Nt(this.attributes,"button"),h=Nt(this.attributes,"pageNum"),d=z(Va(c),2),g=d[0],p=d[1],v=g.size,m=Je(g,["size"]),b=!u.select(ui.prevBtnGroup.class).node(),w=u.maybeAppendByClassName(ui.prevBtnGroup,"g").styles(p);this.prevBtnGroup=w.node();var x=w.maybeAppendByClassName(ui.prevBtn,"path"),_=u.maybeAppendByClassName(ui.nextBtnGroup,"g").styles(p);this.nextBtnGroup=_.node();var S=_.maybeAppendByClassName(ui.nextBtn,"path");[x,S].forEach(function(k){k.styles(et(et({},m),{transformOrigin:"center"})),zE(k.node(),v)});var M=u.maybeAppendByClassName(ui.pageInfoGroup,"g");this.pageInfoGroup=M.node(),M.maybeAppendByClassName(ui.pageInfo,"text").styles(h),this.updatePageInfo(),u.node().setLocalPosition(s+i,o/2),b&&(this.prevBtnGroup.addEventListener("click",function(){n.prev()}),this.nextBtnGroup.addEventListener("click",function(){n.next()}))}},t.prototype.render=function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s;this.attr("transform","translate(".concat(a,", ").concat(o,")"));var l=_t(n);this.renderClipPath(l),this.renderController(l),this.setVisiblePages([this.defaultPage]),this.goTo(this.defaultPage)},t.prototype.bindEvents=function(){var e=this,n=Oc(function(){return e.render(e.attributes,e)},50);this.playWindow.addEventListener(Xt.INSERTED,n),this.playWindow.addEventListener(Xt.REMOVED,n)},t}(Qe);function mgt(r,t,e){var n=1.4,i=n*e;return[["M",r-e,t-i],["L",r+e,t-i],["L",r+e,t+i],["L",r-e,t+i],["Z"]]}var i5=1.4,a5=.4;function ygt(r,t,e){var n=e,i=n*i5,a=n/2,s=n/6,o=r+i*a5;return[["M",r,t],["L",o,t+a],["L",r+i,t+a],["L",r+i,t-a],["L",o,t-a],["Z"],["M",o,t+s],["L",r+i-2,t+s],["M",o,t-s],["L",r+i-2,t-s]]}function bgt(r,t,e){var n=e,i=n*i5,a=n/2,s=n/6,o=t+i*a5;return[["M",r,t],["L",r-a,o],["L",r-a,t+i],["L",r+a,t+i],["L",r+a,o],["Z"],["M",r-s,o],["L",r-s,t+i-2],["M",r+s,o],["L",r+s,t+i-2]]}xe.registerSymbol("hiddenHandle",mgt);xe.registerSymbol("verticalHandle",ygt);xe.registerSymbol("horizontalHandle",bgt);function px(r,t,e){return r===void 0&&(r="horizontal"),r==="horizontal"?t:e}var Fr=zi({layout:"flex",markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label",valueGroup:"value-group",value:"value",backgroundGroup:"background-group",background:"background"},"legend-category-item");function wgt(r){var t=r.querySelector(Fr.marker.class);return t?t.style:{}}var xgt=function(r){Ht(t,r);function t(e){return r.call(this,e,{span:[1,1],marker:function(){return new Ha({style:{r:6}})},markerSize:10,labelFill:"#646464",valueFill:"#646464",labelFontSize:12,valueFontSize:12,labelTextBaseline:"middle",valueTextBaseline:"middle"})||this}return Object.defineProperty(t.prototype,"showValue",{get:function(){var e=this.attributes.valueText;return e?typeof e=="string"||typeof e=="number"?e!=="":typeof e=="function"?!0:e.attr("text")!=="":!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"actualSpace",{get:function(){var e=this.labelGroup,n=this.valueGroup,i=this.attributes.markerSize,a=e.node().getBBox(),s=a.width,o=a.height,l=n.node().getBBox(),u=l.width,c=l.height;return{markerWidth:i,labelWidth:s,valueWidth:u,height:Math.max(i,o,c)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"span",{get:function(){var e=this.attributes.span;if(!e)return[1,1];var n=z(jn(e),2),i=n[0],a=n[1],s=this.showValue?a:0,o=i+s;return[i/o,s/o]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shape",{get:function(){var e,n=this.attributes,i=n.markerSize,a=n.width,s=this.actualSpace,o=s.markerWidth,l=s.height,u=this.actualSpace,c=u.labelWidth,h=u.valueWidth,d=z(this.spacing,2),g=d[0],p=d[1];if(a){var v=a-i-g-p,m=z(this.span,2),b=m[0],w=m[1];e=z([b*v,w*v],2),c=e[0],h=e[1]}var x=o+c+h+g+p;return{width:x,height:l,markerWidth:o,labelWidth:c,valueWidth:h}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"spacing",{get:function(){var e=this.attributes.spacing;if(!e)return[0,0];var n=z(jn(e),2),i=n[0],a=n[1];return this.showValue?[i,a]:[i,0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layout",{get:function(){var e=this.shape,n=e.markerWidth,i=e.labelWidth,a=e.valueWidth,s=e.width,o=e.height,l=z(this.spacing,2),u=l[0],c=l[1];return{height:o,width:s,markerWidth:n,labelWidth:i,valueWidth:a,position:[n/2,n+u,n+i+u+c]}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleSize",{get:function(){var e=wgt(this.markerGroup.node()),n=this.attributes,i=n.markerSize,a=n.markerStrokeWidth,s=a===void 0?e.strokeWidth:a,o=n.markerLineWidth,l=o===void 0?e.lineWidth:o,u=n.markerStroke,c=u===void 0?e.stroke:u,h=+(s||l||(c?1:0))*Math.sqrt(2),d=this.markerGroup.node().getBBox(),g=d.width,p=d.height;return(1-h/Math.max(g,p))*i},enumerable:!1,configurable:!0}),t.prototype.renderMarker=function(e){var n=this,i=this.attributes.marker,a=Nt(this.attributes,"marker");this.markerGroup=e.maybeAppendByClassName(Fr.markerGroup,"g").style("zIndex",0),Ur(!!i,this.markerGroup,function(){var s,o=n.markerGroup.node(),l=(s=o.childNodes)===null||s===void 0?void 0:s[0],u=typeof i=="string"?new xe({style:{symbol:i},className:Fr.marker.name}):i();l?u.nodeName===l.nodeName?l instanceof xe?l.update(et(et({},a),{symbol:i})):(tdt(l,u),_t(l).styles(a)):(l.remove(),_t(u).attr("className",Fr.marker.name).styles(a),o.appendChild(u)):(u instanceof xe||_t(u).attr("className",Fr.marker.name).styles(a),o.appendChild(u)),n.markerGroup.node().scale(1/n.markerGroup.node().getScale()[0]);var c=zE(n.markerGroup.node(),n.scaleSize);n.markerGroup.node().style._transform="scale(".concat(c,")")})},t.prototype.renderLabel=function(e){var n=Nt(this.attributes,"label"),i=n.text,a=Je(n,["text"]);this.labelGroup=e.maybeAppendByClassName(Fr.labelGroup,"g").style("zIndex",0),this.labelGroup.maybeAppendByClassName(Fr.label,function(){return Ga(i)}).styles(a)},t.prototype.renderValue=function(e){var n=this,i=Nt(this.attributes,"value"),a=i.text,s=Je(i,["text"]);this.valueGroup=e.maybeAppendByClassName(Fr.valueGroup,"g").style("zIndex",0),Ur(this.showValue,this.valueGroup,function(){n.valueGroup.maybeAppendByClassName(Fr.value,function(){return Ga(a)}).styles(s)})},t.prototype.renderBackground=function(e){var n=this.shape,i=n.width,a=n.height,s=Nt(this.attributes,"background");this.background=e.maybeAppendByClassName(Fr.backgroundGroup,"g").style("zIndex",-1),this.background.maybeAppendByClassName(Fr.background,"rect").styles(et({width:i,height:a},s))},t.prototype.adjustLayout=function(){var e=this.layout,n=e.labelWidth,i=e.valueWidth,a=e.height,s=z(e.position,3),o=s[0],l=s[1],u=s[2],c=a/2;this.markerGroup.styles({transform:"translate(".concat(o,", ").concat(c,")").concat(this.markerGroup.node().style._transform)}),this.labelGroup.styles({transform:"translate(".concat(l,", ").concat(c,")")}),ux(this.labelGroup.select(Fr.label.class).node(),Math.ceil(n)),this.showValue&&(this.valueGroup.styles({transform:"translate(".concat(u,", ").concat(c,")")}),ux(this.valueGroup.select(Fr.value.class).node(),Math.ceil(i)))},t.prototype.render=function(e,n){var i=_t(n),a=e.x,s=a===void 0?0:a,o=e.y,l=o===void 0?0:o;i.styles({transform:"translate(".concat(s,", ").concat(l,")")}),this.renderMarker(i),this.renderLabel(i),this.renderValue(i),this.renderBackground(i),this.adjustLayout()},t}(Qe),go=zi({page:"item-page",navigator:"navigator",item:"item"},"items"),qN=function(r,t,e){return e===void 0&&(e=!0),r?t(r):e},Egt=function(r){Ht(t,r);function t(e){var n=r.call(this,e,{data:[],gridRow:1/0,gridCol:void 0,padding:0,width:1e3,height:100,rowPadding:0,colPadding:0,layout:"flex",orientation:"horizontal",click:fv,mouseenter:fv,mouseleave:fv})||this;return n.navigatorShape=[0,0],n}return Object.defineProperty(t.prototype,"pageViews",{get:function(){return this.navigator.getContainer()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"grid",{get:function(){var e=this.attributes,n=e.gridRow,i=e.gridCol,a=e.data;if(!n&&!i)throw new Error("gridRow and gridCol can not be set null at the same time");return n&&i?[n,i]:n?[n,a.length]:[a.length,i]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderData",{get:function(){var e=this.attributes,n=e.data,i=e.layout,a=Nt(this.attributes,"item"),s=n.map(function(o,l){var u=o.id,c=u===void 0?l:u,h=o.label,d=o.value;return{id:"".concat(c),index:l,style:et({layout:i,labelText:h,valueText:d},Object.fromEntries(Object.entries(a).map(function(g){var p=z(g,2),v=p[0],m=p[1];return[v,gi(m,[o,l,n])]})))}});return s},enumerable:!1,configurable:!0}),t.prototype.getGridLayout=function(){var e=this,n=this.attributes,i=n.orientation,a=n.width,s=n.rowPadding,o=n.colPadding,l=z(this.navigatorShape,1),u=l[0],c=z(this.grid,2),h=c[0],d=c[1],g=d*h,p=0;return this.pageViews.children.map(function(v,m){var b,w,x=Math.floor(m/g),_=m%g,S=e.ifHorizontal(d,h),M=[Math.floor(_/S),_%S];i==="vertical"&&M.reverse();var k=z(M,2),T=k[0],P=k[1],O=(a-u-(d-1)*o)/d,A=v.getBBox().height,R=z([0,0],2),L=R[0],q=R[1];return i==="horizontal"?(b=z([p,T*(A+s)],2),L=b[0],q=b[1],p=P===d-1?0:p+O+o):(w=z([P*(O+o),p],2),L=w[0],q=w[1],p=T===h-1?0:p+A+s),{page:x,index:m,row:T,col:P,pageIndex:_,width:O,height:A,x:L,y:q}})},t.prototype.getFlexLayout=function(){var e=this.attributes,n=e.width,i=e.height,a=e.rowPadding,s=e.colPadding,o=z(this.navigatorShape,1),l=o[0],u=z(this.grid,2),c=u[0],h=u[1],d=z([n-l,i],2),g=d[0],p=d[1],v=z([0,0,0,0,0,0,0,0],8),m=v[0],b=v[1],w=v[2],x=v[3],_=v[4],S=v[5],M=v[6],k=v[7];return this.pageViews.children.map(function(T,P){var O,A,R,L,q=T.getBBox(),j=q.width,$=q.height,B=M===0?0:s,F=M+B+j;if(F<=g&&qN(_,function(X){return X<h}))return O=z([M+B,k,F],3),m=O[0],b=O[1],M=O[2],{width:j,height:$,x:m,y:b,page:w,index:P,pageIndex:x++,row:S,col:_++};A=z([S+1,0,0,k+$+a],4),S=A[0],_=A[1],M=A[2],k=A[3];var V=k+$;return V<=p&&qN(S,function(X){return X<c})?(R=z([M,k,j],3),m=R[0],b=R[1],M=R[2],{width:j,height:$,x:m,y:b,page:w,index:P,pageIndex:x++,row:S,col:_++}):(L=z([0,0,j,0,w+1,0,0,0],8),m=L[0],b=L[1],M=L[2],k=L[3],w=L[4],x=L[5],S=L[6],_=L[7],{width:j,height:$,x:m,y:b,page:w,index:P,pageIndex:x++,row:S,col:_++})})},Object.defineProperty(t.prototype,"itemsLayout",{get:function(){this.navigatorShape=[0,0];var e=this.attributes.layout==="grid"?this.getGridLayout:this.getFlexLayout,n=e.call(this);return n.slice(-1)[0].page>0?(this.navigatorShape=[55,0],e.call(this)):n},enumerable:!1,configurable:!0}),t.prototype.ifHorizontal=function(e,n){var i=this.attributes.orientation;return px(i,e,n)},t.prototype.flattenPage=function(e){e.querySelectorAll(go.item.class).forEach(function(n){e.appendChild(n)}),e.querySelectorAll(go.page.class).forEach(function(n){var i=e.removeChild(n);i.destroy()})},t.prototype.renderItems=function(e){var n=this.attributes,i=n.click,a=n.mouseenter,s=n.mouseleave;this.flattenPage(e);var o=this.dispatchCustomEvent.bind(this);_t(e).selectAll(go.item.class).data(this.renderData,function(l){return l.id}).join(function(l){return l.append(function(u){var c=u.style;return new xgt({style:c})}).attr("className",go.item.name).on("click",function(){i==null||i(this),o("itemClick",{item:this})}).on("pointerenter",function(){a==null||a(this),o("itemMouseenter",{item:this})}).on("pointerleave",function(){s==null||s(this),o("itemMouseleave",{item:this})})},function(l){return l.each(function(u){var c=u.style;this.update(c)})},function(l){return l.remove()})},t.prototype.relayoutNavigator=function(){var e,n=this.attributes,i=n.layout,a=n.width,s=((e=this.pageViews.children[0])===null||e===void 0?void 0:e.getBBox().height)||0,o=z(this.navigatorShape,2),l=o[0],u=o[1];this.navigator.update(i==="grid"?{pageWidth:a-l,pageHeight:s-u}:{})},t.prototype.adjustLayout=function(){var e=this,n=Object.entries(Bht(this.itemsLayout,"page")).map(function(a){var s=z(a,2),o=s[0],l=s[1];return{page:o,layouts:l}}),i=vt([],z(this.navigator.getContainer().children),!1);n.forEach(function(a){var s=a.layouts,o=e.pageViews.appendChild(new _n({className:go.page.name}));s.forEach(function(l){var u=l.x,c=l.y,h=l.index,d=l.width,g=l.height,p=i[h];o.appendChild(p),uc(p,"__layout__",l),p.update({x:u,y:c,width:d,height:g})})}),this.relayoutNavigator()},t.prototype.renderNavigator=function(e){var n=this.attributes.orientation,i=Nt(this.attributes,"nav"),a=Pn({orientation:n},i),s=this;return e.selectAll(go.navigator.class).data(["nav"]).join(function(o){return o.append(function(){return new vgt({style:a})}).attr("className",go.navigator.name).each(function(){s.navigator=this})},function(o){return o.each(function(){this.update(a)})},function(o){return o.remove()}),this.navigator},t.prototype.getBBox=function(){return this.navigator.getBBox()},t.prototype.render=function(e,n){var i=this.attributes.data;if(!(!i||i.length===0)){var a=this.renderNavigator(_t(n));this.renderItems(a.getContainer()),this.adjustLayout()}},t.prototype.dispatchCustomEvent=function(e,n){var i=new cn(e,{detail:n});this.dispatchEvent(i)},t}(Qe),Pu=zi({markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label"},"handle"),s5={showLabel:!0,formatter:function(r){return r.toString()},markerSize:25,markerStroke:"#c5c5c5",markerFill:"#fff",markerLineWidth:1,labelFontSize:12,labelFill:"#c5c5c5",labelText:"",orientation:"vertical",spacing:0};(function(r){Ht(t,r);function t(e){return r.call(this,e,s5)||this}return t.prototype.render=function(e,n){var i=_t(n).maybeAppendByClassName(Pu.markerGroup,"g");this.renderMarker(i);var a=_t(n).maybeAppendByClassName(Pu.labelGroup,"g");this.renderLabel(a)},t.prototype.renderMarker=function(e){var n=this,i=this.attributes,a=i.orientation,s=i.markerSymbol,o=s===void 0?px(a,"horizontalHandle","verticalHandle"):s;Ur(!!o,e,function(l){var u=Nt(n.attributes,"marker"),c=et({symbol:o},u);n.marker=l.maybeAppendByClassName(Pu.marker,function(){return new xe({style:c})}).update(c)})},t.prototype.renderLabel=function(e){var n=this,i=this.attributes,a=i.showLabel,s=i.orientation,o=i.spacing,l=o===void 0?0:o,u=i.formatter;Ur(a,e,function(c){var h,d=Nt(n.attributes,"label"),g=d.text,p=Je(d,["text"]),v=((h=c.select(Pu.marker.class))===null||h===void 0?void 0:h.node().getBBox())||{},m=v.width,b=m===void 0?0:m,w=v.height,x=w===void 0?0:w,_=z(px(s,[0,x+l,"center","top"],[b+l,0,"start","middle"]),4),S=_[0],M=_[1],k=_[2],T=_[3];c.maybeAppendByClassName(Pu.label,"text").styles(et(et({},p),{x:S,y:M,text:u(g).toString(),textAlign:k,textBaseline:T}))})},t})(Qe);var o5={showTitle:!0,padding:0,orientation:"horizontal",backgroundFill:"transparent",titleText:"",titleSpacing:4,titlePosition:"top-left",titleFill:"#2C3542",titleFontWeight:"bold",titleFontFamily:"sans-serif",titleFontSize:12},_gt=Pn({},o5,{});Pn({},o5,Cl(s5,"handle"),{color:["#d0e3fa","#acc7f6","#8daaf2","#6d8eea","#4d73cd","#325bb1","#5a3e75","#8c3c79","#e23455","#e7655b"],indicatorBackgroundFill:"#262626",indicatorLabelFill:"white",indicatorLabelFontSize:12,indicatorVisibility:"hidden",labelAlign:"value",labelDirection:"positive",labelSpacing:5,showHandle:!0,showIndicator:!0,showLabel:!0,slidable:!0,titleText:"",type:"continuous"});var Nu=zi({title:"title",titleGroup:"title-group",items:"items",itemsGroup:"items-group",contentGroup:"content-group",ribbonGroup:"ribbon-group",ribbon:"ribbon",handlesGroup:"handles-group",handle:"handle",startHandle:"start-handle",endHandle:"end-handle",labelGroup:"label-group",label:"label",indicator:"indicator"},"legend"),Sgt=function(r){Ht(t,r);function t(e){return r.call(this,e,_gt)||this}return t.prototype.renderTitle=function(e,n,i){var a=this.attributes,s=a.showTitle,o=a.titleText,l=Nt(this.attributes,"title"),u=z(Va(l),2),c=u[0],h=u[1];this.titleGroup=e.maybeAppendByClassName(Nu.titleGroup,"g").styles(h);var d=et(et({width:n,height:i},c),{text:s?o:""});this.title=this.titleGroup.maybeAppendByClassName(Nu.title,function(){return new hgt({style:d})}).update(d)},t.prototype.renderItems=function(e,n){var i=n.x,a=n.y,s=n.width,o=n.height,l=Nt(this.attributes,"title",!0),u=z(Va(l),2),c=u[0],h=u[1],d=et(et({},c),{width:s,height:o,x:0,y:0});this.itemsGroup=e.maybeAppendByClassName(Nu.itemsGroup,"g").styles(et(et({},h),{transform:"translate(".concat(i,", ").concat(a,")")}));var g=this;this.itemsGroup.selectAll(Nu.items.class).data(["items"]).join(function(p){return p.append(function(){return new Egt({style:d})}).attr("className",Nu.items.name).each(function(){g.items=_t(this)})},function(p){return p.update(d)},function(p){return p.remove()})},t.prototype.adjustLayout=function(){var e=this.attributes.showTitle;if(e){var n=this.title.node().getAvailableSpace(),i=n.x,a=n.y;this.itemsGroup.node().style.transform="translate(".concat(i,", ").concat(a,")")}},Object.defineProperty(t.prototype,"availableSpace",{get:function(){var e=this.attributes,n=e.showTitle,i=e.width,a=e.height;return n?this.title.node().getAvailableSpace():new ur(0,0,i,a)},enumerable:!1,configurable:!0}),t.prototype.getBBox=function(){var e,n,i=(e=this.title)===null||e===void 0?void 0:e.node(),a=(n=this.items)===null||n===void 0?void 0:n.node();return!i||!a?r.prototype.getBBox.call(this):lgt(i,a)},t.prototype.render=function(e,n){var i=this.attributes,a=i.width,s=i.height,o=i.x,l=o===void 0?0:o,u=i.y,c=u===void 0?0:u,h=_t(n);n.style.transform="translate(".concat(l,", ").concat(c,")"),this.renderTitle(h,a,s),this.renderItems(h,this.availableSpace),this.adjustLayout()},t}(Qe),Mgt={backgroundFill:"#262626",backgroundLineCap:"round",backgroundLineWidth:1,backgroundStroke:"#333",backgroundZIndex:-1,formatter:function(r){return r.toString()},labelFill:"#fff",labelFontSize:12,labelTextBaseline:"middle",padding:[2,4],position:"right",radius:0,zIndex:999},Kb=zi({background:"background",labelGroup:"label-group",label:"label"},"indicator"),kgt=function(r){Ht(t,r);function t(e){var n=r.call(this,e,Mgt)||this;return n.point=[0,0],n.group=n.appendChild(new _n({})),n.isMutationObserved=!0,n}return t.prototype.renderBackground=function(){if(this.label){var e=this.attributes,n=e.position,i=e.padding,a=z(jn(i),4),s=a[0],o=a[1],l=a[2],u=a[3],c=this.label.node().getLocalBounds(),h=c.min,d=c.max,g=new ur(h[0]-u,h[1]-s,d[0]+o-h[0]+u,d[1]+l-h[1]+s),p=this.getPath(n,g),v=Nt(this.attributes,"background");this.background=_t(this.group).maybeAppendByClassName(Kb.background,"path").styles(et(et({},v),{d:p})),this.group.appendChild(this.label.node())}},t.prototype.renderLabel=function(){var e=this.attributes,n=e.formatter,i=e.labelText,a=Nt(this.attributes,"label"),s=z(Va(a),2),o=s[0],l=s[1];o.text;var u=Je(o,["text"]);if(this.label=_t(this.group).maybeAppendByClassName(Kb.labelGroup,"g").styles(l),!!i){var c=this.label.maybeAppendByClassName(Kb.label,function(){return Ga(n(i))}).style("text",n(i).toString());c.selectAll("text").styles(u)}},t.prototype.adjustLayout=function(){var e=z(this.point,2),n=e[0],i=e[1],a=this.attributes,s=a.x,o=a.y;this.group.attr("transform","translate(".concat(s-n,", ").concat(o-i,")"))},t.prototype.getPath=function(e,n){var i=this.attributes.radius,a=n.x,s=n.y,o=n.width,l=n.height,u=[["M",a+i,s],["L",a+o-i,s],["A",i,i,0,0,1,a+o,s+i],["L",a+o,s+l-i],["A",i,i,0,0,1,a+o-i,s+l],["L",a+i,s+l],["A",i,i,0,0,1,a,s+l-i],["L",a,s+i],["A",i,i,0,0,1,a+i,s],["Z"]],c={top:4,right:6,bottom:0,left:2},h=c[e],d=this.createCorner([u[h].slice(-2),u[h+1].slice(-2)]);return u.splice.apply(u,vt([h+1,1],z(d),!1)),u[0][0]="M",u},t.prototype.createCorner=function(e,n){n===void 0&&(n=10);var i=.8,a=Qht.apply(void 0,vt([],z(e),!1)),s=z(e,2),o=z(s[0],2),l=o[0],u=o[1],c=z(s[1],2),h=c[0],d=c[1],g=z(a?[h-l,[l,h]]:[d-u,[u,d]],2),p=g[0],v=z(g[1],2),m=v[0],b=v[1],w=p/2,x=p/Math.abs(p),_=n*x,S=_/2,M=_*Math.sqrt(3)/2*i,k=z([m,m+w-S,m+w,m+w+S,b],5),T=k[0],P=k[1],O=k[2],A=k[3],R=k[4];return a?(this.point=[O,u-M],[["L",T,u],["L",P,u],["L",O,u-M],["L",A,u],["L",R,u]]):(this.point=[l+M,O],[["L",l,T],["L",l,P],["L",l+M,O],["L",l,A],["L",l,R]])},t.prototype.applyVisibility=function(){var e=this.attributes.visibility;e==="hidden"?Ri(this):Xc(this)},t.prototype.bindEvents=function(){this.label.on(Xt.BOUNDS_CHANGED,this.renderBackground)},t.prototype.render=function(){this.renderLabel(),this.renderBackground(),this.adjustLayout(),this.applyVisibility()},t}(Qe);function vx(r){return r===void 0&&(r=""),{CONTAINER:"".concat(r,"tooltip"),TITLE:"".concat(r,"tooltip-title"),LIST:"".concat(r,"tooltip-list"),LIST_ITEM:"".concat(r,"tooltip-list-item"),NAME:"".concat(r,"tooltip-list-item-name"),MARKER:"".concat(r,"tooltip-list-item-marker"),NAME_LABEL:"".concat(r,"tooltip-list-item-name-label"),VALUE:"".concat(r,"tooltip-list-item-value"),CROSSHAIR_X:"".concat(r,"tooltip-crosshair-x"),CROSSHAIR_Y:"".concat(r,"tooltip-crosshair-y")}}var WN={overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"};function Tgt(r){var t;r===void 0&&(r="");var e=vx(r);return t={},t[".".concat(e.CONTAINER)]={position:"absolute",visibility:"visible","z-index":8,transition:"visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)","background-color":"rgba(255, 255, 255, 0.96)","box-shadow":"0 6px 12px 0 rgba(0, 0, 0, 0.12)","border-radius":"4px",color:"rgba(0, 0, 0, 0.65)","font-size":"12px","line-height":"20px",padding:"12px","min-width":"120px","max-width":"360px","font-family":"Roboto-Regular"},t[".".concat(e.TITLE)]={color:"rgba(0, 0, 0, 0.45)"},t[".".concat(e.LIST)]={margin:"0px","list-style-type":"none",padding:"0px"},t[".".concat(e.LIST_ITEM)]={"list-style-type":"none",display:"flex","line-height":"2em","align-items":"center","justify-content":"space-between","white-space":"nowrap"},t[".".concat(e.MARKER)]={width:"8px",height:"8px","border-radius":"50%",display:"inline-block","margin-right":"4px"},t[".".concat(e.NAME)]={display:"flex","align-items":"center","max-width":"216px"},t[".".concat(e.NAME_LABEL)]=et({flex:1},WN),t[".".concat(e.VALUE)]=et({display:"inline-block",float:"right",flex:1,"text-align":"right","min-width":"28px","margin-left":"30px",color:"rgba(0, 0, 0, 0.85)"},WN),t[".".concat(e.CROSSHAIR_X)]={position:"absolute",width:"1px","background-color":"rgba(0, 0, 0, 0.25)"},t[".".concat(e.CROSSHAIR_Y)]={position:"absolute",height:"1px","background-color":"rgba(0, 0, 0, 0.25)"},t}var Ogt=function(r){Ht(t,r);function t(e){var n=this,i,a,s=(a=(i=e.style)===null||i===void 0?void 0:i.template)===null||a===void 0?void 0:a.prefixCls,o=vx(s);return n=r.call(this,e,{data:[],x:0,y:0,visibility:"visible",title:"",position:"bottom-right",offset:[5,5],enterable:!1,container:{x:0,y:0},bounding:null,template:{prefixCls:"",container:'<div class="'.concat(o.CONTAINER,'"></div>'),title:'<div class="'.concat(o.TITLE,'"></div>'),item:'<li class="'.concat(o.LIST_ITEM,`" data-index={index}>
- <span class="`).concat(o.NAME,`">
- <span class="`).concat(o.MARKER,`" style="background:{color}"></span>
- <span class="`).concat(o.NAME_LABEL,`" title="{name}">{name}</span>
- </span>
- <span class="`).concat(o.VALUE,`" title="{value}">{value}</span>
- </li>`)},style:Tgt(s)})||this,n.timestamp=-1,n.prevCustomContentKey=n.attributes.contentKey,n.initShape(),n.render(n.attributes,n),n}return Object.defineProperty(t.prototype,"HTMLTooltipElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),t.prototype.getContainer=function(){return this.element},Object.defineProperty(t.prototype,"elementSize",{get:function(){var e=this.element.offsetWidth,n=this.element.offsetHeight;return{width:e,height:n}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HTMLTooltipItemsElements",{get:function(){var e=this.attributes,n=e.data,i=e.template;return n.map(function(a,s){var o=a.name,l=o===void 0?"":o,u=a.color,c=u===void 0?"black":u,h=a.index,d=Je(a,["name","color","index"]),g=et({name:l,color:c,index:h??s},d);return gw(MW(i.item,g))})},enumerable:!1,configurable:!0}),t.prototype.render=function(e,n){this.renderHTMLTooltipElement(),this.updatePosition()},t.prototype.destroy=function(){var e;(e=this.element)===null||e===void 0||e.remove(),r.prototype.destroy.call(this)},t.prototype.show=function(e,n){var i=this;if(e!==void 0&&n!==void 0){var a=this.element.style.visibility==="hidden",s=function(){i.attributes.x=e??i.attributes.x,i.attributes.y=n??i.attributes.y,i.updatePosition()};a?this.closeTransition(s):s()}this.element.style.visibility="visible"},t.prototype.hide=function(e,n){e===void 0&&(e=0),n===void 0&&(n=0);var i=this.attributes.enterable;i&&this.isCursorEntered(e,n)||(this.element.style.visibility="hidden")},t.prototype.initShape=function(){var e=this.attributes.template;this.element=gw(e.container),this.id&&this.element.setAttribute("id",this.id)},t.prototype.renderCustomContent=function(){if(!(this.prevCustomContentKey!==void 0&&this.prevCustomContentKey===this.attributes.contentKey)){this.prevCustomContentKey=this.attributes.contentKey;var e=this.attributes.content;e&&(typeof e=="string"?this.element.innerHTML=e:vN(this.element,e))}},t.prototype.renderHTMLTooltipElement=function(){var e,n,i=this.attributes,a=i.template,s=i.title,o=i.enterable,l=i.style,u=i.content,c=vx(a.prefixCls),h=this.element;if(this.element.style.pointerEvents=o?"auto":"none",u)this.renderCustomContent();else{s?(h.innerHTML=a.title,h.getElementsByClassName(c.TITLE)[0].innerHTML=s):(n=(e=h.getElementsByClassName(c.TITLE))===null||e===void 0?void 0:e[0])===null||n===void 0||n.remove();var d=this.HTMLTooltipItemsElements,g=document.createElement("ul");g.className=c.LIST,vN(g,d);var p=this.element.querySelector(".".concat(c.LIST));p?p.replaceWith(g):h.appendChild(g)}rdt(h,l)},t.prototype.getRelativeOffsetFromCursor=function(e){var n=this.attributes,i=n.position,a=n.offset,s=e||i,o=s.split("-"),l={left:[-1,0],right:[1,0],top:[0,-1],bottom:[0,1]},u=this.elementSize,c=u.width,h=u.height,d=[-c/2,-h/2];return o.forEach(function(g){var p=z(d,2),v=p[0],m=p[1],b=z(l[g],2),w=b[0],x=b[1];d=[v+(c/2+a[0])*w,m+(h/2+a[1])*x]}),d},t.prototype.setOffsetPosition=function(e){var n=z(e,2),i=n[0],a=n[1],s=this.attributes,o=s.x,l=o===void 0?0:o,u=s.y,c=u===void 0?0:u,h=s.container,d=h.x,g=h.y;this.element.style.left="".concat(+l+d+i,"px"),this.element.style.top="".concat(+c+g+a,"px")},t.prototype.updatePosition=function(){var e=this.attributes.showDelay,n=e===void 0?60:e,i=Date.now();this.timestamp>0&&i-this.timestamp<n||(this.timestamp=i,this.setOffsetPosition(this.autoPosition(this.getRelativeOffsetFromCursor())))},t.prototype.autoPosition=function(e){var n=z(e,2),i=n[0],a=n[1],s=this.attributes,o=s.x,l=s.y,u=s.bounding,c=s.position;if(!u)return[i,a];var h=this.element,d=h.offsetWidth,g=h.offsetHeight,p=z([+o+i,+l+a],2),v=p[0],m=p[1],b={left:"right",right:"left",top:"bottom",bottom:"top"},w=u.x,x=u.y,_=u.width,S=u.height,M={left:v<w,right:v+d>w+_,top:m<x,bottom:m+g>x+S},k=[];c.split("-").forEach(function(P){M[P]?k.push(b[P]):k.push(P)});var T=k.join("-");return this.getRelativeOffsetFromCursor(T)},t.prototype.isCursorEntered=function(e,n){if(this.element){var i=this.element.getBoundingClientRect(),a=i.x,s=i.y,o=i.width,l=i.height;return new ur(a,s,o,l).isPointIn(e,n)}return!1},t.prototype.closeTransition=function(e){var n=this,i=this.element.style.transition;this.element.style.transition="none",e(),setTimeout(function(){n.element.style.transition=i},10)},t.tag="tooltip",t}(Qe),Cgt=function(r){Ht(t,r);function t(e){var n=r.call(this,Pn({},t.defaultOptions,e))||this;return n.hoverColor="#f5f5f5",n.selectedColor="#e6f7ff",n.background=n.appendChild(new Sn({})),n.label=n.background.appendChild(new _n({})),n}return Object.defineProperty(t.prototype,"padding",{get:function(){return jn(this.style.padding)},enumerable:!1,configurable:!0}),t.prototype.renderLabel=function(){var e=this.style,n=e.label,i=e.value,a=Nt(this.attributes,"label");_t(this.label).maybeAppend(".label",function(){return Ga(n)}).attr("className","label").styles(a),this.label.attr("__data__",i)},t.prototype.renderBackground=function(){var e=this.label.getBBox(),n=z(this.padding,4),i=n[0],a=n[1],s=n[2],o=n[3],l=e.width,u=e.height,c=l+o+a,h=u+i+s,d=Nt(this.attributes,"background"),g=this.style,p=g.width,v=p===void 0?0:p,m=g.height,b=m===void 0?0:m,w=g.selected;this.background.attr(et(et({},d),{width:Math.max(c,v),height:Math.max(h,b),fill:w?this.selectedColor:"#fff"})),this.label.attr({transform:"translate(".concat(o,", ").concat((h-u)/2,")")})},t.prototype.render=function(){this.renderLabel(),this.renderBackground()},t.prototype.bindEvents=function(){var e=this;this.addEventListener("pointerenter",function(){e.style.selected||e.background.attr("fill",e.hoverColor)}),this.addEventListener("pointerleave",function(){e.style.selected||e.background.attr("fill",e.style.backgroundFill)});var n=this;this.addEventListener("click",function(){var i=e.style,a=i.label,s=i.value,o=i.onClick;o==null||o(s,{label:a,value:s},n)})},t.defaultOptions={style:{value:"",label:"",cursor:"pointer"}},t}(Qe),Agt=function(r){Ht(t,r);function t(e){var n,i,a=r.call(this,Pn({},t.defaultOptions,e))||this;a.currentValue=(n=t.defaultOptions.style)===null||n===void 0?void 0:n.defaultValue,a.isPointerInSelect=!1,a.select=a.appendChild(new Sn({className:"select",style:{cursor:"pointer",width:0,height:0}})),a.dropdown=a.appendChild(new Sn({className:"dropdown"}));var s=a.style.defaultValue;return s&&(!((i=a.style.options)===null||i===void 0)&&i.some(function(o){return o.value===s}))&&(a.currentValue=s),a}return t.prototype.setValue=function(e){this.currentValue=e,this.render()},t.prototype.getValue=function(){return this.currentValue},Object.defineProperty(t.prototype,"dropdownPadding",{get:function(){return jn(this.style.dropdownPadding)},enumerable:!1,configurable:!0}),t.prototype.renderSelect=function(){var e=this,n,i=this.style,a=i.x,s=i.y,o=i.width,l=i.height,u=i.bordered,c=i.showDropdownIcon,h=Nt(this.attributes,"select"),d=Nt(this.attributes,"placeholder");this.select.attr(et(et({x:a,y:s,width:o,height:l},h),{fill:"#fff",strokeWidth:u?1:0}));var g=this.dropdownPadding,p=10;c&&_t(this.select).maybeAppend(".dropdown-icon","path").style("d","M-5,-3.5 L0,3.5 L5,-3.5").style("transform","translate(".concat(a+o-p-g[1]-g[3],", ").concat(s+l/2,")")).style("lineWidth",1).style("stroke",this.select.style.stroke);var v=(n=this.style.options)===null||n===void 0?void 0:n.find(function(x){return x.value===e.currentValue}),m=et({x:a+g[3]},d);_t(this.select).selectAll(".placeholder").data(v?[]:[1]).join(function(x){return x.append("text").attr("className","placeholder").styles(m).style("y",function(){var _=this.getBBox();return s+(l-_.height)/2})},function(x){return x.styles(m)},function(x){return x.remove()});var b=Nt(this.attributes,"optionLabel"),w=et({x:a+g[3]},b);_t(this.select).selectAll(".value").data(v?[v]:[]).join(function(x){return x.append(function(_){return Ga(_.label)}).attr("className","value").styles(w).style("y",function(){var _=this.getBBox();return s+(l-_.height)/2})},function(x){return x.styles(w)},function(x){return x.remove()})},t.prototype.renderDropdown=function(){var e=this,n,i,a=this.style,s=a.x,o=a.y,l=a.width,u=a.height,c=a.options,h=a.onSelect,d=a.open,g=Nt(this.attributes,"dropdown"),p=Nt(this.attributes,"option"),v=this.dropdownPadding;_t(this.dropdown).maybeAppend(".dropdown-container","g").attr("className","dropdown-container").selectAll(".dropdown-item").data(c,function(w){return w.value}).join(function(w){return w.append(function(x){return new Cgt({className:"dropdown-item",style:et(et(et({},x),p),{width:l-v[1]-v[3],selected:x.value===e.currentValue,onClick:function(_,S,M){e.setValue(_),h==null||h(_,S,M),e.dispatchEvent(new cn("change",{detail:{value:_,option:S,item:M}})),Ri(e.dropdown)}})})}).each(function(x,_){var S,M=(S=this.parentNode)===null||S===void 0?void 0:S.children,k=M.reduce(function(T,P,O){return O<_&&(T+=P.getBBox().height),T},0);this.attr("transform","translate(".concat(v[3],", ").concat(v[0]+k,")"))})},function(w){return w.update(function(x){return{selected:x.value===e.currentValue}})},function(w){return w.remove()});var m=(i=(n=this.dropdown.getElementsByClassName("dropdown-container"))===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.getBBox(),b=g.spacing;this.dropdown.attr(et({transform:"translate(".concat(s,", ").concat(o+u+b,")"),width:m.width+v[1]+v[3],height:m.height+v[0]+v[2]},g)),!d&&Ri(this.dropdown)},t.prototype.render=function(){this.renderSelect(),this.renderDropdown()},t.prototype.bindEvents=function(){var e=this;this.addEventListener("click",function(n){n.stopPropagation()}),this.select.addEventListener("click",function(){e.dropdown.style.visibility==="visible"?Ri(e.dropdown):Xc(e.dropdown)}),this.addEventListener("pointerenter",function(){e.isPointerInSelect=!0}),this.addEventListener("pointerleave",function(){e.isPointerInSelect=!1}),document==null||document.addEventListener("click",function(){e.isPointerInSelect||Ri(e.dropdown)})},t.defaultOptions={style:{x:0,y:0,width:140,height:32,options:[],bordered:!0,defaultValue:"",selectRadius:8,selectStroke:"#d9d9d9",showDropdownIcon:!0,placeholderText:"请选择",placeholderFontSize:12,placeholderTextBaseline:"top",placeholderFill:"#c2c2c2",dropdownFill:"#fff",dropdownStroke:"#d9d9d9",dropdownRadius:8,dropdownShadowBlur:4,dropdownShadowColor:"rgba(0, 0, 0, 0.08)",dropdownPadding:8,dropdownSpacing:10,optionPadding:[8,12],optionFontSize:12,optionTextBaseline:"top",optionBackgroundFill:"#fff",optionBackgroundRadius:4,optionLabelFontSize:12,optionLabelTextBaseline:"top"}},t}(Qe),$i=function(r){Ht(t,r);function t(e){var n=r.call(this,Pn({},{style:{backgroundOpacity:t.backgroundOpacities.default}},t.defaultOptions,e))||this;return n.showBackground=!0,n.background=n.appendChild(new Sn({})),n.icon=n.appendChild(new _n({})),n}return Object.defineProperty(t.prototype,"label",{get:function(){return"BaseIcon"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineWidth",{get:function(){return Math.log10(this.attributes.size)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return jn(this.attributes.size/5)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iconSize",{get:function(){var e=this.attributes.size,n=z(this.padding,4),i=n[0],a=n[1],s=n[2],o=n[3];return Math.max(e-Math.max(o+a,i+s),this.lineWidth*2+1)},enumerable:!1,configurable:!0}),t.prototype.renderBackground=function(){var e=this.attributes,n=e.x,i=e.y,a=e.size,s=a/2,o=Nt(this.attributes,"background");this.background.attr(et({x:n-s,y:i-s,width:a,height:a},o))},t.prototype.showIndicator=function(){if(this.label){var e=this.attributes.size,n=this.background.getBBox(),i=n.x,a=n.y;this.indicator.update({x:i+e/2,y:a-5,labelText:this.label,visibility:"visible"})}},t.prototype.hideIndicator=function(){this.indicator.update({visibility:"hidden"})},t.prototype.connectedCallback=function(){var e;r.prototype.connectedCallback.call(this);var n=this.attributes.size,i=this.background.getBBox(),a=i.x,s=i.y,o=(e=this.ownerDocument)===null||e===void 0?void 0:e.defaultView;o&&(this.indicator=o.appendChild(new kgt({style:{x:a+n/2,y:s-n/2,visibility:"hidden",position:"top",radius:3,zIndex:100}})))},t.prototype.disconnectedCallback=function(){this.indicator.destroy()},t.prototype.render=function(){this.renderIcon(),this.showBackground&&this.renderBackground()},t.prototype.bindEvents=function(){var e=this,n=this.attributes.onClick;if(this.addEventListener("click",function(){n==null||n(e)}),this.showBackground){var i=function(){return e.background.attr({opacity:t.backgroundOpacities.default})},a=function(){return e.background.attr({opacity:t.backgroundOpacities.hover})},s=function(){return e.background.attr({opacity:t.backgroundOpacities.active})};this.addEventListener("pointerenter",function(){a(),e.showIndicator()}),this.addEventListener("pointerleave",function(){i(),e.hideIndicator()}),this.addEventListener("pointerdown",function(){s()}),this.addEventListener("pointerup",function(){i()})}},t.tag="IconBase",t.defaultOptions={style:{x:0,y:0,size:10,color:"#565758",backgroundRadius:4,backgroundFill:"#e2e2e2"}},t.backgroundOpacities={default:0,hover:.8,active:1},t}(Qe),_c=function(r,t){return t===void 0&&(t="#565758"),new qr({style:{fill:t,d:"M ".concat(r,",").concat(r," L -").concat(r,",0 L ").concat(r,",-").concat(r," Z"),transformOrigin:"center"}})},Pgt=function(r){Ht(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.arcPath=function(e,n,i){var a=z([i,i],2),s=a[0],o=a[1],l=function(v){return[e+i*Math.cos(v),n+i*Math.sin(v)]},u=z(l(-5/4*Math.PI),2),c=u[0],h=u[1],d=z(l(1/4*Math.PI),2),g=d[0],p=d[1];return"M".concat(c,",").concat(h,",A").concat(s,",").concat(o,",0,1,1,").concat(g,",").concat(p)},Object.defineProperty(t.prototype,"label",{get:function(){return"重置"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=this.lineWidth,l=o+.5;_t(this.icon).maybeAppend(".reset","path").styles({stroke:a,lineWidth:o,d:this.arcPath(n,i,s/2-o),markerStart:_c(l,a)})},t}($i),Ngt=function(r){Ht(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"快退"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=s/2,l=s/2/Math.pow(3,.5),u=[[n,i],[n,i-l],[n-o,i],[n,i+l],[n,i],[n+o,i-l],[n+o,i+l],[n,i]];_t(this.icon).maybeAppend(".backward","polygon").styles({points:u,fill:a})},t}($i),Rgt=function(r){Ht(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"快进"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=s/2,l=s/2/Math.pow(3,.5),u=[[n,i],[n,i-l],[n+o,i],[n,i+l],[n,i],[n-o,i-l],[n-o,i+l],[n,i]];_t(this.icon).maybeAppend(".forward","polygon").styles({points:u,fill:a})},t}($i),Lgt=function(r){Ht(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"播放"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=s/3*Math.pow(3,.5)*.8,l=[[n+o,i],[n-o/2,i-s/2*.8],[n-o/2,i+s/2*.8],[n+o,i]];_t(this.icon).maybeAppend(".play","polygon").styles({points:l,fill:a})},t}($i),Igt=function(r){Ht(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"暂停"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=s/3,l=[[n-o,i-s/2],[n-o,i+s/2],[n-o/2,i+s/2],[n-o/2,i-s/2],[n-o,i-s/2],[n+o/2,i-s/2],[n+o/2,i+s/2],[n+o,i+s/2],[n+o,i-s/2]];_t(this.icon).maybeAppend(".pause","polygon").styles({points:l,fill:a})},t}($i),Dgt=function(r){Ht(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"范围时间"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this,o=s.iconSize,l=s.lineWidth,u=l;_t(this.icon).maybeAppend(".left-line","line").styles({x1:n-o/2,y1:i-o/2,x2:n-o/2,y2:i+o/2,stroke:a,lineWidth:l}),_t(this.icon).maybeAppend(".right-line","line").styles({x1:n+o/2,y1:i-o/2,x2:n+o/2,y2:i+o/2,stroke:a,lineWidth:l}),_t(this.icon).maybeAppend(".left-arrow","line").styles({x1:n,y1:i,x2:n-o/2+u*2,y2:i,stroke:a,lineWidth:l,markerEnd:_c(l*2,a)}),_t(this.icon).maybeAppend(".right-arrow","line").styles({x1:n,y1:i,x2:n+o/2-u*2,y2:i,stroke:a,lineWidth:l,markerEnd:_c(l*2,a)})},t}($i),Fgt=function(r){Ht(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"单一时间"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this,o=s.iconSize,l=s.lineWidth;_t(this.icon).maybeAppend(".line","line").styles({x1:n,y1:i-o/2,x2:n,y2:i+o/2,stroke:a,lineWidth:l});var u=l;_t(this.icon).maybeAppend(".left-arrow","line").styles({x1:n-o/2-u*2,y1:i,x2:n-u*2,y2:i,stroke:a,lineWidth:l,markerEnd:_c(l*2,a)}),_t(this.icon).maybeAppend(".right-arrow","line").styles({x1:n+o/2+u*2,y1:i,x2:n+u*2,y2:i,stroke:a,lineWidth:l,markerEnd:_c(l*2,a)})},t}($i),l5=function(r){return[[-r/2,-r/2],[-r/2,r/2],[r/2,r/2]]},Bgt=function(r){Ht(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"折线图"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this,o=s.iconSize,l=s.lineWidth,u=l,c=(o-u*2-l)/4,h=(o-u*2-l)/2,d=z([n-o/2+u,i+o/2-u*2],2),g=d[0],p=d[1];_t(this.icon).maybeAppend(".coordinate","polyline").styles({points:l5(o).map(function(v){var m=z(v,2),b=m[0],w=m[1];return[b+n,w+i]}),stroke:a,lineWidth:l}),_t(this.icon).maybeAppend(".line","polyline").styles({points:[[g,p],[g+c,p-h],[g+c*2,p],[g+c*4,p-h*2]],stroke:a,lineWidth:l})},t}($i),zgt=function(r){Ht(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"条形图"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return[1,4,2,4,3]},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.data,n=this.attributes,i=n.x,a=n.y,s=n.color,o=this,l=o.iconSize,u=o.lineWidth,c=u,h=(l-c)/e.length,d=(l-c*2)/4,g=z([i-l/2+c*2,a+l/2-c],2),p=g[0],v=g[1];_t(this.icon).maybeAppend(".coordinate","polyline").styles({points:l5(l).map(function(m){var b=z(m,2),w=b[0],x=b[1];return[w+i,x+a]}),stroke:s,lineWidth:u}),_t(this.icon).maybeAppend(".bars","g").selectAll(".column").data(this.data.map(function(m,b){return{value:m,index:b}})).join(function(m){return m.append("line").attr("className","column").style("x1",function(b){var w=b.index;return p+h*w}).style("y1",v).style("x2",function(b){var w=b.index;return p+h*w}).style("y2",function(b){var w=b.value;return v-d*w}).styles({y1:v,stroke:s,lineWidth:u})})},t}($i),$gt=function(r){Ht(t,r);function t(e){var n=r.call(this,Pn({},{style:{color:"#d8d9d9"}},e))||this;return n.showBackground=!1,n}return t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this,o=s.iconSize,l=s.lineWidth;_t(this.icon).maybeAppend(".split","line").styles({x1:n,y1:i-o/2,x2:n,y2:i+o/2,stroke:a,lineWidth:l})},t}($i),mx=function(r){Ht(t,r);function t(){var e=r.apply(this,vt([],z(arguments),!1))||this;return e.showBackground=!1,e}return Object.defineProperty(t.prototype,"padding",{get:function(){return jn(0)},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.iconSize,n=this.attributes,i=n.x,a=n.y,s=n.speed,o=s===void 0?1:s,l=Ox(this.attributes,["x","y","transform","transformOrigin","width","height","size","color","speed"]),u=He(e,20,1/0),c=20,h=et(et({},l),{x:i-u/2,y:a-c/2,width:u,height:c,defaultValue:o,bordered:!1,showDropdownIcon:!1,selectRadius:2,dropdownPadding:this.padding,dropdownRadius:2,dropdownSpacing:e/5,placeholderFontSize:e/2,optionPadding:0,optionLabelFontSize:e/2,optionBackgroundRadius:1,options:[{label:"1x",value:1},{label:"1.5x",value:1.5},{label:"2x",value:2}]});_t(this.icon).maybeAppend(".speed",function(){return new Agt({style:h})}).attr("className","speed").each(function(){this.update(h)})},t.tag="SpeedSelect",t}($i),YE=function(r){Ht(t,r);function t(e){var n=r.call(this,e)||this;return n.icon=n.appendChild(new _n({})),n.currentType=n.attributes.type,n}return t.prototype.getType=function(){return this.currentType},t.prototype.render=function(){var e=this,n=this.attributes;n.onChange;var i=Je(n,["onChange"]);_t(this.icon).selectAll(".icon").data([this.currentType]).join(function(a){return a.append(function(s){var o,l=(o=e.toggles.find(function(u){var c=z(u,1),h=c[0];return h===s}))===null||o===void 0?void 0:o[1];if(!l)throw new Error("Invalid type: ".concat(s));return new l({})}).attr("className","icon").styles(i,!1).update({})},function(a){return a.styles({restStyles:i}).update({})},function(a){return a.remove()})},t.prototype.bindEvents=function(){var e=this,n=this.attributes.onChange;this.addEventListener("click",function(i){i.preventDefault(),i.stopPropagation();var a=(e.toggles.findIndex(function(o){var l=z(o,1),u=l[0];return u===e.currentType})+1)%e.toggles.length,s=e.toggles[a][0];n==null||n(e.currentType),e.currentType=s,e.render()})},t.tag="ToggleIcon",t}(Qe),yx=function(r){Ht(t,r);function t(e){var n=r.call(this,Pn({},{style:{type:"play"}},e))||this;return n.toggles=[["play",Lgt],["pause",Igt]],n}return t}(YE),bx=function(r){Ht(t,r);function t(e){var n=r.call(this,Pn({},{style:{type:"range"}},e))||this;return n.toggles=[["range",Dgt],["value",Fgt]],n}return t}(YE),wx=function(r){Ht(t,r);function t(e){var n=r.call(this,Pn({},{style:{type:"column"}},e))||this;return n.toggles=[["line",Bgt],["column",zgt]],n}return t}(YE),jgt={reset:Pgt,speed:mx,backward:Ngt,playPause:yx,forward:Rgt,selectionType:bx,chartType:wx,split:$gt},qgt=function(r){Ht(t,r);function t(e){var n=r.call(this,Pn({},t.defaultOptions,e))||this;return n.background=n.appendChild(new Sn({})),n.functions=n.appendChild(new _n({})),n}return Object.defineProperty(t.prototype,"padding",{get:function(){return jn(this.attributes.padding)},enumerable:!1,configurable:!0}),t.prototype.renderBackground=function(){var e=this.style,n=e.x,i=e.y,a=e.width,s=e.height,o=Nt(this.attributes,"background");this.background.attr(et({x:n,y:i,width:a,height:s},o))},t.prototype.renderFunctions=function(){var e=this,n,i=this.attributes,a=i.functions,s=i.iconSize,o=i.iconSpacing,l=i.x,u=i.y,c=i.width,h=i.height,d=i.align,g=z(this.padding,4),p=g[1],v=g[3],m=a.reduce(function(x,_){return x.length&&_.length?x.concat.apply(x,vt(["split"],z(_),!1)):x.concat.apply(x,vt([],z(_),!1))},[]),b=m.length*(s+o)-o,w={left:v+s/2,center:(c-b)/2+s/2,right:c-b-v-p+s/2}[d]||0;(n=this.speedSelect)===null||n===void 0||n.destroy(),this.functions.removeChildren(),m.forEach(function(x,_){var S,M=jgt[x],k={x:l+_*(s+o)+w,y:u+h/2,size:s};if(M===mx?(k.speed=e.attributes.speed,k.onSelect=function(P){return e.handleFunctionChange(x,{value:P})}):[yx,bx,wx].includes(M)?(k.onChange=function(P){return e.handleFunctionChange(x,{value:P})},M===yx&&(k.type=e.attributes.state==="play"?"pause":"play"),M===bx&&(k.type=e.attributes.selectionType==="range"?"value":"range"),M===wx&&(k.type=e.attributes.chartType==="line"?"column":"line")):k.onClick=function(){return e.handleFunctionChange(x,{value:x})},M===mx){var T=(S=e.ownerDocument)===null||S===void 0?void 0:S.defaultView;T&&(e.speedSelect=new M({style:et(et({},k),{zIndex:100})}),T.appendChild(e.speedSelect))}else e.functions.appendChild(new M({style:k}))})},t.prototype.disconnectedCallback=function(){var e;r.prototype.disconnectedCallback.call(this),(e=this.speedSelect)===null||e===void 0||e.destroy()},t.prototype.render=function(){this.renderBackground(),this.renderFunctions()},t.prototype.handleFunctionChange=function(e,n){var i=this.attributes.onChange;i==null||i(e,n)},t.defaultOptions={style:{x:0,y:0,width:300,height:40,padding:0,align:"center",iconSize:25,iconSpacing:0,speed:1,state:"pause",chartType:"line",selectionType:"range",backgroundFill:"#fbfdff",backgroundStroke:"#ebedf0",functions:[["reset","speed"],["backward","playPause","forward"],["selectionType","chartType"]]}},t}(Qe),Wgt=function(r){Ht(t,r);function t(e){var n=r.call(this,Pn({},t.defaultOptions,e))||this;return n.bindEvents(),n}return t.prototype.bindEvents=function(){var e=this;this.addEventListener("mouseenter",function(){e.attr("lineWidth",Math.ceil(+(e.style.r||0)/2))}),this.addEventListener("mouseleave",function(){e.attr("lineWidth",0)})},t.defaultOptions={style:{r:5,fill:"#3f7cf7",lineWidth:0,stroke:"#3f7cf7",strokeOpacity:.5,cursor:"pointer"}},t}(Ha),Ggt=function(r){Ht(t,r);function t(e){return r.call(this,Pn({},t.defaultOptions,e))||this}return t.prototype.renderBackground=function(){var e=this.attributes,n=e.x,i=e.y,a=e.width,s=e.height,o=Nt(this.attributes,"background");_t(this).maybeAppend("background","rect").attr("className","background").styles(et({x:n-a/2,y:i-s/2,width:a,height:s},o))},t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.iconSize,s=Nt(this.attributes,"icon"),o=1,l=a/2;_t(this).maybeAppend("icon-left-line","line").attr("className","icon-left-line").styles(et({x1:n-o,y1:i-l,x2:n-o,y2:i+l},s)),_t(this).maybeAppend("icon-right-line","line").attr("className","icon-right-line").styles(et({x1:n+o,y1:i-l,x2:n+o,y2:i+l},s))},t.prototype.renderBorder=function(){var e=this.attributes,n=e.x,i=e.y,a=e.width,s=e.height,o=e.type,l=Nt(this.attributes,"border"),u=o==="start"?+a/2:-a/2;_t(this).maybeAppend("border","line").attr("className","border").styles(et({x1:u+n,y1:i-s/2,x2:u+n,y2:i+s/2},l))},t.prototype.render=function(){this.renderBackground(),this.renderIcon(),this.renderBorder()},t.defaultOptions={style:{x:0,y:0,width:10,height:50,iconSize:10,type:"start",backgroundFill:"#fff",backgroundFillOpacity:.5,iconStroke:"#9a9a9a",iconLineWidth:1,borderStroke:"#e8e8e8",borderLineWidth:1}},t}(Qe);function Vgt(r,t){return typeof r=="number"?u5(r):Hgt(r,t)}function Hgt(r,t){var e=new Date(r);switch(t){case"half-hour":case"hour":case"four-hour":return[0,6,12,18].includes(e.getHours())&&e.getMinutes()===0?yr(e,`HH:mm
- YYYY-MM-DD`):yr(e,"HH:mm");case"half-day":return e.getHours()<12?`AM
- `.concat(yr(e,"YYYY-MM-DD")):"PM";case"day":return[1,10,20].includes(e.getDate())?yr(e,`DD
- YYYY-MM`):yr(e,"DD");case"week":return e.getDate()<=7?yr(e,`DD
- YYYY-MM`):yr(e,"DD");case"month":return[0,6].includes(e.getMonth())?yr(e,`MM月
- YYYY`):yr(e,"MM月");case"season":return[0].includes(e.getMonth())?yr(e,`MM月
- YYYY`):yr(e,"MM月");case"year":return yr(e,"YYYY");default:return yr(e,"YYYY-MM-DD HH:mm")}}function u5(r){var t=String(Math.floor(r/3600)).padStart(2,"0"),e=String(Math.floor(r%3600/60)).padStart(2,"0"),n=String(Math.floor(r%60)).padStart(2,"0");return r<3600?"".concat(e,":").concat(n):"".concat(t,":").concat(e,":").concat(n)}var Ugt=function(r){Ht(t,r);function t(e){var n=r.call(this,Pn({},t.defaultOptions,e))||this;n.axis=n.appendChild(new pgt({style:{type:"linear",startPos:[0,0],endPos:[0,0],data:[],showArrow:!1,animate:!1}})),n.timeline=n.appendChild(new fft({style:{onChange:function(h){n.handleSliderChange(h)}}})),n.controller=n.appendChild(new qgt({})),n.states={},n.handleSliderChange=function(h){var d=function(){var g=n.states.values;return Array.isArray(g)?vt([],z(g),!1):g}();n.setBySliderValues(h),n.dispatchOnChange(d)};var i=n.attributes,a=i.selectionType,s=i.chartType,o=i.speed,l=i.state,u=i.playMode,c=i.values;return n.states={chartType:s,playMode:u,selectionType:a,speed:o,state:l},n.setByTimebarValues(c),n}return Object.defineProperty(t.prototype,"data",{get:function(){var e=this.attributes.data,n=function(i,a){return i.time<a.time?-1:i.time>a.time?1:0};return e.sort(n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"space",{get:function(){var e=this.attributes,n=e.x,i=e.y,a=e.width,s=e.height,o=e.type,l=e.controllerHeight,u=He(+s-l,0,+s),c=new ur(n,i+ +s-l,+a,l),h,d=0;o==="chart"?(d=35,h=new ur(n,i+u-d,+a,d)):h=new ur;var g=o==="time"?10:u,p=new ur(n,i+(o==="time"?u:u-g),+a,g-d);return{axisBBox:h,controllerBBox:c,timelineBBox:p}},enumerable:!1,configurable:!0}),t.prototype.setBySliderValues=function(e){var n,i,a=this.data,s=z(Array.isArray(e)?e:[0,e],2),o=s[0],l=s[1],u=a.length,c=a[Math.floor(o*u)],h=a[Math.ceil(l*u)-(Array.isArray(e)?0:1)];this.states.values=[(n=c==null?void 0:c.time)!==null&&n!==void 0?n:a[0].time,(i=h==null?void 0:h.time)!==null&&i!==void 0?i:1/0]},t.prototype.setByTimebarValues=function(e){var n,i,a,s=this.data,o=z(Array.isArray(e)?e:[void 0,e],2),l=o[0],u=o[1],c=s.find(function(d){var g=d.time;return g===l}),h=s.find(function(d){var g=d.time;return g===u});this.states.values=[(n=c==null?void 0:c.time)!==null&&n!==void 0?n:(i=s[0])===null||i===void 0?void 0:i.time,(a=h==null?void 0:h.time)!==null&&a!==void 0?a:1/0]},t.prototype.setByIndex=function(e){var n,i,a,s,o=this.data,l=z(e,2),u=l[0],c=l[1];this.states.values=[(i=(n=o[u])===null||n===void 0?void 0:n.time)!==null&&i!==void 0?i:o[0].time,(s=(a=this.data[c])===null||a===void 0?void 0:a.time)!==null&&s!==void 0?s:1/0]},Object.defineProperty(t.prototype,"sliderValues",{get:function(){var e=this.states,n=e.values,i=e.selectionType,a=z(Array.isArray(n)?n:[void 0,n],2),s=a[0],o=a[1],l=this.data,u=l.length,c=i==="value",h=function(){var g=l.findIndex(function(p){var v=p.time;return v===s});return c?0:g>-1?g/u:0},d=function(){if(o===1/0)return 1;var g=l.findIndex(function(p){var v=p.time;return v===o});return g>-1?g/u:c?.5:1};return[h(),d()]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"values",{get:function(){var e=this.states,n=e.values,i=e.selectionType,a=z(Array.isArray(n)?n:[this.data[0].time,n],2),s=a[0],o=a[1];return i==="value"?o:[s,o]},enumerable:!1,configurable:!0}),t.prototype.getDatumByRatio=function(e){var n=this.data,i=n.length,a=Math.floor(e*(i-1));return n[a]},Object.defineProperty(t.prototype,"chartHandleIconShape",{get:function(){var e=this.states.selectionType,n=this.space.timelineBBox.height;return e==="range"?function(i){return new Ggt({style:{type:i,height:n,iconSize:n/6}})}:function(){return new Io({style:{x1:0,y1:-n/2,x2:0,y2:n/2,lineWidth:2,stroke:"#c8c8c8"}})}},enumerable:!1,configurable:!0}),t.prototype.getChartStyle=function(e){var n=this,i=e.x,a=e.y,s=e.width,o=e.height,l=this.states,u=l.selectionType,c=l.chartType,h=this.data,d=this.attributes,g=d.type,p=d.labelFormatter,v=Nt(this.attributes,"chart");v.type;var m=Je(v,["type"]),b=u==="range";if(g==="time")return et({handleIconShape:function(){return new Wgt({})},selectionFill:"#2e7ff8",selectionFillOpacity:1,showLabelOnInteraction:!0,handleLabelDy:b?-15:0,autoFitLabel:b,handleSpacing:b?-15:0,trackFill:"#edeeef",trackLength:s,trackOpacity:.5,trackRadius:o/2,trackSize:o/2,type:u,values:this.sliderValues,formatter:function(_){if(p)return p(_);var S=n.getDatumByRatio(_).time;return typeof S=="number"?u5(S):yr(S,"YYYY-MM-DD HH:mm:ss")},transform:"translate(".concat(i,", ").concat(a,")"),zIndex:1},m);var w=u==="range"?5:0,x=h.map(function(_){var S=_.value;return S});return et({handleIconOffset:w,handleIconShape:this.chartHandleIconShape,selectionFill:"#fff",selectionFillOpacity:.5,selectionType:"invert",sparklineSpacing:.1,sparklineColumnLineWidth:0,sparklineColor:"#d4e5fd",sparklineAreaOpacity:1,sparklineAreaLineWidth:0,sparklineData:x,sparklineType:c,sparklineScale:.8,trackLength:s,trackSize:o,type:u,values:this.sliderValues,transform:"translate(".concat(i,", ").concat(a,")"),zIndex:1},m)},t.prototype.renderChart=function(e){e===void 0&&(e=this.space.timelineBBox),this.timeline.update(this.getChartStyle(e))},t.prototype.updateSelection=function(){this.timeline.setValues(this.sliderValues,!0),this.handleSliderChange(this.sliderValues)},t.prototype.getAxisStyle=function(e){var n=this.data,i=this.attributes,a=i.interval,s=i.labelFormatter,o=Nt(this.attributes,"axis"),l=e.x,u=e.y,c=e.width,h=vt(vt([],z(n),!1),[{time:0}],!1).map(function(g,p,v){var m=g.time;return{label:"".concat(m),value:p/(v.length-1),time:m}}),d=et({startPos:[l,u],endPos:[l+c,u],data:h,labelFilter:function(g,p){return p<h.length-1},labelFormatter:function(g){var p=g.time;return s?s(p):Vgt(p,a)}},o);return d},t.prototype.renderAxis=function(e){e===void 0&&(e=this.space.axisBBox);var n=this.attributes.type;n==="chart"&&this.axis.update(this.getAxisStyle(e))},t.prototype.renderController=function(e){e===void 0&&(e=this.space.controllerBBox);var n=this.attributes.type,i=this.states,a=i.state,s=i.speed,o=i.selectionType,l=i.chartType,u=Nt(this.attributes,"controller"),c=this,h=et(et(et({},e),{iconSize:20,speed:s,state:a,selectionType:o,chartType:l,onChange:function(d,g){var p=g.value;switch(d){case"reset":c.internalReset();break;case"speed":c.handleSpeedChange(p);break;case"backward":c.internalBackward();break;case"playPause":p==="play"?c.internalPlay():c.internalPause();break;case"forward":c.internalForward();break;case"selectionType":c.handleSelectionTypeChange(p);break;case"chartType":c.handleChartTypeChange(p);break}}}),u);n==="time"&&(h.functions=[["reset","speed"],["backward","playPause","forward"],["selectionType"]]),this.controller.update(h)},t.prototype.dispatchOnChange=function(e){var n=this.data,i=this.attributes.onChange,a=this.states,s=a.values,o=a.selectionType,l=z(s,2),u=l[0],c=l[1],h=c===1/0?n.at(-1).time:c,d=o==="range"?[u,h]:h,g=function(p,v){return Array.isArray(p)?Array.isArray(v)?p[0]===v[0]&&(p[1]===v[1]||p[1]===1/0||v[1]===1/0):!1:Array.isArray(v)?!1:p===v};(!e||!g(e,d))&&(i==null||i(o==="range"?[u,h]:h))},t.prototype.internalReset=function(e){var n,i,a=this.states.selectionType;this.internalPause(),this.setBySliderValues(a==="range"?[0,1]:[0,0]),this.renderController(),this.updateSelection(),e||((i=(n=this.attributes)===null||n===void 0?void 0:n.onReset)===null||i===void 0||i.call(n),this.dispatchOnChange())},t.prototype.reset=function(){this.internalReset()},t.prototype.moveSelection=function(e,n){var i=this.data,a=i.length,s=this.states,o=s.values,l=s.selectionType,u=s.playMode,c=z(o,2),h=c[0],d=c[1],g=i.findIndex(function(x){var _=x.time;return _===h}),p=i.findIndex(function(x){var _=x.time;return _===d});p===-1&&(p=a);var v=e==="backward"?-1:1,m;l==="range"?u==="acc"?(m=[g,p+v],v===-1&&g===p&&(m=[g,a])):m=[g+v,p+v]:m=[g,p+v];var b=function(x){var _=z(x.sort(function(T,P){return T-P}),2),S=_[0],M=_[1],k=function(T){return He(T,0,a)};return M>a?l==="value"?[0,0]:u==="acc"?[k(S),k(S)]:[0,k(M-S)]:S<0?u==="acc"?[0,k(M)]:[k(S+a-M),a]:[k(S),k(M)]},w=b(m);return this.setByIndex(w),this.updateSelection(),w},t.prototype.internalBackward=function(e){var n,i,a=this.moveSelection("backward",e);return e||((i=(n=this.attributes)===null||n===void 0?void 0:n.onBackward)===null||i===void 0||i.call(n),this.dispatchOnChange()),a},t.prototype.backward=function(){this.internalBackward()},t.prototype.internalPlay=function(e){var n=this,i,a,s=this.data,o=this.attributes.loop,l=this.states.speed,u=l===void 0?1:l;this.playInterval=window.setInterval(function(){var c=n.internalForward();c[1]===s.length&&!o&&(n.internalPause(),n.renderController())},1e3/u),this.states.state="play",!e&&((a=(i=this.attributes)===null||i===void 0?void 0:i.onPlay)===null||a===void 0||a.call(i))},t.prototype.play=function(){this.internalPlay()},t.prototype.internalPause=function(e){var n,i;clearInterval(this.playInterval),this.states.state="pause",!e&&((i=(n=this.attributes)===null||n===void 0?void 0:n.onPause)===null||i===void 0||i.call(n))},t.prototype.pause=function(){this.internalPause()},t.prototype.internalForward=function(e){var n,i,a=this.moveSelection("forward",e);return e||((i=(n=this.attributes)===null||n===void 0?void 0:n.onForward)===null||i===void 0||i.call(n),this.dispatchOnChange()),a},t.prototype.forward=function(){this.internalForward()},t.prototype.handleSpeedChange=function(e){var n,i;this.states.speed=e;var a=this.states.state;a==="play"&&(this.internalPause(!0),this.internalPlay(!0)),(i=(n=this.attributes)===null||n===void 0?void 0:n.onSpeedChange)===null||i===void 0||i.call(n,e)},t.prototype.handleSelectionTypeChange=function(e){var n,i;this.states.selectionType=e,this.renderChart(),(i=(n=this.attributes)===null||n===void 0?void 0:n.onSelectionTypeChange)===null||i===void 0||i.call(n,e)},t.prototype.handleChartTypeChange=function(e){var n,i;this.states.chartType=e,this.renderChart(),(i=(n=this.attributes)===null||n===void 0?void 0:n.onChartTypeChange)===null||i===void 0||i.call(n,e)},t.prototype.render=function(){var e=this.space,n=e.axisBBox,i=e.controllerBBox,a=e.timelineBBox;this.renderController(i),this.renderAxis(n),this.renderChart(a),this.states.state==="play"&&this.internalPlay()},t.prototype.destroy=function(){r.prototype.destroy.call(this),this.internalPause(!0)},t.defaultOptions={style:{x:0,y:0,axisLabelFill:"#6e6e6e",axisLabelTextAlign:"left",axisLabelTextBaseline:"top",axisLabelTransform:"translate(5, -12)",axisLineLineWidth:1,axisLineStroke:"#cacdd1",axisTickLength:15,axisTickLineWidth:1,axisTickStroke:"#cacdd1",chartShowLabel:!1,chartType:"line",controllerAlign:"center",controllerHeight:40,data:[],interval:"day",loop:!1,playMode:"acc",selectionType:"range",type:"time"}},t}(Qe);function XE(r){const{width:t,height:e,renderer:n}=r,i=Ygt(r),a=new Aw({width:t,height:e,container:i,renderer:n||new pc});return[i,a]}function Ygt(r){var t;const{container:e,className:n,graphCanvas:i}=r;if(e)return typeof e=="string"?document.getElementById(e):e;const a=iu(n,!1),{width:s,height:o,containerStyle:l}=r,[u,c]=Xgt(r);return Object.assign(a.style,Object.assign({position:"absolute",left:u+"px",top:c+"px",width:s+"px",height:o+"px"},l)),(t=i.getContainer())===null||t===void 0||t.appendChild(a),a}function Xgt(r){const{width:t,height:e,placement:n,graphCanvas:i}=r,[a,s]=i.getSize(),[o,l]=gI(n);return[o*(a-t),l*(s-e)]}var Kgt=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class M0 extends Wn{constructor(t,e){super(t,Object.assign({},M0.defaultOptions,e)),this.typePrefix="__data__",this.draw=!1,this.fieldMap={node:new Map,edge:new Map,combo:new Map},this.selectedItems=[],this.bindEvents=()=>{const{graph:n}=this.context;n.on(ut.AFTER_DRAW,this.createElement)},this.changeState=(n,i)=>{const{graph:a}=this.context,{typePrefix:s}=this,o=sr(n,[s,"id"]),l=sr(n,[s,"style","labelText"]),[u]=o.split("__"),c=this.fieldMap[u].get(l)||[];a.setElementState(Object.fromEntries(c==null?void 0:c.map(h=>[h,i])))},this.click=n=>{if(this.options.trigger==="hover")return;const i=sr(n,[this.typePrefix,"id"]);this.selectedItems.includes(i)?(this.selectedItems=this.selectedItems.filter(a=>a!==i),this.changeState(n,[])):(this.selectedItems.push(i),this.changeState(n,"selected"))},this.mouseleave=n=>{this.options.trigger!=="click"&&(this.selectedItems=[],this.changeState(n,[]))},this.mouseenter=n=>{if(this.options.trigger==="click")return;const i=sr(n,[this.typePrefix,"id"]);this.selectedItems.includes(i)?this.selectedItems=this.selectedItems.filter(a=>a!==i):(this.selectedItems.push(i),this.changeState(n,"active"))},this.setFieldMap=(n,i,a)=>{if(!n)return;const s=this.fieldMap[a];if(s)if(!s.has(n))s.set(n,[i]);else{const o=s.get(n);o&&(o.push(i),s.set(n,o))}},this.getEvents=()=>({mouseenter:this.mouseenter,mouseleave:this.mouseleave,click:this.click}),this.getMarkerData=(n,i)=>{if(!n)return[];const{model:a,element:s}=this.context,{nodes:o,edges:l,combos:u}=a.getData(),c={},h=m=>Et(n)?n(m):n,d={node:"circle",edge:"line",combo:"rect"},g={circle:"circle",ellipse:"circle",image:"bowtie",rect:"square",star:"cross",triangle:"triangle",diamond:"diamond",cubic:"dot",line:"hyphen",polyline:"hyphen",quadratic:"hv","cubic-horizontal":"hyphen","cubic-vertical":"line"},p=(m,b)=>s==null?void 0:s.getElementComputedStyle(m,b),v=(m,b)=>{m.forEach(w=>{const{id:x}=w,_=sr(w,["data",h(w)]),S=(s==null?void 0:s.getElementType(b,w))||"circle",M=p(b,w),k=(b==="edge"?M==null?void 0:M.stroke:M==null?void 0:M.fill)||"#1783ff";x&&_&&_.replace(/\s+/g,"")&&(this.setFieldMap(_,x,b),c[_]||(c[_]={id:`${b}__${x}`,label:_,marker:g[S]||d[b],elementType:b,lineWidth:1,stroke:k,fill:k}))})};switch(i){case"node":v(o,"node");break;case"edge":v(l,"edge");break;case"combo":v(u,"combo");break;default:return[]}return Object.values(c)},this.createElement=()=>{if(this.draw){this.updateElement();return}const n=this.options,{width:i,height:a,nodeField:s,edgeField:o,comboField:l,trigger:u,position:c,container:h,containerStyle:d,className:g}=n,p=Kgt(n,["width","height","nodeField","edgeField","comboField","trigger","position","container","containerStyle","className"]),v=this.getMarkerData(s,"node"),m=this.getMarkerData(o,"edge"),b=this.getMarkerData(l,"combo"),w=[...v,...b,...m],x=Object.assign({width:i,height:a,data:w,itemMarkerLineWidth:({lineWidth:M})=>M,itemMarker:({marker:M})=>M,itemMarkerStroke:({stroke:M})=>M,itemMarkerFill:({fill:M})=>M,gridCol:v.length},p,this.getEvents()),_=new Sgt({className:"legend",style:x});this.category=_,this.upsertCanvas().appendChild(_),this.draw=!0},this.bindEvents()}update(t){super.update(t),this.clear(),this.createElement()}clear(){var t,e;(t=this.canvas)===null||t===void 0||t.destroy(),(e=this.container)===null||e===void 0||e.remove(),this.canvas=void 0,this.container=void 0,this.draw=!1}updateElement(){this.category&&this.category.update({itemMarkerOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5,itemLabelOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5})}upsertCanvas(){if(this.canvas)return this.canvas;const t=this.context.canvas,[e,n]=t.getSize(),{width:i=e,height:a=n,position:s,container:o,containerStyle:l,className:u}=this.options,[c,h]=XE({width:i,height:a,graphCanvas:t,container:o,containerStyle:l,placement:s,className:"legend"});return this.container=c,u&&c.classList.add(u),this.canvas=h,this.canvas}destroy(){this.clear(),this.context.graph.off(ut.AFTER_DRAW,this.createElement),super.destroy()}}M0.defaultOptions={position:"bottom",trigger:"hover",orientation:"horizontal",layout:"flex",itemSpacing:4,rowPadding:10,colPadding:10,itemMarkerSize:16,itemLabelFontSize:16,width:240,height:160};class k0 extends Wn{constructor(t,e){super(t,Object.assign({},k0.defaultOptions,e)),this.onDraw=n=>{var i;!((i=n==null?void 0:n.data)===null||i===void 0)&&i.render||this.onRender()},this.shapes=new Map,this.landmarkMap=new Map,this.mask=null,this.isMaskDragging=!1,this.onMaskDragStart=n=>{this.mask&&(this.isMaskDragging=!0,this.mask.setPointerCapture(n.pointerId),this.mask.addEventListener("pointermove",this.onMaskDrag),this.mask.addEventListener("pointerup",this.onMaskDragEnd),this.mask.addEventListener("pointercancel",this.onMaskDragEnd))},this.onMaskDrag=n=>{if(!this.mask||!this.isMaskDragging)return;const{size:[i,a]}=this.options,{movementX:s,movementY:o}=n,{left:l,top:u,width:c,height:h}=this.mask.style,[,,d,g]=this.maskBBox;let p=parseInt(l)+s,v=parseInt(u)+o,m=parseInt(c),b=parseInt(h);p<0&&(p=0),v<0&&(v=0),p+m>i&&(p=fs(i-m,0)),v+b>a&&(v=fs(a-b,0)),m<d&&(s>0?(p=fs(p-s,0),m=ds(m+s,i)):s<0&&(m=ds(m-s,i))),b<g&&(o>0?(v=fs(v-o,0),b=ds(b+o,a)):o<0&&(b=ds(b-o,a))),Object.assign(this.mask.style,{left:p+"px",top:v+"px",width:m+"px",height:b+"px"});const w=parseInt(l)-p,x=parseInt(u)-v;if(w===0&&x===0)return;const _=this.context.canvas.getCamera().getZoom(),S=this.canvas.getCamera().getZoom(),M=_/S;this.context.graph.translateBy([w*M,x*M],!1)},this.onMaskDragEnd=n=>{this.mask&&(this.isMaskDragging=!1,this.mask.releasePointerCapture(n.pointerId),this.mask.removeEventListener("pointermove",this.onMaskDrag),this.mask.removeEventListener("pointerup",this.onMaskDragEnd),this.mask.removeEventListener("pointercancel",this.onMaskDragEnd))},this.onTransform=ZR(()=>{this.isMaskDragging||(this.updateMask(),this.setCamera())},32,{leading:!0}),this.setOnRender(),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),"delay"in t&&this.setOnRender(),this.bindEvents()}setOnRender(){this.onRender=Oc(()=>{this.renderMinimap(),this.renderMask()},this.options.delay,!0)}bindEvents(){const{graph:t}=this.context;t.on(ut.AFTER_DRAW,this.onDraw),t.on(ut.AFTER_RENDER,this.onRender),t.on(ut.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:t}=this.context;t.off(ut.AFTER_DRAW,this.onDraw),t.off(ut.AFTER_RENDER,this.onRender),t.off(ut.AFTER_TRANSFORM,this.onTransform)}renderMinimap(){const t=this.getElements(),e=this.initCanvas();this.setShapes(e,t)}getElements(){const{filter:t}=this.options,{model:e}=this.context,n=e.getData();if(!t)return n;const{nodes:i,edges:a,combos:s}=n;return{nodes:i.filter(o=>t(H(o),"node")),edges:a.filter(o=>t(H(o),"edge")),combos:s.filter(o=>t(H(o),"combo"))}}setShapes(t,e){const{nodes:n,edges:i,combos:a}=e,{shape:s}=this.options,{element:o}=this.context;if(s==="key"){const u=new Set,c=h=>{const d=H(h);u.add(d);const g=o.getElement(d);if(!g)return;const p=g.getShape("key"),v=this.shapes.get(d)||p.cloneNode();v.setPosition(p.getPosition()),g.style.zIndex&&(v.style.zIndex=g.style.zIndex),v.id=g.id,this.shapes.has(d)?Object.entries(p.attributes).forEach(([m,b])=>{v.style[m]!==b&&(v.style[m]=b)}):(t.appendChild(v),this.shapes.set(d,v))};i.forEach(c),a.forEach(c),n.forEach(c),this.shapes.forEach((h,d)=>{u.has(d)||(t.removeChild(h),this.shapes.delete(d))});return}const l=(u,c)=>{const d=o.getElement(u).getPosition();return c.setPosition(d),c};t.removeChildren(),i.forEach(u=>t.appendChild(s(H(u),"edge"))),a.forEach(u=>{t.appendChild(l(H(u),s(H(u),"combo")))}),n.forEach(u=>{t.appendChild(l(H(u),s(H(u),"node")))})}initCanvas(){const{renderer:t,size:[e,n]}=this.options;if(this.canvas){const{width:i,height:a}=this.canvas.getConfig();(e!==i||n!==a)&&this.canvas.resize(e,n),t&&this.canvas.setRenderer(t)}else{const{className:i,position:a,container:s,containerStyle:o}=this.options,[l,u]=XE({renderer:t,width:e,height:n,placement:a,className:"minimap",container:s,containerStyle:o,graphCanvas:this.context.canvas});i&&l.classList.add(i),this.container=l,this.canvas=u}return this.setCamera(),this.canvas}createLandmark(t,e,n){const i=`${t.join(",")}-${e.join(",")}-${n}`;if(this.landmarkMap.has(i))return this.landmarkMap.get(i);const s=this.canvas.getCamera().createLandmark(i,{position:t,focalPoint:e,zoom:n});return this.landmarkMap.set(i,s),s}setCamera(){var t;const{canvas:e}=this.context,n=(t=this.canvas)===null||t===void 0?void 0:t.getCamera();if(!n)return;const{size:[i,a],padding:s}=this.options,[o,l,u,c]=oa(s),{min:h,max:d,center:g}=e.getBounds("elements"),p=d[0]-h[0],v=d[1]-h[1],m=i-c-l,b=a-o-u,w=m/p,x=b/v,_=Math.min(w,x),S=this.createLandmark(g,g,_);n.gotoLandmark(S,0)}get maskBBox(){const{canvas:t}=this.context,e=t.getSize(),n=t.getCanvasByViewport([0,0]),i=t.getCanvasByViewport(e),a=this.canvas.canvas2Viewport(Ni(n)),s=this.canvas.canvas2Viewport(Ni(i)),o=s.x-a.x,l=s.y-a.y;return[a.x,a.y,o,l]}calculateMaskBBox(){const{size:[t,e]}=this.options;let[n,i,a,s]=this.maskBBox;return n<0&&(a=ds(a+n,t),n=0),i<0&&(s=ds(s+i,e),i=0),n+a>t&&(a=fs(t-n,0)),i+s>e&&(s=fs(e-i,0)),[ds(n,t),ds(i,e),fs(a,0),fs(s,0)]}renderMask(){const{maskStyle:t}=this.options;this.mask||(this.mask=document.createElement("div"),this.mask.addEventListener("pointerdown",this.onMaskDragStart)),this.container.appendChild(this.mask),Object.assign(this.mask.style,Object.assign(Object.assign({},t),{cursor:"move",position:"absolute",pointerEvents:"auto"})),this.updateMask()}updateMask(){if(!this.mask)return;const[t,e,n,i]=this.calculateMaskBBox();Object.assign(this.mask.style,{top:e+"px",left:t+"px",width:n+"px",height:i+"px"})}destroy(){var t;this.unbindEvents(),this.canvas.destroy(),(t=this.mask)===null||t===void 0||t.remove(),super.destroy()}}k0.defaultOptions={size:[240,160],shape:"key",padding:10,position:"right-bottom",maskStyle:{border:"1px solid #ddd",background:"rgba(0, 0, 0, 0.1)"},containerStyle:{border:"1px solid #ddd",background:"#fff"},delay:128};const ds=(r,t)=>Math.min(r,t),fs=(r,t)=>Math.max(r,t);var Zb=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};const Jb={x1:0,y1:0,x2:0,y2:0,visibility:"hidden"};class T0 extends Wn{constructor(t,e){super(t,Object.assign({},T0.defaultOptions,e)),this.initSnapline=()=>{const n=this.context.canvas.getLayer("transient");this.horizontalLine||(this.horizontalLine=n.appendChild(new Io({style:Object.assign(Object.assign({},Jb),this.options.horizontalLineStyle)}))),this.verticalLine||(this.verticalLine=n.appendChild(new Io({style:Object.assign(Object.assign({},Jb),this.options.verticalLineStyle)})))},this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!0,this.autoSnapToLine=(n,i,a)=>Zb(this,void 0,void 0,function*(){const{verticalX:s,horizontalY:o}=a,{tolerance:l}=this.options,{min:[u,c],max:[h,d],center:[g,p]}=i;let v=0,m=0;s!==null&&(Un(h,s)<l&&(v=s-h),Un(u,s)<l&&(v=s-u),Un(g,s)<l&&(v=s-g),v!==0&&(this.isVerticalSticking=!0)),o!==null&&(Un(d,o)<l&&(m=o-d),Un(c,o)<l&&(m=o-c),Un(p,o)<l&&(m=o-p),m!==0&&(this.isHorizontalSticking=!0)),(v!==0||m!==0)&&(yield this.context.graph.translateElementBy({[n]:[v,m]},!1))}),this.enableSnap=n=>{const{target:i}=n,a=.5;if(this.isHorizontalSticking||this.isVerticalSticking){const[s,o]=this.getDelta(n);if(this.isHorizontalSticking&&this.isVerticalSticking&&Math.abs(s)<=a&&Math.abs(o)<=a)return this.context.graph.translateElementBy({[i.id]:[-s,-o]},!1),!1;if(this.isHorizontalSticking&&Math.abs(o)<=a)return this.context.graph.translateElementBy({[i.id]:[0,-o]},!1),!1;if(this.isVerticalSticking&&Math.abs(s)<=a)return this.context.graph.translateElementBy({[i.id]:[-s,0]},!1),!1;this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!1,setTimeout(()=>{this.enableStick=!0},200)}return this.enableStick},this.calcSnaplineMetadata=(n,i)=>{const{tolerance:a,shape:s}=this.options,{min:[o,l],max:[u,c],center:[h,d]}=i;let g=null,p=null,v=null,m=null,b=null,w=null;return this.getNodes().some(x=>{if(Ue(n.id,x.id))return!1;const _=GN(x,s).getRenderBounds(),{min:[S,M],max:[k,T],center:[P,O]}=_;return g===null&&(Un(P,h)<a?g=P:Un(S,o)<a||Un(S,u)<a?g=S:(Un(k,u)<a||Un(k,o)<a)&&(g=k),g!==null&&(p=Math.min(M,l),v=Math.max(T,c))),m===null&&(Un(O,d)<a?m=O:Un(M,l)<a||Un(M,c)<a?m=M:(Un(T,c)<a||Un(T,l)<a)&&(m=T),m!==null&&(b=Math.min(S,o),w=Math.max(k,u))),g!==null&&m!==null}),{verticalX:g,verticalMinY:p,verticalMaxY:v,horizontalY:m,horizontalMinX:b,horizontalMaxX:w}},this.onDragStart=()=>{this.initSnapline()},this.onDrag=n=>Zb(this,void 0,void 0,function*(){const{target:i}=n;if(this.options.autoSnap&&!this.enableSnap(n))return;const a=GN(i,this.options.shape).getRenderBounds(),s=this.calcSnaplineMetadata(i,a);this.hideSnapline(),(s.verticalX!==null||s.horizontalY!==null)&&this.updateSnapline(s),this.options.autoSnap&&(yield this.autoSnapToLine(i.id,a,s))}),this.onDragEnd=()=>{this.hideSnapline()},this.bindEvents()}getNodes(){var t;const{filter:e}=this.options,i=(((t=this.context.element)===null||t===void 0?void 0:t.getNodes())||[]).filter(a=>{var s;return XZ(a)&&((s=this.context.viewport)===null||s===void 0?void 0:s.isInViewport(a.getRenderBounds()))});return e?i.filter(a=>e(a)):i}hideSnapline(){this.horizontalLine.style.visibility="hidden",this.verticalLine.style.visibility="hidden"}getLineWidth(t){const{lineWidth:e}=this.options[`${t}LineStyle`];return+(e||Jb.lineWidth||1)/this.context.graph.getZoom()}updateSnapline(t){const{verticalX:e,verticalMinY:n,verticalMaxY:i,horizontalY:a,horizontalMinX:s,horizontalMaxX:o}=t,[l,u]=this.context.canvas.getSize(),{offset:c}=this.options;a!==null?Object.assign(this.horizontalLine.style,{x1:c===1/0?0:s-c,y1:a,x2:c===1/0?l:o+c,y2:a,visibility:"visible",lineWidth:this.getLineWidth("horizontal")}):this.horizontalLine.style.visibility="hidden",e!==null?Object.assign(this.verticalLine.style,{x1:e,y1:c===1/0?0:n-c,x2:e,y2:c===1/0?u:i+c,visibility:"visible",lineWidth:this.getLineWidth("vertical")}):this.verticalLine.style.visibility="hidden"}getDelta(t){const e=this.context.graph.getZoom();return Di([t.dx,t.dy],e)}bindEvents(){return Zb(this,void 0,void 0,function*(){const{graph:t}=this.context;t.on(Zn.DRAG_START,this.onDragStart),t.on(Zn.DRAG,this.onDrag),t.on(Zn.DRAG_END,this.onDragEnd)})}unbindEvents(){const{graph:t}=this.context;t.off(Zn.DRAG_START,this.onDragStart),t.off(Zn.DRAG,this.onDrag),t.off(Zn.DRAG_END,this.onDragEnd)}destroyElements(){var t,e;(t=this.horizontalLine)===null||t===void 0||t.destroy(),(e=this.verticalLine)===null||e===void 0||e.destroy()}destroy(){this.destroyElements(),this.unbindEvents(),super.destroy()}}T0.defaultOptions={tolerance:5,offset:20,autoSnap:!0,shape:"key",verticalLineStyle:{stroke:"#1783FF"},horizontalLineStyle:{stroke:"#1783FF"},filter:()=>!0};const Un=(r,t)=>Math.abs(r-t),GN=(r,t)=>typeof t=="function"?t(r):r.getShape(t);var Zgt=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},Jgt=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};const Qgt=["timestamp","time","date","datetime"];class O0 extends Wn{get padding(){return oa(this.options.padding)}constructor(t,e){super(t,Object.assign({},O0.defaultOptions,e)),this.backup(),this.upsertTimebar()}play(){var t;(t=this.timebar)===null||t===void 0||t.play()}pause(){var t;(t=this.timebar)===null||t===void 0||t.pause()}forward(){var t;(t=this.timebar)===null||t===void 0||t.forward()}backward(){var t;(t=this.timebar)===null||t===void 0||t.backward()}reset(){var t;(t=this.timebar)===null||t===void 0||t.reset()}update(t){super.update(t),this.backup(),this.upsertTimebar()}backup(){this.originalData=VN(this.context.graph.getData())}upsertTimebar(){const{canvas:t}=this.context,e=this.options,{onChange:n,timebarType:i,data:a,x:s,y:o,width:l,height:u,mode:c}=e,h=Jgt(e,["onChange","timebarType","data","x","y","width","height","mode"]),d=t.getSize(),[g]=this.padding;this.upsertCanvas().ready.then(()=>{var p;const v=Object.assign(Object.assign({x:d[0]/2-l/2,y:g,onChange:m=>{const b=(Xr(m)?m:[m,m]).map(w=>OW(w)?w.getTime():w);this.options.mode==="modify"?this.filterElements(b):this.hiddenElements(b),n==null||n(b)}},h),{data:a.map(m=>yt(m)?{time:m,value:0}:m),width:l,height:u,type:i});this.timebar?this.timebar.update(v):(this.timebar=new Ugt({style:v}),(p=this.canvas)===null||p===void 0||p.appendChild(this.timebar))})}upsertCanvas(){if(this.canvas)return this.canvas;const{className:t,height:e,position:n}=this.options,i=this.context.canvas,[a]=i.getSize(),[s,,o]=this.padding,[l,u]=XE({width:a,height:e+s+o,graphCanvas:i,className:"timebar",placement:n});return this.container=l,t&&l.classList.add(t),this.canvas=u,this.canvas}filterElements(t){return Zgt(this,void 0,void 0,function*(){var e;if(!this.originalData)return;const{elementTypes:n,getTime:i}=this.options,{graph:a,element:s}=this.context,o=VN(this.originalData);n.forEach(u=>{const c=`${u}s`;o[c]=(this.originalData[c]||[]).filter(h=>{const d=i(h);return!!HN(d,t)})});const l=[...o.nodes,...o.combos].map(u=>H(u));o.edges=o.edges.filter(u=>{const c=u.source,h=u.target;return l.includes(c)&&l.includes(h)}),a.setData(o),yield(e=s.draw({animation:!1,silence:!0}))===null||e===void 0?void 0:e.finished})}hiddenElements(t){const{graph:e}=this.context,{elementTypes:n,getTime:i}=this.options,a=[],s=[];n.forEach(o=>{var l;const u=`${o}s`;(((l=this.originalData)===null||l===void 0?void 0:l[u])||[]).forEach(h=>{const d=H(h),g=i(h);HN(g,t)?s.push(d):a.push(d)})}),e.hideElement(a,!1),e.showElement(s,!1)}destroy(){var t,e,n;const{graph:i}=this.context;this.originalData&&i.setData(Object.assign({},this.originalData)),(t=this.timebar)===null||t===void 0||t.destroy(),(e=this.canvas)===null||e===void 0||e.destroy(),(n=this.container)===null||n===void 0||n.remove(),this.originalData=void 0,this.container=void 0,this.timebar=void 0,this.canvas=void 0,super.destroy()}}O0.defaultOptions={position:"bottom",enable:!0,timebarType:"time",className:"g6-timebar",width:450,height:60,zIndex:3,elementTypes:["node"],padding:10,mode:"modify",getTime:r=>t0t(r,Qgt,void 0),loop:!1};const VN=r=>{const{nodes:t=[],edges:e=[],combos:n=[]}=r;return{nodes:[...t],edges:[...e],combos:[...n]}},HN=(r,t)=>{if(yt(t))return r===t;const[e,n]=t;return r>=e&&r<=n},t0t=(r,t,e)=>{var n;for(let i=0;i<t.length;i++){const a=t[i],s=(n=r.data)===null||n===void 0?void 0:n[a];if(s)return s}return e};function e0t(r){const t={top:"unset",right:"unset",bottom:"unset",left:"unset"};return r.split("-").forEach(n=>{t[n]="8px"}),t.flexDirection=r.startsWith("top")||r.startsWith("bottom")?"row":"column",t}const n0t=`
- .g6-toolbar {
- position: absolute;
- z-index: 100;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- border-radius: 4px;
- box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
- opacity: 0.65;
- }
- .g6-toolbar .g6-toolbar-item {
- display: inline-block;
- width: 16px;
- height: 16px;
- padding: 4px;
- cursor: pointer;
- box-sizing: content-box;
- }
- .g6-toolbar .g6-toolbar-item:hover {
- background-color: #f0f0f0;
- }
- .g6-toolbar .g6-toolbar-item svg {
- display: inline-block;
- width: 100%;
- height: 100%;
- pointer-events: none;
- }
- `,r0t=`
- <svg>
- <symbol id="zoom-in" viewBox="64 64 896 896">
- <path d="M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>
- </symbol>
- <symbol id="zoom-out" viewBox="64 64 896 896">
- <path d="M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>
- </symbol>
- <symbol id="edit" viewBox="64 64 896 896">
- <path d="M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"></path>
- </symbol>
- <symbol id="delete" viewBox="64 64 896 896">
- <path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"></path>
- </symbol>
- <symbol id="redo" viewBox="64 64 896 896">
- <path d="M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 00-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z"></path>
- </symbol>
- <symbol id="undo" viewBox="64 64 896 896">
- <path d="M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z"></path>
- </symbol>
- <symbol id="export" viewBox="64 64 896 896">
- <path d="M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"></path>
- </symbol>
- <symbol id="auto-fit" viewBox="64 64 896 896">
- <path d="M952 474H829.8C812.5 327.6 696.4 211.5 550 194.2V72c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v122.2C327.6 211.5 211.5 327.6 194.2 474H72c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h122.2C211.5 696.4 327.6 812.5 474 829.8V952c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V829.8C696.4 812.5 812.5 696.4 829.8 550H952c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM512 756c-134.8 0-244-109.2-244-244s109.2-244 244-244 244 109.2 244 244-109.2 244-244 244z"></path>
- <path d="M512 392c-32.1 0-62.1 12.4-84.8 35.2-22.7 22.7-35.2 52.7-35.2 84.8s12.5 62.1 35.2 84.8C449.9 619.4 480 632 512 632s62.1-12.5 84.8-35.2C619.4 574.1 632 544 632 512s-12.5-62.1-35.2-84.8A118.57 118.57 0 00512 392z"></path>
- </symbol>
- <symbol id="reset" viewBox="64 64 896 896">
- <path d="M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"></path>
- </symbol>
- <symbol id="exit-fullscreen" viewBox="0 0 1024 1024">
- <path d="M418.13333333 361.43786666c0 0.2048-0.13653333 0.4096-0.13653334 0.68266667C417.99679999 362.32533333 418.13333333 362.53013333 418.13333333 362.73493333 418.13333333 371.54133333 414.44693333 379.392 408.78079999 385.39946666 408.43946666 385.7408 408.30293333 386.21866666 408.02986666 386.49173333c-1.09226667 1.09226667-2.59413333 1.77493333-3.82293333 2.73066667C398.40426666 393.65973333 391.64586666 396.8 383.93173333 396.8 383.72693333 396.8 383.59039999 396.73173333 383.38559999 396.73173333S382.97599999 396.8 382.77119999 396.8L112.29866666 396.8C92.50133333 396.8 76.79999999 381.50826666 76.79999999 362.66666666 76.66346666 343.89333333 92.63786666 328.53333333 112.16213333 328.53333333l189.44 0L87.44959999 114.51733333C73.59146666 100.59093333 73.25013333 78.5408 86.63039999 65.29706666c13.17546667-13.44853333 35.36213333-12.97066667 49.152 0.88746667l214.08426667 214.08426667L349.86666666 90.89706666C349.79839999 71.23626666 365.22666666 55.46666666 383.99999999 55.46666666 402.77333333 55.33013333 418.13333333 71.30453333 418.13333333 90.8288L418.13333333 361.43786666zM928.90453333 328.53333333l-189.44 0 214.15253333-214.08426667c13.85813333-13.9264 14.19946667-35.90826667 0.88746667-49.22026666-13.17546667-13.44853333-35.36213333-12.97066667-49.152 0.88746666l-214.08426667 214.08426667L691.26826666 90.89706666C691.26826666 71.23626666 675.83999999 55.46666666 657.06666666 55.46666666 638.29333333 55.33013333 622.93333333 71.30453333 622.93333333 90.8288l0 270.60906666c0 0.2048 0.13653333 0.4096 0.13653333 0.68266667C623.06986666 362.32533333 622.93333333 362.53013333 622.93333333 362.73493333 622.93333333 371.54133333 626.61973333 379.392 632.28586666 385.39946666c0.34133333 0.34133333 0.47786667 0.8192 0.8192 1.09226667 1.09226667 1.09226667 2.59413333 1.77493333 3.8912 2.73066667C642.66239999 393.65973333 649.42079999 396.8 657.13493333 396.8c0.2048 0 0.34133333-0.06826667 0.54613333-0.06826667S658.09066666 396.8 658.29546666 396.8l270.5408 0C948.56533333 396.8 964.26666666 381.50826666 964.26666666 362.66666666 964.40319999 343.89333333 948.42879999 328.53333333 928.90453333 328.53333333zM418.13333333 635.73333333c0-8.8064-3.6864-16.5888-9.35253334-22.66453333C408.43946666 612.72746666 408.30293333 612.2496 408.02986666 611.90826666 406.86933333 610.88426666 405.43573333 610.2016 404.20693333 609.24586666 398.47253333 604.80853333 391.64586666 601.6 383.93173333 601.6 383.72693333 601.6 383.59039999 601.73653333 383.38559999 601.73653333S382.97599999 601.6 382.77119999 601.6L112.29866666 601.6C92.50133333 601.6 76.79999999 616.96 76.79999999 635.73333333 76.66346666 654.50666666 92.63786666 669.86666666 112.16213333 669.86666666l189.44 0-214.15253334 214.15253334c-13.85813333 13.85813333-14.19946667 35.84-0.88746666 49.22026666 13.17546667 13.44853333 35.36213333 12.9024 49.152-0.95573333l214.08426666-214.08426667 0 189.37173334c0 19.59253333 15.42826667 35.49866667 34.2016 35.36213333C402.77333333 943.2064 418.13333333 927.232 418.13333333 907.5712L418.13333333 637.09866666c0-0.27306667-0.13653333-0.47786667-0.13653334-0.68266666C417.99679999 636.14293333 418.13333333 635.93813333 418.13333333 635.73333333zM739.46453333 669.86666666l189.44 0c19.456 0 35.49866667-15.36 35.36213333-34.13333333C964.26666666 616.96 948.56533333 601.6 928.76799999 601.6L658.29546666 601.6C658.09066666 601.6 657.88586666 601.73653333 657.68106666 601.73653333S657.33973333 601.6 657.13493333 601.6C649.42079999 601.6 642.59413333 604.80853333 636.85973333 609.24586666 635.63093333 610.2016 634.19733333 610.88426666 633.03679999 611.90826666 632.76373333 612.2496 632.62719999 612.72746666 632.28586666 613.0688 626.61973333 619.14453333 622.93333333 626.92693333 622.93333333 635.73333333c0 0.2048 0.13653333 0.4096 0.13653333 0.68266667C623.06986666 636.6208 622.93333333 636.8256 622.93333333 637.09866666l0 270.5408C622.93333333 927.232 638.29333333 943.2064 657.06666666 942.93333333c18.77333333 0.13653333 34.2016-15.70133333 34.2016-35.36213333l0-189.37173334 214.08426667 214.08426667c13.78986667 13.85813333 35.90826667 14.40426667 49.152 0.95573333 13.312-13.312 12.97066667-35.36213333-0.88746667-49.22026666L739.46453333 669.86666666z" ></path></symbol>
- <symbol id="request-fullscreen" viewBox="0 0 1024 1024">
- <path d="M69.818182 87.598545v273.128728a34.909091 34.909091 0 0 0 69.818182 0V163.653818l221.928727 222.021818a33.512727 33.512727 0 0 0 47.383273-47.383272L186.926545 116.363636h197.073455a34.909091 34.909091 0 0 0 0-69.818181H110.871273C85.364364 46.545455 69.818182 59.671273 69.818182 87.598545zM938.542545 46.545455H665.413818a34.909091 34.909091 0 0 0 0 69.818181h197.073455L640.465455 338.292364a33.512727 33.512727 0 0 0 47.383272 47.383272l221.928728-222.021818v197.073455a34.909091 34.909091 0 0 0 69.818181 0V87.598545c0-27.927273-15.453091-41.053091-40.96-41.05309z m-827.671272 907.636363h273.128727a34.909091 34.909091 0 0 0 0-69.818182H186.926545l222.021819-221.928727a33.512727 33.512727 0 0 0-47.383273-47.383273L139.636364 837.073455V640a34.909091 34.909091 0 0 0-69.818182 0v273.128727c0 27.927273 15.546182 41.053091 41.053091 41.053091z m868.724363-41.053091V640a34.909091 34.909091 0 0 0-69.818181 0v197.073455L687.941818 615.051636a33.512727 33.512727 0 0 0-47.383273 47.383273L862.487273 884.363636H665.413818a34.909091 34.909091 0 0 0 0 69.818182h273.128727c25.6 0 41.053091-13.125818 41.053091-41.053091z" ></path></symbol>
- </svg>
- `;var UN=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class C0 extends Wn{constructor(t,e){super(t,Object.assign({},C0.defaultOptions,e)),this.$element=iu("toolbar",!1),this.onToolbarItemClick=i=>{const{onClick:a}=this.options;if(i.target instanceof Element&&i.target.className.includes("g6-toolbar-item")){const s=i.target.getAttribute("value");a==null||a(s,i.target)}};const n=this.context.canvas.getContainer();this.$element.style.display="flex",n.appendChild(this.$element),ox("g6-toolbar-css","style",{},n0t,document.head),ox("g6-toolbar-svgicon","div",{display:"none"},r0t),this.$element.addEventListener("click",this.onToolbarItemClick),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return UN(this,void 0,void 0,function*(){e.update.call(this,t);const{className:n,position:i,style:a}=this.options;this.$element.className=`g6-toolbar ${n||""}`,Object.assign(this.$element.style,a,e0t(i)),this.$element.innerHTML=yield this.getDOMContent()})}destroy(){this.$element.removeEventListener("click",this.onToolbarItemClick),this.$element.remove(),super.destroy()}getDOMContent(){return UN(this,void 0,void 0,function*(){return(yield this.options.getItems()).map(e=>`
- <div class="g6-toolbar-item" value="${e.value}">
- <svg aria-hidden="true" focusable="false">
- <use xlink:href="#${e.id}"></use>
- </svg>
- </div>`).join("")})}}C0.defaultOptions={position:"top-left"};var YN=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class A0 extends Wn{constructor(t,e){super(t,Object.assign({},A0.defaultOptions,e)),this.currentTarget=null,this.tooltipElement=null,this.container=null,this.isEnable=(n,i)=>{const{enable:a}=this.options;return typeof a=="function"?a(n,i):a},this.onClick=n=>{const{target:{id:i}}=n;this.currentTarget===i?this.hide(n):this.show(n)},this.onPointerMove=n=>{const{target:i}=n;!this.currentTarget||i.id===this.currentTarget||this.show(n)},this.onPointerLeave=n=>{this.hide(n)},this.onCanvasMove=n=>{this.hide(n)},this.onPointerEnter=n=>{this.show(n)},this.showById=n=>YN(this,void 0,void 0,function*(){const i={target:{id:n}};yield this.show(i)}),this.getElementData=(n,i)=>{const{model:a}=this.context;switch(i){case"node":return a.getNodeData([n]);case"edge":return a.getEdgeData([n]);case"combo":return a.getComboData([n]);default:return[]}},this.show=n=>YN(this,void 0,void 0,function*(){var i,a;const{client:s,target:{id:o}}=n;if(Eg(n.target))return;const l=this.context.graph.getElementType(o),{getContent:u,title:c}=this.options,h=this.getElementData(o,l);if(!this.tooltipElement||!this.isEnable(n,h))return;let d={};if(u){if(d.content=yield u(n,h),!d.content)return}else{const v=this.context.graph.getElementRenderStyle(o),m=l==="node"?v.fill:v.stroke;d={title:c||l,data:h.map(b=>({name:"ID",value:b.id||`${b.source} -> ${b.target}`,color:m}))}}this.currentTarget=o;let g,p;if(s)g=s.x,p=s.y;else{const v=sr(h,"0.style",{x:0,y:0});g=v.x,p=v.y}(a=(i=this.options).onOpenChange)===null||a===void 0||a.call(i,!0),this.tooltipElement.update(Object.assign(Object.assign(Object.assign({},this.tooltipStyleProps),{x:g,y:p,style:{".tooltip":{visibility:"visible"}}}),d))}),this.hide=n=>{var i,a,s,o,l;if(!n){(a=(i=this.options).onOpenChange)===null||a===void 0||a.call(i,!1),(s=this.tooltipElement)===null||s===void 0||s.hide(),this.currentTarget=null;return}if(!this.tooltipElement||!this.currentTarget)return;const{client:{x:u,y:c}}=n;(l=(o=this.options).onOpenChange)===null||l===void 0||l.call(o,!1),this.tooltipElement.hide(u,c),this.currentTarget=null},this.initTooltip=()=>{var n;const i=new Ogt({className:"tooltip",style:this.tooltipStyleProps});return(n=this.container)===null||n===void 0||n.appendChild(i.HTMLTooltipElement),i},this.render(),this.bindEvents()}getEvents(){return this.options.trigger==="click"?{"node:click":this.onClick,"edge:click":this.onClick,"combo:click":this.onClick,"canvas:click":this.onPointerLeave,contextmenu:this.onPointerLeave,drag:this.onPointerLeave}:{"node:pointerenter":this.onPointerEnter,"node:pointermove":this.onPointerMove,"canvas:pointermove":this.onCanvasMove,"edge:pointerenter":this.onPointerEnter,"edge:pointermove":this.onPointerMove,"combo:pointerenter":this.onPointerEnter,"combo:pointermove":this.onPointerMove,contextmenu:this.onPointerLeave,"node:drag":this.onPointerLeave}}update(t){var e;this.unbindEvents(),super.update(t),this.tooltipElement&&((e=this.container)===null||e===void 0||e.removeChild(this.tooltipElement.HTMLTooltipElement)),this.tooltipElement=this.initTooltip(),this.bindEvents()}render(){const{canvas:t}=this.context,e=t.getContainer();e&&(this.container=e,this.tooltipElement=this.initTooltip())}unbindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach(n=>{t.off(n,e[n])})}bindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach(n=>{t.on(n,e[n])})}get tooltipStyleProps(){const{canvas:t}=this.context,{center:e}=t.getBounds(),n=t.getContainer(),{top:i,left:a}=n.getBoundingClientRect(),{style:s,position:o,enterable:l,container:u={x:-a,y:-i},title:c,offset:h}=this.options,[d,g]=e,[p,v]=t.getSize();return{x:d,y:g,container:u,title:c,bounding:{x:0,y:0,width:p,height:v},position:o,enterable:l,offset:h,style:s}}destroy(){var t;this.unbindEvents(),this.tooltipElement&&((t=this.container)===null||t===void 0||t.removeChild(this.tooltipElement.HTMLTooltipElement)),super.destroy()}}A0.defaultOptions={trigger:"hover",position:"top-right",enterable:!1,enable:!0,offset:[10,10],style:{".tooltip":{visibility:"hidden"}}};var c5=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};let wl;function h5(r,t){return wl||(wl=document.createElement("canvas")),wl.width=r,wl.height=t,wl.getContext("2d").clearRect(0,0,r,t),wl}function i0t(r,t,e,n){return c5(this,void 0,void 0,function*(){const i=h5(r,t),a=i.getContext("2d"),{rotate:s,opacity:o,textFill:l,textFontSize:u,textFontFamily:c,textFontVariant:h,textFontWeight:d,textAlign:g,textBaseline:p}=n;return a.textAlign=g,a.textBaseline=p,a.translate(r/2,t/2),a.font=`${u}px ${c} ${h} ${d}`,s&&a.rotate(s),o&&(a.globalAlpha=o),l&&(a.fillStyle=l,a.fillText(`${e}`,0,0)),i.toDataURL()})}function a0t(r,t,e,n){return c5(this,void 0,void 0,function*(){const i=h5(r,t),a=i.getContext("2d"),{rotate:s,opacity:o}=n;s&&a.rotate(s),o&&(a.globalAlpha=o);const l=new Image;return l.crossOrigin="anonymous",l.src=e,new Promise(u=>{l.onload=function(){const c=r>l.width?(r-l.width)/2:0,h=t>l.height?(t-l.height)/2:0;a.drawImage(l,0,0,l.width,l.height,c,h,r-c*2,t-h*2),u(i.toDataURL())}})})}var s0t=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},o0t=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class P0 extends Wn{constructor(t,e){super(t,Object.assign({},P0.defaultOptions,e)),this.$element=iu("watermark"),this.context.canvas.getContainer().appendChild(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return s0t(this,void 0,void 0,function*(){e.update.call(this,t);const n=this.options,{width:i,height:a,text:s,imageURL:o}=n,l=o0t(n,["width","height","text","imageURL"]);Object.keys(l).forEach(c=>{c.startsWith("background")&&(this.$element.style[c]=t[c])});const u=o?yield a0t(i,a,o,l):yield i0t(i,a,s,l);this.$element.style.backgroundImage=`url(${u})`})}destroy(){super.destroy(),this.$element.remove()}}P0.defaultOptions={width:200,height:100,opacity:.2,rotate:Math.PI/12,text:"",textFill:"#000",textFontSize:16,textAlign:"center",textBaseline:"middle",backgroundRepeat:"repeat"};const l0t=["#7E92B5","#F4664A","#FFBE3A"],u0t={type:"group",color:["#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]},c0t={type:"group",color:["#99ADD1","#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]};function d5(r){const{bgColor:t,textColor:e,nodeColor:n,nodeColorDisabled:i,nodeStroke:a,nodeHaloStrokeOpacityActive:s=.15,nodeHaloStrokeOpacitySelected:o=.25,nodeOpacityDisabled:l=.06,nodeIconOpacityInactive:u=.85,nodeOpacityInactive:c=.25,nodeBadgePalette:h=l0t,nodePaletteOptions:d=u0t,edgeColor:g,edgeColorDisabled:p,edgePaletteOptions:v=c0t,comboColor:m,comboColorDisabled:b,comboStroke:w,comboStrokeDisabled:x,edgeColorInactive:_}=r;return{background:t,node:{palette:d,style:{donutOpacity:1,badgeBackgroundOpacity:1,badgeFill:"#fff",badgeFontSize:8,badgePadding:[0,4],badgePalette:h,fill:n,fillOpacity:1,halo:!1,iconFill:"#fff",iconOpacity:1,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelFill:e,labelFillOpacity:.85,labelLineHeight:16,labelPadding:[0,2],labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelOffsetY:2,lineWidth:0,portFill:n,portLineWidth:1,portStroke:a,portStrokeOpacity:.65,size:32,stroke:a,strokeOpacity:1,zIndex:2},state:{selected:{halo:!0,haloLineWidth:24,haloStrokeOpacity:o,labelFontSize:12,labelFontWeight:"bold",lineWidth:4,stroke:a},active:{halo:!0,haloLineWidth:12,haloStrokeOpacity:s},highlight:{labelFontWeight:"bold",lineWidth:4,stroke:a,strokeOpacity:.85},inactive:{badgeBackgroundOpacity:c,donutOpacity:c,fillOpacity:c,iconOpacity:u,labelFill:e,labelFillOpacity:c,strokeOpacity:c},disabled:{badgeBackgroundOpacity:.25,donutOpacity:l,fill:i,fillOpacity:l,iconFill:i,iconOpacity:.25,labelFill:e,labelFillOpacity:.25,strokeOpacity:l}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"node-expand",collapse:"node-collapse",update:[{fields:["x","y","fill","stroke"]}],translate:[{fields:["x","y"]}]}},edge:{palette:v,style:{badgeBackgroundFill:g,badgeFill:"#fff",badgeFontSize:8,badgeOffsetX:10,fillOpacity:1,halo:!1,haloLineWidth:12,haloStrokeOpacity:1,increasedLineWidthForHitTesting:2,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[4,4,4,4],labelFill:e,labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelPlacement:"center",labelTextBaseline:"middle",lineWidth:1,stroke:g,strokeOpacity:1,zIndex:1},state:{selected:{halo:!0,haloStrokeOpacity:.25,labelFontSize:14,labelFontWeight:"bold",lineWidth:3},active:{halo:!0,haloStrokeOpacity:.15},highlight:{labelFontWeight:"bold",lineWidth:3},inactive:{stroke:_,fillOpacity:.08,labelOpacity:.25,strokeOpacity:.08,badgeBackgroundOpacity:.25},disabled:{stroke:p,fillOpacity:.45,strokeOpacity:.45,labelOpacity:.25,badgeBackgroundOpacity:.45}},animation:{enter:"fade",exit:"fade",expand:"path-in",collapse:"path-out",show:"fade",hide:"fade",update:[{fields:["sourceNode","targetNode"]},{fields:["stroke"],shape:"key"}],translate:[{fields:["sourceNode","targetNode"]}]}},combo:{style:{collapsedMarkerFill:t,collapsedMarkerFontSize:12,collapsedMarkerFillOpacity:1,collapsedSize:32,collapsedFillOpacity:1,fill:m,halo:!1,haloLineWidth:12,haloStroke:w,haloStrokeOpacity:.25,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[2,4,2,4],labelFill:e,labelFontSize:12,labelFontWeight:400,labelOpacity:1,lineDash:0,lineWidth:1,fillOpacity:.04,strokeOpacity:1,padding:10,stroke:w},state:{selected:{halo:!0,labelFontSize:14,labelFontWeight:700,lineWidth:4},active:{halo:!0},highlight:{labelFontWeight:700,lineWidth:4},inactive:{fillOpacity:.65,labelOpacity:.25,strokeOpacity:.65},disabled:{fill:b,fillOpacity:.25,labelOpacity:.25,stroke:x,strokeOpacity:.25}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"combo-expand",collapse:"combo-collapse",update:[{fields:["x","y"]},{fields:["fill","stroke","lineWidth"],shape:"key"}],translate:[{fields:["x","y"]}]}}}}const h0t={type:"group",color:["#637088","#0F55A6","#008383","#9C5D38","#8B53A6","#4E40A6","#8F6608","#3E801D","#A65383","#175E75","#0F8248"]},d0t={bgColor:"#000000",comboColor:"#fdfdfd",comboColorDisabled:"#d0e4ff",comboStroke:"#99add1",comboStrokeDisabled:"#969696",edgeColor:"#637088",edgeColorDisabled:"#637088",edgeColorInactive:"#D0E4FF",edgePaletteOptions:h0t,nodeColor:"#1783ff",nodeColorDisabled:"#D0E4FF",nodeHaloStrokeOpacityActive:.25,nodeHaloStrokeOpacitySelected:.45,nodeIconOpacityInactive:.45,nodeOpacityDisabled:.25,nodeOpacityInactive:.45,nodeStroke:"#d0e4ff",textColor:"#ffffff"},f0t=d5(d0t),g0t={bgColor:"#ffffff",comboColor:"#99ADD1",comboColorDisabled:"#f0f0f0",comboStroke:"#99add1",comboStrokeDisabled:"#d9d9d9",edgeColor:"#99add1",edgeColorDisabled:"#d9d9d9",edgeColorInactive:"#1B324F",nodeColor:"#1783ff",nodeColorDisabled:"#1B324F",nodeHaloStrokeOpacityActive:.15,nodeHaloStrokeOpacitySelected:.25,nodeIconOpacityInactive:.85,nodeOpacityDisabled:.06,nodeOpacityInactive:.25,nodeStroke:"#000000",textColor:"#000000"},p0t=d5(g0t);class Ka extends Hx{beforeDraw(t,e){return t}afterLayout(t,e){}}class v0t extends Ka{beforeDraw(t){const{model:e}=this.context,n=t.add.combos,i=a=>{const s=[];return a.forEach((o,l)=>{const c=e.getAncestorsData(l,"combo").map(h=>H(h)).reverse();s.push([l,o,c.length])}),new Map(s.sort(([,,o],[,,l])=>l-o).map(([o,l])=>[o,l]))};return t.add.combos=i(n),t.update.combos=i(t.update.combos),t}}function Vr(r,t,e,n,i){const a=H(n),s=`${e}s`,o=i?n:r.add[s].get(a)||r.update[s].get(a)||r.remove[s].get(a)||n;Object.entries(r).forEach(([l,u])=>{t===l?u[s].set(a,o):u[s].delete(a)})}function lf(r,t){return Object.keys(r).every(e=>r[e]===t[e])}class m0t extends Ka{beforeDraw(t,e){if(e.stage==="visibility"||!this.context.model.model.hasTreeStructure(we))return t;const{model:n}=this.context,{add:i,update:a}=t,s=[...t.update.combos.entries(),...t.add.combos.entries()];for(;s.length;){const[o,l]=s.pop();if(Sr(l)){const u=n.getDescendantsData(o),c=u.map(H),{internal:h,external:d}=zw(c,g=>n.getRelatedEdgesData(g));u.forEach(g=>{const p=H(g),v=s.findIndex(([b])=>b===p);v!==-1&&s.splice(v,1);const m=n.getElementType(p);Vr(t,"remove",m,g)}),h.forEach(g=>Vr(t,"remove","edge",g)),d.forEach(g=>{var p;const v=H(g);((p=this.context.element)===null||p===void 0?void 0:p.getElement(v))?a.edges.set(v,g):i.edges.set(v,g)})}else{const u=n.getChildrenData(o),c=u.map(H),{edges:h}=zw(c,d=>n.getRelatedEdgesData(d));[...u,...h].forEach(d=>{var g;const p=H(d),v=n.getElementType(p);((g=this.context.element)===null||g===void 0?void 0:g.getElement(p))?Vr(t,"update",v,d):Vr(t,"add",v,d),v==="combo"&&s.push([p,d])})}}return t}}const XN=(r,t,e,n)=>{const i=`${e}s`,a=H(n);!r.add[i].has(a)&&!r.update[i].has(a)&&r[t][i].set(H(n),n)};class y0t extends Ka{getElement(t){return this.context.element.getElement(t)}handleExpand(t,e){if(XN(e,"add","node",t),Sr(t))return;const n=H(t);XN(e,"add","node",t),this.context.model.getRelatedEdgesData(n,"out").forEach(s=>{Vr(e,"add","edge",s)}),this.context.model.getChildrenData(n).forEach(s=>{this.handleExpand(s,e)})}beforeDraw(t){const{graph:e,model:n}=this.context;if(!n.model.hasTreeStructure(jr))return t;const{add:{nodes:i,edges:a},update:{nodes:s}}=t,o=new Map,l=new Map;i.forEach((c,h)=>{Sr(c)&&o.set(h,c)}),a.forEach(c=>{if(e.getElementType(c.source)!=="node")return;const h=e.getNodeData(c.source);Sr(h)&&o.set(c.source,h)}),s.forEach((c,h)=>{const d=this.getElement(h);if(!d)return;const g=d.attributes.collapsed;Sr(c)?g||o.set(h,c):g&&l.set(h,c)});const u=new Set;return o.forEach((c,h)=>{n.getDescendantsData(h).forEach(g=>{const p=H(g);if(u.has(p))return;Vr(t,"remove","node",g),n.getRelatedEdgesData(p).forEach(m=>{Vr(t,"remove","edge",m)}),u.add(p)})}),l.forEach((c,h)=>{if(n.getAncestorsData(h,jr).some(Sr)){Vr(t,"remove","node",c);return}this.handleExpand(c,t)}),t}}function Zu(r,t,e,n=!1){const i=Pw[r][t];!n&&i?i!==e&&sa.warn(`The extension ${t} of ${r} has been registered before.`):Object.assign(Pw[r],{[t]:e})}/*!
- * @antv/g-plugin-dragndrop
- * @description A G plugin for Drag n Drop implemented with PointerEvents
- * @version 2.0.32
- * @date 1/23/2025, 8:33:12 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var f5=function(){function r(t){at(this,r),this.dragndropPluginOptions=t}return it(r,[{key:"apply",value:function(e){var n=this,i=e.renderingService,a=e.renderingContext,s=a.root.ownerDocument,o=s.defaultView,l=function(c){var h=c.target,d=h===s,g=d&&n.dragndropPluginOptions.isDocumentDraggable?s:h.closest&&h.closest("[draggable=true]");if(g){var p=!1,v=c.timeStamp,m=[c.clientX,c.clientY],b=null,w=[c.clientX,c.clientY],x=function(){var S=Fs($n().mark(function M(k){var T,P,O,A,R,L;return $n().wrap(function(j){for(;;)switch(j.prev=j.next){case 0:if(p){j.next=8;break}if(T=k.timeStamp-v,P=wr([k.clientX,k.clientY],m),!(T<=n.dragndropPluginOptions.dragstartTimeThreshold||P<=n.dragndropPluginOptions.dragstartDistanceThreshold)){j.next=5;break}return j.abrupt("return");case 5:k.type="dragstart",g.dispatchEvent(k),p=!0;case 8:if(k.type="drag",k.dx=k.clientX-w[0],k.dy=k.clientY-w[1],g.dispatchEvent(k),w=[k.clientX,k.clientY],d){j.next=21;break}return O=n.dragndropPluginOptions.overlap==="pointer"?[k.canvasX,k.canvasY]:h.getBounds().center,j.next=17,s.elementsFromPoint(O[0],O[1]);case 17:A=j.sent,R=A[A.indexOf(h)+1],L=(R==null?void 0:R.closest("[droppable=true]"))||(n.dragndropPluginOptions.isDocumentDroppable?s:null),b!==L&&(b&&(k.type="dragleave",k.target=b,b.dispatchEvent(k)),L&&(k.type="dragenter",k.target=L,L.dispatchEvent(k)),b=L,b&&(k.type="dragover",k.target=b,b.dispatchEvent(k)));case 21:case"end":return j.stop()}},M)}));return function(k){return S.apply(this,arguments)}}();o.addEventListener("pointermove",x);var _=function(M){if(p){M.detail={preventClick:!0};var k=M.clone();b&&(k.type="drop",k.target=b,b.dispatchEvent(k)),k.type="dragend",g.dispatchEvent(k),p=!1}o.removeEventListener("pointermove",x)};h.addEventListener("pointerup",_,{once:!0}),h.addEventListener("pointerupoutside",_,{once:!0})}};i.hooks.init.tap(r.tag,function(){o.addEventListener("pointerdown",l)}),i.hooks.destroy.tap(r.tag,function(){o.removeEventListener("pointerdown",l)})}}])}();f5.tag="Dragndrop";var b0t=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return at(this,t),e=qt(this,t),e.name="dragndrop",e.options=n,e}return jt(t,r),it(t,[{key:"init",value:function(){this.addRenderingPlugin(new f5(Ft({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}},{key:"setOptions",value:function(n){Object.assign(this.plugins[0].dragndropPluginOptions,n)}}])}(Vs),KN=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},ZN=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};const JN=["main"],QN=["background","main","label","transient"];function w0t(r){return r.main}class tR{getConfig(){return this.config}getLayer(t="main"){return this.extends.layers[t]||w0t(this.getLayers())}getLayers(){return this.extends.layers}getRenderer(t){return this.extends.renderers[t]}getCamera(t="main"){return this.getLayer(t).getCamera()}getRoot(t="main"){return this.getLayer(t).getRoot()}getContextService(t="main"){return this.getLayer(t).getContextService()}setCursor(t){this.config.cursor=t,this.getLayer().setCursor(t)}get document(){return this.getLayer().document}get context(){return this.getLayer().context}constructor(t){this.config={enableMultiLayer:!0},Object.assign(this.config,t);const e=this.config,{renderer:n,background:i,cursor:a,enableMultiLayer:s}=e,o=ZN(e,["renderer","background","cursor","enableMultiLayer"]),l=s?QN:JN,u=eR(n,l),c=Object.fromEntries(l.map(h=>{const d=new Aw(Object.assign(Object.assign({},o),{supportsMutipleCanvasesInOneContainer:s,renderer:u[h],background:s?h==="background"?i:void 0:i}));return[h,d]}));nR(c),this.extends={config:this.config,renderer:n,renderers:u,layers:c}}get ready(){return Promise.all(Object.entries(this.getLayers()).map(([,t])=>t.ready))}resize(t,e){Object.assign(this.extends.config,{width:t,height:e}),Object.values(this.getLayers()).forEach(n=>{const i=n.getCamera(),a=i.getPosition(),s=i.getFocalPoint();n.resize(t,e),i.setPosition(a),i.setFocalPoint(s)})}getBounds(t){return Ic(Object.values(this.getLayers()).map(e=>t?e.getRoot().childNodes.find(i=>i.classList.includes(t)):e.getRoot()).filter(e=>(e==null?void 0:e.childNodes.length)>0).map(e=>e.getBounds()))}getContainer(){const t=this.extends.config.container;return typeof t=="string"?document.getElementById(t):t}getSize(){return[this.extends.config.width||0,this.extends.config.height||0]}appendChild(t,e){var n;const i=((n=t.style)===null||n===void 0?void 0:n.$layer)||"main";return this.getLayer(i).appendChild(t,e)}setRenderer(t){if(t===this.extends.renderer)return;const e=eR(t,this.config.enableMultiLayer?QN:JN);this.extends.renderers=e,Object.entries(e).forEach(([n,i])=>this.getLayer(n).setRenderer(i)),nR(this.getLayers())}getCanvasByViewport(t){return zn(this.getLayer().viewport2Canvas(Ni(t)))}getViewportByCanvas(t){return zn(this.getLayer().canvas2Viewport(Ni(t)))}getViewportByClient(t){return zn(this.getLayer().client2Viewport(Ni(t)))}getClientByViewport(t){return zn(this.getLayer().viewport2Client(Ni(t)))}getClientByCanvas(t){return this.getClientByViewport(this.getViewportByCanvas(t))}getCanvasByClient(t){const e=this.getLayer(),n=e.client2Viewport(Ni(t));return zn(e.viewport2Canvas(n))}toDataURL(){return KN(this,arguments,void 0,function*(t={}){const e=globalThis.devicePixelRatio||1,{mode:n="viewport"}=t,i=ZN(t,["mode"]);let[a,s,o,l]=[0,0,0,0];if(n==="viewport")[o,l]=this.getSize();else if(n==="overall"){const b=this.getBounds(),w=Us(b);[a,s]=b.min,[o,l]=w}const u=gw('<div id="virtual-image"></div>'),c=new Aw({width:o,height:l,renderer:new pc,devicePixelRatio:e,container:u,background:this.extends.config.background});yield c.ready,c.appendChild(this.getLayer("background").getRoot().cloneNode(!0)),c.appendChild(this.getRoot().cloneNode(!0));const h=this.getLayer("label").getRoot().cloneNode(!0),d=c.viewport2Canvas({x:0,y:0}),g=this.getCanvasByViewport([0,0]);h.translate([g[0]-d.x,g[1]-d.y]),h.scale(1/this.getCamera().getZoom()),c.appendChild(h),c.appendChild(this.getLayer("transient").getRoot().cloneNode(!0));const p=this.getCamera(),v=c.getCamera();if(n==="viewport")v.setZoom(p.getZoom()),v.setPosition(p.getPosition()),v.setFocalPoint(p.getFocalPoint());else if(n==="overall"){const[b,w,x]=v.getPosition(),[_,S,M]=v.getFocalPoint();v.setPosition([b+a,w+s,x]),v.setFocalPoint([_+a,S+s,M])}const m=c.getContextService();return new Promise(b=>{c.addEventListener($r.RERENDER,()=>KN(this,void 0,void 0,function*(){yield new Promise(x=>setTimeout(x,300));const w=yield m.toDataURL(i);b(w)}))})})}destroy(){Object.values(this.getLayers()).forEach(t=>{t.getCamera().cancelLandmarkAnimation(),t.destroy()})}}function eR(r,t){return Object.fromEntries(t.map(e=>{const n=(r==null?void 0:r(e))||new pc;return n instanceof pc&&n.setConfig({enableDirtyRectangleRendering:!1}),e==="main"?n.registerPlugin(new b0t({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):n.unregisterPlugin(n.getPlugin("dom-interaction")),[e,n]}))}function nR(r){Object.entries(r).forEach(([t,e])=>{const n=e.getContextService().getDomElement();n!=null&&n.style&&(n.style.gridArea="1 / 1 / 2 / 2",n.style.outline="none",n.tabIndex=1,t!=="main"&&(n.style.pointerEvents="none")),n!=null&&n.parentElement&&(n.parentElement.style.display="grid")})}const xl=r=>r?parseInt(r):0;function x0t(r){const t=getComputedStyle(r),e=r.clientWidth||xl(t.width),n=r.clientHeight||xl(t.height),i=xl(t.paddingLeft)+xl(t.paddingRight),a=xl(t.paddingTop)+xl(t.paddingBottom);return[e-i,n-a]}function rR(r){if(!r)return[0,0];let t=640,e=480;const[n,i]=x0t(r);t=n||t,e=i||e;const a=1,s=1;return[Math.max(yt(t)?t:a,a),Math.max(yt(e)?e:s,s)]}class N0{constructor(t){this.type=t}}class hn extends N0{constructor(t,e){super(t),this.data=e}}class hi extends N0{constructor(t,e,n,i){super(t),this.animationType=e,this.animation=n,this.data=i}}class El extends N0{constructor(t,e,n){super(t),this.elementType=e,this.data=n}}class Vd extends N0{constructor(t,e){super(t),this.data=e}}function xn(r,t){r.emit(t.type,t)}function E0t(r){if(!r)return null;if(r instanceof $L)return{type:"canvas",element:r};let t=r;for(;t;){if(jc(t))return{type:"node",element:t};if(UI(t))return{type:"edge",element:t};if(nE(t))return{type:"combo",element:t};t=t.parentElement}return null}function iR(r){var t;return((t=r==null?void 0:r.style)===null||t===void 0?void 0:t.zIndex)||0}const sc="cachedStyle",KE=r=>`__${r}__`;function _0t(r,t){const e=Array.isArray(t)?t:[t];sr(r,sc)||uc(r,sc,{}),e.forEach(n=>{uc(sr(r,sc),KE(n),r.attributes[n])})}function aR(r,t){return sr(r,[sc,KE(t)])}function S0t(r,t){return KE(t)in(sr(r,sc)||{})}class M0t{constructor(t){this.tasks=[],this.animations=new Set,this.context=t}getTasks(){const t=[...this.tasks];return this.tasks=[],t}add(t,e){this.tasks.push([t,e])}animate(t,e,n){var i,a,s;(i=e==null?void 0:e.before)===null||i===void 0||i.call(e);const o=this.getTasks().map(([u,c])=>{var h,d,g;const{element:p,elementType:v,stage:m}=u,b=KY(this.context.options,v,m,t);(h=c==null?void 0:c.before)===null||h===void 0||h.call(c);const w=b.length?JY(p,this.inferStyle(u,n),b):null;return w?((d=c==null?void 0:c.beforeAnimate)===null||d===void 0||d.call(c,w),w.finished.then(()=>{var x,_;(x=c==null?void 0:c.afterAnimate)===null||x===void 0||x.call(c,w),(_=c==null?void 0:c.after)===null||_===void 0||_.call(c),this.animations.delete(w)})):(g=c==null?void 0:c.after)===null||g===void 0||g.call(c),w}).filter(Boolean);o.forEach(u=>this.animations.add(u));const l=qx(o);return l?((a=e==null?void 0:e.beforeAnimate)===null||a===void 0||a.call(e,l),l.finished.then(()=>{var u,c;(u=e==null?void 0:e.afterAnimate)===null||u===void 0||u.call(e,l),(c=e==null?void 0:e.after)===null||c===void 0||c.call(e),this.release()})):(s=e==null?void 0:e.after)===null||s===void 0||s.call(e),l}inferStyle(t,e){var n,i;const{element:a,elementType:s,stage:o,originalStyle:l,updatedStyle:u={}}=t;t.modifiedStyle||(t.modifiedStyle=Object.assign(Object.assign({},l),u));const{modifiedStyle:c}=t,h={},d={};if(o==="enter")Object.assign(h,{opacity:0});else if(o==="exit")Object.assign(d,{opacity:0});else if(o==="show")Object.assign(h,{opacity:0}),Object.assign(d,{opacity:(n=aR(a,"opacity"))!==null&&n!==void 0?n:fc("opacity")});else if(o==="hide")Object.assign(h,{opacity:(i=aR(a,"opacity"))!==null&&i!==void 0?i:fc("opacity")}),Object.assign(d,{opacity:0});else if(o==="collapse"){const{collapse:g}=e||{},{target:p,descendants:v,position:m}=g;if(s==="node"){if(v.includes(a.id)){const[b,w,x]=m;Object.assign(d,{x:b,y:w,z:x})}}else if(s==="combo"){if(a.id===p||v.includes(a.id)){const[b,w]=m;Object.assign(d,{x:b,y:w,childrenNode:l.childrenNode})}}else s==="edge"&&Object.assign(d,{sourceNode:c.sourceNode,targetNode:c.targetNode})}else if(o==="expand"){const{expand:g}=e||{},{target:p,descendants:v,position:m}=g;if(s==="node"){if(a.id===p||v.includes(a.id)){const[b,w,x]=m;Object.assign(h,{x:b,y:w,z:x})}}else if(s==="combo"){if(a.id===p||v.includes(a.id)){const[b,w,x]=m;Object.assign(h,{x:b,y:w,z:x,childrenNode:c.childrenNode})}}else s==="edge"&&Object.assign(h,{sourceNode:c.sourceNode,targetNode:c.targetNode})}return[Object.keys(h).length>0?Object.assign({},l,h):l,Object.keys(d).length>0?Object.assign({},c,d):c]}stop(){this.animations.forEach(t=>t.cancel())}clear(){this.tasks=[]}release(){var t,e;const{canvas:n}=this.context,i=(e=(t=n.document)===null||t===void 0?void 0:t.timeline)===null||e===void 0?void 0:e.animationsWithPromises;i&&(n.document.timeline.animationsWithPromises=i.filter(a=>a.playState!=="finished"))}destroy(){this.stop(),this.animations.clear(),this.tasks=[]}}class k0t{constructor(t){this.batchCount=0,this.context=t}emit(t){const{graph:e}=this.context;e.emit(t.type,t)}startBatch(t=!0){this.batchCount++,this.batchCount===1&&this.emit(new hn(ut.BATCH_START,{initiate:t}))}endBatch(){this.batchCount--,this.batchCount===0&&this.emit(new hn(ut.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class T0t extends Vx{constructor(t){super(t),this.currentTarget=null,this.currentTargetType=null,this.category="behavior",this.forwardCanvasEvents=e=>{const{target:n}=e,i=E0t(n);if(!i)return;const{graph:a,canvas:s}=this.context,{type:o,element:l}=i;if("destroyed"in l&&(Eg(l)||l.destroyed))return;const{type:u,detail:c,button:h}=e,d=Object.assign(Object.assign({},e),{target:l,targetType:o,originalTarget:n});u===J.POINTER_MOVE&&(this.currentTarget!==l&&(this.currentTarget&&a.emit(`${this.currentTargetType}:${J.POINTER_LEAVE}`,Object.assign(Object.assign({},d),{type:J.POINTER_LEAVE,target:this.currentTarget,targetType:this.currentTargetType})),l&&(Object.assign(d,{type:J.POINTER_ENTER}),a.emit(`${o}:${J.POINTER_ENTER}`,d))),this.currentTarget=l,this.currentTargetType=o),u===J.CLICK&&h===2||(a.emit(`${o}:${u}`,d),a.emit(u,d)),u===J.CLICK&&c===2&&(Object.assign(d,{type:J.DBLCLICK}),a.emit(`${o}:${J.DBLCLICK}`,d),a.emit(J.DBLCLICK,d)),u===J.POINTER_DOWN&&h===2&&(Object.assign(d,{type:J.CONTEXT_MENU,preventDefault:()=>{var g;(g=s.getContainer())===null||g===void 0||g.addEventListener(J.CONTEXT_MENU,p=>p.preventDefault(),{once:!0})}}),a.emit(`${o}:${J.CONTEXT_MENU}`,d),a.emit(J.CONTEXT_MENU,d))},this.forwardContainerEvents=e=>{this.context.graph.emit(e.type,e)},this.forwardEvents(),this.setBehaviors(this.context.options.behaviors||[])}setBehaviors(t){this.setExtensions(t)}forwardEvents(){const t=this.context.canvas.getContainer();t&&[Al.KEY_DOWN,Al.KEY_UP].forEach(n=>{t.addEventListener(n,this.forwardContainerEvents)});const e=this.context.canvas.document;e&&[J.CLICK,J.DBLCLICK,J.POINTER_OVER,J.POINTER_LEAVE,J.POINTER_ENTER,J.POINTER_MOVE,J.POINTER_OUT,J.POINTER_DOWN,J.POINTER_UP,J.CONTEXT_MENU,J.DRAG_START,J.DRAG,J.DRAG_END,J.DRAG_ENTER,J.DRAG_OVER,J.DRAG_LEAVE,J.DROP,J.WHEEL].forEach(n=>{e.addEventListener(n,this.forwardCanvasEvents)})}destroy(){const t=this.context.canvas.getContainer();t&&[Al.KEY_DOWN,Al.KEY_UP].forEach(e=>{t.removeEventListener(e,this.forwardContainerEvents)}),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}var Sc=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};function gs(r,t){const{data:e,style:n}=r,i=Sc(r,["data","style"]),{data:a,style:s}=t,o=Sc(t,["data","style"]),l=Object.assign(Object.assign({},i),o);return(e||a)&&Object.assign(l,{data:Object.assign(Object.assign({},e),a)}),(n||s)&&Object.assign(l,{style:Object.assign(Object.assign({},n),s)}),l}function Qb(r){const{data:t,style:e}=r,i=Sc(r,["data","style"]);return t&&(i.data=Object.assign({},t)),e&&(i.style=Object.assign({},e)),i}function _l(r={},t={}){const{states:e=[],data:n={},style:i={},children:a=[]}=r,s=Sc(r,["states","data","style","children"]),{states:o=[],data:l={},style:u={},children:c=[]}=t,h=Sc(t,["states","data","style","children"]),d=(p,v)=>p.length!==v.length?!1:p.every((m,b)=>m===v[b]),g=(p,v)=>{const m=Object.keys(p),b=Object.keys(v);return m.length!==b.length?!1:m.every(w=>p[w]===v[w])};return!(!g(s,h)||!d(a,c)||!d(e,o)||!g(n,l)||!g(i,u))}var O0t=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};function tw(r){const{id:t=H(r),style:e,data:n}=r,i=O0t(r,["id","style","data"]),a=Object.assign(Object.assign({},r),{style:Object.assign({},e),data:Object.assign({},n)});return iX(r)?Object.assign({id:t,data:a},i):{id:t,data:a}}function On(r){return r.data}function C0t(r){if(r.hasTreeStructure(jr))return;r.attachTreeStructure(jr);const t=r.getAllEdges();for(const e of t){const{source:n,target:i}=e;r.setParent(i,n,jr)}}class A0t{constructor(){this.latestRemovedComboIds=new Set,this.comboIds=new Set,this.changes=[],this.batchCount=0,this.isTraceless=!1,this.enableUpdateNodeLikeHierarchy=!0,this.model=new Mn}pushChange(t){if(this.isTraceless)return;const{type:e}=t;if(e===Le.NodeUpdated||e===Le.EdgeUpdated||e===Le.ComboUpdated){const{value:n,original:i}=t;this.changes.push({value:Qb(n),original:Qb(i),type:e})}else this.changes.push({value:Qb(t.value),type:e})}getChanges(){return this.changes}clearChanges(){this.changes=[]}batch(t){this.batchCount++,this.model.batch(t),this.batchCount--}isBatching(){return this.batchCount>0}silence(t){this.isTraceless=!0,t(),this.isTraceless=!1}isCombo(t){return this.comboIds.has(t)||this.latestRemovedComboIds.has(t)}getData(){return{nodes:this.getNodeData(),edges:this.getEdgeData(),combos:this.getComboData()}}getNodeData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=On(n);return this.isCombo(H(i))||(t===void 0||t.includes(H(i)))&&e.push(i),e},[])}getEdgeDatum(t){return On(this.model.getEdge(t))}getEdgeData(t){return this.model.getAllEdges().reduce((e,n)=>{const i=On(n);return(t===void 0||t.includes(H(i)))&&e.push(i),e},[])}getComboData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=On(n);return this.isCombo(H(i))&&(t===void 0||t.includes(H(i)))&&e.push(i),e},[])}getRootsData(t=jr){return this.model.getRoots(t).map(On)}getAncestorsData(t,e){const{model:n}=this;return!n.hasNode(t)||!n.hasTreeStructure(e)?[]:n.getAncestors(t,e).map(On)}getDescendantsData(t){const e=this.getElementDataById(t),n=[];return To(e,i=>{i!==e&&n.push(i)},i=>this.getChildrenData(H(i)),"TB"),n}getParentData(t,e){const{model:n}=this;if(!e){sa.warn("The hierarchy structure key is not specified");return}if(!n.hasNode(t)||!n.hasTreeStructure(e))return;const i=n.getParent(t,e);return i?On(i):void 0}getChildrenData(t){const e=this.getElementType(t)==="node"?jr:we,{model:n}=this;return!n.hasNode(t)||!n.hasTreeStructure(e)?[]:n.getChildren(t,e).map(On)}getElementsDataByType(t){return t==="node"?this.getNodeData():t==="edge"?this.getEdgeData():t==="combo"?this.getComboData():[]}getElementDataById(t){return this.getElementType(t)==="edge"?this.getEdgeDatum(t):this.getNodeLikeDatum(t)}getNodeLikeDatum(t){const e=this.model.getNode(t);return On(e)}getNodeLikeData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=On(n);return t?t.includes(H(i))&&e.push(i):e.push(i),e},[])}getElementDataByState(t,e){return this.getElementsDataByType(t).filter(i=>{var a;return(a=i.states)===null||a===void 0?void 0:a.includes(e)})}getElementState(t){var e;return((e=this.getElementDataById(t))===null||e===void 0?void 0:e.states)||[]}hasNode(t){return this.model.hasNode(t)&&!this.isCombo(t)}hasEdge(t){return this.model.hasEdge(t)}hasCombo(t){return this.model.hasNode(t)&&this.isCombo(t)}getRelatedEdgesData(t,e="both"){return this.model.getRelatedEdges(t,e).map(On)}getNeighborNodesData(t){return this.model.getNeighbors(t).map(On)}setData(t){const{nodes:e=[],edges:n=[],combos:i=[]}=t,{nodes:a,edges:s,combos:o}=this.getData(),l=Ns(a,e,h=>H(h),_l),u=Ns(s,n,h=>H(h),_l),c=Ns(o,i,h=>H(h),_l);this.batch(()=>{const h={nodes:l.enter,edges:u.enter,combos:c.enter};this.addData(h),this.computeZIndex(h,"add",!0);const d={nodes:l.update,edges:u.update,combos:c.update};this.updateData(d),this.computeZIndex(d,"update",!0);const g={nodes:l.exit.map(H),edges:u.exit.map(H),combos:c.exit.map(H)};this.removeData(g)})}addData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.addComboData(i),this.addNodeData(e),this.addEdgeData(n)}),this.computeZIndex(t,"add")}addNodeData(t=[]){t.length&&(this.model.addNodes(t.map(e=>(this.pushChange({value:e,type:Le.NodeAdded}),tw(e)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({nodes:t},"add"))}addEdgeData(t=[]){t.length&&(this.model.addEdges(t.map(e=>(this.pushChange({value:e,type:Le.EdgeAdded}),tw(e)))),this.computeZIndex({edges:t},"add"))}addComboData(t=[]){if(!t.length)return;const{model:e}=this;e.hasTreeStructure(we)||e.attachTreeStructure(we),e.addNodes(t.map(n=>(this.comboIds.add(H(n)),this.pushChange({value:n,type:Le.ComboAdded}),tw(n)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({combos:t},"add")}addChildrenData(t,e){const n=this.getNodeLikeDatum(t),i=e.map(H);this.addNodeData(e),this.updateNodeData([{id:t,children:[...n.children||[],...i]}]),this.addEdgeData(i.map(a=>({source:t,target:a})))}computeZIndex(t,e,n=!1){!n&&this.isBatching()||this.batch(()=>{const{nodes:i=[],edges:a=[],combos:s=[]}=t;s.forEach(o=>{var l,u,c;const h=H(o);if(e==="add"&&yt((l=o.style)===null||l===void 0?void 0:l.zIndex)||e==="update"&&!("combo"in o))return;const d=this.getParentData(h,we),g=d?((c=(u=d.style)===null||u===void 0?void 0:u.zIndex)!==null&&c!==void 0?c:0)+1:0;this.preventUpdateNodeLikeHierarchy(()=>{this.updateComboData([{id:h,style:{zIndex:g}}])})}),i.forEach(o=>{var l,u,c;const h=H(o);if(e==="add"&&yt((l=o.style)===null||l===void 0?void 0:l.zIndex)||e==="update"&&!("combo"in o)&&!("children"in o))return;let d=0;const g=this.getParentData(h,we);if(g)d=(((u=g.style)===null||u===void 0?void 0:u.zIndex)||0)+1;else{const p=this.getParentData(h,jr);p&&(d=((c=p==null?void 0:p.style)===null||c===void 0?void 0:c.zIndex)||0)}this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:h,style:{zIndex:d}}])})}),a.forEach(o=>{var l,u,c,h,d;if(yt((l=o.style)===null||l===void 0?void 0:l.zIndex))return;let{id:g,source:p,target:v}=o;if(!g)g=H(o);else{const w=this.getEdgeDatum(g);p=w.source,v=w.target}if(!p||!v)return;const m=((c=(u=this.getNodeLikeDatum(p))===null||u===void 0?void 0:u.style)===null||c===void 0?void 0:c.zIndex)||0,b=((d=(h=this.getNodeLikeDatum(v))===null||h===void 0?void 0:h.style)===null||d===void 0?void 0:d.zIndex)||0;this.updateEdgeData([{id:H(o),style:{zIndex:Math.max(m,b)-1}}])})})}getFrontZIndex(t){var e;const n=this.getElementType(t),i=this.getElementDataById(t),a=this.getData();if(Object.assign(a,{[`${n}s`]:a[`${n}s`].filter(s=>H(s)!==t)}),n==="combo"&&!Sr(i)){const s=new Set(this.getAncestorsData(t,we).map(H));a.nodes=a.nodes.filter(o=>!s.has(H(o))),a.combos=a.combos.filter(o=>!s.has(H(o))),a.edges=a.edges.filter(({source:o,target:l})=>!s.has(o)&&!s.has(l))}return Math.max(((e=i.style)===null||e===void 0?void 0:e.zIndex)||0,0,...Object.values(a).flat().map(s=>{var o;return(((o=s==null?void 0:s.style)===null||o===void 0?void 0:o.zIndex)||0)+1}))}updateNodeLikeHierarchy(t){if(!this.enableUpdateNodeLikeHierarchy)return;const{model:e}=this;t.forEach(n=>{const i=H(n),a=pd(n);a!==void 0&&(e.hasTreeStructure(we)||e.attachTreeStructure(we),a===null&&this.refreshComboData(i),this.setParent(i,pd(n),we));const s=n.children||[];if(s.length){e.hasTreeStructure(jr)||e.attachTreeStructure(jr);const o=s.filter(l=>e.hasNode(l));o.forEach(l=>this.setParent(l,i,jr)),o.length!==s.length&&this.updateNodeData([{id:i,children:o}])}})}preventUpdateNodeLikeHierarchy(t){this.enableUpdateNodeLikeHierarchy=!1,t(),this.enableUpdateNodeLikeHierarchy=!0}updateData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.updateNodeData(e),this.updateComboData(i),this.updateEdgeData(n)}),this.computeZIndex(t,"update")}updateNodeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{const n=[];t.forEach(i=>{const a=H(i),s=On(e.getNode(a));if(_l(s,i))return;const o=gs(s,i);this.pushChange({value:o,original:s,type:Le.NodeUpdated}),e.mergeNodeData(a,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({nodes:t},"update")}refreshData(){const{nodes:t,edges:e,combos:n}=this.getData();t.forEach(i=>{this.pushChange({value:i,original:i,type:Le.NodeUpdated})}),e.forEach(i=>{this.pushChange({value:i,original:i,type:Le.EdgeUpdated})}),n.forEach(i=>{this.pushChange({value:i,original:i,type:Le.ComboUpdated})})}syncNodeLikeDatum(t){const{model:e}=this,n=H(t);if(!e.hasNode(n))return;const i=On(e.getNode(n)),a=gs(i,t);e.mergeNodeData(n,a)}syncEdgeDatum(t){const{model:e}=this,n=H(t);if(!e.hasEdge(n))return;const i=On(e.getEdge(n)),a=gs(i,t);e.mergeEdgeData(n,a)}updateEdgeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{t.forEach(n=>{const i=H(n),a=On(e.getEdge(i));if(_l(a,n))return;n.source&&a.source!==n.source&&e.updateEdgeSource(i,n.source),n.target&&a.target!==n.target&&e.updateEdgeTarget(i,n.target);const s=gs(a,n);this.pushChange({value:s,original:a,type:Le.EdgeUpdated}),e.mergeEdgeData(i,s)})}),this.computeZIndex({edges:t},"update")}updateComboData(t=[]){if(!t.length)return;const{model:e}=this;e.batch(()=>{const n=[];t.forEach(i=>{const a=H(i),s=On(e.getNode(a));if(_l(s,i))return;const o=gs(s,i);this.pushChange({value:o,original:s,type:Le.ComboUpdated}),e.mergeNodeData(a,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({combos:t},"update")}setParent(t,e,n,i=!0){if(t===e)return;const a=this.getNodeLikeDatum(t),s=pd(a);if(s!==e&&n===we){const o={id:t,combo:e};this.isCombo(t)?this.syncNodeLikeDatum(o):this.syncNodeLikeDatum(o)}this.model.setParent(t,e,n),i&&n===we&&bW([s,e]).forEach(o=>{o!==void 0&&this.refreshComboData(o)})}refreshComboData(t){const e=this.getComboData([t])[0],n=this.getAncestorsData(t,we);e&&this.pushChange({value:e,original:e,type:Le.ComboUpdated}),n.forEach(i=>{this.pushChange({value:i,original:i,type:Le.ComboUpdated})})}getElementPosition(t){const e=this.getElementDataById(t);return sn(e)}translateNodeLikeBy(t,e){this.isCombo(t)?this.translateComboBy(t,e):this.translateNodeBy(t,e)}translateNodeLikeTo(t,e){this.isCombo(t)?this.translateComboTo(t,e):this.translateNodeTo(t,e)}translateNodeBy(t,e){const n=this.getElementPosition(t),i=Lt(n,[...e,0].slice(0,3));this.translateNodeTo(t,i)}translateNodeTo(t,e){const[n=0,i=0,a=0]=e;this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:t,style:{x:n,y:i,z:a}}])})}translateComboBy(t,e){const[n=0,i=0,a=0]=e;if([n,i,a].some(isNaN)||[n,i,a].every(l=>l===0))return;const s=this.getComboData([t])[0];if(!s)return;const o=new Set;To(s,l=>{const u=H(l);if(o.has(u))return;o.add(u);const[c,h,d]=sn(l),g=gs(l,{style:{x:c+n,y:h+i,z:d+a}});this.pushChange({value:g,original:l,type:this.isCombo(u)?Le.ComboUpdated:Le.NodeUpdated}),this.model.mergeNodeData(u,g)},l=>this.getChildrenData(H(l)),"BT")}translateComboTo(t,e){var n;if(e.some(isNaN))return;const[i=0,a=0,s=0]=e,o=(n=this.getComboData([t]))===null||n===void 0?void 0:n[0];if(!o)return;const[l,u,c]=sn(o),h=i-l,d=a-u,g=s-c;To(o,p=>{const v=H(p),[m,b,w]=sn(p),x=gs(p,{style:{x:m+h,y:b+d,z:w+g}});this.pushChange({value:x,original:p,type:this.isCombo(v)?Le.ComboUpdated:Le.NodeUpdated}),this.model.mergeNodeData(v,x)},p=>this.getChildrenData(H(p)),"BT")}removeData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.removeEdgeData(n),this.removeNodeData(e),this.removeComboData(i),this.latestRemovedComboIds=new Set(i)})}removeNodeData(t=[]){t.length&&this.batch(()=>{t.forEach(e=>{this.removeEdgeData(this.getRelatedEdgesData(e).map(H)),this.pushChange({value:this.getNodeData([e])[0],type:Le.NodeRemoved}),this.removeNodeLikeHierarchy(e)}),this.model.removeNodes(t)})}removeEdgeData(t=[]){t.length&&(t.forEach(e=>this.pushChange({value:this.getEdgeData([e])[0],type:Le.EdgeRemoved})),this.model.removeEdges(t))}removeComboData(t=[]){t.length&&this.batch(()=>{t.forEach(e=>{this.pushChange({value:this.getComboData([e])[0],type:Le.ComboRemoved}),this.removeNodeLikeHierarchy(e),this.comboIds.delete(e)}),this.model.removeNodes(t)})}removeNodeLikeHierarchy(t){if(this.model.hasTreeStructure(we)){const e=pd(this.getNodeLikeDatum(t));this.setParent(t,void 0,we,!1),this.model.getChildren(t,we).forEach(n=>{const i=On(n),a=H(i);this.setParent(H(i),e,we,!1);const s=gs(i,{id:H(i),combo:e});this.pushChange({value:s,original:i,type:this.isCombo(a)?Le.ComboUpdated:Le.NodeUpdated}),this.model.mergeNodeData(H(i),s)}),kt(e)||this.refreshComboData(e)}}getElementType(t){if(this.model.hasNode(t))return this.isCombo(t)?"combo":"node";if(this.model.hasEdge(t))return"edge";throw new Error(Ra(`Unknown element type of id: ${t}`))}destroy(){const{model:t}=this,e=t.getAllNodes(),n=t.getAllEdges();t.removeEdges(n.map(i=>i.id)),t.removeNodes(e.map(i=>i.id)),this.context={}}}var Ru=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class P0t{constructor(t){this.elementMap={},this.shapeTypeMap={},this.paletteStyle={},this.defaultStyle={},this.stateStyle={},this.visibilityCache=new WeakMap,this.context=t}init(){this.initContainer()}initContainer(){if(!this.container||this.container.destroyed){const{canvas:t}=this.context;this.container=t.appendChild(new _n({className:"elements"}))}}emit(t,e){e.silence||xn(this.context.graph,t)}forEachElementData(t){Bo.forEach(e=>{const n=this.context.model.getElementsDataByType(e);t(e,n)})}getElementType(t,e){var n;const{options:i,graph:a}=this.context,s=((n=i[t])===null||n===void 0?void 0:n.type)||e.type;return s?typeof s=="string"?s:s.call(a,e):t==="edge"?"line":"circle"}getTheme(t){return JL(this.context.options)[t]||{}}getThemeStyle(t){return this.getTheme(t).style||{}}getThemeStateStyle(t,e){const{state:n={}}=this.getTheme(t);return Object.assign({},...e.map(i=>n[i]||{}))}computePaletteStyle(){const{options:t}=this.context;this.paletteStyle={},this.forEachElementData((e,n)=>{var i,a;const s=Object.assign({},BM((i=this.getTheme(e))===null||i===void 0?void 0:i.palette),BM((a=t[e])===null||a===void 0?void 0:a.palette));s!=null&&s.field&&Object.assign(this.paletteStyle,tK(n,s))})}getPaletteStyle(t,e){const n=this.paletteStyle[e];return n?t==="edge"?{stroke:n}:{fill:n}:{}}computeElementDefaultStyle(t,e){var n;const{options:i}=this.context,a=((n=i[t])===null||n===void 0?void 0:n.style)||{};"transform"in a&&Array.isArray(a.transform)&&(a.transform=[...a.transform]),this.defaultStyle[H(e.datum)]=FM(a,e)}computeElementsDefaultStyle(t){const{graph:e}=this.context;this.forEachElementData((n,i)=>{const a=i.length;for(let s=0;s<a;s++){const o=i[s];(t===void 0||t.includes(H(o)))&&this.computeElementDefaultStyle(n,{datum:o,graph:e})}})}getDefaultStyle(t){return this.defaultStyle[t]||{}}getElementState(t){try{const{model:e}=this.context;return e.getElementState(t)}catch{return[]}}getElementStateStyle(t,e,n){var i,a;const{options:s}=this.context,o=((a=(i=s[t])===null||i===void 0?void 0:i.state)===null||a===void 0?void 0:a[e])||{};return FM(o,n)}computeElementStatesStyle(t,e,n){this.stateStyle[H(n.datum)]=Object.assign({},...e.map(i=>this.getElementStateStyle(t,i,n)))}computeElementsStatesStyle(t){const{graph:e}=this.context;this.forEachElementData((n,i)=>{const a=i.length;for(let s=0;s<a;s++){const o=i[s];if(t===void 0||t.includes(H(o))){const l=this.getElementState(H(o));this.computeElementStatesStyle(n,l,{datum:o,graph:e})}}})}getStateStyle(t){return this.stateStyle[t]||{}}computeStyle(t,e){t&&["translate","zIndex"].includes(t)||(this.computePaletteStyle(),this.computeElementsDefaultStyle(e),this.computeElementsStatesStyle(e))}getElement(t){return this.elementMap[t]}getNodes(){return this.context.model.getNodeData().map(({id:t})=>this.elementMap[t])}getEdges(){return this.context.model.getEdgeData().map(t=>this.elementMap[H(t)])}getCombos(){return this.context.model.getComboData().map(({id:t})=>this.elementMap[t])}getElementComputedStyle(t,e){const n=H(e),i=this.getThemeStyle(t),a=this.getPaletteStyle(t,n),s=e.style||{},o=this.getDefaultStyle(n),l=this.getThemeStateStyle(t,this.getElementState(n)),u=this.getStateStyle(n),c=Object.assign({},i,a,s,o,l,u);if(t==="combo"){const h=this.context.model.getChildrenData(n),g=!!c.collapsed?[]:h.map(H).filter(p=>this.getElement(p));Object.assign(c,{childrenNode:g,childrenData:h})}return c}getDrawData(t){this.init();const e=this.computeChangesAndDrawData(t);if(!e)return null;const{type:n="draw",stage:i=n}=t;return this.markDestroyElement(e.drawData),this.computeStyle(i),{type:n,stage:i,data:e}}draw(t={animation:!0}){const e=this.getDrawData(t);if(!e)return;const{data:{drawData:{add:n,update:i,remove:a}}}=e;return this.destroyElements(a,t),this.createElements(n,t),this.updateElements(i,t),this.setAnimationTask(t,e)}preLayoutDraw(){return Ru(this,arguments,void 0,function*(t={animation:!0}){var e,n;const i=this.getDrawData(t);if(!i)return;const{data:{drawData:a}}=i;yield(n=(e=this.context.layout)===null||e===void 0?void 0:e.preLayout)===null||n===void 0?void 0:n.call(e,a);const{add:s,update:o,remove:l}=a;return this.destroyElements(l,t),this.createElements(s,t),this.updateElements(o,t),this.setAnimationTask(t,i)})}setAnimationTask(t,e){const{animation:n,silence:i}=t,{data:{dataChanges:a,drawData:s},stage:o,type:l}=e;return this.context.animation.animate(n,i?{}:{before:()=>this.emit(new hn(ut.BEFORE_DRAW,{dataChanges:a,animation:n,stage:o,render:l==="render"}),t),beforeAnimate:u=>this.emit(new hi(ut.BEFORE_ANIMATE,br.DRAW,u,s),t),afterAnimate:u=>this.emit(new hi(ut.AFTER_ANIMATE,br.DRAW,u,s),t),after:()=>this.emit(new hn(ut.AFTER_DRAW,{dataChanges:a,animation:n,stage:o,render:l==="render",firstRender:this.context.graph.rendered===!1}),t)})}computeChangesAndDrawData(t){const{model:e}=this.context,n=e.getChanges(),i=DE(n);if(i.length===0)return null;const{NodeAdded:a=[],NodeUpdated:s=[],NodeRemoved:o=[],EdgeAdded:l=[],EdgeUpdated:u=[],EdgeRemoved:c=[],ComboAdded:h=[],ComboUpdated:d=[],ComboRemoved:g=[]}=rg(i,b=>b.type),p=b=>new Map(b.map(w=>{const x=w.value;return[H(x),x]})),v={add:{nodes:p(a),edges:p(l),combos:p(h)},update:{nodes:p(s),edges:p(u),combos:p(d)},remove:{nodes:p(o),edges:p(c),combos:p(g)}},m=this.transformData(v,t);return e.clearChanges(),{dataChanges:n,drawData:m}}transformData(t,e){const n=this.context.transform.getTransformInstance();return Object.values(n).reduce((i,a)=>a.beforeDraw(i,e),t)}createElement(t,e,n){var i;const a=H(e);if(this.getElement(a))return;const o=this.getElementType(t,e),l=this.getElementComputedStyle(t,e),u=ja(t,o);if(!u)return sa.warn(`The element ${o} of ${t} is not registered.`);this.emit(new El(ut.BEFORE_ELEMENT_CREATE,t,e),n);const c=this.container.appendChild(new u({id:a,context:this.context,style:l}));this.shapeTypeMap[a]=o,this.elementMap[a]=c;const{stage:h="enter"}=n;(i=this.context.animation)===null||i===void 0||i.add({element:c,elementType:t,stage:h,originalStyle:Object.assign({},c.attributes),updatedStyle:l},{after:()=>{var d;this.emit(new El(ut.AFTER_ELEMENT_CREATE,t,e),n),(d=c.onCreate)===null||d===void 0||d.call(c)}})}createElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["node",n],["combo",a],["edge",i]].forEach(([o,l])=>{l.forEach(u=>this.createElement(o,u,e))})}getUpdateStageStyle(t,e,n){const{stage:i="update"}=n;if(i==="translate")if(t==="node"||t==="combo"){const{style:{x:a=0,y:s=0,z:o=0}={}}=e;return{x:a,y:s,z:o}}else return{};return this.getElementComputedStyle(t,e)}updateElement(t,e,n){var i;const a=H(e),{stage:s="update"}=n,o=this.getElement(a);if(!o)return()=>null;this.emit(new El(ut.BEFORE_ELEMENT_UPDATE,t,e),n);const l=this.getElementType(t,e),u=this.getUpdateStageStyle(t,e,n);this.shapeTypeMap[a]!==l&&(o.destroy(),delete this.shapeTypeMap[a],delete this.elementMap[a],this.createElement(t,e,{animation:!1,silence:!0}));const c=s!=="visibility"?s:u.visibility==="hidden"?"hide":"show";c==="hide"&&delete u.visibility,(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:t,stage:c,originalStyle:Object.assign({},o.attributes),updatedStyle:u},{before:()=>{const h=this.elementMap[a];s!=="collapse"&&jw(h,u),s==="visibility"&&(S0t(h,"opacity")||_0t(h,"opacity"),this.visibilityCache.set(h,c==="show"?"visible":"hidden"),c==="show"&&Do(h,"visible"))},after:()=>{var h;const d=this.elementMap[a];s==="collapse"&&jw(d,u),c==="hide"&&Do(d,this.visibilityCache.get(d)),this.emit(new El(ut.AFTER_ELEMENT_UPDATE,t,e),n),(h=d.onUpdate)===null||h===void 0||h.call(d)}})}updateElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["node",n],["combo",a],["edge",i]].forEach(([o,l])=>{l.forEach(u=>this.updateElement(o,u,e))})}markDestroyElement(t){Object.values(t.remove).forEach(e=>{e.forEach(n=>{const i=H(n),a=this.getElement(i);a&&JZ(a)})})}destroyElement(t,e,n){var i;const{stage:a="exit"}=n,s=H(e),o=this.elementMap[s];if(!o)return()=>null;this.emit(new El(ut.BEFORE_ELEMENT_DESTROY,t,e),n),(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:t,stage:a,originalStyle:Object.assign({},o.attributes),updatedStyle:{}},{after:()=>{var l;this.clearElement(s),o.destroy(),(l=o.onDestroy)===null||l===void 0||l.call(o),this.emit(new El(ut.AFTER_ELEMENT_DESTROY,t,e),n)}})}destroyElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["combo",a],["edge",i],["node",n]].forEach(([o,l])=>{l.forEach(u=>this.destroyElement(o,u,e))})}clearElement(t){delete this.paletteStyle[t],delete this.defaultStyle[t],delete this.stateStyle[t],delete this.elementMap[t],delete this.shapeTypeMap[t]}alignLayoutResultToElement(t,e){var n,i;const a=(n=t.nodes)===null||n===void 0?void 0:n.find(s=>H(s)===e);if(a){const s=sn(this.context.model.getNodeLikeDatum(e)),o=sn(a),l=be(s,o);(i=t.nodes)===null||i===void 0||i.forEach(u=>{var c,h,d;!((c=u.style)===null||c===void 0)&&c.x&&(u.style.x+=l[0]),!((h=u.style)===null||h===void 0)&&h.y&&(u.style.y+=l[1]),!((d=u.style)===null||d===void 0)&&d.z&&(u.style.z+=l[2]||0)})}}collapseNode(t,e){return Ru(this,void 0,void 0,function*(){var n;const{animation:i,align:a}=e,{model:s,layout:o}=this.context,l=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!l)return;this.markDestroyElement(l.drawData);const u=yield o.simulate();a&&this.alignLayoutResultToElement(u,t),s.updateData(u);const c=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!c)return;const{drawData:h}=c,{add:d,remove:g,update:p}=h;this.markDestroyElement(h);const v={animation:i,stage:"collapse",data:h};this.destroyElements(g,v),this.createElements(d,v),this.updateElements(p,v),yield(n=this.context.animation.animate(i,{beforeAnimate:m=>this.emit(new hi(ut.BEFORE_ANIMATE,br.COLLAPSE,m,h),v),afterAnimate:m=>this.emit(new hi(ut.AFTER_ANIMATE,br.COLLAPSE,m,h),v)},{collapse:{target:t,descendants:Array.from(g.nodes).map(([,m])=>H(m)),position:sn(p.nodes.get(t))}}))===null||n===void 0?void 0:n.finished})}expandNode(t,e){return Ru(this,void 0,void 0,function*(){var n;const{model:i,layout:a}=this.context,{animation:s,align:o}=e,l=sn(i.getNodeData([t])[0]),u=this.computeChangesAndDrawData({stage:"expand",animation:s});if(!u)return;const{drawData:{add:c}}=u;this.createElements(c,{animation:!1,stage:"expand",target:t}),this.context.animation.clear();const h=yield a.simulate();o&&this.alignLayoutResultToElement(h,t),i.updateData(h),this.computeStyle("expand");const d=this.computeChangesAndDrawData({stage:"collapse",animation:s});if(!d)return;const{drawData:g}=d,{update:p}=g,v={animation:s,stage:"expand",data:g};c.edges.forEach(m=>p.edges.set(H(m),m)),c.nodes.forEach(m=>p.nodes.set(H(m),m)),this.updateElements(p,v),yield(n=this.context.animation.animate(s,{beforeAnimate:m=>this.emit(new hi(ut.BEFORE_ANIMATE,br.EXPAND,m,g),v),afterAnimate:m=>this.emit(new hi(ut.AFTER_ANIMATE,br.EXPAND,m,g),v)},{expand:{target:t,descendants:Array.from(c.nodes).map(([,m])=>H(m)),position:l}}))===null||n===void 0?void 0:n.finished})}collapseCombo(t,e){return Ru(this,void 0,void 0,function*(){var n;const{model:i,element:a}=this.context;if(i.getAncestorsData(t,we).some(v=>Sr(v)))return;const s=a.getElement(t),o=s.getComboPosition(Object.assign(Object.assign({},s.attributes),{collapsed:!0})),l=this.computeChangesAndDrawData({stage:"collapse",animation:e});if(!l)return;const{dataChanges:u,drawData:c}=l;this.markDestroyElement(c);const{update:h,remove:d}=c,g={animation:e,stage:"collapse",data:c};this.destroyElements(d,g),this.updateElements(h,g);const p=v=>Array.from(v).map(([,m])=>H(m));yield(n=this.context.animation.animate(e,{before:()=>this.emit(new hn(ut.BEFORE_DRAW,{dataChanges:u,animation:e}),g),beforeAnimate:v=>this.emit(new hi(ut.BEFORE_ANIMATE,br.COLLAPSE,v,c),g),afterAnimate:v=>this.emit(new hi(ut.AFTER_ANIMATE,br.COLLAPSE,v,c),g),after:()=>this.emit(new hn(ut.AFTER_DRAW,{dataChanges:u,animation:e}),g)},{collapse:{target:t,descendants:[...p(d.nodes),...p(d.combos)],position:o}}))===null||n===void 0?void 0:n.finished})}expandCombo(t,e){return Ru(this,void 0,void 0,function*(){var n;const{model:i}=this.context,a=sn(i.getComboData([t])[0]);this.computeStyle("expand");const s=this.computeChangesAndDrawData({stage:"expand",animation:e});if(!s)return;const{dataChanges:o,drawData:l}=s,{add:u,update:c}=l,h={animation:e,stage:"expand",data:l,target:t};this.createElements(u,h),this.updateElements(c,h);const d=g=>Array.from(g).map(([,p])=>H(p));yield(n=this.context.animation.animate(e,{before:()=>this.emit(new hn(ut.BEFORE_DRAW,{dataChanges:o,animation:e}),h),beforeAnimate:g=>this.emit(new hi(ut.BEFORE_ANIMATE,br.EXPAND,g,l),h),afterAnimate:g=>this.emit(new hi(ut.AFTER_ANIMATE,br.EXPAND,g,l),h),after:()=>this.emit(new hn(ut.AFTER_DRAW,{dataChanges:o,animation:e}),h)},{expand:{target:t,descendants:[...d(u.nodes),...d(u.combos)],position:a}}))===null||n===void 0?void 0:n.finished})}clear(){this.container.destroy(),this.initContainer(),this.elementMap={},this.shapeTypeMap={},this.defaultStyle={},this.stateStyle={},this.paletteStyle={}}destroy(){this.clear(),this.container.destroy(),this.context={}}}var Sl=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},N0t=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class R0t{get presetOptions(){return{animation:!!QL(this.context.options,!0)}}get options(){const{options:t}=this.context;return t.layout}constructor(t){this.instances=[],this.context=t}getLayoutInstance(){return this.instances}preLayout(t){return Sl(this,void 0,void 0,function*(){var e,n,i,a;const{graph:s,model:o}=this.context,{add:l}=t;xn(s,new hn(ut.BEFORE_LAYOUT,{type:"pre"}));const u=yield(e=this.context.layout)===null||e===void 0?void 0:e.simulate();(n=u==null?void 0:u.nodes)===null||n===void 0||n.forEach(c=>{const h=H(c),d=l.nodes.get(h);o.syncNodeLikeDatum(c),d&&Object.assign(d.style,c.style)}),(i=u==null?void 0:u.edges)===null||i===void 0||i.forEach(c=>{const h=H(c),d=l.edges.get(h);o.syncEdgeDatum(c),d&&Object.assign(d.style,c.style)}),(a=u==null?void 0:u.combos)===null||a===void 0||a.forEach(c=>{const h=H(c),d=l.combos.get(h);o.syncNodeLikeDatum(c),d&&Object.assign(d.style,c.style)}),xn(s,new hn(ut.AFTER_LAYOUT,{type:"pre"})),this.transformDataAfterLayout("pre",t)})}postLayout(){return Sl(this,arguments,void 0,function*(t=this.options){if(!t)return;const e=Array.isArray(t)?t:[t],{graph:n}=this.context;xn(n,new hn(ut.BEFORE_LAYOUT,{type:"post"}));for(const i of e){const a=e.indexOf(i),s=this.getLayoutData(i),o=Object.assign(Object.assign({},this.presetOptions),i);xn(n,new hn(ut.BEFORE_STAGE_LAYOUT,{options:o,index:a}));const l=yield this.stepLayout(s,o,a);xn(n,new hn(ut.AFTER_STAGE_LAYOUT,{options:o,index:a})),i.animation||this.updateElementPosition(l,!1)}xn(n,new hn(ut.AFTER_LAYOUT,{type:"post"})),this.transformDataAfterLayout("post")})}transformDataAfterLayout(t,e){const n=this.context.transform.getTransformInstance();Object.values(n).forEach(i=>i.afterLayout(t,e))}simulate(){return Sl(this,void 0,void 0,function*(){if(!this.options)return{};const t=Array.isArray(this.options)?this.options:[this.options];let e={};for(const n of t){const i=t.indexOf(n),a=this.getLayoutData(n);e=yield this.stepLayout(a,Object.assign(Object.assign(Object.assign({},this.presetOptions),n),{animation:!1}),i)}return e})}stepLayout(t,e,n){return Sl(this,void 0,void 0,function*(){return aJ(e)?yield this.treeLayout(t,e,n):yield this.graphLayout(t,e,n)})}graphLayout(t,e,n){return Sl(this,void 0,void 0,function*(){const{animation:i,enableWorker:a,iterations:s=300}=e,o=this.initGraphLayout(e);if(!o)return{};if(this.instances[n]=o,this.instance=o,a){const u=o;return this.supervisor=new gct(u.graphData2LayoutModel(t),u.instance,{iterations:s}),tf(yield this.supervisor.execute())}if(Qw(o))return i?yield o.execute(t,{onTick:u=>{this.updateElementPosition(u,!1)}}):(o.execute(t),o.stop(),o.tick(s));const l=yield o.execute(t);if(i){const u=this.updateElementPosition(l,i);yield u==null?void 0:u.finished}return l})}treeLayout(t,e,n){return Sl(this,void 0,void 0,function*(){const{type:i,animation:a}=e,s=ja("layout",i);if(!s)return{};const{nodes:o=[],edges:l=[]}=t,u=new Mn({nodes:o.map(p=>({id:H(p),data:p.data||{}})),edges:l.map(p=>({id:H(p),source:p.source,target:p.target,data:p.data||{}}))});C0t(u);const c={nodes:[],edges:[]},h={nodes:[],edges:[]};u.getRoots(jr).forEach(p=>{To(p,x=>{x.children=u.getSuccessors(x.id)},x=>u.getSuccessors(x.id),"TB");const v=s(p,e),{x:m,y:b,z:w=0}=v;To(v,x=>{const{id:_,x:S,y:M,z:k=0}=x;c.nodes.push({id:_,style:{x:m,y:b,z:w}}),h.nodes.push({id:_,style:{x:S,y:M,z:k}})},x=>x.children,"TB")});const g=this.inferTreeLayoutOffset(h);if(sR(h,g),a){sR(c,g),this.updateElementPosition(c,!1);const p=this.updateElementPosition(h,a);yield p==null?void 0:p.finished}return h})}inferTreeLayoutOffset(t){var e;let[n,i]=[1/0,-1/0],[a,s]=[1/0,-1/0];(e=t.nodes)===null||e===void 0||e.forEach(v=>{const{x:m=0,y:b=0}=v.style||{};n=Math.min(n,m),i=Math.max(i,m),a=Math.min(a,b),s=Math.max(s,b)});const{canvas:o}=this.context,l=o.getSize(),[u,c]=o.getCanvasByViewport([0,0]),[h,d]=o.getCanvasByViewport(l);if(n>=u&&i<=h&&a>=c&&s<=d)return[0,0];const g=(u+h)/2,p=(c+d)/2;return[g-(n+i)/2,p-(a+s)/2]}stopLayout(){this.instance&&Qw(this.instance)&&(this.instance.stop(),this.instance=void 0),this.supervisor&&(this.supervisor.stop(),this.supervisor=void 0),this.animationResult&&(this.animationResult.finish(),this.animationResult=void 0)}getLayoutData(t){const{nodeFilter:e=()=>!0,preLayout:n=!1,isLayoutInvisibleNodes:i=!1}=t,{nodes:a,edges:s,combos:o}=this.context.model.getData(),{element:l,model:u}=this.context,c=v=>l.getElement(v),h=n?v=>{var m;return!i&&(((m=v.style)===null||m===void 0?void 0:m.visibility)==="hidden"||u.getAncestorsData(v.id,jr).some(Sr)||u.getAncestorsData(v.id,we).some(Sr))?!1:e(v)}:v=>{const m=H(v),b=c(m);return!b||Eg(b)?!1:e(v)},d=a.filter(h),g=new Map(d.map(v=>[H(v),v]));o.forEach(v=>g.set(H(v),v));const p=s.filter(({source:v,target:m})=>g.has(v)&&g.has(m));return{nodes:d,edges:p,combos:o}}initGraphLayout(t){var e;const{element:n,viewport:i}=this.context,{type:a,enableWorker:s,animation:o,iterations:l}=t,u=N0t(t,["type","enableWorker","animation","iterations"]),[c,h]=i.getCanvasSize(),d=[c/2,h/2],g=(e=t==null?void 0:t.nodeSize)!==null&&e!==void 0?e:w=>{const x=n==null?void 0:n.getElement(w.id);return x?x.attributes.size:n==null?void 0:n.getElementComputedStyle("node",w).size},p=ja("layout",a);if(!p)return sa.warn(`The layout of ${a} is not registered.`);const v=Object.getPrototypeOf(p.prototype)===Tg.prototype?p:oJ(p,this.context),m=new v(this.context),b={nodeSize:g,width:c,height:h,center:d};switch(m.id){case"d3-force":case"d3-force-3d":Object.assign(b,{center:{x:c/2,y:h/2,z:0}});break}return cr(m.options,b,u),m}updateElementPosition(t,e){const{model:n,element:i}=this.context;return i?(n.updateData(t),i.draw({animation:e,silence:!0})):null}destroy(){var t;this.stopLayout(),this.context={},(t=this.supervisor)===null||t===void 0||t.kill(),this.supervisor=void 0,this.instance=void 0,this.instances=[],this.animationResult=void 0}}const sR=(r,t)=>{var e;const[n,i]=t;(e=r.nodes)===null||e===void 0||e.forEach(a=>{if(a.style){const{x:s=0,y:o=0}=a.style;a.style.x=s+n,a.style.y=o+i}else a.style={x:n,y:i}})};function L0t(r){return[I0t].reduce((e,n)=>n(e),r)}function I0t(r){return!r.layout||Array.isArray(r.layout)||"preLayout"in r.layout||["antv-dagre","combo-combined","compact-box","circular","concentric","dagre","fishbone","grid","indented","mds","radial","random","snake","dendrogram","mindmap"].includes(r.layout.type)&&(r.layout.preLayout=!0),r}class D0t extends Vx{constructor(t){super(t),this.category="plugin",this.setPlugins(this.context.options.plugins||[])}setPlugins(t){this.setExtensions(t)}getPluginInstance(t){const e=this.extensionMap[t];if(e)return e;sa.warn(`Cannot find the plugin ${t}, will try to find it by type.`);const n=this.extensions.find(i=>i.type===t);if(n)return this.extensionMap[n.key]}}const Hd=["update-related-edges","collapse-expand-node","collapse-expand-combo","get-edge-actual-ends","arrange-draw-order"];class F0t extends Vx{constructor(t){super(t),this.category="transform",this.setTransforms(this.context.options.transforms||[])}getTransforms(){}setTransforms(t){this.setExtensions([...Hd.slice(0,Hd.length-1),...t,Hd[Hd.length-1]])}getTransformInstance(t){return t?this.extensionMap[t]:this.extensionMap}}var Lu=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class B0t{get padding(){return oa(this.context.options.padding)}get paddingOffset(){const[t,e,n,i]=this.padding,[a,s,o]=[(i-e)/2,(t-n)/2,0];return[a,s,o]}constructor(t){this.landmarkCounter=0,this.context=t;const[e,n]=this.paddingOffset,{zoom:i,rotation:a,x:s=e,y:o=n}=t.options;this.transform({mode:"absolute",scale:i,translate:[s,o],rotate:a},!1)}get camera(){const{canvas:t}=this.context;return new Proxy(t.getCamera(),{get:(e,n)=>{const a=Object.entries(t.getLayers()).filter(([o])=>!["main"].includes(o)).map(([,o])=>o.getCamera()),s=e[n];if(typeof s=="function")return(...o)=>{const l=s.apply(e,o);return a.forEach(u=>{u[n].apply(u,o)}),l}}})}createLandmark(t){return this.camera.createLandmark(`landmark-${this.landmarkCounter++}`,t)}getAnimation(t){const e=QL(this.context.options,t);return e?No(Object.assign({},e),["easing","duration"]):!1}getCanvasSize(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e,n]}getCanvasCenter(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e/2,n/2,0]}getViewportCenter(){const[t,e]=this.camera.getPosition();return[t,e,0]}getGraphCenter(){return this.context.graph.getViewportByCanvas(this.getCanvasCenter())}getZoom(){return this.camera.getZoom()}getRotation(){return this.camera.getRoll()}getTranslateOptions(t){const{camera:e}=this,{mode:n,translate:i=[]}=t,a=this.getZoom(),s=e.getPosition(),o=e.getFocalPoint(),[l,u]=this.getCanvasCenter(),[c=0,h=0,d=0]=i,g=Di([-c,-h,-d],a);return n==="relative"?{position:Lt(s,g),focalPoint:Lt(o,g)}:{position:Lt([l,u,s[2]],g),focalPoint:Lt([l,u,o[2]],g)}}getRotateOptions(t){const{mode:e,rotate:n=0}=t;return{roll:e==="relative"?this.camera.getRoll()+n:n}}getZoomOptions(t){const{zoomRange:e}=this.context.options,n=this.camera.getZoom(),{mode:i,scale:a=1}=t;return He(i==="relative"?n*a:a,...e)}transform(t,e){return Lu(this,void 0,void 0,function*(){const{graph:n}=this.context,{translate:i,rotate:a,scale:s,origin:o}=t;this.cancelAnimation();const l=this.getAnimation(e);if(xn(n,new Vd(ut.BEFORE_TRANSFORM,t)),!a&&s&&!i&&o&&!l){this.camera.setZoomByViewportPoint(this.getZoomOptions(t),o),xn(n,new Vd(ut.AFTER_TRANSFORM,t));return}const u={};if(i&&Object.assign(u,this.getTranslateOptions(t)),yt(a)&&Object.assign(u,this.getRotateOptions(t)),yt(s)&&Object.assign(u,{zoom:this.getZoomOptions(t)}),l)return xn(n,new hi(ut.BEFORE_ANIMATE,br.TRANSFORM,null,t)),new Promise(c=>{this.transformResolver=c,this.camera.gotoLandmark(this.createLandmark(u),Object.assign(Object.assign({},l),{onfinish:()=>{xn(n,new hi(ut.AFTER_ANIMATE,br.TRANSFORM,null,t)),xn(n,new Vd(ut.AFTER_TRANSFORM,t)),this.transformResolver=void 0,c()}}))});this.camera.gotoLandmark(this.createLandmark(u),{duration:0}),xn(n,new Vd(ut.AFTER_TRANSFORM,t))})}fitView(t,e){return Lu(this,void 0,void 0,function*(){const[n,i,a,s]=this.padding,{when:o="always",direction:l="both"}=t||{},[u,c]=this.context.canvas.getSize(),h=u-s-i,d=c-n-a,g=this.context.canvas.getBounds(),p=this.getBBoxInViewport(g),[v,m]=Us(p),b=l==="x"&&v>=h||l==="y"&&m>=d||l==="both"&&v>=h&&m>=d;if(o==="overflow"&&!b)return yield this.fitCenter({animation:e});const w=h/v,x=d/m,_=l==="x"?w:l==="y"?x:Math.min(w,x),S=this.getAnimation(e);yield this.transform({mode:"relative",scale:_,translate:Lt(be(this.getCanvasCenter(),this.getBBoxInViewport(g).center),Di(this.paddingOffset,_))},S)})}fitCenter(t){return Lu(this,void 0,void 0,function*(){const e=this.context.canvas.getBounds();yield this.focus(e,t)})}focusElements(t){return Lu(this,arguments,void 0,function*(e,n={}){const{element:i}=this.context;if(!i)return;const a=o=>n.shapes?o.getShape(n.shapes).getRenderBounds():o.getRenderBounds(),s=Ic(e.map(o=>a(i.getElement(o))));yield this.focus(s,n)})}focus(t,e){return Lu(this,void 0,void 0,function*(){const n=this.context.graph.getViewportByCanvas(t.center),i=e.position||this.getCanvasCenter(),a=be(i,n);yield this.transform({mode:"relative",translate:Lt(a,this.paddingOffset)},e.animation)})}getBBoxInViewport(t){const{min:e,max:n}=t,{graph:i}=this.context,[a,s]=i.getViewportByCanvas(e),[o,l]=i.getViewportByCanvas(n),u=new Me;return u.setMinMax([a,s,0],[o,l,0]),u}isInViewport(t,e=!1,n=0){const{graph:i}=this.context,a=this.getCanvasSize(),[s,o]=i.getCanvasByViewport([0,0]),[l,u]=i.getCanvasByViewport(a);let c=new Me;return c.setMinMax([s,o,0],[l,u,0]),n&&(c=Ys(c,n)),Vl(t)?Ii(t,c):e?oX(t,c):c.intersects(t)}cancelAnimation(){var t,e;!((t=this.camera.landmarks)===null||t===void 0)&&t.length&&this.camera.cancelLandmarkAnimation(),(e=this.transformResolver)===null||e===void 0||e.call(this)}}var _e=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class R0 extends kg{constructor(t){var e;super(),this.options={},this.rendered=!1,this.destroyed=!1,this.context={model:new A0t},this.isCollapsingExpanding=!1,this.onResize=Oc(()=>{this.resize()},300),this._setOptions(Object.assign({},R0.defaultOptions,t),!0),this.context.graph=this,this.options.autoResize&&((e=globalThis.addEventListener)===null||e===void 0||e.call(globalThis,"resize",this.onResize))}getOptions(){return this.options}setOptions(t){this._setOptions(t,!1)}_setOptions(t,e){if(this.updateCanvas(t),Object.assign(this.options,L0t(t)),e){const{data:d}=t;d&&this.addData(d);return}const{behaviors:n,combo:i,data:a,edge:s,layout:o,node:l,plugins:u,theme:c,transforms:h}=t;n&&this.setBehaviors(n),a&&this.setData(a),l&&this.setNode(l),s&&this.setEdge(s),i&&this.setCombo(i),o&&this.setLayout(o),c&&this.setTheme(c),u&&this.setPlugins(u),h&&this.setTransforms(h)}getSize(){return this.context.canvas?this.context.canvas.getSize():[this.options.width||0,this.options.height||0]}setSize(t,e){t&&(this.options.width=t),e&&(this.options.height=e),this.resize(t,e)}setZoomRange(t){this.options.zoomRange=t}getZoomRange(){return this.options.zoomRange}setNode(t){this.options.node=t,this.context.model.refreshData()}setEdge(t){this.options.edge=t,this.context.model.refreshData()}setCombo(t){this.options.combo=t,this.context.model.refreshData()}getTheme(){return this.options.theme}setTheme(t){this.options.theme=Et(t)?t(this.getTheme()):t}setLayout(t){this.options.layout=Et(t)?t(this.getLayout()):t}getLayout(){return this.options.layout}setBehaviors(t){var e;this.options.behaviors=Et(t)?t(this.getBehaviors()):t,(e=this.context.behavior)===null||e===void 0||e.setBehaviors(this.options.behaviors)}updateBehavior(t){this.setBehaviors(e=>e.map(n=>typeof n=="object"&&n.key===t.key?Object.assign(Object.assign({},n),t):n))}getBehaviors(){return this.options.behaviors||[]}setPlugins(t){var e;this.options.plugins=Et(t)?t(this.getPlugins()):t,(e=this.context.plugin)===null||e===void 0||e.setPlugins(this.options.plugins)}updatePlugin(t){this.setPlugins(e=>e.map(n=>typeof n=="object"&&n.key===t.key?Object.assign(Object.assign({},n),t):n))}getPlugins(){return this.options.plugins||[]}getPluginInstance(t){return this.context.plugin.getPluginInstance(t)}setTransforms(t){var e;this.options.transforms=Et(t)?t(this.getTransforms()):t,(e=this.context.transform)===null||e===void 0||e.setTransforms(this.options.transforms)}updateTransform(t){this.setTransforms(e=>e.map(n=>typeof n=="object"&&n.key===t.key?Object.assign(Object.assign({},n),t):n)),this.context.model.refreshData()}getTransforms(){return this.options.transforms||[]}getData(){return this.context.model.getData()}getElementData(t){return Array.isArray(t)?t.map(e=>this.context.model.getElementDataById(e)):this.context.model.getElementDataById(t)}getNodeData(t){var e;return t===void 0?this.context.model.getNodeData():Array.isArray(t)?this.context.model.getNodeData(t):(e=this.context.model.getNodeData([t]))===null||e===void 0?void 0:e[0]}getEdgeData(t){var e;return t===void 0?this.context.model.getEdgeData():Array.isArray(t)?this.context.model.getEdgeData(t):(e=this.context.model.getEdgeData([t]))===null||e===void 0?void 0:e[0]}getComboData(t){var e;return t===void 0?this.context.model.getComboData():Array.isArray(t)?this.context.model.getComboData(t):(e=this.context.model.getComboData([t]))===null||e===void 0?void 0:e[0]}setData(t){this.context.model.setData(Et(t)?t(this.getData()):t)}addData(t){this.context.model.addData(Et(t)?t(this.getData()):t)}addNodeData(t){this.context.model.addNodeData(Et(t)?t(this.getNodeData()):t)}addEdgeData(t){this.context.model.addEdgeData(Et(t)?t(this.getEdgeData()):t)}addComboData(t){this.context.model.addComboData(Et(t)?t(this.getComboData()):t)}addChildrenData(t,e){this.context.model.addChildrenData(t,e)}updateData(t){this.context.model.updateData(Et(t)?t(this.getData()):t)}updateNodeData(t){this.context.model.updateNodeData(Et(t)?t(this.getNodeData()):t)}updateEdgeData(t){this.context.model.updateEdgeData(Et(t)?t(this.getEdgeData()):t)}updateComboData(t){this.context.model.updateComboData(Et(t)?t(this.getComboData()):t)}removeData(t){this.context.model.removeData(Et(t)?t(this.getData()):t)}removeNodeData(t){this.context.model.removeNodeData(Et(t)?t(this.getNodeData()):t)}removeEdgeData(t){this.context.model.removeEdgeData(Et(t)?t(this.getEdgeData()):t)}removeComboData(t){this.context.model.removeComboData(Et(t)?t(this.getComboData()):t)}getElementType(t){return this.context.model.getElementType(t)}getRelatedEdgesData(t,e="both"){return this.context.model.getRelatedEdgesData(t,e)}getNeighborNodesData(t){return this.context.model.getNeighborNodesData(t)}getAncestorsData(t,e){return this.context.model.getAncestorsData(t,e)}getParentData(t,e){return this.context.model.getParentData(t,e)}getChildrenData(t){return this.context.model.getChildrenData(t)}getDescendantsData(t){return this.context.model.getDescendantsData(t)}getElementDataByState(t,e){return this.context.model.getElementDataByState(t,e)}initCanvas(){return _e(this,void 0,void 0,function*(){var t;if(this.context.canvas)return yield this.context.canvas.ready;const{container:e="container",width:n,height:i,renderer:a,cursor:s,background:o,canvas:l,devicePixelRatio:u=(t=globalThis.devicePixelRatio)!==null&&t!==void 0?t:1}=this.options;if(e instanceof tR)this.context.canvas=e,s&&e.setCursor(s),a&&e.setRenderer(a),yield e.ready;else{const c=oe(e)?document.getElementById(e):e,h=rR(c);this.emit(ut.BEFORE_CANVAS_INIT,{container:c,width:n,height:i});const d=Object.assign(Object.assign({},l),{container:c,width:n||h[0],height:i||h[1],background:o,renderer:a,cursor:s,devicePixelRatio:u}),g=new tR(d);this.context.canvas=g,yield g.ready,this.emit(ut.AFTER_CANVAS_INIT,{canvas:g})}})}updateCanvas(t){var e,n;const{renderer:i,cursor:a,height:s,width:o}=t,l=this.context.canvas;l&&(i&&(this.emit(ut.BEFORE_RENDERER_CHANGE,{renderer:this.options.renderer}),l.setRenderer(i),this.emit(ut.AFTER_RENDERER_CHANGE,{renderer:i})),a&&l.setCursor(a),(yt(o)||yt(s))&&this.setSize((e=o??this.options.width)!==null&&e!==void 0?e:0,(n=s??this.options.height)!==null&&n!==void 0?n:0))}initRuntime(){this.context.options=this.options,this.context.batch||(this.context.batch=new k0t(this.context)),this.context.plugin||(this.context.plugin=new D0t(this.context)),this.context.viewport||(this.context.viewport=new B0t(this.context)),this.context.transform||(this.context.transform=new F0t(this.context)),this.context.element||(this.context.element=new P0t(this.context)),this.context.animation||(this.context.animation=new M0t(this.context)),this.context.layout||(this.context.layout=new R0t(this.context)),this.context.behavior||(this.context.behavior=new T0t(this.context))}prepare(){return _e(this,void 0,void 0,function*(){if(yield Promise.resolve(),this.destroyed)throw new Error(Ra("The graph instance has been destroyed"));yield this.initCanvas(),this.initRuntime()})}render(){return _e(this,void 0,void 0,function*(){if(yield this.prepare(),xn(this,new hn(ut.BEFORE_RENDER)),this.options.layout)if(!this.rendered&&sJ(this.options.layout)){const t=yield this.context.element.preLayoutDraw({type:"render"});yield Promise.all([t==null?void 0:t.finished,this.autoFit()])}else{const t=this.context.element.draw({type:"render"});yield Promise.all([t==null?void 0:t.finished,this.context.layout.postLayout()]),yield this.autoFit()}else{const t=this.context.element.draw({type:"render"});yield Promise.all([t==null?void 0:t.finished,this.autoFit()])}this.rendered=!0,xn(this,new hn(ut.AFTER_RENDER))})}draw(){return _e(this,void 0,void 0,function*(){var t;yield this.prepare(),yield(t=this.context.element.draw())===null||t===void 0?void 0:t.finished})}layout(t){return _e(this,void 0,void 0,function*(){yield this.context.layout.postLayout(t)})}stopLayout(){this.context.layout.stopLayout()}clear(){return _e(this,void 0,void 0,function*(){const{model:t,element:e}=this.context;t.setData({}),t.clearChanges(),e==null||e.clear()})}destroy(){var t;xn(this,new hn(ut.BEFORE_DESTROY));const{layout:e,animation:n,element:i,model:a,canvas:s,behavior:o,plugin:l}=this.context;l==null||l.destroy(),o==null||o.destroy(),e==null||e.destroy(),n==null||n.destroy(),i==null||i.destroy(),a.destroy(),s==null||s.destroy(),this.options={},this.context={},this.off(),(t=globalThis.removeEventListener)===null||t===void 0||t.call(globalThis,"resize",this.onResize),this.destroyed=!0,xn(this,new hn(ut.AFTER_DESTROY))}getCanvas(){return this.context.canvas}resize(t,e){var n;const i=rR((n=this.context.canvas)===null||n===void 0?void 0:n.getContainer()),a=[t||i[0],e||i[1]];if(!this.context.canvas)return;const s=this.context.canvas.getSize();Ue(a,s)||(xn(this,new hn(ut.BEFORE_SIZE_CHANGE,{size:a})),this.context.canvas.resize(...a),xn(this,new hn(ut.AFTER_SIZE_CHANGE,{size:a})))}fitView(t,e){return _e(this,void 0,void 0,function*(){var n;yield(n=this.context.viewport)===null||n===void 0?void 0:n.fitView(t,e)})}fitCenter(t){return _e(this,void 0,void 0,function*(){var e;yield(e=this.context.viewport)===null||e===void 0?void 0:e.fitCenter({animation:t})})}autoFit(){return _e(this,void 0,void 0,function*(){const{autoFit:t}=this.context.options;if(t)if(oe(t))t==="view"?yield this.fitView():t==="center"&&(yield this.fitCenter());else{const{type:e,animation:n}=t;e==="view"?yield this.fitView(t.options,n):e==="center"&&(yield this.fitCenter(n))}})}focusElement(t,e){return _e(this,void 0,void 0,function*(){var n;yield(n=this.context.viewport)===null||n===void 0?void 0:n.focusElements(Array.isArray(t)?t:[t],{animation:e})})}zoomBy(t,e,n){return _e(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",scale:t,origin:n},e)})}zoomTo(t,e,n){return _e(this,void 0,void 0,function*(){this.context.viewport.transform({mode:"absolute",scale:t,origin:n},e)})}getZoom(){return this.context.viewport.getZoom()}rotateBy(t,e,n){return _e(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",rotate:t,origin:n},e)})}rotateTo(t,e,n){return _e(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",rotate:t,origin:n},e)})}getRotation(){return this.context.viewport.getRotation()}translateBy(t,e){return _e(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",translate:t},e)})}translateTo(t,e){return _e(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",translate:t},e)})}getPosition(){return be([0,0],this.getCanvasByViewport([0,0]))}translateElementBy(t,e){return _e(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,u]=an(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(l).forEach(([c,h])=>this.context.model.translateNodeLikeBy(c,h)),yield(o=this.context.element.draw({animation:u,stage:"translate"}))===null||o===void 0?void 0:o.finished})}translateElementTo(t,e){return _e(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,u]=an(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(l).forEach(([c,h])=>this.context.model.translateNodeLikeTo(c,h)),yield(o=this.context.element.draw({animation:u,stage:"translate"}))===null||o===void 0?void 0:o.finished})}getElementPosition(t){return this.context.model.getElementPosition(t)}getElementRenderStyle(t){return Ox(this.context.element.getElement(t).attributes,["context"])}setElementVisibility(t,e){return _e(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,u]=an(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],c={nodes:[],edges:[],combos:[]};Object.entries(l).forEach(([g,p])=>{const v=this.getElementType(g);c[`${v}s`].push({id:g,style:{visibility:p}})});const{model:h,element:d}=this.context;h.preventUpdateNodeLikeHierarchy(()=>{h.updateData(c)}),yield(o=d.draw({animation:u,stage:"visibility"}))===null||o===void 0?void 0:o.finished})}showElement(t,e){return _e(this,void 0,void 0,function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map(i=>[i,"visible"])),e)})}hideElement(t,e){return _e(this,void 0,void 0,function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map(i=>[i,"hidden"])),e)})}getElementVisibility(t){var e,n;const i=this.context.element.getElement(t);return(n=(e=i==null?void 0:i.style)===null||e===void 0?void 0:e.visibility)!==null&&n!==void 0?n:"visible"}setElementZIndex(t,e){return _e(this,void 0,void 0,function*(){var n;const i={nodes:[],edges:[],combos:[]},a=an(t)?t:{[t]:e};Object.entries(a).forEach(([l,u])=>{const c=this.getElementType(l);i[`${c}s`].push({id:l,style:{zIndex:u}})});const{model:s,element:o}=this.context;s.preventUpdateNodeLikeHierarchy(()=>s.updateData(i)),yield(n=o.draw({animation:!1,stage:"zIndex"}))===null||n===void 0?void 0:n.finished})}frontElement(t){return _e(this,void 0,void 0,function*(){const e=Array.isArray(t)?t:[t],{model:n}=this.context,i={};e.map(a=>{const s=n.getFrontZIndex(a);if(n.getElementType(a)==="combo"){const l=n.getAncestorsData(a,we).at(-1)||this.getComboData(a),u=[l,...n.getDescendantsData(H(l))],c=s-iR(l);u.forEach(d=>{i[H(d)]=this.getElementZIndex(H(d))+c});const{internal:h}=zw(u.map(H),d=>n.getRelatedEdgesData(d));h.forEach(d=>{const g=H(d);i[g]=this.getElementZIndex(g)+c})}else i[a]=s}),yield this.setElementZIndex(i)})}getElementZIndex(t){return iR(this.context.model.getElementDataById(t))}setElementState(t,e){return _e(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,u]=an(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],c=d=>d?Array.isArray(d)?d:[d]:[],h={nodes:[],edges:[],combos:[]};Object.entries(l).forEach(([d,g])=>{const p=this.getElementType(d);h[`${p}s`].push({id:d,states:c(g)})}),this.updateData(h),yield(o=this.context.element.draw({animation:u,stage:"state"}))===null||o===void 0?void 0:o.finished})}getElementState(t){return this.context.model.getElementState(t)}getElementRenderBounds(t){return this.context.element.getElement(t).getRenderBounds()}collapseElement(t){return _e(this,arguments,void 0,function*(e,n=!0){const{model:i,element:a}=this.context;if(Sr(i.getNodeLikeData([e])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!0});const s=i.getElementType(e);yield this.frontElement(e),this.isCollapsingExpanding=!0,this.setElementCollapsibility(e,!0),s==="node"?yield a.collapseNode(e,n):s==="combo"&&(yield a.collapseCombo(e,!!n.animation)),this.isCollapsingExpanding=!1})}expandElement(t){return _e(this,arguments,void 0,function*(e,n=!0){const{model:i,element:a}=this.context;if(!Sr(i.getNodeLikeData([e])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!0});const s=i.getElementType(e);this.isCollapsingExpanding=!0,this.setElementCollapsibility(e,!1),s==="node"?yield a.expandNode(e,n):s==="combo"&&(yield a.expandCombo(e,!!n.animation)),this.isCollapsingExpanding=!1})}setElementCollapsibility(t,e){const n=this.getElementType(t);n==="node"?this.updateNodeData([{id:t,style:{collapsed:e}}]):n==="combo"&&this.updateComboData([{id:t,style:{collapsed:e}}])}toDataURL(){return _e(this,arguments,void 0,function*(t={}){return this.context.canvas.toDataURL(t)})}getCanvasByViewport(t){return this.context.canvas.getCanvasByViewport(t)}getViewportByCanvas(t){return this.context.canvas.getViewportByCanvas(t)}getClientByCanvas(t){return this.context.canvas.getClientByCanvas(t)}getCanvasByClient(t){return this.context.canvas.getCanvasByClient(t)}getViewportCenter(){return this.context.viewport.getViewportCenter()}getCanvasCenter(){return this.context.viewport.getCanvasCenter()}on(t,e,n){return super.on(t,e,n)}once(t,e){return super.once(t,e)}off(t,e){return super.off(t,e)}}R0.defaultOptions={autoResize:!1,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};var z0t=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};function $0t(r,t){const{getNodeData:e=(o,l)=>{if(o.depth=l,!o.children)return o;const{children:u}=o,c=z0t(o,["children"]);return Object.assign(Object.assign({},c),{children:u.map(h=>h.id)})},getEdgeData:n=(o,l)=>({source:o.id,target:l.id}),getChildren:i=o=>o.children||[]}={},a=[],s=[];return To(r,(o,l)=>{a.push(e(o,l));const u=i(o);for(const c of u)s.push(n(o,c))},o=>i(o),"TB"),{nodes:a,edges:s}}class j0t extends Ka{beforeDraw(t){const{add:e,update:n}=t,{model:i}=this.context;return[...e.edges.entries(),...n.edges.entries()].forEach(([,a])=>{g5(i,a)}),t}}const g5=(r,t)=>{const{source:e,target:n}=t,i=r.getElementDataById(e),a=r.getElementDataById(n),s=KM(i,h=>r.getParentData(h,we)),o=KM(a,h=>r.getParentData(h,we)),l=H(s),u=H(o),c={sourceNode:l,targetNode:u};return t.style?Object.assign(t.style,c):t.style=c,t},q0t=(r,t,e)=>{const[n,i]=t,[a,s]=e;if(i===n)return a;const o=(r-n)/(i-n);return a+o*(s-a)},W0t=(r,t,e)=>{const[n,i]=t,[a,s]=e,o=Math.log(r-n+1)/Math.log(i-n+1);return a+o*(s-a)},G0t=(r,t,e,n=2)=>{const[i,a]=t,[s,o]=e,l=Math.pow((r-i)/(a-i),n);return s+l*(o-s)},V0t=(r,t,e)=>{const[n,i]=t,[a,s]=e,o=Math.sqrt((r-n)/(i-n));return a+o*(s-a)};class L0 extends Ka{constructor(t,e){super(t,cr({},L0.defaultOptions,e)),this.assignSizeByCentrality=(n,i,a,s,o,l)=>{const u=[i,a],c=[s[0],o[0]],h=[s[1],o[1]],d=[s[2],o[2]],g=(p,v)=>{if(typeof l=="function")return l(p,u,v);switch(l){case"linear":return q0t(p,u,v);case"log":return W0t(p,u,v);case"pow":return G0t(p,u,v,2);case"sqrt":return V0t(p,u,v);default:return v[0]}};return[g(n,c),g(n,h),g(n,d)]}}beforeDraw(t){const{model:e}=this.context,n=e.getNodeData(),i=Hr(this.options.maxSize),a=Hr(this.options.minSize),s=this.getCentralities(this.options.centrality),o=s.size>0?Math.max(...s.values()):0,l=s.size>0?Math.min(...s.values()):0;return n.forEach(u=>{var c;const h=this.assignSizeByCentrality(s.get(H(u))||0,l,o,a,i,this.options.scale),d=(c=this.context.element)===null||c===void 0?void 0:c.getElement(H(u)),g={size:h};this.assignLabelStyle(g,h,u,d),(!d||!lf(g,d.attributes))&&Vr(t,d?"update":"add","node",cr(u,{style:g}),!0)}),t}assignLabelStyle(t,e,n,i){var a;const s=i?i.config.style:(a=this.context.element)===null||a===void 0?void 0:a.getElementComputedStyle("node",n);if(Object.assign(t,No(s,["labelFontSize","labelLineHeight"])),this.options.mapLabelSize){const o=this.getLabelSizeByNodeSize(e,1/0,Number(t.labelFontSize));Object.assign(t,{labelFontSize:o,labelLineHeight:o+sX(t.labelPadding)})}return t}getLabelSizeByNodeSize(t,e,n){const i=Math.min(...t)/2,[a,s]=Array.isArray(this.options.mapLabelSize)?this.options.mapLabelSize:[n,e];return Math.min(s,Math.max(i,a))}getCentralities(t){const{model:e}=this.context,n=e.getData();if(typeof t=="function")return t(n);const i=e.getRelatedEdgesData.bind(e);return cI(n,i,t)}}L0.defaultOptions={centrality:{type:"degree"},maxSize:80,minSize:20,scale:"linear",mapLabelSize:!1};class I0 extends Ka{constructor(t,e){super(t,Object.assign({},I0.defaultOptions,e))}get ref(){return this.context.model.getRootsData()[0]}afterLayout(){var t;const e=sn(this.ref),{graph:n,model:i}=this.context;(t=i.getData().nodes)===null||t===void 0||t.forEach(s=>{var o;if(H(s)===H(this.ref))return;const l=dI(be(sn(s),e)),u=Math.abs(l)>Math.PI/2,c=!s.children||s.children.length===0,h=H(s),d=(o=this.context.element)===null||o===void 0?void 0:o.getElement(h);if(!d||!d.isVisible())return;const g=Hr(n.getElementRenderStyle(h).size)[0]/2,p=(c?1:-1)*(g+this.options.offset),v=[["translate",p*Math.cos(l),p*Math.sin(l)],["rotate",u?xr(l)+180:xr(l)]];i.updateNodeData([{id:H(s),style:{labelTextAlign:u===c?"right":"left",labelTextBaseline:"middle",labelTransform:v}}])}),n.draw()}}I0.defaultOptions={offset:5};const H0t="quadratic",oR=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class D0 extends Ka{constructor(t,e){super(t,Object.assign({},D0.defaultOptions,e)),this.cacheMergeStyle=new Map,this.getAffectedParallelEdges=n=>{const{add:{edges:i},update:{nodes:a,edges:s,combos:o},remove:{edges:l}}=n,{model:u}=this.context,c=new Map,h=(p,v)=>{u.getRelatedEdgesData(v).forEach(b=>!c.has(H(b))&&c.set(H(b),b))};a.forEach(h),o.forEach(h);const d=p=>{const v=u.getEdgeData().map(b=>g5(u,b));U0t(p,v).forEach(b=>!c.has(H(b))&&c.set(H(b),b))};if(l.size&&l.forEach(d),i.size&&i.forEach(d),s.size){const p=w4(DE(u.getChanges())).update.edges;s.forEach(v=>{var m;d(v);const b=(m=p.find(w=>H(w.value)===H(v)))===null||m===void 0?void 0:m.original;b&&!ZE(v,b)&&d(b)})}Ki(this.options.edges)||c.forEach((p,v)=>!this.options.edges.includes(v)&&c.delete(v));const g=u.getEdgeData().map(H);return new Map([...c].sort((p,v)=>g.indexOf(p[0])-g.indexOf(v[0])))},this.applyBundlingStyle=(n,i,a)=>{const{edgeMap:s,reverses:o}=lR(i);s.forEach(l=>{l.forEach((u,c,h)=>{var d;const g=h.length,p=u.style||{};if(u.source===u.target){const b=oR.length;p.loopPlacement=oR[c%b],p.loopDist=Math.floor(c/b)*a+50}else if(g===1)p.curveOffset=0;else{const b=(c%2===0?1:-1)*(o[`${u.source}|${u.target}|${c}`]?-1:1);p.curveOffset=g%2===1?b*Math.ceil(c/2)*a*2:b*(Math.floor(c/2)*a*2+a)}const v=Object.assign(u,{type:H0t,style:p}),m=(d=this.context.element)===null||d===void 0?void 0:d.getElement(H(u));(!m||!lf(v.style,m.attributes))&&Vr(n,m?"update":"add","edge",v,!0)})})},this.resetEdgeStyle=n=>{const i=n.style||{},a=this.cacheMergeStyle.get(H(n))||{};return Object.keys(a).forEach(s=>{Ue(i[s],a[s])&&(n[s]?i[s]=n[s]:delete i[s])}),Object.assign(n,{style:i})},this.applyMergingStyle=(n,i)=>{const{edgeMap:a,reverses:s}=lR(i);a.forEach(o=>{var l;if(o.length===1){const c=o[0],h=(l=this.context.element)===null||l===void 0?void 0:l.getElement(H(c)),d=this.resetEdgeStyle(c);(!h||!lf(d,h.attributes))&&Vr(n,h?"update":"add","edge",d);return}const u=o.map(({source:c,target:h,style:d={}},g)=>{const{startArrow:p,endArrow:v}=d,m={},[b,w]=s[`${c}|${h}|${g}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return yf(p)&&(m[b]=p),yf(v)&&(m[w]=v),m}).reduce((c,h)=>Object.assign(Object.assign({},c),h),{});o.forEach((c,h,d)=>{var g;if(h!==0){Vr(n,"remove","edge",c);return}const p=Object.assign({},Et(this.options.style)?this.options.style(d):this.options.style,{childrenData:d});this.cacheMergeStyle.set(H(c),p);const v=Object.assign(Object.assign({},c),{type:"line",style:Object.assign(Object.assign(Object.assign({},c.style),u),p)}),m=(g=this.context.element)===null||g===void 0?void 0:g.getElement(H(c));(!m||!lf(v.style,m.attributes))&&Vr(n,m?"update":"add","edge",v,!0)})})}}beforeDraw(t){const e=this.getAffectedParallelEdges(t);return e.size===0||(this.options.mode==="bundle"?this.applyBundlingStyle(t,e,this.options.distance):this.applyMergingStyle(t,e)),t}}D0.defaultOptions={mode:"bundle",distance:15};const lR=r=>{const t=new Map,e=new Set,n={};for(const[i,a]of r){if(e.has(i))continue;const{source:s,target:o}=a,l=`${s}-${o}`;t.has(l)||t.set(l,[]),t.get(l).push(a),e.add(i);for(const[u,c]of r)e.has(u)||ZE(a,c)&&(t.get(l).push(c),e.add(u),s===c.target&&o===c.source&&(n[`${c.source}|${c.target}|${t.get(l).length-1}`]=!0))}return{edgeMap:t,reverses:n}},U0t=(r,t,e)=>t.filter(n=>ZE(n,r)),ZE=(r,t)=>{const{sourceNode:e,targetNode:n}=r.style||{},{sourceNode:i,targetNode:a}=t.style||{};return e===i&&n===a||e===a&&n===i};class Y0t extends Ka{beforeDraw(t,e){const{stage:n}=e;if(n==="visibility")return t;const{model:i}=this.context,{update:{nodes:a,edges:s,combos:o}}=t,l=(u,c)=>{i.getRelatedEdgesData(c).forEach(d=>!s.has(H(d))&&s.set(H(d),d))};return a.forEach(l),o.forEach(l),t}}const X0t={animation:{"combo-collapse":rI,"combo-expand":rX,"node-collapse":eI,"node-expand":eX,"path-in":nI,"path-out":nX,fade:QY,translate:tX},behavior:{"brush-select":Dc,"click-select":dg,"collapse-expand":_g,"create-edge":Sg,"drag-canvas":Mg,"drag-element-force":uJ,"drag-element":qc,"fix-element-size":Og,"focus-element":Cg,"hover-activate":Ag,"lasso-select":hJ,"auto-adapt-label":ug,"optimize-viewport-transform":Pg,"scroll-canvas":Ng,"zoom-canvas":Rg},combo:{circle:lZ,rect:uZ},edge:{cubic:Vo,line:GI,polyline:wg,quadratic:xg,"cubic-horizontal":$c,"cubic-radial":yg,"cubic-vertical":bg},layout:{"antv-dagre":cet,"combo-combined":hrt,"compact-box":Td.compactBox,"d3-force":Frt,"force-atlas2":Iut,circular:fet,concentric:Kw,dagre:a0,dendrogram:Td.dendrogram,fishbone:s0,force:kD,fruchterman:But,grid:$ut,indented:Td.indented,mds:DD,mindmap:Td.mindmap,radial:Xut,random:nct,snake:o0},node:{circle:zc,diamond:hK,ellipse:pg,hexagon:vK,html:vg,image:FI,rect:sZ,star:oZ,donut:gg,triangle:mg},palette:{spectral:yct,tableau:bct,oranges:wct,greens:xct,blues:Ect},theme:{dark:f0t,light:p0t},plugin:{"bubble-sets":c0,"edge-bundling":d0,"edge-filter-lens":f0,"grid-line":v0,background:l0,contextmenu:h0,fisheye:g0,fullscreen:p0,history:m0,hull:y0,legend:M0,minimap:k0,snapline:T0,timebar:O0,toolbar:C0,tooltip:A0,watermark:P0},transform:{"arrange-draw-order":v0t,"collapse-expand-combo":m0t,"collapse-expand-node":y0t,"get-edge-actual-ends":j0t,"map-node-size":L0,"place-radial-labels":I0,"process-parallel-edges":D0,"update-related-edges":Y0t},shape:{circle:Ha,ellipse:Nc,group:_n,html:Rc,image:Kx,line:Io,path:qr,polygon:Go,polyline:og,rect:Sn,text:Hs,label:Xs,badge:za}};function K0t(){Object.entries(X0t).forEach(([r,t])=>{Object.entries(t).forEach(([e,n])=>{Zu(r,e,n)})})}K0t();const Z0t={__name:"MindMapping",setup(r){const t=ce(null),e={fill:"#EFF0F0",labelFill:"#262626",labelFontSize:24,labelFontWeight:600,labelOffsetY:8,labelPlacement:"center",ports:[{placement:"right"},{placement:"left"}],radius:8},n={fill:"transparent",labelPlacement:"center",labelFontSize:16,ports:[{placement:"right-bottom"},{placement:"left-bottom"}]},i={COLLAPSE_EXPAND:"collapse-expand",ADD_CHILD:"add-child"};let a;const s=m=>(a||(a=new Hs({style:m})),a.attr(m),a.getBBox().width),o=(m,b)=>{const w=b?40:30;return s({text:m,fontSize:(b?e:n).labelFontSize,fontFamily:"Gill Sans"})+w},l=(m,b)=>[o(m,b),b?48:32],p=class p extends vi{constructor(b){Object.assign(b.style,p.defaultStyleProps),super(b)}get childrenData(){return this.context.model.getChildrenData(this.id)}get rootId(){return H(this.context.model.getRootsData()[0])}isShowCollapse(b){const{collapsed:w,showIcon:x}=b;return!w&&x&&this.childrenData.length>0}drawCircleShape(b,w){const{color:x="#000",radius:_=10}=b,[S,M]=this.getSize(b),k={fill:x,stroke:"#fff",lineWidth:1,r:_,x:S/2,y:M/2};this.upsert("circle","circle",k,w)}getCollapseStyle(b){const{showIcon:w,color:x,direction:_}=b;if(!this.isShowCollapse(b))return!1;const[S,M]=this.getSize(b);return{backgroundFill:x,backgroundHeight:12,backgroundWidth:12,cursor:"pointer",fill:"#fff",fontFamily:"iconfont",fontSize:8,text:"",textAlign:"center",transform:_==="left"?[["rotate",90]]:[["rotate",-90]],visibility:w?"visible":"hidden",x:_==="left"?-6:S+6,y:M}}drawCollapseShape(b,w){const x=this.getCollapseStyle(b),_=this.upsert("collapse-expand",za,x,w);this.forwardEvent(_,J.CLICK,S=>{S.stopPropagation(),this.context.graph.emit(i.COLLAPSE_EXPAND,{id:this.id,collapsed:!b.collapsed})})}getCountStyle(b){const{collapsed:w,color:x,direction:_}=b,S=this.context.model.getDescendantsData(this.id).length;if(!w||S===0)return!1;const[M,k]=this.getSize(b);return{backgroundFill:x,backgroundHeight:12,backgroundWidth:12,cursor:"pointer",fill:"#fff",fontSize:8,text:S.toString(),textAlign:"center",x:_==="left"?-6:M+6,y:k}}drawCountShape(b,w){const x=this.getCountStyle(b),_=this.upsert("count",za,x,w);this.forwardEvent(_,J.CLICK,S=>{S.stopPropagation(),this.context.graph.emit(i.COLLAPSE_EXPAND,{id:this.id,collapsed:!1})})}getAddStyle(b){const{collapsed:w,showIcon:x,direction:_}=b;if(w||!x)return!1;const[S,M]=this.getSize(b),k="#ddd",T=this.isShowCollapse(b)?24:12,P=this.id===this.rootId;return{backgroundFill:"#fff",backgroundHeight:12,backgroundLineWidth:1,backgroundStroke:k,backgroundWidth:12,cursor:"pointer",fill:k,fontFamily:"iconfont",fontSize:8,text:"",textAlign:"center",x:P?S+12:_==="left"?-T:S+T,y:P?M/2:M}}getAddBarStyle(b){const{collapsed:w,showIcon:x,direction:_,color:S="#1783FF"}=b;if(w||!x)return!1;const[M,k]=this.getSize(b),T=this.isShowCollapse(b)?12:0,P=this.id===this.rootId,O=2,A=6;return{cursor:"pointer",fill:_==="left"?`linear-gradient(180deg, #fff 20%, ${S})`:`linear-gradient(0deg, #fff 20%, ${S})`,height:O,width:A,x:P?M:_==="left"?-T-A:M+T,y:P?k/2-O/2:k-O/2,zIndex:-1}}drawAddShape(b,w){const x=this.getAddStyle(b),_=this.getAddBarStyle(b);this.upsert("add-bar",Sn,_,w);const S=this.upsert("add",za,x,w);this.forwardEvent(S,J.CLICK,M=>{M.stopPropagation(),this.context.graph.emit(i.ADD_CHILD,{id:this.id,direction:b.direction})})}forwardEvent(b,w,x){b&&!Reflect.has(b,"__bind__")&&(Reflect.set(b,"__bind__",!0),b.addEventListener(w,x))}getKeyStyle(b){const[w,x]=this.getSize(b),_=super.getKeyStyle(b);return{width:w,height:x,..._}}drawKeyShape(b,w){const x=this.getKeyStyle(b);return this.upsert("key",Sn,x,w)}render(b=this.parsedAttributes,w=this){super.render(b,w),this.drawCollapseShape(b,w),this.drawAddShape(b,w),this.drawCountShape(b,w)}};le(p,"defaultStyleProps",{showIcon:!1});let u=p;class c extends $c{get rootId(){return H(this.context.model.getRootsData()[0])}getKeyPath(b){const w=super.getKeyPath(b),x=this.targetNode.id===this.rootId,_=o(this.targetNode.id,x),[,S]=this.getEndpoints(b),M=this.sourceNode.getCenter()[0]<this.targetNode.getCenter()[0]?1:-1;return[...w,["L",S[0]+_*M,S[1]]]}}class h extends Or{constructor(w,x){super(w,x);le(this,"status","idle");le(this,"showIcon",w=>{this.setIcon(w,!0)});le(this,"hideIcon",w=>{this.setIcon(w,!1)});le(this,"setIcon",(w,x)=>{if(this.status!=="idle")return;const{target:_}=w,S=_.id,{graph:M,element:k}=this.context;M.updateNodeData([{id:S,style:{showIcon:x}}]),k.draw({animation:!1,silence:!0})});le(this,"onCollapseExpand",async w=>{this.status="busy";const{id:x,collapsed:_}=w,{graph:S}=this.context;await S.frontElement(x),_?await S.collapseElement(x):await S.expandElement(x),this.status="idle"});le(this,"addChild",async w=>{this.status="busy";const{onCreateChild:x=()=>({id:`新节点 in ${new Date(Date.now()).toLocaleString()}`})}=this.options,{graph:_}=this.context,S=x(w.id),M=_.getNodeData(w.id);_.addNodeData([S]),_.addEdgeData([{source:w.id,target:S.id}]),_.updateNodeData([{id:w.id,children:[...M.children||[],S.id],style:{collapsed:!1,showIcon:!1}}]),await _.render(),await _.focusElement(S.id),this.status="idle"});this.bindEvents()}update(w){this.unbindEvents(),super.update(w),this.bindEvents()}bindEvents(){const{graph:w}=this.context;w.on(Zn.POINTER_ENTER,this.showIcon),w.on(Zn.POINTER_LEAVE,this.hideIcon),w.on(i.COLLAPSE_EXPAND,this.onCollapseExpand),w.on(i.ADD_CHILD,this.addChild)}unbindEvents(){const{graph:w}=this.context;w.off(Zn.POINTER_ENTER,this.showIcon),w.off(Zn.POINTER_LEAVE,this.hideIcon),w.off(i.COLLAPSE_EXPAND,this.onCollapseExpand),w.off(i.ADD_CHILD,this.addChild)}}const v=class v extends Ka{constructor(b,w){super(b,Object.assign({},v.defaultOptions,w))}beforeDraw(b){const w=this.context.model.getNodeData(),x=this.context.model.getEdgeData();if(w.length===0)return b;let _=0;return w.forEach(S=>{S.style||(S.style={}),S.style.color=this.options.colors[_++%this.options.colors.length]}),x.forEach(S=>{const M=w.find(k=>k.id===S.target);M&&(S.style||(S.style={}),S.style.stroke=M.style.color)}),b}};le(v,"defaultOptions",{colors:["#80B4FF","#FFC8A2","#E6C8FF","#A2E6E6","#C8B4FF","#FFD878","#A2E680","#FFA2D8","#80C8D8","#80E6A2","#FFD878","#D880D8","#80C880","#FFA280","#80E6E6","#FFA2D8","#C8C8D8","#FFC8C8","#FFD878","#C8FF80"]});let d=v;Zu(Na.NODE,"mindmap",u),Zu(Na.EDGE,"mindmap",c),Zu(Na.BEHAVIOR,"collapse-expand-tree",h),Zu(Na.TRANSFORM,"assign-color-by-branch",d);const g=(m,b)=>{if(!b)return"center";const w=sn(m)[0];return sn(b)[0]>w?"left":"right"};return Tc(async()=>{const m=Cq,b=m.id,w=new R0({container:t.value,width:t.value.clientWidth||1e3,height:t.value.clientHeight||800,fitView:!0,fitCenter:!0,data:$0t(m),node:{type:"mindmap",style:function(x){const _=g(x,this.getParentData(H(x),"tree")),S=H(x)===b;return{direction:_,labelText:H(x),size:l(H(x),S),labelFontFamily:"Gill Sans",labelBackground:!0,labelBackgroundFill:"transparent",labelPadding:_==="left"?[2,0,10,40]:[2,40,10,0],...S?e:n}}},edge:{type:"mindmap",style:{lineWidth:3,stroke:function(x){return this.getNodeData(x.target).style.color||"#99ADD1"}}},layout:{type:"mindmap",direction:"H",getHeight:()=>80,getWidth:x=>o(x.id,x.id===b),getVGap:()=>6,getHGap:()=>60,animation:!1,getSide:()=>"right"},behaviors:["drag-canvas","zoom-canvas","collapse-expand-tree"],transforms:["assign-color-by-branch"],animation:{duration:200}});w.once(ut.AFTER_RENDER,()=>{w.fitView()}),w.render()}),(m,b)=>($t(),Ve("div",{ref_key:"container",ref:t,class:"mindmap-container"},null,512))}},J0t=$o(Z0t,[["__scopeId","data-v-a144d84e"]]),Q0t="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.75%204C7.75%202.20508%209.20508%200.75%2011%200.75H27C27.1212%200.75%2027.2375%200.798159%2027.3232%200.883885L38.1161%2011.6768C38.2018%2011.7625%2038.25%2011.8788%2038.25%2012V36C38.25%2037.7949%2036.7949%2039.25%2035%2039.25H11C9.20507%2039.25%207.75%2037.7949%207.75%2036V4Z'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3cpath%20d='M27%200.5V8C27%2010.2091%2028.7909%2012%2031%2012H38.5'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3crect%20x='1'%20y='18'%20width='29'%20height='16'%20rx='2'%20fill='%23155EEF'%20/%3e%3cpath%20d='M7.40163%2030H4.82351V22.7273H7.42294C8.15447%2022.7273%208.78421%2022.8729%209.31214%2023.1641C9.84008%2023.4529%2010.2461%2023.8684%2010.5302%2024.4105C10.8166%2024.9527%2010.9599%2025.6013%2010.9599%2026.3565C10.9599%2027.1141%2010.8166%2027.7652%2010.5302%2028.3097C10.2461%2028.8542%209.83771%2029.272%209.30504%2029.5632C8.77474%2029.8544%208.14027%2030%207.40163%2030ZM6.36115%2028.6825H7.33771C7.79226%2028.6825%208.1746%2028.602%208.48473%2028.4411C8.79723%2028.2777%209.03161%2028.0256%209.18786%2027.6847C9.34647%2027.3414%209.42578%2026.8987%209.42578%2026.3565C9.42578%2025.8191%209.34647%2025.38%209.18786%2025.0391C9.03161%2024.6982%208.79841%2024.4472%208.48828%2024.2862C8.17815%2024.1252%207.79581%2024.0447%207.34126%2024.0447H6.36115V28.6825ZM18.7821%2026.3636C18.7821%2027.1567%2018.6318%2027.8314%2018.3311%2028.3878C18.0328%2028.9441%2017.6257%2029.3691%2017.1096%2029.6626C16.5958%2029.9538%2016.0182%2030.0994%2015.3766%2030.0994C14.7303%2030.0994%2014.1503%2029.9527%2013.6365%2029.6591C13.1228%2029.3655%2012.7168%2028.9406%2012.4185%2028.3842C12.1202%2027.8279%2011.9711%2027.1544%2011.9711%2026.3636C11.9711%2025.5705%2012.1202%2024.8958%2012.4185%2024.3395C12.7168%2023.7831%2013.1228%2023.3594%2013.6365%2023.0682C14.1503%2022.7746%2014.7303%2022.6278%2015.3766%2022.6278C16.0182%2022.6278%2016.5958%2022.7746%2017.1096%2023.0682C17.6257%2023.3594%2018.0328%2023.7831%2018.3311%2024.3395C18.6318%2024.8958%2018.7821%2025.5705%2018.7821%2026.3636ZM17.2232%2026.3636C17.2232%2025.8499%2017.1462%2025.4167%2016.9924%2025.0639C16.8408%2024.7112%2016.6266%2024.4437%2016.3496%2024.2614C16.0726%2024.0791%2015.7483%2023.9879%2015.3766%2023.9879C15.0049%2023.9879%2014.6806%2024.0791%2014.4036%2024.2614C14.1266%2024.4437%2013.9112%2024.7112%2013.7573%2025.0639C13.6058%2025.4167%2013.53%2025.8499%2013.53%2026.3636C13.53%2026.8774%2013.6058%2027.3106%2013.7573%2027.6634C13.9112%2028.0161%2014.1266%2028.2836%2014.4036%2028.4659C14.6806%2028.6482%2015.0049%2028.7393%2015.3766%2028.7393C15.7483%2028.7393%2016.0726%2028.6482%2016.3496%2028.4659C16.6266%2028.2836%2016.8408%2028.0161%2016.9924%2027.6634C17.1462%2027.3106%2017.2232%2026.8774%2017.2232%2026.3636ZM26.3381%2025.2734H24.7827C24.7543%2025.0722%2024.6963%2024.8935%2024.6087%2024.7372C24.5211%2024.5786%2024.4086%2024.4437%2024.2713%2024.3324C24.134%2024.2211%2023.9754%2024.1359%2023.7955%2024.0767C23.6179%2024.0175%2023.425%2023.9879%2023.2166%2023.9879C22.8402%2023.9879%2022.5123%2024.0814%2022.233%2024.2685C21.9536%2024.4531%2021.737%2024.723%2021.5831%2025.0781C21.4292%2025.4309%2021.3523%2025.8594%2021.3523%2026.3636C21.3523%2026.8821%2021.4292%2027.3177%2021.5831%2027.6705C21.7393%2028.0232%2021.9571%2028.2895%2022.2365%2028.4695C22.5159%2028.6494%2022.839%2028.7393%2023.206%2028.7393C23.4119%2028.7393%2023.6025%2028.7121%2023.7777%2028.6577C23.9553%2028.6032%2024.1127%2028.5239%2024.25%2028.4197C24.3873%2028.3132%2024.5009%2028.1842%2024.5909%2028.0327C24.6832%2027.8812%2024.7472%2027.7083%2024.7827%2027.5142L26.3381%2027.5213C26.2978%2027.8551%2026.1972%2028.1771%2026.0362%2028.4872C25.8776%2028.795%2025.6634%2029.0708%2025.3935%2029.3146C25.1259%2029.5561%2024.8063%2029.7479%2024.4347%2029.8899C24.0653%2030.0296%2023.6475%2030.0994%2023.1811%2030.0994C22.5324%2030.0994%2021.9524%2029.9527%2021.4411%2029.6591C20.9321%2029.3655%2020.5296%2028.9406%2020.2337%2028.3842C19.9401%2027.8279%2019.7933%2027.1544%2019.7933%2026.3636C19.7933%2025.5705%2019.9425%2024.8958%2020.2408%2024.3395C20.5391%2023.7831%2020.9439%2023.3594%2021.4553%2023.0682C21.9666%2022.7746%2022.5419%2022.6278%2023.1811%2022.6278C23.6025%2022.6278%2023.9931%2022.687%2024.353%2022.8054C24.7152%2022.9238%2025.036%2023.0966%2025.3153%2023.3239C25.5947%2023.5488%2025.822%2023.8246%2025.9972%2024.1513C26.1747%2024.478%2026.2884%2024.852%2026.3381%2025.2734Z'%20fill='white'%20/%3e%3c/svg%3e",tpt="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.75%204C7.75%202.20508%209.20508%200.75%2011%200.75H27C27.1212%200.75%2027.2375%200.798159%2027.3232%200.883885L38.1161%2011.6768C38.2018%2011.7625%2038.25%2011.8788%2038.25%2012V36C38.25%2037.7949%2036.7949%2039.25%2035%2039.25H11C9.20507%2039.25%207.75%2037.7949%207.75%2036V4Z'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3cpath%20d='M27%200.5V8C27%2010.2091%2028.7909%2012%2031%2012H38.5'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3crect%20x='1'%20y='18'%20width='36'%20height='16'%20rx='2'%20fill='%23155EEF'%20/%3e%3cpath%20d='M7.40554%2030H4.82741V22.7273H7.42685C8.15838%2022.7273%208.78812%2022.8729%209.31605%2023.1641C9.84399%2023.4529%2010.25%2023.8684%2010.5341%2024.4105C10.8205%2024.9527%2010.9638%2025.6013%2010.9638%2026.3565C10.9638%2027.1141%2010.8205%2027.7652%2010.5341%2028.3097C10.25%2028.8542%209.84162%2029.272%209.30895%2029.5632C8.77865%2029.8544%208.14418%2030%207.40554%2030ZM6.36506%2028.6825H7.34162C7.79616%2028.6825%208.1785%2028.602%208.48864%2028.4411C8.80114%2028.2777%209.03551%2028.0256%209.19176%2027.6847C9.35038%2027.3414%209.42969%2026.8987%209.42969%2026.3565C9.42969%2025.8191%209.35038%2025.38%209.19176%2025.0391C9.03551%2024.6982%208.80232%2024.4472%208.49219%2024.2862C8.18205%2024.1252%207.79972%2024.0447%207.34517%2024.0447H6.36506V28.6825ZM18.786%2026.3636C18.786%2027.1567%2018.6357%2027.8314%2018.335%2028.3878C18.0368%2028.9441%2017.6296%2029.3691%2017.1135%2029.6626C16.5997%2029.9538%2016.0221%2030.0994%2015.3805%2030.0994C14.7342%2030.0994%2014.1542%2029.9527%2013.6404%2029.6591C13.1267%2029.3655%2012.7207%2028.9406%2012.4224%2028.3842C12.1241%2027.8279%2011.975%2027.1544%2011.975%2026.3636C11.975%2025.5705%2012.1241%2024.8958%2012.4224%2024.3395C12.7207%2023.7831%2013.1267%2023.3594%2013.6404%2023.0682C14.1542%2022.7746%2014.7342%2022.6278%2015.3805%2022.6278C16.0221%2022.6278%2016.5997%2022.7746%2017.1135%2023.0682C17.6296%2023.3594%2018.0368%2023.7831%2018.335%2024.3395C18.6357%2024.8958%2018.786%2025.5705%2018.786%2026.3636ZM17.2271%2026.3636C17.2271%2025.8499%2017.1502%2025.4167%2016.9963%2025.0639C16.8448%2024.7112%2016.6305%2024.4437%2016.3535%2024.2614C16.0765%2024.0791%2015.7522%2023.9879%2015.3805%2023.9879C15.0088%2023.9879%2014.6845%2024.0791%2014.4075%2024.2614C14.1305%2024.4437%2013.9151%2024.7112%2013.7612%2025.0639C13.6097%2025.4167%2013.5339%2025.8499%2013.5339%2026.3636C13.5339%2026.8774%2013.6097%2027.3106%2013.7612%2027.6634C13.9151%2028.0161%2014.1305%2028.2836%2014.4075%2028.4659C14.6845%2028.6482%2015.0088%2028.7393%2015.3805%2028.7393C15.7522%2028.7393%2016.0765%2028.6482%2016.3535%2028.4659C16.6305%2028.2836%2016.8448%2028.0161%2016.9963%2027.6634C17.1502%2027.3106%2017.2271%2026.8774%2017.2271%2026.3636ZM26.342%2025.2734H24.7866C24.7582%2025.0722%2024.7002%2024.8935%2024.6126%2024.7372C24.525%2024.5786%2024.4125%2024.4437%2024.2752%2024.3324C24.1379%2024.2211%2023.9793%2024.1359%2023.7994%2024.0767C23.6218%2024.0175%2023.4289%2023.9879%2023.2205%2023.9879C22.8441%2023.9879%2022.5162%2024.0814%2022.2369%2024.2685C21.9575%2024.4531%2021.7409%2024.723%2021.587%2025.0781C21.4331%2025.4309%2021.3562%2025.8594%2021.3562%2026.3636C21.3562%2026.8821%2021.4331%2027.3177%2021.587%2027.6705C21.7433%2028.0232%2021.9611%2028.2895%2022.2404%2028.4695C22.5198%2028.6494%2022.8429%2028.7393%2023.2099%2028.7393C23.4158%2028.7393%2023.6064%2028.7121%2023.7816%2028.6577C23.9592%2028.6032%2024.1166%2028.5239%2024.2539%2028.4197C24.3912%2028.3132%2024.5049%2028.1842%2024.5948%2028.0327C24.6871%2027.8812%2024.7511%2027.7083%2024.7866%2027.5142L26.342%2027.5213C26.3017%2027.8551%2026.2011%2028.1771%2026.0401%2028.4872C25.8815%2028.795%2025.6673%2029.0708%2025.3974%2029.3146C25.1299%2029.5561%2024.8103%2029.7479%2024.4386%2029.8899C24.0692%2030.0296%2023.6514%2030.0994%2023.185%2030.0994C22.5363%2030.0994%2021.9563%2029.9527%2021.445%2029.6591C20.936%2029.3655%2020.5335%2028.9406%2020.2376%2028.3842C19.944%2027.8279%2019.7972%2027.1544%2019.7972%2026.3636C19.7972%2025.5705%2019.9464%2024.8958%2020.2447%2024.3395C20.543%2023.7831%2020.9478%2023.3594%2021.4592%2023.0682C21.9705%2022.7746%2022.5458%2022.6278%2023.185%2022.6278C23.6064%2022.6278%2023.997%2022.687%2024.3569%2022.8054C24.7191%2022.9238%2025.0399%2023.0966%2025.3192%2023.3239C25.5986%2023.5488%2025.8259%2023.8246%2026.0011%2024.1513C26.1786%2024.478%2026.2923%2024.852%2026.342%2025.2734ZM28.7301%2022.7273L30.1967%2025.206H30.2536L31.7273%2022.7273H33.4638L31.2443%2026.3636L33.5135%2030H31.745L30.2536%2027.5178H30.1967L28.7053%2030H26.9439L29.2202%2026.3636L26.9865%2022.7273H28.7301Z'%20fill='white'%20/%3e%3c/svg%3e",ept="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.75%204C7.75%202.20508%209.20508%200.75%2011%200.75H27C27.1212%200.75%2027.2375%200.798159%2027.3232%200.883885L38.1161%2011.6768C38.2018%2011.7625%2038.25%2011.8788%2038.25%2012V36C38.25%2037.7949%2036.7949%2039.25%2035%2039.25H11C9.20507%2039.25%207.75%2037.7949%207.75%2036V4Z'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3cpath%20d='M27%200.5V8C27%2010.2091%2028.7909%2012%2031%2012H38.5'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3crect%20x='1'%20y='18'%20width='26'%20height='16'%20rx='2'%20fill='%23D92D20'%20/%3e%3cpath%20d='M4.8323%2030V22.7273H7.70162C8.25323%2022.7273%208.72316%2022.8326%209.11142%2023.0433C9.49967%2023.2517%209.7956%2023.5417%209.9992%2023.9134C10.2052%2024.2827%2010.3082%2024.7088%2010.3082%2025.1918C10.3082%2025.6747%2010.204%2026.1009%209.99565%2026.4702C9.78732%2026.8395%209.48547%2027.1271%209.09011%2027.3331C8.69712%2027.5391%208.22127%2027.642%207.66255%2027.642H5.83372V26.4098H7.41397C7.7099%2026.4098%207.95375%2026.3589%208.14551%2026.2571C8.33964%2026.1529%208.48405%2026.0097%208.57875%2025.8274C8.67581%2025.6428%208.72434%2025.4309%208.72434%2025.1918C8.72434%2024.9503%208.67581%2024.7396%208.57875%2024.5597C8.48405%2024.3774%208.33964%2024.2365%208.14551%2024.1371C7.95138%2024.0353%207.70517%2023.9844%207.40687%2023.9844H6.36994V30H4.8323ZM13.885%2030H11.3069V22.7273H13.9063C14.6379%2022.7273%2015.2676%2022.8729%2015.7955%2023.1641C16.3235%2023.4529%2016.7295%2023.8684%2017.0136%2024.4105C17.3%2024.9527%2017.4433%2025.6013%2017.4433%2026.3565C17.4433%2027.1141%2017.3%2027.7652%2017.0136%2028.3097C16.7295%2028.8542%2016.3211%2029.272%2015.7884%2029.5632C15.2581%2029.8544%2014.6237%2030%2013.885%2030ZM12.8445%2028.6825H13.8211C14.2757%2028.6825%2014.658%2028.602%2014.9681%2028.4411C15.2806%2028.2777%2015.515%2028.0256%2015.6713%2027.6847C15.8299%2027.3414%2015.9092%2026.8987%2015.9092%2026.3565C15.9092%2025.8191%2015.8299%2025.38%2015.6713%2025.0391C15.515%2024.6982%2015.2818%2024.4472%2014.9717%2024.2862C14.6615%2024.1252%2014.2792%2024.0447%2013.8247%2024.0447H12.8445V28.6825ZM18.5823%2030V22.7273H23.3976V23.995H20.1199V25.728H23.078V26.9957H20.1199V30H18.5823Z'%20fill='white'%20/%3e%3c/svg%3e",npt="data:image/svg+xml,%3csvg%20width='20'%20height='20'%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M6.66667%2010H13.3333M6.5%2017.5H13.5C14.9001%2017.5%2015.6002%2017.5%2016.135%2017.2275C16.6054%2016.9878%2016.9878%2016.6054%2017.2275%2016.135C17.5%2015.6002%2017.5%2014.9001%2017.5%2013.5V6.5C17.5%205.09987%2017.5%204.3998%2017.2275%203.86502C16.9878%203.39462%2016.6054%203.01217%2016.135%202.77248C15.6002%202.5%2014.9001%202.5%2013.5%202.5H6.5C5.09987%202.5%204.3998%202.5%203.86502%202.77248C3.39462%203.01217%203.01217%203.39462%202.77248%203.86502C2.5%204.3998%202.5%205.09987%202.5%206.5V13.5C2.5%2014.9001%202.5%2015.6002%202.77248%2016.135C3.01217%2016.6054%203.39462%2016.9878%203.86502%2017.2275C4.3998%2017.5%205.09987%2017.5%206.5%2017.5Z'%20stroke='%237F56D9'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20/%3e%3c/svg%3e",rpt=["src","alt"],ipt={__name:"FileIcon",props:{name:String},setup(r){const t=r,e=i=>(i==null?void 0:i.slice(i.lastIndexOf(".")+1).toLowerCase())??"",n=Ze(()=>new URL(Object.assign({"../../assets/AISearch/doc.svg":Q0t,"../../assets/AISearch/docx.svg":tpt,"../../assets/AISearch/pdf.svg":ept,"../../assets/AISearch/selected-files-collapse.svg":npt})[`../../assets/AISearch/${e(t.name)}.svg`],import.meta.url).href);return(i,a)=>($t(),Ve("img",{src:n.value,alt:i.fileType,class:"file-icon"},null,8,rpt))}},apt=$o(ipt,[["__scopeId","data-v-e8edb435"]]),spt={class:"chunk-list"},opt={key:1},lpt={class:"card"},upt={class:"documentReference"},cpt={class:"popupMarkdown"},hpt=["innerHTML"],dpt=["innerHTML"],fpt=["onClick"],gpt={key:0},ppt={__name:"ChunkList",props:{chunks:Array,highlightWord:String},emits:"clickDocumentButton",setup(r,{emit:t}){const e=r,n=t,i=(u,c)=>{n("clickDocumentButton",u,c)},a=u=>{if(!e.highlightWord)return u;const c=new RegExp(`(${e.highlightWord})`,"gi");return u.replace(c,'<span class="highlighted">$1</span>')},s=ce(1),o=ce(10),l=u=>{s.value=u};return(u,c)=>{const h=hR,d=Cj,g=tg,p=dR,v=cR;return $t(),Ve("div",spt,[r.chunks.length?($t(),Ve("div",opt,[($t(!0),Ve(oc,null,eg(r.chunks,(m,b)=>($t(),Ve("div",{key:b},[un("div",lpt,[un("div",upt,[ae(d,{trigger:"hover"},{content:ve(()=>[un("div",cpt,[un("div",{innerHTML:a(m.content_with_weight)},null,8,hpt)])]),default:ve(()=>[un("div",{innerHTML:a(m.highlight),class:"highlightContent"},null,8,dpt)]),_:2},1024),un("div",{class:"fileBtn",onClick:w=>i(m.docId,m)},[ae(g,null,{default:ve(()=>[ae(apt,{name:m.docnm_kwd},null,8,["name"]),un("div",null,uf(m.docnm_kwd),1)]),_:2},1024)],8,fpt)])]),b<r.chunks.length-1?($t(),dn(p,{key:0,margin:12})):Ds("",!0)]))),128)),r.chunks.length>1?($t(),Ve("div",gpt,[ae(p),ae(v,{current:s.value,total:r.chunks.length,pageSize:o.value,"show-total":"","show-page-size":"",onChange:l},null,8,["current","total","pageSize"])])):Ds("",!0)])):($t(),dn(h,{key:0,dot:""}))])}}},vpt=$o(ppt,[["__scopeId","data-v-275fa8ce"]]),mpt="/rgflow/v1/conversation/ask";function ypt(r){return wR({url:"/rgflow/v1/chunk/retrieval_test",method:"post",data:r})}function bpt(r){return wR({url:"/rgflow/v1/conversation/related_questions",method:"post",data:r})}var wpt=Object.defineProperty,xpt=(r,t,e)=>t in r?wpt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ud=(r,t,e)=>xpt(r,typeof t!="symbol"?t+"":t,e);class uR extends Error{constructor(t,e){super(t),Ud(this,"type"),Ud(this,"field"),Ud(this,"value"),Ud(this,"line"),this.name="ParseError",this.type=e.type,this.field=e.field,this.value=e.value,this.line=e.line}}function ew(r){}function Ept(r){const{onEvent:t=ew,onError:e=ew,onRetry:n=ew,onComment:i}=r;let a="",s=!0,o,l="",u="";function c(v){const m=s?v.replace(/^\xEF\xBB\xBF/,""):v,[b,w]=_pt(`${a}${m}`);for(const x of b)h(x);a=w,s=!1}function h(v){if(v===""){g();return}if(v.startsWith(":")){i&&i(v.slice(v.startsWith(": ")?2:1));return}const m=v.indexOf(":");if(m!==-1){const b=v.slice(0,m),w=v[m+1]===" "?2:1,x=v.slice(m+w);d(b,x,v);return}d(v,"",v)}function d(v,m,b){switch(v){case"event":u=m;break;case"data":l=`${l}${m}
- `;break;case"id":o=m.includes("\0")?void 0:m;break;case"retry":/^\d+$/.test(m)?n(parseInt(m,10)):e(new uR(`Invalid \`retry\` value: "${m}"`,{type:"invalid-retry",value:m,line:b}));break;default:e(new uR(`Unknown field "${v.length>20?`${v.slice(0,20)}…`:v}"`,{type:"unknown-field",field:v,value:m,line:b}));break}}function g(){l.length>0&&t({id:o,event:u||void 0,data:l.endsWith(`
- `)?l.slice(0,-1):l}),o=void 0,l="",u=""}function p(v={}){a&&v.consume&&h(a),o=void 0,l="",u="",a=""}return{feed:c,reset:p}}function _pt(r){const t=[];let e="";const n=r.length;for(let i=0;i<n;i++){const a=r[i];a==="\r"&&r[i+1]===`
- `?(t.push(e),e="",i++):a==="\r"||a===`
- `?(t.push(e),e=""):e+=a}return[t,e]}class Spt extends TransformStream{constructor({onError:t,onRetry:e,onComment:n}={}){let i;super({start(a){i=Ept({onEvent:s=>{a.enqueue(s)},onError(s){t==="terminate"?a.error(s):typeof t=="function"&&t(s)},onRetry:e,onComment:n})},transform(a){i.feed(a)}})}}function p5(){const r=ce(1),t=ce(10);return{setPaginationParams:(n,i)=>{r.value=n,i&&(t.value=i)},page:r,size:t}}function Mpt(){var o;const{page:r,size:t}=p5(),e=ce({chunks:[],documents:[],total:0}),n=ce(!1),i=hj(),a=((o=i==null?void 0:i.query)==null?void 0:o.id)||"",s=async l=>{n.value=!0;try{const u=await ypt({...l,kb_id:l.kb_id??a,page:r.value,size:t.value});if(u.data.retcode===0){const c=u.data.data;e.value={chunks:c.chunks,documents:c.doc_aggs,total:c.total}}else e.value={chunks:[],documents:[],total:0}}catch{e.value={chunks:[],documents:[],total:0},xR.error("检索失败")}finally{n.value=!1}};return{chunksData:Ze(()=>e.value),loading:Ze(()=>n.value),testChunk:s}}function kpt(){const r=ce([]),t=ce(!1);return{data:r,loading:t,fetchRelatedQuestions:async n=>{t.value=!0;try{const{data:i}=await bpt({question:n});r.value=(i==null?void 0:i.slice(0,5))??[]}catch(i){xR.error(i.message)}finally{t.value=!1}}}}function Tpt(r){const t=ce({}),e=ce(!0),n=ce(null),i=()=>{n.value&&clearTimeout(n.value),n.value=setTimeout(()=>{t.value={},clearTimeout(n.value)},1e3)},a=async(s,o)=>{var l;try{e.value=!1;const u=Ej.get(),c=await fetch(r,{method:"POST",headers:{Authorization:`Bearer ${u}`,"Content-Type":"application/json"},body:JSON.stringify(s),signal:o==null?void 0:o.signal}),h=c.clone().json(),d=(l=c==null?void 0:c.body)==null?void 0:l.pipeThrough(new TextDecoderStream).pipeThrough(new Spt).getReader();for(;;){const g=await(d==null?void 0:d.read());if(g){const{done:p,value:v}=g;if(p){console.info("done"),i();break}try{const m=JSON.parse((v==null?void 0:v.data)||""),b=m==null?void 0:m.data;typeof b!="boolean"&&(console.info("data:",b),t.value={...b,conversationId:s==null?void 0:s.conversation_id})}catch(m){console.warn(m)}}}return console.info("done?"),e.value=!0,i(),{data:await h,response:c}}catch(u){e.value=!0,i(),console.warn(u)}};return _x(()=>{n.value&&clearTimeout(n.value)}),{send:a,answer:t,done:e,resetAnswer:i}}function Opt(){const{setPaginationParams:r,page:t,size:e}=p5(),n=(s,o)=>{r(s,o)},i=s=>{r(s.page,s.pageSize)};return{pagination:Ze(()=>({showQuickJumper:!0,total:0,showSizeChanger:!0,current:t.value,pageSize:e.value,pageSizeOptions:[1,2,10,20,50,100],onChange:n})),setPagination:i}}var Jf={exports:{}};/**
- * @license
- * Lodash <https://lodash.com/>
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
- * Released under MIT license <https://lodash.com/license>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */Jf.exports;(function(r,t){(function(){var e,n="4.17.21",i=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",s="Expected a function",o="Invalid `variable` option passed into `_.template`",l="__lodash_hash_undefined__",u=500,c="__lodash_placeholder__",h=1,d=2,g=4,p=1,v=2,m=1,b=2,w=4,x=8,_=16,S=32,M=64,k=128,T=256,P=512,O=30,A="...",R=800,L=16,q=1,j=2,$=3,B=1/0,F=9007199254740991,V=17976931348623157e292,X=NaN,K=4294967295,dt=K-1,ct=K>>>1,ht=[["ary",k],["bind",m],["bindKey",b],["curry",x],["curryRight",_],["flip",P],["partial",S],["partialRight",M],["rearg",T]],lt="[object Arguments]",pt="[object Array]",wt="[object AsyncFunction]",Bt="[object Boolean]",Ut="[object Date]",Fe="[object DOMException]",Gn="[object Error]",on="[object Function]",dr="[object GeneratorFunction]",Rn="[object Map]",te="[object Number]",bi="[object Null]",Wt="[object Object]",Kr="[object Promise]",Cr="[object Proxy]",ji="[object RegExp]",mn="[object Set]",Ln="[object String]",Be="[object Symbol]",ha="[object Undefined]",kn="[object WeakMap]",wi="[object WeakSet]",qi="[object ArrayBuffer]",tr="[object DataView]",Za="[object Float32Array]",Ja="[object Float64Array]",ou="[object Int8Array]",Jo="[object Int16Array]",Zr="[object Int32Array]",xi="[object Uint8Array]",F0="[object Uint8ClampedArray]",B0="[object Uint16Array]",z0="[object Uint32Array]",v5=/\b__p \+= '';/g,m5=/\b(__p \+=) '' \+/g,y5=/(__e\(.*?\)|\b__t\)) \+\n'';/g,JE=/&(?:amp|lt|gt|quot|#39);/g,QE=/[&<>"']/g,b5=RegExp(JE.source),w5=RegExp(QE.source),x5=/<%-([\s\S]+?)%>/g,E5=/<%([\s\S]+?)%>/g,t_=/<%=([\s\S]+?)%>/g,_5=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,S5=/^\w*$/,M5=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$0=/[\\^$.*+?()[\]{}|]/g,k5=RegExp($0.source),j0=/^\s+/,T5=/\s/,O5=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,C5=/\{\n\/\* \[wrapped with (.+)\] \*/,A5=/,? & /,P5=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,N5=/[()=,{}\[\]\/\s]/,R5=/\\(\\)?/g,L5=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,e_=/\w*$/,I5=/^[-+]0x[0-9a-f]+$/i,D5=/^0b[01]+$/i,F5=/^\[object .+?Constructor\]$/,B5=/^0o[0-7]+$/i,z5=/^(?:0|[1-9]\d*)$/,$5=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Jc=/($^)/,j5=/['\n\r\u2028\u2029\\]/g,Qc="\\ud800-\\udfff",q5="\\u0300-\\u036f",W5="\\ufe20-\\ufe2f",G5="\\u20d0-\\u20ff",n_=q5+W5+G5,r_="\\u2700-\\u27bf",i_="a-z\\xdf-\\xf6\\xf8-\\xff",V5="\\xac\\xb1\\xd7\\xf7",H5="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",U5="\\u2000-\\u206f",Y5=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",a_="A-Z\\xc0-\\xd6\\xd8-\\xde",s_="\\ufe0e\\ufe0f",o_=V5+H5+U5+Y5,q0="['’]",X5="["+Qc+"]",l_="["+o_+"]",th="["+n_+"]",u_="\\d+",K5="["+r_+"]",c_="["+i_+"]",h_="[^"+Qc+o_+u_+r_+i_+a_+"]",W0="\\ud83c[\\udffb-\\udfff]",Z5="(?:"+th+"|"+W0+")",d_="[^"+Qc+"]",G0="(?:\\ud83c[\\udde6-\\uddff]){2}",V0="[\\ud800-\\udbff][\\udc00-\\udfff]",Qo="["+a_+"]",f_="\\u200d",g_="(?:"+c_+"|"+h_+")",J5="(?:"+Qo+"|"+h_+")",p_="(?:"+q0+"(?:d|ll|m|re|s|t|ve))?",v_="(?:"+q0+"(?:D|LL|M|RE|S|T|VE))?",m_=Z5+"?",y_="["+s_+"]?",Q5="(?:"+f_+"(?:"+[d_,G0,V0].join("|")+")"+y_+m_+")*",t8="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",e8="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",b_=y_+m_+Q5,n8="(?:"+[K5,G0,V0].join("|")+")"+b_,r8="(?:"+[d_+th+"?",th,G0,V0,X5].join("|")+")",i8=RegExp(q0,"g"),a8=RegExp(th,"g"),H0=RegExp(W0+"(?="+W0+")|"+r8+b_,"g"),s8=RegExp([Qo+"?"+c_+"+"+p_+"(?="+[l_,Qo,"$"].join("|")+")",J5+"+"+v_+"(?="+[l_,Qo+g_,"$"].join("|")+")",Qo+"?"+g_+"+"+p_,Qo+"+"+v_,e8,t8,u_,n8].join("|"),"g"),o8=RegExp("["+f_+Qc+n_+s_+"]"),l8=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,u8=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],c8=-1,Ne={};Ne[Za]=Ne[Ja]=Ne[ou]=Ne[Jo]=Ne[Zr]=Ne[xi]=Ne[F0]=Ne[B0]=Ne[z0]=!0,Ne[lt]=Ne[pt]=Ne[qi]=Ne[Bt]=Ne[tr]=Ne[Ut]=Ne[Gn]=Ne[on]=Ne[Rn]=Ne[te]=Ne[Wt]=Ne[ji]=Ne[mn]=Ne[Ln]=Ne[kn]=!1;var Oe={};Oe[lt]=Oe[pt]=Oe[qi]=Oe[tr]=Oe[Bt]=Oe[Ut]=Oe[Za]=Oe[Ja]=Oe[ou]=Oe[Jo]=Oe[Zr]=Oe[Rn]=Oe[te]=Oe[Wt]=Oe[ji]=Oe[mn]=Oe[Ln]=Oe[Be]=Oe[xi]=Oe[F0]=Oe[B0]=Oe[z0]=!0,Oe[Gn]=Oe[on]=Oe[kn]=!1;var h8={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},d8={"&":"&","<":"<",">":">",'"':""","'":"'"},f8={"&":"&","<":"<",">":">",""":'"',"'":"'"},g8={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},p8=parseFloat,v8=parseInt,w_=typeof Ma=="object"&&Ma&&Ma.Object===Object&&Ma,m8=typeof self=="object"&&self&&self.Object===Object&&self,In=w_||m8||Function("return this")(),U0=t&&!t.nodeType&&t,Qs=U0&&!0&&r&&!r.nodeType&&r,x_=Qs&&Qs.exports===U0,Y0=x_&&w_.process,Jr=function(){try{var U=Qs&&Qs.require&&Qs.require("util").types;return U||Y0&&Y0.binding&&Y0.binding("util")}catch{}}(),E_=Jr&&Jr.isArrayBuffer,__=Jr&&Jr.isDate,S_=Jr&&Jr.isMap,M_=Jr&&Jr.isRegExp,k_=Jr&&Jr.isSet,T_=Jr&&Jr.isTypedArray;function Ar(U,tt,Z){switch(Z.length){case 0:return U.call(tt);case 1:return U.call(tt,Z[0]);case 2:return U.call(tt,Z[0],Z[1]);case 3:return U.call(tt,Z[0],Z[1],Z[2])}return U.apply(tt,Z)}function y8(U,tt,Z,St){for(var It=-1,ue=U==null?0:U.length;++It<ue;){var yn=U[It];tt(St,yn,Z(yn),U)}return St}function Qr(U,tt){for(var Z=-1,St=U==null?0:U.length;++Z<St&&tt(U[Z],Z,U)!==!1;);return U}function b8(U,tt){for(var Z=U==null?0:U.length;Z--&&tt(U[Z],Z,U)!==!1;);return U}function O_(U,tt){for(var Z=-1,St=U==null?0:U.length;++Z<St;)if(!tt(U[Z],Z,U))return!1;return!0}function Qa(U,tt){for(var Z=-1,St=U==null?0:U.length,It=0,ue=[];++Z<St;){var yn=U[Z];tt(yn,Z,U)&&(ue[It++]=yn)}return ue}function eh(U,tt){var Z=U==null?0:U.length;return!!Z&&tl(U,tt,0)>-1}function X0(U,tt,Z){for(var St=-1,It=U==null?0:U.length;++St<It;)if(Z(tt,U[St]))return!0;return!1}function ze(U,tt){for(var Z=-1,St=U==null?0:U.length,It=Array(St);++Z<St;)It[Z]=tt(U[Z],Z,U);return It}function ts(U,tt){for(var Z=-1,St=tt.length,It=U.length;++Z<St;)U[It+Z]=tt[Z];return U}function K0(U,tt,Z,St){var It=-1,ue=U==null?0:U.length;for(St&&ue&&(Z=U[++It]);++It<ue;)Z=tt(Z,U[It],It,U);return Z}function w8(U,tt,Z,St){var It=U==null?0:U.length;for(St&&It&&(Z=U[--It]);It--;)Z=tt(Z,U[It],It,U);return Z}function Z0(U,tt){for(var Z=-1,St=U==null?0:U.length;++Z<St;)if(tt(U[Z],Z,U))return!0;return!1}var x8=J0("length");function E8(U){return U.split("")}function _8(U){return U.match(P5)||[]}function C_(U,tt,Z){var St;return Z(U,function(It,ue,yn){if(tt(It,ue,yn))return St=ue,!1}),St}function nh(U,tt,Z,St){for(var It=U.length,ue=Z+(St?1:-1);St?ue--:++ue<It;)if(tt(U[ue],ue,U))return ue;return-1}function tl(U,tt,Z){return tt===tt?I8(U,tt,Z):nh(U,A_,Z)}function S8(U,tt,Z,St){for(var It=Z-1,ue=U.length;++It<ue;)if(St(U[It],tt))return It;return-1}function A_(U){return U!==U}function P_(U,tt){var Z=U==null?0:U.length;return Z?tp(U,tt)/Z:X}function J0(U){return function(tt){return tt==null?e:tt[U]}}function Q0(U){return function(tt){return U==null?e:U[tt]}}function N_(U,tt,Z,St,It){return It(U,function(ue,yn,Ee){Z=St?(St=!1,ue):tt(Z,ue,yn,Ee)}),Z}function M8(U,tt){var Z=U.length;for(U.sort(tt);Z--;)U[Z]=U[Z].value;return U}function tp(U,tt){for(var Z,St=-1,It=U.length;++St<It;){var ue=tt(U[St]);ue!==e&&(Z=Z===e?ue:Z+ue)}return Z}function ep(U,tt){for(var Z=-1,St=Array(U);++Z<U;)St[Z]=tt(Z);return St}function k8(U,tt){return ze(tt,function(Z){return[Z,U[Z]]})}function R_(U){return U&&U.slice(0,F_(U)+1).replace(j0,"")}function Pr(U){return function(tt){return U(tt)}}function np(U,tt){return ze(tt,function(Z){return U[Z]})}function lu(U,tt){return U.has(tt)}function L_(U,tt){for(var Z=-1,St=U.length;++Z<St&&tl(tt,U[Z],0)>-1;);return Z}function I_(U,tt){for(var Z=U.length;Z--&&tl(tt,U[Z],0)>-1;);return Z}function T8(U,tt){for(var Z=U.length,St=0;Z--;)U[Z]===tt&&++St;return St}var O8=Q0(h8),C8=Q0(d8);function A8(U){return"\\"+g8[U]}function P8(U,tt){return U==null?e:U[tt]}function el(U){return o8.test(U)}function N8(U){return l8.test(U)}function R8(U){for(var tt,Z=[];!(tt=U.next()).done;)Z.push(tt.value);return Z}function rp(U){var tt=-1,Z=Array(U.size);return U.forEach(function(St,It){Z[++tt]=[It,St]}),Z}function D_(U,tt){return function(Z){return U(tt(Z))}}function es(U,tt){for(var Z=-1,St=U.length,It=0,ue=[];++Z<St;){var yn=U[Z];(yn===tt||yn===c)&&(U[Z]=c,ue[It++]=Z)}return ue}function rh(U){var tt=-1,Z=Array(U.size);return U.forEach(function(St){Z[++tt]=St}),Z}function L8(U){var tt=-1,Z=Array(U.size);return U.forEach(function(St){Z[++tt]=[St,St]}),Z}function I8(U,tt,Z){for(var St=Z-1,It=U.length;++St<It;)if(U[St]===tt)return St;return-1}function D8(U,tt,Z){for(var St=Z+1;St--;)if(U[St]===tt)return St;return St}function nl(U){return el(U)?B8(U):x8(U)}function Ei(U){return el(U)?z8(U):E8(U)}function F_(U){for(var tt=U.length;tt--&&T5.test(U.charAt(tt)););return tt}var F8=Q0(f8);function B8(U){for(var tt=H0.lastIndex=0;H0.test(U);)++tt;return tt}function z8(U){return U.match(H0)||[]}function $8(U){return U.match(s8)||[]}var j8=function U(tt){tt=tt==null?In:rl.defaults(In.Object(),tt,rl.pick(In,u8));var Z=tt.Array,St=tt.Date,It=tt.Error,ue=tt.Function,yn=tt.Math,Ee=tt.Object,ip=tt.RegExp,q8=tt.String,ti=tt.TypeError,ih=Z.prototype,W8=ue.prototype,il=Ee.prototype,ah=tt["__core-js_shared__"],sh=W8.toString,fe=il.hasOwnProperty,G8=0,B_=function(){var f=/[^.]+$/.exec(ah&&ah.keys&&ah.keys.IE_PROTO||"");return f?"Symbol(src)_1."+f:""}(),oh=il.toString,V8=sh.call(Ee),H8=In._,U8=ip("^"+sh.call(fe).replace($0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),lh=x_?tt.Buffer:e,ns=tt.Symbol,uh=tt.Uint8Array,z_=lh?lh.allocUnsafe:e,ch=D_(Ee.getPrototypeOf,Ee),$_=Ee.create,j_=il.propertyIsEnumerable,hh=ih.splice,q_=ns?ns.isConcatSpreadable:e,uu=ns?ns.iterator:e,to=ns?ns.toStringTag:e,dh=function(){try{var f=ao(Ee,"defineProperty");return f({},"",{}),f}catch{}}(),Y8=tt.clearTimeout!==In.clearTimeout&&tt.clearTimeout,X8=St&&St.now!==In.Date.now&&St.now,K8=tt.setTimeout!==In.setTimeout&&tt.setTimeout,fh=yn.ceil,gh=yn.floor,ap=Ee.getOwnPropertySymbols,Z8=lh?lh.isBuffer:e,W_=tt.isFinite,J8=ih.join,Q8=D_(Ee.keys,Ee),bn=yn.max,Vn=yn.min,t9=St.now,e9=tt.parseInt,G_=yn.random,n9=ih.reverse,sp=ao(tt,"DataView"),cu=ao(tt,"Map"),op=ao(tt,"Promise"),al=ao(tt,"Set"),hu=ao(tt,"WeakMap"),du=ao(Ee,"create"),ph=hu&&new hu,sl={},r9=so(sp),i9=so(cu),a9=so(op),s9=so(al),o9=so(hu),vh=ns?ns.prototype:e,fu=vh?vh.valueOf:e,V_=vh?vh.toString:e;function I(f){if(Ye(f)&&!zt(f)&&!(f instanceof re)){if(f instanceof ei)return f;if(fe.call(f,"__wrapped__"))return HS(f)}return new ei(f)}var ol=function(){function f(){}return function(y){if(!qe(y))return{};if($_)return $_(y);f.prototype=y;var E=new f;return f.prototype=e,E}}();function mh(){}function ei(f,y){this.__wrapped__=f,this.__actions__=[],this.__chain__=!!y,this.__index__=0,this.__values__=e}I.templateSettings={escape:x5,evaluate:E5,interpolate:t_,variable:"",imports:{_:I}},I.prototype=mh.prototype,I.prototype.constructor=I,ei.prototype=ol(mh.prototype),ei.prototype.constructor=ei;function re(f){this.__wrapped__=f,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=K,this.__views__=[]}function l9(){var f=new re(this.__wrapped__);return f.__actions__=fr(this.__actions__),f.__dir__=this.__dir__,f.__filtered__=this.__filtered__,f.__iteratees__=fr(this.__iteratees__),f.__takeCount__=this.__takeCount__,f.__views__=fr(this.__views__),f}function u9(){if(this.__filtered__){var f=new re(this);f.__dir__=-1,f.__filtered__=!0}else f=this.clone(),f.__dir__*=-1;return f}function c9(){var f=this.__wrapped__.value(),y=this.__dir__,E=zt(f),C=y<0,N=E?f.length:0,D=E7(0,N,this.__views__),W=D.start,G=D.end,Y=G-W,nt=C?G:W-1,rt=this.__iteratees__,ot=rt.length,xt=0,Mt=Vn(Y,this.__takeCount__);if(!E||!C&&N==Y&&Mt==Y)return pS(f,this.__actions__);var Ot=[];t:for(;Y--&&xt<Mt;){nt+=y;for(var Kt=-1,Ct=f[nt];++Kt<ot;){var ee=rt[Kt],ie=ee.iteratee,Lr=ee.type,rr=ie(Ct);if(Lr==j)Ct=rr;else if(!rr){if(Lr==q)continue t;break t}}Ot[xt++]=Ct}return Ot}re.prototype=ol(mh.prototype),re.prototype.constructor=re;function eo(f){var y=-1,E=f==null?0:f.length;for(this.clear();++y<E;){var C=f[y];this.set(C[0],C[1])}}function h9(){this.__data__=du?du(null):{},this.size=0}function d9(f){var y=this.has(f)&&delete this.__data__[f];return this.size-=y?1:0,y}function f9(f){var y=this.__data__;if(du){var E=y[f];return E===l?e:E}return fe.call(y,f)?y[f]:e}function g9(f){var y=this.__data__;return du?y[f]!==e:fe.call(y,f)}function p9(f,y){var E=this.__data__;return this.size+=this.has(f)?0:1,E[f]=du&&y===e?l:y,this}eo.prototype.clear=h9,eo.prototype.delete=d9,eo.prototype.get=f9,eo.prototype.has=g9,eo.prototype.set=p9;function da(f){var y=-1,E=f==null?0:f.length;for(this.clear();++y<E;){var C=f[y];this.set(C[0],C[1])}}function v9(){this.__data__=[],this.size=0}function m9(f){var y=this.__data__,E=yh(y,f);if(E<0)return!1;var C=y.length-1;return E==C?y.pop():hh.call(y,E,1),--this.size,!0}function y9(f){var y=this.__data__,E=yh(y,f);return E<0?e:y[E][1]}function b9(f){return yh(this.__data__,f)>-1}function w9(f,y){var E=this.__data__,C=yh(E,f);return C<0?(++this.size,E.push([f,y])):E[C][1]=y,this}da.prototype.clear=v9,da.prototype.delete=m9,da.prototype.get=y9,da.prototype.has=b9,da.prototype.set=w9;function fa(f){var y=-1,E=f==null?0:f.length;for(this.clear();++y<E;){var C=f[y];this.set(C[0],C[1])}}function x9(){this.size=0,this.__data__={hash:new eo,map:new(cu||da),string:new eo}}function E9(f){var y=Ah(this,f).delete(f);return this.size-=y?1:0,y}function _9(f){return Ah(this,f).get(f)}function S9(f){return Ah(this,f).has(f)}function M9(f,y){var E=Ah(this,f),C=E.size;return E.set(f,y),this.size+=E.size==C?0:1,this}fa.prototype.clear=x9,fa.prototype.delete=E9,fa.prototype.get=_9,fa.prototype.has=S9,fa.prototype.set=M9;function no(f){var y=-1,E=f==null?0:f.length;for(this.__data__=new fa;++y<E;)this.add(f[y])}function k9(f){return this.__data__.set(f,l),this}function T9(f){return this.__data__.has(f)}no.prototype.add=no.prototype.push=k9,no.prototype.has=T9;function _i(f){var y=this.__data__=new da(f);this.size=y.size}function O9(){this.__data__=new da,this.size=0}function C9(f){var y=this.__data__,E=y.delete(f);return this.size=y.size,E}function A9(f){return this.__data__.get(f)}function P9(f){return this.__data__.has(f)}function N9(f,y){var E=this.__data__;if(E instanceof da){var C=E.__data__;if(!cu||C.length<i-1)return C.push([f,y]),this.size=++E.size,this;E=this.__data__=new fa(C)}return E.set(f,y),this.size=E.size,this}_i.prototype.clear=O9,_i.prototype.delete=C9,_i.prototype.get=A9,_i.prototype.has=P9,_i.prototype.set=N9;function H_(f,y){var E=zt(f),C=!E&&oo(f),N=!E&&!C&&os(f),D=!E&&!C&&!N&&hl(f),W=E||C||N||D,G=W?ep(f.length,q8):[],Y=G.length;for(var nt in f)(y||fe.call(f,nt))&&!(W&&(nt=="length"||N&&(nt=="offset"||nt=="parent")||D&&(nt=="buffer"||nt=="byteLength"||nt=="byteOffset")||ma(nt,Y)))&&G.push(nt);return G}function U_(f){var y=f.length;return y?f[yp(0,y-1)]:e}function R9(f,y){return Ph(fr(f),ro(y,0,f.length))}function L9(f){return Ph(fr(f))}function lp(f,y,E){(E!==e&&!Si(f[y],E)||E===e&&!(y in f))&&ga(f,y,E)}function gu(f,y,E){var C=f[y];(!(fe.call(f,y)&&Si(C,E))||E===e&&!(y in f))&&ga(f,y,E)}function yh(f,y){for(var E=f.length;E--;)if(Si(f[E][0],y))return E;return-1}function I9(f,y,E,C){return rs(f,function(N,D,W){y(C,N,E(N),W)}),C}function Y_(f,y){return f&&Gi(y,Tn(y),f)}function D9(f,y){return f&&Gi(y,pr(y),f)}function ga(f,y,E){y=="__proto__"&&dh?dh(f,y,{configurable:!0,enumerable:!0,value:E,writable:!0}):f[y]=E}function up(f,y){for(var E=-1,C=y.length,N=Z(C),D=f==null;++E<C;)N[E]=D?e:Wp(f,y[E]);return N}function ro(f,y,E){return f===f&&(E!==e&&(f=f<=E?f:E),y!==e&&(f=f>=y?f:y)),f}function ni(f,y,E,C,N,D){var W,G=y&h,Y=y&d,nt=y&g;if(E&&(W=N?E(f,C,N,D):E(f)),W!==e)return W;if(!qe(f))return f;var rt=zt(f);if(rt){if(W=S7(f),!G)return fr(f,W)}else{var ot=Hn(f),xt=ot==on||ot==dr;if(os(f))return yS(f,G);if(ot==Wt||ot==lt||xt&&!N){if(W=Y||xt?{}:FS(f),!G)return Y?f7(f,D9(W,f)):d7(f,Y_(W,f))}else{if(!Oe[ot])return N?f:{};W=M7(f,ot,G)}}D||(D=new _i);var Mt=D.get(f);if(Mt)return Mt;D.set(f,W),d3(f)?f.forEach(function(Ct){W.add(ni(Ct,y,E,Ct,f,D))}):c3(f)&&f.forEach(function(Ct,ee){W.set(ee,ni(Ct,y,E,ee,f,D))});var Ot=nt?Y?Cp:Op:Y?pr:Tn,Kt=rt?e:Ot(f);return Qr(Kt||f,function(Ct,ee){Kt&&(ee=Ct,Ct=f[ee]),gu(W,ee,ni(Ct,y,E,ee,f,D))}),W}function F9(f){var y=Tn(f);return function(E){return X_(E,f,y)}}function X_(f,y,E){var C=E.length;if(f==null)return!C;for(f=Ee(f);C--;){var N=E[C],D=y[N],W=f[N];if(W===e&&!(N in f)||!D(W))return!1}return!0}function K_(f,y,E){if(typeof f!="function")throw new ti(s);return xu(function(){f.apply(e,E)},y)}function pu(f,y,E,C){var N=-1,D=eh,W=!0,G=f.length,Y=[],nt=y.length;if(!G)return Y;E&&(y=ze(y,Pr(E))),C?(D=X0,W=!1):y.length>=i&&(D=lu,W=!1,y=new no(y));t:for(;++N<G;){var rt=f[N],ot=E==null?rt:E(rt);if(rt=C||rt!==0?rt:0,W&&ot===ot){for(var xt=nt;xt--;)if(y[xt]===ot)continue t;Y.push(rt)}else D(y,ot,C)||Y.push(rt)}return Y}var rs=_S(Wi),Z_=_S(hp,!0);function B9(f,y){var E=!0;return rs(f,function(C,N,D){return E=!!y(C,N,D),E}),E}function bh(f,y,E){for(var C=-1,N=f.length;++C<N;){var D=f[C],W=y(D);if(W!=null&&(G===e?W===W&&!Rr(W):E(W,G)))var G=W,Y=D}return Y}function z9(f,y,E,C){var N=f.length;for(E=Yt(E),E<0&&(E=-E>N?0:N+E),C=C===e||C>N?N:Yt(C),C<0&&(C+=N),C=E>C?0:g3(C);E<C;)f[E++]=y;return f}function J_(f,y){var E=[];return rs(f,function(C,N,D){y(C,N,D)&&E.push(C)}),E}function Dn(f,y,E,C,N){var D=-1,W=f.length;for(E||(E=T7),N||(N=[]);++D<W;){var G=f[D];y>0&&E(G)?y>1?Dn(G,y-1,E,C,N):ts(N,G):C||(N[N.length]=G)}return N}var cp=SS(),Q_=SS(!0);function Wi(f,y){return f&&cp(f,y,Tn)}function hp(f,y){return f&&Q_(f,y,Tn)}function wh(f,y){return Qa(y,function(E){return ya(f[E])})}function io(f,y){y=as(y,f);for(var E=0,C=y.length;f!=null&&E<C;)f=f[Vi(y[E++])];return E&&E==C?f:e}function tS(f,y,E){var C=y(f);return zt(f)?C:ts(C,E(f))}function er(f){return f==null?f===e?ha:bi:to&&to in Ee(f)?x7(f):L7(f)}function dp(f,y){return f>y}function $9(f,y){return f!=null&&fe.call(f,y)}function j9(f,y){return f!=null&&y in Ee(f)}function q9(f,y,E){return f>=Vn(y,E)&&f<bn(y,E)}function fp(f,y,E){for(var C=E?X0:eh,N=f[0].length,D=f.length,W=D,G=Z(D),Y=1/0,nt=[];W--;){var rt=f[W];W&&y&&(rt=ze(rt,Pr(y))),Y=Vn(rt.length,Y),G[W]=!E&&(y||N>=120&&rt.length>=120)?new no(W&&rt):e}rt=f[0];var ot=-1,xt=G[0];t:for(;++ot<N&&nt.length<Y;){var Mt=rt[ot],Ot=y?y(Mt):Mt;if(Mt=E||Mt!==0?Mt:0,!(xt?lu(xt,Ot):C(nt,Ot,E))){for(W=D;--W;){var Kt=G[W];if(!(Kt?lu(Kt,Ot):C(f[W],Ot,E)))continue t}xt&&xt.push(Ot),nt.push(Mt)}}return nt}function W9(f,y,E,C){return Wi(f,function(N,D,W){y(C,E(N),D,W)}),C}function vu(f,y,E){y=as(y,f),f=jS(f,y);var C=f==null?f:f[Vi(ii(y))];return C==null?e:Ar(C,f,E)}function eS(f){return Ye(f)&&er(f)==lt}function G9(f){return Ye(f)&&er(f)==qi}function V9(f){return Ye(f)&&er(f)==Ut}function mu(f,y,E,C,N){return f===y?!0:f==null||y==null||!Ye(f)&&!Ye(y)?f!==f&&y!==y:H9(f,y,E,C,mu,N)}function H9(f,y,E,C,N,D){var W=zt(f),G=zt(y),Y=W?pt:Hn(f),nt=G?pt:Hn(y);Y=Y==lt?Wt:Y,nt=nt==lt?Wt:nt;var rt=Y==Wt,ot=nt==Wt,xt=Y==nt;if(xt&&os(f)){if(!os(y))return!1;W=!0,rt=!1}if(xt&&!rt)return D||(D=new _i),W||hl(f)?LS(f,y,E,C,N,D):b7(f,y,Y,E,C,N,D);if(!(E&p)){var Mt=rt&&fe.call(f,"__wrapped__"),Ot=ot&&fe.call(y,"__wrapped__");if(Mt||Ot){var Kt=Mt?f.value():f,Ct=Ot?y.value():y;return D||(D=new _i),N(Kt,Ct,E,C,D)}}return xt?(D||(D=new _i),w7(f,y,E,C,N,D)):!1}function U9(f){return Ye(f)&&Hn(f)==Rn}function gp(f,y,E,C){var N=E.length,D=N,W=!C;if(f==null)return!D;for(f=Ee(f);N--;){var G=E[N];if(W&&G[2]?G[1]!==f[G[0]]:!(G[0]in f))return!1}for(;++N<D;){G=E[N];var Y=G[0],nt=f[Y],rt=G[1];if(W&&G[2]){if(nt===e&&!(Y in f))return!1}else{var ot=new _i;if(C)var xt=C(nt,rt,Y,f,y,ot);if(!(xt===e?mu(rt,nt,p|v,C,ot):xt))return!1}}return!0}function nS(f){if(!qe(f)||C7(f))return!1;var y=ya(f)?U8:F5;return y.test(so(f))}function Y9(f){return Ye(f)&&er(f)==ji}function X9(f){return Ye(f)&&Hn(f)==mn}function K9(f){return Ye(f)&&Fh(f.length)&&!!Ne[er(f)]}function rS(f){return typeof f=="function"?f:f==null?vr:typeof f=="object"?zt(f)?sS(f[0],f[1]):aS(f):M3(f)}function pp(f){if(!wu(f))return Q8(f);var y=[];for(var E in Ee(f))fe.call(f,E)&&E!="constructor"&&y.push(E);return y}function Z9(f){if(!qe(f))return R7(f);var y=wu(f),E=[];for(var C in f)C=="constructor"&&(y||!fe.call(f,C))||E.push(C);return E}function vp(f,y){return f<y}function iS(f,y){var E=-1,C=gr(f)?Z(f.length):[];return rs(f,function(N,D,W){C[++E]=y(N,D,W)}),C}function aS(f){var y=Pp(f);return y.length==1&&y[0][2]?zS(y[0][0],y[0][1]):function(E){return E===f||gp(E,f,y)}}function sS(f,y){return Rp(f)&&BS(y)?zS(Vi(f),y):function(E){var C=Wp(E,f);return C===e&&C===y?Gp(E,f):mu(y,C,p|v)}}function xh(f,y,E,C,N){f!==y&&cp(y,function(D,W){if(N||(N=new _i),qe(D))J9(f,y,W,E,xh,C,N);else{var G=C?C(Ip(f,W),D,W+"",f,y,N):e;G===e&&(G=D),lp(f,W,G)}},pr)}function J9(f,y,E,C,N,D,W){var G=Ip(f,E),Y=Ip(y,E),nt=W.get(Y);if(nt){lp(f,E,nt);return}var rt=D?D(G,Y,E+"",f,y,W):e,ot=rt===e;if(ot){var xt=zt(Y),Mt=!xt&&os(Y),Ot=!xt&&!Mt&&hl(Y);rt=Y,xt||Mt||Ot?zt(G)?rt=G:tn(G)?rt=fr(G):Mt?(ot=!1,rt=yS(Y,!0)):Ot?(ot=!1,rt=bS(Y,!0)):rt=[]:Eu(Y)||oo(Y)?(rt=G,oo(G)?rt=p3(G):(!qe(G)||ya(G))&&(rt=FS(Y))):ot=!1}ot&&(W.set(Y,rt),N(rt,Y,C,D,W),W.delete(Y)),lp(f,E,rt)}function oS(f,y){var E=f.length;if(E)return y+=y<0?E:0,ma(y,E)?f[y]:e}function lS(f,y,E){y.length?y=ze(y,function(D){return zt(D)?function(W){return io(W,D.length===1?D[0]:D)}:D}):y=[vr];var C=-1;y=ze(y,Pr(Tt()));var N=iS(f,function(D,W,G){var Y=ze(y,function(nt){return nt(D)});return{criteria:Y,index:++C,value:D}});return M8(N,function(D,W){return h7(D,W,E)})}function Q9(f,y){return uS(f,y,function(E,C){return Gp(f,C)})}function uS(f,y,E){for(var C=-1,N=y.length,D={};++C<N;){var W=y[C],G=io(f,W);E(G,W)&&yu(D,as(W,f),G)}return D}function t7(f){return function(y){return io(y,f)}}function mp(f,y,E,C){var N=C?S8:tl,D=-1,W=y.length,G=f;for(f===y&&(y=fr(y)),E&&(G=ze(f,Pr(E)));++D<W;)for(var Y=0,nt=y[D],rt=E?E(nt):nt;(Y=N(G,rt,Y,C))>-1;)G!==f&&hh.call(G,Y,1),hh.call(f,Y,1);return f}function cS(f,y){for(var E=f?y.length:0,C=E-1;E--;){var N=y[E];if(E==C||N!==D){var D=N;ma(N)?hh.call(f,N,1):xp(f,N)}}return f}function yp(f,y){return f+gh(G_()*(y-f+1))}function e7(f,y,E,C){for(var N=-1,D=bn(fh((y-f)/(E||1)),0),W=Z(D);D--;)W[C?D:++N]=f,f+=E;return W}function bp(f,y){var E="";if(!f||y<1||y>F)return E;do y%2&&(E+=f),y=gh(y/2),y&&(f+=f);while(y);return E}function Zt(f,y){return Dp($S(f,y,vr),f+"")}function n7(f){return U_(dl(f))}function r7(f,y){var E=dl(f);return Ph(E,ro(y,0,E.length))}function yu(f,y,E,C){if(!qe(f))return f;y=as(y,f);for(var N=-1,D=y.length,W=D-1,G=f;G!=null&&++N<D;){var Y=Vi(y[N]),nt=E;if(Y==="__proto__"||Y==="constructor"||Y==="prototype")return f;if(N!=W){var rt=G[Y];nt=C?C(rt,Y,G):e,nt===e&&(nt=qe(rt)?rt:ma(y[N+1])?[]:{})}gu(G,Y,nt),G=G[Y]}return f}var hS=ph?function(f,y){return ph.set(f,y),f}:vr,i7=dh?function(f,y){return dh(f,"toString",{configurable:!0,enumerable:!1,value:Hp(y),writable:!0})}:vr;function a7(f){return Ph(dl(f))}function ri(f,y,E){var C=-1,N=f.length;y<0&&(y=-y>N?0:N+y),E=E>N?N:E,E<0&&(E+=N),N=y>E?0:E-y>>>0,y>>>=0;for(var D=Z(N);++C<N;)D[C]=f[C+y];return D}function s7(f,y){var E;return rs(f,function(C,N,D){return E=y(C,N,D),!E}),!!E}function Eh(f,y,E){var C=0,N=f==null?C:f.length;if(typeof y=="number"&&y===y&&N<=ct){for(;C<N;){var D=C+N>>>1,W=f[D];W!==null&&!Rr(W)&&(E?W<=y:W<y)?C=D+1:N=D}return N}return wp(f,y,vr,E)}function wp(f,y,E,C){var N=0,D=f==null?0:f.length;if(D===0)return 0;y=E(y);for(var W=y!==y,G=y===null,Y=Rr(y),nt=y===e;N<D;){var rt=gh((N+D)/2),ot=E(f[rt]),xt=ot!==e,Mt=ot===null,Ot=ot===ot,Kt=Rr(ot);if(W)var Ct=C||Ot;else nt?Ct=Ot&&(C||xt):G?Ct=Ot&&xt&&(C||!Mt):Y?Ct=Ot&&xt&&!Mt&&(C||!Kt):Mt||Kt?Ct=!1:Ct=C?ot<=y:ot<y;Ct?N=rt+1:D=rt}return Vn(D,dt)}function dS(f,y){for(var E=-1,C=f.length,N=0,D=[];++E<C;){var W=f[E],G=y?y(W):W;if(!E||!Si(G,Y)){var Y=G;D[N++]=W===0?0:W}}return D}function fS(f){return typeof f=="number"?f:Rr(f)?X:+f}function Nr(f){if(typeof f=="string")return f;if(zt(f))return ze(f,Nr)+"";if(Rr(f))return V_?V_.call(f):"";var y=f+"";return y=="0"&&1/f==-1/0?"-0":y}function is(f,y,E){var C=-1,N=eh,D=f.length,W=!0,G=[],Y=G;if(E)W=!1,N=X0;else if(D>=i){var nt=y?null:m7(f);if(nt)return rh(nt);W=!1,N=lu,Y=new no}else Y=y?[]:G;t:for(;++C<D;){var rt=f[C],ot=y?y(rt):rt;if(rt=E||rt!==0?rt:0,W&&ot===ot){for(var xt=Y.length;xt--;)if(Y[xt]===ot)continue t;y&&Y.push(ot),G.push(rt)}else N(Y,ot,E)||(Y!==G&&Y.push(ot),G.push(rt))}return G}function xp(f,y){return y=as(y,f),f=jS(f,y),f==null||delete f[Vi(ii(y))]}function gS(f,y,E,C){return yu(f,y,E(io(f,y)),C)}function _h(f,y,E,C){for(var N=f.length,D=C?N:-1;(C?D--:++D<N)&&y(f[D],D,f););return E?ri(f,C?0:D,C?D+1:N):ri(f,C?D+1:0,C?N:D)}function pS(f,y){var E=f;return E instanceof re&&(E=E.value()),K0(y,function(C,N){return N.func.apply(N.thisArg,ts([C],N.args))},E)}function Ep(f,y,E){var C=f.length;if(C<2)return C?is(f[0]):[];for(var N=-1,D=Z(C);++N<C;)for(var W=f[N],G=-1;++G<C;)G!=N&&(D[N]=pu(D[N]||W,f[G],y,E));return is(Dn(D,1),y,E)}function vS(f,y,E){for(var C=-1,N=f.length,D=y.length,W={};++C<N;){var G=C<D?y[C]:e;E(W,f[C],G)}return W}function _p(f){return tn(f)?f:[]}function Sp(f){return typeof f=="function"?f:vr}function as(f,y){return zt(f)?f:Rp(f,y)?[f]:VS(de(f))}var o7=Zt;function ss(f,y,E){var C=f.length;return E=E===e?C:E,!y&&E>=C?f:ri(f,y,E)}var mS=Y8||function(f){return In.clearTimeout(f)};function yS(f,y){if(y)return f.slice();var E=f.length,C=z_?z_(E):new f.constructor(E);return f.copy(C),C}function Mp(f){var y=new f.constructor(f.byteLength);return new uh(y).set(new uh(f)),y}function l7(f,y){var E=y?Mp(f.buffer):f.buffer;return new f.constructor(E,f.byteOffset,f.byteLength)}function u7(f){var y=new f.constructor(f.source,e_.exec(f));return y.lastIndex=f.lastIndex,y}function c7(f){return fu?Ee(fu.call(f)):{}}function bS(f,y){var E=y?Mp(f.buffer):f.buffer;return new f.constructor(E,f.byteOffset,f.length)}function wS(f,y){if(f!==y){var E=f!==e,C=f===null,N=f===f,D=Rr(f),W=y!==e,G=y===null,Y=y===y,nt=Rr(y);if(!G&&!nt&&!D&&f>y||D&&W&&Y&&!G&&!nt||C&&W&&Y||!E&&Y||!N)return 1;if(!C&&!D&&!nt&&f<y||nt&&E&&N&&!C&&!D||G&&E&&N||!W&&N||!Y)return-1}return 0}function h7(f,y,E){for(var C=-1,N=f.criteria,D=y.criteria,W=N.length,G=E.length;++C<W;){var Y=wS(N[C],D[C]);if(Y){if(C>=G)return Y;var nt=E[C];return Y*(nt=="desc"?-1:1)}}return f.index-y.index}function xS(f,y,E,C){for(var N=-1,D=f.length,W=E.length,G=-1,Y=y.length,nt=bn(D-W,0),rt=Z(Y+nt),ot=!C;++G<Y;)rt[G]=y[G];for(;++N<W;)(ot||N<D)&&(rt[E[N]]=f[N]);for(;nt--;)rt[G++]=f[N++];return rt}function ES(f,y,E,C){for(var N=-1,D=f.length,W=-1,G=E.length,Y=-1,nt=y.length,rt=bn(D-G,0),ot=Z(rt+nt),xt=!C;++N<rt;)ot[N]=f[N];for(var Mt=N;++Y<nt;)ot[Mt+Y]=y[Y];for(;++W<G;)(xt||N<D)&&(ot[Mt+E[W]]=f[N++]);return ot}function fr(f,y){var E=-1,C=f.length;for(y||(y=Z(C));++E<C;)y[E]=f[E];return y}function Gi(f,y,E,C){var N=!E;E||(E={});for(var D=-1,W=y.length;++D<W;){var G=y[D],Y=C?C(E[G],f[G],G,E,f):e;Y===e&&(Y=f[G]),N?ga(E,G,Y):gu(E,G,Y)}return E}function d7(f,y){return Gi(f,Np(f),y)}function f7(f,y){return Gi(f,IS(f),y)}function Sh(f,y){return function(E,C){var N=zt(E)?y8:I9,D=y?y():{};return N(E,f,Tt(C,2),D)}}function ll(f){return Zt(function(y,E){var C=-1,N=E.length,D=N>1?E[N-1]:e,W=N>2?E[2]:e;for(D=f.length>3&&typeof D=="function"?(N--,D):e,W&&nr(E[0],E[1],W)&&(D=N<3?e:D,N=1),y=Ee(y);++C<N;){var G=E[C];G&&f(y,G,C,D)}return y})}function _S(f,y){return function(E,C){if(E==null)return E;if(!gr(E))return f(E,C);for(var N=E.length,D=y?N:-1,W=Ee(E);(y?D--:++D<N)&&C(W[D],D,W)!==!1;);return E}}function SS(f){return function(y,E,C){for(var N=-1,D=Ee(y),W=C(y),G=W.length;G--;){var Y=W[f?G:++N];if(E(D[Y],Y,D)===!1)break}return y}}function g7(f,y,E){var C=y&m,N=bu(f);function D(){var W=this&&this!==In&&this instanceof D?N:f;return W.apply(C?E:this,arguments)}return D}function MS(f){return function(y){y=de(y);var E=el(y)?Ei(y):e,C=E?E[0]:y.charAt(0),N=E?ss(E,1).join(""):y.slice(1);return C[f]()+N}}function ul(f){return function(y){return K0(_3(E3(y).replace(i8,"")),f,"")}}function bu(f){return function(){var y=arguments;switch(y.length){case 0:return new f;case 1:return new f(y[0]);case 2:return new f(y[0],y[1]);case 3:return new f(y[0],y[1],y[2]);case 4:return new f(y[0],y[1],y[2],y[3]);case 5:return new f(y[0],y[1],y[2],y[3],y[4]);case 6:return new f(y[0],y[1],y[2],y[3],y[4],y[5]);case 7:return new f(y[0],y[1],y[2],y[3],y[4],y[5],y[6])}var E=ol(f.prototype),C=f.apply(E,y);return qe(C)?C:E}}function p7(f,y,E){var C=bu(f);function N(){for(var D=arguments.length,W=Z(D),G=D,Y=cl(N);G--;)W[G]=arguments[G];var nt=D<3&&W[0]!==Y&&W[D-1]!==Y?[]:es(W,Y);if(D-=nt.length,D<E)return AS(f,y,Mh,N.placeholder,e,W,nt,e,e,E-D);var rt=this&&this!==In&&this instanceof N?C:f;return Ar(rt,this,W)}return N}function kS(f){return function(y,E,C){var N=Ee(y);if(!gr(y)){var D=Tt(E,3);y=Tn(y),E=function(G){return D(N[G],G,N)}}var W=f(y,E,C);return W>-1?N[D?y[W]:W]:e}}function TS(f){return va(function(y){var E=y.length,C=E,N=ei.prototype.thru;for(f&&y.reverse();C--;){var D=y[C];if(typeof D!="function")throw new ti(s);if(N&&!W&&Ch(D)=="wrapper")var W=new ei([],!0)}for(C=W?C:E;++C<E;){D=y[C];var G=Ch(D),Y=G=="wrapper"?Ap(D):e;Y&&Lp(Y[0])&&Y[1]==(k|x|S|T)&&!Y[4].length&&Y[9]==1?W=W[Ch(Y[0])].apply(W,Y[3]):W=D.length==1&&Lp(D)?W[G]():W.thru(D)}return function(){var nt=arguments,rt=nt[0];if(W&&nt.length==1&&zt(rt))return W.plant(rt).value();for(var ot=0,xt=E?y[ot].apply(this,nt):rt;++ot<E;)xt=y[ot].call(this,xt);return xt}})}function Mh(f,y,E,C,N,D,W,G,Y,nt){var rt=y&k,ot=y&m,xt=y&b,Mt=y&(x|_),Ot=y&P,Kt=xt?e:bu(f);function Ct(){for(var ee=arguments.length,ie=Z(ee),Lr=ee;Lr--;)ie[Lr]=arguments[Lr];if(Mt)var rr=cl(Ct),Ir=T8(ie,rr);if(C&&(ie=xS(ie,C,N,Mt)),D&&(ie=ES(ie,D,W,Mt)),ee-=Ir,Mt&&ee<nt){var en=es(ie,rr);return AS(f,y,Mh,Ct.placeholder,E,ie,en,G,Y,nt-ee)}var Mi=ot?E:this,wa=xt?Mi[f]:f;return ee=ie.length,G?ie=I7(ie,G):Ot&&ee>1&&ie.reverse(),rt&&Y<ee&&(ie.length=Y),this&&this!==In&&this instanceof Ct&&(wa=Kt||bu(wa)),wa.apply(Mi,ie)}return Ct}function OS(f,y){return function(E,C){return W9(E,f,y(C),{})}}function kh(f,y){return function(E,C){var N;if(E===e&&C===e)return y;if(E!==e&&(N=E),C!==e){if(N===e)return C;typeof E=="string"||typeof C=="string"?(E=Nr(E),C=Nr(C)):(E=fS(E),C=fS(C)),N=f(E,C)}return N}}function kp(f){return va(function(y){return y=ze(y,Pr(Tt())),Zt(function(E){var C=this;return f(y,function(N){return Ar(N,C,E)})})})}function Th(f,y){y=y===e?" ":Nr(y);var E=y.length;if(E<2)return E?bp(y,f):y;var C=bp(y,fh(f/nl(y)));return el(y)?ss(Ei(C),0,f).join(""):C.slice(0,f)}function v7(f,y,E,C){var N=y&m,D=bu(f);function W(){for(var G=-1,Y=arguments.length,nt=-1,rt=C.length,ot=Z(rt+Y),xt=this&&this!==In&&this instanceof W?D:f;++nt<rt;)ot[nt]=C[nt];for(;Y--;)ot[nt++]=arguments[++G];return Ar(xt,N?E:this,ot)}return W}function CS(f){return function(y,E,C){return C&&typeof C!="number"&&nr(y,E,C)&&(E=C=e),y=ba(y),E===e?(E=y,y=0):E=ba(E),C=C===e?y<E?1:-1:ba(C),e7(y,E,C,f)}}function Oh(f){return function(y,E){return typeof y=="string"&&typeof E=="string"||(y=ai(y),E=ai(E)),f(y,E)}}function AS(f,y,E,C,N,D,W,G,Y,nt){var rt=y&x,ot=rt?W:e,xt=rt?e:W,Mt=rt?D:e,Ot=rt?e:D;y|=rt?S:M,y&=~(rt?M:S),y&w||(y&=-4);var Kt=[f,y,N,Mt,ot,Ot,xt,G,Y,nt],Ct=E.apply(e,Kt);return Lp(f)&&qS(Ct,Kt),Ct.placeholder=C,WS(Ct,f,y)}function Tp(f){var y=yn[f];return function(E,C){if(E=ai(E),C=C==null?0:Vn(Yt(C),292),C&&W_(E)){var N=(de(E)+"e").split("e"),D=y(N[0]+"e"+(+N[1]+C));return N=(de(D)+"e").split("e"),+(N[0]+"e"+(+N[1]-C))}return y(E)}}var m7=al&&1/rh(new al([,-0]))[1]==B?function(f){return new al(f)}:Xp;function PS(f){return function(y){var E=Hn(y);return E==Rn?rp(y):E==mn?L8(y):k8(y,f(y))}}function pa(f,y,E,C,N,D,W,G){var Y=y&b;if(!Y&&typeof f!="function")throw new ti(s);var nt=C?C.length:0;if(nt||(y&=-97,C=N=e),W=W===e?W:bn(Yt(W),0),G=G===e?G:Yt(G),nt-=N?N.length:0,y&M){var rt=C,ot=N;C=N=e}var xt=Y?e:Ap(f),Mt=[f,y,E,C,N,rt,ot,D,W,G];if(xt&&N7(Mt,xt),f=Mt[0],y=Mt[1],E=Mt[2],C=Mt[3],N=Mt[4],G=Mt[9]=Mt[9]===e?Y?0:f.length:bn(Mt[9]-nt,0),!G&&y&(x|_)&&(y&=-25),!y||y==m)var Ot=g7(f,y,E);else y==x||y==_?Ot=p7(f,y,G):(y==S||y==(m|S))&&!N.length?Ot=v7(f,y,E,C):Ot=Mh.apply(e,Mt);var Kt=xt?hS:qS;return WS(Kt(Ot,Mt),f,y)}function NS(f,y,E,C){return f===e||Si(f,il[E])&&!fe.call(C,E)?y:f}function RS(f,y,E,C,N,D){return qe(f)&&qe(y)&&(D.set(y,f),xh(f,y,e,RS,D),D.delete(y)),f}function y7(f){return Eu(f)?e:f}function LS(f,y,E,C,N,D){var W=E&p,G=f.length,Y=y.length;if(G!=Y&&!(W&&Y>G))return!1;var nt=D.get(f),rt=D.get(y);if(nt&&rt)return nt==y&&rt==f;var ot=-1,xt=!0,Mt=E&v?new no:e;for(D.set(f,y),D.set(y,f);++ot<G;){var Ot=f[ot],Kt=y[ot];if(C)var Ct=W?C(Kt,Ot,ot,y,f,D):C(Ot,Kt,ot,f,y,D);if(Ct!==e){if(Ct)continue;xt=!1;break}if(Mt){if(!Z0(y,function(ee,ie){if(!lu(Mt,ie)&&(Ot===ee||N(Ot,ee,E,C,D)))return Mt.push(ie)})){xt=!1;break}}else if(!(Ot===Kt||N(Ot,Kt,E,C,D))){xt=!1;break}}return D.delete(f),D.delete(y),xt}function b7(f,y,E,C,N,D,W){switch(E){case tr:if(f.byteLength!=y.byteLength||f.byteOffset!=y.byteOffset)return!1;f=f.buffer,y=y.buffer;case qi:return!(f.byteLength!=y.byteLength||!D(new uh(f),new uh(y)));case Bt:case Ut:case te:return Si(+f,+y);case Gn:return f.name==y.name&&f.message==y.message;case ji:case Ln:return f==y+"";case Rn:var G=rp;case mn:var Y=C&p;if(G||(G=rh),f.size!=y.size&&!Y)return!1;var nt=W.get(f);if(nt)return nt==y;C|=v,W.set(f,y);var rt=LS(G(f),G(y),C,N,D,W);return W.delete(f),rt;case Be:if(fu)return fu.call(f)==fu.call(y)}return!1}function w7(f,y,E,C,N,D){var W=E&p,G=Op(f),Y=G.length,nt=Op(y),rt=nt.length;if(Y!=rt&&!W)return!1;for(var ot=Y;ot--;){var xt=G[ot];if(!(W?xt in y:fe.call(y,xt)))return!1}var Mt=D.get(f),Ot=D.get(y);if(Mt&&Ot)return Mt==y&&Ot==f;var Kt=!0;D.set(f,y),D.set(y,f);for(var Ct=W;++ot<Y;){xt=G[ot];var ee=f[xt],ie=y[xt];if(C)var Lr=W?C(ie,ee,xt,y,f,D):C(ee,ie,xt,f,y,D);if(!(Lr===e?ee===ie||N(ee,ie,E,C,D):Lr)){Kt=!1;break}Ct||(Ct=xt=="constructor")}if(Kt&&!Ct){var rr=f.constructor,Ir=y.constructor;rr!=Ir&&"constructor"in f&&"constructor"in y&&!(typeof rr=="function"&&rr instanceof rr&&typeof Ir=="function"&&Ir instanceof Ir)&&(Kt=!1)}return D.delete(f),D.delete(y),Kt}function va(f){return Dp($S(f,e,XS),f+"")}function Op(f){return tS(f,Tn,Np)}function Cp(f){return tS(f,pr,IS)}var Ap=ph?function(f){return ph.get(f)}:Xp;function Ch(f){for(var y=f.name+"",E=sl[y],C=fe.call(sl,y)?E.length:0;C--;){var N=E[C],D=N.func;if(D==null||D==f)return N.name}return y}function cl(f){var y=fe.call(I,"placeholder")?I:f;return y.placeholder}function Tt(){var f=I.iteratee||Up;return f=f===Up?rS:f,arguments.length?f(arguments[0],arguments[1]):f}function Ah(f,y){var E=f.__data__;return O7(y)?E[typeof y=="string"?"string":"hash"]:E.map}function Pp(f){for(var y=Tn(f),E=y.length;E--;){var C=y[E],N=f[C];y[E]=[C,N,BS(N)]}return y}function ao(f,y){var E=P8(f,y);return nS(E)?E:e}function x7(f){var y=fe.call(f,to),E=f[to];try{f[to]=e;var C=!0}catch{}var N=oh.call(f);return C&&(y?f[to]=E:delete f[to]),N}var Np=ap?function(f){return f==null?[]:(f=Ee(f),Qa(ap(f),function(y){return j_.call(f,y)}))}:Kp,IS=ap?function(f){for(var y=[];f;)ts(y,Np(f)),f=ch(f);return y}:Kp,Hn=er;(sp&&Hn(new sp(new ArrayBuffer(1)))!=tr||cu&&Hn(new cu)!=Rn||op&&Hn(op.resolve())!=Kr||al&&Hn(new al)!=mn||hu&&Hn(new hu)!=kn)&&(Hn=function(f){var y=er(f),E=y==Wt?f.constructor:e,C=E?so(E):"";if(C)switch(C){case r9:return tr;case i9:return Rn;case a9:return Kr;case s9:return mn;case o9:return kn}return y});function E7(f,y,E){for(var C=-1,N=E.length;++C<N;){var D=E[C],W=D.size;switch(D.type){case"drop":f+=W;break;case"dropRight":y-=W;break;case"take":y=Vn(y,f+W);break;case"takeRight":f=bn(f,y-W);break}}return{start:f,end:y}}function _7(f){var y=f.match(C5);return y?y[1].split(A5):[]}function DS(f,y,E){y=as(y,f);for(var C=-1,N=y.length,D=!1;++C<N;){var W=Vi(y[C]);if(!(D=f!=null&&E(f,W)))break;f=f[W]}return D||++C!=N?D:(N=f==null?0:f.length,!!N&&Fh(N)&&ma(W,N)&&(zt(f)||oo(f)))}function S7(f){var y=f.length,E=new f.constructor(y);return y&&typeof f[0]=="string"&&fe.call(f,"index")&&(E.index=f.index,E.input=f.input),E}function FS(f){return typeof f.constructor=="function"&&!wu(f)?ol(ch(f)):{}}function M7(f,y,E){var C=f.constructor;switch(y){case qi:return Mp(f);case Bt:case Ut:return new C(+f);case tr:return l7(f,E);case Za:case Ja:case ou:case Jo:case Zr:case xi:case F0:case B0:case z0:return bS(f,E);case Rn:return new C;case te:case Ln:return new C(f);case ji:return u7(f);case mn:return new C;case Be:return c7(f)}}function k7(f,y){var E=y.length;if(!E)return f;var C=E-1;return y[C]=(E>1?"& ":"")+y[C],y=y.join(E>2?", ":" "),f.replace(O5,`{
- /* [wrapped with `+y+`] */
- `)}function T7(f){return zt(f)||oo(f)||!!(q_&&f&&f[q_])}function ma(f,y){var E=typeof f;return y=y??F,!!y&&(E=="number"||E!="symbol"&&z5.test(f))&&f>-1&&f%1==0&&f<y}function nr(f,y,E){if(!qe(E))return!1;var C=typeof y;return(C=="number"?gr(E)&&ma(y,E.length):C=="string"&&y in E)?Si(E[y],f):!1}function Rp(f,y){if(zt(f))return!1;var E=typeof f;return E=="number"||E=="symbol"||E=="boolean"||f==null||Rr(f)?!0:S5.test(f)||!_5.test(f)||y!=null&&f in Ee(y)}function O7(f){var y=typeof f;return y=="string"||y=="number"||y=="symbol"||y=="boolean"?f!=="__proto__":f===null}function Lp(f){var y=Ch(f),E=I[y];if(typeof E!="function"||!(y in re.prototype))return!1;if(f===E)return!0;var C=Ap(E);return!!C&&f===C[0]}function C7(f){return!!B_&&B_ in f}var A7=ah?ya:Zp;function wu(f){var y=f&&f.constructor,E=typeof y=="function"&&y.prototype||il;return f===E}function BS(f){return f===f&&!qe(f)}function zS(f,y){return function(E){return E==null?!1:E[f]===y&&(y!==e||f in Ee(E))}}function P7(f){var y=Ih(f,function(C){return E.size===u&&E.clear(),C}),E=y.cache;return y}function N7(f,y){var E=f[1],C=y[1],N=E|C,D=N<(m|b|k),W=C==k&&E==x||C==k&&E==T&&f[7].length<=y[8]||C==(k|T)&&y[7].length<=y[8]&&E==x;if(!(D||W))return f;C&m&&(f[2]=y[2],N|=E&m?0:w);var G=y[3];if(G){var Y=f[3];f[3]=Y?xS(Y,G,y[4]):G,f[4]=Y?es(f[3],c):y[4]}return G=y[5],G&&(Y=f[5],f[5]=Y?ES(Y,G,y[6]):G,f[6]=Y?es(f[5],c):y[6]),G=y[7],G&&(f[7]=G),C&k&&(f[8]=f[8]==null?y[8]:Vn(f[8],y[8])),f[9]==null&&(f[9]=y[9]),f[0]=y[0],f[1]=N,f}function R7(f){var y=[];if(f!=null)for(var E in Ee(f))y.push(E);return y}function L7(f){return oh.call(f)}function $S(f,y,E){return y=bn(y===e?f.length-1:y,0),function(){for(var C=arguments,N=-1,D=bn(C.length-y,0),W=Z(D);++N<D;)W[N]=C[y+N];N=-1;for(var G=Z(y+1);++N<y;)G[N]=C[N];return G[y]=E(W),Ar(f,this,G)}}function jS(f,y){return y.length<2?f:io(f,ri(y,0,-1))}function I7(f,y){for(var E=f.length,C=Vn(y.length,E),N=fr(f);C--;){var D=y[C];f[C]=ma(D,E)?N[D]:e}return f}function Ip(f,y){if(!(y==="constructor"&&typeof f[y]=="function")&&y!="__proto__")return f[y]}var qS=GS(hS),xu=K8||function(f,y){return In.setTimeout(f,y)},Dp=GS(i7);function WS(f,y,E){var C=y+"";return Dp(f,k7(C,D7(_7(C),E)))}function GS(f){var y=0,E=0;return function(){var C=t9(),N=L-(C-E);if(E=C,N>0){if(++y>=R)return arguments[0]}else y=0;return f.apply(e,arguments)}}function Ph(f,y){var E=-1,C=f.length,N=C-1;for(y=y===e?C:y;++E<y;){var D=yp(E,N),W=f[D];f[D]=f[E],f[E]=W}return f.length=y,f}var VS=P7(function(f){var y=[];return f.charCodeAt(0)===46&&y.push(""),f.replace(M5,function(E,C,N,D){y.push(N?D.replace(R5,"$1"):C||E)}),y});function Vi(f){if(typeof f=="string"||Rr(f))return f;var y=f+"";return y=="0"&&1/f==-1/0?"-0":y}function so(f){if(f!=null){try{return sh.call(f)}catch{}try{return f+""}catch{}}return""}function D7(f,y){return Qr(ht,function(E){var C="_."+E[0];y&E[1]&&!eh(f,C)&&f.push(C)}),f.sort()}function HS(f){if(f instanceof re)return f.clone();var y=new ei(f.__wrapped__,f.__chain__);return y.__actions__=fr(f.__actions__),y.__index__=f.__index__,y.__values__=f.__values__,y}function F7(f,y,E){(E?nr(f,y,E):y===e)?y=1:y=bn(Yt(y),0);var C=f==null?0:f.length;if(!C||y<1)return[];for(var N=0,D=0,W=Z(fh(C/y));N<C;)W[D++]=ri(f,N,N+=y);return W}function B7(f){for(var y=-1,E=f==null?0:f.length,C=0,N=[];++y<E;){var D=f[y];D&&(N[C++]=D)}return N}function z7(){var f=arguments.length;if(!f)return[];for(var y=Z(f-1),E=arguments[0],C=f;C--;)y[C-1]=arguments[C];return ts(zt(E)?fr(E):[E],Dn(y,1))}var $7=Zt(function(f,y){return tn(f)?pu(f,Dn(y,1,tn,!0)):[]}),j7=Zt(function(f,y){var E=ii(y);return tn(E)&&(E=e),tn(f)?pu(f,Dn(y,1,tn,!0),Tt(E,2)):[]}),q7=Zt(function(f,y){var E=ii(y);return tn(E)&&(E=e),tn(f)?pu(f,Dn(y,1,tn,!0),e,E):[]});function W7(f,y,E){var C=f==null?0:f.length;return C?(y=E||y===e?1:Yt(y),ri(f,y<0?0:y,C)):[]}function G7(f,y,E){var C=f==null?0:f.length;return C?(y=E||y===e?1:Yt(y),y=C-y,ri(f,0,y<0?0:y)):[]}function V7(f,y){return f&&f.length?_h(f,Tt(y,3),!0,!0):[]}function H7(f,y){return f&&f.length?_h(f,Tt(y,3),!0):[]}function U7(f,y,E,C){var N=f==null?0:f.length;return N?(E&&typeof E!="number"&&nr(f,y,E)&&(E=0,C=N),z9(f,y,E,C)):[]}function US(f,y,E){var C=f==null?0:f.length;if(!C)return-1;var N=E==null?0:Yt(E);return N<0&&(N=bn(C+N,0)),nh(f,Tt(y,3),N)}function YS(f,y,E){var C=f==null?0:f.length;if(!C)return-1;var N=C-1;return E!==e&&(N=Yt(E),N=E<0?bn(C+N,0):Vn(N,C-1)),nh(f,Tt(y,3),N,!0)}function XS(f){var y=f==null?0:f.length;return y?Dn(f,1):[]}function Y7(f){var y=f==null?0:f.length;return y?Dn(f,B):[]}function X7(f,y){var E=f==null?0:f.length;return E?(y=y===e?1:Yt(y),Dn(f,y)):[]}function K7(f){for(var y=-1,E=f==null?0:f.length,C={};++y<E;){var N=f[y];C[N[0]]=N[1]}return C}function KS(f){return f&&f.length?f[0]:e}function Z7(f,y,E){var C=f==null?0:f.length;if(!C)return-1;var N=E==null?0:Yt(E);return N<0&&(N=bn(C+N,0)),tl(f,y,N)}function J7(f){var y=f==null?0:f.length;return y?ri(f,0,-1):[]}var Q7=Zt(function(f){var y=ze(f,_p);return y.length&&y[0]===f[0]?fp(y):[]}),tF=Zt(function(f){var y=ii(f),E=ze(f,_p);return y===ii(E)?y=e:E.pop(),E.length&&E[0]===f[0]?fp(E,Tt(y,2)):[]}),eF=Zt(function(f){var y=ii(f),E=ze(f,_p);return y=typeof y=="function"?y:e,y&&E.pop(),E.length&&E[0]===f[0]?fp(E,e,y):[]});function nF(f,y){return f==null?"":J8.call(f,y)}function ii(f){var y=f==null?0:f.length;return y?f[y-1]:e}function rF(f,y,E){var C=f==null?0:f.length;if(!C)return-1;var N=C;return E!==e&&(N=Yt(E),N=N<0?bn(C+N,0):Vn(N,C-1)),y===y?D8(f,y,N):nh(f,A_,N,!0)}function iF(f,y){return f&&f.length?oS(f,Yt(y)):e}var aF=Zt(ZS);function ZS(f,y){return f&&f.length&&y&&y.length?mp(f,y):f}function sF(f,y,E){return f&&f.length&&y&&y.length?mp(f,y,Tt(E,2)):f}function oF(f,y,E){return f&&f.length&&y&&y.length?mp(f,y,e,E):f}var lF=va(function(f,y){var E=f==null?0:f.length,C=up(f,y);return cS(f,ze(y,function(N){return ma(N,E)?+N:N}).sort(wS)),C});function uF(f,y){var E=[];if(!(f&&f.length))return E;var C=-1,N=[],D=f.length;for(y=Tt(y,3);++C<D;){var W=f[C];y(W,C,f)&&(E.push(W),N.push(C))}return cS(f,N),E}function Fp(f){return f==null?f:n9.call(f)}function cF(f,y,E){var C=f==null?0:f.length;return C?(E&&typeof E!="number"&&nr(f,y,E)?(y=0,E=C):(y=y==null?0:Yt(y),E=E===e?C:Yt(E)),ri(f,y,E)):[]}function hF(f,y){return Eh(f,y)}function dF(f,y,E){return wp(f,y,Tt(E,2))}function fF(f,y){var E=f==null?0:f.length;if(E){var C=Eh(f,y);if(C<E&&Si(f[C],y))return C}return-1}function gF(f,y){return Eh(f,y,!0)}function pF(f,y,E){return wp(f,y,Tt(E,2),!0)}function vF(f,y){var E=f==null?0:f.length;if(E){var C=Eh(f,y,!0)-1;if(Si(f[C],y))return C}return-1}function mF(f){return f&&f.length?dS(f):[]}function yF(f,y){return f&&f.length?dS(f,Tt(y,2)):[]}function bF(f){var y=f==null?0:f.length;return y?ri(f,1,y):[]}function wF(f,y,E){return f&&f.length?(y=E||y===e?1:Yt(y),ri(f,0,y<0?0:y)):[]}function xF(f,y,E){var C=f==null?0:f.length;return C?(y=E||y===e?1:Yt(y),y=C-y,ri(f,y<0?0:y,C)):[]}function EF(f,y){return f&&f.length?_h(f,Tt(y,3),!1,!0):[]}function _F(f,y){return f&&f.length?_h(f,Tt(y,3)):[]}var SF=Zt(function(f){return is(Dn(f,1,tn,!0))}),MF=Zt(function(f){var y=ii(f);return tn(y)&&(y=e),is(Dn(f,1,tn,!0),Tt(y,2))}),kF=Zt(function(f){var y=ii(f);return y=typeof y=="function"?y:e,is(Dn(f,1,tn,!0),e,y)});function TF(f){return f&&f.length?is(f):[]}function OF(f,y){return f&&f.length?is(f,Tt(y,2)):[]}function CF(f,y){return y=typeof y=="function"?y:e,f&&f.length?is(f,e,y):[]}function Bp(f){if(!(f&&f.length))return[];var y=0;return f=Qa(f,function(E){if(tn(E))return y=bn(E.length,y),!0}),ep(y,function(E){return ze(f,J0(E))})}function JS(f,y){if(!(f&&f.length))return[];var E=Bp(f);return y==null?E:ze(E,function(C){return Ar(y,e,C)})}var AF=Zt(function(f,y){return tn(f)?pu(f,y):[]}),PF=Zt(function(f){return Ep(Qa(f,tn))}),NF=Zt(function(f){var y=ii(f);return tn(y)&&(y=e),Ep(Qa(f,tn),Tt(y,2))}),RF=Zt(function(f){var y=ii(f);return y=typeof y=="function"?y:e,Ep(Qa(f,tn),e,y)}),LF=Zt(Bp);function IF(f,y){return vS(f||[],y||[],gu)}function DF(f,y){return vS(f||[],y||[],yu)}var FF=Zt(function(f){var y=f.length,E=y>1?f[y-1]:e;return E=typeof E=="function"?(f.pop(),E):e,JS(f,E)});function QS(f){var y=I(f);return y.__chain__=!0,y}function BF(f,y){return y(f),f}function Nh(f,y){return y(f)}var zF=va(function(f){var y=f.length,E=y?f[0]:0,C=this.__wrapped__,N=function(D){return up(D,f)};return y>1||this.__actions__.length||!(C instanceof re)||!ma(E)?this.thru(N):(C=C.slice(E,+E+(y?1:0)),C.__actions__.push({func:Nh,args:[N],thisArg:e}),new ei(C,this.__chain__).thru(function(D){return y&&!D.length&&D.push(e),D}))});function $F(){return QS(this)}function jF(){return new ei(this.value(),this.__chain__)}function qF(){this.__values__===e&&(this.__values__=f3(this.value()));var f=this.__index__>=this.__values__.length,y=f?e:this.__values__[this.__index__++];return{done:f,value:y}}function WF(){return this}function GF(f){for(var y,E=this;E instanceof mh;){var C=HS(E);C.__index__=0,C.__values__=e,y?N.__wrapped__=C:y=C;var N=C;E=E.__wrapped__}return N.__wrapped__=f,y}function VF(){var f=this.__wrapped__;if(f instanceof re){var y=f;return this.__actions__.length&&(y=new re(this)),y=y.reverse(),y.__actions__.push({func:Nh,args:[Fp],thisArg:e}),new ei(y,this.__chain__)}return this.thru(Fp)}function HF(){return pS(this.__wrapped__,this.__actions__)}var UF=Sh(function(f,y,E){fe.call(f,E)?++f[E]:ga(f,E,1)});function YF(f,y,E){var C=zt(f)?O_:B9;return E&&nr(f,y,E)&&(y=e),C(f,Tt(y,3))}function XF(f,y){var E=zt(f)?Qa:J_;return E(f,Tt(y,3))}var KF=kS(US),ZF=kS(YS);function JF(f,y){return Dn(Rh(f,y),1)}function QF(f,y){return Dn(Rh(f,y),B)}function tB(f,y,E){return E=E===e?1:Yt(E),Dn(Rh(f,y),E)}function t3(f,y){var E=zt(f)?Qr:rs;return E(f,Tt(y,3))}function e3(f,y){var E=zt(f)?b8:Z_;return E(f,Tt(y,3))}var eB=Sh(function(f,y,E){fe.call(f,E)?f[E].push(y):ga(f,E,[y])});function nB(f,y,E,C){f=gr(f)?f:dl(f),E=E&&!C?Yt(E):0;var N=f.length;return E<0&&(E=bn(N+E,0)),Bh(f)?E<=N&&f.indexOf(y,E)>-1:!!N&&tl(f,y,E)>-1}var rB=Zt(function(f,y,E){var C=-1,N=typeof y=="function",D=gr(f)?Z(f.length):[];return rs(f,function(W){D[++C]=N?Ar(y,W,E):vu(W,y,E)}),D}),iB=Sh(function(f,y,E){ga(f,E,y)});function Rh(f,y){var E=zt(f)?ze:iS;return E(f,Tt(y,3))}function aB(f,y,E,C){return f==null?[]:(zt(y)||(y=y==null?[]:[y]),E=C?e:E,zt(E)||(E=E==null?[]:[E]),lS(f,y,E))}var sB=Sh(function(f,y,E){f[E?0:1].push(y)},function(){return[[],[]]});function oB(f,y,E){var C=zt(f)?K0:N_,N=arguments.length<3;return C(f,Tt(y,4),E,N,rs)}function lB(f,y,E){var C=zt(f)?w8:N_,N=arguments.length<3;return C(f,Tt(y,4),E,N,Z_)}function uB(f,y){var E=zt(f)?Qa:J_;return E(f,Dh(Tt(y,3)))}function cB(f){var y=zt(f)?U_:n7;return y(f)}function hB(f,y,E){(E?nr(f,y,E):y===e)?y=1:y=Yt(y);var C=zt(f)?R9:r7;return C(f,y)}function dB(f){var y=zt(f)?L9:a7;return y(f)}function fB(f){if(f==null)return 0;if(gr(f))return Bh(f)?nl(f):f.length;var y=Hn(f);return y==Rn||y==mn?f.size:pp(f).length}function gB(f,y,E){var C=zt(f)?Z0:s7;return E&&nr(f,y,E)&&(y=e),C(f,Tt(y,3))}var pB=Zt(function(f,y){if(f==null)return[];var E=y.length;return E>1&&nr(f,y[0],y[1])?y=[]:E>2&&nr(y[0],y[1],y[2])&&(y=[y[0]]),lS(f,Dn(y,1),[])}),Lh=X8||function(){return In.Date.now()};function vB(f,y){if(typeof y!="function")throw new ti(s);return f=Yt(f),function(){if(--f<1)return y.apply(this,arguments)}}function n3(f,y,E){return y=E?e:y,y=f&&y==null?f.length:y,pa(f,k,e,e,e,e,y)}function r3(f,y){var E;if(typeof y!="function")throw new ti(s);return f=Yt(f),function(){return--f>0&&(E=y.apply(this,arguments)),f<=1&&(y=e),E}}var zp=Zt(function(f,y,E){var C=m;if(E.length){var N=es(E,cl(zp));C|=S}return pa(f,C,y,E,N)}),i3=Zt(function(f,y,E){var C=m|b;if(E.length){var N=es(E,cl(i3));C|=S}return pa(y,C,f,E,N)});function a3(f,y,E){y=E?e:y;var C=pa(f,x,e,e,e,e,e,y);return C.placeholder=a3.placeholder,C}function s3(f,y,E){y=E?e:y;var C=pa(f,_,e,e,e,e,e,y);return C.placeholder=s3.placeholder,C}function o3(f,y,E){var C,N,D,W,G,Y,nt=0,rt=!1,ot=!1,xt=!0;if(typeof f!="function")throw new ti(s);y=ai(y)||0,qe(E)&&(rt=!!E.leading,ot="maxWait"in E,D=ot?bn(ai(E.maxWait)||0,y):D,xt="trailing"in E?!!E.trailing:xt);function Mt(en){var Mi=C,wa=N;return C=N=e,nt=en,W=f.apply(wa,Mi),W}function Ot(en){return nt=en,G=xu(ee,y),rt?Mt(en):W}function Kt(en){var Mi=en-Y,wa=en-nt,k3=y-Mi;return ot?Vn(k3,D-wa):k3}function Ct(en){var Mi=en-Y,wa=en-nt;return Y===e||Mi>=y||Mi<0||ot&&wa>=D}function ee(){var en=Lh();if(Ct(en))return ie(en);G=xu(ee,Kt(en))}function ie(en){return G=e,xt&&C?Mt(en):(C=N=e,W)}function Lr(){G!==e&&mS(G),nt=0,C=Y=N=G=e}function rr(){return G===e?W:ie(Lh())}function Ir(){var en=Lh(),Mi=Ct(en);if(C=arguments,N=this,Y=en,Mi){if(G===e)return Ot(Y);if(ot)return mS(G),G=xu(ee,y),Mt(Y)}return G===e&&(G=xu(ee,y)),W}return Ir.cancel=Lr,Ir.flush=rr,Ir}var mB=Zt(function(f,y){return K_(f,1,y)}),yB=Zt(function(f,y,E){return K_(f,ai(y)||0,E)});function bB(f){return pa(f,P)}function Ih(f,y){if(typeof f!="function"||y!=null&&typeof y!="function")throw new ti(s);var E=function(){var C=arguments,N=y?y.apply(this,C):C[0],D=E.cache;if(D.has(N))return D.get(N);var W=f.apply(this,C);return E.cache=D.set(N,W)||D,W};return E.cache=new(Ih.Cache||fa),E}Ih.Cache=fa;function Dh(f){if(typeof f!="function")throw new ti(s);return function(){var y=arguments;switch(y.length){case 0:return!f.call(this);case 1:return!f.call(this,y[0]);case 2:return!f.call(this,y[0],y[1]);case 3:return!f.call(this,y[0],y[1],y[2])}return!f.apply(this,y)}}function wB(f){return r3(2,f)}var xB=o7(function(f,y){y=y.length==1&&zt(y[0])?ze(y[0],Pr(Tt())):ze(Dn(y,1),Pr(Tt()));var E=y.length;return Zt(function(C){for(var N=-1,D=Vn(C.length,E);++N<D;)C[N]=y[N].call(this,C[N]);return Ar(f,this,C)})}),$p=Zt(function(f,y){var E=es(y,cl($p));return pa(f,S,e,y,E)}),l3=Zt(function(f,y){var E=es(y,cl(l3));return pa(f,M,e,y,E)}),EB=va(function(f,y){return pa(f,T,e,e,e,y)});function _B(f,y){if(typeof f!="function")throw new ti(s);return y=y===e?y:Yt(y),Zt(f,y)}function SB(f,y){if(typeof f!="function")throw new ti(s);return y=y==null?0:bn(Yt(y),0),Zt(function(E){var C=E[y],N=ss(E,0,y);return C&&ts(N,C),Ar(f,this,N)})}function MB(f,y,E){var C=!0,N=!0;if(typeof f!="function")throw new ti(s);return qe(E)&&(C="leading"in E?!!E.leading:C,N="trailing"in E?!!E.trailing:N),o3(f,y,{leading:C,maxWait:y,trailing:N})}function kB(f){return n3(f,1)}function TB(f,y){return $p(Sp(y),f)}function OB(){if(!arguments.length)return[];var f=arguments[0];return zt(f)?f:[f]}function CB(f){return ni(f,g)}function AB(f,y){return y=typeof y=="function"?y:e,ni(f,g,y)}function PB(f){return ni(f,h|g)}function NB(f,y){return y=typeof y=="function"?y:e,ni(f,h|g,y)}function RB(f,y){return y==null||X_(f,y,Tn(y))}function Si(f,y){return f===y||f!==f&&y!==y}var LB=Oh(dp),IB=Oh(function(f,y){return f>=y}),oo=eS(function(){return arguments}())?eS:function(f){return Ye(f)&&fe.call(f,"callee")&&!j_.call(f,"callee")},zt=Z.isArray,DB=E_?Pr(E_):G9;function gr(f){return f!=null&&Fh(f.length)&&!ya(f)}function tn(f){return Ye(f)&&gr(f)}function FB(f){return f===!0||f===!1||Ye(f)&&er(f)==Bt}var os=Z8||Zp,BB=__?Pr(__):V9;function zB(f){return Ye(f)&&f.nodeType===1&&!Eu(f)}function $B(f){if(f==null)return!0;if(gr(f)&&(zt(f)||typeof f=="string"||typeof f.splice=="function"||os(f)||hl(f)||oo(f)))return!f.length;var y=Hn(f);if(y==Rn||y==mn)return!f.size;if(wu(f))return!pp(f).length;for(var E in f)if(fe.call(f,E))return!1;return!0}function jB(f,y){return mu(f,y)}function qB(f,y,E){E=typeof E=="function"?E:e;var C=E?E(f,y):e;return C===e?mu(f,y,e,E):!!C}function jp(f){if(!Ye(f))return!1;var y=er(f);return y==Gn||y==Fe||typeof f.message=="string"&&typeof f.name=="string"&&!Eu(f)}function WB(f){return typeof f=="number"&&W_(f)}function ya(f){if(!qe(f))return!1;var y=er(f);return y==on||y==dr||y==wt||y==Cr}function u3(f){return typeof f=="number"&&f==Yt(f)}function Fh(f){return typeof f=="number"&&f>-1&&f%1==0&&f<=F}function qe(f){var y=typeof f;return f!=null&&(y=="object"||y=="function")}function Ye(f){return f!=null&&typeof f=="object"}var c3=S_?Pr(S_):U9;function GB(f,y){return f===y||gp(f,y,Pp(y))}function VB(f,y,E){return E=typeof E=="function"?E:e,gp(f,y,Pp(y),E)}function HB(f){return h3(f)&&f!=+f}function UB(f){if(A7(f))throw new It(a);return nS(f)}function YB(f){return f===null}function XB(f){return f==null}function h3(f){return typeof f=="number"||Ye(f)&&er(f)==te}function Eu(f){if(!Ye(f)||er(f)!=Wt)return!1;var y=ch(f);if(y===null)return!0;var E=fe.call(y,"constructor")&&y.constructor;return typeof E=="function"&&E instanceof E&&sh.call(E)==V8}var qp=M_?Pr(M_):Y9;function KB(f){return u3(f)&&f>=-9007199254740991&&f<=F}var d3=k_?Pr(k_):X9;function Bh(f){return typeof f=="string"||!zt(f)&&Ye(f)&&er(f)==Ln}function Rr(f){return typeof f=="symbol"||Ye(f)&&er(f)==Be}var hl=T_?Pr(T_):K9;function ZB(f){return f===e}function JB(f){return Ye(f)&&Hn(f)==kn}function QB(f){return Ye(f)&&er(f)==wi}var tz=Oh(vp),ez=Oh(function(f,y){return f<=y});function f3(f){if(!f)return[];if(gr(f))return Bh(f)?Ei(f):fr(f);if(uu&&f[uu])return R8(f[uu]());var y=Hn(f),E=y==Rn?rp:y==mn?rh:dl;return E(f)}function ba(f){if(!f)return f===0?f:0;if(f=ai(f),f===B||f===-1/0){var y=f<0?-1:1;return y*V}return f===f?f:0}function Yt(f){var y=ba(f),E=y%1;return y===y?E?y-E:y:0}function g3(f){return f?ro(Yt(f),0,K):0}function ai(f){if(typeof f=="number")return f;if(Rr(f))return X;if(qe(f)){var y=typeof f.valueOf=="function"?f.valueOf():f;f=qe(y)?y+"":y}if(typeof f!="string")return f===0?f:+f;f=R_(f);var E=D5.test(f);return E||B5.test(f)?v8(f.slice(2),E?2:8):I5.test(f)?X:+f}function p3(f){return Gi(f,pr(f))}function nz(f){return f?ro(Yt(f),-9007199254740991,F):f===0?f:0}function de(f){return f==null?"":Nr(f)}var rz=ll(function(f,y){if(wu(y)||gr(y)){Gi(y,Tn(y),f);return}for(var E in y)fe.call(y,E)&&gu(f,E,y[E])}),v3=ll(function(f,y){Gi(y,pr(y),f)}),zh=ll(function(f,y,E,C){Gi(y,pr(y),f,C)}),iz=ll(function(f,y,E,C){Gi(y,Tn(y),f,C)}),az=va(up);function sz(f,y){var E=ol(f);return y==null?E:Y_(E,y)}var oz=Zt(function(f,y){f=Ee(f);var E=-1,C=y.length,N=C>2?y[2]:e;for(N&&nr(y[0],y[1],N)&&(C=1);++E<C;)for(var D=y[E],W=pr(D),G=-1,Y=W.length;++G<Y;){var nt=W[G],rt=f[nt];(rt===e||Si(rt,il[nt])&&!fe.call(f,nt))&&(f[nt]=D[nt])}return f}),lz=Zt(function(f){return f.push(e,RS),Ar(m3,e,f)});function uz(f,y){return C_(f,Tt(y,3),Wi)}function cz(f,y){return C_(f,Tt(y,3),hp)}function hz(f,y){return f==null?f:cp(f,Tt(y,3),pr)}function dz(f,y){return f==null?f:Q_(f,Tt(y,3),pr)}function fz(f,y){return f&&Wi(f,Tt(y,3))}function gz(f,y){return f&&hp(f,Tt(y,3))}function pz(f){return f==null?[]:wh(f,Tn(f))}function vz(f){return f==null?[]:wh(f,pr(f))}function Wp(f,y,E){var C=f==null?e:io(f,y);return C===e?E:C}function mz(f,y){return f!=null&&DS(f,y,$9)}function Gp(f,y){return f!=null&&DS(f,y,j9)}var yz=OS(function(f,y,E){y!=null&&typeof y.toString!="function"&&(y=oh.call(y)),f[y]=E},Hp(vr)),bz=OS(function(f,y,E){y!=null&&typeof y.toString!="function"&&(y=oh.call(y)),fe.call(f,y)?f[y].push(E):f[y]=[E]},Tt),wz=Zt(vu);function Tn(f){return gr(f)?H_(f):pp(f)}function pr(f){return gr(f)?H_(f,!0):Z9(f)}function xz(f,y){var E={};return y=Tt(y,3),Wi(f,function(C,N,D){ga(E,y(C,N,D),C)}),E}function Ez(f,y){var E={};return y=Tt(y,3),Wi(f,function(C,N,D){ga(E,N,y(C,N,D))}),E}var _z=ll(function(f,y,E){xh(f,y,E)}),m3=ll(function(f,y,E,C){xh(f,y,E,C)}),Sz=va(function(f,y){var E={};if(f==null)return E;var C=!1;y=ze(y,function(D){return D=as(D,f),C||(C=D.length>1),D}),Gi(f,Cp(f),E),C&&(E=ni(E,h|d|g,y7));for(var N=y.length;N--;)xp(E,y[N]);return E});function Mz(f,y){return y3(f,Dh(Tt(y)))}var kz=va(function(f,y){return f==null?{}:Q9(f,y)});function y3(f,y){if(f==null)return{};var E=ze(Cp(f),function(C){return[C]});return y=Tt(y),uS(f,E,function(C,N){return y(C,N[0])})}function Tz(f,y,E){y=as(y,f);var C=-1,N=y.length;for(N||(N=1,f=e);++C<N;){var D=f==null?e:f[Vi(y[C])];D===e&&(C=N,D=E),f=ya(D)?D.call(f):D}return f}function Oz(f,y,E){return f==null?f:yu(f,y,E)}function Cz(f,y,E,C){return C=typeof C=="function"?C:e,f==null?f:yu(f,y,E,C)}var b3=PS(Tn),w3=PS(pr);function Az(f,y,E){var C=zt(f),N=C||os(f)||hl(f);if(y=Tt(y,4),E==null){var D=f&&f.constructor;N?E=C?new D:[]:qe(f)?E=ya(D)?ol(ch(f)):{}:E={}}return(N?Qr:Wi)(f,function(W,G,Y){return y(E,W,G,Y)}),E}function Pz(f,y){return f==null?!0:xp(f,y)}function Nz(f,y,E){return f==null?f:gS(f,y,Sp(E))}function Rz(f,y,E,C){return C=typeof C=="function"?C:e,f==null?f:gS(f,y,Sp(E),C)}function dl(f){return f==null?[]:np(f,Tn(f))}function Lz(f){return f==null?[]:np(f,pr(f))}function Iz(f,y,E){return E===e&&(E=y,y=e),E!==e&&(E=ai(E),E=E===E?E:0),y!==e&&(y=ai(y),y=y===y?y:0),ro(ai(f),y,E)}function Dz(f,y,E){return y=ba(y),E===e?(E=y,y=0):E=ba(E),f=ai(f),q9(f,y,E)}function Fz(f,y,E){if(E&&typeof E!="boolean"&&nr(f,y,E)&&(y=E=e),E===e&&(typeof y=="boolean"?(E=y,y=e):typeof f=="boolean"&&(E=f,f=e)),f===e&&y===e?(f=0,y=1):(f=ba(f),y===e?(y=f,f=0):y=ba(y)),f>y){var C=f;f=y,y=C}if(E||f%1||y%1){var N=G_();return Vn(f+N*(y-f+p8("1e-"+((N+"").length-1))),y)}return yp(f,y)}var Bz=ul(function(f,y,E){return y=y.toLowerCase(),f+(E?x3(y):y)});function x3(f){return Vp(de(f).toLowerCase())}function E3(f){return f=de(f),f&&f.replace($5,O8).replace(a8,"")}function zz(f,y,E){f=de(f),y=Nr(y);var C=f.length;E=E===e?C:ro(Yt(E),0,C);var N=E;return E-=y.length,E>=0&&f.slice(E,N)==y}function $z(f){return f=de(f),f&&w5.test(f)?f.replace(QE,C8):f}function jz(f){return f=de(f),f&&k5.test(f)?f.replace($0,"\\$&"):f}var qz=ul(function(f,y,E){return f+(E?"-":"")+y.toLowerCase()}),Wz=ul(function(f,y,E){return f+(E?" ":"")+y.toLowerCase()}),Gz=MS("toLowerCase");function Vz(f,y,E){f=de(f),y=Yt(y);var C=y?nl(f):0;if(!y||C>=y)return f;var N=(y-C)/2;return Th(gh(N),E)+f+Th(fh(N),E)}function Hz(f,y,E){f=de(f),y=Yt(y);var C=y?nl(f):0;return y&&C<y?f+Th(y-C,E):f}function Uz(f,y,E){f=de(f),y=Yt(y);var C=y?nl(f):0;return y&&C<y?Th(y-C,E)+f:f}function Yz(f,y,E){return E||y==null?y=0:y&&(y=+y),e9(de(f).replace(j0,""),y||0)}function Xz(f,y,E){return(E?nr(f,y,E):y===e)?y=1:y=Yt(y),bp(de(f),y)}function Kz(){var f=arguments,y=de(f[0]);return f.length<3?y:y.replace(f[1],f[2])}var Zz=ul(function(f,y,E){return f+(E?"_":"")+y.toLowerCase()});function Jz(f,y,E){return E&&typeof E!="number"&&nr(f,y,E)&&(y=E=e),E=E===e?K:E>>>0,E?(f=de(f),f&&(typeof y=="string"||y!=null&&!qp(y))&&(y=Nr(y),!y&&el(f))?ss(Ei(f),0,E):f.split(y,E)):[]}var Qz=ul(function(f,y,E){return f+(E?" ":"")+Vp(y)});function t$(f,y,E){return f=de(f),E=E==null?0:ro(Yt(E),0,f.length),y=Nr(y),f.slice(E,E+y.length)==y}function e$(f,y,E){var C=I.templateSettings;E&&nr(f,y,E)&&(y=e),f=de(f),y=zh({},y,C,NS);var N=zh({},y.imports,C.imports,NS),D=Tn(N),W=np(N,D),G,Y,nt=0,rt=y.interpolate||Jc,ot="__p += '",xt=ip((y.escape||Jc).source+"|"+rt.source+"|"+(rt===t_?L5:Jc).source+"|"+(y.evaluate||Jc).source+"|$","g"),Mt="//# sourceURL="+(fe.call(y,"sourceURL")?(y.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++c8+"]")+`
- `;f.replace(xt,function(Ct,ee,ie,Lr,rr,Ir){return ie||(ie=Lr),ot+=f.slice(nt,Ir).replace(j5,A8),ee&&(G=!0,ot+=`' +
- __e(`+ee+`) +
- '`),rr&&(Y=!0,ot+=`';
- `+rr+`;
- __p += '`),ie&&(ot+=`' +
- ((__t = (`+ie+`)) == null ? '' : __t) +
- '`),nt=Ir+Ct.length,Ct}),ot+=`';
- `;var Ot=fe.call(y,"variable")&&y.variable;if(!Ot)ot=`with (obj) {
- `+ot+`
- }
- `;else if(N5.test(Ot))throw new It(o);ot=(Y?ot.replace(v5,""):ot).replace(m5,"$1").replace(y5,"$1;"),ot="function("+(Ot||"obj")+`) {
- `+(Ot?"":`obj || (obj = {});
- `)+"var __t, __p = ''"+(G?", __e = _.escape":"")+(Y?`, __j = Array.prototype.join;
- function print() { __p += __j.call(arguments, '') }
- `:`;
- `)+ot+`return __p
- }`;var Kt=S3(function(){return ue(D,Mt+"return "+ot).apply(e,W)});if(Kt.source=ot,jp(Kt))throw Kt;return Kt}function n$(f){return de(f).toLowerCase()}function r$(f){return de(f).toUpperCase()}function i$(f,y,E){if(f=de(f),f&&(E||y===e))return R_(f);if(!f||!(y=Nr(y)))return f;var C=Ei(f),N=Ei(y),D=L_(C,N),W=I_(C,N)+1;return ss(C,D,W).join("")}function a$(f,y,E){if(f=de(f),f&&(E||y===e))return f.slice(0,F_(f)+1);if(!f||!(y=Nr(y)))return f;var C=Ei(f),N=I_(C,Ei(y))+1;return ss(C,0,N).join("")}function s$(f,y,E){if(f=de(f),f&&(E||y===e))return f.replace(j0,"");if(!f||!(y=Nr(y)))return f;var C=Ei(f),N=L_(C,Ei(y));return ss(C,N).join("")}function o$(f,y){var E=O,C=A;if(qe(y)){var N="separator"in y?y.separator:N;E="length"in y?Yt(y.length):E,C="omission"in y?Nr(y.omission):C}f=de(f);var D=f.length;if(el(f)){var W=Ei(f);D=W.length}if(E>=D)return f;var G=E-nl(C);if(G<1)return C;var Y=W?ss(W,0,G).join(""):f.slice(0,G);if(N===e)return Y+C;if(W&&(G+=Y.length-G),qp(N)){if(f.slice(G).search(N)){var nt,rt=Y;for(N.global||(N=ip(N.source,de(e_.exec(N))+"g")),N.lastIndex=0;nt=N.exec(rt);)var ot=nt.index;Y=Y.slice(0,ot===e?G:ot)}}else if(f.indexOf(Nr(N),G)!=G){var xt=Y.lastIndexOf(N);xt>-1&&(Y=Y.slice(0,xt))}return Y+C}function l$(f){return f=de(f),f&&b5.test(f)?f.replace(JE,F8):f}var u$=ul(function(f,y,E){return f+(E?" ":"")+y.toUpperCase()}),Vp=MS("toUpperCase");function _3(f,y,E){return f=de(f),y=E?e:y,y===e?N8(f)?$8(f):_8(f):f.match(y)||[]}var S3=Zt(function(f,y){try{return Ar(f,e,y)}catch(E){return jp(E)?E:new It(E)}}),c$=va(function(f,y){return Qr(y,function(E){E=Vi(E),ga(f,E,zp(f[E],f))}),f});function h$(f){var y=f==null?0:f.length,E=Tt();return f=y?ze(f,function(C){if(typeof C[1]!="function")throw new ti(s);return[E(C[0]),C[1]]}):[],Zt(function(C){for(var N=-1;++N<y;){var D=f[N];if(Ar(D[0],this,C))return Ar(D[1],this,C)}})}function d$(f){return F9(ni(f,h))}function Hp(f){return function(){return f}}function f$(f,y){return f==null||f!==f?y:f}var g$=TS(),p$=TS(!0);function vr(f){return f}function Up(f){return rS(typeof f=="function"?f:ni(f,h))}function v$(f){return aS(ni(f,h))}function m$(f,y){return sS(f,ni(y,h))}var y$=Zt(function(f,y){return function(E){return vu(E,f,y)}}),b$=Zt(function(f,y){return function(E){return vu(f,E,y)}});function Yp(f,y,E){var C=Tn(y),N=wh(y,C);E==null&&!(qe(y)&&(N.length||!C.length))&&(E=y,y=f,f=this,N=wh(y,Tn(y)));var D=!(qe(E)&&"chain"in E)||!!E.chain,W=ya(f);return Qr(N,function(G){var Y=y[G];f[G]=Y,W&&(f.prototype[G]=function(){var nt=this.__chain__;if(D||nt){var rt=f(this.__wrapped__),ot=rt.__actions__=fr(this.__actions__);return ot.push({func:Y,args:arguments,thisArg:f}),rt.__chain__=nt,rt}return Y.apply(f,ts([this.value()],arguments))})}),f}function w$(){return In._===this&&(In._=H8),this}function Xp(){}function x$(f){return f=Yt(f),Zt(function(y){return oS(y,f)})}var E$=kp(ze),_$=kp(O_),S$=kp(Z0);function M3(f){return Rp(f)?J0(Vi(f)):t7(f)}function M$(f){return function(y){return f==null?e:io(f,y)}}var k$=CS(),T$=CS(!0);function Kp(){return[]}function Zp(){return!1}function O$(){return{}}function C$(){return""}function A$(){return!0}function P$(f,y){if(f=Yt(f),f<1||f>F)return[];var E=K,C=Vn(f,K);y=Tt(y),f-=K;for(var N=ep(C,y);++E<f;)y(E);return N}function N$(f){return zt(f)?ze(f,Vi):Rr(f)?[f]:fr(VS(de(f)))}function R$(f){var y=++G8;return de(f)+y}var L$=kh(function(f,y){return f+y},0),I$=Tp("ceil"),D$=kh(function(f,y){return f/y},1),F$=Tp("floor");function B$(f){return f&&f.length?bh(f,vr,dp):e}function z$(f,y){return f&&f.length?bh(f,Tt(y,2),dp):e}function $$(f){return P_(f,vr)}function j$(f,y){return P_(f,Tt(y,2))}function q$(f){return f&&f.length?bh(f,vr,vp):e}function W$(f,y){return f&&f.length?bh(f,Tt(y,2),vp):e}var G$=kh(function(f,y){return f*y},1),V$=Tp("round"),H$=kh(function(f,y){return f-y},0);function U$(f){return f&&f.length?tp(f,vr):0}function Y$(f,y){return f&&f.length?tp(f,Tt(y,2)):0}return I.after=vB,I.ary=n3,I.assign=rz,I.assignIn=v3,I.assignInWith=zh,I.assignWith=iz,I.at=az,I.before=r3,I.bind=zp,I.bindAll=c$,I.bindKey=i3,I.castArray=OB,I.chain=QS,I.chunk=F7,I.compact=B7,I.concat=z7,I.cond=h$,I.conforms=d$,I.constant=Hp,I.countBy=UF,I.create=sz,I.curry=a3,I.curryRight=s3,I.debounce=o3,I.defaults=oz,I.defaultsDeep=lz,I.defer=mB,I.delay=yB,I.difference=$7,I.differenceBy=j7,I.differenceWith=q7,I.drop=W7,I.dropRight=G7,I.dropRightWhile=V7,I.dropWhile=H7,I.fill=U7,I.filter=XF,I.flatMap=JF,I.flatMapDeep=QF,I.flatMapDepth=tB,I.flatten=XS,I.flattenDeep=Y7,I.flattenDepth=X7,I.flip=bB,I.flow=g$,I.flowRight=p$,I.fromPairs=K7,I.functions=pz,I.functionsIn=vz,I.groupBy=eB,I.initial=J7,I.intersection=Q7,I.intersectionBy=tF,I.intersectionWith=eF,I.invert=yz,I.invertBy=bz,I.invokeMap=rB,I.iteratee=Up,I.keyBy=iB,I.keys=Tn,I.keysIn=pr,I.map=Rh,I.mapKeys=xz,I.mapValues=Ez,I.matches=v$,I.matchesProperty=m$,I.memoize=Ih,I.merge=_z,I.mergeWith=m3,I.method=y$,I.methodOf=b$,I.mixin=Yp,I.negate=Dh,I.nthArg=x$,I.omit=Sz,I.omitBy=Mz,I.once=wB,I.orderBy=aB,I.over=E$,I.overArgs=xB,I.overEvery=_$,I.overSome=S$,I.partial=$p,I.partialRight=l3,I.partition=sB,I.pick=kz,I.pickBy=y3,I.property=M3,I.propertyOf=M$,I.pull=aF,I.pullAll=ZS,I.pullAllBy=sF,I.pullAllWith=oF,I.pullAt=lF,I.range=k$,I.rangeRight=T$,I.rearg=EB,I.reject=uB,I.remove=uF,I.rest=_B,I.reverse=Fp,I.sampleSize=hB,I.set=Oz,I.setWith=Cz,I.shuffle=dB,I.slice=cF,I.sortBy=pB,I.sortedUniq=mF,I.sortedUniqBy=yF,I.split=Jz,I.spread=SB,I.tail=bF,I.take=wF,I.takeRight=xF,I.takeRightWhile=EF,I.takeWhile=_F,I.tap=BF,I.throttle=MB,I.thru=Nh,I.toArray=f3,I.toPairs=b3,I.toPairsIn=w3,I.toPath=N$,I.toPlainObject=p3,I.transform=Az,I.unary=kB,I.union=SF,I.unionBy=MF,I.unionWith=kF,I.uniq=TF,I.uniqBy=OF,I.uniqWith=CF,I.unset=Pz,I.unzip=Bp,I.unzipWith=JS,I.update=Nz,I.updateWith=Rz,I.values=dl,I.valuesIn=Lz,I.without=AF,I.words=_3,I.wrap=TB,I.xor=PF,I.xorBy=NF,I.xorWith=RF,I.zip=LF,I.zipObject=IF,I.zipObjectDeep=DF,I.zipWith=FF,I.entries=b3,I.entriesIn=w3,I.extend=v3,I.extendWith=zh,Yp(I,I),I.add=L$,I.attempt=S3,I.camelCase=Bz,I.capitalize=x3,I.ceil=I$,I.clamp=Iz,I.clone=CB,I.cloneDeep=PB,I.cloneDeepWith=NB,I.cloneWith=AB,I.conformsTo=RB,I.deburr=E3,I.defaultTo=f$,I.divide=D$,I.endsWith=zz,I.eq=Si,I.escape=$z,I.escapeRegExp=jz,I.every=YF,I.find=KF,I.findIndex=US,I.findKey=uz,I.findLast=ZF,I.findLastIndex=YS,I.findLastKey=cz,I.floor=F$,I.forEach=t3,I.forEachRight=e3,I.forIn=hz,I.forInRight=dz,I.forOwn=fz,I.forOwnRight=gz,I.get=Wp,I.gt=LB,I.gte=IB,I.has=mz,I.hasIn=Gp,I.head=KS,I.identity=vr,I.includes=nB,I.indexOf=Z7,I.inRange=Dz,I.invoke=wz,I.isArguments=oo,I.isArray=zt,I.isArrayBuffer=DB,I.isArrayLike=gr,I.isArrayLikeObject=tn,I.isBoolean=FB,I.isBuffer=os,I.isDate=BB,I.isElement=zB,I.isEmpty=$B,I.isEqual=jB,I.isEqualWith=qB,I.isError=jp,I.isFinite=WB,I.isFunction=ya,I.isInteger=u3,I.isLength=Fh,I.isMap=c3,I.isMatch=GB,I.isMatchWith=VB,I.isNaN=HB,I.isNative=UB,I.isNil=XB,I.isNull=YB,I.isNumber=h3,I.isObject=qe,I.isObjectLike=Ye,I.isPlainObject=Eu,I.isRegExp=qp,I.isSafeInteger=KB,I.isSet=d3,I.isString=Bh,I.isSymbol=Rr,I.isTypedArray=hl,I.isUndefined=ZB,I.isWeakMap=JB,I.isWeakSet=QB,I.join=nF,I.kebabCase=qz,I.last=ii,I.lastIndexOf=rF,I.lowerCase=Wz,I.lowerFirst=Gz,I.lt=tz,I.lte=ez,I.max=B$,I.maxBy=z$,I.mean=$$,I.meanBy=j$,I.min=q$,I.minBy=W$,I.stubArray=Kp,I.stubFalse=Zp,I.stubObject=O$,I.stubString=C$,I.stubTrue=A$,I.multiply=G$,I.nth=iF,I.noConflict=w$,I.noop=Xp,I.now=Lh,I.pad=Vz,I.padEnd=Hz,I.padStart=Uz,I.parseInt=Yz,I.random=Fz,I.reduce=oB,I.reduceRight=lB,I.repeat=Xz,I.replace=Kz,I.result=Tz,I.round=V$,I.runInContext=U,I.sample=cB,I.size=fB,I.snakeCase=Zz,I.some=gB,I.sortedIndex=hF,I.sortedIndexBy=dF,I.sortedIndexOf=fF,I.sortedLastIndex=gF,I.sortedLastIndexBy=pF,I.sortedLastIndexOf=vF,I.startCase=Qz,I.startsWith=t$,I.subtract=H$,I.sum=U$,I.sumBy=Y$,I.template=e$,I.times=P$,I.toFinite=ba,I.toInteger=Yt,I.toLength=g3,I.toLower=n$,I.toNumber=ai,I.toSafeInteger=nz,I.toString=de,I.toUpper=r$,I.trim=i$,I.trimEnd=a$,I.trimStart=s$,I.truncate=o$,I.unescape=l$,I.uniqueId=R$,I.upperCase=u$,I.upperFirst=Vp,I.each=t3,I.eachRight=e3,I.first=KS,Yp(I,function(){var f={};return Wi(I,function(y,E){fe.call(I.prototype,E)||(f[E]=y)}),f}(),{chain:!1}),I.VERSION=n,Qr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(f){I[f].placeholder=I}),Qr(["drop","take"],function(f,y){re.prototype[f]=function(E){E=E===e?1:bn(Yt(E),0);var C=this.__filtered__&&!y?new re(this):this.clone();return C.__filtered__?C.__takeCount__=Vn(E,C.__takeCount__):C.__views__.push({size:Vn(E,K),type:f+(C.__dir__<0?"Right":"")}),C},re.prototype[f+"Right"]=function(E){return this.reverse()[f](E).reverse()}}),Qr(["filter","map","takeWhile"],function(f,y){var E=y+1,C=E==q||E==$;re.prototype[f]=function(N){var D=this.clone();return D.__iteratees__.push({iteratee:Tt(N,3),type:E}),D.__filtered__=D.__filtered__||C,D}}),Qr(["head","last"],function(f,y){var E="take"+(y?"Right":"");re.prototype[f]=function(){return this[E](1).value()[0]}}),Qr(["initial","tail"],function(f,y){var E="drop"+(y?"":"Right");re.prototype[f]=function(){return this.__filtered__?new re(this):this[E](1)}}),re.prototype.compact=function(){return this.filter(vr)},re.prototype.find=function(f){return this.filter(f).head()},re.prototype.findLast=function(f){return this.reverse().find(f)},re.prototype.invokeMap=Zt(function(f,y){return typeof f=="function"?new re(this):this.map(function(E){return vu(E,f,y)})}),re.prototype.reject=function(f){return this.filter(Dh(Tt(f)))},re.prototype.slice=function(f,y){f=Yt(f);var E=this;return E.__filtered__&&(f>0||y<0)?new re(E):(f<0?E=E.takeRight(-f):f&&(E=E.drop(f)),y!==e&&(y=Yt(y),E=y<0?E.dropRight(-y):E.take(y-f)),E)},re.prototype.takeRightWhile=function(f){return this.reverse().takeWhile(f).reverse()},re.prototype.toArray=function(){return this.take(K)},Wi(re.prototype,function(f,y){var E=/^(?:filter|find|map|reject)|While$/.test(y),C=/^(?:head|last)$/.test(y),N=I[C?"take"+(y=="last"?"Right":""):y],D=C||/^find/.test(y);N&&(I.prototype[y]=function(){var W=this.__wrapped__,G=C?[1]:arguments,Y=W instanceof re,nt=G[0],rt=Y||zt(W),ot=function(ee){var ie=N.apply(I,ts([ee],G));return C&&xt?ie[0]:ie};rt&&E&&typeof nt=="function"&&nt.length!=1&&(Y=rt=!1);var xt=this.__chain__,Mt=!!this.__actions__.length,Ot=D&&!xt,Kt=Y&&!Mt;if(!D&&rt){W=Kt?W:new re(this);var Ct=f.apply(W,G);return Ct.__actions__.push({func:Nh,args:[ot],thisArg:e}),new ei(Ct,xt)}return Ot&&Kt?f.apply(this,G):(Ct=this.thru(ot),Ot?C?Ct.value()[0]:Ct.value():Ct)})}),Qr(["pop","push","shift","sort","splice","unshift"],function(f){var y=ih[f],E=/^(?:push|sort|unshift)$/.test(f)?"tap":"thru",C=/^(?:pop|shift)$/.test(f);I.prototype[f]=function(){var N=arguments;if(C&&!this.__chain__){var D=this.value();return y.apply(zt(D)?D:[],N)}return this[E](function(W){return y.apply(zt(W)?W:[],N)})}}),Wi(re.prototype,function(f,y){var E=I[y];if(E){var C=E.name+"";fe.call(sl,C)||(sl[C]=[]),sl[C].push({name:y,func:E})}}),sl[Mh(e,b).name]=[{name:"wrapper",func:e}],re.prototype.clone=l9,re.prototype.reverse=u9,re.prototype.value=c9,I.prototype.at=zF,I.prototype.chain=$F,I.prototype.commit=jF,I.prototype.next=qF,I.prototype.plant=GF,I.prototype.reverse=VF,I.prototype.toJSON=I.prototype.valueOf=I.prototype.value=HF,I.prototype.first=I.prototype.head,uu&&(I.prototype[uu]=WF),I},rl=j8();Qs?((Qs.exports=rl)._=rl,U0._=rl):In._=rl}).call(Ma)})(Jf,Jf.exports);var Yd=Jf.exports;const Cpt={class:"ai-search-container"},Apt={key:0,class:"search-results"},Ppt={__name:"index",setup(r){const t=ce(""),e=ce(!1),n=ce(!1),i=ce(1e3),a=ce("思维导图"),s=ce([]),o=ce([]),l=ce(!1),u=ce(""),c=ce(!0),h=ce([]);Tc(async()=>{const j=ce([]),{data:{kbs:$}}=await Aj();$&&(j.value=$,o.value=s.value.filter(B=>j.value.some(F=>F.id===B)))});const{send:g,answer:p,done:v}=Tpt(mpt),{testChunk:m}=Mpt(),b={chunks:[{chunk_id:"dfb302c677d12caa",content_ltks:"为 进一步 明确 500 千伏 三林 站 gi 气室 故障 原因 设备 中心 于 12 月 组织 开展 母线 导体 连接处 接触不良 发热 烧熔 的 复现 试验 以 修复 后 的 故障 气室 为 研究 对象 模拟 因 螺栓 松动 导致 的 导体 接触不良 缺陷 复现 烧熔 现象 本次 触头 发热 复现 试验 中 模拟 通过 四颗 螺栓 进行 导流 调整 接触 电阻 至 毫 欧 级 施加 800 a 电流 在 持续 数 小时 后 触头",content_with_weight:"为进一步明确500千伏三林站…GIS气室故障原因,设备中心于12月组织开展母线导体连接处接触不良、发热烧熔的复现试验。以修复后的故障气室为研究对象,模拟因螺栓松动导致的导体接触不良缺陷,复现烧熔现象。本次触头发热复现试验中,模拟通过四颗螺栓进行导流,调整接触电阻至毫欧级,施加800A电流,在持续数小时后触头",doc_id:"fef62ff8ea9711efa8250242ac120006",docnm_kwd:"《设备技术中心工作动态》2024年第1期.pdf",highlight:"为进一步明确500千伏三林站 gi气室故障原因设备中心于 12月组织开展母线导体连接处接触不良发热烧熔的复现试验以 <em>修复</em>后的故障气室为研究",image_id:"da47dcbaea9711ef94400242ac120006-dfb302c677d12caa",important_kwd:[],kb_id:"da47dcbaea9711ef94400242ac120006",positions:[[10,74,264,520,705]],similarity:.8448677925218482,term_similarity:1,vector_similarity:.4828926417394943},{chunk_id:"b4551e204904b0bc",content_ltks:"应急 响应 220 千伏 万荣 站 闸刀 内部 机构 异常 技术 支撑 11 月 1 日 , 万荣 站 配合 天宝 站 2号 主 变 调换 启动 方式 恢复 操作 中 合 上 220 千伏 1号 母 联 开关 合 后 , 发现 1号 母 联 开关 三相 电流 不 平衡 , 调取 历史潮流 数据分析 认为 荣仁 2b 58 正 母 闸刀 可能 存在 异常 。 随后 现场 召开 会议 制定 了 差异化 运维 措施 。 11 月 13 日 开始 , 公司 安排 检修 计划 对 2b 58 正 母 闸刀 b 相 进行 解体 检查和 修复 工作 , 电科院 技术人员 现场 见证 了 现场 缺陷 检查和 分析 工作 。 初步 分析 认为 缺陷 主要 原因 是 固定 夹 叉 的 螺栓 松动 。 11 月 18 日 , 该站 在 用 x射线 进行 闸刀 隐患 排查 时 , 发现 石 荣 2136 付 母 闸刀 a 相 内部 夹 叉 也 存在 松动 现象 。 公司 立即 安排 解体 检修 , 拆开 后 发现 夹 叉 有 轻微 倾斜 移位 , 紧固 夹 叉 的 螺栓 明显 松动 , 然后 公司 对 机构 进行 了 修复 工作 。 由于 两把 闸刀 均 出现 同 类型 的 缺陷 , 公司 组织 召开 了 专题 分析 讨论 会议 , 制定 了 下 一步 工作 计划 。 ( 文 : 胡 正 勇 )",content_with_weight:"应急响应220千伏万荣站闸刀内部机构异常技术支撑11月1日,万荣站配合天宝站2号主变调换启动方式恢复操作中合上220千伏1号母联开关合后,发现1号母联开关三相电流不平衡,调取历史潮流数据分析认为荣仁2B58正母闸刀可能存在异常。随后现场召开会议制定了差异化运维措施。11月13日开始,公司安排检修计划对2B58正母闸刀B相进行解体检查和修复工作,电科院技术人员现场见证了现场缺陷检查和分析工作。初步分析认为缺陷主要原因是固定夹叉的螺栓松动。11月18日,该站在用X射线进行闸刀隐患排查时,发现石荣2136付母闸刀A相内部夹叉也存在松动现象。公司立即安排解体检修,拆开后发现夹叉有轻微倾斜移位,紧固夹叉的螺栓明显松动,然后公司对机构进行了修复工作。由于两把闸刀均出现同类型的缺陷,公司组织召开了专题分析讨论会议,制定了下一步工作计划。(文:胡正勇)",doc_id:"cb5a8c5ac2a311ef82860242ac1b0006",docnm_kwd:"《设备技术中心工作动态》2023年第12期.pdf",highlight:"11月13日开始,公司安排检修计划对 2b 58正母闸刀b相进行解体检查和<em>修复</em>工作,电科院技术人员现场见证了现场缺陷检查和分析工作。...公司立即安排解体检修,拆开后发现夹叉有轻微倾斜移位,紧固夹叉的螺栓明显松动,然后公司对机构进行了 <em>修复</em>工作。",image_id:"9aa72c1cc2a311ef8d280242ac1b0006-b4551e204904b0bc",important_kwd:[],kb_id:"9aa72c1cc2a311ef8d280242ac1b0006",positions:[[25,91,523,297,324],[25,88,520,332,514]],similarity:.8445477432805392,term_similarity:1,vector_similarity:.4818258109351308},{chunk_id:"81346015403dcd12",content_ltks:"开展 三林 站 母线 修复 高风险 作业 督查 2023 年 11 月 , 生产 管控 室 组织 浦东 和 松江 公司 专家 开展 三林 站 三 母线 修复 二级 高风险 作业 的 作业 督查 工作 。 2023 年 10 月 , 三林 站 三 母线 跳闸 , 现场 发现 三 母线 气室 外壳 有 击 穿孔 。 事故 发生 后 , 超高压 公司 隔离 了 故障 母线 。 进 博会 保 电 结束 后 , 超高压 公司 开始 开展 母线 修复 工作 。 根据 国网公司 “ 五级 五 控 ” 的 要求 , 上海市 生产 管控 中心 生产 管控 室 组织 浦东 公司 和 青浦 公司 专家 于 2023 年 11 月 21 日和 22 日 两次 去 现场 进行 作业 督查 。 督查 过程 中 , 现场 正 开展 母线 抽 真空 和 分段 开关 机构 渗 油 处理 , 现场 作业 督查 过程 中 未 发现 问题 。 ( 文 : 吴 天逸 )",content_with_weight:"开展三林站母线修复高风险作业督查2023年11月,生产管控室组织浦东和松江公司专家开展三林站三母线修复二级高风险作业的作业督查工作。2023年10月,三林站三母线跳闸,现场发现三母线气室外壳有击穿孔。事故发生后,超高压公司隔离了故障母线。进博会保电结束后,超高压公司开始开展母线修复工作。根据国网公司“五级五控”的要求,上海市生产管控中心生产管控室组织浦东公司和青浦公司专家于2023年11月21日和22日两次去现场进行作业督查。督查过程中,现场正开展母线抽真空和分段开关机构渗油处理,现场作业督查过程中未发现问题。(文:吴天逸)",doc_id:"cb5a8c5ac2a311ef82860242ac1b0006",docnm_kwd:"《设备技术中心工作动态》2023年第12期.pdf",highlight:"开展三林站母线<em>修复</em>高风险作业督查2023年11月,生产管控室组织浦东和松江公司专家开展三林站三母线<em>修复</em>二级高风险作业的作业督查工作。...进博会保电结束后 ,超高压公司开始开展母线<em>修复</em>工作。",image_id:"9aa72c1cc2a311ef8d280242ac1b0006-81346015403dcd12",important_kwd:[],kb_id:"9aa72c1cc2a311ef8d280242ac1b0006",positions:[[35,94,526,571,588],[35,88,520,597,723]],similarity:.8438986441373534,term_similarity:1,vector_similarity:.47966214712451133},{chunk_id:"92b840b911f4d3da",content_ltks:"7 月 期间 , 在 电科院 设备 中心 的 协调 组织 下 , 南瑞 信通 、 北京 信 普达 、 上海 翊 邦 项目组 的 相关 专业 人员 进行 了 长达 一个月 的 项目 内部测试 工作 , 7 月 25 日 , 项目组 总结 了 工业 互联网 设备 远程 运维 模块 的 改进 和 部署 实施 情况 , 并 制定 了 8 月份 的 bug 修复 和 系统 部署 计划 。 … 针对 于 目前 系统 存在 的 问题 和 部署 执行 方 解决问题 能力 不足 的 情况 , 项目组 已 与 南瑞 信通 协商 并 达成 一致意见 , 在 接下来 的 建设 和 部署 工作 中 , 南瑞 信通 将 派遣 新 的 项目 成员 入 组 进行 系统 完善 以及 功能测试 , 坚决 在 规定 时间 内 保质保量 地 如期完成 项目 所有 功能 。 ( 文 : 彭 政 睿 )",content_with_weight:"7月期间,在电科院设备中心的协调组织下,南瑞信通、北京信普达、上海翊邦项目组的相关专业人员进行了长达一个月的项目内部测试工作,7月25日,项目组总结了工业互联网设备远程运维模块的改进和部署实施情况,并制定了8月份的BUG修复和系统部署计划。…针对于目前系统存在的问题和部署执行方解决问题能力不足的情况,项目组已与南瑞信通协商并达成一致意见,在接下来的建设和部署工作中,南瑞信通将派遣新的项目成员入组进行系统完善以及功能测试,坚决在规定时间内保质保量地如期完成项目所有功能。(文:彭政睿)",doc_id:"c57a96e0c2a311ef82860242ac1b0006",docnm_kwd:"《设备技术中心工作动态》2023年第8期 - 副本.pdf",highlight:"了长达一个月的项目内部测试工作, 7月25日,项目组总结了工业互联网设备远程运维模块的改进和部署实施情况,并制定了 8月份的 bug <em>修复</em>",image_id:"9aa72c1cc2a311ef8d280242ac1b0006-92b840b911f4d3da",important_kwd:[],kb_id:"9aa72c1cc2a311ef8d280242ac1b0006",positions:[[36,87,519,312,437]],similarity:.8438452874204787,term_similarity:1,vector_similarity:.4794842914015958},{chunk_id:"0ac501cf467e1f56",content_ltks:"7 月 期间 , 在 电科院 设备 中心 的 协调 组织 下 , 南瑞 信通 、 北京 信 普达 、 上海 翊 邦 项目组 的 相关 专业 人员 进行 了 长达 一个月 的 项目 内部测试 工作 , 7 月 25 日 , 项目组 总结 了 工业 互联网 设备 远程 运维 模块 的 改进 和 部署 实施 情况 , 并 制定 了 8 月份 的 bug 修复 和 系统 部署 计划 。 … 针对 于 目前 系统 存在 的 问题 和 部署 执行 方 解决问题 能力 不足 的 情况 , 项目组 已 与 南瑞 信通 协商 并 达成 一致意见 , 在 接下来 的 建设 和 部署 工作 中 , 南瑞 信通 将 派遣 新 的 项目 成员 入 组 进行 系统 完善 以及 功能测试 , 坚决 在 规定 时间 内 保质保量 地 如期完成 项目 所有 功能 。 ( 文 : 彭 政 睿 )",content_with_weight:"7月期间,在电科院设备中心的协调组织下,南瑞信通、北京信普达、上海翊邦项目组的相关专业人员进行了长达一个月的项目内部测试工作,7月25日,项目组总结了工业互联网设备远程运维模块的改进和部署实施情况,并制定了8月份的BUG修复和系统部署计划。…针对于目前系统存在的问题和部署执行方解决问题能力不足的情况,项目组已与南瑞信通协商并达成一致意见,在接下来的建设和部署工作中,南瑞信通将派遣新的项目成员入组进行系统完善以及功能测试,坚决在规定时间内保质保量地如期完成项目所有功能。(文:彭政睿)",doc_id:"c6075116c2a311ef82860242ac1b0006",docnm_kwd:"《设备技术中心工作动态》2023年第8期.pdf",highlight:"了长达一个月的项目内部测试工作, 7月25日,项目组总结了工业互联网设备远程运维模块的改进和部署实施情况,并制定了 8月份的 bug <em>修复</em>",image_id:"9aa72c1cc2a311ef8d280242ac1b0006-0ac501cf467e1f56",important_kwd:[],kb_id:"9aa72c1cc2a311ef8d280242ac1b0006",positions:[[36,87,519,312,437]],similarity:.8434534957462398,term_similarity:1,vector_similarity:.47817831915413295},{chunk_id:"49a3df09c2b1496d",content_ltks:"2023 年 11 月 在 万荣 站 220 千伏 gi 完成 相关 闸刀 机构 缺陷 修复 工作 后 电科院 对 220 千伏 gi 相关 间隔 安装 了 全站 域 无线 局 放 连续 监测 装置 监测数据 显示 部分 测点 存在 小幅 值 强 间歇性 的 特高频 局 放 信号 为 核实 复测 在线 监测数据 并 进行 定位 电科院 带电 检测 人员 于 2023 年 12 月 8 日 14 日 15 日 21 日 对 万荣 站 220 千伏 设",content_with_weight:"2023年11月,在万荣站220千伏GIS完成相关闸刀机构缺陷修复工作后,电科院对220千伏GIS相关间隔安装了全站域无线局放连续监测装置,监测数据显示部分测点存在小幅值强间歇性的特高频局放信号。为核实复测在线监测数据并进行定位,电科院带电检测人员于2023 年12 月8 日、14 日-15日、21日,对万荣站220千伏设",doc_id:"fef62ff8ea9711efa8250242ac120006",docnm_kwd:"《设备技术中心工作动态》2024年第1期.pdf",highlight:"2023年11月在万荣站 220千伏gi完成相关闸刀机构缺陷<em>修复</em>工作后电科院对 220千伏gi相关间隔安装了全站域无线局放连续监测装置监测数据",image_id:"da47dcbaea9711ef94400242ac120006-49a3df09c2b1496d",important_kwd:[],kb_id:"da47dcbaea9711ef94400242ac120006",positions:[[21,335,522,178,361]],similarity:.8422425543227802,term_similarity:1,vector_similarity:.47414184774260076},{chunk_id:"947fe2f63e6589e4",content_ltks:"院 现场 支撑 500 kv 三林 站 220 kv … gi 母线 消 缺 工作 , 对 拆解 下 的 母线 导体 连接结构 进行 查看 。 设备部 现场 组织 召开 了 情况 分析 会 和 母线 三相 电流 不 平衡 讨论会 , 针对 母线 出现 三相 不 平衡 电流 , 如何 快速 查找 可疑 位置 的 问题 , 电科院 结合 现有 计算 分析方法 , 提出 了 用 电流 绝对值 代替 向 量值 的 计算 方案 。 为 保障 本次 设备 的 顺利 投运 , 电科院 于 11 月 23-24 日 该站 gi 设备 耐压 期间 , 同步 利用 开关设备 交流 耐压 试验 放电 故障 定位系统 , 以及 声学 可视化 击穿 定位系统 进行 耐压 闪络 定位 监测 , 测试 过程 中 未 发现异常 信号 , 设备 顺利 投运 。 11 月 29 日 , 公司 设备部 组织 电科院 、 超高压 、 厂家 等 各 单位 于 电科院 开展 故障 间隔 解体 分析 , 国网 设备部 、 中国 电科院 远程 出席 并 全过程 见证 , 特邀 专家 刘 兆 林 参会 。 会上 , 运维 单位 和 厂家 分别 介绍 了 故障 gi 修复 情况 、 解体 方案 , 电科院 对 复现 试验 方案 进行 了 汇报 。 解体 发现 熔融 金属 来源于 触 指 弹簧 。 国网 设备部 、 中国 电科院 和 参会 专家 结合 解体 情况 对 故障 原因 讨论 和 明确 , 同时 认为 该 事件 是 一起 典型 的 设备 自身 缺陷 导致 的 故障 。 为 对 故障 根源 进行 进一步 验证 , 电科院 将 于 故障 解体 分析 后 , 对 故障 gi 母线 气室 开展 触头 接触不良 、 发热 烧熔 的 复现 试验 。 ( 文 / 图 : 刘 忠 岳 )",content_with_weight:"院现场支撑500kV三林站220kV…GIS母线消缺工作,对拆解下的母线导体连接结构进行查看。设备部现场组织召开了情况分析会和母线三相电流不平衡讨论会,针对母线出现三相不平衡电流,如何快速查找可疑位置的问题,电科院结合现有计算分析方法,提出了用电流绝对值代替向量值的计算方案。为保障本次设备的顺利投运,电科院于11月23-24日该站GIS设备耐压期间,同步利用开关设备交流耐压试验放电故障定位系统,以及声学可视化击穿定位系统进行耐压闪络定位监测,测试过程中未发现异常信号,设备顺利投运。11月29日,公司设备部组织电科院、超高压、厂家等各单位于电科院开展故障间隔解体分析,国网设备部、中国电科院远程出席并全过程见证,特邀专家刘兆林参会。会上,运维单位和厂家分别介绍了故障GIS修复情况、解体方案,电科院对复现试验方案进行了汇报。解体发现熔融金属来源于触指弹簧。国网设备部、中国电科院和参会专家结合解体情况对故障原因讨论和明确,同时认为该事件是一起典型的设备自身缺陷导致的故障。为对故障根源进行进一步验证,电科院将于故障解体分析后,对故障GIS母线气室开展触头接触不良、发热烧熔的复现试验。(文/图:刘忠岳)",doc_id:"cb5a8c5ac2a311ef82860242ac1b0006",docnm_kwd:"《设备技术中心工作动态》2023年第12期.pdf",highlight:"会上,运维单位和厂家分别介绍了故障gi <em>修复</em>情况、解体方案,电科院对复现试验方案进行了汇报。解体发现熔融金属来源于触指弹簧。",image_id:"9aa72c1cc2a311ef8d280242ac1b0006-947fe2f63e6589e4",important_kwd:[],kb_id:"9aa72c1cc2a311ef8d280242ac1b0006",positions:[[11,88,520,312,571]],similarity:.8385149276383687,term_similarity:1,vector_similarity:.46171642546122904},{chunk_id:"109e6d02f73f96ae",content_ltks:"推进 工业 互联网 设备 远程 运维 测试 及 完善 工作 8 月 22 日 下午 , 工业 互联网 项目组 在 汇泰 大楼 现场 召开 “ 工业 互联网 设备 远程 运维 建设 推进 会 ” 。 此次 会议 参会 公司 为 电科院 、 南瑞 信通 、 北京 信 普达 、 上海 翊 邦 项目组 的 相关 负责人 , 项目组 各 建设部门 汇报 了 工业 互联网 设备 远程 运维 功能 改进 和 部署 实施 情况 。 8 月前 半月 , 项目组 按 详细 设计方案 归纳 出 了 项目 的 测试 大纲 , 并 根据 项目 大纲 进行 了 全面 的 测试 。 结果显示 , 除去 与 i 6000 相关 的 人员 权限 之类 的 功能 , 其余 大部分 功能 已 建设 完成 。 但 在 数据 方面 , 由于 pm 数据 质量 及其 他 问题 , 导致 项目 获取 的 数据 质量 仍然 不 完善 , 后续 将 针对 当前 已 测试 出 的 数据 问题 和 归集 共享 页面 的 问题 进行 改进 。 截至 目前 , i 6000 接入 测试 已 完成 , 上线 试运行 资料 已 提交 , 整个 设备 远程 运维 平台 具备 了 上线 试运行 部署 条件 。 在 南瑞 和 科大 企业 节点 对接 的 工作 上 , 因 国网 安全 攻防 演练 暂时 延后 , 演练 结束 后 , 项目组 将 协调 信通 公司 网 安室 对 相关 功能 进行 支撑 。 接下来 , 项目组 将 持续 关注 生产 环境 部署 实施 , 地址 转换 以及 pc 端 概况 页面 样式 修改 工作 , 确保 系统 功能 的 用户 使用 体验 , 不断 优化 业务 功能 , 并 针对 问题 清单 , 协调 各部 门 加快 问题 修复 。 ( 文 : 彭 政 睿 )",content_with_weight:"推进工业互联网设备远程运维测试及完善工作8月22日下午,工业互联网项目组在汇泰大楼现场召开“工业互联网设备远程运维建设推进会”。此次会议参会公司为电科院、南瑞信通、北京信普达、上海翊邦项目组的相关负责人,项目组各建设部门汇报了工业互联网设备远程运维功能改进和部署实施情况。8月前半月,项目组按详细设计方案归纳出了项目的测试大纲,并根据项目大纲进行了全面的测试。结果显示,除去与i6000相关的人员权限之类的功能,其余大部分功能已建设完成。但在数据方面,由于PMS数据质量及其他问题,导致项目获取的数据质量仍然不完善,后续将针对当前已测试出的数据问题和归集共享页面的问题进行改进。截至目前,i6000接入测试已完成,上线试运行资料已提交,整个设备远程运维平台具备了上线试运行部署条件。在南瑞和科大企业节点对接的工作上,因国网安全攻防演练暂时延后,演练结束后,项目组将协调信通公司网安室对相关功能进行支撑。接下来,项目组将持续关注生产环境部署实施,地址转换以及PC端概况页面样式修改工作,确保系统功能的用户使用体验,不断优化业务功能,并针对问题清单,协调各部门加快问题修复。(文:彭政睿)",doc_id:"c70bb142c2a311ef82860242ac1b0006",docnm_kwd:"《设备技术中心工作动态》2023年第9期.pdf",highlight:"实施,地址转换以及pc端概况页面样式修改工作,确保系统功能的用户使用体验,不断优化业务功能,并针对问题清单,协调各部门加快问题<em>修复</em>",image_id:"9aa72c1cc2a311ef8d280242ac1b0006-109e6d02f73f96ae",important_kwd:[],kb_id:"9aa72c1cc2a311ef8d280242ac1b0006",positions:[[49,85,517,114,132],[49,76,508,141,380]],similarity:.8375257435045269,term_similarity:1,vector_similarity:.45841914501508996},{chunk_id:"1579874bce44ab41",content_ltks:"3 月 27 日 - 31 日 , 根据 公司 设备部 要求 , 设备 中心 赴 吴江 变压器厂 开展 南桥 换 流变 返 厂 检修 技术 监督 工作 。 该台 南桥 换流 变因 产 氢 问题 , 于 2022 年 11 月 返 厂 检修 , 电科院 进行 全程 技术 监督 。 结合 此次 返 厂 检修 机会 , 电科院 开展 了 换 流变 寿命 评估 相关 工作 , 对 绝缘纸 、 绝缘油 、 密封件 、 继电器 、 表计 等 组 部件 进行 取样 检测 , 评估 老化 状态 。 29 日 , 上海 公司 在 吴江 变压器厂 组织 召开 南桥 换 流变 检修 总结会 , 会议 对 南桥 换 流变 检修 过程 中 发现 的 问题 , 修复 处理 措施 , 以及 产 气 原因 进行 了 讨论 分析 , 明确 了 发货 时间 及 检修 总结报告 编制 要求 。 目前 , 该换 流变 已 顺利 通过 出厂 试验 , 具备 发往 现场 条件 。 待 换 流变 运至 现场 后 , 电科院 将 对 现场 安装 过程 进行 监督 , 并 开展 局 放 试验 , 以 验证 其 绝缘 状态 是否 良好 。 ( 文 : 崔 律 )",content_with_weight:"3月27日-31日,根据公司设备部要求,设备中心赴吴江变压器厂开展南桥换流变返厂检修技术监督工作。该台南桥换流变因产氢问题,于2022年11月返厂检修,电科院进行全程技术监督。结合此次返厂检修机会,电科院开展了换流变寿命评估相关工作,对绝缘纸、绝缘油、密封件、继电器、表计等组部件进行取样检测,评估老化状态。29日,上海公司在吴江变压器厂组织召开南桥换流变检修总结会,会议对南桥换流变检修过程中发现的问题,修复处理措施,以及产气原因进行了讨论分析,明确了发货时间及检修总结报告编制要求。目前,该换流变已顺利通过出厂试验,具备发往现场条件。待换流变运至现场后,电科院将对现场安装过程进行监督,并开展局放试验,以验证其绝缘状态是否良好。(文:崔律)",doc_id:"c3257f7cc2a311ef82860242ac1b0006",docnm_kwd:"《设备技术中心工作动态》2023年第4期.pdf",highlight:"29日,上海公司在吴江变压器厂组织召开南桥换流变检修总结会,会议对南桥换流变检修过程中发现的问题, <em>修复</em>处理措施,以及产气原因进行",image_id:"9aa72c1cc2a311ef8d280242ac1b0006-1579874bce44ab41",important_kwd:[],kb_id:"9aa72c1cc2a311ef8d280242ac1b0006",positions:[[35,76,507,542,706]],similarity:.8369589835828704,term_similarity:1,vector_similarity:.45652994527623464},{chunk_id:"d466025984fd23ec",content_ltks:"为了 有序 推进 了 相关 改造 工作 4 月 12 日 国网 江苏省 电力 有限公司 超高压 公司 组织 召开 无锡 500 kv 岷 珠 变 5220 线 5042 流变 改造 方案 评审会 相关 与会 单位 审查 并 通过 了 上述 流变 的 改造 方案 本次 涉及 造 的 流变 为 阿海 珐 输配电 上海 互感器 有限公司 生产 运行 时间 已有 12 年 设备 老 旧 绝缘 水平 低 且 此 型号 设备 具有 家族 性 缺陷 无法 修复 影响 电网 供电 可靠性 根据 国家电网 设备 2024 7 号 国家电网 有限公司 关于 开展 2024 年 电网 设备 重点 隐患 排查 治理 工作 的 通知 的 最新 要求 上海 雷 兹 阿海 珐 流变 投运 15 年 以上 油 漫 正 立式 流变 缺陷 批次 mwb 流变 2006 年 11 12 月 出厂 需 在 2024 年底 前 完成 治理",content_with_weight:"为了有序推进了相关改造工作,4月12日,国网江苏省电力有限公司超高压公司组织召开无锡500kV岷珠变5220线5042流变改造方案评审会,相关与会单位审查并通过了上述流变的改造方案。本次涉及造的流变为阿海珐输配电(上海)互感器有限公司生产,运行时间已有12年,设备老旧,绝缘水平低,且此型号设备具有家族性缺陷,无法修复,影响电网供电可靠性。根据国家电网设备(2024)7号《国家电网有限公司关于开展2024年电网设备重点隐患排查治理工作的通知》的最新要求,上海雷兹(阿海珐)流变、投运15年以上油漫正立式流变、缺陷批次…MWB…流变(2006年11-12月出厂)需在2024年底前完成治理。",doc_id:"058e6a60ea9811efa8250242ac120006",docnm_kwd:"《设备技术中心工作动态》2024年第5期.pdf",highlight:"的改造方案本次涉及造的流变为阿海珐输配电上海互感器有限公司生产运行时间已有12年设备老旧绝缘水平低且此型号设备具有家族性缺陷无法<em>修复</em>",image_id:"da47dcbaea9711ef94400242ac120006-d466025984fd23ec",important_kwd:[],kb_id:"da47dcbaea9711ef94400242ac120006",positions:[[32,74,510,615,761]],similarity:.8347282031212104,term_similarity:1,vector_similarity:.44909401040403474}],doc_aggs:[{count:3,doc_id:"cb5a8c5ac2a311ef82860242ac1b0006",doc_name:"《设备技术中心工作动态》2023年第12期.pdf"},{count:2,doc_id:"fef62ff8ea9711efa8250242ac120006",doc_name:"《设备技术中心工作动态》2024年第1期.pdf"},{count:1,doc_id:"c57a96e0c2a311ef82860242ac1b0006",doc_name:"《设备技术中心工作动态》2023年第8期 - 副本.pdf"},{count:1,doc_id:"c6075116c2a311ef82860242ac1b0006",doc_name:"《设备技术中心工作动态》2023年第8期.pdf"},{count:1,doc_id:"c70bb142c2a311ef82860242ac1b0006",doc_name:"《设备技术中心工作动态》2023年第9期.pdf"},{count:1,doc_id:"c3257f7cc2a311ef82860242ac1b0006",doc_name:"《设备技术中心工作动态》2023年第4期.pdf"},{count:1,doc_id:"058e6a60ea9811efa8250242ac120006",doc_name:"《设备技术中心工作动态》2024年第5期.pdf"}],total:20},{fetchRelatedQuestions:w,data:x}=kpt(),{pagination:_,setPagination:S}=Opt(),M=async j=>{const $=Yd.trim(j);Yd.isEmpty($)||(S({page:1}),c.value=!1,l.value=!0,g({kb_ids:o.value,question:$}),m({kb_id:o.value,highlight:!0,question:$,page:1,size:_.pageSize}),await w($))},k=j=>{l.value||(u.value=j,M(j))},T=(j,$=1,B=10)=>{const F=Yd.trim(u.value);l.value||Yd.isEmpty(F)||m({kb_id:o.value,highlight:!0,question:F,doc_ids:j??h.value,page:$,size:B})};dj(v,j=>{j&&(l.value=!1)});const P=(j,$)=>{console.log("文档点击:",j,$),a.value="文档详情",n.value=!0},O=()=>{a.value="思维导图",n.value=!0},A=(j,$)=>{var B;(B=_.onChange)==null||B.call(_,j,$),T(h.value,j,$)},R=j=>{s.value=j},L=j=>{s.value=j},q=j=>{M(j),e.value=!0};return(j,$)=>{const B=ej,F=dR,V=nj,X=tg,K=sj,dt=cR,ct=yR,ht=tj;return $t(),Ve(oc,null,[un("div",Cpt,[ae(yq,{onUpdateCheckedList:R,onInitSelectedKeys:L}),un("div",{class:Mr(["content-box",{"search-active":e.value}])},[ae(B,{class:"input-search",modelValue:t.value,"onUpdate:modelValue":$[0]||($[0]=lt=>t.value=lt),placeholder:"请输入搜索内容","search-button":"",loading:l.value,onSearch:q},null,8,["modelValue","loading"]),ae(fj,{name:"fade"},{default:ve(()=>{var lt,pt;return[e.value?($t(),Ve("div",Apt,[ae(kq,{content:(lt=ps(p))==null?void 0:lt.answer},null,8,["content"]),ae(F),ae(Eq,{documents:b.doc_aggs,selectedDocumentIds:h.value,onOnFileSelected:T},null,8,["documents","selectedDocumentIds"]),ae(F),ae(vpt,{chunks:b.chunks,highlightWord:t.value,onClickDocumentButton:P},null,8,["chunks","highlightWord"]),ae(F),((pt=ps(x))==null?void 0:pt.length)>0?($t(),dn(K,{key:0,title:"相关问题"},{default:ve(()=>[ae(X,{wrap:""},{default:ve(()=>[($t(!0),Ve(oc,null,eg(ps(x),(wt,Bt)=>($t(),dn(V,{key:Bt,onClick:Ut=>k(wt),class:"related-question-tag"},{default:ve(()=>[pR(uf(wt),1)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})):Ds("",!0),ae(F),ae(dt,{current:ps(_).current,"onUpdate:current":$[1]||($[1]=wt=>ps(_).current=wt),total:b.total,pageSize:ps(_).pageSize,onChange:A},null,8,["current","total","pageSize"]),ae(ct,{class:"floating-btn",shape:"circle",onClick:O},{default:ve(()=>[ae(ps(Dj),{size:"32"})]),_:1})])):Ds("",!0)]}),_:1})],2)]),ae(ht,{visible:n.value,"onUpdate:visible":$[2]||($[2]=lt=>n.value=lt),title:a.value,width:i.value,footer:!1},{default:ve(()=>[ae(J0t)]),_:1},8,["visible","title","width"])],64)}}},Npt=$o(Ppt,[["__scopeId","data-v-a68d008f"]]),Evt={__name:"AISearch",setup(r){return(t,e)=>($t(),dn(Z$,null,{default:ve(()=>[ae(J$,null,{default:ve(()=>[ae(Npt)]),_:1})]),_:1}))}};export{Evt as default};
|