| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- var PN=Object.defineProperty;var A2=r=>{throw TypeError(r)};var NN=(r,t,e)=>t in r?PN(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Ot=(r,t,e)=>NN(r,typeof t!="symbol"?t+"":t,e),xd=(r,t,e)=>t.has(r)||A2("Cannot "+e);var tr=(r,t,e)=>(xd(r,t,"read from private field"),e?e.call(r):t.get(r)),Ed=(r,t,e)=>t.has(r)?A2("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),kl=(r,t,e,n)=>(xd(r,t,"write to private field"),n?n.call(r,e):t.set(r,e),e),Sd=(r,t,e)=>(xd(r,t,"access private method"),e);import RN from"./LayoutExperience-BcRq8UC_.js";import LN from"./ContentContainer-CtVrPS98.js";/* empty css */import{m as DN,c as Xy,V as IN,a as FN,D as BN}from"./ViewerDocxFromUrl-7rDZOVxQ.js";import{S as pM}from"./index-B1mmH5Yz.js";import{C as zN}from"./index-Bjen1fPm.js";import{S as Fu}from"./index-CqRwYcHm.js";import{T as $N}from"./index-BxH3Rpe6.js";import{D as mM}from"./index-zwkpltIk.js";import"./index-Ew_GAvIT.js";import{d as Xi,c as le,o as ct,a as Xt,n as Ko,b as yn,e as Ee,u as Ky,p as _a,s as ee,A as Lt,q as Hn,m as Jr,F as _s,Z as Bu,_ as jN,C as yM,$ as bM,r as Ii,j as Rt,i as qN,x as Zy,S as Jy,v as GN,w as Uc,D as At,I as wM,J as ka,X as yr,B as WN,G as VN,a0 as HN,E as UN}from"./vue-vendor-BSLWZmNt.js";import"./index-CrPgmW1a.js";import{T as YN}from"./index-qxpU9Ih0.js";import{a as Ki,c as qa,d as ks,l as _d,m as kd,s as xM,j as EM,n as XN,p as KN,_ as Zi,u as SM,B as _M,q as rt,r as ZN,t as Yc,v as JN,k as zu,w as P2,x as QN,y as pt,z as W,A as Ut,C as V,D as dt,E as Gi,F as kM,G as Ml,H as Qy,J as tR,g as MM}from"./index-BuZ8RqOW.js";import{I as eR}from"./index-CA_9wWtr.js";import{u as Tm}from"./use-merge-state-CE8KUZP3.js";import{u as nR,L as rR,S as iR}from"./use-responsive-C5llMoFb.js";import{I as aR}from"./index-C4GAysGE.js";import{R as sR}from"./resize-observer-B0bvkKaf.js";import{C as oR,a as lR,i as cR,b as uR,c as CM,S as N2,d as hR,e as dR,f as fR,g as gR,h as vR,j as pR,k as mR}from"./_getTag-C-l7Nylr.js";/* empty css *//* empty css */import{T as yR,a as bR,P as wR}from"./index-BWfVC4HV.js";/* empty css */import{T as xR}from"./index-BMsXtd4H.js";import{P as ER}from"./index-DHBWbPMS.js";import{P as TM}from"./index-Pw-sCBy5.js";import{Q as SR}from"./common-kr3rfyRl.js";import{M as $u}from"./index-rT7you44.js";import"./index-DD-Xchrk.js";import{a as _R}from"./index-CjKQNOS8.js";import"./Header-CqGVECy0.js";import"./use-platform-information-Tmg_jBsj.js";/* empty css */import"./index-C8ta0_dY.js";import"./use-logout-CxM5si9R.js";import"./use-current-user-DPLGGc-j.js";import"./login-Cakk8eY4.js";import"./index-fC5qpfhr.js";import"./index-DKcLuBm9.js";import"./render-function-CrOd21Ym.js";import"./responsive-observe-4ACH6YSC.js";import"./index-wrCOjsDH.js";import"./index.es-BW_FzNZC.js";import"./get-value-by-path-6Qp_6Uo8.js";const kR=Xi({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=qa("icon"),n=Ee(()=>[e,`${e}-attachment`,{[`${e}-spin`]:r.spin}]),i=Ee(()=>{const s={};return r.size&&(s.fontSize=ks(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)}}}}),MR=["stroke-width","stroke-linecap","stroke-linejoin"],CR=Xt("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),TR=[CR];function OR(r,t,e,n,i,a){return ct(),le("svg",{viewBox:"0 0 48 48",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",class:yn(r.cls),style:Ko(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))},TR,14,MR)}var Md=Ki(kR,[["render",OR]]);const AR=Object.assign(Md,{install:(r,t)=>{var e;const n=(e=t==null?void 0:t.iconPrefix)!=null?e:"";r.component(n+Md.name,Md)}}),PR=Xi({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=qa("icon"),n=Ee(()=>[e,`${e}-drag-dot`,{[`${e}-spin`]:r.spin}]),i=Ee(()=>{const s={};return r.size&&(s.fontSize=ks(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)}}}}),NR=["stroke-width","stroke-linecap","stroke-linejoin"],RR=Xt("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),LR=Xt("path",{d:"M40 17v2h-2v-2h2ZM25 17v2h-2v-2h2ZM10 17v2H8v-2h2ZM40 29v2h-2v-2h2ZM25 29v2h-2v-2h2ZM10 29v2H8v-2h2Z"},null,-1),DR=[RR,LR];function IR(r,t,e,n,i,a){return ct(),le("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",class:yn(r.cls),style:Ko(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))},DR,14,NR)}var Cd=Ki(PR,[["render",IR]]);const FR=Object.assign(Cd,{install:(r,t)=>{var e;const n=(e=t==null?void 0:t.iconPrefix)!=null?e:"";r.component(n+Cd.name,Cd)}});var BR=Xi({name:"ResizeTrigger",components:{ResizeObserver:sR,IconDragDot:FR,IconDragDotVertical:aR},props:{prefixCls:{type:String,required:!0},direction:{type:String,default:"horizontal"}},emits:["resize"],setup(r,{emit:t}){const{direction:e,prefixCls:n}=Ky(r),i=Ee(()=>(e==null?void 0:e.value)==="horizontal");return{classNames:Ee(()=>[n.value,{[`${n.value}-horizontal`]:i.value,[`${n.value}-vertical`]:!i.value}]),onResize:o=>{t("resize",o)},isHorizontal:i}}});function zR(r,t,e,n,i,a){const s=_a("IconDragDot"),o=_a("IconDragDotVertical"),l=_a("ResizeObserver");return ct(),ee(l,{onResize:r.onResize},{default:Lt(()=>[Xt("div",{class:yn(r.classNames)},[Hn(" @slot 自定义内容 "),Jr(r.$slots,"default",{},()=>[Xt("div",{class:yn(`${r.prefixCls}-icon-wrapper`)},[Hn(" @slot 自定义 icon "),Jr(r.$slots,"icon",{},()=>[r.isHorizontal?(ct(),ee(s,{key:0,class:yn(`${r.prefixCls}-icon`)},null,8,["class"])):(ct(),ee(o,{key:1,class:yn(`${r.prefixCls}-icon`)},null,8,["class"]))])],2)])],2)]),_:3},8,["onResize"])}var $R=Ki(BR,[["render",zR]]),jR=Object.defineProperty,R2=Object.getOwnPropertySymbols,qR=Object.prototype.hasOwnProperty,GR=Object.prototype.propertyIsEnumerable,L2=(r,t,e)=>t in r?jR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Td=(r,t)=>{for(var e in t||(t={}))qR.call(t,e)&&L2(r,e,t[e]);if(R2)for(var e of R2(t))GR.call(t,e)&&L2(r,e,t[e]);return r};const OM="left",AM="right",t1="top",e1="bottom",WR=[OM,AM,t1,e1];function D2(r,t){if(r===0)return 0;const e=r-t;return e<=0?0:e}function Od(r){return[t1,e1].indexOf(r)>-1}const VR=Xi({name:"ResizeBox",components:{ResizeTrigger:$R},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}=Ky(r),[a,s]=Tm(null,Ii({value:n})),[o,l]=Tm(null,Ii({value:e})),c=Rt(),u=Ii({}),h=qa("resizebox"),d=Ee(()=>[h]),f=Ee(()=>Td(Td(Td({},ks(a.value)?{width:`${a.value}px`}:{}),ks(o.value)?{height:`${o.value}px`}:{}),u)),g=Ee(()=>i.value.filter(w=>WR.includes(w))),v={direction:"",startPageX:0,startPageY:0,startWidth:0,startHeight:0,moving:!1,padding:{left:0,right:0,top:0,bottom:0}};function p(w){if(!v.moving)return;const{startPageX:x,startPageY:S,startWidth:E,startHeight:_,direction:C}=v;let k=E,M=_;const T=w.pageX-x,O=w.pageY-S;switch(C){case OM:k=E-T,s(k),t("update:width",k);break;case AM:k=E+T,s(k),t("update:width",k);break;case t1:M=_-O,l(M),t("update:height",M);break;case e1:M=_+O,l(M),t("update:height",M);break}t("moving",{width:k,height:M},w)}function m(w){v.moving=!1,kd(window,"mousemove",p),kd(window,"mouseup",m),kd(window,"contextmenu",m),document.body.style.cursor="default",t("movingEnd",w)}function y(w,x){var S,E;t("movingStart",x),v.moving=!0,v.startPageX=x.pageX,v.startPageY=x.pageY,v.direction=w;const{top:_,left:C,right:k,bottom:M}=v.padding;v.startWidth=D2(((S=c.value)==null?void 0:S.clientWidth)||0,C+k),v.startHeight=D2(((E=c.value)==null?void 0:E.clientHeight)||0,_+M),_d(window,"mousemove",p),_d(window,"mouseup",m),_d(window,"contextmenu",m),document.body.style.cursor=Od(w)?"row-resize":"col-resize"}function b(w,x){const{width:S,height:E}=x.contentRect,_=Od(w)?E:S;v.padding[w]=_,u[`padding-${w}`]=`${_}px`}return{prefixCls:h,classNames:d,styles:f,wrapperRef:c,onMoveStart:y,isHorizontal:Od,allowDirections:g,onTiggerResize:b}}});function HR(r,t,e,n,i,a){const s=_a("ResizeTrigger");return ct(),ee(bM(r.component),yM({ref:"wrapperRef",class:r.classNames},r.$attrs,{style:r.styles}),{default:Lt(()=>[Jr(r.$slots,"default"),(ct(!0),le(_s,null,Bu(r.allowDirections,o=>(ct(),ee(s,{key:o,"prefix-cls":`${r.prefixCls}-trigger`,class:yn(`${r.prefixCls}-direction-${o}`),direction:r.isHorizontal(o)?"horizontal":"vertical",onMousedown:l=>{r.onMoveStart(o,l)},onResize:l=>{r.onTiggerResize(o,l)}},jN({default:Lt(()=>[r.$slots["resize-trigger"]?Jr(r.$slots,"resize-trigger",{key:0,direction:o}):Hn("v-if",!0)]),_:2},[r.$slots["resize-trigger-icon"]?{name:"icon",fn:Lt(()=>[Jr(r.$slots,"resize-trigger-icon",{direction:o})])}:void 0]),1032,["prefix-cls","class","direction","onMousedown","onResize"]))),128))]),_:3},16,["class","style"])}var Ad=Ki(VR,[["render",HR]]);const UR=Object.assign(Ad,{install:(r,t)=>{xM(r,t);const e=EM(t);r.component(e+Ad.name,Ad)}}),YR=(()=>{let r=0;return(t="")=>(r+=1,`${t}${r}`)})();var XR=Xi({name:"LayoutSider",components:{IconLeft:XN,IconRight:eR,ResizeBox:UR},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:c}=Ky(r),[u,h]=Tm(i.value,Ii({value:n})),d=Ee(()=>c.value?"ResizeBox":"div"),f=Ee(()=>a.value&&!s.value),g=qa("layout-sider"),v=Ee(()=>[g,{[`${g}-light`]:e.value==="light",[`${g}-has-trigger`]:f.value,[`${g}-collapsed`]:n.value}]),p=Ee(()=>{const{width:x,collapsedWidth:S}=r,E=u.value?S:x;return ks(E)?`${E}px`:String(E)}),m=Ee(()=>[`${g}-trigger`,{[`${g}-trigger-light`]:e.value==="light"}]),y=()=>{const x=!u.value;h(x),t("update:collapsed",x),t("collapse",x,"clickTrigger")};nR(o,x=>{const S=!x;S!==u.value&&(h(S),t("update:collapsed",S),t("collapse",S,"responsive"),t("breakpoint",S))});const b=YR("__arco_layout_sider"),w=qN(rR,void 0);return Zy(()=>{var x;(x=w==null?void 0:w.onSiderMount)==null||x.call(w,b)}),Jy(()=>{var x;(x=w==null?void 0:w.onSiderUnMount)==null||x.call(w,b)}),GN(iR,Ii({theme:e,collapsed:u,collapsedWidth:l})),{componentTag:d,prefixCls:g,classNames:v,triggerClassNames:m,localCollapsed:u,siderWidth:p,showTrigger:f,toggleTrigger:y}}});const KR={key:0},ZR={key:1};function JR(r,t,e,n,i,a){const s=_a("IconLeft"),o=_a("IconRight");return ct(),ee(bM(r.componentTag),yM({class:r.classNames,style:{width:r.siderWidth}},r.resizeDirections?{directions:r.resizeDirections}:{}),{default:Lt(()=>[Xt("div",{class:yn(`${r.prefixCls}-children`)},[Jr(r.$slots,"default")],2),r.showTrigger?(ct(),le("div",{key:0,class:yn(r.triggerClassNames),style:Ko({width:r.siderWidth}),onClick:t[0]||(t[0]=(...l)=>r.toggleTrigger&&r.toggleTrigger(...l))},[Jr(r.$slots,"trigger",{collapsed:r.localCollapsed},()=>[r.reverseArrow?(ct(),le("div",ZR,[r.localCollapsed?(ct(),ee(s,{key:0})):(ct(),ee(o,{key:1}))])):(ct(),le("div",KR,[r.localCollapsed?(ct(),ee(o,{key:1})):(ct(),ee(s,{key:0}))]))])],6)):Hn("v-if",!0)]),_:3},16,["class","style"])}var QR=Ki(XR,[["render",JR]]);const tL=Xi({name:"Skeleton",props:{loading:{type:Boolean,default:!0},animation:{type:Boolean,default:!1}},setup(r){const t=qa("skeleton"),e=Ee(()=>[t,{[`${t}-animation`]:r.animation}]);return{prefixCls:t,cls:e}}});function eL(r,t,e,n,i,a){return ct(),le("div",{class:yn(r.cls)},[r.loading?Jr(r.$slots,"default",{key:0}):Jr(r.$slots,"content",{key:1})],2)}var Pd=Ki(tL,[["render",eL]]);const nL=Xi({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=qa("skeleton-line"),e=[];for(let n=0;n<r.rows;n++){const i={};ks(r.widths[n])?i.width=`${r.widths[n]}px`:KN(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 rL(r,t,e,n,i,a){return ct(!0),le(_s,null,Bu(r.lines,(s,o)=>(ct(),le("ul",{key:o,class:yn(r.prefixCls)},[Xt("li",{class:yn(`${r.prefixCls}-row`),style:Ko(s)},null,6)],2))),128)}var Lc=Ki(nL,[["render",rL]]);const iL=Xi({name:"SkeletonShape",props:{shape:{type:String,default:"square"},size:{type:String,default:"medium"}},setup(r){const t=qa("skeleton-shape"),e=Ee(()=>[t,`${t}-${r.shape}`,`${t}-${r.size}`]);return{prefixCls:t,cls:e}}});function aL(r,t,e,n,i,a){return ct(),le("div",{class:yn(r.cls)},null,2)}var Nd=Ki(iL,[["render",aL]]);const sL=Object.assign(Pd,{Line:Lc,Shape:Nd,install:(r,t)=>{xM(r,t);const e=EM(t);r.component(e+Pd.name,Pd),r.component(e+Lc.name,Lc),r.component(e+Nd.name,Nd)}}),oL={key:1,class:"no-data"},lL={__name:"Sidebar",props:{model_list:{type:Array,default:()=>[]}},emits:["updateCheckedList"],setup(r,{emit:t}){const e=Rt(!1),n=Rt([]),i=Rt([]),a=t,s=r;Uc(()=>s.model_list,l=>{n.value=l.map(c=>c.id)},{immediate:!0});const o=l=>{n.value=l,a("updateCheckedList",l)};return(l,c)=>{const u=YN,h=pM,d=QR;return ct(),ee(d,{width:"18%"},{default:Lt(()=>[At(h,{loading:e.value},{default:Lt(()=>[r.model_list.length?(ct(),ee(u,{key:0,class:"tree",data:r.model_list,checkable:"","checked-keys":n.value,"selected-keys":i.value,"field-names":{title:"name",key:"id"},onCheck:o},null,8,["data","checked-keys","selected-keys"])):(ct(),le("div",oL,"暂无数据"))]),_:1},8,["loading"])]),_:1})}}},cL=Zi(lL,[["__scopeId","data-v-897d2854"]]),uL="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",hL=["src"],dL={__name:"RetrievalDocuments",props:{documents:String},emits:"onFilesSelected",setup(r,{emit:t}){const{t:e}=SM(),n=t,i=Rt([]),a=Rt([]),s=Ii({type:"checkbox",showCheckedAll:!0,onlyCurrent:!1}),o={pageSize:10},l=u=>{i.value=u},c=u=>{n("onFilesSelected",u),l(u)};return(u,h)=>{const d=Fu,f=bR,g=_a("icon-eye"),v=_M,p=xR,m=yR,y=oR,b=lR;return ct(),ee(b,{class:"select-files-collapse"},{default:Lt(()=>[(ct(),ee(y,{key:1},{"expand-icon":Lt(({active:w})=>[Xt("img",{src:yr(uL),style:Ko({transform:w?"rotate(180deg)":"rotate(0deg)"})},null,12,hL)]),header:Lt(()=>[At(d,null,{default:Lt(()=>{var w;return[wM(ka(i.value.length)+"/"+ka(((w=r.documents)==null?void 0:w.length)||0)+" "+ka(u.$t("ai_search.selected_files")),1)]}),_:1})]),default:Lt(()=>[At(m,{data:r.documents,onSelectionChange:c,rowKey:"doc_id","show-header":!1,bordered:!1,"row-selection":s,selectedKeys:a.value,"onUpdate:selectedKeys":h[0]||(h[0]=w=>a.value=w),pagination:o},{columns:Lt(()=>[At(f,{"data-index":"doc_name"}),At(f,{"data-index":"count",width:"80"}),At(f,{width:"80"},{cell:Lt(({record:w})=>[At(p,{content:u.$t("ai_search.preview")},{default:Lt(()=>[At(v,{type:"text"},{default:Lt(()=>[At(g)]),_:1})]),_:1},8,["content"])]),_:1})]),_:1},8,["data","row-selection","selectedKeys"])]),_:1}))]),_:1})}}},fL=Zi(dL,[["__scopeId","data-v-d6389ec1"]]),gL="/assets/logo-B-RMh_L1.png",vL={class:"markdown-content"},pL={class:"header"},mL=["innerHTML"],yL={__name:"MarkdownContent",props:{content:String},setup(r){const t=r,e=Ee(()=>DN(t.content||""));return(n,i)=>{const a=Lc,s=Fu,o=sL;return ct(),le("div",vL,[Xt("div",pL,[i[0]||(i[0]=Xt("img",{src:gL,alt:"Logo",class:"logo"},null,-1)),Xt("h3",null,ka(n.$t("ai_search.intelligent_answer")),1)]),r.content?(ct(),le("div",{key:0,innerHTML:e.value,class:"content"},null,8,mL)):(ct(),ee(o,{key:1,class:"content",animation:!0},{default:Lt(()=>[At(s,{direction:"vertical",style:{width:"100%"},size:"large"},{default:Lt(()=>[At(a,{rows:3})]),_:1})]),_:1}))])}}},bL=Zi(yL,[["__scopeId","data-v-c4e00a39"]]);function I2(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 vt(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?I2(Object(e),!0).forEach(function(n){rt(r,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):I2(Object(e)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(e,n))})}return r}function mt(r,t,e){return t=Yc(t),ZN(r,JN()?Reflect.construct(t,e||[],Yc(r).constructor):t.apply(r,e))}var PM={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,c,u){this.fn=l,this.context=c,this.once=u||!1}function a(l,c,u,h,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new i(u,h||l,d),g=e?e+c:c;return l._events[g]?l._events[g].fn?l._events[g]=[l._events[g],f]:l._events[g].push(f):(l._events[g]=f,l._eventsCount++),l}function s(l,c){--l._eventsCount===0?l._events=new n:delete l._events[c]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],u,h;if(this._eventsCount===0)return c;for(h in u=this._events)t.call(u,h)&&c.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},o.prototype.listeners=function(c){var u=e?e+c:c,h=this._events[u];if(!h)return[];if(h.fn)return[h.fn];for(var d=0,f=h.length,g=new Array(f);d<f;d++)g[d]=h[d].fn;return g},o.prototype.listenerCount=function(c){var u=e?e+c:c,h=this._events[u];return h?h.fn?1:h.length:0},o.prototype.emit=function(c,u,h,d,f,g){var v=e?e+c:c;if(!this._events[v])return!1;var p=this._events[v],m=arguments.length,y,b;if(p.fn){switch(p.once&&this.removeListener(c,p.fn,void 0,!0),m){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,u),!0;case 3:return p.fn.call(p.context,u,h),!0;case 4:return p.fn.call(p.context,u,h,d),!0;case 5:return p.fn.call(p.context,u,h,d,f),!0;case 6:return p.fn.call(p.context,u,h,d,f,g),!0}for(b=1,y=new Array(m-1);b<m;b++)y[b-1]=arguments[b];p.fn.apply(p.context,y)}else{var w=p.length,x;for(b=0;b<w;b++)switch(p[b].once&&this.removeListener(c,p[b].fn,void 0,!0),m){case 1:p[b].fn.call(p[b].context);break;case 2:p[b].fn.call(p[b].context,u);break;case 3:p[b].fn.call(p[b].context,u,h);break;case 4:p[b].fn.call(p[b].context,u,h,d);break;default:if(!y)for(x=1,y=new Array(m-1);x<m;x++)y[x-1]=arguments[x];p[b].fn.apply(p[b].context,y)}}return!0},o.prototype.on=function(c,u,h){return a(this,c,u,h,!1)},o.prototype.once=function(c,u,h){return a(this,c,u,h,!0)},o.prototype.removeListener=function(c,u,h,d){var f=e?e+c:c;if(!this._events[f])return this;if(!u)return s(this,f),this;var g=this._events[f];if(g.fn)g.fn===u&&(!d||g.once)&&(!h||g.context===h)&&s(this,f);else{for(var v=0,p=[],m=g.length;v<m;v++)(g[v].fn!==u||d&&!g[v].once||h&&g[v].context!==h)&&p.push(g[v]);p.length?this._events[f]=p.length===1?p[0]:p:s(this,f)}return this},o.prototype.removeAllListeners=function(c){var u;return c?(u=e?e+c:c,this._events[u]&&s(this,u)):(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})(PM);var wL=PM.exports;const NM=zu(wL);var te=1e-6,_e=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 RM(){var r=new _e(9);return _e!=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 xL(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 EL(r,t,e,n,i,a,s,o,l){var c=new _e(9);return c[0]=r,c[1]=t,c[2]=e,c[3]=n,c[4]=i,c[5]=a,c[6]=s,c[7]=o,c[8]=l,c}function Wt(){var r=new _e(16);return _e!=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 LM(r){var t=new _e(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 Ms(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 DM(r,t,e,n,i,a,s,o,l,c,u,h,d,f,g,v){var p=new _e(16);return p[0]=r,p[1]=t,p[2]=e,p[3]=n,p[4]=i,p[5]=a,p[6]=s,p[7]=o,p[8]=l,p[9]=c,p[10]=u,p[11]=h,p[12]=d,p[13]=f,p[14]=g,p[15]=v,p}function Om(r,t,e,n,i,a,s,o,l,c,u,h,d,f,g,v,p){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]=c,r[9]=u,r[10]=h,r[11]=d,r[12]=f,r[13]=g,r[14]=v,r[15]=p,r}function Wi(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 IM(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 xr(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],f=t[11],g=t[12],v=t[13],p=t[14],m=t[15],y=e*o-n*s,b=e*l-i*s,w=e*c-a*s,x=n*l-i*o,S=n*c-a*o,E=i*c-a*l,_=u*v-h*g,C=u*p-d*g,k=u*m-f*g,M=h*p-d*v,T=h*m-f*v,O=d*m-f*p,R=y*O-b*T+w*M+x*k-S*C+E*_;return R?(R=1/R,r[0]=(o*O-l*T+c*M)*R,r[1]=(i*T-n*O-a*M)*R,r[2]=(v*E-p*S+m*x)*R,r[3]=(d*S-h*E-f*x)*R,r[4]=(l*k-s*O-c*C)*R,r[5]=(e*O-i*k+a*C)*R,r[6]=(p*w-g*E-m*b)*R,r[7]=(u*E-d*w+f*b)*R,r[8]=(s*T-o*k+c*_)*R,r[9]=(n*k-e*T-a*_)*R,r[10]=(g*S-v*w+m*y)*R,r[11]=(h*w-u*S-f*y)*R,r[12]=(o*C-s*M-l*_)*R,r[13]=(e*M-n*C+i*_)*R,r[14]=(v*b-g*x-p*y)*R,r[15]=(u*x-h*b+d*y)*R,r):null}function SL(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],f=t[11],g=t[12],v=t[13],p=t[14],m=t[15];return r[0]=o*(d*m-f*p)-h*(l*m-c*p)+v*(l*f-c*d),r[1]=-(n*(d*m-f*p)-h*(i*m-a*p)+v*(i*f-a*d)),r[2]=n*(l*m-c*p)-o*(i*m-a*p)+v*(i*c-a*l),r[3]=-(n*(l*f-c*d)-o*(i*f-a*d)+h*(i*c-a*l)),r[4]=-(s*(d*m-f*p)-u*(l*m-c*p)+g*(l*f-c*d)),r[5]=e*(d*m-f*p)-u*(i*m-a*p)+g*(i*f-a*d),r[6]=-(e*(l*m-c*p)-s*(i*m-a*p)+g*(i*c-a*l)),r[7]=e*(l*f-c*d)-s*(i*f-a*d)+u*(i*c-a*l),r[8]=s*(h*m-f*v)-u*(o*m-c*v)+g*(o*f-c*h),r[9]=-(e*(h*m-f*v)-u*(n*m-a*v)+g*(n*f-a*h)),r[10]=e*(o*m-c*v)-s*(n*m-a*v)+g*(n*c-a*o),r[11]=-(e*(o*f-c*h)-s*(n*f-a*h)+u*(n*c-a*o)),r[12]=-(s*(h*p-d*v)-u*(o*p-l*v)+g*(o*d-l*h)),r[13]=e*(h*p-d*v)-u*(n*p-i*v)+g*(n*d-i*h),r[14]=-(e*(o*p-l*v)-s*(n*p-i*v)+g*(n*l-i*o)),r[15]=e*(o*d-l*h)-s*(n*d-i*h)+u*(n*l-i*o),r}function FM(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],c=r[8],u=r[9],h=r[10],d=r[11],f=r[12],g=r[13],v=r[14],p=r[15],m=t*s-e*a,y=t*o-n*a,b=t*l-i*a,w=e*o-n*s,x=e*l-i*s,S=n*l-i*o,E=c*g-u*f,_=c*v-h*f,C=c*p-d*f,k=u*v-h*g,M=u*p-d*g,T=h*p-d*v;return m*T-y*M+b*k+w*C-x*_+S*E}function Je(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=t[9],f=t[10],g=t[11],v=t[12],p=t[13],m=t[14],y=t[15],b=e[0],w=e[1],x=e[2],S=e[3];return r[0]=b*n+w*o+x*h+S*v,r[1]=b*i+w*l+x*d+S*p,r[2]=b*a+w*c+x*f+S*m,r[3]=b*s+w*u+x*g+S*y,b=e[4],w=e[5],x=e[6],S=e[7],r[4]=b*n+w*o+x*h+S*v,r[5]=b*i+w*l+x*d+S*p,r[6]=b*a+w*c+x*f+S*m,r[7]=b*s+w*u+x*g+S*y,b=e[8],w=e[9],x=e[10],S=e[11],r[8]=b*n+w*o+x*h+S*v,r[9]=b*i+w*l+x*d+S*p,r[10]=b*a+w*c+x*f+S*m,r[11]=b*s+w*u+x*g+S*y,b=e[12],w=e[13],x=e[14],S=e[15],r[12]=b*n+w*o+x*h+S*v,r[13]=b*i+w*l+x*d+S*p,r[14]=b*a+w*c+x*f+S*m,r[15]=b*s+w*u+x*g+S*y,r}function bs(r,t,e){var n=e[0],i=e[1],a=e[2],s,o,l,c,u,h,d,f,g,v,p,m;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],c=t[3],u=t[4],h=t[5],d=t[6],f=t[7],g=t[8],v=t[9],p=t[10],m=t[11],r[0]=s,r[1]=o,r[2]=l,r[3]=c,r[4]=u,r[5]=h,r[6]=d,r[7]=f,r[8]=g,r[9]=v,r[10]=p,r[11]=m,r[12]=s*n+u*i+g*a+t[12],r[13]=o*n+h*i+v*a+t[13],r[14]=l*n+d*i+p*a+t[14],r[15]=c*n+f*i+m*a+t[15]),r}function BM(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 _L(r,t,e,n){var i=n[0],a=n[1],s=n[2],o=Math.hypot(i,a,s),l,c,u,h,d,f,g,v,p,m,y,b,w,x,S,E,_,C,k,M,T,O,R,D;return o<te?null:(o=1/o,i*=o,a*=o,s*=o,l=Math.sin(e),c=Math.cos(e),u=1-c,h=t[0],d=t[1],f=t[2],g=t[3],v=t[4],p=t[5],m=t[6],y=t[7],b=t[8],w=t[9],x=t[10],S=t[11],E=i*i*u+c,_=a*i*u+s*l,C=s*i*u-a*l,k=i*a*u-s*l,M=a*a*u+c,T=s*a*u+i*l,O=i*s*u+a*l,R=a*s*u-i*l,D=s*s*u+c,r[0]=h*E+v*_+b*C,r[1]=d*E+p*_+w*C,r[2]=f*E+m*_+x*C,r[3]=g*E+y*_+S*C,r[4]=h*k+v*M+b*T,r[5]=d*k+p*M+w*T,r[6]=f*k+m*M+x*T,r[7]=g*k+y*M+S*T,r[8]=h*O+v*R+b*D,r[9]=d*O+p*R+w*D,r[10]=f*O+m*R+x*D,r[11]=g*O+y*R+S*D,t!==r&&(r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r)}function zM(r,t,e){var n=Math.sin(e),i=Math.cos(e),a=t[4],s=t[5],o=t[6],l=t[7],c=t[8],u=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+c*n,r[5]=s*i+u*n,r[6]=o*i+h*n,r[7]=l*i+d*n,r[8]=c*i-a*n,r[9]=u*i-s*n,r[10]=h*i-o*n,r[11]=d*i-l*n,r}function $M(r,t,e){var n=Math.sin(e),i=Math.cos(e),a=t[0],s=t[1],o=t[2],l=t[3],c=t[8],u=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-c*n,r[1]=s*i-u*n,r[2]=o*i-h*n,r[3]=l*i-d*n,r[8]=a*n+c*i,r[9]=s*n+u*i,r[10]=o*n+h*i,r[11]=l*n+d*i,r}function kL(r,t,e){var n=Math.sin(e),i=Math.cos(e),a=t[0],s=t[1],o=t[2],l=t[3],c=t[4],u=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+c*n,r[1]=s*i+u*n,r[2]=o*i+h*n,r[3]=l*i+d*n,r[4]=c*i-a*n,r[5]=u*i-s*n,r[6]=h*i-o*n,r[7]=d*i-l*n,r}function ki(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 pa(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 jM(r,t,e){var n=e[0],i=e[1],a=e[2],s=Math.hypot(n,i,a),o,l,c;return s<te?null:(s=1/s,n*=s,i*=s,a*=s,o=Math.sin(t),l=Math.cos(t),c=1-l,r[0]=n*n*c+l,r[1]=i*n*c+a*o,r[2]=a*n*c-i*o,r[3]=0,r[4]=n*i*c-a*o,r[5]=i*i*c+l,r[6]=a*i*c+n*o,r[7]=0,r[8]=n*a*c+i*o,r[9]=i*a*c-n*o,r[10]=a*a*c+l,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function qM(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 GM(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 Am(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 WM(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=n+n,l=i+i,c=a+a,u=n*o,h=n*l,d=n*c,f=i*l,g=i*c,v=a*c,p=s*o,m=s*l,y=s*c;return r[0]=1-(f+v),r[1]=h+y,r[2]=d-m,r[3]=0,r[4]=h-y,r[5]=1-(u+v),r[6]=g+p,r[7]=0,r[8]=d+m,r[9]=g-p,r[10]=1-(u+f),r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function ML(r,t){var e=new _e(3),n=-t[0],i=-t[1],a=-t[2],s=t[3],o=t[4],l=t[5],c=t[6],u=t[7],h=n*n+i*i+a*a+s*s;return h>0?(e[0]=(o*s+u*n+l*a-c*i)*2/h,e[1]=(l*s+u*i+c*n-o*a)*2/h,e[2]=(c*s+u*a+o*i-l*n)*2/h):(e[0]=(o*s+u*n+l*a-c*i)*2,e[1]=(l*s+u*i+c*n-o*a)*2,e[2]=(c*s+u*a+o*i-l*n)*2),WM(r,t,e),r}function Xc(r,t){return r[0]=t[12],r[1]=t[13],r[2]=t[14],r}function Cs(r,t){var e=t[0],n=t[1],i=t[2],a=t[4],s=t[5],o=t[6],l=t[8],c=t[9],u=t[10];return r[0]=Math.hypot(e,n,i),r[1]=Math.hypot(a,s,o),r[2]=Math.hypot(l,c,u),r}function Kc(r,t){var e=new _e(3);Cs(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,c=t[4]*n,u=t[5]*i,h=t[6]*a,d=t[8]*n,f=t[9]*i,g=t[10]*a,v=s+u+g,p=0;return v>0?(p=Math.sqrt(v+1)*2,r[3]=.25*p,r[0]=(h-f)/p,r[1]=(d-l)/p,r[2]=(o-c)/p):s>u&&s>g?(p=Math.sqrt(1+s-u-g)*2,r[3]=(h-f)/p,r[0]=.25*p,r[1]=(o+c)/p,r[2]=(d+l)/p):u>g?(p=Math.sqrt(1+u-s-g)*2,r[3]=(d-l)/p,r[0]=(o+c)/p,r[1]=.25*p,r[2]=(h+f)/p):(p=Math.sqrt(1+g-s-u)*2,r[3]=(o-c)/p,r[0]=(d+l)/p,r[1]=(h+f)/p,r[2]=.25*p),r}function CL(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3],l=i+i,c=a+a,u=s+s,h=i*l,d=i*c,f=i*u,g=a*c,v=a*u,p=s*u,m=o*l,y=o*c,b=o*u,w=n[0],x=n[1],S=n[2];return r[0]=(1-(g+p))*w,r[1]=(d+b)*w,r[2]=(f-y)*w,r[3]=0,r[4]=(d-b)*x,r[5]=(1-(h+p))*x,r[6]=(v+m)*x,r[7]=0,r[8]=(f+y)*S,r[9]=(v-m)*S,r[10]=(1-(h+g))*S,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function So(r,t,e,n,i){var a=t[0],s=t[1],o=t[2],l=t[3],c=a+a,u=s+s,h=o+o,d=a*c,f=a*u,g=a*h,v=s*u,p=s*h,m=o*h,y=l*c,b=l*u,w=l*h,x=n[0],S=n[1],E=n[2],_=i[0],C=i[1],k=i[2],M=(1-(v+m))*x,T=(f+w)*x,O=(g-b)*x,R=(f-w)*S,D=(1-(d+m))*S,L=(p+y)*S,P=(g+b)*E,A=(p-y)*E,I=(1-(d+v))*E;return r[0]=M,r[1]=T,r[2]=O,r[3]=0,r[4]=R,r[5]=D,r[6]=L,r[7]=0,r[8]=P,r[9]=A,r[10]=I,r[11]=0,r[12]=e[0]+_-(M*_+R*C+P*k),r[13]=e[1]+C-(T*_+D*C+A*k),r[14]=e[2]+k-(O*_+L*C+I*k),r[15]=1,r}function n1(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e+e,o=n+n,l=i+i,c=e*s,u=n*s,h=n*o,d=i*s,f=i*o,g=i*l,v=a*s,p=a*o,m=a*l;return r[0]=1-h-g,r[1]=u+m,r[2]=d-p,r[3]=0,r[4]=u-m,r[5]=1-c-g,r[6]=f+v,r[7]=0,r[8]=d+p,r[9]=f-v,r[10]=1-c-h,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function TL(r,t,e,n,i,a,s){var o=1/(e-t),l=1/(i-n),c=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)*c,r[11]=-1,r[12]=0,r[13]=0,r[14]=s*a*2*c,r[15]=0,r}function VM(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 OL=VM;function AL(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 PL(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),c=2/(i+a);return r[0]=l,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=c,r[6]=0,r[7]=0,r[8]=-((s-o)*l*.5),r[9]=(i-a)*c*.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 HM(r,t,e,n,i,a,s){var o=1/(t-e),l=1/(n-i),c=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*c,r[11]=0,r[12]=(t+e)*o,r[13]=(i+n)*l,r[14]=(s+a)*c,r[15]=1,r}var UM=HM;function YM(r,t,e,n,i,a,s){var o=1/(t-e),l=1/(n-i),c=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]=c,r[11]=0,r[12]=(t+e)*o,r[13]=(i+n)*l,r[14]=a*c,r[15]=1,r}function XM(r,t,e,n){var i,a,s,o,l,c,u,h,d,f,g=t[0],v=t[1],p=t[2],m=n[0],y=n[1],b=n[2],w=e[0],x=e[1],S=e[2];return Math.abs(g-w)<te&&Math.abs(v-x)<te&&Math.abs(p-S)<te?Wi(r):(u=g-w,h=v-x,d=p-S,f=1/Math.hypot(u,h,d),u*=f,h*=f,d*=f,i=y*d-b*h,a=b*u-m*d,s=m*h-y*u,f=Math.hypot(i,a,s),f?(f=1/f,i*=f,a*=f,s*=f):(i=0,a=0,s=0),o=h*s-d*a,l=d*i-u*s,c=u*a-h*i,f=Math.hypot(o,l,c),f?(f=1/f,o*=f,l*=f,c*=f):(o=0,l=0,c=0),r[0]=i,r[1]=o,r[2]=u,r[3]=0,r[4]=a,r[5]=l,r[6]=h,r[7]=0,r[8]=s,r[9]=c,r[10]=d,r[11]=0,r[12]=-(i*g+a*v+s*p),r[13]=-(o*g+l*v+c*p),r[14]=-(u*g+h*v+d*p),r[15]=1,r)}function NL(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=n[0],l=n[1],c=n[2],u=i-e[0],h=a-e[1],d=s-e[2],f=u*u+h*h+d*d;f>0&&(f=1/Math.sqrt(f),u*=f,h*=f,d*=f);var g=l*d-c*h,v=c*u-o*d,p=o*h-l*u;return f=g*g+v*v+p*p,f>0&&(f=1/Math.sqrt(f),g*=f,v*=f,p*=f),r[0]=g,r[1]=v,r[2]=p,r[3]=0,r[4]=h*p-d*v,r[5]=d*g-u*p,r[6]=u*v-h*g,r[7]=0,r[8]=u,r[9]=h,r[10]=d,r[11]=0,r[12]=i,r[13]=a,r[14]=s,r[15]=1,r}function RL(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 LL(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 DL(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 KM(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 IL(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 FL(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 Pm(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 BL(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],s=r[4],o=r[5],l=r[6],c=r[7],u=r[8],h=r[9],d=r[10],f=r[11],g=r[12],v=r[13],p=r[14],m=r[15],y=t[0],b=t[1],w=t[2],x=t[3],S=t[4],E=t[5],_=t[6],C=t[7],k=t[8],M=t[9],T=t[10],O=t[11],R=t[12],D=t[13],L=t[14],P=t[15];return Math.abs(e-y)<=te*Math.max(1,Math.abs(e),Math.abs(y))&&Math.abs(n-b)<=te*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(i-w)<=te*Math.max(1,Math.abs(i),Math.abs(w))&&Math.abs(a-x)<=te*Math.max(1,Math.abs(a),Math.abs(x))&&Math.abs(s-S)<=te*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(o-E)<=te*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(l-_)<=te*Math.max(1,Math.abs(l),Math.abs(_))&&Math.abs(c-C)<=te*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(u-k)<=te*Math.max(1,Math.abs(u),Math.abs(k))&&Math.abs(h-M)<=te*Math.max(1,Math.abs(h),Math.abs(M))&&Math.abs(d-T)<=te*Math.max(1,Math.abs(d),Math.abs(T))&&Math.abs(f-O)<=te*Math.max(1,Math.abs(f),Math.abs(O))&&Math.abs(g-R)<=te*Math.max(1,Math.abs(g),Math.abs(R))&&Math.abs(v-D)<=te*Math.max(1,Math.abs(v),Math.abs(D))&&Math.abs(p-L)<=te*Math.max(1,Math.abs(p),Math.abs(L))&&Math.abs(m-P)<=te*Math.max(1,Math.abs(m),Math.abs(P))}var ZM=Je,zL=KM;const $L=Object.freeze(Object.defineProperty({__proto__:null,add:DL,adjoint:SL,clone:LM,copy:Ms,create:Wt,determinant:FM,equals:BL,exactEquals:Pm,frob:LL,fromQuat:n1,fromQuat2:ML,fromRotation:jM,fromRotationTranslation:WM,fromRotationTranslationScale:CL,fromRotationTranslationScaleOrigin:So,fromScaling:pa,fromTranslation:ki,fromValues:DM,fromXRotation:qM,fromYRotation:GM,fromZRotation:Am,frustum:TL,getRotation:Kc,getScaling:Cs,getTranslation:Xc,identity:Wi,invert:xr,lookAt:XM,mul:ZM,multiply:Je,multiplyScalar:IL,multiplyScalarAndAdd:FL,ortho:UM,orthoNO:HM,orthoZO:YM,perspective:OL,perspectiveFromFieldOfView:PL,perspectiveNO:VM,perspectiveZO:AL,rotate:_L,rotateX:zM,rotateY:$M,rotateZ:kL,scale:BM,set:Om,str:RL,sub:zL,subtract:KM,targetTo:NL,translate:bs,transpose:IM},Symbol.toStringTag,{value:"Module"}));function St(){var r=new _e(3);return _e!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function zr(r){var t=new _e(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t}function qr(r){var t=r[0],e=r[1],n=r[2];return Math.hypot(t,e,n)}function Yt(r,t,e){var n=new _e(3);return n[0]=r,n[1]=t,n[2]=e,n}function Er(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r}function Ze(r,t,e,n){return r[0]=t,r[1]=e,r[2]=n,r}function Fi(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r}function Nm(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r}function jL(r,t,e){return r[0]=t[0]*e[0],r[1]=t[1]*e[1],r[2]=t[2]*e[2],r}function qL(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 GL(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 Zc(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r}function WL(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 Ma(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 Sr(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]}function Dc(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 Rm(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 Qe(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 VL(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 HL(r,t,e){var n=e[0],i=e[1],a=e[2],s=e[3],o=t[0],l=t[1],c=t[2],u=i*c-a*l,h=a*o-n*c,d=n*l-i*o,f=i*d-a*h,g=a*u-n*d,v=n*h-i*u,p=s*2;return u*=p,h*=p,d*=p,f*=2,g*=2,v*=2,r[0]=o+u+f,r[1]=l+h+g,r[2]=c+d+v,r}function Us(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)<=te*Math.max(1,Math.abs(e),Math.abs(a))&&Math.abs(n-s)<=te*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-o)<=te*Math.max(1,Math.abs(i),Math.abs(o))}var UL=Nm,F2=WL,JM=qr;(function(){var r=St();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 _r(){var r=new _e(4);return _e!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function ao(r,t,e,n){var i=new _e(4);return i[0]=r,i[1]=t,i[2]=e,i[3]=n,i}function YL(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r}function XL(r,t,e,n,i){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r}function KL(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 Ur(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=_r();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 Te(){var r=new _e(4);return _e!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Ti(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 Bi(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=e[0],l=e[1],c=e[2],u=e[3];return r[0]=n*u+s*o+i*c-a*l,r[1]=i*u+s*l+a*o-n*c,r[2]=a*u+s*c+n*l-i*o,r[3]=s*u-n*o-i*l-a*c,r}function Rd(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3],l=e[0],c=e[1],u=e[2],h=e[3],d,f,g,v,p;return f=i*l+a*c+s*u+o*h,f<0&&(f=-f,l=-l,c=-c,u=-u,h=-h),1-f>te?(d=Math.acos(f),g=Math.sin(d),v=Math.sin((1-n)*d)/g,p=Math.sin(n*d)/g):(v=1-n,p=n),r[0]=v*i+p*l,r[1]=v*a+p*c,r[2]=v*s+p*u,r[3]=v*o+p*h,r}function Ld(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 ZL(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 Cl(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),c=Math.sin(n),u=Math.cos(n);return r[0]=a*l*u-s*o*c,r[1]=s*o*u+a*l*c,r[2]=s*l*c-a*o*u,r[3]=s*l*u+a*o*c,r}var JL=ao,Tl=YL,B2=XL,z2=Bi,Jc=KL;(function(){var r=St(),t=Yt(1,0,0),e=Yt(0,1,0);return function(n,i,a){var s=Sr(i,a);return s<-.999999?(Dc(r,t,i),JM(r)<1e-6&&Dc(r,e,i),Ma(r,r),Ti(n,r,Math.PI),n):s>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Dc(r,i,a),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+s,Jc(n,n))}})();(function(){var r=Te(),t=Te();return function(e,n,i,a,s,o){return Rd(r,n,s,o),Rd(t,i,a,o),Rd(e,r,t,2*o*(1-o)),e}})();(function(){var r=RM();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],Jc(t,ZL(t,r))}})();function r1(){var r=new _e(2);return _e!=Float32Array&&(r[0]=0,r[1]=0),r}function QL(r,t){return r[0]=t[0],r[1]=t[1],r}function t6(r,t,e){return r[0]=t,r[1]=e,r}function e6(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 n6(r,t){return r[0]*t[0]+r[1]*t[1]}function r6(r,t){return r[0]===t[0]&&r[1]===t[1]}(function(){var r=r1();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 No=function(r){return r!==null&&typeof r!="function"&&isFinite(r.length)},i6=function(r,t){return No(r)?r.indexOf(t)>-1:!1},a6=function(r,t){if(!No(r))return r;for(var e=[],n=0;n<r.length;n++){var i=r[n];t(i,n)&&e.push(i)}return e},s6=function(r,t){return t===void 0&&(t=[]),a6(r,function(e){return!i6(t,e)})};function at(r){return typeof r=="function"}function ot(r){return r==null}function Dn(r){return Array.isArray(r)}const me=function(r){var t=typeof r;return r!==null&&t==="object"||t==="function"};function QM(r,t){if(r){var e;if(Dn(r))for(var n=0,i=r.length;n<i&&(e=t(r[n],n),e!==!1);n++);else if(me(r)){for(var a in r)if(r.hasOwnProperty(a)&&(e=t(r[a],a),e===!1))break}}}var Lm=function(r){return typeof r=="object"&&r!==null},o6={}.toString,tC=function(r,t){return o6.call(r)==="[object "+t+"]"},Ts=function(r){if(!Lm(r)||!tC(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 Qc(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 tu=function(r){if(Dn(r))return r.reduce(function(t,e){return Math.min(t,e)},r[0])};var l6=function(r,t,e){if(!Dn(r)&&!Ts(r))return r;var n=e;return QM(r,function(i,a){n=t(n,i,a)}),n};function Tt(r){return typeof r=="string"}function c6(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 u6=Object.prototype.hasOwnProperty;function ju(r,t){if(!t||!Dn(r))return{};for(var e={},n=at(t)?t:function(o){return o[t]},i,a=0;a<r.length;a++){var s=r[a];i=n(s),u6.call(e,i)?e[i].push(s):e[i]=[s]}return e}var ce=function(r,t,e){return r<t?t:r>e?e:r};function nt(r){return typeof r=="number"}var h6=1e-5;function _o(r,t,e){return e===void 0&&(e=h6),r===t||Math.abs(r-t)<e}const d6=function(r,t){if(Dn(r)){for(var e,n=-1/0,i=0;i<r.length;i++){var a=r[i],s=at(t)?t(a):a[t];s>n&&(e=a,n=s)}return e}},f6=function(r,t){if(Dn(r)){for(var e,n=1/0,i=0;i<r.length;i++){var a=r[i],s=at(t)?t(a):a[t];s<n&&(e=a,n=s)}return e}};var eC=function(r,t){return(r%t+t)%t};const nC=function(r){return ot(r)?"":r.toString()};var g6=function(r){var t=nC(r);return t.charAt(0).toLowerCase()+t.substring(1)};function v6(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 eu=function(r){var t=nC(r);return t.charAt(0).toUpperCase()+t.substring(1)},p6={}.toString,m6=function(r){return p6.call(r).replace(/^\[object /,"").replace(/]$/,"")},nu=function(r){return tC(r,"Boolean")};function y6(r){return r instanceof Date}function b6(r){return r===null}var w6=Object.prototype,x6=function(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||w6;return r===e},ut=function(r){return r===void 0},Vi=function(r){if(typeof r!="object"||r===null)return r;var t;if(Dn(r)){t=[];for(var e=0,n=r.length;e<n;e++)typeof r[e]=="object"&&r[e]!=null?t[e]=Vi(r[e]):t[e]=r[e]}else{t={};for(var i in r)typeof r[i]=="object"&&r[i]!=null?t[i]=Vi(r[i]):t[i]=r[i]}return t};function Zo(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 E6(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 Dd=new Map;function Dm(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];Dd.has(r)||Dd.set(r,E6(e));var o=Dd.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 S6=5;function _6(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 rC(r,t,e,n){e=e||0,n=n||S6;for(var i in t)if(_6(t,i)){var a=t[i];a!==null&&Ts(a)?(Ts(r[i])||(r[i]={}),e<n?rC(r[i],a,e+1,n):r[i]=t[i]):Dn(a)?(r[i]=[],r[i]=r[i].concat(a)):a!==void 0&&(r[i]=a)}}var on=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)rC(r,t[n]);return r},k6=Object.prototype.hasOwnProperty;function wr(r){if(ot(r))return!0;if(No(r))return!r.length;var t=m6(r);if(t==="Map"||t==="Set")return!r.size;if(x6(r))return!Object.keys(r).length;for(var e in r)if(k6.call(r,e))return!1;return!0}var ue=function(r,t){if(r===t)return!0;if(!r||!t||Tt(r)||Tt(t))return!1;if(No(r)||No(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(Lm(r)||Lm(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 nn=function(r,t,e){for(var n=0,i=Tt(t)?t.split("."):t;r&&n<i.length;)r=r[i[n++]];return r===void 0||n<i.length?e:r},Ro=function(r,t,e){var n=r,i=Tt(t)?t.split("."):t;return i.forEach(function(a,s){s<i.length-1?(me(n[a])||(n[a]=nt(i[s+1])?[]:{}),n=n[a]):n[a]=e}),r};var M6=Object.prototype.hasOwnProperty;const La=function(r,t){if(r===null||!Ts(r))return{};var e={};return QM(t,function(n){M6.call(r,n)&&(e[n]=r[n])}),e},i1=function(r,t){return l6(r,function(e,n,i){return t.includes(i)||(e[i]=n),e},{})},iC=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)},c=function(){var u=Date.now();!o&&e.leading===!1&&(o=u);var h=t-(u-o);return i=this,a=arguments,h<=0||h>t?(n&&(clearTimeout(n),n=null),o=u,s=r.apply(i,a),n||(i=a=null)):!n&&e.trailing!==!1&&(n=setTimeout(l,h)),s};return c.cancel=function(){clearTimeout(n),o=0,n=i=a=null},c};var Ol={};const C6=function(r){return r=r||"g",Ol[r]?Ol[r]+=1:Ol[r]=1,r+Ol[r]},Id=function(){},Im=function(r){return r};var Fm=function(r,t){return Fm=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])},Fm(r,t)};function wt(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Fm(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var q=function(){return q=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},q.apply(this,arguments)};function fe(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 bt(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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})}function Jo(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 N(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 T6(){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 Q(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 Fd(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 aC={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function O6(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 ko={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function sC(r){return Array.isArray(r)&&r.every(function(t){var e=t[0].toLowerCase();return ko[e]===t.length-1&&"achlmqstvz".includes(e)})}function oC(r){return sC(r)&&r.every(function(t){var e=t[0];return e===e.toUpperCase()})}function lC(r){return oC(r)&&r.every(function(t){var e=t[0];return"ACLMQZ".includes(e)})}function $2(r){for(var t=r.pathValue[r.segmentStart],e=t.toLowerCase(),n=r.data;n.length>=ko[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,ko[e]))),!!ko[e]););}function A6(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 P6(r){return r>=48&&r<=57||r===43||r===45||r===46}function Qa(r){return r>=48&&r<=57}function N6(r){var t=r.max,e=r.pathValue,n=r.index,i=n,a=!1,s=!1,o=!1,l=!1,c;if(i>=t){r.err="[path-util]: Invalid path value at index ".concat(i,', "pathValue" is missing param');return}if(c=e.charCodeAt(i),(c===43||c===45)&&(i+=1,c=e.charCodeAt(i)),!Qa(c)&&c!==46){r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(e[i],'" is not a number');return}if(c!==46){if(a=c===48,i+=1,c=e.charCodeAt(i),a&&i<t&&c&&Qa(c)){r.err="[path-util]: Invalid path value at index ".concat(n,', "').concat(e[n],'" illegal number');return}for(;i<t&&Qa(e.charCodeAt(i));)i+=1,s=!0;c=e.charCodeAt(i)}if(c===46){for(l=!0,i+=1;Qa(e.charCodeAt(i));)i+=1,o=!0;c=e.charCodeAt(i)}if(c===101||c===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,c=e.charCodeAt(i),(c===43||c===45)&&(i+=1),i<t&&Qa(e.charCodeAt(i)))for(;i<t&&Qa(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 R6(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 Ic(r){for(var t=r.pathValue,e=r.max;r.index<e&&R6(t.charCodeAt(r.index));)r.index+=1}function L6(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 D6(r){return(r|32)===97}function I6(r){var t=r.max,e=r.pathValue,n=r.index,i=e.charCodeAt(n),a=ko[e[n].toLowerCase()];if(r.segmentStart=n,!L6(i)){r.err='[path-util]: Invalid path value "'.concat(e[n],'" is not a path command');return}if(r.index+=1,Ic(r),r.data=[],!a){$2(r);return}for(;;){for(var s=a;s>0;s-=1){if(D6(i)&&(s===3||s===4)?A6(r):N6(r),r.err.length)return;r.data.push(r.param),Ic(r),r.index<t&&e.charCodeAt(r.index)===44&&(r.index+=1,Ic(r))}if(r.index>=r.max||!P6(e.charCodeAt(r.index)))break}$2(r)}var F6=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 B6(r){if(sC(r))return[].concat(r);var t=new F6(r);for(Ic(t);t.index<t.max&&!t.err.length;)I6(t);return t.err?t.err:t.segments}function z6(r){if(oC(r))return[].concat(r);var t=B6(r),e=0,n=0,i=0,a=0;return t.map(function(s){var o=s.slice(1).map(Number),l=s[0],c=l.toUpperCase();if(l==="M")return e=o[0],n=o[1],i=e,a=n,["M",e,n];var u;if(l!==c)switch(c){case"A":u=[c,o[0],o[1],o[2],o[3],o[4],o[5]+e,o[6]+n];break;case"V":u=[c,o[0]+n];break;case"H":u=[c,o[0]+e];break;default:{var h=o.map(function(f,g){return f+(g%2?n:e)});u=[c].concat(h)}}else u=[c].concat(o);var d=u.length;switch(c){case"Z":e=i,n=a;break;case"H":e=u[1];break;case"V":n=u[1];break;default:e=u[d-2],n=u[d-1],c==="M"&&(i=e,a=n)}return u})}function $6(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 c=n*2-a,u=i*2-s;t.x1=c,t.y1=u,l=["C",c,u].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 f=o[0],g=o[1];t.qx=f,t.qy=g}return l}function ru(r){if(lC(r))return[].concat(r);for(var t=z6(r),e=q({},aC),n=0;n<t.length;n+=1){t[n]=$6(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 j6(r){return lC(r)&&r.every(function(t){var e=t[0];return"MC".includes(e)})}function Al(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 a1(r,t,e,n,i,a,s,o,l,c){var u=r,h=t,d=e,f=n,g=o,v=l,p=Math.PI*120/180,m=Math.PI/180*(+i||0),y=[],b,w,x,S,E;if(c)w=c[0],x=c[1],S=c[2],E=c[3];else{b=Al(u,h,-m),u=b.x,h=b.y,b=Al(g,v,-m),g=b.x,v=b.y;var _=(u-g)/2,C=(h-v)/2,k=_*_/(d*d)+C*C/(f*f);k>1&&(k=Math.sqrt(k),d*=k,f*=k);var M=d*d,T=f*f,O=(a===s?-1:1)*Math.sqrt(Math.abs((M*T-M*C*C-T*_*_)/(M*C*C+T*_*_)));S=O*d*C/f+(u+g)/2,E=O*-f*_/d+(h+v)/2,w=Math.asin(((h-E)/f*Math.pow(10,9)>>0)/Math.pow(10,9)),x=Math.asin(((v-E)/f*Math.pow(10,9)>>0)/Math.pow(10,9)),w=u<S?Math.PI-w:w,x=g<S?Math.PI-x:x,w<0&&(w=Math.PI*2+w),x<0&&(x=Math.PI*2+x),s&&w>x&&(w-=Math.PI*2),!s&&x>w&&(x-=Math.PI*2)}var R=x-w;if(Math.abs(R)>p){var D=x,L=g,P=v;x=w+p*(s&&x>w?1:-1),g=S+d*Math.cos(x),v=E+f*Math.sin(x),y=a1(g,v,d,f,i,0,s,L,P,[x,D,S,E])}R=x-w;var A=Math.cos(w),I=Math.sin(w),B=Math.cos(x),j=Math.sin(x),G=Math.tan(R/4),H=4/3*d*G,Y=4/3*f*G,K=[u,h],tt=[u+H*I,h-Y*A],it=[g+H*j,v-Y*B],_t=[g,v];if(tt[0]=2*K[0]-tt[0],tt[1]=2*K[1]-tt[1],c)return tt.concat(it,_t,y);y=tt.concat(it,_t,y);for(var Mt=[],re=0,Re=y.length;re<Re;re+=1)Mt[re]=re%2?Al(y[re-1],y[re],m).y:Al(y[re],y[re+1],m).x;return Mt}function q6(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 Si(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 j2=function(r,t,e,n){var i=.5,a=Si([r,t],[e,n],i);return Q(Q([],a,!0),[e,n,e,n],!1)};function G6(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,c=t.x,u=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(a1(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(q6(s[0],s[1],s[2],s[3],s[4],s[5]));case"L":return["C"].concat(j2(o,l,i,a));case"Z":return o===c&&l===u?["C",o,l,c,u,c,u]:["C"].concat(j2(o,l,c,u))}return r}function Bm(r,t){if(t===void 0&&(t=!1),j6(r)){var e=[].concat(r);return t?[e,[]]:e}for(var n=ru(r),i=q({},aC),a=[],s="",o=n.length,l,c,u=[],h=0;h<o;h+=1){n[h]&&(s=n[h][0]),a[h]=s;var d=G6(n[h],i);n[h]=d,O6(n,a,h),o=n.length,s==="Z"&&u.push(h),l=n[h],c=l.length,i.x1=+l[c-2],i.y1=+l[c-1],i.x2=+l[c-4]||i.x1,i.y2=+l[c-3]||i.y1}return t?[n,u]:n}function W6(r){return r.map(function(t){return Array.isArray(t)?[].concat(t):t})}function V6(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 fn(r,t){return Math.sqrt((r[0]-t[0])*(r[0]-t[0])+(r[1]-t[1])*(r[1]-t[1]))}function zm(r,t,e,n,i){var a=fn([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=Si([r,t],[e,n],i/a),l=o[0],c=o[1];s={x:l,y:c}}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 q2(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,c=l*Math.acos(s/o);return c}function H6(r,t,e,n,i,a,s,o,l,c){var u=Math.abs,h=Math.sin,d=Math.cos,f=Math.sqrt,g=Math.PI,v=u(e),p=u(n),m=(i%360+360)%360,y=m*(g/180);if(r===o&&t===l)return{x:r,y:t};if(v===0||p===0)return zm(r,t,o,l,c).point;var b=(r-o)/2,w=(t-l)/2,x={x:d(y)*b+h(y)*w,y:-h(y)*b+d(y)*w},S=Math.pow(x.x,2)/Math.pow(v,2)+Math.pow(x.y,2)/Math.pow(p,2);S>1&&(v*=f(S),p*=f(S));var E=Math.pow(v,2)*Math.pow(p,2)-Math.pow(v,2)*Math.pow(x.y,2)-Math.pow(p,2)*Math.pow(x.x,2),_=Math.pow(v,2)*Math.pow(x.y,2)+Math.pow(p,2)*Math.pow(x.x,2),C=E/_;C=C<0?0:C;var k=(a!==s?1:-1)*f(C),M={x:k*(v*x.y/p),y:k*(-(p*x.x)/v)},T={x:d(y)*M.x-h(y)*M.y+(r+o)/2,y:h(y)*M.x+d(y)*M.y+(t+l)/2},O={x:(x.x-M.x)/v,y:(x.y-M.y)/p},R=q2({x:1,y:0},O),D={x:(-x.x-M.x)/v,y:(-x.y-M.y)/p},L=q2(O,D);!s&&L>0?L-=2*g:s&&L<0&&(L+=2*g),L%=2*g;var P=R+L*c,A=v*d(P),I=p*h(P),B={x:d(y)*A-h(y)*I+T.x,y:h(y)*A+d(y)*I+T.y};return B}function U6(r,t,e,n,i,a,s,o,l,c,u){var h,d=u.bbox,f=d===void 0?!0:d,g=u.length,v=g===void 0?!0:g,p=u.sampleSize,m=p===void 0?30:p,y=typeof c=="number",b=r,w=t,x=0,S=[b,w,x],E=[b,w],_=0,C={x:0,y:0},k=[{x:b,y:w}];y&&c<=0&&(C={x:b,y:w});for(var M=0;M<=m;M+=1){if(_=M/m,h=H6(r,t,e,n,i,a,s,o,l,_),b=h.x,w=h.y,f&&k.push({x:b,y:w}),v&&(x+=fn(E,[b,w])),E=[b,w],y&&x>=c&&c>S[2]){var T=(x-c)/(x-S[2]);C={x:E[0]*(1-T)+S[0]*T,y:E[1]*(1-T)+S[1]*T}}S=[b,w,x]}return y&&c>=x&&(C={x:o,y:l}),{length:x,point:C,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 Y6(r,t,e,n,i,a,s,o,l){var c=1-l;return{x:Math.pow(c,3)*r+3*Math.pow(c,2)*l*e+3*c*Math.pow(l,2)*i+Math.pow(l,3)*s,y:Math.pow(c,3)*t+3*Math.pow(c,2)*l*n+3*c*Math.pow(l,2)*a+Math.pow(l,3)*o}}function cC(r,t,e,n,i,a,s,o,l,c){var u,h=c.bbox,d=h===void 0?!0:h,f=c.length,g=f===void 0?!0:f,v=c.sampleSize,p=v===void 0?10:v,m=typeof l=="number",y=r,b=t,w=0,x=[y,b,w],S=[y,b],E=0,_={x:0,y:0},C=[{x:y,y:b}];m&&l<=0&&(_={x:y,y:b});for(var k=0;k<=p;k+=1){if(E=k/p,u=Y6(r,t,e,n,i,a,s,o,E),y=u.x,b=u.y,d&&C.push({x:y,y:b}),g&&(w+=fn(S,[y,b])),S=[y,b],m&&w>=l&&l>x[2]){var M=(w-l)/(w-x[2]);_={x:S[0]*(1-M)+x[0]*M,y:S[1]*(1-M)+x[1]*M}}x=[y,b,w]}return m&&l>=w&&(_={x:s,y:o}),{length:w,point:_,min:{x:Math.min.apply(null,C.map(function(T){return T.x})),y:Math.min.apply(null,C.map(function(T){return T.y}))},max:{x:Math.max.apply(null,C.map(function(T){return T.x})),y:Math.max.apply(null,C.map(function(T){return T.y}))}}}function X6(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 K6(r,t,e,n,i,a,s,o){var l,c=o.bbox,u=c===void 0?!0:c,h=o.length,d=h===void 0?!0:h,f=o.sampleSize,g=f===void 0?10:f,v=typeof s=="number",p=r,m=t,y=0,b=[p,m,y],w=[p,m],x=0,S={x:0,y:0},E=[{x:p,y:m}];v&&s<=0&&(S={x:p,y:m});for(var _=0;_<=g;_+=1){if(x=_/g,l=X6(r,t,e,n,i,a,x),p=l.x,m=l.y,u&&E.push({x:p,y:m}),d&&(y+=fn(w,[p,m])),w=[p,m],v&&y>=s&&s>b[2]){var C=(y-s)/(y-b[2]);S={x:w[0]*(1-C)+b[0]*C,y:w[1]*(1-C)+b[1]*C}}b=[p,m,y]}return v&&s>=y&&(S={x:i,y:a}),{length:y,point:S,min:{x:Math.min.apply(null,E.map(function(k){return k.x})),y:Math.min.apply(null,E.map(function(k){return k.y}))},max:{x:Math.max.apply(null,E.map(function(k){return k.x})),y:Math.max.apply(null,E.map(function(k){return k.y}))}}}function uC(r,t,e){for(var n,i,a,s,o,l,c=ru(r),u=typeof t=="number",h,d=[],f,g=0,v=0,p=0,m=0,y,b=[],w=[],x=0,S={x:0,y:0},E=S,_=S,C=S,k=0,M=0,T=c.length;M<T;M+=1)y=c[M],f=y[0],h=f==="M",d=h?d:[g,v].concat(y.slice(1)),h?(p=y[1],m=y[2],S={x:p,y:m},E=S,x=0,u&&t<.001&&(C=S)):f==="L"?(n=zm(d[0],d[1],d[2],d[3],(t||0)-k),x=n.length,S=n.min,E=n.max,_=n.point):f==="A"?(i=U6(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],d[8],(t||0)-k,e||{}),x=i.length,S=i.min,E=i.max,_=i.point):f==="C"?(a=cC(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],(t||0)-k,e||{}),x=a.length,S=a.min,E=a.max,_=a.point):f==="Q"?(s=K6(d[0],d[1],d[2],d[3],d[4],d[5],(t||0)-k,e||{}),x=s.length,S=s.min,E=s.max,_=s.point):f==="Z"&&(d=[g,v,p,m],o=zm(d[0],d[1],d[2],d[3],(t||0)-k),x=o.length,S=o.min,E=o.max,_=o.point),u&&k<t&&k+x>=t&&(C=_),w.push(E),b.push(S),k+=x,l=f!=="Z"?y.slice(-2):[p,m],g=l[0],v=l[1];return u&&t>=k&&(C={x:g,y:v}),{length:k,point:C,min:{x:Math.min.apply(null,b.map(function(O){return O.x})),y:Math.min.apply(null,b.map(function(O){return O.y}))},max:{x:Math.max.apply(null,w.map(function(O){return O.x})),y:Math.max.apply(null,w.map(function(O){return O.y}))}}}function Z6(r,t){return uC(r,void 0,q(q({},t),{bbox:!1,length:!0})).length}function J6(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 Q6(r,t){var e=r.length-1,n=[],i=0,a=0,s=J6(r);return s.forEach(function(o,l){r.slice(1).forEach(function(c,u){a+=fn(r[(l+u)%e].slice(-2),t[u%e].slice(-2))}),n[l]=a,a=0}),i=n.indexOf(Math.min.apply(null,n)),s[i]}function tD(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 eD(r){var t=0,e=0,n=0;return Bm(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],c=s[2],u=s[3],h=s[4],d=s[5];return n=tD(t,e,o,l,c,u,h,d),a=i.slice(-2),t=a[0],e=a[1],n}}).reduce(function(i,a){return i+a},0)}function G2(r){return eD(r)>=0}function nD(r,t,e){return uC(r,t,q(q({},e),{bbox:!1,length:!0})).point}function rD(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=Si(e,n,t),o=Si(n,i,t),l=Si(i,a,t),c=Si(s,o,t),u=Si(o,l,t),h=Si(c,u,t);return[["C"].concat(s,c,h),["C"].concat(u,l,a)]}function W2(r){return r.map(function(t,e,n){var i=e&&n[e-1].slice(-2).concat(t.slice(1)),a=e?cC(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?rD(i):[t,t]:s=[t],{s:t,ss:s,l:a}})}function hC(r,t,e){var n=W2(r),i=W2(t),a=n.length,s=i.length,o=n.filter(function(p){return p.l}).length,l=i.filter(function(p){return p.l}).length,c=n.filter(function(p){return p.l}).reduce(function(p,m){var y=m.l;return p+y},0)/o||0,u=i.filter(function(p){return p.l}).reduce(function(p,m){var y=m.l;return p+y},0)/l||0,h=e||Math.max(a,s),d=[c,u],f=[h-a,h-s],g=0,v=[n,i].map(function(p,m){return p.l===h?p.map(function(y){return y.s}):p.map(function(y,b){return g=b&&f[m]&&y.l>=d[m],f[m]-=g?1:0,g?y.ss:[y.s]}).flat()});return v[0].length===v[1].length?v:hC(v[0],v[1],h)}function $m(r){var t=document.createElement("div");t.innerHTML=r;var e=t.childNodes[0];return e&&t.contains(e)&&t.removeChild(e),e}function iD(r,t){for(;!{}.hasOwnProperty.call(r,t)&&(r=Yc(r))!==null;);return r}function jm(){return jm=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(r,t,e){var n=iD(r,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?r:e):i.value}},jm.apply(null,arguments)}function V2(r,t,e,n){var i=jm(Yc(r.prototype),t,e);return typeof i=="function"?function(a){return i.apply(e,a)}:i}function Qr(r,t,e,n){var i=r-e,a=t-n;return Math.sqrt(i*i+a*a)}function dC(r,t){var e=Math.min.apply(Math,Q([],N(r),!1)),n=Math.min.apply(Math,Q([],N(t),!1)),i=Math.max.apply(Math,Q([],N(r),!1)),a=Math.max.apply(Math,Q([],N(t),!1));return{x:e,y:n,width:i-e,height:a-n}}function aD(r,t,e){return Math.atan(-t/r*Math.tan(e))}function sD(r,t,e){return Math.atan(t/(r*Math.tan(e)))}function oD(r,t,e,n,i,a){return e*Math.cos(i)*Math.cos(a)-n*Math.sin(i)*Math.sin(a)+r}function lD(r,t,e,n,i,a){return e*Math.sin(i)*Math.cos(a)+n*Math.cos(i)*Math.sin(a)+t}function cD(r,t,e,n,i,a,s){for(var o=aD(e,n,i),l=1/0,c=-1/0,u=[a,s],h=-Math.PI*2;h<=Math.PI*2;h+=Math.PI){var d=o+h;a<s?a<d&&d<s&&u.push(d):s<d&&d<a&&u.push(d)}for(var h=0;h<u.length;h++){var f=oD(r,t,e,n,i,u[h]);f<l&&(l=f),f>c&&(c=f)}for(var g=sD(e,n,i),v=1/0,p=-1/0,m=[a,s],h=-Math.PI*2;h<=Math.PI*2;h+=Math.PI){var y=g+h;a<s?a<y&&y<s&&m.push(y):s<y&&y<a&&m.push(y)}for(var h=0;h<m.length;h++){var b=lD(r,t,e,n,i,m[h]);b<v&&(v=b),b>p&&(p=b)}return{x:l,y:v,width:c-l,height:p-v}}var uD=1e-4;function fC(r,t,e,n,i,a){var s=-1,o=1/0,l=[e,n],c=20;a&&a>200&&(c=a/10);for(var u=1/c,h=u/10,d=0;d<=c;d++){var f=d*u,g=[i.apply(void 0,Q([],N(r.concat([f])),!1)),i.apply(void 0,Q([],N(t.concat([f])),!1))],v=Qr(l[0],l[1],g[0],g[1]);v<o&&(s=f,o=v)}if(s===0)return{x:r[0],y:t[0]};if(s===1){var p=r.length;return{x:r[p-1],y:t[p-1]}}o=1/0;for(var d=0;d<32&&!(h<uD);d++){var m=s-h,y=s+h,g=[i.apply(void 0,Q([],N(r.concat([m])),!1)),i.apply(void 0,Q([],N(t.concat([m])),!1))],v=Qr(l[0],l[1],g[0],g[1]);if(m>=0&&v<o)s=m,o=v;else{var b=[i.apply(void 0,Q([],N(r.concat([y])),!1)),i.apply(void 0,Q([],N(t.concat([y])),!1))],w=Qr(l[0],l[1],b[0],b[1]);y<=1&&w<o?(s=y,o=w):h*=.5}}return{x:i.apply(void 0,Q([],N(r.concat([s])),!1)),y:i.apply(void 0,Q([],N(t.concat([s])),!1))}}function gC(r,t,e,n){return Qr(r,t,e,n)}function vC(r,t,e,n,i){return{x:(1-i)*r+i*e,y:(1-i)*t+i*n}}function hD(r,t,e,n,i,a){var s=[e-r,n-t];if(r6(s,[0,0]))return Math.sqrt((i-r)*(i-r)+(a-t)*(a-t));var o=[-s[1],s[0]];e6(o,o);var l=[i-r,a-t];return Math.abs(n6(l,o))}function qm(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 H2(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,c,u;if(_o(i,0))_o(a,0)||(l=-s/a,l>=0&&l<=1&&o.push(l));else{var h=a*a-4*i*s;_o(h,0)?o.push(-a/(2*i)):h>0&&(u=Math.sqrt(h),l=(-a+u)/(2*i),c=(-a-u)/(2*i),l>=0&&l<=1&&o.push(l),c>=0&&c<=1&&o.push(c))}return o}function dD(r,t,e,n,i,a,s,o){for(var l=[r,s],c=[t,o],u=H2(r,e,i,s),h=H2(t,n,a,o),d=0;d<u.length;d++)l.push(qm(r,e,i,s,u[d]));for(var d=0;d<h.length;d++)c.push(qm(t,n,a,o,h[d]));return dC(l,c)}function fD(r,t,e,n,i,a,s,o,l,c,u){return fC([r,e,i,s],[t,n,a,o],l,c,qm,u)}function U2(r,t,e,n,i,a,s,o,l,c,u){var h=fD(r,t,e,n,i,a,s,o,l,c,u);return Qr(h.x,h.y,l,c)}function gD(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+=Qr(n[0],n[1],i[0],i[1])}return t}function vD(r){return gD(r)}function Gm(r,t,e,n){var i=1-n;return i*i*r+2*n*i*t+n*n*e}function Y2(r,t,e){var n=r+e-2*t;if(_o(n,0))return[.5];var i=(r-t)/n;return i<=1&&i>=0?[i]:[]}function pD(r,t,e,n,i,a){var s=Y2(r,e,i)[0],o=Y2(t,n,a)[0],l=[r,i],c=[t,a];return s!==void 0&&l.push(Gm(r,e,i,s)),o!==void 0&&c.push(Gm(t,n,a,o)),dC(l,c)}function mD(r,t,e,n,i,a,s,o){return fC([r,e,i],[t,n,a],s,o,Gm)}function yD(r,t,e,n,i,a,s,o){var l=mD(r,t,e,n,i,a,s,o);return Qr(l.x,l.y,s,o)}function We(){We=function(){return t};var r,t={},e=Object.prototype,n=e.hasOwnProperty,i=Object.defineProperty||function(L,P,A){L[P]=A.value},a=typeof Symbol=="function"?Symbol:{},s=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function c(L,P,A){return Object.defineProperty(L,P,{value:A,enumerable:!0,configurable:!0,writable:!0}),L[P]}try{c({},"")}catch{c=function(A,I,B){return A[I]=B}}function u(L,P,A,I){var B=P&&P.prototype instanceof m?P:m,j=Object.create(B.prototype),G=new R(I||[]);return i(j,"_invoke",{value:k(L,A,G)}),j}function h(L,P,A){try{return{type:"normal",arg:L.call(P,A)}}catch(I){return{type:"throw",arg:I}}}t.wrap=u;var d="suspendedStart",f="suspendedYield",g="executing",v="completed",p={};function m(){}function y(){}function b(){}var w={};c(w,s,function(){return this});var x=Object.getPrototypeOf,S=x&&x(x(D([])));S&&S!==e&&n.call(S,s)&&(w=S);var E=b.prototype=m.prototype=Object.create(w);function _(L){["next","throw","return"].forEach(function(P){c(L,P,function(A){return this._invoke(P,A)})})}function C(L,P){function A(B,j,G,H){var Y=h(L[B],L,j);if(Y.type!=="throw"){var K=Y.arg,tt=K.value;return tt&&P2(tt)=="object"&&n.call(tt,"__await")?P.resolve(tt.__await).then(function(it){A("next",it,G,H)},function(it){A("throw",it,G,H)}):P.resolve(tt).then(function(it){K.value=it,G(K)},function(it){return A("throw",it,G,H)})}H(Y.arg)}var I;i(this,"_invoke",{value:function(j,G){function H(){return new P(function(Y,K){A(j,G,Y,K)})}return I=I?I.then(H,H):H()}})}function k(L,P,A){var I=d;return function(B,j){if(I===g)throw Error("Generator is already running");if(I===v){if(B==="throw")throw j;return{value:r,done:!0}}for(A.method=B,A.arg=j;;){var G=A.delegate;if(G){var H=M(G,A);if(H){if(H===p)continue;return H}}if(A.method==="next")A.sent=A._sent=A.arg;else if(A.method==="throw"){if(I===d)throw I=v,A.arg;A.dispatchException(A.arg)}else A.method==="return"&&A.abrupt("return",A.arg);I=g;var Y=h(L,P,A);if(Y.type==="normal"){if(I=A.done?v:f,Y.arg===p)continue;return{value:Y.arg,done:A.done}}Y.type==="throw"&&(I=v,A.method="throw",A.arg=Y.arg)}}}function M(L,P){var A=P.method,I=L.iterator[A];if(I===r)return P.delegate=null,A==="throw"&&L.iterator.return&&(P.method="return",P.arg=r,M(L,P),P.method==="throw")||A!=="return"&&(P.method="throw",P.arg=new TypeError("The iterator does not provide a '"+A+"' method")),p;var B=h(I,L.iterator,P.arg);if(B.type==="throw")return P.method="throw",P.arg=B.arg,P.delegate=null,p;var j=B.arg;return j?j.done?(P[L.resultName]=j.value,P.next=L.nextLoc,P.method!=="return"&&(P.method="next",P.arg=r),P.delegate=null,p):j:(P.method="throw",P.arg=new TypeError("iterator result is not an object"),P.delegate=null,p)}function T(L){var P={tryLoc:L[0]};1 in L&&(P.catchLoc=L[1]),2 in L&&(P.finallyLoc=L[2],P.afterLoc=L[3]),this.tryEntries.push(P)}function O(L){var P=L.completion||{};P.type="normal",delete P.arg,L.completion=P}function R(L){this.tryEntries=[{tryLoc:"root"}],L.forEach(T,this),this.reset(!0)}function D(L){if(L||L===""){var P=L[s];if(P)return P.call(L);if(typeof L.next=="function")return L;if(!isNaN(L.length)){var A=-1,I=function B(){for(;++A<L.length;)if(n.call(L,A))return B.value=L[A],B.done=!1,B;return B.value=r,B.done=!0,B};return I.next=I}}throw new TypeError(P2(L)+" is not iterable")}return y.prototype=b,i(E,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:y,configurable:!0}),y.displayName=c(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(L){var P=typeof L=="function"&&L.constructor;return!!P&&(P===y||(P.displayName||P.name)==="GeneratorFunction")},t.mark=function(L){return Object.setPrototypeOf?Object.setPrototypeOf(L,b):(L.__proto__=b,c(L,l,"GeneratorFunction")),L.prototype=Object.create(E),L},t.awrap=function(L){return{__await:L}},_(C.prototype),c(C.prototype,o,function(){return this}),t.AsyncIterator=C,t.async=function(L,P,A,I,B){B===void 0&&(B=Promise);var j=new C(u(L,P,A,I),B);return t.isGeneratorFunction(P)?j:j.next().then(function(G){return G.done?G.value:j.next()})},_(E),c(E,l,"Generator"),c(E,s,function(){return this}),c(E,"toString",function(){return"[object Generator]"}),t.keys=function(L){var P=Object(L),A=[];for(var I in P)A.push(I);return A.reverse(),function B(){for(;A.length;){var j=A.pop();if(j in P)return B.value=j,B.done=!1,B}return B.done=!0,B}},t.values=D,R.prototype={constructor:R,reset:function(P){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(O),!P)for(var A in this)A.charAt(0)==="t"&&n.call(this,A)&&!isNaN(+A.slice(1))&&(this[A]=r)},stop:function(){this.done=!0;var P=this.tryEntries[0].completion;if(P.type==="throw")throw P.arg;return this.rval},dispatchException:function(P){if(this.done)throw P;var A=this;function I(K,tt){return G.type="throw",G.arg=P,A.next=K,tt&&(A.method="next",A.arg=r),!!tt}for(var B=this.tryEntries.length-1;B>=0;--B){var j=this.tryEntries[B],G=j.completion;if(j.tryLoc==="root")return I("end");if(j.tryLoc<=this.prev){var H=n.call(j,"catchLoc"),Y=n.call(j,"finallyLoc");if(H&&Y){if(this.prev<j.catchLoc)return I(j.catchLoc,!0);if(this.prev<j.finallyLoc)return I(j.finallyLoc)}else if(H){if(this.prev<j.catchLoc)return I(j.catchLoc,!0)}else{if(!Y)throw Error("try statement without catch or finally");if(this.prev<j.finallyLoc)return I(j.finallyLoc)}}}},abrupt:function(P,A){for(var I=this.tryEntries.length-1;I>=0;--I){var B=this.tryEntries[I];if(B.tryLoc<=this.prev&&n.call(B,"finallyLoc")&&this.prev<B.finallyLoc){var j=B;break}}j&&(P==="break"||P==="continue")&&j.tryLoc<=A&&A<=j.finallyLoc&&(j=null);var G=j?j.completion:{};return G.type=P,G.arg=A,j?(this.method="next",this.next=j.finallyLoc,p):this.complete(G)},complete:function(P,A){if(P.type==="throw")throw P.arg;return P.type==="break"||P.type==="continue"?this.next=P.arg:P.type==="return"?(this.rval=this.arg=P.arg,this.method="return",this.next="end"):P.type==="normal"&&A&&(this.next=A),p},finish:function(P){for(var A=this.tryEntries.length-1;A>=0;--A){var I=this.tryEntries[A];if(I.finallyLoc===P)return this.complete(I.completion,I.afterLoc),O(I),p}},catch:function(P){for(var A=this.tryEntries.length-1;A>=0;--A){var I=this.tryEntries[A];if(I.tryLoc===P){var B=I.completion;if(B.type==="throw"){var j=B.arg;O(I)}return j}}throw Error("illegal catch attempt")},delegateYield:function(P,A,I){return this.delegate={iterator:D(P),resultName:A,nextLoc:I},this.method==="next"&&(this.arg=r),p}},t}function ma(r,t){var e=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!e){if(Array.isArray(r)||(e=QN(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(c){throw c},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 c=e.next();return s=c.done,c},e:function(c){o=!0,a=c},f:function(){try{s||e.return==null||e.return()}finally{if(o)throw a}}}}function bD(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 Ga(r,t){if(r==null)return{};var e,n,i=bD(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 wD=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},pC={exports:{}};(function(r,t){(function(e,n){r.exports=n()})(wD,function(){function e(x,S,E,_,C){n(x,S,E||0,_||x.length-1,C||a)}function n(x,S,E,_,C){for(;_>E;){if(_-E>600){var k=_-E+1,M=S-E+1,T=Math.log(k),O=.5*Math.exp(2*T/3),R=.5*Math.sqrt(T*O*(k-O)/k)*(M-k/2<0?-1:1),D=Math.max(E,Math.floor(S-M*O/k+R)),L=Math.min(_,Math.floor(S+(k-M)*O/k+R));n(x,S,D,L,C)}var P=x[S],A=E,I=_;for(i(x,E,S),C(x[_],P)>0&&i(x,E,_);A<I;){for(i(x,A,I),A++,I--;C(x[A],P)<0;)A++;for(;C(x[I],P)>0;)I--}C(x[E],P)===0?i(x,E,I):(I++,i(x,I,_)),I<=S&&(E=I+1),S<=I&&(_=I-1)}}function i(x,S,E){var _=x[S];x[S]=x[E],x[E]=_}function a(x,S){return x<S?-1:x>S?1:0}var s=function(S){S===void 0&&(S=9),this._maxEntries=Math.max(4,S),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(S){var E=this.data,_=[];if(!y(S,E))return _;for(var C=this.toBBox,k=[];E;){for(var M=0;M<E.children.length;M++){var T=E.children[M],O=E.leaf?C(T):T;y(S,O)&&(E.leaf?_.push(T):m(S,O)?this._all(T,_):k.push(T))}E=k.pop()}return _},s.prototype.collides=function(S){var E=this.data;if(!y(S,E))return!1;for(var _=[];E;){for(var C=0;C<E.children.length;C++){var k=E.children[C],M=E.leaf?this.toBBox(k):k;if(y(S,M)){if(E.leaf||m(S,M))return!0;_.push(k)}}E=_.pop()}return!1},s.prototype.load=function(S){if(!(S&&S.length))return this;if(S.length<this._minEntries){for(var E=0;E<S.length;E++)this.insert(S[E]);return this}var _=this._build(S.slice(),0,S.length-1,0);if(!this.data.children.length)this.data=_;else if(this.data.height===_.height)this._splitRoot(this.data,_);else{if(this.data.height<_.height){var C=this.data;this.data=_,_=C}this._insert(_,this.data.height-_.height-1,!0)}return this},s.prototype.insert=function(S){return S&&this._insert(S,this.data.height-1),this},s.prototype.clear=function(){return this.data=b([]),this},s.prototype.remove=function(S,E){if(!S)return this;for(var _=this.data,C=this.toBBox(S),k=[],M=[],T,O,R;_||k.length;){if(_||(_=k.pop(),O=k[k.length-1],T=M.pop(),R=!0),_.leaf){var D=o(S,_.children,E);if(D!==-1)return _.children.splice(D,1),k.push(_),this._condense(k),this}!R&&!_.leaf&&m(_,C)?(k.push(_),M.push(T),T=0,O=_,_=_.children[0]):O?(T++,_=O.children[T],R=!1):_=null}return this},s.prototype.toBBox=function(S){return S},s.prototype.compareMinX=function(S,E){return S.minX-E.minX},s.prototype.compareMinY=function(S,E){return S.minY-E.minY},s.prototype.toJSON=function(){return this.data},s.prototype.fromJSON=function(S){return this.data=S,this},s.prototype._all=function(S,E){for(var _=[];S;)S.leaf?E.push.apply(E,S.children):_.push.apply(_,S.children),S=_.pop();return E},s.prototype._build=function(S,E,_,C){var k=_-E+1,M=this._maxEntries,T;if(k<=M)return T=b(S.slice(E,_+1)),l(T,this.toBBox),T;C||(C=Math.ceil(Math.log(k)/Math.log(M)),M=Math.ceil(k/Math.pow(M,C-1))),T=b([]),T.leaf=!1,T.height=C;var O=Math.ceil(k/M),R=O*Math.ceil(Math.sqrt(M));w(S,E,_,R,this.compareMinX);for(var D=E;D<=_;D+=R){var L=Math.min(D+R-1,_);w(S,D,L,O,this.compareMinY);for(var P=D;P<=L;P+=O){var A=Math.min(P+O-1,L);T.children.push(this._build(S,P,A,C-1))}}return l(T,this.toBBox),T},s.prototype._chooseSubtree=function(S,E,_,C){for(;C.push(E),!(E.leaf||C.length-1===_);){for(var k=1/0,M=1/0,T=void 0,O=0;O<E.children.length;O++){var R=E.children[O],D=f(R),L=v(S,R)-D;L<M?(M=L,k=D<k?D:k,T=R):L===M&&D<k&&(k=D,T=R)}E=T||E.children[0]}return E},s.prototype._insert=function(S,E,_){var C=_?S:this.toBBox(S),k=[],M=this._chooseSubtree(C,this.data,E,k);for(M.children.push(S),u(M,C);E>=0&&k[E].children.length>this._maxEntries;)this._split(k,E),E--;this._adjustParentBBoxes(C,k,E)},s.prototype._split=function(S,E){var _=S[E],C=_.children.length,k=this._minEntries;this._chooseSplitAxis(_,k,C);var M=this._chooseSplitIndex(_,k,C),T=b(_.children.splice(M,_.children.length-M));T.height=_.height,T.leaf=_.leaf,l(_,this.toBBox),l(T,this.toBBox),E?S[E-1].children.push(T):this._splitRoot(_,T)},s.prototype._splitRoot=function(S,E){this.data=b([S,E]),this.data.height=S.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},s.prototype._chooseSplitIndex=function(S,E,_){for(var C,k=1/0,M=1/0,T=E;T<=_-E;T++){var O=c(S,0,T,this.toBBox),R=c(S,T,_,this.toBBox),D=p(O,R),L=f(O)+f(R);D<k?(k=D,C=T,M=L<M?L:M):D===k&&L<M&&(M=L,C=T)}return C||_-E},s.prototype._chooseSplitAxis=function(S,E,_){var C=S.leaf?this.compareMinX:h,k=S.leaf?this.compareMinY:d,M=this._allDistMargin(S,E,_,C),T=this._allDistMargin(S,E,_,k);M<T&&S.children.sort(C)},s.prototype._allDistMargin=function(S,E,_,C){S.children.sort(C);for(var k=this.toBBox,M=c(S,0,E,k),T=c(S,_-E,_,k),O=g(M)+g(T),R=E;R<_-E;R++){var D=S.children[R];u(M,S.leaf?k(D):D),O+=g(M)}for(var L=_-E-1;L>=E;L--){var P=S.children[L];u(T,S.leaf?k(P):P),O+=g(T)}return O},s.prototype._adjustParentBBoxes=function(S,E,_){for(var C=_;C>=0;C--)u(E[C],S)},s.prototype._condense=function(S){for(var E=S.length-1,_=void 0;E>=0;E--)S[E].children.length===0?E>0?(_=S[E-1].children,_.splice(_.indexOf(S[E]),1)):this.clear():l(S[E],this.toBBox)};function o(x,S,E){if(!E)return S.indexOf(x);for(var _=0;_<S.length;_++)if(E(x,S[_]))return _;return-1}function l(x,S){c(x,0,x.children.length,S,x)}function c(x,S,E,_,C){C||(C=b(null)),C.minX=1/0,C.minY=1/0,C.maxX=-1/0,C.maxY=-1/0;for(var k=S;k<E;k++){var M=x.children[k];u(C,x.leaf?_(M):M)}return C}function u(x,S){return x.minX=Math.min(x.minX,S.minX),x.minY=Math.min(x.minY,S.minY),x.maxX=Math.max(x.maxX,S.maxX),x.maxY=Math.max(x.maxY,S.maxY),x}function h(x,S){return x.minX-S.minX}function d(x,S){return x.minY-S.minY}function f(x){return(x.maxX-x.minX)*(x.maxY-x.minY)}function g(x){return x.maxX-x.minX+(x.maxY-x.minY)}function v(x,S){return(Math.max(S.maxX,x.maxX)-Math.min(S.minX,x.minX))*(Math.max(S.maxY,x.maxY)-Math.min(S.minY,x.minY))}function p(x,S){var E=Math.max(x.minX,S.minX),_=Math.max(x.minY,S.minY),C=Math.min(x.maxX,S.maxX),k=Math.min(x.maxY,S.maxY);return Math.max(0,C-E)*Math.max(0,k-_)}function m(x,S){return x.minX<=S.minX&&x.minY<=S.minY&&S.maxX<=x.maxX&&S.maxY<=x.maxY}function y(x,S){return S.minX<=x.maxX&&S.minY<=x.maxY&&S.maxX>=x.minX&&S.maxY>=x.minY}function b(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function w(x,S,E,_,C){for(var k=[S,E];k.length;)if(E=k.pop(),S=k.pop(),!(E-S<=_)){var M=S+Math.ceil((E-S)/_/2)*_;e(x,M,S,E,C),k.push(S,M,M,E)}}return s})})(pC);var xD=pC.exports,$=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}({}),Fc=function(r){return r[r.ZERO=0]="ZERO",r[r.NEGATIVE_ONE=1]="NEGATIVE_ONE",r}({}),Ji=function(){function r(){V(this,r),this.plugins=[]}return W(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)})}}])}(),ED=function(){function r(t){V(this,r),this.clipSpaceNearZ=Fc.NEGATIVE_ONE,this.plugins=[],this.config=vt({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1,enableSizeAttenuation:!0,enableRenderingOptimization:!1},t)}return W(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)}}])}(),Bd=Fi,ts=Er,SD=GL,_D=qL,X2=Zc,zd=UL,Vt=function(){function r(){V(this,r),this.center=[0,0,0],this.halfExtents=[0,0,0],this.min=[0,0,0],this.max=[0,0,0]}return W(r,[{key:"update",value:function(e,n){ts(this.center,e),ts(this.halfExtents,n),zd(this.min,this.center,this.halfExtents),Bd(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(e,n){Bd(this.center,n,e),X2(this.center,this.center,.5),zd(this.halfExtents,n,e),X2(this.halfExtents,this.halfExtents,.5),ts(this.min,e),ts(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],c=o[1],u=o[2],h=i-l,d=i+l,f=a-c,g=a+c,v=s-u,p=s+u,m=e.center,y=m[0],b=m[1],w=m[2],x=e.halfExtents,S=x[0],E=x[1],_=x[2],C=y-S,k=y+S,M=b-E,T=b+E,O=w-_,R=w+_;C<h&&(h=C),k>d&&(d=k),M<f&&(f=M),T>g&&(g=T),O<v&&(v=O),R>p&&(p=R),n[0]=(h+d)*.5,n[1]=(f+g)*.5,n[2]=(v+p)*.5,o[0]=(d-h)*.5,o[1]=(g-f)*.5,o[2]=(p-v)*.5,this.min[0]=h,this.min[1]=f,this.min[2]=v,this.max[0]=d,this.max[1]=g,this.max[2]=p}}},{key:"setFromTransformedAABB",value:function(e,n){var i=this.center,a=this.halfExtents,s=e.center,o=e.halfExtents,l=n[0],c=n[4],u=n[8],h=n[1],d=n[5],f=n[9],g=n[2],v=n[6],p=n[10],m=Math.abs(l),y=Math.abs(c),b=Math.abs(u),w=Math.abs(h),x=Math.abs(d),S=Math.abs(f),E=Math.abs(g),_=Math.abs(v),C=Math.abs(p);i[0]=n[12]+l*s[0]+c*s[1]+u*s[2],i[1]=n[13]+h*s[0]+d*s[1]+f*s[2],i[2]=n[14]+g*s[0]+v*s[1]+p*s[2],a[0]=m*o[0]+y*o[1]+b*o[2],a[1]=w*o[0]+x*o[1]+S*o[2],a[2]=E*o[0]+_*o[1]+C*o[2],zd(this.min,i,a),Bd(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=SD([0,0,0],this.getMin(),e.getMin()),a=_D([0,0,0],this.getMax(),e.getMax());return n.setMinMax(i,a),n}},{key:"getNegativeFarPoint",value:function(e){return e.pnVertexFlag===273?ts([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?ts([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}}])}(),kD=function(){function r(t,e){V(this,r),this.distance=t||0,this.normal=e||Yt(0,1,0),this.updatePNVertexFlag()}return W(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 Sr(e,this.normal)-this.distance}},{key:"normalize",value:function(){var e=1/JM(this.normal);Zc(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&&Rm(i,e,n,o),l}}])}(),es=function(r){return r[r.OUTSIDE=4294967295]="OUTSIDE",r[r.INSIDE=0]="INSIDE",r[r.INDETERMINATE=2147483647]="INDETERMINATE",r}({}),MD=function(){function r(t){if(V(this,r),this.planes=[],t)this.planes=t;else for(var e=0;e<6;e++)this.planes.push(new kD)}return W(r,[{key:"extractFromVPMatrix",value:function(e){var n=dt(e,16),i=n[0],a=n[1],s=n[2],o=n[3],l=n[4],c=n[5],u=n[6],h=n[7],d=n[8],f=n[9],g=n[10],v=n[11],p=n[12],m=n[13],y=n[14],b=n[15];Ze(this.planes[0].normal,o-i,h-l,v-d),this.planes[0].distance=b-p,Ze(this.planes[1].normal,o+i,h+l,v+d),this.planes[1].distance=b+p,Ze(this.planes[2].normal,o+a,h+c,v+f),this.planes[2].distance=b+m,Ze(this.planes[3].normal,o-a,h-c,v-f),this.planes[3].distance=b-m,Ze(this.planes[4].normal,o-s,h-u,v-g),this.planes[4].distance=b-y,Ze(this.planes[5].normal,o+s,h+u,v+g),this.planes[5].distance=b+y,this.planes.forEach(function(w){w.normalize(),w.updatePNVertexFlag()})}}])}(),qe=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;V(this,r),this.x=0,this.y=0,this.x=t,this.y=e}return W(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}}])}(),Os=function(){function r(t,e,n,i){V(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 W(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=ao(e.x,e.y,0,1),a=ao(e.x+e.width,e.y,0,1),s=ao(e.x,e.y+e.height,0,1),o=ao(e.x+e.width,e.y+e.height,0,1),l=_r(),c=_r(),u=_r(),h=_r();Ur(l,i,n),Ur(c,a,n),Ur(u,s,n),Ur(h,o,n);var d=Math.min(l[0],c[0],u[0],h[0]),f=Math.min(l[1],c[1],u[1],h[1]),g=Math.max(l[0],c[0],u[0],h[0]),v=Math.max(l[1],c[1],u[1],h[1]);return r.fromRect({x:d,y:f,width:g-d,height:v-f})}}])}(),Ft="Method not implemented.",ns="Use document.documentElement instead.",CD="Cannot append a destroyed element.";function ws(r){return r===void 0?0:r>360||r<-360?r%360:r}var $d=St();function en(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?zr(r):Er($d,r):nt(r)?n?Yt(r,t,e):Ze($d,r,t,e):n?Yt(r[0],r[1]||t,r[2]||e):Ze($d,r[0],r[1]||t,r[2]||e)}var TD=Math.PI/180;function Bt(r){return r*TD}var OD=180/Math.PI;function gn(r){return r*OD}function AD(r){return 360*r}var iu=Math.PI/2;function PD(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e*e,o=n*n,l=i*i,c=a*a,u=s+o+l+c,h=e*a-n*i;return h>.499995*u?(r[0]=iu,r[1]=2*Math.atan2(n,e),r[2]=0):h<-.499995*u?(r[0]=-iu,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+c)),r[2]=Math.atan2(2*(e*n+i*a),1-2*(o+l))),r}function ND(r,t){var e,n,i=Cs(St(),t),a=dt(i,3),s=a[0],o=a[1],l=a[2],c=Math.asin(-t[2]/s);return c<iu?c>-iu?(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]=c,r[2]=n,r}function jd(r,t){return t.length===16?ND(r,t):PD(r,t)}function RD(r,t,e,n,i){var a=Math.cos(r),s=Math.sin(r);return EL(n*a,i*s,0,-n*s,i*a,0,t,e,1)}function LD(r,t,e,n,i,a,s){var o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1,l=2*a,c=e-t,u=n-i,h=l/c,d=l/u,f=(e+t)/c,g=(n+i)/u,v,p,m=s-a,y=s*a;return o?(v=-s/m,p=-y/m):(v=-(s+a)/m,p=-2*y/m),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]=f,r[9]=g,r[10]=v,r[11]=-1,r[12]=0,r[13]=0,r[14]=p,r[15]=0,r}function K2(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 c=1/s;n*=c,i*=c}var u=Math.atan2(e,t),h=gn(u);return[r[6],r[7],a,s,h]}var vr=Wt(),er=Wt(),Ys=_r(),lt=[St(),St(),St()],Z2=St();function DD(r,t,e,n,i,a){if(!ID(vr,r)||(Ms(er,vr),er[3]=0,er[7]=0,er[11]=0,er[15]=1,Math.abs(FM(er))<1e-8))return!1;var s=vr[3],o=vr[7],l=vr[11],c=vr[12],u=vr[13],h=vr[14],d=vr[15];if(s!==0||o!==0||l!==0){Ys[0]=s,Ys[1]=o,Ys[2]=l,Ys[3]=d;var f=xr(er,er);if(!f)return!1;IM(er,er),Ur(i,Ys,er)}else i[0]=i[1]=i[2]=0,i[3]=1;if(t[0]=c,t[1]=u,t[2]=h,FD(lt,vr),e[0]=qr(lt[0]),Ma(lt[0],lt[0]),n[0]=Sr(lt[0],lt[1]),qd(lt[1],lt[1],lt[0],1,-n[0]),e[1]=qr(lt[1]),Ma(lt[1],lt[1]),n[0]/=e[1],n[1]=Sr(lt[0],lt[2]),qd(lt[2],lt[2],lt[0],1,-n[1]),n[2]=Sr(lt[1],lt[2]),qd(lt[2],lt[2],lt[1],1,-n[2]),e[2]=qr(lt[2]),Ma(lt[2],lt[2]),n[1]/=e[2],n[2]/=e[2],Dc(Z2,lt[1],lt[2]),Sr(lt[0],Z2)<0)for(var g=0;g<3;g++)e[g]*=-1,lt[g][0]*=-1,lt[g][1]*=-1,lt[g][2]*=-1;return a[0]=.5*Math.sqrt(Math.max(1+lt[0][0]-lt[1][1]-lt[2][2],0)),a[1]=.5*Math.sqrt(Math.max(1-lt[0][0]+lt[1][1]-lt[2][2],0)),a[2]=.5*Math.sqrt(Math.max(1-lt[0][0]-lt[1][1]+lt[2][2],0)),a[3]=.5*Math.sqrt(Math.max(1+lt[0][0]+lt[1][1]+lt[2][2],0)),lt[2][1]>lt[1][2]&&(a[0]=-a[0]),lt[0][2]>lt[2][0]&&(a[1]=-a[1]),lt[1][0]>lt[0][1]&&(a[2]=-a[2]),!0}function ID(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 FD(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 qd(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 It=function(r){return r[r.ORBITING=0]="ORBITING",r[r.EXPLORING=1]="EXPLORING",r[r.TRACKING=2]="TRACKING",r}({}),Wm=function(r){return r[r.DEFAULT=0]="DEFAULT",r[r.ROTATIONAL=1]="ROTATIONAL",r[r.TRANSLATIONAL=2]="TRANSLATIONAL",r[r.CINEMATIC=3]="CINEMATIC",r}({}),jn=function(r){return r[r.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",r[r.PERSPECTIVE=1]="PERSPECTIVE",r}({}),mC={UPDATED:"updated"},J2=2e-4,yC=function(){function r(){V(this,r),this.clipSpaceNearZ=Fc.NEGATIVE_ONE,this.eventEmitter=new NM,this.matrix=Wt(),this.right=Yt(1,0,0),this.up=Yt(0,1,0),this.forward=Yt(0,0,1),this.position=Yt(0,0,1),this.focalPoint=Yt(0,0,0),this.distanceVector=Yt(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=Wt(),this.projectionMatrixInverse=Wt(),this.jitteredProjectionMatrix=void 0,this.enableUpdate=!0,this.type=It.EXPLORING,this.trackingMode=Wm.DEFAULT,this.projectionMode=jn.PERSPECTIVE,this.frustum=new MD,this.orthoMatrix=Wt()}return W(r,[{key:"isOrtho",value:function(){return this.projectionMode===jn.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===It.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===It.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!==It.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 xr(Wt(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"jitterProjectionMatrix",value:function(e,n){var i=ki(Wt(),[e,n,0]);this.jitteredProjectionMatrix=Je(Wt(),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===jn.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===jn.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===jn.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===jn.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===jn.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===jn.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]}),c=l.x,u=l.y,h=Yt(c-a,u-s,0),d=Sr(h,this.right)/qr(this.right),f=Sr(h,this.up)/qr(this.up),g=this.getPosition(),v=dt(g,2),p=v[0],m=v[1],y=this.getFocalPoint(),b=dt(y,2),w=b[0],x=b[1];return this.setPosition(p-d,m-f),this.setFocalPoint(w-d,x-f),this}},{key:"setPerspective",value:function(e,n,i,a){var s;this.projectionMode=jn.PERSPECTIVE,this.fov=i,this.near=e,this.far=n,this.aspect=a;var o=this.near*Math.tan(Bt(.5*this.fov))/this.zoom,l=2*o,c=this.aspect*l,u=-.5*c;if((s=this.view)!==null&&s!==void 0&&s.enabled){var h=this.view.fullWidth,d=this.view.fullHeight;u+=this.view.offsetX*c/h,o-=this.view.offsetY*l/d,c*=this.view.width/h,l*=this.view.height/d}return LD(this.projectionMatrix,u,u+c,o-l,o,e,this.far,this.clipSpaceNearZ===Fc.ZERO),xr(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this}},{key:"setOrthographic",value:function(e,n,i,a,s,o){var l;this.projectionMode=jn.ORTHOGRAPHIC,this.rright=n,this.left=e,this.top=i,this.bottom=a,this.near=s,this.far=o;var c=(this.rright-this.left)/(2*this.zoom),u=(this.top-this.bottom)/(2*this.zoom),h=(this.rright+this.left)/2,d=(this.top+this.bottom)/2,f=h-c,g=h+c,v=d+u,p=d-u;if((l=this.view)!==null&&l!==void 0&&l.enabled){var m=(this.rright-this.left)/this.view.fullWidth/this.zoom,y=(this.top-this.bottom)/this.view.fullHeight/this.zoom;f+=m*this.view.offsetX,g=f+m*this.view.width,v-=y*this.view.offsetY,p=v-y*this.view.height}return this.clipSpaceNearZ===Fc.NEGATIVE_ONE?UM(this.projectionMatrix,f,g,v,p,s,o):YM(this.projectionMatrix,f,g,v,p,s,o),xr(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=en(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=Yt(0,1,0);if(this.focalPoint=en(e,n,i),this.trackingMode===Wm.CINEMATIC){var s=Nm(St(),this.focalPoint,this.position);e=s[0],n=s[1],i=s[2];var o=qr(s),l=gn(Math.asin(n/o)),c=90+gn(Math.atan2(i,e)),u=Wt();$M(u,u,Bt(c)),zM(u,u,Bt(l)),a=Qe(St(),[0,1,0],u)}return xr(this.matrix,XM(Wt(),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<J2&&(this.distance=J2),this.dollyingStep=this.distance/100;var n=St();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=ws(e),this.computeMatrix(),this._getAxes(),this.type===It.ORBITING||this.type===It.EXPLORING?this._getPosition():this.type===It.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getAzimuth",value:function(){return this.azimuth}},{key:"setElevation",value:function(e){return this.elevation=ws(e),this.computeMatrix(),this._getAxes(),this.type===It.ORBITING||this.type===It.EXPLORING?this._getPosition():this.type===It.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getElevation",value:function(){return this.elevation}},{key:"setRoll",value:function(e){return this.roll=ws(e),this.computeMatrix(),this._getAxes(),this.type===It.ORBITING||this.type===It.EXPLORING?this._getPosition():this.type===It.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=Ti(Te(),[0,0,1],Bt(this.roll));Wi(this.matrix);var n=Ti(Te(),[1,0,0],Bt((this.rotateWorld&&this.type!==It.TRACKING||this.type===It.TRACKING?1:-1)*this.elevation)),i=Ti(Te(),[0,1,0],Bt((this.rotateWorld&&this.type!==It.TRACKING||this.type===It.TRACKING?1:-1)*this.azimuth)),a=Bi(Te(),i,n);a=Bi(Te(),a,e);var s=n1(Wt(),a);this.type===It.ORBITING||this.type===It.EXPLORING?(bs(this.matrix,this.matrix,this.focalPoint),Je(this.matrix,this.matrix,s),bs(this.matrix,this.matrix,[0,0,this.distance])):this.type===It.TRACKING&&(bs(this.matrix,this.matrix,this.position),Je(this.matrix,this.matrix,s))}},{key:"_setPosition",value:function(e,n,i){this.position=en(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(){Er(this.right,en(Ur(_r(),[1,0,0,0],this.matrix))),Er(this.up,en(Ur(_r(),[0,1,0,0],this.matrix))),Er(this.forward,en(Ur(_r(),[0,0,1,0],this.matrix))),Ma(this.right,this.right),Ma(this.up,this.up),Ma(this.forward,this.forward)}},{key:"_getAngles",value:function(){var e=this.distanceVector[0],n=this.distanceVector[1],i=this.distanceVector[2],a=qr(this.distanceVector);if(a===0){this.elevation=0,this.azimuth=0;return}this.type===It.TRACKING?(this.elevation=gn(Math.asin(n/a)),this.azimuth=gn(Math.atan2(-e,-i))):this.rotateWorld?(this.elevation=gn(Math.asin(n/a)),this.azimuth=gn(Math.atan2(-e,-i))):(this.elevation=-gn(Math.asin(n/a)),this.azimuth=-gn(Math.atan2(-e,-i)))}},{key:"_getPosition",value:function(){Er(this.position,en(Ur(_r(),[0,0,0,1],this.matrix))),this._getDistance()}},{key:"_getFocalPoint",value:function(){VL(this.distanceVector,[0,0,-this.distance],xL(RM(),this.matrix)),Fi(this.focalPoint,this.position,this.distanceVector),this._getDistance()}},{key:"_getDistance",value:function(){this.distanceVector=Nm(St(),this.focalPoint,this.position),this.distance=qr(this.distanceVector),this.dollyingStep=this.distance/100}},{key:"_getOrthoMatrix",value:function(){if(this.projectionMode===jn.ORTHOGRAPHIC){var e=this.position,n=Ti(Te(),[0,0,1],-this.roll*Math.PI/180);So(this.orthoMatrix,n,Yt((this.rright-this.left)/2-e[0],(this.top-this.bottom)/2-e[1],0),Yt(this.zoom,this.zoom,1),e)}}},{key:"triggerUpdate",value:function(){if(this.enableUpdate){var e=this.getViewTransform(),n=Je(Wt(),this.getPerspective(),e);this.getFrustum().extractFromVPMatrix(n),this.eventEmitter.emit(mC.UPDATED)}}},{key:"rotate",value:function(e,n,i){throw new Error(Ft)}},{key:"pan",value:function(e,n){throw new Error(Ft)}},{key:"dolly",value:function(e){throw new Error(Ft)}},{key:"createLandmark",value:function(e,n){throw new Error(Ft)}},{key:"gotoLandmark",value:function(e,n){throw new Error(Ft)}},{key:"cancelLandmarkAnimation",value:function(){throw new Error(Ft)}}])}(),BD=function(r){return r[r.Standard=0]="Standard",r}({}),au=function(r){return r[r.ADDED=0]="ADDED",r[r.REMOVED=1]="REMOVED",r[r.Z_INDEX_CHANGED=2]="Z_INDEX_CHANGED",r}({}),bC={absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Os(0,0,0,0)},Z=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 s1(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function wC(r,t){var e=Object.create(r.prototype);for(var n in t)e[n]=t[n];return e}function Qo(){}var Lo=.7,su=1/Lo,xs="\\s*([+-]?\\d+)\\s*",Do="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Mr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",zD=/^#([0-9a-f]{3,8})$/,$D=new RegExp(`^rgb\\(${xs},${xs},${xs}\\)$`),jD=new RegExp(`^rgb\\(${Mr},${Mr},${Mr}\\)$`),qD=new RegExp(`^rgba\\(${xs},${xs},${xs},${Do}\\)$`),GD=new RegExp(`^rgba\\(${Mr},${Mr},${Mr},${Do}\\)$`),WD=new RegExp(`^hsl\\(${Do},${Mr},${Mr}\\)$`),VD=new RegExp(`^hsla\\(${Do},${Mr},${Mr},${Do}\\)$`),Q2={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};s1(Qo,qu,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:tb,formatHex:tb,formatHex8:HD,formatHsl:UD,formatRgb:eb,toString:eb});function tb(){return this.rgb().formatHex()}function HD(){return this.rgb().formatHex8()}function UD(){return xC(this).formatHsl()}function eb(){return this.rgb().formatRgb()}function qu(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=zD.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?nb(t):e===3?new bn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?Pl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?Pl(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=$D.exec(r))?new bn(t[1],t[2],t[3],1):(t=jD.exec(r))?new bn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=qD.exec(r))?Pl(t[1],t[2],t[3],t[4]):(t=GD.exec(r))?Pl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=WD.exec(r))?ab(t[1],t[2]/100,t[3]/100,1):(t=VD.exec(r))?ab(t[1],t[2]/100,t[3]/100,t[4]):Q2.hasOwnProperty(r)?nb(Q2[r]):r==="transparent"?new bn(NaN,NaN,NaN,0):null}function nb(r){return new bn(r>>16&255,r>>8&255,r&255,1)}function Pl(r,t,e,n){return n<=0&&(r=t=e=NaN),new bn(r,t,e,n)}function YD(r){return r instanceof Qo||(r=qu(r)),r?(r=r.rgb(),new bn(r.r,r.g,r.b,r.opacity)):new bn}function XD(r,t,e,n){return arguments.length===1?YD(r):new bn(r,t,e,n??1)}function bn(r,t,e,n){this.r=+r,this.g=+t,this.b=+e,this.opacity=+n}s1(bn,XD,wC(Qo,{brighter(r){return r=r==null?su:Math.pow(su,r),new bn(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?Lo:Math.pow(Lo,r),new bn(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new bn(Ca(this.r),Ca(this.g),Ca(this.b),ou(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:rb,formatHex:rb,formatHex8:KD,formatRgb:ib,toString:ib}));function rb(){return`#${ba(this.r)}${ba(this.g)}${ba(this.b)}`}function KD(){return`#${ba(this.r)}${ba(this.g)}${ba(this.b)}${ba((isNaN(this.opacity)?1:this.opacity)*255)}`}function ib(){const r=ou(this.opacity);return`${r===1?"rgb(":"rgba("}${Ca(this.r)}, ${Ca(this.g)}, ${Ca(this.b)}${r===1?")":`, ${r})`}`}function ou(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function Ca(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function ba(r){return r=Ca(r),(r<16?"0":"")+r.toString(16)}function ab(r,t,e,n){return n<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new ar(r,t,e,n)}function xC(r){if(r instanceof ar)return new ar(r.h,r.s,r.l,r.opacity);if(r instanceof Qo||(r=qu(r)),!r)return new ar;if(r instanceof ar)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 ar(s,o,l,r.opacity)}function ZD(r,t,e,n){return arguments.length===1?xC(r):new ar(r,t,e,n??1)}function ar(r,t,e,n){this.h=+r,this.s=+t,this.l=+e,this.opacity=+n}s1(ar,ZD,wC(Qo,{brighter(r){return r=r==null?su:Math.pow(su,r),new ar(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?Lo:Math.pow(Lo,r),new ar(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 bn(Gd(r>=240?r-240:r+120,i,n),Gd(r,i,n),Gd(r<120?r+240:r-120,i,n),this.opacity)},clamp(){return new ar(sb(this.h),Nl(this.s),Nl(this.l),ou(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=ou(this.opacity);return`${r===1?"hsl(":"hsla("}${sb(this.h)}, ${Nl(this.s)*100}%, ${Nl(this.l)*100}%${r===1?")":`, ${r})`}`}}));function sb(r){return r=(r||0)%360,r<0?r+360:r}function Nl(r){return Math.max(0,Math.min(1,r||0))}function Gd(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 ke(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 c=r.apply(this,a);return e.cache=l.set(o,c)||l,c};return e.cache=new(ke.Cache||Map),ke.cacheList.push(e.cache),e}ke.Cache=Map;ke.cacheList=[];ke.clearCache=function(){ke.cacheList.forEach(function(r){return r.clear()})};var J=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}({}),ir=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}({}),JD=function(r){return r[r.kYes=0]="kYes",r[r.kNo=1]="kNo",r}({}),QD=function(r){return r[r.kYes=0]="kYes",r[r.kNo=1]="kNo",r}({}),tI=[{name:"em",unit_type:J.kEms},{name:"px",unit_type:J.kPixels},{name:"deg",unit_type:J.kDegrees},{name:"rad",unit_type:J.kRadians},{name:"grad",unit_type:J.kGradians},{name:"ms",unit_type:J.kMilliseconds},{name:"s",unit_type:J.kSeconds},{name:"rem",unit_type:J.kRems},{name:"turn",unit_type:J.kTurns}],As=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}({}),eI=function(t){return tI.find(function(e){return e.name===t}).unit_type},nI=function(t){return t?t==="number"?J.kNumber:t==="percent"||t==="%"?J.kPercentage:eI(t):J.kUnknown},rI=function(t){switch(t){case J.kNumber:case J.kInteger:return ir.kUNumber;case J.kPercentage:return ir.kUPercent;case J.kPixels:return ir.kULength;case J.kMilliseconds:case J.kSeconds:return ir.kUTime;case J.kDegrees:case J.kRadians:case J.kGradians:case J.kTurns:return ir.kUAngle;default:return ir.kUOther}},iI=function(t){switch(t){case ir.kUNumber:return J.kNumber;case ir.kULength:return J.kPixels;case ir.kUPercent:return J.kPercentage;case ir.kUTime:return J.kSeconds;case ir.kUAngle:return J.kDegrees;default:return J.kUnknown}},ob=function(t){var e=1;switch(t){case J.kPixels:case J.kDegrees:case J.kSeconds:break;case J.kMilliseconds:e=.001;break;case J.kRadians:e=180/Math.PI;break;case J.kGradians:e=.9;break;case J.kTurns:e=360;break}return e},Vm=function(t){switch(t){case J.kNumber:case J.kInteger:return"";case J.kPercentage:return"%";case J.kEms:return"em";case J.kRems:return"rem";case J.kPixels:return"px";case J.kDegrees:return"deg";case J.kRadians:return"rad";case J.kGradians:return"grad";case J.kMilliseconds:return"ms";case J.kSeconds:return"s";case J.kTurns:return"turn"}return""},Gu=function(){function r(){V(this,r)}return W(r,[{key:"toString",value:function(){return this.buildCSSText(JD.kNo,QD.kNo,"")}},{key:"isNumericValue",value:function(){return this.getType()>=As.kUnitType&&this.getType()<=As.kClampType}}],[{key:"isAngle",value:function(e){return e===J.kDegrees||e===J.kRadians||e===J.kGradians||e===J.kTurns}},{key:"isLength",value:function(e){return e>=J.kEms&&e<J.kDegrees}},{key:"isRelativeUnit",value:function(e){return e===J.kPercentage||e===J.kEms||e===J.kRems}},{key:"isTime",value:function(e){return e===J.kSeconds||e===J.kMilliseconds}}])}(),aI=function(r){function t(e){var n;return V(this,t),n=mt(this,t),n.colorSpace=e,n}return pt(t,r),W(t,[{key:"getType",value:function(){return As.kColorType}},{key:"to",value:function(n){return this}}])}(Gu),Oi=function(r){return r[r.Constant=0]="Constant",r[r.LinearGradient=1]="LinearGradient",r[r.RadialGradient=2]="RadialGradient",r}({}),Rl=function(r){function t(e,n){var i;return V(this,t),i=mt(this,t),i.type=e,i.value=n,i}return pt(t,r),W(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 As.kColorType}}])}(Gu),Yn=function(r){function t(e){var n;return V(this,t),n=mt(this,t),n.value=e,n}return pt(t,r),W(t,[{key:"clone",value:function(){return new t(this.value)}},{key:"getType",value:function(){return As.kKeywordType}},{key:"buildCSSText",value:function(n,i,a){return a+this.value}}])}(Gu),sI=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},Hm=function(t){return iI(rI(t))},Ie=function(r){function t(e){var n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:J.kNumber;V(this,t),n=mt(this,t);var a;return typeof i=="string"?a=nI(i):a=i,n.unit=a,n.value=e,n}return pt(t,r),W(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 As.kUnitType}},{key:"convertTo",value:function(n){if(this.unit===n)return new t(this.value,this.unit);var i=Hm(this.unit);if(i!==Hm(n)||i===J.kUnknown)return null;var a=ob(this.unit)/ob(n);return new t(this.value*a,n)}},{key:"buildCSSText",value:function(n,i,a){var s;switch(this.unit){case J.kUnknown:break;case J.kInteger:s=Number(this.value).toFixed(0);break;case J.kNumber:case J.kPercentage:case J.kEms:case J.kRems:case J.kPixels:case J.kDegrees:case J.kRadians:case J.kGradians:case J.kMilliseconds:case J.kSeconds:case J.kTurns:{var o=-999999,l=999999,c=this.value,u=Vm(this.unit);if(c<o||c>l){var h=Vm(this.unit);!Number.isFinite(c)||Number.isNaN(c)?s=sI(c,h):s=c+(h||"")}else s="".concat(c).concat(u)}}return a+=s,a}}])}(Gu),nr=new Ie(0,"px");new Ie(1,"px");var Da=new Ie(0,"deg"),o1=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 V(this,t),a=mt(this,t,["rgb"]),a.r=e,a.g=n,a.b=i,a.alpha=s,a.isNone=o,a}return pt(t,r),W(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,")")}}])}(aI),lb=new Yn("unset"),oI=new Yn("initial"),lI=new Yn("inherit"),Wd={"":lb,unset:lb,initial:oI,inherit:lI},cI=function(t){return Wd[t]||(Wd[t]=new Yn(t)),Wd[t]},EC=new o1(0,0,0,0,!0),SC=new o1(0,0,0,0),uI=ke(function(r,t,e,n){return new o1(r,t,e,n)},function(r,t,e,n){return"rgba(".concat(r,",").concat(t,",").concat(e,",").concat(n,")")}),ne=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:J.kNumber;return new Ie(t,e)};new Ie(50,"%");function hI(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 dI=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(P){throw new Error("".concat(t,": ").concat(P))}function n(){var P=i();return t.length>0&&e("Invalid input not EOF"),P}function i(){return b(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(P,A,I){return o(A,function(B){var j=I();return j&&(D(r.comma)||e("Missing comma before color stops")),{type:P,orientation:j,colorStops:b(w)}})}function o(P,A){var I=D(P);if(I){D(r.startCall)||e("Missing (");var B=A(I);return D(r.endCall)||e("Missing )"),B}}function l(){return c()||u()}function c(){return R("directional",r.sideOrCorner,1)}function u(){return R("angular",r.angleValue,1)}function h(){var P,A=d(),I;return A&&(P=[],P.push(A),I=t,D(r.comma)&&(A=d(),A?P.push(A):t=I)),P}function d(){var P=f()||g();if(P)P.at=p();else{var A=v();if(A){P=A;var I=p();I&&(P.at=I)}else{var B=m();B&&(P={type:"default-radial",at:B})}}return P}function f(){var P=R("shape",/^(circle)/i,0);return P&&(P.style=O()||v()),P}function g(){var P=R("shape",/^(ellipse)/i,0);return P&&(P.style=M()||v()),P}function v(){return R("extent-keyword",r.extentKeywords,1)}function p(){if(R("position",/^at/,0)){var P=m();return P||e("Missing positioning value"),P}}function m(){var P=y();if(P.x||P.y)return{type:"position",value:P}}function y(){return{x:M(),y:M()}}function b(P){var A=P(),I=[];if(A)for(I.push(A);D(r.comma);)A=P(),A?I.push(A):e("One extra comma");return I}function w(){var P=x();return P||e("Expected color definition"),P.length=M(),P}function x(){return E()||C()||_()||S()}function S(){return R("literal",r.literalColor,0)}function E(){return R("hex",r.hexColor,1)}function _(){return o(r.rgbColor,function(){return{type:"rgb",value:b(k)}})}function C(){return o(r.rgbaColor,function(){return{type:"rgba",value:b(k)}})}function k(){return D(r.number)[1]}function M(){return R("%",r.percentageValue,1)||T()||O()}function T(){return R("position-keyword",r.positionKeywords,1)}function O(){return R("px",r.pixelValue,1)||R("em",r.emValue,1)}function R(P,A,I){var B=D(A);if(B)return{type:P,value:B[I]}}function D(P){var A=/^[\n\r\t\s]+/.exec(t);A&&L(A[0].length);var I=P.exec(t);return I&&L(I[0].length),I}function L(P){t=t.substring(P)}return function(P){return t=P,n()}}();function fI(r,t,e,n){var i=Bt(n.value),a=0,s=0,o=a+t/2,l=s+e/2,c=Math.abs(t*Math.cos(i))+Math.abs(e*Math.sin(i)),u=r[0]+o-Math.cos(i)*c/2,h=r[1]+l-Math.sin(i)*c/2,d=r[0]+o+Math.cos(i)*c/2,f=r[1]+l+Math.sin(i)*c/2;return{x1:u,y1:h,x2:d,y2:f}}function gI(r,t,e,n,i,a){var s=n.value,o=i.value;n.unit===J.kPercentage&&(s=n.value/100*t),i.unit===J.kPercentage&&(o=i.value/100*e);var l=Math.max(fn([0,0],[s,o]),fn([0,e],[s,o]),fn([t,e],[s,o]),fn([t,0],[s,o]));return a&&(a instanceof Ie?l=a.value:a instanceof Yn&&(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(fn([0,0],[s,o]),fn([0,e],[s,o]),fn([t,e],[s,o]),fn([t,0],[s,o]))))),{x:s+r[0],y:o+r[1],r:l}}var vI=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,pI=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,mI=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,_C=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function yI(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(!ot(l)&&!ot(a)){for(var c=1;c<s-i;c++)r[i+c].length={type:"%",value:"".concat(a+(Number(l)-a)*c/(s-i))};i=s,a=Number(l)}}}var bI={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},wI=ke(function(r){var t;return r.type==="angular"?t=Number(r.value):t=bI[r.value]||0,ne(t,"deg")}),xI=ke(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:ne(t,n),cy:ne(e,i)}}),EI=ke(function(r){if(r.indexOf("linear")>-1||r.indexOf("radial")>-1){var t=dI(r);return t.map(function(o){var l=o.type,c=o.orientation,u=o.colorStops;yI(u);var h=u.map(function(b){return{offset:ne(Number(b.length.value),"%"),color:hI(b)}});if(l==="linear-gradient")return new Rl(Oi.LinearGradient,{angle:c?wI(c):Da,steps:h});if(l==="radial-gradient"&&(c||(c=[{type:"shape",value:"circle"}]),c[0].type==="shape"&&c[0].value==="circle")){var d=xI(c[0].at),f=d.cx,g=d.cy,v;if(c[0].style){var p=c[0].style,m=p.type,y=p.value;m==="extent-keyword"?v=cI(y):v=ne(y,m)}return new Rl(Oi.RadialGradient,{cx:f,cy:g,size:v,steps:h})}})}var e=r[0];if(r[1]==="("||r[2]==="("){if(e==="l"){var n=vI.exec(r);if(n){var i,a=((i=n[2].match(_C))===null||i===void 0?void 0:i.map(function(o){return o.split(":")}))||[];return[new Rl(Oi.LinearGradient,{angle:ne(parseFloat(n[1]),"deg"),steps:a.map(function(o){var l=dt(o,2),c=l[0],u=l[1];return{offset:ne(Number(c)*100,"%"),color:u}})})]}}else if(e==="r"){var s=SI(r);if(s)if(Tt(s))r=s;else return[new Rl(Oi.RadialGradient,s)]}else if(e==="p")return _I(r)}});function SI(r){var t=pI.exec(r);if(t){var e,n=((e=t[4].match(_C))===null||e===void 0?void 0:e.map(function(i){return i.split(":")}))||[];return{cx:ne(50,"%"),cy:ne(50,"%"),steps:n.map(function(i){var a=dt(i,2),s=a[0],o=a[1];return{offset:ne(Number(s)*100,"%"),color:o}})}}return null}function _I(r){var t=mI.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 Ia(r){return r&&!!r.image}function lu(r){return r&&!ot(r.r)&&!ot(r.g)&&!ot(r.b)}var Mo=ke(function(r){if(Ia(r))return vt({repetition:"repeat"},r);if(ot(r)&&(r=""),r==="transparent")return SC;if(r==="currentColor")r="black";else if(r==="none")return EC;var t=EI(r);if(t)return t;var e=qu(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),uI.apply(void 0,n)});function kI(r,t){if(!(!lu(r)||!lu(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(ce(n[i],0,255));return n[3]=ce(n[3],0,1),"rgba(".concat(n.join(","),")")}]}function tl(r,t){if(ot(t))return ne(0,"px");if(t="".concat(t).trim().toLowerCase(),isFinite(Number(t))){if("px".search(r)>=0)return ne(Number(t),"px");if("deg".search(r)>=0)return ne(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 ne(Number(t.replace(new RegExp("U".concat(i),"g"),"").replace(new RegExp(n,"g"),"*0")),i)})[0]}var kC=function(t){return tl(new RegExp("px","g"),t)},MI=ke(kC),CI=function(t){return tl(new RegExp("%","g"),t)};ke(CI);var MC=function(t){return nt(t)||isFinite(Number(t))?ne(Number(t)||0,"px"):tl(new RegExp("px|%|em|rem","g"),t)},Um=ke(MC),CC=function(t){return tl(new RegExp("deg|rad|grad|turn","g"),t)},TI=ke(CC);function OI(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=Hm(r.unit),c=r.convertTo(l),u=t.convertTo(l);return c&&u?(s=c.value,o=u.value,a=Vm(r.unit)):(Ie.isLength(r.unit)||Ie.isLength(t.unit))&&(s=_n(r,i,e),o=_n(t,i,e),a="px"),[s,o,function(h){return h+a}]}function vn(r){var t=0;return r.unit===J.kDegrees?t=r.value:r.unit===J.kRadians?t=gn(Number(r.value)):r.unit===J.kTurns?t=AD(Number(r.value)):r.value&&(t=r.value),t}function cb(r,t){var e;return Array.isArray(r)?e=r.map(function(n){return Number(n)}):Tt(r)?e=r.split(" ").map(function(n){return Number(n)}):nt(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(Ut(e),Ut(e)):e}function _n(r,t,e){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r.unit===J.kPixels)return Number(r.value);if(r.unit===J.kPercentage&&e){var i=e.nodeName===$.GROUP?e.getLocalBounds():e.getGeometryBounds();return(n?i.min[t]:0)+r.value/100*i.halfExtents[t]*2}return 0}var AI=function(t){return tl(/deg|rad|grad|turn|px|%/g,t)},PI=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function NI(){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,PI.indexOf(n[1])>-1&&e.push({name:n[1],params:n[2].split(" ").map(function(a){return AI(a)||Mo(a)})}),t.lastIndex===r.length)return e}return[]}function TC(r){return r.toString()}var OC=function(t){return typeof t=="number"?ne(t):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?ne(Number(t)):ne(0)},Ym=ke(OC);ke(function(r){return Tt(r)?r.split(" ").map(Ym):r.map(Ym)});function l1(r,t){return[r,t,TC]}function c1(r,t){return function(e,n){return[e,n,function(i){return TC(ce(i,r,t))}]}}function AC(r,t){if(r.length===t.length)return[r,t,function(e){return e}]}function Xm(r){return r.parsedStyle.d.totalLength===0&&(r.parsedStyle.d.totalLength=Z6(r.parsedStyle.d.absolutePath)),r.parsedStyle.d.totalLength}function RI(r){return r.parsedStyle.points.totalLength===0&&(r.parsedStyle.points.totalLength=vD(r.parsedStyle.points.points)),r.parsedStyle.points.totalLength}function LI(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&&cu(s,o)&&(r.splice(t,1),t--)}}}function DI(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 II(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 cu(r,t){return r[0]===t[0]&&r[1]===t[1]}function FI(r,t){for(var e=[],n=[],i=[],a=0;a<r.length;a++){var s=r[a],o=s.currentPoint,l=s.params,c=s.prePoint,u=void 0;switch(s.command){case"Q":u=pD(c[0],c[1],l[1],l[2],l[3],l[4]);break;case"C":u=dD(c[0],c[1],l[1],l[2],l[3],l[4],l[5],l[6]);break;case"A":var h=s.arcParams;u=cD(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}u&&(s.box=u,e.push(u.x,u.x+u.width),n.push(u.y,u.y+u.height))}e=e.filter(function(w){return!Number.isNaN(w)&&w!==1/0&&w!==-1/0}),n=n.filter(function(w){return!Number.isNaN(w)&&w!==1/0&&w!==-1/0});var d=tu(e),f=tu(n),g=Qc(e),v=Qc(n);if(i.length===0)return{x:d,y:f,width:g-d,height:v-f};for(var p=0;p<i.length;p++){var m=i[p],y=m.currentPoint,b=void 0;y[0]===d?(b=Ll(m,t),d-=b.xExtra):y[0]===g&&(b=Ll(m,t),g+=b.xExtra),y[1]===f?(b=Ll(m,t),f-=b.yExtra):y[1]===v&&(b=Ll(m,t),v+=b.yExtra)}return{x:d,y:f,width:g-d,height:v-f}}function Ll(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||_o(l,0))return{xExtra:0,yExtra:0};var c=Math.abs(Math.atan2(i[1]-n[1],i[0]-n[0])),u=Math.abs(Math.atan2(i[0]-n[0],i[1]-n[1]));c=c>Math.PI/2?Math.PI-c:c,u=u>Math.PI/2?Math.PI-u:u;var h={xExtra:Math.cos(l/2-c)*(t/2*(1/Math.sin(l/2)))-t/2||0,yExtra:Math.cos(u-l/2)*(t/2*(1/Math.sin(l/2)))-t/2||0};return h}function ub(r,t){return[t[0]+(t[0]-r[0]),t[1]+(t[1]-r[1])]}var hb=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},db=function(t,e,n,i,a,s,o,l){e=Math.abs(e),n=Math.abs(n),i=eC(i,360);var c=Bt(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 u=(t.x-o.x)/2,h=(t.y-o.y)/2,d={x:Math.cos(c)*u+Math.sin(c)*h,y:-Math.sin(c)*u+Math.cos(c)*h},f=Math.pow(d.x,2)/Math.pow(e,2)+Math.pow(d.y,2)/Math.pow(n,2);f>1&&(e*=Math.sqrt(f),n*=Math.sqrt(f));var g=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),p=g/v;p=p<0?0:p;var m=(a!==s?1:-1)*Math.sqrt(p),y={x:m*(e*d.y/n),y:m*(-(n*d.x)/e)},b={x:Math.cos(c)*y.x-Math.sin(c)*y.y+(t.x+o.x)/2,y:Math.sin(c)*y.x+Math.cos(c)*y.y+(t.y+o.y)/2},w={x:(d.x-y.x)/e,y:(d.y-y.y)/n},x=hb({x:1,y:0},w),S={x:(-d.x-y.x)/e,y:(-d.y-y.y)/n},E=hb(w,S);!s&&E>0?E-=2*Math.PI:s&&E<0&&(E+=2*Math.PI),E%=2*Math.PI;var _=x+E*l,C=e*Math.cos(_),k=n*Math.sin(_),M={x:Math.cos(c)*C-Math.sin(c)*k+b.x,y:Math.sin(c)*C+Math.cos(c)*k+b.y,ellipticalArcStartAngle:x,ellipticalArcEndAngle:x+E,ellipticalArcAngle:_,ellipticalArcCenter:b,resultantRx:e,resultantRy:n};return M};function BI(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 c=l[0],u={command:c,prePoint:e,params:l,startTangent:null,endTangent:null,currentPoint:null,nextPoint:null,arcParams:null,box:null,cubicParams:null};switch(c){case"M":i=[l[1],l[2]],a=o;break;case"A":var h=zI(e,l);u.arcParams=h;break}if(c==="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)),u.currentPoint=e,t[a]&&cu(e,t[a].currentPoint)&&(t[a].prePoint=u.prePoint);var f=n?[n[n.length-2],n[n.length-1]]:null;u.nextPoint=f;var g=u.prePoint;if(["L","H","V"].includes(c))u.startTangent=[g[0]-e[0],g[1]-e[1]],u.endTangent=[e[0]-g[0],e[1]-g[1]];else if(c==="Q"){var v=[l[1],l[2]];u.startTangent=[g[0]-v[0],g[1]-v[1]],u.endTangent=[e[0]-v[0],e[1]-v[1]]}else if(c==="T"){var p=t[o-1],m=ub(p.currentPoint,g);p.command==="Q"?(u.command="Q",u.startTangent=[g[0]-m[0],g[1]-m[1]],u.endTangent=[e[0]-m[0],e[1]-m[1]]):(u.command="TL",u.startTangent=[g[0]-e[0],g[1]-e[1]],u.endTangent=[e[0]-g[0],e[1]-g[1]])}else if(c==="C"){var y=[l[1],l[2]],b=[l[3],l[4]];u.startTangent=[g[0]-y[0],g[1]-y[1]],u.endTangent=[e[0]-b[0],e[1]-b[1]],u.startTangent[0]===0&&u.startTangent[1]===0&&(u.startTangent=[y[0]-b[0],y[1]-b[1]]),u.endTangent[0]===0&&u.endTangent[1]===0&&(u.endTangent=[b[0]-y[0],b[1]-y[1]])}else if(c==="S"){var w=t[o-1],x=ub(w.currentPoint,g),S=[l[1],l[2]];w.command==="C"?(u.command="C",u.startTangent=[g[0]-x[0],g[1]-x[1]],u.endTangent=[e[0]-S[0],e[1]-S[1]]):(u.command="SQ",u.startTangent=[g[0]-S[0],g[1]-S[1]],u.endTangent=[e[0]-S[0],e[1]-S[1]])}else if(c==="A"){var E=fb(u,0),_=E.x,C=E.y,k=fb(u,1,!1),M=k.x,T=k.y;u.startTangent=[_,C],u.endTangent=[M,T]}t.push(u)}return t}function fb(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,c=n.arcFlag,u=n.sweepFlag,h=db({x:r.prePoint[0],y:r.prePoint[1]},a,o,l,!!c,!!u,{x:r.currentPoint[0],y:r.currentPoint[1]},t),d=db({x:r.prePoint[0],y:r.prePoint[1]},a,o,l,!!c,!!u,{x:r.currentPoint[0],y:r.currentPoint[1]},e?t+.005:t-.005),f=d.x-h.x,g=d.y-h.y,v=Math.sqrt(f*f+g*g);return{x:-f/v,y:-g/v}}function Dl(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Km(r,t){return Dl(r)*Dl(t)?(r[0]*t[0]+r[1]*t[1])/(Dl(r)*Dl(t)):1}function gb(r,t){return(r[0]*t[1]<r[1]*t[0]?-1:1)*Math.acos(Km(r,t))}function zI(r,t){var e=t[1],n=t[2],i=eC(Bt(t[3]),Math.PI*2),a=t[4],s=t[5],o=r[0],l=r[1],c=t[6],u=t[7],h=Math.cos(i)*(o-c)/2+Math.sin(i)*(l-u)/2,d=-1*Math.sin(i)*(o-c)/2+Math.cos(i)*(l-u)/2,f=h*h/(e*e)+d*d/(n*n);f>1&&(e*=Math.sqrt(f),n*=Math.sqrt(f));var g=e*e*(d*d)+n*n*(h*h),v=g?Math.sqrt((e*e*(n*n)-g)/g):1;a===s&&(v*=-1),isNaN(v)&&(v=0);var p=n?v*e*d/n:0,m=e?v*-n*h/e:0,y=(o+c)/2+Math.cos(i)*p-Math.sin(i)*m,b=(l+u)/2+Math.sin(i)*p+Math.cos(i)*m,w=[(h-p)/e,(d-m)/n],x=[(-1*h-p)/e,(-1*d-m)/n],S=gb([1,0],w),E=gb(w,x);return Km(w,x)<=-1&&(E=Math.PI),Km(w,x)>=1&&(E=0),s===0&&E>0&&(E-=2*Math.PI),s===1&&E<0&&(E+=2*Math.PI),{cx:y,cy:b,rx:cu(r,[c,u])?0:e,ry:cu(r,[c,u])?0:n,startAngle:S,endAngle:S+E,xRotation:i,arcFlag:a,sweepFlag:s}}var PC=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=ru(t)}catch{e=ru(""),console.error("[g]: Invalid SVG Path definition: ".concat(t))}LI(e);var n=DI(e),i=II(e),a=i.polygons,s=i.polylines,o=BI(e),l=FI(o,0),c=l.x,u=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(c)?c:0,y:Number.isFinite(u)?u:0,width:Number.isFinite(h)?h:0,height:Number.isFinite(d)?d:0}}},$I=ke(PC);function NC(r){return Tt(r)?$I(r):PC(r)}function jI(r,t,e){var n=r.curve,i=t.curve;(!n||n.length===0)&&(n=Bm(r.absolutePath,!1),r.curve=n),(!i||i.length===0)&&(i=Bm(t.absolutePath,!1),t.curve=i);var a=[n,i];n.length!==i.length&&(a=hC(n,i));var s=G2(a[0])!==G2(a[1])?V6(a[0]):W6(a[0]);return[s,Q6(a[1],s),function(o){return o}]}function qI(r,t){var e;return Tt(r)?e=r.split(" ").map(function(n){var i=n.split(","),a=dt(i,2),s=a[0],o=a[1];return[Number(s),Number(o)]}):e=r,{points:e,totalLength:0,segments:[]}}function GI(r,t){return[r.points,t.points,function(e){return e}]}var oe=null,Es=/\s*(\w+)\(([^)]*)\)/g;function un(r){return function(t){var e=0;return r.map(function(n){return n===oe?t[e++]:n})}}function ua(r){return r}var Io={matrix:["NNNNNN",[oe,oe,0,0,oe,oe,0,0,0,0,1,0,oe,oe,0,1],ua],matrix3d:["NNNNNNNNNNNNNNNN",ua],rotate:["A"],rotateX:["A"],rotateY:["A"],rotateZ:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",un([oe,oe,new Ie(1)]),ua],scaleX:["N",un([oe,new Ie(1),new Ie(1)]),un([oe,new Ie(1)])],scaleY:["N",un([new Ie(1),oe,new Ie(1)]),un([new Ie(1),oe])],scaleZ:["N",un([new Ie(1),new Ie(1),oe])],scale3d:["NNN",ua],skew:["Aa",null,ua],skewX:["A",null,un([oe,Da])],skewY:["A",null,un([Da,oe])],translate:["Tt",un([oe,oe,nr]),ua],translateX:["T",un([oe,nr,nr]),un([oe,nr])],translateY:["T",un([nr,oe,nr]),un([nr,oe])],translateZ:["L",un([nr,nr,oe])],translate3d:["TTL",ua]};function RC(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=Io[a];if(!o)return[];var l=s.map(function(c){return ne(c)});t.push({t:a,d:l})}return t}function LC(r){if(Array.isArray(r))return RC(r);if(r=(r||"none").trim(),r==="none")return[];var t=[],e,n=0;for(Es.lastIndex=0;e=Es.exec(r);){if(e.index!==n)return[];n=e.index+e[0].length;var i=e[1],a=Io[i];if(!a)return[];var s=e[2].split(","),o=a[0];if(o.length<s.length)return[];for(var l=[],c=0;c<o.length;c++){var u=s[c],h=o[c],d=void 0;if(u?d={A:function(g){return g.trim()==="0"?Da:TI(g)},N:Ym,T:Um,L:MI}[h.toUpperCase()](u):d={a:Da,n:l[0],t:nr}[h],d===void 0)return[];l.push(d)}if(t.push({t:i,d:l}),Es.lastIndex===r.length)return t}return[]}function WI(r){if(Array.isArray(r))return RC(r);if(r=(r||"none").trim(),r==="none")return[];var t=[],e,n=0;for(Es.lastIndex=0;e=Es.exec(r);){if(e.index!==n)return[];n=e.index+e[0].length;var i=e[1],a=Io[i];if(!a)return[];var s=e[2].split(","),o=a[0];if(o.length<s.length)return[];for(var l=[],c=0;c<o.length;c++){var u=s[c],h=o[c],d=void 0;if(u?d={A:function(g){return g.trim()==="0"?Da:CC(g)},N:OC,T:MC,L:kC}[h.toUpperCase()](u):d={a:Da,n:l[0],t:nr}[h],d===void 0)return[];l.push(d)}if(t.push({t:i,d:l}),Es.lastIndex===r.length)return t}return[]}function VI(r){var t,e,n,i;switch(r.t){case"rotateX":return i=Bt(vn(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=Bt(vn(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=Bt(vn(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=Bt(vn(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),c=o*o;return[1-2*(e*e+n*n)*c,2*(t*e*c+n*l),2*(t*n*c-e*l),0,2*(t*e*c-n*l),1-2*(t*t+n*n)*c,2*(e*n*c+t*l),0,2*(t*n*c+e*l),2*(e*n*c-t*l),1-2*(t*t+e*e)*c,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 u=Bt(vn(r.d[0])),h=Bt(vn(r.d[1]));return[1,Math.tan(h),0,0,Math.tan(u),1,0,0,0,0,1,0,0,0,0,1];case"skewX":return i=Bt(vn(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=Bt(vn(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=_n(r.d[0],0,null)||0,e=_n(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=_n(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=_n(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=_n(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=_n(r.d[0],0,null)||0,e=_n(r.d[1],0,null)||0,n=_n(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=_n(r.d[0],0,null)||0,f=d?-1/d:0;return[1,0,0,0,0,1,0,0,0,0,1,f,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(g){return g.value})}}function HI(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 UI(r){return r.length===0?[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]:r.map(VI).reduce(HI)}function vb(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 DD(UI(r),t,e,n,i,a),[[t,e,n,a,i]]}var YI=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]],c=0;c<4;c++)l[c][3]=o[c];for(var u=0;u<3;u++)for(var h=0;h<3;h++)l[3][u]+=n[h]*l[h][u];var d=s[0],f=s[1],g=s[2],v=s[3],p=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];p[0][0]=1-2*(f*f+g*g),p[0][1]=2*(d*f-g*v),p[0][2]=2*(d*g+f*v),p[1][0]=2*(d*f+g*v),p[1][1]=1-2*(d*d+g*g),p[1][2]=2*(f*g-d*v),p[2][0]=2*(d*g-f*v),p[2][1]=2*(f*g+d*v),p[2][2]=1-2*(d*d+f*f),l=r(l,p);var m=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];a[2]&&(m[2][1]=a[2],l=r(l,m)),a[1]&&(m[2][1]=0,m[2][0]=a[0],l=r(l,m)),a[0]&&(m[2][0]=0,m[1][0]=a[0],l=r(l,m));for(var y=0;y<3;y++)for(var b=0;b<3;b++)l[y][b]*=i[y];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 XI(r){return r.toFixed(6).replace(".000000","")}function Vd(r,t){var e,n;return r.decompositionPair!==t&&(r.decompositionPair=t,e=vb(r)),t.decompositionPair!==r&&(t.decompositionPair=r,n=vb(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=ZI(e[0][3],n[0][3],i[5]),s=YI(i[0],i[1],i[2],a,i[4]),o=s.map(XI).join(",");return o}])}function KI(r,t){for(var e=0,n=0;n<r.length;n++)e+=r[n]*t[n];return e}function ZI(r,t,e){var n=KI(r,t);n=ce(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 Hd(r){return r.replace(/[XY]/,"")}function Ud(r){return r.replace(/(X|Y|Z|3d)?$/,"3d")}var JI=function(t,e){return t==="perspective"&&e==="perspective"||(t==="matrix"||t==="matrix3d")&&(e==="matrix"||e==="matrix3d")};function QI(r,t,e){var n=!1;if(!r.length||!t.length){r.length||(n=!0,r=t,t=[]);for(var i=function(){var M=r[a],T=M.t,O=M.d,R=T.substring(0,5)==="scale"?1:0;t.push({t:T,d:O.map(function(D){return typeof D=="number"?ne(R):ne(R,D.unit)})})},a=0;a<r.length;a++)i()}var s=[],o=[],l=[];if(r.length!==t.length){var c=Vd(r,t);s=[c[0]],o=[c[1]],l=[["matrix",[c[2]]]]}else for(var u=0;u<r.length;u++){var h=r[u].t,d=t[u].t,f=r[u].d,g=t[u].d,v=Io[h],p=Io[d],m=void 0;if(JI(h,d)){var y=Vd([r[u]],[t[u]]);s.push(y[0]),o.push(y[1]),l.push(["matrix",[y[2]]]);continue}else if(h===d)m=h;else if(v[2]&&p[2]&&Hd(h)===Hd(d))m=Hd(h),f=v[2](f),g=p[2](g);else if(v[1]&&p[1]&&Ud(h)===Ud(d))m=Ud(h),f=v[1](f),g=p[1](g);else{var b=Vd(r,t);s=[b[0]],o=[b[1]],l=[["matrix",[b[2]]]];break}for(var w=[],x=[],S=[],E=0;E<f.length;E++){var _=OI(f[E],g[E],e,!1,E);w[E]=_[0],x[E]=_[1],S.push(_[2])}s.push(w),o.push(x),l.push([m,S])}if(n){var C=s;s=o,o=C}return[s,o,function(k){return k.map(function(M,T){var O=M.map(function(R,D){return l[T][1][D](R)}).join(",");return l[T][0]==="matrix"&&O.split(",").length===16&&(l[T][0]="matrix3d"),l[T][0]==="matrix3d"&&O.split(",").length===6&&(l[T][0]="matrix"),"".concat(l[T][0],"(").concat(O,")")}).join(" ")}]}var t5=ke(function(r){if(Tt(r)){if(r==="text-anchor")return[ne(0,"px"),ne(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:[Um(pb(t[0])),Um(pb(t[1]))]}return[ne(r[0]||0,"px"),ne(r[1]||0,"px")]});function pb(r){return r==="center"?"50%":r==="left"||r==="top"?"0%":r==="right"||r==="bottom"?"100%":r}var u1=[{n:"display",k:["none"]},{n:"opacity",int:!0,inh:!0,d:"1",syntax:Z.OPACITY_VALUE},{n:"fillOpacity",int:!0,inh:!0,d:"1",syntax:Z.OPACITY_VALUE},{n:"strokeOpacity",int:!0,inh:!0,d:"1",syntax:Z.OPACITY_VALUE},{n:"fill",int:!0,k:["none"],d:"none",syntax:Z.PAINT},{n:"fillRule",k:["nonzero","evenodd"],d:"nonzero"},{n:"stroke",int:!0,k:["none"],d:"none",syntax:Z.PAINT,l:!0},{n:"shadowType",k:["inner","outer","both"],d:"outer",l:!0},{n:"shadowColor",int:!0,syntax:Z.COLOR},{n:"shadowOffsetX",int:!0,l:!0,d:"0",syntax:Z.LENGTH_PERCENTAGE},{n:"shadowOffsetY",int:!0,l:!0,d:"0",syntax:Z.LENGTH_PERCENTAGE},{n:"shadowBlur",int:!0,l:!0,d:"0",syntax:Z.SHADOW_BLUR},{n:"lineWidth",int:!0,inh:!0,d:"1",l:!0,a:["strokeWidth"],syntax:Z.LENGTH_PERCENTAGE},{n:"increasedLineWidthForHitTesting",inh:!0,d:"0",l:!0,syntax:Z.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:Z.LENGTH_PERCENTAGE_12},{n:"lineDashOffset",int:!0,inh:!0,d:"0",a:["strokeDashoffset"],syntax:Z.LENGTH_PERCENTAGE},{n:"offsetPath",syntax:Z.DEFINED_PATH},{n:"offsetDistance",int:!0,syntax:Z.OFFSET_DISTANCE},{n:"dx",int:!0,l:!0,d:"0",syntax:Z.LENGTH_PERCENTAGE},{n:"dy",int:!0,l:!0,d:"0",syntax:Z.LENGTH_PERCENTAGE},{n:"zIndex",ind:!0,int:!0,d:"0",k:["auto"],syntax:Z.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:Z.FILTER},{n:"clipPath",syntax:Z.DEFINED_PATH},{n:"textPath",syntax:Z.DEFINED_PATH},{n:"textPathSide",k:["left","right"],d:"left"},{n:"textPathStartOffset",l:!0,d:"0",syntax:Z.LENGTH_PERCENTAGE},{n:"transform",p:100,int:!0,k:["none"],d:"none",syntax:Z.TRANSFORM},{n:"transformOrigin",p:100,d:"0 0",l:!0,syntax:Z.TRANSFORM_ORIGIN},{n:"cx",int:!0,l:!0,d:"0",syntax:Z.COORDINATE},{n:"cy",int:!0,l:!0,d:"0",syntax:Z.COORDINATE},{n:"cz",int:!0,l:!0,d:"0",syntax:Z.COORDINATE},{n:"r",int:!0,l:!0,d:"0",syntax:Z.LENGTH_PERCENTAGE},{n:"rx",int:!0,l:!0,d:"0",syntax:Z.LENGTH_PERCENTAGE},{n:"ry",int:!0,l:!0,d:"0",syntax:Z.LENGTH_PERCENTAGE},{n:"x",int:!0,l:!0,d:"0",syntax:Z.COORDINATE},{n:"y",int:!0,l:!0,d:"0",syntax:Z.COORDINATE},{n:"z",int:!0,l:!0,d:"0",syntax:Z.COORDINATE},{n:"width",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:Z.LENGTH_PERCENTAGE},{n:"height",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:Z.LENGTH_PERCENTAGE},{n:"radius",int:!0,l:!0,d:"0",syntax:Z.LENGTH_PERCENTAGE_14},{n:"x1",int:!0,l:!0,syntax:Z.COORDINATE},{n:"y1",int:!0,l:!0,syntax:Z.COORDINATE},{n:"z1",int:!0,l:!0,syntax:Z.COORDINATE},{n:"x2",int:!0,l:!0,syntax:Z.COORDINATE},{n:"y2",int:!0,l:!0,syntax:Z.COORDINATE},{n:"z2",int:!0,l:!0,syntax:Z.COORDINATE},{n:"d",int:!0,l:!0,d:"",syntax:Z.PATH,p:50},{n:"points",int:!0,l:!0,syntax:Z.LIST_OF_POINTS,p:50},{n:"text",l:!0,d:"",syntax:Z.TEXT,p:50},{n:"textTransform",l:!0,inh:!0,k:["capitalize","uppercase","lowercase","none"],d:"none",syntax:Z.TEXT_TRANSFORM,p:51},{n:"font",l:!0},{n:"fontSize",int:!0,inh:!0,d:"16px",l:!0,syntax:Z.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:Z.LENGTH,int:!0,d:"0"},{n:"letterSpacing",l:!0,syntax:Z.LENGTH,int:!0,d:"0"},{n:"miterLimit",l:!0,syntax:Z.NUMBER,d:function(t){return t===$.PATH||t===$.POLYGON||t===$.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:Z.MARKER},{n:"markerEnd",syntax:Z.MARKER},{n:"markerMid",syntax:Z.MARKER},{n:"markerStartOffset",syntax:Z.LENGTH,l:!0,int:!0,d:"0"},{n:"markerEndOffset",syntax:Z.LENGTH,l:!0,int:!0,d:"0"}],e5=new Set(u1.filter(function(r){return!!r.l}).map(function(r){return r.n})),DC={},n5=function(){function r(t){var e=this;V(this,r),this.runtime=t,u1.forEach(function(n){e.registerMetadata(n)})}return W(r,[{key:"registerMetadata",value:function(e){[e.n].concat(Ut(e.a||[])).forEach(function(n){DC[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;r5(e,n);var o=!!i.forceUpdateGeometry;if(!o){for(var l in n)if(e5.has(l)){o=!0;break}}var c=IC(e);c.has("fill")&&n.fill&&(e.parsedStyle.fill=Mo(n.fill)),c.has("stroke")&&n.stroke&&(e.parsedStyle.stroke=Mo(n.stroke)),c.has("shadowColor")&&n.shadowColor&&(e.parsedStyle.shadowColor=Mo(n.shadowColor)),c.has("filter")&&n.filter&&(e.parsedStyle.filter=NI(n.filter)),c.has("radius")&&!ot(n.radius)&&(e.parsedStyle.radius=cb(n.radius,4)),c.has("lineDash")&&!ot(n.lineDash)&&(e.parsedStyle.lineDash=cb(n.lineDash,"even")),c.has("points")&&n.points&&(e.parsedStyle.points=qI(n.points)),c.has("d")&&n.d===""&&(e.parsedStyle.d=vt({},bC)),c.has("d")&&n.d&&(e.parsedStyle.d=NC(n.d)),c.has("textTransform")&&n.textTransform&&this.runtime.CSSPropertySyntaxFactory[Z.TEXT_TRANSFORM].calculator(null,null,{value:n.textTransform},e,null),c.has("clipPath")&&!ut(n.clipPath)&&this.runtime.CSSPropertySyntaxFactory[Z.DEFINED_PATH].calculator("clipPath",a,n.clipPath,e,this.runtime),c.has("offsetPath")&&n.offsetPath&&this.runtime.CSSPropertySyntaxFactory[Z.DEFINED_PATH].calculator("offsetPath",s,n.offsetPath,e,this.runtime),c.has("transform")&&n.transform&&(e.parsedStyle.transform=LC(n.transform)),c.has("transformOrigin")&&n.transformOrigin&&(e.parsedStyle.transformOrigin=t5(n.transformOrigin)),c.has("markerStart")&&n.markerStart&&(e.parsedStyle.markerStart=this.runtime.CSSPropertySyntaxFactory[Z.MARKER].calculator(null,n.markerStart,n.markerStart,null,null)),c.has("markerEnd")&&n.markerEnd&&(e.parsedStyle.markerEnd=this.runtime.CSSPropertySyntaxFactory[Z.MARKER].calculator(null,n.markerEnd,n.markerEnd,null,null)),c.has("markerMid")&&n.markerMid&&(e.parsedStyle.markerMid=this.runtime.CSSPropertySyntaxFactory[Z.MARKER].calculator("",n.markerMid,n.markerMid,null,null)),c.has("zIndex")&&!ot(n.zIndex)&&this.runtime.CSSPropertySyntaxFactory[Z.Z_INDEX].postProcessor(e),c.has("offsetDistance")&&!ot(n.offsetDistance)&&this.runtime.CSSPropertySyntaxFactory[Z.OFFSET_DISTANCE].postProcessor(e),c.has("transform")&&n.transform&&this.runtime.CSSPropertySyntaxFactory[Z.TRANSFORM].postProcessor(e),c.has("transformOrigin")&&n.transformOrigin&&this.runtime.CSSPropertySyntaxFactory[Z.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 Vt),a.renderBounds||(a.renderBounds=new Vt);var s=e.parsedStyle,o=i.update(s,e),l=o.cx,c=l===void 0?0:l,u=o.cy,h=u===void 0?0:u,d=o.cz,f=d===void 0?0:d,g=o.hwidth,v=g===void 0?0:g,p=o.hheight,m=p===void 0?0:p,y=o.hdepth,b=y===void 0?0:y,w=[Math.abs(v),Math.abs(m),b],x=s.stroke,S=s.lineWidth,E=S===void 0?1:S,_=s.increasedLineWidthForHitTesting,C=_===void 0?0:_,k=s.shadowType,M=k===void 0?"outer":k,T=s.shadowColor,O=s.filter,R=O===void 0?[]:O,D=s.transformOrigin,L=[c,h,f];a.contentBounds.update(L,w);var P=n===$.POLYLINE||n===$.POLYGON||n===$.PATH?Math.SQRT2:.5,A=x&&!x.isNone;if(A){var I=((E||0)+(C||0))*P;w[0]+=I,w[1]+=I}if(a.renderBounds.update(L,w),T&&M&&M!=="inner"){var B=a.renderBounds,j=B.min,G=B.max,H=s.shadowBlur,Y=s.shadowOffsetX,K=s.shadowOffsetY,tt=H||0,it=Y||0,_t=K||0,Mt=j[0]-tt+it,re=G[0]+tt+it,Re=j[1]-tt+_t,Le=G[1]+tt+_t;j[0]=Math.min(j[0],Mt),G[0]=Math.max(G[0],re),j[1]=Math.min(j[1],Re),G[1]=Math.max(G[1],Le),a.renderBounds.setMinMax(j,G)}R.forEach(function(Nt){var Ir=Nt.name,Jn=Nt.params;if(Ir==="blur"){var xl=Jn[0].value;a.renderBounds.update(a.renderBounds.center,Fi(a.renderBounds.halfExtents,a.renderBounds.halfExtents,[xl,xl,0]))}else if(Ir==="drop-shadow"){var oa=Jn[0].value,Qn=Jn[1].value,Ce=Jn[2].value,la=a.renderBounds,In=la.min,Fr=la.max,El=In[0]-Ce+oa,fi=Fr[0]+Ce+oa,Sl=In[1]-Ce+Qn,_l=Fr[1]+Ce+Qn;In[0]=Math.min(In[0],El),Fr[0]=Math.max(Fr[0],fi),In[1]=Math.min(In[1],Sl),Fr[1]=Math.max(Fr[1],_l),a.renderBounds.setMinMax(In,Fr)}}),e.geometry.dirty=!1;var cn=v<0,sa=m<0,Pt=(cn?-1:1)*(D?_n(D[0],0,e,!0):0),Dr=(sa?-1:1)*(D?_n(D[1],1,e,!0):0);(Pt||Dr)&&e.setOrigin(Pt,Dr)}}},{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===$.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===$.CIRCLE&&e.style.rawR&&(e.style.r=e.style.rawR,delete e.style.rawR))}}])}();function r5(r,t){var e=IC(r);for(var n in t)e.has(n)&&(r.parsedStyle[n]=t[n])}function IC(r){return r.constructor.PARSED_STYLE_LIST}var i5=function(){function r(){V(this,r),this.mixer=l1}return W(r,[{key:"calculator",value:function(e,n,i,a){return vn(i)}}])}(),a5=function(){function r(){V(this,r)}return W(r,[{key:"calculator",value:function(e,n,i,a,s){return i instanceof Yn&&(i=null),s.sceneGraphService.updateDisplayObjectDependency(e,n,i,a),e==="clipPath"&&a.forEach(function(o){o.childNodes.length===0&&s.sceneGraphService.dirtifyToRoot(o)}),i}}])}(),s5=function(){function r(){V(this,r),this.parser=Mo,this.mixer=kI}return W(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof Yn?i.value==="none"?EC:SC:i}}])}(),o5=function(){function r(){V(this,r)}return W(r,[{key:"calculator",value:function(e,n,i){return i instanceof Yn?[]:i}}])}();function mb(r){var t=r.parsedStyle,e=t.fontSize;return ot(e)?null:e}var Zm=function(){function r(){V(this,r),this.mixer=l1}return W(r,[{key:"calculator",value:function(e,n,i,a,s){if(nt(i))return i;if(Ie.isRelativeUnit(i.unit)){if(i.unit===J.kPercentage)return 0;if(i.unit===J.kEms){if(a.parentNode){var o=mb(a.parentNode);if(o)return o*=i.value,o}return 0}if(i.unit===J.kRems){var l;if(a!=null&&(l=a.ownerDocument)!==null&&l!==void 0&&l.documentElement){var c=mb(a.ownerDocument.documentElement);if(c)return c*=i.value,c}return 0}}else return i.value}}])}(),l5=function(){function r(){V(this,r),this.mixer=AC}return W(r,[{key:"calculator",value:function(e,n,i){return i.map(function(a){return a.value})}}])}(),c5=function(){function r(){V(this,r),this.mixer=AC}return W(r,[{key:"calculator",value:function(e,n,i){return i.map(function(a){return a.value})}}])}(),u5=function(){function r(){V(this,r)}return W(r,[{key:"calculator",value:function(e,n,i,a){var s;i instanceof Yn&&(i=null);var o=(s=i)===null||s===void 0?void 0:s.cloneNode(!0);return o&&(o.style.isMarker=!0),o}}])}(),h5=function(){function r(){V(this,r),this.mixer=l1}return W(r,[{key:"calculator",value:function(e,n,i){return i.value}}])}(),d5=function(){function r(){V(this,r),this.mixer=c1(0,1)}return W(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===$.LINE||s===$.PATH||s===$.POLYLINE){var o=i.getPoint(a);o&&e.setLocalPosition(o.x,o.y)}}}}])}(),f5=function(){function r(){V(this,r),this.mixer=c1(0,1)}return W(r,[{key:"calculator",value:function(e,n,i){return i.value}}])}(),g5=function(){function r(){V(this,r),this.parser=NC,this.mixer=jI}return W(r,[{key:"calculator",value:function(e,n,i){return i instanceof Yn&&i.value==="unset"?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Os(0,0,0,0)}:i}}])}(),v5=W(function r(){V(this,r),this.mixer=GI}),p5=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=mt(this,t,[].concat(i)),e.mixer=c1(0,1/0),e}return pt(t,r),W(t)}(Zm),m5=function(){function r(){V(this,r)}return W(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof Yn?i.value==="unset"?"":i.value:"".concat(i)}},{key:"postProcessor",value:function(e){e.nodeValue="".concat(e.parsedStyle.text)||""}}])}(),y5=function(){function r(){V(this,r)}return W(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}}])}(),Yd=new WeakMap;function b5(r,t,e){if(r){var n=typeof r=="string"?document.getElementById(r):r;Yd.has(n)&&Yd.get(n).destroy(e),Yd.set(n,t)}}var h1=typeof window<"u"&&typeof window.document<"u";function w5(r){return!!r.getAttribute}function x5(r,t){for(var e=0,n=r.length;e<n;){var i=e+n>>>1;FC(r[i],t)<0?e=i+1:n=i}return e}function FC(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 BC(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 yb="px";function E5(r,t,e){h1&&r.style&&(r.style.width=t+yb,r.style.height=e+yb)}function zC(r,t){if(h1)return document.defaultView.getComputedStyle(r,null).getPropertyValue(t)}function S5(r){var t=zC(r,"width");return t==="auto"?r.offsetWidth:parseFloat(t)}function _5(r){var t=zC(r,"height");return t==="auto"?r.offsetHeight:parseFloat(t)}var k5=1,M5={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Jm=typeof performance=="object"&&performance.now?performance:Date;function uu(r){return r.nodeName===$.FRAGMENT?!0:r.getRootNode().nodeName===$.FRAGMENT}function Wa(){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 C5=1,T5=function(){return C5++},Cr=typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:{},O5=Date.now(),A5=function(){return Cr.performance&&typeof Cr.performance.now=="function"?Cr.performance.now():Date.now()-O5},so={},bb=Date.now(),P5=function(t){if(typeof t!="function")throw new TypeError("".concat(t," is not a function"));var e=Date.now(),n=e-bb,i=n>16?0:16-n,a=T5();return so[a]=t,Object.keys(so).length>1||setTimeout(function(){bb=e;var s=so;so={},Object.keys(s).forEach(function(o){return s[o](A5())})},i),a},N5=function(t){delete so[t]},R5=["","webkit","moz","ms","o"],$C=function(t){return typeof t!="string"?P5:t===""?Cr.requestAnimationFrame:Cr["".concat(t,"RequestAnimationFrame")]},L5=function(t){return typeof t!="string"?N5:t===""?Cr.cancelAnimationFrame:Cr["".concat(t,"CancelAnimationFrame")]||Cr["".concat(t,"CancelRequestAnimationFrame")]},D5=function(t,e){for(var n=0;t[n]!==void 0;){if(e(t[n]))return t[n];n+=1}},jC=D5(R5,function(r){return!!$C(r)}),d1=$C(jC),qC=L5(jC);Cr.requestAnimationFrame=d1;Cr.cancelAnimationFrame=qC;var I5=function(){function r(){V(this,r),this.callbacks=[]}return W(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)}))}}])}(),F5=function(){function r(){V(this,r),this.callbacks=[]}return W(r,[{key:"tapPromise",value:function(e,n){this.callbacks.push(n)}},{key:"promise",value:function(){var t=Gi(We().mark(function n(){var i,a,s,o,l=arguments;return We().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:if(!this.callbacks.length){u.next=14;break}return u.next=3,(i=this.callbacks)[0].apply(i,l);case 3:a=u.sent,s=0;case 5:if(!(s<this.callbacks.length-1)){u.next=13;break}return o=this.callbacks[s],u.next=9,o(a);case 9:a=u.sent;case 10:s++,u.next=5;break;case 13:return u.abrupt("return",a);case 14:return u.abrupt("return",null);case 15:case"end":return u.stop()}},n,this)}));function e(){return t.apply(this,arguments)}return e}()}])}(),tn=function(){function r(){V(this,r),this.callbacks=[]}return W(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)})}}])}(),Xd=function(){function r(){V(this,r),this.callbacks=[]}return W(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}}])}(),B5=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],z5=/([\"\'])[^\'\"]+\1/;function $5(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,c=r.fontWeight,u=c===void 0?"normal":c,h=nt(e)&&"".concat(e,"px")||"16px",d=i.split(","),f=d.length-1;f>=0;f--){var g=d[f].trim();!z5.test(g)&&B5.indexOf(g)<0&&(g='"'.concat(g,'"')),d[f]=g}return"".concat(s," ").concat(l," ").concat(u," ").concat(h," ").concat(d.join(","))}function Kd(r,t,e){return Wi(r),r[4]=Math.tan(t),r[1]=Math.tan(e),r}var pe=Wt(),j5=Wt(),q5={scale:function(t){pa(pe,[t[0].value,t[1].value,1])},scaleX:function(t){pa(pe,[t[0].value,1,1])},scaleY:function(t){pa(pe,[1,t[0].value,1])},scaleZ:function(t){pa(pe,[1,1,t[0].value])},scale3d:function(t){pa(pe,[t[0].value,t[1].value,t[2].value])},translate:function(t){ki(pe,[t[0].value,t[1].value,0])},translateX:function(t){ki(pe,[t[0].value,0,0])},translateY:function(t){ki(pe,[0,t[0].value,0])},translateZ:function(t){ki(pe,[0,0,t[0].value])},translate3d:function(t){ki(pe,[t[0].value,t[1].value,t[2].value])},rotate:function(t){Am(pe,Bt(vn(t[0])))},rotateX:function(t){qM(pe,Bt(vn(t[0])))},rotateY:function(t){GM(pe,Bt(vn(t[0])))},rotateZ:function(t){Am(pe,Bt(vn(t[0])))},rotate3d:function(t){jM(pe,Bt(vn(t[3])),[t[0].value,t[1].value,t[2].value])},skew:function(t){Kd(pe,Bt(t[0].value),Bt(t[1].value))},skewX:function(t){Kd(pe,Bt(t[0].value),0)},skewY:function(t){Kd(pe,0,Bt(t[0].value))},matrix:function(t){Om(pe,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){Om.apply($L,[pe].concat(Ut(t.map(function(e){return e.value}))))}},G5=Yt(1,1,1),W5=St(),wb={translate:function(t,e){U.sceneGraphService.setLocalScale(t,G5,!1),U.sceneGraphService.setLocalEulerAngles(t,W5,void 0,void 0,!1),U.sceneGraphService.setLocalPosition(t,[e[0].value,e[1].value,0],!1),U.sceneGraphService.dirtifyLocal(t,t.transformable)}};function GC(r,t){if(r.length){if(r.length===1&&wb[r[0].t]){wb[r[0].t](t,r[0].d);return}for(var e=Wi(j5),n=0;n<r.length;n++){var i=r[n],a=i.t,s=i.d,o=q5[a];o&&(o(s),ZM(e,e,pe))}t.setLocalTransform(e)}else t.resetLocalTransform();return t.getLocalTransform()}var V5=function(){function r(){V(this,r),this.parser=WI,this.mixer=QI}return W(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof Yn?[]:i}},{key:"postProcessor",value:function(e){GC(e.parsedStyle.transform,e)}}])}(),H5=function(){function r(){V(this,r)}return W(r,[{key:"postProcessor",value:function(e){var n=e.parsedStyle.transformOrigin;n[0].unit===J.kPixels&&n[1].unit===J.kPixels?e.setOrigin(n[0].value,n[1].value):e.getGeometryBounds()}}])}(),U5=function(){function r(){V(this,r)}return W(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=au.Z_INDEX_CHANGED)}}}])}(),Y5=function(){function r(){V(this,r)}return W(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,c=l===void 0?0:l;return{cx:a,cy:o,hwidth:c,hheight:c}}}])}(),X5=function(){function r(){V(this,r)}return W(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,c=l===void 0?0:l,u=e.ry,h=u===void 0?0:u;return{cx:a,cy:o,hwidth:c,hheight:h}}}])}(),K5=function(){function r(){V(this,r)}return W(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),c=Math.min(i,s),u=Math.max(i,s),h=l-o,d=u-c,f=h/2,g=d/2;return{cx:o+f,cy:c+g,hwidth:f,hheight:g}}}])}(),Z5=function(){function r(){V(this,r)}return W(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,c=o/2,u=l/2;return{cx:a+c,cy:s+u,hwidth:c,hheight:u}}}])}(),J5=function(){function r(){V(this,r)}return W(r,[{key:"update",value:function(e){if(e.points&&Dn(e.points.points)){var n=e.points.points,i=Math.min.apply(Math,Ut(n.map(function(d){return d[0]}))),a=Math.max.apply(Math,Ut(n.map(function(d){return d[0]}))),s=Math.min.apply(Math,Ut(n.map(function(d){return d[1]}))),o=Math.max.apply(Math,Ut(n.map(function(d){return d[1]}))),l=a-i,c=o-s,u=l/2,h=c/2;return{cx:i+u,cy:s+h,hwidth:u,hheight:h}}return{cx:0,cy:0,hwidth:0,hheight:0}}}])}(),Q5=function(){function r(){V(this,r)}return W(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,c=e.width,u=c===void 0?0:c,h=e.height,d=h===void 0?0:h,f=u,g=d;return l&&!Tt(l)&&(f||(f=l.width,e.width=f),g||(g=l.height,e.height=g)),{cx:a+f/2,cy:o+g/2,hwidth:f/2,hheight:g/2}}}])}(),t4=function(){function r(t){V(this,r),this.globalRuntime=t}return W(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,c=l===void 0?1:l,u=e.textBaseline,h=u===void 0?"alphabetic":u,d=e.dx,f=d===void 0?0:d,g=e.dy,v=g===void 0?0:g,p=e.x,m=p===void 0?0:p,y=e.y,b=y===void 0?0:y;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 w=(n==null||(i=n.ownerDocument)===null||i===void 0||(i=i.defaultView)===null||i===void 0?void 0:i.getConfig())||{},x=w.offscreenCanvas,S=this.globalRuntime.textService.measureText(a,e,x);e.metrics=S;var E=S.width,_=S.height,C=E/2,k=_/2,M=m+C;o==="center"||o==="middle"?M+=c/2-C:(o==="right"||o==="end")&&(M+=c-C*2);var T=b-k;return h==="middle"?T+=k:h==="top"||h==="hanging"?T+=k*2:h==="alphabetic"||(h==="bottom"||h==="ideographic")&&(T+=0),f&&(M+=f),v&&(T+=v),{cx:M,cy:T,hwidth:C,hheight:k}}}])}(),e4=function(){function r(){V(this,r)}return W(r,[{key:"update",value:function(e,n){return{cx:0,cy:0,hwidth:0,hheight:0}}}])}(),n4=function(){function r(){V(this,r)}return W(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,c=l===void 0?0:l,u=e.height,h=u===void 0?0:u;return{cx:a+c/2,cy:o+h/2,hwidth:c/2,hheight:h/2}}}])}(),Wu=function(){function r(t){V(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 qe,this.page=new qe,this.canvas=new qe,this.viewport=new qe,this.composed=!1,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}return W(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(Ft)}}])}(),WC=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=mt(this,t,[].concat(i)),e.client=new qe,e.movement=new qe,e.offset=new qe,e.global=new qe,e.screen=new qe,e}return pt(t,r),W(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(Ft)}}])}(Wu),hu=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=mt(this,t,[].concat(i)),e.width=0,e.height=0,e.isPrimary=!1,e}return pt(t,r),W(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)}}])}(WC),Qm=function(r){function t(){return V(this,t),mt(this,t,arguments)}return pt(t,r),W(t,[{key:"clone",value:function(){return this.manager.cloneWheelEvent(this)}}])}(WC),we=function(r){function t(e,n){var i;return V(this,t),i=mt(this,t,[null]),i.type=e,i.detail=n,Object.assign(i,n),i}return pt(t,r),W(t)}(Wu),xb=new WeakMap,VC=function(){function r(){V(this,r),this.emitter=new NM}return W(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(nu(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=at(n)?n:n.handleEvent;var c=at(n)?void 0:n;return s?this.emitter.once(e,n,c):this.emitter.on(e,n,c),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=nu(i)?i:i==null?void 0:i.capture;s&&(e+="capture"),n=at(n)?n:(a=n)===null||a===void 0?void 0:a.handleEvent;var o=at(n)?void 0:n;return this.emitter.off(e,n,o),this}},{key:"emit",value:function(e,n){this.dispatchEvent(new we(e,n))}},{key:"dispatchEvent",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=xb.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&&xb.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}}])}(),ie=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=mt(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 pt(t,r),W(t,[{key:"textContent",get:function(){var n="";this.nodeName===$.TEXT&&(n+=this.style.text);var i=ma(this.childNodes),a;try{for(i.s();!(a=i.n()).done;){var s=a.value;s.nodeName===$.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===$.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(Ft)}},{key:"lookupNamespaceURI",value:function(n){throw new Error(Ft)}},{key:"lookupPrefix",value:function(n){throw new Error(Ft)}},{key:"normalize",value:function(){throw new Error(Ft)}},{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 c=s.length>o.length?s:o,u=c===s?o:s;if(c[c.length-u.length]===u[0])return c===s?t.DOCUMENT_POSITION_CONTAINED_BY|t.DOCUMENT_POSITION_FOLLOWING:t.DOCUMENT_POSITION_CONTAINS|t.DOCUMENT_POSITION_PRECEDING;for(var h=c.length-u.length,d=u.length-1;d>=0;d--){var f=u[d],g=c[h+d];if(g!==f){var v=f.parentNode.childNodes;return v.indexOf(f)<v.indexOf(g)?u===s?t.DOCUMENT_POSITION_PRECEDING:t.DOCUMENT_POSITION_FOLLOWING:c===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}}])}(VC);ie.DOCUMENT_POSITION_DISCONNECTED=1;ie.DOCUMENT_POSITION_PRECEDING=2;ie.DOCUMENT_POSITION_FOLLOWING=4;ie.DOCUMENT_POSITION_CONTAINS=8;ie.DOCUMENT_POSITION_CONTAINED_BY=16;ie.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;var r4=2048,i4=function(){function r(t,e){var n=this;V(this,r),this.nativeHTMLMap=new WeakMap,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.tmpMatrix=Wt(),this.tmpVec3=St(),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=Jm.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),c=n.findMountedTarget(l.pressTargetsByButton[i.button]),u=c;if(c&&!s.composedPath().includes(c)){for(var h=c;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")}ie.isNode(h)&&(h=h.parentNode)}delete l.pressTargetsByButton[i.button],u=h}if(u){var f,g=n.clonePointerEvent(s,"click");g.target=u,g.path=[],l.clicksByButton[i.button]||(l.clicksByButton[i.button]={clickCount:0,target:g.target,timeStamp:a});var v=n.context.renderingContext.root.ownerDocument.defaultView,p=l.clicksByButton[i.button];p.target===g.target&&a-p.timeStamp<v.getConfig().dblClickSpeed?++p.clickCount:p.clickCount=1,p.target=g.target,p.timeStamp=a,g.detail=p.clickCount,(f=s.detail)!==null&&f!==void 0&&f.preventClick||(!n.context.config.useNativeClickEvent&&(g.pointerType==="mouse"||g.pointerType==="touch")&&n.dispatchEvent(g,"click"),n.dispatchEvent(g,"pointertap")),n.freeEvent(g)}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 c=i.type==="mousemove"?"mouseout":"pointerout",u=n.createPointerEvent(i,c,l||void 0);if(n.dispatchEvent(u,"pointerout"),s&&n.dispatchEvent(u,"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"),ie.isNode(h.target)&&(h.target=h.target.parentNode);n.freeEvent(h)}n.freeEvent(u)}if(l!==a.target){var d=i.type==="mousemove"?"mouseover":"pointerover",f=n.clonePointerEvent(a,d);n.dispatchEvent(f,"pointerover"),s&&n.dispatchEvent(f,"mouseover");for(var g=l&&ie.isNode(l)&&l.parentNode;g&&g!==(ie.isNode(n.rootTarget)&&n.rootTarget.parentNode)&&g!==a.target;)g=g.parentNode;var v=!g||g===(ie.isNode(n.rootTarget)&&n.rootTarget.parentNode);if(v){var p=n.clonePointerEvent(a,"pointerenter");for(p.eventPhase=p.AT_TARGET;p.target&&p.target!==l&&p.target!==(ie.isNode(n.rootTarget)&&n.rootTarget.parentNode);)p.currentTarget=p.target,n.notifyTarget(p),s&&n.notifyTarget(p,"mouseenter"),ie.isNode(p.target)&&(p.target=p.target.parentNode);n.freeEvent(p)}n.freeEvent(f)}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 c=n.createPointerEvent(i,"pointerleave",o||void 0);for(c.eventPhase=c.AT_TARGET;c.target&&c.target!==(ie.isNode(n.rootTarget)&&n.rootTarget.parentNode);)c.currentTarget=c.target,n.notifyTarget(c),s&&n.notifyTarget(c,"mouseleave"),ie.isNode(c.target)&&(c.target=c.target.parentNode);a.overTargets=null,n.freeEvent(l),n.freeEvent(c)}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!==(ie.isNode(n.rootTarget)&&n.rootTarget.parentNode);)l.currentTarget=l.target,n.notifyTarget(l),o&&n.notifyTarget(l,"mouseenter"),ie.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"),ie.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 W(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 qe((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 qe((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,c=o.height,u=s.getPerspectiveInverse(),h=s.getWorldTransform(),d=Je(this.tmpMatrix,h,u),f=Ze(this.tmpVec3,n/l*2-1,(1-i/c)*2-1,0);return Qe(f,f,d),new qe(f[0],f[1])}},{key:"canvas2Viewport",value:function(e){var n=this.rootTarget.defaultView,i=n.getCamera(),a=i.getPerspective(),s=i.getViewTransform(),o=Je(this.tmpMatrix,a,s),l=Ze(this.tmpVec3,e.x,e.y,0);Qe(this.tmpVec3,this.tmpVec3,o);var c=this.context.config,u=c.width,h=c.height;return new qe((l[0]+1)/2*u,(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<r4&&e!==this.rootTarget;a++)ie.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(hu);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(Qm);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(Qm);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(hu);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=Jm.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||ie.isNode(a)&&a.parentNode===n)n=e[i];else break}return n}},{key:"getCursor",value:function(e){for(var n=e;n;){var i=w5(n)&&n.getAttribute("cursor");if(i)return i;n=ie.isNode(n)&&n.parentNode}}}])}(),f1=function(){function r(){V(this,r)}return W(r,[{key:"getOrCreateCanvas",value:function(e,n){if(this.canvas)return this.canvas;if(e||U.offscreenCanvas)this.canvas=e||U.offscreenCanvas,this.context=this.canvas.getContext("2d",vt({willReadFrequently:!0},n));else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",vt({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",vt({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}}])}(),Ss=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}({}),a4=function(){function r(t,e){V(this,r),this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.hooks={init:new tn,initAsync:new I5,dirtycheck:new Xd,cull:new Xd,beginFrame:new tn,beforeRender:new tn,render:new tn,afterRender:new tn,endFrame:new tn,destroy:new tn,pick:new F5,pickSync:new Xd,pointerDown:new tn,pointerUp:new tn,pointerMove:new tn,pointerOut:new tn,pointerOver:new tn,pointerWheel:new tn,pointerCancel:new tn,click:new tn},this.globalRuntime=t,this.context=e}return W(r,[{key:"init",value:function(e){var n=this,i=vt(vt({},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(Ss.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(Ss.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(c){a.hooks.beforeRender.call(c),a.hooks.render.call(c),a.hooks.afterRender.call(c)}),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 c(g){var v=g.renderable,p=g.sortable,m=o?v.dirty||i.dirtyRectangleRenderingDisabled?g:null:g;if(m){var y=l?a.hooks.cull.call(m,a.context.camera):m;y&&(a.stats.rendered+=1,i.renderListCurrentFrame.push(y))}v.dirty=!1,p.renderOrder=a.zIndexCounter,a.zIndexCounter+=1,a.stats.total+=1,p.dirty&&(a.sort(g,p),p.dirty=!1,p.dirtyChildren=[],p.dirtyReason=void 0)}for(var u=[e];u.length>0;){var h=u.pop();c(h);for(var d=h.sortable.sorted||h.childNodes,f=d.length-1;f>=0;f--)u.push(d[f])}}},{key:"sort",value:function(e,n){n.sorted&&n.dirtyReason!==au.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=x5(n.sorted,i);n.sorted.splice(o,0,i)}}):n.sorted=e.childNodes.slice().sort(FC)}},{key:"destroy",value:function(){this.inited=!1,this.hooks.destroy.call(),this.globalRuntime.sceneGraphService.clearPendingEvents()}},{key:"dirtify",value:function(){this.context.renderingContext.renderReasons.add(Ss.DISPLAY_OBJECT_CHANGED)}}])}(),s4=/\[\s*(.*)=(.*)\s*\]/,o4=function(){function r(){V(this,r)}return W(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(s4),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 ot(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}({}),Tr=function(r){function t(e,n,i,a,s,o,l,c){var u;return V(this,t),u=mt(this,t,[null]),u.relatedNode=n,u.prevValue=i,u.newValue=a,u.attrName=s,u.attrChange=o,u.prevParsedValue=l,u.newParsedValue=c,u.type=e,u}return pt(t,r),W(t)}(Wu);Tr.ADDITION=2;Tr.MODIFICATION=1;Tr.REMOVAL=3;function Eb(r){var t=r.renderable;t&&(t.renderBoundsDirty=!0,t.boundsDirty=!0)}var l4=new Tr(xt.REPARENT,null,"","","",0,"",""),c4=r1(),Il=St(),u4=Yt(1,1,1),h4=Wt(),d4=r1(),vi=St(),rs=Wt(),pi=Te(),f4=St(),g4=Te(),v4=St(),Xs=St(),ha=St(),Fl=Wt(),Sb=Te(),_b=Te(),Bl=Te(),Zd={affectChildren:!0},p4=function(){function r(t){V(this,r),this.pendingEvents=new Map,this.boundsChangedEvent=new we(xt.BOUNDS_CHANGED),this.displayObjectDependencyMap=new WeakMap,this.runtime=t}return W(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===$.FRAGMENT,l=uu(n);e.parentNode=n;var c=o?e.childNodes:[e];nt(i)?c.forEach(function(f){n.childNodes.splice(i,0,f),f.parentNode=n}):c.forEach(function(f){n.childNodes.push(f),f.parentNode=n});var u=n,h=u.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=au.ADDED),!l){if(o)this.dirtifyFragment(e);else{var d=e.transformable;d&&this.dirtifyWorld(e,d)}s&&e.dispatchEvent(l4)}}},{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=au.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=Yt(n,i,a));var s=e.transformable;if(e.parentNode===null||!e.parentNode.transformable)this.rotateLocal(e,n);else{var o=pi;Cl(o,n[0],n[1],n[2]);var l=this.getRotation(e),c=this.getRotation(e.parentNode);Tl(Bl,c),Ld(Bl,Bl),Bi(o,Bl,o),Bi(s.localRotation,o,l),Jc(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=Yt(n,i,a));var s=e.transformable;Cl(_b,n[0],n[1],n[2]),z2(s.localRotation,s.localRotation,_b),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=Yt(n,i,a));var s=e.transformable;if(e.parentNode===null||!e.parentNode.transformable)this.setLocalEulerAngles(e,n);else{Cl(s.localRotation,n[0],n[1],n[2]);var o=this.getRotation(e.parentNode);Tl(Sb,Ld(pi,o)),z2(s.localRotation,s.localRotation,Sb),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=Yt(n,i,a));var o=e.transformable;Cl(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=Yt(n,i,a));var s=e.transformable;Us(n,Il)||(HL(n,n,s.localRotation),Fi(s.localPosition,s.localPosition,n),this.dirtifyLocal(e,s))}},{key:"setPosition",value:function(e,n){var i,a=e.transformable;if(ha[0]=n[0],ha[1]=n[1],ha[2]=(i=n[2])!==null&&i!==void 0?i:0,!Us(this.getPosition(e),ha)){if(Er(a.position,ha),e.parentNode===null||!e.parentNode.transformable)Er(a.localPosition,ha);else{var s=e.parentNode.transformable;Ms(Fl,s.worldTransform),xr(Fl,Fl),Qe(a.localPosition,ha,Fl)}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;Xs[0]=n[0],Xs[1]=n[1],Xs[2]=(i=n[2])!==null&&i!==void 0?i:0,!Us(s.localPosition,Xs)&&(Er(s.localPosition,Xs),a&&this.dirtifyLocal(e,s))}},{key:"scaleLocal",value:function(e,n){var i,a=e.transformable;jL(a.localScale,a.localScale,Ze(vi,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;Ze(vi,n[0],n[1],(i=n[2])!==null&&i!==void 0?i:s.localScale[2]),!Us(vi,s.localScale)&&(Er(s.localScale,vi),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=Ze(vi,n,i,a)),!Us(n,Il)&&(Fi(vi,this.getPosition(e),n),this.setPosition(e,vi))}},{key:"setRotation",value:function(e,n,i,a,s){var o=e.transformable;if(typeof n=="number"&&(n=JL(n,i,a,s)),e.parentNode===null||!e.parentNode.transformable)this.setLocalRotation(e,n);else{var l=this.getRotation(e.parentNode);Tl(pi,l),Ld(pi,pi),Bi(o.localRotation,pi,n),Jc(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=B2(pi,n,i,a,s));var l=e.transformable;Tl(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=t6(d4,n,i));var s=e.transformable;QL(s.localSkew,n),a&&this.dirtifyLocal(e,s)}},{key:"dirtifyLocal",value:function(e,n){uu(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===$.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===$.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!==$.FRAGMENT&&(Zd.affectChildren=a,a?s.forEach(function(o){i(o,Zd)}):i(s,Zd))}),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;)Eb(i),i=i.parentNode;n&&e.forEach(function(a){Eb(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 Tr(xt.ATTR_MODIFIED,s,n,n,a,Tr.MODIFICATION,n,n)),s.isCustomElement&&s.isConnected&&s.attributeChangedCallback&&s.attributeChangedCallback(a,n,n)})})}},{key:"getPosition",value:function(e){var n=e.transformable;return Xc(n.position,this.getWorldTransform(e,n))}},{key:"getRotation",value:function(e){var n=e.transformable;return Kc(n.rotation,this.getWorldTransform(e,n))}},{key:"getScale",value:function(e){var n=e.transformable;return Cs(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){So(e.localTransform,e.localRotation,e.localPosition,Yt(1,1,1),e.origin),(e.localSkew[0]!==0||e.localSkew[1]!==0)&&(Wi(rs),rs[4]=Math.tan(e.localSkew[0]),rs[1]=Math.tan(e.localSkew[1]),Je(e.localTransform,e.localTransform,rs));var i=So(rs,B2(pi,0,0,0,1),Ze(vi,1,1,1),e.localScale,e.origin);Je(e.localTransform,e.localTransform,i)}else{var a=e.localTransform,s=e.localPosition,o=e.localRotation,l=e.localScale,c=e.origin,u=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,f=c[0]!==0||c[1]!==0||c[2]!==0;!h&&!d&&!f?u?ki(a,s):Wi(a):So(a,o,s,l,c)}}},{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=Xc(f4,n),a=Kc(g4,n),s=Cs(v4,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,u4,!1),this.setLocalPosition(e,Il,!1),this.setLocalEulerAngles(e,Il,void 0,void 0,!1),this.setLocalSkew(e,c4,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(!Vt.isEmpty(a)){var s=i||new Vt;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&&U.styleValueRegistry.updateGeometry(e);var s=n?a.renderBounds:a.contentBounds||null;return s||new Vt}},{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),c=e.childNodes;if(c.forEach(function(d){var f=n.getBounds(d,i);f&&(l?l.add(f):(l=o||new Vt,l.update(f.center,f.halfExtents)))}),l||(l=new Vt),i){var u=BC(e);if(u){var h=u.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=h4;e.parentNode.transformable&&(n=xr(rs,this.getWorldTransform(e.parentNode)));var i=this.getBounds(e);if(!Vt.isEmpty(i)){var a=new Vt;return a.setFromTransformedAABB(i,n),a}}return this.getBounds(e)}},{key:"getBoundingClientRect",value:function(e){var n,i,a=this.getGeometryBounds(e);Vt.isEmpty(a)||(i=new Vt,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=dt(o,2),c=l[0],u=l[1],h=i.getMax(),d=dt(h,2),f=d[0],g=d[1];return new Os(c+((s==null?void 0:s.left)||0),u+((s==null?void 0:s.top)||0),f-c,g-u)}return new Os((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?Ms(n.worldTransform,n.localTransform):Je(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}}}])}(),da={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]},kb=/[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff!"#$%&'()*+,-./:;]/,m4=/[!%),.:;?\]}¢°·'""†‡›℃∶、。〃〆〕〗〞﹚﹜!"%'),.:;?!]}~]/,y4=/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/,b4=/[!),.:;?\]}¢·–—'"•"、。〆〞〕〉》」︰︱︲︳﹐﹑﹒﹔﹕﹖﹘﹚﹜!),.:;?︶︸︺︼︾﹀﹂﹗]|}、]/,w4=/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/,x4=/[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、:;,。.]/,E4=/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/,S4=/[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/,_4=/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/,k4=new RegExp("".concat(m4.source,"|").concat(b4.source,"|").concat(x4.source,"|").concat(S4.source)),M4=new RegExp("".concat(y4.source,"|").concat(w4.source,"|").concat(E4.source,"|").concat(_4.source)),C4=function(){function r(t){var e=this;V(this,r),this.fontMetricsCache={},this.shouldBreakByKinsokuShorui=function(n,i){return e.isBreakingSpace(i)?!1:!!(n&&(M4.exec(i)||k4.exec(n)))},this.trimByKinsokuShorui=function(n){var i=Ut(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 W(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=da.MetricsString+da.BaselineSymbol,l=Math.ceil(s.measureText(o).width),c=Math.ceil(s.measureText(da.BaselineSymbol).width),u=da.HeightMultiplier*c;c=c*da.BaselineMultiplier|0,a.width=l,a.height=u,s.fillStyle="#f00",s.fillRect(0,0,l,u),s.font=e,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(o,0,c);var h=s.getImageData(0,0,l||1,u||1).data,d=h.length,f=l*4,g=0,v=0,p=!1;for(g=0;g<c;++g){for(var m=0;m<f;m+=4)if(h[v+m]!==255){p=!0;break}if(!p)v+=f;else break}for(i.ascent=c-g,v=d-f,p=!1,g=u;g>c;--g){for(var y=0;y<f;y+=4)if(h[v+y]!==255){p=!0;break}if(!p)v-=f;else break}return i.descent=g-c,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,c=n.lineHeight,u=n.lineWidth,h=u===void 0?1:u,d=n.textBaseline,f=d===void 0?"alphabetic":d,g=n.textAlign,v=g===void 0?"start":g,p=n.letterSpacing,m=p===void 0?0:p,y=n.textPath;n.textPathSide,n.textPathStartOffset;var b=n.leading,w=b===void 0?0:b,x=$5(n),S=this.measureFont(x,i);S.fontSize===0&&(S.fontSize=s,S.ascent=s);var E=this.runtime.offscreenCanvasCreator.getOrCreateContext(i);E.font=x,n.isOverflowing=!1;var _=l?this.wordWrap(e,n,i):e,C=_.split(/(?:\r\n|\r|\n)/),k=new Array(C.length),M=0;if(y){y.getTotalLength();for(var T=0;T<C.length;T++)E.measureText(C[T]).width+(C[T].length-1)*m}else{for(var O=0;O<C.length;O++){var R=E.measureText(C[O]).width+(C[O].length-1)*m;k[O]=R,M=Math.max(M,R)}var D=M+h,L=c||S.fontSize+h,P=Math.max(L,S.fontSize+h)+(C.length-1)*(L+w);L+=w;var A=0;return f==="middle"?A=-P/2:f==="bottom"||f==="alphabetic"||f==="ideographic"?A=-P:(f==="top"||f==="hanging")&&(A=0),{font:x,width:D,height:P,lines:C,lineWidths:k,lineHeight:L,maxLineWidth:M,fontProperties:S,lineMetrics:k.map(function(I,B){var j=0;return v==="center"||v==="middle"?j-=I/2:(v==="right"||v==="end")&&(j-=I),new Os(j-h/2,A+B*L,I+h,L)})}}}},{key:"wordWrap",value:function(e,n,i){var a=this,s=this,o=n.wordWrapWidth,l=o===void 0?0:o,c=n.letterSpacing,u=c===void 0?0:c,h=n.maxLines,d=h===void 0?1/0:h,f=n.textOverflow,g=this.runtime.offscreenCanvasCreator.getOrCreateContext(i),v=l+u,p="";f==="ellipsis"?p="...":f&&f!=="clip"&&(p=f);var m=Array.from(e),y=[],b=0,w=0,x=0,S={},E=function(A){return a.getFromCache(A,u,S,g)},_=E(p);function C(P,A,I,B){for(;E(P)<B&&A<m.length-1&&!s.isNewline(m[A+1]);)A+=1,P+=m[A];for(;E(P)>B&&A>I;)A-=1,P=P.slice(0,-1);return{lineTxt:P,txtLastCharIndex:A}}function k(P,A){if(!(_<=0||_>v)){if(!y[P]){y[P]=p;return}var I=C(y[P],A,x+1,v-_);y[P]=I.lineTxt+p}}for(var M=0;M<m.length;M++){var T=m[M],O=m[M-1],R=m[M+1],D=E(T);if(this.isNewline(T)){if(b+1>=d){n.isOverflowing=!0,M<m.length-1&&k(b,M-1);break}x=M-1,b+=1,w=0,y[b]="";continue}if(w>0&&w+D>v){var L=C(y[b],M-1,x+1,v);if(L.txtLastCharIndex!==M-1){if(y[b]=L.lineTxt,L.txtLastCharIndex===m.length-1)break;M=L.txtLastCharIndex+1,T=m[M],O=m[M-1],R=m[M+1],D=E(T)}if(b+1>=d){n.isOverflowing=!0,k(b,M-1);break}if(x=M-1,b+=1,w=0,y[b]="",this.isBreakingSpace(T))continue;this.canBreakInLastChar(T)||(y=this.trimToBreakable(y),w=this.sumTextWidthByCache(y[b]||"",E)),this.shouldBreakByKinsokuShorui(T,R)&&(y=this.trimByKinsokuShorui(y),w+=E(O||""))}w+=D,y[b]=(y[b]||"")+T}return y.join(`
- `)}},{key:"isBreakingSpace",value:function(e){return typeof e!="string"?!1:da.BreakingSpaces.indexOf(e.charCodeAt(0))>=0}},{key:"isNewline",value:function(e){return typeof e!="string"?!1:da.Newlines.indexOf(e.charCodeAt(0))>=0}},{key:"trimToBreakable",value:function(e){var n=Ut(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,c=a+(o?0:1);return n[n.length-1]+=i.slice(l,i.length),n[n.length-2]=i.slice(0,c),n}},{key:"canBreakInLastChar",value:function(e){return!(e&&kb.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(!kb.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}}])}(),U={},T4=function(r){var t=new Q5,e=new J5;return r={},rt(rt(rt(rt(rt(rt(rt(rt(rt(rt(r,$.FRAGMENT,null),$.CIRCLE,new Y5),$.ELLIPSE,new X5),$.RECT,t),$.IMAGE,t),$.GROUP,new e4),$.LINE,new K5),$.TEXT,new t4(U)),$.POLYLINE,e),$.POLYGON,e),rt(rt(rt(r,$.PATH,new Z5),$.HTML,new n4),$.MESH,null)}(),O4=function(r){var t=new s5,e=new Zm;return r={},rt(rt(rt(rt(rt(rt(rt(rt(rt(rt(r,Z.PERCENTAGE,null),Z.NUMBER,new h5),Z.ANGLE,new i5),Z.DEFINED_PATH,new a5),Z.PAINT,t),Z.COLOR,t),Z.FILTER,new o5),Z.LENGTH,e),Z.LENGTH_PERCENTAGE,e),Z.LENGTH_PERCENTAGE_12,new l5),rt(rt(rt(rt(rt(rt(rt(rt(rt(rt(r,Z.LENGTH_PERCENTAGE_14,new c5),Z.COORDINATE,new Zm),Z.OFFSET_DISTANCE,new d5),Z.OPACITY_VALUE,new f5),Z.PATH,new g5),Z.LIST_OF_POINTS,new v5),Z.SHADOW_BLUR,new p5),Z.TEXT,new m5),Z.TEXT_TRANSFORM,new y5),Z.TRANSFORM,new V5),rt(rt(rt(r,Z.TRANSFORM_ORIGIN,new H5),Z.Z_INDEX,new U5),Z.MARKER,new u5)}(),A4=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}};U.CameraContribution=yC;U.AnimationTimeline=null;U.EasingFunction=null;U.offscreenCanvasCreator=new f1;U.sceneGraphSelector=new o4;U.sceneGraphService=new p4(U);U.textService=new C4(U);U.geometryUpdaterFactory=T4;U.CSSPropertySyntaxFactory=O4;U.styleValueRegistry=new n5(U);U.layoutRegistry=null;U.globalThis=A4();U.enableStyleSyntax=!0;U.enableSizeAttenuation=!1;var P4=0,ty=new Tr(xt.INSERTED,null,"","","",0,"",""),ey=new Tr(xt.REMOVED,null,"","","",0,"",""),HC=new we(xt.DESTROY),N4=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=mt(this,t,[].concat(i)),e.entity=P4++,e.renderable={bounds:void 0,boundsDirty:!0,renderBounds:void 0,renderBoundsDirty:!0,dirtyRenderBounds:void 0,dirty:!1},e.cullable={strategy:BD.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 pt(t,r),W(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(Ft)}},{key:"appendChild",value:function(n,i){var a;if(n.destroyed)throw new Error(CD);return U.sceneGraphService.attach(n,this,i),(a=this.ownerDocument)!==null&&a!==void 0&&a.defaultView&&(!uu(this)&&n.nodeName===$.FRAGMENT?this.ownerDocument.defaultView.mountFragment(n):this.ownerDocument.defaultView.mountChildren(n)),this.isMutationObserved&&(ty.relatedNode=this,n.dispatchEvent(ty)),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 ey.relatedNode=this,n.dispatchEvent(ey),(i=n.ownerDocument)!==null&&i!==void 0&&i.defaultView&&n.ownerDocument.defaultView.unmountChildren(n),U.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 U.sceneGraphService.matches(n,this)}},{key:"getElementById",value:function(n){return U.sceneGraphService.querySelector("#".concat(n),this)}},{key:"getElementsByName",value:function(n){return U.sceneGraphService.querySelectorAll('[name="'.concat(n,'"]'),this)}},{key:"getElementsByClassName",value:function(n){return U.sceneGraphService.querySelectorAll(".".concat(n),this)}},{key:"getElementsByTagName",value:function(n){return U.sceneGraphService.querySelectorAll(n,this)}},{key:"querySelector",value:function(n){return U.sceneGraphService.querySelector(n,this)}},{key:"querySelectorAll",value:function(n){return U.sceneGraphService.querySelectorAll(n,this)}},{key:"closest",value:function(n){var i=this;do{if(U.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,c){var u;return(u=n.parentNode)===null||u===void 0?void 0:u.appendChild(l,i+c+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],c=s.slice(1);this.parentNode.appendChild(l,i),(n=l).after.apply(n,Ut(c))}}},{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(HC),this.remove(),this.emitter.removeAllListeners(),this.destroyed=!0}},{key:"getGeometryBounds",value:function(){return U.sceneGraphService.getGeometryBounds(this)}},{key:"getRenderBounds",value:function(){return U.sceneGraphService.getBounds(this,!0)}},{key:"getBounds",value:function(){return U.sceneGraphService.getBounds(this)}},{key:"getLocalBounds",value:function(){return U.sceneGraphService.getLocalBounds(this)}},{key:"getBoundingClientRect",value:function(){return U.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(Ft)}},{key:"getAttributeNode",value:function(n){throw new Error(Ft)}},{key:"getAttributeNodeNS",value:function(n,i){throw new Error(Ft)}},{key:"hasAttributeNS",value:function(n,i){throw new Error(Ft)}},{key:"removeAttributeNS",value:function(n,i){throw new Error(Ft)}},{key:"removeAttributeNode",value:function(n){throw new Error(Ft)}},{key:"setAttributeNS",value:function(n,i,a){throw new Error(Ft)}},{key:"setAttributeNode",value:function(n){throw new Error(Ft)}},{key:"setAttributeNodeNS",value:function(n){throw new Error(Ft)}},{key:"toggleAttribute",value:function(n,i){throw new Error(Ft)}}])}(ie);function Ct(r){return!!(r!=null&&r.nodeName)}var R4=U.globalThis.Proxy?U.globalThis.Proxy:function(){},br=new Tr(xt.ATTR_MODIFIED,null,null,null,null,Tr.MODIFICATION,null,null),Ks=St(),L4=Te(),Zt=function(r){function t(e){var n;return V(this,t),n=mt(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||$.GROUP,e.initialParsedStyle&&Object.assign(n.parsedStyle,e.initialParsedStyle),n.initAttributes(e.style),U.enableStyleSyntax&&(n.style=new R4({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 pt(t,r),W(t,[{key:"destroy",value:function(){V2(t,"destroy",this)([]),this.getAnimations().forEach(function(n){n.cancel()})}},{key:"cloneNode",value:function(n,i){var a=vt({},this.attributes);for(var s in a){var o=a[s];Ct(o)&&s!=="clipPath"&&s!=="offsetPath"&&s!=="textPath"&&(a[s]=o.cloneNode(n)),i&&(a[s]=i(s,o))}var l=new this.constructor(vt(vt({},this.config),{},{style:a}));return l.setLocalTransform(this.getLocalTransform()),n&&this.children.forEach(function(c){if(!c.style.isMarker){var u=c.cloneNode(n);l.appendChild(u)}}),l}},{key:"initAttributes",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i={forceUpdateGeometry:!0};U.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;ut(i)||(a||i!==this.attributes[n])&&(this.internalSetAttribute(n,i,{memoize:s}),V2(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];U.styleValueRegistry.processProperties(this,rt({},n,i),a),s.dirty=!0;var c=this.parsedStyle[n];if(this.isConnected&&(br.relatedNode=this,br.prevValue=o,br.newValue=i,br.attrName=n,br.prevParsedValue=l,br.newParsedValue=c,this.isMutationObserved?this.dispatchEvent(br):(br.target=this,this.ownerDocument.defaultView.dispatchEvent(br,!0))),this.isCustomElement&&this.isConnected||!this.isCustomElement){var u,h;(u=(h=this).attributeChangedCallback)===null||u===void 0||u.call(h,n,o,i,l,c)}}},{key:"getBBox",value:function(){var n=this.getBounds(),i=n.getMin(),a=dt(i,2),s=a[0],o=a[1],l=n.getMax(),c=dt(l,2),u=c[0],h=c[1];return new Os(s,o,u-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 U.sceneGraphService.setOrigin(this,en(n,i,a,!1)),this}},{key:"getOrigin",value:function(){return U.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 U.sceneGraphService.setPosition(this,en(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 U.sceneGraphService.setLocalPosition(this,en(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 U.sceneGraphService.translate(this,en(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 U.sceneGraphService.translateLocal(this,en(n,i,a,!1)),this}},{key:"getPosition",value:function(){return U.sceneGraphService.getPosition(this)}},{key:"getLocalPosition",value:function(){return U.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=en(n,i,a,!1)),U.sceneGraphService.scaleLocal(this,n),this}},{key:"setLocalScale",value:function(n,i,a){return typeof n=="number"&&(i=i||n,a=a||n,n=en(n,i,a,!1)),U.sceneGraphService.setLocalScale(this,n),this}},{key:"getLocalScale",value:function(){return U.sceneGraphService.getLocalScale(this)}},{key:"getScale",value:function(){return U.sceneGraphService.getScale(this)}},{key:"getEulerAngles",value:function(){var n=jd(Ks,U.sceneGraphService.getWorldTransform(this)),i=dt(n,3),a=i[2];return gn(a)}},{key:"getLocalEulerAngles",value:function(){var n=jd(Ks,U.sceneGraphService.getLocalRotation(this)),i=dt(n,3),a=i[2];return gn(a)}},{key:"setEulerAngles",value:function(n){return U.sceneGraphService.setEulerAngles(this,0,0,n),this}},{key:"setLocalEulerAngles",value:function(n){return U.sceneGraphService.setLocalEulerAngles(this,0,0,n),this}},{key:"rotateLocal",value:function(n,i,a){return ot(i)&&ot(a)?U.sceneGraphService.rotateLocal(this,0,0,n):U.sceneGraphService.rotateLocal(this,n,i,a),this}},{key:"rotate",value:function(n,i,a){return ot(i)&&ot(a)?U.sceneGraphService.rotate(this,0,0,n):U.sceneGraphService.rotate(this,n,i,a),this}},{key:"setRotation",value:function(n,i,a,s){return U.sceneGraphService.setRotation(this,n,i,a,s),this}},{key:"setLocalRotation",value:function(n,i,a,s){return U.sceneGraphService.setLocalRotation(this,n,i,a,s),this}},{key:"setLocalSkew",value:function(n,i){return U.sceneGraphService.setLocalSkew(this,n,i),this}},{key:"getRotation",value:function(){return U.sceneGraphService.getRotation(this)}},{key:"getLocalRotation",value:function(){return U.sceneGraphService.getLocalRotation(this)}},{key:"getLocalSkew",value:function(){return U.sceneGraphService.getLocalSkew(this)}},{key:"getLocalTransform",value:function(){return U.sceneGraphService.getLocalTransform(this)}},{key:"getWorldTransform",value:function(){return U.sceneGraphService.getWorldTransform(this)}},{key:"setLocalTransform",value:function(n){return U.sceneGraphService.setLocalTransform(this,n),this}},{key:"resetLocalTransform",value:function(){U.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,Ut(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,Ut(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?me(o)?(Object.keys(o).forEach(function(c){n.setAttribute(c,o[c])}),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=Xc(Ks,i),s=dt(a,2),o=s[0],l=s[1],c=Cs(Ks,i),u=dt(c,2),h=u[0],d=u[1],f=Kc(L4,i),g=jd(Ks,f),v=dt(g,3),p=v[0],m=v[2];return RD(p||m,o,l,h,d)}},{key:"getLocalMatrix",value:function(){return this.getMatrix(this.getLocalTransform())}},{key:"setMatrix",value:function(n){var i=K2(n),a=dt(i,5),s=a[0],o=a[1],l=a[2],c=a[3],u=a[4];this.setEulerAngles(u).setPosition(s,o).setLocalScale(l,c)}},{key:"setLocalMatrix",value:function(n){var i=K2(n),a=dt(i,5),s=a[0],o=a[1],l=a[2],c=a[3],u=a[4];this.setLocalEulerAngles(u).setLocalPosition(s,o).setLocalScale(l,c)}},{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}}])}(N4);Zt.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 li=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return V(this,t),mt(this,t,[vt({type:$.CIRCLE},e)])}return pt(t,r),W(t)}(Zt);li.PARSED_STYLE_LIST=new Set([].concat(Ut(Zt.PARSED_STYLE_LIST),["cx","cy","cz","r","isBillboard","isSizeAttenuation"]));var D4=["style"],g1=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=Ga(n,D4);return V(this,t),e=mt(this,t,[vt({style:i},a)]),e.isCustomElement=!0,e}return pt(t,r),W(t)}(Zt);g1.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var el=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return V(this,t),mt(this,t,[vt({type:$.ELLIPSE},e)])}return pt(t,r),W(t)}(Zt);el.PARSED_STYLE_LIST=new Set([].concat(Ut(Zt.PARSED_STYLE_LIST),["cx","cy","cz","rx","ry","isBillboard","isSizeAttenuation"]));var I4=function(r){function t(){return V(this,t),mt(this,t,[{type:$.FRAGMENT}])}return pt(t,r),W(t)}(Zt);I4.PARSED_STYLE_LIST=new Set(["class","className"]);var Pe=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return V(this,t),mt(this,t,[vt({type:$.GROUP},e)])}return pt(t,r),W(t)}(Zt);Pe.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var F4=["style"],nl=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=Ga(n,F4);return V(this,t),e=mt(this,t,[vt({type:$.HTML,style:i},a)]),e.cullable.enable=!1,e}return pt(t,r),W(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=xr(Wt(),this.parentNode.getWorldTransform()),i=this.getBounds();if(!Vt.isEmpty(i)){var a=new Vt;return a.setFromTransformedAABB(i,n),a}}return this.getBounds()}}])}(Zt);nl.PARSED_STYLE_LIST=new Set([].concat(Ut(Zt.PARSED_STYLE_LIST),["x","y","$el","innerHTML","width","height"]));var rl=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return V(this,t),mt(this,t,[vt({type:$.IMAGE},e)])}return pt(t,r),W(t)}(Zt);rl.PARSED_STYLE_LIST=new Set([].concat(Ut(Zt.PARSED_STYLE_LIST),["x","y","z","src","width","height","isBillboard","billboardRotation","isSizeAttenuation","keepAspectRatio"]));var B4=["style"],Fa=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=Ga(n,B4);V(this,t),e=mt(this,t,[vt({type:$.LINE,style:vt({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&&Ct(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),l&&Ct(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return pt(t,r),W(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&&Ct(s)&&(this.markerStartAngle=0,s.remove()),o&&Ct(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"&&(s&&Ct(s)&&(this.markerEndAngle=0,s.remove()),o&&Ct(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,c=i.x1,u=i.x2,h=i.y1,d=i.y2,f=n?a:s;if(!(!f||!Ct(f))){var g=0,v,p,m,y,b,w;n?(m=c,y=h,v=u-c,p=d-h,b=o||0,w=this.markerStartAngle):(m=u,y=d,v=c-u,p=h-d,b=l||0,w=this.markerEndAngle),g=Math.atan2(p,v),f.setLocalEulerAngles(g*180/Math.PI+w),f.setLocalPosition(m+Math.cos(g)*b,y+Math.sin(g)*b)}}},{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,c=a.y2,u=vC(s,o,l,c,n),h=u.x,d=u.y,f=Qe(St(),Yt(h,d,0),i?this.getWorldTransform():this.getLocalTransform());return new qe(f[0],f[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 gC(i,a,s,o)}}])}(Zt);Fa.PARSED_STYLE_LIST=new Set([].concat(Ut(Zt.PARSED_STYLE_LIST),["x1","y1","x2","y2","z1","z2","isBillboard","isSizeAttenuation","markerStart","markerEnd","markerStartOffset","markerEndOffset"]));var z4=["style"],Tn=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=Ga(n,z4);V(this,t),e=mt(this,t,[vt({type:$.PATH,style:i,initialParsedStyle:{miterLimit:4,d:vt({},bC)}},a)]),e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[];var s=e.parsedStyle,o=s.markerStart,l=s.markerEnd,c=s.markerMid;return o&&Ct(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),c&&Ct(c)&&e.placeMarkerMid(c),l&&Ct(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return pt(t,r),W(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&&Ct(s)&&(this.markerStartAngle=0,s.remove()),o&&Ct(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"?(s&&Ct(s)&&(this.markerEndAngle=0,s.remove()),o&&Ct(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,c=n?a:s;if(!(!c||!Ct(c))){var u=0,h,d,f,g,v,p;if(n){var m=this.getStartTangent(),y=dt(m,2),b=y[0],w=y[1];f=w[0],g=w[1],h=b[0]-w[0],d=b[1]-w[1],v=o||0,p=this.markerStartAngle}else{var x=this.getEndTangent(),S=dt(x,2),E=S[0],_=S[1];f=_[0],g=_[1],h=E[0]-_[0],d=E[1]-_[1],v=l||0,p=this.markerEndAngle}u=Math.atan2(d,h),c.setLocalEulerAngles(u*180/Math.PI+p),c.setLocalPosition(f+Math.cos(u)*v,g+Math.sin(u)*v)}}},{key:"placeMarkerMid",value:function(n){var i=this.parsedStyle.d.segments;if(this.markerMidList.forEach(function(u){u.remove()}),n&&Ct(n))for(var a=1;a<i.length-1;a++){var s=dt(i[a].currentPoint,2),o=s[0],l=s[1],c=a===1?n:n.cloneNode(!0);this.markerMidList.push(c),this.appendChild(c),c.setLocalPosition(o,l)}}},{key:"getTotalLength",value:function(){return Xm(this)}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle.d.absolutePath,s=nD(a,n),o=s.x,l=s.y,c=Qe(St(),Yt(o,l,0),i?this.getWorldTransform():this.getLocalTransform());return new qe(c[0],c[1])}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPointAtLength(n*Xm(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}}])}(Zt);Tn.PARSED_STYLE_LIST=new Set([].concat(Ut(Zt.PARSED_STYLE_LIST),["d","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard","isSizeAttenuation"]));var $4=["style"],Va=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=Ga(n,$4);V(this,t),e=mt(this,t,[vt({type:$.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,c=s.markerMid;return o&&Ct(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),c&&Ct(c)&&e.placeMarkerMid(c),l&&Ct(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return pt(t,r),W(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&&Ct(s)&&(this.markerStartAngle=0,s.remove()),o&&Ct(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"?(s&&Ct(s)&&(this.markerEndAngle=0,s.remove()),o&&Ct(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,c=i.points,u=c||{},h=u.points,d=n?a:s;if(!(!d||!Ct(d)||!h)){var f=0,g,v,p,m,y,b;if(p=h[0][0],m=h[0][1],n)g=h[1][0]-h[0][0],v=h[1][1]-h[0][1],y=o||0,b=this.markerStartAngle;else{var w=h.length;this.parsedStyle.isClosed?(g=h[w-1][0]-h[0][0],v=h[w-1][1]-h[0][1]):(p=h[w-1][0],m=h[w-1][1],g=h[w-2][0]-h[w-1][0],v=h[w-2][1]-h[w-1][1]),y=l||0,b=this.markerEndAngle}f=Math.atan2(v,g),d.setLocalEulerAngles(f*180/Math.PI+b),d.setLocalPosition(p+Math.cos(f)*y,m+Math.sin(f)*y)}}},{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&&Ct(n)&&s)for(var o=1;o<(this.parsedStyle.isClosed?s.length:s.length-1);o++){var l=s[o][0],c=s[o][1],u=o===1?n:n.cloneNode(!0);this.markerMidList.push(u),this.appendChild(u),u.setLocalPosition(l,c)}}}])}(Zt);Va.PARSED_STYLE_LIST=new Set([].concat(Ut(Zt.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isClosed","isBillboard","isSizeAttenuation"]));var j4=["style"],Vu=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.style,i=Ga(e,j4);return V(this,t),mt(this,t,[vt({type:$.POLYLINE,style:n,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!1}},i)])}return pt(t,r),W(t,[{key:"getTotalLength",value:function(){return RI(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,c,u=this.getTotalLength();a.forEach(function(m,y){a[y+1]&&(l=[0,0],l[0]=o/u,c=gC(m[0],m[1],a[y+1][0],a[y+1][1]),o+=c,l[1]=o/u,s.push(l))}),this.parsedStyle.points.segments=s}var h=0,d=0;this.parsedStyle.points.segments.forEach(function(m,y){n>=m[0]&&n<=m[1]&&(h=(n-m[0])/(m[1]-m[0]),d=y)});var f=vC(a[d][0],a[d][1],a[d+1][0],a[d+1][1],h),g=f.x,v=f.y,p=Qe(St(),Yt(g,v,0),i?this.getWorldTransform():this.getLocalTransform());return new qe(p[0],p[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}}])}(Va);Vu.PARSED_STYLE_LIST=new Set([].concat(Ut(Va.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard"]));var Be=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return V(this,t),mt(this,t,[vt({type:$.RECT},e)])}return pt(t,r),W(t)}(Zt);Be.PARSED_STYLE_LIST=new Set([].concat(Ut(Zt.PARSED_STYLE_LIST),["x","y","z","width","height","isBillboard","isSizeAttenuation","radius"]));var q4=["style"],Qi=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.style,i=Ga(e,q4);return V(this,t),mt(this,t,[vt({type:$.TEXT,style:vt({fill:"black"},n)},i)])}return pt(t,r),W(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}}])}(Zt);Qi.PARSED_STYLE_LIST=new Set([].concat(Ut(Zt.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 G4=function(){function r(){V(this,r),this.registry={},this.define($.CIRCLE,li),this.define($.ELLIPSE,el),this.define($.RECT,Be),this.define($.IMAGE,rl),this.define($.LINE,Fa),this.define($.GROUP,Pe),this.define($.PATH,Tn),this.define($.POLYGON,Va),this.define($.POLYLINE,Vu),this.define($.TEXT,Qi),this.define($.HTML,nl)}return W(r,[{key:"define",value:function(e,n){this.registry[e]=n}},{key:"get",value:function(e){return this.registry[e]}}])}(),UC=function(r){function t(){var e;V(this,t),e=mt(this,t),e.defaultView=null,e.ownerDocument=null,e.nodeName="document";try{e.timeline=new U.AnimationTimeline(e)}catch{}var n={};return u1.forEach(function(i){var a=i.n,s=i.inh,o=i.d;s&&o&&(n[a]=at(o)?o($.GROUP):o)}),e.documentElement=new Pe({id:"g-root",style:n}),e.documentElement.ownerDocument=e,e.documentElement.parentNode=e,e.childNodes=[e.documentElement],e}return pt(t,r),W(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"?Qi:Pe);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(Ft)}},{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}),c=[];return l.forEach(function(u){var h=u.displayObject,d=h.parsedStyle.pointerEvents,f=d===void 0?"auto":d,g=["auto","visiblepainted","visiblefill","visiblestroke","visible"].includes(f);(!g||g&&h.isVisible())&&!h.isCulled()&&h.isInteractive()&&c.push(h)}),c.sort(function(u,h){return h.sortable.renderOrder-u.sortable.renderOrder}),c}},{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(),c=l.width,u=l.height;if(s<0||o<0||s>c||o>u)return null;var h=this.defaultView.viewport2Client({x:s,y:o}),d=h.x,f=h.y,g=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!0,position:{x:n,y:i,viewportX:s,viewportY:o,clientX:d,clientY:f},picked:[]}),v=g.picked;return v&&v[0]||this.documentElement}},{key:"elementFromPoint",value:function(){var e=Gi(We().mark(function i(a,s){var o,l,c,u,h,d,f,g,v,p,m;return We().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(o=this.defaultView.canvas2Viewport({x:a,y:s}),l=o.x,c=o.y,u=this.defaultView.getConfig(),h=u.width,d=u.height,!(l<0||c<0||l>h||c>d)){b.next=4;break}return b.abrupt("return",null);case 4:return f=this.defaultView.viewport2Client({x:l,y:c}),g=f.x,v=f.y,b.next=7,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!0,position:{x:a,y:s,viewportX:l,viewportY:c,clientX:g,clientY:v},picked:[]});case 7:return p=b.sent,m=p.picked,b.abrupt("return",m&&m[0]||this.documentElement);case 10:case"end":return b.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(),c=l.width,u=l.height;if(s<0||o<0||s>c||o>u)return[];var h=this.defaultView.viewport2Client({x:s,y:o}),d=h.x,f=h.y,g=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!1,position:{x:n,y:i,viewportX:s,viewportY:o,clientX:d,clientY:f},picked:[]}),v=g.picked;return v[v.length-1]!==this.documentElement&&v.push(this.documentElement),v}},{key:"elementsFromPoint",value:function(){var e=Gi(We().mark(function i(a,s){var o,l,c,u,h,d,f,g,v,p,m;return We().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(o=this.defaultView.canvas2Viewport({x:a,y:s}),l=o.x,c=o.y,u=this.defaultView.getConfig(),h=u.width,d=u.height,!(l<0||c<0||l>h||c>d)){b.next=4;break}return b.abrupt("return",[]);case 4:return f=this.defaultView.viewport2Client({x:l,y:c}),g=f.x,v=f.y,b.next=7,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!1,position:{x:a,y:s,viewportX:l,viewportY:c,clientX:g,clientY:v},picked:[]});case 7:return p=b.sent,m=p.picked,m[m.length-1]!==this.documentElement&&m.push(this.documentElement),b.abrupt("return",m);case 11:case"end":return b.stop()}},i,this)}));function n(i,a){return e.apply(this,arguments)}return n}()},{key:"appendChild",value:function(n,i){throw new Error(ns)}},{key:"insertBefore",value:function(n,i){throw new Error(ns)}},{key:"removeChild",value:function(n,i){throw new Error(ns)}},{key:"replaceChild",value:function(n,i,a){throw new Error(ns)}},{key:"append",value:function(){throw new Error(ns)}},{key:"prepend",value:function(){throw new Error(ns)}},{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)}}])}(ie),YC=function(){function r(t){V(this,r),this.strategies=t}return W(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(c){return c.isVisible(n,o)}),!o.isCulled()&&o.isVisible()?o:(o.dispatchEvent(new we(xt.CULLED)),null)}return o}),i.hooks.afterRender.tap(r.tag,function(o){o.cullable.visibilityPlaneMask=-1})}}])}();YC.tag="Culling";var XC=function(){function r(){var t=this;V(this,r),this.autoPreventDefault=!1,this.rootPointerEvent=new hu(null),this.rootWheelEvent=new Qm(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=ma(a),o;try{for(s.s();!(o=s.n()).done;){var l=o.value,c=t.bootstrapEvent(t.rootPointerEvent,l,i,e);t.context.eventService.mapEvent(c)}}catch(u){s.e(u)}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=ma(a),o;try{for(s.s();!(o=s.n()).done;){var l=o.value,c=t.bootstrapEvent(t.rootPointerEvent,l,i,e);t.context.eventService.mapEvent(c)}}catch(u){s.e(u)}finally{s.f()}t.setCursor(t.context.eventService.cursor)}}return W(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 c=ma(o),u;try{for(c.s();!(u=c.n()).done;){var h=u.value,d=n.bootstrapEvent(n.rootPointerEvent,h,a,s);n.context.eventService.mapEvent(d)}}catch(f){c.e(f)}finally{c.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),c=l?"":"outside",u=n.normalizeToPointerEvent(s,a),h=ma(u),d;try{for(h.s();!(d=h.n()).done;){var f=d.value,g=n.bootstrapEvent(n.rootPointerEvent,f,a,s);g.type+=c,n.context.eventService.mapEvent(g)}}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=ma(o),c;try{for(l.s();!(c=l.n()).done;){var u=c.value,h=n.bootstrapEvent(n.rootPointerEvent,u,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 c=this.context.eventService.viewport2Canvas(e.viewport),u=c.x,h=c.y;return e.canvas.x=u,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=M5[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,c=o.y;return n.canvas.x=l,n.canvas.y=c,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=Jm.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];ut(s.button)&&(s.button=0),ut(s.buttons)&&(s.buttons=1),ut(s.isPrimary)&&(s.isPrimary=e.touches.length===1&&e.type==="touchstart"),ut(s.width)&&(s.width=s.radiusX||1),ut(s.height)&&(s.height=s.radiusY||1),ut(s.tiltX)&&(s.tiltX=0),ut(s.tiltY)&&(s.tiltY=0),ut(s.pointerType)&&(s.pointerType="touch"),ut(s.pointerId)&&(s.pointerId=s.identifier||0),ut(s.pressure)&&(s.pressure=s.force||.5),ut(s.twist)&&(s.twist=0),ut(s.tangentialPressure)&&(s.tangentialPressure=0),s.isNormalized=!0,s.type=e.type,i.push(s)}else if(n.isMouseEvent(e)){var o=e;ut(o.isPrimary)&&(o.isPrimary=!0),ut(o.width)&&(o.width=1),ut(o.height)&&(o.height=1),ut(o.tiltX)&&(o.tiltX=0),ut(o.tiltY)&&(o.tiltY=0),ut(o.pointerType)&&(o.pointerType="mouse"),ut(o.pointerId)&&(o.pointerId=k5),ut(o.pressure)&&(o.pressure=.5),ut(o.twist)&&(o.twist=0),ut(o.tangentialPressure)&&(o.tangentialPressure=0),o.isNormalized=!0,i.push(o)}else i.push(e);return i}}])}();XC.tag="Event";var W4=[$.CIRCLE,$.ELLIPSE,$.IMAGE,$.RECT,$.LINE,$.POLYLINE,$.POLYGON,$.TEXT,$.PATH,$.HTML],V4=function(){function r(){V(this,r)}return W(r,[{key:"isVisible",value:function(e,n){var i,a=n.cullable;if(!a.enable)return!0;var s=n.getRenderBounds();if(Vt.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||es.INDETERMINATE,o.planes),a.visible=a.visibilityPlaneMask!==es.OUTSIDE,a.visible}},{key:"computeVisibilityWithPlaneMask",value:function(e,n,i,a){if(i===es.OUTSIDE||i===es.INSIDE)return i;for(var s=es.INSIDE,o=W4.indexOf(e.nodeName)>-1,l=0,c=a.length;l<c;++l){var u=1<<l;if(i&u&&!(o&&(l===4||l===5))){var h=a[l],d=h.normal,f=h.distance;if(Sr(d,n.getPositiveFarPoint(a[l]))+f<0)return es.OUTSIDE;Sr(d,n.getNegativeFarPoint(a[l]))+f<0&&(s|=u)}}return s}}])}(),KC=function(){function r(){V(this,r),this.syncTasks=new Map,this.isFirstTimeRendering=!0,this.syncing=!1,this.isFirstTimeRenderingFinished=!1}return W(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 c=function(v){var p=v.target;p.renderable.dirty=!0,a.dirtify()},u=function(v){n.syncTasks.set(v.target,v.detail.affectChildren),a.dirtify()},h=function(v){var p=v.target;U.enableSizeAttenuation&&U.styleValueRegistry.updateSizeAttenuation(p,l.getCamera().getZoom())},d=function(v){var p=v.target,m=p.rBushNode;m.aabb&&n.rBush.remove(m.aabb),n.syncTasks.delete(p),U.sceneGraphService.dirtifyToRoot(p),a.dirtify()};a.hooks.init.tap(r.tag,function(){l.addEventListener(xt.MOUNTED,h),l.addEventListener(xt.UNMOUNTED,d),l.addEventListener(xt.ATTR_MODIFIED,c),l.addEventListener(xt.BOUNDS_CHANGED,u)}),a.hooks.destroy.tap(r.tag,function(){l.removeEventListener(xt.MOUNTED,h),l.removeEventListener(xt.UNMOUNTED,d),l.removeEventListener(xt.ATTR_MODIFIED,c),l.removeEventListener(xt.BOUNDS_CHANGED,u),n.syncTasks.clear()});var f=(i=U.globalThis.requestIdleCallback)!==null&&i!==void 0?i:d1.bind(U.globalThis);a.hooks.endFrame.tap(r.tag,function(){n.isFirstTimeRendering?(n.isFirstTimeRendering=!1,n.syncing=!0,f(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 Vt),s.dirtyRenderBounds.update(a.center,a.halfExtents));var o=a.getMin(),l=dt(o,2),c=l[0],u=l[1],h=a.getMax(),d=dt(h,2),f=d[0],g=d[1];i.aabb||(i.aabb={}),i.aabb.displayObject=e,i.aabb.minX=c,i.aabb.minY=u,i.aabb.maxX=f,i.aabb.maxY=g}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 c=e.syncNode(l,n);c&&(i.push(c),a.add(l))}};this.syncTasks.forEach(function(o,l){o&&l.forEach(s);for(var c=l;c;)s(c),c=c.parentElement}),this.rBush.load(i),i.length=0,this.syncing=!1}}}])}();KC.tag="Prepare";var Mn=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}({}),Mb=500,H4=.1,U4=1e3,zl=new we(xt.MOUNTED),$l=new we(xt.UNMOUNTED),Jd=new we(Mn.BEFORE_RENDER),Cb=new we(Mn.RERENDER),Qd=new we(Mn.AFTER_RENDER),ny=function(r){function t(e){var n;V(this,t),n=mt(this,t),n.Element=Zt,n.inited=!1,n.context={};var i=e.container,a=e.canvas,s=e.renderer,o=e.width,l=e.height,c=e.background,u=e.cursor,h=e.supportsMutipleCanvasesInOneContainer,d=e.cleanUpOnDestroy,f=d===void 0?!0:d,g=e.offscreenCanvas,v=e.devicePixelRatio,p=e.requestAnimationFrame,m=e.cancelAnimationFrame,y=e.createImage,b=e.supportsTouchEvents,w=e.supportsPointerEvents,x=e.isTouchEvent,S=e.isMouseEvent,E=e.dblClickSpeed,_=o,C=l,k=v||h1&&window.devicePixelRatio||1;return k=k>=1?Math.ceil(k):1,a&&(_=o||S5(a)||a.width/k,C=l||_5(a)||a.height/k),n.customElements=new G4,n.devicePixelRatio=k,n.requestAnimationFrame=p??d1.bind(U.globalThis),n.cancelAnimationFrame=m??qC.bind(U.globalThis),n.supportsTouchEvents=b??"ontouchstart"in U.globalThis,n.supportsPointerEvents=w??!!U.globalThis.PointerEvent,n.isTouchEvent=x??function(M){return n.supportsTouchEvents&&M instanceof U.globalThis.TouchEvent},n.isMouseEvent=S??function(M){return!U.globalThis.MouseEvent||M instanceof U.globalThis.MouseEvent&&(!n.supportsPointerEvents||!(M instanceof U.globalThis.PointerEvent))},g&&(U.offscreenCanvas=g),n.document=new UC,n.document.defaultView=n,h||b5(i,n,f),n.initRenderingContext(vt(vt({},e),{},{width:_,height:C,background:c??"transparent",cursor:u??"default",cleanUpOnDestroy:f,devicePixelRatio:k,requestAnimationFrame:n.requestAnimationFrame,cancelAnimationFrame:n.cancelAnimationFrame,supportsTouchEvents:n.supportsTouchEvents,supportsPointerEvents:n.supportsPointerEvents,isTouchEvent:n.isTouchEvent,isMouseEvent:n.isMouseEvent,dblClickSpeed:E??200,createImage:y??function(){return new window.Image}})),n.initDefaultCamera(_,C,s.clipSpaceNearZ),n.initRenderer(s,!0),n}return pt(t,r),W(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 U.CameraContribution;o.clipSpaceNearZ=a,o.setType(It.EXPLORING,Wm.DEFAULT).setPosition(n/2,i/2,Mb).setFocalPoint(n/2,i/2,0).setOrthographic(n/-2,n/2,i/2,i/-2,H4,U4),o.canvas=this,o.eventEmitter.on(mC.UPDATED,function(){s.context.renderingContext.renderReasons.add(Ss.CAMERA_CHANGED),U.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){U.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;ke.clearCache(),i||this.dispatchEvent(new we(Mn.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 we(Mn.AFTER_DESTROY));var s=function(l){l.currentTarget=null,l.manager=null,l.target=null,l.relatedNode=null};s(zl),s($l),s(Jd),s(Cb),s(Qd),s(br),s(ty),s(ey),s(HC)}},{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,Mb).setFocalPoint(n/2,i/2,0),o===jn.ORTHOGRAPHIC?s.setOrthographic(n/-2,n/2,i/2,i/-2,s.getNear(),s.getFar()):s.setAspect(n/i),this.dispatchEvent(new we(Mn.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&&(Jd.detail=n,Qd.detail=n),this.dispatchEvent(Jd);var a=this.getRenderingService();a.render(this.getConfig(),n,function(){i.dispatchEvent(Cb)}),this.dispatchEvent(Qd)}},{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 xD,this.context.renderingPlugins=[],this.context.renderingPlugins.push(new XC,new KC,new YC([new V4])),this.loadRendererContainerModule(n),this.context.contextService=new this.context.ContextService(vt(vt({},U),this.context)),this.context.renderingService=new a4(U,this.context),this.context.eventService=new i4(U,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 we(Mn.READY))}):i.dispatchEvent(new we(Mn.READY)):i.dispatchEvent(new we(Mn.RENDERER_CHANGED)),i.readyPromise&&i.resolveReadyPromise(),a||i.getRoot().forEach(function(o){var l=o,c=l.renderable;c&&(c.renderBoundsDirty=!0,c.boundsDirty=!0,c.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(U)})}},{key:"setRenderer",value:function(n){var i=this.getConfig();if(i.renderer!==n){var a=i.renderer;i.renderer=n,this.destroy(!1,!0),Ut((a==null?void 0:a.getPlugins())||[]).reverse().forEach(function(s){s.destroy(U)}),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($l):($l.target=n,this.dispatchEvent($l,!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]:uu(n);this.inited?n.isConnected||(n.ownerDocument=this.document,n.isConnected=!0,a||(n.isMutationObserved?n.dispatchEvent(zl):(zl.target=n,this.dispatchEvent(zl,!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})}}])}(VC);/*!
- * @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 Y4=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=mt(this,t,[].concat(i)),e.landmarks=[],e}return pt(t,r),W(t,[{key:"rotate",value:function(n,i,a){if(this.relElevation=ws(i),this.relAzimuth=ws(n),this.relRoll=ws(a),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.type===It.EXPLORING){var s=Ti(Te(),[1,0,0],Bt((this.rotateWorld?1:-1)*this.relElevation)),o=Ti(Te(),[0,1,0],Bt((this.rotateWorld?1:-1)*this.relAzimuth)),l=Ti(Te(),[0,0,1],Bt(this.relRoll)),c=Bi(Te(),o,s);c=Bi(Te(),c,l);var u=n1(Wt(),c);bs(this.matrix,this.matrix,[0,0,-this.distance]),Je(this.matrix,this.matrix,u),bs(this.matrix,this.matrix,[0,0,this.distance])}else{if(Math.abs(this.elevation)>90)return this;this.computeMatrix()}return this._getAxes(),this.type===It.ORBITING||this.type===It.EXPLORING?this._getPosition():this.type===It.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(n,i){var a=en(n,i,0),s=zr(this.position);return Fi(s,s,Zc(St(),this.right,a[0])),Fi(s,s,Zc(St(),this.up,a[1])),this._setPosition(s),this.triggerUpdate(),this}},{key:"dolly",value:function(n){var i=this.forward,a=zr(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===It.ORBITING||this.type===It.EXPLORING?this._getDistance():this.type===It.TRACKING&&Fi(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]:{},c=l.position,u=c===void 0?this.position:c,h=l.focalPoint,d=h===void 0?this.focalPoint:h,f=l.roll,g=l.zoom,v=new U.CameraContribution;v.setType(this.type,void 0),v.setPosition(u[0],(i=u[1])!==null&&i!==void 0?i:this.position[1],(a=u[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(f??this.roll),v.setZoom(g??this.zoom);var p={name:n,matrix:LM(v.getWorldTransform()),right:zr(v.right),up:zr(v.up),forward:zr(v.forward),position:zr(v.getPosition()),focalPoint:zr(v.getFocalPoint()),distanceVector:zr(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(p),p}},{key:"gotoLandmark",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=Tt(n)?this.landmarks.find(function(M){return M.name===n}):n;if(s){var o=nt(a)?{duration:a}:a,l=o.easing,c=l===void 0?"linear":l,u=o.duration,h=u===void 0?100:u,d=o.easingFunction,f=d===void 0?void 0:d,g=o.onfinish,v=g===void 0?void 0:g,p=o.onframe,m=p===void 0?void 0:p,y=.01;this.cancelLandmarkAnimation();var b=s.position,w=s.focalPoint,x=s.zoom,S=s.roll,E=f||U.EasingFunction(c),_,C=function(){i.setFocalPoint(w),i.setPosition(b),i.setRoll(S),i.setZoom(x),i.computeMatrix(),i.triggerUpdate(),v==null||v()};if(h===0)return C();var k=function(T){_===void 0&&(_=T);var O=T-_;if(O>=h){C();return}var R=E(O/h),D=St(),L=St(),P=1,A=0;Rm(D,i.focalPoint,w,R),Rm(L,i.position,b,R),A=i.roll*(1-R)+S*R,P=i.zoom*(1-R)+x*R,i.setFocalPoint(D),i.setPosition(L),i.setRoll(A),i.setZoom(P);var I=F2(D,w)+F2(L,b);if(I<=y&&x===void 0&&S===void 0)return C();i.computeMatrix(),i.triggerUpdate(),O<h&&(m==null||m(R),i.landmarkAnimationID=i.canvas.requestAnimationFrame(k))};this.canvas.requestAnimationFrame(k)}}}])}(yC);U.CameraContribution=Y4;/*!
- * @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 tf=function(r){function t(e,n,i,a){var s;return V(this,t),s=mt(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 pt(t,r),W(t)}(Wu),X4=0,K4=function(){function r(t,e){var n;V(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(X4++),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 W(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 tf(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(Ft)}},{key:"addEventListener",value:function(e,n,i){throw new Error(Ft)}},{key:"removeEventListener",value:function(e,n,i){throw new Error(Ft)}},{key:"dispatchEvent",value:function(e){throw new Error(Ft)}},{key:"commitStyles",value:function(){throw new Error(Ft)}},{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 tf(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 tf(null,this,this.currentTime,e);this.onframe(a)}this._finishedFlag=!1}}}])}(),Z4=4,J4=.001,Q4=1e-7,t8=10,oo=11,jl=1/(oo-1),e8=typeof Float32Array=="function",ZC=function(t,e){return 1-3*e+3*t},JC=function(t,e){return 3*e-6*t},QC=function(t){return 3*t},du=function(t,e,n){return((ZC(e,n)*t+JC(e,n))*t+QC(e))*t},tT=function(t,e,n){return 3*ZC(e,n)*t*t+2*JC(e,n)*t+QC(e)},n8=function(t,e,n,i,a){var s,o,l=0;do o=e+(n-e)/2,s=du(o,i,a)-t,s>0?n=o:e=o;while(Math.abs(s)>Q4&&++l<t8);return o},r8=function(t,e,n,i){for(var a=0;a<Z4;++a){var s=tT(e,n,i);if(s===0)return e;var o=du(e,n,i)-t;e-=o/s}return e},v1=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=e8?new Float32Array(oo):new Array(oo),s=0;s<oo;++s)a[s]=du(s*jl,t,n);var o=function(c){for(var u=0,h=1,d=oo-1;h!==d&&a[h]<=c;++h)u+=jl;--h;var f=(c-a[h])/(a[h+1]-a[h]),g=u+f*jl,v=tT(g,t,n);return v>=J4?r8(c,g,t,n):v===0?g:n8(c,u,u+jl,t,n)};return function(l){return l===0||l===1?l:du(o(l),e,i)}},i8=function(t){return t=t.replace(/([A-Z])/g,function(e){return"-".concat(e.toLowerCase())}),t.charAt(0)==="-"?t.substring(1):t},ql=function(t){return Math.pow(t,2)},Gl=function(t){return Math.pow(t,3)},Wl=function(t){return Math.pow(t,4)},Vl=function(t){return Math.pow(t,5)},Hl=function(t){return Math.pow(t,6)},Ul=function(t){return 1-Math.cos(t*Math.PI/2)},Yl=function(t){return 1-Math.sqrt(1-t*t)},Xl=function(t){return t*t*(3*t-2)},Kl=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)},Zl=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=dt(e,2),i=n[0],a=i===void 0?1:i,s=n[1],o=s===void 0?.5:s,l=ce(Number(a),1,10),c=ce(Number(o),.1,2);return t===0||t===1?t:-l*Math.pow(2,10*(t-1))*Math.sin((t-1-c/(Math.PI*2)*Math.asin(1/l))*(Math.PI*2)/c)},Zs=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,i=dt(e,4),a=i[0],s=a===void 0?1:a,o=i[1],l=o===void 0?100:o,c=i[2],u=c===void 0?10:c,h=i[3],d=h===void 0?0:h;s=ce(s,.1,1e3),l=ce(l,.1,1e3),u=ce(u,.1,1e3),d=ce(d,.1,1e3);var f=Math.sqrt(l/s),g=u/(2*Math.sqrt(l*s)),v=g<1?f*Math.sqrt(1-g*g):0,p=1,m=g<1?(g*f+-d)/v:-d+f,y=n?n*t/1e3:t;return g<1?y=Math.exp(-y*g*f)*(p*Math.cos(v*y)+m*Math.sin(v*y)):y=(p+m*y)*Math.exp(-y*f),t===0||t===1?t:1-y},ef=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=e,i=dt(n,2),a=i[0],s=a===void 0?10:a,o=i[1],l=o==="start"?Math.ceil:Math.floor;return l(ce(t,0,1)*s)/s},Tb=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=dt(e,4),i=n[0],a=n[1],s=n[2],o=n[3];return v1(i,a,s,o)(t)},Jl=v1(.42,0,1,1),Fn=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)}},Bn=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}},zn=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}},Ob={steps:ef,"step-start":function(t){return ef(t,[1,"start"])},"step-end":function(t){return ef(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":Tb,ease:function(t){return Tb(t,[.25,.1,.25,1])},in:Jl,out:Fn(Jl),"in-out":Bn(Jl),"out-in":zn(Jl),"in-quad":ql,"out-quad":Fn(ql),"in-out-quad":Bn(ql),"out-in-quad":zn(ql),"in-cubic":Gl,"out-cubic":Fn(Gl),"in-out-cubic":Bn(Gl),"out-in-cubic":zn(Gl),"in-quart":Wl,"out-quart":Fn(Wl),"in-out-quart":Bn(Wl),"out-in-quart":zn(Wl),"in-quint":Vl,"out-quint":Fn(Vl),"in-out-quint":Bn(Vl),"out-in-quint":zn(Vl),"in-expo":Hl,"out-expo":Fn(Hl),"in-out-expo":Bn(Hl),"out-in-expo":zn(Hl),"in-sine":Ul,"out-sine":Fn(Ul),"in-out-sine":Bn(Ul),"out-in-sine":zn(Ul),"in-circ":Yl,"out-circ":Fn(Yl),"in-out-circ":Bn(Yl),"out-in-circ":zn(Yl),"in-back":Xl,"out-back":Fn(Xl),"in-out-back":Bn(Xl),"out-in-back":zn(Xl),"in-bounce":Kl,"out-bounce":Fn(Kl),"in-out-bounce":Bn(Kl),"out-in-bounce":zn(Kl),"in-elastic":Zl,"out-elastic":Fn(Zl),"in-out-elastic":Bn(Zl),"out-in-elastic":zn(Zl),spring:Zs,"spring-in":Zs,"spring-out":Fn(Zs),"spring-in-out":Bn(Zs),"spring-out-in":zn(Zs)},a8=function(t){return i8(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()},s8=function(t){return Ob[a8(t)]||Ob.linear},o8=function(t){return t},l8=1,c8=.5,Ab=0;function Pb(r,t){return function(e){if(e>=1)return 1;var n=1/r;return e+=t*n,e-e%n}}var Ql="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",u8=new RegExp("cubic-bezier\\(".concat(Ql,",").concat(Ql,",").concat(Ql,",").concat(Ql,"\\)")),h8=/steps\(\s*(\d+)\s*\)/,d8=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function p1(r){var t=u8.exec(r);if(t)return v1.apply(void 0,Ut(t.slice(1).map(Number)));var e=h8.exec(r);if(e)return Pb(Number(e[1]),Ab);var n=d8.exec(r);return n?Pb(Number(n[1]),{start:l8,middle:c8,end:Ab}[n[2]]):s8(r)}function f8(r){return Math.abs(g8(r)/(r.playbackRate||1))}function g8(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 eT=0,m1=1,Hu=2,nT=3;function v8(r,t,e){if(t===null)return eT;var n=e.endTime;return t<Math.min(e.delay,n)?m1:t>=Math.min(e.delay+r+e.endDelay,n)?Hu:nT}function p8(r,t,e,n,i){switch(n){case m1:return t==="backwards"||t==="both"?0:null;case nT:return e-i;case Hu:return t==="forwards"||t==="both"?r:null;case eT:return null}}function m8(r,t,e,n,i){var a=i;return r===0?t!==m1&&(a+=e):a+=n/r,a}function y8(r,t,e,n,i,a){var s=r===1/0?t%1:r%1;return s===0&&e===Hu&&n!==0&&(i!==0||a===0)&&(s=1),s}function b8(r,t,e,n){return r===Hu&&t===1/0?1/0:e===1?Math.floor(n)-1:Math.floor(n)}function w8(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 x8(r,t,e){var n=v8(r,t,e),i=p8(r,e.fill,t,n,e.delay);if(i===null)return null;var a=e.duration==="auto"?0:e.duration,s=m8(a,n,e.iterations,i,e.iterationStart),o=y8(s,e.iterationStart,n,e.iterations,i,a),l=b8(n,e.iterations,o,s),c=w8(e.direction,l,o);return e.currentIteration=l,e.progress=c,e.easingFunction(c)}function E8(r,t,e){var n=S8(r,t),i=_8(n,e);return function(a,s){if(s!==null)i.filter(function(l){return s>=l.applyFrom&&s<l.applyTo}).forEach(function(l){var c=s-l.startOffset,u=l.endOffset-l.startOffset,h=u===0?0:c/u;a.setAttribute(l.property,l.interpolation(h),!1,!1)});else for(var o in n)rT(o)&&a.setAttribute(o,null)}}function rT(r){return r!=="offset"&&r!=="easing"&&r!=="composite"&&r!=="computedOffset"}function S8(r,t){for(var e={},n=0;n<r.length;n++)for(var i in r[n])if(rT(i)){var a={offset:r[n].offset,computedOffset:r[n].computedOffset,easing:r[n].easing,easingFunction:p1(r[n].easing)||t.easingFunction,value:r[n][i]};e[i]=e[i]||[],e[i].push(a)}return e}function _8(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,c=i[o].computedOffset,u=l,h=c;a===0&&(u=-1/0,c===0&&(o=s)),a===i.length-2&&(h=1/0,l===1&&(s=o)),e.push({applyFrom:u,applyTo:h,startOffset:i[s].computedOffset,endOffset:i[o].computedOffset,easingFunction:i[s].easingFunction,property:n,interpolation:k8(n,i[s].value,i[o].value,t)})}return e.sort(function(d,f){return d.startOffset-f.startOffset}),e}var Nb=function(t,e,n){return function(i){var a=iT(t,e,i);return nt(a)?a:n(a)}};function k8(r,t,e,n){var i=DC[r];if(i&&i.syntax&&i.int){var a=U.styleValueRegistry.getPropertySyntax(i.syntax);if(a){var s=a.parser,o=s?s(t,n):t,l=s?s(e,n):e,c=a.mixer(o,l,n);if(c){var u=Nb.apply(void 0,Ut(c));return function(h){return h===0?t:h===1?e:u(h)}}}}return Nb(!1,!0,function(h){return h?e:t})}function iT(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(iT(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 M8=function(){function r(){V(this,r),this.delay=0,this.direction="normal",this.duration="auto",this._easing="linear",this.easingFunction=o8,this.endDelay=0,this.fill="auto",this.iterationStart=0,this.iterations=1,this.currentIteration=null,this.progress=null}return W(r,[{key:"easing",get:function(){return this._easing},set:function(e){this.easingFunction=p1(e),this._easing=e}}])}();function C8(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 Rb(r,t){if(r===null)return[];Array.isArray(r)||(r=C8(r));for(var e=r.map(function(l){var c={};t!=null&&t.composite&&(c.composite="auto");for(var u in l){var h=l[u];if(u==="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.");c.computedOffset=h}}else if(u==="composite"&&["replace","add","accumulate","auto"].indexOf(h)===-1)throw new Error("".concat(h," compositing is not supported"));c[u]=h}return c.offset===void 0&&(c.offset=null),c.easing===void 0&&(c.easing=(t==null?void 0:t.easing)||"linear"),c.composite===void 0&&(c.composite="auto"),c}),n=!0,i=-1/0,a=0;a<e.length;a++){var s=e[a].offset;if(ot(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,c=e,u=c.length;if(e[u-1].computedOffset=Number((l=e[u-1].offset)!==null&&l!==void 0?l:1),u>1){var h;e[0].computedOffset=Number((h=e[0].offset)!==null&&h!==void 0?h:0)}for(var d=0,f=Number(e[0].computedOffset),g=1;g<u;g++){var v=e[g].computedOffset;if(!ot(v)&&!ot(f)){for(var p=1;p<g-d;p++)e[d+p].computedOffset=f+(Number(v)-f)*p/(g-d);d=g,f=Number(v)}}}return n||o(),e}var T8="backwards|forwards|both|none".split("|"),O8="reverse|alternate|alternate-reverse".split("|");function A8(r,t){var e=new M8;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"&&T8.indexOf(r[n])===-1||n==="direction"&&O8.indexOf(r[n])===-1)return;e[n]=r[n]}}),e}function P8(r,t){return r=N8(r??{duration:"auto"}),A8(r)}function N8(r){return typeof r=="number"&&(isNaN(r)?r={duration:"auto"}:r={duration:r}),r}var R8=function(){function r(t,e,n){var i=this;V(this,r),this.composite="replace",this.iterationComposite="replace",this.target=t,this.timing=P8(n),this.timing.effect=this,this.timing.activeDuration=f8(this.timing),this.timing.endTime=Math.max(0,this.timing.delay+this.timing.activeDuration+this.timing.endDelay),this.normalizedKeyframes=Rb(e,this.timing),this.interpolations=E8(this.normalizedKeyframes,this.timing,this.target);var a=U.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 W(r,[{key:"applyInterpolations",value:function(){this.interpolations(this.target,Number(this.timeFraction))}},{key:"update",value:function(e){return e===null?!1:(this.timeFraction=x8(this.timing.activeDuration,e,this.timing),this.timeFraction!==null)}},{key:"getKeyframes",value:function(){return this.normalizedKeyframes}},{key:"setKeyframes",value:function(e){this.normalizedKeyframes=Rb(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 Lb(r,t){return Number(r.id)-Number(t.id)}var L8=function(){function r(t){var e=this;V(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(Lb),e.animations=e.tick(n,!0,e.animations)[0],i.forEach(function(a){a[1](n)}),e.applyPendingEffects()},this.document=t}return W(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 R8(e,n,i),s=new K4(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(Lb);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=[],c=[],u=[],h=[];return i.forEach(function(d){d.tick(e,n),d._inEffect?(c.push(d.effect),d.markTarget()):(l.push(d.effect),d.unmarkTarget()),d._needsTick&&(a.ticking=!0);var f=d._inEffect||d._needsTick;d._inTimeline=f,f?u.push(d):h.push(d)}),(s=this.pendingEffects).push.apply(s,l),(o=this.pendingEffects).push.apply(o,c),this.ticking&&this.requestAnimationFrame(function(){}),this.inTick=!1,[u,h]}}])}();U.EasingFunction=p1;U.AnimationTimeline=L8;const D8={duration:500},I8={duration:1e3,easing:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",iterations:1,fill:"both"};var Qt;(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"})(Qt||(Qt={}));var dn;(function(r){r.DRAW="draw",r.COLLAPSE="collapse",r.EXPAND="expand",r.TRANSFORM="transform"})(dn||(dn={}));var ni;(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"})(ni||(ni={}));var wa;(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"})(wa||(wa={}));var z;(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"})(z||(z={}));var ps;(function(r){r.KEY_DOWN="keydown",r.KEY_UP="keyup"})(ps||(ps={}));var fu;(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"})(fu||(fu={}));var X;(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"})(X||(X={}));var _i;(function(r){r.UNDO="undo",r.REDO="redo",r.CANCEL="cancel",r.ADD="add",r.CLEAR="clear",r.CHANGE="change"})(_i||(_i={}));var Vn;(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"})(Vn||(Vn={}));const jt="combo",Cn="tree";var Yr;(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"})(Yr||(Yr={}));const ry={animation:{},behavior:{},combo:{},edge:{},layout:{},node:{},palette:{},theme:{},plugin:{},transform:{},shape:{}};function ri(r,t){var e;const n=(e=ry[r])===null||e===void 0?void 0:e[t];if(n)return n}const F8="5.0.43",B8="G6";function Xr(r){return`[${B8} v${F8}] ${r}`}const Ar={mute:!1,debug:r=>{console.debug(Xr(r))},info:r=>{console.info(Xr(r))},warn:r=>{console.warn(Xr(r))},error:r=>{console.error(Xr(r))}};function aT(r){const{theme:t}=r;if(!t)return{};const e=ri(Yr.THEME,t);return e||(Ar.warn(`The theme of ${t} is not registered.`),{})}function y1(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 iy(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=>ot(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 Fo(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 sT(r,t){const{animation:e}=r;if(e===!1||t===!1)return!1;const n=Object.assign({},D8);return me(e)&&Object.assign(n,e),me(t)&&Object.assign(n,t),n}function z8(r){if(typeof r=="string"){const t=ri(Yr.ANIMATION,r);return t||(Ar.warn(`The animation of ${r} is not registered.`),[])}return r}function $8(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 c=(a=aT(r)[t])===null||a===void 0?void 0:a.animation,u=(d=[])=>z8(d).map(f=>Object.assign(Object.assign(Object.assign(Object.assign({},I8),me(s)&&s),f),me(n)&&n));if(l)return u(l);if(!c)return[];const h=c[e];return h===!1?[]:u(h)}function oT(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,nt(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 j8=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 q8=(r,t,e)=>{if(!e.length)return null;const[n,i]=t,a=c=>{var u;if(c){const h=r.getShape(c);if(!h)return null;const d=`get${eu(c)}Style`,f=((u=r==null?void 0:r[d])===null||u===void 0?void 0:u.bind(r))||(p=>p),g=(f==null?void 0:f(n))||{},v=(f==null?void 0:f(i))||{};return{shape:h,fromStyle:g,toStyle:v}}else return{shape:r,fromStyle:n,toStyle:i}};let s;const o=e.map(c=>{var{fields:u,shape:h,states:d}=c,f=j8(c,["fields","shape","states"]);const g=a(h);if(!g)return null;const{shape:v,fromStyle:p,toStyle:m}=g,y=[{},{}];if(u.forEach(w=>{var x,S;Object.assign(y[0],{[w]:(x=p[w])!==null&&x!==void 0?x:Fo(w)}),Object.assign(y[1],{[w]:(S=m[w])!==null&&S!==void 0?S:Fo(w)})}),y.some(w=>Object.keys(w).some(x=>["x","y","z"].includes(x)))){const{x:w=0,y:x=0,z:S,transform:E=""}=v.attributes||{};y.forEach(_=>{var C,k,M;_.transform=oT((C=_.x)!==null&&C!==void 0?C:w,(k=_.y)!==null&&k!==void 0?k:x,(M=_.z)!==null&&M!==void 0?M:S,E)})}const b=v.animate(iy(y),f);return h===void 0&&(s=b),b}).filter(Boolean),l=s||(o==null?void 0:o[0]);return l?y1(l,o.filter(c=>c!==c)):null},G8=[{fields:["opacity"]}],W8=[{fields:["x","y"]}],lT=[{fields:["x","y"]}],V8=lT,cT=[{fields:["sourceNode","targetNode"]}],H8=cT,uT=[{fields:["childrenNode","x","y"]}],U8=uT;function Y8(r){return"source"in r&&"target"in r}function X8(r){return r.length===2}function Ps(r){return r instanceof Float32Array?!0:Array.isArray(r)&&(r.length===2||r.length===3)?r.every(t=>typeof t=="number"):!1}function Or(r,t,e){return r>=t&&r<=e}function Pr(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 K8(r=0){const t=Pr(r);return t[0]+t[2]}function Nr(r){return r.max[0]-r.min[0]}function Rr(r){return r.max[1]-r.min[1]}function ta(r){return[Nr(r),Rr(r)]}function Ai(r,t){const e=Ps(r)?b1(r):r.getShape("key").getBounds();return t?ea(e,t):e}function b1(r){const[t,e,n=0]=r,i=new Vt;return i.setMinMax([t,e,n],[t,e,n]),i}function ea(r,t){const[e,n,i,a]=Pr(t),[s,o,l]=r.min,[c,u,h]=r.max,d=new Vt;return d.setMinMax([s-a,o-e,l],[c+n,u+i,h]),d}function il(r){if(r.length===0)return new Vt;if(r.length===1)return r[0];const t=new Vt;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 Z8(r,t){const[e,n]=r.min,[i,a]=r.max,[s,o]=t.min,[l,c]=t.max;return e>=s&&i<=l&&n>=o&&a<=c}function cr(r,t){return Or(r[0],t.min[0],t.max[0])&&Or(r[1],t.min[1],t.max[1])}function hT(r,t,e=!1){const{min:[n,i],max:[a,s]}=t,o=(r[1]===i||r[1]===s)&&(e||Or(r[0],n,a)),l=(r[0]===n||r[0]===a)&&(e||Or(r[1],i,s));return o||l}function J8(r,t){return!cr(r,t)}function gu(r,t){const{center:e}=t;return r[0]===e[0]&&r[1]===e[1]}function Co(r,t){const[e,n]=r,[i,a]=t.min,[s,o]=t.max,l=e-i,c=s-e,u=n-a,h=o-n,d=Math.min(l,c,u,h);return d===l?"left":d===c?"right":d===u?"top":d===h?"bottom":"left"}function Ta(r,t){const e=Vi(r);if(cr(r,t))switch(Co(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]=Or(n,a,o)?n:n<a?a:o,e[1]=Or(i,s,l)?i:i<s?s:l}return e}function Q8(r,t){const{center:e}=r,[n,i]=ta(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 t9(r,t){let[e,n]=ta(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 e9(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 n9=function(t,e){return t===e},Db=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}(),r9=function(){function r(t){t===void 0&&(t=n9),this.head=null,this.tail=null,this.compare=t}return r.prototype.prepend=function(t){var e=new Db(t,this.head);return this.head=e,this.tail||(this.tail=e),this},r.prototype.append=function(t){var e=new Db(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}(),i9=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(c){return c.source===t};return i.filter(a).map(function(l){return l.target})}if(n==="source"){var s=function(c){return c.target===t};return i.filter(s).map(function(l){return l.source})}var o=function(c){return c.source===t?c.target:c.source};return i.map(o)},a9=function(t,e){return e.filter(function(n){return n.source===t})},s9=function(t,e){return e.filter(function(n){return n.source===t||n.target===t})},o9=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},l9={}.toString,w1=function(r,t){return l9.call(r)==="[object "+t+"]"};const dT=function(r){return w1(r,"Function")},fT=function(r){return Array.isArray?Array.isArray(r):w1(r,"Array")},c9=function(r){var t=typeof r;return r!==null&&t==="object"||t==="function"};function u9(r,t){if(r){var e;if(fT(r))for(var n=0,i=r.length;n<i&&(e=t(r[n],n),e!==!1);n++);else if(c9(r)){for(var a in r)if(r.hasOwnProperty(a)&&(e=t(r[a],a),e===!1))break}}}const h9=function(r){return w1(r,"String")};var d9=Object.values?function(r){return Object.values(r)}:function(r){var t=[];return u9(r,function(e,n){dT(r)&&n==="prototype"||t.push(e)}),t};const f9=function(r,t){if(!dT(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 tc;f9(function(r,t){t===void 0&&(t={});var e=t.fontSize,n=t.fontFamily,i=t.fontWeight,a=t.fontStyle,s=t.fontVariant;return tc||(tc=document.createElement("canvas").getContext("2d")),tc.font=[a,s,i,e+"px",n].join(" "),tc.measureText(h9(r)?r:"").width},function(r,t){return t===void 0&&(t={}),T6([r],d9(t)).join("")});var g9=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},v9=function(t,e,n,i){var a=t.nodes,s=a===void 0?[]:a,o=t.edges,l=o===void 0?[]:o,c={},u={},h={};s.forEach(function(y,b){var w=y.id;u[w]=1/0,w===e&&(u[w]=0)});for(var d=s.length,f=function(b){var w=g9(u,s,c),x=w.id;if(c[x]=!0,u[x]===1/0)return"continue";var S=[];n?S=a9(x,l):S=s9(x,l),S.forEach(function(E){var _=E.target,C=E.source,k=_===x?C:_,M=i&&E[i]?E[i]:1;u[k]>u[w.id]+M?(u[k]=u[w.id]+M,h[k]=[w.id]):u[k]===u[w.id]+M&&h[k].push(w.id)})},g=0;g<d;g++)f();h[e]=[e];var v={};for(var p in u)u[p]!==1/0&&gT(e,p,h,v);var m={};for(var p in v)m[p]=v[p][0];return{length:u,path:m,allPath:v}};function gT(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=gT(r,o,e,n);if(!l)return;for(var c=0,u=l;c<u.length;c++){var h=u[c];fT(h)?i.push(Q(Q([],h,!0),[t],!1)):i.push([h,t])}}return n[t]=i,n[t]}var vT=function(t,e,n,i,a){var s=v9(t,e,i,a),o=s.length,l=s.path,c=s.allPath;return{length:o[n],path:l[n],allPath:c[n]}},Ib;(function(r){r.EuclideanDistance="euclideanDistance"})(Ib||(Ib={}));var p9=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,c=t.edges,u=c===void 0?[]:c,h=l.length,d,f={},g={},v=0;v<h;++v){var p=l[v],m=p.id;f[m]=1/h,g[m]=1/h}for(var y=o9(t);s>0&&i>e;){a=0;for(var v=0;v<h;++v){var p=l[v],m=p.id;if(d=0,y[p.id].inDegree===0)f[m]=0;else{for(var b=i9(m,u,"source"),w=0;w<b.length;++w){var x=b[w],S=y[x].outDegree;S>0&&(d+=g[x]/S)}f[m]=n*d,a+=f[m]}}a=(1-a)/h,i=0;for(var v=0;v<h;++v){var p=l[v],m=p.id;d=f[m]+a,i+=Math.abs(d-g[m]),g[m]=d}s-=1}return g};(function(){function r(t){t===void 0&&(t=10),this.linkedList=new r9,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 F(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(Xr("The datum does not have available id."))}function ec(r){return r.combo}function pT(r,t){const e={nodes:(r.nodes||[]).map(F),edges:(r.edges||[]).map(F),combos:(r.combos||[]).map(F)};return t?Object.values(e).flat():e}const mT=(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(F(a),e.direction).length;i.set(F(a),s)}),i}case"betweenness":return m9(r,e.directed,e.weightPropertyName);case"closeness":return y9(r,e.directed,e.weightPropertyName);case"eigenvector":return w9(r,e.directed);case"pagerank":return b9(r,e.epsilon,e.linkProb);default:return yT(r)}},yT=r=>{var t;const e=new Map;return(t=r.nodes)===null||t===void 0||t.forEach(n=>{e.set(F(n),0)}),e},m9=(r,t,e)=>{const n=yT(r),{nodes:i=[]}=r;return i.forEach(a=>{i.forEach(s=>{if(a!==s){const{allPath:o}=vT(r,F(a),F(s),t,e),l=o.length;o.flat().forEach(c=>{c!==F(a)&&c!==F(s)&&n.set(c,n.get(c)+1/l)})}})}),n},y9=(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:c}=vT(r,F(a),F(l),t,e);o+=c}return o},0);n.set(F(a),1/s)}),n},b9=(r,t,e)=>{var n;const i=new Map,a=p9(r,t,e);return(n=r.nodes)===null||n===void 0||n.forEach(s=>{i.set(F(s),a[F(s)])}),i},w9=(r,t)=>{const{nodes:e=[]}=r,n=x9(r,t),i=E9(n,e.length),a=new Map;return e.forEach((s,o)=>{a.set(F(s),i[o])}),a},x9=(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(c=>F(c)===a),l=e.findIndex(c=>F(c)===s);t?i[o][l]=1:(i[o][l]=1,i[l][o]=1)}),i},E9=(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 c=0;c<t;c++)for(let u=0;u<t;u++)o[c]+=r[c][u]*i[u];const l=Math.sqrt(o.reduce((c,u)=>c+u*u,0));for(let c=0;c<t;c++)o[c]/=l;a=Math.sqrt(o.reduce((c,u,h)=>c+(u-i[h])*u,0)),i=o}return i};function zi(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=[],c=[],u=[],h=[];return o.forEach(d=>{s.has(d)?n(i.get(d),a.get(d))?h.push(a.get(d)):c.push(a.get(d)):l.push(a.get(d))}),s.forEach(d=>{o.has(d)||u.push(i.get(d))}),{enter:l,exit:u,keep:h,update:c}}function Ba(r,t,e){const n=i=>{e&&!e(i)||(i.style.visibility=t)};r.forEach(i=>{n(i)})}function S9(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 x1{constructor(t){this.extensions=[],this.extensionMap={},this.context=t}setExtensions(t){const e=S9(this.context.graph,this.category,t),{enter:n,update:i,exit:a,keep:s}=zi(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=ri(e,i);if(!a)return Ar.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 E1{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 xn extends E1{}class Uu extends xn{constructor(t,e){super(t,Object.assign({},Uu.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(ea(o,this.options.padding))):a.hide.push(s)}),a},this.hideLabelIfExceedViewport=(n,i)=>{const{exit:a}=zi(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(c=>(this.nodeCentralities.has(c.id)||(this.nodeCentralities=mT(s,o,i)),{node:c,centrality:this.nodeCentralities.get(c.id)})).sort((c,u)=>u.centrality-c.centrality).map(c=>c.node)},this.sortLabelElementsInView=n=>{const{sort:i,sortNode:a,sortCombo:s,sortEdge:o}=this.options,{model:l}=this.context;if(at(i))return n.sort((v,p)=>i(l.getElementDataById(v.id),l.getElementDataById(p.id)));const{node:c=[],edge:u=[],combo:h=[]}=ju(n,v=>v.type),d=at(s)?h.sort((v,p)=>s(...l.getComboData([v.id,p.id]))):h,f=at(a)?c.sort((v,p)=>a(...l.getNodeData([v.id,p.id]))):this.sortNodesByCentrality(c,a),g=at(o)?u.sort((v,p)=>o(...l.getEdgeData([v.id,p.id]))):u;return[...d,...f,...g]},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 c=o.length-1;c>=0;c--)this.showLabel(o[c]);l.forEach(this.hideLabel)},this.hiddenElements=new Map,this.hideLabel=n=>{const i=n.getShape("label");i&&Ba(i,"hidden"),this.hiddenElements.set(n.id,n)},this.showLabel=n=>{const i=n.getShape("label");i&&Ba(i,"visible"),n.toFront(),this.hiddenElements.delete(n.id)},this.onTransform=iC(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(X.BEFORE_RENDER,this.onBeforeRender),t.on(X.AFTER_RENDER,this.onAfterRender),t.on(X.AFTER_DRAW,this.toggle),t.on(X.AFTER_LAYOUT,this.toggle),t.on(X.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:t}=this.context;t.off(X.BEFORE_RENDER,this.onBeforeRender),t.off(X.AFTER_RENDER,this.onAfterRender),t.off(X.AFTER_DRAW,this.toggle),t.off(X.AFTER_LAYOUT,this.toggle),t.off(X.AFTER_TRANSFORM,this.onTransform)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return at(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}Uu.defaultOptions={enable:!0,throttle:100,padding:0,sortNode:{type:"degree"}};const Fb=[0,0,0];function ft(r,t){return r.map((e,n)=>e+t[n])}function $t(r,t){return r.map((e,n)=>e-t[n])}function Gr(r,t){return typeof t=="number"?r.map(e=>e*t):r.map((e,n)=>e*t[n])}function ur(r,t){return typeof t=="number"?r.map(e=>e/t):r.map((e,n)=>e/t[n])}function _9(r,t){return r.reduce((e,n,i)=>e+n*t[i],0)}function k9(r,t){const e=Bo(r),n=Bo(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 Pi(r,t){return r.map(e=>e*t)}function Kt(r,t){return Math.sqrt(r.reduce((e,n,i)=>e+Math.pow(n-t[i]||0,2),0))}function vu(r,t){return r.reduce((e,n,i)=>e+Math.abs(n-t[i]),0)}function ti(r){const t=r.reduce((e,n)=>e+Math.pow(n,2),0);return r.map(e=>e/Math.sqrt(t))}function S1(r,t,e=!1){const n=r[0]*t[1]-r[1]*t[0];let i=Math.acos(Gr(r,t).reduce((a,s)=>a+s,0)/(Kt(r,Fb)*Kt(t,Fb)));return e&&n<0&&(i=2*Math.PI-i),i}function Yu(r,t=!0){return t?[-r[1],r[0]]:[r[1],-r[0]]}function M9(r,t){return r.map(e=>e%t)}function za(r){return[r[0],r[1]]}function Bo(r){return X8(r)?[r[0],r[1],0]:r}function bT(r){const[t,e]=r;return!t&&!e?0:Math.atan2(e,t)}function wT(r,t){const[e,n]=r,[i,a]=t,s=$t(e,n),o=$t(i,a);return k9(s,o).every(l=>l===0)}function _1(r,t,e=!1){if(wT(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&&(!Or(o,0,1)||!Or(l,0,1))))return[n[0]+o*(i[0]-n[0]),n[1]+o*(i[1]-n[1])]}function xT(r){if(Array.isArray(r))return Or(r[0],0,1)&&Or(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 ye(r){const{x:t=0,y:e=0,z:n=0}=r.style||{};return[+t,+e,+n]}function C9(r){const{x:t,y:e,z:n}=r.style||{};return t!==void 0||e!==void 0||n!==void 0}function T9(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 Wr(r,t="center"){const e=xT(t);return T9(r,e)}function Ge(r){var t;return[r.x,r.y,(t=r.z)!==null&&t!==void 0?t:0]}function sr(r){var t;return{x:r[0],y:r[1],z:(t=r[2])!==null&&t!==void 0?t:0}}function Js(r,t=0){return r.map(e=>parseFloat(e.toFixed(t)))}function $i(r,t,e,n=!1){if(ue(r,t))return r;const i=n?$t(r,t):$t(t,r),a=ti(i),s=[a[0]*e,a[1]*e];return ft(za(r),s)}function ET(r,t){return r[1]===t[1]}function O9(r,t){return r[0]===t[0]}function A9(r,t){return ET(r,t)||O9(r,t)}function ST(r,t,e){return wT([r,t],[t,e])}function _T(r,t){return[2*t[0]-r[0],2*t[1]-r[1]]}function kT(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=ft(t,s),o=ft(t,o));const l=i?_T(r,t):r,c=_1([t,l],[s,o]);if(c)return{point:c,line:[s,o]}}return{point:t,line:void 0}}function P9(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,c=o-1;l<o;c=l++){const u=t[l+e][0],h=t[l+e][1],d=t[c+e][0],f=t[c+e][1];h>a!=f>a&&i<(d-u)*(a-h)/(f-h)+u&&(s=!s)}return s}function N9(r,t,e=!1){const n=Wr(t,"center"),i=[Wr(t,"left-top"),Wr(t,"right-top"),Wr(t,"right-bottom"),Wr(t,"left-bottom")];return kT(r,n,i,!1,e).point}function Xu(r,t,e=!1){const n=t.center,i=e?_T(r,n):r,a=$t(i,t.center),s=Math.atan2(a[1],a[0]);if(isNaN(s))return n;const o=Nr(t)/2,l=Rr(t)/2,c=n[0]+o*Math.cos(s),u=n[1]+l*Math.sin(s);return[c,u]}function R9(r,t){let e=1/0,n=[r[0],t[0]];return r.forEach(i=>{t.forEach(a=>{const s=Kt(i,a);s<e&&(e=s,n=[i,a])})}),n}function L9(r,t){let e=1/0,n=[[0,0],[0,0]];return t.forEach(i=>{const a=D9(r,i);a<e&&(e=a,n=i)}),n}function D9(r,t){const e=MT(r,t);return Kt(r,e)}function MT(r,t){const[e,n]=t[0],[i,a]=t[1],[s,o]=r,l=i-e,c=a-n;if(l===0&&c===0)return[e,n];let u=((s-e)*l+(o-n)*c)/(l*l+c*c);u>1?u=1:u<0&&(u=0);const h=e+u*l,d=n+u*c;return[h,d]}function I9(r){const t=r.reduce((e,n)=>ft(e,n),[0,0]);return ur(t,r.length)}function k1(r,t=!0){const e=I9(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 Bb(r,t){return[r,[r[0],t[1]],t,[t[0],r[1]]]}class F9{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(z.POINTER_DOWN,this.onPointerDown),t.on(z.POINTER_MOVE,this.onPointerMove),t.on(z.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(z.POINTER_DOWN,this.onPointerDown),this.emitter.off(z.POINTER_MOVE,this.onPointerMove),this.emitter.off(z.POINTER_UP,this.onPointerUp)}}const zb=r=>r.map(t=>Tt(t)?t.toLocaleLowerCase():t);class Ds{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(z.WHEEL,e)},this.onDrag=e=>{this.triggerExtendKey(z.DRAG,e)},this.handlePinch=(e,n)=>{this.triggerExtendKey(z.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(z.PINCH)&&!this.pinchHandler&&(this.pinchHandler=new F9(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=zb(Array.from(this.recordKey)).sort(),n=zb(t).sort();return ue(e,n)}bindEvents(){var t;const{emitter:e}=this;e.on(z.KEY_DOWN,this.onKeyDown),e.on(z.KEY_UP,this.onKeyUp),e.on(z.WHEEL,this.onWheel),e.on(z.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(z.KEY_DOWN,this.onKeyDown),this.emitter.off(z.KEY_UP,this.onKeyUp),this.emitter.off(z.WHEEL,this.onWheel),this.emitter.off(z.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 al extends xn{constructor(t,e){super(t,on({},al.defaultOptions,e)),this.shortcut=new Ds(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 Be({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=pu(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(Bb(this.startPoint,this.endPoint))}onPointerUp(t){if(this.startPoint){if(!this.endPoint){this.clearBrush();return}this.endPoint=pu(t),this.updateElementsStates(Bb(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[F(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(c=>{l[c]=[...e.getElementState(c),i]});break;case"diff":o.forEach(c=>{const u=e.getElementState(c);l[c]=u.includes(i)?u.filter(h=>h!==i):[...u,i]});break;case"intersect":o.forEach(c=>{const u=e.getElementState(c);l[c]=u.includes(i)?[i]:[]});break;case"default":default:o.forEach(c=>{l[c]=[i]});break}at(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=F(o);t.getElementVisibility(l)!=="hidden"&&P9(t.getElementPosition(l),e)&&i.push(l)})}),n.includes("edge")){const s=a.edges;s==null||s.forEach(o=>{const{source:l,target:c}=o;i.includes(l)&&i.includes(c)&&i.push(F(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 at(e)?e(t):!!e}bindEvents(){const{graph:t}=this.context;t.on(z.POINTER_DOWN,this.onPointerDown),t.on(z.POINTER_MOVE,this.onPointerMove),t.on(z.POINTER_UP,this.onPointerUp),t.on(ni.CLICK,this.clearStates)}unbindEvents(){const{graph:t}=this.context;t.off(z.POINTER_DOWN,this.onPointerDown),t.off(z.POINTER_MOVE,this.onPointerMove),t.off(z.POINTER_UP,this.onPointerUp),t.off(ni.CLICK,this.clearStates)}update(t){this.unbindEvents(),this.options=on(this.options,t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}al.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 pu=r=>[r.canvas.x,r.canvas.y],ii=.8,$a=["node","edge","combo"];function Oa(r,t,e,n,i=0){n==="TB"&&t(r,i);const a=e(r);if(a)for(const s of a)Oa(s,t,e,n,i+1);n==="BT"&&t(r,i)}function B9(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 CT(r,t,e,n,i="both"){if(t==="combo"||t==="node")return nf(r,e,n,i);const a=r.getEdgeData(e);if(!a)return[];const s=nf(r,a.source,n-1,i),o=nf(r,a.target,n-1,i);return Array.from(new Set([...s,...o,e]))}function nf(r,t,e,n="both"){const i=new Set,a=new Set,s=new Set;return B9(t,(o,l)=>{l>e||(s.add(o),r.getRelatedEdgesData(o,n).forEach(c=>{const u=F(c);!a.has(u)&&l<e&&(s.add(u),a.add(u))}))},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 rf(r){return r.states||[]}var nc=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class Ku extends xn{constructor(t,e){super(t,Object.assign({},Ku.defaultOptions,e)),this.onClickSelect=n=>nc(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=>nc(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 Ds(t.graph),this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),$a.forEach(e=>{t.on(`${e}:${z.CLICK}`,this.onClickSelect)}),t.on(ni.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 CT(i,n,e.id,typeof a=="function"?a(t):a).filter(s=>s!==e.id)}updateState(t){return nc(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),c=rf(l).includes(e)?"unselect":"select",u={},h=this.isMultipleSelect,d=[s.id],f=this.getNeighborIds(t);if(h)if(Object.assign(u,this.getDataStates()),c==="select"){const g=(v,p)=>{v.forEach(m=>{const y=new Set(o.getElementState(m));y.add(p),y.delete(n),u[m]=Array.from(y)})};g(d,e),g(f,i),n&&Object.keys(u).forEach(v=>{const p=u[v];!p.includes(e)&&!p.includes(i)&&!p.includes(n)&&u[v].push(n)})}else{const g=u[s.id];u[s.id]=g.filter(v=>v!==e&&v!==i),g.includes(n)||u[s.id].push(n),f.forEach(v=>{u[v]=u[v].filter(p=>p!==i),u[v].includes(e)||u[v].push(n)})}else if(c==="select"){Object.assign(u,this.getClearStates(!!n));const g=(v,p)=>{v.forEach(m=>{u[m]||(u[m]=o.getElementState(m)),u[m].push(p)})};g(d,e),g(f,i),n&&Object.keys(u).forEach(v=>{!d.includes(v)&&!f.includes(v)&&u[v].push(n)})}else Object.assign(u,this.getClearStates());yield o.setElementState(u,a)})}getDataStates(){const{graph:t}=this.context,{nodes:e,edges:n,combos:i}=t.getData(),a={};return[...e,...n,...i].forEach(s=>{a[F(s)]=rf(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:c}=e.getData(),u={};return[...o,...l,...c].forEach(h=>{const d=rf(h),f=d.filter(g=>!s.has(g));(t||f.length!==d.length)&&(u[F(h)]=f)}),u}clearState(){return nc(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 at(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;$a.forEach(e=>{t.off(`${e}:${z.CLICK}`,this.onClickSelect)}),t.off(ni.CLICK,this.onClickCanvas)}destroy(){this.unbindEvents(),super.destroy()}}Ku.defaultOptions={animation:!0,enable:!0,multiple:!1,trigger:["shift"],state:"selected",neighborState:"selected",unselectedState:void 0,degree:0};function mn(r){var t;return!!(!((t=r.style)===null||t===void 0)&&t.collapsed)}function mu(r,t){if(!r.startsWith(t))return!1;const e=r[t.length];return e>="A"&&e<="Z"}function z9(r,t){return`${t}${eu(r)}`}function $9(r,t,e=!0){if(!t||!mu(r,t))return r;const n=r.slice(t.length);return e?g6(n):n}function Se(r,t){const e=Object.entries(r).reduce((n,[i,a])=>(i==="className"||i==="class"||mu(i,t)&&Object.assign(n,{[$9(i,t)]:a}),n),{});if("opacity"in r){const n=z9("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 ay(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 TT(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 Nn(r=0){if(typeof r=="number")return[r,r,r];const[t,e=t,n=t]=r;return[t,e,n]}var j9=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 $b(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 $e(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 q9(r){const{x:t,y:e,z:n,class:i,className:a,transform:s,transformOrigin:o,zIndex:l,visibility:c}=r;return j9(r,["x","y","z","class","className","transform","transformOrigin","zIndex","visibility"])}function G9(r,t){const e=Nn(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 jb(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 W9(r,t){if(!t)return{};const{type:e,color:n,field:i,invert:a}=t,s=l=>{const c=typeof n=="string"?ri("palette",n):n;if(typeof c=="function"){const u={};return l.forEach(([h,d])=>{u[h]=c(a?1-d:d)}),u}else if(Array.isArray(c)){const u=a?[...c].reverse():c,h={};return l.forEach(([d,f])=>{h[d]=u[f%c.length]}),h}return{}},o=(l,c)=>{var u;return typeof l=="string"?(u=c.data)===null||u===void 0?void 0:u[l]:l==null?void 0:l(c)};if(e==="group"){const l=ju(r,d=>{if(!i)return"default";const f=o(i,d);return f?String(f):"default"}),c=Object.keys(l),u=s(c.map((d,f)=>[d,f])),h={};return Object.entries(l).forEach(([d,f])=>{f.forEach(g=>{h[F(g)]=u[d]})}),h}else if(e==="value"){const[l,c]=r.reduce(([h,d],f)=>{const g=o(i,f);if(typeof g!="number")throw new Error(Xr(`Palette field ${i} is not a number`));return[Math.min(h,g),Math.max(d,g)]},[1/0,-1/0]),u=c-l;return s(r.map(h=>[h.id,(o(i,h)-l)/u]))}}function OT(r){const t=typeof r=="string"?ri("palette",r):r;if(typeof t!="function")return t}function AT(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 PT(r,t,e=1,n=!1){const i=n?e:1,a=(r.max[0]-r.min[0])*i;return AT(a,t)}function V9(r,t,e=1){const n=Kt(r[0],r[1])*e;return AT(n,t)}class sl extends g1{constructor(t){qb(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,c,u,h,d,f;const g=this.shapeMap[t];if(n===!1){g&&((s=a==null?void 0:a.beforeDestroy)===null||s===void 0||s.call(a,g),i.removeChild(g),delete this.shapeMap[t],(o=a==null?void 0:a.afterDestroy)===null||o===void 0||o.call(a,g));return}const v=typeof e=="string"?ri(Yr.SHAPE,e):e;if(!v)throw new Error(Xr(`Shape ${e} not found`));if(!g||g.destroyed||!(g instanceof v)){g&&((l=a==null?void 0:a.beforeDestroy)===null||l===void 0||l.call(a,g),g==null||g.destroy(),(c=a==null?void 0:a.afterDestroy)===null||c===void 0||c.call(a,g)),(u=a==null?void 0:a.beforeCreate)===null||u===void 0||u.call(a);const p=new v({className:t,style:n});return i.appendChild(p),this.shapeMap[t]=p,(h=a==null?void 0:a.afterCreate)===null||h===void 0||h.call(a,p),p}return(d=a==null?void 0:a.beforeUpdate)===null||d===void 0||d.call(a,g),fy(g,n),(f=a==null?void 0:a.afterUpdate)===null||f===void 0||f.call(a,g),g}update(t={}){const e=Object.assign({},this.attributes,t);qb(e),$F(this,e),this.render(e,this),this.setVisibility()}bindEvents(){}getGraphicStyle(t){return q9(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:c=a,y:u=s,z:h=o}=l;Object.assign(l,{transform:h?[["translate3d",c,u,h]]:[["translate",c,u]]})})}const i=super.animate(t,e);if(i&&(af(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 c=`get${eu(o)}Style`,u=this[c];if(at(u)){const h=t.map(f=>u.call(this,Object.assign(Object.assign({},this.attributes),f))),d=l.animate(iy(h),e);d&&(af(l,d),n.push(d))}});const s=(o,l)=>{if(!wr(o)){const c=`get${eu(l)}Style`,u=this[c];if(at(u)){const h=t.map(d=>u.call(this,Object.assign(Object.assign({},this.attributes),d)));Object.entries(h[0]).map(([d])=>{const f=h.map(v=>v[d]),g=o[d];if(g){const v=g.animate(iy(f),e);v&&(af(g,v),n.push(v))}})}}};this.compositeShapes.forEach(([o,l])=>{const c=ay(this.shapeMap,l);s(c,o)})}}return y1(n)}getShape(t){return this.shapeMap[t]}setVisibility(){const{visibility:t}=this.attributes;Ba(this,t)}destroy(){this.shapeMap={},this.animateMap={},super.destroy()}}function af(r,t){t==null||t.finished.then(()=>{const e=r.activeAnimations.findIndex(n=>n===t);e>-1&&r.activeAnimations.splice(e,1)})}function qb(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=oT(t,e,n,i);a&&(r.transform=a)}return r}var H9=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 na extends sl{constructor(t){super($e({style:na.defaultStyleProps},t))}isTextStyle(t){return mu(t,"label")}isBackgroundStyle(t){return mu(t,"background")}getTextStyle(t){const e=this.getGraphicStyle(t),{padding:n}=e,i=H9(e,["padding"]);return TT(i,"background")}getBackgroundStyle(t){if(t.background===!1)return!1;const e=this.getGraphicStyle(t),{wordWrap:n,wordWrapWidth:i,padding:a}=e,s=Se(e,"background"),{min:[o,l],center:[c,u],halfExtents:[h,d]}=this.shapeMap.text.getGeometryBounds(),[f,g,v,p]=Pr(a),m=h*2+p+g,{width:y,height:b}=s;y&&b?Object.assign(s,{x:c-Number(y)/2,y:u-Number(b)/2}):Object.assign(s,{x:o-p,y:l-f,width:n?Math.min(m,i+p+g):m,height:d*2+f+v});const{radius:w}=s;if(typeof w=="string"&&w.endsWith("%")){const x=Number(w.replace("%",""))/100;s.radius=Math.min(+s.width,+s.height)*x}return s}render(t=this.parsedAttributes,e=this){this.upsert("text",Qi,this.getTextStyle(t),e),this.upsert("background",Be,this.getBackgroundStyle(t),e)}getGeometryBounds(){return(this.getShape("background")||this.getShape("text")).getGeometryBounds()}}na.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 ei extends sl{constructor(t){super($e({style:ei.defaultStyleProps},t))}getBadgeStyle(t){return this.getGraphicStyle(t)}render(t=this.parsedAttributes,e=this){this.upsert("label",na,this.getBadgeStyle(t),e)}getGeometryBounds(){const t=this.getShape("label");return(t.getShape("background")||t.getShape("text")).getGeometryBounds()}}ei.defaultStyleProps={padding:[2,4,2,4],fontSize:10,wordWrap:!1,backgroundRadius:"50%",backgroundOpacity:1};function U9(r,t=!0){const e=[];return r.forEach((n,i)=>{e.push([i===0?"M":"L",...n])}),t&&e.push(["Z"]),e}const Gb={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 Y9(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 Gb?n=a:t.unshift(a),i={type:n},Gb[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 X9(r){const t=[];return(typeof r=="string"?Y9(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 NT=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],[c,u]=r[s],[h,d]=r[s+1],[f,g]=s!==r.length-2?r[s+2]:[h,d],v=c+(h-o)/6,p=u+(d-l)/6,m=h-(f-c)/6,y=d-(g-u)/6;a.push(["C",v,p,m,y,h,d])}return a};function K9(r,t,e,n,i,a,s){const[o,l]=Wr(r,t),c={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 c;const u=X9(a);if(!u||u.length<=3)return c;const h=u.map((g,v)=>{const p=g,m=u[(v+1)%u.length];return ue(p,m)?null:[p,m]}).filter(Boolean),d=L9([o,l],h),f=MT([o,l],d);if(f&&d&&(c.transform=[["translate",f[0]+e,f[1]+n]],s)){const g=Math.atan((d[0][1]-d[1][1])/(d[0][0]-d[1][0]));c.transform.push(["rotate",g/Math.PI*180]),c.textAlign="center",(t==="right"||t==="left")&&(g>0?c.textBaseline=t==="right"?"bottom":"top":c.textBaseline=t==="right"?"top":"bottom")}return c}var Z9=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 ol extends sl{constructor(t){super($e({style:ol.defaultStyleProps},t))}getLabelStyle(t){if(!t.label||!t.d||t.d.length===0)return!1;const e=Se(this.getGraphicStyle(t),"label"),{maxWidth:n,offsetX:i,offsetY:a,autoRotate:s,placement:o,closeToPath:l}=e,c=Z9(e,["maxWidth","offsetX","offsetY","autoRotate","placement","closeToPath"]),u=this.shapeMap.key,h=u==null?void 0:u.getRenderBounds();return Object.assign(K9(h,o,i,a,l,t.d,s),{wordWrapWidth:PT(h,n)},c)}getKeyStyle(t){return this.getGraphicStyle(t)}render(t,e){this.upsert("key",Tn,this.getKeyStyle(t),e),this.upsert("label",na,this.getLabelStyle(t),e)}}ol.defaultStyleProps={label:!0,labelPlacement:"bottom",labelCloseToPath:!0,labelAutoRotate:!0,labelOffsetX:0,labelOffsetY:0};function J9(r){const t=[],e=n=>{n!=null&&n.children.length&&n.children.forEach(i=>{t.push(i),e(i)})};return e(r),t}function Q9(r){const t=[];let e=r.parentNode;for(;e;)t.push(e),e=e.parentNode;return t}let M1=class extends rl{constructor(t){super(t),this.onMounted=()=>{this.handleRadius()},this.onAttrModified=()=>{this.handleRadius()},hs=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 Be({style:o});this.style.clipPath=l}}else e&&(this.style.clipPath=null)}};const sy=new WeakMap;let hs=null;const C1=r=>{if(hs&&Q9(hs).includes(r)){const t=sy.get(r);t?t.includes(hs)||t.push(hs):sy.set(r,[hs])}},T1=r=>{const t=sy.get(r);t&&t.forEach(e=>e.handleRadius())};class RT extends sl{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()?M1:Qi,this.getIconStyle(t),e)}}class LT extends sl{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 rc=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 Xn extends LT{constructor(t){super($e({style:Xn.defaultStyleProps},t)),this.type="node"}getSize(t=this.attributes){const{size:e}=t;return Nn(e)}getKeyStyle(t){const e=this.getGraphicStyle(t);return Object.assign(TT(e,["label","halo","icon","badge","port"]))}getLabelStyle(t){if(t.label===!1||!t.labelText)return!1;const e=Se(this.getGraphicStyle(t),"label"),{placement:n,maxWidth:i,offsetX:a,offsetY:s}=e,o=rc(e,["placement","maxWidth","offsetX","offsetY"]),l=this.getShape("key").getLocalBounds();return Object.assign(aw(l,n,a,s),{wordWrapWidth:PT(l,i)},o)}getHaloStyle(t){if(t.halo===!1)return!1;const e=this.getKeyStyle(t),{fill:n}=e,i=rc(e,["fill"]),a=Se(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=Se(this.getGraphicStyle(t),"icon");return Object.assign(G9(t.size,e),e)}getBadgesStyle(t){var e;const n=ay(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=rc(t,["badges","badgePalette","opacity"]),c=OT(s),u=Se(this.getGraphicStyle(l),"badge");return a.forEach((h,d)=>{i[d]=Object.assign(Object.assign({backgroundFill:c?c[d%(c==null?void 0:c.length)]:void 0,opacity:o},u),this.getBadgeStyle(h))}),i}getBadgeStyle(t){const e=this.getShape("key"),{placement:n="top",offsetX:i,offsetY:a}=t,s=rc(t,["placement","offsetX","offsetY"]),o=aw(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=Se(this.getGraphicStyle(t),"port"),{ports:s=[]}=t;return s.forEach((o,l)=>{const c=o.key||l,u=Object.assign(Object.assign({},a),o);if(eO(u))i[c]=!1;else{const[h,d]=this.getPortXY(t,o);i[c]=Object.assign({transform:[["translate",h,d]]},u)}}),i}getPortXY(t,e){const{placement:n="left"}=e,i=this.getShape("key");return R1(t7(this.context,i),n)}getPorts(){return ay(this.shapeMap,"port-")}getCenter(){return this.getShape("key").getBounds().center}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return N9(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",RT,n,e),C1(this)}drawBadgeShapes(t,e){const n=this.getBadgesStyle(t);Object.keys(n).forEach(i=>{const a=n[i];this.upsert(`badge-${i}`,ei,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,li,a,e)})}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",na,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)&&T1(this)}onframe(){this.drawBadgeShapes(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this)}}Xn.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 t7(r,t){if(!r)return t.getLocalBounds();const e=r.canvas.getLayer(),n=t.cloneNode();Ba(n,"hidden"),e.appendChild(n);const i=n.getLocalBounds();return n.destroy(),i}let ll=class DT extends Xn{constructor(t){super($e({style:DT.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",li,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*ii;return e?Object.assign({width:i,height:i},e):!1}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return Xu(t,n,e)}};ll.defaultStyleProps={size:32};class Zu extends Xn{constructor(t){super(t)}get parsedAttributes(){return this.attributes}drawKeyShape(t,e){return this.upsert("key",Va,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 kT(t,s,a,!0,e).point}}class e7 extends Zu{constructor(t){super(t)}getPoints(t){const[e,n]=this.getSize(t);return BF(e,n)}}var n7=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 Ju extends ll{constructor(t){super($e({style:Ju.defaultStyleProps},t))}parseOuterR(){const{size:t}=this.parsedAttributes;return Math.min(...Nn(t))/2}parseInnerR(){const{innerR:t}=this.parsedAttributes;return Tt(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=>nt(h)?{value:h}:h),a=Se(this.getGraphicStyle(t),"donut"),s=OT(t.donutPalette);if(!s)return;const o=i.reduce((h,d)=>{var f;return h+((f=d.value)!==null&&f!==void 0?f:0)},0),l=this.parseOuterR(),c=this.parseInnerR();let u=0;i.forEach((h,d)=>{const{value:f=0,color:g=s[d%s.length]}=h,v=n7(h,["value","color"]),p=(o===0?1/i.length:f/o)*360;this.upsert(`round${d}`,Tn,Object.assign(Object.assign(Object.assign({},a),{d:a7(l,c,u,u+p),fill:g}),v),e),u+=p})}render(t,e=this){super.render(t,e),this.drawDonutShape(t,e)}}Ju.defaultStyleProps={innerR:"50%",donuts:[],donutPalette:"tableau"};const ic=(r,t,e,n)=>[r+Math.sin(n)*e,t-Math.cos(n)*e],r7=(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"]],i7=(r,t,e,n,i,a)=>{const[s,o]=[i/360*2*Math.PI,a/360*2*Math.PI],l=[ic(r,t,n,s),ic(r,t,e,s),ic(r,t,e,o),ic(r,t,n,o)],c=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,c,1,l[2][0],l[2][1]],["L",l[3][0],l[3][1]],["A",n,n,0,c,0,l[0][0],l[0][1]],["Z"]]},a7=(r=0,t=0,e,n)=>{const[i,a]=[0,0];return Math.abs(e-n)%360<1e-6?r7(i,a,r,t):i7(i,a,r,t,e,n)};class Qu extends Xn{constructor(t){super($e({style:Qu.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",el,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*ii;return e?Object.assign({width:a,height:a},e):!1}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return Xu(t,n,e)}}Qu.defaultStyleProps={size:[45,35]};class s7 extends Zu{constructor(t){super(t)}getOuterR(t){return t.outerR||Math.min(...this.getSize(t))/2}getPoints(t){return jF(this.getOuterR(t))}getIconStyle(t){const e=super.getIconStyle(t),n=this.getOuterR(t)*ii;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 o7(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 l7(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,c=s>o?1:s/o,u=s>o?o/s:1;r.save(),r.scale(c,u),r.arc(n,a,l,0,Math.PI*2)}}function c7(r,t){var e=t.x1,n=t.y1,i=t.x2,a=t.y2,s=t.markerStart,o=t.markerEnd,l=t.markerStartOffset,c=t.markerEndOffset,u=0,h=0,d=0,f=0,g=0,v,p;s&&Ct(s)&&l&&(v=i-e,p=a-n,g=Math.atan2(p,v),u=Math.cos(g)*(l||0),h=Math.sin(g)*(l||0)),o&&Ct(o)&&c&&(v=e-i,p=n-a,g=Math.atan2(p,v),d=Math.cos(g)*(c||0),f=Math.sin(g)*(c||0)),r.moveTo(e+u,n+h),r.lineTo(i+d,a+f)}function u7(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.d,o=s.absolutePath,l=s.segments,c=0,u=0,h=0,d=0,f=0,g,v;if(e&&Ct(e)&&i){var p=e.parentNode.getStartTangent(),m=dt(p,2),y=m[0],b=m[1];g=y[0]-b[0],v=y[1]-b[1],f=Math.atan2(v,g),c=Math.cos(f)*(i||0),u=Math.sin(f)*(i||0)}if(n&&Ct(n)&&a){var w=n.parentNode.getEndTangent(),x=dt(w,2),S=x[0],E=x[1];g=S[0]-E[0],v=S[1]-E[1],f=Math.atan2(v,g),h=Math.cos(f)*(a||0),d=Math.sin(f)*(a||0)}for(var _=0;_<o.length;_++){var C=o[_],k=C[0],M=o[_+1],T=_===0&&(c!==0||u!==0),O=(_===o.length-1||M&&(M[0]==="M"||M[0]==="Z"))&&h!==0&&d!==0,R=T?[c,u]:[0,0],D=dt(R,2),L=D[0],P=D[1],A=O?[h,d]:[0,0],I=dt(A,2),B=I[0],j=I[1];switch(k){case"M":r.moveTo(C[1]+L,C[2]+P);break;case"L":r.lineTo(C[1]+B,C[2]+j);break;case"Q":r.quadraticCurveTo(C[1],C[2],C[3]+B,C[4]+j);break;case"C":r.bezierCurveTo(C[1],C[2],C[3],C[4],C[5]+B,C[6]+j);break;case"A":{var G=l[_].arcParams,H=G.cx,Y=G.cy,K=G.rx,tt=G.ry,it=G.startAngle,_t=G.endAngle,Mt=G.xRotation,re=G.sweepFlag;if(r.ellipse)r.ellipse(H,Y,K,tt,Mt,it,_t,!!(1-re));else{var Re=K>tt?K:tt,Le=K>tt?1:K/tt,cn=K>tt?tt/K:1;r.translate(H,Y),r.rotate(Mt),r.scale(Le,cn),r.arc(0,0,Re,it,_t,!!(1-re)),r.scale(1/Le,1/cn),r.rotate(-Mt),r.translate(-H,-Y)}O&&r.lineTo(C[6]+h,C[7]+d);break}case"Z":r.closePath();break}}}function h7(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],c=s[0][1],u=s[o-1][0],h=s[o-1][1],d=0,f=0,g=0,v=0,p=0,m,y;e&&Ct(e)&&i&&(m=s[1][0]-s[0][0],y=s[1][1]-s[0][1],p=Math.atan2(y,m),d=Math.cos(p)*(i||0),f=Math.sin(p)*(i||0)),n&&Ct(n)&&a&&(m=s[o-1][0]-s[0][0],y=s[o-1][1]-s[0][1],p=Math.atan2(y,m),g=Math.cos(p)*(a||0),v=Math.sin(p)*(a||0)),r.moveTo(l+(d||g),c+(f||v));for(var b=1;b<o-1;b++){var w=s[b];r.lineTo(w[0],w[1])}r.lineTo(u,h)}function d7(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],c=s[0][1],u=s[o-1][0],h=s[o-1][1],d=0,f=0,g=0,v=0,p=0,m,y;e&&Ct(e)&&i&&(m=s[1][0]-s[0][0],y=s[1][1]-s[0][1],p=Math.atan2(y,m),d=Math.cos(p)*(i||0),f=Math.sin(p)*(i||0)),n&&Ct(n)&&a&&(m=s[o-2][0]-s[o-1][0],y=s[o-2][1]-s[o-1][1],p=Math.atan2(y,m),g=Math.cos(p)*(a||0),v=Math.sin(p)*(a||0)),r.moveTo(l+d,c+f);for(var b=1;b<o-1;b++){var w=s[b];r.lineTo(w[0],w[1])}r.lineTo(u+g,h+v)}function f7(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,c=o,u=l,h=s&&s.some(function(x){return x!==0});if(!h)r.rect(n,a,c,u);else{var d=o>0?1:-1,f=l>0?1:-1,g=d+f===0,v=s.map(function(x){return ce(x,0,Math.min(Math.abs(c)/2,Math.abs(u)/2))}),p=dt(v,4),m=p[0],y=p[1],b=p[2],w=p[3];r.moveTo(d*m+n,a),r.lineTo(c-d*y+n,a),y!==0&&r.arc(c-d*y+n,f*y+a,y,-f*Math.PI/2,d>0?0:Math.PI,g),r.lineTo(c+n,u-f*b+a),b!==0&&r.arc(c-d*b+n,u-f*b+a,b,d>0?0:Math.PI,f>0?Math.PI/2:1.5*Math.PI,g),r.lineTo(d*w+n,u+a),w!==0&&r.arc(d*w+n,u-f*w+a,w,f>0?Math.PI/2:-Math.PI/2,d>0?Math.PI:0,g),r.lineTo(n,f*m+a),m!==0&&r.arc(d*m+n,f*m+a,m,d>0?Math.PI:0,f>0?Math.PI*1.5:Math.PI/2,g)}}var g7=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=mt(this,t,[].concat(i)),e.name="canvas-path-generator",e}return pt(t,r),W(t,[{key:"init",value:function(){var n,i=(n={},rt(rt(rt(rt(rt(rt(rt(rt(rt(rt(n,$.CIRCLE,o7),$.ELLIPSE,l7),$.RECT,f7),$.LINE,c7),$.POLYLINE,d7),$.POLYGON,h7),$.PATH,u7),$.TEXT,void 0),$.GROUP,void 0),$.IMAGE,void 0),rt(rt(rt(n,$.HTML,void 0),$.MESH,void 0),$.FRAGMENT,void 0));this.context.pathGeneratorFactory=i}},{key:"destroy",value:function(){delete this.context.pathGeneratorFactory}}])}(Ji);/*!
- * @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 v7=St(),p7=St(),m7=St(),y7=Wt(),IT=function(){function r(){var t=this;V(this,r),this.isHit=function(e,n,i,a){var s=t.context.pointInPathPickerFactory[e.nodeName];if(s){var o=xr(y7,i),l=Qe(p7,Ze(m7,n[0],n[1],0),o);if(s(e,new qe(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 W(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 c=Gi(We().mark(function u(h){return We().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return f.abrupt("return",a.pick(l,h));case 1:case"end":return f.stop()}},u)}));return function(u){return c.apply(this,arguments)}}()),s.hooks.pickSync.tap(r.tag,function(c){return a.pick(l,c)})}},{key:"pick",value:function(e,n){var i=n.topmost,a=n.position,s=a.x,o=a.y,l=Ze(v7,s,o,0),c=e.elementsFromBBox(l[0],l[1],l[0],l[1]),u=[],h=ma(c),d;try{for(h.s();!(d=h.n()).done;){var f=d.value,g=f.getWorldTransform(),v=this.isHit(f,l,g,!1);if(v){var p=BC(f);if(p){var m=p.parsedStyle.clipPath,y=this.isHit(m,l,m.getWorldTransform(),!0);if(y){if(i)return n.picked=[f],n;u.push(f)}}else{if(i)return n.picked=[f],n;u.push(f)}}}}catch(b){h.e(b)}finally{h.f()}return n.picked=u,n}}])}();IT.tag="CanvasPicker";function b7(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,c=n.fill,u=n.stroke,h=n.lineWidth,d=h===void 0?1:h,f=n.increasedLineWidthForHitTesting,g=f===void 0?0:f,v=n.pointerEvents,p=v===void 0?"auto":v,m=(d+g)/2,y=Qr(a,o,t.x,t.y),b=Wa(p,c,u),w=dt(b,2),x=w[0],S=w[1];return x&&S||e?y<=l+m:x?y<=l:S?y>=l-m&&y<=l+m:!1}function ac(r,t,e,n){return r/(e*e)+t/(n*n)}function w7(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,c=n.ry,u=n.fill,h=n.stroke,d=n.lineWidth,f=d===void 0?1:d,g=n.increasedLineWidthForHitTesting,v=g===void 0?0:g,p=n.pointerEvents,m=p===void 0?"auto":p,y=t.x,b=t.y,w=Wa(m,u,h),x=dt(w,2),S=x[0],E=x[1],_=(f+v)/2,C=(y-a)*(y-a),k=(b-o)*(b-o);return S&&E||e?ac(C,k,l+_,c+_)<=1:S?ac(C,k,l,c)<=1:E?ac(C,k,l-_,c-_)>=1&&ac(C,k,l+_,c+_)<=1:!1}function xa(r,t,e,n,i,a){return i>=r&&i<=r+e&&a>=t&&a<=t+n}function x7(r,t,e,n,i,a,s){var o=i/2;return xa(r-o,t-o,e,i,a,s)||xa(r+e-o,t-o,i,n,a,s)||xa(r+o,t+n-o,e,i,a,s)||xa(r-o,t+o,i,n,a,s)}function sc(r,t,e,n,i,a,s,o){var l=(Math.atan2(o-t,s-r)+Math.PI*2)%(Math.PI*2),c={x:r+e*Math.cos(l),y:t+e*Math.sin(l)};return Qr(c.x,c.y,s,o)<=a/2}function Ni(r,t,e,n,i,a,s){var o=Math.min(r,e),l=Math.max(r,e),c=Math.min(t,n),u=Math.max(t,n),h=i/2;return a>=o-h&&a<=l+h&&s>=c-h&&s<=u+h?hD(r,t,e,n,a,s)<=i/2:!1}function FT(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],c=r[s+1][0],u=r[s+1][1];if(Ni(o,l,c,u,t,e,n))return!0}if(i){var h=r[0],d=r[a-1];if(Ni(h[0],h[1],d[0],d[1],t,e,n))return!0}return!1}var E7=1e-6;function sf(r){return Math.abs(r)<E7?0:r<0?-1:1}function S7(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 BT(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(S7(s,o,[t,e]))return!0;sf(s[1]-e)>0!=sf(o[1]-e)>0&&sf(t-(e-s[1])*(s[0]-o[0])/(s[1]-o[1])-s[0])<0&&(n=!n)}return n}function Wb(r,t,e){for(var n=!1,i=0;i<r.length;i++){var a=r[i];if(n=BT(a,t,e),n)break}return n}function _7(r,t,e){var n=r.parsedStyle,i=n.x1,a=n.y1,s=n.x2,o=n.y2,l=n.lineWidth,c=l===void 0?1:l,u=n.increasedLineWidthForHitTesting,h=u===void 0?0:u,d=n.pointerEvents,f=d===void 0?"auto":d,g=n.fill,v=n.stroke,p=Wa(f,g,v),m=dt(p,2),y=m[1];return!y&&!e||!c?!1:Ni(i,a,s,o,c+h,t.x,t.y)}function k7(r,t,e,n,i){for(var a=!1,s=t/2,o=0;o<r.length;o++){var l=r[o],c=l.currentPoint,u=l.params,h=l.prePoint,d=l.box;if(!(d&&!xa(d.x-s,d.y-s,d.width+t,d.height+t,e,n)))switch(l.command){case"L":case"Z":if(a=Ni(h[0],h[1],c[0],c[1],t,e,n),a)return!0;break;case"Q":var f=yD(h[0],h[1],u[1],u[2],u[3],u[4],e,n);if(a=f<=t/2,a)return!0;break;case"C":var g=U2(h[0],h[1],u[1],u[2],u[3],u[4],u[5],u[6],e,n,i);if(a=g<=t/2,a)return!0;break;case"A":l.cubicParams||(l.cubicParams=a1(h[0],h[1],u[1],u[2],u[3],u[4],u[5],u[6],u[7],void 0));for(var v=l.cubicParams,p=h,m=0;m<v.length;m+=6){var y=U2(p[0],p[1],v[m],v[m+1],v[m+2],v[m+3],v[m+4],v[m+5],e,n,i);if(p=[v[m+4],v[m+5]],a=y<=t/2,a)return!0}break}}return a}function M7(r,t,e,n,i,a){var s=r.parsedStyle,o=s.lineWidth,l=o===void 0?1:o,c=s.increasedLineWidthForHitTesting,u=c===void 0?0:c,h=s.stroke,d=s.fill,f=s.d,g=s.pointerEvents,v=g===void 0?"auto":g,p=f.segments,m=f.hasArc,y=f.polylines,b=f.polygons,w=Wa(v,(b==null?void 0:b.length)&&d,h),x=dt(w,2),S=x[0],E=x[1],_=Xm(r),C=!1;return S||e?(m?C=n(r,t):C=Wb(b,t.x,t.y)||Wb(y,t.x,t.y),C):((E||e)&&(C=k7(p,l+u,t.x,t.y,_)),C)}function C7(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,c=l===void 0?0:l,u=n.points,h=n.pointerEvents,d=h===void 0?"auto":h,f=Wa(d,a,i),g=dt(f,2),v=g[0],p=g[1],m=!1;return(p||e)&&(m=FT(u.points,o+c,t.x,t.y,!0)),!m&&(v||e)&&(m=BT(u.points,t.x,t.y)),m}function T7(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,c=n.pointerEvents,u=c===void 0?"auto":c,h=n.fill,d=n.stroke,f=Wa(u,h,d),g=dt(f,2),v=g[1];return!v&&!e||!a?!1:FT(l.points,a+o,t.x,t.y,!1)}function O7(r,t,e,n,i){var a=r.parsedStyle,s=a.radius,o=a.fill,l=a.stroke,c=a.lineWidth,u=c===void 0?1:c,h=a.increasedLineWidthForHitTesting,d=h===void 0?0:h,f=a.x,g=f===void 0?0:f,v=a.y,p=v===void 0?0:v,m=a.width,y=a.height,b=a.pointerEvents,w=b===void 0?"auto":b,x=Wa(w,o,l),S=dt(x,2),E=S[0],_=S[1],C=s&&s.some(function(O){return O!==0}),k=u+d;if(C){var T=!1;return(_||e)&&(T=A7(g,p,m,y,s.map(function(O){return ce(O,0,Math.min(Math.abs(m)/2,Math.abs(y)/2))}),k,t.x,t.y)),!T&&(E||e)&&(T=n(r,t)),T}else{var M=k/2;if(E&&_||e)return xa(g-M,p-M,m+M,y+M,t.x,t.y);if(E)return xa(g,p,m,y,t.x,t.y);if(_)return x7(g,p,m,y,k,t.x,t.y)}return!1}function A7(r,t,e,n,i,a,s,o){var l=dt(i,4),c=l[0],u=l[1],h=l[2],d=l[3];return Ni(r+c,t,r+e-u,t,a,s,o)||Ni(r+e,t+u,r+e,t+n-h,a,s,o)||Ni(r+e-h,t+n,r+d,t+n,a,s,o)||Ni(r,t+n-d,r,t+c,a,s,o)||sc(r+e-u,t+u,u,1.5*Math.PI,2*Math.PI,a,s,o)||sc(r+e-h,t+n-h,h,0,.5*Math.PI,a,s,o)||sc(r+d,t+n-d,d,.5*Math.PI,Math.PI,a,s,o)||sc(r+c,t+c,c,Math.PI,1.5*Math.PI,a,s,o)}function P7(r,t,e,n,i,a){var s=r.parsedStyle,o=s.pointerEvents,l=o===void 0?"auto":o,c=s.x,u=c===void 0?0:c,h=s.y,d=h===void 0?0:h,f=s.width,g=s.height;if(l==="non-transparent-pixel"){var v=i.config.offscreenCanvas,p=a.offscreenCanvasCreator.getOrCreateCanvas(v),m=a.offscreenCanvasCreator.getOrCreateContext(v,{willReadFrequently:!0});p.width=f,p.height=g,i.defaultStyleRendererFactory[$.IMAGE].render(m,vt(vt({},r.parsedStyle),{},{x:0,y:0}),r,void 0,void 0,void 0);var y=m.getImageData(t.x-u,t.y-d,1,1).data;return y.every(function(b){return b!==0})}return!0}function N7(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 R7=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=mt(this,t,[].concat(i)),e.name="canvas-picker",e}return pt(t,r),W(t,[{key:"init",value:function(){var n,i=(n={},rt(rt(rt(rt(rt(rt(rt(rt(rt(rt(n,$.CIRCLE,b7),$.ELLIPSE,w7),$.RECT,O7),$.LINE,_7),$.POLYLINE,T7),$.POLYGON,C7),$.PATH,M7),$.TEXT,N7),$.GROUP,null),$.IMAGE,P7),rt(rt(n,$.HTML,null),$.MESH,null));this.context.pointInPathPickerFactory=i,this.addRenderingPlugin(new IT)}},{key:"destroy",value:function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()}}])}(Ji);function pr(r,t){if(!{}.hasOwnProperty.call(r,t))throw new TypeError("attempted to use private field on non-instance");return r}var L7=0;function D7(r){return"__private_"+L7+++"_"+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 I7=function(){function r(){V(this,r),this.cacheStore=new Map}return W(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=vt(vt({},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()}}])}(),of=[],lf=[],oy=function(){function r(){V(this,r)}return W(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;of.length<=0&&lf.length<=0||(lf.forEach(function(n){return n()}),lf=of.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,c=e.naturalHeight||e.height,u=n-s,h=i-s,d=Math.ceil(l/u),f=Math.ceil(c/h),g={tileSize:[n,i],gridSize:[f,d],tiles:Array(f).fill(null).map(function(){return Array(d).fill(null)})},v=function(y){for(var b=function(S){of.push(function(){var E=S*u,_=y*h,C=[Math.min(n,l-E),Math.min(i,c-_)],k=C[0],M=C[1],T=o.createCanvas();T.width=n,T.height=i;var O=T.getContext("2d");O.drawImage(e,E,_,k,M,0,0,k,M),g.tiles[y][S]={x:E,y:_,tileX:S,tileY:y,data:T},a()})},w=0;w<d;w++)b(w)},p=0;p<f;p++)v(p);return r.stop(),r.executeTask(),g}}])}();oy.TASK_NUM_PER_FRAME=10;var En=new I7;En.onRefAdded=function(t){var e=this;t.addEventListener(xt.DESTROY,function(){e.releaseRef(t)},{once:!0})};var O1=function(){function r(t,e){V(this,r),this.gradientCache={},this.patternCache={},this.context=t,this.runtime=e}return W(r,[{key:"getImageSync",value:function(e,n,i){var a=Tt(e)?e:e.src;if(En.has(a)){var s=En.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=Tt(e)?e:e.src;if(!Tt(e)&&!En.has(a)){var s={img:e,size:[e.naturalWidth||e.width,e.naturalHeight||e.height],tileSize:oc(e)};En.put(a,s,n)}if(En.has(a)){var o=En.get(a,n);return o.img.complete?Promise.resolve(o):new Promise(function(l,c){o.img.addEventListener("load",function(){o.size=[o.img.naturalWidth||o.img.width,o.img.naturalHeight||o.img.height],o.tileSize=oc(o.img),l(o)}),o.img.addEventListener("error",function(u){c(u)})})}return new Promise(function(l,c){var u=i.context.config.createImage();if(u){var h={img:u,size:[0,0],tileSize:oc(u)};En.put(a,h,n),u.onload=function(){h.size=[u.naturalWidth||u.width,u.naturalHeight||u.height],h.tileSize=oc(h.img),l(h)},u.onerror=function(d){c(d)},u.crossOrigin="Anonymous",u.src=a}})}},{key:"createDownSampledImage",value:function(){var t=Gi(We().mark(function n(i,a){var s,o,l,c,u,h,d,f,g,v,p,m,y,b;return We().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:return x.next=2,this.getOrCreateImage(i,a);case 2:if(s=x.sent,!(typeof s.downSamplingRate<"u")){x.next=5;break}return x.abrupt("return",s);case 5:if(o=this.context.config.enableLargeImageOptimization,l=typeof o=="boolean"?{}:o,c=l.maxDownSampledImageSize,u=c===void 0?2048:c,h=l.downSamplingRateThreshold,d=h===void 0?.5:h,f=this.runtime.globalThis.createImageBitmap,g=dt(s.size,2),v=g[0],p=g[1],m=s.img,y=Math.min((u+u)/(v+p),Math.max(.01,Math.min(d,.5))),b=vt(vt({},s),{},{downSamplingRate:y}),En.update(s.img.src,b,a),!f){x.next=25;break}return x.prev=14,x.next=17,f(s.img,{resizeWidth:v*y,resizeHeight:p*y});case 17:m=x.sent,x.next=23;break;case 20:x.prev=20,x.t0=x.catch(14),y=1;case 23:x.next=26;break;case 25:y=1;case 26:return b=vt(vt({},this.getImageSync(i,a)),{},{downSampled:m,downSamplingRate:y}),En.update(s.img.src,b,a),x.abrupt("return",b);case 29:case"end":return x.stop()}},n,this,[[14,20]])}));function e(n,i){return t.apply(this,arguments)}return e}()},{key:"createImageTiles",value:function(){var t=Gi(We().mark(function n(i,a,s,o){var l,c,u,h,d;return We().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return g.next=2,this.getOrCreateImage(i,o);case 2:return l=g.sent,c=o.ownerDocument.defaultView,u=c.requestAnimationFrame,h=c.cancelAnimationFrame,oy.api={requestAnimationFrame:u,cancelAnimationFrame:h,createCanvas:function(){return f1.createCanvas()}},d=vt(vt({},l),oy.sliceImage(l.img,l.tileSize[0],l.tileSize[0],s)),En.update(l.img.src,d,o),g.abrupt("return",d);case 8:case"end":return g.stop()}},n,this)}));function e(n,i,a,s){return t.apply(this,arguments)}return e}()},{key:"releaseImage",value:function(e,n){En.release(Tt(e)?e:e.src,n)}},{key:"releaseImageRef",value:function(e){En.releaseRef(e)}},{key:"getOrCreatePatternSync",value:function(e,n,i,a,s,o,l){var c=this.generatePatternKey(n);if(c&&this.patternCache[c])return this.patternCache[c];var u=n.image,h=n.repetition,d=n.transform,f,g=!1;if(Tt(u)){var v=this.getImageSync(u,e,l);f=v==null?void 0:v.img}else a?(f=a,g=!0):f=u;var p=f&&i.createPattern(f,h);if(p){var m;d?m=GC(LC(d),new Zt({})):m=Wi(Wt()),g&&BM(m,m,[1/s,1/s,1]),p.setTransform({a:m[0],b:m[1],c:m[4],d:m[5],e:m[12]+o[0],f:m[13]+o[1]})}return c&&p&&(this.patternCache[c]=p),p}},{key:"getOrCreateGradient",value:function(e,n){var i=this.generateGradientKey(e),a=e.type,s=e.steps,o=e.min,l=e.width,c=e.height,u=e.angle,h=e.cx,d=e.cy,f=e.size;if(this.gradientCache[i])return this.gradientCache[i];var g=null;if(a===Oi.LinearGradient){var v=fI(o,l,c,u),p=v.x1,m=v.y1,y=v.x2,b=v.y2;g=n.createLinearGradient(p,m,y,b)}else if(a===Oi.RadialGradient){var w=gI(o,l,c,h,d,f),x=w.x,S=w.y,E=w.r;g=n.createRadialGradient(x,S,0,x,S,E)}return g&&(s.forEach(function(_){var C=_.offset,k=_.color;if(C.unit===J.kPercentage){var M;(M=g)===null||M===void 0||M.addColorStop(C.value/100,k.toString())}}),this.gradientCache[i]=g),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,c=e.cx,u=e.cy,h=e.size;return"gradient-".concat(n,"-").concat((l==null?void 0:l.toString())||0,"-").concat((c==null?void 0:c.toString())||0,"-").concat((u==null?void 0:u.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 f=d.offset,g=d.color;return"".concat(f).concat(g)}).join("-"))}},{key:"generatePatternKey",value:function(e){var n=e.image,i=e.repetition;if(Tt(n))return"pattern-".concat(n,"-").concat(i);if(n.nodeName==="rect")return"pattern-".concat(n.entity,"-").concat(i)}}])}();O1.isSupportTile=!!f1.createCanvas();function oc(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 zT=function(){function r(){V(this,r)}return W(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,f){var g=h.parsedStyle,v=g.width,p=g.height;v&&!p?h.setAttribute("height",f/d*v):!v&&p&&h.setAttribute("width",d/f*p)},l=function(h){var d=h.target,f=d.nodeName,g=d.attributes;if(f===$.IMAGE){var v=g.src,p=g.keepAspectRatio;a.getImageSync(v,d,function(m){var y=m.img,b=y.width,w=y.height;p&&o(d,b,w),d.renderable.dirty=!0,n.dirtify()})}},c=function(h){var d=h.target,f=h.attrName,g=h.prevValue,v=h.newValue;d.nodeName!==$.IMAGE||f!=="src"||(g!==v&&a.releaseImage(g,d),Tt(v)&&a.getOrCreateImage(v,d).then(function(p){var m=p.img,y=m.width,b=m.height;d.attributes.keepAspectRatio&&o(d,y,b),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,c)}),n.hooks.destroy.tap(r.tag,function(){s.removeEventListener(xt.MOUNTED,l),s.removeEventListener(xt.ATTR_MODIFIED,c)})}}])}();zT.tag="LoadImage";var F7=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=mt(this,t,[].concat(i)),e.name="image-loader",e}return pt(t,r),W(t,[{key:"init",value:function(n){this.context.imagePool=new O1(this.context,n),this.addRenderingPlugin(new zT)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(Ji);/*!
- * @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 ve=D7("renderState"),$T=function(){function r(t){V(this,r),this.removedRBushNodeAABBs=[],this.renderQueue=[],Object.defineProperty(this,ve,{writable:!0,value:{restoreStack:[],prevObject:null,currentContext:new Map}}),this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=Wt(),this.dprMatrix=Wt(),this.tmpMat4=Wt(),this.vec3a=St(),this.vec3b=St(),this.vec3c=St(),this.vec3d=St(),this.canvasRendererPluginOptions=t}return W(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,c=a.renderingContext,u=a.rBushRoot,h=a.pathGeneratorFactory,d=s.renderer.getConfig().enableRenderingOptimization;s.renderer.getConfig().enableDirtyCheck=!1,s.renderer.getConfig().enableDirtyRectangleRendering=!1,this.rBush=u,this.pathGeneratorFactory=h;var f=e.contextService,g=c.root.ownerDocument.defaultView,v=function(b){var w=b.target,x=w.rBushNode;x.aabb&&i.removedRBushNodeAABBs.push(x.aabb)},p=function(b){var w=b.target,x=w.rBushNode;x.aabb&&i.removedRBushNodeAABBs.push(x.aabb)};l.hooks.init.tap(r.tag,function(){g.addEventListener(xt.UNMOUNTED,v),g.addEventListener(xt.CULLED,p);var y=f.getDPR(),b=s.width,w=s.height,x=f.getContext();i.clearRect(x,0,0,b*y,w*y,s.background)}),l.hooks.destroy.tap(r.tag,function(){g.removeEventListener(xt.UNMOUNTED,v),g.removeEventListener(xt.CULLED,p),i.renderQueue=[],i.removedRBushNodeAABBs=[],pr(i,ve)[ve]={restoreStack:[],prevObject:null,currentContext:null}}),l.hooks.beginFrame.tap(r.tag,function(){var y,b=f.getContext(),w=f.getDPR(),x=s.width,S=s.height,E=i.canvasRendererPluginOptions,_=E.dirtyObjectNumThreshold,C=E.dirtyObjectRatioThreshold,k=l.getStats(),M=k.total,T=k.rendered,O=T/M;i.clearFullScreen=i.clearFullScreenLastFrame||!((y=g.context.renderingPlugins[1])!==null&&y!==void 0&&y.isFirstTimeRenderingFinished)||l.disableDirtyRectangleRendering()||T>_&&O>C,b&&(typeof b.resetTransform=="function"?b.resetTransform():b.setTransform(1,0,0,1,0,0),i.clearFullScreen&&i.clearRect(b,0,0,x*w,S*w,s.background))});var m=function(b,w){for(var x=[b];x.length>0;){var S=x.pop();S.isVisible()&&!S.isCulled()&&(d?i.renderDisplayObjectOptimized(S,w,i.context,pr(i,ve)[ve],n):i.renderDisplayObject(S,w,i.context,pr(i,ve)[ve],n));for(var E=S.sortable.sorted||S.childNodes,_=E.length-1;_>=0;_--)x.push(E[_])}};l.hooks.endFrame.tap(r.tag,function(){if(c.root.childNodes.length===0){i.clearFullScreenLastFrame=!0;return}d=s.renderer.getConfig().enableRenderingOptimization,pr(i,ve)[ve]={restoreStack:[],prevObject:null,currentContext:pr(i,ve)[ve].currentContext},pr(i,ve)[ve].currentContext.clear(),i.clearFullScreenLastFrame=!1;var y=f.getContext(),b=f.getDPR();if(pa(i.dprMatrix,[b,b,1]),Je(i.vpMatrix,i.dprMatrix,o.getOrthoMatrix()),i.clearFullScreen)d?(y.save(),m(c.root,y),y.restore()):m(c.root,y),i.removedRBushNodeAABBs=[];else{var w=i.safeMergeAABB.apply(i,[i.mergeDirtyAABBs(i.renderQueue)].concat(Ut(i.removedRBushNodeAABBs.map(function(K){var tt=K.minX,it=K.minY,_t=K.maxX,Mt=K.maxY,re=new Vt;return re.setMinMax([tt,it,0],[_t,Mt,0]),re}))));if(i.removedRBushNodeAABBs=[],Vt.isEmpty(w)){i.renderQueue=[];return}var x=i.convertAABB2Rect(w),S=x.x,E=x.y,_=x.width,C=x.height,k=Qe(i.vec3a,[S,E,0],i.vpMatrix),M=Qe(i.vec3b,[S+_,E,0],i.vpMatrix),T=Qe(i.vec3c,[S,E+C,0],i.vpMatrix),O=Qe(i.vec3d,[S+_,E+C,0],i.vpMatrix),R=Math.min(k[0],M[0],O[0],T[0]),D=Math.min(k[1],M[1],O[1],T[1]),L=Math.max(k[0],M[0],O[0],T[0]),P=Math.max(k[1],M[1],O[1],T[1]),A=Math.floor(R),I=Math.floor(D),B=Math.ceil(L-R),j=Math.ceil(P-D);y.save(),i.clearRect(y,A,I,B,j,s.background),y.beginPath(),y.rect(A,I,B,j),y.clip(),y.setTransform(i.vpMatrix[0],i.vpMatrix[1],i.vpMatrix[4],i.vpMatrix[5],i.vpMatrix[12],i.vpMatrix[13]);var G=s.renderer.getConfig(),H=G.enableDirtyRectangleRenderingDebug;H&&g.dispatchEvent(new we(Mn.DIRTY_RECTANGLE,{dirtyRect:{x:A,y:I,width:B,height:j}}));var Y=i.searchDirtyObjects(w);Y.sort(function(K,tt){return K.sortable.renderOrder-tt.sortable.renderOrder}).forEach(function(K){K&&K.isVisible()&&!K.isCulled()&&i.renderDisplayObject(K,y,i.context,pr(i,ve)[ve],n)}),y.restore(),i.renderQueue.forEach(function(K){i.saveDirtyAABB(K)}),i.renderQueue=[]}pr(i,ve)[ve].restoreStack.forEach(function(){y.restore()}),pr(i,ve)[ve].restoreStack=[]}),l.hooks.render.tap(r.tag,function(y){i.clearFullScreen||i.renderQueue.push(y)})}},{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,c=!1,u=this.context.styleRendererFactory[o],h=this.pathGeneratorFactory[o],d=e.parsedStyle.clipPath;if(d){l=!a.prevObject||!Pm(d.getWorldTransform(),a.prevObject.getWorldTransform()),l&&(this.applyWorldTransform(n,d),a.prevObject=null);var f=this.pathGeneratorFactory[d.nodeName];f&&(n.save(),c=!0,n.beginPath(),f(n,d.parsedStyle),n.closePath(),n.clip())}if(u){l=!a.prevObject||!Pm(e.getWorldTransform(),a.prevObject.getWorldTransform()),l&&this.applyWorldTransform(n,e);var g=!a.prevObject;if(!g){var v=a.prevObject.nodeName;o===$.TEXT?g=v!==$.TEXT:o===$.IMAGE?g=v!==$.IMAGE:g=v===$.TEXT||v===$.IMAGE}u.applyStyleToContext(n,e,g,a),a.prevObject=e}h&&(n.beginPath(),h(n,e.parsedStyle),o!==$.LINE&&o!==$.PATH&&o!==$.POLYLINE&&n.closePath()),u&&u.drawToContext(n,e,pr(this,ve)[ve],this,s),c&&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)&ie.DOCUMENT_POSITION_CONTAINS)&&(n.restore(),a.restoreStack.pop());var c=this.context.styleRendererFactory[o],u=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())}c&&(this.applyWorldTransform(n,e),n.save(),this.applyAttributesToContext(n,e)),u&&(n.beginPath(),u(n,e.parsedStyle),o!==$.LINE&&o!==$.PATH&&o!==$.POLYLINE&&n.closePath()),c&&(c.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,c=i.lineDashOffset;l&&e.setLineDash(l),ot(c)||(e.lineDashOffset=c),ot(o)||(e.globalAlpha*=o),!ot(a)&&!Array.isArray(a)&&!a.isNone&&(e.strokeStyle=n.attributes.stroke),!ot(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]),c=o-a,u=l-s;return{x:a,y:s,width:c,height:u}}},{key:"mergeDirtyAABBs",value:function(e){var n=new Vt;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=dt(n,2),a=i[0],s=i[1],o=e.getMax(),l=dt(o,2),c=l[0],u=l[1],h=this.rBush.search({minX:a,minY:s,maxX:c,maxY:u});return h.map(function(d){var f=d.displayObject;return f})}},{key:"saveDirtyAABB",value:function(e){var n=e.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new Vt);var i=e.getRenderBounds();i&&n.dirtyRenderBounds.update(i.center,i.halfExtents)}},{key:"applyWorldTransform",value:function(e,n,i){i?(Ms(this.tmpMat4,n.getLocalTransform()),Je(this.tmpMat4,i,this.tmpMat4),Je(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(Ms(this.tmpMat4,n.getWorldTransform()),Je(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 Vt,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}}])}();$T.tag="CanvasRenderer";function yu(r,t,e,n,i,a,s){var o,l;if(r.image.nodeName==="rect"){var c=r.image.parsedStyle,u=c.width,h=c.height;l=n.contextService.getDPR();var d=n.config.offscreenCanvas;o=a.offscreenCanvasCreator.getOrCreateCanvas(d),o.width=u*l,o.height=h*l;var f=a.offscreenCanvasCreator.getOrCreateContext(d),g={restoreStack:[],prevObject:null,currentContext:new Map};r.image.forEach(function(p){i.renderDisplayObject(p,f,n,g,a)}),g.restoreStack.forEach(function(){f.restore()})}var v=s.getOrCreatePatternSync(t,r,e,o,l,t.getGeometryBounds().min,function(){t.renderable.dirty=!0,n.renderingService.dirtify()});return v}function bu(r,t,e,n){var i;if(r.type===Oi.LinearGradient||r.type===Oi.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(vt(vt({type:r.type},r.value),{},{min:l,width:s,height:o}),e)}return i}var lc=["shadowBlur","shadowOffsetX","shadowOffsetY"],Vb=["lineCap","lineJoin","miterLimit"],be={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},Hb={};function se(r,t,e,n){var i=n.has(t)?n.get(t):be[t];return i!==e&&(t==="lineDash"?r.setLineDash(e):r[t]=e,n.set(t,e)),i}var B7=function(){function r(t){V(this,r),this.imagePool=t}return W(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?Hb:a.prevObject.parsedStyle,o=n.parsedStyle;(i||o.opacity!==s.opacity)&&se(e,"globalAlpha",ot(o.opacity)?be.globalAlpha:o.opacity,a.currentContext),(i||o.blend!==s.blend)&&se(e,"globalCompositeOperation",ot(o.blend)?be.globalCompositeOperation:o.blend,a.currentContext)}},{key:"applyStrokeFillStyleToContext",value:function(e,n,i,a){var s=i?Hb:a.prevObject.parsedStyle,o=n.parsedStyle,l=o.lineWidth,c=l===void 0?be.lineWidth:l,u=o.fill&&!o.fill.isNone,h=o.stroke&&!o.stroke.isNone&&c>0;if(h){if(i||n.attributes.stroke!==a.prevObject.attributes.stroke){var d=!ot(o.stroke)&&!Array.isArray(o.stroke)&&!o.stroke.isNone?n.attributes.stroke:be.strokeStyle;se(e,"strokeStyle",d,a.currentContext)}(i||o.lineWidth!==s.lineWidth)&&se(e,"lineWidth",ot(o.lineWidth)?be.lineWidth:o.lineWidth,a.currentContext),(i||o.lineDash!==s.lineDash)&&se(e,"lineDash",o.lineDash||be.lineDash,a.currentContext),(i||o.lineDashOffset!==s.lineDashOffset)&&se(e,"lineDashOffset",ot(o.lineDashOffset)?be.lineDashOffset:o.lineDashOffset,a.currentContext);for(var f=0;f<Vb.length;f++){var g=Vb[f];(i||o[g]!==s[g])&&se(e,g,ot(o[g])?be[g]:o[g],a.currentContext)}}if(u&&(i||n.attributes.fill!==a.prevObject.attributes.fill)){var v=!ot(o.fill)&&!Array.isArray(o.fill)&&!o.fill.isNone?n.attributes.fill:be.fillStyle;se(e,"fillStyle",v,a.currentContext)}}},{key:"applyStyleToContext",value:function(e,n,i,a){var s=n.nodeName;this.applyCommonStyleToContext(e,n,i,a),s===$.IMAGE||this.applyStrokeFillStyleToContext(e,n,i,a)}},{key:"applyShadowAndFilterStyleToContext",value:function(e,n,i,a){var s=n.parsedStyle;if(i){se(e,"shadowColor",s.shadowColor.toString(),a.currentContext);for(var o=0;o<lc.length;o++){var l=lc[o];se(e,l,s[l]||be[l],a.currentContext)}}s.filter&&s.filter.length&&se(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){se(e,"shadowColor",be.shadowColor,a.currentContext);for(var o=0;o<lc.length;o++){var l=lc[o];se(e,l,be[l],a.currentContext)}}if(i)if(n&&s){var c=e.filter;!ot(c)&&c.indexOf("drop-shadow")>-1&&se(e,"filter",c.replace(/drop-shadow\([^)]*\)/,"").trim()||be.filter,a.currentContext)}else se(e,"filter",be.filter,a.currentContext)}},{key:"fillToContext",value:function(e,n,i,a,s){var o=this,l=n.parsedStyle,c=l.fill,u=l.fillRule,h=null;if(Array.isArray(c)&&c.length>0)c.forEach(function(f){var g=se(e,"fillStyle",bu(f,n,e,o.imagePool),i.currentContext);h=h??g,u?e.fill(u):e.fill()});else{if(Ia(c)){var d=yu(c,n,e,n.ownerDocument.defaultView.context,a,s,this.imagePool);d&&(e.fillStyle=d,h=!0)}u?e.fill(u):e.fill()}h!==null&&se(e,"fillStyle",h,i.currentContext)}},{key:"strokeToContext",value:function(e,n,i,a,s){var o=this,l=n.parsedStyle.stroke,c=null;if(Array.isArray(l)&&l.length>0)l.forEach(function(d){var f=se(e,"strokeStyle",bu(d,n,e,o.imagePool),i.currentContext);c=c??f,e.stroke()});else{if(Ia(l)){var u=yu(l,n,e,n.ownerDocument.defaultView.context,a,s,this.imagePool);if(u){var h=se(e,"strokeStyle",u,i.currentContext);c=c??h}}e.stroke()}c!==null&&se(e,"strokeStyle",c,i.currentContext)}},{key:"drawToContext",value:function(e,n,i,a,s){var o,l=n.nodeName,c=n.parsedStyle,u=c.opacity,h=u===void 0?be.globalAlpha:u,d=c.fillOpacity,f=d===void 0?be.fillOpacity:d,g=c.strokeOpacity,v=g===void 0?be.strokeOpacity:g,p=c.lineWidth,m=p===void 0?be.lineWidth:p,y=c.fill&&!c.fill.isNone,b=c.stroke&&!c.stroke.isNone&&m>0;if(!(!y&&!b)){var w=!ot(c.shadowColor)&&c.shadowBlur>0,x=c.shadowType==="inner",S=((o=c.fill)===null||o===void 0?void 0:o.alpha)===0,E=!!(c.filter&&c.filter.length),_=w&&b&&(l===$.PATH||l===$.LINE||l===$.POLYLINE||S||x),C=null;if(y){_||this.applyShadowAndFilterStyleToContext(e,n,w,i);var k=h*f;C=se(e,"globalAlpha",k,i.currentContext),this.fillToContext(e,n,i,a,s),_||this.clearShadowAndFilterStyleForContext(e,w,E,i)}if(b){var M=!1,T=h*v,O=se(e,"globalAlpha",T,i.currentContext);if(C=y?C:O,_&&(this.applyShadowAndFilterStyleToContext(e,n,w,i),M=!0,x)){var R=e.globalCompositeOperation;e.globalCompositeOperation="source-atop",this.strokeToContext(e,n,i,a,s),e.globalCompositeOperation=R,this.clearShadowAndFilterStyleForContext(e,w,E,i,!0)}this.strokeToContext(e,n,i,a,s),M&&this.clearShadowAndFilterStyleForContext(e,w,E,i)}C!==null&&se(e,"globalAlpha",C,i.currentContext)}}}])}(),A1=function(r){function t(){return V(this,t),mt(this,t,arguments)}return pt(t,r),W(t,[{key:"render",value:function(n,i,a,s,o,l){var c=i.fill,u=i.fillRule,h=i.opacity,d=h===void 0?1:h,f=i.fillOpacity,g=f===void 0?1:f,v=i.stroke,p=i.strokeOpacity,m=p===void 0?1:p,y=i.lineWidth,b=y===void 0?1:y,w=i.lineCap,x=i.lineJoin,S=i.shadowType,E=i.shadowColor,_=i.shadowBlur,C=i.filter,k=i.miterLimit,M=c&&!c.isNone,T=v&&!v.isNone&&b>0,O=(c==null?void 0:c.alpha)===0,R=!!(C&&C.length),D=!ot(E)&&_>0,L=a.nodeName,P=S==="inner",A=T&&D&&(L===$.PATH||L===$.LINE||L===$.POLYLINE||O||P);M&&(n.globalAlpha=d*g,A||wu(a,n,D),jT(n,a,c,u,s,o,l,this.imagePool),A||this.clearShadowAndFilter(n,R,D)),T&&(n.globalAlpha=d*m,n.lineWidth=b,ot(k)||(n.miterLimit=k),ot(w)||(n.lineCap=w),ot(x)||(n.lineJoin=x),A&&(P&&(n.globalCompositeOperation="source-atop"),wu(a,n,!0),P&&(ly(n,a,v,s,o,l,this.imagePool),n.globalCompositeOperation=be.globalCompositeOperation,this.clearShadowAndFilter(n,R,!0))),ly(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;!ot(s)&&s.indexOf("drop-shadow")>-1&&(n.filter=s.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}}}])}(B7);function wu(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 jT(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(c){r.fillStyle=bu(c,t,r,o),l||(n?r.fill(n):r.fill())}):(Ia(e)&&(r.fillStyle=yu(e,t,r,i,a,s,o)),l||(n?r.fill(n):r.fill()))}function ly(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=bu(l,t,r,s),o||r.stroke()}):(Ia(e)&&(r.strokeStyle=yu(e,t,r,n,i,a,s)),o||r.stroke())}function z7(r,t){var e=dt(r,4),n=e[0],i=e[1],a=e[2],s=e[3],o=dt(t,4),l=o[0],c=o[1],u=o[2],h=o[3],d=Math.max(n,l),f=Math.max(i,c),g=Math.min(n+a,l+u),v=Math.min(i+s,c+h);return g<=d||v<=f?null:[d,f,g-d,v-f]}function $7(r,t){var e=Qe(St(),[r[0],r[1],0],t),n=Qe(St(),[r[0]+r[2],r[1],0],t),i=Qe(St(),[r[0],r[1]+r[3],0],t),a=Qe(St(),[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 j7=function(r){function t(){return V(this,t),mt(this,t,arguments)}return pt(t,r),W(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(c){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,c=s.imageRect,u=s.drawRect,h=l.size,d=n.getTransform(),f=d.a,g=d.b,v=d.c,p=d.d,m=d.e,y=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 b=[h[0]/c[2],h[1]/c[3]],w=[l.tileSize[0]/b[0],l.tileSize[1]/b[1]],x=[Math.floor((u[0]-c[0])/w[0]),Math.ceil((u[0]+u[2]-c[0])/w[0])],S=x[0],E=x[1],_=[Math.floor((u[1]-c[1])/w[1]),Math.ceil((u[1]+u[3]-c[1])/w[1])],C=_[0],k=_[1],M=C;M<=k;M++)for(var T=S;T<=E;T++){var O=l.tiles[M][T];if(O){var R=[Math.floor(c[0]+O.tileX*w[0]),Math.floor(c[1]+O.tileY*w[1]),Math.ceil(w[0]),Math.ceil(w[1])];n.drawImage(O.data,R[0],R[1],R[2],R[3])}}n.setTransform(f,g,v,p,m,y)}},{key:"render",value:function(n,i,a){var s=i.x,o=s===void 0?0:s,l=i.y,c=l===void 0?0:l,u=i.width,h=i.height,d=i.src,f=i.shadowColor,g=i.shadowBlur,v=this.imagePool.getImageSync(d,a),p=v==null?void 0:v.img,m=u,y=h;if(p){m||(m=p.width),y||(y=p.height);var b=!ot(f)&&g>0;wu(a,n,b);try{var w=a.ownerDocument.defaultView.getContextService().getDomElement(),x=w.width,S=w.height,E=n.getTransform(),_=E.a,C=E.b,k=E.c,M=E.d,T=E.e,O=E.f,R=DM(_,k,0,0,C,M,0,0,0,0,1,0,T,O,0,1),D=$7([o,c,m,y],R),L=z7([0,0,x,S],D);if(!L)return;if(!a.ownerDocument.defaultView.getConfig().enableLargeImageOptimization){t.renderFull(n,i,a,{image:p,drawRect:[o,c,m,y]});return}var P=D[2]/v.size[0];if(P<(v.downSamplingRate||.5)){this.renderDownSampled(n,i,a,{src:d,imageCache:v,drawRect:[o,c,m,y]});return}if(!O1.isSupportTile){t.renderFull(n,i,a,{image:p,drawRect:[o,c,m,y]});return}this.renderTile(n,i,a,{src:d,imageCache:v,imageRect:D,drawRect:L})}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]))}}])}(A1),q7=function(r){function t(){return V(this,t),mt(this,t,arguments)}return pt(t,r),W(t,[{key:"render",value:function(n,i,a,s,o,l){a.getBounds();var c=i.lineWidth,u=c===void 0?1:c,h=i.textAlign,d=h===void 0?"start":h,f=i.textBaseline,g=f===void 0?"alphabetic":f,v=i.lineJoin,p=v===void 0?"miter":v,m=i.miterLimit,y=m===void 0?10:m,b=i.letterSpacing,w=b===void 0?0:b,x=i.stroke,S=i.fill,E=i.fillRule,_=i.fillOpacity,C=_===void 0?1:_,k=i.strokeOpacity,M=k===void 0?1:k,T=i.opacity,O=T===void 0?1:T,R=i.metrics,D=i.x,L=D===void 0?0:D,P=i.y,A=P===void 0?0:P,I=i.dx,B=i.dy,j=i.shadowColor,G=i.shadowBlur,H=R.font,Y=R.lines,K=R.height,tt=R.lineHeight,it=R.lineMetrics;n.font=H,n.lineWidth=u,n.textAlign=d==="middle"?"center":d;var _t=g;_t==="alphabetic"&&(_t="bottom"),n.lineJoin=p,ot(y)||(n.miterLimit=y);var Mt=A;g==="middle"?Mt+=-K/2-tt/2:g==="bottom"||g==="alphabetic"||g==="ideographic"?Mt+=-K:(g==="top"||g==="hanging")&&(Mt+=-tt);var re=L+(I||0);Mt+=B||0,Y.length===1&&(_t==="bottom"?(_t="middle",Mt-=.5*K):_t==="top"&&(_t="middle",Mt+=.5*K)),n.textBaseline=_t;var Re=!ot(j)&&G>0;wu(a,n,Re);for(var Le=0;Le<Y.length;Le++){var cn=u/2+re;Mt+=tt,!ot(x)&&!x.isNone&&u&&this.drawLetterSpacing(n,a,Y[Le],it[Le],d,cn,Mt,w,S,E,C,x,M,O,!0,s,o,l),ot(S)||this.drawLetterSpacing(n,a,Y[Le],it[Le],d,cn,Mt,w,S,E,C,x,M,O,!1,s,o,l)}}},{key:"drawLetterSpacing",value:function(n,i,a,s,o,l,c,u,h,d,f,g,v,p,m,y,b,w){if(u===0){m?this.strokeText(n,i,a,l,c,g,v,y,b,w):this.fillText(n,i,a,l,c,h,d,f,p,y,b,w);return}var x=n.textAlign;n.textAlign="left";var S=l;o==="center"||o==="middle"?S=l-s.width/2:(o==="right"||o==="end")&&(S=l-s.width);for(var E=Array.from(a),_=n.measureText(a).width,C=0,k=0;k<E.length;++k){var M=E[k];m?this.strokeText(n,i,M,S,c,g,v,y,b,w):this.fillText(n,i,M,S,c,h,d,f,p,y,b,w),C=n.measureText(a.substring(k+1)).width,S+=_-C+u,_=C}n.textAlign=x}},{key:"fillText",value:function(n,i,a,s,o,l,c,u,h,d,f,g){jT(n,i,l,c,d,f,g,this.imagePool,!0);var v,p=!ot(u)&&u!==1;p&&(v=n.globalAlpha,n.globalAlpha=u*h),n.fillText(a,s,o),p&&(n.globalAlpha=v)}},{key:"strokeText",value:function(n,i,a,s,o,l,c,u,h,d){ly(n,i,l,u,h,d,this.imagePool,!0);var f,g=!ot(c)&&c!==1;g&&(f=n.globalAlpha,n.globalAlpha=c),n.strokeText(a,s,o),g&&(n.globalAlpha=f)}},{key:"drawToContext",value:function(n,i,a,s,o){this.render(n,i.parsedStyle,i,i.ownerDocument.defaultView.context,s,o)}}])}(A1),G7=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return V(this,t),e=mt(this,t),e.name="canvas-renderer",e.options=n,e}return pt(t,r),W(t,[{key:"init",value:function(){var n,i=vt({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),a=this.context.imagePool,s=new A1(a),o=(n={},rt(rt(rt(rt(rt(rt(rt(rt(rt(rt(n,$.CIRCLE,s),$.ELLIPSE,s),$.RECT,s),$.IMAGE,new j7(a)),$.TEXT,new q7(a)),$.LINE,s),$.POLYLINE,s),$.POLYGON,s),$.PATH,s),$.GROUP,void 0),rt(rt(rt(n,$.HTML,void 0),$.MESH,void 0),$.FRAGMENT,void 0));this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new $T(i))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory}}])}(Ji);/*!
- * @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 qT=function(){function r(){V(this,r)}return W(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,c=function(_){a.hooks.pointerMove.call(_)},u=function(_){a.hooks.pointerUp.call(_)},h=function(_){a.hooks.pointerDown.call(_)},d=function(_){a.hooks.pointerOver.call(_)},f=function(_){a.hooks.pointerOut.call(_)},g=function(_){a.hooks.pointerCancel.call(_)},v=function(_){a.hooks.pointerWheel.call(_)},p=function(_){a.hooks.click.call(_)},m=function(_){n.globalThis.document.addEventListener("pointermove",c,!0),_.addEventListener("pointerdown",h,!0),_.addEventListener("pointerleave",f,!0),_.addEventListener("pointerover",d,!0),n.globalThis.addEventListener("pointerup",u,!0),n.globalThis.addEventListener("pointercancel",g,!0)},y=function(_){_.addEventListener("touchstart",h,!0),_.addEventListener("touchend",u,!0),_.addEventListener("touchmove",c,!0),_.addEventListener("touchcancel",g,!0)},b=function(_){n.globalThis.document.addEventListener("mousemove",c,!0),_.addEventListener("mousedown",h,!0),_.addEventListener("mouseout",f,!0),_.addEventListener("mouseover",d,!0),n.globalThis.addEventListener("mouseup",u,!0)},w=function(_){n.globalThis.document.removeEventListener("pointermove",c,!0),_.removeEventListener("pointerdown",h,!0),_.removeEventListener("pointerleave",f,!0),_.removeEventListener("pointerover",d,!0),n.globalThis.removeEventListener("pointerup",u,!0),n.globalThis.removeEventListener("pointercancel",g,!0)},x=function(_){_.removeEventListener("touchstart",h,!0),_.removeEventListener("touchend",u,!0),_.removeEventListener("touchmove",c,!0),_.removeEventListener("touchcancel",g,!0)},S=function(_){n.globalThis.document.removeEventListener("mousemove",c,!0),_.removeEventListener("mousedown",h,!0),_.removeEventListener("mouseout",f,!0),_.removeEventListener("mouseover",d,!0),n.globalThis.removeEventListener("mouseup",u,!0)};a.hooks.init.tap(r.tag,function(){var E=i.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(E.style.msContentZooming="none",E.style.msTouchAction="none"):l.supportsPointerEvents&&(E.style.touchAction="none"),l.supportsPointerEvents?m(E):b(E),l.supportsTouchEvents&&y(E),o.useNativeClickEvent&&E.addEventListener("click",p,!0),E.addEventListener("wheel",v,{passive:!0,capture:!0})}),a.hooks.destroy.tap(r.tag,function(){var E=i.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(E.style.msContentZooming="",E.style.msTouchAction=""):l.supportsPointerEvents&&(E.style.touchAction=""),l.supportsPointerEvents?w(E):S(E),l.supportsTouchEvents&&x(E),o.useNativeClickEvent&&E.removeEventListener("click",p,!0),E.removeEventListener("wheel",v,!0)})}}])}();qT.tag="DOMInteraction";var W7=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=mt(this,t,[].concat(i)),e.name="dom-interaction",e}return pt(t,r),W(t,[{key:"init",value:function(){this.addRenderingPlugin(new qT)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(Ji);/*!
- * @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 V7="g-canvas-camera",GT=function(){function r(){V(this,r),this.displayObjectHTMLElementMap=new WeakMap}return W(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,c=l.context.eventService.nativeHTMLMap,u=function(m,y){y.style.transform=i.joinTransformMatrix(m.getWorldTransform(),m.getOrigin())},h=function(m){var y=m.target;if(y.nodeName===$.HTML){i.$camera||(i.$camera=i.createCamera(a));var b=i.getOrCreateEl(y);i.$camera.appendChild(b),Object.keys(y.attributes).forEach(function(w){i.updateAttribute(w,y)}),u(y,b),c.set(b,y)}},d=function(m){var y=m.target;if(y.nodeName===$.HTML&&i.$camera){var b=i.getOrCreateEl(y);b&&(b.remove(),c.delete(b))}},f=function(m){var y=m.target;if(y.nodeName===$.HTML){var b=m.attrName;i.updateAttribute(b,y)}},g=function(m){var y=m.target,b=y.nodeName===$.FRAGMENT?y.childNodes:[y];b.forEach(function(w){if(w.nodeName===$.HTML){var x=i.getOrCreateEl(w);u(w,x)}})},v=function(){if(i.$camera){var m=i.context.config,y=m.width,b=m.height;i.$camera.parentElement.style.width="".concat(y||0,"px"),i.$camera.parentElement.style.height="".concat(b||0,"px")}};o.hooks.init.tap(r.tag,function(){l.addEventListener(Mn.RESIZE,v),l.addEventListener(xt.MOUNTED,h),l.addEventListener(xt.UNMOUNTED,d),l.addEventListener(xt.ATTR_MODIFIED,f),l.addEventListener(xt.BOUNDS_CHANGED,g)}),o.hooks.endFrame.tap(r.tag,function(){i.$camera&&s.renderReasons.has(Ss.CAMERA_CHANGED)&&(i.$camera.style.transform=i.joinTransformMatrix(a.getOrthoMatrix()))}),o.hooks.destroy.tap(r.tag,function(){i.$camera&&i.$camera.remove(),l.removeEventListener(Mn.RESIZE,v),l.removeEventListener(xt.MOUNTED,h),l.removeEventListener(xt.UNMOUNTED,d),l.removeEventListener(xt.ATTR_MODIFIED,f),l.removeEventListener(xt.BOUNDS_CHANGED,g)})}},{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 c=V7,u=l.querySelector("#".concat(c));if(!u){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");u=d,d.id=c,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 u}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;Tt(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=nt(o)?"".concat(o,"px"):o.toString();break;case"height":var l=n.parsedStyle.height;i.style.height=nt(l)?"".concat(l,"px"):l.toString();break;case"zIndex":var c=n.parsedStyle.zIndex;i.style["z-index"]="".concat(c);break;case"visibility":var u=n.parsedStyle.visibility;i.style.visibility=u;break;case"pointerEvents":var h=n.parsedStyle.pointerEvents,d=h===void 0?"auto":h;i.style.pointerEvents=d;break;case"opacity":var f=n.parsedStyle.opacity;i.style.opacity="".concat(f);break;case"fill":var g=n.parsedStyle.fill,v="";lu(g)?g.isNone?v="transparent":v=n.getAttribute("fill"):Array.isArray(g)?v=n.getAttribute("fill"):Ia(g),i.style.background=v;break;case"stroke":var p=n.parsedStyle.stroke,m="";lu(p)?p.isNone?m="transparent":m=n.getAttribute("stroke"):Array.isArray(p)?m=n.getAttribute("stroke"):Ia(p),i.style["border-color"]=m,i.style["border-style"]="solid";break;case"lineWidth":var y=n.parsedStyle.lineWidth;i.style["border-width"]="".concat(y||0,"px");break;case"lineDash":i.style["border-style"]="dashed";break;case"filter":var b=n.style.filter;i.style.filter=b;break;default:!ot(n.style[e])&&n.style[e]!==""&&(i.style[e]=n.style[e])}}}])}();GT.tag="HTMLRendering";var H7=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=mt(this,t,[].concat(i)),e.name="html-renderer",e}return pt(t,r),W(t,[{key:"init",value:function(){this.addRenderingPlugin(new GT)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(Ji);/*!
- * @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 U7=function(){function r(t){V(this,r),this.renderingContext=t.renderingContext,this.canvasConfig=t.config}return W(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=Tt(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,E5(this.$canvas,e,n)),this.renderingContext.renderReasons.add(Ss.CAMERA_CHANGED)}},{key:"applyCursorStyle",value:function(e){this.$container&&this.$container.style&&(this.$container.style.cursor=e)}},{key:"toDataURL",value:function(){var t=Gi(We().mark(function n(){var i,a,s,o=arguments;return We().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:return i=o.length>0&&o[0]!==void 0?o[0]:{},a=i.type,s=i.encoderOptions,c.abrupt("return",this.context.canvas.toDataURL(a,s));case 3:case"end":return c.stop()}},n,this)}));function e(){return t.apply(this,arguments)}return e}()}])}(),Y7=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=mt(this,t,[].concat(i)),e.name="canvas-context-register",e}return pt(t,r),W(t,[{key:"init",value:function(){this.context.ContextService=U7}},{key:"destroy",value:function(){delete this.context.ContextService}}])}(Ji),zo=function(r){function t(e){var n;return V(this,t),n=mt(this,t,[e]),n.registerPlugin(new Y7),n.registerPlugin(new F7),n.registerPlugin(new g7),n.registerPlugin(new G7),n.registerPlugin(new W7),n.registerPlugin(new R7),n.registerPlugin(new H7),n}return pt(t,r),W(t)}(ED),X7=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 th extends Xn{constructor(t){super(Object.assign(Object.assign({},t),{style:Object.assign({},th.defaultStyleProps,t.style)})),this.rootPointerEvent=new hu(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);Ro(n.context.eventService,"mappingTable.pointerupoutside",[]),n.context.eventService.mapEvent(o)})}}get eventService(){return this.context.canvas.context.eventService}get events(){return[z.CLICK,z.POINTER_DOWN,z.POINTER_MOVE,z.POINTER_UP,z.POINTER_OVER,z.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=La(t,["dx","dy","innerHTML","pointerEvents","cursor"]),{dx:n=0,dy:i=0}=e,a=X7(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",Be,{x:i,y:a,width:s,height:o,opacity:0},e);return this.upsert("key",nl,n,l)}connectedCallback(){if(!(this.context.canvas.getRenderer("main")instanceof zo))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];ut(a.button)&&(a.button=0),ut(a.buttons)&&(a.buttons=1),ut(a.isPrimary)&&(a.isPrimary=t.touches.length===1&&t.type==="touchstart"),ut(a.width)&&(a.width=a.radiusX||1),ut(a.height)&&(a.height=a.radiusY||1),ut(a.tiltX)&&(a.tiltX=0),ut(a.tiltY)&&(a.tiltY=0),ut(a.pointerType)&&(a.pointerType="touch"),ut(a.pointerId)&&(a.pointerId=a.identifier||0),ut(a.pressure)&&(a.pressure=a.force||.5),ut(a.twist)&&(a.twist=0),ut(a.tangentialPressure)&&(a.tangentialPressure=0),a.isNormalized=!0,a.type=t.type,n.push(a)}else if(e.isMouseEvent(t)){const i=t;ut(i.isPrimary)&&(i.isPrimary=!0),ut(i.width)&&(i.width=1),ut(i.height)&&(i.height=1),ut(i.tiltX)&&(i.tiltX=0),ut(i.tiltY)&&(i.tiltY=0),ut(i.pointerType)&&(i.pointerType="mouse"),ut(i.pointerId)&&(i.pointerId=1),ut(i.pressure)&&(i.pressure=.5),ut(i.twist)&&(i.twist=0),ut(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(!ot(i)&&!ot(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}`}}th.defaultStyleProps={size:[160,80],halo:!1,icon:!1,label:!1,pointerEvents:"auto"};var Ub=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 WT=class VT extends Xn{constructor(t){super($e({style:VT.defaultStyleProps},t))}getKeyStyle(t){const[e,n]=this.getSize(t),i=super.getKeyStyle(t),{fillOpacity:a,opacity:s=a}=i,o=Ub(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;Ub(e,["fill","stroke"]);const a=Se(this.getGraphicStyle(t),"halo"),s=Number(a.lineWidth),[o,l]=ft(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*ii,height:i*ii},e):!1}drawKeyShape(t,e){const n=this.upsert("key",M1,this.getKeyStyle(t),e);return C1(this),n}drawHaloShape(t,e){this.upsert("halo",Be,this.getHaloStyle(t),e)}update(t){super.update(t),t&&("x"in t||"y"in t||"z"in t)&&T1(this)}};WT.defaultStyleProps={size:32};class K7 extends Xn{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*ii,height:i*ii},e):!1}drawKeyShape(t,e){return this.upsert("key",Be,this.getKeyStyle(t),e)}}class Z7 extends Zu{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 LF(this.getOuterR(t),this.getInnerR(t))}getIconStyle(t){const e=super.getIconStyle(t),n=this.getInnerR(t)*2*ii;return e?Object.assign({width:n,height:n},e):!1}getPortXY(t,e){const{placement:n="top"}=e,i=this.getShape("key").getLocalBounds(),a=DF(this.getOuterR(t),this.getInnerR(t));return R1(i,n,a,!1)}}class eh extends Zu{constructor(t){super($e({style:eh.defaultStyleProps},t))}getPoints(t){const{direction:e}=t,[n,i]=this.getSize(t);return IF(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=FF(s,o,n);return R1(a,i,l,!1)}getIconStyle(t){const{icon:e,iconText:n,iconSrc:i,direction:a}=t;if(e===!1||wr(n||i))return!1;const s=Se(this.getGraphicStyle(t),"icon"),o=this.getShape("key").getLocalBounds(),[l,c]=Q8(o,a),u=t9(o,a)*2*ii;return Object.assign({x:l,y:c,width:u,height:u},s)}}eh.defaultStyleProps={size:40,direction:"up"};var Yb=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 Is extends Xn{constructor(t){super($e({style:Is.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]=Pr(e);return ft(Nn(n),[o+a,i+s,0])}getCollapsedKeySize(t){return Nn(t.collapsedSize)}getExpandedKeySize(t){const e=this.getContentBBox(t);return[Nr(e),Rr(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 Vt,{x:o=0,y:l=0,size:c}=t,[u,h]=Nn(c);return s.setMinMax([o-u/2,l-h/2,0],[o+u/2,l+h/2,0]),s}const a=il(i.map(s=>s.getBounds()));return n?ea(a,n):a}drawCollapsedMarkerShape(t,e){const n=this.getCollapsedMarkerStyle(t);this.upsert("collapsed-marker",RT,n,e),C1(this)}getCollapsedMarkerStyle(t){if(!t.collapsed||!t.collapsedMarker)return!1;const e=Se(this.getGraphicStyle(t),"collapsedMarker"),{type:n}=e,i=Yb(e,["type"]),a=this.getShape("key"),[s,o]=Wr(a.getLocalBounds(),"center"),l=Object.assign(Object.assign({},i),{x:s,y:o});if(n){const c=this.getCollapsedMarkerText(n,t);Object.assign(l,{text:c})}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(F(a))==="node").length.toString():at(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(F(l)));if(o.length>0&&o.some(C9)){const l=o.reduce((c,u)=>ft(c,ye(u)),[0,0,0]);return ur(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}}),T1(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,c=Yb(i,["x","y","z","transform"]);return c}),e);return n&&new Proxy(n,{set:(i,a,s)=>(a==="currentTime"&&Promise.resolve().then(()=>this.onframe()),Reflect.set(i,a,s))})}}Is.defaultStyleProps={childrenNode:[],droppable:!0,draggable:!0,collapsed:!1,collapsedSize:32,collapsedMarker:!0,collapsedMarkerZIndex:1,collapsedMarkerFontSize:12,collapsedMarkerTextAlign:"center",collapsedMarkerTextBaseline:"middle",collapsedMarkerType:"child-count"};class J7 extends Is{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",li,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&&Se(n,"collapsed")),{r:i/2})}getCollapsedKeySize(t){const[e,n]=Nn(t.collapsedSize),i=Math.max(e,n)/2;return[i*2,i*2,0]}getExpandedKeySize(t){const e=this.getContentBBox(t),[n,i]=ta(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 Xu(t,n,e)}}class Q7 extends Is{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",Be,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&&Se(e,"collapsed")),{width:n,height:i,x:-n/2,y:-i/2})}}const tF={padding:10};function Xb(r,t,e,n,i,a){const{padding:s}=Object.assign(tF,a),o=Ai(e,s),l=Ai(n,s),c=[r,...i,t];let u=null;const h=[];for(let d=0,f=c.length;d<f-1;d++){const g=d+1,v=c[d],p=c[g],m=A9(v,p);let y=null;if(d===0)if(g===f-1)if(o.intersects(l))y=cf(v,p,o,l);else if(!gu(v,o)&&!gu(p,l)){const b=Ta(v,o),w=Ta(p,l);y=Zb(b,w,an(b,w)),y.points.unshift(b),y.points.push(w)}else m||(y=nF(v,p,o,l));else cr(p,o)?y=cf(v,p,o,Ai(p,s),u):m||(y=Bc(v,p,o));else g===f-1?cr(v,l)?y=cf(v,p,Ai(v,s),l,u):m||(y=HT(v,p,l,u)):m||(y=Zb(v,p,u));y?(h.push(...y.points),u=y.direction):u=an(v,p),g<f-1&&h.push(p)}return h.map(za)}const eF={N:"S",S:"N",W:"E",E:"W"},Kb={N:-Math.PI/2,S:Math.PI/2,E:0,W:Math.PI};function an(r,t){const[e,n]=r,[i,a]=t;return e===i?n>a?"N":"S":n===a?e>i?"W":"E":null}function cy(r,t){return t==="N"||t==="S"?Rr(r):Nr(r)}function Zb(r,t,e){const n=[r[0],t[1]],i=[t[0],r[1]],a=an(r,n),s=an(r,i),o=e?eF[e]:null,l=a===e||a!==o&&s!==e?n:i;return{points:[l],direction:an(l,t)}}function Bc(r,t,e){if(gu(r,e)){const n=$o(r,t,e);return{points:[n],direction:an(n,t)}}else{const n=Ta(r,e),a=["left","right"].includes(Co(r,e))?[t[0],n[1]]:[n[0],t[1]];return{points:[a],direction:an(a,t)}}}function HT(r,t,e,n){const i=gu(t,e)?t:Ta(t,e),a=[[i[0],r[1]],[r[0],i[1]]],s=a.filter(l=>J8(l,e)&&!hT(l,e,!0)),o=s.filter(l=>an(l,r)!==n);if(o.length>0){const l=o.find(c=>an(r,c)===n)||o[0];return{points:[l],direction:an(l,t)}}else{const l=s6(a,s)[0],c=$i(t,l,cy(e,n)/2);return{points:[$o(c,r,e),c],direction:an(c,t)}}}function nF(r,t,e,n){let i=Bc(r,t,e);const a=Bo(i.points[0]);if(cr(a,n)){i=Bc(t,r,n);const s=Bo(i.points[0]);if(cr(s,e)){const o=$i(r,a,cy(e,an(r,a))/2),l=$i(t,s,cy(n,an(t,s))/2),c=[(o[0]+l[0])/2,(o[1]+l[1])/2],u=Bc(r,c,e),h=HT(c,t,n,u.direction);i.points=[u.points[0],h.points[0]],i.direction=h.direction}}return i}function cf(r,t,e,n,i){const s=il([e,n]),o=Kt(t,s.center)>Kt(r,s.center),[l,c]=o?[t,r]:[r,t],u=Rr(s)+Nr(s);let h;if(i){const g=[l[0]+u*Math.cos(Kb[i]),l[1]+u*Math.sin(Kb[i])];h=$i(Ta(g,s),g,.01)}else h=$i(Ta(l,s),l,-.01);let d=$o(h,c,s),f=[Js(h,2),Js(d,2)];if(ue(Js(h),Js(d))){const g=S1($t(h,l),[1,0,0])+Math.PI/2;d=[c[0]+u*Math.cos(g),c[1]+u*Math.sin(g),0],d=Js($i(Ta(d,s),c,-.01),2);const v=$o(h,d,s);f=[h,v,d]}return{points:o?f.reverse():f,direction:an(o?h:d,t)}}function $o(r,t,e){let n=[r[0],t[1]];return cr(n,e)&&(n=[t[0],r[1]]),n}function UT(r,t,e,n,i){let l=typeof t=="number"?t:.5;t==="start"&&(l=0),t==="end"&&(l=.99);const c=Ge(r.getPoint(l)),u=Ge(r.getPoint(l+.01));let h=t==="start"?"left":t==="end"?"right":"center";if(ET(c,u)||!e){const[m,y]=Jb(r,l,n,i);return{transform:[["translate",m,y]],textAlign:h}}let d=Math.atan2(u[1]-c[1],u[0]-c[0]);u[0]<c[0]&&(h=h==="center"?h:h==="left"?"right":"left",n*=-1,d+=Math.PI);const[g,v]=Jb(r,l,n,i,d),p=[["translate",g,v],["rotate",d/Math.PI*180]];return{textAlign:h,transform:p}}function rF(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 UT(r.key,e,!0,(l?(l/2+o/2)*(t==="suffix"?1:-1):0)+n,i)}function Jb(r,t,e,n,i){const[a,s]=Ge(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 uy(r,t,e,n){if(ue(r,t))return r;const i=$t(t,r),a=[r[0]+e*i[0],r[1]+e*i[1]],s=ti(Yu(i,!1));return a[0]+=n*s[0],a[1]+=n*s[1],a}function iF(r){return nt(r)?[r,-r]:r}function aF(r){return nt(r)?[r,1-r]:r}function sF(r,t,e){return[["M",r[0],r[1]],["Q",e[0],e[1],t[0],t[1]]]}function YT(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 P1(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 c=a[l-1]||n,u=a[l+1]||i;if(!ST(c,o,u)&&t){const[h,d]=oF(c,o,u,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 oF(r,t,e,n){const i=vu(r,t),a=vu(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 lF=r=>{const t=Math.PI/2,e=Rr(r)/2,n=Nr(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 XT(r,t,e,n,i){const a=Ai(r),s=r.getCenter();let o=n&&Hi(n),l=i&&Hi(i);if(!o||!l){const c=lF(a),u=c[t][0],h=c[t][1],[d,f]=ta(a),g=Math.max(d,f),v=ft(s,[g*Math.cos(u),g*Math.sin(u),0]),p=ft(s,[g*Math.cos(h),g*Math.sin(h),0]);o=dy(r,v),l=dy(r,p),e||([o,l]=[l,o])}return[o,l]}function cF(r,t,e,n,i,a){const s=r.getPorts()[i||a],o=r.getPorts()[a||i];let[l,c]=XT(r,t,e,s,o);const u=uF(r,l,c,n);return s&&(l=jo(s,u[0])),o&&(c=jo(o,u[u.length-1])),YT(l,c,u)}function uF(r,t,e,n){const i=r.getCenter();if(ue(t,e)){const a=$t(t,i),s=[n*Math.sign(a[0])||n/2,n*Math.sign(a[1])||-n/2,0];return[ft(t,s),ft(e,Gr(s,[1,-1,1]))]}return[$i(i,t,Kt(i,t)+n),$i(i,e,Kt(i,e)+n)]}function hF(r,t,e,n,i,a,s){const o=L1(r),l=o[a||s],c=o[s||a];let[u,h]=XT(r,e,n,l,c);const d=dF(r,u,h,i);return l&&(u=jo(l,d[0])),c&&(h=jo(c,d[d.length-1])),P1([u,...d,h],t)}function dF(r,t,e,n){const i=[],a=Ai(r);if(ue(t,e))switch(Co(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=Co(t,a),o=Co(e,a);if(s===o){const l=s;let c,u;switch(l){case"left":c=Math.min(t[0],e[0])-n,i.push([c,t[1]]),i.push([c,e[1]]);break;case"right":c=Math.max(t[0],e[0])+n,i.push([c,t[1]]),i.push([c,e[1]]);break;case"top":u=Math.min(t[1],e[1])-n,i.push([t[0],u]),i.push([e[0],u]);break;case"bottom":u=Math.max(t[1],e[1])+n,i.push([t[0],u]),i.push([e[0],u]);break}}else{const l=(d,f)=>({left:[f[0]-n,f[1]],right:[f[0]+n,f[1]],top:[f[0],f[1]-n],bottom:[f[0],f[1]+n]})[d],c=l(s,t),u=l(o,e),h=$o(c,u,a);i.push(c,h,u)}}return i}function hy(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 Qb(r,t){const e=[];let n=r;for(;n;){e.push(n);const i=t(F(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(mn);return e[i]||e.at(-1)}return r}function fF(r,t){return t||(r<4?10:r===4?12:r*2.5)}const gF=(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"]]},KT=(r,t)=>[["M",-r/2,0],["L",r/2,-t/2],["L",r/2,t/2],["Z"]],vF=(r,t)=>[["M",-r/2,0],["L",0,-t/2],["L",r/2,0],["L",0,t/2],["Z"]],pF=(r,t)=>[["M",-r/2,0],["L",r/2,-t/2],["L",4*r/5-r/2,0],["L",r/2,t/2],["Z"]],mF=(r,t)=>[["M",-r/2,-t/2],["L",r/2,-t/2],["L",r/2,t/2],["L",-r/2,t/2],["Z"]],yF=(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"]]},bF=(r,t)=>[["M",r/2,-t/2],["L",-r/2,0],["L",r/2,0],["L",-r/2,0],["L",r/2,t/2]],wF=Object.freeze(Object.defineProperty({__proto__:null,circle:gF,diamond:vF,rect:mF,simple:bF,triangle:KT,triangleRect:yF,vee:pF},Symbol.toStringTag,{value:"Module"}));var cc=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 ra extends LT{constructor(t){super($e({style:ra.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=cc(e,["loop"]),{sourceNode:a,targetNode:s}=this,l={d:n&&AF(a,s)?this.getLoopPath(t):this.getKeyPath(t)};return Tn.PARSED_STYLE_LIST.forEach(c=>{c in i&&(l[c]=i[c])}),l}getLoopPath(t){const{sourcePort:e,targetPort:n}=t,i=this.sourceNode,a=Ai(i),s=Math.max(Nr(a),Rr(a)),{placement:o,clockwise:l,dist:c=s}=Se(this.getGraphicStyle(t),"loop");return cF(i,o,l,c,e,n)}getEndpoints(t,e=!0,n=[]){const{sourcePort:i,targetPort:a}=t,{sourceNode:s,targetNode:o}=this,[l,c]=NF(s,o,i,a);if(!e){const f=l?Hi(l):s.getCenter(),g=c?Hi(c):o.getCenter();return[f,g]}const u=typeof n=="function"?n():n,h=iw(l||s,u[0]||c||o),d=iw(c||o,u[u.length-1]||l||s);return[h,d]}getHaloStyle(t){if(t.halo===!1)return!1;const e=this.getKeyStyle(t),n=Se(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign({},e),n)}getLabelStyle(t){if(t.label===!1||!t.labelText)return!1;const e=Se(this.getGraphicStyle(t),"label"),{placement:n,offsetX:i,offsetY:a,autoRotate:s,maxWidth:o}=e,l=cc(e,["placement","offsetX","offsetY","autoRotate","maxWidth"]),c=UT(this.shapeMap.key,n,s,i,a),u=this.shapeMap.key.getLocalBounds(),h=V9([u.min,u.max],o);return Object.assign({wordWrapWidth:h},c,l)}getBadgeStyle(t){if(t.badge===!1||!t.badgeText)return!1;const e=Se(t,"badge"),{offsetX:n,offsetY:i,placement:a}=e,s=cc(e,["offsetX","offsetY","placement"]);return Object.assign(s,rF(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),[c,u,h]=i?["markerStart","markerStartOffset","startArrowOffset"]:["markerEnd","markerEndOffset","endArrowOffset"],d=o.parsedStyle[c];if(d)d.attr(l);else{const f=l.src?rl:Tn,g=new f({style:l});o.style[c]=g}o.style[u]=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=Se(this.getGraphicStyle(t),i),{size:s,type:o}=a,l=cc(a,["size","type"]),[c,u]=Nn(fF(n.lineWidth,s)),d=(at(o)?o:wF[o]||KT)(c,u);return Object.assign(La(n,["stroke","strokeOpacity","fillOpacity"]),{width:c,height:u},Object.assign({},d&&{d,fill:o==="simple"?"":n.stroke}),l)}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",na,n,e)}drawHaloShape(t,e){const n=this.getHaloStyle(t);this.upsert("halo",Tn,n,e)}drawBadgeShape(t,e){const n=this.getBadgeStyle(t);this.upsert("badge",ei,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",Tn,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))})}}ra.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 Ha extends ra{constructor(t){super($e({style:Ha.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t),{controlPoints:i,curvePosition:a,curveOffset:s}=t,o=this.getControlPoints(e,n,aF(a),iF(s),i);return YT(e,n,o)}getControlPoints(t,e,n,i,a){return(a==null?void 0:a.length)===2?a:[uy(t,e,n[0],i[0]),uy(t,e,n[1],i[1])]}}Ha.defaultStyleProps={curvePosition:.5,curveOffset:20};class cl extends Ha{constructor(t){super($e({style:cl.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]]]}}cl.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};class nh extends Ha{constructor(t){super($e({style:nh.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=ye(this.ref),n=this.sourceNode.getIntersectPoint(e,!0),i=this.targetNode.getIntersectPoint(e);return[n,i]}toRadialCoordinate(t){const e=ye(this.ref),n=Kt(t,e),i=bT($t(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)]]}}nh.defaultStyleProps={curvePosition:.5,curveOffset:20};class rh extends Ha{constructor(t){super($e({style:rh.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]]]}}rh.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};let ZT=class JT extends ra{constructor(t){super($e({style:JT.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t);return[["M",e[0],e[1]],["L",n[0],n[1]]]}};ZT.defaultStyleProps={};const xF={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:vu},$r=r=>`${Math.round(r[0])}|||${Math.round(r[1])}`;function Ea(r,t){const e=n=>Math.round(n/t);return nt(r)?e(r):r.map(e)}function EF(r,t){const e=Math.abs(r-t);return e>Math.PI?2*Math.PI-e:e}function tw(r,t){const e=t[0]-r[0],n=t[1]-r[1];return!e&&!n?0:Math.atan2(n,e)}function QT(r,t,e,n){const i=tw(r,t),a=e[$r(r)],o=tw(a||n,r);return EF(o,i)}const SF=(r,t)=>{const{offset:e,gridSize:n}=t,i={};return r.forEach(a=>{if(!a||a.destroyed||!a.isVisible())return;const s=ea(a.getRenderBounds(),e);for(let o=Ea(s.min[0],n);o<=Ea(s.max[0],n);o+=1)for(let l=Ea(s.min[1],n);l<=Ea(s.max[1],n);l+=1)i[`${o}|||${l}`]=!0}),i};function ew(r,t,e){return Math.min(...t.map(n=>e(r,n)))}function _F(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 nw=(r,t,e,n)=>{if(!t)return[r];const{directionMap:i,offset:a}=n,s=ea(t.getRenderBounds(),a),o=Object.keys(i).reduce((l,c)=>{if(e.includes(c)){const u=i[c],[h,d]=ta(s),f=[r[0]+u.stepX*h,r[1]+u.stepY*d],g=e9(s);for(let v=0;v<g.length;v++){const p=_1([r,f],g[v]);p&&hT(p,s)&&l.push(p)}}return l},[]);return cr(r,s)||o.push(r),o.map(l=>Ea(l,n.gridSize))},kF=(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 c=r,u=t[$r(c)];for(;u;){const f=u,g=c;QT(f,g,t,e)&&(l=[f[0]===g[0]?l[0]:f[0]*s,f[1]===g[1]?l[1]:f[1]*s],o.unshift(l)),u=t[$r(f)],c=f}const h=i.map(f=>[f[0]*s,f[1]*s]),d=_F(h,l,vu);return o.unshift(d),o};function MF(r,t,e,n){const i=za(r.getCenter()),a=za(t.getCenter()),s=Object.assign(xF,n),{gridSize:o}=s,l=s.enableObstacleAvoidance?e:[r,t],c=SF(l,s),u=Ea(i,o),h=Ea(a,o),d=nw(i,r,s.startDirections,s),f=nw(a,t,s.endDirections,s);d.forEach(_=>delete c[$r(_)]),f.forEach(_=>delete c[$r(_)]);const g={},v={},p={},m={},y={},b=new CF;for(let _=0;_<d.length;_++){const C=d[_],k=$r(C);g[k]=C,m[k]=0,y[k]=ew(C,f,s.distFunc),b.add({id:k,value:y[k]})}const w=f.map(_=>$r(_));let x=s.maximumLoops,S,E=1/0;for(const[_,C]of Object.entries(g))y[_]<=E&&(E=y[_],S=C);for(;Object.keys(g).length>0&&x>0;){const _=b.minId(!1);if(_)S=g[_];else break;const C=$r(S);if(w.includes(C))return kF(S,p,u,a,d,h,o);delete g[C],b.remove(C),v[C]=!0;for(const k of Object.values(s.directionMap)){const M=ft(S,[k.stepX,k.stepY]),T=$r(M);if(v[T])continue;const O=QT(S,M,p,u);if(O>s.maxAllowedDirectionChange||c[T])continue;g[T]||(g[T]=M);const R=s.penalties[O],D=s.distFunc(S,M)+(isNaN(R)?o:R),L=m[C]+D,P=m[T];P&&L>=P||(p[T]=S,m[T]=L,y[T]=L+ew(M,f,s.distFunc),b.add({id:T,value:y[T]}))}x-=1}return[]}class CF{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 ih extends ra{constructor(t){super($e({style:ih.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=MF(n,i,l,e),o.length||(o=Xb(a,s,n,i,t.controlPoints,{padding:e.offset}))}else e.type==="orth"&&(o=Xb(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 P1(e,t.radius)}getLoopPath(t){const{sourcePort:e,targetPort:n,radius:i}=t,a=this.sourceNode,s=Ai(a),o=Math.max(Nr(s),Rr(s))/4,{placement:l,clockwise:c,dist:u=o}=Se(this.getGraphicStyle(t),"loop");return hF(a,i,l,c,u,e,n)}}ih.defaultStyleProps={radius:0,controlPoints:[],router:!1};class ah extends ra{constructor(t){super($e({style:ah.defaultStyleProps},t))}getKeyPath(t){const{curvePosition:e,curveOffset:n}=t,[i,a]=this.getEndpoints(t),s=t.controlPoint||uy(i,a,e,n);return sF(i,a,s)}}ah.defaultStyleProps={curvePosition:.5,curveOffset:30};var TF=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 ul(r){return r instanceof Xn&&r.type==="node"}function tO(r){return r instanceof ra}function N1(r){return r instanceof Is}function OF(r){return ul(r)||tO(r)||N1(r)}function AF(r,t){return!r||!t?!1:r===t}const PF={top:[.5,0],right:[1,.5],bottom:[.5,1],left:[0,.5],default:[.5,.5]};function R1(r,t,e=PF,n=!0){const i=[.5,.5],a=Tt(t)?nn(e,t.toLocaleLowerCase(),i):t;if(!n&&Tt(t))return a;const[s,o]=a||i;return[r.min[0]+Nr(r)*s,r.min[1]+Rr(r)*o]}function L1(r){if(!r)return{};const t=r.getPorts();return(r.attributes.ports||[]).forEach((n,i)=>{var a;const{key:s,placement:o}=n;eO(n)&&(t[a=s||i]||(t[a]=Wr(r.getShape("key").getBounds(),o)))}),t}function eO(r){const{r:t}=r;return!t||Number(t)===0}function Hi(r){return Ps(r)?r:r.getPosition()}function NF(r,t,e,n){const i=rw(r,t,e,n),a=rw(t,r,n,e);return[i,a]}function rw(r,t,e,n){const i=L1(r);if(e)return i[e];const a=Object.values(i);if(a.length===0)return;const s=a.map(c=>Hi(c)),o=RF(t,n),[l]=R9(s,o);return a.find(c=>Hi(c)===l)}function RF(r,t){const e=L1(r);if(t)return[Hi(e[t])];const n=Object.values(e);return n.length>0?n.map(i=>Hi(i)):[r.getCenter()]}function iw(r,t){return N1(r)||ul(r)?dy(r,t):jo(r,t)}function jo(r,t){if(!r||!t)return[0,0,0];if(Ps(r))return r;if(r.attributes.linkToCenter)return r.getPosition();const e=Ps(t)?t:ul(t)?t.getCenter():t.getPosition();return Xu(e,r.getBounds())}function dy(r,t){if(!r||!t)return[0,0,0];const e=Ps(t)?t:ul(t)?t.getCenter():t.getPosition();return r.getIntersectPoint(e)||r.getCenter()}function aw(r,t="bottom",e=0,n=0,i=!1){const a=t.split("-"),[s,o]=Wr(r,t),l=a.includes("left")?"right":a.includes("right")?"left":"center";let c=a.includes("top")?"bottom":a.includes("bottom")?"top":"middle";return i&&(c=c==="top"?"bottom":c==="bottom"?"top":c),{transform:[["translate",s+e,o+n]],textBaseline:c,textAlign:l}}function LF(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 DF(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 IF(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 FF(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 BF(r,t){return[[0,-t/2],[r/2,0],[0,t/2],[-r/2,0]]}function zF(r){return nn(r,["style","visibility"])!=="hidden"}function $F(r,t){const{zIndex:e,transform:n,transformOrigin:i,visibility:a,cursor:s,clipPath:o,component:l}=t,c=TF(t,["zIndex","transform","transformOrigin","visibility","cursor","clipPath","component"]);Object.assign(r.attributes,c),n&&r.setAttribute("transform",n),nt(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 fy(r,t){"update"in r?r.update(t):r.attr(t)}function jF(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 qF(r){Ro(r,"__to_be_destroyed__",!0)}function sh(r){return nn(r,"__to_be_destroyed__",!1)}var GF=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class oh extends xn{constructor(t,e){super(t,Object.assign({},oh.defaultOptions,e)),this.onCollapseExpand=n=>GF(this,void 0,void 0,function*(){if(!this.validate(n))return;const{target:i}=n;if(!OF(i))return;const a=i.id,{model:s,graph:o}=this.context,l=s.getElementDataById(a);if(!l)return!1;const{onCollapse:c,onExpand:u,animation:h,align:d}=this.options;mn(l)?(yield o.expandElement(a,{animation:h,align:d}),u==null||u(a)):(yield o.collapseElement(a,{animation:h,align:d}),c==null||c(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 at(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}oh.defaultOptions={enable:!0,animation:!0,trigger:z.DBLCLICK,align:!0};var uc=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};const WF="g6-create-edge-assist-edge-id",hc="g6-create-edge-assist-node-id";class lh extends xn{constructor(t,e){super(t,Object.assign({},lh.defaultOptions,e)),this.drop=n=>uc(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=>uc(this,void 0,void 0,function*(){var i,a,s;if(!this.validate(n))return;const{graph:o,canvas:l,batch:c,element:u}=this.context,{style:h}=this.options;if(this.source){this.createEdge(n),yield this.cancelEdge();return}c.startBatch(),l.setCursor("crosshair"),this.source=this.getSelectedNodeIDs([n.target.id])[0];const d=o.getElementData(this.source);o.addNodeData([{id:hc,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:WF,source:this.source,target:hc,style:Object.assign({pointerEvents:"none"},h)}]),yield(s=u.draw({animation:!1}))===null||s===void 0?void 0:s.finished}),this.updateAssistEdge=n=>uc(this,void 0,void 0,function*(){var i;if(!this.source)return;const{model:a,element:s}=this.context;a.translateNodeTo(hc,[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:c}=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}-${C6()}`,f=c({id:d,source:this.source,target:h,style:o});s.addEdgeData([f]),l(f)},this.cancelEdge=()=>uc(this,void 0,void 0,function*(){var n;if(!this.source)return;const{graph:i,element:a,batch:s}=this.context;i.removeNodeData([hc]),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(Vn.CLICK,this.handleCreateEdge),t.on(wa.CLICK,this.handleCreateEdge),t.on(ni.CLICK,this.cancelEdge),t.on(fu.CLICK,this.cancelEdge)):(t.on(Vn.DRAG_START,this.handleCreateEdge),t.on(wa.DRAG_START,this.handleCreateEdge),t.on(z.POINTER_UP,this.drop)),t.on(z.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 at(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;t.off(Vn.CLICK,this.handleCreateEdge),t.off(wa.CLICK,this.handleCreateEdge),t.off(ni.CLICK,this.cancelEdge),t.off(fu.CLICK,this.cancelEdge),t.off(Vn.DRAG_START,this.handleCreateEdge),t.off(wa.DRAG_START,this.handleCreateEdge),t.off(z.POINTER_UP,this.drop),t.off(z.POINTER_MOVE,this.updateAssistEdge)}destroy(){this.unbindEvents(),super.destroy()}}lh.defaultOptions={animation:!0,enable:!0,style:{},trigger:"drag",onCreate:r=>r,onFinish:()=>{}};var sw=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class ch extends xn{constructor(t,e){super(t,Object.assign({},ch.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,c=(o=(s=n.movement)===null||s===void 0?void 0:s.y)!==null&&o!==void 0?o:n.dy;l|c&&this.translate([l,c],!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=Zo(()=>{var n,i;(i=(n=this.options).onFinish)===null||i===void 0||i.call(n)},300),this.shortcut=new Ds(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(me(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(z.DRAG_START,this.onDragStart),e.on(z.DRAG,this.onDrag),e.on(z.DRAG_END,this.onDragEnd)}}onTranslate(t,e){return sw(this,void 0,void 0,function*(){if(!this.validate(e))return;const{sensitivity:n}=this.options,i=n*-1;yield this.translate(Gr(t,i),this.options.animation),this.invokeOnFinish()})}translate(t,e){return sw(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,c,u]=Pr(this.options.range),h=[s*o,a*l,s*c,a*u],d=ea(b1(n.getCanvasCenter()),h),f=$t(n.getViewportCenter(),[t,e,0]);if(!cr(f,d)){const{min:[g,v],max:[p,m]}=d;(f[0]<g&&t>0||f[0]>p&&t<0)&&(t=0),(f[1]<v&&e>0||f[1]>m&&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(z.DRAG_START,this.onDragStart),t.off(z.DRAG,this.onDrag),t.off(z.DRAG_END,this.onDragEnd)}destroy(){this.shortcut.destroy(),this.unbindEvents(),this.context.canvas.setCursor(this.defaultCursor),super.destroy()}}ch.defaultOptions={enable:r=>"targetType"in r?r.targetType==="canvas":!0,sensitivity:10,direction:"both",range:1/0};var ow=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class hl extends xn{constructor(t,e){super(t,Object.assign({},hl.defaultOptions,e)),this.enable=!1,this.enableElements=["node","combo"],this.target=[],this.shadowOrigin=[0,0],this.hiddenEdges=[],this.isDragging=!1,this.onDrop=n=>ow(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 c=a.getParentData(l,jt);c&&F(c)===o&&a.refreshComboData(o),a.setParent(l,o,jt)}),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===z.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}:${z.DRAG_START}`,this.onDragStart),t.on(`${i}:${z.DRAG}`,this.onDrag),t.on(`${i}:${z.DRAG_END}`,this.onDragEnd),t.on(`${i}:${z.POINTER_ENTER}`,this.setCursor),t.on(`${i}:${z.POINTER_LEAVE}`,this.setCursor)}),["link"].includes(this.options.dropEffect)&&(t.on(wa.DROP,this.onDrop),t.on(ni.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 ur([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,c]=$t([+s,+o],this.shadowOrigin);this.moveElement(this.target,[l,c])}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 at(e)?e(t):!!e}moveElement(t,e){return ow(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=Se(this.options,"shadow"),n=il(t.map(c=>this.context.element.getElement(c).getBounds())),[i,a]=n.min;this.shadowOrigin=[i,a];const[s,o]=ta(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 Be({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(F):this.hiddenEdges=Array.from(new Set(this.target.map(i=>n.getRelatedEdgesData(i,t).map(F)).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}:${z.DRAG_START}`,this.onDragStart),t.off(`${i}:${z.DRAG}`,this.onDrag),t.off(`${i}:${z.DRAG_END}`,this.onDragEnd),t.off(`${i}:${z.POINTER_ENTER}`,this.setCursor),t.off(`${i}:${z.POINTER_LEAVE}`,this.setCursor)}),t.off(`combo:${z.DROP}`,this.onDrop),t.off(`canvas:${z.DROP}`,this.onDrop)}destroy(){var t;this.unbindEvents(),(t=this.shadow)===null||t===void 0||t.destroy(),super.destroy()}}hl.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 VF="*",uh=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[VF]||[],o=function(l){for(var c=l.length,u=0;u<c;u++)if(l[u]){var h=l[u],d=h.callback,f=h.once;f&&(l.splice(u,1),l.length===0&&delete e._events[t],c--,u--),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 gy(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 xu(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)&&xu(a,t,e,n))return!0;return!1}const lw=()=>!0;class HF{constructor(t){Ot(this,"graph");Ot(this,"nodeFilter");Ot(this,"edgeFilter");Ot(this,"cacheEnabled");Ot(this,"inEdgesMap",new Map);Ot(this,"outEdgesMap",new Map);Ot(this,"bothEdgesMap",new Map);Ot(this,"allNodesMap",new Map);Ot(this,"allEdgesMap",new Map);Ot(this,"clearCache",()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()});Ot(this,"refreshCache",()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map(t=>t.id))});Ot(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)})});Ot(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||lw,n=t.edgeFilter||lw;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];gy([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];xu(this.getNode(t),new Set,e,i)}}let Ne=class nO extends uh{constructor(e){super();Ot(this,"nodeMap",new Map);Ot(this,"edgeMap",new Map);Ot(this,"inEdgesMap",new Map);Ot(this,"outEdgesMap",new Map);Ot(this,"bothEdgesMap",new Map);Ot(this,"treeIndices",new Map);Ot(this,"changes",[]);Ot(this,"batchCount",0);Ot(this,"onChanged",()=>{});Ot(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(c=>{a.parentMap.delete(c.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 u,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&&((u=a.childrenMap.get(o.id))==null||u.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 c=a.childrenMap.get(l.id);c||(c=new Set,a.childrenMap.set(l.id,c)),c.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 xu(this.getNode(e),new Set,n,a)}bfsTree(e,n,i){const a=s=>this.getChildren(s,i);return gy([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 gy([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 xu(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 nO({nodes:e,edges:n});return this.treeIndices.forEach(({parentMap:a,childrenMap:s},o)=>{const l=new Map;a.forEach((u,h)=>{l.set(h,i.getNode(u.id))});const c=new Map;s.forEach((u,h)=>{c.set(h,new Set(Array.from(u).map(d=>i.getNode(d.id))))}),i.treeIndices.set(o,{parentMap:l,childrenMap:c})}),i}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(e){return new HF({graph:this,...e})}};class hh{constructor(t,e){this.context=t,this.options=e||{}}}var UF=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})},YF=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 XF(r){const{type:t}=r;return["compact-box","mindmap","dendrogram","indented"].includes(t)}function KF(r){return!Array.isArray(r)&&(r==null?void 0:r.preLayout)}function zc(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:c=l.slice(1,l.length-1)}}=i;n.edges.push({id:a,source:s,target:o,style:Object.assign({},c!=null&&c.length?{controlPoints:c.map(Ge)}:{})})}),n}function ZF(r,t){class e extends hh{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 zc(l)}}}execute(i,a){return UF(this,void 0,void 0,function*(){return zc(yield this.instance.execute(this.graphData2LayoutModel(i),this.transformOptions(on({},this.options,a))))})}transformOptions(i){const{onTick:a}=i;return a&&(i.onTick=s=>a(zc(s))),i}graphData2LayoutModel(i){const{nodes:a=[],edges:s=[],combos:o=[]}=i,l=a.map(f=>{const g=F(f),{data:v,style:p,combo:m}=f,y=YF(f,["data","style","combo"]),b={id:g,data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},v),{data:v}),m?{parentId:m}:{}),{style:p}),y)};return p!=null&&p.x&&Object.assign(b.data,{x:p.x}),p!=null&&p.y&&Object.assign(b.data,{y:p.y}),p!=null&&p.z&&Object.assign(b.data,{z:p.z}),b}),c=new Map(l.map(f=>[f.id,f])),u=s.filter(f=>{const{source:g,target:v}=f;return c.has(g)&&c.has(v)}).map(f=>{const{source:g,target:v,data:p,style:m}=f;return{id:F(f),source:g,target:v,data:Object.assign({},p),style:Object.assign({},m)}}),h=o.map(f=>({id:F(f),data:Object.assign({_isCombo:!0},f.data),style:Object.assign({},f.style)})),d=new Ne({nodes:[...l,...h],edges:u});return t.model.model.hasTreeStructure(jt)&&(d.attachTreeStructure(jt),l.forEach(f=>{const g=t.model.model.getParent(f.id,jt);g&&d.hasNode(g.id)&&d.setParent(f.id,g.id,jt)})),d}}return e}function uf(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 cw(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 JF=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class QF extends hl{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):(Ar.warn("DragElementForce only works with d3-force or d3-force-3d layout"),!1):!1}moveElement(t,e){return JF(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&&uf(n,"setFixedPosition",t[a],[...ft([+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&&cw(e,"simulation").alphaTarget(.3).restart(),this.context.graph.getNodeData(this.target).forEach(n=>{const{x:i=0,y:a=0}=n.style||{};e&&uf(e,"setFixedPosition",F(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&&cw(t,"simulation").alphaTarget(0),!this.options.fixed&&this.context.graph.getNodeData(this.target).forEach(e=>{t&&uf(t,"setFixedPosition",F(e),[null,null,null])})}}var uw=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class dh extends xn{constructor(t,e){super(t,Object.assign({},dh.defaultOptions,e)),this.isZoomEvent=n=>!!(n.data&&"scale"in n.data),this.relatedEdgeToUpdate=new Set,this.zoom=this.context.graph.getZoom(),this.fixElementSize=n=>uw(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,c=(a?i.getElementDataByState("node",a):i.getNodeData()).filter(s),u=(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,f=[...c,...h];f.length>0&&f.forEach(g=>this.fixNodeLike(g,d)),this.updateRelatedEdges(),u.length>0&&u.forEach(g=>this.fixEdge(g,d))}),this.cachedStyles=new Map,this.getOriginalFieldValue=(n,i,a)=>{var s;const o=this.cachedStyles.get(n)||[],l=((s=o.find(c=>c.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(c=>c.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=J9(n);(Array.isArray(a)?a:[a]).forEach(l=>{const{shape:c,fields:u}=l,h=typeof c=="function"?c(s):n.getShape(c);if(h){if(!u){this.scaleEntireElement(n.id,h,i);return}u.forEach(d=>{const f=this.getOriginalFieldValue(n.id,h,d);nt(f)&&(h.style[d]=f/i)})}})},this.skipIfExceedViewport=n=>{const{viewport:i}=this.context;return!(i!=null&&i.isInViewport(n.getRenderBounds(),!1,30))},this.fixNodeLike=(n,i)=>{const a=F(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(F(h)));const u=this.options[l.type];if(!u){this.scaleEntireElement(a,l,i);return}this.scaleSpecificShapes(l,i,u)},this.fixEdge=(n,i)=>{const a=F(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=>uw(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(wr(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(F(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(X.AFTER_DRAW,this.resetTransform),t.on(X.AFTER_TRANSFORM,this.fixElementSize)}unbindEvents(){const{graph:t}=this.context;t.off(X.AFTER_DRAW,this.resetTransform),t.off(X.AFTER_TRANSFORM,this.fixElementSize)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return at(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}dh.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 tB=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class fh extends xn{constructor(t,e){super(t,Object.assign({},fh.defaultOptions,e)),this.focus=n=>tB(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(),$a.forEach(e=>{t.on(`${e}:${z.CLICK}`,this.focus)})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return at(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;$a.forEach(e=>{t.off(`${e}:${z.CLICK}`,this.focus)})}destroy(){this.unbindEvents(),super.destroy()}}fh.defaultOptions={animation:{easing:"ease-in",duration:500},enable:!0};class gh extends xn{constructor(t,e){super(t,Object.assign({},gh.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===z.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,c=this.getActiveIds(n),u={};if(s&&Object.assign(u,this.getElementsState(c,s,i)),l){const h=pT(a.getData(),!0).filter(d=>!c.includes(d));Object.assign(u,this.getElementsState(h,l,i))}a.setElementState(u,o)},this.getElementsState=(n,i,a)=>{const{graph:s}=this.context,o={};return n.forEach(l=>{const c=s.getElementState(l);a?o[l]=c.includes(i)?c:[...c,i]:o[l]=c.filter(u=>u!==i)}),o},this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),$a.forEach(n=>{t.on(`${n}:${z.POINTER_ENTER}`,this.hoverElement),t.on(`${n}:${z.POINTER_LEAVE}`,this.hoverElement)});const e=this.context.canvas.document;e.addEventListener(`${z.DRAG_START}`,this.toggleFrozen),e.addEventListener(`${z.DRAG_END}`,this.toggleFrozen)}getActiveIds(t){const{graph:e}=this.context,{degree:n,direction:i}=this.options,a=t.target.id;return n?CT(e,t.targetType,a,typeof n=="function"?n(t):n,i):[a]}validate(t){if(this.destroyed||this.isFrozen||sh(t.target)||this.context.graph.isCollapsingExpanding)return!1;const{enable:e}=this.options;return at(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;$a.forEach(n=>{t.off(`${n}:${z.POINTER_ENTER}`,this.hoverElement),t.off(`${n}:${z.POINTER_LEAVE}`,this.hoverElement)});const e=this.context.canvas.document;e.removeEventListener(`${z.DRAG_START}`,this.toggleFrozen),e.removeEventListener(`${z.DRAG_END}`,this.toggleFrozen)}destroy(){this.unbindEvents(),super.destroy()}}gh.defaultOptions={animation:!1,enable:!0,degree:0,direction:"both",state:"active",inactiveState:void 0};class eB extends al{onPointerDown(t){if(!super.validate(t)||!super.isKeydown()||this.points)return;const{canvas:e}=this.context;this.pathShape=new Tn({id:"g6-lasso-select",style:this.options.style}),e.appendChild(this.pathShape),this.points=[pu(t)]}onPointerMove(t){var e;if(!this.points)return;const{immediately:n,mode:i}=this.options;this.points.push(pu(t)),(e=this.pathShape)===null||e===void 0||e.setAttribute("d",U9(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 vh extends xn{constructor(t,e){super(t,Object.assign({},vh.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):Ba(s,i,a)})},this.filterShapes=(n,i)=>{if(at(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=Zo(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(X.BEFORE_TRANSFORM,this.hideShapes),t.on(X.AFTER_TRANSFORM,this.showShapes)}unbindEvents(){const{graph:t}=this.context;t.off(X.BEFORE_TRANSFORM,this.hideShapes),t.off(X.AFTER_TRANSFORM,this.showShapes)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return at(e)?e(t):!!e}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}vh.defaultOptions={enable:!0,debounce:200,shapes:r=>r==="node"};var hw=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class ph extends xn{constructor(t,e){super(t,Object.assign({},ph.defaultOptions,e)),this.onWheel=n=>hw(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 Ds(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){var t,e;const{trigger:n}=this.options;if(this.shortcut.unbindAll(),me(n)){(t=this.graphDom)===null||t===void 0||t.removeEventListener(z.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(z.WHEEL,this.onWheel,{passive:!1})}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}formatDisplacement(t){const{sensitivity:e}=this.options;return t=Gr(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,c,u]=Pr(this.options.range),h=[s*o,a*l,s*c,a*u],d=ea(b1(n.getCanvasCenter()),h),f=$t(n.getViewportCenter(),[t,e,0]);if(!cr(f,d)){const{min:[g,v],max:[p,m]}=d;(f[0]<g&&t>0||f[0]>p&&t<0)&&(t=0),(f[1]<v&&e>0||f[1]>m&&e<0)&&(e=0)}return[t,e]}scroll(t,e){return hw(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 at(e)?e(t):!!e}destroy(){var t;this.shortcut.destroy(),(t=this.graphDom)===null||t===void 0||t.removeEventListener(z.WHEEL,this.onWheel),super.destroy()}}ph.defaultOptions={enable:!0,sensitivity:1,preventDefault:!0,range:1/0};var dw=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class mh extends xn{constructor(t,e){super(t,Object.assign({},mh.defaultOptions,e)),this.zoom=(n,i,a)=>dw(this,void 0,void 0,function*(){if(!this.validate(i))return;const{graph:s}=this.context;let o;"viewport"in i&&(o=Ge(i.viewport));const{sensitivity:l,onFinish:c}=this.options,u=1+ce(n,-50,50)*l/100,h=s.getZoom();yield s.zoomTo(h*u,a,o),c==null||c()}),this.onReset=()=>dw(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 Ds(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(z.PINCH))this.shortcut.bind([z.PINCH],e=>{this.zoom(e.scale,e,!1)});else{const e=this.context.canvas.getContainer();e==null||e.addEventListener(z.WHEEL,this.preventDefault),this.shortcut.bind([...t,z.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 at(e)?e(t):!!e}destroy(){var t;this.shortcut.destroy(),(t=this.context.canvas.getContainer())===null||t===void 0||t.removeEventListener(z.WHEEL,this.preventDefault),super.destroy()}}mh.defaultOptions={animation:{duration:200},enable:!0,sensitivity:1,trigger:[],preventDefault:!0};function nB(r,t,e,n){return n===void 0&&(n="height"),e==="center"?(r[n]+t[n])/2:r.height}var ia={assign:Object.assign,getHeight:nB},rO=ia,D1=18,rB=D1*2,fw=D1,iB={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||fw},getVGap:function(t){return t.vgap||fw},getChildren:function(t){return t.children},getHeight:function(t){return t.height||rB},getWidth:function(t){var e=t.label||" ";return t.width||e.split("").length*D1}};function Eu(r,t){var e=this;if(e.vgap=e.hgap=0,r instanceof Eu)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}rO.assign(Eu.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 aB(r,t,e){t===void 0&&(t={}),t=rO.assign({},iB,t);var n=new Eu(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 c=new Eu(s[l],t);a.children[l]=c,i.push(c),c.parent=a,c.depth=a.depth+1}}}return n}var iO=aB,sB=iO,oB=function(){function r(e,n){n===void 0&&(n={});var i=this;i.options=n,i.rootNode=sB(e,n)}var t=r.prototype;return t.execute=function(){throw new Error("please override this method")},r}(),yh=oB;function lo(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}lo.fromNode=function(r,t){if(!r)return null;var e=[];return r.children.forEach(function(n){e.push(lo.fromNode(n,t))}),t?new lo(r.height,r.width,r.x,e):new lo(r.width,r.height,r.y,e)};function aO(r,t,e){e?r.y+=t:r.x+=t,r.children.forEach(function(n){aO(n,t,e)})}function sO(r,t){var e=t?r.y:r.x;return r.children.forEach(function(n){e=Math.min(sO(n,t),e)}),e}function lB(r,t){var e=sO(r,t);aO(r,-e,t)}function oO(r,t,e){e?t.y=r.x:t.x=r.x,r.c.forEach(function(n,i){oO(n,t.children[i],e)})}function lO(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){lO(n,t,e)})}var cB=function(r,t){t===void 0&&(t={});var e=t.isHorizontal;function n(y){if(y.cs===0){i(y);return}n(y.c[0]);for(var b=p(c(y.c[0].el),0,null),w=1;w<y.cs;++w){n(y.c[w]);var x=c(y.c[w].er);a(y,w,b),b=p(x,w,b)}d(y),i(y)}function i(y){y.cs===0?(y.el=y,y.er=y,y.msel=y.mser=0):(y.el=y.c[0].el,y.msel=y.c[0].msel,y.er=y.c[y.cs-1].er,y.mser=y.c[y.cs-1].mser)}function a(y,b,w){for(var x=y.c[b-1],S=x.mod,E=y.c[b],_=E.mod;x!==null&&E!==null;){c(x)>w.low&&(w=w.nxt);var C=S+x.prelim+x.w-(_+E.prelim);C>0&&(_+=C,s(y,b,w.index,C));var k=c(x),M=c(E);k<=M&&(x=l(x),x!==null&&(S+=x.mod)),k>=M&&(E=o(E),E!==null&&(_+=E.mod))}!x&&E?u(y,b,E,_):x&&!E&&h(y,b,x,S)}function s(y,b,w,x){y.c[b].mod+=x,y.c[b].msel+=x,y.c[b].mser+=x,g(y,b,w,x)}function o(y){return y.cs===0?y.tl:y.c[0]}function l(y){return y.cs===0?y.tr:y.c[y.cs-1]}function c(y){return y.y+y.h}function u(y,b,w,x){var S=y.c[0].el;S.tl=w;var E=x-w.mod-y.c[0].msel;S.mod+=E,S.prelim-=E,y.c[0].el=y.c[b].el,y.c[0].msel=y.c[b].msel}function h(y,b,w,x){var S=y.c[b].er;S.tr=w;var E=x-w.mod-y.c[b].mser;S.mod+=E,S.prelim-=E,y.c[b].er=y.c[b-1].er,y.c[b].mser=y.c[b-1].mser}function d(y){y.prelim=(y.c[0].prelim+y.c[0].mod+y.c[y.cs-1].mod+y.c[y.cs-1].prelim+y.c[y.cs-1].w)/2-y.w/2}function f(y,b){b+=y.mod,y.x=y.prelim+b,v(y);for(var w=0;w<y.cs;w++)f(y.c[w],b)}function g(y,b,w,x){if(w!==b-1){var S=b-w;y.c[w+1].shift+=x/S,y.c[b].shift-=x/S,y.c[b].change-=x-x/S}}function v(y){for(var b=0,w=0,x=0;x<y.cs;x++)b+=y.c[x].shift,w+=b+y.c[x].change,y.c[x].mod+=w}function p(y,b,w){for(;w!==null&&y>=w.low;)w=w.nxt;return{low:y,index:b,nxt:w}}lO(r,e);var m=lo.fromNode(r,e);return n(m),f(m,0),oO(m,r,e),lB(r,e),r},gw=iO,cO=function(r,t){for(var e=gw(r.data,t,!0),n=gw(r.data,t,!0),i=r.children.length,a=Math.round(i/2),s=t.getSide||function(u,h){return h<a?"right":"left"},o=0;o<i;o++){var l=r.children[o],c=s(l,o);c==="right"?n.children.push(l):e.children.push(l)}return e.eachNode(function(u){u.isRoot()||(u.side="left")}),n.eachNode(function(u){u.isRoot()||(u.side="right")}),{left:e,right:n}},uB=cO,Ei=["LR","RL","TB","BT","H","V"],hB=["LR","RL","H"],dB=function(t){return hB.indexOf(t)>-1},fB=Ei[0],I1=function(r,t,e){var n=t.direction||fB;if(t.isHorizontal=dB(n),Ei.indexOf(n)===-1)throw new TypeError("Invalid direction: "+n);if(n===Ei[0])e(r,t);else if(n===Ei[1])e(r,t),r.right2left();else if(n===Ei[2])e(r,t);else if(n===Ei[3])e(r,t),r.bottom2top();else if(n===Ei[4]||n===Ei[5]){var i=uB(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)),gB(r,t),r};function gB(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(u){o++;var h=u.x,d=u.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 c=Math.PI*2/o;r.DFTraverse(function(u){var h=(u[i]-a[i])/l*(Math.PI*2-c)+c,d=u[n]-r[n];u.x=Math.cos(h)*d,u.y=Math.sin(h)*d})}}function vB(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,vy(r,t)}function vy(r,t){return vy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},vy(r,t)}var pB=yh,mB=cB,yB=I1,bB=ia,wB=function(r){function t(){return r.apply(this,arguments)||this}vB(t,r);var e=t.prototype;return e.execute=function(){var i=this;return yB(i.rootNode,i.options,mB)},t}(pB),xB={};function EB(r,t){return t=bB.assign({},xB,t),new wB(r,t).execute()}var SB=EB,_B=ia;function kB(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 MB={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function uO(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){uO(n,t.children[i],e)})}var CB=function(r,t){t===void 0&&(t={}),t=_B.assign({},MB,t);var e=0;function n(l){if(!l)return null;l.width=0,l.depth&&l.depth>e&&(e=l.depth);var c=l.children,u=c.length,h=new kB(l.height,[]);return c.forEach(function(d,f){var g=n(d);h.children.push(g),f===0&&(h.leftChild=g),f===u-1&&(h.rightChild=g)}),h.originNode=l,h.isLeaf=l.isLeaf(),h}function i(l){if(l.isLeaf||l.children.length===0)l.drawingDepth=e;else{var c=l.children.map(function(h){return i(h)}),u=Math.min.apply(null,c);l.drawingDepth=u-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(c){s(c)}),l.y=(l.leftChild.y+l.rightChild.y)/2)}var o=n(r);return i(o),s(o),uO(o,r,t.isHorizontal),r};function TB(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,py(r,t)}function py(r,t){return py=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},py(r,t)}var OB=yh,AB=CB,PB=I1,NB=ia,RB=function(r){function t(){return r.apply(this,arguments)||this}TB(t,r);var e=t.prototype;return e.execute=function(){var i=this;return i.rootNode.width=0,PB(i.rootNode,i.options,AB)},t}(OB),LB={};function DB(r,t){return t=NB.assign({},LB,t),new RB(r,t).execute()}var IB=DB,vw=ia;function FB(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+vw.getHeight(t,r,i),t.parent&&r.parent.id!==t.parent.id){var s=t.parent,o=s.y+vw.getHeight(s,r,i);r.y=o>r.y?o:r.y}}else r.y=0}var BB=function(r,t,e,n){var i=null;r.eachNode(function(a){FB(a,i,t,e,n),i=a})};function zB(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,my(r,t)}function my(r,t){return my=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},my(r,t)}var $B=yh,dc=BB,jB=cO,qB=ia,co=["LR","RL","H"],GB=co[0],WB=function(r){function t(){return r.apply(this,arguments)||this}zB(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,c=a.dropCap,u=c===void 0?!0:c,h=a.direction,d=h===void 0?GB:h,f=a.align;if(d&&co.indexOf(d)===-1)throw new TypeError("Invalid direction: "+d);if(d===co[0])dc(s,l,u,f);else if(d===co[1])dc(s,l,u,f),s.right2left();else if(d===co[2]){var g=jB(s,a),v=g.left,p=g.right;dc(v,l,u,f),v.right2left(),dc(p,l,u,f);var m=v.getBoundingBox();p.translate(m.width,0),s.x=p.x-s.width/2}return s},t}($B),VB={};function HB(r,t){return t=qB.assign({},VB,t),new WB(r,t).execute()}var UB=HB,YB=ia;function hO(r,t){var e=0;return r.children.length?r.children.forEach(function(n){e+=hO(n,t)}):e=r.height,r._subTreeSep=t.getSubTreeSep(r.data),r.totalHeight=Math.max(r.height,e)+2*r._subTreeSep,r.totalHeight}function dO(r){var t=r.children,e=t.length;if(e){t.forEach(function(l){dO(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 XB={getSubTreeSep:function(){return 0}},KB=function(r,t){t===void 0&&(t={}),t=YB.assign({},XB,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,hO(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}}}}),dO(r)};function ZB(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,yy(r,t)}function yy(r,t){return yy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},yy(r,t)}var JB=yh,QB=KB,tz=I1,ez=ia,nz=function(r){function t(){return r.apply(this,arguments)||this}ZB(t,r);var e=t.prototype;return e.execute=function(){var i=this;return tz(i.rootNode,i.options,QB)},t}(JB),rz={};function iz(r,t){return t=ez.assign({},rz,t),new nz(r,t).execute()}var az=iz,sz={compactBox:SB,dendrogram:IB,indented:UB,mindmap:az},fc=sz;const oz=(r,t)=>{if(r!=="next"&&r!=="prev")return t},pw=r=>{r.prev.next=r.next,r.next.prev=r.prev,delete r.next,delete r.prev};let lz=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 pw(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&pw(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,oz)),n=n==null?void 0:n.prev;return`[${t.join(", ")}]`}},cz=class extends lz{};const uz=()=>1,hz=(r,t)=>{var e;if(r.getAllNodes().length<=1)return[];const n=fz(r,t||uz);return(e=dz(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()},dz=(r,t,e)=>{let n=[];const i=t[t.length-1],a=t[0];let s;for(;r.getAllNodes().length;){for(;s=a.dequeue();)hf(r,t,e,s);for(;s=i.dequeue();)hf(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(hf(r,t,e,s,!0));break}}}return n},hf=(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 c=l.data.weight,u=r.getNode(l.source);i&&o.push({v:l.source,w:l.target,in:0,out:0}),u.data.out===void 0&&(u.data.out=0),u.data.out-=c,by(t,e,Object.assign({v:u.id},u.data))}),(s=r.getRelatedEdges(n.v,"out"))===null||s===void 0||s.forEach(l=>{const c=l.data.weight,u=l.target,h=r.getNode(u);h.data.in===void 0&&(h.data.in=0),h.data.in-=c,by(t,e,Object.assign({v:h.id},h.data))}),r.removeNode(n.v)),i?o:void 0},fz=(r,t)=>{const e=new Ne;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 c=e.getRelatedEdges(l.source,"out").find(h=>h.target===l.target),u=(t==null?void 0:t(l))||1;c?e.updateEdgeData(c==null?void 0:c.id,Object.assign(Object.assign({},c.data),{weight:c.data.weight+u})):e.addEdge({id:l.id,source:l.source,target:l.target,data:{weight:u}}),i=Math.max(i,e.getNode(l.source).data.out+=u),n=Math.max(n,e.getNode(l.target).data.in+=u)});const a=[],s=i+n+3;for(let l=0;l<s;l++)a.push(new cz);const o=n+1;return e.getAllNodes().forEach(l=>{by(a,o,Object.assign({v:l.id},e.getNode(l.id).data))}),{buckets:a,zeroIdx:o,graph:e}},by=(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)},gz=(r,t)=>{const n=hz(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)})})},vz=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})})}})},pz=(r,t)=>Number(r)-Number(t),Fs=(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},mz=r=>{const t=new Ne;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},fO=r=>{const t=new Ne;return r.getAllNodes().forEach(e=>{r.getChildren(e.id).length||t.addNode(Object.assign({},e))}),r.getAllEdges().forEach(e=>{t.addEdge(e)}),t},yz=(r,t)=>r==null?void 0:r.reduce((e,n,i)=>(e[n]=t[i],e),{}),mw=(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,c;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,c=o):(i<0&&(s=-s),l=s,c=s*a/i),{x:e+l,y:n+c}},qo=r=>{const t=[],e=gO(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)=>pz(r.getNode(i).data.order,r.getNode(a).data.order));return t},bz=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)})},wz=(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(c=>{const u=r.getNode(c);u&&(u.data.rank=u.data.rank||0,u.data.rank+=s)}))}},yw=(r,t,e,n)=>{const i={width:0,height:0};return nt(e)&&nt(n)&&(i.rank=e,i.order=n),Fs(r,"border",i,t)},gO=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},xz=(r,t)=>{const e={lhs:[],rhs:[]};return r==null||r.forEach(n=>{t(n)?e.lhs.push(n):e.rhs.push(n)}),e},F1=(r,t)=>r.reduce((e,n)=>{const i=t(e),a=t(n);return i>a?n:e}),vO=(r,t,e,n,i,a)=>{n.includes(t.id)||(n.push(t.id),e||a.push(t.id),i(t.id).forEach(s=>vO(r,s,e,n,i,a)),e&&a.push(t.id))},pO=(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))vO(r,l,e==="post",o,a,s);else throw new Error(`Graph does not have node: ${l}`)}),s},Ez=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)bw(r,"borderLeft","_bl",e,i,a),bw(r,"borderRight","_br",e,i,a)}};r.getRoots().forEach(e=>t(e.id))},bw=(r,t,e,n,i,a)=>{const s={rank:a,borderType:t,width:0,height:0},o=i.data[t][a-1],l=Fs(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}})},Sz=(r,t)=>{const e=t.toLowerCase();(e==="lr"||e==="rl")&&mO(r)},_z=(r,t)=>{const e=t.toLowerCase();(e==="bt"||e==="rl")&&kz(r),(e==="lr"||e==="rl")&&(Mz(r),mO(r))},mO=r=>{r.getAllNodes().forEach(t=>{ww(t)}),r.getAllEdges().forEach(t=>{ww(t)})},ww=r=>{const t=r.data.width;r.data.width=r.data.height,r.data.height=t},kz=r=>{r.getAllNodes().forEach(t=>{df(t.data)}),r.getAllEdges().forEach(t=>{var e;(e=t.data.points)===null||e===void 0||e.forEach(n=>df(n)),t.data.hasOwnProperty("y")&&df(t.data)})},df=r=>{r!=null&&r.y&&(r.y=-r.y)},Mz=r=>{r.getAllNodes().forEach(t=>{ff(t.data)}),r.getAllEdges().forEach(t=>{var e;(e=t.data.points)===null||e===void 0||e.forEach(n=>ff(n)),t.data.hasOwnProperty("x")&&ff(t.data)})},ff=r=>{const t=r.x;r.x=r.y,r.y=t},Cz=r=>{const t=Fs(r,"root",{},"_root"),e=Tz(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=Oz(r)+1;return r.getRoots().forEach(o=>{yO(r,t,a,s,i,e,o.id)}),{nestingRoot:t,nodeRankFactor:a}},yO=(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=yw(r,"_bt"),c=yw(r,"_bb"),u=r.getNode(s);r.setParent(l,s),u.data.borderTop=l,r.setParent(c,s),u.data.borderBottom=c,o==null||o.forEach(h=>{yO(r,t,e,n,i,a,h.id);const d=h.data.borderTop?h.data.borderTop:h.id,f=h.data.borderBottom?h.data.borderBottom:h.id,g=h.data.borderTop?n:2*n,v=d!==f?1:i-a[s]+1;r.addEdge({id:`e${Math.random()}`,source:l,target:d,data:{minlen:v,weight:g,nestingEdge:!0}}),r.addEdge({id:`e${Math.random()}`,source:f,target:c,data:{minlen:v,weight:g,nestingEdge:!0}})}),r.getParent(s)||r.addEdge({id:`e${Math.random()}`,source:t,target:l,data:{weight:0,minlen:i+a[s]}})},Tz=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},Oz=r=>{let t=0;return r.getAllEdges().forEach(e=>{t+=e.data.weight}),t},Az=(r,t)=>{t&&r.removeNode(t),r.getAllEdges().forEach(e=>{e.data.nestingEdge&&r.removeEdge(e.id)})},Pz="edge",bO="edge-label",Nz=(r,t)=>{r.getAllEdges().forEach(e=>Rz(r,e,t))},Rz=(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,c,u;for(u=0,++i;i<s;++u,++i)t.data.points=[],c={originalEdge:t,width:0,height:0,rank:i},l=Fs(r,Pz,c,"_d"),i===o&&(c.width=t.data.width,c.height=t.data.height,c.dummy=bO,c.labelpos=t.data.labelpos),r.addEdge({id:`e${Math.random()}`,source:n,target:l,data:{weight:t.data.weight}}),u===0&&e.push(l),n=l;r.addEdge({id:`e${Math.random()}`,source:n,target:a,data:{weight:t.data.weight}})},Lz=(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===bO&&(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)})},Dz=(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}})},Iz=(r,t,e)=>{const n=Fz(r),i=new Ne({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 c=i.getRelatedEdges(l,"out").find(({target:h})=>h===a.id),u=c!==void 0?c.data.weight:0;c?i.updateEdgeData(c.id,Object.assign(Object.assign({},c.data),{weight:o.data.weight+u})):i.addEdge({id:o.id,source:l,target:a.id,data:{weight:o.data.weight+u}})}),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},Fz=r=>{let t;for(;r.hasNode(t=`_root${Math.random()}`););return t},Bz=(r,t,e)=>{const n=yz(e,e.map((u,h)=>h)),a=t.map(u=>{const h=r.getRelatedEdges(u,"out").map(d=>({pos:n[d.target]||0,weight:d.data.weight}));return h==null?void 0:h.sort((d,f)=>d.pos-f.pos)}).flat().filter(u=>u!==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 c=0;return a==null||a.forEach(u=>{if(u){let h=u.pos+s;l[h]+=u.weight;let d=0;for(;h>0;)h%2&&(d+=l[h+1]),h=h-1>>1,l[h]+=u.weight;c+=u.weight*d}}),c},xw=(r,t)=>{let e=0;for(let n=1;n<(t==null?void 0:t.length);n+=1)e+=Bz(r,t[n-1],t[n]);return e},Ew=r=>{const t={},e=r.getAllNodes(),n=e.map(c=>{var u;return(u=c.data.rank)!==null&&u!==void 0?u:-1/0}),i=Math.max(...n),a=[];for(let c=0;c<i+1;c++)a.push([]);const s=e.sort((c,u)=>r.getNode(c.id).data.rank-r.getNode(u.id).data.rank),l=s.filter(c=>r.getNode(c.id).data.fixorder!==void 0).sort((c,u)=>r.getNode(c.id).data.fixorder-r.getNode(u.id).data.fixorder);return l==null||l.forEach(c=>{isNaN(r.getNode(c.id).data.rank)||a[r.getNode(c.id).data.rank].push(c.id),t[c.id]=!0}),s==null||s.forEach(c=>r.dfsTree(c.id,u=>{if(t.hasOwnProperty(u.id))return!0;t[u.id]=!0,isNaN(u.data.rank)||a[u.data.rank].push(u.id)})),a},zz=(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}}),$z=(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 c=a[o.v];o.barycenter!==void 0&&(c.barycenter=o.barycenter,c.weight=o.weight)}),(e=t.getAllEdges())===null||e===void 0||e.forEach(o=>{const l=a[o.source],c=a[o.target];l!==void 0&&c!==void 0&&(c.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 jz(s)},jz=r=>{var t,e;const n=[],i=l=>c=>{c.merged||(c.barycenter===void 0||l.barycenter===void 0||c.barycenter>=l.barycenter)&&qz(l,c)},a=l=>c=>{c.in.push(l),--c.indegree===0&&r.push(c)};for(;r!=null&&r.length;){const l=r.pop();n.push(l),(t=l.in.reverse())===null||t===void 0||t.forEach(c=>i(l)(c)),(e=l.out)===null||e===void 0||e.forEach(c=>a(l)(c))}const s=n.filter(l=>!l.merged),o=["vs","i","barycenter","weight"];return s.map(l=>{const c={};return o==null||o.forEach(u=>{l[u]!==void 0&&(c[u]=l[u])}),c})},qz=(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},Gz=(r,t,e,n)=>{const i=xz(r,d=>{const f=d.hasOwnProperty("fixorder")&&!isNaN(d.fixorder);return n?!f&&d.hasOwnProperty("barycenter"):f||d.hasOwnProperty("barycenter")}),a=i.lhs,s=i.rhs.sort((d,f)=>-d.i- -f.i),o=[];let l=0,c=0,u=0;a==null||a.sort(Wz(!!t,!!e)),u=Sw(o,s,u),a==null||a.forEach(d=>{var f;u+=(f=d.vs)===null||f===void 0?void 0:f.length,o.push(d.vs),l+=d.barycenter*d.weight,c+=d.weight,u=Sw(o,s,u)});const h={vs:o.flat()};return c&&(h.barycenter=l/c,h.weight=c),h},Sw=(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},Wz=(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},wO=(r,t,e,n,i,a)=>{var s,o,l,c;let u=r.getChildren(t).map(y=>y.id);const h=r.getNode(t),d=h?h.data.borderLeft:void 0,f=h?h.data.borderRight:void 0,g={};d&&(u=u==null?void 0:u.filter(y=>y!==d&&y!==f));const v=zz(r,u||[]);v==null||v.forEach(y=>{var b;if(!((b=r.getChildren(y.v))===null||b===void 0)&&b.length){const w=wO(r,y.v,e,n,a);g[y.v]=w,w.hasOwnProperty("barycenter")&&Hz(y,w)}});const p=$z(v,e);Vz(p,g),(s=p.filter(y=>y.vs.length>0))===null||s===void 0||s.forEach(y=>{const b=r.getNode(y.vs[0]);b&&(y.fixorder=b.data.fixorder,y.order=b.data.order)});const m=Gz(p,n,i,a);if(d&&(m.vs=[d,m.vs,f].flat(),!((o=r.getPredecessors(d))===null||o===void 0)&&o.length)){const y=r.getNode(((l=r.getPredecessors(d))===null||l===void 0?void 0:l[0].id)||""),b=r.getNode(((c=r.getPredecessors(f))===null||c===void 0?void 0:c[0].id)||"");m.hasOwnProperty("barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+y.data.order+b.data.order)/(m.weight+2),m.weight+=2}return m},Vz=(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()})},Hz=(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)},Uz=(r,t)=>{const e=gO(r),n=[],i=[];for(let u=1;u<e+1;u++)n.push(u);for(let u=e-1;u>-1;u--)i.push(u);const a=_w(r,n,"in"),s=_w(r,i,"out");let o=Ew(r);gf(r,o);let l=Number.POSITIVE_INFINITY,c;for(let u=0,h=0;h<4;++u,++h){kw(u%2?a:s,u%4>=2,!1,t),o=qo(r);const d=xw(r,o);d<l&&(h=0,c=Vi(o),l=d)}o=Ew(r),gf(r,o);for(let u=0,h=0;h<4;++u,++h){kw(u%2?a:s,u%4>=2,!0,t),o=qo(r);const d=xw(r,o);d<l&&(h=0,c=Vi(o),l=d)}gf(r,c)},_w=(r,t,e)=>t.map(n=>Iz(r,n,e)),kw=(r,t,e,n)=>{const i=new Ne;r==null||r.forEach(a=>{var s;const o=a.getRoots()[0].id,l=wO(a,o,i,t,e,n);for(let c=0;c<((s=l.vs)===null||s===void 0?void 0:s.length);c++){const u=a.getNode(l.vs[c]);u&&(u.data.order=c)}Dz(a,i,l.vs)})},gf=(r,t)=>{t==null||t.forEach(e=>{e==null||e.forEach((n,i)=>{r.getNode(n).data.order=i})})},Yz=(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))})},Xz=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},Kz=(r,t,e,n)=>{var i,a;const s=[],o=[],l=Math.min(t[e].low,t[n].low),c=Math.max(t[e].lim,t[n].lim);let u,h;u=e;do u=(i=r.getParent(u))===null||i===void 0?void 0:i.id,s.push(u);while(u&&(t[u].low>l||c>t[u].lim));for(h=u,u=n;u&&u!==h;)o.push(u),u=(a=r.getParent(u))===null||a===void 0?void 0:a.id;return{lca:h,path:s.concat(o.reverse())}},Zz=(r,t)=>{const e=Xz(r);t.forEach(n=>{var i,a;let s=n,o=r.getNode(s);const l=o.data.originalEdge;if(!l)return;const c=Kz(r,e,l.source,l.target),u=c.path,h=c.lca;let d=0,f=u[d],g=!0;for(;s!==l.target;){if(o=r.getNode(s),g){for(;f!==h&&((i=r.getNode(f))===null||i===void 0?void 0:i.data.maxRank)<o.data.rank;)d++,f=u[d];f===h&&(g=!1)}if(!g){for(;d<u.length-1&&((a=r.getNode(u[d+1]))===null||a===void 0?void 0:a.data.minRank)<=o.data.rank;)d++;f=u[d]}r.hasNode(f)&&r.setParent(s,f),s=r.getSuccessors(s)[0].id}})},Jz=(r,t)=>{const e={},n=(i,a)=>{let s=0,o=0;const l=i.length,c=a==null?void 0:a[(a==null?void 0:a.length)-1];return a==null||a.forEach((u,h)=>{var d;const f=t$(r,u),g=f?r.getNode(f.id).data.order:l;(f||u===c)&&((d=a.slice(o,h+1))===null||d===void 0||d.forEach(v=>{var p;(p=r.getPredecessors(v))===null||p===void 0||p.forEach(m=>{var y;const b=r.getNode(m.id),w=b.data.order;(w<s||g<w)&&!(b.data.dummy&&(!((y=r.getNode(v))===null||y===void 0)&&y.data.dummy))&&xO(e,m.id,v)})}),o=h+1,s=g)}),a};return t!=null&&t.length&&t.reduce(n),e},Qz=(r,t)=>{const e={};function n(o,l,c,u,h){var d,f;let g;for(let v=l;v<c;v++)g=o[v],!((d=r.getNode(g))===null||d===void 0)&&d.data.dummy&&((f=r.getPredecessors(g))===null||f===void 0||f.forEach(p=>{const m=r.getNode(p.id);m.data.dummy&&(m.data.order<u||m.data.order>h)&&xO(e,p.id,g)}))}function i(o){return JSON.stringify(o.slice(1))}function a(o,l){const c=i(o);l.get(c)||(n(...o),l.set(c,!0))}const s=(o,l)=>{let c=-1,u,h=0;const d=new Map;return l==null||l.forEach((f,g)=>{var v;if(((v=r.getNode(f))===null||v===void 0?void 0:v.data.dummy)==="border"){const p=r.getPredecessors(f)||[];p.length&&(u=r.getNode(p[0].id).data.order,a([l,h,g,c,u],d),h=g,c=u)}a([l,h,l.length,u,o.length],d)}),l};return t!=null&&t.length&&t.reduce(s),e},t$=(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)},xO=(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},e$=(r,t,e)=>{let n=t,i=e;if(n>i){const a=t;n=i,i=a}return!!r[n]},n$=(r,t,e,n)=>{const i={},a={},s={};return t==null||t.forEach(o=>{o==null||o.forEach((l,c)=>{i[l]=l,a[l]=l,s[l]=c})}),t==null||t.forEach(o=>{let l=-1;o==null||o.forEach(c=>{let u=n(c).map(h=>h.id);if(u.length){u=u.sort((d,f)=>s[d]-s[f]);const h=(u.length-1)/2;for(let d=Math.floor(h),f=Math.ceil(h);d<=f;++d){const g=u[d];a[c]===c&&l<s[g]&&!e$(e,c,g)&&(a[g]=c,a[c]=i[c]=i[g],l=s[g])}}})}),{root:i,align:a}},r$=(r,t,e,n,i,a,s)=>{var o;const l={},c=i$(r,t,e,i,a,s),u=s?"borderLeft":"borderRight",h=(g,v)=>{let p=c.getAllNodes(),m=p.pop();const y={};for(;m;)y[m.id]?g(m.id):(y[m.id]=!0,p.push(m),p=p.concat(v(m.id))),m=p.pop()},d=g=>{l[g]=(c.getRelatedEdges(g,"in")||[]).reduce((v,p)=>Math.max(v,(l[p.source]||0)+p.data.weight),0)},f=g=>{const v=(c.getRelatedEdges(g,"out")||[]).reduce((m,y)=>Math.min(m,(l[y.target]||0)-y.data.weight),Number.POSITIVE_INFINITY),p=r.getNode(g);v!==Number.POSITIVE_INFINITY&&p.data.borderType!==u&&(l[g]=Math.max(l[g],v))};return h(d,c.getPredecessors.bind(c)),h(f,c.getSuccessors.bind(c)),(o=Object.values(n))===null||o===void 0||o.forEach(g=>{l[g]=l[e[g]]}),l},i$=(r,t,e,n,i,a)=>{const s=new Ne,o=l$(n,i,a);return t==null||t.forEach(l=>{let c;l==null||l.forEach(u=>{const h=e[u];if(s.hasNode(h)||s.addNode({id:h,data:{}}),c){const d=e[c],f=s.getRelatedEdges(d,"out").find(g=>g.target===h);f?s.updateEdgeData(f.id,Object.assign(Object.assign({},f.data),{weight:Math.max(o(r,u,c),f.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:d,target:h,data:{weight:Math.max(o(r,u,c),0)}})}c=u})}),s},a$=(r,t)=>F1(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=c$(r,s)/2;i=Math.max(o+l,i),a=Math.min(o-l,a)}),i-a});function s$(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 c;if(l===t)return;const u=Object.values(l);c=s==="l"?n-Math.min(...u):i-Math.max(...u),c&&(r[o]={},Object.keys(l).forEach(h=>{r[o][h]=l[h]+c}))})})}const o$=(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},l$=(r,t,e)=>(n,i,a)=>{const s=n.getNode(i),o=n.getNode(a);let l=0,c=0;if(l+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":c=-s.data.width/2;break;case"r":c=s.data.width/2;break}if(c&&(l+=e?c:-c),c=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":c=o.data.width/2;break;case"r":c=-o.data.width/2;break}return c&&(l+=e?c:-c),c=0,l},c$=(r,t)=>r.getNode(t).data.width||0,u$=(r,t)=>{const{ranksep:e=0}=t||{},n=qo(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})},h$=(r,t)=>{const{align:e,nodesep:n=0,edgesep:i=0}=t||{},a=qo(r),s=Object.assign(Jz(r,a),Qz(r,a)),o={};let l=[];["u","d"].forEach(u=>{l=u==="u"?a:Object.values(a).reverse(),["l","r"].forEach(h=>{h==="r"&&(l=l.map(v=>Object.values(v).reverse()));const d=(u==="u"?r.getPredecessors:r.getSuccessors).bind(r),f=n$(r,l,s,d),g=r$(r,l,f.root,f.align,n,i,h==="r");h==="r"&&Object.keys(g).forEach(v=>g[v]=-g[v]),o[u+h]=g})});const c=a$(r,o);return c&&s$(o,c),o$(o,e)},d$=(r,t)=>{var e;const n=fO(r);u$(n,t);const i=h$(n,t);(e=Object.keys(i))===null||e===void 0||e.forEach(a=>{n.getNode(a).data.x=i[a]})},EO=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),c=o.data.minlen,u=l-c;u&&(s===void 0||u<s)&&(s=u)}),s||(s=0),a.data.rank=s,s};r.getAllNodes().filter(n=>r.getRelatedEdges(n.id,"in").length===0).forEach(n=>e(n.id))},f$=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 c;return(o=r.getRelatedEdges(s,"out"))===null||o===void 0||o.forEach(u=>{const h=n(u.target),d=u.data.minlen,f=h-d;f&&(c===void 0||f<c)&&(c=f)}),c||(c=0),(e===void 0||c<e)&&(e=c),l.data.rank=c,c};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 c=r.getNode(s),u=isNaN(c.data.layer)?o:c.data.layer;(c.data.rank===void 0||c.data.rank<u)&&(c.data.rank=u),!i[s]&&(i[s]=!0,(l=r.getRelatedEdges(s,"out"))===null||l===void 0||l.forEach(h=>{a(h.target,u+h.data.minlen)}))};r.getAllNodes().forEach(s=>{const o=s.data;o&&(isNaN(o.layer)?o.rank-=e:a(s.id,o.layer))})},Ui=(r,t)=>r.getNode(t.target).data.rank-r.getNode(t.source).data.rank-t.data.minlen,g$=r=>{const t=new Ne({tree:[]}),e=r.getAllNodes()[0],n=r.getAllNodes().length;t.addNode(e);let i,a;for(;v$(t,r)<n;)i=SO(t,r),a=t.hasNode(i.source)?Ui(r,i):-Ui(r,i),_O(t,r,a);return t},v$=(r,t)=>{const e=n=>{t.getRelatedEdges(n,"both").forEach(i=>{const a=i.source,s=n===a?i.target:a;!r.hasNode(s)&&!Ui(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},p$=r=>{const t=new Ne({tree:[]}),e=r.getAllNodes()[0],n=r.getAllNodes().length;t.addNode(e);let i,a;for(;m$(t,r)<n;)i=SO(t,r),a=t.hasNode(i.source)?Ui(r,i):-Ui(r,i),_O(t,r,a);return t},m$=(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||!Ui(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},SO=(r,t)=>F1(t.getAllEdges(),e=>r.hasNode(e.source)!==r.hasNode(e.target)?Ui(t,e):1/0),_O=(r,t,e)=>{r.getAllNodes().forEach(n=>{const i=t.getNode(n.id);i.data.rank||(i.data.rank=0),i.data.rank+=e})},y$=r=>{const t=mz(r);EO(t);const e=g$(t);MO(e),kO(e,t);let n,i;for(;n=x$(e);)i=E$(e,t,n),S$(e,t,n,i)},kO=(r,t)=>{let e=pO(r,r.getAllNodes(),"post");e=e.slice(0,(e==null?void 0:e.length)-1),e.forEach(n=>{b$(r,t,n)})},b$=(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=w$(r,t,e)},w$=(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 c=l.source===e,u=c?l.target:l.source;if(u!==i){const h=c===a,d=l.data.weight;if(o+=h?d:-d,k$(r,e,u)){const f=r.getRelatedEdges(e,"both").find(g=>g.source===u||g.target===u).data.cutvalue;o+=h?-f:f}}}),o},MO=(r,t=r.getAllNodes()[0].id)=>{CO(r,{},1,t)},CO=(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(c=>{t[c.id]||(o=CO(r,t,o,c.id,n))}),l.data.low=s,l.data.lim=o++,i?l.data.parent=i:delete l.data.parent,o},x$=r=>r.getAllEdges().find(t=>t.data.cutvalue<0),E$=(r,t,e)=>{let n=e.source,i=e.target;t.getRelatedEdges(n,"out").find(u=>u.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 c=t.getAllEdges().filter(u=>l===Mw(r.getNode(u.source),o)&&l!==Mw(r.getNode(u.target),o));return F1(c,u=>Ui(t,u))},S$=(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:{}}),MO(r),kO(r,t),_$(r,t)},_$=(r,t)=>{const e=r.getAllNodes().find(i=>!i.data.parent);let n=pO(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))})},k$=(r,t,e)=>r.getRelatedEdges(t,"both").find(n=>n.source===e||n.target===e),Mw=(r,t)=>t.data.low<=r.data.lim&&r.data.lim<=t.data.lim,M$=(r,t)=>{switch(t){case"network-simplex":T$(r);break;case"tight-tree":Cw(r);break;case"longest-path":C$(r);break;default:Cw(r)}},C$=EO,Cw=r=>{f$(r),p$(r)},T$=r=>{y$(r)},O$=(r,t)=>{const{edgeLabelSpace:e,keepNodeOrder:n,prevGraph:i,rankdir:a,ranksep:s}=t;!n&&i&&P$(r,i);const o=F$(r);e&&(t.ranksep=B$(o,{rankdir:a,ranksep:s}));let l;try{l=A$(o,t)}catch(c){if(c.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:
- `,c);return}throw c}return N$(r,o),l},A$=(r,t)=>{const{ranker:e,rankdir:n="tb",nodeOrder:i,keepNodeOrder:a,align:s,nodesep:o=50,edgesep:l=20,ranksep:c=50}=t;U$(r),gz(r);const{nestingRoot:u,nodeRankFactor:h}=Cz(r);M$(fO(r),e),z$(r),wz(r,h),Az(r,u),bz(r),$$(r),j$(r);const d=[];Nz(r,d),Zz(r,d),Ez(r),a&&Yz(r,i),Uz(r,a),Y$(r),Sz(r,n),d$(r,{align:s,nodesep:o,edgesep:l,ranksep:c}),X$(r),H$(r),Lz(r,d),W$(r),_z(r,n);const{width:f,height:g}=q$(r);return G$(r),V$(r),vz(r),{width:f,height:g}},P$=(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})},N$=(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)})},R$=["width","height","layer","fixorder"],L$={width:0,height:0},D$=["minlen","weight","width","height","labeloffset"],I$={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},vf=["labelpos"],F$=r=>{const t=new Ne({tree:[]});return r.getAllNodes().forEach(e=>{const n=Ow(r.getNode(e.id).data),i=Object.assign(Object.assign({},L$),n),a=Tw(i,R$);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);ot(s)||(t.hasNode(s.id)||t.addNode(Object.assign({},s)),t.setParent(e.id,s.id))}),r.getAllEdges().forEach(e=>{const n=Ow(r.getEdge(e.id).data),i={};vf==null||vf.forEach(a=>{n[a]!==void 0&&(i[a]=n[a])}),t.addEdge({id:e.id,source:e.source,target:e.target,data:Object.assign({},I$,Tw(n,D$),i)})}),t},B$=(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},z$=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};Fs(r,"edge-proxy",i,"_ep")}})},$$=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},j$=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))})},q$=(r,t)=>{let e,n=0,i,a=0;const{marginx:s=0,marginy:o=0}={},l=c=>{if(!c.data)return;const u=c.data.x,h=c.data.y,d=c.data.width,f=c.data.height;!isNaN(u)&&!isNaN(d)&&(e===void 0&&(e=u-d/2),e=Math.min(e,u-d/2),n=Math.max(n,u+d/2)),!isNaN(h)&&!isNaN(f)&&(i===void 0&&(i=h-f/2),i=Math.min(i,h-f/2),a=Math.max(a,h+f/2))};return r.getAllNodes().forEach(c=>{l(c)}),r.getAllEdges().forEach(c=>{c!=null&&c.data.hasOwnProperty("x")&&l(c)}),e-=s,i-=o,r.getAllNodes().forEach(c=>{c.data.x-=e,c.data.y-=i}),r.getAllEdges().forEach(c=>{var u;(u=c.data.points)===null||u===void 0||u.forEach(h=>{h.x-=e,h.y-=i}),c.data.hasOwnProperty("x")&&(c.data.x-=e),c.data.hasOwnProperty("y")&&(c.data.y-=i)}),{width:n-e+s,height:a-i+o}},G$=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(mw(e.data,i)),t.data.points.push(mw(n.data,a))})},W$=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}})},V$=r=>{r.getAllEdges().forEach(t=>{var e;t.data.reversed&&((e=t.data.points)===null||e===void 0||e.reverse())})},H$=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]),c=r.getNode(a.data.borderRight[((i=a.data.borderRight)===null||i===void 0?void 0:i.length)-1]);a.data.width=Math.abs((c==null?void 0:c.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)})},U$=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)}})},Y$=r=>{const t=qo(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=>{Fs(r,"selfedge",{width:l.data.width,height:l.data.height,rank:o.data.rank,order:a+ ++n,e:l},"_se")}),delete o.data.selfEdges})})},X$=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}})},Tw=(r,t)=>{const e={};return t==null||t.forEach(n=>{r[n]!==void 0&&(e[n]=+r[n])}),e},Ow=(r={})=>{const t={};return Object.keys(r).forEach(e=>{t[e.toLowerCase()]=r[e]}),t},Vr=Array.isArray,TO=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},OO=(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,c=a[o],u=a[l];c===void 0||u===void 0||(i[c][u]=1,i[u][c]=1)}),i},K$=(r,t)=>{const e=[];return r.forEach(n=>{const i=[];n.forEach(a=>{i.push(a*t)}),e.push(i)}),e},Z$=r=>{let t=1/0,e=1/0,n=-1/0,i=-1/0;return r.forEach(a=>{let s=a.data.size;Vr(s)?s.length===1&&(s=[s[0],s[0]]):nt(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],c=a.data.x+o[0],u=a.data.y-o[1],h=a.data.y+o[1];t>l&&(t=l),e>u&&(e=u),n<c&&(n=c),i<h&&(i=h)}),{minX:t,minY:e,maxX:n,maxY:i}},Aw=(r,t)=>Math.sqrt((r.x-t.x)*(r.x-t.x)+(r.y-t.y)*(r.y-t.y)),wy=(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 c=t[l];if(r.hasNode(c.id)&&!(s!=null&&s(c))){if(o!=null&&o(c))return;n==="TB"&&e(c),wy(r,r.getChildren(c.id,i),e,n,i,a),n!=="TB"&&e(c)}}},xy=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=>xy(e))}if(typeof r=="object"){const t={};return Object.keys(r).forEach(e=>{t[e]=xy(r[e])}),t}return r},On=(r,t)=>{const e=xy(r);return e.data=e.data||{},t&&(nt(e.data.x)||(e.data.x=Math.random()*t[0]),nt(e.data.y)||(e.data.y=Math.random()*t[1])),e};function dl(r){if(!r)return[0,0,0];if(nt(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 Aa(r,t){let e;return at(t)?e=t:nt(t)?e=()=>t:e=()=>r,e}function B1(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:me(i)&&i.width&&i.height?e?Math.max(i.width,i.height)||r:[i.width,i.height]:i:r}:at(t)?t:nt(t)?()=>t:Array.isArray(t)?()=>e?Math.max(...t)||r:t:me(t)&&t.width&&t.height?()=>e?Math.max(t.width,t.height)||r:[t.width,t.height]:()=>r}const z1=(r,t,e=10)=>{let n;const i=typeof t=="function"?t:()=>t||0;return r?Array.isArray(r)?n=s=>r:at(r)?n=r:n=s=>r:n=s=>{var o,l,c;if(!((o=s.data)===null||o===void 0)&&o.bboxSize)return(l=s.data)===null||l===void 0?void 0:l.bboxSize;if(!((c=s.data)===null||c===void 0)&&c.size){const u=s.data.size;return Array.isArray(u)?u:me(u)?[u.width,u.height]:u}return e},s=>{const o=n(s),l=i(s);return Math.max(...dl(o))+l}},J$={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};class Q${constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},J$),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,e)})}genericDagreLayout(t,e,n){return bt(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:c,ranksepFunc:u,nodesepFunc:h,edgeLabelSpace:d,ranker:f,nodeOrder:g,begin:v,controlPoints:p,radial:m,sortByCombo:y,preset:b}=i,w=new Ne({tree:[]}),x=Aa(l||50,u),S=Aa(c||50,h);let E=S,_=x;(o==="LR"||o==="RL")&&(E=x,_=S);const C=B1(10,a,!1),k=e.getAllNodes(),M=e.getAllEdges();k.forEach(A=>{const I=dl(C(A)),B=_(A),j=E(A),G=I[0]+2*j,H=I[1]+2*B,Y=A.data.layer;nt(Y)?w.addNode({id:A.id,data:{width:G,height:H,layer:Y}}):w.addNode({id:A.id,data:{width:G,height:H}})}),y&&(w.attachTreeStructure("combo"),k.forEach(A=>{const{parentId:I}=A.data;I!==void 0&&w.hasNode(I)&&w.setParent(A.id,I,"combo")})),M.forEach(A=>{w.addEdge({id:A.id,source:A.source,target:A.target,data:{weight:A.data.weight||1}})});let T;b!=null&&b.length&&(T=new Ne({nodes:b})),O$(w,{prevGraph:T,edgeLabelSpace:d,keepNodeOrder:!!g,nodeOrder:g||[],acyclicer:"greedy",ranker:f,rankdir:o,nodesep:c,align:s});const O=[0,0];if(v){let A=1/0,I=1/0;w.getAllNodes().forEach(B=>{A>B.data.x&&(A=B.data.x),I>B.data.y&&(I=B.data.y)}),w.getAllEdges().forEach(B=>{var j;(j=B.data.points)===null||j===void 0||j.forEach(G=>{A>G.x&&(A=G.x),I>G.y&&(I=G.y)})}),O[0]=v[0]-A,O[1]=v[1]-I}const R=o==="LR"||o==="RL";if(!m){const A=new Set,B=o==="BT"||o==="RL"?(Y,K)=>K-Y:(Y,K)=>Y-K;w.getAllNodes().forEach(Y=>{Y.data.x=Y.data.x+O[0],Y.data.y=Y.data.y+O[1],A.add(R?Y.data.x:Y.data.y)});const j=Array.from(A).sort(B),G=R?(Y,K)=>Y.x!==K.x:(Y,K)=>Y.y!==K.y,H=R?(Y,K,tt)=>{const it=Math.max(K.y,tt.y),_t=Math.min(K.y,tt.y);return Y.filter(Mt=>Mt.y<=it&&Mt.y>=_t)}:(Y,K,tt)=>{const it=Math.max(K.x,tt.x),_t=Math.min(K.x,tt.x);return Y.filter(Mt=>Mt.x<=it&&Mt.x>=_t)};w.getAllEdges().forEach((Y,K)=>{var tt;d&&p&&Y.data.type!=="loop"&&(Y.data.controlPoints=tj((tt=Y.data.points)===null||tt===void 0?void 0:tt.map(({x:it,y:_t})=>({x:it+O[0],y:_t+O[1]})),w.getNode(Y.source),w.getNode(Y.target),j,R,G,H))})}let D=[];D=w.getAllNodes().map(A=>On(A));const L=w.getAllEdges();return t&&(D.forEach(A=>{e.mergeNodeData(A.id,{x:A.data.x,y:A.data.y})}),L.forEach(A=>{e.mergeEdgeData(A.id,{controlPoints:A.data.controlPoints})})),{nodes:D,edges:L}})}}const tj=(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:c}=t.data,{x:u,y:h}=e.data;if(i&&(l=t.data.y,c=t.data.x,u=e.data.y,h=e.data.x),h!==c&&l!==u){const d=n.indexOf(c),f=n[d+1];if(f){const p=o[0],m=i?{x:(c+f)/2,y:(p==null?void 0:p.y)||u}:{x:(p==null?void 0:p.x)||u,y:(c+f)/2};(!p||a(p,m))&&o.unshift(m)}const g=n.indexOf(h),v=Math.abs(g-d);if(v===1)o=s(o,t.data,e.data),o.length||o.push(i?{x:(c+h)/2,y:l}:{x:l,y:(c+h)/2});else if(v>1){const p=n[g-1];if(p){const m=o[o.length-1],y=i?{x:(h+p)/2,y:(m==null?void 0:m.y)||u}:{x:(m==null?void 0:m.x)||l,y:(h+p)/2};(!m||a(m,y))&&o.push(y)}}}}return o},Ua=(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}},ej={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};class nj{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},ej),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericCircularLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericCircularLayout(!0,t,e)})}genericCircularLayout(t,e,n){return bt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,divisions:l,startAngle:c=0,endAngle:u=2*Math.PI,angleRatio:h,ordering:d,clockwise:f,nodeSpacing:g,nodeSize:v}=i,p=e.getAllNodes(),m=e.getAllEdges(),[y,b,w]=ij(a,s,o),x=p==null?void 0:p.length;if(!x||x===1)return Ua(e,t,w);const S=(u-c)/x;let{radius:E,startRadius:_,endRadius:C}=i;if(g){const R=Aa(10,g),D=B1(10,v);let L=-1/0;p.forEach(A=>{const I=D(A);L<I&&(L=I)});let P=0;p.forEach((A,I)=>{I===0?P+=L||10:P+=(R(A)||0)+(L||10)}),E=P/(2*Math.PI)}else!E&&!_&&!C?E=Math.min(b,y)/2:!_&&C?_=C:_&&!C&&(C=_);const k=S*h;let M=[];d==="topology"?M=Pw(e,p):d==="topology-directed"?M=Pw(e,p,!0):d==="degree"?M=rj(e,p):M=p.map(R=>On(R));const T=Math.ceil(x/l);for(let R=0;R<x;++R){let D=E;!D&&_!==null&&C!==null&&(D=_+R*(C-_)/(x-1)),D||(D=10+R*100/(x-1));let L=c+R%T*k+2*Math.PI/l*Math.floor(R/T);f||(L=u-R%T*k-2*Math.PI/l*Math.floor(R/T)),M[R].data.x=w[0]+Math.cos(L)*D,M[R].data.y=w[1]+Math.sin(L)*D}return t&&M.forEach(R=>{e.mergeNodeData(R.id,{x:R.data.x,y:R.data.y})}),{nodes:M,edges:m}})}}const Pw=(r,t,e=!1)=>{const n=[On(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(On(o)),i[o.id]=!0,s++;else{const c=e?r.getSuccessors(n[s].id):r.getNeighbors(n[s].id);let u=!1;for(let d=0;d<c.length;d++){const f=c[d];if(r.getDegree(f.id)===r.getDegree(o.id)&&!i[f.id]){n.push(On(f)),i[f.id]=!0,u=!0;break}}let h=0;for(;!u&&(i[t[h].id]||(n.push(On(t[h])),i[t[h].id]=!0,u=!0),h++,h!==a););}}),n};function rj(r,t){const e=[];return t.forEach((n,i)=>{e.push(On(n))}),e.sort((n,i)=>r.getDegree(n.id,"both")-r.getDegree(i.id,"both")),e}const ij=(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]},aj={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:3/2*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class Ey{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},aj),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericConcentricLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericConcentricLayout(!0,t,e)})}genericConcentricLayout(t,e,n){return bt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o,sortBy:l,maxLevelDiff:c,sweep:u,clockwise:h,equidistant:d,preventOverlap:f,startAngle:g=3/2*Math.PI,nodeSize:v,nodeSpacing:p}=i,m=e.getAllNodes(),y=e.getAllEdges(),b=!s&&typeof window<"u"?window.innerWidth:s,w=!o&&typeof window<"u"?window.innerHeight:o,x=a||[b/2,w/2];if(!(m!=null&&m.length)||m.length===1)return Ua(e,t,x);const S=[];let E,_=0;Vr(v)?E=Math.max(v[0],v[1]):at(v)?(E=-1/0,m.forEach(A=>{const I=Math.max(...dl(v(A)));I>E&&(E=I)})):E=v,Vr(p)?_=Math.max(p[0],p[1]):nt(p)&&(_=p),m.forEach(A=>{const I=On(A);S.push(I);let B=E;const{data:j}=I;Vr(j.size)?B=Math.max(j.size[0],j.size[1]):nt(j.size)?B=j.size:me(j.size)&&(B=Math.max(j.size.width,j.size.height)),E=Math.max(E,B),at(p)&&(_=Math.max(p(A),_))});const C={};S.forEach((A,I)=>{C[A.id]=I});let k=l;(!Tt(k)||S[0].data[k]===void 0)&&(k="degree"),k==="degree"?S.sort((A,I)=>e.getDegree(I.id,"both")-e.getDegree(A.id,"both")):S.sort((A,I)=>I.data[k]-A.data[k]);const M=S[0],T=(c||(k==="degree"?e.getDegree(M.id,"both"):M.data[k]))/4,O=[{nodes:[]}];let R=O[0];S.forEach(A=>{if(R.nodes.length>0){const I=Math.abs(k==="degree"?e.getDegree(R.nodes[0].id,"both")-e.getDegree(A.id,"both"):R.nodes[0].data[k]-A.data[k]);T&&I>=T&&(R={nodes:[]},O.push(R))}R.nodes.push(A)});let D=E+_;if(!f){const A=O.length>0&&O[0].nodes.length>1,B=(Math.min(b,w)/2-D)/(O.length+(A?1:0));D=Math.min(D,B)}let L=0;if(O.forEach(A=>{const I=u===void 0?2*Math.PI-2*Math.PI/A.nodes.length:u;if(A.dTheta=I/Math.max(1,A.nodes.length-1),A.nodes.length>1&&f){const B=Math.cos(A.dTheta)-Math.cos(0),j=Math.sin(A.dTheta)-Math.sin(0),G=Math.sqrt(D*D/(B*B+j*j));L=Math.max(G,L)}A.r=L,L+=D}),d){let A=0,I=0;for(let B=0;B<O.length;B++){const G=(O[B].r||0)-I;A=Math.max(A,G)}I=0,O.forEach((B,j)=>{j===0&&(I=B.r||0),B.r=I,I+=A})}return O.forEach(A=>{const I=A.dTheta||0,B=A.r||0;A.nodes.forEach((j,G)=>{const H=g+(h?1:-1)*I*G;j.data.x=x[0]+B*Math.cos(H),j.data.y=x[1]+B*Math.sin(H)})}),t&&S.forEach(A=>e.mergeNodeData(A.id,{x:A.data.x,y:A.data.y})),{nodes:S,edges:y}})}}function sj(r){const t=+this._x.call(null,r),e=+this._y.call(null,r);return AO(this.cover(t,e),t,e,r)}function AO(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,c=r._x1,u=r._y1,h,d,f,g,v,p,m,y;if(!a)return r._root=s,r;for(;a.length;)if((v=t>=(h=(o+c)/2))?o=h:c=h,(p=e>=(d=(l+u)/2))?l=d:u=d,i=a,!(a=a[m=p<<1|v]))return i[m]=s,r;if(f=+r._x.call(null,a.data),g=+r._y.call(null,a.data),t===f&&e===g)return s.next=a,i?i[m]=s:r._root=s,r;do i=i?i[m]=new Array(4):r._root=new Array(4),(v=t>=(h=(o+c)/2))?o=h:c=h,(p=e>=(d=(l+u)/2))?l=d:u=d;while((m=p<<1|v)===(y=(g>=d)<<1|f>=h));return i[y]=a,i[m]=s,r}function oj(r){var t,e,n=r.length,i,a,s=new Array(n),o=new Array(n),l=1/0,c=1/0,u=-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>u&&(u=i),a<c&&(c=a),a>h&&(h=a));if(l>u||c>h)return this;for(this.cover(l,c).cover(u,h),e=0;e<n;++e)AO(this,s[e],o[e],r[e]);return this}function lj(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,c;e>r||r>=i||n>t||t>=a;)switch(c=(t<n)<<1|r<e,l=new Array(4),l[c]=o,o=l,s*=2,c){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 cj(){var r=[];return this.visit(function(t){if(!t.length)do r.push(t.data);while(t=t.next)}),r}function uj(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 rn(r,t,e,n,i){this.node=r,this.x0=t,this.y0=e,this.x1=n,this.y1=i}function hj(r,t,e){var n,i=this._x0,a=this._y0,s,o,l,c,u=this._x1,h=this._y1,d=[],f=this._root,g,v;for(f&&d.push(new rn(f,i,a,u,h)),e==null?e=1/0:(i=r-e,a=t-e,u=r+e,h=t+e,e*=e);g=d.pop();)if(!(!(f=g.node)||(s=g.x0)>u||(o=g.y0)>h||(l=g.x1)<i||(c=g.y1)<a))if(f.length){var p=(s+l)/2,m=(o+c)/2;d.push(new rn(f[3],p,m,l,c),new rn(f[2],s,m,p,c),new rn(f[1],p,o,l,m),new rn(f[0],s,o,p,m)),(v=(t>=m)<<1|r>=p)&&(g=d[d.length-1],d[d.length-1]=d[d.length-1-v],d[d.length-1-v]=g)}else{var y=r-+this._x.call(null,f.data),b=t-+this._y.call(null,f.data),w=y*y+b*b;if(w<e){var x=Math.sqrt(e=w);i=r-x,a=t-x,u=r+x,h=t+x,n=f.data}}return n}function dj(r){if(isNaN(u=+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,c=this._y1,u,h,d,f,g,v,p,m;if(!e)return this;if(e.length)for(;;){if((g=u>=(d=(s+l)/2))?s=d:l=d,(v=h>=(f=(o+c)/2))?o=f:c=f,t=e,!(e=e[p=v<<1|g]))return this;if(!e.length)break;(t[p+1&3]||t[p+2&3]||t[p+3&3])&&(n=t,m=p)}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[p]=a:delete t[p],(e=t[0]||t[1]||t[2]||t[3])&&e===(t[3]||t[2]||t[1]||t[0])&&!e.length&&(n?n[m]=e:this._root=e),this):(this._root=a,this)}function fj(r){for(var t=0,e=r.length;t<e;++t)this.remove(r[t]);return this}function gj(){return this._root}function vj(){var r=0;return this.visit(function(t){if(!t.length)do++r;while(t=t.next)}),r}function pj(r){var t=[],e,n=this._root,i,a,s,o,l;for(n&&t.push(new rn(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 c=(a+o)/2,u=(s+l)/2;(i=n[3])&&t.push(new rn(i,c,u,o,l)),(i=n[2])&&t.push(new rn(i,a,u,c,l)),(i=n[1])&&t.push(new rn(i,c,s,o,u)),(i=n[0])&&t.push(new rn(i,a,s,c,u))}return this}function mj(r){var t=[],e=[],n;for(this._root&&t.push(new rn(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,c=n.y1,u=(s+l)/2,h=(o+c)/2;(a=i[0])&&t.push(new rn(a,s,o,u,h)),(a=i[1])&&t.push(new rn(a,u,o,l,h)),(a=i[2])&&t.push(new rn(a,s,h,u,c)),(a=i[3])&&t.push(new rn(a,u,h,l,c))}e.push(n)}for(;n=e.pop();)r(n.node,n.x0,n.y0,n.x1,n.y1);return this}function yj(r){return r[0]}function bj(r){return arguments.length?(this._x=r,this):this._x}function wj(r){return r[1]}function xj(r){return arguments.length?(this._y=r,this):this._y}function bh(r,t,e){var n=new $1(t??yj,e??wj,NaN,NaN,NaN,NaN);return r==null?n:n.addAll(r)}function $1(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 Nw(r){for(var t={data:r.data},e=t;r=r.next;)e=e.next={data:r.data};return t}var ln=bh.prototype=$1.prototype;ln.copy=function(){var r=new $1(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=Nw(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]=Nw(n));return r};ln.add=sj;ln.addAll=oj;ln.cover=lj;ln.data=cj;ln.extent=uj;ln.find=hj;ln.remove=dj;ln.removeAll=fj;ln.root=gj;ln.size=vj;ln.visit=pj;ln.visitAfter=mj;ln.x=bj;ln.y=xj;function Ej(r){const t=+this._x.call(null,r),e=+this._y.call(null,r),n=+this._z.call(null,r);return PO(this.cover(t,e,n),t,e,n,r)}function PO(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,c=r._y0,u=r._z0,h=r._x1,d=r._y1,f=r._z1,g,v,p,m,y,b,w,x,S,E,_;if(!s)return r._root=o,r;for(;s.length;)if((w=t>=(g=(l+h)/2))?l=g:h=g,(x=e>=(v=(c+d)/2))?c=v:d=v,(S=n>=(p=(u+f)/2))?u=p:f=p,a=s,!(s=s[E=S<<2|x<<1|w]))return a[E]=o,r;if(m=+r._x.call(null,s.data),y=+r._y.call(null,s.data),b=+r._z.call(null,s.data),t===m&&e===y&&n===b)return o.next=s,a?a[E]=o:r._root=o,r;do a=a?a[E]=new Array(8):r._root=new Array(8),(w=t>=(g=(l+h)/2))?l=g:h=g,(x=e>=(v=(c+d)/2))?c=v:d=v,(S=n>=(p=(u+f)/2))?u=p:f=p;while((E=S<<2|x<<1|w)===(_=(b>=p)<<2|(y>=v)<<1|m>=g));return a[_]=s,a[E]=o,r}function Sj(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,c=-1/0,u=-1/0;for(let h=0,d,f,g,v;h<t;++h)isNaN(f=+this._x.call(null,d=r[h]))||isNaN(g=+this._y.call(null,d))||isNaN(v=+this._z.call(null,d))||(e[h]=f,n[h]=g,i[h]=v,f<a&&(a=f),f>l&&(l=f),g<s&&(s=g),g>c&&(c=g),v<o&&(o=v),v>u&&(u=v));if(a>l||s>c||o>u)return this;this.cover(a,s,o).cover(l,c,u);for(let h=0;h<t;++h)PO(this,e[h],n[h],i[h],r[h]);return this}function _j(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 c=s-n||1,u=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]=u,u=h,c*=2,d){case 0:s=n+c,o=i+c,l=a+c;break;case 1:n=s-c,o=i+c,l=a+c;break;case 2:s=n+c,i=o-c,l=a+c;break;case 3:n=s-c,i=o-c,l=a+c;break;case 4:s=n+c,o=i+c,a=l-c;break;case 5:n=s-c,o=i+c,a=l-c;break;case 6:s=n+c,i=o-c,a=l-c;break;case 7:n=s-c,i=o-c,a=l-c;break}this._root&&this._root.length&&(this._root=u)}return this._x0=n,this._y0=i,this._z0=a,this._x1=s,this._y1=o,this._z1=l,this}function kj(){var r=[];return this.visit(function(t){if(!t.length)do r.push(t.data);while(t=t.next)}),r}function Mj(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 Ht(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 Cj(r,t,e,n){var i,a=this._x0,s=this._y0,o=this._z0,l,c,u,h,d,f,g=this._x1,v=this._y1,p=this._z1,m=[],y=this._root,b,w;for(y&&m.push(new Ht(y,a,s,o,g,v,p)),n==null?n=1/0:(a=r-n,s=t-n,o=e-n,g=r+n,v=t+n,p=e+n,n*=n);b=m.pop();)if(!(!(y=b.node)||(l=b.x0)>g||(c=b.y0)>v||(u=b.z0)>p||(h=b.x1)<a||(d=b.y1)<s||(f=b.z1)<o))if(y.length){var x=(l+h)/2,S=(c+d)/2,E=(u+f)/2;m.push(new Ht(y[7],x,S,E,h,d,f),new Ht(y[6],l,S,E,x,d,f),new Ht(y[5],x,c,E,h,S,f),new Ht(y[4],l,c,E,x,S,f),new Ht(y[3],x,S,u,h,d,E),new Ht(y[2],l,S,u,x,d,E),new Ht(y[1],x,c,u,h,S,E),new Ht(y[0],l,c,u,x,S,E)),(w=(e>=E)<<2|(t>=S)<<1|r>=x)&&(b=m[m.length-1],m[m.length-1]=m[m.length-1-w],m[m.length-1-w]=b)}else{var _=r-+this._x.call(null,y.data),C=t-+this._y.call(null,y.data),k=e-+this._z.call(null,y.data),M=_*_+C*C+k*k;if(M<n){var T=Math.sqrt(n=M);a=r-T,s=t-T,o=e-T,g=r+T,v=t+T,p=e+T,i=y.data}}return i}const Tj=(r,t,e,n,i,a)=>Math.sqrt((r-n)**2+(t-i)**2+(e-a)**2);function Oj(r,t,e,n){const i=[],a=r-n,s=t-n,o=e-n,l=r+n,c=t+n,u=e+n;return this.visit((h,d,f,g,v,p,m)=>{if(!h.length)do{const y=h.data;Tj(r,t,e,this._x(y),this._y(y),this._z(y))<=n&&i.push(y)}while(h=h.next);return d>l||f>c||g>u||v<a||p<s||m<o}),i}function Aj(r){if(isNaN(d=+this._x.call(null,r))||isNaN(f=+this._y.call(null,r))||isNaN(g=+this._z.call(null,r)))return this;var t,e=this._root,n,i,a,s=this._x0,o=this._y0,l=this._z0,c=this._x1,u=this._y1,h=this._z1,d,f,g,v,p,m,y,b,w,x,S;if(!e)return this;if(e.length)for(;;){if((y=d>=(v=(s+c)/2))?s=v:c=v,(b=f>=(p=(o+u)/2))?o=p:u=p,(w=g>=(m=(l+h)/2))?l=m:h=m,t=e,!(e=e[x=w<<2|b<<1|y]))return this;if(!e.length)break;(t[x+1&7]||t[x+2&7]||t[x+3&7]||t[x+4&7]||t[x+5&7]||t[x+6&7]||t[x+7&7])&&(n=t,S=x)}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[x]=a:delete t[x],(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[S]=e:this._root=e),this):(this._root=a,this)}function Pj(r){for(var t=0,e=r.length;t<e;++t)this.remove(r[t]);return this}function Nj(){return this._root}function Rj(){var r=0;return this.visit(function(t){if(!t.length)do++r;while(t=t.next)}),r}function Lj(r){var t=[],e,n=this._root,i,a,s,o,l,c,u;for(n&&t.push(new Ht(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,c=e.y1,u=e.z1)&&n.length){var h=(a+l)/2,d=(s+c)/2,f=(o+u)/2;(i=n[7])&&t.push(new Ht(i,h,d,f,l,c,u)),(i=n[6])&&t.push(new Ht(i,a,d,f,h,c,u)),(i=n[5])&&t.push(new Ht(i,h,s,f,l,d,u)),(i=n[4])&&t.push(new Ht(i,a,s,f,h,d,u)),(i=n[3])&&t.push(new Ht(i,h,d,o,l,c,f)),(i=n[2])&&t.push(new Ht(i,a,d,o,h,c,f)),(i=n[1])&&t.push(new Ht(i,h,s,o,l,d,f)),(i=n[0])&&t.push(new Ht(i,a,s,o,h,d,f))}return this}function Dj(r){var t=[],e=[],n;for(this._root&&t.push(new Ht(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,c=n.x1,u=n.y1,h=n.z1,d=(s+c)/2,f=(o+u)/2,g=(l+h)/2;(a=i[0])&&t.push(new Ht(a,s,o,l,d,f,g)),(a=i[1])&&t.push(new Ht(a,d,o,l,c,f,g)),(a=i[2])&&t.push(new Ht(a,s,f,l,d,u,g)),(a=i[3])&&t.push(new Ht(a,d,f,l,c,u,g)),(a=i[4])&&t.push(new Ht(a,s,o,g,d,f,h)),(a=i[5])&&t.push(new Ht(a,d,o,g,c,f,h)),(a=i[6])&&t.push(new Ht(a,s,f,g,d,u,h)),(a=i[7])&&t.push(new Ht(a,d,f,g,c,u,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 Ij(r){return r[0]}function Fj(r){return arguments.length?(this._x=r,this):this._x}function Bj(r){return r[1]}function zj(r){return arguments.length?(this._y=r,this):this._y}function $j(r){return r[2]}function jj(r){return arguments.length?(this._z=r,this):this._z}function NO(r,t,e,n){var i=new j1(t??Ij,e??Bj,n??$j,NaN,NaN,NaN,NaN,NaN,NaN);return r==null?i:i.addAll(r)}function j1(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 Rw(r){for(var t={data:r.data},e=t;r=r.next;)e=e.next={data:r.data};return t}var He=NO.prototype=j1.prototype;He.copy=function(){var r=new j1(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=Rw(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]=Rw(n));return r};He.add=Ej;He.addAll=Sj;He.cover=_j;He.data=kj;He.extent=Mj;He.find=Cj;He.findAllWithinRadius=Oj;He.remove=Aj;He.removeAll=Pj;He.root=Nj;He.size=Rj;He.visit=Lj;He.visitAfter=Dj;He.x=Fj;He.y=zj;He.z=jj;const qj=.81,pf=.1;function Gj(r,t,e,n,i=2){const a=t/e,s=r.getAllNodes(),o=s.map((u,h)=>{const{nodeStrength:d,x:f,y:g,z:v,size:p}=u.data;return{x:f,y:g,z:v,size:p,index:h,id:u.id,vx:0,vy:0,vz:0,weight:a*d}}),l=(i===2?bh(o,u=>u.x,u=>u.y):NO(o,u=>u.x,u=>u.y,u=>u.z)).visitAfter(Wj),c=new Map;return o.forEach(u=>{c.set(u.id,u),Hj(u,l,i)}),o.map((u,h)=>{const{id:d,data:f}=s[h],{mass:g=1}=f;n[d]={x:u.vx/g,y:u.vy/g,z:u.vz/g}}),n}function Wj(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 Vj=(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],c=a.x-r.x||pf,u=a.y-r.y||pf,h=a.z-r.z||pf,d=[c,u,h],f=l-t;let g=0;for(let m=0;m<s;m++)g+=d[m]*d[m];const p=Math.sqrt(g)*g;if(f*f*qj<g){const m=r.weight/p;return a.vx+=c*m,a.vy+=u*m,a.vz+=h*m,!0}if(r.length)return!1;if(r.data!==a){const m=r.data.weight/p;a.vx+=c*m,a.vy+=u*m,a.vz+=h*m}};function Hj(r,t,e){t.visit((n,i,a,s,o)=>Vj(n,i,a,s,o,r,e))}const Uj={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 RO{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},Uj),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericForceLayout(!1,t,e)})}assign(t,e){return bt(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 bt(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:c,height:u,nodeSize:h,getMass:d,nodeStrength:f,edgeStrength:g,linkDistance:v}=o,p=a.map((_,C)=>Object.assign(Object.assign({},_),{data:Object.assign(Object.assign({},_.data),{x:nt(_.data.x)?_.data.x:Math.random()*c,y:nt(_.data.y)?_.data.y:Math.random()*u,z:nt(_.data.z)?_.data.z:Math.random()*Math.sqrt(c*u),size:h(_)||30,mass:d(_),nodeStrength:f(_)})})),m=s.map(_=>Object.assign(Object.assign({},_),{data:Object.assign(Object.assign({},_.data),{edgeStrength:g(_),linkDistance:v(_,e.getNode(_.source),e.getNode(_.target))})}));if(!(a!=null&&a.length))return this.lastResult={nodes:[],edges:s},{nodes:[],edges:s};const y={};a.forEach((_,C)=>{y[_.id]={x:0,y:0,z:0}});const b=new Ne({nodes:p,edges:m});this.formatCentripetal(o,b);const{maxIteration:w,minMovement:x,onTick:S}=o;if(this.lastLayoutNodes=p,this.lastLayoutEdges=m,this.lastAssign=t,this.lastGraph=e,this.lastCalcGraph=b,this.lastOptions=o,this.lastVelMap=y,typeof window>"u")return;let E=0;return new Promise(_=>{this.timeInterval=window.setInterval(()=>{(!a||!this.running)&&_({nodes:mf(e,p),edges:s}),this.runOneStep(b,e,E,y,o),this.updatePosition(e,b,y,o),t&&p.forEach(C=>e.mergeNodeData(C.id,{x:C.data.x,y:C.data.y,z:l===3?C.data.z:void 0})),S==null||S({nodes:mf(e,p),edges:s}),E++,(E>=w||this.judgingDistance<x)&&(window.clearInterval(this.timeInterval),_({nodes:mf(e,p),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 c=1;nt(l==null?void 0:l.data.mass)&&(c=l==null?void 0:l.data.mass);const u=e.getDegree(l.id,"both");return!u||u<5?c:u*5*c}),n.nodeSize=z1(t.nodeSize,t.nodeSpacing);const o=t.linkDistance?Aa(1,t.linkDistance):l=>1+n.nodeSize(e.getNode(l.source))+n.nodeSize(e.getNode(l.target));return n.linkDistance=o,n.nodeStrength=Aa(1,t.nodeStrength),n.edgeStrength=Aa(1,t.edgeStrength),n}formatCentripetal(t,e){const{dimensions:n,centripetalOptions:i,center:a,clusterNodeStrength:s,leafCluster:o,clustering:l,nodeClusterBy:c}=t,u=e.getAllNodes(),h=i||{leaf:2,single:2,others:1,center:m=>({x:a[0],y:a[1],z:n===3?a[2]:void 0})};typeof s!="function"&&(t.clusterNodeStrength=m=>s);let d,f;if(o&&c&&(d=Lw(e,c),f=Array.from(new Set(u==null?void 0:u.map(m=>m.data[c])))||[],t.centripetalOptions=Object.assign(h,{single:100,leaf:m=>{const{siblingLeaves:y,sameTypeLeaves:b}=d[m.id]||{};return(b==null?void 0:b.length)===(y==null?void 0:y.length)||(f==null?void 0:f.length)===1?1:t.clusterNodeStrength(m)},others:1,center:m=>{const y=e.getDegree(m.id,"both");if(!y)return{x:100,y:100,z:0};let b;if(y===1){const{sameTypeLeaves:w=[]}=d[m.id]||{};w.length===1?b=void 0:w.length>1&&(b=Dw(w))}else b=void 0;return{x:b==null?void 0:b.x,y:b==null?void 0:b.y,z:b==null?void 0:b.z}}})),l&&c){d||(d=Lw(e,c)),f||(f=Array.from(new Set(u.map(y=>y.data[c])))),f=f.filter(y=>y!==void 0);const m={};f.forEach(y=>{const b=u.filter(w=>w.data[c]===y).map(w=>e.getNode(w.id));m[y]=Dw(b)}),t.centripetalOptions=Object.assign(h,{single:y=>t.clusterNodeStrength(y),leaf:y=>t.clusterNodeStrength(y),others:y=>t.clusterNodeStrength(y),center:y=>{const b=m[y.data[c]];return{x:b==null?void 0:b.x,y:b==null?void 0:b.y,z:b==null?void 0:b.z}}})}const{leaf:g,single:v,others:p}=t.centripetalOptions||{};g&&typeof g!="function"&&(t.centripetalOptions.leaf=()=>g),v&&typeof v!="function"&&(t.centripetalOptions.single=()=>v),p&&typeof p!="function"&&(t.centripetalOptions.others=()=>p)}runOneStep(t,e,n,i,a){const s={},o=t.getAllNodes(),l=t.getAllEdges();if(!(o!=null&&o.length))return;const{monitor:c}=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),c){const u=this.calTotalEnergy(s,o);c({energy:u,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,c=s*s+o*o+l*l,{mass:u=1}=i.data;n+=u*c*.5}),n}calRepulsive(t,e,n){const{dimensions:i,factor:a,coulombDisScale:s}=n;Gj(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:c}=s,u=t.getNode(l),h=t.getNode(c);if(!u||!h)return;let d=h.data.x-u.data.x,f=h.data.y-u.data.y,g=i===3?h.data.z-u.data.z:0;!d&&!f&&(d=Math.random()*.01,f=Math.random()*.01,i===3&&!g&&(g=Math.random()*.01));const v=Math.sqrt(d*d+f*f+g*g);if(v<a(u)+a(h))return;const p=d/v,m=f/v,y=g/v,{linkDistance:b=200,edgeStrength:w=200}=s.data||{},S=(b-v)*w,E=u.data.mass||1,_=h.data.mass||1,C=1/E,k=1/_,M=p*S,T=m*S,O=y*S;e[l].x-=M*C,e[l].y-=T*C,e[l].z-=O*C,e[c].x+=M*k,e[c].y+=T*k,e[c].z+=O*k})}calGravity(t,e,n,i){const{getCenter:a}=i,s=t.getAllNodes(),o=e.getAllNodes(),l=e.getAllEdges(),{width:c,height:u,center:h,gravity:d,centripetalOptions:f}=i;s&&s.forEach(g=>{const{id:v,data:p}=g,{mass:m,x:y,y:b,z:w}=p,x=e.getNode(v);let S=0,E=0,_=0,C=d;const k=t.getDegree(v,"in"),M=t.getDegree(v,"out"),T=t.getDegree(v,"both"),O=a==null?void 0:a(x,T);if(O){const[R,D,L]=O;S=y-R,E=b-D,C=L}else S=y-h[0],E=b-h[1],_=w-h[2];if(C&&(n[v].x-=C*S/m,n[v].y-=C*E/m,n[v].z-=C*_/m),f){const{leaf:R,single:D,others:L,center:P}=f,{x:A,y:I,z:B,centerStrength:j}=(P==null?void 0:P(x,o,l,c,u))||{x:0,y:0,z:0,centerStrength:0};if(!nt(A)||!nt(I))return;const G=(y-A)/m,H=(b-I)/m,Y=(w-B)/m;if(j&&(n[v].x-=j*G,n[v].y-=j*H,n[v].z-=j*Y),T===0){const tt=D(x);if(!tt)return;n[v].x-=tt*G,n[v].y-=tt*H,n[v].z-=tt*Y;return}if(k===0||M===0){const tt=R(x,o,l);if(!tt)return;n[v].x-=tt*G,n[v].y-=tt*H,n[v].z-=tt*Y;return}const K=L(x);if(!K)return;n[v].x-=K*G,n[v].y-=K*H,n[v].z-=K*Y}})}updateVelocity(t,e,n,i){const{damping:a,maxSpeed:s,interval:o,dimensions:l}=i,c=t.getAllNodes();c!=null&&c.length&&c.forEach(u=>{const{id:h}=u;let d=(n[h].x+e[h].x*o)*a||.01,f=(n[h].y+e[h].y*o)*a||.01,g=l===3?(n[h].z+e[h].z*o)*a||.01:0;const v=Math.sqrt(d*d+f*f+g*g);if(v>s){const p=s/v;d=p*d,f=p*f,g=p*g}n[h]={x:d,y:f,z:g}})}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 c=0;a==="max"?this.judgingDistance=-1/0:a==="min"&&(this.judgingDistance=1/0),l.forEach(u=>{const{id:h}=u,d=t.getNode(h);if(nt(d.data.fx)&&nt(d.data.fy)){e.mergeNodeData(h,{x:d.data.fx,y:d.data.fy,z:o===3?d.data.fz:void 0});return}const f=n[h].x*s,g=n[h].y*s,v=o===3?n[h].z*s:0;e.mergeNodeData(h,{x:u.data.x+f,y:u.data.y+g,z:u.data.z+v});const p=Math.sqrt(f*f+g*g+v*v);switch(a){case"max":this.judgingDistance<p&&(this.judgingDistance=p);break;case"min":this.judgingDistance>p&&(this.judgingDistance=p);break;default:c=c+p;break}}),(!a||a==="mean")&&(this.judgingDistance=c/l.length)}}const Lw=(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]=Yj(r,"leaf",i,t))}),n},Yj=(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(c=>r.getDegree(c.id,"in")===0||r.getDegree(c.id,"out")===0);const l=Xj(r,t,n,e,o);return{coreNode:s,siblingLeaves:o,sameTypeLeaves:l}},Xj=(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},Dw=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}},mf=(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 kt={};const Kj=Object.prototype.toString;function Go(r){const t=Kj.call(r);return t.endsWith("Array]")&&!t.includes("Big")}const Zj=Object.freeze(Object.defineProperty({__proto__:null,isAnyArray:Go},Symbol.toStringTag,{value:"Module"})),Jj=kM(Zj);function Qj(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Go(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 tq(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Go(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 eq(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Go(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(!Go(t.output))throw new TypeError("output option must be an array if specified");e=t.output}else e=new Array(r.length);var n=tq(r),i=Qj(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 c=(l-s)/(i-n),u=0;u<r.length;u++)e[u]=(r[u]-n)*c+s;return e}const nq=Object.freeze(Object.defineProperty({__proto__:null,default:eq},Symbol.toStringTag,{value:"Module"})),rq=kM(nq);Object.defineProperty(kt,"__esModule",{value:!0});var pn=Jj,Iw=rq;const gc=" ".repeat(2),LO=" ".repeat(4);function iq(){return DO(this)}function DO(r,t={}){const{maxRows:e=15,maxColumns:n=10,maxNumSize:i=8,padMinus:a="auto"}=t;return`${r.constructor.name} {
- ${gc}[
- ${LO}${aq(r,e,n,i,a)}
- ${gc}]
- ${gc}rows: ${r.rows}
- ${gc}columns: ${r.columns}
- }`}function aq(r,t,e,n,i){const{rows:a,columns:s}=r,o=Math.min(a,t),l=Math.min(s,e),c=[];if(i==="auto"){i=!1;t:for(let u=0;u<o;u++)for(let h=0;h<l;h++)if(r.get(u,h)<0){i=!0;break t}}for(let u=0;u<o;u++){let h=[];for(let d=0;d<l;d++)h.push(sq(r.get(u,d),n,i));c.push(`${h.join(" ")}`)}return l!==s&&(c[c.length-1]+=` ... ${s-e} more columns`),o!==a&&c.push(`... ${a-t} more rows`),c.join(`
- ${LO}`)}function sq(r,t,e){return(r>=0&&e?` ${Fw(r,t-1)}`:Fw(r,t)).padEnd(t)}function Fw(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 oq(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 Gn(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 Wn(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 ds(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 fs(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 q1(r,t){if(!pn.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 G1(r,t){if(!pn.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 Sy(r,t,e,n,i){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(vc("startRow",t),vc("endRow",e),vc("startColumn",n),vc("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 wh(r,t=0){let e=[];for(let n=0;n<r;n++)e.push(t);return e}function vc(r,t){if(typeof t!="number")throw new TypeError(`${r} must be a number`)}function is(r){if(r.isEmpty())throw new Error("Empty matrix has no elements to index")}function lq(r){let t=wh(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 cq(r){let t=wh(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 uq(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 hq(r){let t=wh(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 dq(r){let t=wh(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 fq(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 gq(r,t,e){const n=r.rows,i=r.columns,a=[];for(let s=0;s<n;s++){let o=0,l=0,c=0;for(let u=0;u<i;u++)c=r.get(s,u)-e[s],o+=c,l+=c*c;t?a.push((l-o*o/i)/(i-1)):a.push((l-o*o/i)/i)}return a}function vq(r,t,e){const n=r.rows,i=r.columns,a=[];for(let s=0;s<i;s++){let o=0,l=0,c=0;for(let u=0;u<n;u++)c=r.get(u,s)-e[s],o+=c,l+=c*c;t?a.push((l-o*o/n)/(n-1)):a.push((l-o*o/n)/n)}return a}function pq(r,t,e){const n=r.rows,i=r.columns,a=n*i;let s=0,o=0,l=0;for(let c=0;c<n;c++)for(let u=0;u<i;u++)l=r.get(c,u)-e,s+=l,o+=l*l;return t?(o-s*s/a)/(a-1):(o-s*s/a)/a}function mq(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 yq(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 bq(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 wq(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 xq(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 Eq(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 Sq(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 _q(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 kq(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 yt{static from1DArray(t,e,n){if(t*e!==n.length)throw new RangeError("data length does not match given dimensions");let a=new et(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 et(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 et(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 et(t,e)}static ones(t,e){return new et(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 et(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 et(t,e);for(let c=0;c<t;c++)for(let u=0;u<e;u++){let h=i+Math.round(s()*o);l.set(c,u,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 et(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 yt.isMatrix(t)?t:new et(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 c=a;c<e;c++){let u=t.get(o,c)-l*t.get(i,c);t.set(o,c,u)}}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 et(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){Gn(this,t);let e=[];for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}getRowVector(t){return et.rowVector(this.getRow(t))}setRow(t,e){Gn(this,t),e=ds(this,e);for(let n=0;n<this.columns;n++)this.set(t,n,e[n]);return this}swapRows(t,e){Gn(this,t),Gn(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){Wn(this,t);let e=[];for(let n=0;n<this.rows;n++)e.push(this.get(n,t));return e}getColumnVector(t){return et.columnVector(this.getColumn(t))}setColumn(t,e){Wn(this,t),e=fs(this,e);for(let n=0;n<this.rows;n++)this.set(n,t,e[n]);return this}swapColumns(t,e){Wn(this,t),Wn(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=ds(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=ds(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=ds(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=ds(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=fs(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=fs(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=fs(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=fs(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){Gn(this,t);for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e);return this}mulColumn(t,e){Wn(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(){is(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(){is(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(Gn(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){Gn(this,t),is(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(Gn(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){Gn(this,t),is(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(Wn(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){Wn(this,t),is(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(Wn(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){Wn(this,t),is(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){yt.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=et.checkMatrix(t);let e=this.rows,n=this.columns,i=t.columns,a=new et(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 c=0;for(let u=0;u<n;u++)c+=this.get(l,u)*s[u];a.set(l,o,c)}}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=et.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=et.checkMatrix(t);let e=new et(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),c=this.get(1,1),u=t.get(1,1),h=(n+c)*(i+u),d=(o+c)*i,f=n*(s-u),g=c*(l-i),v=(n+a)*u,p=(o-n)*(i+s),m=(a-c)*(l+u),y=h+g-v+m,b=f+v,w=d+g,x=h-d+f+p;return e.set(0,0,y),e.set(0,1,b),e.set(1,0,w),e.set(1,1,x),e}strassen3x3(t){t=et.checkMatrix(t);let e=new et(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),c=this.get(2,0),u=this.get(2,1),h=this.get(2,2),d=t.get(0,0),f=t.get(0,1),g=t.get(0,2),v=t.get(1,0),p=t.get(1,1),m=t.get(1,2),y=t.get(2,0),b=t.get(2,1),w=t.get(2,2),x=(n+i+a-s-o-u-h)*p,S=(n-s)*(-f+p),E=o*(-d+f+v-p-m-y+w),_=(-n+s+o)*(d-f+p),C=(s+o)*(-d+f),k=n*d,M=(-n+c+u)*(d-g+m),T=(-n+c)*(g-m),O=(c+u)*(-d+g),R=(n+i+a-o-l-c-u)*m,D=u*(-d+g+v-p-m-y+b),L=(-a+u+h)*(p+y-b),P=(a-h)*(p-b),A=a*y,I=(u+h)*(-y+b),B=(-a+o+l)*(m+y-w),j=(a-l)*(m-w),G=(o+l)*(-y+w),H=i*v,Y=l*b,K=s*g,tt=c*f,it=h*w,_t=k+A+H,Mt=x+_+C+k+L+A+I,re=k+M+O+R+A+B+G,Re=S+E+_+k+A+B+j,Le=S+_+C+k+Y,cn=A+B+j+G+K,sa=k+M+T+D+L+P+A,Pt=L+P+A+I+tt,Dr=k+M+T+O+it;return e.set(0,0,_t),e.set(0,1,Mt),e.set(0,2,re),e.set(1,0,Re),e.set(1,1,Le),e.set(1,2,cn),e.set(2,0,sa),e.set(2,1,Pt),e.set(2,2,Dr),e}mmulStrassen(t){t=et.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,f){let g=h.rows,v=h.columns;if(g===d&&v===f)return h;{let p=yt.zeros(d,f);return p=p.setSubMatrix(h,0,0),p}}let l=Math.max(n,a),c=Math.max(i,s);e=o(e,l,c),t=o(t,l,c);function u(h,d,f,g){if(f<=512||g<=512)return h.mmul(d);f%2===1&&g%2===1?(h=o(h,f+1,g+1),d=o(d,f+1,g+1)):f%2===1?(h=o(h,f+1,g),d=o(d,f+1,g)):g%2===1&&(h=o(h,f,g+1),d=o(d,f,g+1));let v=parseInt(h.rows/2,10),p=parseInt(h.columns/2,10),m=h.subMatrix(0,v-1,0,p-1),y=d.subMatrix(0,v-1,0,p-1),b=h.subMatrix(0,v-1,p,h.columns-1),w=d.subMatrix(0,v-1,p,d.columns-1),x=h.subMatrix(v,h.rows-1,0,p-1),S=d.subMatrix(v,d.rows-1,0,p-1),E=h.subMatrix(v,h.rows-1,p,h.columns-1),_=d.subMatrix(v,d.rows-1,p,d.columns-1),C=u(yt.add(m,E),yt.add(y,_),v,p),k=u(yt.add(x,E),y,v,p),M=u(m,yt.sub(w,_),v,p),T=u(E,yt.sub(S,y),v,p),O=u(yt.add(m,b),_,v,p),R=u(yt.sub(x,m),yt.add(y,w),v,p),D=u(yt.sub(b,E),yt.add(S,_),v,p),L=yt.add(C,T);L.sub(O),L.add(D);let P=yt.add(M,O),A=yt.add(k,T),I=yt.sub(C,k);I.add(M),I.add(R);let B=yt.zeros(2*L.rows,2*L.columns);return B=B.setSubMatrix(L,0,0),B=B.setSubMatrix(P,L.rows,0),B=B.setSubMatrix(A,0,L.columns),B=B.setSubMatrix(I,L.rows,L.columns),B.subMatrix(0,f-1,0,g-1)}return u(e,t,l,c)}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 et(this.rows,this.columns);for(let a=0;a<this.rows;a++){const s=this.getRow(a);s.length>0&&Iw(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 et(this.rows,this.columns);for(let a=0;a<this.columns;a++){const s=this.getColumn(a);s.length&&Iw(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=et.checkMatrix(t);let e=this.rows,n=this.columns,i=t.rows,a=t.columns,s=new et(e*i,n*a);for(let o=0;o<e;o++)for(let l=0;l<n;l++)for(let c=0;c<i;c++)for(let u=0;u<a;u++)s.set(i*o+c,a*l+u,this.get(o,l)*t.get(c,u));return s}kroneckerSum(t){if(t=et.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(et.eye(n,n)),a=et.eye(e,e).kroneckerProduct(t);return i.add(a)}transpose(){let t=new et(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=Bw){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=Bw){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,n,i){Sy(this,t,e,n,i);let a=new et(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 et(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 et(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=et.checkMatrix(t),t.isEmpty())return this;let i=e+t.rows-1,a=n+t.columns-1;Sy(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){q1(this,t),G1(this,e);let n=new et(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 et(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 lq(this);case"column":return cq(this);case void 0:return uq(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return hq(this);case"column":return dq(this);case void 0:return fq(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(!pn.isAnyArray(i))throw new TypeError("mean must be an array");return gq(this,n,i)}case"column":{if(!pn.isAnyArray(i))throw new TypeError("mean must be an array");return vq(this,n,i)}case void 0:{if(typeof i!="number")throw new TypeError("mean must be a number");return pq(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(!pn.isAnyArray(n))throw new TypeError("center must be an array");return mq(this,n),this}case"column":{if(!pn.isAnyArray(n))throw new TypeError("center must be an array");return yq(this,n),this}case void 0:{if(typeof n!="number")throw new TypeError("center must be a number");return bq(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=wq(this);else if(!pn.isAnyArray(n))throw new TypeError("scale must be an array");return xq(this,n),this}case"column":{if(n===void 0)n=Eq(this);else if(!pn.isAnyArray(n))throw new TypeError("scale must be an array");return Sq(this,n),this}case void 0:{if(n===void 0)n=_q(this);else if(typeof n!="number")throw new TypeError("scale must be a number");return kq(this,n),this}default:throw new Error(`invalid option: ${t}`)}}toString(t){return DO(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)}}yt.prototype.klass="Matrix";typeof Symbol<"u"&&(yt.prototype[Symbol.for("nodejs.util.inspect.custom")]=iq);function Bw(r,t){return r-t}function Mq(r){return r.every(t=>typeof t=="number")}yt.random=yt.rand;yt.randomInt=yt.randInt;yt.diagonal=yt.diag;yt.prototype.diagonal=yt.prototype.diag;yt.identity=yt.eye;yt.prototype.negate=yt.prototype.neg;yt.prototype.tensorProduct=yt.prototype.kroneckerProduct;var Xo,_y,Ra;let et=(Ra=class extends yt{constructor(e,n){super();Ed(this,Xo);Ot(this,"data");if(Ra.isMatrix(e))Sd(this,Xo,_y).call(this,e.rows,e.columns),Ra.copy(e,this);else if(Number.isInteger(e)&&e>=0)Sd(this,Xo,_y).call(this,e,n);else if(pn.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(!Mq(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 Gn(this,e),this.data.splice(e,1),this.rows-=1,this}addRow(e,n){return n===void 0&&(n=e,e=this.rows),Gn(this,e,!0),n=Float64Array.from(ds(this,n)),this.data.splice(e,0,n),this.rows+=1,this}removeColumn(e){Wn(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),Wn(this,e,!0),n=fs(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}},Xo=new WeakSet,_y=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},Ra);oq(yt,et);var Xe;const Iu=class Iu extends yt{constructor(e){super();Ed(this,Xe);if(et.isMatrix(e)){if(!e.isSymmetric())throw new TypeError("not symmetric data");kl(this,Xe,et.copy(e,new et(e.rows,e.rows)))}else if(Number.isInteger(e)&&e>=0)kl(this,Xe,new et(e,e));else if(kl(this,Xe,new et(e)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return tr(this,Xe).size}get rows(){return tr(this,Xe).rows}get columns(){return tr(this,Xe).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(e){return et.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 Iu(this.diagonalSize);for(const[n,i,a]of this.upperRightEntries())e.set(n,i,a);return e}toMatrix(){return new et(this)}get(e,n){return tr(this,Xe).get(e,n)}set(e,n,i){return tr(this,Xe).set(e,n,i),tr(this,Xe).set(n,e,i),this}removeCross(e){return tr(this,Xe).removeRow(e),tr(this,Xe).removeColumn(e),this}addCross(e,n){n===void 0&&(n=e,e=this.diagonalSize);const i=n.slice();return i.splice(e,1),tr(this,Xe).addRow(e,i),tr(this,Xe).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 Iu(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)}};Xe=new WeakMap;let Pa=Iu;Pa.prototype.klassType="SymmetricMatrix";class xh extends Pa{static isDistanceMatrix(t){return Pa.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 Pa(this)}clone(){const t=new xh(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}}xh.prototype.klassSubType="DistanceMatrix";class ci extends yt{constructor(t,e,n){super(),this.matrix=t,this.rows=e,this.columns=n}}class Cq extends ci{constructor(t,e){Wn(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 Tq extends ci{constructor(t,e){G1(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 Oq extends ci{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 Aq extends ci{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 Pq extends ci{constructor(t,e){Gn(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 Nq extends ci{constructor(t,e){q1(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 $c extends ci{constructor(t,e,n){q1(t,e),G1(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 Rq extends ci{constructor(t,e,n,i,a){Sy(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 Lq extends ci{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 IO extends yt{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 Ln extends yt{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 Dq(r,t){if(pn.isAnyArray(r))return r[0]&&pn.isAnyArray(r[0])?new Ln(r):new IO(r,t);throw new Error("the argument is not an array")}class Eh{constructor(t){t=Ln.checkMatrix(t);let e=t.clone(),n=e.rows,i=e.columns,a=new Float64Array(n),s=1,o,l,c,u,h,d,f,g,v;for(o=0;o<n;o++)a[o]=o;for(g=new Float64Array(n),l=0;l<i;l++){for(o=0;o<n;o++)g[o]=e.get(o,l);for(o=0;o<n;o++){for(v=Math.min(o,l),h=0,c=0;c<v;c++)h+=e.get(o,c)*g[c];g[o]-=h,e.set(o,l,g[o])}for(u=l,o=l+1;o<n;o++)Math.abs(g[o])>Math.abs(g[u])&&(u=o);if(u!==l){for(c=0;c<i;c++)d=e.get(u,c),e.set(u,c,e.get(l,c)),e.set(l,c,d);f=a[u],a[u]=a[l],a[l]=f,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=et.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,c;for(c=0;c<s;c++)for(o=c+1;o<s;o++)for(l=0;l<i;l++)a.set(o,l,a.get(o,l)-a.get(c,l)*e.get(o,c));for(c=s-1;c>=0;c--){for(l=0;l<i;l++)a.set(c,l,a.get(c,l)/e.get(c,c));for(o=0;o<c;o++)for(l=0;l<i;l++)a.set(o,l,a.get(o,l)-a.get(c,l)*e.get(o,c))}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 et(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 et(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 jr(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 W1{constructor(t){t=Ln.checkMatrix(t);let e=t.clone(),n=t.rows,i=t.columns,a=new Float64Array(i),s,o,l,c;for(l=0;l<i;l++){let u=0;for(s=l;s<n;s++)u=jr(u,e.get(s,l));if(u!==0){for(e.get(l,l)<0&&(u=-u),s=l;s<n;s++)e.set(s,l,e.get(s,l)/u);for(e.set(l,l,e.get(l,l)+1),o=l+1;o<i;o++){for(c=0,s=l;s<n;s++)c+=e.get(s,l)*e.get(s,o);for(c=-c/e.get(l,l),s=l;s<n;s++)e.set(s,o,e.get(s,o)+c*e.get(s,l))}}a[l]=-u}this.QR=e,this.Rdiag=a}solve(t){t=et.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,c,u;for(c=0;c<s;c++)for(l=0;l<i;l++){for(u=0,o=c;o<n;o++)u+=e.get(o,c)*a.get(o,l);for(u=-u/e.get(c,c),o=c;o<n;o++)a.set(o,l,a.get(o,l)+u*e.get(o,c))}for(c=s-1;c>=0;c--){for(l=0;l<i;l++)a.set(c,l,a.get(c,l)/this.Rdiag[c]);for(o=0;o<c;o++)for(l=0;l<i;l++)a.set(o,l,a.get(o,l)-a.get(c,l)*e.get(o,c))}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 et(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 et(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 Bs=class{constructor(t,e={}){if(t=Ln.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,c=!!s,u=!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,u=!0;let k=l;l=c,c=k}else h=t.clone();let d=Math.min(n,i),f=Math.min(n+1,i),g=new Float64Array(f),v=new et(n,d),p=new et(i,i),m=new Float64Array(i),y=new Float64Array(n),b=new Float64Array(f);for(let k=0;k<f;k++)b[k]=k;let w=Math.min(n-1,i),x=Math.max(0,Math.min(i-2,n)),S=Math.max(w,x);for(let k=0;k<S;k++){if(k<w){g[k]=0;for(let M=k;M<n;M++)g[k]=jr(g[k],h.get(M,k));if(g[k]!==0){h.get(k,k)<0&&(g[k]=-g[k]);for(let M=k;M<n;M++)h.set(M,k,h.get(M,k)/g[k]);h.set(k,k,h.get(k,k)+1)}g[k]=-g[k]}for(let M=k+1;M<i;M++){if(k<w&&g[k]!==0){let T=0;for(let O=k;O<n;O++)T+=h.get(O,k)*h.get(O,M);T=-T/h.get(k,k);for(let O=k;O<n;O++)h.set(O,M,h.get(O,M)+T*h.get(O,k))}m[M]=h.get(k,M)}if(l&&k<w)for(let M=k;M<n;M++)v.set(M,k,h.get(M,k));if(k<x){m[k]=0;for(let M=k+1;M<i;M++)m[k]=jr(m[k],m[M]);if(m[k]!==0){m[k+1]<0&&(m[k]=0-m[k]);for(let M=k+1;M<i;M++)m[M]/=m[k];m[k+1]+=1}if(m[k]=-m[k],k+1<n&&m[k]!==0){for(let M=k+1;M<n;M++)y[M]=0;for(let M=k+1;M<n;M++)for(let T=k+1;T<i;T++)y[M]+=m[T]*h.get(M,T);for(let M=k+1;M<i;M++){let T=-m[M]/m[k+1];for(let O=k+1;O<n;O++)h.set(O,M,h.get(O,M)+T*y[O])}}if(c)for(let M=k+1;M<i;M++)p.set(M,k,m[M])}}let E=Math.min(i,n+1);if(w<i&&(g[w]=h.get(w,w)),n<E&&(g[E-1]=0),x+1<E&&(m[x]=h.get(x,E-1)),m[E-1]=0,l){for(let k=w;k<d;k++){for(let M=0;M<n;M++)v.set(M,k,0);v.set(k,k,1)}for(let k=w-1;k>=0;k--)if(g[k]!==0){for(let M=k+1;M<d;M++){let T=0;for(let O=k;O<n;O++)T+=v.get(O,k)*v.get(O,M);T=-T/v.get(k,k);for(let O=k;O<n;O++)v.set(O,M,v.get(O,M)+T*v.get(O,k))}for(let M=k;M<n;M++)v.set(M,k,-v.get(M,k));v.set(k,k,1+v.get(k,k));for(let M=0;M<k-1;M++)v.set(M,k,0)}else{for(let M=0;M<n;M++)v.set(M,k,0);v.set(k,k,1)}}if(c)for(let k=i-1;k>=0;k--){if(k<x&&m[k]!==0)for(let M=k+1;M<i;M++){let T=0;for(let O=k+1;O<i;O++)T+=p.get(O,k)*p.get(O,M);T=-T/p.get(k+1,k);for(let O=k+1;O<i;O++)p.set(O,M,p.get(O,M)+T*p.get(O,k))}for(let M=0;M<i;M++)p.set(M,k,0);p.set(k,k,1)}let _=E-1,C=Number.EPSILON;for(;E>0;){let k,M;for(k=E-2;k>=-1&&k!==-1;k--){const T=Number.MIN_VALUE+C*Math.abs(g[k]+Math.abs(g[k+1]));if(Math.abs(m[k])<=T||Number.isNaN(m[k])){m[k]=0;break}}if(k===E-2)M=4;else{let T;for(T=E-1;T>=k&&T!==k;T--){let O=(T!==E?Math.abs(m[T]):0)+(T!==k+1?Math.abs(m[T-1]):0);if(Math.abs(g[T])<=C*O){g[T]=0;break}}T===k?M=3:T===E-1?M=1:(M=2,k=T)}switch(k++,M){case 1:{let T=m[E-2];m[E-2]=0;for(let O=E-2;O>=k;O--){let R=jr(g[O],T),D=g[O]/R,L=T/R;if(g[O]=R,O!==k&&(T=-L*m[O-1],m[O-1]=D*m[O-1]),c)for(let P=0;P<i;P++)R=D*p.get(P,O)+L*p.get(P,E-1),p.set(P,E-1,-L*p.get(P,O)+D*p.get(P,E-1)),p.set(P,O,R)}break}case 2:{let T=m[k-1];m[k-1]=0;for(let O=k;O<E;O++){let R=jr(g[O],T),D=g[O]/R,L=T/R;if(g[O]=R,T=-L*m[O],m[O]=D*m[O],l)for(let P=0;P<n;P++)R=D*v.get(P,O)+L*v.get(P,k-1),v.set(P,k-1,-L*v.get(P,O)+D*v.get(P,k-1)),v.set(P,O,R)}break}case 3:{const T=Math.max(Math.abs(g[E-1]),Math.abs(g[E-2]),Math.abs(m[E-2]),Math.abs(g[k]),Math.abs(m[k])),O=g[E-1]/T,R=g[E-2]/T,D=m[E-2]/T,L=g[k]/T,P=m[k]/T,A=((R+O)*(R-O)+D*D)/2,I=O*D*(O*D);let B=0;(A!==0||I!==0)&&(A<0?B=0-Math.sqrt(A*A+I):B=Math.sqrt(A*A+I),B=I/(A+B));let j=(L+O)*(L-O)+B,G=L*P;for(let H=k;H<E-1;H++){let Y=jr(j,G);Y===0&&(Y=Number.MIN_VALUE);let K=j/Y,tt=G/Y;if(H!==k&&(m[H-1]=Y),j=K*g[H]+tt*m[H],m[H]=K*m[H]-tt*g[H],G=tt*g[H+1],g[H+1]=K*g[H+1],c)for(let it=0;it<i;it++)Y=K*p.get(it,H)+tt*p.get(it,H+1),p.set(it,H+1,-tt*p.get(it,H)+K*p.get(it,H+1)),p.set(it,H,Y);if(Y=jr(j,G),Y===0&&(Y=Number.MIN_VALUE),K=j/Y,tt=G/Y,g[H]=Y,j=K*m[H]+tt*g[H+1],g[H+1]=-tt*m[H]+K*g[H+1],G=tt*m[H+1],m[H+1]=K*m[H+1],l&&H<n-1)for(let it=0;it<n;it++)Y=K*v.get(it,H)+tt*v.get(it,H+1),v.set(it,H+1,-tt*v.get(it,H)+K*v.get(it,H+1)),v.set(it,H,Y)}m[E-2]=j;break}case 4:{if(g[k]<=0&&(g[k]=g[k]<0?-g[k]:0,c))for(let T=0;T<=_;T++)p.set(T,k,-p.get(T,k));for(;k<_&&!(g[k]>=g[k+1]);){let T=g[k];if(g[k]=g[k+1],g[k+1]=T,c&&k<i-1)for(let O=0;O<i;O++)T=p.get(O,k+1),p.set(O,k+1,p.get(O,k)),p.set(O,k,T);if(l&&k<n-1)for(let O=0;O<n;O++)T=v.get(O,k+1),v.set(O,k+1,v.get(O,k)),v.set(O,k,T);k++}E--;break}}}if(u){let k=p;p=v,v=k}this.m=n,this.n=i,this.s=g,this.U=v,this.V=p}solve(t){let e=t,n=this.threshold,i=this.s.length,a=et.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),c=o.rows,u=s.rows,h=et.zeros(c,u);for(let d=0;d<c;d++)for(let f=0;f<u;f++){let g=0;for(let v=0;v<i;v++)g+=l.get(d,v)*s.get(f,v);h.set(d,f,g)}return h.mmul(e)}solveForDiagonal(t){return this.solve(et.diag(t))}inverse(){let t=this.V,e=this.threshold,n=t.rows,i=t.columns,a=new et(n,this.s.length);for(let u=0;u<n;u++)for(let h=0;h<i;h++)Math.abs(this.s[h])>e&&a.set(u,h,t.get(u,h)/this.s[h]);let s=this.U,o=s.rows,l=s.columns,c=new et(n,o);for(let u=0;u<n;u++)for(let h=0;h<o;h++){let d=0;for(let f=0;f<l;f++)d+=a.get(u,f)*s.get(h,f);c.set(u,h,d)}return c}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 et.diag(this.s)}};function Iq(r,t=!1){return r=Ln.checkMatrix(r),t?new Bs(r).inverse():FO(r,et.eye(r.rows))}function FO(r,t,e=!1){return r=Ln.checkMatrix(r),t=Ln.checkMatrix(t),e?new Bs(r).solve(t):r.isSquare()?new Eh(r).solve(t):new W1(r).solve(t)}function jc(r){if(r=et.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 $c(r,[1,2],[1,2]),s=new $c(r,[1,2],[0,2]),o=new $c(r,[1,2],[0,1]),t=r.get(0,0),e=r.get(0,1),n=r.get(0,2),t*jc(a)-e*jc(s)+n*jc(o)}else return new Eh(r).determinant}else throw Error("determinant can only be calculated for a square matrix")}function Fq(r,t){let e=[];for(let n=0;n<r;n++)n!==t&&e.push(n);return e}function Bq(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 zq(r,t={}){const{thresholdValue:e=1e-9,thresholdError:n=1e-9}=t;r=et.checkMatrix(r);let i=r.rows,a=new et(i,i);for(let s=0;s<i;s++){let o=et.columnVector(r.getRow(s)),l=r.subMatrixRow(Fq(i,s)).transpose(),u=new Bs(l).solve(o),h=et.sub(o,l.mmul(u)).abs().max();a.setRow(s,Bq(h,u,s,e,n))}return a}function $q(r,t=Number.EPSILON){if(r=et.checkMatrix(r),r.isEmpty())return r.transpose();let e=new Bs(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(et.diag(a).mmul(n.transpose()))}function jq(r,t=r,e={}){r=new et(r);let n=!1;if(typeof t=="object"&&!et.isMatrix(t)&&!pn.isAnyArray(t)?(e=t,t=r,n=!0):t=new et(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 qq(r,t=r,e={}){r=new et(r);let n=!1;if(typeof t=="object"&&!et.isMatrix(t)&&!pn.isAnyArray(t)?(e=t,t=r,n=!0):t=new et(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 c=0;c<l.rows;c++)for(let u=0;u<l.columns;u++)l.set(c,u,l.get(c,u)*(1/(s[c]*o[u]))*(1/(r.rows-1)));return l}class BO{constructor(t,e={}){const{assumeSymmetric:n=!1}=e;if(t=Ln.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 et(i,i),s=new Float64Array(i),o=new Float64Array(i),l=t,c,u,h=!1;if(n?h=!0:h=t.isSymmetric(),h){for(c=0;c<i;c++)for(u=0;u<i;u++)a.set(c,u,l.get(c,u));Gq(i,o,s,a),Wq(i,o,s,a)}else{let d=new et(i,i),f=new Float64Array(i);for(u=0;u<i;u++)for(c=0;c<i;c++)d.set(c,u,l.get(c,u));Vq(i,d,f,a),Hq(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 et(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 Gq(r,t,e,n){let i,a,s,o,l,c,u,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,c=0;c<o;c++)h=h+Math.abs(e[c]);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(c=0;c<o;c++)e[c]/=h,s+=e[c]*e[c];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,c=l+1;c<=o-1;c++)a+=n.get(c,l)*e[c],t[c]+=n.get(c,l)*i;t[l]=a}for(i=0,l=0;l<o;l++)t[l]/=s,i+=t[l]*e[l];for(u=i/(s+s),l=0;l<o;l++)t[l]-=u*e[l];for(l=0;l<o;l++){for(i=e[l],a=t[l],c=l;c<=o-1;c++)n.set(c,l,n.get(c,l)-(i*t[c]+a*e[c]));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(c=0;c<=o;c++)e[c]=n.get(c,o+1)/s;for(l=0;l<=o;l++){for(a=0,c=0;c<=o;c++)a+=n.get(c,o+1)*n.get(c,l);for(c=0;c<=o;c++)n.set(c,l,n.get(c,l)-a*e[c])}}for(c=0;c<=o;c++)n.set(c,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 Wq(r,t,e,n){let i,a,s,o,l,c,u,h,d,f,g,v,p,m,y,b;for(s=1;s<r;s++)t[s-1]=t[s];t[r-1]=0;let w=0,x=0,S=Number.EPSILON;for(c=0;c<r;c++){for(x=Math.max(x,Math.abs(e[c])+Math.abs(t[c])),u=c;u<r&&!(Math.abs(t[u])<=S*x);)u++;if(u>c)do{for(i=e[c],h=(e[c+1]-i)/(2*t[c]),d=jr(h,1),h<0&&(d=-d),e[c]=t[c]/(h+d),e[c+1]=t[c]*(h+d),f=e[c+1],a=i-e[c],s=c+2;s<r;s++)e[s]-=a;for(w=w+a,h=e[u],g=1,v=g,p=g,m=t[c+1],y=0,b=0,s=u-1;s>=c;s--)for(p=v,v=g,b=y,i=g*t[s],a=g*h,d=jr(h,t[s]),t[s+1]=y*d,y=t[s]/d,g=h/d,h=g*e[s]-y*i,e[s+1]=a+y*(g*i+y*e[s]),l=0;l<r;l++)a=n.get(l,s+1),n.set(l,s+1,y*n.get(l,s)+g*a),n.set(l,s,g*n.get(l,s)-y*a);h=-y*b*p*m*t[c]/f,t[c]=y*h,e[c]=g*h}while(Math.abs(t[c])>S*x);e[c]=e[c]+w,t[c]=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 Vq(r,t,e,n){let i=0,a=r-1,s,o,l,c,u,h,d;for(h=i+1;h<=a-1;h++){for(d=0,c=h;c<=a;c++)d=d+Math.abs(t.get(c,h-1));if(d!==0){for(l=0,c=a;c>=h;c--)e[c]=t.get(c,h-1)/d,l+=e[c]*e[c];for(o=Math.sqrt(l),e[h]>0&&(o=-o),l=l-e[h]*o,e[h]=e[h]-o,u=h;u<r;u++){for(s=0,c=a;c>=h;c--)s+=e[c]*t.get(c,u);for(s=s/l,c=h;c<=a;c++)t.set(c,u,t.get(c,u)-s*e[c])}for(c=0;c<=a;c++){for(s=0,u=a;u>=h;u--)s+=e[u]*t.get(c,u);for(s=s/l,u=h;u<=a;u++)t.set(c,u,t.get(c,u)-s*e[u])}e[h]=d*e[h],t.set(h,h-1,d*o)}}for(c=0;c<r;c++)for(u=0;u<r;u++)n.set(c,u,c===u?1:0);for(h=a-1;h>=i+1;h--)if(t.get(h,h-1)!==0){for(c=h+1;c<=a;c++)e[c]=t.get(c,h-1);for(u=h;u<=a;u++){for(o=0,c=h;c<=a;c++)o+=e[c]*n.get(c,u);for(o=o/e[h]/t.get(h,h-1),c=h;c<=a;c++)n.set(c,u,n.get(c,u)+o*e[c])}}}function Hq(r,t,e,n,i){let a=r-1,s=0,o=r-1,l=Number.EPSILON,c=0,u=0,h=0,d=0,f=0,g=0,v=0,p=0,m,y,b,w,x,S,E,_,C,k,M,T,O,R,D;for(m=0;m<r;m++)for((m<s||m>o)&&(e[m]=i.get(m,m),t[m]=0),y=Math.max(m-1,0);y<r;y++)u=u+Math.abs(i.get(m,y));for(;a>=s;){for(w=a;w>s&&(g=Math.abs(i.get(w-1,w-1))+Math.abs(i.get(w,w)),g===0&&(g=u),!(Math.abs(i.get(w,w-1))<l*g));)w--;if(w===a)i.set(a,a,i.get(a,a)+c),e[a]=i.get(a,a),t[a]=0,a--,p=0;else if(w===a-1){if(E=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+E,v=Math.sqrt(Math.abs(d)),i.set(a,a,i.get(a,a)+c),i.set(a-1,a-1,i.get(a-1,a-1)+c),_=i.get(a,a),d>=0){for(v=h>=0?h+v:h-v,e[a-1]=_+v,e[a]=e[a-1],v!==0&&(e[a]=_-E/v),t[a-1]=0,t[a]=0,_=i.get(a,a-1),g=Math.abs(_)+Math.abs(v),h=_/g,d=v/g,f=Math.sqrt(h*h+d*d),h=h/f,d=d/f,y=a-1;y<r;y++)v=i.get(a-1,y),i.set(a-1,y,d*v+h*i.get(a,y)),i.set(a,y,d*i.get(a,y)-h*v);for(m=0;m<=a;m++)v=i.get(m,a-1),i.set(m,a-1,d*v+h*i.get(m,a)),i.set(m,a,d*i.get(m,a)-h*v);for(m=s;m<=o;m++)v=n.get(m,a-1),n.set(m,a-1,d*v+h*n.get(m,a)),n.set(m,a,d*n.get(m,a)-h*v)}else e[a-1]=_+h,e[a]=_+h,t[a-1]=v,t[a]=-v;a=a-2,p=0}else{if(_=i.get(a,a),C=0,E=0,w<a&&(C=i.get(a-1,a-1),E=i.get(a,a-1)*i.get(a-1,a)),p===10){for(c+=_,m=s;m<=a;m++)i.set(m,m,i.get(m,m)-_);g=Math.abs(i.get(a,a-1))+Math.abs(i.get(a-1,a-2)),_=C=.75*g,E=-.4375*g*g}if(p===30&&(g=(C-_)/2,g=g*g+E,g>0)){for(g=Math.sqrt(g),C<_&&(g=-g),g=_-E/((C-_)/2+g),m=s;m<=a;m++)i.set(m,m,i.get(m,m)-g);c+=g,_=C=E=.964}for(p=p+1,x=a-2;x>=w&&(v=i.get(x,x),f=_-v,g=C-v,h=(f*g-E)/i.get(x+1,x)+i.get(x,x+1),d=i.get(x+1,x+1)-v-f-g,f=i.get(x+2,x+1),g=Math.abs(h)+Math.abs(d)+Math.abs(f),h=h/g,d=d/g,f=f/g,!(x===w||Math.abs(i.get(x,x-1))*(Math.abs(d)+Math.abs(f))<l*(Math.abs(h)*(Math.abs(i.get(x-1,x-1))+Math.abs(v)+Math.abs(i.get(x+1,x+1))))));)x--;for(m=x+2;m<=a;m++)i.set(m,m-2,0),m>x+2&&i.set(m,m-3,0);for(b=x;b<=a-1&&(R=b!==a-1,b!==x&&(h=i.get(b,b-1),d=i.get(b+1,b-1),f=R?i.get(b+2,b-1):0,_=Math.abs(h)+Math.abs(d)+Math.abs(f),_!==0&&(h=h/_,d=d/_,f=f/_)),_!==0);b++)if(g=Math.sqrt(h*h+d*d+f*f),h<0&&(g=-g),g!==0){for(b!==x?i.set(b,b-1,-g*_):w!==x&&i.set(b,b-1,-i.get(b,b-1)),h=h+g,_=h/g,C=d/g,v=f/g,d=d/h,f=f/h,y=b;y<r;y++)h=i.get(b,y)+d*i.get(b+1,y),R&&(h=h+f*i.get(b+2,y),i.set(b+2,y,i.get(b+2,y)-h*v)),i.set(b,y,i.get(b,y)-h*_),i.set(b+1,y,i.get(b+1,y)-h*C);for(m=0;m<=Math.min(a,b+3);m++)h=_*i.get(m,b)+C*i.get(m,b+1),R&&(h=h+v*i.get(m,b+2),i.set(m,b+2,i.get(m,b+2)-h*f)),i.set(m,b,i.get(m,b)-h),i.set(m,b+1,i.get(m,b+1)-h*d);for(m=s;m<=o;m++)h=_*n.get(m,b)+C*n.get(m,b+1),R&&(h=h+v*n.get(m,b+2),n.set(m,b+2,n.get(m,b+2)-h*f)),n.set(m,b,n.get(m,b)-h),n.set(m,b+1,n.get(m,b+1)-h*d)}}}if(u!==0){for(a=r-1;a>=0;a--)if(h=e[a],d=t[a],d===0)for(w=a,i.set(a,a,1),m=a-1;m>=0;m--){for(E=i.get(m,m)-h,f=0,y=w;y<=a;y++)f=f+i.get(m,y)*i.get(y,a);if(t[m]<0)v=E,g=f;else if(w=m,t[m]===0?i.set(m,a,E!==0?-f/E:-f/(l*u)):(_=i.get(m,m+1),C=i.get(m+1,m),d=(e[m]-h)*(e[m]-h)+t[m]*t[m],S=(_*g-v*f)/d,i.set(m,a,S),i.set(m+1,a,Math.abs(_)>Math.abs(v)?(-f-E*S)/_:(-g-C*S)/v)),S=Math.abs(i.get(m,a)),l*S*S>1)for(y=m;y<=a;y++)i.set(y,a,i.get(y,a)/S)}else if(d<0)for(w=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))):(D=pc(0,-i.get(a-1,a),i.get(a-1,a-1)-h,d),i.set(a-1,a-1,D[0]),i.set(a-1,a,D[1])),i.set(a,a-1,0),i.set(a,a,1),m=a-2;m>=0;m--){for(k=0,M=0,y=w;y<=a;y++)k=k+i.get(m,y)*i.get(y,a-1),M=M+i.get(m,y)*i.get(y,a);if(E=i.get(m,m)-h,t[m]<0)v=E,f=k,g=M;else if(w=m,t[m]===0?(D=pc(-k,-M,E,d),i.set(m,a-1,D[0]),i.set(m,a,D[1])):(_=i.get(m,m+1),C=i.get(m+1,m),T=(e[m]-h)*(e[m]-h)+t[m]*t[m]-d*d,O=(e[m]-h)*2*d,T===0&&O===0&&(T=l*u*(Math.abs(E)+Math.abs(d)+Math.abs(_)+Math.abs(C)+Math.abs(v))),D=pc(_*f-v*k+d*M,_*g-v*M-d*k,T,O),i.set(m,a-1,D[0]),i.set(m,a,D[1]),Math.abs(_)>Math.abs(v)+Math.abs(d)?(i.set(m+1,a-1,(-k-E*i.get(m,a-1)+d*i.get(m,a))/_),i.set(m+1,a,(-M-E*i.get(m,a)-d*i.get(m,a-1))/_)):(D=pc(-f-C*i.get(m,a-1),-g-C*i.get(m,a),v,d),i.set(m+1,a-1,D[0]),i.set(m+1,a,D[1]))),S=Math.max(Math.abs(i.get(m,a-1)),Math.abs(i.get(m,a))),l*S*S>1)for(y=m;y<=a;y++)i.set(y,a-1,i.get(y,a-1)/S),i.set(y,a,i.get(y,a)/S)}for(m=0;m<r;m++)if(m<s||m>o)for(y=m;y<r;y++)n.set(m,y,i.get(m,y));for(y=r-1;y>=s;y--)for(m=s;m<=o;m++){for(v=0,b=s;b<=Math.min(y,o);b++)v=v+n.get(m,b)*i.get(b,y);n.set(m,y,v)}}}function pc(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 zO{constructor(t){if(t=Ln.checkMatrix(t),!t.isSymmetric())throw new Error("Matrix is not symmetric");let e=t,n=e.rows,i=new et(n,n),a=!0,s,o,l;for(o=0;o<n;o++){let c=0;for(l=0;l<o;l++){let u=0;for(s=0;s<l;s++)u+=i.get(l,s)*i.get(o,s);u=(e.get(o,l)-u)/i.get(l,l),i.set(o,l,u),c=c+u*u}for(c=e.get(o,o)-c,a&&(a=c>0),i.set(o,o,Math.sqrt(Math.max(c,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=Ln.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 $O{constructor(t,e={}){t=Ln.checkMatrix(t);let{Y:n}=e;const{scaleScores:i=!1,maxIterations:a=1e3,terminationCriteria:s=1e-10}=e;let o;if(n){if(pn.isAnyArray(n)&&typeof n[0]=="number"?n=et.columnVector(n):n=Ln.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,c,u,h,d;for(let f=0;f<a&&l>s;f++)h=t.transpose().mmul(o).div(o.transpose().mmul(o).get(0,0)),h=h.div(h.norm()),c=t.mmul(h).div(h.transpose().mmul(h).get(0,0)),f>0&&(l=c.clone().sub(d).pow(2).sum()),d=c.clone(),n?(u=n.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0)),u=u.div(u.norm()),o=n.mmul(u).div(u.transpose().mmul(u).get(0,0))):o=c;if(n){let f=t.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0));f=f.div(f.norm());let g=t.clone().sub(c.clone().mmul(f.transpose())),v=o.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0)),p=n.clone().sub(c.clone().mulS(v.get(0,0)).mmul(u.transpose()));this.t=c,this.p=f.transpose(),this.w=h.transpose(),this.q=u,this.u=o,this.s=c.transpose().mmul(c),this.xResidual=g,this.yResidual=p,this.betas=v}else this.w=h.transpose(),this.s=c.transpose().mmul(c).sqrt(),i?this.t=c.clone().div(this.s.get(0,0)):this.t=c,this.xResidual=t.sub(c.mmul(h.transpose()))}}kt.AbstractMatrix=yt;kt.CHO=zO;kt.CholeskyDecomposition=zO;kt.DistanceMatrix=xh;kt.EVD=BO;kt.EigenvalueDecomposition=BO;kt.LU=Eh;kt.LuDecomposition=Eh;var jO=kt.Matrix=et;kt.MatrixColumnSelectionView=Tq;kt.MatrixColumnView=Cq;kt.MatrixFlipColumnView=Oq;kt.MatrixFlipRowView=Aq;kt.MatrixRowSelectionView=Nq;kt.MatrixRowView=Pq;kt.MatrixSelectionView=$c;kt.MatrixSubView=Rq;kt.MatrixTransposeView=Lq;kt.NIPALS=$O;kt.Nipals=$O;kt.QR=W1;kt.QrDecomposition=W1;kt.SVD=Bs;var Uq=kt.SingularValueDecomposition=Bs;kt.SymmetricMatrix=Pa;kt.WrapperMatrix1D=IO;kt.WrapperMatrix2D=Ln;kt.correlation=qq;kt.covariance=jq;var zw=kt.default=et;kt.determinant=jc;kt.inverse=Iq;kt.linearDependencies=zq;kt.pseudoInverse=$q;kt.solve=FO;kt.wrap=Dq;const Ri=jO,qO=Uq;zw.Matrix&&zw.Matrix;const Yq={center:[0,0],linkDistance:50};class GO{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},Yq),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericMDSLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericMDSLayout(!0,t,e)})}genericMDSLayout(t,e,n){return bt(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 Ua(e,t,a);const c=OO({nodes:o,edges:l}),u=TO(c);Xq(u);const h=K$(u,s),d=Kq(h),f=[];return d.forEach((v,p)=>{const m=On(o[p]);m.data.x=v[0]+a[0],m.data.y=v[1]+a[1],f.push(m)}),t&&f.forEach(v=>e.mergeNodeData(v.id,{x:v.data.x,y:v.data.y})),{nodes:f,edges:l}})}}const Xq=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)})})},Kq=r=>{const e=Ri.mul(Ri.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 qO(e),o=Ri.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map(l=>Ri.mul([l],[o]).toJSON()[0].splice(0,2))};function ky(r){return!!r.tick&&!!r.stop}const Zq={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},Jq={center:[0,0],comboPadding:10,treeKey:"combo"};class Qq{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},Jq),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericComboCombinedLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericComboCombinedLayout(!0,t,e)})}genericComboCombinedLayout(t,e,n){return bt(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(_=>!_.data._isCombo),c=e.getAllNodes().filter(_=>_.data._isCombo),u=e.getAllEdges(),h=l==null?void 0:l.length;if(!h||h===1)return Ua(e,t,a);const d=[],f=new Map;l.forEach(_=>{f.set(_.id,_)});const g=new Map;c.forEach(_=>{g.set(_.id,_)});const v=new Map,p=this.getInnerGraphs(e,s,f,g,u,i,v);yield Promise.all(p);const m=new Map,y=[],b=new Map;let w=!0;e.getRoots(s).forEach(_=>{const C=v.get(_.id),k=g.get(_.id)||f.get(_.id),M={id:_.id,data:Object.assign(Object.assign({},_.data),{x:C.data.x||k.data.x,y:C.data.y||k.data.y,fx:C.data.fx||k.data.fx,fy:C.data.fy||k.data.fy,mass:C.data.mass||k.data.mass,size:C.data.size})};y.push(M),m.set(_.id,!0),!isNaN(M.data.x)&&M.data.x!==0&&!isNaN(M.data.y)&&M.data.y!==0?w=!1:(M.data.x=Math.random()*100,M.data.y=Math.random()*100),wy(e,[_],T=>{T.id!==_.id&&b.set(T.id,_.id)},"TB",s)});const x=[];u.forEach(_=>{const C=b.get(_.source)||_.source,k=b.get(_.target)||_.target;C!==k&&m.has(C)&&m.has(k)&&x.push({id:_.id,source:C,target:k,data:{}})});let S;if(y!=null&&y.length){if(y.length===1)y[0].data.x=a[0],y[0].data.y=a[1];else{const _=new Ne({nodes:y,edges:x}),C=o||new RO;w&&Zq[C.id]&&(yield(y.length<100?new GO:new Ey).assign(_));const k=Object.assign({center:a,kg:5,preventOverlap:!0,animate:!1},C.id==="force"?{gravity:1,factor:4,linkDistance:(M,T,O)=>{const R=Math.max(...T.data.size)||32,D=Math.max(...O.data.size)||32;return R/2+D/2+200}}:{});S=yield $w(C,_,k)}v.forEach(_=>{var C;const k=S.nodes.find(O=>O.id===_.id);if(k){const{x:O,y:R}=k.data;_.data.visited=!0,_.data.x=O,_.data.y=R,d.push({id:_.id,data:{x:O,y:R}})}const{x:M,y:T}=_.data;(C=_.data.nodes)===null||C===void 0||C.forEach(O=>{d.push({id:O.id,data:{x:O.data.x+M,y:O.data.y+T}})})}),v.forEach(({data:_})=>{const{x:C,y:k,visited:M,nodes:T}=_;T==null||T.forEach(O=>{if(!M){const R=d.find(D=>D.id===O.id);R.data.x+=C||0,R.data.y+=k||0}})})}return t&&d.forEach(_=>{e.mergeNodeData(_.id,{x:_.data.x,y:_.data.y})}),{nodes:d,edges:u}})}initVals(t){const e=Object.assign({},t),{nodeSize:n,spacing:i,comboPadding:a}=t;let s,o;if(nt(i)?o=()=>i:at(i)?o=i:o=()=>0,e.spacing=o,!n)s=c=>{const u=o(c);return c.size?Vr(c.size)?((c.size[0]>c.size[1]?c.size[0]:c.size[1])+u)/2:me(c.size)?((c.size.width>c.size.height?c.size.width:c.size.height)+u)/2:(c.size+u)/2:32+u/2};else if(at(n))s=c=>{const u=n(c),h=o(c);return Vr(c.size)?((c.size[0]>c.size[1]?c.size[0]:c.size[1])+h)/2:((u||32)+h)/2};else if(Vr(n)){const u=(n[0]>n[1]?n[0]:n[1])/2;s=h=>u+o(h)/2}else{const c=n/2;s=u=>c+o(u)/2}e.nodeSize=s;let l;return nt(a)?l=()=>a:Vr(a)?l=()=>Math.max.apply(null,a):at(a)?l=a:l=()=>0,e.comboPadding=l,e}getInnerGraphs(t,e,n,i,a,s,o){const{nodeSize:l,comboPadding:c,spacing:u,innerLayout:h}=s,d=h||new Ey({}),f={center:[0,0],preventOverlap:!0,nodeSpacing:u},g=[],v=p=>{let m=(c==null?void 0:c(p))||10;return Vr(m)&&(m=Math.max(...m)),{size:m?[m*2,m*2]:[30,30],padding:m}};return t.getRoots(e).forEach(p=>{o.set(p.id,{id:p.id,data:{nodes:[],size:v(p).size}});let m=Promise.resolve();wy(t,[p],y=>{var b;if(!y.data._isCombo)return;const{size:w,padding:x}=v(y);if(!(!((b=t.getChildren(y.id,e))===null||b===void 0)&&b.length))o.set(y.id,{id:y.id,data:Object.assign(Object.assign({},y.data),{size:w})});else{const S=o.get(y.id);o.set(y.id,{id:y.id,data:Object.assign({nodes:[]},S==null?void 0:S.data)});const E=new Map,_=t.getChildren(y.id,e).map(M=>{if(M.data._isCombo)return o.has(M.id)||o.set(M.id,{id:M.id,data:Object.assign({},M.data)}),E.set(M.id,!0),o.get(M.id);const T=n.get(M.id)||i.get(M.id);return E.set(M.id,!0),{id:M.id,data:Object.assign(Object.assign({},T.data),M.data)}}),C={nodes:_,edges:a.filter(M=>E.has(M.source)&&E.has(M.target))};let k=1/0;_.forEach(M=>{var T;let{size:O}=M.data;O||(O=((T=o.get(M.id))===null||T===void 0?void 0:T.data.size)||(l==null?void 0:l(M))||[30,30]),nt(O)&&(O=[O,O]);const[R,D]=O;k>R&&(k=R),k>D&&(k=D),M.data.size=O}),m=m.then(()=>bt(this,void 0,void 0,function*(){const M=new Ne(C);yield $w(d,M,f,!0);const{minX:T,minY:O,maxX:R,maxY:D}=Z$(_),L={x:(R+T)/2,y:(D+O)/2};C.nodes.forEach(A=>{A.data.x-=L.x,A.data.y-=L.y});const P=[Math.max(R-T,k)+x*2,Math.max(D-O,k)+x*2];o.get(y.id).data.size=P,o.get(y.id).data.nodes=_}))}return!0},"BT",e),g.push(m)}),g}}function $w(r,t,e,n){var i;return bt(this,void 0,void 0,function*(){return ky(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 tG(r,t){var e,n=1;r==null&&(r=0),t==null&&(t=0);function i(){var a,s=e.length,o,l=0,c=0;for(a=0;a<s;++a)o=e[a],l+=o.x,c+=o.y;for(l=(l/s-r)*n,c=(c/s-t)*n,a=0;a<s;++a)o=e[a],o.x-=l,o.y-=c}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 Ae(r){return function(){return r}}function Li(r){return(r()-.5)*1e-6}function eG(r){return r.x+r.vx}function nG(r){return r.y+r.vy}function rG(r){var t,e,n,i=1,a=1;typeof r!="function"&&(r=Ae(r==null?1:+r));function s(){for(var c,u=t.length,h,d,f,g,v,p,m=0;m<a;++m)for(h=bh(t,eG,nG).visitAfter(o),c=0;c<u;++c)d=t[c],v=e[d.index],p=v*v,f=d.x+d.vx,g=d.y+d.vy,h.visit(y);function y(b,w,x,S,E){var _=b.data,C=b.r,k=v+C;if(_){if(_.index>d.index){var M=f-_.x-_.vx,T=g-_.y-_.vy,O=M*M+T*T;O<k*k&&(M===0&&(M=Li(n),O+=M*M),T===0&&(T=Li(n),O+=T*T),O=(k-(O=Math.sqrt(O)))/O*i,d.vx+=(M*=O)*(k=(C*=C)/(p+C)),d.vy+=(T*=O)*k,_.vx-=M*(k=1-k),_.vy-=T*k)}return}return w>f+k||S<f-k||x>g+k||E<g-k}}function o(c){if(c.data)return c.r=e[c.data.index];for(var u=c.r=0;u<4;++u)c[u]&&c[u].r>c.r&&(c.r=c[u].r)}function l(){if(t){var c,u=t.length,h;for(e=new Array(u),c=0;c<u;++c)h=t[c],e[h.index]=+r(h,c,t)}}return s.initialize=function(c,u){t=c,n=u,l()},s.iterations=function(c){return arguments.length?(a=+c,s):a},s.strength=function(c){return arguments.length?(i=+c,s):i},s.radius=function(c){return arguments.length?(r=typeof c=="function"?c:Ae(+c),l(),s):r},s}function iG(r){return r.index}function jw(r,t){var e=r.get(t);if(!e)throw new Error("node not found: "+t);return e}function aG(r){var t=iG,e=h,n,i=Ae(30),a,s,o,l,c,u=1;r==null&&(r=[]);function h(p){return 1/Math.min(o[p.source.index],o[p.target.index])}function d(p){for(var m=0,y=r.length;m<u;++m)for(var b=0,w,x,S,E,_,C,k;b<y;++b)w=r[b],x=w.source,S=w.target,E=S.x+S.vx-x.x-x.vx||Li(c),_=S.y+S.vy-x.y-x.vy||Li(c),C=Math.sqrt(E*E+_*_),C=(C-a[b])/C*p*n[b],E*=C,_*=C,S.vx-=E*(k=l[b]),S.vy-=_*k,x.vx+=E*(k=1-k),x.vy+=_*k}function f(){if(s){var p,m=s.length,y=r.length,b=new Map(s.map((x,S)=>[t(x,S,s),x])),w;for(p=0,o=new Array(m);p<y;++p)w=r[p],w.index=p,typeof w.source!="object"&&(w.source=jw(b,w.source)),typeof w.target!="object"&&(w.target=jw(b,w.target)),o[w.source.index]=(o[w.source.index]||0)+1,o[w.target.index]=(o[w.target.index]||0)+1;for(p=0,l=new Array(y);p<y;++p)w=r[p],l[p]=o[w.source.index]/(o[w.source.index]+o[w.target.index]);n=new Array(y),g(),a=new Array(y),v()}}function g(){if(s)for(var p=0,m=r.length;p<m;++p)n[p]=+e(r[p],p,r)}function v(){if(s)for(var p=0,m=r.length;p<m;++p)a[p]=+i(r[p],p,r)}return d.initialize=function(p,m){s=p,c=m,f()},d.links=function(p){return arguments.length?(r=p,f(),d):r},d.id=function(p){return arguments.length?(t=p,d):t},d.iterations=function(p){return arguments.length?(u=+p,d):u},d.strength=function(p){return arguments.length?(e=typeof p=="function"?p:Ae(+p),g(),d):e},d.distance=function(p){return arguments.length?(i=typeof p=="function"?p:Ae(+p),v(),d):i},d}var sG={value:()=>{}};function WO(){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 qc(e)}function qc(r){this._=r}function oG(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}})}qc.prototype=WO.prototype={constructor:qc,on:function(r,t){var e=this._,n=oG(r+"",e),i,a=-1,s=n.length;if(arguments.length<2){for(;++a<s;)if((i=(r=n[a]).type)&&(i=lG(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]=qw(e[i],r.name,t);else if(t==null)for(i in e)e[i]=qw(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 qc(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 lG(r,t){for(var e=0,n=r.length,i;e<n;++e)if((i=r[e]).name===t)return i.value}function qw(r,t,e){for(var n=0,i=r.length;n<i;++n)if(r[n].name===t){r[n]=sG,r=r.slice(0,n).concat(r.slice(n+1));break}return e!=null&&r.push({name:t,value:e}),r}var Ns=0,uo=0,Qs=0,VO=1e3,Su,ho,_u=0,ja=0,Sh=0,Wo=typeof performance=="object"&&performance.now?performance:Date,HO=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function UO(){return ja||(HO(cG),ja=Wo.now()+Sh)}function cG(){ja=0}function My(){this._call=this._time=this._next=null}My.prototype=YO.prototype={constructor:My,restart:function(r,t,e){if(typeof r!="function")throw new TypeError("callback is not a function");e=(e==null?UO():+e)+(t==null?0:+t),!this._next&&ho!==this&&(ho?ho._next=this:Su=this,ho=this),this._call=r,this._time=e,Cy()},stop:function(){this._call&&(this._call=null,this._time=1/0,Cy())}};function YO(r,t,e){var n=new My;return n.restart(r,t,e),n}function uG(){UO(),++Ns;for(var r=Su,t;r;)(t=ja-r._time)>=0&&r._call.call(void 0,t),r=r._next;--Ns}function Gw(){ja=(_u=Wo.now())+Sh,Ns=uo=0;try{uG()}finally{Ns=0,dG(),ja=0}}function hG(){var r=Wo.now(),t=r-_u;t>VO&&(Sh-=t,_u=r)}function dG(){for(var r,t=Su,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:Su=e);ho=r,Cy(n)}function Cy(r){if(!Ns){uo&&(uo=clearTimeout(uo));var t=r-ja;t>24?(r<1/0&&(uo=setTimeout(Gw,r-Wo.now()-Sh)),Qs&&(Qs=clearInterval(Qs))):(Qs||(_u=Wo.now(),Qs=setInterval(hG,VO)),Ns=1,HO(Gw))}}const fG=1664525,gG=1013904223,Ww=4294967296;function vG(){let r=1;return()=>(r=(fG*r+gG)%Ww)/Ww}function pG(r){return r.x}function mG(r){return r.y}var yG=10,bG=Math.PI*(3-Math.sqrt(5));function wG(r){var t,e=1,n=.001,i=1-Math.pow(n,1/300),a=0,s=.6,o=new Map,l=YO(h),c=WO("tick","end"),u=vG();r==null&&(r=[]);function h(){d(),c.call("tick",t),e<n&&(l.stop(),c.call("end",t))}function d(v){var p,m=r.length,y;v===void 0&&(v=1);for(var b=0;b<v;++b)for(e+=(a-e)*i,o.forEach(function(w){w(e)}),p=0;p<m;++p)y=r[p],y.fx==null?y.x+=y.vx*=s:(y.x=y.fx,y.vx=0),y.fy==null?y.y+=y.vy*=s:(y.y=y.fy,y.vy=0);return t}function f(){for(var v=0,p=r.length,m;v<p;++v){if(m=r[v],m.index=v,m.fx!=null&&(m.x=m.fx),m.fy!=null&&(m.y=m.fy),isNaN(m.x)||isNaN(m.y)){var y=yG*Math.sqrt(.5+v),b=v*bG;m.x=y*Math.cos(b),m.y=y*Math.sin(b)}(isNaN(m.vx)||isNaN(m.vy))&&(m.vx=m.vy=0)}}function g(v){return v.initialize&&v.initialize(r,u),v}return f(),t={tick:d,restart:function(){return l.restart(h),t},stop:function(){return l.stop(),t},nodes:function(v){return arguments.length?(r=v,f(),o.forEach(g),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?(u=v,o.forEach(g),t):u},force:function(v,p){return arguments.length>1?(p==null?o.delete(v):o.set(v,g(p)),t):o.get(v)},find:function(v,p,m){var y=0,b=r.length,w,x,S,E,_;for(m==null?m=1/0:m*=m,y=0;y<b;++y)E=r[y],w=v-E.x,x=p-E.y,S=w*w+x*x,S<m&&(_=E,m=S);return _},on:function(v,p){return arguments.length>1?(c.on(v,p),t):c.on(v)}}}function xG(){var r,t,e,n,i=Ae(-30),a,s=1,o=1/0,l=.81;function c(f){var g,v=r.length,p=bh(r,pG,mG).visitAfter(h);for(n=f,g=0;g<v;++g)t=r[g],p.visit(d)}function u(){if(r){var f,g=r.length,v;for(a=new Array(g),f=0;f<g;++f)v=r[f],a[v.index]=+i(v,f,r)}}function h(f){var g=0,v,p,m=0,y,b,w;if(f.length){for(y=b=w=0;w<4;++w)(v=f[w])&&(p=Math.abs(v.value))&&(g+=v.value,m+=p,y+=p*v.x,b+=p*v.y);f.x=y/m,f.y=b/m}else{v=f,v.x=v.data.x,v.y=v.data.y;do g+=a[v.data.index];while(v=v.next)}f.value=g}function d(f,g,v,p){if(!f.value)return!0;var m=f.x-t.x,y=f.y-t.y,b=p-g,w=m*m+y*y;if(b*b/l<w)return w<o&&(m===0&&(m=Li(e),w+=m*m),y===0&&(y=Li(e),w+=y*y),w<s&&(w=Math.sqrt(s*w)),t.vx+=m*f.value*n/w,t.vy+=y*f.value*n/w),!0;if(f.length||w>=o)return;(f.data!==t||f.next)&&(m===0&&(m=Li(e),w+=m*m),y===0&&(y=Li(e),w+=y*y),w<s&&(w=Math.sqrt(s*w)));do f.data!==t&&(b=a[f.data.index]*n/w,t.vx+=m*b,t.vy+=y*b);while(f=f.next)}return c.initialize=function(f,g){r=f,e=g,u()},c.strength=function(f){return arguments.length?(i=typeof f=="function"?f:Ae(+f),u(),c):i},c.distanceMin=function(f){return arguments.length?(s=f*f,c):Math.sqrt(s)},c.distanceMax=function(f){return arguments.length?(o=f*f,c):Math.sqrt(o)},c.theta=function(f){return arguments.length?(l=f*f,c):Math.sqrt(l)},c}function EG(r,t,e){var n,i=Ae(.1),a,s;typeof r!="function"&&(r=Ae(+r)),t==null&&(t=0),e==null&&(e=0);function o(c){for(var u=0,h=n.length;u<h;++u){var d=n[u],f=d.x-t||1e-6,g=d.y-e||1e-6,v=Math.sqrt(f*f+g*g),p=(s[u]-v)*a[u]*c/v;d.vx+=f*p,d.vy+=g*p}}function l(){if(n){var c,u=n.length;for(a=new Array(u),s=new Array(u),c=0;c<u;++c)s[c]=+r(n[c],c,n),a[c]=isNaN(s[c])?0:+i(n[c],c,n)}}return o.initialize=function(c){n=c,l()},o.strength=function(c){return arguments.length?(i=typeof c=="function"?c:Ae(+c),l(),o):i},o.radius=function(c){return arguments.length?(r=typeof c=="function"?c:Ae(+c),l(),o):r},o.x=function(c){return arguments.length?(t=+c,o):t},o.y=function(c){return arguments.length?(e=+c,o):e},o}function SG(r){var t=Ae(.1),e,n,i;typeof r!="function"&&(r=Ae(r==null?0:+r));function a(o){for(var l=0,c=e.length,u;l<c;++l)u=e[l],u.vx+=(i[l]-u.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:Ae(+o),s(),a):t},a.x=function(o){return arguments.length?(r=typeof o=="function"?o:Ae(+o),s(),a):r},a}function _G(r){var t=Ae(.1),e,n,i;typeof r!="function"&&(r=Ae(r==null?0:+r));function a(o){for(var l=0,c=e.length,u;l<c;++l)u=e[l],u.vy+=(i[l]-u.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:Ae(+o),s(),a):t},a.y=function(o){return arguments.length?(r=typeof o=="function"?o:Ae(+o),s(),a):r},a}class kG{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:aG,manyBody:xG,center:tG,collide:rG,radial:EG,x:SG,y:_G},this.options={link:{id:e=>e.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},on(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericLayout(!1,t,e)})}assign(t,e){return bt(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=on({},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 bt(this,void 0,void 0,function*(){const a=this.getOptions(n),s=e.getAllNodes().map(({id:u,data:h})=>Object.assign(Object.assign({id:u},h),La(h.data,this.config.inputNodeAttrs))),o=e.getAllEdges().map(u=>Object.assign({},u));Object.assign(this.context,{assign:t,nodes:s,edges:o,graph:e});const l=new Promise(u=>{this.resolver=u}),c=this.setSimulation(a);return c.nodes(s),(i=c.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),La(o,this.config.outputNodeAttrs))})),s=n.map(({id:o,source:l,target:c,data:u})=>({id:o,source:typeof l=="object"?l.id:l,target:typeof c=="object"?c.id:c,data:u}));return t&&a.forEach(o=>i.mergeNodeData(o.id,o.data)),{nodes:a,edges:s}}initSimulation(){return wG()}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())})),Vw(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)),Vw(s,Object.entries(t[a]))}else e.force(a,null)}),e}}const Vw=(r,t)=>t.reduce((e,[n,i])=>!e[n]||i===void 0?e:e[n].call(r,i),r);var yf,Hw;function MG(){if(Hw)return yf;Hw=1;function r(){this.__data__=[],this.size=0}return yf=r,yf}var bf,Uw;function zs(){if(Uw)return bf;Uw=1;function r(t,e){return t===e||t!==t&&e!==e}return bf=r,bf}var wf,Yw;function _h(){if(Yw)return wf;Yw=1;var r=zs();function t(e,n){for(var i=e.length;i--;)if(r(e[i][0],n))return i;return-1}return wf=t,wf}var xf,Xw;function CG(){if(Xw)return xf;Xw=1;var r=_h(),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 xf=n,xf}var Ef,Kw;function TG(){if(Kw)return Ef;Kw=1;var r=_h();function t(e){var n=this.__data__,i=r(n,e);return i<0?void 0:n[i][1]}return Ef=t,Ef}var Sf,Zw;function OG(){if(Zw)return Sf;Zw=1;var r=_h();function t(e){return r(this.__data__,e)>-1}return Sf=t,Sf}var _f,Jw;function AG(){if(Jw)return _f;Jw=1;var r=_h();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 _f=t,_f}var kf,Qw;function kh(){if(Qw)return kf;Qw=1;var r=MG(),t=CG(),e=TG(),n=OG(),i=AG();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var c=s[o];this.set(c[0],c[1])}}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=e,a.prototype.has=n,a.prototype.set=i,kf=a,kf}var Mf,tx;function PG(){if(tx)return Mf;tx=1;var r=kh();function t(){this.__data__=new r,this.size=0}return Mf=t,Mf}var Cf,ex;function NG(){if(ex)return Cf;ex=1;function r(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}return Cf=r,Cf}var Tf,nx;function RG(){if(nx)return Tf;nx=1;function r(t){return this.__data__.get(t)}return Tf=r,Tf}var Of,rx;function LG(){if(rx)return Of;rx=1;function r(t){return this.__data__.has(t)}return Of=r,Of}var Af,ix;function XO(){if(ix)return Af;ix=1;var r=typeof Ml=="object"&&Ml&&Ml.Object===Object&&Ml;return Af=r,Af}var Pf,ax;function hr(){if(ax)return Pf;ax=1;var r=XO(),t=typeof self=="object"&&self&&self.Object===Object&&self,e=r||t||Function("return this")();return Pf=e,Pf}var Nf,sx;function $s(){if(sx)return Nf;sx=1;var r=hr(),t=r.Symbol;return Nf=t,Nf}var Rf,ox;function DG(){if(ox)return Rf;ox=1;var r=$s(),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 c=!0}catch{}var u=n.call(s);return c&&(o?s[i]=l:delete s[i]),u}return Rf=a,Rf}var Lf,lx;function IG(){if(lx)return Lf;lx=1;var r=Object.prototype,t=r.toString;function e(n){return t.call(n)}return Lf=e,Lf}var Df,cx;function Ya(){if(cx)return Df;cx=1;var r=$s(),t=DG(),e=IG(),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 Df=s,Df}var If,ux;function Kn(){if(ux)return If;ux=1;function r(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}return If=r,If}var Ff,hx;function fl(){if(hx)return Ff;hx=1;var r=Ya(),t=Kn(),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 Ff=s,Ff}var Bf,dx;function FG(){if(dx)return Bf;dx=1;var r=hr(),t=r["__core-js_shared__"];return Bf=t,Bf}var zf,fx;function BG(){if(fx)return zf;fx=1;var r=FG(),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 zf=e,zf}var $f,gx;function KO(){if(gx)return $f;gx=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 $f=e,$f}var jf,vx;function zG(){if(vx)return jf;vx=1;var r=fl(),t=BG(),e=Kn(),n=KO(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,l=s.toString,c=o.hasOwnProperty,u=RegExp("^"+l.call(c).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function h(d){if(!e(d)||t(d))return!1;var f=r(d)?u:a;return f.test(n(d))}return jf=h,jf}var qf,px;function $G(){if(px)return qf;px=1;function r(t,e){return t==null?void 0:t[e]}return qf=r,qf}var Gf,mx;function Xa(){if(mx)return Gf;mx=1;var r=zG(),t=$G();function e(n,i){var a=t(n,i);return r(a)?a:void 0}return Gf=e,Gf}var Wf,yx;function V1(){if(yx)return Wf;yx=1;var r=Xa(),t=hr(),e=r(t,"Map");return Wf=e,Wf}var Vf,bx;function Mh(){if(bx)return Vf;bx=1;var r=Xa(),t=r(Object,"create");return Vf=t,Vf}var Hf,wx;function jG(){if(wx)return Hf;wx=1;var r=Mh();function t(){this.__data__=r?r(null):{},this.size=0}return Hf=t,Hf}var Uf,xx;function qG(){if(xx)return Uf;xx=1;function r(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}return Uf=r,Uf}var Yf,Ex;function GG(){if(Ex)return Yf;Ex=1;var r=Mh(),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 Yf=i,Yf}var Xf,Sx;function WG(){if(Sx)return Xf;Sx=1;var r=Mh(),t=Object.prototype,e=t.hasOwnProperty;function n(i){var a=this.__data__;return r?a[i]!==void 0:e.call(a,i)}return Xf=n,Xf}var Kf,_x;function VG(){if(_x)return Kf;_x=1;var r=Mh(),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 Kf=e,Kf}var Zf,kx;function HG(){if(kx)return Zf;kx=1;var r=jG(),t=qG(),e=GG(),n=WG(),i=VG();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var c=s[o];this.set(c[0],c[1])}}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=e,a.prototype.has=n,a.prototype.set=i,Zf=a,Zf}var Jf,Mx;function UG(){if(Mx)return Jf;Mx=1;var r=HG(),t=kh(),e=V1();function n(){this.size=0,this.__data__={hash:new r,map:new(e||t),string:new r}}return Jf=n,Jf}var Qf,Cx;function YG(){if(Cx)return Qf;Cx=1;function r(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}return Qf=r,Qf}var t0,Tx;function Ch(){if(Tx)return t0;Tx=1;var r=YG();function t(e,n){var i=e.__data__;return r(n)?i[typeof n=="string"?"string":"hash"]:i.map}return t0=t,t0}var e0,Ox;function XG(){if(Ox)return e0;Ox=1;var r=Ch();function t(e){var n=r(this,e).delete(e);return this.size-=n?1:0,n}return e0=t,e0}var n0,Ax;function KG(){if(Ax)return n0;Ax=1;var r=Ch();function t(e){return r(this,e).get(e)}return n0=t,n0}var r0,Px;function ZG(){if(Px)return r0;Px=1;var r=Ch();function t(e){return r(this,e).has(e)}return r0=t,r0}var i0,Nx;function JG(){if(Nx)return i0;Nx=1;var r=Ch();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 i0=t,i0}var a0,Rx;function H1(){if(Rx)return a0;Rx=1;var r=UG(),t=XG(),e=KG(),n=ZG(),i=JG();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var c=s[o];this.set(c[0],c[1])}}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=e,a.prototype.has=n,a.prototype.set=i,a0=a,a0}var s0,Lx;function QG(){if(Lx)return s0;Lx=1;var r=kh(),t=V1(),e=H1(),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 s0=i,s0}var o0,Dx;function Th(){if(Dx)return o0;Dx=1;var r=kh(),t=PG(),e=NG(),n=RG(),i=LG(),a=QG();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,o0=s,o0}var l0,Ix;function U1(){if(Ix)return l0;Ix=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 l0=r,l0}var c0,Fx;function ZO(){if(Fx)return c0;Fx=1;var r=Xa(),t=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch{}}();return c0=t,c0}var u0,Bx;function Oh(){if(Bx)return u0;Bx=1;var r=ZO();function t(e,n,i){n=="__proto__"&&r?r(e,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[n]=i}return u0=t,u0}var h0,zx;function Ah(){if(zx)return h0;zx=1;var r=Oh(),t=zs(),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 h0=i,h0}var d0,$x;function gl(){if($x)return d0;$x=1;var r=Ah(),t=Oh();function e(n,i,a,s){var o=!a;a||(a={});for(var l=-1,c=i.length;++l<c;){var u=i[l],h=s?s(a[u],n[u],u,a,n):void 0;h===void 0&&(h=n[u]),o?t(a,u,h):r(a,u,h)}return a}return d0=e,d0}var f0,jx;function tW(){if(jx)return f0;jx=1;function r(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}return f0=r,f0}var g0,qx;function Lr(){if(qx)return g0;qx=1;function r(t){return t!=null&&typeof t=="object"}return g0=r,g0}var v0,Gx;function eW(){if(Gx)return v0;Gx=1;var r=Ya(),t=Lr(),e="[object Arguments]";function n(i){return t(i)&&r(i)==e}return v0=n,v0}var p0,Wx;function vl(){if(Wx)return p0;Wx=1;var r=eW(),t=Lr(),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 p0=a,p0}var m0,Vx;function Me(){if(Vx)return m0;Vx=1;var r=Array.isArray;return m0=r,m0}var fo={exports:{}},y0,Hx;function nW(){if(Hx)return y0;Hx=1;function r(){return!1}return y0=r,y0}fo.exports;var Ux;function js(){return Ux||(Ux=1,function(r,t){var e=hr(),n=nW(),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,c=l||n;r.exports=c}(fo,fo.exports)),fo.exports}var b0,Yx;function Ph(){if(Yx)return b0;Yx=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 b0=e,b0}var w0,Xx;function Y1(){if(Xx)return w0;Xx=1;var r=9007199254740991;function t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=r}return w0=t,w0}var x0,Kx;function rW(){if(Kx)return x0;Kx=1;var r=Ya(),t=Y1(),e=Lr(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",s="[object Date]",o="[object Error]",l="[object Function]",c="[object Map]",u="[object Number]",h="[object Object]",d="[object RegExp]",f="[object Set]",g="[object String]",v="[object WeakMap]",p="[object ArrayBuffer]",m="[object DataView]",y="[object Float32Array]",b="[object Float64Array]",w="[object Int8Array]",x="[object Int16Array]",S="[object Int32Array]",E="[object Uint8Array]",_="[object Uint8ClampedArray]",C="[object Uint16Array]",k="[object Uint32Array]",M={};M[y]=M[b]=M[w]=M[x]=M[S]=M[E]=M[_]=M[C]=M[k]=!0,M[n]=M[i]=M[p]=M[a]=M[m]=M[s]=M[o]=M[l]=M[c]=M[u]=M[h]=M[d]=M[f]=M[g]=M[v]=!1;function T(O){return e(O)&&t(O.length)&&!!M[r(O)]}return x0=T,x0}var E0,Zx;function Nh(){if(Zx)return E0;Zx=1;function r(t){return function(e){return t(e)}}return E0=r,E0}var go={exports:{}};go.exports;var Jx;function X1(){return Jx||(Jx=1,function(r,t){var e=XO(),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}(go,go.exports)),go.exports}var S0,Qx;function pl(){if(Qx)return S0;Qx=1;var r=rW(),t=Nh(),e=X1(),n=e&&e.isTypedArray,i=n?t(n):r;return S0=i,S0}var _0,tE;function JO(){if(tE)return _0;tE=1;var r=tW(),t=vl(),e=Me(),n=js(),i=Ph(),a=pl(),s=Object.prototype,o=s.hasOwnProperty;function l(c,u){var h=e(c),d=!h&&t(c),f=!h&&!d&&n(c),g=!h&&!d&&!f&&a(c),v=h||d||f||g,p=v?r(c.length,String):[],m=p.length;for(var y in c)(u||o.call(c,y))&&!(v&&(y=="length"||f&&(y=="offset"||y=="parent")||g&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||i(y,m)))&&p.push(y);return p}return _0=l,_0}var k0,eE;function Rh(){if(eE)return k0;eE=1;var r=Object.prototype;function t(e){var n=e&&e.constructor,i=typeof n=="function"&&n.prototype||r;return e===i}return k0=t,k0}var M0,nE;function QO(){if(nE)return M0;nE=1;function r(t,e){return function(n){return t(e(n))}}return M0=r,M0}var C0,rE;function iW(){if(rE)return C0;rE=1;var r=QO(),t=r(Object.keys,Object);return C0=t,C0}var T0,iE;function K1(){if(iE)return T0;iE=1;var r=Rh(),t=iW(),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 T0=i,T0}var O0,aE;function ui(){if(aE)return O0;aE=1;var r=fl(),t=Y1();function e(n){return n!=null&&t(n.length)&&!r(n)}return O0=e,O0}var A0,sE;function aa(){if(sE)return A0;sE=1;var r=JO(),t=K1(),e=ui();function n(i){return e(i)?r(i):t(i)}return A0=n,A0}var P0,oE;function aW(){if(oE)return P0;oE=1;var r=gl(),t=aa();function e(n,i){return n&&r(i,t(i),n)}return P0=e,P0}var N0,lE;function sW(){if(lE)return N0;lE=1;function r(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}return N0=r,N0}var R0,cE;function oW(){if(cE)return R0;cE=1;var r=Kn(),t=Rh(),e=sW(),n=Object.prototype,i=n.hasOwnProperty;function a(s){if(!r(s))return e(s);var o=t(s),l=[];for(var c in s)c=="constructor"&&(o||!i.call(s,c))||l.push(c);return l}return R0=a,R0}var L0,uE;function Ka(){if(uE)return L0;uE=1;var r=JO(),t=oW(),e=ui();function n(i){return e(i)?r(i,!0):t(i)}return L0=n,L0}var D0,hE;function lW(){if(hE)return D0;hE=1;var r=gl(),t=Ka();function e(n,i){return n&&r(i,t(i),n)}return D0=e,D0}var vo={exports:{}};vo.exports;var dE;function tA(){return dE||(dE=1,function(r,t){var e=hr(),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(c,u){if(u)return c.slice();var h=c.length,d=o?o(h):new c.constructor(h);return c.copy(d),d}r.exports=l}(vo,vo.exports)),vo.exports}var I0,fE;function eA(){if(fE)return I0;fE=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 I0=r,I0}var F0,gE;function nA(){if(gE)return F0;gE=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 F0=r,F0}var B0,vE;function rA(){if(vE)return B0;vE=1;function r(){return[]}return B0=r,B0}var z0,pE;function Z1(){if(pE)return z0;pE=1;var r=nA(),t=rA(),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 z0=a,z0}var $0,mE;function cW(){if(mE)return $0;mE=1;var r=gl(),t=Z1();function e(n,i){return r(n,t(n),i)}return $0=e,$0}var j0,yE;function J1(){if(yE)return j0;yE=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 j0=r,j0}var q0,bE;function Lh(){if(bE)return q0;bE=1;var r=QO(),t=r(Object.getPrototypeOf,Object);return q0=t,q0}var G0,wE;function iA(){if(wE)return G0;wE=1;var r=J1(),t=Lh(),e=Z1(),n=rA(),i=Object.getOwnPropertySymbols,a=i?function(s){for(var o=[];s;)r(o,e(s)),s=t(s);return o}:n;return G0=a,G0}var W0,xE;function uW(){if(xE)return W0;xE=1;var r=gl(),t=iA();function e(n,i){return r(n,t(n),i)}return W0=e,W0}var V0,EE;function aA(){if(EE)return V0;EE=1;var r=J1(),t=Me();function e(n,i,a){var s=i(n);return t(n)?s:r(s,a(n))}return V0=e,V0}var H0,SE;function sA(){if(SE)return H0;SE=1;var r=aA(),t=Z1(),e=aa();function n(i){return r(i,e,t)}return H0=n,H0}var U0,_E;function hW(){if(_E)return U0;_E=1;var r=aA(),t=iA(),e=Ka();function n(i){return r(i,e,t)}return U0=n,U0}var Y0,kE;function dW(){if(kE)return Y0;kE=1;var r=Xa(),t=hr(),e=r(t,"DataView");return Y0=e,Y0}var X0,ME;function fW(){if(ME)return X0;ME=1;var r=Xa(),t=hr(),e=r(t,"Promise");return X0=e,X0}var K0,CE;function oA(){if(CE)return K0;CE=1;var r=Xa(),t=hr(),e=r(t,"Set");return K0=e,K0}var Z0,TE;function gW(){if(TE)return Z0;TE=1;var r=Xa(),t=hr(),e=r(t,"WeakMap");return Z0=e,Z0}var J0,OE;function qs(){if(OE)return J0;OE=1;var r=dW(),t=V1(),e=fW(),n=oA(),i=gW(),a=Ya(),s=KO(),o="[object Map]",l="[object Object]",c="[object Promise]",u="[object Set]",h="[object WeakMap]",d="[object DataView]",f=s(r),g=s(t),v=s(e),p=s(n),m=s(i),y=a;return(r&&y(new r(new ArrayBuffer(1)))!=d||t&&y(new t)!=o||e&&y(e.resolve())!=c||n&&y(new n)!=u||i&&y(new i)!=h)&&(y=function(b){var w=a(b),x=w==l?b.constructor:void 0,S=x?s(x):"";if(S)switch(S){case f:return d;case g:return o;case v:return c;case p:return u;case m:return h}return w}),J0=y,J0}var Q0,AE;function vW(){if(AE)return Q0;AE=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 Q0=e,Q0}var tg,PE;function lA(){if(PE)return tg;PE=1;var r=hr(),t=r.Uint8Array;return tg=t,tg}var eg,NE;function Q1(){if(NE)return eg;NE=1;var r=lA();function t(e){var n=new e.constructor(e.byteLength);return new r(n).set(new r(e)),n}return eg=t,eg}var ng,RE;function pW(){if(RE)return ng;RE=1;var r=Q1();function t(e,n){var i=n?r(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}return ng=t,ng}var rg,LE;function mW(){if(LE)return rg;LE=1;var r=/\w*$/;function t(e){var n=new e.constructor(e.source,r.exec(e));return n.lastIndex=e.lastIndex,n}return rg=t,rg}var ig,DE;function yW(){if(DE)return ig;DE=1;var r=$s(),t=r?r.prototype:void 0,e=t?t.valueOf:void 0;function n(i){return e?Object(e.call(i)):{}}return ig=n,ig}var ag,IE;function cA(){if(IE)return ag;IE=1;var r=Q1();function t(e,n){var i=n?r(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}return ag=t,ag}var sg,FE;function bW(){if(FE)return sg;FE=1;var r=Q1(),t=pW(),e=mW(),n=yW(),i=cA(),a="[object Boolean]",s="[object Date]",o="[object Map]",l="[object Number]",c="[object RegExp]",u="[object Set]",h="[object String]",d="[object Symbol]",f="[object ArrayBuffer]",g="[object DataView]",v="[object Float32Array]",p="[object Float64Array]",m="[object Int8Array]",y="[object Int16Array]",b="[object Int32Array]",w="[object Uint8Array]",x="[object Uint8ClampedArray]",S="[object Uint16Array]",E="[object Uint32Array]";function _(C,k,M){var T=C.constructor;switch(k){case f:return r(C);case a:case s:return new T(+C);case g:return t(C,M);case v:case p:case m:case y:case b:case w:case x:case S:case E:return i(C,M);case o:return new T;case l:case h:return new T(C);case c:return e(C);case u:return new T;case d:return n(C)}}return sg=_,sg}var og,BE;function uA(){if(BE)return og;BE=1;var r=Kn(),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 og=e,og}var lg,zE;function hA(){if(zE)return lg;zE=1;var r=uA(),t=Lh(),e=Rh();function n(i){return typeof i.constructor=="function"&&!e(i)?r(t(i)):{}}return lg=n,lg}var cg,$E;function wW(){if($E)return cg;$E=1;var r=qs(),t=Lr(),e="[object Map]";function n(i){return t(i)&&r(i)==e}return cg=n,cg}var ug,jE;function xW(){if(jE)return ug;jE=1;var r=wW(),t=Nh(),e=X1(),n=e&&e.isMap,i=n?t(n):r;return ug=i,ug}var hg,qE;function EW(){if(qE)return hg;qE=1;var r=qs(),t=Lr(),e="[object Set]";function n(i){return t(i)&&r(i)==e}return hg=n,hg}var dg,GE;function SW(){if(GE)return dg;GE=1;var r=EW(),t=Nh(),e=X1(),n=e&&e.isSet,i=n?t(n):r;return dg=i,dg}var fg,WE;function dA(){if(WE)return fg;WE=1;var r=Th(),t=U1(),e=Ah(),n=aW(),i=lW(),a=tA(),s=eA(),o=cW(),l=uW(),c=sA(),u=hW(),h=qs(),d=vW(),f=bW(),g=hA(),v=Me(),p=js(),m=xW(),y=Kn(),b=SW(),w=aa(),x=Ka(),S=1,E=2,_=4,C="[object Arguments]",k="[object Array]",M="[object Boolean]",T="[object Date]",O="[object Error]",R="[object Function]",D="[object GeneratorFunction]",L="[object Map]",P="[object Number]",A="[object Object]",I="[object RegExp]",B="[object Set]",j="[object String]",G="[object Symbol]",H="[object WeakMap]",Y="[object ArrayBuffer]",K="[object DataView]",tt="[object Float32Array]",it="[object Float64Array]",_t="[object Int8Array]",Mt="[object Int16Array]",re="[object Int32Array]",Re="[object Uint8Array]",Le="[object Uint8ClampedArray]",cn="[object Uint16Array]",sa="[object Uint32Array]",Pt={};Pt[C]=Pt[k]=Pt[Y]=Pt[K]=Pt[M]=Pt[T]=Pt[tt]=Pt[it]=Pt[_t]=Pt[Mt]=Pt[re]=Pt[L]=Pt[P]=Pt[A]=Pt[I]=Pt[B]=Pt[j]=Pt[G]=Pt[Re]=Pt[Le]=Pt[cn]=Pt[sa]=!0,Pt[O]=Pt[R]=Pt[H]=!1;function Dr(Nt,Ir,Jn,xl,oa,Qn){var Ce,la=Ir&S,In=Ir&E,Fr=Ir&_;if(Jn&&(Ce=oa?Jn(Nt,xl,oa,Qn):Jn(Nt)),Ce!==void 0)return Ce;if(!y(Nt))return Nt;var El=v(Nt);if(El){if(Ce=d(Nt),!la)return s(Nt,Ce)}else{var fi=h(Nt),Sl=fi==R||fi==D;if(p(Nt))return a(Nt,la);if(fi==A||fi==C||Sl&&!oa){if(Ce=In||Sl?{}:g(Nt),!la)return In?l(Nt,i(Ce,Nt)):o(Nt,n(Ce,Nt))}else{if(!Pt[fi])return oa?Nt:{};Ce=f(Nt,fi,la)}}Qn||(Qn=new r);var _l=Qn.get(Nt);if(_l)return _l;Qn.set(Nt,Ce),b(Nt)?Nt.forEach(function(gi){Ce.add(Dr(gi,Ir,Jn,gi,Nt,Qn))}):m(Nt)&&Nt.forEach(function(gi,ca){Ce.set(ca,Dr(gi,Ir,Jn,ca,Nt,Qn))});var AN=Fr?In?u:c:In?x:w,O2=El?void 0:AN(Nt);return t(O2||Nt,function(gi,ca){O2&&(ca=gi,gi=Nt[ca]),e(Ce,ca,Dr(gi,Ir,Jn,ca,Nt,Qn))}),Ce}return fg=Dr,fg}var gg,VE;function _W(){if(VE)return gg;VE=1;var r=dA(),t=4;function e(n){return r(n,t)}return gg=e,gg}var vg,HE;function t2(){if(HE)return vg;HE=1;function r(t){return function(){return t}}return vg=r,vg}var pg,UE;function kW(){if(UE)return pg;UE=1;function r(t){return function(e,n,i){for(var a=-1,s=Object(e),o=i(e),l=o.length;l--;){var c=o[t?l:++a];if(n(s[c],c,s)===!1)break}return e}}return pg=r,pg}var mg,YE;function e2(){if(YE)return mg;YE=1;var r=kW(),t=r();return mg=t,mg}var yg,XE;function n2(){if(XE)return yg;XE=1;var r=e2(),t=aa();function e(n,i){return n&&r(n,i,t)}return yg=e,yg}var bg,KE;function MW(){if(KE)return bg;KE=1;var r=ui();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 bg=t,bg}var wg,ZE;function Dh(){if(ZE)return wg;ZE=1;var r=n2(),t=MW(),e=t(r);return wg=e,wg}var xg,JE;function Za(){if(JE)return xg;JE=1;function r(t){return t}return xg=r,xg}var Eg,QE;function fA(){if(QE)return Eg;QE=1;var r=Za();function t(e){return typeof e=="function"?e:r}return Eg=t,Eg}var Sg,tS;function gA(){if(tS)return Sg;tS=1;var r=U1(),t=Dh(),e=fA(),n=Me();function i(a,s){var o=n(a)?r:t;return o(a,e(s))}return Sg=i,Sg}var _g,eS;function vA(){return eS||(eS=1,_g=gA()),_g}var kg,nS;function CW(){if(nS)return kg;nS=1;var r=Dh();function t(e,n){var i=[];return r(e,function(a,s,o){n(a,s,o)&&i.push(a)}),i}return kg=t,kg}var Mg,rS;function TW(){if(rS)return Mg;rS=1;var r="__lodash_hash_undefined__";function t(e){return this.__data__.set(e,r),this}return Mg=t,Mg}var Cg,iS;function OW(){if(iS)return Cg;iS=1;function r(t){return this.__data__.has(t)}return Cg=r,Cg}var Tg,aS;function pA(){if(aS)return Tg;aS=1;var r=H1(),t=TW(),e=OW();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,Tg=n,Tg}var Og,sS;function AW(){if(sS)return Og;sS=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 Og=r,Og}var Ag,oS;function mA(){if(oS)return Ag;oS=1;function r(t,e){return t.has(e)}return Ag=r,Ag}var Pg,lS;function yA(){if(lS)return Pg;lS=1;var r=pA(),t=AW(),e=mA(),n=1,i=2;function a(s,o,l,c,u,h){var d=l&n,f=s.length,g=o.length;if(f!=g&&!(d&&g>f))return!1;var v=h.get(s),p=h.get(o);if(v&&p)return v==o&&p==s;var m=-1,y=!0,b=l&i?new r:void 0;for(h.set(s,o),h.set(o,s);++m<f;){var w=s[m],x=o[m];if(c)var S=d?c(x,w,m,o,s,h):c(w,x,m,s,o,h);if(S!==void 0){if(S)continue;y=!1;break}if(b){if(!t(o,function(E,_){if(!e(b,_)&&(w===E||u(w,E,l,c,h)))return b.push(_)})){y=!1;break}}else if(!(w===x||u(w,x,l,c,h))){y=!1;break}}return h.delete(s),h.delete(o),y}return Pg=a,Pg}var Ng,cS;function PW(){if(cS)return Ng;cS=1;function r(t){var e=-1,n=Array(t.size);return t.forEach(function(i,a){n[++e]=[a,i]}),n}return Ng=r,Ng}var Rg,uS;function r2(){if(uS)return Rg;uS=1;function r(t){var e=-1,n=Array(t.size);return t.forEach(function(i){n[++e]=i}),n}return Rg=r,Rg}var Lg,hS;function NW(){if(hS)return Lg;hS=1;var r=$s(),t=lA(),e=zs(),n=yA(),i=PW(),a=r2(),s=1,o=2,l="[object Boolean]",c="[object Date]",u="[object Error]",h="[object Map]",d="[object Number]",f="[object RegExp]",g="[object Set]",v="[object String]",p="[object Symbol]",m="[object ArrayBuffer]",y="[object DataView]",b=r?r.prototype:void 0,w=b?b.valueOf:void 0;function x(S,E,_,C,k,M,T){switch(_){case y:if(S.byteLength!=E.byteLength||S.byteOffset!=E.byteOffset)return!1;S=S.buffer,E=E.buffer;case m:return!(S.byteLength!=E.byteLength||!M(new t(S),new t(E)));case l:case c:case d:return e(+S,+E);case u:return S.name==E.name&&S.message==E.message;case f:case v:return S==E+"";case h:var O=i;case g:var R=C&s;if(O||(O=a),S.size!=E.size&&!R)return!1;var D=T.get(S);if(D)return D==E;C|=o,T.set(S,E);var L=n(O(S),O(E),C,k,M,T);return T.delete(S),L;case p:if(w)return w.call(S)==w.call(E)}return!1}return Lg=x,Lg}var Dg,dS;function RW(){if(dS)return Dg;dS=1;var r=sA(),t=1,e=Object.prototype,n=e.hasOwnProperty;function i(a,s,o,l,c,u){var h=o&t,d=r(a),f=d.length,g=r(s),v=g.length;if(f!=v&&!h)return!1;for(var p=f;p--;){var m=d[p];if(!(h?m in s:n.call(s,m)))return!1}var y=u.get(a),b=u.get(s);if(y&&b)return y==s&&b==a;var w=!0;u.set(a,s),u.set(s,a);for(var x=h;++p<f;){m=d[p];var S=a[m],E=s[m];if(l)var _=h?l(E,S,m,s,a,u):l(S,E,m,a,s,u);if(!(_===void 0?S===E||c(S,E,o,l,u):_)){w=!1;break}x||(x=m=="constructor")}if(w&&!x){var C=a.constructor,k=s.constructor;C!=k&&"constructor"in a&&"constructor"in s&&!(typeof C=="function"&&C instanceof C&&typeof k=="function"&&k instanceof k)&&(w=!1)}return u.delete(a),u.delete(s),w}return Dg=i,Dg}var Ig,fS;function LW(){if(fS)return Ig;fS=1;var r=Th(),t=yA(),e=NW(),n=RW(),i=qs(),a=Me(),s=js(),o=pl(),l=1,c="[object Arguments]",u="[object Array]",h="[object Object]",d=Object.prototype,f=d.hasOwnProperty;function g(v,p,m,y,b,w){var x=a(v),S=a(p),E=x?u:i(v),_=S?u:i(p);E=E==c?h:E,_=_==c?h:_;var C=E==h,k=_==h,M=E==_;if(M&&s(v)){if(!s(p))return!1;x=!0,C=!1}if(M&&!C)return w||(w=new r),x||o(v)?t(v,p,m,y,b,w):e(v,p,E,m,y,b,w);if(!(m&l)){var T=C&&f.call(v,"__wrapped__"),O=k&&f.call(p,"__wrapped__");if(T||O){var R=T?v.value():v,D=O?p.value():p;return w||(w=new r),b(R,D,m,y,w)}}return M?(w||(w=new r),n(v,p,m,y,b,w)):!1}return Ig=g,Ig}var Fg,gS;function bA(){if(gS)return Fg;gS=1;var r=LW(),t=Lr();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 Fg=e,Fg}var Bg,vS;function DW(){if(vS)return Bg;vS=1;var r=Th(),t=bA(),e=1,n=2;function i(a,s,o,l){var c=o.length,u=c,h=!l;if(a==null)return!u;for(a=Object(a);c--;){var d=o[c];if(h&&d[2]?d[1]!==a[d[0]]:!(d[0]in a))return!1}for(;++c<u;){d=o[c];var f=d[0],g=a[f],v=d[1];if(h&&d[2]){if(g===void 0&&!(f in a))return!1}else{var p=new r;if(l)var m=l(g,v,f,a,s,p);if(!(m===void 0?t(v,g,e|n,l,p):m))return!1}}return!0}return Bg=i,Bg}var zg,pS;function wA(){if(pS)return zg;pS=1;var r=Kn();function t(e){return e===e&&!r(e)}return zg=t,zg}var $g,mS;function IW(){if(mS)return $g;mS=1;var r=wA(),t=aa();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 $g=e,$g}var jg,yS;function xA(){if(yS)return jg;yS=1;function r(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}return jg=r,jg}var qg,bS;function FW(){if(bS)return qg;bS=1;var r=DW(),t=IW(),e=xA();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 qg=n,qg}var Gg,wS;function Gs(){if(wS)return Gg;wS=1;var r=Ya(),t=Lr(),e="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&r(i)==e}return Gg=n,Gg}var Wg,xS;function i2(){if(xS)return Wg;xS=1;var r=Me(),t=Gs(),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 Wg=i,Wg}var Vg,ES;function BW(){if(ES)return Vg;ES=1;var r=H1(),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 c=n.apply(this,s);return a.cache=l.set(o,c)||l,c};return a.cache=new(e.Cache||r),a}return e.Cache=r,Vg=e,Vg}var Hg,SS;function zW(){if(SS)return Hg;SS=1;var r=BW(),t=500;function e(n){var i=r(n,function(s){return a.size===t&&a.clear(),s}),a=i.cache;return i}return Hg=e,Hg}var Ug,_S;function $W(){if(_S)return Ug;_S=1;var r=zW(),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,c){a.push(l?c.replace(e,"$1"):o||s)}),a});return Ug=n,Ug}var Yg,kS;function Ih(){if(kS)return Yg;kS=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 Yg=r,Yg}var Xg,MS;function jW(){if(MS)return Xg;MS=1;var r=$s(),t=Ih(),e=Me(),n=Gs(),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 Xg=s,Xg}var Kg,CS;function EA(){if(CS)return Kg;CS=1;var r=jW();function t(e){return e==null?"":r(e)}return Kg=t,Kg}var Zg,TS;function Fh(){if(TS)return Zg;TS=1;var r=Me(),t=i2(),e=$W(),n=EA();function i(a,s){return r(a)?a:t(a,s)?[a]:e(n(a))}return Zg=i,Zg}var Jg,OS;function ml(){if(OS)return Jg;OS=1;var r=Gs();function t(e){if(typeof e=="string"||r(e))return e;var n=e+"";return n=="0"&&1/e==-1/0?"-0":n}return Jg=t,Jg}var Qg,AS;function Bh(){if(AS)return Qg;AS=1;var r=Fh(),t=ml();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 Qg=e,Qg}var tv,PS;function qW(){if(PS)return tv;PS=1;var r=Bh();function t(e,n,i){var a=e==null?void 0:r(e,n);return a===void 0?i:a}return tv=t,tv}var ev,NS;function GW(){if(NS)return ev;NS=1;function r(t,e){return t!=null&&e in Object(t)}return ev=r,ev}var nv,RS;function SA(){if(RS)return nv;RS=1;var r=Fh(),t=vl(),e=Me(),n=Ph(),i=Y1(),a=ml();function s(o,l,c){l=r(l,o);for(var u=-1,h=l.length,d=!1;++u<h;){var f=a(l[u]);if(!(d=o!=null&&c(o,f)))break;o=o[f]}return d||++u!=h?d:(h=o==null?0:o.length,!!h&&i(h)&&n(f,h)&&(e(o)||t(o)))}return nv=s,nv}var rv,LS;function _A(){if(LS)return rv;LS=1;var r=GW(),t=SA();function e(n,i){return n!=null&&t(n,i,r)}return rv=e,rv}var iv,DS;function WW(){if(DS)return iv;DS=1;var r=bA(),t=qW(),e=_A(),n=i2(),i=wA(),a=xA(),s=ml(),o=1,l=2;function c(u,h){return n(u)&&i(h)?a(s(u),h):function(d){var f=t(d,u);return f===void 0&&f===h?e(d,u):r(h,f,o|l)}}return iv=c,iv}var av,IS;function kA(){if(IS)return av;IS=1;function r(t){return function(e){return e==null?void 0:e[t]}}return av=r,av}var sv,FS;function VW(){if(FS)return sv;FS=1;var r=Bh();function t(e){return function(n){return r(n,e)}}return sv=t,sv}var ov,BS;function HW(){if(BS)return ov;BS=1;var r=kA(),t=VW(),e=i2(),n=ml();function i(a){return e(a)?r(n(a)):t(a)}return ov=i,ov}var lv,zS;function hi(){if(zS)return lv;zS=1;var r=FW(),t=WW(),e=Za(),n=Me(),i=HW();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 lv=a,lv}var cv,$S;function MA(){if($S)return cv;$S=1;var r=nA(),t=CW(),e=hi(),n=Me();function i(a,s){var o=n(a)?r:t;return o(a,e(s,3))}return cv=i,cv}var uv,jS;function UW(){if(jS)return uv;jS=1;var r=Object.prototype,t=r.hasOwnProperty;function e(n,i){return n!=null&&t.call(n,i)}return uv=e,uv}var hv,qS;function CA(){if(qS)return hv;qS=1;var r=UW(),t=SA();function e(n,i){return n!=null&&t(n,i,r)}return hv=e,hv}var dv,GS;function YW(){if(GS)return dv;GS=1;var r=K1(),t=qs(),e=vl(),n=Me(),i=ui(),a=js(),s=Rh(),o=pl(),l="[object Map]",c="[object Set]",u=Object.prototype,h=u.hasOwnProperty;function d(f){if(f==null)return!0;if(i(f)&&(n(f)||typeof f=="string"||typeof f.splice=="function"||a(f)||o(f)||e(f)))return!f.length;var g=t(f);if(g==l||g==c)return!f.size;if(s(f))return!r(f).length;for(var v in f)if(h.call(f,v))return!1;return!0}return dv=d,dv}var fv,WS;function TA(){if(WS)return fv;WS=1;function r(t){return t===void 0}return fv=r,fv}var gv,VS;function OA(){if(VS)return gv;VS=1;var r=Dh(),t=ui();function e(n,i){var a=-1,s=t(n)?Array(n.length):[];return r(n,function(o,l,c){s[++a]=i(o,l,c)}),s}return gv=e,gv}var vv,HS;function AA(){if(HS)return vv;HS=1;var r=Ih(),t=hi(),e=OA(),n=Me();function i(a,s){var o=n(a)?r:e;return o(a,t(s,3))}return vv=i,vv}var pv,US;function XW(){if(US)return pv;US=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 pv=r,pv}var mv,YS;function KW(){if(YS)return mv;YS=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 mv=r,mv}var yv,XS;function PA(){if(XS)return yv;XS=1;var r=XW(),t=Dh(),e=hi(),n=KW(),i=Me();function a(s,o,l){var c=i(s)?r:n,u=arguments.length<3;return c(s,e(o,4),l,u,t)}return yv=a,yv}var bv,KS;function ZW(){if(KS)return bv;KS=1;var r=Ya(),t=Me(),e=Lr(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&e(a)&&r(a)==n}return bv=i,bv}var wv,ZS;function JW(){if(ZS)return wv;ZS=1;var r=kA(),t=r("length");return wv=t,wv}var xv,JS;function QW(){if(JS)return xv;JS=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(c){return o.test(c)}return xv=l,xv}var Ev,QS;function tV(){if(QS)return Ev;QS=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]",c="(?:"+o+"|"+l+")",u="[^"+r+"]",h="(?:\\ud83c[\\udde6-\\uddff]){2}",d="[\\ud800-\\udbff][\\udc00-\\udfff]",f="\\u200d",g=c+"?",v="["+a+"]?",p="(?:"+f+"(?:"+[u,h,d].join("|")+")"+v+g+")*",m=v+g+p,y="(?:"+[u+o+"?",o,h,d,s].join("|")+")",b=RegExp(l+"(?="+l+")|"+y+m,"g");function w(x){for(var S=b.lastIndex=0;b.test(x);)++S;return S}return Ev=w,Ev}var Sv,t_;function eV(){if(t_)return Sv;t_=1;var r=JW(),t=QW(),e=tV();function n(i){return t(i)?e(i):r(i)}return Sv=n,Sv}var _v,e_;function nV(){if(e_)return _v;e_=1;var r=K1(),t=qs(),e=ui(),n=ZW(),i=eV(),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 c=t(l);return c==a||c==s?l.size:r(l).length}return _v=o,_v}var kv,n_;function rV(){if(n_)return kv;n_=1;var r=U1(),t=uA(),e=n2(),n=hi(),i=Lh(),a=Me(),s=js(),o=fl(),l=Kn(),c=pl();function u(h,d,f){var g=a(h),v=g||s(h)||c(h);if(d=n(d,4),f==null){var p=h&&h.constructor;v?f=g?new p:[]:l(h)?f=o(p)?t(i(h)):{}:f={}}return(v?r:e)(h,function(m,y,b){return d(f,m,y,b)}),f}return kv=u,kv}var Mv,r_;function iV(){if(r_)return Mv;r_=1;var r=$s(),t=vl(),e=Me(),n=r?r.isConcatSpreadable:void 0;function i(a){return e(a)||t(a)||!!(n&&a&&a[n])}return Mv=i,Mv}var Cv,i_;function a2(){if(i_)return Cv;i_=1;var r=J1(),t=iV();function e(n,i,a,s,o){var l=-1,c=n.length;for(a||(a=t),o||(o=[]);++l<c;){var u=n[l];i>0&&a(u)?i>1?e(u,i-1,a,s,o):r(o,u):s||(o[o.length]=u)}return o}return Cv=e,Cv}var Tv,a_;function aV(){if(a_)return Tv;a_=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 Tv=r,Tv}var Ov,s_;function NA(){if(s_)return Ov;s_=1;var r=aV(),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),c=Array(l);++o<l;)c[o]=s[i+o];o=-1;for(var u=Array(i+1);++o<i;)u[o]=s[o];return u[i]=a(c),r(n,this,u)}}return Ov=e,Ov}var Av,o_;function sV(){if(o_)return Av;o_=1;var r=t2(),t=ZO(),e=Za(),n=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:r(a),writable:!0})}:e;return Av=n,Av}var Pv,l_;function oV(){if(l_)return Pv;l_=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 Pv=n,Pv}var Nv,c_;function RA(){if(c_)return Nv;c_=1;var r=sV(),t=oV(),e=t(r);return Nv=e,Nv}var Rv,u_;function zh(){if(u_)return Rv;u_=1;var r=Za(),t=NA(),e=RA();function n(i,a){return e(t(i,a,r),i+"")}return Rv=n,Rv}var Lv,h_;function LA(){if(h_)return Lv;h_=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 Lv=r,Lv}var Dv,d_;function lV(){if(d_)return Dv;d_=1;function r(t){return t!==t}return Dv=r,Dv}var Iv,f_;function cV(){if(f_)return Iv;f_=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 Iv=r,Iv}var Fv,g_;function uV(){if(g_)return Fv;g_=1;var r=LA(),t=lV(),e=cV();function n(i,a,s){return a===a?e(i,a,s):r(i,t,s)}return Fv=n,Fv}var Bv,v_;function hV(){if(v_)return Bv;v_=1;var r=uV();function t(e,n){var i=e==null?0:e.length;return!!i&&r(e,n,0)>-1}return Bv=t,Bv}var zv,p_;function dV(){if(p_)return zv;p_=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 zv=r,zv}var $v,m_;function fV(){if(m_)return $v;m_=1;function r(){}return $v=r,$v}var jv,y_;function gV(){if(y_)return jv;y_=1;var r=oA(),t=fV(),e=r2(),n=1/0,i=r&&1/e(new r([,-0]))[1]==n?function(a){return new r(a)}:t;return jv=i,jv}var qv,b_;function vV(){if(b_)return qv;b_=1;var r=pA(),t=hV(),e=dV(),n=mA(),i=gV(),a=r2(),s=200;function o(l,c,u){var h=-1,d=t,f=l.length,g=!0,v=[],p=v;if(u)g=!1,d=e;else if(f>=s){var m=c?null:i(l);if(m)return a(m);g=!1,d=n,p=new r}else p=c?[]:v;t:for(;++h<f;){var y=l[h],b=c?c(y):y;if(y=u||y!==0?y:0,g&&b===b){for(var w=p.length;w--;)if(p[w]===b)continue t;c&&p.push(b),v.push(y)}else d(p,b,u)||(p!==v&&p.push(b),v.push(y))}return v}return qv=o,qv}var Gv,w_;function DA(){if(w_)return Gv;w_=1;var r=ui(),t=Lr();function e(n){return t(n)&&r(n)}return Gv=e,Gv}var Wv,x_;function pV(){if(x_)return Wv;x_=1;var r=a2(),t=zh(),e=vV(),n=DA(),i=t(function(a){return e(r(a,1,n,!0))});return Wv=i,Wv}var Vv,E_;function mV(){if(E_)return Vv;E_=1;var r=Ih();function t(e,n){return r(n,function(i){return e[i]})}return Vv=t,Vv}var Hv,S_;function IA(){if(S_)return Hv;S_=1;var r=mV(),t=aa();function e(n){return n==null?[]:r(n,t(n))}return Hv=e,Hv}var Uv,__;function Zn(){if(__)return Uv;__=1;var r;if(typeof Xy=="function")try{r={clone:_W(),constant:t2(),each:vA(),filter:MA(),has:CA(),isArray:Me(),isEmpty:YW(),isFunction:fl(),isUndefined:TA(),keys:aa(),map:AA(),reduce:PA(),size:nV(),transform:rV(),union:pV(),values:IA()}}catch{}return r||(r=window._),Uv=r,Uv}var Yv,k_;function s2(){if(k_)return Yv;k_=1;var r=Zn();Yv=i;var t="\0",e="\0",n="";function i(u){this._isDirected=r.has(u,"directed")?u.directed:!0,this._isMultigraph=r.has(u,"multigraph")?u.multigraph:!1,this._isCompound=r.has(u,"compound")?u.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(u){return this._label=u,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(u){return r.isFunction(u)||(u=r.constant(u)),this._defaultNodeLabelFn=u,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return r.keys(this._nodes)},i.prototype.sources=function(){var u=this;return r.filter(this.nodes(),function(h){return r.isEmpty(u._in[h])})},i.prototype.sinks=function(){var u=this;return r.filter(this.nodes(),function(h){return r.isEmpty(u._out[h])})},i.prototype.setNodes=function(u,h){var d=arguments,f=this;return r.each(u,function(g){d.length>1?f.setNode(g,h):f.setNode(g)}),this},i.prototype.setNode=function(u,h){return r.has(this._nodes,u)?(arguments.length>1&&(this._nodes[u]=h),this):(this._nodes[u]=arguments.length>1?h:this._defaultNodeLabelFn(u),this._isCompound&&(this._parent[u]=e,this._children[u]={},this._children[e][u]=!0),this._in[u]={},this._preds[u]={},this._out[u]={},this._sucs[u]={},++this._nodeCount,this)},i.prototype.node=function(u){return this._nodes[u]},i.prototype.hasNode=function(u){return r.has(this._nodes,u)},i.prototype.removeNode=function(u){var h=this;if(r.has(this._nodes,u)){var d=function(f){h.removeEdge(h._edgeObjs[f])};delete this._nodes[u],this._isCompound&&(this._removeFromParentsChildList(u),delete this._parent[u],r.each(this.children(u),function(f){h.setParent(f)}),delete this._children[u]),r.each(r.keys(this._in[u]),d),delete this._in[u],delete this._preds[u],r.each(r.keys(this._out[u]),d),delete this._out[u],delete this._sucs[u],--this._nodeCount}return this},i.prototype.setParent=function(u,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===u)throw new Error("Setting "+h+" as parent of "+u+" would create a cycle");this.setNode(h)}return this.setNode(u),this._removeFromParentsChildList(u),this._parent[u]=h,this._children[h][u]=!0,this},i.prototype._removeFromParentsChildList=function(u){delete this._children[this._parent[u]][u]},i.prototype.parent=function(u){if(this._isCompound){var h=this._parent[u];if(h!==e)return h}},i.prototype.children=function(u){if(r.isUndefined(u)&&(u=e),this._isCompound){var h=this._children[u];if(h)return r.keys(h)}else{if(u===e)return this.nodes();if(this.hasNode(u))return[]}},i.prototype.predecessors=function(u){var h=this._preds[u];if(h)return r.keys(h)},i.prototype.successors=function(u){var h=this._sucs[u];if(h)return r.keys(h)},i.prototype.neighbors=function(u){var h=this.predecessors(u);if(h)return r.union(h,this.successors(u))},i.prototype.isLeaf=function(u){var h;return this.isDirected()?h=this.successors(u):h=this.neighbors(u),h.length===0},i.prototype.filterNodes=function(u){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,p){u(p)&&h.setNode(p,v)}),r.each(this._edgeObjs,function(v){h.hasNode(v.v)&&h.hasNode(v.w)&&h.setEdge(v,d.edge(v))});var f={};function g(v){var p=d.parent(v);return p===void 0||h.hasNode(p)?(f[v]=p,p):p in f?f[p]:g(p)}return this._isCompound&&r.each(h.nodes(),function(v){h.setParent(v,g(v))}),h},i.prototype.setDefaultEdgeLabel=function(u){return r.isFunction(u)||(u=r.constant(u)),this._defaultEdgeLabelFn=u,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return r.values(this._edgeObjs)},i.prototype.setPath=function(u,h){var d=this,f=arguments;return r.reduce(u,function(g,v){return f.length>1?d.setEdge(g,v,h):d.setEdge(g,v),v}),this},i.prototype.setEdge=function(){var u,h,d,f,g=!1,v=arguments[0];typeof v=="object"&&v!==null&&"v"in v?(u=v.v,h=v.w,d=v.name,arguments.length===2&&(f=arguments[1],g=!0)):(u=v,h=arguments[1],d=arguments[3],arguments.length>2&&(f=arguments[2],g=!0)),u=""+u,h=""+h,r.isUndefined(d)||(d=""+d);var p=o(this._isDirected,u,h,d);if(r.has(this._edgeLabels,p))return g&&(this._edgeLabels[p]=f),this;if(!r.isUndefined(d)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(u),this.setNode(h),this._edgeLabels[p]=g?f:this._defaultEdgeLabelFn(u,h,d);var m=l(this._isDirected,u,h,d);return u=m.v,h=m.w,Object.freeze(m),this._edgeObjs[p]=m,a(this._preds[h],u),a(this._sucs[u],h),this._in[h][p]=m,this._out[u][p]=m,this._edgeCount++,this},i.prototype.edge=function(u,h,d){var f=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,u,h,d);return this._edgeLabels[f]},i.prototype.hasEdge=function(u,h,d){var f=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,u,h,d);return r.has(this._edgeLabels,f)},i.prototype.removeEdge=function(u,h,d){var f=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,u,h,d),g=this._edgeObjs[f];return g&&(u=g.v,h=g.w,delete this._edgeLabels[f],delete this._edgeObjs[f],s(this._preds[h],u),s(this._sucs[u],h),delete this._in[h][f],delete this._out[u][f],this._edgeCount--),this},i.prototype.inEdges=function(u,h){var d=this._in[u];if(d){var f=r.values(d);return h?r.filter(f,function(g){return g.v===h}):f}},i.prototype.outEdges=function(u,h){var d=this._out[u];if(d){var f=r.values(d);return h?r.filter(f,function(g){return g.w===h}):f}},i.prototype.nodeEdges=function(u,h){var d=this.inEdges(u,h);if(d)return d.concat(this.outEdges(u,h))};function a(u,h){u[h]?u[h]++:u[h]=1}function s(u,h){--u[h]||delete u[h]}function o(u,h,d,f){var g=""+h,v=""+d;if(!u&&g>v){var p=g;g=v,v=p}return g+n+v+n+(r.isUndefined(f)?t:f)}function l(u,h,d,f){var g=""+h,v=""+d;if(!u&&g>v){var p=g;g=v,v=p}var m={v:g,w:v};return f&&(m.name=f),m}function c(u,h){return o(u,h.v,h.w,h.name)}return Yv}var Xv,M_;function yV(){return M_||(M_=1,Xv="2.1.8"),Xv}var Kv,C_;function bV(){return C_||(C_=1,Kv={Graph:s2(),version:yV()}),Kv}var Zv,T_;function wV(){if(T_)return Zv;T_=1;var r=Zn(),t=s2();Zv={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),c=s.parent(o),u={v:o};return r.isUndefined(l)||(u.value=l),r.isUndefined(c)||(u.parent=c),u})}function i(s){return r.map(s.edges(),function(o){var l=s.edge(o),c={v:o.v,w:o.w};return r.isUndefined(o.name)||(c.name=o.name),r.isUndefined(l)||(c.value=l),c})}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 Zv}var Jv,O_;function xV(){if(O_)return Jv;O_=1;var r=Zn();Jv=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 Jv}var Qv,A_;function FA(){if(A_)return Qv;A_=1;var r=Zn();Qv=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},Qv}var tp,P_;function BA(){if(P_)return tp;P_=1;var r=Zn(),t=FA();tp=n;var e=r.constant(1);function n(a,s,o,l){return i(a,String(s),o||e,l||function(c){return a.outEdges(c)})}function i(a,s,o,l){var c={},u=new t,h,d,f=function(g){var v=g.v!==h?g.v:g.w,p=c[v],m=o(g),y=d.distance+m;if(m<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+g+" Weight: "+m);y<p.distance&&(p.distance=y,p.predecessor=h,u.decrease(v,y))};for(a.nodes().forEach(function(g){var v=g===s?0:Number.POSITIVE_INFINITY;c[g]={distance:v},u.add(g,v)});u.size()>0&&(h=u.removeMin(),d=c[h],d.distance!==Number.POSITIVE_INFINITY);)l(h).forEach(f);return c}return tp}var ep,N_;function EV(){if(N_)return ep;N_=1;var r=BA(),t=Zn();ep=e;function e(n,i,a){return t.transform(n.nodes(),function(s,o){s[o]=r(n,o,i,a)},{})}return ep}var np,R_;function zA(){if(R_)return np;R_=1;var r=Zn();np=t;function t(e){var n=0,i=[],a={},s=[];function o(l){var c=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&&(c.lowlink=Math.min(c.lowlink,a[d].index)):(o(d),c.lowlink=Math.min(c.lowlink,a[d].lowlink))}),c.lowlink===c.index){var u=[],h;do h=i.pop(),a[h].onStack=!1,u.push(h);while(l!==h);s.push(u)}}return e.nodes().forEach(function(l){r.has(a,l)||o(l)}),s}return np}var rp,L_;function SV(){if(L_)return rp;L_=1;var r=Zn(),t=zA();rp=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 rp}var ip,D_;function _V(){if(D_)return ip;D_=1;var r=Zn();ip=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(c){o[c]={},o[c][c]={distance:0},l.forEach(function(u){c!==u&&(o[c][u]={distance:Number.POSITIVE_INFINITY})}),s(c).forEach(function(u){var h=u.v===c?u.w:u.v,d=a(u);o[c][h]={distance:d,predecessor:c}})}),l.forEach(function(c){var u=o[c];l.forEach(function(h){var d=o[h];l.forEach(function(f){var g=d[c],v=u[f],p=d[f],m=g.distance+v.distance;m<p.distance&&(p.distance=m,p.predecessor=v.predecessor)})})}),o}return ip}var ap,I_;function $A(){if(I_)return ap;I_=1;var r=Zn();ap=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,ap}var sp,F_;function kV(){if(F_)return sp;F_=1;var r=$A();sp=t;function t(e){try{r(e)}catch(n){if(n instanceof r.CycleException)return!1;throw n}return!0}return sp}var op,B_;function jA(){if(B_)return op;B_=1;var r=Zn();op=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(c){if(!n.hasNode(c))throw new Error("Graph does not have node: "+c);e(n,c,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(c){e(n,c,a,s,o,l)}),a&&l.push(i))}return op}var lp,z_;function MV(){if(z_)return lp;z_=1;var r=jA();lp=t;function t(e,n){return r(e,n,"post")}return lp}var cp,$_;function CV(){if($_)return cp;$_=1;var r=jA();cp=t;function t(e,n){return r(e,n,"pre")}return cp}var up,j_;function TV(){if(j_)return up;j_=1;var r=Zn(),t=s2(),e=FA();up=n;function n(i,a){var s=new t,o={},l=new e,c;function u(d){var f=d.v===c?d.w:d.v,g=l.priority(f);if(g!==void 0){var v=a(d);v<g&&(o[f]=c,l.decrease(f,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(c=l.removeMin(),r.has(o,c))s.setEdge(c,o[c]);else{if(h)throw new Error("Input graph is not connected: "+i);h=!0}i.nodeEdges(c).forEach(u)}return s}return up}var hp,q_;function OV(){return q_||(q_=1,hp={components:xV(),dijkstra:BA(),dijkstraAll:EV(),findCycles:SV(),floydWarshall:_V(),isAcyclic:kV(),postorder:MV(),preorder:CV(),prim:TV(),tarjan:zA(),topsort:$A()}),hp}var dp,G_;function AV(){if(G_)return dp;G_=1;var r=bV();return dp={Graph:r.Graph,json:wV(),alg:OV(),version:r.version},dp}var ku;if(typeof Xy=="function")try{ku=AV()}catch{}ku||(ku=window.graphlib);var dr=ku,fp,W_;function PV(){if(W_)return fp;W_=1;var r=dA(),t=1,e=4;function n(i){return r(i,t|e)}return fp=n,fp}var gp,V_;function $h(){if(V_)return gp;V_=1;var r=zs(),t=ui(),e=Ph(),n=Kn();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 gp=i,gp}var vp,H_;function NV(){if(H_)return vp;H_=1;var r=zh(),t=zs(),e=$h(),n=Ka(),i=Object.prototype,a=i.hasOwnProperty,s=r(function(o,l){o=Object(o);var c=-1,u=l.length,h=u>2?l[2]:void 0;for(h&&e(l[0],l[1],h)&&(u=1);++c<u;)for(var d=l[c],f=n(d),g=-1,v=f.length;++g<v;){var p=f[g],m=o[p];(m===void 0||t(m,i[p])&&!a.call(o,p))&&(o[p]=d[p])}return o});return vp=s,vp}var pp,U_;function RV(){if(U_)return pp;U_=1;var r=hi(),t=ui(),e=aa();function n(i){return function(a,s,o){var l=Object(a);if(!t(a)){var c=r(s,3);a=e(a),s=function(h){return c(l[h],h,l)}}var u=i(a,s,o);return u>-1?l[c?a[u]:u]:void 0}}return pp=n,pp}var mp,Y_;function LV(){if(Y_)return mp;Y_=1;var r=/\s/;function t(e){for(var n=e.length;n--&&r.test(e.charAt(n)););return n}return mp=t,mp}var yp,X_;function DV(){if(X_)return yp;X_=1;var r=LV(),t=/^\s+/;function e(n){return n&&n.slice(0,r(n)+1).replace(t,"")}return yp=e,yp}var bp,K_;function IV(){if(K_)return bp;K_=1;var r=DV(),t=Kn(),e=Gs(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;function l(c){if(typeof c=="number")return c;if(e(c))return n;if(t(c)){var u=typeof c.valueOf=="function"?c.valueOf():c;c=t(u)?u+"":u}if(typeof c!="string")return c===0?c:+c;c=r(c);var h=a.test(c);return h||s.test(c)?o(c.slice(2),h?2:8):i.test(c)?n:+c}return bp=l,bp}var wp,Z_;function qA(){if(Z_)return wp;Z_=1;var r=IV(),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 wp=n,wp}var xp,J_;function FV(){if(J_)return xp;J_=1;var r=qA();function t(e){var n=r(e),i=n%1;return n===n?i?n-i:n:0}return xp=t,xp}var Ep,Q_;function BV(){if(Q_)return Ep;Q_=1;var r=LA(),t=hi(),e=FV(),n=Math.max;function i(a,s,o){var l=a==null?0:a.length;if(!l)return-1;var c=o==null?0:e(o);return c<0&&(c=n(l+c,0)),r(a,t(s,3),c)}return Ep=i,Ep}var Sp,t3;function zV(){if(t3)return Sp;t3=1;var r=RV(),t=BV(),e=r(t);return Sp=e,Sp}var _p,e3;function GA(){if(e3)return _p;e3=1;var r=a2();function t(e){var n=e==null?0:e.length;return n?r(e,1):[]}return _p=t,_p}var kp,n3;function $V(){if(n3)return kp;n3=1;var r=e2(),t=fA(),e=Ka();function n(i,a){return i==null?i:r(i,t(a),e)}return kp=n,kp}var Mp,r3;function jV(){if(r3)return Mp;r3=1;function r(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}return Mp=r,Mp}var Cp,i3;function qV(){if(i3)return Cp;i3=1;var r=Oh(),t=n2(),e=hi();function n(i,a){var s={};return a=e(a,3),t(i,function(o,l,c){r(s,l,a(o,l,c))}),s}return Cp=n,Cp}var Tp,a3;function o2(){if(a3)return Tp;a3=1;var r=Gs();function t(e,n,i){for(var a=-1,s=e.length;++a<s;){var o=e[a],l=n(o);if(l!=null&&(c===void 0?l===l&&!r(l):i(l,c)))var c=l,u=o}return u}return Tp=t,Tp}var Op,s3;function GV(){if(s3)return Op;s3=1;function r(t,e){return t>e}return Op=r,Op}var Ap,o3;function WV(){if(o3)return Ap;o3=1;var r=o2(),t=GV(),e=Za();function n(i){return i&&i.length?r(i,e,t):void 0}return Ap=n,Ap}var Pp,l3;function WA(){if(l3)return Pp;l3=1;var r=Oh(),t=zs();function e(n,i,a){(a!==void 0&&!t(n[i],a)||a===void 0&&!(i in n))&&r(n,i,a)}return Pp=e,Pp}var Np,c3;function VV(){if(c3)return Np;c3=1;var r=Ya(),t=Lh(),e=Lr(),n="[object Object]",i=Function.prototype,a=Object.prototype,s=i.toString,o=a.hasOwnProperty,l=s.call(Object);function c(u){if(!e(u)||r(u)!=n)return!1;var h=t(u);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 Np=c,Np}var Rp,u3;function VA(){if(u3)return Rp;u3=1;function r(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}return Rp=r,Rp}var Lp,h3;function HV(){if(h3)return Lp;h3=1;var r=gl(),t=Ka();function e(n){return r(n,t(n))}return Lp=e,Lp}var Dp,d3;function UV(){if(d3)return Dp;d3=1;var r=WA(),t=tA(),e=cA(),n=eA(),i=hA(),a=vl(),s=Me(),o=DA(),l=js(),c=fl(),u=Kn(),h=VV(),d=pl(),f=VA(),g=HV();function v(p,m,y,b,w,x,S){var E=f(p,y),_=f(m,y),C=S.get(_);if(C){r(p,y,C);return}var k=x?x(E,_,y+"",p,m,S):void 0,M=k===void 0;if(M){var T=s(_),O=!T&&l(_),R=!T&&!O&&d(_);k=_,T||O||R?s(E)?k=E:o(E)?k=n(E):O?(M=!1,k=t(_,!0)):R?(M=!1,k=e(_,!0)):k=[]:h(_)||a(_)?(k=E,a(E)?k=g(E):(!u(E)||c(E))&&(k=i(_))):M=!1}M&&(S.set(_,k),w(k,_,b,x,S),S.delete(_)),r(p,y,k)}return Dp=v,Dp}var Ip,f3;function YV(){if(f3)return Ip;f3=1;var r=Th(),t=WA(),e=e2(),n=UV(),i=Kn(),a=Ka(),s=VA();function o(l,c,u,h,d){l!==c&&e(c,function(f,g){if(d||(d=new r),i(f))n(l,c,g,u,o,h,d);else{var v=h?h(s(l,g),f,g+"",l,c,d):void 0;v===void 0&&(v=f),t(l,g,v)}},a)}return Ip=o,Ip}var Fp,g3;function XV(){if(g3)return Fp;g3=1;var r=zh(),t=$h();function e(n){return r(function(i,a){var s=-1,o=a.length,l=o>1?a[o-1]:void 0,c=o>2?a[2]:void 0;for(l=n.length>3&&typeof l=="function"?(o--,l):void 0,c&&t(a[0],a[1],c)&&(l=o<3?void 0:l,o=1),i=Object(i);++s<o;){var u=a[s];u&&n(i,u,s,l)}return i})}return Fp=e,Fp}var Bp,v3;function KV(){if(v3)return Bp;v3=1;var r=YV(),t=XV(),e=t(function(n,i,a){r(n,i,a)});return Bp=e,Bp}var zp,p3;function HA(){if(p3)return zp;p3=1;function r(t,e){return t<e}return zp=r,zp}var $p,m3;function ZV(){if(m3)return $p;m3=1;var r=o2(),t=HA(),e=Za();function n(i){return i&&i.length?r(i,e,t):void 0}return $p=n,$p}var jp,y3;function JV(){if(y3)return jp;y3=1;var r=o2(),t=hi(),e=HA();function n(i,a){return i&&i.length?r(i,t(a,2),e):void 0}return jp=n,jp}var qp,b3;function QV(){if(b3)return qp;b3=1;var r=hr(),t=function(){return r.Date.now()};return qp=t,qp}var Gp,w3;function tH(){if(w3)return Gp;w3=1;var r=Ah(),t=Fh(),e=Ph(),n=Kn(),i=ml();function a(s,o,l,c){if(!n(s))return s;o=t(o,s);for(var u=-1,h=o.length,d=h-1,f=s;f!=null&&++u<h;){var g=i(o[u]),v=l;if(g==="__proto__"||g==="constructor"||g==="prototype")return s;if(u!=d){var p=f[g];v=c?c(p,g,f):void 0,v===void 0&&(v=n(p)?p:e(o[u+1])?[]:{})}r(f,g,v),f=f[g]}return s}return Gp=a,Gp}var Wp,x3;function eH(){if(x3)return Wp;x3=1;var r=Bh(),t=tH(),e=Fh();function n(i,a,s){for(var o=-1,l=a.length,c={};++o<l;){var u=a[o],h=r(i,u);s(h,u)&&t(c,e(u,i),h)}return c}return Wp=n,Wp}var Vp,E3;function nH(){if(E3)return Vp;E3=1;var r=eH(),t=_A();function e(n,i){return r(n,i,function(a,s){return t(n,s)})}return Vp=e,Vp}var Hp,S3;function rH(){if(S3)return Hp;S3=1;var r=GA(),t=NA(),e=RA();function n(i){return e(t(i,void 0,r),i+"")}return Hp=n,Hp}var Up,_3;function iH(){if(_3)return Up;_3=1;var r=nH(),t=rH(),e=t(function(n,i){return n==null?{}:r(n,i)});return Up=e,Up}var Yp,k3;function aH(){if(k3)return Yp;k3=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),c=Array(l);l--;)c[s?l:++o]=n,n+=a;return c}return Yp=e,Yp}var Xp,M3;function sH(){if(M3)return Xp;M3=1;var r=aH(),t=$h(),e=qA();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 Xp=n,Xp}var Kp,C3;function oH(){if(C3)return Kp;C3=1;var r=sH(),t=r();return Kp=t,Kp}var Zp,T3;function lH(){if(T3)return Zp;T3=1;function r(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}return Zp=r,Zp}var Jp,O3;function cH(){if(O3)return Jp;O3=1;var r=Gs();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,c=n===null,u=n===n,h=r(n);if(!c&&!h&&!o&&e>n||o&&l&&u&&!c&&!h||a&&l&&u||!i&&u||!s)return 1;if(!a&&!o&&!h&&e<n||h&&i&&s&&!a&&!o||c&&i&&s||!l&&s||!u)return-1}return 0}return Jp=t,Jp}var Qp,A3;function uH(){if(A3)return Qp;A3=1;var r=cH();function t(e,n,i){for(var a=-1,s=e.criteria,o=n.criteria,l=s.length,c=i.length;++a<l;){var u=r(s[a],o[a]);if(u){if(a>=c)return u;var h=i[a];return u*(h=="desc"?-1:1)}}return e.index-n.index}return Qp=t,Qp}var tm,P3;function hH(){if(P3)return tm;P3=1;var r=Ih(),t=Bh(),e=hi(),n=OA(),i=lH(),a=Nh(),s=uH(),o=Za(),l=Me();function c(u,h,d){h.length?h=r(h,function(v){return l(v)?function(p){return t(p,v.length===1?v[0]:v)}:v}):h=[o];var f=-1;h=r(h,a(e));var g=n(u,function(v,p,m){var y=r(h,function(b){return b(v)});return{criteria:y,index:++f,value:v}});return i(g,function(v,p){return s(v,p,d)})}return tm=c,tm}var em,N3;function dH(){if(N3)return em;N3=1;var r=a2(),t=hH(),e=zh(),n=$h(),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 em=i,em}var nm,R3;function fH(){if(R3)return nm;R3=1;var r=EA(),t=0;function e(n){var i=++t;return r(n)+i}return nm=e,nm}var rm,L3;function gH(){if(L3)return rm;L3=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 rm=r,rm}var im,D3;function vH(){if(D3)return im;D3=1;var r=Ah(),t=gH();function e(n,i){return t(n||[],i||[],r)}return im=e,im}var Mu;if(typeof Xy=="function")try{Mu={cloneDeep:PV(),constant:t2(),defaults:NV(),each:vA(),filter:MA(),find:zV(),flatten:GA(),forEach:gA(),forIn:$V(),has:CA(),isUndefined:TA(),last:jV(),map:AA(),mapValues:qV(),max:WV(),merge:KV(),min:ZV(),minBy:JV(),now:QV(),pick:iH(),range:oH(),reduce:PA(),sortBy:dH(),uniqueId:fH(),values:IA(),zipObject:vH()}}catch{}Mu||(Mu=window._);var ae=Mu,pH=jh;function jh(){var r={};r._next=r._prev=r,this._sentinel=r}jh.prototype.dequeue=function(){var r=this._sentinel,t=r._prev;if(t!==r)return UA(t),t};jh.prototype.enqueue=function(r){var t=this._sentinel;r._prev&&r._next&&UA(r),r._next=t._next,t._next._prev=r,t._next=r,r._prev=t};jh.prototype.toString=function(){for(var r=[],t=this._sentinel,e=t._prev;e!==t;)r.push(JSON.stringify(e,mH)),e=e._prev;return"["+r.join(", ")+"]"};function UA(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function mH(r,t){if(r!=="_next"&&r!=="_prev")return t}var Kr=ae,yH=dr.Graph,bH=pH,wH=EH,xH=Kr.constant(1);function EH(r,t){if(r.nodeCount()<=1)return[];var e=_H(r,t||xH),n=SH(e.graph,e.buckets,e.zeroIdx);return Kr.flatten(Kr.map(n,function(i){return r.outEdges(i.v,i.w)}),!0)}function SH(r,t,e){for(var n=[],i=t[t.length-1],a=t[0],s;r.nodeCount();){for(;s=a.dequeue();)am(r,t,e,s);for(;s=i.dequeue();)am(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(am(r,t,e,s,!0));break}}}return n}function am(r,t,e,n,i){var a=i?[]:void 0;return Kr.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,Ty(t,e,l)}),Kr.forEach(r.outEdges(n.v),function(s){var o=r.edge(s),l=s.w,c=r.node(l);c.in-=o,Ty(t,e,c)}),r.removeNode(n.v),a}function _H(r,t){var e=new yH,n=0,i=0;Kr.forEach(r.nodes(),function(o){e.setNode(o,{v:o,in:0,out:0})}),Kr.forEach(r.edges(),function(o){var l=e.edge(o.v,o.w)||0,c=t(o),u=l+c;e.setEdge(o.v,o.w,u),i=Math.max(i,e.node(o.v).out+=c),n=Math.max(n,e.node(o.w).in+=c)});var a=Kr.range(i+n+3).map(function(){return new bH}),s=n+1;return Kr.forEach(e.nodes(),function(o){Ty(a,s,e.node(o))}),{graph:e,buckets:a,zeroIdx:s}}function Ty(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 Sa=ae,kH=wH,MH={run:CH,undo:OH};function CH(r){var t=r.graph().acyclicer==="greedy"?kH(r,e(r)):TH(r);Sa.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,Sa.uniqueId("rev"))});function e(n){return function(i){return n.edge(i).weight}}}function TH(r){var t=[],e={},n={};function i(a){Sa.has(n,a)||(n[a]=!0,e[a]=!0,Sa.forEach(r.outEdges(a),function(s){Sa.has(e,s.w)?t.push(s):i(s.w)}),delete e[a])}return Sa.forEach(r.nodes(),i),t}function OH(r){Sa.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 Dt=ae,YA=dr.Graph,wn={addDummyNode:XA,simplify:AH,asNonCompoundGraph:PH,successorWeights:NH,predecessorWeights:RH,intersectRect:LH,buildLayerMatrix:DH,normalizeRanks:IH,removeEmptyRanks:FH,addBorderNode:BH,maxRank:KA,partition:zH,time:$H,notime:jH};function XA(r,t,e,n){var i;do i=Dt.uniqueId(n);while(r.hasNode(i));return e.dummy=t,r.setNode(i,e),i}function AH(r){var t=new YA().setGraph(r.graph());return Dt.forEach(r.nodes(),function(e){t.setNode(e,r.node(e))}),Dt.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 PH(r){var t=new YA({multigraph:r.isMultigraph()}).setGraph(r.graph());return Dt.forEach(r.nodes(),function(e){r.children(e).length||t.setNode(e,r.node(e))}),Dt.forEach(r.edges(),function(e){t.setEdge(e,r.edge(e))}),t}function NH(r){var t=Dt.map(r.nodes(),function(e){var n={};return Dt.forEach(r.outEdges(e),function(i){n[i.w]=(n[i.w]||0)+r.edge(i).weight}),n});return Dt.zipObject(r.nodes(),t)}function RH(r){var t=Dt.map(r.nodes(),function(e){var n={};return Dt.forEach(r.inEdges(e),function(i){n[i.v]=(n[i.v]||0)+r.edge(i).weight}),n});return Dt.zipObject(r.nodes(),t)}function LH(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,c;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,c=o):(i<0&&(s=-s),l=s,c=s*a/i),{x:e+l,y:n+c}}function DH(r){var t=Dt.map(Dt.range(KA(r)+1),function(){return[]});return Dt.forEach(r.nodes(),function(e){var n=r.node(e),i=n.rank;Dt.isUndefined(i)||(t[i][n.order]=e)}),t}function IH(r){var t=Dt.min(Dt.map(r.nodes(),function(e){return r.node(e).rank}));Dt.forEach(r.nodes(),function(e){var n=r.node(e);Dt.has(n,"rank")&&(n.rank-=t)})}function FH(r){var t=Dt.min(Dt.map(r.nodes(),function(a){return r.node(a).rank})),e=[];Dt.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;Dt.forEach(e,function(a,s){Dt.isUndefined(a)&&s%i!==0?--n:n&&Dt.forEach(a,function(o){r.node(o).rank+=n})})}function BH(r,t,e,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=e,i.order=n),XA(r,"border",i,t)}function KA(r){return Dt.max(Dt.map(r.nodes(),function(t){var e=r.node(t).rank;if(!Dt.isUndefined(e))return e}))}function zH(r,t){var e={lhs:[],rhs:[]};return Dt.forEach(r,function(n){t(n)?e.lhs.push(n):e.rhs.push(n)}),e}function $H(r,t){var e=Dt.now();try{return t()}finally{console.log(r+" time: "+(Dt.now()-e)+"ms")}}function jH(r,t){return t()}var ZA=ae,qH=wn,GH={run:WH,undo:HH};function WH(r){r.graph().dummyChains=[],ZA.forEach(r.edges(),function(t){VH(r,t)})}function VH(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 c,u,h;for(h=0,++n;n<a;++h,++n)o.points=[],u={width:0,height:0,edgeLabel:o,edgeObj:t,rank:n},c=qH.addDummyNode(r,"edge",u,"_d"),n===l&&(u.width=o.width,u.height=o.height,u.dummy="edge-label",u.labelpos=o.labelpos),r.setEdge(e,c,{weight:o.weight},s),h===0&&r.graph().dummyChains.push(c),e=c;r.setEdge(e,i,{weight:o.weight},s)}}function HH(r){ZA.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 mc=ae,qh={longestPath:UH,slack:YH};function UH(r){var t={};function e(n){var i=r.node(n);if(mc.has(t,n))return i.rank;t[n]=!0;var a=mc.min(mc.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}mc.forEach(r.sources(),e)}function YH(r,t){return r.node(t.w).rank-r.node(t.v).rank-r.edge(t).minlen}var Cu=ae,XH=dr.Graph,Tu=qh.slack,JA=KH;function KH(r){var t=new XH({directed:!1}),e=r.nodes()[0],n=r.nodeCount();t.setNode(e,{});for(var i,a;ZH(t,r)<n;)i=JH(t,r),a=t.hasNode(i.v)?Tu(r,i):-Tu(r,i),QH(t,r,a);return t}function ZH(r,t){function e(n){Cu.forEach(t.nodeEdges(n),function(i){var a=i.v,s=n===a?i.w:a;!r.hasNode(s)&&!Tu(t,i)&&(r.setNode(s,{}),r.setEdge(n,s,{}),e(s))})}return Cu.forEach(r.nodes(),e),r.nodeCount()}function JH(r,t){return Cu.minBy(t.edges(),function(e){if(r.hasNode(e.v)!==r.hasNode(e.w))return Tu(t,e)})}function QH(r,t,e){Cu.forEach(r.nodes(),function(n){t.node(n).rank+=e})}var ai=ae,tU=JA,eU=qh.slack,nU=qh.longestPath,rU=dr.alg.preorder,iU=dr.alg.postorder,aU=wn.simplify,sU=Ja;Ja.initLowLimValues=c2;Ja.initCutValues=l2;Ja.calcCutValue=QA;Ja.leaveEdge=eP;Ja.enterEdge=nP;Ja.exchangeEdges=rP;function Ja(r){r=aU(r),nU(r);var t=tU(r);c2(t),l2(t,r);for(var e,n;e=eP(t);)n=nP(t,r,e),rP(t,r,e,n)}function l2(r,t){var e=iU(r,r.nodes());e=e.slice(0,e.length-1),ai.forEach(e,function(n){oU(r,t,n)})}function oU(r,t,e){var n=r.node(e),i=n.parent;r.edge(e,i).cutvalue=QA(r,t,e)}function QA(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,ai.forEach(t.nodeEdges(e),function(l){var c=l.v===e,u=c?l.w:l.v;if(u!==i){var h=c===a,d=t.edge(l).weight;if(o+=h?d:-d,cU(r,e,u)){var f=r.edge(e,u).cutvalue;o+=h?-f:f}}}),o}function c2(r,t){arguments.length<2&&(t=r.nodes()[0]),tP(r,{},1,t)}function tP(r,t,e,n,i){var a=e,s=r.node(n);return t[n]=!0,ai.forEach(r.neighbors(n),function(o){ai.has(t,o)||(e=tP(r,t,e,o,n))}),s.low=a,s.lim=e++,i?s.parent=i:delete s.parent,e}function eP(r){return ai.find(r.edges(),function(t){return r.edge(t).cutvalue<0})}function nP(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 c=ai.filter(t.edges(),function(u){return l===I3(r,r.node(u.v),o)&&l!==I3(r,r.node(u.w),o)});return ai.minBy(c,function(u){return eU(t,u)})}function rP(r,t,e,n){var i=e.v,a=e.w;r.removeEdge(i,a),r.setEdge(n.v,n.w,{}),c2(r),l2(r,t),lU(r,t)}function lU(r,t){var e=ai.find(r.nodes(),function(i){return!t.node(i).parent}),n=rU(r,e);n=n.slice(1),ai.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 cU(r,t,e){return r.hasEdge(t,e)}function I3(r,t,e){return e.low<=t.lim&&t.lim<=e.lim}var uU=qh,iP=uU.longestPath,hU=JA,dU=sU,fU=gU;function gU(r){switch(r.graph().ranker){case"network-simplex":F3(r);break;case"tight-tree":pU(r);break;case"longest-path":vU(r);break;default:F3(r)}}var vU=iP;function pU(r){iP(r),hU(r)}function F3(r){dU(r)}var Oy=ae,mU=yU;function yU(r){var t=wU(r);Oy.forEach(r.graph().dummyChains,function(e){for(var n=r.node(e),i=n.edgeObj,a=bU(r,t,i.v,i.w),s=a.path,o=a.lca,l=0,c=s[l],u=!0;e!==i.w;){if(n=r.node(e),u){for(;(c=s[l])!==o&&r.node(c).maxRank<n.rank;)l++;c===o&&(u=!1)}if(!u){for(;l<s.length-1&&r.node(c=s[l+1]).minRank<=n.rank;)l++;c=s[l]}r.setParent(e,c),e=r.successors(e)[0]}})}function bU(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,c;l=e;do l=r.parent(l),i.push(l);while(l&&(t[l].low>s||o>t[l].lim));for(c=l,l=n;(l=r.parent(l))!==c;)a.push(l);return{path:i.concat(a.reverse()),lca:c}}function wU(r){var t={},e=0;function n(i){var a=e;Oy.forEach(r.children(i),n),t[i]={low:a,lim:e++}}return Oy.forEach(r.children(),n),t}var Zr=ae,Ay=wn,xU={run:EU,cleanup:kU};function EU(r){var t=Ay.addDummyNode(r,"root",{},"_root"),e=SU(r),n=Zr.max(Zr.values(e))-1,i=2*n+1;r.graph().nestingRoot=t,Zr.forEach(r.edges(),function(s){r.edge(s).minlen*=i});var a=_U(r)+1;Zr.forEach(r.children(),function(s){aP(r,t,i,a,n,e,s)}),r.graph().nodeRankFactor=i}function aP(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=Ay.addBorderNode(r,"_bt"),c=Ay.addBorderNode(r,"_bb"),u=r.node(s);r.setParent(l,s),u.borderTop=l,r.setParent(c,s),u.borderBottom=c,Zr.forEach(o,function(h){aP(r,t,e,n,i,a,h);var d=r.node(h),f=d.borderTop?d.borderTop:h,g=d.borderBottom?d.borderBottom:h,v=d.borderTop?n:2*n,p=f!==g?1:i-a[s]+1;r.setEdge(l,f,{weight:v,minlen:p,nestingEdge:!0}),r.setEdge(g,c,{weight:v,minlen:p,nestingEdge:!0})}),r.parent(s)||r.setEdge(t,l,{weight:0,minlen:i+a[s]})}function SU(r){var t={};function e(n,i){var a=r.children(n);a&&a.length&&Zr.forEach(a,function(s){e(s,i+1)}),t[n]=i}return Zr.forEach(r.children(),function(n){e(n,1)}),t}function _U(r){return Zr.reduce(r.edges(),function(t,e){return t+r.edge(e).weight},0)}function kU(r){var t=r.graph();r.removeNode(t.nestingRoot),delete t.nestingRoot,Zr.forEach(r.edges(),function(e){var n=r.edge(e);n.nestingEdge&&r.removeEdge(e)})}var sm=ae,MU=wn,CU=TU;function TU(r){function t(e){var n=r.children(e),i=r.node(e);if(n.length&&sm.forEach(n,t),sm.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,s=i.maxRank+1;a<s;++a)B3(r,"borderLeft","_bl",e,i,a),B3(r,"borderRight","_br",e,i,a)}}sm.forEach(r.children(),t)}function B3(r,t,e,n,i,a){var s={width:0,height:0,rank:a,borderType:t},o=i[t][a-1],l=MU.addDummyNode(r,"border",s,e);i[t][a]=l,r.setParent(l,n),o&&r.setEdge(o,l,{weight:1})}var kr=ae,OU={adjust:AU,undo:PU};function AU(r){var t=r.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&sP(r)}function PU(r){var t=r.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&NU(r),(t==="lr"||t==="rl")&&(RU(r),sP(r))}function sP(r){kr.forEach(r.nodes(),function(t){z3(r.node(t))}),kr.forEach(r.edges(),function(t){z3(r.edge(t))})}function z3(r){var t=r.width;r.width=r.height,r.height=t}function NU(r){kr.forEach(r.nodes(),function(t){om(r.node(t))}),kr.forEach(r.edges(),function(t){var e=r.edge(t);kr.forEach(e.points,om),kr.has(e,"y")&&om(e)})}function om(r){r.y=-r.y}function RU(r){kr.forEach(r.nodes(),function(t){lm(r.node(t))}),kr.forEach(r.edges(),function(t){var e=r.edge(t);kr.forEach(e.points,lm),kr.has(e,"x")&&lm(e)})}function lm(r){var t=r.x;r.x=r.y,r.y=t}var Br=ae,LU=DU;function DU(r){var t={},e=Br.filter(r.nodes(),function(o){return!r.children(o).length}),n=Br.max(Br.map(e,function(o){return r.node(o).rank})),i=Br.map(Br.range(n+1),function(){return[]});function a(o){if(!Br.has(t,o)){t[o]=!0;var l=r.node(o);i[l.rank].push(o),Br.forEach(r.successors(o),a)}}var s=Br.sortBy(e,function(o){return r.node(o).rank});return Br.forEach(s,a),i}var mi=ae,IU=FU;function FU(r,t){for(var e=0,n=1;n<t.length;++n)e+=BU(r,t[n-1],t[n]);return e}function BU(r,t,e){for(var n=mi.zipObject(e,mi.map(e,function(c,u){return u})),i=mi.flatten(mi.map(t,function(c){return mi.sortBy(mi.map(r.outEdges(c),function(u){return{pos:n[u.w],weight:r.edge(u).weight}}),"pos")}),!0),a=1;a<e.length;)a<<=1;var s=2*a-1;a-=1;var o=mi.map(new Array(s),function(){return 0}),l=0;return mi.forEach(i.forEach(function(c){var u=c.pos+a;o[u]+=c.weight;for(var h=0;u>0;)u%2&&(h+=o[u+1]),u=u-1>>1,o[u]+=c.weight;l+=c.weight*h})),l}var $3=ae,zU=$U;function $U(r,t){return $3.map(t,function(e){var n=r.inEdges(e);if(n.length){var i=$3.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 kn=ae,jU=qU;function qU(r,t){var e={};kn.forEach(r,function(i,a){var s=e[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};kn.isUndefined(i.barycenter)||(s.barycenter=i.barycenter,s.weight=i.weight)}),kn.forEach(t.edges(),function(i){var a=e[i.v],s=e[i.w];!kn.isUndefined(a)&&!kn.isUndefined(s)&&(s.indegree++,a.out.push(e[i.w]))});var n=kn.filter(e,function(i){return!i.indegree});return GU(n)}function GU(r){var t=[];function e(a){return function(s){s.merged||(kn.isUndefined(s.barycenter)||kn.isUndefined(a.barycenter)||s.barycenter>=a.barycenter)&&WU(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),kn.forEach(i.in.reverse(),e(i)),kn.forEach(i.out,n(i))}return kn.map(kn.filter(t,function(a){return!a.merged}),function(a){return kn.pick(a,["vs","i","barycenter","weight"])})}function WU(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 po=ae,VU=wn,HU=UU;function UU(r,t){var e=VU.partition(r,function(u){return po.has(u,"barycenter")}),n=e.lhs,i=po.sortBy(e.rhs,function(u){return-u.i}),a=[],s=0,o=0,l=0;n.sort(YU(!!t)),l=j3(a,i,l),po.forEach(n,function(u){l+=u.vs.length,a.push(u.vs),s+=u.barycenter*u.weight,o+=u.weight,l=j3(a,i,l)});var c={vs:po.flatten(a,!0)};return o&&(c.barycenter=s/o,c.weight=o),c}function j3(r,t,e){for(var n;t.length&&(n=po.last(t)).i<=e;)t.pop(),r.push(n.vs),e++;return e}function YU(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 Mi=ae,XU=zU,KU=jU,ZU=HU,JU=oP;function oP(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=Mi.filter(i,function(g){return g!==s&&g!==o}));var c=XU(r,i);Mi.forEach(c,function(g){if(r.children(g.v).length){var v=oP(r,g.v,e,n);l[g.v]=v,Mi.has(v,"barycenter")&&tY(g,v)}});var u=KU(c,e);QU(u,l);var h=ZU(u,n);if(s&&(h.vs=Mi.flatten([s,h.vs,o],!0),r.predecessors(s).length)){var d=r.node(r.predecessors(s)[0]),f=r.node(r.predecessors(o)[0]);Mi.has(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+d.order+f.order)/(h.weight+2),h.weight+=2}return h}function QU(r,t){Mi.forEach(r,function(e){e.vs=Mi.flatten(e.vs.map(function(n){return t[n]?t[n].vs:n}),!0)})}function tY(r,t){Mi.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 mo=ae,eY=dr.Graph,nY=rY;function rY(r,t,e){var n=iY(r),i=new eY({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return r.node(a)});return mo.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),mo.forEach(r[e](a),function(l){var c=l.v===a?l.w:l.v,u=i.edge(c,a),h=mo.isUndefined(u)?0:u.weight;i.setEdge(c,a,{weight:r.edge(l).weight+h})}),mo.has(s,"minRank")&&i.setNode(a,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))}),i}function iY(r){for(var t;r.hasNode(t=mo.uniqueId("_root")););return t}var aY=ae,sY=oY;function oY(r,t,e){var n={},i;aY.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 ji=ae,lY=LU,cY=IU,uY=JU,hY=nY,dY=sY,fY=dr.Graph,q3=wn,gY=vY;function vY(r){var t=q3.maxRank(r),e=G3(r,ji.range(1,t+1),"inEdges"),n=G3(r,ji.range(t-1,-1,-1),"outEdges"),i=lY(r);W3(r,i);for(var a=Number.POSITIVE_INFINITY,s,o=0,l=0;l<4;++o,++l){pY(o%2?e:n,o%4>=2),i=q3.buildLayerMatrix(r);var c=cY(r,i);c<a&&(l=0,s=ji.cloneDeep(i),a=c)}W3(r,s)}function G3(r,t,e){return ji.map(t,function(n){return hY(r,n,e)})}function pY(r,t){var e=new fY;ji.forEach(r,function(n){var i=n.graph().root,a=uY(n,i,e,t);ji.forEach(a.vs,function(s,o){n.node(s).order=o}),dY(n,e,a.vs)})}function W3(r,t){ji.forEach(t,function(e){ji.forEach(e,function(n,i){r.node(n).order=i})})}var gt=ae,mY=dr.Graph,yY=wn,bY={positionX:AY};function wY(r,t){var e={};function n(i,a){var s=0,o=0,l=i.length,c=gt.last(a);return gt.forEach(a,function(u,h){var d=EY(r,u),f=d?r.node(d).order:l;(d||u===c)&&(gt.forEach(a.slice(o,h+1),function(g){gt.forEach(r.predecessors(g),function(v){var p=r.node(v),m=p.order;(m<s||f<m)&&!(p.dummy&&r.node(g).dummy)&&lP(e,v,g)})}),o=h+1,s=f)}),a}return gt.reduce(t,n),e}function xY(r,t){var e={};function n(a,s,o,l,c){var u;gt.forEach(gt.range(s,o),function(h){u=a[h],r.node(u).dummy&>.forEach(r.predecessors(u),function(d){var f=r.node(d);f.dummy&&(f.order<l||f.order>c)&&lP(e,d,u)})})}function i(a,s){var o=-1,l,c=0;return gt.forEach(s,function(u,h){if(r.node(u).dummy==="border"){var d=r.predecessors(u);d.length&&(l=r.node(d[0]).order,n(s,c,h,o,l),c=h,o=l)}n(s,c,s.length,l,a.length)}),s}return gt.reduce(t,i),e}function EY(r,t){if(r.node(t).dummy)return gt.find(r.predecessors(t),function(e){return r.node(e).dummy})}function lP(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 SY(r,t,e){if(t>e){var n=t;t=e,e=n}return gt.has(r[t],e)}function _Y(r,t,e,n){var i={},a={},s={};return gt.forEach(t,function(o){gt.forEach(o,function(l,c){i[l]=l,a[l]=l,s[l]=c})}),gt.forEach(t,function(o){var l=-1;gt.forEach(o,function(c){var u=n(c);if(u.length){u=gt.sortBy(u,function(v){return s[v]});for(var h=(u.length-1)/2,d=Math.floor(h),f=Math.ceil(h);d<=f;++d){var g=u[d];a[c]===c&&l<s[g]&&!SY(e,c,g)&&(a[g]=c,a[c]=i[c]=i[g],l=s[g])}}})}),{root:i,align:a}}function kY(r,t,e,n,i){var a={},s=MY(r,t,e,i),o=i?"borderLeft":"borderRight";function l(h,d){for(var f=s.nodes(),g=f.pop(),v={};g;)v[g]?h(g):(v[g]=!0,f.push(g),f=f.concat(d(g))),g=f.pop()}function c(h){a[h]=s.inEdges(h).reduce(function(d,f){return Math.max(d,a[f.v]+s.edge(f))},0)}function u(h){var d=s.outEdges(h).reduce(function(g,v){return Math.min(g,a[v.w]-s.edge(v))},Number.POSITIVE_INFINITY),f=r.node(h);d!==Number.POSITIVE_INFINITY&&f.borderType!==o&&(a[h]=Math.max(a[h],d))}return l(c,s.predecessors.bind(s)),l(u,s.successors.bind(s)),gt.forEach(n,function(h){a[h]=a[e[h]]}),a}function MY(r,t,e,n){var i=new mY,a=r.graph(),s=PY(a.nodesep,a.edgesep,n);return gt.forEach(t,function(o){var l;gt.forEach(o,function(c){var u=e[c];if(i.setNode(u),l){var h=e[l],d=i.edge(h,u);i.setEdge(h,u,Math.max(s(r,c,l),d||0))}l=c})}),i}function CY(r,t){return gt.minBy(gt.values(t),function(e){var n=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return gt.forIn(e,function(a,s){var o=NY(r,s)/2;n=Math.max(a+o,n),i=Math.min(a-o,i)}),n-i})}function TY(r,t){var e=gt.values(t),n=gt.min(e),i=gt.max(e);gt.forEach(["u","d"],function(a){gt.forEach(["l","r"],function(s){var o=a+s,l=r[o],c;if(l!==t){var u=gt.values(l);c=s==="l"?n-gt.min(u):i-gt.max(u),c&&(r[o]=gt.mapValues(l,function(h){return h+c}))}})})}function OY(r,t){return gt.mapValues(r.ul,function(e,n){if(t)return r[t.toLowerCase()][n];var i=gt.sortBy(gt.map(r,n));return(i[1]+i[2])/2})}function AY(r){var t=yY.buildLayerMatrix(r),e=gt.merge(wY(r,t),xY(r,t)),n={},i;gt.forEach(["u","d"],function(s){i=s==="u"?t:gt.values(t).reverse(),gt.forEach(["l","r"],function(o){o==="r"&&(i=gt.map(i,function(h){return gt.values(h).reverse()}));var l=(s==="u"?r.predecessors:r.successors).bind(r),c=_Y(r,i,e,l),u=kY(r,i,c.root,c.align,o==="r");o==="r"&&(u=gt.mapValues(u,function(h){return-h})),n[s+o]=u})});var a=CY(r,n);return TY(n,a),OY(n,r.graph().align)}function PY(r,t,e){return function(n,i,a){var s=n.node(i),o=n.node(a),l=0,c;if(l+=s.width/2,gt.has(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":c=-s.width/2;break;case"r":c=s.width/2;break}if(c&&(l+=e?c:-c),c=0,l+=(s.dummy?t:r)/2,l+=(o.dummy?t:r)/2,l+=o.width/2,gt.has(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":c=o.width/2;break;case"r":c=-o.width/2;break}return c&&(l+=e?c:-c),c=0,l}}function NY(r,t){return r.node(t).width}var yo=ae,cP=wn,RY=bY.positionX,LY=DY;function DY(r){r=cP.asNonCompoundGraph(r),IY(r),yo.forEach(RY(r),function(t,e){r.node(e).x=t})}function IY(r){var t=cP.buildLayerMatrix(r),e=r.graph().ranksep,n=0;yo.forEach(t,function(i){var a=yo.max(yo.map(i,function(s){return r.node(s).height}));yo.forEach(i,function(s){r.node(s).y=n+a/2}),n+=a+e})}var Et=ae,V3=MH,H3=GH,FY=fU,BY=wn.normalizeRanks,zY=mU,$Y=wn.removeEmptyRanks,U3=xU,jY=CU,Y3=OU,qY=gY,GY=LY,Yi=wn,WY=dr.Graph,VY=HY;function HY(r,t){var e=t&&t.debugTiming?Yi.time:Yi.notime;e("layout",function(){var n=e(" buildLayoutGraph",function(){return rX(r)});e(" runLayout",function(){UY(n,e)}),e(" updateInputGraph",function(){YY(r,n)})})}function UY(r,t){t(" makeSpaceForEdgeLabels",function(){iX(r)}),t(" removeSelfEdges",function(){fX(r)}),t(" acyclic",function(){V3.run(r)}),t(" nestingGraph.run",function(){U3.run(r)}),t(" rank",function(){FY(Yi.asNonCompoundGraph(r))}),t(" injectEdgeLabelProxies",function(){aX(r)}),t(" removeEmptyRanks",function(){$Y(r)}),t(" nestingGraph.cleanup",function(){U3.cleanup(r)}),t(" normalizeRanks",function(){BY(r)}),t(" assignRankMinMax",function(){sX(r)}),t(" removeEdgeLabelProxies",function(){oX(r)}),t(" normalize.run",function(){H3.run(r)}),t(" parentDummyChains",function(){zY(r)}),t(" addBorderSegments",function(){jY(r)}),t(" order",function(){qY(r)}),t(" insertSelfEdges",function(){gX(r)}),t(" adjustCoordinateSystem",function(){Y3.adjust(r)}),t(" position",function(){GY(r)}),t(" positionSelfEdges",function(){vX(r)}),t(" removeBorderNodes",function(){dX(r)}),t(" normalize.undo",function(){H3.undo(r)}),t(" fixupEdgeLabelCoords",function(){uX(r)}),t(" undoCoordinateSystem",function(){Y3.undo(r)}),t(" translateGraph",function(){lX(r)}),t(" assignNodeIntersects",function(){cX(r)}),t(" reversePoints",function(){hX(r)}),t(" acyclic.undo",function(){V3.undo(r)})}function YY(r,t){Et.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))}),Et.forEach(r.edges(),function(e){var n=r.edge(e),i=t.edge(e);n.points=i.points,Et.has(i,"x")&&(n.x=i.x,n.y=i.y)}),r.graph().width=t.graph().width,r.graph().height=t.graph().height}var XY=["nodesep","edgesep","ranksep","marginx","marginy"],KY={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},ZY=["acyclicer","ranker","rankdir","align"],JY=["width","height"],QY={width:0,height:0},tX=["minlen","weight","width","height","labeloffset"],eX={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},nX=["labelpos"];function rX(r){var t=new WY({multigraph:!0,compound:!0}),e=um(r.graph());return t.setGraph(Et.merge({},KY,cm(e,XY),Et.pick(e,ZY))),Et.forEach(r.nodes(),function(n){var i=um(r.node(n));t.setNode(n,Et.defaults(cm(i,JY),QY)),t.setParent(n,r.parent(n))}),Et.forEach(r.edges(),function(n){var i=um(r.edge(n));t.setEdge(n,Et.merge({},eX,cm(i,tX),Et.pick(i,nX)))}),t}function iX(r){var t=r.graph();t.ranksep/=2,Et.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 aX(r){Et.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};Yi.addDummyNode(r,"edge-proxy",a,"_ep")}})}function sX(r){var t=0;Et.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=Et.max(t,n.maxRank))}),r.graph().maxRank=t}function oX(r){Et.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 lX(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(c){var u=c.x,h=c.y,d=c.width,f=c.height;t=Math.min(t,u-d/2),e=Math.max(e,u+d/2),n=Math.min(n,h-f/2),i=Math.max(i,h+f/2)}Et.forEach(r.nodes(),function(c){l(r.node(c))}),Et.forEach(r.edges(),function(c){var u=r.edge(c);Et.has(u,"x")&&l(u)}),t-=s,n-=o,Et.forEach(r.nodes(),function(c){var u=r.node(c);u.x-=t,u.y-=n}),Et.forEach(r.edges(),function(c){var u=r.edge(c);Et.forEach(u.points,function(h){h.x-=t,h.y-=n}),Et.has(u,"x")&&(u.x-=t),Et.has(u,"y")&&(u.y-=n)}),a.width=e-t+s,a.height=i-n+o}function cX(r){Et.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(Yi.intersectRect(n,a)),e.points.push(Yi.intersectRect(i,s))})}function uX(r){Et.forEach(r.edges(),function(t){var e=r.edge(t);if(Et.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 hX(r){Et.forEach(r.edges(),function(t){var e=r.edge(t);e.reversed&&e.points.reverse()})}function dX(r){Et.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(Et.last(e.borderLeft)),s=r.node(Et.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}}),Et.forEach(r.nodes(),function(t){r.node(t).dummy==="border"&&r.removeNode(t)})}function fX(r){Et.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 gX(r){var t=Yi.buildLayerMatrix(r);Et.forEach(t,function(e){var n=0;Et.forEach(e,function(i,a){var s=r.node(i);s.order=a+n,Et.forEach(s.selfEdges,function(o){Yi.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 vX(r){Et.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 cm(r,t){return Et.mapValues(Et.pick(r,t),Number)}function um(r){var t={};return Et.forEach(r,function(e,n){t[n.toLowerCase()]=e}),t}var yc=ae,pX=wn,mX=dr.Graph,yX={debugOrdering:bX};function bX(r){var t=pX.buildLayerMatrix(r),e=new mX({compound:!0,multigraph:!0}).setGraph({});return yc.forEach(r.nodes(),function(n){e.setNode(n,{label:n}),e.setParent(n,"layer"+r.node(n).rank)}),yc.forEach(r.edges(),function(n){e.setEdge(n.v,n.w,{},n.name)}),yc.forEach(t,function(n,i){var a="layer"+i;e.setNode(a,{rank:"same"}),yc.reduce(n,function(s,o){return e.setEdge(s,o,{style:"invis"}),o})}),e}var wX="0.8.5",uP={graphlib:dr,layout:VY,debug:yX,util:{time:wn.time,notime:wn.notime},version:wX};const xX=zu(uP);class Gh{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,Gh.defaultOptions,t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),e))})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,Object.assign(Object.assign({},this.options),e))})}genericDagreLayout(t,e,n){return bt(this,void 0,void 0,function*(){const{nodeSize:i}=n,a=new uP.graphlib.Graph;a.setGraph(n),a.setDefaultEdgeLabel(()=>({}));const s=e.getAllNodes(),o=e.getAllEdges();[...s,...o].some(({id:c})=>nt(c))&&console.error("Dagre layout only support string id, it will convert number to string."),e.getAllNodes().forEach(c=>{const{id:u}=c,h=Object.assign({},c.data);if(i!==void 0){const[d,f]=dl(at(i)?i(c):i);Object.assign(h,{width:d,height:f})}a.setNode(u.toString(),h)}),e.getAllEdges().forEach(({id:c,source:u,target:h})=>{a.setEdge(u.toString(),h.toString(),{id:c})}),xX.layout(a);const l={nodes:[],edges:[]};return a.nodes().forEach(c=>{const u=a.node(c);l.nodes.push({id:c,data:u}),t&&e.mergeNodeData(c,u)}),a.edges().forEach(c=>{const u=a.edge(c),{id:h}=u,d=fe(u,["id"]),{v:f,w:g}=c;l.edges.push({id:h,source:f,target:g,data:d}),t&&e.mergeEdgeData(h,d)}),l})}}Gh.defaultOptions={};class u2{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 u2(s)}}class ms{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 ms(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 ms(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 ms(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 ms(i)}}class ys{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 ys(this.quad.NW()),this.NE=new ys(this.quad.NE()),this.SW=new ys(this.quad.SW()),this.SE=new ys(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 EX={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 SX{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},EX),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericForceAtlas2Layout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericForceAtlas2Layout(!0,t,e)})}genericForceAtlas2Layout(t,e,n){return bt(this,void 0,void 0,function*(){const i=e.getAllEdges(),a=e.getAllNodes(),s=this.formatOptions(n,a.length),{width:o,height:l,prune:c,maxIteration:u,nodeSize:h,center:d}=s;if(!(a!=null&&a.length)||a.length===1)return Ua(e,t,d);const f=a.map(m=>On(m,[o,l])),g=i.filter(m=>{const{source:y,target:b}=m;return y!==b}),v=new Ne({nodes:f,edges:g}),p=this.getSizes(v,h);if(this.run(v,e,u,p,t,s),c){for(let y=0;y<g.length;y+=1){const{source:b,target:w}=g[y],x=v.getDegree(b),S=v.getDegree(b);if(x<=1){const E=v.getNode(w);v.mergeNodeData(b,{x:E.data.x,y:E.data.y})}else if(S<=1){const E=v.getNode(b);v.mergeNodeData(w,{x:E.data.x,y:E.data.y})}}const m=Object.assign(Object.assign({},s),{prune:!1,barnesHut:!1});this.run(v,e,100,p,t,m)}return{nodes:f,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]=z1(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:c,kr:u,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),c===0&&!l?(n.maxIteration=250,e<=200&&e>100?n.maxIteration=1e3:e>200&&(n.maxIteration=1200)):c===0&&l&&(n.maxIteration=100,e<=200&&e>100?n.maxIteration=500:e>200&&(n.maxIteration=950)),u||(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:c}=s,u=t.getAllNodes();let h=0,d=n;const f={},g={},v={};for(let p=0;p<u.length;p+=1){const{data:m,id:y}=u[p];if(f[y]=[0,0],l){const b={id:p,rx:m.x,ry:m.y,mass:1,g:o,degree:t.getDegree(y)};v[y]=new u2(b)}}for(;d>0;)h=this.oneStep(t,{iter:d,preventOverlapIters:50,krPrime:100,sg:h,forces:f,preForces:g,bodies:v,sizes:i},s),d--,c==null||c({nodes:u,edges:e.getAllEdges()});return t}oneStep(t,e,n){const{iter:i,preventOverlapIters:a,krPrime:s,sg:o,preForces:l,bodies:c,sizes:u}=e;let{forces:h}=e;const{preventOverlap:d,barnesHut:f}=n,g=t.getAllNodes();for(let v=0;v<g.length;v+=1){const{id:p}=g[v];l[p]=[...h[p]],h[p]=[0,0]}return h=this.getAttrForces(t,i,a,u,h,n),f&&(d&&i>a||!d)?h=this.getOptRepGraForces(t,h,c,n):h=this.getRepGraForces(t,i,a,h,s,u,n),this.updatePos(t,h,l,o,n)}getAttrForces(t,e,n,i,a,s){const{preventOverlap:o,dissuadeHubs:l,mode:c,prune:u}=s,h=t.getAllEdges();for(let d=0;d<h.length;d+=1){const{source:f,target:g}=h[d],v=t.getNode(f),p=t.getNode(g),m=t.getDegree(f),y=t.getDegree(g);if(u&&(m<=1||y<=1))continue;const b=[p.data.x-v.data.x,p.data.y-v.data.y];let w=Math.hypot(b[0],b[1]);w=w<1e-4?1e-4:w,b[0]=b[0]/w,b[1]=b[1]/w,o&&e<n&&(w=w-i[f]-i[g]);let x=w,S=x;c==="linlog"&&(x=Math.log(1+w),S=x),l&&(x=w/m,S=w/y),o&&e<n&&w<=0?(x=0,S=0):o&&e<n&&w>0&&(x=w,S=w),a[f][0]+=x*b[0],a[g][0]-=S*b[0],a[f][1]+=x*b[1],a[g][1]-=S*b[1]}return a}getOptRepGraForces(t,e,n,i){const{kg:a,center:s,prune:o}=i,l=t.getAllNodes(),c=l.length;let u=9e10,h=-9e10,d=9e10,f=-9e10;for(let y=0;y<c;y+=1){const{id:b,data:w}=l[y];o&&t.getDegree(b)<=1||(n[b].setPos(w.x,w.y),w.x>=h&&(h=w.x),w.x<=u&&(u=w.x),w.y>=f&&(f=w.y),w.y<=d&&(d=w.y))}const g=Math.max(h-u,f-d),v={xmid:(h+u)/2,ymid:(f+d)/2,length:g,massCenter:s,mass:c},p=new ms(v),m=new ys(p);for(let y=0;y<c;y+=1){const{id:b}=l[y];o&&t.getDegree(b)<=1||n[b].in(p)&&m.insert(n[b])}for(let y=0;y<c;y+=1){const{id:b,data:w}=l[y],x=t.getDegree(b);if(o&&x<=1)continue;n[b].resetForce(),m.updateForce(n[b]),e[b][0]-=n[b].fx,e[b][1]-=n[b].fy;const S=[w.x-s[0],w.y-s[1]];let E=Math.hypot(S[0],S[1]);E=E<1e-4?1e-4:E,S[0]=S[0]/E,S[1]=S[1]/E;const _=a*(x+1);e[b][0]-=_*S[0],e[b][1]-=_*S[1]}return e}getRepGraForces(t,e,n,i,a,s,o){const{preventOverlap:l,kr:c,kg:u,center:h,prune:d}=o,f=t.getAllNodes(),g=f.length;for(let v=0;v<g;v+=1){const p=f[v],m=t.getDegree(p.id);for(let x=v+1;x<g;x+=1){const S=f[x],E=t.getDegree(S.id);if(d&&(m<=1||E<=1))continue;const _=[S.data.x-p.data.x,S.data.y-p.data.y];let C=Math.hypot(_[0],_[1]);C=C<1e-4?1e-4:C,_[0]=_[0]/C,_[1]=_[1]/C,l&&e<n&&(C=C-s[p.id]-s[S.id]);let k=c*(m+1)*(E+1)/C;l&&e<n&&C<0?k=a*(m+1)*(E+1):l&&e<n&&C===0?k=0:l&&e<n&&C>0&&(k=c*(m+1)*(E+1)/C),i[p.id][0]-=k*_[0],i[S.id][0]+=k*_[0],i[p.id][1]-=k*_[1],i[S.id][1]+=k*_[1]}const y=[p.data.x-h[0],p.data.y-h[1]],b=Math.hypot(y[0],y[1]);y[0]=y[0]/b,y[1]=y[1]/b;const w=u*(m+1);i[p.id][0]-=w*y[0],i[p.id][1]-=w*y[1]}return i}updatePos(t,e,n,i,a){const{ks:s,tao:o,prune:l,ksmax:c}=a,u=t.getAllNodes(),h=u.length,d=[],f=[];let g=0,v=0,p=i;for(let y=0;y<h;y+=1){const{id:b}=u[y],w=t.getDegree(b);if(l&&w<=1)continue;const x=[e[b][0]-n[b][0],e[b][1]-n[b][1]],S=Math.hypot(x[0],x[1]),E=[e[b][0]+n[b][0],e[b][1]+n[b][1]],_=Math.hypot(E[0],E[1]);d[y]=S,f[y]=_/2,g+=(w+1)*d[y],v+=(w+1)*f[y]}const m=p;p=o*v/g,m!==0&&(p=p>1.5*m?1.5*m:p);for(let y=0;y<h;y+=1){const{id:b,data:w}=u[y],x=t.getDegree(b);if(l&&x<=1||nt(w.fx)&&nt(w.fy))continue;let S=s*p/(1+p*Math.sqrt(d[y])),E=Math.hypot(e[b][0],e[b][1]);E=E<1e-4?1e-4:E;const _=c/E;S=S>_?_:S;const C=S*e[b][0],k=S*e[b][1];t.mergeNodeData(b,{x:w.x+C,y:w.y+k})}return p}}const _X={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},kX=800;class MX{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},_X),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericFruchtermanLayout(!1,t,e)})}assign(t,e){return bt(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 bt(this,void 0,void 0,function*(){if(this.running)return;const i=this.formatOptions(n),{dimensions:a,width:s,height:o,center:l,clustering:c,nodeClusterBy:u,maxIteration:h,onTick:d}=i,f=e.getAllNodes(),g=e.getAllEdges();if(!(f!=null&&f.length)){const b={nodes:[],edges:g};return this.lastResult=b,b}if(f.length===1){t&&e.mergeNodeData(f[0].id,{x:l[0],y:l[1],z:a===3?l[2]:void 0});const b={nodes:[Object.assign(Object.assign({},f[0]),{data:Object.assign(Object.assign({},f[0].data),{x:l[0],y:l[1],z:a===3?l[2]:void 0})})],edges:g};return this.lastResult=b,b}const v=f.map(b=>On(b,[s,o])),p=new Ne({nodes:v,edges:g}),m={};if(c&&v.forEach(b=>{const w=b.data[u];m[w]||(m[w]={name:w,cx:0,cy:0,count:0})}),this.lastLayoutNodes=v,this.lastLayoutEdges=g,this.lastAssign=t,this.lastGraph=p,this.lastOptions=i,this.lastClusterMap=m,typeof window>"u")return;let y=0;return new Promise(b=>{this.timeInterval=window.setInterval(()=>{if(!this.running){b({nodes:v,edges:g});return}this.runOneStep(p,m,i),t&&v.forEach(({id:w,data:x})=>e.mergeNodeData(w,{x:x.x,y:x.y,z:a===3?x.z:void 0})),d==null||d({nodes:v,edges:g}),y++,y>=h&&(window.clearInterval(this.timeInterval),b({nodes:v,edges:g}))},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:c,clustering:u,nodeClusterBy:h,clusterGravity:d}=n,f=a*s,g=Math.sqrt(f)/10,v=t.getAllNodes(),p=f/(v.length+1),m=Math.sqrt(p),y={};if(this.applyCalculate(t,y,m,p),u){for(const w in e)e[w].cx=0,e[w].cy=0,e[w].count=0;v.forEach(w=>{const{data:x}=w,S=e[x[h]];nt(x.x)&&(S.cx+=x.x),nt(x.y)&&(S.cy+=x.y),S.count++});for(const w in e)e[w].cx/=e[w].count,e[w].cy/=e[w].count;const b=d||o;v.forEach((w,x)=>{const{id:S,data:E}=w;if(!nt(E.x)||!nt(E.y))return;const _=e[E[h]],C=Math.sqrt((E.x-_.cx)*(E.x-_.cx)+(E.y-_.cy)*(E.y-_.cy)),k=m*b;y[S].x-=k*(E.x-_.cx)/C,y[S].y-=k*(E.y-_.cy)/C})}v.forEach((b,w)=>{const{id:x,data:S}=b;if(!nt(S.x)||!nt(S.y))return;const E=.01*m*o;y[x].x-=E*(S.x-l[0]),y[x].y-=E*(S.y-l[1]),i===3&&(y[x].z-=E*(S.z-l[2]))}),v.forEach((b,w)=>{const{id:x,data:S}=b;if(nt(S.fx)&&nt(S.fy)){S.x=S.fx,S.y=S.fy,i===3&&(S.z=S.fz);return}if(!nt(S.x)||!nt(S.y))return;const E=Math.sqrt(y[x].x*y[x].x+y[x].y*y[x].y+(i===3?y[x].z*y[x].z:0));if(E>0){const _=Math.min(g*(c/kX),E);t.mergeNodeData(x,{x:S.x+y[x].x/E*_,y:S.y+y[x].y/E*_,z:i===3?S.z+y[x].z/E*_: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:c},u)=>{if(o<=u||!nt(a.x)||!nt(l.x)||!nt(a.y)||!nt(l.y))return;let h=a.x-l.x,d=a.y-l.y,f=this.options.dimensions===3?a.z-l.z:0,g=h*h+d*d+f*f;g===0&&(g=1,h=.01,d=.01,f=.01);const v=n/g,p=h*v,m=d*v,y=f*v;e[s].x+=p,e[s].y+=m,e[c].x-=p,e[c].y-=m,this.options.dimensions===3&&(e[s].z+=y,e[c].z-=y)})})}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:c}=t.getNode(o);if(!nt(c.x)||!nt(l.x)||!nt(c.y)||!nt(l.y))return;const u=c.x-l.x,h=c.y-l.y,d=this.options.dimensions===3?c.z-l.z:0,f=Math.sqrt(u*u+h*h+d*d)/n,g=u*f,v=h*f,p=d*f;e[s].x+=g,e[s].y+=v,e[o].x-=g,e[o].y-=v,this.options.dimensions===3&&(e[s].z+=p,e[o].z-=p)})}}const CX={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 TX{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},CX),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericGridLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericGridLayout(!0,t,e)})}genericGridLayout(t,e,n){return bt(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:c,cols:u,nodeSpacing:h,nodeSize:d,width:f,height:g,position:v}=i;let{sortBy:p}=i;const m=e.getAllNodes(),y=e.getAllEdges(),b=m==null?void 0:m.length;if(!b||b===1)return Ua(e,t,a);const w=m.map(D=>On(D));p!=="id"&&(!Tt(p)||w[0].data[p]===void 0)&&(p="degree"),p==="degree"?w.sort((D,L)=>e.getDegree(L.id,"both")-e.getDegree(D.id,"both")):p==="id"?w.sort((D,L)=>nt(L.id)&&nt(D.id)?L.id-D.id:`${D.id}`.localeCompare(`${L.id}`)):w.sort((D,L)=>L.data[p]-D.data[p]);const x=!f&&typeof window<"u"?window.innerWidth:f,S=!g&&typeof window<"u"?window.innerHeight:g,E=b,_={rows:c,cols:u};if(c!=null&&u!=null)_.rows=c,_.cols=u;else if(c!=null&&u==null)_.rows=c,_.cols=Math.ceil(E/_.rows);else if(c==null&&u!=null)_.cols=u,_.rows=Math.ceil(E/_.cols);else{const D=Math.sqrt(E*S/x);_.rows=Math.round(D),_.cols=Math.round(x/S*D)}if(_.rows=Math.max(_.rows,1),_.cols=Math.max(_.cols,1),_.cols*_.rows>E){const D=bc(_),L=wc(_);(D-1)*L>=E?bc(_,D-1):(L-1)*D>=E&&wc(_,L-1)}else for(;_.cols*_.rows<E;){const D=bc(_),L=wc(_);(L+1)*D>=E?wc(_,L+1):bc(_,D+1)}let C=s?0:x/_.cols,k=s?0:S/_.rows;if(l||h){const D=Aa(10,h),L=B1(30,d,!1);w.forEach(P=>{(!P.data.x||!P.data.y)&&(P.data.x=0,P.data.y=0);const A=e.getNode(P.id),[I,B]=dl(L(A)||30),j=D!==void 0?D(P):o,G=I+j,H=B+j;C=Math.max(C,G),k=Math.max(k,H)})}const M={},T={row:0,col:0},O={};for(let D=0;D<w.length;D++){const L=w[D];let P;if(v&&(P=v(e.getNode(L.id))),P&&(P.row!==void 0||P.col!==void 0)){const A={row:P.row,col:P.col};if(A.col===void 0)for(A.col=0;Py(M,A);)A.col++;else if(A.row===void 0)for(A.row=0;Py(M,A);)A.row++;O[L.id]=A,hP(M,A)}OX(L,a,C,k,O,_,T,M)}const R={nodes:w,edges:y};return t&&w.forEach(D=>{e.mergeNodeData(D.id,{x:D.data.x,y:D.data.y})}),R})}}const bc=(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},wc=(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},Py=(r,t)=>r[`c-${t.row}-${t.col}`]||!1,hP=(r,t)=>r[`c-${t.row}-${t.col}`]=!0,X3=(r,t)=>{const e=r.cols||5;t.col++,t.col>=e&&(t.col=0,t.row++)},OX=(r,t,e,n,i,a,s,o)=>{let l,c;const u=i[r.id];if(u)l=u.col*e+e/2+t[0],c=u.row*n+n/2+t[1];else{for(;Py(o,s);)X3(a,s);l=s.col*e+e/2+t[0],c=s.row*n+n/2+t[1],hP(o,s),X3(a,s)}r.data.x=l,r.data.y=c},AX=(r,t,e)=>{try{const n=Ri.mul(Ri.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 qO(n),l=Ri.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map(c=>Ri.mul([c],[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}},PX=800,NX={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},RX=(r,t)=>{const e=Object.assign(Object.assign({},NX),t),{positions:n,iterations:i,width:a,k:s,speed:o=100,strictRadial:l,focusIdx:c,radii:u=[],nodeSizeFunc:h}=e,d=r.getAllNodes(),f=[],g=a/10;for(let v=0;v<i;v++)n.forEach((p,m)=>{f[m]={x:0,y:0}}),LX(d,n,f,s,u,h),DX(n,f,o,l,c,g,a,u);return n},LX=(r,t,e,n,i,a)=>{t.forEach((s,o)=>{e[o]={x:0,y:0},t.forEach((l,c)=>{if(o===c||i[o]!==i[c])return;let u=s.x-l.x,h=s.y-l.y,d=Math.sqrt(u*u+h*h);if(d===0){d=1;const f=o>c?1:-1;u=.01*f,h=.01*f}if(d<a(r[o])/2+a(r[c])/2){const f=n*n/d;e[o].x+=u/d*f,e[o].y+=h/d*f}})})},DX=(r,t,e,n,i,a,s,o)=>{const l=a||s/10;return n&&t.forEach((c,u)=>{const h=r[u].x-r[i].x,d=r[u].y-r[i].y,f=Math.sqrt(h*h+d*d);let g=d/f,v=-h/f;const p=Math.sqrt(c.x*c.x+c.y*c.y);let m=Math.acos((g*c.x+v*c.y)/p);m>Math.PI/2&&(m-=Math.PI/2,g*=-1,v*=-1);const y=Math.cos(m)*p;c.x=g*y,c.y=v*y}),r.forEach((c,u)=>{if(u===i)return;const h=Math.sqrt(t[u].x*t[u].x+t[u].y*t[u].y);if(h>0&&u!==i){const d=Math.min(l*(e/PX),h);if(c.x+=t[u].x/h*d,c.y+=t[u].y/h*d,n){let f=c.x-r[i].x,g=c.y-r[i].y;const v=Math.sqrt(f*f+g*g);f=f/v*o[u],g=g/v*o[u],c.x=r[i].x+f,c.y=r[i].y+g}}}),r},IX={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class FX{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},IX),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericRadialLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericRadialLayout(!0,t,e)})}genericRadialLayout(t,e,n){return bt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,focusNode:l,unitRadius:c,nodeSize:u,nodeSpacing:h,strictRadial:d,preventOverlap:f,maxPreventOverlapIteration:g,sortBy:v,linkDistance:p=50,sortStrength:m=10,maxIteration:y=1e3}=i,b=e.getAllNodes(),w=e.getAllEdges(),x=!a&&typeof window<"u"?window.innerWidth:a,S=!s&&typeof window<"u"?window.innerHeight:s,E=o||[x/2,S/2];if(!(b!=null&&b.length)||b.length===1)return Ua(e,t,E);let _=b[0];if(Tt(l)){for(let it=0;it<b.length;it++)if(b[it].id===l){_=b[it];break}}else _=l||b[0];const C=$X(b,_.id),k=OO({nodes:b,edges:w}),M=TO(k),T=qX(M,C);jX(M,C,T+1);const O=M[C];let R=x-E[0]>E[0]?E[0]:x-E[0],D=S-E[1]>E[1]?E[1]:S-E[1];R===0&&(R=x/2),D===0&&(D=S/2);const L=Math.min(R,D),P=Math.max(...O),A=[],I=c||L/P;O.forEach((it,_t)=>{A[_t]=it*I});const B=BX(b,M,p,A,I,v,m),j=zX(B),G=AX(p,B,p);let H=G.map(([it,_t])=>({x:(isNaN(it)?Math.random()*p:it)-G[C][0],y:(isNaN(_t)?Math.random()*p:_t)-G[C][1]}));this.run(y,H,j,B,A,C);let Y;if(f){Y=z1(u,h);const it={nodes:b,nodeSizeFunc:Y,positions:H,radii:A,height:S,width:x,strictRadial:!!d,focusIdx:C,iterations:g||200,k:H.length/4.5};H=RX(e,it)}const K=[];return H.forEach((it,_t)=>{const Mt=On(b[_t]);Mt.data.x=it.x+E[0],Mt.data.y=it.y+E[1],K.push(Mt)}),t&&K.forEach(it=>e.mergeNodeData(it.id,{x:it.data.x,y:it.data.y})),{nodes:K,edges:w}})}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,c)=>{const u=Aw(l,{x:0,y:0}),h=u===0?0:1/u;if(c===s)return;let d=0,f=0,g=0;e.forEach((p,m)=>{if(c===m)return;const y=Aw(l,p),b=y===0?0:1/y,w=i[m][c];g+=a[c][m],d+=a[c][m]*(p.x+w*(l.x-p.x)*b),f+=a[c][m]*(p.y+w*(l.y-p.y)*b)});const v=n[c]===0?0:1/n[c];g*=o,g+=t*v*v,d*=o,d+=t*v*l.x*h,l.x=d/g,f*=o,f+=t*v*l.y*h,l.y=f/g})}}const BX=(r,t,e,n,i,a,s)=>{if(!r)return[];const o=[];if(t){const l={};t.forEach((c,u)=>{const h=[];c.forEach((d,f)=>{var g,v;if(u===f)h.push(0);else if(n[u]===n[f])if(a==="data")h.push(d*(Math.abs(u-f)*s)/(n[u]/i));else if(a){let p,m;if(l[r[u].id])p=l[r[u].id];else{const y=(a==="id"?r[u].id:(g=r[u].data)===null||g===void 0?void 0:g[a])||0;Tt(y)?p=y.charCodeAt(0):p=y,l[r[u].id]=p}if(l[r[f].id])m=l[r[f].id];else{const y=(a==="id"?r[f].id:(v=r[f].data)===null||v===void 0?void 0:v[a])||0;Tt(y)?m=y.charCodeAt(0):m=y,l[r[f].id]=m}h.push(d*(Math.abs(p-m)*s)/(n[u]/i))}else h.push(d*e/(n[u]/i));else{const p=(e+i)/2;h.push(d*p)}}),o.push(h)})}return o},zX=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},$X=(r,t)=>{let e=-1;return r.forEach((n,i)=>{n.id===t&&(e=i)}),Math.max(e,0)},jX=(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}}},qX=(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},GX={center:[0,0],width:300,height:300};class WX{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},GX),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericRandomLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericRandomLayout(!0,t,e)})}genericRandomLayout(t,e,n){return bt(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(),c=.9,u=!s&&typeof window<"u"?window.innerWidth:s,h=!o&&typeof window<"u"?window.innerHeight:o,d=a||[u/2,h/2],f=[];return l&&l.forEach(v=>{f.push({id:v.id,data:{x:(Math.random()-.5)*c*u+d[0],y:(Math.random()-.5)*c*h+d[1]}})}),t&&f.forEach(v=>e.mergeNodeData(v.id,{x:v.data.x,y:v.data.y})),{nodes:f,edges:e.getAllEdges()}})}}/**
- * @license
- * Copyright 2019 Google LLC
- * SPDX-License-Identifier: Apache-2.0
- */const dP=Symbol("Comlink.proxy"),VX=Symbol("Comlink.endpoint"),fP=Symbol("Comlink.releaseProxy"),hm=Symbol("Comlink.finalizer"),Gc=Symbol("Comlink.thrown"),gP=r=>typeof r=="object"&&r!==null||typeof r=="function",HX={canHandle:r=>gP(r)&&r[dP],serialize(r){const{port1:t,port2:e}=new MessageChannel;return pP(r,t),[e,[e]]},deserialize(r){return r.start(),yP(r)}},UX={canHandle:r=>gP(r)&&Gc 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}},vP=new Map([["proxy",HX],["throw",UX]]);function YX(r,t){for(const e of r)if(t===e||e==="*"||e instanceof RegExp&&e.test(t))return!0;return!1}function pP(r,t=globalThis,e=["*"]){t.addEventListener("message",function n(i){if(!i||!i.data)return;if(!YX(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(ya);let c;try{const u=o.slice(0,-1).reduce((d,f)=>d[f],r),h=o.reduce((d,f)=>d[f],r);switch(s){case"GET":c=h;break;case"SET":u[o.slice(-1)[0]]=ya(i.data.value),c=!0;break;case"APPLY":c=h.apply(u,l);break;case"CONSTRUCT":{const d=new h(...l);c=tK(d)}break;case"ENDPOINT":{const{port1:d,port2:f}=new MessageChannel;pP(r,f),c=QX(d,[d])}break;case"RELEASE":c=void 0;break;default:return}}catch(u){c={value:u,[Gc]:0}}Promise.resolve(c).catch(u=>({value:u,[Gc]:0})).then(u=>{const[h,d]=Pu(u);t.postMessage(Object.assign(Object.assign({},h),{id:a}),d),s==="RELEASE"&&(t.removeEventListener("message",n),mP(t),hm in r&&typeof r[hm]=="function"&&r[hm]())}).catch(u=>{const[h,d]=Pu({value:new TypeError("Unserializable return value"),[Gc]:0});t.postMessage(Object.assign(Object.assign({},h),{id:a}),d)})}),t.start&&t.start()}function XX(r){return r.constructor.name==="MessagePort"}function mP(r){XX(r)&&r.close()}function yP(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)}}),Ny(r,e,[],t)}function xc(r){if(r)throw new Error("Proxy has been released and is not useable")}function bP(r){return gs(r,new Map,{type:"RELEASE"}).then(()=>{mP(r)})}const Ou=new WeakMap,Au="FinalizationRegistry"in globalThis&&new FinalizationRegistry(r=>{const t=(Ou.get(r)||0)-1;Ou.set(r,t),t===0&&bP(r)});function KX(r,t){const e=(Ou.get(t)||0)+1;Ou.set(t,e),Au&&Au.register(r,t,r)}function ZX(r){Au&&Au.unregister(r)}function Ny(r,t,e=[],n=function(){}){let i=!1;const a=new Proxy(n,{get(s,o){if(xc(i),o===fP)return()=>{ZX(a),bP(r),t.clear(),i=!0};if(o==="then"){if(e.length===0)return{then:()=>a};const l=gs(r,t,{type:"GET",path:e.map(c=>c.toString())}).then(ya);return l.then.bind(l)}return Ny(r,t,[...e,o])},set(s,o,l){xc(i);const[c,u]=Pu(l);return gs(r,t,{type:"SET",path:[...e,o].map(h=>h.toString()),value:c},u).then(ya)},apply(s,o,l){xc(i);const c=e[e.length-1];if(c===VX)return gs(r,t,{type:"ENDPOINT"}).then(ya);if(c==="bind")return Ny(r,t,e.slice(0,-1));const[u,h]=K3(l);return gs(r,t,{type:"APPLY",path:e.map(d=>d.toString()),argumentList:u},h).then(ya)},construct(s,o){xc(i);const[l,c]=K3(o);return gs(r,t,{type:"CONSTRUCT",path:e.map(u=>u.toString()),argumentList:l},c).then(ya)}});return KX(a,r),a}function JX(r){return Array.prototype.concat.apply([],r)}function K3(r){const t=r.map(Pu);return[t.map(e=>e[0]),JX(t.map(e=>e[1]))]}const wP=new WeakMap;function QX(r,t){return wP.set(r,t),r}function tK(r){return Object.assign(r,{[dP]:!0})}function Pu(r){for(const[t,e]of vP)if(e.canHandle(r)){const[n,i]=e.serialize(r);return[{type:"HANDLER",name:t,value:n},i]}return[{type:"RAW",value:r},wP.get(r)||[]]}function ya(r){switch(r.type){case"HANDLER":return vP.get(r.name).deserialize(r.value);case"RAW":return r.value}}function gs(r,t,e,n){return new Promise(i=>{const a=eK();t.set(a,i),r.start&&r.start(),r.postMessage(Object.assign({id:a},e),n)})}function eK(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class nK extends uh{constructor(t,e,n){super(),this.graph=t,this.layout=e,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=yP(new Worker(new URL("/assets/worker-oDIEKZfz.js",import.meta.url),{type:"module"})),this.running&&(this.running=!1,this.execute())}execute(){var t;return bt(this,void 0,void 0,function*(){if(this.running)return this;this.running=!0;const e=this.layout.options,{onTick:n}=e,i=fe(e,["onTick"]),a={};Object.keys(i).forEach(c=>{at(i[c])||(a[c]=i[c])});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[fP]()}isRunning(){return this.running}}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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class Wh extends hh{constructor(){super(...arguments),this.id="fishbone"}getRoot(){const t=this.context.model.getRootsData();if(!(wr(t)||t.length>2))return t[0]}formatSize(t){const e=typeof t=="function"?t:()=>t;return n=>Nn(e(n))}doLayout(t,e){const{hGap:n,getRibSep:i,vGap:a,nodeSize:s,height:o}=e,{model:l}=this.context,c=this.formatSize(s);let u=c(t)[0]+i(t);const h=(b,w=0)=>{var x;return w+=n*((b.children||[]).length+1),(x=b.children)===null||x===void 0||x.forEach(S=>{var E;(E=l.getNodeLikeDatum(S).children)===null||E===void 0||E.forEach(C=>{const k=l.getNodeLikeDatum(C);w=h(k,w)})}),w},d=b=>{if(b.depth===1)return u;const w=l.getParentData(b.id,"tree");if(as(b)){const x=l.getParentData(w.id,"tree"),S=v(b)-v(x);return d(w)+S*n/a}else{const x=(w.children||[]).indexOf(b.id),S=l.getNodeData((w.children||[]).slice(x));return f(w)-S.reduce((E,_)=>E+h(_),0)-c(w)[0]/2}},f=Dm(b=>{if(dm(b))return c(b)[0]/2;const w=l.getParentData(b.id,"tree");if(as(b))return d(b)+h(b)+c(b)[0]/2;{const x=v(b)-v(w),S=n/a;return d(b)+x*S}},b=>b.id),g=b=>v(l.getParentData(b,"tree")),v=Dm(b=>{if(dm(b))return o/2;if(as(b)){const w=l.getParentData(b.id,"tree"),x=w.children.indexOf(b.id);if(x===0)return g(w.id)+a;const S=l.getNodeLikeDatum(w.children[x-1]);if(wr(S.children))return v(S)+a;const E=l.getDescendantsData(S.id);return Math.max(...E.map(_=>as(_)?g(_.id):v(_)))+a}else{if(wr(b.children))return g(b.id)+a;const w=l.getNodeLikeDatum(b.children.slice(-1)[0]);if(wr(w.children))return v(w)+a;const x=l.getDescendantsData(b.id).slice(-1)[0];return(as(x)?g(x.id):v(x))+a}},b=>b.id);let p=0;const m={nodes:[],edges:[]},y=b=>{var w;(w=b.children)===null||w===void 0||w.forEach(C=>y(l.getNodeLikeDatum(C)));const x=v(b),S=f(b);if(m.nodes.push({id:b.id,x:S,y:x}),dm(b))return;const E=l.getRelatedEdgesData(b.id,"in")[0],_=[d(b),as(b)?x:g(b.id)];m.edges.push({id:F(E),controlPoints:[_],relatedNodeId:b.id}),p=Math.max(p,S+i(b)),b.depth===1&&(u=p)};return y(t),m}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(wr(l))return!1;const c=l.length===1?o:l[l.length-2].id;return n.includes(c)};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 rK(this,void 0,void 0,function*(){const n=Object.assign(Object.assign(Object.assign({},Wh.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:c}=this.context,u=[],h=[];return l.nodes.forEach(d=>{const{id:f,x:g,y:v}=d,p=c.getNodeLikeDatum(f);u.push(Z3(p,{x:g,y:v}))}),l.edges.forEach(d=>{const{id:f,controlPoints:g}=d,v=c.getEdgeDatum(f);h.push(Z3(v,{controlPoints:g}))}),{nodes:u,edges:h}})}}Wh.defaultOptions={direction:"RL",getRibSep:()=>60};const Z3=(r,t)=>Object.assign(Object.assign({},r),{style:Object.assign(Object.assign({},r.style||{}),t)}),dm=r=>r.depth===0,as=r=>(r.depth||(r.depth=0))%2===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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class Vh extends hh{constructor(){super(...arguments),this.id="snake"}formatSize(t,e){const n=typeof e=="function"?e:()=>e;return t.reduce((i,a)=>{const[s,o]=Nn(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 c=e.filter(d=>i[d.id]===0),u=e.filter(d=>a[d.id]===0);return!(c.length!==1||u.length!==1||e.filter(d=>i[d.id]===1&&a[d.id]===1).length!==e.length-2)}execute(t,e){return iK(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:c,clockwise:u,width:h,height:d}=Object.assign({},Vh.defaultOptions,this.options,e),[f,g,v,p]=Pr(a),m=this.formatSize(t.nodes||[],i),y=Math.ceil((t.nodes||[]).length/o);let b=l||(h-p-g-o*m[0])/(o-1),w=c||(d-f-v-y*m[1])/(y-1);return(w===1/0||w<0)&&(w=0),(b===1/0||b<0)&&(b=0),{nodes:((s?(n=t.nodes)===null||n===void 0?void 0:n.sort(s):aK(t))||[]).map((E,_)=>{const C=Math.floor(_/o),k=_%o,M=u?C%2===0?k:o-1-k:C%2===0?o-1-k:k,T=p+M*(m[0]+b)+m[0]/2,O=f+C*(m[1]+w)+m[1]/2;return{id:E.id,style:{x:T,y:O}}})}})}}Vh.defaultOptions={padding:0,cols:5,clockwise:!0};function aK(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(c=>c.id===o);s.push(l),i[o].forEach(c=>{n[c]--,n[c]===0&&a.push(c)})}return s}const sK=["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)"],oK=["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)"],lK=["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)"],cK=["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)"],uK=["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 Ue extends E1{}function Ws(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 Ry(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 hK=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class Hh extends Ue{constructor(t,e){super(t,Object.assign({},Hh.defaultOptions,e)),this.$element=Ws("background"),this.context.canvas.getContainer().prepend(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return hK(this,void 0,void 0,function*(){e.update.call(this,t),Object.assign(this.$element.style,i1(this.options,["key","type"]))})}destroy(){super.destroy(),this.$element.remove()}}Hh.defaultOptions={transition:"background 0.5s",backgroundSize:"cover",zIndex:"-1"};function h2(r,t,e,n,i,a){const s=r,o=t,l=e-s,c=n-o;let u=i-s,h=a-o,d=u*l+h*c,f=0;d<=0?f=0:(u=l-u,h=c-h,d=u*l+h*c,d<=0?f=0:f=d*d/(l*l+c*c));const g=u*u+h*h-f;return g<0?0:g}function Di(r,t,e,n){return(r-e)*(r-e)+(t-n)*(t-n)}function J3(r,t,e,n,i){return Di(r,t,e,n)<i*i}function dK(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 xP(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 Fe{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 Fe(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 h2(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 he;(function(r){r[r.POINT=1]="POINT",r[r.PARALLEL=2]="PARALLEL",r[r.COINCIDENT=3]="COINCIDENT",r[r.NONE=4]="NONE"})(he||(he={}));class fm{constructor(t,e=0,n=0){this.state=t,this.x=e,this.y=n}}function Ec(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 fm(he.POINT,r.x1+a*(r.x2-r.x1),r.y1+a*(r.y2-r.y1)):new fm(he.NONE)}return new fm(e===0||n===0?he.COINCIDENT:he.PARALLEL)}function EP(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 fK(r,t){function e(i,a,s,o){let l=EP(t,new Fe(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 de;(function(r){r[r.LEFT=0]="LEFT",r[r.TOP=1]="TOP",r[r.RIGHT=2]="RIGHT",r[r.BOTTOM=3]="BOTTOM"})(de||(de={}));function Wc(r,t,e){const n=new Set;return r.width<=0?(n.add(de.LEFT),n.add(de.RIGHT)):t<r.x?n.add(de.LEFT):t>r.x+r.width&&n.add(de.RIGHT),r.height<=0?(n.add(de.TOP),n.add(de.BOTTOM)):e<r.y?n.add(de.TOP):e>r.y+r.height&&n.add(de.BOTTOM),n}function SP(r,t){let e=t.x1,n=t.y1;const i=t.x2,a=t.y2,s=Array.from(Wc(r,i,a));if(s.length===0)return!0;let o=Wc(r,e,n);for(;o.size!==0;){for(const l of s)if(o.has(l))return!1;if(o.has(de.RIGHT)||o.has(de.LEFT)){let l=r.x;o.has(de.RIGHT)&&(l+=r.width),n=n+(l-e)*(a-n)/(i-e),e=l}else{let l=r.y;o.has(de.BOTTOM)&&(l+=r.height),e=e+(l-n)*(i-e)/(a-n),n=l}o=Wc(r,e,n)}return!0}function gK(r,t){let e=Number.POSITIVE_INFINITY,n=0;function i(a,s,o,l){let c=EP(t,new Fe(a,s,o,l));c=Math.abs(c-.5),c>=0&&c<=1&&(n++,c<e&&(e=c))}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 vK(r,t){let e=0;const n=Ec(r,new Fe(t.x,t.y,t.x2,t.y));e+=n.state===he.POINT?1:0;const i=Ec(r,new Fe(t.x,t.y,t.x,t.y2));e+=i.state===he.POINT?1:0;const a=Ec(r,new Fe(t.x,t.y2,t.x2,t.y2));e+=a.state===he.POINT?1:0;const s=Ec(r,new Fe(t.x2,t.y,t.x2,t.y2));return e+=s.state===he.POINT?1:0,{top:n,left:i,bottom:a,right:s,count:e}}class Ke{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 Ke(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 Ke(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=Wc(this,t,e);return n.has(de.TOP)?n.has(de.LEFT)?Di(t,e,this.x,this.y):n.has(de.RIGHT)?Di(t,e,this.x2,this.y):(this.y-e)*(this.y-e):n.has(de.BOTTOM)?n.has(de.LEFT)?Di(t,e,this.x,this.y2):n.has(de.RIGHT)?Di(t,e,this.x2,this.y2):(e-this.y2)*(e-this.y2):n.has(de.LEFT)?(this.x-t)*(this.x-t):n.has(de.RIGHT)?(t-this.x2)*(t-this.x2):0}}function pK(r){if(r.length===0)return null;const t=r[0],e=new Ke(t.x,t.y,0,0);for(const n of r)e.addPoint(n);return e}class Nu{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 Nu(t.cx,t.cy,t.radius)}containsPt(t,e){return Di(this.cx,this.cy,t,e)<this.radius*this.radius}distSquare(t,e){const n=Di(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 Na{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 Na(this.pixelGroup,t.x,t.y,e.x,e.y,t.width,t.height)}static fromPixelRegion(t,e){return new Na(e,0,0,t.x,t.y,Math.ceil(t.width/e),Math.ceil(t.height/e))}copy(t,e){return new Na(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 Ke(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,c=o-a;return new Ke(i,a,l,c)}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 c=s;c<l;c++){const u=(c-t.j)*i,h=c*n;for(let d=a;d<o;d++){const f=t.area[d-t.i+u];f!==0&&(this.area[d+h]+=e*f)}}}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 _P(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 Q3(r,t,e){return kP(Object.assign(xP(r),{distSquare:(n,i)=>h2(r.x1,r.y1,r.x2,r.y2,n,i)}),t,e)}function kP(r,t,e){const n=_P(r,e),i=t.scale(n),a=t.createSub(i,n);return mK(a,t,e,(s,o)=>r.distSquare(s,o)),a}function mK(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),c=n(o,l);if(c===0){r.set(s,a,i);continue}if(c<i){const u=e-Math.sqrt(c);r.set(s,a,u*u)}}return r}function yK(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,c=i.y2-n.y2,u=i.width-s-l,h=i.height-o-c,d=e*e;a.fillArea({x:s,y:o,width:u+1,height:h+1},d);const f=[0],g=Math.max(o,s,l,c);{const y=t.invertScaleX(n.x+n.width/2);for(let b=1;b<g;b++){const w=t.invertScaleY(n.y-b),x=r.distSquare(y,w);if(x<d){const S=e-Math.sqrt(x);f.push(S*S)}else break}}const v=[],p=Math.max(s,l),m=Math.max(o,l);for(let y=1;y<p;y++){const b=t.invertScaleX(n.x-y),w=[];for(let x=1;x<m;x++){const S=t.invertScaleY(n.y-x),E=r.distSquare(b,S);if(E<d){const _=e-Math.sqrt(E);w.push(_*_)}else w.push(0)}v.push(w)}for(let y=1;y<Math.min(o,f.length);y++){const b=f[y];a.fillHorizontalLine(s,o-y,u+1,b)}for(let y=1;y<Math.min(c,f.length);y++){const b=f[y];a.fillHorizontalLine(s,o+h+y,u+1,b)}for(let y=1;y<Math.min(s,f.length);y++){const b=f[y];a.fillVerticalLine(s-y,o,h+1,b)}for(let y=1;y<Math.min(c,f.length);y++){const b=f[y];a.fillVerticalLine(s+u+y,o,h+1,b)}for(let y=1;y<s;y++){const b=v[y-1],w=s-y;for(let x=1;x<o;x++)a.set(w,o-x,b[x-1]);for(let x=1;x<c;x++)a.set(w,o+h+x,b[x-1])}for(let y=1;y<l;y++){const b=v[y-1],w=s+u+y;for(let x=1;x<o;x++)a.set(w,o-x,b[x-1]);for(let x=1;x<c;x++)a.set(w,o+h+x,b[x-1])}return a}function Jt(r,t){return{x:r,y:t}}function bK(r,t,e,n){if(r.length===0)return[];const i=_K(r);return i.map((a,s)=>{const o=i.slice(0,s);return wK(t,a,o,e,n)}).flat()}function wK(r,t,e,n,i){const a=Jt(t.cx,t.cy),s=SK(a,e,r);if(s==null)return[];const o=new Fe(a.x,a.y,s.cx,s.cy),l=xK(o,r,n,i);return EK(l,r)}function xK(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(),c=MP(t,l),u=c?vK(l,c):null;if(!c||!u||u.count!==2){s||i.push(l);continue}let h=n,d=_c(c,h,u,!0),f=yi(d,a)||yi(d,i),g=Sc(d,t);for(;!f&&g&&h>=1;)h/=1.5,d=_c(c,h,u,!0),f=yi(d,a)||yi(d,i),g=Sc(d,t);if(d&&!f&&!g&&(a.push(new Fe(l.x1,l.y1,d.x,d.y)),a.push(new Fe(d.x,d.y,l.x2,l.y2)),s=!0),s)continue;h=n,d=_c(c,h,u,!1);let v=yi(d,a)||yi(d,i);for(g=Sc(d,t);!v&&g&&h>=1;)h/=1.5,d=_c(c,h,u,!1),v=yi(d,a)||yi(d,i),g=Sc(d,t);d&&!v&&(a.push(new Fe(l.x1,l.y1,d.x,d.y)),a.push(new Fe(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 EK(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 Fe(n.x1,n.y1,i.x2,i.y2);MP(t,a)?(e.push(n),r.push(i)):r.push(a)}return e}function SK(r,t,e){let n=Number.POSITIVE_INFINITY;return t.reduce((i,a)=>{const s=Di(r.x,r.y,a.cx,a.cy);if(s>n)return i;const o=new Fe(r.x,r.y,a.cx,a.cy),l=kK(e,o);return s*(l+1)*(l+1)<n&&(i=a,n=s*(l+1)*(l+1)),i},null)}function _K(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 Sc(r,t){return t.some(e=>e.containsPt(r.x,r.y))}function yi(r,t){return t.some(e=>!!(J3(e.x1,e.y1,r.x,r.y,.001)||J3(e.x2,e.y2,r.x,r.y,.001)))}function MP(r,t){let e=Number.POSITIVE_INFINITY,n=null;for(const i of r){if(!SP(i,t))continue;const a=gK(i,t);a>=0&&a<e&&(n=i,e=a)}return n}function kK(r,t){return r.reduce((e,n)=>SP(n,t)&&fK(n,t)?e+1:e,0)}function _c(r,t,e,n){const i=e.top,a=e.left,s=e.bottom,o=e.right;if(n){if(a.state===he.POINT){if(i.state===he.POINT)return Jt(r.x-t,r.y-t);if(s.state===he.POINT)return Jt(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?Jt(r.x-t,r.y-t):Jt(r.x2+t,r.y-t):a.y<o.y?Jt(r.x-t,r.y2+t):Jt(r.x2+t,r.y2+t)}if(o.state===he.POINT){if(i.state===he.POINT)return Jt(r.x2+t,r.y-t);if(s.state===he.POINT)return Jt(r.x2+t,r.y2+t)}const u=r.height*r.width;return r.height*((i.x-r.x+(o.x-r.x))*.5)<u*.5?i.x>s.x?Jt(r.x-t,r.y-t):Jt(r.x-t,r.y2+t):i.x<s.x?Jt(r.x2+t,r.y-t):Jt(r.x2+t,r.y2+t)}if(a.state===he.POINT){if(i.state===he.POINT)return Jt(r.x2+t,r.y2+t);if(s.state===he.POINT)return Jt(r.x2+t,r.y-t);const u=r.height*r.width;return r.width*((a.y-r.y+(o.y-r.y))*.5)<u*.5?a.y>o.y?Jt(r.x2+t,r.y2+t):Jt(r.x-t,r.y2+t):a.y<o.y?Jt(r.x2+t,r.y-t):Jt(r.x-t,r.y-t)}if(o.state===he.POINT){if(i.state===he.POINT)return Jt(r.x-t,r.y2+t);if(s.state===he.POINT)return Jt(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?Jt(r.x2+t,r.y2+t):Jt(r.x2+t,r.y-t):i.x<s.x?Jt(r.x-t,r.y2+t):Jt(r.x-t,r.y-t)}function MK(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(h2(a.x,a.y,s.x,s.y,l.x,l.y)>n)return!1}return!0}function CK(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(;MK(t,n,a,i);)a++;e.push(t.get(n)),n=a}return new Vs(e)}}function TK(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 OK(r=6){function a(s,o,l){let c=0,u=0;for(let h=-2;h<=1;h++){const d=s.get(o+h),f=TK(h,l);c+=f*d.x,u+=f*d.y}return{x:c,y:u}}return s=>{if(s.length<3)return s;const o=[],l=s.closed,c=s.length+3-1+(l?0:2);o.push(a(s,2-(l?0:2),0));for(let u=2-(l?0:2);u<c;u++)for(let h=1;h<=r;h++)o.push(a(s,u,h/r));return new Vs(o)}}function AK(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 Vs(i)}}class Vs{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:dK(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 AK(t)(this)}simplify(t){return CK(t)(this)}bSplines(t){return OK(t)(this)}apply(t){return t(this)}containsElements(t){const e=pK(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 Fe(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 PK{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 Vs(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 to=0,kc=1,Mc=2,gm=3;function NK(r,t){const e=(Math.floor(r.width)+Math.floor(r.height))*2,n=new PK(e);function i(l,c,u,h){const d=r.get(l,c);return Number.isNaN(d)?Number.NaN:d>t?u+h:u}function a(l,c){let u=to;return u=i(l,c,u,1),u=i(l+1,c,u,2),u=i(l,c+1,u,4),u=i(l+1,c+1,u,8),Number.isNaN(u)?-1:u}let s=kc;function o(l,c){let u=l,h=c,d=r.invertScaleX(u),f=r.invertScaleY(h);for(let g=0;g<r.width*r.height;g++){const v={x:d,y:f};if(n.contains(v)){if(n.isFirst(v))return!0}else n.add(v);const p=a(u,h);switch(p){case-1:return!0;case 0:case 3:case 2:case 7:s=Mc;break;case 12:case 14:case 4:s=gm;break;case 6:s=s===to?gm:Mc;break;case 1:case 13:case 5:s=to;break;case 9:s=s===Mc?to:kc;break;case 10:case 8:case 11:s=kc;break;default:return console.warn("Marching squares invalid state: "+p),!0}switch(s){case to:h--,f-=r.pixelGroup;break;case kc:h++,f+=r.pixelGroup;break;case gm:u--,d-=r.pixelGroup;break;case Mc:u++,d+=r.pixelGroup;break;default:return console.warn("Marching squares invalid state: "+p),!0}}return!0}for(let l=0;l<r.width;l++)for(let c=0;c<r.height;c++){if(r.get(l,c)<=t)continue;const u=a(l,c);if(!(u<0||u===15)&&o(l,c))return n.path()}return null}const Uh={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 To(r){return r!=null&&typeof r.radius=="number"}function tk(r,t){if(To(r)!==To(t))return!1;if(To(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 rr;(function(r){r[r.MEMBERS=0]="MEMBERS",r[r.NON_MEMBERS=1]="NON_MEMBERS",r[r.EDGES=2]="EDGES"})(rr||(rr={}));let ek=class{constructor(t={}){this.dirty=new Set,this.members=[],this.nonMembers=[],this.virtualEdges=[],this.edges=[],this.activeRegion=new Ke(0,0,0,0),this.potentialArea=new Na(1,0,0,0,0,0,0),this.o=Object.assign({},Uh,t)}pushMember(...t){if(t.length!==0){this.dirty.add(rr.MEMBERS);for(const e of t)this.members.push({raw:e,obj:To(e)?Nu.from(e):Ke.from(e),area:null})}}removeMember(t){const e=this.members.findIndex(n=>tk(n.raw,t));return e<0?!1:(this.members.splice(e,1),this.dirty.add(rr.MEMBERS),!0)}removeNonMember(t){const e=this.nonMembers.findIndex(n=>tk(n.raw,t));return e<0?!1:(this.nonMembers.splice(e,1),this.dirty.add(rr.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(rr.NON_MEMBERS),!0)}pushNonMember(...t){if(t.length!==0){this.dirty.add(rr.NON_MEMBERS);for(const e of t)this.nonMembers.push({raw:e,obj:To(e)?Nu.from(e):Ke.from(e),area:null})}}pushEdge(...t){if(t.length!==0){this.dirty.add(rr.EDGES);for(const e of t)this.edges.push({raw:e,obj:Fe.from(e),area:null})}}update(){const t=this.dirty.has(rr.MEMBERS),e=this.dirty.has(rr.NON_MEMBERS);let n=this.dirty.has(rr.EDGES);this.dirty.clear();const i=this.members.map(c=>c.obj);if(this.o.virtualEdges&&(t||e)){const c=this.nonMembers.map(d=>d.obj),u=bK(i,c,this.o.maxRoutingIterations,this.o.morphBuffer),h=new Map(this.virtualEdges.map(d=>[d.obj.toString(),d.area]));this.virtualEdges=u.map(d=>{var f;return{raw:d,obj:d,area:(f=h.get(d.toString()))!==null&&f!==void 0?f:null}}),n=!0}let a=!1;if(t||n){const c=this.virtualEdges.concat(this.edges).map(f=>f.obj),u=LK(i,c),h=Math.max(this.o.edgeR1,this.o.nodeR1)+this.o.morphBuffer,d=Ke.from(_P(u,h));d.equals(this.activeRegion)||(a=!0,this.activeRegion=d)}if(a){const c=Math.ceil(this.activeRegion.width/this.o.pixelGroup),u=Math.ceil(this.activeRegion.height/this.o.pixelGroup);this.activeRegion.x!==this.potentialArea.pixelX||this.activeRegion.y!==this.potentialArea.pixelY?(this.potentialArea=Na.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)):(c!==this.potentialArea.width||u!==this.potentialArea.height)&&(this.potentialArea=Na.fromPixelRegion(this.activeRegion,this.o.pixelGroup))}const s=new Map,o=c=>{if(c.area){const u=`${c.obj.width}x${c.obj.height}x${c.obj instanceof Ke?"R":"C"}`;s.set(u,c.area)}},l=c=>{if(c.area)return;const u=`${c.obj.width}x${c.obj.height}x${c.obj instanceof Ke?"R":"C"}`;if(s.has(u)){const d=s.get(u);c.area=this.potentialArea.copy(d,{x:c.obj.x-this.o.nodeR1,y:c.obj.y-this.o.nodeR1});return}const h=c.obj instanceof Ke?yK(c.obj,this.potentialArea,this.o.nodeR1):kP(c.obj,this.potentialArea,this.o.nodeR1);c.area=h,s.set(u,h)};this.members.forEach(o),this.nonMembers.forEach(o),this.members.forEach(l),this.nonMembers.forEach(c=>{this.activeRegion.intersects(c.obj)?l(c):c.area=null}),this.edges.forEach(c=>{c.area||(c.area=Q3(c.obj,this.potentialArea,this.o.edgeR1))}),this.virtualEdges.forEach(c=>{c.area||(c.area=Q3(c.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 Vs([]);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 RK(e,n,i,a,o=>o.containsElements(s),t)}};function RK(r,t,e,n,i,a={}){const s=Object.assign({},Uh,a);let o=s.threshold,l=s.memberInfluenceFactor,c=s.edgeInfluenceFactor,u=s.nonMemberInfluenceFactor;const h=(s.nodeR0-s.nodeR1)*(s.nodeR0-s.nodeR1),d=(s.edgeR0-s.edgeR1)*(s.edgeR0-s.edgeR1);for(let f=0;f<s.maxMarchingIterations;f++){if(r.clear(),l!==0){const v=l/h;for(const p of t)r.incArea(p,v)}if(c!==0){const v=c/d;for(const p of e)r.incArea(p,v)}if(u!==0){const v=u/h;for(const p of n)r.incArea(p,v)}const g=NK(r,o);if(g&&i(g))return g;if(o*=.95,f<=s.maxMarchingIterations*.5)l*=1.2,c*=1.2;else if(u!==0&&n.length>0)u*=.8;else break}return new Vs([])}function LK(r,t){if(r.length===0)return new Ke(0,0,0,0);const e=Ke.from(r[0]);for(const n of r)e.add(n);for(const n of t)e.add(xP(n));return e}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 Yh extends Ue{constructor(t,e){super(t,on({},Yh.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 ol({style:a}),this.context.canvas.appendChild(this.shape))},this.updateBubbleSetsPath=n=>{if(!this.shape)return;const i=F(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:c=[],exit:u=[]}=zi(s,a,p=>p),{enter:h=[],exit:d=[]}=zi(l,o,p=>p);n&&(u.push(n),c.push(n));const f=(p,m,y)=>{p.forEach(b=>{const w=y?this.members:this.avoidMembers,x=y?"pushMember":"pushNonMember",S=y?"removeMember":"removeNonMember";if(m){let E;i.getElementType(b)==="edge"?([E]=FK(i,b),this.bubbleSets.pushEdge(E)):([E]=IK(i,b),this.bubbleSets[x](E)),w.set(b,E)}else{const E=w.get(b);E&&(i.getElementType(b)==="edge"?this.bubbleSets.removeEdge(E):this.bubbleSets[S](E),w.delete(b))}})};f(u,!1,!0),f(c,!0,!0),f(d,!1,!1),f(h,!0,!1);const v=this.bubbleSets.compute().sample(8).simplify(0).bSplines().simplify(0);return this.path=NT(v.points.map(Ge)),this.path},this.bindEvents(),this.bubbleSets=new ek(this.options)}bindEvents(){this.context.graph.on(X.AFTER_RENDER,this.drawBubbleSets),this.context.graph.on(X.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath)}init(){this.bubbleSets=new ek(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=DK(t,["type","key","members","avoidMembers"]),o=Object.keys(s).reduce((l,c)=>(c in Uh?l.bubbleSetOptions[c]=s[c]:l.style[c]=s[c],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=at(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(X.AFTER_RENDER,this.drawBubbleSets),this.context.graph.off(X.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath),this.shape.destroy(),super.destroy()}}Yh.defaultOptions=Object.assign({members:[],avoidMembers:[],fill:"lightblue",fillOpacity:.2,stroke:"blue",strokeOpacity:.2},Uh);const IK=(r,t)=>(Array.isArray(t)?t:[t]).map(n=>{const i=r.getElementRenderBounds(n);return new Ke(i.min[0],i.min[1],Nr(i),Rr(i))}),FK=(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 Fe.from({x1:a[0],y1:a[1],x2:s[0],y2:s[1]})});function BK(r){return`
- <ul class="g6-contextmenu-ul">
- ${r.map(t=>`<li class="g6-contextmenu-li" value="${t.value}">${t.name}</li>`).join("")}
- </ul>
- `}const zK=`
- .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 nk=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class Xh extends Ue{constructor(t,e){super(t,Object.assign({},Xh.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=Ws("contextmenu",!1,{zIndex:"99"});const{className:t}=this.options;t&&this.$element.classList.add(t),this.context.canvas.getContainer().appendChild(this.$element),Ry("g6-contextmenu-css","style",{},zK,document.head)}show(t){return nk(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 nk(this,void 0,void 0,function*(){const{getContent:e,getItems:n}=this.options;return n?BK(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)}}Xh.defaultOptions={trigger:"contextmenu",offset:[4,4],loadingContent:'<div class="g6-contextmenu-loading">Loading...</div>',getContent:()=>"It is a empty context menu.",enable:()=>!0};class Kh extends Ue{constructor(t,e){super(t,Object.assign({},Kh.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:c,divisions:u,iterations:h}=this.options;for(let d=0;d<s;d++){for(let f=0;f<h;f++){const g={};a.forEach(v=>{var p;if(v.source===v.target)return;const m=F(v);g[m]=this.getEdgeForces(v,u,c);for(let y=0;y<u+1;y++)(p=this.edgePoints)[m]||(p[m]=[]),this.edgePoints[m][y]=ft(this.edgePoints[m][y],g[m][y])})}c/=2,u*=l,h*=o,this.divideEdges(u)}a.forEach(d=>{const f=F(d),g=i.getElement(f);g==null||g.update({d:P1(this.edgePoints[f])})})},this.bindEvents()}get nodeMap(){const t=this.context.model.getNodeData();return Object.fromEntries(t.map(e=>[F(e),za(ye(e))]))}divideEdges(t){this.context.model.getEdgeData().forEach(n=>{var i;const a=F(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(ur(ft(s,o),2)),this.edgePoints[a].push(o);else{const c=(this.edgePoints[a].length===0?Kt(s,o):WK(this.edgePoints[a]))/(t+1);let u=c;const h=[s];for(let d=1;d<this.edgePoints[a].length;d++){const f=this.edgePoints[a][d-1],g=this.edgePoints[a][d];let v=Kt(g,f);for(;v>u;){const p=u/v,m=ft(f,Gr($t(g,f),p));h.push(m),v-=u,u=c}u-=v}h.push(o),this.edgePoints[a]=h}})}getVectorPosition(t){const e=this.nodeMap[t.source],n=this.nodeMap[t.target],[i,a]=$t(n,e),s=Kt(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=$K(n,i),s=jK(n,i),o=qK(n,i),l=GK(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,c;if(o<=a)return;this.measureEdgeCompatibility(i,s)>=e&&(t[l=F(i)]||(t[l]=[]),t[F(i)].push(s),t[c=F(s)]||(t[c]=[]),t[F(s)].push(i))})}),t}getSpringForce(t,e){const{pre:n,cur:i,next:a}=t;return Gr($t(ft(n,a),Gr(i,2)),e)}getElectrostaticForce(t,e){wr(this.edgeBundles)&&(this.edgeBundles=this.getEdgeBundles());const n=this.edgeBundles[F(e)];let i=[0,0];return n==null||n.forEach(a=>{const s=this.edgePoints[F(a)][t],o=this.edgePoints[F(e)][t],l=$t(s,o),c=Kt(s,o);i=ft(i,Gr(l,1/c))}),i}getEdgeForces(t,e,n){const i=this.nodeMap[t.source],a=this.nodeMap[t.target],s=this.options.K/(Kt(i,a)*(e+1)),o=[[0,0]],l=F(t);for(let c=1;c<e;c++){const u=this.getSpringForce({pre:this.edgePoints[l][c-1],cur:this.edgePoints[l][c],next:this.edgePoints[l][c+1]||[0,0]},s),h=this.getElectrostaticForce(c,t);o.push(Gr(ft(u,h),n))}return o.push([0,0]),o}bindEvents(){const{graph:t}=this.context;t.on(X.AFTER_RENDER,this.onBundle)}unbindEvents(){const{graph:t}=this.context;t.off(X.AFTER_RENDER,this.onBundle)}destroy(){this.unbindEvents(),super.destroy()}}Kh.defaultOptions={K:.1,lambda:.1,divisions:1,divRate:2,cycles:6,iterations:90,iterRate:2/3,bundleThreshold:.6};const $K=(r,t)=>Math.abs(_9([r.vx,r.vy],[t.vx,t.vy])/(r.length*t.length)),jK=(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)},qK=(r,t)=>{const e=(r.length+t.length)/2,n=ur(ft(r.source,r.target),2),i=ur(ft(t.source,t.target),2);return e/(e+Kt(n,i))},rk=(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]},ik=(r,t)=>{const e=rk(t.source,r),n=rk(t.target,r),i=ur(ft(e,n),2),a=ur(ft(r.source,r.target),2);return Kt(e,n)===0?0:Math.max(0,1-2*Kt(a,i)/Kt(e,n))},GK=(r,t)=>Math.min(ik(r,t),ik(t,r)),WK=r=>{let t=0;for(let e=1;e<r.length;e++)t+=Kt(r[e],r[e-1]);return t},VK={fill:"#fff",fillOpacity:1,lineWidth:1,stroke:"#000",strokeOpacity:.8,zIndex:-1/0},ak=.05;class Zh extends Ue{constructor(t,e){super(t,Object.assign({},Zh.defaultOptions,e)),this.shapes=new Map,this.r=this.options.r,this.onEdgeFilter=n=>{if(this.options.trigger==="drag"&&this.isLensOn)return;const i=Ge(n.canvas);this.renderLens(i),this.renderFocusElements()},this.renderLens=n=>{const i=Object.assign({},VK,this.options.style);this.isLensOn||(this.lens=new ll({style:i}),this.canvas.appendChild(this.lens)),Object.assign(i,sr(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(c=>n(F(c),"node")),edges:o.filter(c=>n(F(c),"edge")),combos:l.filter(c=>n(F(c),"combo"))}},this.getFocusElements=n=>{const{nodes:i,edges:a}=this.getFilterData(),s=i.filter(c=>Kt(ye(c),n)<this.r),o=s.map(c=>F(c)),l=a.filter(c=>{const{source:u,target:h}=c,d=o.includes(u),f=o.includes(h);switch(this.options.nodeType){case"both":return d&&f;case"either":return d!==f;case"source":return d&&!f;case"target":return!d&&f;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,c=u=>{const h=F(u);l.add(h);const d=n.getElement(h);if(!d)return;const f=this.shapes.get(h)||d.cloneNode();f.setPosition(d.getPosition()),f.id=d.id,this.shapes.has(h)?Object.entries(d.attributes).forEach(([p,m])=>{f.style[p]!==m&&(f.style[p]=m)}):(this.canvas.appendChild(f),this.shapes.set(h,f));const g=i.getElementType(h),v=this.getElementStyle(g,u);f.update(v)};s.forEach(c),o.forEach(c),this.shapes.forEach((u,h)=>{l.has(h)||(u.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:c,canvas:u}=this.context,h=c.getCanvasByClient([a,s]),d=(i=this.lens)===null||i===void 0?void 0:i.getCenter();if(!this.isLensOn||Kt(h,d)>this.r)return;const{maxR:f,minR:g}=this.options,v=o+l>0?1/(1-ak):1-ak,p=Math.min(...u.getSize())/2;this.r=Math.max(g||0,Math.min(f||p,this.r*v)),this.renderLens(d),this.renderFocusElements()},this.isLensDragging=!1,this.onDragStart=n=>{var i;const a=Ge(n.canvas),s=(i=this.lens)===null||i===void 0?void 0:i.getCenter();!this.isLensOn||Kt(a,s)>this.r||(this.isLensDragging=!0)},this.onDrag=n=>{if(!this.isLensDragging)return;const i=Ge(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(z.CLICK,this.onEdgeFilter),n==="pointermove"?a.addEventListener(z.POINTER_MOVE,this.onEdgeFilter):n==="drag"&&(a.addEventListener(z.DRAG_START,this.onDragStart),a.addEventListener(z.DRAG,this.onDrag),a.addEventListener(z.DRAG_END,this.onDragEnd)),i==="wheel"&&((t=this.graphDom)===null||t===void 0||t.addEventListener(z.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(z.CLICK,this.onEdgeFilter),n==="pointermove"?a.removeEventListener(z.POINTER_MOVE,this.onEdgeFilter):n==="drag"&&(a.removeEventListener(z.DRAG_START,this.onDragStart),a.removeEventListener(z.DRAG,this.onDrag),a.removeEventListener(z.DRAG_END,this.onDragEnd)),i==="wheel"&&((t=this.graphDom)===null||t===void 0||t.removeEventListener(z.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()}}Zh.defaultOptions={trigger:"pointermove",r:60,nodeType:"both",filter:()=>!0,style:{lineWidth:2},nodeStyle:{label:!1},edgeStyle:{label:!0},scaleRBy:"wheel",preventDefault:!0};const HK={fill:"#ccc",fillOpacity:.1,lineWidth:2,stroke:"#000",strokeOpacity:.8,labelFontSize:12},sk=.05,ok=.1;class Jh extends Ue{constructor(t,e){super(t,Object.assign({},Jh.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=Ge(n.canvas);this.onMagnify(i)},this.onMagnify=n=>{n.some(isNaN)||(this.renderLens(n),this.renderFocusElements())},this.renderLens=n=>{const i=Object.assign({},HK,this.options.style);this.isLensOn||(this.lens=new ll({style:i}),this.canvas.appendChild(this.lens)),Object.assign(i,sr(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(c=>{const u=ye(c),h=Kt(u,i);if(h>this.r)return;const d=a*h/(this.d*h+this.r),[f,g]=u,[v,p]=i,m=(f-v)/h,y=(g-p)/h,b=[v+d*m,p+d*y],w=F(c),x=this.getNodeStyle(c),S=La(n.getElementRenderStyle(w),Object.keys(x));s.set(w,Object.assign(Object.assign({},sr(b)),x)),o.set(w,Object.assign(Object.assign({},sr(u)),S))}),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:c}=zi(Array.from(this.prevMagnifiedStyleMap.keys()),Array.from(n.keys()),d=>d),u=new Set,h=(d,f)=>{const g=s.getElement(d);g==null||g.update(f),a.getRelatedEdgesData(d).forEach(v=>{u.add(F(v))})};[...o,...c].forEach(d=>{h(d,n.get(d))}),l.forEach(d=>{h(d,this.prevOriginStyleMap.get(d)),this.prevOriginStyleMap.delete(d)}),u.forEach(d=>{const f=s.getElement(d);f==null||f.update({})}),this.prevMagnifiedStyleMap=n,i.forEach((d,f)=>{this.prevOriginStyleMap.has(f)||this.prevOriginStyleMap.set(f,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!(Kt(s,o)>this.r)},this.scaleR=n=>{const{maxR:i,minR:a}=this.options,s=n?1/(1-sk):1-sk,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+ok:this.d-ok;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=Ge(n.canvas),a=this.lens.getCenter();return!(Kt(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=Ge(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(z.CLICK,this.onCreateFisheye),n==="pointermove"&&s.addEventListener(z.POINTER_MOVE,this.onCreateFisheye),n==="drag"||i==="drag"||a==="drag"){s.addEventListener(z.DRAG_START,this.onDragStart),s.addEventListener(z.DRAG_END,this.onDragEnd);const o=n==="drag"?this.onDrag:i==="drag"?this.scaleRByDrag:this.scaleDByDrag;s.addEventListener(z.DRAG,o)}if(i==="wheel"||a==="wheel"){const o=i==="wheel"?this.scaleRByWheel:this.scaleDByWheel;(t=this.graphDom)===null||t===void 0||t.addEventListener(z.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(z.CLICK,this.onCreateFisheye),n==="pointermove"&&s.removeEventListener(z.POINTER_MOVE,this.onCreateFisheye),n==="drag"||i==="drag"||a==="drag"){s.removeEventListener(z.DRAG_START,this.onDragStart),s.removeEventListener(z.DRAG_END,this.onDragEnd);const o=n==="drag"?this.onDrag:i==="drag"?this.scaleRByDrag:this.scaleDByDrag;s.removeEventListener(z.DRAG,o)}if(i==="wheel"||a==="wheel"){const o=i==="wheel"?this.scaleRByWheel:this.scaleDByWheel;(t=this.graphDom)===null||t===void 0||t.removeEventListener(z.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()}}Jh.defaultOptions={trigger:"pointermove",r:120,d:1.5,maxD:5,minD:0,showDPercent:!0,style:{},nodeStyle:{label:!0},preventDefault:!0};class Qh extends Ue{constructor(t,e){super(t,Object.assign({},Qh.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 Ds(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||!UK()||this.$el.requestFullscreen().catch(t=>{Ar.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()}}Qh.defaultOptions={trigger:{},autoFit:!0};function UK(){return document.fullscreenEnabled||Reflect.get(document,"webkitFullscreenEnabled")||Reflect.get(document,"mozFullscreenEnabled")||Reflect.get(document,"msFullscreenEnabled")}class td extends Ue{constructor(t,e){super(t,Object.assign({},td.defaultOptions,e)),this.$element=Ws("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(X.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=M9(ft(this.offset,t),this.options.size),this.$element.style.backgroundPosition=`${this.offset[0]}px ${this.offset[1]}px`}destroy(){this.context.graph.off(X.AFTER_TRANSFORM,this.onTransform),this.$element.remove(),super.destroy()}}td.defaultOptions={border:!0,borderLineWidth:1,borderStroke:"#eee",borderStyle:"solid",lineWidth:1,size:20,stroke:"#eee"};function d2(r){const t={Added:new Map,Updated:new Map,Removed:new Map};return r.forEach(e=>{const{type:n,value:i}=e,a=F(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 CP(r){const{NodeAdded:t=[],NodeUpdated:e=[],NodeRemoved:n=[],EdgeAdded:i=[],EdgeUpdated:a=[],EdgeRemoved:s=[],ComboAdded:o=[],ComboUpdated:l=[],ComboRemoved:c=[]}=ju(r,u=>u.type);return{add:{nodes:t,edges:i,combos:o},update:{nodes:e,edges:a,combos:l},remove:{nodes:n,edges:s,combos:c}}}function TP(r,t){for(const e in r)me(r[e])&&!Array.isArray(r[e])&&r[e]!==null?(t[e]||(t[e]={}),TP(r[e],t[e])):t[e]===void 0&&(t[e]=Fo(e))}function YK(r,t=!1,e){const n={animation:t,current:{add:{},update:{},remove:{}},original:{add:{},update:{},remove:{}}},{add:i,update:a,remove:s}=CP(d2(r));return["nodes","edges","combos"].forEach(o=>{a[o]&&a[o].forEach(l=>{var c,u;const h=Object.assign({},l.value);let d=Object.assign({},l.original);if(e){const f=e.graph.getElementType(F(l.original)),g=f==="edge"?"stroke":"fill",v=e.element.getElementComputedStyle(f,l.original);d=Object.assign(Object.assign({},l.original),{style:Object.assign({[g]:v[g]},l.original.style)})}TP(h,d),(c=n.current.update)[o]||(c[o]=[]),n.current.update[o].push(h),(u=n.original.update)[o]||(u[o]=[]),n.original.update[o].push(d)}),i[o]&&i[o].forEach(l=>{var c,u;const h=Object.assign({},l.value);(c=n.current.add)[o]||(c[o]=[]),n.current.add[o].push(h),(u=n.original.remove)[o]||(u[o]=[]),n.original.remove[o].push(h)}),s[o]&&s[o].forEach(l=>{var c,u;const h=Object.assign({},l.value);(c=n.current.remove)[o]||(c[o]=[]),n.current.remove[o].push(h),(u=n.original.add)[o]||(u[o]=[]),n.original.add[o].push(h)})}),n}class ed extends Ue{constructor(t,e){super(t,Object.assign({},ed.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 c=a?i.original:i.current;this.context.graph.addData(c.add),this.context.graph.updateData(c.update),this.context.graph.removeData(pT(c.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===X.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(YK(this.batchChanges.flat(),this.batchAnimation,this.context)),this.notify(_i.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 uh;const{graph:n}=this.context;n.on(X.AFTER_DRAW,this.addCommand),n.on(X.BATCH_START,this.initBatchCommand),n.on(X.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(_i.UNDO,a)}return this}redo(){const t=this.redoStack.pop();return t&&(this.executeCommand(t,!1),this.undoStackPush(t),this.notify(_i.REDO,t)),this}undoAndCancel(){const t=this.undoStack.pop();return t&&(this.executeCommand(t,!1),this.redoStack=[],this.notify(_i.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(_i.CLEAR,null)}notify(t,e){this.emitter.emit(t,{cmd:e}),this.emitter.emit(_i.CHANGE,{cmd:e})}on(t,e){this.emitter.on(t,e)}destroy(){const{graph:t}=this.context;t.off(X.AFTER_DRAW,this.addCommand),t.off(X.BATCH_START,this.initBatchCommand),t.off(X.BATCH_END,this.addCommand),this.emitter.off(),super.destroy(),this.undoStack=[],this.redoStack=[]}}ed.defaultOptions={stackSize:0};function Cc(r,t,e,n,i,a){const s=(a-t)*(e-r)-(n-t)*(i-r);return s>0?!0:!(s<0)}function XK(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],c=t[1][1];return Cc(e,n,s,o,l,c)!==Cc(i,a,s,o,l,c)&&Cc(e,n,i,a,s,o)!==Cc(e,n,i,a,l,c)}var KK=XK;function OP(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}}}OP.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 ZK(r,t){return new OP(r,t)}var JK=ZK,QK={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 AP(r,t,e){return(t[0]-r[0])*(e[1]-r[1])-(t[1]-r[1])*(e[0]-r[0])}function tZ(r){const t=[];for(let e=0;e<r.length;e++){for(;t.length>=2&&AP(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}return t.pop(),t}function eZ(r){const t=r.reverse(),e=[];for(let n=0;n<t.length;n++){for(;e.length>=2&&AP(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}return e.pop(),e}function nZ(r){const t=tZ(r),n=eZ(r).concat(t);return n.push(r[0]),n}var rZ=nZ;const iZ=KK,aZ=JK,vm=QK,sZ=rZ;function oZ(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 lZ(r){return r.sort(function(t,e){return t[0]-e[0]||t[1]-e[1]})}function Ly(r,t){return Math.pow(t[0]-r[0],2)+Math.pow(t[1]-r[1],2)}function lk(r,t,e){const n=[t[0]-r[0],t[1]-r[1]],i=[e[0]-r[0],e[1]-r[1]],a=Ly(r,t),s=Ly(r,e);return(n[0]*i[0]+n[1]*i[1])/Math.sqrt(a*s)}function ck(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])&&iZ(r,n))return!0}return!1}function cZ(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 uZ(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 hZ(r,t,e){let n=null,i=uk,a=uk,s,o;for(let l=0;l<t.length;l++)s=lk(r[0],r[1],t[l]),o=lk(r[1],r[0],t[l]),s>i&&o>a&&!ck([r[0],t[l]],e)&&!ck([r[1],t[l]],e)&&(i=s,a=o,n=t[l]);return n}function PP(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(Ly(o[0],o[1])<t||i.has(l))continue;let c=0,u=uZ(o),h,d,f;do u=n.extendBbox(u,c),h=u[2]-u[0],d=u[3]-u[1],f=hZ(o,n.rangePoints(u),r),c++;while(f===null&&(e[0]>h||e[1]>d));h>=e[0]&&d>=e[1]&&i.add(l),f!==null&&(r.splice(s+1,0,f),n.removePoint(f),a=!0)}return a?PP(r,t,e,n,i):r}function dZ(r,t,e){let n=t||20;const i=oZ(lZ(vm.toXy(r,e)));if(i.length<4){const h=i.concat([i[0]]);return e?vm.fromXy(h,e):h}const a=cZ(i),s=[a[0]*hk,a[1]*hk],o=sZ(i),l=i.filter(function(h){return o.indexOf(h)<0}),c=Math.ceil(1/(i.length/(a[0]*a[1]))),u=PP(o,Math.pow(n,2),s,aZ(l,c),new Set);return e?vm.fromXy(u,e):u}const uk=Math.cos(90/(180/Math.PI)),hk=.6;var fZ=dZ;const gZ=zu(fZ);function vZ(r,t,e){if(r.length===1)return pZ(r[0],t,e);if(r.length===2)return dk(r,t,e);if(r.length===3){const[n,i,a]=k1(r);if(ST(n,i,a))return dk([n,a],t,e)}switch(e){case"smooth":return yZ(r,t);case"sharp":return bZ(r,t);case"rounded":default:return mZ(r,t)}}const pZ=(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]]},dk=(r,t,e)=>{const n=[t,t,0,0,0],i=e==="sharp"?ft(r[0],Pi(ti($t(r[0],r[1])),t)):r[0],a=e==="sharp"?ft(r[1],Pi(ti($t(r[1],r[0])),t)):r[1],s=Pi(ti(Yu($t(i,a),!1)),t),o=Pi(s,-1),l=ft(i,s),c=ft(a,s),u=ft(a,o),h=ft(i,o);return e==="sharp"?[["M",l[0],l[1]],["L",c[0],c[1]],["L",u[0],u[1]],["L",h[0],h[1]],["Z"]]:[["M",l[0],l[1]],["L",c[0],c[1]],["A",...n,u[0],u[1]],["L",h[0],h[1]],["A",...n,l[0],l[1]]]},mZ=(r,t)=>{const e=k1(r).map((o,l)=>{const c=(l-2+r.length)%r.length,u=(l-1+r.length)%r.length,h=(l+1)%r.length,d=r[c],f=r[u],g=r[h],v=$t(d,f),p=$t(f,o),m=$t(o,g),y=(E,_)=>S1(E,_,!0)<Math.PI,b=y(v,p),w=y(p,m),x=E=>Pi(ti(Yu(E,!1)),t),S=x(p);return[{p:za(b?ft(f,x(v)):ft(f,S)),concave:b&&f},{p:za(w?ft(o,x(m)):ft(o,S)),concave:w&&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 c=[],u=a[e.length-1];return l===0&&c.push(["M",...u[1].p]),o[0].concave?s.push(o[0].p,o[1].p):c.push(["A",...n,...o[0].p]),o[1].concave?s.unshift(o[1].p):c.push(["L",...o[1].p]),s.length===3&&(c.pop(),c.push(["C",...s.flat()]),s=[]),c})},yZ=(r,t)=>{const e=k1(r).map((n,i)=>{const a=r[(i+1)%r.length];return{p:n,v:ti($t(a,n))}});return e.forEach((n,i)=>{const a=i>0?i-1:r.length-1,s=e[a].v,o=ti(ft(s,Pi(n.v,S1(s,n.v,!0)<Math.PI?1:-1)));n.p=ft(n.p,Pi(o,t))}),NT(e.map(n=>n.p))},bZ=(r,t)=>{const n=r.map((a,s)=>{const o=r[s===0?r.length-1:s-1],l=Bo(Pi(ti(Yu($t(o,a),!1)),t));return[ft(o,l),ft(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 _1(o,l,!0)}).filter(Boolean).map((a,s)=>[s===0?"M":"L",a[0],a[1]]).concat([["Z"]])};var wZ=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 nd extends Ue{constructor(t,e){super(t,Object.assign({},nd.defaultOptions,e)),this.hullMemberIds=[],this.drawHull=()=>{if(!this.shape)this.shape=new ol({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(F(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(c=>i.getNodeData(c)),o=gZ(s.map(ye),this.options.concavity).slice(1).reverse(),l=o.flatMap(c=>s.filter(u=>ue(ye(u),c)).map(F));return ue(l,this.hullMemberIds)&&!n?this.path:(this.hullMemberIds=l,this.path=vZ(o,this.getPadding(),this.options.corner),this.path)},this.bindEvents()}bindEvents(){this.context.graph.on(X.AFTER_RENDER,this.drawHull),this.context.graph.on(X.AFTER_ELEMENT_UPDATE,this.updateHullPath)}getHullStyle(t){const e=this.options,{members:n,padding:i,corner:a}=e,s=wZ(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=at(t)?t(this.options.members):t,this.shape.update(this.getHullStyle(!0))}getMember(){return this.options.members}destroy(){this.context.graph.off(X.AFTER_DRAW,this.drawHull),this.shape.destroy(),this.hullMemberIds=[],super.destroy()}}nd.defaultOptions={members:[],padding:10,corner:"rounded",concavity:1/0,fill:"lightblue",fillOpacity:.2,labelOpacity:1,stroke:"blue",strokeOpacity:.2};function NP(r,t){t(r),r.children&&r.children.forEach(function(e){e&&NP(e,t)})}function yl(r){rd(r,!0)}function or(r){rd(r,!1)}function rd(r,t){var e=t?"visible":"hidden";NP(r,function(n){n.attr("visibility",e)})}var xZ=function(r){wt(t,r);function t(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=r.apply(this,Q([],N(e),!1))||this;return i.isMutationObserved=!0,i.addEventListener(xt.INSERTED,function(){or(i)}),i}return t}(Pe);function RP(r){var t=r.appendChild(new xZ({class:"offscreen"}));return or(t),t}function EZ(r){for(var t=r;t;){if(t.className==="offscreen")return!0;t=t.parent}return!1}var f2=function(r){wt(t,r);function t(e){e===void 0&&(e={});var n=e.style,i=fe(e,["style"]);return r.call(this,q({style:q({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=RP(this)),this._offscreen},enumerable:!1,configurable:!0}),t.prototype.disconnectedCallback=function(){var e;(e=this._offscreen)===null||e===void 0||e.destroy()},t}(Qi);function Rs(r){return r*Math.PI/180}function LP(r){return Number((r*180/Math.PI).toPrecision(5))}var sn=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 Un(r,t){return at(r)?r.apply(void 0,Q([],N(t),!1)):r}var fr=function(r,t){var e=function(i){return"".concat(t,"-").concat(i)},n=Object.fromEntries(Object.entries(r).map(function(i){var a=N(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},SZ=5,DP=function(r,t,e,n){e===void 0&&(e=0),n===void 0&&(n=SZ),Object.entries(t).forEach(function(i){var a=N(i,2),s=a[0],o=a[1],l=r;Object.prototype.hasOwnProperty.call(t,s)&&(o?Ts(o)?(Ts(r[s])||(l[s]={}),e<n?DP(r[s],o,e+1,n):l[s]=t[s]):Dn(o)?(l[s]=[],l[s]=l[s].concat(o)):l[s]=o:l[s]=o)})},ze=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)DP(r,t[n]);return r},IP=function(r){return r!==void 0&&r!=null&&!Number.isNaN(r)},Tc,_Z=Dm(function(r,t){var e=t.fontSize,n=t.fontFamily,i=t.fontWeight,a=t.fontStyle,s=t.fontVariant;return Tc||(Tc=U.offscreenCanvasCreator.getOrCreateContext(void 0)),Tc.font=[a,s,i,"".concat(e,"px"),n].join(" "),Tc.measureText(r).width},function(r,t){return[r,Object.values(t||FP(r)).join()].join("")},4096),FP=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 BP(r){return r.nodeName==="text"?r:r.nodeName==="g"&&r.children.length===1&&r.children[0].nodeName==="text"?r.children[0]:null}function zP(r,t){var e=BP(r);e&&e.attr(t)}function Dy(r,t,e){e===void 0&&(e="..."),zP(r,{wordWrap:!0,wordWrapWidth:t,maxLines:1,textOverflow:e})}function kZ(r,t,e,n){e===void 0&&(e=2),n===void 0&&(n="top"),zP(r,{wordWrap:!0,wordWrapWidth:t,maxLines:e,textBaseline:n})}function fk(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,c=o.clientY;return[l,c]}return n&&i?[n,i]:[0,0]}function si(r){return typeof r=="function"?r():Tt(r)||nt(r)?new f2({style:{text:String(r)}}):r}function MZ(r,t){return r.reduce(function(e,n){return(e[n[t]]=e[n[t]]||[]).push(n),e},{})}function Rn(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 je(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 CZ=function(r,t){return function(e){return r*(1-e)+t*e}};function TZ(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]=g2(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 OZ(r,t){r===void 0&&(r={}),t===void 0&&(t={});var e={},n={};return Object.entries(t).forEach(function(i){var a=N(i,2),s=a[0],o=a[1];s in r?e[s]=g2(r[s],o):n[s]=o}),function(i){return Object.entries(e).forEach(function(a){var s=N(a,2),o=s[0],l=s[1];return n[o]=l(i)}),n}}function g2(r,t){return typeof r=="number"&&typeof t=="number"?CZ(r,t):Array.isArray(r)&&Array.isArray(t)?TZ(r,t):typeof r=="object"&&typeof t=="object"?OZ(r,t):function(e){return r}}function AZ(r,t,e,n){if(!n)return r.attr("__keyframe_data__",e),null;var i=n.duration,a=i===void 0?0:i,s=g2(t,e),o=Math.ceil(+a/16),l=new Array(o).fill(0).map(function(c,u,h){return{__keyframe_data__:s(u/(h.length-1))}});return r.animate(l,q({fill:"both"},n))}function Hr(r,t){return[r[0]*t,r[1]*t]}function bo(r,t){return[r[0]+t[0],r[1]+t[1]]}function pm(r,t){return[r[0]-t[0],r[1]-t[1]]}function fa(r,t){return[Math.min(r[0],t[0]),Math.min(r[1],t[1])]}function ga(r,t){return[Math.max(r[0],t[0]),Math.max(r[1],t[1])]}function Vo(r,t){return Math.sqrt(Math.pow(r[0]-t[0],2)+Math.pow(r[1]-t[1],2))}function $P(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 PZ(r,t){return t?[r[1],-r[0]]:[-r[1],r[0]]}function gk(r,t){return+r.toPrecision(t)}function vk(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 NZ(r,t,e,n){var i,a=[],s=!!n,o,l,c=[1/0,1/0],u=[-1/0,-1/0],h,d,f;if(s){i=N(n,2),c=i[0],u=i[1];for(var g=0,v=r.length;g<v;g+=1){var p=r[g];c=fa(c,p),u=ga(u,p)}}for(var g=0,m=r.length;g<m;g+=1){var p=r[g];if(g===0)f=p;else if(g===m-1)d=p,a.push(f),a.push(d);else{var y=[g?g-1:m-1,g-1][1];o=r[y],l=r[g+1];var b=[0,0];b=pm(l,o),b=Hr(b,t);var w=Vo(p,o),x=Vo(p,l),S=w+x;S!==0&&(w/=S,x/=S);var E=Hr(b,-w),_=Hr(b,x);d=bo(p,E),h=bo(p,_),h=fa(h,ga(l,p)),h=ga(h,fa(l,p)),E=pm(h,p),E=Hr(E,-w/x),d=bo(p,E),d=fa(d,ga(o,p)),d=ga(d,fa(o,p)),_=pm(p,d),_=Hr(_,x/w),h=bo(p,_),s&&(d=ga(d,c),d=fa(d,u),h=ga(h,c),h=fa(h,u)),a.push(f),a.push(d),f=h}}return a}function RZ(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=NZ(i,.4,n,e),l=i.length,c=[],u,h,d,a=0;a<l-1;a+=1)u=o[a*2],h=o[a*2+1],d=i[a+1],c.push(["C",u[0],u[1],h[0],h[1],d[0],d[1]]);return c}var LZ=["$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 DZ(r){return LZ.includes(r)}function pk(r){var t={};for(var e in r)DZ(e)&&(t[e]=r[e]);return t}function IZ(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 v2(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 FZ(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 BZ(r){throw new Error(r)}var zZ=function(){function r(i,a,s,o,l,c,u){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]),c===void 0&&(c=[]),u===void 0&&(u=[]),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=c,this._facetElements=u}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 c=this._data[l],u=N(Array.isArray(c)?c:[c,null],2),h=u[0],d=u[1],f=s(h,l);f.__data__=h,d!==null&&(f.__fromElements__=d),this._parent.appendChild(f),o.push(f)}return new e(o,null,this._parent,this._document)}for(var l=0;l<this._elements.length;l++){var g=this._elements[l],h=g.__data__,f=s(h,l);g.appendChild(f),o.push(f)}return new e(o,null,o[0],this._document)},r.prototype.maybeAppend=function(i,a){var s=Fd(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=Fd(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=Fd(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(k){return k}),s===void 0&&(s=function(){return null});for(var c=[],u=[],h=new Set(this._elements),d=[],f=new Set,g=new Map(this._elements.map(function(k,M){return[a(k.__data__,M),k]})),v=new Map(this._facetElements.map(function(k,M){return[a(k.__data__,M),k]})),p=FZ(this._elements,function(k){return s(k.__data__)}),m=0;m<i.length;m++){var y=i[m],b=a(y,m),w=s(y,m);if(g.has(b)){var x=g.get(b);x.__data__=y,x.__facet__=!1,u.push(x),h.delete(x),g.delete(b)}else if(v.has(b)){var x=v.get(b);x.__data__=y,x.__facet__=!0,u.push(x),v.delete(b)}else if(p.has(b)){var S=p.get(b);d.push([y,S]);try{for(var E=(o=void 0,Jo(S)),_=E.next();!_.done;_=E.next()){var x=_.value;h.delete(x)}}catch(k){o={error:k}}finally{try{_&&!_.done&&(l=E.return)&&l.call(E)}finally{if(o)throw o.error}}p.delete(b)}else if(g.has(w)){var x=g.get(w);x.__toData__?x.__toData__.push(y):x.__toData__=[y],f.add(x),h.delete(x)}else c.push(y)}var C=[new e([],c,this._parent,this._document),new e(u,null,this._parent,this._document),new e(h,null,this._parent,this._document),new e([],d,this._parent,this._document),new e(f,null,this._parent,this._document)];return new e(this._elements,null,this._parent,this._document,C)},r.prototype.merge=function(i){var a=Q(Q([],N(this._elements),!1),N(i._elements),!1),s=Q(Q([],N(this._transitions),!1),N(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:BZ("Unknown node type: ".concat(i))},r.prototype.join=function(i,a,s,o,l){i===void 0&&(i=function(g){return g}),a===void 0&&(a=function(g){return g}),s===void 0&&(s=function(g){return g.remove()}),o===void 0&&(o=function(g){return g}),l===void 0&&(l=function(g){return g.remove()});var c=i(this._enter),u=a(this._update),h=s(this._exit),d=o(this._merge),f=l(this._split);return u.merge(c).merge(h).merge(d).merge(f)},r.prototype.remove=function(){for(var i=function(o){var l=a._elements[o],c=a._transitions[o];c?c.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,c){a!==void 0&&(this.style[i]=o.call(this,l,c))})},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(c){var u=N(c,2),h=u[0],d=u[1],f=typeof d!="function"||!a?function(){return d}:d;d!==void 0&&l.attr(h,f.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,Q([this._parent,this],N(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 c=typeof s=="string"?this.createElement(s):s();return o.appendChild(c),new e([c],null,this._parent,this._document)},r.registry={g:Pe,rect:Be,circle:li,path:Tn,text:f2,ellipse:el,image:rl,line:Fa,polygon:Va,polyline:Vu,html:nl},r}();function st(r){return new zZ([r],null,r,r.ownerDocument)}function $Z(r,t,e){return r.querySelector(t)?st(r).select(t):st(r).append(e)}function Ve(r){if(nt(r))return[r,r,r,r];if(Dn(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 mk(r){var t=r.getLocalBounds(),e=t.min,n=t.max,i=N([e,n],2),a=N(i[0],2),s=a[0],o=a[1],l=N(i[1],2),c=l[0],u=l[1];return{x:s,y:o,width:c-s,height:u-o,left:s,bottom:u,top:o,right:c}}function jZ(r,t){var e=N(r,2),n=e[0],i=e[1],a=N(t,2),s=a[0],o=a[1];return n!==s&&i===o}function qZ(r,t){var e,n,i=t.attributes;try{for(var a=Jo(Object.entries(i)),s=a.next();!s.done;s=a.next()){var o=N(s.value,2),l=o[0],c=o[1];l!=="id"&&l!=="className"&&r.attr(l,c)}}catch(u){e={error:u}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}}function p2(r){return r.toString().charAt(0).toUpperCase()+r.toString().slice(1)}function GZ(r){return r.toString().charAt(0).toLowerCase()+r.toString().slice(1)}function WZ(r,t){return"".concat(t).concat(p2(r))}function yk(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?GZ(a):a}function VZ(r,t){Object.entries(t).forEach(function(e){var n=N(e,2),i=n[0],a=n[1];Q([r],N(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,c){return"".concat(l).concat(c.join(":"),";")},"")}})})}var Oc=function(r,t){if(!(r!=null&&r.startsWith(t)))return!1;var e=r[t.length];return e>="A"&&e<="Z"};function ht(r,t,e){e===void 0&&(e=!1);var n={};return Object.entries(r).forEach(function(i){var a=N(i,2),s=a[0],o=a[1];if(!(s==="className"||s==="class")){if(Oc(s,"show")&&Oc(yk(s,"show"),t)!==e)s===WZ(t,"show")?n[s]=o:n[s.replace(new RegExp(p2(t)),"")]=o;else if(!Oc(s,"show")&&Oc(s,t)!==e){var l=yk(s,t);l==="filter"&&typeof o=="function"||(n[l]=o)}}}),n}function vs(r,t){return Object.entries(r).reduce(function(e,n){var i=N(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(p2(a))]=s,e},{})}function oi(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=N(a,2),o=s[0],l=s[1];t.includes(o)||(e.indexOf(o)!==-1?i[o]=l:n[o]=l)}),[n,i]}function hn(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 HZ(r,t,e){var n=r.getBBox(),i=n.width,a=n.height,s=N([t,e].map(function(c,u){var h;return c.includes("%")?parseFloat(((h=c.match(/[+-]?([0-9]*[.])?[0-9]+/))===null||h===void 0?void 0:h[0])||"0")/100*(u===0?i:a):c}),2),o=s[0],l=s[1];return[o,l]}function jP(r,t){if(t)try{var e=/translate\(([+-]*[\d]+[%]*),[ ]*([+-]*[\d]+[%]*)\)/g,n=t.replace(e,function(i,a,s){return"translate(".concat(HZ(r,a,s),")")});r.attr("transform",n)}catch{}}function UZ(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 bk=function(r,t){if(t==null){r.innerHTML="";return}r.replaceChildren?Array.isArray(t)?r.replaceChildren.apply(r,Q([],N(t),!1)):r.replaceChildren(t):(r.innerHTML="",Array.isArray(t)?t.forEach(function(e){return r.appendChild(e)}):r.appendChild(t))};function YZ(){rd(this,this.attributes.visibility!=="hidden")}var ge=function(r){wt(t,r);function t(e,n){n===void 0&&(n={});var i=r.call(this,ze({},{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=RP(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"&&YZ.call(this)},t.prototype.update=function(e,n){var i;return this.attr(ze({},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=fe(e,["x","y","transform","transformOrigin","class","className","zIndex"]);return n},t}(g1),qP=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"]]},XZ=qP,KZ=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"]]},ZZ=function(r,t,e){return[["M",r-e,t],["L",r,t-e],["L",r+e,t],["L",r,t+e],["Z"]]},JZ=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"]]},QZ=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"]]},tJ=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"]]},eJ=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"]]},GP=function(r,t,e){return[["M",r,t+e],["L",r,t-e]]},nJ=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]]},rJ=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]]},iJ=function(r,t,e){return[["M",r-e,t],["L",r+e,t],["M",r,t-e],["L",r,t+e]]},aJ=function(r,t,e){return[["M",r-e,t],["L",r+e,t]]},WP=function(r,t,e){return[["M",r-e,t],["L",r+e,t]]},sJ=WP,oJ=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]]},lJ=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]]},cJ=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]]},uJ=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 hJ(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 dJ=function(r,t,e){return[["M",r-e,t-e],["L",r+e,t],["L",r-e,t+e],["Z"]]};function fJ(r){var t="default";if(me(r)&&r instanceof Image)t="image";else if(at(r))t="symbol";else if(Tt(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 gJ(r){var t=fJ(r);return["base64","url","image"].includes(t)?"image":r&&t==="symbol"?"path":null}var qt=function(r){wt(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),c=l.symbol,u=l.size,h=u===void 0?16:u,d=fe(l,["symbol","size"]),f=gJ(c);Rn(!!f,st(n),function(g){g.maybeAppendByClassName("marker",f).attr("className","marker ".concat(f,"-marker")).call(function(v){if(f==="image"){var p=h*2;v.styles({img:c,width:p,height:p,x:a-h,y:o-h})}else{var p=h/2,m=at(c)?c:t.getSymbol(c);v.styles(q({d:m==null?void 0:m(a,o,p)},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}(ge);qt.registerSymbol("cross",nJ);qt.registerSymbol("hyphen",aJ);qt.registerSymbol("line",GP);qt.registerSymbol("plus",iJ);qt.registerSymbol("tick",rJ);qt.registerSymbol("circle",qP);qt.registerSymbol("point",XZ);qt.registerSymbol("bowtie",eJ);qt.registerSymbol("hexagon",tJ);qt.registerSymbol("square",KZ);qt.registerSymbol("diamond",ZZ);qt.registerSymbol("triangle",JZ);qt.registerSymbol("triangle-down",QZ);qt.registerSymbol("line",GP);qt.registerSymbol("dot",WP);qt.registerSymbol("dash",sJ);qt.registerSymbol("smooth",oJ);qt.registerSymbol("hv",lJ);qt.registerSymbol("vh",cJ);qt.registerSymbol("hvh",uJ);qt.registerSymbol("vhv",hJ);function Ru(r,...t){return t.reduce((e,n)=>i=>e(n(i)),r)}function Iy(r,t){return t-r?e=>(e-r)/(t-r):e=>.5}function vJ(r,t){const e=t<r?t:r,n=r>t?r:t;return i=>Math.min(Math.max(e,i),n)}function pJ(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 wk=Math.sqrt(50),xk=Math.sqrt(10),Ek=Math.sqrt(2);function Vc(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>=wk?10:a>=xk?5:a>=Ek?2:1)*10**i:-(10**-i)/(a>=wk?10:a>=xk?5:a>=Ek?2:1)}const mJ=(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=Vc(s,o,e),l>0?(s=Math.floor(s/l)*l,o=Math.ceil(o/l)*l,l=Vc(s,o,e)):l<0&&(s=Math.ceil(s*l)/l,o=Math.floor(o*l)/l,l=Vc(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 Sk(r){return!ut(r)&&!b6(r)&&!Number.isNaN(r)}var VP={exports:{}},yJ={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]},HP={exports:{}},bJ=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")},wJ=bJ,xJ=Array.prototype.concat,EJ=Array.prototype.slice,_k=HP.exports=function(t){for(var e=[],n=0,i=t.length;n<i;n++){var a=t[n];wJ(a)?e=xJ.call(e,EJ.call(a)):e.push(a)}return e};_k.wrap=function(r){return function(){return r(_k(arguments))}};var SJ=HP.exports,Oo=yJ,bl=SJ,UP=Object.hasOwnProperty,YP=Object.create(null);for(var mm in Oo)UP.call(Oo,mm)&&(YP[Oo[mm]]=mm);var An=VP.exports={to:{},get:{}};An.get=function(r){var t=r.substring(0,3).toLowerCase(),e,n;switch(t){case"hsl":e=An.get.hsl(r),n="hsl";break;case"hwb":e=An.get.hwb(r),n="hwb";break;default:e=An.get.rgb(r),n="rgb";break}return e?{model:n,value:e}:null};An.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,c;if(o=r.match(e)){for(c=o[2],o=o[1],l=0;l<3;l++){var u=l*2;s[l]=parseInt(o.slice(u,u+2),16)}c&&(s[3]=parseInt(c,16)/255)}else if(o=r.match(t)){for(o=o[1],c=o[3],l=0;l<3;l++)s[l]=parseInt(o[l]+o[l],16);c&&(s[3]=parseInt(c+c,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]:UP.call(Oo,o[1])?(s=Oo[o[1]],s[3]=1,s):null:null;for(l=0;l<3;l++)s[l]=qi(s[l],0,255);return s[3]=qi(s[3],0,1),s};An.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=qi(parseFloat(e[2]),0,100),s=qi(parseFloat(e[3]),0,100),o=qi(isNaN(n)?1:n,0,1);return[i,a,s,o]}return null};An.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=qi(parseFloat(e[2]),0,100),s=qi(parseFloat(e[3]),0,100),o=qi(isNaN(n)?1:n,0,1);return[i,a,s,o]}return null};An.to.hex=function(){var r=bl(arguments);return"#"+Ac(r[0])+Ac(r[1])+Ac(r[2])+(r[3]<1?Ac(Math.round(r[3]*255)):"")};An.to.rgb=function(){var r=bl(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]+")"};An.to.rgb.percent=function(){var r=bl(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]+")"};An.to.hsl=function(){var r=bl(arguments);return r.length<4||r[3]===1?"hsl("+r[0]+", "+r[1]+"%, "+r[2]+"%)":"hsla("+r[0]+", "+r[1]+"%, "+r[2]+"%, "+r[3]+")"};An.to.hwb=function(){var r=bl(arguments),t="";return r.length>=4&&r[3]!==1&&(t=", "+r[3]),"hwb("+r[0]+", "+r[1]+"%, "+r[2]+"%"+t+")"};An.to.keyword=function(r){return YP[r.slice(0,3)]};function qi(r,t,e){return Math.min(Math.max(t,r),e)}function Ac(r){var t=Math.round(r).toString(16).toUpperCase();return t.length<2?"0"+t:t}var _J=VP.exports;const kJ=zu(_J);function ym(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 MJ(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=ym(s,a,t+1/3),l=ym(s,a,t),c=ym(s,a,t-1/3);return[o*255,l*255,c*255,i]}function kk(r){const t=kJ.get(r);if(!t)return null;const{model:e,value:n}=t;return e==="rgb"?n:e==="hsl"?MJ(n):null}const Lu=(r,t)=>e=>r*(1-e)+t*e,CJ=(r,t)=>{const e=kk(r),n=kk(t);return e===null||n===null?e?()=>r:()=>t:i=>{const a=new Array(4);for(let u=0;u<4;u+=1){const h=e[u],d=n[u];a[u]=h*(1-i)+d*i}const[s,o,l,c]=a;return`rgba(${Math.round(s)}, ${Math.round(o)}, ${Math.round(l)}, ${c})`}},TJ=(r,t)=>typeof r=="number"&&typeof t=="number"?Lu(r,t):typeof r=="string"&&typeof t=="string"?CJ(r,t):()=>r,OJ=(r,t)=>{const e=Lu(r,t);return n=>Math.round(e(n))};function Mk({map:r,initKey:t},e){const n=t(e);return r.has(n)?r.get(n):e}function AJ({map:r,initKey:t},e){const n=t(e);return r.has(n)?r.get(n):(r.set(n,e),e)}function PJ({map:r,initKey:t},e){const n=t(e);return r.has(n)&&(e=r.get(n),r.delete(n)),e}function NJ(r){return typeof r=="object"?r.valueOf():r}class Ck extends Map{constructor(t){if(super(),this.map=new Map,this.initKey=NJ,t!==null)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(Mk({map:this.map,initKey:this.initKey},t))}has(t){return super.has(Mk({map:this.map,initKey:this.initKey},t))}set(t,e){return super.set(AJ({map:this.map,initKey:this.initKey},t),e)}delete(t){return super.delete(PJ({map:this.map,initKey:this.initKey},t))}}class XP{constructor(t){this.options=on({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=on({},this.options,t),this.rescale(t)}rescale(t){}}const m2=Symbol("defaultUnknown");function Tk(r,t,e){for(let n=0;n<t.length;n+=1)r.has(t[n])||r.set(e(t[n]),n)}function Ok(r){const{value:t,from:e,to:n,mapper:i,notFoundReturn:a}=r;let s=i.get(t);if(s===void 0){if(a!==m2)return a;s=e.push(t)-1,i.set(t,s)}return n[s%n.length]}function Ak(r){return r instanceof Date?t=>`${t}`:typeof r=="object"?t=>JSON.stringify(t):t=>t}class y2 extends XP{getDefaultOptions(){return{domain:[],range:[],unknown:m2}}constructor(t){super(t)}map(t){return this.domainIndexMap.size===0&&Tk(this.domainIndexMap,this.getDomain(),this.domainKey),Ok({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return this.rangeIndexMap.size===0&&Tk(this.rangeIndexMap,this.getRange(),this.rangeKey),Ok({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=Ak(e),this.rangeKey=Ak(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 y2(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 RJ(r){const t=Math.min(...r);return r.map(e=>e/t)}function LJ(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 DJ(r){return Math.round(r*1e12)/1e12}function IJ(r){const{domain:t,range:e,paddingOuter:n,paddingInner:i,flex:a,round:s,align:o}=r,l=t.length,c=LJ(a,l),[u,h]=e,d=h-u,f=2/l*n+1-1/l*i,g=d/f,v=g*i/l,p=g-l*v,m=RJ(c),y=m.reduce((T,O)=>T+O),b=p/y,w=new Ck(t.map((T,O)=>{const R=m[O]*b;return[T,s?Math.floor(R):R]})),x=new Ck(t.map((T,O)=>{const D=m[O]*b+v;return[T,s?Math.floor(D):D]})),S=Array.from(x.values()).reduce((T,O)=>T+O),_=(d-(S-S/l*i))*o,C=u+_;let k=s?Math.round(C):C;const M=new Array(l);for(let T=0;T<l;T+=1){M[T]=DJ(k);const O=t[T];k+=x.get(O)}return{valueBandWidth:w,valueStep:x,adjustedRange:M}}function FJ(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 IJ(r);const{range:a,paddingOuter:s,paddingInner:o,round:l,align:c}=r;let u,h,d=a[0];const g=a[1]-d,v=s*2,p=n-o;u=g/Math.max(1,v+p),l&&(u=Math.floor(u)),d+=(g-u*(n-o))*c,h=u*(1-o),l&&(d=Math.round(d),h=Math.round(h));const m=new Array(n).fill(0).map((y,b)=>d+b*u);return{valueStep:u,valueBandWidth:h,adjustedRange:m}}class b2 extends y2{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:m2,flex:[]}}constructor(t){super(t)}clone(){return new b2(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}=FJ({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 BJ=(r,t,e)=>{let n,i,a=r,s=t;if(a===s&&e>0)return[a];let o=Vc(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},zJ=(r,t,e)=>{const[n,i]=r,[a,s]=t;let o,l;return n<i?(o=Iy(n,i),l=e(a,s)):(o=Iy(i,n),l=e(s,a)),Ru(l,o)},$J=(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 c=0;c<n;c+=1)i[c]=Iy(o[c],o[c+1]),a[c]=e(l[c],l[c+1]);return c=>{const u=pJ(r,c,1,n)-1,h=i[u],d=a[u];return Ru(d,h)(c)}},Pk=(r,t,e,n)=>(Math.min(r.length,t.length)>2?$J:zJ)(r,t,n?OJ:e);class jJ extends XP{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:Lu,tickCount:5}}map(t){return Sk(t)?this.output(t):this.options.unknown}invert(t){return Sk(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 mJ}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?vJ(i[0],i[a-1]):Im}composeOutput(t,e){const{domain:n,range:i,round:a,interpolate:s}=this.options,o=Pk(n.map(t),i,s,a);this.output=Ru(o,e,t)}composeInput(t,e,n){const{domain:i,range:a}=this.options,s=Pk(a,i.map(t),Lu);this.input=Ru(e,n,s)}}class Ao extends jJ{getDefaultOptions(){return{domain:[0,1],range:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolate:TJ,tickMethod:BJ,tickCount:5}}chooseTransforms(){return[Im,Im]}clone(){return new Ao(this.options)}}var qJ=function(r){wt(t,r);function t(e){var n=this,i=e.style,a=fe(e,["style"]);return n=r.call(this,on({},{type:"column"},q({style:i},a)))||this,n.columnsGroup=new Pe({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,")"),st(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(ze({},this.attributes,e)),this.render()},t.prototype.clear=function(){this.removeChildren()},t}(Zt),GJ=function(r){wt(t,r);function t(e){var n=this,i=e.style,a=fe(e,["style"]);return n=r.call(this,on({},{type:"lines"},q({style:i},a)))||this,n.linesGroup=n.appendChild(new Pe),n.areasGroup=n.appendChild(new Pe),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(ze({},this.attributes,e)),this.render()},t.prototype.renderLines=function(e){st(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){st(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}(Zt);function WJ(r,t){var e,n=t.x,i=t.y,a=N(i.getOptions().range||[0,0],2),s=a[0],o=a[1];return o>s&&(e=N([s,o],2),o=e[0],s=e[1]),r.map(function(l){var c=l.map(function(u,h){return[n.map(h),ce(i.map(u),o,s)]});return c})}function Ho(r,t){t===void 0&&(t=!1);var e=t?r.length-1:0,n=r.map(function(i,a){return Q([a===e?"M":"L"],N(i),!1)});return t?n.reverse():n}function Du(r,t){if(t===void 0&&(t=!1),r.length<=2)return Ho(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,Q([],N(a),!1))}var s=RZ(e);return t?s.unshift(Q(["M"],N(r[n-1]),!1)):s.unshift(Q(["M"],N(r[0]),!1)),s}function w2(r,t,e){var n=Vi(r);return n.push(["L",t,e],["L",0,e],["Z"]),n}function VJ(r,t,e,n){return r.map(function(i){return w2(t?Du(i):Ho(i),e,n)})}function HJ(r,t,e){for(var n=[],i=r.length-1;i>=0;i-=1){var a=r[i],s=Ho(a),o=void 0;if(i===0)o=w2(s,t,e);else{var l=r[i-1],c=Ho(l,!0);c[0][0]="L",o=Q(Q(Q([],N(s),!1),N(c),!1),[["Z"]],!1)}n.push(o)}return n}function UJ(r,t,e){for(var n=[],i=r.length-1;i>=0;i-=1){var a=r[i],s=Du(a),o=void 0;if(i===0)o=w2(s,t,e);else{var l=r[i-1],c=Du(l,!0),u=a[0];c[0][0]="L",o=Q(Q(Q([],N(s),!1),N(c),!1),[Q(["M"],N(u),!1),["Z"]],!1)}n.push(o)}return n}function Nk(r){return r.length===0?[0,0]:[tu(f6(r,function(t){return tu(t)||0})),Qc(d6(r,function(t){return Qc(t)||0}))]}function Rk(r){for(var t=Vi(r),e=t[0].length,n=N([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 YJ=function(r){wt(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=Vi(e);return nt(n[0])?[n]:n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this.attributes.isStack?Rk(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=N(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=ht(this.attributes,"area"),l=ht(this.attributes,"line"),c=this.containerShape.width,u=this.data;if(u[0].length===0)return{lines:[],areas:[]};var h=this.scales,d=h.x,f=h.y,g=WJ(u,{x:d,y:f}),v=[];if(o){var p=this.baseline;a?v=s?UJ(g,c,p):HJ(g,c,p):v=VJ(g,s,c,p)}return{lines:g.map(function(m,y){return q({stroke:e.getColor(y),d:s?Du(m):Ho(m)},l)}),areas:v.map(function(m,y){return q({d:m,fill:e.getColor(y)},o)})}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"columnsStyle",{get:function(){var e=this,n=ht(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,c=this.rawData;if(!c)return{columns:[]};a&&(c=Rk(c));var u=this.createScales(c),h=u.x,d=u.y,f=N(Nk(c),2),g=f[0],v=f[1],p=new Ao({domain:[0,v-(g>0?0:g)],range:[0,l*o]}),m=h.getBandWidth(),y=this.rawData;return{columns:c.map(function(b,w){return b.map(function(x,S){var E=m/c.length,_=function(){return{x:h.map(S)+E*w,y:x>=0?d.map(x):d.map(0),width:E,height:p.map(Math.abs(x))}},C=function(){return{x:h.map(S),y:d.map(x),width:m,height:p.map(y[w][S])}};return q(q({fill:e.getColor(w)},n),a?C():_())})})}},enumerable:!1,configurable:!0}),t.prototype.render=function(e,n){$Z(n,".container","rect").attr("className","container").node();var i=e.type,a=e.x,s=e.y,o="spark".concat(i),l=q({x:a,y:s},i==="line"?this.linesStyle:this.columnsStyle);st(n).selectAll(".spark").data([i]).join(function(c){return c.append(function(u){return u==="line"?new GJ({className:o,style:l}):new qJ({className:o,style:l})}).attr("className","spark ".concat(o))},function(c){return c.update(l)},function(c){return c.remove()})},t.prototype.getColor=function(e){var n=this.attributes.color;return Dn(n)?n[e%n.length]:at(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,c=l===void 0?[]:l,u=a.spacing,h=this.containerShape,d=h.width,f=h.height,g=N(Nk(e),2),v=g[0],p=g[1],m=new Ao({domain:[(n=c[0])!==null&&n!==void 0?n:v,(i=c[1])!==null&&i!==void 0?i:p],range:[f,f*(1-o)]});return s==="line"?{type:s,x:new Ao({domain:[0,e[0].length-1],range:[0,d]}),y:m}:{type:s,x:new b2({domain:e[0].map(function(y,b){return b}),range:[0,d],paddingInner:u,paddingOuter:u/2,align:.5}),y:m}},t.tag="sparkline",t}(ge);function XJ(r){return typeof r=="boolean"?!1:"enter"in r&&"update"in r&&"exit"in r}function Lk(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=N(n,1),a=i[0];return!t.includes(a)}));return Object.fromEntries(t.map(function(n){return XJ(r)?r[n]===!1?[n,!1]:[n,q(q({},r[n]),e)]:[n,e]}))}function Hs(r,t){r?r.finished.then(t):t()}function KJ(r,t){r.length===0?t():Promise.all(r.map(function(e){return e==null?void 0:e.finished})).then(t)}function KP(r,t){"update"in r?r.update(t):r.attr(t)}function ZP(r,t,e){if(t.length===0)return null;if(!e){var n=t.slice(-1)[0];return KP(r,{style:n}),null}return r.animate(t,e)}function ZJ(r,t){return!(r.nodeName!=="text"||t.nodeName!=="text"||r.attributes.text!==t.attributes.text)}function JJ(r,t,e,n){if(n===void 0&&(n="destroy"),ZJ(r,t))return r.remove(),[null];var i=function(){n==="destroy"?r.destroy():n==="hide"&&or(r),t.isVisible()&&yl(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,c=Math.ceil(+s/2),u=+s/4,h=N(r.getGeometryBounds().center,2),d=h[0],f=h[1],g=N(t.getGeometryBounds().center,2),v=g[0],p=g[1],m=N([(d+v)/2-d,(f+p)/2-f],2),y=m[0],b=m[1],w=r.style.opacity,x=w===void 0?1:w,S=t.style.opacity,E=S===void 0?1:S,_=r.style.transform||"",C=t.style.transform||"",k=r.animate([{opacity:x,transform:"translate(0, 0) ".concat(_)},{opacity:0,transform:"translate(".concat(y,", ").concat(b,") ").concat(_)}],q(q({fill:"both"},e),{duration:l+c+u})),M=t.animate([{opacity:0,transform:"translate(".concat(-y,", ").concat(-b,") ").concat(C),offset:.01},{opacity:E,transform:"translate(0, 0) ".concat(C)}],q(q({fill:"both"},e),{duration:c+u,delay:l+c-u}));return Hs(M,i),[k,M]}function lr(r,t,e){var n={},i={};return Object.entries(t).forEach(function(a){var s=N(a,2),o=s[0],l=s[1];if(!ot(l)){var c=r.style[o]||r.parsedStyle[o]||0;c!==l&&(n[o]=c,i[o]=l)}}),e?ZP(r,[n,i],q({fill:"both"},e)):(KP(r,i),null)}function id(r,t){return r.style.opacity||(r.style.opacity=1),lr(r,{opacity:0},t)}var JP={fill:"#fff",lineWidth:1,radius:2,size:10,stroke:"#bfbfbf",strokeOpacity:1,zIndex:0},QP={fill:"#000",fillOpacity:.45,fontSize:12,textAlign:"center",textBaseline:"middle",zIndex:1},tN={x:0,y:0,orientation:"horizontal",showLabel:!0,type:"start"},mr=fr({foreground:"foreground",handle:"handle",selection:"selection",sparkline:"sparkline",sparklineGroup:"sparkline-group",track:"track",brushArea:"brush-area"},"slider"),Ci=fr({labelGroup:"label-group",label:"label",iconGroup:"icon-group",icon:"icon",iconRect:"icon-rect",iconLine:"icon-line"},"handle"),QJ=function(r){wt(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,c=l===void 0?o/4:l,u=e.orientation,h=fe(e,["x","y","size","radius","orientation"]),d=o,f=d*2.4,g=st(n).maybeAppendByClassName(Ci.iconRect,"rect").styles(q(q({},h),{width:d,height:f,radius:c,x:i-d/2,y:a-f/2,transformOrigin:"center"})),v=i+1/3*d-d/2,p=i+2/3*d-d/2,m=a+1/4*f-f/2,y=a+3/4*f-f/2;g.maybeAppendByClassName("".concat(Ci.iconLine,"-1"),"line").styles(q({x1:v,x2:v,y1:m,y2:y},h)),g.maybeAppendByClassName("".concat(Ci.iconLine,"-2"),"line").styles(q({x1:p,x2:p,y1:m,y2:y},h)),u==="vertical"&&(g.node().style.transform="rotate(90)")},t}(ge),tQ=function(r){wt(t,r);function t(e){return r.call(this,e,tN)||this}return t.prototype.renderLabel=function(e){var n=this,i=this.attributes,a=i.x,s=i.y,o=i.showLabel,l=ht(this.attributes,"label"),c=l.x,u=c===void 0?0:c,h=l.y,d=h===void 0?0:h,f=l.transform,g=l.transformOrigin,v=fe(l,["x","y","transform","transformOrigin"]),p=N(oi(v,[]),2),m=p[0],y=p[1],b=st(e).maybeAppendByClassName(Ci.labelGroup,"g").styles(y),w=q(q({},QP),m),x=w.text,S=fe(w,["text"]);Rn(!!o,b,function(E){n.label=E.maybeAppendByClassName(Ci.label,"text").styles(q(q({},S),{x:a+u,y:s+d,transform:f,transformOrigin:g,text:"".concat(x)})),n.label.on("mousedown",function(_){_.stopPropagation()}),n.label.on("touchstart",function(_){_.stopPropagation()})})},t.prototype.renderIcon=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.orientation,o=n.type,l=q(q({x:i,y:a,orientation:s},JP),ht(this.attributes,"icon")),c=this.attributes.iconShape,u=c===void 0?function(){return new QJ({style:l})}:c,h=st(e).maybeAppendByClassName(Ci.iconGroup,"g");h.selectAll(Ci.icon.class).data([u]).join(function(d){return d.append(typeof u=="string"?u:function(){return u(o)}).attr("className",Ci.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}(ge),eQ=function(r){wt(t,r);function t(e){var n=r.call(this,e,q(q(q({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},vs(tN,"handle")),vs(JP,"handleIcon")),vs(QP,"handleLabel")))||this;return n.range=[0,1],n.onDragStart=function(i){return function(a){a.stopPropagation(),n.target=i,n.prevPos=n.getOrientVal(fk(a));var s=n.availableSpace,o=s.x,l=s.y,c=n.getBBox(),u=c.x,h=c.y;n.selectionStartPos=n.getRatio(n.prevPos-n.getOrientVal([o,l])-n.getOrientVal([+u,+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 c=n.getOrientVal(fk(i)),u=c-n.prevPos;if(u){var h=n.getRatio(u);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=c}},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],c=o==="range"?n.getValues():n.getValues()[1],u=new we("valuechange",{detail:{oldValue:l,value:c}});n.dispatchEvent(u),s==null||s(c)},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=ht(this.attributes,"sparkline");return q(q({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=N(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=N(Ve(n),4),a=i[0],s=i[1],o=i[2],l=i[3],c=this.shape,u=c.width,h=c.height;return{x:l,y:a,width:u-(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(mr.selection.class).each(function(i,a){lr(this,n[a],e)})},t.prototype.updateHandlesPosition=function(e){this.attributes.showHandle&&(this.startHandle&&lr(this.startHandle,this.getHandleStyle("start"),e),this.endHandle&&lr(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=ht(this.attributes,"track");this.trackShape=st(e).maybeAppendByClassName(mr.track,"rect").styles(q(q({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=st(e).maybeAppendByClassName(mr.brushArea,"rect").styles(q({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=st(e).maybeAppendByClassName(mr.sparklineGroup,"g");Rn(o==="horizontal",l,function(c){var u=q(q({},n.sparklineStyle),{x:a,y:s});c.maybeAppendByClassName(mr.sparkline,function(){return new YJ({style:u})}).update(u)})},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:[],c=this;(n=this.foregroundGroup)===null||n===void 0||n.selectAll(mr.handle.class).data(l.map(function(u){return{type:u}}),function(u){return u.type}).join(function(u){return u.append(function(h){var d=h.type;return new tQ({style:e.getHandleStyle(d)})}).each(function(h){var d=h.type;this.attr("class","".concat(mr.handle.name," ").concat(d,"-handle"));var f="".concat(d,"Handle");c[f]=this,this.addEventListener("pointerdown",c.onDragStart(d))})},function(u){return u.each(function(h){var d=h.type;this.update(c.getHandleStyle(d))})},function(u){return u.each(function(h){var d=h.type,f="".concat(d,"Handle");c[f]=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=st(e).maybeAppendByClassName(mr.foreground,"g");var l=ht(this.attributes,"selection"),c=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(q(q({},l),{transform:"translate(".concat(i,", ").concat(a,")")}))},u=this;this.foregroundGroup.selectAll(mr.selection.class).data(s==="value"?[]:this.calcSelectionArea().map(function(h,d){return{style:q({},h),index:d,show:o==="select"?d===1:d!==1}}),function(h){return h.index}).join(function(h){return h.append("rect").attr("className",mr.selection.name).call(c).each(function(d,f){var g=this;f===1?(u.selectionShape=st(this),this.on("pointerdown",function(v){g.attr("cursor","grabbing"),u.onDragStart("selection")(v)}),u.dispatchCustomEvent(this,"pointerenter","selectionMouseenter"),u.dispatchCustomEvent(this,"pointerleave","selectionMouseleave"),u.dispatchCustomEvent(this,"click","selectionClick"),this.addEventListener("pointerdown",function(){g.attr("cursor","grabbing")}),this.addEventListener("pointerup",function(){g.attr("cursor","pointer")}),this.addEventListener("pointerover",function(){g.attr("cursor","pointer")})):this.on("pointerdown",u.onDragStart("track"))})},function(h){return h.call(c)},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=N(this.range,2),s=a[0],o=a[1],l=N(this.getValues().map(function(p){return gk(p,n)}),2),c=l[0],u=l[1],h=Array.isArray(e)?e:[c,e??u],d=N((h||[c,u]).map(function(p){return gk(p,n)}),2),f=d[0],g=d[1];if(this.attributes.type==="value")return[0,ce(g,s,o)];f>g&&(i=N([g,f],2),f=i[0],g=i[1]);var v=g-f;return v>o-s?[s,o]:f<s?c===s&&u===g?[s,g]:[s,v+s]:g>o?u===o&&c===f?[f,o]:[o-v,o]:[f,g]},t.prototype.calcSelectionArea=function(e){var n=N(this.clampValues(e),2),i=n[0],a=n[1],s=this.availableSpace,o=s.x,l=s.y,c=s.width,u=s.height;return this.getOrientVal([[{y:l,height:u,x:o,width:i*c},{y:l,height:u,x:i*c+o,width:(a-i)*c},{y:l,height:u,x:a*c,width:(1-a)*c}],[{x:o,width:c,y:l,height:i*u},{x:o,width:c,y:i*u+l,height:(a-i)*u},{x:o,width:c,y:a*u,height:(1-a)*u}]])},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,c=N(this.clampValues(),2),u=c[0],h=c[1],d=e==="start"?-n:n,f=(e==="start"?u:h)*this.getOrientVal([o,l])+d;return{x:a+this.getOrientVal([f,o/2]),y:s+this.getOrientVal([l/2,f])}},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,c=ht(this.attributes,"handle"),u=ht(c,"label"),h=c.spacing,d=this.getHandleSize(),f=this.clampValues(),g=e==="start"?f[0]:f[1],v=o(g),p=new f2({style:q(q(q({},u),this.inferTextStyle(e)),{text:v})}),m=p.getBBox(),y=m.width,b=m.height;if(p.destroy(),!l){if(a==="value")return{text:v,x:0,y:-b-h};var w=h+d+(s==="horizontal"?y/2:0);return n={text:v},n[s==="horizontal"?"x":"y"]=e==="start"?-w:w,n}var x=0,S=0,E=this.availableSpace,_=E.width,C=E.height,k=this.calcSelectionArea()[1],M=k.x,T=k.y,O=k.width,R=k.height,D=h+d;if(s==="horizontal"){var L=D+y/2;if(e==="start"){var P=M-D-y;x=P>0?-L:L}else{var A=_-M-O-D>y;x=A?L:-L}}else{var I=D,B=b+D;e==="start"?S=T-d>b?-B:I:S=C-(T+R)-d>b?B:-I}return{x,y:S,text:v}},t.prototype.getHandleLabelStyle=function(e){var n=ht(this.attributes,"handleLabel");return q(q(q({},n),this.calcHandleText(e)),this.inferTextStyle(e))},t.prototype.getHandleIconStyle=function(){var e=this.attributes.handleIconShape,n=ht(this.attributes,"handleIcon"),i=this.getOrientVal(["ew-resize","ns-resize"]),a=this.getHandleSize();return q({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,c=this.calcHandlePosition(e),u=c.x,h=c.y,d=this.calcHandleText(e),f=s;return!s&&o&&(this.target?f=!0:f=!1),q(q(q({},vs(this.getHandleIconStyle(),"icon")),vs(q(q({},this.getHandleLabelStyle(e)),d),"label")),{transform:"translate(".concat(u+i,", ").concat(h+a,")"),orientation:l,showLabel:f,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=N(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=N(this.getValues(),2),o=s[0],l=s[1],c=a==="range"?e:0,u=[o+c,l+n].sort();i?this.setValues(u):this.innerSetValues(u,!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 we(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}(ge),x2={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 Tn({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:[]};on({},x2,{style:{type:"arc"}});on({},x2,{style:{}});var zt=fr({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"),Ls=fr({lineGroup:"line-group",line:"line",regionGroup:"region-group",region:"region"},"grid");function eN(r){return r.reduce(function(t,e,n){return t.push(Q([n===0?"M":"L"],N(e),!1)),t},[])}function nQ(r,t,e){var n=t.connect,i=n===void 0?"line":n,a=t.center;if(i==="line")return eN(r);if(!a)return[];var s=Vo(r[0],a),o=e?0:1;return r.reduce(function(l,c,u){return u===0?l.push(Q(["M"],N(c),!1)):l.push(Q(["A",s,s,0,0,o],N(c),!1)),l},[])}function Fy(r,t,e){return t.type==="surround"?nQ(r,t,e):eN(r)}function rQ(r,t,e){var n=e.type,i=e.connect,a=e.center,s=e.closed,o=s?[["Z"]]:[],l=N([Fy(r,e),Fy(t.slice().reverse(),e,!0)],2),c=l[0],u=l[1],h=N([r[0],t.slice(-1)[0]],2),d=h[0],f=h[1],g=function(y,b){return[c,y,u,b,o].flat()};if(i==="line"||n==="surround")return g([Q(["L"],N(f),!1)],[Q(["L"],N(d),!1)]);if(!a)throw new Error("Arc grid need to specified center");var v=N([Vo(f,a),Vo(d,a)],2),p=v[0],m=v[1];return g([Q(["A",p,p,0,0,1],N(f),!1),Q(["L"],N(f),!1)],[Q(["A",m,m,0,0,0],N(d),!1),Q(["L"],N(d),!1)])}function iQ(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:Fy(o.points,e)}});return r.selectAll(Ls.line.class).data(s,function(o){return o.id}).join(function(o){return o.append("path").each(function(l,c){var u=Un(pk(q({d:l.d},n)),[l,c,s]);this.attr(q({class:Ls.line.name,stroke:"#D9D9D9",lineWidth:1,lineDash:[4,4],isBillboard:a},u))})},function(o){return o.transition(function(l,c){var u=Un(pk(q({d:l.d},n)),[l,c,s]);return lr(this,u,i.update)})},function(o){return o.transition(function(){var l=this,c=id(this,i.exit);return Hs(c,function(){return l.remove()}),c})}).transitions()}function aQ(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(g){return s[g%s.length]},l=[],c=0;c<t.length-1;c++){var u=N([t[c].points,t[c+1].points],2),h=u[0],d=u[1],f=rQ(h,d,e);l.push({d:f,fill:o(c)})}return r.selectAll(Ls.region.class).data(l,function(g,v){return v}).join(function(g){return g.append("path").each(function(v,p){var m=Un(v,[v,p,l]);this.attr(m)}).attr("className",Ls.region.name)},function(g){return g.transition(function(v,p){var m=Un(v,[v,p,l]);return lr(this,m,n.update)})},function(g){return g.transition(function(){var v=this,p=id(this,n.exit);return Hs(p,function(){return v.remove()}),p})}).transitions()}function sQ(r){var t=r.data,e=t===void 0?[]:t,n=r.closed;return n?e.map(function(i){var a=i.points,s=N(a,1),o=s[0];return q(q({},i),{points:Q(Q([],N(a),!1),[o],!1)})}):e}var oQ=function(r){wt(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=fe(e,["type","center","areaFill","closed"]),a=sQ(e),s=st(n).maybeAppendByClassName(Ls.lineGroup,"g"),o=st(n).maybeAppendByClassName(Ls.regionGroup,"g"),l=iQ(s,a,e,i),c=aQ(o,a,e);return Q(Q([],N(l),!1),N(c),!1)},t}(ge);function nN(r,t){return Object.fromEntries(Object.entries(r).map(function(e){var n=N(e,2),i=n[0],a=n[1];return[i,Un(a,t)]}))}function E2(r,t){return t&&at(t)?r.filter(t):r}function rN(r,t){var e=t.startAngle,n=t.endAngle;return(n-e)*r+e}function ad(r,t){if(t.type==="linear"){var e=N(t.startPos,2),n=e[0],i=e[1],a=N(t.endPos,2),s=a[0],o=a[1],l=N([s-n,o-i],2),c=l[0],u=l[1];return $P([c,u])}var h=Rs(rN(r,t));return[-Math.sin(h),Math.cos(h)]}function S2(r,t,e){var n=ad(r,e);return PZ(n,t!=="positive")}function wl(r,t){return S2(r,t.labelDirection,t)}function lQ(r,t){var e=N(t.startPos,2),n=e[0],i=e[1],a=N(t.endPos,2),s=a[0],o=a[1],l=N([s-n,o-i],2),c=l[0],u=l[1];return[n+c*r,i+u*r]}function cQ(r,t){var e=t.radius,n=N(t.center,2),i=n[0],a=n[1],s=Rs(rN(r,t));return[i+e*Math.cos(s),a+e*Math.sin(s)]}function sd(r,t){return t.type==="linear"?lQ(r,t):cQ(r,t)}function iN(r){return ad(0,r)[1]===0}function aN(r){return ad(0,r)[0]===0}function sN(r,t){return t-r===360}function Dk(r,t,e,n,i){var a=t-r,s=N([i,i],2),o=s[0],l=s[1],c=N([Rs(r),Rs(t)],2),u=c[0],h=c[1],d=function(C){return[e+i*Math.cos(C),n+i*Math.sin(C)]},f=N(d(u),2),g=f[0],v=f[1],p=N(d(h),2),m=p[0],y=p[1];if(sN(r,t)){var b=(h+u)/2,w=N(d(b),2),x=w[0],S=w[1];return[["M",g,v],["A",o,l,0,1,0,x,S],["A",o,l,0,1,0,m,y]]}var E=a>180?1:0,_=r>t?0:1;return"M".concat(g,",").concat(v,",A").concat(o,",").concat(l,",0,").concat(E,",").concat(_,",").concat(m,",").concat(y)}function uQ(r){var t=r.attributes,e=t.startAngle,n=t.endAngle,i=t.center,a=t.radius;return Q(Q([e,n],N(i),!1),[a],!1)}function hQ(r,t,e,n){var i=t.startAngle,a=t.endAngle,s=t.center,o=t.radius;return r.selectAll(zt.line.class).data([{d:Dk.apply(void 0,Q(Q([i,a],N(s),!1),[o],!1))}],function(l,c){return c}).join(function(l){return l.append("path").attr("className",zt.line.name).styles(t).styles({d:function(c){return c.d}})},function(l){return l.transition(function(){var c=this,u=AZ(this,uQ(this),Q(Q([i,a],N(s),!1),[o],!1),n.update);if(u){var h=function(){var d=nn(c.attributes,"__keyframe_data__");c.style.d=Dk.apply(void 0,Q([],N(d),!1))};u.onframe=h,u.onfinish=h}return u}).styles(t)},function(l){return l.remove()}).styles(e).transitions()}function dQ(r,t){t.truncRange,t.truncShape,t.lineExtension}function fQ(r,t,e){e===void 0&&(e=[0,0]);var n=N([r,t,e],3),i=N(n[0],2),a=i[0],s=i[1],o=N(n[1],2),l=o[0],c=o[1],u=N(n[2],2),h=u[0],d=u[1],f=N([l-a,c-s],2),g=f[0],v=f[1],p=Math.sqrt(Math.pow(g,2)+Math.pow(v,2)),m=N([-h/p,d/p],2),y=m[0],b=m[1];return[y*g,y*v,b*g,b*v]}function Ik(r){var t=N(r,2),e=N(t[0],2),n=e[0],i=e[1],a=N(t[1],2),s=a[0],o=a[1];return{x1:n,y1:i,x2:s,y2:o}}function gQ(r,t,e,n){var i=t.showTrunc,a=t.startPos,s=t.endPos,o=t.truncRange,l=t.lineExtension,c=N([a,s],2),u=N(c[0],2),h=u[0],d=u[1],f=N(c[1],2),g=f[0],v=f[1],p=N(l?fQ(a,s,l):new Array(4).fill(0),4),m=p[0],y=p[1],b=p[2],w=p[3],x=function(A){return r.selectAll(zt.line.class).data(A,function(I,B){return B}).join(function(I){return I.append("line").attr("className",function(B){return"".concat(zt.line.name," ").concat(B.className)}).styles(e).transition(function(B){return lr(this,Ik(B.line),!1)})},function(I){return I.styles(e).transition(function(B){var j=B.line;return lr(this,Ik(j),n.update)})},function(I){return I.remove()}).transitions()};if(!i||!o)return x([{line:[[h+m,d+y],[g+b,v+w]],className:zt.line.name}]);var S=N(o,2),E=S[0],_=S[1],C=g-h,k=v-d,M=N([h+C*E,d+k*E],2),T=M[0],O=M[1],R=N([h+C*_,d+k*_],2),D=R[0],L=R[1],P=x([{line:[[h+m,d+y],[T,O]],className:zt.lineFirst.name},{line:[[D,L],[g+b,v+w]],className:zt.lineSecond.name}]);return dQ(r,t),P}function vQ(r,t,e,n){var i=e.showArrow,a=e.showTrunc,s=e.lineArrow,o=e.lineArrowOffset,l=e.lineArrowSize,c;if(t==="arc"?c=r.select(zt.line.class):a?c=r.select(zt.lineSecond.class):c=r.select(zt.line.class),!i||!s||e.type==="arc"&&sN(e.startAngle,e.endAngle)){var u=c.node();u&&(u.style.markerEnd=void 0);return}var h=si(s);h.attr(n),v2(h,l),c.style("markerEnd",h).style("markerEndOffset",-o)}function pQ(r,t,e){var n=t.type,i,a=ht(t,"line");return n==="linear"?i=gQ(r,t,vk(a,"arrow"),e):i=hQ(r,t,vk(a,"arrow"),e),vQ(r,n,t,a),i}function mQ(r,t){return S2(r,t.gridDirection,t)}function oN(r){var t=r.type,e=r.gridCenter;return t==="linear"?e:e||r.center}function yQ(r,t){var e=t.gridLength;return r.map(function(n,i){var a=n.value,s=N(sd(a,t),2),o=s[0],l=s[1],c=N(Hr(mQ(a,t),e),2),u=c[0],h=c[1];return{id:i,points:[[o,l],[o+u,l+h]]}})}function bQ(r,t){var e=t.gridControlAngles,n=oN(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=N(n,2),a=i[0],s=i[1];return r.map(function(o,l){var c=o.value,u=N(sd(c,t),2),h=u[0],d=u[1],f=N([h-a,d-s],2),g=f[0],v=f[1],p=[];return e.forEach(function(m){var y=Rs(m),b=N([Math.cos(y),Math.sin(y)],2),w=b[0],x=b[1],S=g*w-v*x+a,E=g*x+v*w+s;p.push([S,E])}),{points:p,id:l}})}function wQ(r,t,e,n){var i=ht(e,"grid"),a=i.type,s=i.areaFill,o=oN(e),l=E2(t,e.gridFilter),c=a==="segment"?yQ(l,e):bQ(l,e),u=q(q({},i),{center:o,areaFill:at(s)?l.map(function(h,d){return Un(s,[h,d,l])}):s,animate:n,data:c});return r.selectAll(zt.grid.class).data([1]).join(function(h){return h.append(function(){return new oQ({style:u})}).attr("className",zt.grid.name)},function(h){return h.transition(function(){return this.update(u)})},function(h){return h.remove()}).transitions()}var By=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,c=Math.cos(t),u=Math.sin(t),h=e-e*c+n*u,d=n-e*u-n*c,f=[[c*a-u*l+h,u*a+c*l+d],[c*o-u*l+h,u*o+c*l+d],[c*a-u*s+h,u*a+c*s+d],[c*o-u*s+h,u*o+c*s+d]];return f},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 zy(r,t){var e=r.getEulerAngles()||0;r.setEulerAngles(0);var n=r.getBounds(),i=N(n.min,2),a=i[0],s=i[1],o=N(n.max,2),l=o[0],c=o[1],u=r.getBBox(),h=u.width,d=u.height,f=d,g=0,v=0,p=a,m=s,y=BP(r);if(y){f-=1.5;var b=y.style.textAlign,w=y.style.textBaseline;b==="center"?p=(a+l)/2:(b==="right"||b==="end")&&(p=l),w==="middle"?m=(s+c)/2:w==="bottom"&&(m=c)}var x=N(Ve(t),4),S=x[0],E=S===void 0?0:S,_=x[1],C=_===void 0?0:_,k=x[2],M=k===void 0?E:k,T=x[3],O=T===void 0?C:T,R=new By((g+=a)-O,(v+=s)-E,g+h+C,v+f+M);return r.setEulerAngles(e),R.rotatedPoints(Rs(e),p,m)}function wo(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 xo(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 xQ(r,t){var e=xo(r[0],r[1],t[0]),n=xo(r[0],r[1],t[1]),i=xo(t[0],t[1],r[0]),a=xo(t[0],t[1],r[1]);return!!(e!==n&&i!==a||e===0&&wo(r,t[0])||n===0&&wo(r,t[1])||i===0&&wo(t,r[0])||a===0&&wo(t,r[1]))}function EQ(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(xQ(s,n)){if(xo(s[0],t,s[1])===0)return wo(s,t);i++}a=(a+1)%e}while(a!==0);return!!(i&1)}function SQ(r,t){return t.every(function(e){return EQ(r,e)})}function _Q(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=zy(t,e);return SQ(o,l)}function kQ(r,t){var e=N(r,4),n=e[0],i=e[1],a=e[2],s=e[3],o=N(t,4),l=o[0],c=o[1],u=o[2],h=o[3],d=a-n,f=s-i,g=u-l,v=h-c,p=d*v-g*f;if(p===0)return!1;var m=p>0,y=n-l,b=i-c,w=d*b-f*y;if(w<0===m)return!1;var x=g*b-v*y;return!(x<0===m||w>p===m||x>p===m)}function MQ(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 kQ(t,n)})}function CQ(r,t,e){var n,i,a=zy(r,e).flat(1),s=zy(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=Jo(o),c=l.next();!c.done;c=l.next()){var u=c.value;if(MQ(s,u))return!0}}catch(h){n={error:h}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}return!1}function TQ(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=N(a,2),l=o[0],c=o[1],u=n==="negative"?0:i,h=-s-u,d=s+u,f=N(Ve(t),4),g=f[0],v=f[1],p=f[2],m=f[3];return new By(l+h-m,c+h-g,l+d+v,c+d+p)}var y=N(r.startPos,2),b=y[0],w=y[1],x=N(r.endPos,2),S=x[0],E=x[1],_=N(aN(r)?[-t,0,t,0]:[0,t,0,-t],4),C=_[0],k=_[1],M=_[2],T=_[3],O=wl(0,r),R=Hr(O,i),D=new By(b,w,S,E);return D.x1+=T,D.y1+=C,D.x2+=k+R[0],D.y2+=M+R[1],D}function od(r,t,e){var n,i,a=t.crossPadding,s=new Set,o=null,l=TQ(t,a),c=function(g){return l?_Q(l,g):!0},u=function(g,v){return!g||!g.firstChild?!0:!CQ(g.firstChild,v.firstChild,Ve(e))};try{for(var h=Jo(r),d=h.next();!d.done;d=h.next()){var f=d.value;c(f)?!o||u(o,f)?o=f:(s.add(o),s.add(f)):s.add(f)}}catch(g){n={error:g}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return Array.from(s)}function bm(r,t){return t===void 0&&(t={}),ot(r)?0:typeof r=="number"?r:Math.floor(_Z(r,t))}function OQ(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,c=t.step,u=c===void 0?" ":c,h=t.margin,d=h===void 0?[0,0,0,0]:h,f=FP(n.getTextShape(r[0])),g=bm(u,f),v=s?bm(s,f):g,p=bm(l,f);(ot(p)||p===1/0)&&(p=Math.max.apply(null,r.map(function(S){return S.getBBox().width})));var m=r.slice(),y=N(d,4);y[0],y[1],y[2],y[3];for(var b=function(S){if(m.forEach(function(E){n.ellipsis(n.getTextShape(E),S,a)}),m=od(r,e,d),m.length<1)return{value:void 0}},w=p;w>v+g;w-=g){var x=b(w);if(typeof x=="object")return x.value}}}var AQ={parity:function(r,t){var e=t.seq,n=e===void 0?2:e;return r.filter(function(i,a){return a%n?(or(i),!1):!0})}},PQ=function(r){return r.filter(IP)};function NQ(r,t,e,n){var i=r.length,a=t.keepHeader,s=t.keepTail;if(!(i<=1||i===2&&a&&s)){var o=AQ.parity,l=function(b){return b.forEach(n.show),b},c=2,u=r.slice(),h=r.slice(),d=Math.min.apply(Math,Q([1],N(r.map(function(b){return b.getBBox().width})),!1));if(e.type==="linear"&&(iN(e)||aN(e))){var f=mk(r[0]).left,g=mk(r[i-1]).right,v=Math.abs(g-f)||1;c=Math.max(Math.floor(i*d/v),c)}var p,m;for(a&&(p=u.splice(0,1)[0]),s&&(m=u.splice(-1,1)[0],u.reverse()),l(u);c<r.length&&od(PQ(m?Q(Q([m],N(h),!1),[p],!1):Q([p],N(h),!1)),e,t==null?void 0:t.margin).length;){if(m&&!p&&c%2===0){var y=u.splice(0,1);y.forEach(n.hide)}else if(m&&p){var y=u.splice(0,1);y.forEach(n.hide)}h=o(l(u),{seq:c}),c++}}}function RQ(r,t,e,n){var i,a,s=t.optionalAngles,o=s===void 0?[0,45,90]:s,l=t.margin,c=t.recoverWhenFailed,u=c===void 0?!0:c,h=r.map(function(m){return m.getLocalEulerAngles()}),d=function(){return od(r,e,l).length<1},f=function(m){return r.forEach(function(y,b){var w=Array.isArray(m)?m[b]:m;n.rotate(y,+w)})};try{for(var g=Jo(o),v=g.next();!v.done;v=g.next()){var p=v.value;if(f(p),d())return}}catch(m){i={error:m}}finally{try{v&&!v.done&&(a=g.return)&&a.call(g)}finally{if(i)throw i.error}}u&&f(h)}function LQ(r){var t=r.type,e=r.labelDirection;return t==="linear"&&iN(r)?e==="negative"?"bottom":"top":"middle"}function DQ(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,c=l===void 0?!0:l,u=t.margin,h=u===void 0?[0,0,0,0]:u,d=r.map(function(y){return y.attr("maxLines")||1}),f=Math.min.apply(Math,Q([],N(d),!1)),g=function(){return od(r,e,h).length<1},v=LQ(e),p=function(y){return r.forEach(function(b,w){var x=Array.isArray(y)?y[w]:y;n.wrap(b,a,x,v)})};if(!(f>o)){for(var m=f;m<=o;m++)if(p(m),g())return;c&&p(d)}}var IQ=new Map([["hide",NQ],["rotate",RQ],["ellipsis",OQ],["wrap",DQ]]);function FQ(r,t,e){return t.labelOverlap.length<1?!1:e==="hide"?!EZ(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 BQ(r,t,e){var n=t.labelOverlap,i=n===void 0?[]:n;i.length&&i.forEach(function(a){var s=a.type,o=IQ.get(s);FQ(r,t,s)&&(o==null||o(r,a,t,e))})}function zQ(){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 Fk(r){for(var t=r;t<0;)t+=360;return Math.round(t%360)}function $y(r,t){var e=N(r,2),n=e[0],i=e[1],a=N(t,2),s=a[0],o=a[1],l=N([n*s+i*o,n*o-i*s],2),c=l[0],u=l[1];return Math.atan2(u,c)}function $Q(r){var t=(r+360)%180;return je(t,-90,90)||(t+=180),t}function jQ(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=wl(r.value,e),l=ad(r.value,e);return i==="horizontal"?0:(i==="perpendicular"?s=$y([1,0],o):s=$y([l[0]<0?-1:1,0],l),$Q(LP(s)))}function lN(r,t,e){var n=e.type,i=e.labelAlign,a=wl(r,e),s=Fk(t),o=Fk(LP($y([1,0],a))),l="center",c="middle";return n==="linear"?[90,270].includes(o)&&s===0?(l="center",c=a[1]===1?"top":"bottom"):!(o%180)&&[90,270].includes(s)?l="center":o===0?(je(s,0,90,!1,!0)||je(s,0,90)||je(s,270,360))&&(l="start"):o===90?je(s,0,90,!1,!0)?l="start":(je(s,90,180)||je(s,270,360))&&(l="end"):o===270?je(s,0,90,!1,!0)?l="end":(je(s,90,180)||je(s,270,360))&&(l="start"):o===180&&(s===90?l="start":(je(s,0,90)||je(s,270,360))&&(l="end")):i==="parallel"?je(o,0,180,!0)?c="top":c="bottom":i==="horizontal"?je(o,90,270,!1)?l="end":(je(o,270,360,!1)||je(o,0,90))&&(l="start"):i==="perpendicular"&&(je(o,90,270)?l="end":l="start"),{textAlign:l,textBaseline:c}}function qQ(r,t,e){t.setLocalEulerAngles(r);var n=t.__data__.value,i=lN(n,r,e),a=t.querySelector(zt.labelItem.class);a&&cN(a,i)}function Bk(r,t,e){var n=e.showTick,i=e.tickLength,a=e.tickDirection,s=e.labelDirection,o=e.labelSpacing,l=t.indexOf(r),c=Un(o,[r,l,t]),u=N([wl(r.value,e),zQ(s,a)],2),h=u[0],d=u[1],f=d===1?Un(n?i:0,[r,l,t]):0,g=N(bo(Hr(h,c+f),sd(r.value,e)),2),v=g[0],p=g[1];return{x:v,y:p}}function GQ(r,t,e,n){var i=n.labelFormatter,a=at(i)?function(){return si(Un(i,[r,t,e,wl(r.value,n)]))}:function(){return si(r.label||"")};return a}function cN(r,t){r.nodeName==="text"&&r.attr(t)}function zk(r){BQ(this.node().childNodes,r,{hide:or,show:yl,rotate:function(t,e){qQ(+e,t,r)},ellipsis:function(t,e,n){t&&Dy(t,e||1/0,n)},wrap:function(t,e,n){t&&kZ(t,e,n)},getTextShape:function(t){return t.querySelector("text")}})}function $k(r,t,e,n,i){var a=e.indexOf(t),s=st(r).append(GQ(t,a,e,i)).attr("className",zt.labelItem.name).node(),o=N(oi(nN(n,[t,a,e])),2),l=o[0],c=o[1],u=c.transform,h=fe(c,["transform"]);jP(s,u);var d=jQ(t,s,i);return s.getLocalEulerAngles()||s.setLocalEulerAngles(d),cN(s,q(q({},lN(t.value,d,i)),l)),r.attr(h),s}function WQ(r,t,e,n){var i=E2(t,e.labelFilter),a=ht(e,"label");return r.selectAll(zt.label.class).data(i,function(s,o){return o}).join(function(s){return s.append("g").attr("className",zt.label.name).transition(function(o){$k(this,o,t,a,e);var l=Bk(o,t,e),c=l.x,u=l.y;return this.style.transform="translate(".concat(c,", ").concat(u,")"),null}).call(function(){zk.call(r,e)})},function(s){return s.transition(function(o){var l=this.querySelector(zt.labelItem.class),c=$k(this,o,t,a,e),u=JJ(l,c,n.update),h=Bk(o,t,e),d=h.x,f=h.y,g=lr(this,{transform:"translate(".concat(d,", ").concat(f,")")},n.update);return Q(Q([],N(u),!1),[g],!1)}).call(function(o){var l=nn(o,"_transitions").flat().filter(IP);KJ(l,function(){zk.call(r,e)})})},function(s){return s.transition(function(){var o=this,l=id(this.childNodes[0],n.exit);return Hs(l,function(){return st(o).remove()}),l})}).transitions()}function uN(r,t){return S2(r,t.tickDirection,t)}function VQ(r,t){var e=N(r,2),n=e[0],i=e[1];return[[0,0],[n*t,i*t]]}function HQ(r,t,e,n,i){var a=i.tickLength,s=N(VQ(n,Un(a,[r,t,e])),2),o=N(s[0],2),l=o[0],c=o[1],u=N(s[1],2),h=u[0],d=u[1];return{x1:l,x2:h,y1:c,y2:d}}function UQ(r,t,e,n,i){var a=i.tickFormatter,s=uN(t.value,i),o="line";return at(a)&&(o=function(){return Un(a,[t,e,n,s])}),r.append(o).attr("className",zt.tickItem.name)}function YQ(r,t,e,n,i,a,s){var o=uN(r.value,a),l=HQ(r,t,e,o,a),c=l.x1,u=l.x2,h=l.y1,d=l.y2,f=N(oi(nN(s,[r,t,e,o])),2),g=f[0],v=f[1];n.node().nodeName==="line"&&n.styles(q({x1:c,x2:u,y1:h,y2:d},g)),i.attr(v),n.styles(g)}function jk(r,t,e,n,i,a){var s=UQ(st(this),r,t,e,n);YQ(r,t,e,s,this,n,i);var o=N(sd(r.value,n),2),l=o[0],c=o[1];return lr(this,{transform:"translate(".concat(l,", ").concat(c,")")},a)}function XQ(r,t,e,n){var i=E2(t,e.tickFilter),a=ht(e,"tick");return r.selectAll(zt.tick.class).data(i,function(s){return s.id||s.label}).join(function(s){return s.append("g").attr("className",zt.tick.name).transition(function(o,l){return jk.call(this,o,l,i,e,a,!1)})},function(s){return s.transition(function(o,l){return this.removeChildren(),jk.call(this,o,l,i,e,a,n.update)})},function(s){return s.transition(function(){var o=this,l=id(this.childNodes[0],n.exit);return Hs(l,function(){return o.remove()}),l})}).transitions()}var qk=fr({text:"text"},"title");function ld(r){return/\S+-\S+/g.test(r)?r.split("-").map(function(t){return t[0]}):r.length>2?[r[0]]:r.split("")}function KQ(r,t){var e=r.attributes,n=e.position,i=e.spacing,a=e.inset,s=e.text,o=r.getBBox(),l=t.getBBox(),c=ld(n),u=N(Ve(s?i:0),4),h=u[0],d=u[1],f=u[2],g=u[3],v=N(Ve(a),4),p=v[0],m=v[1],y=v[2],b=v[3],w=N([g+d,h+f],2),x=w[0],S=w[1],E=N([b+m,p+y],2),_=E[0],C=E[1];if(c[0]==="l")return new sn(o.x,o.y,l.width+o.width+x+_,Math.max(l.height+C,o.height));if(c[0]==="t")return new sn(o.x,o.y,Math.max(l.width+_,o.width),l.height+o.height+S+C);var k=N([t.attributes.width||l.width,t.attributes.height||l.height],2),M=k[0],T=k[1];return new sn(l.x,l.y,M+o.width+x+_,T+o.height+S+C)}function ZQ(r,t){var e=Object.entries(t).reduce(function(n,i){var a=N(i,2),s=a[0],o=a[1],l=r.node().attr(s);return l||(n[s]=o),n},{});r.styles(e)}function JQ(r){var t,e,n,i,a=r,s=a.width,o=a.height,l=a.position,c=N([+s/2,+o/2],2),u=c[0],h=c[1],d=N([+u,+h,"center","middle"],4),f=d[0],g=d[1],v=d[2],p=d[3],m=ld(l);return m.includes("l")&&(t=N([0,"start"],2),f=t[0],v=t[1]),m.includes("r")&&(e=N([+s,"end"],2),f=e[0],v=e[1]),m.includes("t")&&(n=N([0,"top"],2),g=n[0],p=n[1]),m.includes("b")&&(i=N([+o,"bottom"],2),g=i[0],p=i[1]),{x:f,y:g,textAlign:v,textBaseline:p}}var QQ=function(r){wt(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,c=e.querySelector(qk.text.class);if(!c)return new sn(0,0,+i,+a);var u=c.getBBox(),h=u.width,d=u.height,f=N(Ve(o),4),g=f[0],v=f[1],p=f[2],m=f[3],y=N([0,0,+i,+a],4),b=y[0],w=y[1],x=y[2],S=y[3],E=ld(s);if(E.includes("i"))return new sn(b,w,x,S);E.forEach(function(L,P){var A,I,B,j;L==="t"&&(A=N(P===0?[d+p,+a-d-p]:[0,+a],2),w=A[0],S=A[1]),L==="r"&&(I=N([+i-h-m],1),x=I[0]),L==="b"&&(B=N([+a-d-g],1),S=B[0]),L==="l"&&(j=N(P===0?[h+v,+i-h-v]:[0,+i],2),b=j[0],x=j[1])});var _=N(Ve(l),4),C=_[0],k=_[1],M=_[2],T=_[3],O=N([T+k,C+M],2),R=O[0],D=O[1];return new sn(b+T,w+C,x-R,S-D)},t.prototype.getBBox=function(){return this.title?this.title.getBBox():new sn(0,0,0,0)},t.prototype.render=function(e,n){var i=this;e.width,e.height,e.position,e.spacing;var a=fe(e,["width","height","position","spacing"]),s=N(oi(a),1),o=s[0],l=JQ(e),c=l.x,u=l.y,h=l.textAlign,d=l.textBaseline;Rn(!!a.text,st(n),function(f){i.title=f.maybeAppendByClassName(qk.text,"text").styles(o).call(ZQ,{x:c,y:u,textAlign:h,textBaseline:d}).node()})},t}(ge);function ttt(r,t,e){var n=e.titlePosition,i=n===void 0?"lb":n,a=e.titleSpacing,s=ld(i),o=r.node().getLocalBounds(),l=N(o.min,2),c=l[0],u=l[1],h=N(o.halfExtents,2),d=h[0],f=h[1],g=N(t.node().getLocalBounds().halfExtents,2),v=g[0],p=g[1],m=N([c+d,u+f],2),y=m[0],b=m[1],w=N(Ve(a),4),x=w[0],S=w[1],E=w[2],_=w[3];if(["start","end"].includes(i)&&e.type==="linear"){var C=e.startPos,k=e.endPos,M=N(i==="start"?[C,k]:[k,C],2),T=M[0],O=M[1],R=$P([-O[0]+T[0],-O[1]+T[1]]),D=N(Hr(R,x),2),L=D[0],P=D[1];return{x:T[0]+L,y:T[1]+P}}return s.includes("t")&&(b-=f+p+x),s.includes("r")&&(y+=d+v+S),s.includes("l")&&(y-=d+v+_),s.includes("b")&&(b+=f+p+E),{x:y,y:b}}function ett(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 Gk(r,t,e,n,i){var a=ht(n,"title"),s=N(oi(a),2),o=s[0],l=s[1],c=l.transform,u=l.transformOrigin,h=fe(l,["transform","transformOrigin"]);t.styles(h);var d=c||ett(r.node(),o.direction,o.position);r.styles(q(q({},o),{transformOrigin:u})),jP(r.node(),d);var f=ttt(st(e._offscreen||e.querySelector(zt.mainGroup.class)),t,n),g=f.x,v=f.y,p=lr(t.node(),{transform:"translate(".concat(g,", ").concat(v,")")},i);return p}function ntt(r,t,e,n){var i=e.titleText;return r.selectAll(zt.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 si(i)}).attr("className",zt.title.name).transition(function(){return Gk(st(this),r,t,e,n.enter)})},function(a){return a.transition(function(){return Gk(st(this),r,t,e,n.update)})},function(a){return a.remove()}).transitions()}function Wk(r,t,e,n){var i=r.showLine,a=r.showTick,s=r.showLabel,o=t.maybeAppendByClassName(zt.lineGroup,"g"),l=Rn(i,o,function(f){return pQ(f,r,n)})||[],c=t.maybeAppendByClassName(zt.tickGroup,"g"),u=Rn(a,c,function(f){return XQ(f,e,r,n)})||[],h=t.maybeAppendByClassName(zt.labelGroup,"g"),d=Rn(s,h,function(f){return WQ(f,e,r,n)})||[];return Q(Q(Q([],N(l),!1),N(u),!1),N(d),!1).filter(function(f){return!!f})}var rtt=function(r){wt(t,r);function t(e){return r.call(this,e,x2)||this}return t.prototype.render=function(e,n,i){var a=this,s=e.titleText,o=e.data,l=e.animate,c=e.showTitle,u=e.showGrid,h=e.dataThreshold,d=e.truncRange,f=IZ(o,h).filter(function(x){var S=x.value;return!(d&&S>d[0]&&S<d[1])}),g=Lk(i===void 0?l:i),v=st(n).maybeAppendByClassName(zt.gridGroup,"g"),p=Rn(u,v,function(x){return wQ(x,f,e,g)})||[],m=st(n).maybeAppendByClassName(zt.mainGroup,"g");s&&(!this.initialized&&g.enter||this.initialized&&g.update)&&Wk(e,st(this.offscreenGroup),f,Lk(!1));var y=Wk(e,st(m.node()),f,g),b=st(n).maybeAppendByClassName(zt.titleGroup,"g"),w=Rn(c,b,function(x){return ntt(x,a,e,g)})||[];return Q(Q(Q([],N(p),!1),N(y),!1),N(w),!1).flat().filter(function(x){return!!x})},t}(ge),$n=fr({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"),itt=function(r){wt(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:dJ(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 Pe({class:$n.contentGroup.name})),n.playWindow=n.contentGroup.appendChild(new Pe({class:$n.playWindow.name})),n.innerCurrPage=n.defaultPage,n}return Object.defineProperty(t.prototype,"defaultPage",{get:function(){var e=this.attributes.defaultPage;return ce(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=N(UZ(e.map(function(h){var d=h.getBBox(),f=d.width,g=d.height;return[f,g]})).map(function(h){return Math.max.apply(Math,Q([],N(h),!1))}),2),i=n[0],a=n[1],s=this.attributes,o=s.pageWidth,l=o===void 0?i:o,c=s.pageHeight,u=c===void 0?a:c;return{pageWidth:l,pageHeight:u}},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 sn(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,c=a.pageViews;if(o!=="idle"||e<0||c.length<=0||e>=c.length)return null;c[s].setLocalPosition(0,0),this.prepareFollowingPage(e);var u=N(this.getFollowingPageDiff(e),2),h=u[0],d=u[1];this.playState="running";var f=ZP(l,[{transform:"translate(0, 0)"},{transform:"translate(".concat(-h,", ").concat(-d,")")}],i);return Hs(f,function(){n.innerCurrPage=e,n.playState="idle",n.setVisiblePages([e]),n.updatePageInfo()}),f},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:ce(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:ce(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($n.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)?yl(n):or(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,c=a.getBBox(),u=c.width;c.height;var h=N(o==="horizontal"?[-180,0]:[-90,90],2),d=h[0],f=h[1];n.setLocalEulerAngles(d),i.setLocalEulerAngles(f);var g=n.getBBox(),v=g.width,p=g.height,m=i.getBBox(),y=m.width,b=m.height,w=Math.max(v,u,y),x=o==="horizontal"?{offset:[[0,0],[v/2+l,0],[v+u+l*2,0]],textAlign:"start"}:{offset:[[w/2,-p-l],[w/2,0],[w/2,b+l]],textAlign:"center"},S=N(x.offset,3),E=N(S[0],2),_=E[0],C=E[1],k=N(S[1],2),M=k[0],T=k[1],O=N(S[2],2),R=O[0],D=O[1],L=x.textAlign,P=a.querySelector("text");P&&(P.style.textAlign=L),n.setLocalPosition(_,C),a.setLocalPosition(M,T),i.setLocalPosition(R,D)},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($n.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=N(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,c=e.maybeAppendByClassName($n.controller,"g");if(rd(c.node(),l),!!l){var u=ht(this.attributes,"button"),h=ht(this.attributes,"pageNum"),d=N(oi(u),2),f=d[0],g=d[1],v=f.size,p=fe(f,["size"]),m=!c.select($n.prevBtnGroup.class).node(),y=c.maybeAppendByClassName($n.prevBtnGroup,"g").styles(g);this.prevBtnGroup=y.node();var b=y.maybeAppendByClassName($n.prevBtn,"path"),w=c.maybeAppendByClassName($n.nextBtnGroup,"g").styles(g);this.nextBtnGroup=w.node();var x=w.maybeAppendByClassName($n.nextBtn,"path");[b,x].forEach(function(E){E.styles(q(q({},p),{transformOrigin:"center"})),v2(E.node(),v)});var S=c.maybeAppendByClassName($n.pageInfoGroup,"g");this.pageInfoGroup=S.node(),S.maybeAppendByClassName($n.pageInfo,"text").styles(h),this.updatePageInfo(),c.node().setLocalPosition(s+i,o/2),m&&(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=st(n);this.renderClipPath(l),this.renderController(l),this.setVisiblePages([this.defaultPage]),this.goTo(this.defaultPage)},t.prototype.bindEvents=function(){var e=this,n=Zo(function(){return e.render(e.attributes,e)},50);this.playWindow.addEventListener(xt.INSERTED,n),this.playWindow.addEventListener(xt.REMOVED,n)},t}(ge);function att(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 hN=1.4,dN=.4;function stt(r,t,e){var n=e,i=n*hN,a=n/2,s=n/6,o=r+i*dN;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 ott(r,t,e){var n=e,i=n*hN,a=n/2,s=n/6,o=t+i*dN;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]]}qt.registerSymbol("hiddenHandle",att);qt.registerSymbol("verticalHandle",stt);qt.registerSymbol("horizontalHandle",ott);function jy(r,t,e){return r===void 0&&(r="horizontal"),r==="horizontal"?t:e}var Sn=fr({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 ltt(r){var t=r.querySelector(Sn.marker.class);return t?t.style:{}}var ctt=function(r){wt(t,r);function t(e){return r.call(this,e,{span:[1,1],marker:function(){return new li({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(),c=l.width,u=l.height;return{markerWidth:i,labelWidth:s,valueWidth:c,height:Math.max(i,o,u)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"span",{get:function(){var e=this.attributes.span;if(!e)return[1,1];var n=N(Ve(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,c=this.actualSpace,u=c.labelWidth,h=c.valueWidth,d=N(this.spacing,2),f=d[0],g=d[1];if(a){var v=a-i-f-g,p=N(this.span,2),m=p[0],y=p[1];e=N([m*v,y*v],2),u=e[0],h=e[1]}var b=o+u+h+f+g;return{width:b,height:l,markerWidth:o,labelWidth:u,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=N(Ve(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=N(this.spacing,2),c=l[0],u=l[1];return{height:o,width:s,markerWidth:n,labelWidth:i,valueWidth:a,position:[n/2,n+c,n+i+c+u]}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleSize",{get:function(){var e=ltt(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,c=n.markerStroke,u=c===void 0?e.stroke:c,h=+(s||l||(u?1:0))*Math.sqrt(2),d=this.markerGroup.node().getBBox(),f=d.width,g=d.height;return(1-h/Math.max(f,g))*i},enumerable:!1,configurable:!0}),t.prototype.renderMarker=function(e){var n=this,i=this.attributes.marker,a=ht(this.attributes,"marker");this.markerGroup=e.maybeAppendByClassName(Sn.markerGroup,"g").style("zIndex",0),Rn(!!i,this.markerGroup,function(){var s,o=n.markerGroup.node(),l=(s=o.childNodes)===null||s===void 0?void 0:s[0],c=typeof i=="string"?new qt({style:{symbol:i},className:Sn.marker.name}):i();l?c.nodeName===l.nodeName?l instanceof qt?l.update(q(q({},a),{symbol:i})):(qZ(l,c),st(l).styles(a)):(l.remove(),st(c).attr("className",Sn.marker.name).styles(a),o.appendChild(c)):(c instanceof qt||st(c).attr("className",Sn.marker.name).styles(a),o.appendChild(c)),n.markerGroup.node().scale(1/n.markerGroup.node().getScale()[0]);var u=v2(n.markerGroup.node(),n.scaleSize);n.markerGroup.node().style._transform="scale(".concat(u,")")})},t.prototype.renderLabel=function(e){var n=ht(this.attributes,"label"),i=n.text,a=fe(n,["text"]);this.labelGroup=e.maybeAppendByClassName(Sn.labelGroup,"g").style("zIndex",0),this.labelGroup.maybeAppendByClassName(Sn.label,function(){return si(i)}).styles(a)},t.prototype.renderValue=function(e){var n=this,i=ht(this.attributes,"value"),a=i.text,s=fe(i,["text"]);this.valueGroup=e.maybeAppendByClassName(Sn.valueGroup,"g").style("zIndex",0),Rn(this.showValue,this.valueGroup,function(){n.valueGroup.maybeAppendByClassName(Sn.value,function(){return si(a)}).styles(s)})},t.prototype.renderBackground=function(e){var n=this.shape,i=n.width,a=n.height,s=ht(this.attributes,"background");this.background=e.maybeAppendByClassName(Sn.backgroundGroup,"g").style("zIndex",-1),this.background.maybeAppendByClassName(Sn.background,"rect").styles(q({width:i,height:a},s))},t.prototype.adjustLayout=function(){var e=this.layout,n=e.labelWidth,i=e.valueWidth,a=e.height,s=N(e.position,3),o=s[0],l=s[1],c=s[2],u=a/2;this.markerGroup.styles({transform:"translate(".concat(o,", ").concat(u,")").concat(this.markerGroup.node().style._transform)}),this.labelGroup.styles({transform:"translate(".concat(l,", ").concat(u,")")}),Dy(this.labelGroup.select(Sn.label.class).node(),Math.ceil(n)),this.showValue&&(this.valueGroup.styles({transform:"translate(".concat(c,", ").concat(u,")")}),Dy(this.valueGroup.select(Sn.value.class).node(),Math.ceil(i)))},t.prototype.render=function(e,n){var i=st(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}(ge),va=fr({page:"item-page",navigator:"navigator",item:"item"},"items"),Vk=function(r,t,e){return e===void 0&&(e=!0),r?t(r):e},utt=function(r){wt(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:Id,mouseenter:Id,mouseleave:Id})||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=ht(this.attributes,"item"),s=n.map(function(o,l){var c=o.id,u=c===void 0?l:c,h=o.label,d=o.value;return{id:"".concat(u),index:l,style:q({layout:i,labelText:h,valueText:d},Object.fromEntries(Object.entries(a).map(function(f){var g=N(f,2),v=g[0],p=g[1];return[v,Un(p,[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=N(this.navigatorShape,1),c=l[0],u=N(this.grid,2),h=u[0],d=u[1],f=d*h,g=0;return this.pageViews.children.map(function(v,p){var m,y,b=Math.floor(p/f),w=p%f,x=e.ifHorizontal(d,h),S=[Math.floor(w/x),w%x];i==="vertical"&&S.reverse();var E=N(S,2),_=E[0],C=E[1],k=(a-c-(d-1)*o)/d,M=v.getBBox().height,T=N([0,0],2),O=T[0],R=T[1];return i==="horizontal"?(m=N([g,_*(M+s)],2),O=m[0],R=m[1],g=C===d-1?0:g+k+o):(y=N([C*(k+o),g],2),O=y[0],R=y[1],g=_===h-1?0:g+M+s),{page:b,index:p,row:_,col:C,pageIndex:w,width:k,height:M,x:O,y:R}})},t.prototype.getFlexLayout=function(){var e=this.attributes,n=e.width,i=e.height,a=e.rowPadding,s=e.colPadding,o=N(this.navigatorShape,1),l=o[0],c=N(this.grid,2),u=c[0],h=c[1],d=N([n-l,i],2),f=d[0],g=d[1],v=N([0,0,0,0,0,0,0,0],8),p=v[0],m=v[1],y=v[2],b=v[3],w=v[4],x=v[5],S=v[6],E=v[7];return this.pageViews.children.map(function(_,C){var k,M,T,O,R=_.getBBox(),D=R.width,L=R.height,P=S===0?0:s,A=S+P+D;if(A<=f&&Vk(w,function(B){return B<h}))return k=N([S+P,E,A],3),p=k[0],m=k[1],S=k[2],{width:D,height:L,x:p,y:m,page:y,index:C,pageIndex:b++,row:x,col:w++};M=N([x+1,0,0,E+L+a],4),x=M[0],w=M[1],S=M[2],E=M[3];var I=E+L;return I<=g&&Vk(x,function(B){return B<u})?(T=N([S,E,D],3),p=T[0],m=T[1],S=T[2],{width:D,height:L,x:p,y:m,page:y,index:C,pageIndex:b++,row:x,col:w++}):(O=N([0,0,D,0,y+1,0,0,0],8),p=O[0],m=O[1],S=O[2],E=O[3],y=O[4],b=O[5],x=O[6],w=O[7],{width:D,height:L,x:p,y:m,page:y,index:C,pageIndex:b++,row:x,col:w++})})},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 jy(i,e,n)},t.prototype.flattenPage=function(e){e.querySelectorAll(va.item.class).forEach(function(n){e.appendChild(n)}),e.querySelectorAll(va.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);st(e).selectAll(va.item.class).data(this.renderData,function(l){return l.id}).join(function(l){return l.append(function(c){var u=c.style;return new ctt({style:u})}).attr("className",va.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(c){var u=c.style;this.update(u)})},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=N(this.navigatorShape,2),l=o[0],c=o[1];this.navigator.update(i==="grid"?{pageWidth:a-l,pageHeight:s-c}:{})},t.prototype.adjustLayout=function(){var e=this,n=Object.entries(MZ(this.itemsLayout,"page")).map(function(a){var s=N(a,2),o=s[0],l=s[1];return{page:o,layouts:l}}),i=Q([],N(this.navigator.getContainer().children),!1);n.forEach(function(a){var s=a.layouts,o=e.pageViews.appendChild(new Pe({className:va.page.name}));s.forEach(function(l){var c=l.x,u=l.y,h=l.index,d=l.width,f=l.height,g=i[h];o.appendChild(g),Ro(g,"__layout__",l),g.update({x:c,y:u,width:d,height:f})})}),this.relayoutNavigator()},t.prototype.renderNavigator=function(e){var n=this.attributes.orientation,i=ht(this.attributes,"nav"),a=ze({orientation:n},i),s=this;return e.selectAll(va.navigator.class).data(["nav"]).join(function(o){return o.append(function(){return new itt({style:a})}).attr("className",va.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(st(n));this.renderItems(a.getContainer()),this.adjustLayout()}},t.prototype.dispatchCustomEvent=function(e,n){var i=new we(e,{detail:n});this.dispatchEvent(i)},t}(ge),eo=fr({markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label"},"handle"),fN={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){wt(t,r);function t(e){return r.call(this,e,fN)||this}return t.prototype.render=function(e,n){var i=st(n).maybeAppendByClassName(eo.markerGroup,"g");this.renderMarker(i);var a=st(n).maybeAppendByClassName(eo.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?jy(a,"horizontalHandle","verticalHandle"):s;Rn(!!o,e,function(l){var c=ht(n.attributes,"marker"),u=q({symbol:o},c);n.marker=l.maybeAppendByClassName(eo.marker,function(){return new qt({style:u})}).update(u)})},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,c=i.formatter;Rn(a,e,function(u){var h,d=ht(n.attributes,"label"),f=d.text,g=fe(d,["text"]),v=((h=u.select(eo.marker.class))===null||h===void 0?void 0:h.node().getBBox())||{},p=v.width,m=p===void 0?0:p,y=v.height,b=y===void 0?0:y,w=N(jy(s,[0,b+l,"center","top"],[m+l,0,"start","middle"]),4),x=w[0],S=w[1],E=w[2],_=w[3];u.maybeAppendByClassName(eo.label,"text").styles(q(q({},g),{x,y:S,text:c(f).toString(),textAlign:E,textBaseline:_}))})},t})(ge);var gN={showTitle:!0,padding:0,orientation:"horizontal",backgroundFill:"transparent",titleText:"",titleSpacing:4,titlePosition:"top-left",titleFill:"#2C3542",titleFontWeight:"bold",titleFontFamily:"sans-serif",titleFontSize:12},htt=ze({},gN,{});ze({},gN,vs(fN,"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 no=fr({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"),dtt=function(r){wt(t,r);function t(e){return r.call(this,e,htt)||this}return t.prototype.renderTitle=function(e,n,i){var a=this.attributes,s=a.showTitle,o=a.titleText,l=ht(this.attributes,"title"),c=N(oi(l),2),u=c[0],h=c[1];this.titleGroup=e.maybeAppendByClassName(no.titleGroup,"g").styles(h);var d=q(q({width:n,height:i},u),{text:s?o:""});this.title=this.titleGroup.maybeAppendByClassName(no.title,function(){return new QQ({style:d})}).update(d)},t.prototype.renderItems=function(e,n){var i=n.x,a=n.y,s=n.width,o=n.height,l=ht(this.attributes,"title",!0),c=N(oi(l),2),u=c[0],h=c[1],d=q(q({},u),{width:s,height:o,x:0,y:0});this.itemsGroup=e.maybeAppendByClassName(no.itemsGroup,"g").styles(q(q({},h),{transform:"translate(".concat(i,", ").concat(a,")")}));var f=this;this.itemsGroup.selectAll(no.items.class).data(["items"]).join(function(g){return g.append(function(){return new utt({style:d})}).attr("className",no.items.name).each(function(){f.items=st(this)})},function(g){return g.update(d)},function(g){return g.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 sn(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):KQ(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,c=i.y,u=c===void 0?0:c,h=st(n);n.style.transform="translate(".concat(l,", ").concat(u,")"),this.renderTitle(h,a,s),this.renderItems(h,this.availableSpace),this.adjustLayout()},t}(ge),ftt={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},wm=fr({background:"background",labelGroup:"label-group",label:"label"},"indicator"),gtt=function(r){wt(t,r);function t(e){var n=r.call(this,e,ftt)||this;return n.point=[0,0],n.group=n.appendChild(new Pe({})),n.isMutationObserved=!0,n}return t.prototype.renderBackground=function(){if(this.label){var e=this.attributes,n=e.position,i=e.padding,a=N(Ve(i),4),s=a[0],o=a[1],l=a[2],c=a[3],u=this.label.node().getLocalBounds(),h=u.min,d=u.max,f=new sn(h[0]-c,h[1]-s,d[0]+o-h[0]+c,d[1]+l-h[1]+s),g=this.getPath(n,f),v=ht(this.attributes,"background");this.background=st(this.group).maybeAppendByClassName(wm.background,"path").styles(q(q({},v),{d:g})),this.group.appendChild(this.label.node())}},t.prototype.renderLabel=function(){var e=this.attributes,n=e.formatter,i=e.labelText,a=ht(this.attributes,"label"),s=N(oi(a),2),o=s[0],l=s[1];o.text;var c=fe(o,["text"]);if(this.label=st(this.group).maybeAppendByClassName(wm.labelGroup,"g").styles(l),!!i){var u=this.label.maybeAppendByClassName(wm.label,function(){return si(n(i))}).style("text",n(i).toString());u.selectAll("text").styles(c)}},t.prototype.adjustLayout=function(){var e=N(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,c=[["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"]],u={top:4,right:6,bottom:0,left:2},h=u[e],d=this.createCorner([c[h].slice(-2),c[h+1].slice(-2)]);return c.splice.apply(c,Q([h+1,1],N(d),!1)),c[0][0]="M",c},t.prototype.createCorner=function(e,n){n===void 0&&(n=10);var i=.8,a=jZ.apply(void 0,Q([],N(e),!1)),s=N(e,2),o=N(s[0],2),l=o[0],c=o[1],u=N(s[1],2),h=u[0],d=u[1],f=N(a?[h-l,[l,h]]:[d-c,[c,d]],2),g=f[0],v=N(f[1],2),p=v[0],m=v[1],y=g/2,b=g/Math.abs(g),w=n*b,x=w/2,S=w*Math.sqrt(3)/2*i,E=N([p,p+y-x,p+y,p+y+x,m],5),_=E[0],C=E[1],k=E[2],M=E[3],T=E[4];return a?(this.point=[k,c-S],[["L",_,c],["L",C,c],["L",k,c-S],["L",M,c],["L",T,c]]):(this.point=[l+S,k],[["L",l,_],["L",l,C],["L",l+S,k],["L",l,M],["L",l,T]])},t.prototype.applyVisibility=function(){var e=this.attributes.visibility;e==="hidden"?or(this):yl(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}(ge);function qy(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 Hk={overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"};function vtt(r){var t;r===void 0&&(r="");var e=qy(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)]=q({flex:1},Hk),t[".".concat(e.VALUE)]=q({display:"inline-block",float:"right",flex:1,"text-align":"right","min-width":"28px","margin-left":"30px",color:"rgba(0, 0, 0, 0.85)"},Hk),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 ptt=function(r){wt(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=qy(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:vtt(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,c=a.color,u=c===void 0?"black":c,h=a.index,d=fe(a,["name","color","index"]),f=q({name:l,color:u,index:h??s},d);return $m(v6(i.item,f))})},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=$m(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:bk(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,c=i.content,u=qy(a.prefixCls),h=this.element;if(this.element.style.pointerEvents=o?"auto":"none",c)this.renderCustomContent();else{s?(h.innerHTML=a.title,h.getElementsByClassName(u.TITLE)[0].innerHTML=s):(n=(e=h.getElementsByClassName(u.TITLE))===null||e===void 0?void 0:e[0])===null||n===void 0||n.remove();var d=this.HTMLTooltipItemsElements,f=document.createElement("ul");f.className=u.LIST,bk(f,d);var g=this.element.querySelector(".".concat(u.LIST));g?g.replaceWith(f):h.appendChild(f)}VZ(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]},c=this.elementSize,u=c.width,h=c.height,d=[-u/2,-h/2];return o.forEach(function(f){var g=N(d,2),v=g[0],p=g[1],m=N(l[f],2),y=m[0],b=m[1];d=[v+(u/2+a[0])*y,p+(h/2+a[1])*b]}),d},t.prototype.setOffsetPosition=function(e){var n=N(e,2),i=n[0],a=n[1],s=this.attributes,o=s.x,l=o===void 0?0:o,c=s.y,u=c===void 0?0:c,h=s.container,d=h.x,f=h.y;this.element.style.left="".concat(+l+d+i,"px"),this.element.style.top="".concat(+u+f+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=N(e,2),i=n[0],a=n[1],s=this.attributes,o=s.x,l=s.y,c=s.bounding,u=s.position;if(!c)return[i,a];var h=this.element,d=h.offsetWidth,f=h.offsetHeight,g=N([+o+i,+l+a],2),v=g[0],p=g[1],m={left:"right",right:"left",top:"bottom",bottom:"top"},y=c.x,b=c.y,w=c.width,x=c.height,S={left:v<y,right:v+d>y+w,top:p<b,bottom:p+f>b+x},E=[];u.split("-").forEach(function(C){S[C]?E.push(m[C]):E.push(C)});var _=E.join("-");return this.getRelativeOffsetFromCursor(_)},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 sn(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}(ge),mtt=function(r){wt(t,r);function t(e){var n=r.call(this,ze({},t.defaultOptions,e))||this;return n.hoverColor="#f5f5f5",n.selectedColor="#e6f7ff",n.background=n.appendChild(new Be({})),n.label=n.background.appendChild(new Pe({})),n}return Object.defineProperty(t.prototype,"padding",{get:function(){return Ve(this.style.padding)},enumerable:!1,configurable:!0}),t.prototype.renderLabel=function(){var e=this.style,n=e.label,i=e.value,a=ht(this.attributes,"label");st(this.label).maybeAppend(".label",function(){return si(n)}).attr("className","label").styles(a),this.label.attr("__data__",i)},t.prototype.renderBackground=function(){var e=this.label.getBBox(),n=N(this.padding,4),i=n[0],a=n[1],s=n[2],o=n[3],l=e.width,c=e.height,u=l+o+a,h=c+i+s,d=ht(this.attributes,"background"),f=this.style,g=f.width,v=g===void 0?0:g,p=f.height,m=p===void 0?0:p,y=f.selected;this.background.attr(q(q({},d),{width:Math.max(u,v),height:Math.max(h,m),fill:y?this.selectedColor:"#fff"})),this.label.attr({transform:"translate(".concat(o,", ").concat((h-c)/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}(ge),ytt=function(r){wt(t,r);function t(e){var n,i,a=r.call(this,ze({},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 Be({className:"select",style:{cursor:"pointer",width:0,height:0}})),a.dropdown=a.appendChild(new Be({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 Ve(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,c=i.bordered,u=i.showDropdownIcon,h=ht(this.attributes,"select"),d=ht(this.attributes,"placeholder");this.select.attr(q(q({x:a,y:s,width:o,height:l},h),{fill:"#fff",strokeWidth:c?1:0}));var f=this.dropdownPadding,g=10;u&&st(this.select).maybeAppend(".dropdown-icon","path").style("d","M-5,-3.5 L0,3.5 L5,-3.5").style("transform","translate(".concat(a+o-g-f[1]-f[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(b){return b.value===e.currentValue}),p=q({x:a+f[3]},d);st(this.select).selectAll(".placeholder").data(v?[]:[1]).join(function(b){return b.append("text").attr("className","placeholder").styles(p).style("y",function(){var w=this.getBBox();return s+(l-w.height)/2})},function(b){return b.styles(p)},function(b){return b.remove()});var m=ht(this.attributes,"optionLabel"),y=q({x:a+f[3]},m);st(this.select).selectAll(".value").data(v?[v]:[]).join(function(b){return b.append(function(w){return si(w.label)}).attr("className","value").styles(y).style("y",function(){var w=this.getBBox();return s+(l-w.height)/2})},function(b){return b.styles(y)},function(b){return b.remove()})},t.prototype.renderDropdown=function(){var e=this,n,i,a=this.style,s=a.x,o=a.y,l=a.width,c=a.height,u=a.options,h=a.onSelect,d=a.open,f=ht(this.attributes,"dropdown"),g=ht(this.attributes,"option"),v=this.dropdownPadding;st(this.dropdown).maybeAppend(".dropdown-container","g").attr("className","dropdown-container").selectAll(".dropdown-item").data(u,function(y){return y.value}).join(function(y){return y.append(function(b){return new mtt({className:"dropdown-item",style:q(q(q({},b),g),{width:l-v[1]-v[3],selected:b.value===e.currentValue,onClick:function(w,x,S){e.setValue(w),h==null||h(w,x,S),e.dispatchEvent(new we("change",{detail:{value:w,option:x,item:S}})),or(e.dropdown)}})})}).each(function(b,w){var x,S=(x=this.parentNode)===null||x===void 0?void 0:x.children,E=S.reduce(function(_,C,k){return k<w&&(_+=C.getBBox().height),_},0);this.attr("transform","translate(".concat(v[3],", ").concat(v[0]+E,")"))})},function(y){return y.update(function(b){return{selected:b.value===e.currentValue}})},function(y){return y.remove()});var p=(i=(n=this.dropdown.getElementsByClassName("dropdown-container"))===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.getBBox(),m=f.spacing;this.dropdown.attr(q({transform:"translate(".concat(s,", ").concat(o+c+m,")"),width:p.width+v[1]+v[3],height:p.height+v[0]+v[2]},f)),!d&&or(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"?or(e.dropdown):yl(e.dropdown)}),this.addEventListener("pointerenter",function(){e.isPointerInSelect=!0}),this.addEventListener("pointerleave",function(){e.isPointerInSelect=!1}),document==null||document.addEventListener("click",function(){e.isPointerInSelect||or(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}(ge),gr=function(r){wt(t,r);function t(e){var n=r.call(this,ze({},{style:{backgroundOpacity:t.backgroundOpacities.default}},t.defaultOptions,e))||this;return n.showBackground=!0,n.background=n.appendChild(new Be({})),n.icon=n.appendChild(new Pe({})),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 Ve(this.attributes.size/5)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iconSize",{get:function(){var e=this.attributes.size,n=N(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=ht(this.attributes,"background");this.background.attr(q({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 gtt({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}(ge),Uo=function(r,t){return t===void 0&&(t="#565758"),new Tn({style:{fill:t,d:"M ".concat(r,",").concat(r," L -").concat(r,",0 L ").concat(r,",-").concat(r," Z"),transformOrigin:"center"}})},btt=function(r){wt(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.arcPath=function(e,n,i){var a=N([i,i],2),s=a[0],o=a[1],l=function(v){return[e+i*Math.cos(v),n+i*Math.sin(v)]},c=N(l(-5/4*Math.PI),2),u=c[0],h=c[1],d=N(l(1/4*Math.PI),2),f=d[0],g=d[1];return"M".concat(u,",").concat(h,",A").concat(s,",").concat(o,",0,1,1,").concat(f,",").concat(g)},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;st(this.icon).maybeAppend(".reset","path").styles({stroke:a,lineWidth:o,d:this.arcPath(n,i,s/2-o),markerStart:Uo(l,a)})},t}(gr),wtt=function(r){wt(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),c=[[n,i],[n,i-l],[n-o,i],[n,i+l],[n,i],[n+o,i-l],[n+o,i+l],[n,i]];st(this.icon).maybeAppend(".backward","polygon").styles({points:c,fill:a})},t}(gr),xtt=function(r){wt(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),c=[[n,i],[n,i-l],[n+o,i],[n,i+l],[n,i],[n-o,i-l],[n-o,i+l],[n,i]];st(this.icon).maybeAppend(".forward","polygon").styles({points:c,fill:a})},t}(gr),Ett=function(r){wt(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]];st(this.icon).maybeAppend(".play","polygon").styles({points:l,fill:a})},t}(gr),Stt=function(r){wt(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]];st(this.icon).maybeAppend(".pause","polygon").styles({points:l,fill:a})},t}(gr),_tt=function(r){wt(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,c=l;st(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}),st(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}),st(this.icon).maybeAppend(".left-arrow","line").styles({x1:n,y1:i,x2:n-o/2+c*2,y2:i,stroke:a,lineWidth:l,markerEnd:Uo(l*2,a)}),st(this.icon).maybeAppend(".right-arrow","line").styles({x1:n,y1:i,x2:n+o/2-c*2,y2:i,stroke:a,lineWidth:l,markerEnd:Uo(l*2,a)})},t}(gr),ktt=function(r){wt(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;st(this.icon).maybeAppend(".line","line").styles({x1:n,y1:i-o/2,x2:n,y2:i+o/2,stroke:a,lineWidth:l});var c=l;st(this.icon).maybeAppend(".left-arrow","line").styles({x1:n-o/2-c*2,y1:i,x2:n-c*2,y2:i,stroke:a,lineWidth:l,markerEnd:Uo(l*2,a)}),st(this.icon).maybeAppend(".right-arrow","line").styles({x1:n+o/2+c*2,y1:i,x2:n+c*2,y2:i,stroke:a,lineWidth:l,markerEnd:Uo(l*2,a)})},t}(gr),vN=function(r){return[[-r/2,-r/2],[-r/2,r/2],[r/2,r/2]]},Mtt=function(r){wt(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,c=l,u=(o-c*2-l)/4,h=(o-c*2-l)/2,d=N([n-o/2+c,i+o/2-c*2],2),f=d[0],g=d[1];st(this.icon).maybeAppend(".coordinate","polyline").styles({points:vN(o).map(function(v){var p=N(v,2),m=p[0],y=p[1];return[m+n,y+i]}),stroke:a,lineWidth:l}),st(this.icon).maybeAppend(".line","polyline").styles({points:[[f,g],[f+u,g-h],[f+u*2,g],[f+u*4,g-h*2]],stroke:a,lineWidth:l})},t}(gr),Ctt=function(r){wt(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,c=o.lineWidth,u=c,h=(l-u)/e.length,d=(l-u*2)/4,f=N([i-l/2+u*2,a+l/2-u],2),g=f[0],v=f[1];st(this.icon).maybeAppend(".coordinate","polyline").styles({points:vN(l).map(function(p){var m=N(p,2),y=m[0],b=m[1];return[y+i,b+a]}),stroke:s,lineWidth:c}),st(this.icon).maybeAppend(".bars","g").selectAll(".column").data(this.data.map(function(p,m){return{value:p,index:m}})).join(function(p){return p.append("line").attr("className","column").style("x1",function(m){var y=m.index;return g+h*y}).style("y1",v).style("x2",function(m){var y=m.index;return g+h*y}).style("y2",function(m){var y=m.value;return v-d*y}).styles({y1:v,stroke:s,lineWidth:c})})},t}(gr),Ttt=function(r){wt(t,r);function t(e){var n=r.call(this,ze({},{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;st(this.icon).maybeAppend(".split","line").styles({x1:n,y1:i-o/2,x2:n,y2:i+o/2,stroke:a,lineWidth:l})},t}(gr),Gy=function(r){wt(t,r);function t(){var e=r.apply(this,Q([],N(arguments),!1))||this;return e.showBackground=!1,e}return Object.defineProperty(t.prototype,"padding",{get:function(){return Ve(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=i1(this.attributes,["x","y","transform","transformOrigin","width","height","size","color","speed"]),c=ce(e,20,1/0),u=20,h=q(q({},l),{x:i-c/2,y:a-u/2,width:c,height:u,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}]});st(this.icon).maybeAppend(".speed",function(){return new ytt({style:h})}).attr("className","speed").each(function(){this.update(h)})},t.tag="SpeedSelect",t}(gr),_2=function(r){wt(t,r);function t(e){var n=r.call(this,e)||this;return n.icon=n.appendChild(new Pe({})),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=fe(n,["onChange"]);st(this.icon).selectAll(".icon").data([this.currentType]).join(function(a){return a.append(function(s){var o,l=(o=e.toggles.find(function(c){var u=N(c,1),h=u[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=N(o,1),c=l[0];return c===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}(ge),Wy=function(r){wt(t,r);function t(e){var n=r.call(this,ze({},{style:{type:"play"}},e))||this;return n.toggles=[["play",Ett],["pause",Stt]],n}return t}(_2),Vy=function(r){wt(t,r);function t(e){var n=r.call(this,ze({},{style:{type:"range"}},e))||this;return n.toggles=[["range",_tt],["value",ktt]],n}return t}(_2),Hy=function(r){wt(t,r);function t(e){var n=r.call(this,ze({},{style:{type:"column"}},e))||this;return n.toggles=[["line",Mtt],["column",Ctt]],n}return t}(_2),Ott={reset:btt,speed:Gy,backward:wtt,playPause:Wy,forward:xtt,selectionType:Vy,chartType:Hy,split:Ttt},Att=function(r){wt(t,r);function t(e){var n=r.call(this,ze({},t.defaultOptions,e))||this;return n.background=n.appendChild(new Be({})),n.functions=n.appendChild(new Pe({})),n}return Object.defineProperty(t.prototype,"padding",{get:function(){return Ve(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=ht(this.attributes,"background");this.background.attr(q({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,c=i.y,u=i.width,h=i.height,d=i.align,f=N(this.padding,4),g=f[1],v=f[3],p=a.reduce(function(b,w){return b.length&&w.length?b.concat.apply(b,Q(["split"],N(w),!1)):b.concat.apply(b,Q([],N(w),!1))},[]),m=p.length*(s+o)-o,y={left:v+s/2,center:(u-m)/2+s/2,right:u-m-v-g+s/2}[d]||0;(n=this.speedSelect)===null||n===void 0||n.destroy(),this.functions.removeChildren(),p.forEach(function(b,w){var x,S=Ott[b],E={x:l+w*(s+o)+y,y:c+h/2,size:s};if(S===Gy?(E.speed=e.attributes.speed,E.onSelect=function(C){return e.handleFunctionChange(b,{value:C})}):[Wy,Vy,Hy].includes(S)?(E.onChange=function(C){return e.handleFunctionChange(b,{value:C})},S===Wy&&(E.type=e.attributes.state==="play"?"pause":"play"),S===Vy&&(E.type=e.attributes.selectionType==="range"?"value":"range"),S===Hy&&(E.type=e.attributes.chartType==="line"?"column":"line")):E.onClick=function(){return e.handleFunctionChange(b,{value:b})},S===Gy){var _=(x=e.ownerDocument)===null||x===void 0?void 0:x.defaultView;_&&(e.speedSelect=new S({style:q(q({},E),{zIndex:100})}),_.appendChild(e.speedSelect))}else e.functions.appendChild(new S({style:E}))})},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}(ge),Ptt=function(r){wt(t,r);function t(e){var n=r.call(this,ze({},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}(li),Ntt=function(r){wt(t,r);function t(e){return r.call(this,ze({},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=ht(this.attributes,"background");st(this).maybeAppend("background","rect").attr("className","background").styles(q({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=ht(this.attributes,"icon"),o=1,l=a/2;st(this).maybeAppend("icon-left-line","line").attr("className","icon-left-line").styles(q({x1:n-o,y1:i-l,x2:n-o,y2:i+l},s)),st(this).maybeAppend("icon-right-line","line").attr("className","icon-right-line").styles(q({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=ht(this.attributes,"border"),c=o==="start"?+a/2:-a/2;st(this).maybeAppend("border","line").attr("className","border").styles(q({x1:c+n,y1:i-s/2,x2:c+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}(ge);function Rtt(r,t){return typeof r=="number"?pN(r):Ltt(r,t)}function Ltt(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?hn(e,`HH:mm
- YYYY-MM-DD`):hn(e,"HH:mm");case"half-day":return e.getHours()<12?`AM
- `.concat(hn(e,"YYYY-MM-DD")):"PM";case"day":return[1,10,20].includes(e.getDate())?hn(e,`DD
- YYYY-MM`):hn(e,"DD");case"week":return e.getDate()<=7?hn(e,`DD
- YYYY-MM`):hn(e,"DD");case"month":return[0,6].includes(e.getMonth())?hn(e,`MM月
- YYYY`):hn(e,"MM月");case"season":return[0].includes(e.getMonth())?hn(e,`MM月
- YYYY`):hn(e,"MM月");case"year":return hn(e,"YYYY");default:return hn(e,"YYYY-MM-DD HH:mm")}}function pN(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 Dtt=function(r){wt(t,r);function t(e){var n=r.call(this,ze({},t.defaultOptions,e))||this;n.axis=n.appendChild(new rtt({style:{type:"linear",startPos:[0,0],endPos:[0,0],data:[],showArrow:!1,animate:!1}})),n.timeline=n.appendChild(new eQ({style:{onChange:function(h){n.handleSliderChange(h)}}})),n.controller=n.appendChild(new Att({})),n.states={},n.handleSliderChange=function(h){var d=function(){var f=n.states.values;return Array.isArray(f)?Q([],N(f),!1):f}();n.setBySliderValues(h),n.dispatchOnChange(d)};var i=n.attributes,a=i.selectionType,s=i.chartType,o=i.speed,l=i.state,c=i.playMode,u=i.values;return n.states={chartType:s,playMode:c,selectionType:a,speed:o,state:l},n.setByTimebarValues(u),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,c=ce(+s-l,0,+s),u=new sn(n,i+ +s-l,+a,l),h,d=0;o==="chart"?(d=35,h=new sn(n,i+c-d,+a,d)):h=new sn;var f=o==="time"?10:c,g=new sn(n,i+(o==="time"?c:c-f),+a,f-d);return{axisBBox:h,controllerBBox:u,timelineBBox:g}},enumerable:!1,configurable:!0}),t.prototype.setBySliderValues=function(e){var n,i,a=this.data,s=N(Array.isArray(e)?e:[0,e],2),o=s[0],l=s[1],c=a.length,u=a[Math.floor(o*c)],h=a[Math.ceil(l*c)-(Array.isArray(e)?0:1)];this.states.values=[(n=u==null?void 0:u.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=N(Array.isArray(e)?e:[void 0,e],2),l=o[0],c=o[1],u=s.find(function(d){var f=d.time;return f===l}),h=s.find(function(d){var f=d.time;return f===c});this.states.values=[(n=u==null?void 0:u.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=N(e,2),c=l[0],u=l[1];this.states.values=[(i=(n=o[c])===null||n===void 0?void 0:n.time)!==null&&i!==void 0?i:o[0].time,(s=(a=this.data[u])===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=N(Array.isArray(n)?n:[void 0,n],2),s=a[0],o=a[1],l=this.data,c=l.length,u=i==="value",h=function(){var f=l.findIndex(function(g){var v=g.time;return v===s});return u?0:f>-1?f/c:0},d=function(){if(o===1/0)return 1;var f=l.findIndex(function(g){var v=g.time;return v===o});return f>-1?f/c:u?.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=N(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 Ntt({style:{type:i,height:n,iconSize:n/6}})}:function(){return new Fa({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,c=l.selectionType,u=l.chartType,h=this.data,d=this.attributes,f=d.type,g=d.labelFormatter,v=ht(this.attributes,"chart");v.type;var p=fe(v,["type"]),m=c==="range";if(f==="time")return q({handleIconShape:function(){return new Ptt({})},selectionFill:"#2e7ff8",selectionFillOpacity:1,showLabelOnInteraction:!0,handleLabelDy:m?-15:0,autoFitLabel:m,handleSpacing:m?-15:0,trackFill:"#edeeef",trackLength:s,trackOpacity:.5,trackRadius:o/2,trackSize:o/2,type:c,values:this.sliderValues,formatter:function(w){if(g)return g(w);var x=n.getDatumByRatio(w).time;return typeof x=="number"?pN(x):hn(x,"YYYY-MM-DD HH:mm:ss")},transform:"translate(".concat(i,", ").concat(a,")"),zIndex:1},p);var y=c==="range"?5:0,b=h.map(function(w){var x=w.value;return x});return q({handleIconOffset:y,handleIconShape:this.chartHandleIconShape,selectionFill:"#fff",selectionFillOpacity:.5,selectionType:"invert",sparklineSpacing:.1,sparklineColumnLineWidth:0,sparklineColor:"#d4e5fd",sparklineAreaOpacity:1,sparklineAreaLineWidth:0,sparklineData:b,sparklineType:u,sparklineScale:.8,trackLength:s,trackSize:o,type:c,values:this.sliderValues,transform:"translate(".concat(i,", ").concat(a,")"),zIndex:1},p)},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=ht(this.attributes,"axis"),l=e.x,c=e.y,u=e.width,h=Q(Q([],N(n),!1),[{time:0}],!1).map(function(f,g,v){var p=f.time;return{label:"".concat(p),value:g/(v.length-1),time:p}}),d=q({startPos:[l,c],endPos:[l+u,c],data:h,labelFilter:function(f,g){return g<h.length-1},labelFormatter:function(f){var g=f.time;return s?s(g):Rtt(g,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,c=ht(this.attributes,"controller"),u=this,h=q(q(q({},e),{iconSize:20,speed:s,state:a,selectionType:o,chartType:l,onChange:function(d,f){var g=f.value;switch(d){case"reset":u.internalReset();break;case"speed":u.handleSpeedChange(g);break;case"backward":u.internalBackward();break;case"playPause":g==="play"?u.internalPlay():u.internalPause();break;case"forward":u.internalForward();break;case"selectionType":u.handleSelectionTypeChange(g);break;case"chartType":u.handleChartTypeChange(g);break}}}),c);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=N(s,2),c=l[0],u=l[1],h=u===1/0?n.at(-1).time:u,d=o==="range"?[c,h]:h,f=function(g,v){return Array.isArray(g)?Array.isArray(v)?g[0]===v[0]&&(g[1]===v[1]||g[1]===1/0||v[1]===1/0):!1:Array.isArray(v)?!1:g===v};(!e||!f(e,d))&&(i==null||i(o==="range"?[c,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,c=s.playMode,u=N(o,2),h=u[0],d=u[1],f=i.findIndex(function(b){var w=b.time;return w===h}),g=i.findIndex(function(b){var w=b.time;return w===d});g===-1&&(g=a);var v=e==="backward"?-1:1,p;l==="range"?c==="acc"?(p=[f,g+v],v===-1&&f===g&&(p=[f,a])):p=[f+v,g+v]:p=[f,g+v];var m=function(b){var w=N(b.sort(function(_,C){return _-C}),2),x=w[0],S=w[1],E=function(_){return ce(_,0,a)};return S>a?l==="value"?[0,0]:c==="acc"?[E(x),E(x)]:[0,E(S-x)]:x<0?c==="acc"?[0,E(S)]:[E(x+a-S),a]:[E(x),E(S)]},y=m(p);return this.setByIndex(y),this.updateSelection(),y},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,c=l===void 0?1:l;this.playInterval=window.setInterval(function(){var u=n.internalForward();u[1]===s.length&&!o&&(n.internalPause(),n.renderController())},1e3/c),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}(ge);function k2(r){const{width:t,height:e,renderer:n}=r,i=Itt(r),a=new ny({width:t,height:e,container:i,renderer:n||new zo});return[i,a]}function Itt(r){var t;const{container:e,className:n,graphCanvas:i}=r;if(e)return typeof e=="string"?document.getElementById(e):e;const a=Ws(n,!1),{width:s,height:o,containerStyle:l}=r,[c,u]=Ftt(r);return Object.assign(a.style,Object.assign({position:"absolute",left:c+"px",top:u+"px",width:s+"px",height:o+"px"},l)),(t=i.getContainer())===null||t===void 0||t.appendChild(a),a}function Ftt(r){const{width:t,height:e,placement:n,graphCanvas:i}=r,[a,s]=i.getSize(),[o,l]=xT(n);return[o*(a-t),l*(s-e)]}var Btt=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 cd extends Ue{constructor(t,e){super(t,Object.assign({},cd.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(X.AFTER_DRAW,this.createElement)},this.changeState=(n,i)=>{const{graph:a}=this.context,{typePrefix:s}=this,o=nn(n,[s,"id"]),l=nn(n,[s,"style","labelText"]),[c]=o.split("__"),u=this.fieldMap[c].get(l)||[];a.setElementState(Object.fromEntries(u==null?void 0:u.map(h=>[h,i])))},this.click=n=>{if(this.options.trigger==="hover")return;const i=nn(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=nn(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:c}=a.getData(),u={},h=p=>at(n)?n(p):n,d={node:"circle",edge:"line",combo:"rect"},f={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"},g=(p,m)=>s==null?void 0:s.getElementComputedStyle(p,m),v=(p,m)=>{p.forEach(y=>{const{id:b}=y,w=nn(y,["data",h(y)]),x=(s==null?void 0:s.getElementType(m,y))||"circle",S=g(m,y),E=(m==="edge"?S==null?void 0:S.stroke:S==null?void 0:S.fill)||"#1783ff";b&&w&&w.replace(/\s+/g,"")&&(this.setFieldMap(w,b,m),u[w]||(u[w]={id:`${m}__${b}`,label:w,marker:f[x]||d[m],elementType:m,lineWidth:1,stroke:E,fill:E}))})};switch(i){case"node":v(o,"node");break;case"edge":v(l,"edge");break;case"combo":v(c,"combo");break;default:return[]}return Object.values(u)},this.createElement=()=>{if(this.draw){this.updateElement();return}const n=this.options,{width:i,height:a,nodeField:s,edgeField:o,comboField:l,trigger:c,position:u,container:h,containerStyle:d,className:f}=n,g=Btt(n,["width","height","nodeField","edgeField","comboField","trigger","position","container","containerStyle","className"]),v=this.getMarkerData(s,"node"),p=this.getMarkerData(o,"edge"),m=this.getMarkerData(l,"combo"),y=[...v,...m,...p],b=Object.assign({width:i,height:a,data:y,itemMarkerLineWidth:({lineWidth:S})=>S,itemMarker:({marker:S})=>S,itemMarkerStroke:({stroke:S})=>S,itemMarkerFill:({fill:S})=>S,gridCol:v.length},g,this.getEvents()),w=new dtt({className:"legend",style:b});this.category=w,this.upsertCanvas().appendChild(w),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:c}=this.options,[u,h]=k2({width:i,height:a,graphCanvas:t,container:o,containerStyle:l,placement:s,className:"legend"});return this.container=u,c&&u.classList.add(c),this.canvas=h,this.canvas}destroy(){this.clear(),this.context.graph.off(X.AFTER_DRAW,this.createElement),super.destroy()}}cd.defaultOptions={position:"bottom",trigger:"hover",orientation:"horizontal",layout:"flex",itemSpacing:4,rowPadding:10,colPadding:10,itemMarkerSize:16,itemLabelFontSize:16,width:240,height:160};class ud extends Ue{constructor(t,e){super(t,Object.assign({},ud.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:c,width:u,height:h}=this.mask.style,[,,d,f]=this.maskBBox;let g=parseInt(l)+s,v=parseInt(c)+o,p=parseInt(u),m=parseInt(h);g<0&&(g=0),v<0&&(v=0),g+p>i&&(g=wi(i-p,0)),v+m>a&&(v=wi(a-m,0)),p<d&&(s>0?(g=wi(g-s,0),p=bi(p+s,i)):s<0&&(p=bi(p-s,i))),m<f&&(o>0?(v=wi(v-o,0),m=bi(m+o,a)):o<0&&(m=bi(m-o,a))),Object.assign(this.mask.style,{left:g+"px",top:v+"px",width:p+"px",height:m+"px"});const y=parseInt(l)-g,b=parseInt(c)-v;if(y===0&&b===0)return;const w=this.context.canvas.getCamera().getZoom(),x=this.canvas.getCamera().getZoom(),S=w/x;this.context.graph.translateBy([y*S,b*S],!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=iC(()=>{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=Zo(()=>{this.renderMinimap(),this.renderMask()},this.options.delay,!0)}bindEvents(){const{graph:t}=this.context;t.on(X.AFTER_DRAW,this.onDraw),t.on(X.AFTER_RENDER,this.onRender),t.on(X.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:t}=this.context;t.off(X.AFTER_DRAW,this.onDraw),t.off(X.AFTER_RENDER,this.onRender),t.off(X.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(F(o),"node")),edges:a.filter(o=>t(F(o),"edge")),combos:s.filter(o=>t(F(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 c=new Set,u=h=>{const d=F(h);c.add(d);const f=o.getElement(d);if(!f)return;const g=f.getShape("key"),v=this.shapes.get(d)||g.cloneNode();v.setPosition(g.getPosition()),f.style.zIndex&&(v.style.zIndex=f.style.zIndex),v.id=f.id,this.shapes.has(d)?Object.entries(g.attributes).forEach(([p,m])=>{v.style[p]!==m&&(v.style[p]=m)}):(t.appendChild(v),this.shapes.set(d,v))};i.forEach(u),a.forEach(u),n.forEach(u),this.shapes.forEach((h,d)=>{c.has(d)||(t.removeChild(h),this.shapes.delete(d))});return}const l=(c,u)=>{const d=o.getElement(c).getPosition();return u.setPosition(d),u};t.removeChildren(),i.forEach(c=>t.appendChild(s(F(c),"edge"))),a.forEach(c=>{t.appendChild(l(F(c),s(F(c),"combo")))}),n.forEach(c=>{t.appendChild(l(F(c),s(F(c),"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,c]=k2({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=c}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,c,u]=Pr(s),{min:h,max:d,center:f}=e.getBounds("elements"),g=d[0]-h[0],v=d[1]-h[1],p=i-u-l,m=a-o-c,y=p/g,b=m/v,w=Math.min(y,b),x=this.createLandmark(f,f,w);n.gotoLandmark(x,0)}get maskBBox(){const{canvas:t}=this.context,e=t.getSize(),n=t.getCanvasByViewport([0,0]),i=t.getCanvasByViewport(e),a=this.canvas.canvas2Viewport(sr(n)),s=this.canvas.canvas2Viewport(sr(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=bi(a+n,t),n=0),i<0&&(s=bi(s+i,e),i=0),n+a>t&&(a=wi(t-n,0)),i+s>e&&(s=wi(e-i,0)),[bi(n,t),bi(i,e),wi(a,0),wi(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()}}ud.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 bi=(r,t)=>Math.min(r,t),wi=(r,t)=>Math.max(r,t);var xm=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};const Em={x1:0,y1:0,x2:0,y2:0,visibility:"hidden"};class hd extends Ue{constructor(t,e){super(t,Object.assign({},hd.defaultOptions,e)),this.initSnapline=()=>{const n=this.context.canvas.getLayer("transient");this.horizontalLine||(this.horizontalLine=n.appendChild(new Fa({style:Object.assign(Object.assign({},Em),this.options.horizontalLineStyle)}))),this.verticalLine||(this.verticalLine=n.appendChild(new Fa({style:Object.assign(Object.assign({},Em),this.options.verticalLineStyle)})))},this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!0,this.autoSnapToLine=(n,i,a)=>xm(this,void 0,void 0,function*(){const{verticalX:s,horizontalY:o}=a,{tolerance:l}=this.options,{min:[c,u],max:[h,d],center:[f,g]}=i;let v=0,p=0;s!==null&&(Ye(h,s)<l&&(v=s-h),Ye(c,s)<l&&(v=s-c),Ye(f,s)<l&&(v=s-f),v!==0&&(this.isVerticalSticking=!0)),o!==null&&(Ye(d,o)<l&&(p=o-d),Ye(u,o)<l&&(p=o-u),Ye(g,o)<l&&(p=o-g),p!==0&&(this.isHorizontalSticking=!0)),(v!==0||p!==0)&&(yield this.context.graph.translateElementBy({[n]:[v,p]},!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:[c,u],center:[h,d]}=i;let f=null,g=null,v=null,p=null,m=null,y=null;return this.getNodes().some(b=>{if(ue(n.id,b.id))return!1;const w=Uk(b,s).getRenderBounds(),{min:[x,S],max:[E,_],center:[C,k]}=w;return f===null&&(Ye(C,h)<a?f=C:Ye(x,o)<a||Ye(x,c)<a?f=x:(Ye(E,c)<a||Ye(E,o)<a)&&(f=E),f!==null&&(g=Math.min(S,l),v=Math.max(_,u))),p===null&&(Ye(k,d)<a?p=k:Ye(S,l)<a||Ye(S,u)<a?p=S:(Ye(_,u)<a||Ye(_,l)<a)&&(p=_),p!==null&&(m=Math.min(x,o),y=Math.max(E,c))),f!==null&&p!==null}),{verticalX:f,verticalMinY:g,verticalMaxY:v,horizontalY:p,horizontalMinX:m,horizontalMaxX:y}},this.onDragStart=()=>{this.initSnapline()},this.onDrag=n=>xm(this,void 0,void 0,function*(){const{target:i}=n;if(this.options.autoSnap&&!this.enableSnap(n))return;const a=Uk(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 zF(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||Em.lineWidth||1)/this.context.graph.getZoom()}updateSnapline(t){const{verticalX:e,verticalMinY:n,verticalMaxY:i,horizontalY:a,horizontalMinX:s,horizontalMaxX:o}=t,[l,c]=this.context.canvas.getSize(),{offset:u}=this.options;a!==null?Object.assign(this.horizontalLine.style,{x1:u===1/0?0:s-u,y1:a,x2:u===1/0?l:o+u,y2:a,visibility:"visible",lineWidth:this.getLineWidth("horizontal")}):this.horizontalLine.style.visibility="hidden",e!==null?Object.assign(this.verticalLine.style,{x1:e,y1:u===1/0?0:n-u,x2:e,y2:u===1/0?c:i+u,visibility:"visible",lineWidth:this.getLineWidth("vertical")}):this.verticalLine.style.visibility="hidden"}getDelta(t){const e=this.context.graph.getZoom();return ur([t.dx,t.dy],e)}bindEvents(){return xm(this,void 0,void 0,function*(){const{graph:t}=this.context;t.on(Vn.DRAG_START,this.onDragStart),t.on(Vn.DRAG,this.onDrag),t.on(Vn.DRAG_END,this.onDragEnd)})}unbindEvents(){const{graph:t}=this.context;t.off(Vn.DRAG_START,this.onDragStart),t.off(Vn.DRAG,this.onDrag),t.off(Vn.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()}}hd.defaultOptions={tolerance:5,offset:20,autoSnap:!0,shape:"key",verticalLineStyle:{stroke:"#1783FF"},horizontalLineStyle:{stroke:"#1783FF"},filter:()=>!0};const Ye=(r,t)=>Math.abs(r-t),Uk=(r,t)=>typeof t=="function"?t(r):r.getShape(t);var ztt=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})},$tt=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 jtt=["timestamp","time","date","datetime"];class dd extends Ue{get padding(){return Pr(this.options.padding)}constructor(t,e){super(t,Object.assign({},dd.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=Yk(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:c,mode:u}=e,h=$tt(e,["onChange","timebarType","data","x","y","width","height","mode"]),d=t.getSize(),[f]=this.padding;this.upsertCanvas().ready.then(()=>{var g;const v=Object.assign(Object.assign({x:d[0]/2-l/2,y:f,onChange:p=>{const m=(Dn(p)?p:[p,p]).map(y=>y6(y)?y.getTime():y);this.options.mode==="modify"?this.filterElements(m):this.hiddenElements(m),n==null||n(m)}},h),{data:a.map(p=>nt(p)?{time:p,value:0}:p),width:l,height:c,type:i});this.timebar?this.timebar.update(v):(this.timebar=new Dtt({style:v}),(g=this.canvas)===null||g===void 0||g.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,c]=k2({width:a,height:e+s+o,graphCanvas:i,className:"timebar",placement:n});return this.container=l,t&&l.classList.add(t),this.canvas=c,this.canvas}filterElements(t){return ztt(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=Yk(this.originalData);n.forEach(c=>{const u=`${c}s`;o[u]=(this.originalData[u]||[]).filter(h=>{const d=i(h);return!!Xk(d,t)})});const l=[...o.nodes,...o.combos].map(c=>F(c));o.edges=o.edges.filter(c=>{const u=c.source,h=c.target;return l.includes(u)&&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 c=`${o}s`;(((l=this.originalData)===null||l===void 0?void 0:l[c])||[]).forEach(h=>{const d=F(h),f=i(h);Xk(f,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()}}dd.defaultOptions={position:"bottom",enable:!0,timebarType:"time",className:"g6-timebar",width:450,height:60,zIndex:3,elementTypes:["node"],padding:10,mode:"modify",getTime:r=>qtt(r,jtt,void 0),loop:!1};const Yk=r=>{const{nodes:t=[],edges:e=[],combos:n=[]}=r;return{nodes:[...t],edges:[...e],combos:[...n]}},Xk=(r,t)=>{if(nt(t))return r===t;const[e,n]=t;return r>=e&&r<=n},qtt=(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 Gtt(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 Wtt=`
- .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;
- }
- `,Vtt=`
- <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 Kk=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class fd extends Ue{constructor(t,e){super(t,Object.assign({},fd.defaultOptions,e)),this.$element=Ws("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),Ry("g6-toolbar-css","style",{},Wtt,document.head),Ry("g6-toolbar-svgicon","div",{display:"none"},Vtt),this.$element.addEventListener("click",this.onToolbarItemClick),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return Kk(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,Gtt(i)),this.$element.innerHTML=yield this.getDOMContent()})}destroy(){this.$element.removeEventListener("click",this.onToolbarItemClick),this.$element.remove(),super.destroy()}getDOMContent(){return Kk(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("")})}}fd.defaultOptions={position:"top-left"};var Zk=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class gd extends Ue{constructor(t,e){super(t,Object.assign({},gd.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=>Zk(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=>Zk(this,void 0,void 0,function*(){var i,a;const{client:s,target:{id:o}}=n;if(sh(n.target))return;const l=this.context.graph.getElementType(o),{getContent:c,title:u}=this.options,h=this.getElementData(o,l);if(!this.tooltipElement||!this.isEnable(n,h))return;let d={};if(c){if(d.content=yield c(n,h),!d.content)return}else{const v=this.context.graph.getElementRenderStyle(o),p=l==="node"?v.fill:v.stroke;d={title:u||l,data:h.map(m=>({name:"ID",value:m.id||`${m.source} -> ${m.target}`,color:p}))}}this.currentTarget=o;let f,g;if(s)f=s.x,g=s.y;else{const v=nn(h,"0.style",{x:0,y:0});f=v.x,g=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:f,y:g,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:c,y:u}}=n;(l=(o=this.options).onOpenChange)===null||l===void 0||l.call(o,!1),this.tooltipElement.hide(c,u),this.currentTarget=null},this.initTooltip=()=>{var n;const i=new ptt({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:c={x:-a,y:-i},title:u,offset:h}=this.options,[d,f]=e,[g,v]=t.getSize();return{x:d,y:f,container:c,title:u,bounding:{x:0,y:0,width:g,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()}}gd.defaultOptions={trigger:"hover",position:"top-right",enterable:!1,enable:!0,offset:[10,10],style:{".tooltip":{visibility:"hidden"}}};var mN=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};let ss;function yN(r,t){return ss||(ss=document.createElement("canvas")),ss.width=r,ss.height=t,ss.getContext("2d").clearRect(0,0,r,t),ss}function Htt(r,t,e,n){return mN(this,void 0,void 0,function*(){const i=yN(r,t),a=i.getContext("2d"),{rotate:s,opacity:o,textFill:l,textFontSize:c,textFontFamily:u,textFontVariant:h,textFontWeight:d,textAlign:f,textBaseline:g}=n;return a.textAlign=f,a.textBaseline=g,a.translate(r/2,t/2),a.font=`${c}px ${u} ${h} ${d}`,s&&a.rotate(s),o&&(a.globalAlpha=o),l&&(a.fillStyle=l,a.fillText(`${e}`,0,0)),i.toDataURL()})}function Utt(r,t,e,n){return mN(this,void 0,void 0,function*(){const i=yN(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(c=>{l.onload=function(){const u=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,u,h,r-u*2,t-h*2),c(i.toDataURL())}})})}var Ytt=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})},Xtt=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 vd extends Ue{constructor(t,e){super(t,Object.assign({},vd.defaultOptions,e)),this.$element=Ws("watermark"),this.context.canvas.getContainer().appendChild(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return Ytt(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=Xtt(n,["width","height","text","imageURL"]);Object.keys(l).forEach(u=>{u.startsWith("background")&&(this.$element.style[u]=t[u])});const c=o?yield Utt(i,a,o,l):yield Htt(i,a,s,l);this.$element.style.backgroundImage=`url(${c})`})}destroy(){super.destroy(),this.$element.remove()}}vd.defaultOptions={width:200,height:100,opacity:.2,rotate:Math.PI/12,text:"",textFill:"#000",textFontSize:16,textAlign:"center",textBaseline:"middle",backgroundRepeat:"repeat"};const Ktt=["#7E92B5","#F4664A","#FFBE3A"],Ztt={type:"group",color:["#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]},Jtt={type:"group",color:["#99ADD1","#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]};function bN(r){const{bgColor:t,textColor:e,nodeColor:n,nodeColorDisabled:i,nodeStroke:a,nodeHaloStrokeOpacityActive:s=.15,nodeHaloStrokeOpacitySelected:o=.25,nodeOpacityDisabled:l=.06,nodeIconOpacityInactive:c=.85,nodeOpacityInactive:u=.25,nodeBadgePalette:h=Ktt,nodePaletteOptions:d=Ztt,edgeColor:f,edgeColorDisabled:g,edgePaletteOptions:v=Jtt,comboColor:p,comboColorDisabled:m,comboStroke:y,comboStrokeDisabled:b,edgeColorInactive:w}=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:u,donutOpacity:u,fillOpacity:u,iconOpacity:c,labelFill:e,labelFillOpacity:u,strokeOpacity:u},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:f,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:f,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:w,fillOpacity:.08,labelOpacity:.25,strokeOpacity:.08,badgeBackgroundOpacity:.25},disabled:{stroke:g,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:p,halo:!1,haloLineWidth:12,haloStroke:y,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:y},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:m,fillOpacity:.25,labelOpacity:.25,stroke:b,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 Qtt={type:"group",color:["#637088","#0F55A6","#008383","#9C5D38","#8B53A6","#4E40A6","#8F6608","#3E801D","#A65383","#175E75","#0F8248"]},tet={bgColor:"#000000",comboColor:"#fdfdfd",comboColorDisabled:"#d0e4ff",comboStroke:"#99add1",comboStrokeDisabled:"#969696",edgeColor:"#637088",edgeColorDisabled:"#637088",edgeColorInactive:"#D0E4FF",edgePaletteOptions:Qtt,nodeColor:"#1783ff",nodeColorDisabled:"#D0E4FF",nodeHaloStrokeOpacityActive:.25,nodeHaloStrokeOpacitySelected:.45,nodeIconOpacityInactive:.45,nodeOpacityDisabled:.25,nodeOpacityInactive:.45,nodeStroke:"#d0e4ff",textColor:"#ffffff"},eet=bN(tet),net={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"},ret=bN(net);class di extends E1{beforeDraw(t,e){return t}afterLayout(t,e){}}class iet extends di{beforeDraw(t){const{model:e}=this.context,n=t.add.combos,i=a=>{const s=[];return a.forEach((o,l)=>{const u=e.getAncestorsData(l,"combo").map(h=>F(h)).reverse();s.push([l,o,u.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 Pn(r,t,e,n,i){const a=F(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,c])=>{t===l?c[s].set(a,o):c[s].delete(a)})}function Hc(r,t){return Object.keys(r).every(e=>r[e]===t[e])}class aet extends di{beforeDraw(t,e){if(e.stage==="visibility"||!this.context.model.model.hasTreeStructure(jt))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(mn(l)){const c=n.getDescendantsData(o),u=c.map(F),{internal:h,external:d}=hy(u,f=>n.getRelatedEdgesData(f));c.forEach(f=>{const g=F(f),v=s.findIndex(([m])=>m===g);v!==-1&&s.splice(v,1);const p=n.getElementType(g);Pn(t,"remove",p,f)}),h.forEach(f=>Pn(t,"remove","edge",f)),d.forEach(f=>{var g;const v=F(f);((g=this.context.element)===null||g===void 0?void 0:g.getElement(v))?a.edges.set(v,f):i.edges.set(v,f)})}else{const c=n.getChildrenData(o),u=c.map(F),{edges:h}=hy(u,d=>n.getRelatedEdgesData(d));[...c,...h].forEach(d=>{var f;const g=F(d),v=n.getElementType(g);((f=this.context.element)===null||f===void 0?void 0:f.getElement(g))?Pn(t,"update",v,d):Pn(t,"add",v,d),v==="combo"&&s.push([g,d])})}}return t}}const Jk=(r,t,e,n)=>{const i=`${e}s`,a=F(n);!r.add[i].has(a)&&!r.update[i].has(a)&&r[t][i].set(F(n),n)};class set extends di{getElement(t){return this.context.element.getElement(t)}handleExpand(t,e){if(Jk(e,"add","node",t),mn(t))return;const n=F(t);Jk(e,"add","node",t),this.context.model.getRelatedEdgesData(n,"out").forEach(s=>{Pn(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(Cn))return t;const{add:{nodes:i,edges:a},update:{nodes:s}}=t,o=new Map,l=new Map;i.forEach((u,h)=>{mn(u)&&o.set(h,u)}),a.forEach(u=>{if(e.getElementType(u.source)!=="node")return;const h=e.getNodeData(u.source);mn(h)&&o.set(u.source,h)}),s.forEach((u,h)=>{const d=this.getElement(h);if(!d)return;const f=d.attributes.collapsed;mn(u)?f||o.set(h,u):f&&l.set(h,u)});const c=new Set;return o.forEach((u,h)=>{n.getDescendantsData(h).forEach(f=>{const g=F(f);if(c.has(g))return;Pn(t,"remove","node",f),n.getRelatedEdgesData(g).forEach(p=>{Pn(t,"remove","edge",p)}),c.add(g)})}),l.forEach((u,h)=>{if(n.getAncestorsData(h,Cn).some(mn)){Pn(t,"remove","node",u);return}this.handleExpand(u,t)}),t}}function Eo(r,t,e,n=!1){const i=ry[r][t];!n&&i?i!==e&&Ar.warn(`The extension ${t} of ${r} has been registered before.`):Object.assign(ry[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 wN=function(){function r(t){V(this,r),this.dragndropPluginOptions=t}return W(r,[{key:"apply",value:function(e){var n=this,i=e.renderingService,a=e.renderingContext,s=a.root.ownerDocument,o=s.defaultView,l=function(u){var h=u.target,d=h===s,f=d&&n.dragndropPluginOptions.isDocumentDraggable?s:h.closest&&h.closest("[draggable=true]");if(f){var g=!1,v=u.timeStamp,p=[u.clientX,u.clientY],m=null,y=[u.clientX,u.clientY],b=function(){var x=Gi(We().mark(function S(E){var _,C,k,M,T,O;return We().wrap(function(D){for(;;)switch(D.prev=D.next){case 0:if(g){D.next=8;break}if(_=E.timeStamp-v,C=fn([E.clientX,E.clientY],p),!(_<=n.dragndropPluginOptions.dragstartTimeThreshold||C<=n.dragndropPluginOptions.dragstartDistanceThreshold)){D.next=5;break}return D.abrupt("return");case 5:E.type="dragstart",f.dispatchEvent(E),g=!0;case 8:if(E.type="drag",E.dx=E.clientX-y[0],E.dy=E.clientY-y[1],f.dispatchEvent(E),y=[E.clientX,E.clientY],d){D.next=21;break}return k=n.dragndropPluginOptions.overlap==="pointer"?[E.canvasX,E.canvasY]:h.getBounds().center,D.next=17,s.elementsFromPoint(k[0],k[1]);case 17:M=D.sent,T=M[M.indexOf(h)+1],O=(T==null?void 0:T.closest("[droppable=true]"))||(n.dragndropPluginOptions.isDocumentDroppable?s:null),m!==O&&(m&&(E.type="dragleave",E.target=m,m.dispatchEvent(E)),O&&(E.type="dragenter",E.target=O,O.dispatchEvent(E)),m=O,m&&(E.type="dragover",E.target=m,m.dispatchEvent(E)));case 21:case"end":return D.stop()}},S)}));return function(E){return x.apply(this,arguments)}}();o.addEventListener("pointermove",b);var w=function(S){if(g){S.detail={preventClick:!0};var E=S.clone();m&&(E.type="drop",E.target=m,m.dispatchEvent(E)),E.type="dragend",f.dispatchEvent(E),g=!1}o.removeEventListener("pointermove",b)};h.addEventListener("pointerup",w,{once:!0}),h.addEventListener("pointerupoutside",w,{once:!0})}};i.hooks.init.tap(r.tag,function(){o.addEventListener("pointerdown",l)}),i.hooks.destroy.tap(r.tag,function(){o.removeEventListener("pointerdown",l)})}}])}();wN.tag="Dragndrop";var oet=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return V(this,t),e=mt(this,t),e.name="dragndrop",e.options=n,e}return pt(t,r),W(t,[{key:"init",value:function(){this.addRenderingPlugin(new wN(vt({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)}}])}(Ji),Qk=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})},tM=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 eM=["main"],nM=["background","main","label","transient"];function cet(r){return r.main}class rM{getConfig(){return this.config}getLayer(t="main"){return this.extends.layers[t]||cet(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=tM(e,["renderer","background","cursor","enableMultiLayer"]),l=s?nM:eM,c=iM(n,l),u=Object.fromEntries(l.map(h=>{const d=new ny(Object.assign(Object.assign({},o),{supportsMutipleCanvasesInOneContainer:s,renderer:c[h],background:s?h==="background"?i:void 0:i}));return[h,d]}));aM(u),this.extends={config:this.config,renderer:n,renderers:c,layers:u}}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 il(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=iM(t,this.config.enableMultiLayer?nM:eM);this.extends.renderers=e,Object.entries(e).forEach(([n,i])=>this.getLayer(n).setRenderer(i)),aM(this.getLayers())}getCanvasByViewport(t){return Ge(this.getLayer().viewport2Canvas(sr(t)))}getViewportByCanvas(t){return Ge(this.getLayer().canvas2Viewport(sr(t)))}getViewportByClient(t){return Ge(this.getLayer().client2Viewport(sr(t)))}getClientByViewport(t){return Ge(this.getLayer().viewport2Client(sr(t)))}getClientByCanvas(t){return this.getClientByViewport(this.getViewportByCanvas(t))}getCanvasByClient(t){const e=this.getLayer(),n=e.client2Viewport(sr(t));return Ge(e.viewport2Canvas(n))}toDataURL(){return Qk(this,arguments,void 0,function*(t={}){const e=globalThis.devicePixelRatio||1,{mode:n="viewport"}=t,i=tM(t,["mode"]);let[a,s,o,l]=[0,0,0,0];if(n==="viewport")[o,l]=this.getSize();else if(n==="overall"){const m=this.getBounds(),y=ta(m);[a,s]=m.min,[o,l]=y}const c=$m('<div id="virtual-image"></div>'),u=new ny({width:o,height:l,renderer:new zo,devicePixelRatio:e,container:c,background:this.extends.config.background});yield u.ready,u.appendChild(this.getLayer("background").getRoot().cloneNode(!0)),u.appendChild(this.getRoot().cloneNode(!0));const h=this.getLayer("label").getRoot().cloneNode(!0),d=u.viewport2Canvas({x:0,y:0}),f=this.getCanvasByViewport([0,0]);h.translate([f[0]-d.x,f[1]-d.y]),h.scale(1/this.getCamera().getZoom()),u.appendChild(h),u.appendChild(this.getLayer("transient").getRoot().cloneNode(!0));const g=this.getCamera(),v=u.getCamera();if(n==="viewport")v.setZoom(g.getZoom()),v.setPosition(g.getPosition()),v.setFocalPoint(g.getFocalPoint());else if(n==="overall"){const[m,y,b]=v.getPosition(),[w,x,S]=v.getFocalPoint();v.setPosition([m+a,y+s,b]),v.setFocalPoint([w+a,x+s,S])}const p=u.getContextService();return new Promise(m=>{u.addEventListener(Mn.RERENDER,()=>Qk(this,void 0,void 0,function*(){yield new Promise(b=>setTimeout(b,300));const y=yield p.toDataURL(i);m(y)}))})})}destroy(){Object.values(this.getLayers()).forEach(t=>{t.getCamera().cancelLandmarkAnimation(),t.destroy()})}}function iM(r,t){return Object.fromEntries(t.map(e=>{const n=(r==null?void 0:r(e))||new zo;return n instanceof zo&&n.setConfig({enableDirtyRectangleRendering:!1}),e==="main"?n.registerPlugin(new oet({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):n.unregisterPlugin(n.getPlugin("dom-interaction")),[e,n]}))}function aM(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 os=r=>r?parseInt(r):0;function uet(r){const t=getComputedStyle(r),e=r.clientWidth||os(t.width),n=r.clientHeight||os(t.height),i=os(t.paddingLeft)+os(t.paddingRight),a=os(t.paddingTop)+os(t.paddingBottom);return[e-i,n-a]}function sM(r){if(!r)return[0,0];let t=640,e=480;const[n,i]=uet(r);t=n||t,e=i||e;const a=1,s=1;return[Math.max(nt(t)?t:a,a),Math.max(nt(e)?e:s,s)]}class pd{constructor(t){this.type=t}}class xe extends pd{constructor(t,e){super(t),this.data=e}}class qn extends pd{constructor(t,e,n,i){super(t),this.animationType=e,this.animation=n,this.data=i}}class ls extends pd{constructor(t,e,n){super(t),this.elementType=e,this.data=n}}class Pc extends pd{constructor(t,e){super(t),this.data=e}}function Oe(r,t){r.emit(t.type,t)}function het(r){if(!r)return null;if(r instanceof UC)return{type:"canvas",element:r};let t=r;for(;t;){if(ul(t))return{type:"node",element:t};if(tO(t))return{type:"edge",element:t};if(N1(t))return{type:"combo",element:t};t=t.parentElement}return null}function oM(r){var t;return((t=r==null?void 0:r.style)===null||t===void 0?void 0:t.zIndex)||0}const Po="cachedStyle",M2=r=>`__${r}__`;function det(r,t){const e=Array.isArray(t)?t:[t];nn(r,Po)||Ro(r,Po,{}),e.forEach(n=>{Ro(nn(r,Po),M2(n),r.attributes[n])})}function lM(r,t){return nn(r,[Po,M2(t)])}function fet(r,t){return M2(t)in(nn(r,Po)||{})}class get{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(([c,u])=>{var h,d,f;const{element:g,elementType:v,stage:p}=c,m=$8(this.context.options,v,p,t);(h=u==null?void 0:u.before)===null||h===void 0||h.call(u);const y=m.length?q8(g,this.inferStyle(c,n),m):null;return y?((d=u==null?void 0:u.beforeAnimate)===null||d===void 0||d.call(u,y),y.finished.then(()=>{var b,w;(b=u==null?void 0:u.afterAnimate)===null||b===void 0||b.call(u,y),(w=u==null?void 0:u.after)===null||w===void 0||w.call(u),this.animations.delete(y)})):(f=u==null?void 0:u.after)===null||f===void 0||f.call(u),y}).filter(Boolean);o.forEach(c=>this.animations.add(c));const l=y1(o);return l?((a=e==null?void 0:e.beforeAnimate)===null||a===void 0||a.call(e,l),l.finished.then(()=>{var c,u;(c=e==null?void 0:e.afterAnimate)===null||c===void 0||c.call(e,l),(u=e==null?void 0:e.after)===null||u===void 0||u.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:c={}}=t;t.modifiedStyle||(t.modifiedStyle=Object.assign(Object.assign({},l),c));const{modifiedStyle:u}=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=lM(a,"opacity"))!==null&&n!==void 0?n:Fo("opacity")});else if(o==="hide")Object.assign(h,{opacity:(i=lM(a,"opacity"))!==null&&i!==void 0?i:Fo("opacity")}),Object.assign(d,{opacity:0});else if(o==="collapse"){const{collapse:f}=e||{},{target:g,descendants:v,position:p}=f;if(s==="node"){if(v.includes(a.id)){const[m,y,b]=p;Object.assign(d,{x:m,y,z:b})}}else if(s==="combo"){if(a.id===g||v.includes(a.id)){const[m,y]=p;Object.assign(d,{x:m,y,childrenNode:l.childrenNode})}}else s==="edge"&&Object.assign(d,{sourceNode:u.sourceNode,targetNode:u.targetNode})}else if(o==="expand"){const{expand:f}=e||{},{target:g,descendants:v,position:p}=f;if(s==="node"){if(a.id===g||v.includes(a.id)){const[m,y,b]=p;Object.assign(h,{x:m,y,z:b})}}else if(s==="combo"){if(a.id===g||v.includes(a.id)){const[m,y,b]=p;Object.assign(h,{x:m,y,z:b,childrenNode:u.childrenNode})}}else s==="edge"&&Object.assign(h,{sourceNode:u.sourceNode,targetNode:u.targetNode})}return[Object.keys(h).length>0?Object.assign({},l,h):l,Object.keys(d).length>0?Object.assign({},u,d):u]}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 vet{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 xe(X.BATCH_START,{initiate:t}))}endBatch(){this.batchCount--,this.batchCount===0&&this.emit(new xe(X.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class pet extends x1{constructor(t){super(t),this.currentTarget=null,this.currentTargetType=null,this.category="behavior",this.forwardCanvasEvents=e=>{const{target:n}=e,i=het(n);if(!i)return;const{graph:a,canvas:s}=this.context,{type:o,element:l}=i;if("destroyed"in l&&(sh(l)||l.destroyed))return;const{type:c,detail:u,button:h}=e,d=Object.assign(Object.assign({},e),{target:l,targetType:o,originalTarget:n});c===z.POINTER_MOVE&&(this.currentTarget!==l&&(this.currentTarget&&a.emit(`${this.currentTargetType}:${z.POINTER_LEAVE}`,Object.assign(Object.assign({},d),{type:z.POINTER_LEAVE,target:this.currentTarget,targetType:this.currentTargetType})),l&&(Object.assign(d,{type:z.POINTER_ENTER}),a.emit(`${o}:${z.POINTER_ENTER}`,d))),this.currentTarget=l,this.currentTargetType=o),c===z.CLICK&&h===2||(a.emit(`${o}:${c}`,d),a.emit(c,d)),c===z.CLICK&&u===2&&(Object.assign(d,{type:z.DBLCLICK}),a.emit(`${o}:${z.DBLCLICK}`,d),a.emit(z.DBLCLICK,d)),c===z.POINTER_DOWN&&h===2&&(Object.assign(d,{type:z.CONTEXT_MENU,preventDefault:()=>{var f;(f=s.getContainer())===null||f===void 0||f.addEventListener(z.CONTEXT_MENU,g=>g.preventDefault(),{once:!0})}}),a.emit(`${o}:${z.CONTEXT_MENU}`,d),a.emit(z.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&&[ps.KEY_DOWN,ps.KEY_UP].forEach(n=>{t.addEventListener(n,this.forwardContainerEvents)});const e=this.context.canvas.document;e&&[z.CLICK,z.DBLCLICK,z.POINTER_OVER,z.POINTER_LEAVE,z.POINTER_ENTER,z.POINTER_MOVE,z.POINTER_OUT,z.POINTER_DOWN,z.POINTER_UP,z.CONTEXT_MENU,z.DRAG_START,z.DRAG,z.DRAG_END,z.DRAG_ENTER,z.DRAG_OVER,z.DRAG_LEAVE,z.DROP,z.WHEEL].forEach(n=>{e.addEventListener(n,this.forwardCanvasEvents)})}destroy(){const t=this.context.canvas.getContainer();t&&[ps.KEY_DOWN,ps.KEY_UP].forEach(e=>{t.removeEventListener(e,this.forwardContainerEvents)}),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}var Yo=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 xi(r,t){const{data:e,style:n}=r,i=Yo(r,["data","style"]),{data:a,style:s}=t,o=Yo(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 Sm(r){const{data:t,style:e}=r,i=Yo(r,["data","style"]);return t&&(i.data=Object.assign({},t)),e&&(i.style=Object.assign({},e)),i}function cs(r={},t={}){const{states:e=[],data:n={},style:i={},children:a=[]}=r,s=Yo(r,["states","data","style","children"]),{states:o=[],data:l={},style:c={},children:u=[]}=t,h=Yo(t,["states","data","style","children"]),d=(g,v)=>g.length!==v.length?!1:g.every((p,m)=>p===v[m]),f=(g,v)=>{const p=Object.keys(g),m=Object.keys(v);return p.length!==m.length?!1:p.every(y=>g[y]===v[y])};return!(!f(s,h)||!d(a,u)||!d(e,o)||!f(n,l)||!f(i,c))}var met=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 _m(r){const{id:t=F(r),style:e,data:n}=r,i=met(r,["id","style","data"]),a=Object.assign(Object.assign({},r),{style:Object.assign({},e),data:Object.assign({},n)});return Y8(r)?Object.assign({id:t,data:a},i):{id:t,data:a}}function De(r){return r.data}function yet(r){if(r.hasTreeStructure(Cn))return;r.attachTreeStructure(Cn);const t=r.getAllEdges();for(const e of t){const{source:n,target:i}=e;r.setParent(i,n,Cn)}}class bet{constructor(){this.latestRemovedComboIds=new Set,this.comboIds=new Set,this.changes=[],this.batchCount=0,this.isTraceless=!1,this.enableUpdateNodeLikeHierarchy=!0,this.model=new Ne}pushChange(t){if(this.isTraceless)return;const{type:e}=t;if(e===Qt.NodeUpdated||e===Qt.EdgeUpdated||e===Qt.ComboUpdated){const{value:n,original:i}=t;this.changes.push({value:Sm(n),original:Sm(i),type:e})}else this.changes.push({value:Sm(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=De(n);return this.isCombo(F(i))||(t===void 0||t.includes(F(i)))&&e.push(i),e},[])}getEdgeDatum(t){return De(this.model.getEdge(t))}getEdgeData(t){return this.model.getAllEdges().reduce((e,n)=>{const i=De(n);return(t===void 0||t.includes(F(i)))&&e.push(i),e},[])}getComboData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=De(n);return this.isCombo(F(i))&&(t===void 0||t.includes(F(i)))&&e.push(i),e},[])}getRootsData(t=Cn){return this.model.getRoots(t).map(De)}getAncestorsData(t,e){const{model:n}=this;return!n.hasNode(t)||!n.hasTreeStructure(e)?[]:n.getAncestors(t,e).map(De)}getDescendantsData(t){const e=this.getElementDataById(t),n=[];return Oa(e,i=>{i!==e&&n.push(i)},i=>this.getChildrenData(F(i)),"TB"),n}getParentData(t,e){const{model:n}=this;if(!e){Ar.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?De(i):void 0}getChildrenData(t){const e=this.getElementType(t)==="node"?Cn:jt,{model:n}=this;return!n.hasNode(t)||!n.hasTreeStructure(e)?[]:n.getChildren(t,e).map(De)}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 De(e)}getNodeLikeData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=De(n);return t?t.includes(F(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(De)}getNeighborNodesData(t){return this.model.getNeighbors(t).map(De)}setData(t){const{nodes:e=[],edges:n=[],combos:i=[]}=t,{nodes:a,edges:s,combos:o}=this.getData(),l=zi(a,e,h=>F(h),cs),c=zi(s,n,h=>F(h),cs),u=zi(o,i,h=>F(h),cs);this.batch(()=>{const h={nodes:l.enter,edges:c.enter,combos:u.enter};this.addData(h),this.computeZIndex(h,"add",!0);const d={nodes:l.update,edges:c.update,combos:u.update};this.updateData(d),this.computeZIndex(d,"update",!0);const f={nodes:l.exit.map(F),edges:c.exit.map(F),combos:u.exit.map(F)};this.removeData(f)})}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:Qt.NodeAdded}),_m(e)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({nodes:t},"add"))}addEdgeData(t=[]){t.length&&(this.model.addEdges(t.map(e=>(this.pushChange({value:e,type:Qt.EdgeAdded}),_m(e)))),this.computeZIndex({edges:t},"add"))}addComboData(t=[]){if(!t.length)return;const{model:e}=this;e.hasTreeStructure(jt)||e.attachTreeStructure(jt),e.addNodes(t.map(n=>(this.comboIds.add(F(n)),this.pushChange({value:n,type:Qt.ComboAdded}),_m(n)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({combos:t},"add")}addChildrenData(t,e){const n=this.getNodeLikeDatum(t),i=e.map(F);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,c,u;const h=F(o);if(e==="add"&&nt((l=o.style)===null||l===void 0?void 0:l.zIndex)||e==="update"&&!("combo"in o))return;const d=this.getParentData(h,jt),f=d?((u=(c=d.style)===null||c===void 0?void 0:c.zIndex)!==null&&u!==void 0?u:0)+1:0;this.preventUpdateNodeLikeHierarchy(()=>{this.updateComboData([{id:h,style:{zIndex:f}}])})}),i.forEach(o=>{var l,c,u;const h=F(o);if(e==="add"&&nt((l=o.style)===null||l===void 0?void 0:l.zIndex)||e==="update"&&!("combo"in o)&&!("children"in o))return;let d=0;const f=this.getParentData(h,jt);if(f)d=(((c=f.style)===null||c===void 0?void 0:c.zIndex)||0)+1;else{const g=this.getParentData(h,Cn);g&&(d=((u=g==null?void 0:g.style)===null||u===void 0?void 0:u.zIndex)||0)}this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:h,style:{zIndex:d}}])})}),a.forEach(o=>{var l,c,u,h,d;if(nt((l=o.style)===null||l===void 0?void 0:l.zIndex))return;let{id:f,source:g,target:v}=o;if(!f)f=F(o);else{const y=this.getEdgeDatum(f);g=y.source,v=y.target}if(!g||!v)return;const p=((u=(c=this.getNodeLikeDatum(g))===null||c===void 0?void 0:c.style)===null||u===void 0?void 0:u.zIndex)||0,m=((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:F(o),style:{zIndex:Math.max(p,m)-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=>F(s)!==t)}),n==="combo"&&!mn(i)){const s=new Set(this.getAncestorsData(t,jt).map(F));a.nodes=a.nodes.filter(o=>!s.has(F(o))),a.combos=a.combos.filter(o=>!s.has(F(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=F(n),a=ec(n);a!==void 0&&(e.hasTreeStructure(jt)||e.attachTreeStructure(jt),a===null&&this.refreshComboData(i),this.setParent(i,ec(n),jt));const s=n.children||[];if(s.length){e.hasTreeStructure(Cn)||e.attachTreeStructure(Cn);const o=s.filter(l=>e.hasNode(l));o.forEach(l=>this.setParent(l,i,Cn)),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=F(i),s=De(e.getNode(a));if(cs(s,i))return;const o=xi(s,i);this.pushChange({value:o,original:s,type:Qt.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:Qt.NodeUpdated})}),e.forEach(i=>{this.pushChange({value:i,original:i,type:Qt.EdgeUpdated})}),n.forEach(i=>{this.pushChange({value:i,original:i,type:Qt.ComboUpdated})})}syncNodeLikeDatum(t){const{model:e}=this,n=F(t);if(!e.hasNode(n))return;const i=De(e.getNode(n)),a=xi(i,t);e.mergeNodeData(n,a)}syncEdgeDatum(t){const{model:e}=this,n=F(t);if(!e.hasEdge(n))return;const i=De(e.getEdge(n)),a=xi(i,t);e.mergeEdgeData(n,a)}updateEdgeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{t.forEach(n=>{const i=F(n),a=De(e.getEdge(i));if(cs(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=xi(a,n);this.pushChange({value:s,original:a,type:Qt.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=F(i),s=De(e.getNode(a));if(cs(s,i))return;const o=xi(s,i);this.pushChange({value:o,original:s,type:Qt.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=ec(a);if(s!==e&&n===jt){const o={id:t,combo:e};this.isCombo(t)?this.syncNodeLikeDatum(o):this.syncNodeLikeDatum(o)}this.model.setParent(t,e,n),i&&n===jt&&c6([s,e]).forEach(o=>{o!==void 0&&this.refreshComboData(o)})}refreshComboData(t){const e=this.getComboData([t])[0],n=this.getAncestorsData(t,jt);e&&this.pushChange({value:e,original:e,type:Qt.ComboUpdated}),n.forEach(i=>{this.pushChange({value:i,original:i,type:Qt.ComboUpdated})})}getElementPosition(t){const e=this.getElementDataById(t);return ye(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=ft(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;Oa(s,l=>{const c=F(l);if(o.has(c))return;o.add(c);const[u,h,d]=ye(l),f=xi(l,{style:{x:u+n,y:h+i,z:d+a}});this.pushChange({value:f,original:l,type:this.isCombo(c)?Qt.ComboUpdated:Qt.NodeUpdated}),this.model.mergeNodeData(c,f)},l=>this.getChildrenData(F(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,c,u]=ye(o),h=i-l,d=a-c,f=s-u;Oa(o,g=>{const v=F(g),[p,m,y]=ye(g),b=xi(g,{style:{x:p+h,y:m+d,z:y+f}});this.pushChange({value:b,original:g,type:this.isCombo(v)?Qt.ComboUpdated:Qt.NodeUpdated}),this.model.mergeNodeData(v,b)},g=>this.getChildrenData(F(g)),"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(F)),this.pushChange({value:this.getNodeData([e])[0],type:Qt.NodeRemoved}),this.removeNodeLikeHierarchy(e)}),this.model.removeNodes(t)})}removeEdgeData(t=[]){t.length&&(t.forEach(e=>this.pushChange({value:this.getEdgeData([e])[0],type:Qt.EdgeRemoved})),this.model.removeEdges(t))}removeComboData(t=[]){t.length&&this.batch(()=>{t.forEach(e=>{this.pushChange({value:this.getComboData([e])[0],type:Qt.ComboRemoved}),this.removeNodeLikeHierarchy(e),this.comboIds.delete(e)}),this.model.removeNodes(t)})}removeNodeLikeHierarchy(t){if(this.model.hasTreeStructure(jt)){const e=ec(this.getNodeLikeDatum(t));this.setParent(t,void 0,jt,!1),this.model.getChildren(t,jt).forEach(n=>{const i=De(n),a=F(i);this.setParent(F(i),e,jt,!1);const s=xi(i,{id:F(i),combo:e});this.pushChange({value:s,original:i,type:this.isCombo(a)?Qt.ComboUpdated:Qt.NodeUpdated}),this.model.mergeNodeData(F(i),s)}),ot(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(Xr(`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 ro=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class wet{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 Pe({className:"elements"}))}}emit(t,e){e.silence||Oe(this.context.graph,t)}forEachElementData(t){$a.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 aT(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({},jb((i=this.getTheme(e))===null||i===void 0?void 0:i.palette),jb((a=t[e])===null||a===void 0?void 0:a.palette));s!=null&&s.field&&Object.assign(this.paletteStyle,W9(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[F(e.datum)]=$b(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(F(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 $b(o,n)}computeElementStatesStyle(t,e,n){this.stateStyle[F(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(F(o))){const l=this.getElementState(F(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[F(t)])}getCombos(){return this.context.model.getComboData().map(({id:t})=>this.elementMap[t])}getElementComputedStyle(t,e){const n=F(e),i=this.getThemeStyle(t),a=this.getPaletteStyle(t,n),s=e.style||{},o=this.getDefaultStyle(n),l=this.getThemeStateStyle(t,this.getElementState(n)),c=this.getStateStyle(n),u=Object.assign({},i,a,s,o,l,c);if(t==="combo"){const h=this.context.model.getChildrenData(n),f=!!u.collapsed?[]:h.map(F).filter(g=>this.getElement(g));Object.assign(u,{childrenNode:f,childrenData:h})}return u}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 ro(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 xe(X.BEFORE_DRAW,{dataChanges:a,animation:n,stage:o,render:l==="render"}),t),beforeAnimate:c=>this.emit(new qn(X.BEFORE_ANIMATE,dn.DRAW,c,s),t),afterAnimate:c=>this.emit(new qn(X.AFTER_ANIMATE,dn.DRAW,c,s),t),after:()=>this.emit(new xe(X.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=d2(n);if(i.length===0)return null;const{NodeAdded:a=[],NodeUpdated:s=[],NodeRemoved:o=[],EdgeAdded:l=[],EdgeUpdated:c=[],EdgeRemoved:u=[],ComboAdded:h=[],ComboUpdated:d=[],ComboRemoved:f=[]}=ju(i,m=>m.type),g=m=>new Map(m.map(y=>{const b=y.value;return[F(b),b]})),v={add:{nodes:g(a),edges:g(l),combos:g(h)},update:{nodes:g(s),edges:g(c),combos:g(d)},remove:{nodes:g(o),edges:g(u),combos:g(f)}},p=this.transformData(v,t);return e.clearChanges(),{dataChanges:n,drawData:p}}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=F(e);if(this.getElement(a))return;const o=this.getElementType(t,e),l=this.getElementComputedStyle(t,e),c=ri(t,o);if(!c)return Ar.warn(`The element ${o} of ${t} is not registered.`);this.emit(new ls(X.BEFORE_ELEMENT_CREATE,t,e),n);const u=this.container.appendChild(new c({id:a,context:this.context,style:l}));this.shapeTypeMap[a]=o,this.elementMap[a]=u;const{stage:h="enter"}=n;(i=this.context.animation)===null||i===void 0||i.add({element:u,elementType:t,stage:h,originalStyle:Object.assign({},u.attributes),updatedStyle:l},{after:()=>{var d;this.emit(new ls(X.AFTER_ELEMENT_CREATE,t,e),n),(d=u.onCreate)===null||d===void 0||d.call(u)}})}createElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["node",n],["combo",a],["edge",i]].forEach(([o,l])=>{l.forEach(c=>this.createElement(o,c,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=F(e),{stage:s="update"}=n,o=this.getElement(a);if(!o)return()=>null;this.emit(new ls(X.BEFORE_ELEMENT_UPDATE,t,e),n);const l=this.getElementType(t,e),c=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 u=s!=="visibility"?s:c.visibility==="hidden"?"hide":"show";u==="hide"&&delete c.visibility,(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:t,stage:u,originalStyle:Object.assign({},o.attributes),updatedStyle:c},{before:()=>{const h=this.elementMap[a];s!=="collapse"&&fy(h,c),s==="visibility"&&(fet(h,"opacity")||det(h,"opacity"),this.visibilityCache.set(h,u==="show"?"visible":"hidden"),u==="show"&&Ba(h,"visible"))},after:()=>{var h;const d=this.elementMap[a];s==="collapse"&&fy(d,c),u==="hide"&&Ba(d,this.visibilityCache.get(d)),this.emit(new ls(X.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(c=>this.updateElement(o,c,e))})}markDestroyElement(t){Object.values(t.remove).forEach(e=>{e.forEach(n=>{const i=F(n),a=this.getElement(i);a&&qF(a)})})}destroyElement(t,e,n){var i;const{stage:a="exit"}=n,s=F(e),o=this.elementMap[s];if(!o)return()=>null;this.emit(new ls(X.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 ls(X.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(c=>this.destroyElement(o,c,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=>F(s)===e);if(a){const s=ye(this.context.model.getNodeLikeDatum(e)),o=ye(a),l=$t(s,o);(i=t.nodes)===null||i===void 0||i.forEach(c=>{var u,h,d;!((u=c.style)===null||u===void 0)&&u.x&&(c.style.x+=l[0]),!((h=c.style)===null||h===void 0)&&h.y&&(c.style.y+=l[1]),!((d=c.style)===null||d===void 0)&&d.z&&(c.style.z+=l[2]||0)})}}collapseNode(t,e){return ro(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 c=yield o.simulate();a&&this.alignLayoutResultToElement(c,t),s.updateData(c);const u=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!u)return;const{drawData:h}=u,{add:d,remove:f,update:g}=h;this.markDestroyElement(h);const v={animation:i,stage:"collapse",data:h};this.destroyElements(f,v),this.createElements(d,v),this.updateElements(g,v),yield(n=this.context.animation.animate(i,{beforeAnimate:p=>this.emit(new qn(X.BEFORE_ANIMATE,dn.COLLAPSE,p,h),v),afterAnimate:p=>this.emit(new qn(X.AFTER_ANIMATE,dn.COLLAPSE,p,h),v)},{collapse:{target:t,descendants:Array.from(f.nodes).map(([,p])=>F(p)),position:ye(g.nodes.get(t))}}))===null||n===void 0?void 0:n.finished})}expandNode(t,e){return ro(this,void 0,void 0,function*(){var n;const{model:i,layout:a}=this.context,{animation:s,align:o}=e,l=ye(i.getNodeData([t])[0]),c=this.computeChangesAndDrawData({stage:"expand",animation:s});if(!c)return;const{drawData:{add:u}}=c;this.createElements(u,{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:f}=d,{update:g}=f,v={animation:s,stage:"expand",data:f};u.edges.forEach(p=>g.edges.set(F(p),p)),u.nodes.forEach(p=>g.nodes.set(F(p),p)),this.updateElements(g,v),yield(n=this.context.animation.animate(s,{beforeAnimate:p=>this.emit(new qn(X.BEFORE_ANIMATE,dn.EXPAND,p,f),v),afterAnimate:p=>this.emit(new qn(X.AFTER_ANIMATE,dn.EXPAND,p,f),v)},{expand:{target:t,descendants:Array.from(u.nodes).map(([,p])=>F(p)),position:l}}))===null||n===void 0?void 0:n.finished})}collapseCombo(t,e){return ro(this,void 0,void 0,function*(){var n;const{model:i,element:a}=this.context;if(i.getAncestorsData(t,jt).some(v=>mn(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:c,drawData:u}=l;this.markDestroyElement(u);const{update:h,remove:d}=u,f={animation:e,stage:"collapse",data:u};this.destroyElements(d,f),this.updateElements(h,f);const g=v=>Array.from(v).map(([,p])=>F(p));yield(n=this.context.animation.animate(e,{before:()=>this.emit(new xe(X.BEFORE_DRAW,{dataChanges:c,animation:e}),f),beforeAnimate:v=>this.emit(new qn(X.BEFORE_ANIMATE,dn.COLLAPSE,v,u),f),afterAnimate:v=>this.emit(new qn(X.AFTER_ANIMATE,dn.COLLAPSE,v,u),f),after:()=>this.emit(new xe(X.AFTER_DRAW,{dataChanges:c,animation:e}),f)},{collapse:{target:t,descendants:[...g(d.nodes),...g(d.combos)],position:o}}))===null||n===void 0?void 0:n.finished})}expandCombo(t,e){return ro(this,void 0,void 0,function*(){var n;const{model:i}=this.context,a=ye(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:c,update:u}=l,h={animation:e,stage:"expand",data:l,target:t};this.createElements(c,h),this.updateElements(u,h);const d=f=>Array.from(f).map(([,g])=>F(g));yield(n=this.context.animation.animate(e,{before:()=>this.emit(new xe(X.BEFORE_DRAW,{dataChanges:o,animation:e}),h),beforeAnimate:f=>this.emit(new qn(X.BEFORE_ANIMATE,dn.EXPAND,f,l),h),afterAnimate:f=>this.emit(new qn(X.AFTER_ANIMATE,dn.EXPAND,f,l),h),after:()=>this.emit(new xe(X.AFTER_DRAW,{dataChanges:o,animation:e}),h)},{expand:{target:t,descendants:[...d(c.nodes),...d(c.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 us=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})},xet=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 Eet{get presetOptions(){return{animation:!!sT(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 us(this,void 0,void 0,function*(){var e,n,i,a;const{graph:s,model:o}=this.context,{add:l}=t;Oe(s,new xe(X.BEFORE_LAYOUT,{type:"pre"}));const c=yield(e=this.context.layout)===null||e===void 0?void 0:e.simulate();(n=c==null?void 0:c.nodes)===null||n===void 0||n.forEach(u=>{const h=F(u),d=l.nodes.get(h);o.syncNodeLikeDatum(u),d&&Object.assign(d.style,u.style)}),(i=c==null?void 0:c.edges)===null||i===void 0||i.forEach(u=>{const h=F(u),d=l.edges.get(h);o.syncEdgeDatum(u),d&&Object.assign(d.style,u.style)}),(a=c==null?void 0:c.combos)===null||a===void 0||a.forEach(u=>{const h=F(u),d=l.combos.get(h);o.syncNodeLikeDatum(u),d&&Object.assign(d.style,u.style)}),Oe(s,new xe(X.AFTER_LAYOUT,{type:"pre"})),this.transformDataAfterLayout("pre",t)})}postLayout(){return us(this,arguments,void 0,function*(t=this.options){if(!t)return;const e=Array.isArray(t)?t:[t],{graph:n}=this.context;Oe(n,new xe(X.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);Oe(n,new xe(X.BEFORE_STAGE_LAYOUT,{options:o,index:a}));const l=yield this.stepLayout(s,o,a);Oe(n,new xe(X.AFTER_STAGE_LAYOUT,{options:o,index:a})),i.animation||this.updateElementPosition(l,!1)}Oe(n,new xe(X.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 us(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 us(this,void 0,void 0,function*(){return XF(e)?yield this.treeLayout(t,e,n):yield this.graphLayout(t,e,n)})}graphLayout(t,e,n){return us(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 c=o;return this.supervisor=new nK(c.graphData2LayoutModel(t),c.instance,{iterations:s}),zc(yield this.supervisor.execute())}if(ky(o))return i?yield o.execute(t,{onTick:c=>{this.updateElementPosition(c,!1)}}):(o.execute(t),o.stop(),o.tick(s));const l=yield o.execute(t);if(i){const c=this.updateElementPosition(l,i);yield c==null?void 0:c.finished}return l})}treeLayout(t,e,n){return us(this,void 0,void 0,function*(){const{type:i,animation:a}=e,s=ri("layout",i);if(!s)return{};const{nodes:o=[],edges:l=[]}=t,c=new Ne({nodes:o.map(g=>({id:F(g),data:g.data||{}})),edges:l.map(g=>({id:F(g),source:g.source,target:g.target,data:g.data||{}}))});yet(c);const u={nodes:[],edges:[]},h={nodes:[],edges:[]};c.getRoots(Cn).forEach(g=>{Oa(g,b=>{b.children=c.getSuccessors(b.id)},b=>c.getSuccessors(b.id),"TB");const v=s(g,e),{x:p,y:m,z:y=0}=v;Oa(v,b=>{const{id:w,x,y:S,z:E=0}=b;u.nodes.push({id:w,style:{x:p,y:m,z:y}}),h.nodes.push({id:w,style:{x,y:S,z:E}})},b=>b.children,"TB")});const f=this.inferTreeLayoutOffset(h);if(cM(h,f),a){cM(u,f),this.updateElementPosition(u,!1);const g=this.updateElementPosition(h,a);yield g==null?void 0:g.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:p=0,y:m=0}=v.style||{};n=Math.min(n,p),i=Math.max(i,p),a=Math.min(a,m),s=Math.max(s,m)});const{canvas:o}=this.context,l=o.getSize(),[c,u]=o.getCanvasByViewport([0,0]),[h,d]=o.getCanvasByViewport(l);if(n>=c&&i<=h&&a>=u&&s<=d)return[0,0];const f=(c+h)/2,g=(u+d)/2;return[f-(n+i)/2,g-(a+s)/2]}stopLayout(){this.instance&&ky(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:c}=this.context,u=v=>l.getElement(v),h=n?v=>{var p;return!i&&(((p=v.style)===null||p===void 0?void 0:p.visibility)==="hidden"||c.getAncestorsData(v.id,Cn).some(mn)||c.getAncestorsData(v.id,jt).some(mn))?!1:e(v)}:v=>{const p=F(v),m=u(p);return!m||sh(m)?!1:e(v)},d=a.filter(h),f=new Map(d.map(v=>[F(v),v]));o.forEach(v=>f.set(F(v),v));const g=s.filter(({source:v,target:p})=>f.has(v)&&f.has(p));return{nodes:d,edges:g,combos:o}}initGraphLayout(t){var e;const{element:n,viewport:i}=this.context,{type:a,enableWorker:s,animation:o,iterations:l}=t,c=xet(t,["type","enableWorker","animation","iterations"]),[u,h]=i.getCanvasSize(),d=[u/2,h/2],f=(e=t==null?void 0:t.nodeSize)!==null&&e!==void 0?e:y=>{const b=n==null?void 0:n.getElement(y.id);return b?b.attributes.size:n==null?void 0:n.getElementComputedStyle("node",y).size},g=ri("layout",a);if(!g)return Ar.warn(`The layout of ${a} is not registered.`);const v=Object.getPrototypeOf(g.prototype)===hh.prototype?g:ZF(g,this.context),p=new v(this.context),m={nodeSize:f,width:u,height:h,center:d};switch(p.id){case"d3-force":case"d3-force-3d":Object.assign(m,{center:{x:u/2,y:h/2,z:0}});break}return on(p.options,m,c),p}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 cM=(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 _et(r){return[ket].reduce((e,n)=>n(e),r)}function ket(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 Met extends x1{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;Ar.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 Nc=["update-related-edges","collapse-expand-node","collapse-expand-combo","get-edge-actual-ends","arrange-draw-order"];class Cet extends x1{constructor(t){super(t),this.category="transform",this.setTransforms(this.context.options.transforms||[])}getTransforms(){}setTransforms(t){this.setExtensions([...Nc.slice(0,Nc.length-1),...t,Nc[Nc.length-1]])}getTransformInstance(t){return t?this.extensionMap[t]:this.extensionMap}}var io=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class Tet{get padding(){return Pr(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(c=>{c[n].apply(c,o)}),l}}})}createLandmark(t){return this.camera.createLandmark(`landmark-${this.landmarkCounter++}`,t)}getAnimation(t){const e=sT(this.context.options,t);return e?La(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,c]=this.getCanvasCenter(),[u=0,h=0,d=0]=i,f=ur([-u,-h,-d],a);return n==="relative"?{position:ft(s,f),focalPoint:ft(o,f)}:{position:ft([l,c,s[2]],f),focalPoint:ft([l,c,o[2]],f)}}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 ce(i==="relative"?n*a:a,...e)}transform(t,e){return io(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(Oe(n,new Pc(X.BEFORE_TRANSFORM,t)),!a&&s&&!i&&o&&!l){this.camera.setZoomByViewportPoint(this.getZoomOptions(t),o),Oe(n,new Pc(X.AFTER_TRANSFORM,t));return}const c={};if(i&&Object.assign(c,this.getTranslateOptions(t)),nt(a)&&Object.assign(c,this.getRotateOptions(t)),nt(s)&&Object.assign(c,{zoom:this.getZoomOptions(t)}),l)return Oe(n,new qn(X.BEFORE_ANIMATE,dn.TRANSFORM,null,t)),new Promise(u=>{this.transformResolver=u,this.camera.gotoLandmark(this.createLandmark(c),Object.assign(Object.assign({},l),{onfinish:()=>{Oe(n,new qn(X.AFTER_ANIMATE,dn.TRANSFORM,null,t)),Oe(n,new Pc(X.AFTER_TRANSFORM,t)),this.transformResolver=void 0,u()}}))});this.camera.gotoLandmark(this.createLandmark(c),{duration:0}),Oe(n,new Pc(X.AFTER_TRANSFORM,t))})}fitView(t,e){return io(this,void 0,void 0,function*(){const[n,i,a,s]=this.padding,{when:o="always",direction:l="both"}=t||{},[c,u]=this.context.canvas.getSize(),h=c-s-i,d=u-n-a,f=this.context.canvas.getBounds(),g=this.getBBoxInViewport(f),[v,p]=ta(g),m=l==="x"&&v>=h||l==="y"&&p>=d||l==="both"&&v>=h&&p>=d;if(o==="overflow"&&!m)return yield this.fitCenter({animation:e});const y=h/v,b=d/p,w=l==="x"?y:l==="y"?b:Math.min(y,b),x=this.getAnimation(e);yield this.transform({mode:"relative",scale:w,translate:ft($t(this.getCanvasCenter(),this.getBBoxInViewport(f).center),ur(this.paddingOffset,w))},x)})}fitCenter(t){return io(this,void 0,void 0,function*(){const e=this.context.canvas.getBounds();yield this.focus(e,t)})}focusElements(t){return io(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=il(e.map(o=>a(i.getElement(o))));yield this.focus(s,n)})}focus(t,e){return io(this,void 0,void 0,function*(){const n=this.context.graph.getViewportByCanvas(t.center),i=e.position||this.getCanvasCenter(),a=$t(i,n);yield this.transform({mode:"relative",translate:ft(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),c=new Vt;return c.setMinMax([a,s,0],[o,l,0]),c}isInViewport(t,e=!1,n=0){const{graph:i}=this.context,a=this.getCanvasSize(),[s,o]=i.getCanvasByViewport([0,0]),[l,c]=i.getCanvasByViewport(a);let u=new Vt;return u.setMinMax([s,o,0],[l,c,0]),n&&(u=ea(u,n)),Ps(t)?cr(t,u):e?Z8(t,u):u.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 Gt=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class md extends uh{constructor(t){var e;super(),this.options={},this.rendered=!1,this.destroyed=!1,this.context={model:new bet},this.isCollapsingExpanding=!1,this.onResize=Zo(()=>{this.resize()},300),this._setOptions(Object.assign({},md.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,_et(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:c,theme:u,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),u&&this.setTheme(u),c&&this.setPlugins(c),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=at(t)?t(this.getTheme()):t}setLayout(t){this.options.layout=at(t)?t(this.getLayout()):t}getLayout(){return this.options.layout}setBehaviors(t){var e;this.options.behaviors=at(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=at(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=at(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(at(t)?t(this.getData()):t)}addData(t){this.context.model.addData(at(t)?t(this.getData()):t)}addNodeData(t){this.context.model.addNodeData(at(t)?t(this.getNodeData()):t)}addEdgeData(t){this.context.model.addEdgeData(at(t)?t(this.getEdgeData()):t)}addComboData(t){this.context.model.addComboData(at(t)?t(this.getComboData()):t)}addChildrenData(t,e){this.context.model.addChildrenData(t,e)}updateData(t){this.context.model.updateData(at(t)?t(this.getData()):t)}updateNodeData(t){this.context.model.updateNodeData(at(t)?t(this.getNodeData()):t)}updateEdgeData(t){this.context.model.updateEdgeData(at(t)?t(this.getEdgeData()):t)}updateComboData(t){this.context.model.updateComboData(at(t)?t(this.getComboData()):t)}removeData(t){this.context.model.removeData(at(t)?t(this.getData()):t)}removeNodeData(t){this.context.model.removeNodeData(at(t)?t(this.getNodeData()):t)}removeEdgeData(t){this.context.model.removeEdgeData(at(t)?t(this.getEdgeData()):t)}removeComboData(t){this.context.model.removeComboData(at(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 Gt(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:c=(t=globalThis.devicePixelRatio)!==null&&t!==void 0?t:1}=this.options;if(e instanceof rM)this.context.canvas=e,s&&e.setCursor(s),a&&e.setRenderer(a),yield e.ready;else{const u=Tt(e)?document.getElementById(e):e,h=sM(u);this.emit(X.BEFORE_CANVAS_INIT,{container:u,width:n,height:i});const d=Object.assign(Object.assign({},l),{container:u,width:n||h[0],height:i||h[1],background:o,renderer:a,cursor:s,devicePixelRatio:c}),f=new rM(d);this.context.canvas=f,yield f.ready,this.emit(X.AFTER_CANVAS_INIT,{canvas:f})}})}updateCanvas(t){var e,n;const{renderer:i,cursor:a,height:s,width:o}=t,l=this.context.canvas;l&&(i&&(this.emit(X.BEFORE_RENDERER_CHANGE,{renderer:this.options.renderer}),l.setRenderer(i),this.emit(X.AFTER_RENDERER_CHANGE,{renderer:i})),a&&l.setCursor(a),(nt(o)||nt(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 vet(this.context)),this.context.plugin||(this.context.plugin=new Met(this.context)),this.context.viewport||(this.context.viewport=new Tet(this.context)),this.context.transform||(this.context.transform=new Cet(this.context)),this.context.element||(this.context.element=new wet(this.context)),this.context.animation||(this.context.animation=new get(this.context)),this.context.layout||(this.context.layout=new Eet(this.context)),this.context.behavior||(this.context.behavior=new pet(this.context))}prepare(){return Gt(this,void 0,void 0,function*(){if(yield Promise.resolve(),this.destroyed)throw new Error(Xr("The graph instance has been destroyed"));yield this.initCanvas(),this.initRuntime()})}render(){return Gt(this,void 0,void 0,function*(){if(yield this.prepare(),Oe(this,new xe(X.BEFORE_RENDER)),this.options.layout)if(!this.rendered&&KF(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,Oe(this,new xe(X.AFTER_RENDER))})}draw(){return Gt(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 Gt(this,void 0,void 0,function*(){yield this.context.layout.postLayout(t)})}stopLayout(){this.context.layout.stopLayout()}clear(){return Gt(this,void 0,void 0,function*(){const{model:t,element:e}=this.context;t.setData({}),t.clearChanges(),e==null||e.clear()})}destroy(){var t;Oe(this,new xe(X.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,Oe(this,new xe(X.AFTER_DESTROY))}getCanvas(){return this.context.canvas}resize(t,e){var n;const i=sM((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)||(Oe(this,new xe(X.BEFORE_SIZE_CHANGE,{size:a})),this.context.canvas.resize(...a),Oe(this,new xe(X.AFTER_SIZE_CHANGE,{size:a})))}fitView(t,e){return Gt(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 Gt(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 Gt(this,void 0,void 0,function*(){const{autoFit:t}=this.context.options;if(t)if(Tt(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 Gt(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 Gt(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",scale:t,origin:n},e)})}zoomTo(t,e,n){return Gt(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 Gt(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",rotate:t,origin:n},e)})}rotateTo(t,e,n){return Gt(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 Gt(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",translate:t},e)})}translateTo(t,e){return Gt(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",translate:t},e)})}getPosition(){return $t([0,0],this.getCanvasByViewport([0,0]))}translateElementBy(t,e){return Gt(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=me(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(l).forEach(([u,h])=>this.context.model.translateNodeLikeBy(u,h)),yield(o=this.context.element.draw({animation:c,stage:"translate"}))===null||o===void 0?void 0:o.finished})}translateElementTo(t,e){return Gt(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=me(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(l).forEach(([u,h])=>this.context.model.translateNodeLikeTo(u,h)),yield(o=this.context.element.draw({animation:c,stage:"translate"}))===null||o===void 0?void 0:o.finished})}getElementPosition(t){return this.context.model.getElementPosition(t)}getElementRenderStyle(t){return i1(this.context.element.getElement(t).attributes,["context"])}setElementVisibility(t,e){return Gt(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=me(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],u={nodes:[],edges:[],combos:[]};Object.entries(l).forEach(([f,g])=>{const v=this.getElementType(f);u[`${v}s`].push({id:f,style:{visibility:g}})});const{model:h,element:d}=this.context;h.preventUpdateNodeLikeHierarchy(()=>{h.updateData(u)}),yield(o=d.draw({animation:c,stage:"visibility"}))===null||o===void 0?void 0:o.finished})}showElement(t,e){return Gt(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 Gt(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 Gt(this,void 0,void 0,function*(){var n;const i={nodes:[],edges:[],combos:[]},a=me(t)?t:{[t]:e};Object.entries(a).forEach(([l,c])=>{const u=this.getElementType(l);i[`${u}s`].push({id:l,style:{zIndex:c}})});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 Gt(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,jt).at(-1)||this.getComboData(a),c=[l,...n.getDescendantsData(F(l))],u=s-oM(l);c.forEach(d=>{i[F(d)]=this.getElementZIndex(F(d))+u});const{internal:h}=hy(c.map(F),d=>n.getRelatedEdgesData(d));h.forEach(d=>{const f=F(d);i[f]=this.getElementZIndex(f)+u})}else i[a]=s}),yield this.setElementZIndex(i)})}getElementZIndex(t){return oM(this.context.model.getElementDataById(t))}setElementState(t,e){return Gt(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=me(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],u=d=>d?Array.isArray(d)?d:[d]:[],h={nodes:[],edges:[],combos:[]};Object.entries(l).forEach(([d,f])=>{const g=this.getElementType(d);h[`${g}s`].push({id:d,states:u(f)})}),this.updateData(h),yield(o=this.context.element.draw({animation:c,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 Gt(this,arguments,void 0,function*(e,n=!0){const{model:i,element:a}=this.context;if(mn(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 Gt(this,arguments,void 0,function*(e,n=!0){const{model:i,element:a}=this.context;if(!mn(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 Gt(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)}}md.defaultOptions={autoResize:!1,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};var Oet=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 Aet(r,t){const{getNodeData:e=(o,l)=>{if(o.depth=l,!o.children)return o;const{children:c}=o,u=Oet(o,["children"]);return Object.assign(Object.assign({},u),{children:c.map(h=>h.id)})},getEdgeData:n=(o,l)=>({source:o.id,target:l.id}),getChildren:i=o=>o.children||[]}={},a=[],s=[];return Oa(r,(o,l)=>{a.push(e(o,l));const c=i(o);for(const u of c)s.push(n(o,u))},o=>i(o),"TB"),{nodes:a,edges:s}}class Pet extends di{beforeDraw(t){const{add:e,update:n}=t,{model:i}=this.context;return[...e.edges.entries(),...n.edges.entries()].forEach(([,a])=>{xN(i,a)}),t}}const xN=(r,t)=>{const{source:e,target:n}=t,i=r.getElementDataById(e),a=r.getElementDataById(n),s=Qb(i,h=>r.getParentData(h,jt)),o=Qb(a,h=>r.getParentData(h,jt)),l=F(s),c=F(o),u={sourceNode:l,targetNode:c};return t.style?Object.assign(t.style,u):t.style=u,t},Net=(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)},Ret=(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)},Let=(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)},Det=(r,t,e)=>{const[n,i]=t,[a,s]=e,o=Math.sqrt((r-n)/(i-n));return a+o*(s-a)};class yd extends di{constructor(t,e){super(t,on({},yd.defaultOptions,e)),this.assignSizeByCentrality=(n,i,a,s,o,l)=>{const c=[i,a],u=[s[0],o[0]],h=[s[1],o[1]],d=[s[2],o[2]],f=(g,v)=>{if(typeof l=="function")return l(g,c,v);switch(l){case"linear":return Net(g,c,v);case"log":return Ret(g,c,v);case"pow":return Let(g,c,v,2);case"sqrt":return Det(g,c,v);default:return v[0]}};return[f(n,u),f(n,h),f(n,d)]}}beforeDraw(t){const{model:e}=this.context,n=e.getNodeData(),i=Nn(this.options.maxSize),a=Nn(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(c=>{var u;const h=this.assignSizeByCentrality(s.get(F(c))||0,l,o,a,i,this.options.scale),d=(u=this.context.element)===null||u===void 0?void 0:u.getElement(F(c)),f={size:h};this.assignLabelStyle(f,h,c,d),(!d||!Hc(f,d.attributes))&&Pn(t,d?"update":"add","node",on(c,{style:f}),!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,La(s,["labelFontSize","labelLineHeight"])),this.options.mapLabelSize){const o=this.getLabelSizeByNodeSize(e,1/0,Number(t.labelFontSize));Object.assign(t,{labelFontSize:o,labelLineHeight:o+K8(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 mT(n,i,t)}}yd.defaultOptions={centrality:{type:"degree"},maxSize:80,minSize:20,scale:"linear",mapLabelSize:!1};class bd extends di{constructor(t,e){super(t,Object.assign({},bd.defaultOptions,e))}get ref(){return this.context.model.getRootsData()[0]}afterLayout(){var t;const e=ye(this.ref),{graph:n,model:i}=this.context;(t=i.getData().nodes)===null||t===void 0||t.forEach(s=>{var o;if(F(s)===F(this.ref))return;const l=bT($t(ye(s),e)),c=Math.abs(l)>Math.PI/2,u=!s.children||s.children.length===0,h=F(s),d=(o=this.context.element)===null||o===void 0?void 0:o.getElement(h);if(!d||!d.isVisible())return;const f=Nn(n.getElementRenderStyle(h).size)[0]/2,g=(u?1:-1)*(f+this.options.offset),v=[["translate",g*Math.cos(l),g*Math.sin(l)],["rotate",c?gn(l)+180:gn(l)]];i.updateNodeData([{id:F(s),style:{labelTextAlign:c===u?"right":"left",labelTextBaseline:"middle",labelTransform:v}}])}),n.draw()}}bd.defaultOptions={offset:5};const Iet="quadratic",uM=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class wd extends di{constructor(t,e){super(t,Object.assign({},wd.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:c}=this.context,u=new Map,h=(g,v)=>{c.getRelatedEdgesData(v).forEach(m=>!u.has(F(m))&&u.set(F(m),m))};a.forEach(h),o.forEach(h);const d=g=>{const v=c.getEdgeData().map(m=>xN(c,m));Fet(g,v).forEach(m=>!u.has(F(m))&&u.set(F(m),m))};if(l.size&&l.forEach(d),i.size&&i.forEach(d),s.size){const g=CP(d2(c.getChanges())).update.edges;s.forEach(v=>{var p;d(v);const m=(p=g.find(y=>F(y.value)===F(v)))===null||p===void 0?void 0:p.original;m&&!C2(v,m)&&d(m)})}wr(this.options.edges)||u.forEach((g,v)=>!this.options.edges.includes(v)&&u.delete(v));const f=c.getEdgeData().map(F);return new Map([...u].sort((g,v)=>f.indexOf(g[0])-f.indexOf(v[0])))},this.applyBundlingStyle=(n,i,a)=>{const{edgeMap:s,reverses:o}=hM(i);s.forEach(l=>{l.forEach((c,u,h)=>{var d;const f=h.length,g=c.style||{};if(c.source===c.target){const m=uM.length;g.loopPlacement=uM[u%m],g.loopDist=Math.floor(u/m)*a+50}else if(f===1)g.curveOffset=0;else{const m=(u%2===0?1:-1)*(o[`${c.source}|${c.target}|${u}`]?-1:1);g.curveOffset=f%2===1?m*Math.ceil(u/2)*a*2:m*(Math.floor(u/2)*a*2+a)}const v=Object.assign(c,{type:Iet,style:g}),p=(d=this.context.element)===null||d===void 0?void 0:d.getElement(F(c));(!p||!Hc(v.style,p.attributes))&&Pn(n,p?"update":"add","edge",v,!0)})})},this.resetEdgeStyle=n=>{const i=n.style||{},a=this.cacheMergeStyle.get(F(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}=hM(i);a.forEach(o=>{var l;if(o.length===1){const u=o[0],h=(l=this.context.element)===null||l===void 0?void 0:l.getElement(F(u)),d=this.resetEdgeStyle(u);(!h||!Hc(d,h.attributes))&&Pn(n,h?"update":"add","edge",d);return}const c=o.map(({source:u,target:h,style:d={}},f)=>{const{startArrow:g,endArrow:v}=d,p={},[m,y]=s[`${u}|${h}|${f}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return nu(g)&&(p[m]=g),nu(v)&&(p[y]=v),p}).reduce((u,h)=>Object.assign(Object.assign({},u),h),{});o.forEach((u,h,d)=>{var f;if(h!==0){Pn(n,"remove","edge",u);return}const g=Object.assign({},at(this.options.style)?this.options.style(d):this.options.style,{childrenData:d});this.cacheMergeStyle.set(F(u),g);const v=Object.assign(Object.assign({},u),{type:"line",style:Object.assign(Object.assign(Object.assign({},u.style),c),g)}),p=(f=this.context.element)===null||f===void 0?void 0:f.getElement(F(u));(!p||!Hc(v.style,p.attributes))&&Pn(n,p?"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}}wd.defaultOptions={mode:"bundle",distance:15};const hM=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[c,u]of r)e.has(c)||C2(a,u)&&(t.get(l).push(u),e.add(c),s===u.target&&o===u.source&&(n[`${u.source}|${u.target}|${t.get(l).length-1}`]=!0))}return{edgeMap:t,reverses:n}},Fet=(r,t,e)=>t.filter(n=>C2(n,r)),C2=(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 Bet extends di{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=(c,u)=>{i.getRelatedEdgesData(u).forEach(d=>!s.has(F(d))&&s.set(F(d),d))};return a.forEach(l),o.forEach(l),t}}const zet={animation:{"combo-collapse":uT,"combo-expand":U8,"node-collapse":lT,"node-expand":V8,"path-in":cT,"path-out":H8,fade:G8,translate:W8},behavior:{"brush-select":al,"click-select":Ku,"collapse-expand":oh,"create-edge":lh,"drag-canvas":ch,"drag-element-force":QF,"drag-element":hl,"fix-element-size":dh,"focus-element":fh,"hover-activate":gh,"lasso-select":eB,"auto-adapt-label":Uu,"optimize-viewport-transform":vh,"scroll-canvas":ph,"zoom-canvas":mh},combo:{circle:J7,rect:Q7},edge:{cubic:Ha,line:ZT,polyline:ih,quadratic:ah,"cubic-horizontal":cl,"cubic-radial":nh,"cubic-vertical":rh},layout:{"antv-dagre":Q$,"combo-combined":Qq,"compact-box":fc.compactBox,"d3-force":kG,"force-atlas2":SX,circular:nj,concentric:Ey,dagre:Gh,dendrogram:fc.dendrogram,fishbone:Wh,force:RO,fruchterman:MX,grid:TX,indented:fc.indented,mds:GO,mindmap:fc.mindmap,radial:FX,random:WX,snake:Vh},node:{circle:ll,diamond:e7,ellipse:Qu,hexagon:s7,html:th,image:WT,rect:K7,star:Z7,donut:Ju,triangle:eh},palette:{spectral:sK,tableau:oK,oranges:lK,greens:cK,blues:uK},theme:{dark:eet,light:ret},plugin:{"bubble-sets":Yh,"edge-bundling":Kh,"edge-filter-lens":Zh,"grid-line":td,background:Hh,contextmenu:Xh,fisheye:Jh,fullscreen:Qh,history:ed,hull:nd,legend:cd,minimap:ud,snapline:hd,timebar:dd,toolbar:fd,tooltip:gd,watermark:vd},transform:{"arrange-draw-order":iet,"collapse-expand-combo":aet,"collapse-expand-node":set,"get-edge-actual-ends":Pet,"map-node-size":yd,"place-radial-labels":bd,"process-parallel-edges":wd,"update-related-edges":Bet},shape:{circle:li,ellipse:el,group:Pe,html:nl,image:M1,line:Fa,path:Tn,polygon:Va,polyline:Vu,rect:Be,text:Qi,label:na,badge:ei}};function $et(){Object.entries(zet).forEach(([r,t])=>{Object.entries(t).forEach(([e,n])=>{Eo(r,e,n)})})}$et();const jet={class:"progress"},qet={__name:"MindMapping",props:{data:Object,loading:Boolean},setup(r){const t=r,e=Rt(null),n=Rt(0),i=Rt(null),a=()=>{i.value=setInterval(()=>{n.value+=Math.random()>.5?3:2,n.value>98&&(n.value=98,clearInterval(i.value))},1e3)};Zy(()=>{t.loading&&!t.data&&a()}),Jy(()=>{clearInterval(i.value)}),Uc(()=>t.loading,S=>{S&&!t.data?a():clearInterval(i.value)}),Uc(()=>t.data,S=>{S&&b(S)});const s={fill:"#EFF0F0",labelFill:"#262626",labelFontSize:24,labelFontWeight:600,labelOffsetY:8,labelPlacement:"center",ports:[{placement:"right"},{placement:"left"}],radius:8},o={fill:"transparent",labelPlacement:"center",labelFontSize:16,ports:[{placement:"right-bottom"},{placement:"left-bottom"}]},l={COLLAPSE_EXPAND:"collapse-expand",ADD_CHILD:"add-child"};let c;const u=S=>(c||(c=new Qi({style:S})),c.attr(S),c.getBBox().width),h=(S,E)=>{const _=E?40:30;return u({text:S,fontSize:(E?s:o).labelFontSize,fontFamily:"Gill Sans"})+_},d=(S,E)=>[h(S,E),E?48:32],w=class w extends Xn{constructor(E){Object.assign(E.style,w.defaultStyleProps),super(E)}get childrenData(){return this.context.model.getChildrenData(this.id)}get rootId(){return F(this.context.model.getRootsData()[0])}isShowCollapse(E){const{collapsed:_,showIcon:C}=E;return!_&&C&&this.childrenData.length>0}getCollapseStyle(E){const{color:_,direction:C}=E;if(!this.isShowCollapse(E))return!1;const[k,M]=this.getSize(E);return{backgroundFill:_,backgroundHeight:12,backgroundWidth:12,cursor:"pointer",stroke:_,lineWidth:4,fontSize:0,text:"",textAlign:"center",transform:[],visibility:"visible",x:C==="left"?-6:k+6,y:M}}drawCollapseShape(E,_){const C=this.getCollapseStyle(E),k=this.upsert("collapse-expand",ei,C,_);this.forwardEvent(k,z.CLICK,M=>{M.stopPropagation(),this.context.graph.emit(l.COLLAPSE_EXPAND,{id:this.id,collapsed:!E.collapsed})})}getCountStyle(E){const{collapsed:_,color:C,direction:k}=E,M=this.context.model.getDescendantsData(this.id).length;if(!_||M===0)return!1;const[T,O]=this.getSize(E);return{backgroundFill:C,backgroundHeight:12,backgroundWidth:12,cursor:"pointer",fill:"#fff",fontSize:8,text:M.toString(),textAlign:"center",x:k==="left"?-4:T+4,y:O}}drawCountShape(E,_){const C=this.getCountStyle(E),k=this.upsert("count",ei,C,_);this.forwardEvent(k,z.CLICK,M=>{M.stopPropagation(),this.context.graph.emit(l.COLLAPSE_EXPAND,{id:this.id,collapsed:!1})})}getAddStyle(E){const{collapsed:_,showIcon:C,direction:k}=E,M=this.childrenData.length===0;if(_||!C||!M)return!1;const[T,O]=this.getSize(E),R=this.isShowCollapse(E)?24:12,D=this.id===this.rootId;return{backgroundFill:"#1783FF",backgroundHeight:14,backgroundLineWidth:1,backgroundStroke:"#1783FF",backgroundWidth:14,cursor:"pointer",fill:"#fff",fontSize:14,text:"+",textAlign:"center",x:D?T+12:k==="left"?-R:T+R,y:D?O/2:O}}drawAddShape(E,_){const C=this.getAddStyle(E),k=this.upsert("add",ei,C,_);this.forwardEvent(k,z.CLICK,M=>{M.stopPropagation(),this.context.graph.emit(l.ADD_CHILD,{id:this.id,direction:E.direction})})}forwardEvent(E,_,C){E&&!Reflect.has(E,"__bind__")&&(Reflect.set(E,"__bind__",!0),E.addEventListener(_,C))}getKeyStyle(E){const[_,C]=this.getSize(E),k=super.getKeyStyle(E);return{width:_,height:C,...k}}drawKeyShape(E,_){const C=this.getKeyStyle(E);return this.upsert("key",Be,C,_)}render(E=this.parsedAttributes,_=this){super.render(E,_),this.drawCollapseShape(E,_),this.drawAddShape(E,_),this.drawCountShape(E,_)}};Ot(w,"defaultStyleProps",{showIcon:!0});let f=w;class g extends cl{get rootId(){return F(this.context.model.getRootsData()[0])}getKeyPath(E){const _=super.getKeyPath(E),C=this.targetNode.id===this.rootId,k=h(this.targetNode.id,C),[,M]=this.getEndpoints(E),T=this.sourceNode.getCenter()[0]<this.targetNode.getCenter()[0]?1:-1;return[..._,["L",M[0]+k*T,M[1]]]}}class v extends xn{constructor(_,C){super(_,C);Ot(this,"status","idle");Ot(this,"showIcon",_=>{this.setIcon(_,!0)});Ot(this,"hideIcon",_=>{this.setIcon(_,!1)});Ot(this,"setIcon",(_,C)=>{if(this.status!=="idle")return;const{target:k}=_,M=k.id,{graph:T,element:O}=this.context;T.updateNodeData([{id:M,style:{showIcon:C}}]),O.draw({animation:!1,silence:!0})});Ot(this,"onCollapseExpand",async _=>{this.status="busy";const{id:C,collapsed:k}=_,{graph:M}=this.context;await M.frontElement(C),k?await M.collapseElement(C):await M.expandElement(C),this.status="idle"});Ot(this,"addChild",async _=>{this.status="busy";const{onCreateChild:C=()=>({id:`新节点 in ${new Date(Date.now()).toLocaleString()}`})}=this.options,{graph:k}=this.context,M=C(_.id),T=k.getNodeData(_.id);k.addNodeData([M]),k.addEdgeData([{source:_.id,target:M.id}]),k.updateNodeData([{id:_.id,children:[...T.children||[],M.id],style:{collapsed:!1,showIcon:!1}}]),await k.render(),await k.focusElement(M.id),this.status="idle"});this.bindEvents()}update(_){this.unbindEvents(),super.update(_),this.bindEvents()}bindEvents(){const{graph:_}=this.context;_.on(l.COLLAPSE_EXPAND,this.onCollapseExpand),_.on(l.ADD_CHILD,this.addChild)}unbindEvents(){const{graph:_}=this.context;_.off(l.COLLAPSE_EXPAND,this.onCollapseExpand),_.off(l.ADD_CHILD,this.addChild)}}const x=class x extends di{constructor(E,_){super(E,Object.assign({},x.defaultOptions,_))}beforeDraw(E){const _=this.context.model.getNodeData(),C=this.context.model.getEdgeData();if(_.length===0)return E;let k=0;return _.forEach(M=>{M.style||(M.style={}),M.style.color=this.options.colors[k++%this.options.colors.length]}),C.forEach(M=>{const T=_.find(O=>O.id===M.target);T&&(M.style||(M.style={}),M.style.stroke=T.style.color)}),E}};Ot(x,"defaultOptions",{colors:["#80B4FF","#FFC8A2","#E6C8FF","#A2E6E6","#C8B4FF","#FFD878","#A2E680","#FFA2D8","#80C8D8","#80E6A2","#FFD878","#D880D8","#80C880","#FFA280","#80E6E6","#FFA2D8","#C8C8D8","#FFC8C8","#FFD878","#C8FF80"]});let p=x;Eo(Yr.NODE,"mindmap",f),Eo(Yr.EDGE,"mindmap",g),Eo(Yr.BEHAVIOR,"collapse-expand-tree",v),Eo(Yr.TRANSFORM,"assign-color-by-branch",p);const m=(S,E)=>{if(!E)return"center";const _=ye(S)[0];return ye(E)[0]>_?"left":"right"};let y=null;const b=S=>{var _,C;y&&y.destroy();const E=S.id;y=new md({container:e.value,width:((_=e.value)==null?void 0:_.clientWidth)||1e3,height:((C=e.value)==null?void 0:C.clientHeight)||800,fitView:!0,fitCenter:!0,data:Aet(S),node:{type:"mindmap",style:function(k){const M=m(k,this.getParentData(F(k),"tree")),T=F(k)===E;return{direction:M,labelText:F(k),size:d(F(k),T),labelFontFamily:"Gill Sans",labelBackground:!0,labelBackgroundFill:"transparent",labelPadding:M==="left"?[2,0,10,40]:[2,40,10,0],color:k.style.color,...T?s:o}}},edge:{type:"mindmap",style:{lineWidth:3,stroke:function(k){return this.getNodeData(k.target).style.color||"#99ADD1"}}},layout:{type:"mindmap",direction:"H",getHeight:()=>80,getWidth:k=>h(k.id,k.id===E),getVGap:()=>6,getHGap:()=>60,animation:!1,getSide:()=>"right"},behaviors:["drag-canvas","zoom-canvas","collapse-expand-tree"],transforms:["assign-color-by-branch"],animation:{duration:200}}),y.once(X.AFTER_RENDER,()=>{y.fitView()}),y.render()};return(S,E)=>{const _=ER;return ct(),le(_s,null,[WN(Xt("div",jet,[At(_,{type:"circle",width:"250","stroke-width":"10",percent:n.value/100,"show-text":!1},null,8,["percent"]),Xt("h1",null,ka(`${n.value}%`),1)],512),[[VN,!r.data&&r.loading]]),Xt("div",{ref_key:"container",ref:e,class:"mindmap-container"},null,512)],64)}}},Get=Zi(qet,[["__scopeId","data-v-a7ff0ca7"]]),Wet="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",Vet="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",Het="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",Uet="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",Yet="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='%23079455'%20/%3e%3cpath%20d='M6.38636%2022.7273L7.85298%2025.206H7.9098L9.38352%2022.7273H11.12L8.90057%2026.3636L11.1697%2030H9.40128L7.9098%2027.5178H7.85298L6.36151%2030H4.60014L6.87642%2026.3636L4.64276%2022.7273H6.38636ZM12.093%2030V22.7273H13.6307V28.7322H16.7486V30H12.093ZM21.7122%2024.8189C21.6838%2024.5324%2021.5618%2024.3099%2021.3464%2024.1513C21.131%2023.9927%2020.8386%2023.9134%2020.4693%2023.9134C20.2183%2023.9134%2020.0065%2023.9489%2019.8336%2024.0199C19.6608%2024.0885%2019.5282%2024.1844%2019.4359%2024.3075C19.3459%2024.4306%2019.301%2024.5703%2019.301%2024.7266C19.2962%2024.8568%2019.3234%2024.9704%2019.3826%2025.0675C19.4442%2025.1645%2019.5282%2025.2486%2019.6348%2025.3196C19.7413%2025.3883%2019.8644%2025.4486%2020.0041%2025.5007C20.1438%2025.5504%2020.2929%2025.593%2020.4515%2025.6286L21.1049%2025.7848C21.4222%2025.8558%2021.7134%2025.9505%2021.9785%2026.0689C22.2437%2026.1873%2022.4733%2026.3329%2022.6674%2026.5057C22.8616%2026.6785%2023.0119%2026.8821%2023.1184%2027.1165C23.2273%2027.3509%2023.283%2027.6196%2023.2853%2027.9226C23.283%2028.3677%2023.1693%2028.7536%2022.9444%2029.0803C22.7219%2029.4046%2022.3999%2029.6567%2021.9785%2029.8366C21.5595%2030.0142%2021.054%2030.103%2020.4622%2030.103C19.8751%2030.103%2019.3637%2030.013%2018.9281%2029.8331C18.4949%2029.6532%2018.1563%2029.3868%2017.9125%2029.0341C17.671%2028.679%2017.5443%2028.2398%2017.5325%2027.7166H19.0204C19.037%2027.9605%2019.1068%2028.1641%2019.2299%2028.3274C19.3554%2028.4884%2019.5223%2028.6103%2019.7306%2028.6932C19.9413%2028.7737%2020.1793%2028.8139%2020.4444%2028.8139C20.7048%2028.8139%2020.9309%2028.776%2021.1227%2028.7003C21.3168%2028.6245%2021.4672%2028.5192%2021.5737%2028.3842C21.6802%2028.2493%2021.7335%2028.0942%2021.7335%2027.919C21.7335%2027.7557%2021.685%2027.6184%2021.5879%2027.5071C21.4932%2027.3958%2021.3535%2027.3011%2021.1689%2027.223C20.9866%2027.1449%2020.7628%2027.0739%2020.4977%2027.0099L19.7058%2026.8111C19.0926%2026.6619%2018.6085%2026.4287%2018.2534%2026.1115C17.8983%2025.7943%2017.7219%2025.367%2017.7243%2024.8295C17.7219%2024.3892%2017.8391%2024.0045%2018.0758%2023.6754C18.3149%2023.3464%2018.6428%2023.0895%2019.0595%2022.9048C19.4761%2022.7202%2019.9496%2022.6278%2020.4799%2022.6278C21.0197%2022.6278%2021.4908%2022.7202%2021.8933%2022.9048C22.2981%2023.0895%2022.613%2023.3464%2022.8379%2023.6754C23.0628%2024.0045%2023.1788%2024.3857%2023.1859%2024.8189H21.7122Z'%20fill='white'%20/%3e%3c/svg%3e",Xet="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='33'%20height='16'%20rx='2'%20fill='%23079455'%20/%3e%3cpath%20d='M6.31214%2022.7273L7.77876%2025.206H7.83558L9.3093%2022.7273H11.0458L8.82635%2026.3636L11.0955%2030H9.32706L7.83558%2027.5178H7.77876L6.28729%2030H4.52592L6.8022%2026.3636L4.56854%2022.7273H6.31214ZM12.0188%2030V22.7273H13.5565V28.7322H16.6744V30H12.0188ZM21.638%2024.8189C21.6096%2024.5324%2021.4876%2024.3099%2021.2722%2024.1513C21.0568%2023.9927%2020.7644%2023.9134%2020.3951%2023.9134C20.1441%2023.9134%2019.9322%2023.9489%2019.7594%2024.0199C19.5866%2024.0885%2019.454%2024.1844%2019.3617%2024.3075C19.2717%2024.4306%2019.2267%2024.5703%2019.2267%2024.7266C19.222%2024.8568%2019.2492%2024.9704%2019.3084%2025.0675C19.37%2025.1645%2019.454%2025.2486%2019.5605%2025.3196C19.6671%2025.3883%2019.7902%2025.4486%2019.9299%2025.5007C20.0695%2025.5504%2020.2187%2025.593%2020.3773%2025.6286L21.0307%2025.7848C21.348%2025.8558%2021.6391%2025.9505%2021.9043%2026.0689C22.1694%2026.1873%2022.3991%2026.3329%2022.5932%2026.5057C22.7873%2026.6785%2022.9377%2026.8821%2023.0442%2027.1165C23.1531%2027.3509%2023.2087%2027.6196%2023.2111%2027.9226C23.2087%2028.3677%2023.0951%2028.7536%2022.8702%2029.0803C22.6477%2029.4046%2022.3257%2029.6567%2021.9043%2029.8366C21.4853%2030.0142%2020.9798%2030.103%2020.388%2030.103C19.8008%2030.103%2019.2895%2030.013%2018.8539%2029.8331C18.4206%2029.6532%2018.0821%2029.3868%2017.8382%2029.0341C17.5968%2028.679%2017.4701%2028.2398%2017.4583%2027.7166H18.9462C18.9628%2027.9605%2019.0326%2028.1641%2019.1557%2028.3274C19.2812%2028.4884%2019.4481%2028.6103%2019.6564%2028.6932C19.8671%2028.7737%2020.1051%2028.8139%2020.3702%2028.8139C20.6306%2028.8139%2020.8567%2028.776%2021.0485%2028.7003C21.2426%2028.6245%2021.3929%2028.5192%2021.4995%2028.3842C21.606%2028.2493%2021.6593%2028.0942%2021.6593%2027.919C21.6593%2027.7557%2021.6107%2027.6184%2021.5137%2027.5071C21.419%2027.3958%2021.2793%2027.3011%2021.0946%2027.223C20.9123%2027.1449%2020.6886%2027.0739%2020.4235%2027.0099L19.6316%2026.8111C19.0184%2026.6619%2018.5343%2026.4287%2018.1792%2026.1115C17.824%2025.7943%2017.6477%2025.367%2017.65%2024.8295C17.6477%2024.3892%2017.7649%2024.0045%2018.0016%2023.6754C18.2407%2023.3464%2018.5686%2023.0895%2018.9853%2022.9048C19.4019%2022.7202%2019.8754%2022.6278%2020.4057%2022.6278C20.9455%2022.6278%2021.4166%2022.7202%2021.8191%2022.9048C22.2239%2023.0895%2022.5388%2023.3464%2022.7637%2023.6754C22.9886%2024.0045%2023.1046%2024.3857%2023.1117%2024.8189H21.638ZM25.6871%2022.7273L27.1538%2025.206H27.2106L28.6843%2022.7273H30.4208L28.2013%2026.3636L30.4705%2030H28.7021L27.2106%2027.5178H27.1538L25.6623%2030H23.9009L26.1772%2026.3636L23.9435%2022.7273H25.6871Z'%20fill='white'%20/%3e%3c/svg%3e",Ket=["src","alt"],Zet={__name:"FileIcon",props:{name:String},setup(r){const t=r,e=i=>(i==null?void 0:i.slice(i.lastIndexOf(".")+1).toLowerCase())??"",n=Ee(()=>new URL(Object.assign({"../../assets/ai-search/doc.svg":Wet,"../../assets/ai-search/docx.svg":Vet,"../../assets/ai-search/pdf.svg":Het,"../../assets/ai-search/selected-files-collapse.svg":Uet,"../../assets/ai-search/xls.svg":Yet,"../../assets/ai-search/xlsx.svg":Xet})[`../../assets/ai-search/${e(t.name)}.svg`],import.meta.url).href);return(i,a)=>(ct(),le("img",{src:n.value,alt:i.file_type,class:"file-icon"},null,8,Ket))}},Jet=Zi(Zet,[["__scopeId","data-v-e10f06a3"]]),Qet={class:"image-aside-btn-container"},tnt=["src"],ent=["src"],nnt={__name:"PopoverImage",props:{src:String},setup(r){return(t,e)=>{const n=TM;return ct(),ee(n,null,{content:Lt(()=>[Xt("img",{src:r.src,class:"image-large-view"},null,8,ent)]),default:Lt(()=>[Xt("div",Qet,[Xt("img",{src:r.src,class:"image-aside-btn"},null,8,tnt)])]),_:1})}}},rnt=Zi(nnt,[["__scopeId","data-v-2a984fc9"]]),int={class:"chunk-list"},ant={key:1},snt={class:"card"},ont={class:"document-reference"},lnt={class:"popup-markdown"},cnt=["innerHTML"],unt=["innerHTML"],hnt=["onClick"],dnt={key:0},fnt={__name:"ChunkList",props:{chunks:Array,total:{type:Number,required:!0},highlight_word:String,page_size:{type:Number,default:10},loading:Boolean},emits:["clickDocumentButton","pageChange","pageSizeChange"],setup(r,{emit:t}){const e=r,n=t,i=u=>{n("clickDocumentButton",u)},a=u=>{if(!e.highlight_word)return u;const h=new RegExp(`(${e.highlight_word})`,"gi");return u.replace(h,'<span class="highlighted">$1</span>')},s=Rt(1),o=Rt(10),l=u=>{s.value=u,n("pageChange",u)},c=u=>{u.value=u,n("pageSizeChange",u)};return(u,h)=>{const d=pM,f=TM,g=Fu,v=mM,p=wR;return ct(),le("div",int,[r.loading?(ct(),ee(d,{key:0,dot:"",loading:r.loading},null,8,["loading"])):(ct(),le("div",ant,[(ct(!0),le(_s,null,Bu(r.chunks,(m,y)=>(ct(),le("div",{key:y},[Xt("div",snt,[m.image_url?(ct(),ee(rnt,{key:0,src:m.image_url},null,8,["src"])):Hn("",!0),Xt("div",ont,[At(f,{trigger:"hover"},{content:Lt(()=>[Xt("div",lnt,[Xt("div",{innerHTML:a(m.content_with_weight)},null,8,cnt)])]),default:Lt(()=>[Xt("div",{innerHTML:a(m.highlight),class:"highlight-content"},null,8,unt)]),_:2},1024),Xt("div",{class:"file-btn",onClick:b=>i(m)},[At(g,null,{default:Lt(()=>[At(Jet,{name:m.docnm_kwd},null,8,["name"]),Xt("div",null,ka(m.docnm_kwd),1)]),_:2},1024)],8,hnt)])]),y<r.chunks.length-1?(ct(),ee(v,{key:0,margin:12})):Hn("",!0)]))),128)),r.chunks.length>1?(ct(),le("div",dnt,[At(v),At(p,{current:s.value,total:r.total,"page-size":o.value,"show-total":"","show-page-size":"",onChange:l,onPageSizeChange:c},null,8,["current","total","page-size"])])):Hn("",!0)]))])}}},gnt=Zi(fnt,[["__scopeId","data-v-b3b13c46"]]);var vnt=Object.defineProperty,pnt=(r,t,e)=>t in r?vnt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Rc=(r,t,e)=>pnt(r,typeof t!="symbol"?t+"":t,e);class dM extends Error{constructor(t,e){super(t),Rc(this,"type"),Rc(this,"field"),Rc(this,"value"),Rc(this,"line"),this.name="ParseError",this.type=e.type,this.field=e.field,this.value=e.value,this.line=e.line}}function km(r){}function mnt(r){const{onEvent:t=km,onError:e=km,onRetry:n=km,onComment:i}=r;let a="",s=!0,o,l="",c="";function u(v){const p=s?v.replace(/^\xEF\xBB\xBF/,""):v,[m,y]=ynt(`${a}${p}`);for(const b of m)h(b);a=y,s=!1}function h(v){if(v===""){f();return}if(v.startsWith(":")){i&&i(v.slice(v.startsWith(": ")?2:1));return}const p=v.indexOf(":");if(p!==-1){const m=v.slice(0,p),y=v[p+1]===" "?2:1,b=v.slice(p+y);d(m,b,v);return}d(v,"",v)}function d(v,p,m){switch(v){case"event":c=p;break;case"data":l=`${l}${p}
- `;break;case"id":o=p.includes("\0")?void 0:p;break;case"retry":/^\d+$/.test(p)?n(parseInt(p,10)):e(new dM(`Invalid \`retry\` value: "${p}"`,{type:"invalid-retry",value:p,line:m}));break;default:e(new dM(`Unknown field "${v.length>20?`${v.slice(0,20)}…`:v}"`,{type:"unknown-field",field:v,value:p,line:m}));break}}function f(){l.length>0&&t({id:o,event:c||void 0,data:l.endsWith(`
- `)?l.slice(0,-1):l}),o=void 0,l="",c=""}function g(v={}){a&&v.consume&&h(a),o=void 0,l="",c="",a=""}return{feed:u,reset:g}}function ynt(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 bnt extends TransformStream{constructor({onError:t,onRetry:e,onComment:n}={}){let i;super({start(a){i=mnt({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 wnt(r){return Qy({url:"/rgflow/v1/chunk/retrieval_test",method:"post",data:r})}function xnt(r){return Qy({url:"/rgflow/v1/conversation/related_questions",method:"post",data:r})}function Ent(r){return Qy({url:"/rgflow/v1/conversation/mindmap",method:"post",data:r})}function Snt(){var s;const r=Rt({chunks:[],documents:[],total:0}),t=Rt(!1),e=HN(),n=((s=e==null?void 0:e.query)==null?void 0:s.id)||"",{getFileUrl:i}=EN(),a=async o=>{t.value=!0;try{const{data:l,code:c}=await wnt({...o,kb_id:o.kb_id??n});c===0?r.value={chunks:l.chunks.map(u=>({...u,image_url:i(u.image_id,"image")})),documents:l.doc_aggs,total:l.total}:r.value={chunks:[],documents:[],total:0}}catch{r.value={chunks:[],documents:[],total:0},$u.error("检索失败")}finally{t.value=!1}};return{chunks_data:Ee(()=>r.value),loading:Ee(()=>t.value),testChunk:a}}function _nt(){const r=Rt([]),t=Rt(!1);return{data:r,loading:t,fetchRelatedQuestions:async n=>{t.value=!0;try{const{data:i}=await xnt({question:n});r.value=(i==null?void 0:i.slice(0,5))??[]}catch(i){$u.error(i.message)}finally{t.value=!1}}}}function knt(){const r=Rt({}),t=Rt(!0),e=Rt(null),n=()=>{e.value&&clearTimeout(e.value),e.value=setTimeout(()=>{r.value={},clearTimeout(e.value)},1e3)},i=async(a,s)=>{var o;try{t.value=!1;const l=tR.get(),u=`${MM("RGFLOW_BASE_URL")}/v1/conversation/ask`,h=await fetch(u,{method:"POST",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify(a),signal:s==null?void 0:s.signal}),d=h.clone().json(),f=(o=h==null?void 0:h.body)==null?void 0:o.pipeThrough(new TextDecoderStream).pipeThrough(new bnt).getReader();for(;;){const g=await(f==null?void 0:f.read());if(g){const{done:v,value:p}=g;if(v){console.info("done"),n();break}try{const m=JSON.parse((p==null?void 0:p.data)||""),y=m==null?void 0:m.data;typeof y!="boolean"&&(r.value={...y,conversation_id:a==null?void 0:a.conversation_id})}catch(m){console.warn(m)}}}return console.info("done?"),t.value=!0,n(),{data:await d,response:h}}catch(l){t.value=!0,n(),console.warn(l)}};return Jy(()=>{e.value&&clearTimeout(e.value)}),{send:i,answer:r,done:t,resetAnswer:n}}function Mnt(){const r=Rt(null),t=Rt(!1);return{data:r,loading:t,fetchMindmap:async n=>{t.value=!0;try{const{data:i}=await Ent(n);r.value=i}catch{$u.error("获取思维导图失败")}finally{t.value=!1}}}}function EN(){return{getFileUrl:(t,e)=>{if(!t||!e)return"";const n=MM("RGFLOW_BASE_URL");let i="";switch(e){case"doc":case"docx":i=`${n}/document/${t}?ext=docx&prefix=document`;break;case"pdf":i=`${n}/v1/document/get/${t}`;break;case"image":i=`${n}/v1/document/image/${t}`;break;default:i=""}return i}}}var Cnt="[object Symbol]";function Tnt(r){return typeof r=="symbol"||cR(r)&&uR(r)==Cnt}function Ont(r,t){for(var e=-1,n=r==null?0:r.length,i=Array(n);++e<n;)i[e]=t(r[e],e,r);return i}var fM=N2?N2.prototype:void 0,gM=fM?fM.toString:void 0;function T2(r){if(typeof r=="string")return r;if(CM(r))return Ont(r,T2)+"";if(Tnt(r))return gM?gM.call(r):"";var t=r+"";return t=="0"&&1/r==-1/0?"-0":t}var Ant=/\s/;function Pnt(r){for(var t=r.length;t--&&Ant.test(r.charAt(t)););return t}var Nnt=/^\s+/;function Rnt(r){return r&&r.slice(0,Pnt(r)+1).replace(Nnt,"")}function Lnt(r,t,e,n){for(var i=r.length,a=e+-1;++a<i;)if(t(r[a],a,r))return a;return-1}function Dnt(r){return r!==r}function Int(r,t,e){for(var n=e-1,i=r.length;++n<i;)if(r[n]===t)return n;return-1}function SN(r,t,e){return t===t?Int(r,t,e):Lnt(r,Dnt,e)}function Fnt(r){return r==null?"":T2(r)}function Bnt(r,t,e){var n=-1,i=r.length;t<0&&(t=-t>i?0:i+t),e=e>i?i:e,e<0&&(e+=i),i=t>e?0:e-t>>>0,t>>>=0;for(var a=Array(i);++n<i;)a[n]=r[n+t];return a}function znt(r,t,e){var n=r.length;return e=e===void 0?n:e,!t&&e>=n?r:Bnt(r,t,e)}var $nt="\\ud800-\\udfff",jnt="\\u0300-\\u036f",qnt="\\ufe20-\\ufe2f",Gnt="\\u20d0-\\u20ff",Wnt=jnt+qnt+Gnt,Vnt="\\ufe0e\\ufe0f",Hnt="\\u200d",Unt=RegExp("["+Hnt+$nt+Wnt+Vnt+"]");function Ynt(r){return Unt.test(r)}function Xnt(r){return r.split("")}var _N="\\ud800-\\udfff",Knt="\\u0300-\\u036f",Znt="\\ufe20-\\ufe2f",Jnt="\\u20d0-\\u20ff",Qnt=Knt+Znt+Jnt,trt="\\ufe0e\\ufe0f",ert="["+_N+"]",Uy="["+Qnt+"]",Yy="\\ud83c[\\udffb-\\udfff]",nrt="(?:"+Uy+"|"+Yy+")",kN="[^"+_N+"]",MN="(?:\\ud83c[\\udde6-\\uddff]){2}",CN="[\\ud800-\\udbff][\\udc00-\\udfff]",rrt="\\u200d",TN=nrt+"?",ON="["+trt+"]?",irt="(?:"+rrt+"(?:"+[kN,MN,CN].join("|")+")"+ON+TN+")*",art=ON+TN+irt,srt="(?:"+[kN+Uy+"?",Uy,MN,CN,ert].join("|")+")",ort=RegExp(Yy+"(?="+Yy+")|"+srt+art,"g");function lrt(r){return r.match(ort)||[]}function vM(r){return Ynt(r)?lrt(r):Xnt(r)}var crt="[object Map]",urt="[object Set]",hrt=Object.prototype,drt=hrt.hasOwnProperty;function Mm(r){if(r==null)return!0;if(hR(r)&&(CM(r)||typeof r=="string"||typeof r.splice=="function"||dR(r)||fR(r)||gR(r)))return!r.length;var t=vR(r);if(t==crt||t==urt)return!r.size;if(pR(r))return!mR(r).length;for(var e in r)if(drt.call(r,e))return!1;return!0}function frt(r,t){for(var e=r.length;e--&&SN(t,r[e],0)>-1;);return e}function grt(r,t){for(var e=-1,n=r.length;++e<n&&SN(t,r[e],0)>-1;);return e}function Cm(r,t,e){if(r=Fnt(r),r&&t===void 0)return Rnt(r);if(!r||!(t=T2(t)))return r;var n=vM(r),i=vM(t),a=grt(n,i),s=frt(n,i)+1;return znt(n,a,s).join("")}const vrt={class:"ai-search-container"},prt={key:0,class:"search-results"},mrt={__name:"index",setup(r){const{t}=SM(),e=Rt(""),n=Rt(!1),i=Rt(!1),a=Rt(1e3),s=Rt(t("ai_search.mindmap_title")),o=Rt(!1),l=Rt(!0),c=Rt([]),u=Ii({page:1,page_size:10}),h=Rt(!1),d=Rt([]),f=Rt([]),g=Rt(""),v=Ii({doc_id:"",doc_name:"",drawer_url:"",image_url:"",positions:[]});Zy(async()=>{try{const{data:{rows:G}}=await SR();d.value=G,f.value=G.map(H=>H.id)}catch(G){console.error(G)}});const{send:m,answer:y,done:b}=knt(),{chunks_data:w,testChunk:x}=Snt(),{fetchRelatedQuestions:S,data:E}=_nt(),{data:_,loading:C,fetchMindmap:k}=Mnt(),{getFileUrl:M}=EN(),T=async G=>{const H=Cm(G);Mm(H)||(w.value={documents:[],chunks:[]},c.value=[],E.value=[],l.value=!1,o.value=!0,m({kb_ids:f.value,question:H}),x({kb_id:f.value,highlight:!0,question:H,page:1,size:u.page_size}),await S(H))},O=G=>{o.value||(e.value=G,T(G))},R=async(G,H=1,Y=10)=>{const K=Cm(e.value);o.value||Mm(K)||(h.value=!0,await x({kb_id:f.value,highlight:!0,question:K,doc_ids:G??c.value,page:H,size:Y}),h.value=!1)};Uc(b,G=>{G&&(o.value=!1)});const D=G=>{const{doc_id:H,docnm_kwd:Y,image_id:K,positions:tt}=G;s.value=Y,i.value=!0;const it=Y.split(".").pop().toLowerCase();switch(v.doc_id=H,v.doc_name=Y,v.drawer_url=M(H,it),v.image_url=M(K,"image"),v.positions=tt,it){case"pdf":g.value="pdf";break;case"doc":case"docx":g.value="doc";break}},L=()=>{s.value=t("ai_search.mindmap_title"),g.value="mindmap",i.value=!0,k({question:e.value,kb_ids:f.value})},P=G=>{f.value=G},A=G=>{const H=Cm(G);if(Mm(H)){$u.warning(t("ai_search.enter_search_content"));return}T(H),n.value=!0},I=G=>{A(G.target.value)},B=G=>{u.page=G,R(c.value,G,u.page_size)},j=G=>{u.page_size=G,R(c.value,u.page,G)};return(G,H)=>{const Y=_R,K=mM,tt=$N,it=Fu,_t=zN,Mt=_M,re=BN;return ct(),le(_s,null,[Xt("div",vrt,[At(cL,{model_list:d.value,onUpdateCheckedList:P},null,8,["model_list"]),Xt("div",{class:yn(["content-box",{"search-active":n.value}])},[At(Y,{class:"input-search",modelValue:e.value,"onUpdate:modelValue":H[0]||(H[0]=Re=>e.value=Re),placeholder:G.$t("ai_search.placeholder"),"search-button":"",loading:o.value,onPressEnter:I,onSearch:A},null,8,["modelValue","placeholder","loading"]),At(UN,{name:"fade"},{default:Lt(()=>{var Re,Le;return[n.value?(ct(),le("div",prt,[At(bL,{content:(Re=yr(y))==null?void 0:Re.answer},null,8,["content"]),At(K),At(fL,{documents:yr(w).documents,selected_document_ids:c.value,onOnFilesSelected:R},null,8,["documents","selected_document_ids"]),At(K),At(gnt,{chunks:yr(w).chunks,total:yr(w).total,highlight_word:e.value,loading:h.value,onClickDocumentButton:D,onPageChange:B,onPageSizeChange:j},null,8,["chunks","total","highlight_word","loading"]),At(K),((Le=yr(E))==null?void 0:Le.length)>0?(ct(),ee(_t,{key:0,title:G.$t("ai_search.related_questions")},{default:Lt(()=>[At(it,{wrap:""},{default:Lt(()=>[(ct(!0),le(_s,null,Bu(yr(E),(cn,sa)=>(ct(),ee(tt,{key:sa,onClick:Pt=>O(cn),class:"related-question-tag"},{default:Lt(()=>[wM(ka(cn),1)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1},8,["title"])):Hn("",!0),At(K),At(Mt,{class:"floating-btn",shape:"circle",onClick:L},{default:Lt(()=>[At(yr(AR),{size:"32"})]),_:1})])):Hn("",!0)]}),_:1})],2)]),At(re,{visible:i.value,"onUpdate:visible":H[1]||(H[1]=Re=>i.value=Re),title:s.value,width:a.value,footer:!1},{default:Lt(()=>[g.value==="mindmap"?(ct(),ee(Get,{key:0,loading:yr(C),data:yr(_)},null,8,["loading","data"])):Hn("",!0),g.value==="pdf"?(ct(),ee(IN,{key:1,url:v.drawer_url,doc_width:a.value-20,positions:v.positions,'"':""},null,8,["url","doc_width","positions"])):Hn("",!0),g.value==="doc"?(ct(),ee(FN,{key:2,url:v.drawer_url,doc_width:a.value-20},null,8,["url","doc_width"])):Hn("",!0)]),_:1},8,["visible","title","width"])],64)}}},yrt=Zi(mrt,[["__scopeId","data-v-b5e61348"]]),pit={__name:"AISearch",setup(r){return(t,e)=>(ct(),ee(RN,null,{default:Lt(()=>[At(LN,null,{default:Lt(()=>[At(yrt)]),_:1})]),_:1}))}};export{pit as default};
|