| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- var Y$=Object.defineProperty;var A3=r=>{throw TypeError(r)};var X$=(r,t,e)=>t in r?Y$(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var le=(r,t,e)=>X$(r,typeof t!="symbol"?t+"":t,e),tv=(r,t,e)=>t.has(r)||A3("Cannot "+e);var ki=(r,t,e)=>(tv(r,t,"read from private field"),e?e.call(r):t.get(r)),ev=(r,t,e)=>t.has(r)?A3("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),qh=(r,t,e,n)=>(tv(r,t,"write to private field"),n?n.call(r,e):t.set(r,e),e),nv=(r,t,e)=>(tv(r,t,"access private method"),e);import K$ from"./LayoutExperience-CbDoKV7Z.js";import Z$ from"./ContentContainer-DBf1MglB.js";/* empty css */import{m as J$,c as Sx,D as Q$}from"./_commonjs-dynamic-modules-DecfrgjF.js";import{S as fR}from"./index-BchwKSUm.js";import{C as tj}from"./index-DXGQd2wS.js";import{S as t0}from"./index-BRUjRQKi.js";import{T as ej}from"./index-BLLeiZG3.js";import{D as gR}from"./index-CVlQLA_S.js";import{u as iw,b as nj}from"./index-mTH4NScl.js";import{d as Ws,c as He,o as jt,a as Ve,n as Tc,b as Mr,e as an,q as Mx,l as _o,p as dn,y as ve,m as Ds,k as Fa,P as $l,X as e0,Y as rj,A as pR,Z as vR,r as So,f as ue,O as ij,u as Oc,Q as n0,i as aj,s as sj,B as ae,F as mR,G as uc,V as Xi,w as aw,z as oj,D as lj,_ as uj,C as cj}from"./vue-vendor-DFp1TAzT.js";import"./index-vyFNDYIs.js";import{T as hj}from"./index-GR-EqkzY.js";import{Q as dj}from"./common-CoVB6VMO.js";import{_ as jo}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{I as fj}from"./index-DwMeJvvQ.js";import{_ as Gs,a as qo,i as jl,o as rv,b as iv,s as yR,c as bR,I as gj,d as pj,u as vj,B as wR,e as wt,f as mj,h as cf,j as yj,g as r0,k as P3,l as bj,m as qt,n as it,p as Ce,q as at,r as Rt,t as Fs,v as xR,w as ka,x as kx,y as wj}from"./index-B4_lrobW.js";import{I as xj}from"./index-BJGoGJ0P.js";import{R as Ej}from"./resize-observer-DVNiuBek.js";import{r as N3}from"./responsive-observe-747JICzb.js";import{C as _j,a as Sj}from"./index-CnCDiVmP.js";/* empty css *//* empty css */import{T as Mj,a as kj,P as Cj}from"./index-C5hcgeqI.js";/* empty css */import{T as Tj}from"./index-D_BZioyV.js";import{_ as Oj}from"./Header-COVz2D9q.js";import{P as Aj}from"./index-Bf1olR1x.js";import{P as Pj}from"./index-DFTGC7Tv.js";import{q as Nj}from"./rgflow-dify-DqdOJKOL.js";import{M as i0}from"./index-WrGBbeTK.js";import"./index-Bb_l1XT5.js";import"./render-function-BUOKTXkZ.js";import"./index.es-BW_FzNZC.js";/* empty css */import"./use-logout-C20S-VmD.js";import"./use-current-user-QbHvj0Tl.js";import"./login-bRsWxFRm.js";import"./index-Bdx2q6bW.js";const Rj=Ws({name:"IconAttachment",props:{size:{type:[Number,String]},strokeWidth:{type:Number,default:4},strokeLinecap:{type:String,default:"butt",validator:r=>["butt","round","square"].includes(r)},strokeLinejoin:{type:String,default:"miter",validator:r=>["arcs","bevel","miter","miter-clip","round"].includes(r)},rotate:Number,spin:Boolean},emits:{click:r=>!0},setup(r,{emit:t}){const e=qo("icon"),n=an(()=>[e,`${e}-attachment`,{[`${e}-spin`]:r.spin}]),i=an(()=>{const s={};return r.size&&(s.fontSize=jl(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)}}}}),Lj=["stroke-width","stroke-linecap","stroke-linejoin"],Ij=Ve("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),Dj=[Ij];function Fj(r,t,e,n,i,a){return jt(),He("svg",{viewBox:"0 0 48 48",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",class:Mr(r.cls),style:Tc(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))},Dj,14,Lj)}var av=Gs(Rj,[["render",Fj]]);const Bj=Object.assign(av,{install:(r,t)=>{var e;const n=(e=t==null?void 0:t.iconPrefix)!=null?e:"";r.component(n+av.name,av)}}),zj=Ws({name:"IconDragDot",props:{size:{type:[Number,String]},strokeWidth:{type:Number,default:4},strokeLinecap:{type:String,default:"butt",validator:r=>["butt","round","square"].includes(r)},strokeLinejoin:{type:String,default:"miter",validator:r=>["arcs","bevel","miter","miter-clip","round"].includes(r)},rotate:Number,spin:Boolean},emits:{click:r=>!0},setup(r,{emit:t}){const e=qo("icon"),n=an(()=>[e,`${e}-drag-dot`,{[`${e}-spin`]:r.spin}]),i=an(()=>{const s={};return r.size&&(s.fontSize=jl(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)}}}}),$j=["stroke-width","stroke-linecap","stroke-linejoin"],jj=Ve("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),qj=Ve("path",{d:"M40 17v2h-2v-2h2ZM25 17v2h-2v-2h2ZM10 17v2H8v-2h2ZM40 29v2h-2v-2h2ZM25 29v2h-2v-2h2ZM10 29v2H8v-2h2Z"},null,-1),Wj=[jj,qj];function Gj(r,t,e,n,i,a){return jt(),He("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",class:Mr(r.cls),style:Tc(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))},Wj,14,$j)}var sv=Gs(zj,[["render",Gj]]);const Vj=Object.assign(sv,{install:(r,t)=>{var e;const n=(e=t==null?void 0:t.iconPrefix)!=null?e:"";r.component(n+sv.name,sv)}}),Hj=Symbol("LayoutSiderInjectionKey"),Uj=Symbol("SiderInjectionKey");var Yj=Ws({name:"ResizeTrigger",components:{ResizeObserver:Ej,IconDragDot:Vj,IconDragDotVertical:xj},props:{prefixCls:{type:String,required:!0},direction:{type:String,default:"horizontal"}},emits:["resize"],setup(r,{emit:t}){const{direction:e,prefixCls:n}=Mx(r),i=an(()=>(e==null?void 0:e.value)==="horizontal");return{classNames:an(()=>[n.value,{[`${n.value}-horizontal`]:i.value,[`${n.value}-vertical`]:!i.value}]),onResize:o=>{t("resize",o)},isHorizontal:i}}});function Xj(r,t,e,n,i,a){const s=_o("IconDragDot"),o=_o("IconDragDotVertical"),l=_o("ResizeObserver");return jt(),dn(l,{onResize:r.onResize},{default:ve(()=>[Ve("div",{class:Mr(r.classNames)},[Ds(" @slot 自定义内容 "),Fa(r.$slots,"default",{},()=>[Ve("div",{class:Mr(`${r.prefixCls}-icon-wrapper`)},[Ds(" @slot 自定义 icon "),Fa(r.$slots,"icon",{},()=>[r.isHorizontal?(jt(),dn(s,{key:0,class:Mr(`${r.prefixCls}-icon`)},null,8,["class"])):(jt(),dn(o,{key:1,class:Mr(`${r.prefixCls}-icon`)},null,8,["class"]))])],2)])],2)]),_:3},8,["onResize"])}var Kj=Gs(Yj,[["render",Xj]]),Zj=Object.defineProperty,R3=Object.getOwnPropertySymbols,Jj=Object.prototype.hasOwnProperty,Qj=Object.prototype.propertyIsEnumerable,L3=(r,t,e)=>t in r?Zj(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ov=(r,t)=>{for(var e in t||(t={}))Jj.call(t,e)&&L3(r,e,t[e]);if(R3)for(var e of R3(t))Qj.call(t,e)&&L3(r,e,t[e]);return r};const ER="left",_R="right",Cx="top",Tx="bottom",tq=[ER,_R,Cx,Tx];function I3(r,t){if(r===0)return 0;const e=r-t;return e<=0?0:e}function lv(r){return[Cx,Tx].indexOf(r)>-1}const eq=Ws({name:"ResizeBox",components:{ResizeTrigger:Kj},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}=Mx(r),[a,s]=iw(null,So({value:n})),[o,l]=iw(null,So({value:e})),u=ue(),c=So({}),h=qo("resizebox"),d=an(()=>[h]),g=an(()=>ov(ov(ov({},jl(a.value)?{width:`${a.value}px`}:{}),jl(o.value)?{height:`${o.value}px`}:{}),c)),p=an(()=>i.value.filter(S=>tq.includes(S))),v={direction:"",startPageX:0,startPageY:0,startWidth:0,startHeight:0,moving:!1,padding:{left:0,right:0,top:0,bottom:0}};function m(S){if(!v.moving)return;const{startPageX:_,startPageY:M,startWidth:k,startHeight:C,direction:P}=v;let T=k,A=C;const R=S.pageX-_,L=S.pageY-M;switch(P){case ER:T=k-R,s(T),t("update:width",T);break;case _R:T=k+R,s(T),t("update:width",T);break;case Cx:A=C-L,l(A),t("update:height",A);break;case Tx:A=C+L,l(A),t("update:height",A);break}t("moving",{width:T,height:A},S)}function b(S){v.moving=!1,iv(window,"mousemove",m),iv(window,"mouseup",b),iv(window,"contextmenu",b),document.body.style.cursor="default",t("movingEnd",S)}function w(S,_){var M,k;t("movingStart",_),v.moving=!0,v.startPageX=_.pageX,v.startPageY=_.pageY,v.direction=S;const{top:C,left:P,right:T,bottom:A}=v.padding;v.startWidth=I3(((M=u.value)==null?void 0:M.clientWidth)||0,P+T),v.startHeight=I3(((k=u.value)==null?void 0:k.clientHeight)||0,C+A),rv(window,"mousemove",m),rv(window,"mouseup",b),rv(window,"contextmenu",b),document.body.style.cursor=lv(S)?"row-resize":"col-resize"}function x(S,_){const{width:M,height:k}=_.contentRect,C=lv(S)?k:M;v.padding[S]=C,c[`padding-${S}`]=`${C}px`}return{prefixCls:h,classNames:d,styles:g,wrapperRef:u,onMoveStart:w,isHorizontal:lv,allowDirections:p,onTiggerResize:x}}});function nq(r,t,e,n,i,a){const s=_o("ResizeTrigger");return jt(),dn(vR(r.component),pR({ref:"wrapperRef",class:r.classNames},r.$attrs,{style:r.styles}),{default:ve(()=>[Fa(r.$slots,"default"),(jt(!0),He($l,null,e0(r.allowDirections,o=>(jt(),dn(s,{key:o,"prefix-cls":`${r.prefixCls}-trigger`,class:Mr(`${r.prefixCls}-direction-${o}`),direction:r.isHorizontal(o)?"horizontal":"vertical",onMousedown:l=>{r.onMoveStart(o,l)},onResize:l=>{r.onTiggerResize(o,l)}},rj({default:ve(()=>[r.$slots["resize-trigger"]?Fa(r.$slots,"resize-trigger",{key:0,direction:o}):Ds("v-if",!0)]),_:2},[r.$slots["resize-trigger-icon"]?{name:"icon",fn:ve(()=>[Fa(r.$slots,"resize-trigger-icon",{direction:o})])}:void 0]),1032,["prefix-cls","class","direction","onMousedown","onResize"]))),128))]),_:3},16,["class","style"])}var uv=Gs(eq,[["render",nq]]);const rq=Object.assign(uv,{install:(r,t)=>{yR(r,t);const e=bR(t);r.component(e+uv.name,uv)}});function iq(r,t){const e=an(()=>ij(r)?r.value:r);let n="";Oc(()=>{n=N3.subscribe((i,a)=>{e.value&&(!a||a===e.value)&&t(!!i[e.value])})}),n0(()=>{n&&N3.unsubscribe(n)})}const aq=(()=>{let r=0;return(t="")=>(r+=1,`${t}${r}`)})();var sq=Ws({name:"LayoutSider",components:{IconLeft:gj,IconRight:fj,ResizeBox:rq},props:{theme:{type:String,default:"light"},collapsed:{type:Boolean,default:void 0},defaultCollapsed:{type:Boolean},collapsible:{type:Boolean},width:{type:Number,default:200},collapsedWidth:{type:Number,default:48},reverseArrow:{type:Boolean},breakpoint:{type:String},resizeDirections:{type:Array,default:void 0},hideTrigger:{type:Boolean}},emits:["collapse","update:collapsed","breakpoint"],setup(r,{emit:t}){const{theme:e,collapsed:n,defaultCollapsed:i,collapsible:a,hideTrigger:s,breakpoint:o,collapsedWidth:l,resizeDirections:u}=Mx(r),[c,h]=iw(i.value,So({value:n})),d=an(()=>u.value?"ResizeBox":"div"),g=an(()=>a.value&&!s.value),p=qo("layout-sider"),v=an(()=>[p,{[`${p}-light`]:e.value==="light",[`${p}-has-trigger`]:g.value,[`${p}-collapsed`]:n.value}]),m=an(()=>{const{width:_,collapsedWidth:M}=r,k=c.value?M:_;return jl(k)?`${k}px`:String(k)}),b=an(()=>[`${p}-trigger`,{[`${p}-trigger-light`]:e.value==="light"}]),w=()=>{const _=!c.value;h(_),t("update:collapsed",_),t("collapse",_,"clickTrigger")};iq(o,_=>{const M=!_;M!==c.value&&(h(M),t("update:collapsed",M),t("collapse",M,"responsive"),t("breakpoint",M))});const x=aq("__arco_layout_sider"),S=aj(Hj,void 0);return Oc(()=>{var _;(_=S==null?void 0:S.onSiderMount)==null||_.call(S,x)}),n0(()=>{var _;(_=S==null?void 0:S.onSiderUnMount)==null||_.call(S,x)}),sj(Uj,So({theme:e,collapsed:c,collapsedWidth:l})),{componentTag:d,prefixCls:p,classNames:v,triggerClassNames:b,localCollapsed:c,siderWidth:m,showTrigger:g,toggleTrigger:w}}});const oq={key:0},lq={key:1};function uq(r,t,e,n,i,a){const s=_o("IconLeft"),o=_o("IconRight");return jt(),dn(vR(r.componentTag),pR({class:r.classNames,style:{width:r.siderWidth}},r.resizeDirections?{directions:r.resizeDirections}:{}),{default:ve(()=>[Ve("div",{class:Mr(`${r.prefixCls}-children`)},[Fa(r.$slots,"default")],2),r.showTrigger?(jt(),He("div",{key:0,class:Mr(r.triggerClassNames),style:Tc({width:r.siderWidth}),onClick:t[0]||(t[0]=(...l)=>r.toggleTrigger&&r.toggleTrigger(...l))},[Fa(r.$slots,"trigger",{collapsed:r.localCollapsed},()=>[r.reverseArrow?(jt(),He("div",lq,[r.localCollapsed?(jt(),dn(s,{key:0})):(jt(),dn(o,{key:1}))])):(jt(),He("div",oq,[r.localCollapsed?(jt(),dn(o,{key:1})):(jt(),dn(s,{key:0}))]))])],6)):Ds("v-if",!0)]),_:3},16,["class","style"])}var cq=Gs(sq,[["render",uq]]);const hq=Ws({name:"Skeleton",props:{loading:{type:Boolean,default:!0},animation:{type:Boolean,default:!1}},setup(r){const t=qo("skeleton"),e=an(()=>[t,{[`${t}-animation`]:r.animation}]);return{prefixCls:t,cls:e}}});function dq(r,t,e,n,i,a){return jt(),He("div",{class:Mr(r.cls)},[r.loading?Fa(r.$slots,"default",{key:0}):Fa(r.$slots,"content",{key:1})],2)}var cv=Gs(hq,[["render",dq]]);const fq=Ws({name:"SkeletonLine",props:{rows:{type:Number,default:1},widths:{type:Array,default:()=>[]},lineHeight:{type:Number,default:20},lineSpacing:{type:Number,default:15}},setup(r){const t=qo("skeleton-line"),e=[];for(let n=0;n<r.rows;n++){const i={};jl(r.widths[n])?i.width=`${r.widths[n]}px`:pj(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 gq(r,t,e,n,i,a){return jt(!0),He($l,null,e0(r.lines,(s,o)=>(jt(),He("ul",{key:o,class:Mr(r.prefixCls)},[Ve("li",{class:Mr(`${r.prefixCls}-row`),style:Tc(s)},null,6)],2))),128)}var Kd=Gs(fq,[["render",gq]]);const pq=Ws({name:"SkeletonShape",props:{shape:{type:String,default:"square"},size:{type:String,default:"medium"}},setup(r){const t=qo("skeleton-shape"),e=an(()=>[t,`${t}-${r.shape}`,`${t}-${r.size}`]);return{prefixCls:t,cls:e}}});function vq(r,t,e,n,i,a){return jt(),He("div",{class:Mr(r.cls)},null,2)}var hv=Gs(pq,[["render",vq]]);const mq=Object.assign(cv,{Line:Kd,Shape:hv,install:(r,t)=>{yR(r,t);const e=bR(t);r.component(e+cv.name,cv),r.component(e+Kd.name,Kd),r.component(e+hv.name,hv)}}),yq={key:1,class:"no-data"},bq={__name:"Sidebar",emits:["updateCheckedList","initSelectedKeys"],setup(r,{emit:t}){const e=ue(!1),n=ue([]),i=ue([]),a=ue([]),s=t,o=async()=>{e.value=!0;try{const{data:{rows:u}}=await dj();n.value=u,i.value=u.map(c=>c.id),s("initSelectedKeys",["da47dcbaea9711ef94400242ac120006"])}catch(u){console.error(u)}finally{e.value=!1}};Oc(()=>{o()});const l=u=>{i.value=u,s("updateCheckedList",u)};return(u,c)=>{const h=hj,d=fR,g=cq;return jt(),dn(g,{width:"18%"},{default:ve(()=>[ae(d,{loading:e.value},{default:ve(()=>[n.value.length?(jt(),dn(h,{key:0,class:"tree",data:n.value,checkable:"","checked-keys":i.value,"selected-keys":a.value,"field-names":{title:"name",key:"id"},onCheck:l},null,8,["data","checked-keys","selected-keys"])):(jt(),He("div",yq,"暂无数据"))]),_:1},8,["loading"])]),_:1})}}},wq=jo(bq,[["__scopeId","data-v-df85dafb"]]),xq="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",Eq=["src"],_q={__name:"RetrievalDocuments",props:{documents:String},emits:"onFilesSelected",setup(r,{emit:t}){const{t:e}=vj(),n=t,i=ue([]),a=ue([]),s=So({type:"checkbox",showCheckedAll:!0,onlyCurrent:!1}),o={pageSize:10},l=c=>{i.value=c},u=c=>{n("onFilesSelected",c),l(c)};return(c,h)=>{const d=t0,g=kj,p=_o("icon-eye"),v=wR,m=Tj,b=Mj,w=_j,x=Sj;return jt(),dn(x,{class:"selectFilesCollapse"},{default:ve(()=>[(jt(),dn(w,{key:1},{"expand-icon":ve(({active:S})=>[Ve("img",{src:Xi(xq),style:Tc({transform:S?"rotate(180deg)":"rotate(0deg)"})},null,12,Eq)]),header:ve(()=>[ae(d,null,{default:ve(()=>{var S;return[mR(uc(i.value.length)+"/"+uc(((S=r.documents)==null?void 0:S.length)||0)+" 选定文件 ",1)]}),_:1})]),default:ve(()=>[ae(b,{data:r.documents,onSelectionChange:u,rowKey:"doc_id","show-header":!1,bordered:!1,"row-selection":s,selectedKeys:a.value,"onUpdate:selectedKeys":h[0]||(h[0]=S=>a.value=S),pagination:o},{columns:ve(()=>[ae(g,{"data-index":"doc_name"}),ae(g,{"data-index":"count",width:"80"}),ae(g,{width:"80"},{cell:ve(({record:S})=>[ae(m,{content:"预览"},{default:ve(()=>[ae(v,{type:"text"},{default:ve(()=>[ae(p)]),_:1})]),_:1})]),_:1})]),_:1},8,["data","row-selection","selectedKeys"])]),_:1}))]),_:1})}}},Sq=jo(_q,[["__scopeId","data-v-9cbf061f"]]),Mq={class:"markdown-content"},kq=["innerHTML"],Cq={__name:"MarkdownContent",props:{content:String},setup(r){const t=r,e=an(()=>J$(t.content||""));return(n,i)=>{const a=Kd,s=t0,o=mq;return jt(),He("div",Mq,[i[0]||(i[0]=Ve("div",{class:"header"},[Ve("img",{src:Oj,alt:"Logo",class:"logo"}),Ve("h3",null,"智能回答")],-1)),r.content?(jt(),He("div",{key:0,innerHTML:e.value,class:"content"},null,8,kq)):(jt(),dn(o,{key:1,class:"content",animation:!0},{default:ve(()=>[ae(s,{direction:"vertical",style:{width:"100%"},size:"large"},{default:ve(()=>[ae(a,{rows:3})]),_:1})]),_:1}))])}}},Tq=jo(Cq,[["__scopeId","data-v-ef411f6d"]]),Oq="电力维修",Aq=[{id:"电力维修的资质要求",children:[{id:"资质等级",children:[{id:"分为一级、二级、三级、四级和五级,五级是初级,一级资质最高"}]},{id:"资质申请材料",children:[{id:"包括许可证申请表、法人证明材料和净资产证明材料、主要设备及机具清单、经营场所证明材料、主要负责人的简历、专业技术任职资格证书等有关证明材料、工程技术人员、经济管理人员明细表及其专业技术任职资格证明文件、电工作业人员登记表"}]}]},{id:"申请材料提交",children:[{id:"申请人确定申请事项并根据填报要求网上提交或提供书面申请材料"}]}],Pq={id:Oq,children:Aq};function D3(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 Bt(r){for(var t=1;t<arguments.length;t++){var e=arguments[t]!=null?arguments[t]:{};t%2?D3(Object(e),!0).forEach(function(n){wt(r,n,e[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):D3(Object(e)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(e,n))})}return r}function Wt(r,t,e){return t=cf(t),mj(r,yj()?Reflect.construct(t,e||[],cf(r).constructor):t.apply(r,e))}var SR={exports:{}};(function(r){var t=Object.prototype.hasOwnProperty,e="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(e=!1));function i(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function a(l,u,c,h,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var g=new i(c,h||l,d),p=e?e+u:u;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],g]:l._events[p].push(g):(l._events[p]=g,l._eventsCount++),l}function s(l,u){--l._eventsCount===0?l._events=new n:delete l._events[u]}function o(){this._events=new n,this._eventsCount=0}o.prototype.eventNames=function(){var u=[],c,h;if(this._eventsCount===0)return u;for(h in c=this._events)t.call(c,h)&&u.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},o.prototype.listeners=function(u){var c=e?e+u:u,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var d=0,g=h.length,p=new Array(g);d<g;d++)p[d]=h[d].fn;return p},o.prototype.listenerCount=function(u){var c=e?e+u:u,h=this._events[c];return h?h.fn?1:h.length:0},o.prototype.emit=function(u,c,h,d,g,p){var v=e?e+u:u;if(!this._events[v])return!1;var m=this._events[v],b=arguments.length,w,x;if(m.fn){switch(m.once&&this.removeListener(u,m.fn,void 0,!0),b){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,c),!0;case 3:return m.fn.call(m.context,c,h),!0;case 4:return m.fn.call(m.context,c,h,d),!0;case 5:return m.fn.call(m.context,c,h,d,g),!0;case 6:return m.fn.call(m.context,c,h,d,g,p),!0}for(x=1,w=new Array(b-1);x<b;x++)w[x-1]=arguments[x];m.fn.apply(m.context,w)}else{var S=m.length,_;for(x=0;x<S;x++)switch(m[x].once&&this.removeListener(u,m[x].fn,void 0,!0),b){case 1:m[x].fn.call(m[x].context);break;case 2:m[x].fn.call(m[x].context,c);break;case 3:m[x].fn.call(m[x].context,c,h);break;case 4:m[x].fn.call(m[x].context,c,h,d);break;default:if(!w)for(_=1,w=new Array(b-1);_<b;_++)w[_-1]=arguments[_];m[x].fn.apply(m[x].context,w)}}return!0},o.prototype.on=function(u,c,h){return a(this,u,c,h,!1)},o.prototype.once=function(u,c,h){return a(this,u,c,h,!0)},o.prototype.removeListener=function(u,c,h,d){var g=e?e+u:u;if(!this._events[g])return this;if(!c)return s(this,g),this;var p=this._events[g];if(p.fn)p.fn===c&&(!d||p.once)&&(!h||p.context===h)&&s(this,g);else{for(var v=0,m=[],b=p.length;v<b;v++)(p[v].fn!==c||d&&!p[v].once||h&&p[v].context!==h)&&m.push(p[v]);m.length?this._events[g]=m.length===1?m[0]:m:s(this,g)}return this},o.prototype.removeAllListeners=function(u){var c;return u?(c=e?e+u:u,this._events[c]&&s(this,c)):(this._events=new n,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=e,o.EventEmitter=o,r.exports=o})(SR);var Nq=SR.exports;const MR=r0(Nq);var De=1e-6,gn=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var r=0,t=arguments.length;t--;)r+=arguments[t]*arguments[t];return Math.sqrt(r)});function kR(){var r=new gn(9);return gn!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function Rq(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 Lq(r,t,e,n,i,a,s,o,l){var u=new gn(9);return u[0]=r,u[1]=t,u[2]=e,u[3]=n,u[4]=i,u[5]=a,u[6]=s,u[7]=o,u[8]=l,u}function Se(){var r=new gn(16);return gn!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}function CR(r){var t=new gn(16);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t}function ql(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 TR(r,t,e,n,i,a,s,o,l,u,c,h,d,g,p,v){var m=new gn(16);return m[0]=r,m[1]=t,m[2]=e,m[3]=n,m[4]=i,m[5]=a,m[6]=s,m[7]=o,m[8]=l,m[9]=u,m[10]=c,m[11]=h,m[12]=d,m[13]=g,m[14]=p,m[15]=v,m}function sw(r,t,e,n,i,a,s,o,l,u,c,h,d,g,p,v,m){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r[4]=a,r[5]=s,r[6]=o,r[7]=l,r[8]=u,r[9]=c,r[10]=h,r[11]=d,r[12]=g,r[13]=p,r[14]=v,r[15]=m,r}function Bs(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function OR(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 Ji(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],g=t[11],p=t[12],v=t[13],m=t[14],b=t[15],w=e*o-n*s,x=e*l-i*s,S=e*u-a*s,_=n*l-i*o,M=n*u-a*o,k=i*u-a*l,C=c*v-h*p,P=c*m-d*p,T=c*b-g*p,A=h*m-d*v,R=h*b-g*v,L=d*b-g*m,$=w*L-x*R+S*A+_*T-M*P+k*C;return $?($=1/$,r[0]=(o*L-l*R+u*A)*$,r[1]=(i*R-n*L-a*A)*$,r[2]=(v*k-m*M+b*_)*$,r[3]=(d*M-h*k-g*_)*$,r[4]=(l*T-s*L-u*P)*$,r[5]=(e*L-i*T+a*P)*$,r[6]=(m*S-p*k-b*x)*$,r[7]=(c*k-d*S+g*x)*$,r[8]=(s*R-o*T+u*C)*$,r[9]=(n*T-e*R-a*C)*$,r[10]=(p*M-v*S+b*w)*$,r[11]=(h*S-c*M-g*w)*$,r[12]=(o*P-s*A-l*C)*$,r[13]=(e*A-n*P+i*C)*$,r[14]=(v*x-p*_-m*w)*$,r[15]=(c*_-h*x+d*w)*$,r):null}function Iq(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],g=t[11],p=t[12],v=t[13],m=t[14],b=t[15];return r[0]=o*(d*b-g*m)-h*(l*b-u*m)+v*(l*g-u*d),r[1]=-(n*(d*b-g*m)-h*(i*b-a*m)+v*(i*g-a*d)),r[2]=n*(l*b-u*m)-o*(i*b-a*m)+v*(i*u-a*l),r[3]=-(n*(l*g-u*d)-o*(i*g-a*d)+h*(i*u-a*l)),r[4]=-(s*(d*b-g*m)-c*(l*b-u*m)+p*(l*g-u*d)),r[5]=e*(d*b-g*m)-c*(i*b-a*m)+p*(i*g-a*d),r[6]=-(e*(l*b-u*m)-s*(i*b-a*m)+p*(i*u-a*l)),r[7]=e*(l*g-u*d)-s*(i*g-a*d)+c*(i*u-a*l),r[8]=s*(h*b-g*v)-c*(o*b-u*v)+p*(o*g-u*h),r[9]=-(e*(h*b-g*v)-c*(n*b-a*v)+p*(n*g-a*h)),r[10]=e*(o*b-u*v)-s*(n*b-a*v)+p*(n*u-a*o),r[11]=-(e*(o*g-u*h)-s*(n*g-a*h)+c*(n*u-a*o)),r[12]=-(s*(h*m-d*v)-c*(o*m-l*v)+p*(o*d-l*h)),r[13]=e*(h*m-d*v)-c*(n*m-i*v)+p*(n*d-i*h),r[14]=-(e*(o*m-l*v)-s*(n*m-i*v)+p*(n*l-i*o)),r[15]=e*(o*d-l*h)-s*(n*d-i*h)+c*(n*l-i*o),r}function AR(r){var t=r[0],e=r[1],n=r[2],i=r[3],a=r[4],s=r[5],o=r[6],l=r[7],u=r[8],c=r[9],h=r[10],d=r[11],g=r[12],p=r[13],v=r[14],m=r[15],b=t*s-e*a,w=t*o-n*a,x=t*l-i*a,S=e*o-n*s,_=e*l-i*s,M=n*l-i*o,k=u*p-c*g,C=u*v-h*g,P=u*m-d*g,T=c*v-h*p,A=c*m-d*p,R=h*m-d*v;return b*R-w*A+x*T+S*P-_*C+M*k}function Jn(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=t[9],g=t[10],p=t[11],v=t[12],m=t[13],b=t[14],w=t[15],x=e[0],S=e[1],_=e[2],M=e[3];return r[0]=x*n+S*o+_*h+M*v,r[1]=x*i+S*l+_*d+M*m,r[2]=x*a+S*u+_*g+M*b,r[3]=x*s+S*c+_*p+M*w,x=e[4],S=e[5],_=e[6],M=e[7],r[4]=x*n+S*o+_*h+M*v,r[5]=x*i+S*l+_*d+M*m,r[6]=x*a+S*u+_*g+M*b,r[7]=x*s+S*c+_*p+M*w,x=e[8],S=e[9],_=e[10],M=e[11],r[8]=x*n+S*o+_*h+M*v,r[9]=x*i+S*l+_*d+M*m,r[10]=x*a+S*u+_*g+M*b,r[11]=x*s+S*c+_*p+M*w,x=e[12],S=e[13],_=e[14],M=e[15],r[12]=x*n+S*o+_*h+M*v,r[13]=x*i+S*l+_*d+M*m,r[14]=x*a+S*u+_*g+M*b,r[15]=x*s+S*c+_*p+M*w,r}function Il(r,t,e){var n=e[0],i=e[1],a=e[2],s,o,l,u,c,h,d,g,p,v,m,b;return t===r?(r[12]=t[0]*n+t[4]*i+t[8]*a+t[12],r[13]=t[1]*n+t[5]*i+t[9]*a+t[13],r[14]=t[2]*n+t[6]*i+t[10]*a+t[14],r[15]=t[3]*n+t[7]*i+t[11]*a+t[15]):(s=t[0],o=t[1],l=t[2],u=t[3],c=t[4],h=t[5],d=t[6],g=t[7],p=t[8],v=t[9],m=t[10],b=t[11],r[0]=s,r[1]=o,r[2]=l,r[3]=u,r[4]=c,r[5]=h,r[6]=d,r[7]=g,r[8]=p,r[9]=v,r[10]=m,r[11]=b,r[12]=s*n+c*i+p*a+t[12],r[13]=o*n+h*i+v*a+t[13],r[14]=l*n+d*i+m*a+t[14],r[15]=u*n+g*i+b*a+t[15]),r}function PR(r,t,e){var n=e[0],i=e[1],a=e[2];return r[0]=t[0]*n,r[1]=t[1]*n,r[2]=t[2]*n,r[3]=t[3]*n,r[4]=t[4]*i,r[5]=t[5]*i,r[6]=t[6]*i,r[7]=t[7]*i,r[8]=t[8]*a,r[9]=t[9]*a,r[10]=t[10]*a,r[11]=t[11]*a,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r}function Dq(r,t,e,n){var i=n[0],a=n[1],s=n[2],o=Math.hypot(i,a,s),l,u,c,h,d,g,p,v,m,b,w,x,S,_,M,k,C,P,T,A,R,L,$,q;return o<De?null:(o=1/o,i*=o,a*=o,s*=o,l=Math.sin(e),u=Math.cos(e),c=1-u,h=t[0],d=t[1],g=t[2],p=t[3],v=t[4],m=t[5],b=t[6],w=t[7],x=t[8],S=t[9],_=t[10],M=t[11],k=i*i*c+u,C=a*i*c+s*l,P=s*i*c-a*l,T=i*a*c-s*l,A=a*a*c+u,R=s*a*c+i*l,L=i*s*c+a*l,$=a*s*c-i*l,q=s*s*c+u,r[0]=h*k+v*C+x*P,r[1]=d*k+m*C+S*P,r[2]=g*k+b*C+_*P,r[3]=p*k+w*C+M*P,r[4]=h*T+v*A+x*R,r[5]=d*T+m*A+S*R,r[6]=g*T+b*A+_*R,r[7]=p*T+w*A+M*R,r[8]=h*L+v*$+x*q,r[9]=d*L+m*$+S*q,r[10]=g*L+b*$+_*q,r[11]=p*L+w*$+M*q,t!==r&&(r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r)}function NR(r,t,e){var n=Math.sin(e),i=Math.cos(e),a=t[4],s=t[5],o=t[6],l=t[7],u=t[8],c=t[9],h=t[10],d=t[11];return t!==r&&(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[4]=a*i+u*n,r[5]=s*i+c*n,r[6]=o*i+h*n,r[7]=l*i+d*n,r[8]=u*i-a*n,r[9]=c*i-s*n,r[10]=h*i-o*n,r[11]=d*i-l*n,r}function RR(r,t,e){var n=Math.sin(e),i=Math.cos(e),a=t[0],s=t[1],o=t[2],l=t[3],u=t[8],c=t[9],h=t[10],d=t[11];return t!==r&&(r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=a*i-u*n,r[1]=s*i-c*n,r[2]=o*i-h*n,r[3]=l*i-d*n,r[8]=a*n+u*i,r[9]=s*n+c*i,r[10]=o*n+h*i,r[11]=l*n+d*i,r}function Fq(r,t,e){var n=Math.sin(e),i=Math.cos(e),a=t[0],s=t[1],o=t[2],l=t[3],u=t[4],c=t[5],h=t[6],d=t[7];return t!==r&&(r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=a*i+u*n,r[1]=s*i+c*n,r[2]=o*i+h*n,r[3]=l*i+d*n,r[4]=u*i-a*n,r[5]=c*i-s*n,r[6]=h*i-o*n,r[7]=d*i-l*n,r}function bs(r,t){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function po(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=t[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function LR(r,t,e){var n=e[0],i=e[1],a=e[2],s=Math.hypot(n,i,a),o,l,u;return s<De?null:(s=1/s,n*=s,i*=s,a*=s,o=Math.sin(t),l=Math.cos(t),u=1-l,r[0]=n*n*u+l,r[1]=i*n*u+a*o,r[2]=a*n*u-i*o,r[3]=0,r[4]=n*i*u-a*o,r[5]=i*i*u+l,r[6]=a*i*u+n*o,r[7]=0,r[8]=n*a*u+i*o,r[9]=i*a*u-n*o,r[10]=a*a*u+l,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function IR(r,t){var e=Math.sin(t),n=Math.cos(t);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=n,r[6]=e,r[7]=0,r[8]=0,r[9]=-e,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function DR(r,t){var e=Math.sin(t),n=Math.cos(t);return r[0]=n,r[1]=0,r[2]=-e,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=e,r[9]=0,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function ow(r,t){var e=Math.sin(t),n=Math.cos(t);return r[0]=n,r[1]=e,r[2]=0,r[3]=0,r[4]=-e,r[5]=n,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function FR(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=n+n,l=i+i,u=a+a,c=n*o,h=n*l,d=n*u,g=i*l,p=i*u,v=a*u,m=s*o,b=s*l,w=s*u;return r[0]=1-(g+v),r[1]=h+w,r[2]=d-b,r[3]=0,r[4]=h-w,r[5]=1-(c+v),r[6]=p+m,r[7]=0,r[8]=d+b,r[9]=p-m,r[10]=1-(c+g),r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function Bq(r,t){var e=new gn(3),n=-t[0],i=-t[1],a=-t[2],s=t[3],o=t[4],l=t[5],u=t[6],c=t[7],h=n*n+i*i+a*a+s*s;return h>0?(e[0]=(o*s+c*n+l*a-u*i)*2/h,e[1]=(l*s+c*i+u*n-o*a)*2/h,e[2]=(u*s+c*a+o*i-l*n)*2/h):(e[0]=(o*s+c*n+l*a-u*i)*2,e[1]=(l*s+c*i+u*n-o*a)*2,e[2]=(u*s+c*a+o*i-l*n)*2),FR(r,t,e),r}function hf(r,t){return r[0]=t[12],r[1]=t[13],r[2]=t[14],r}function Wl(r,t){var e=t[0],n=t[1],i=t[2],a=t[4],s=t[5],o=t[6],l=t[8],u=t[9],c=t[10];return r[0]=Math.hypot(e,n,i),r[1]=Math.hypot(a,s,o),r[2]=Math.hypot(l,u,c),r}function df(r,t){var e=new gn(3);Wl(e,t);var n=1/e[0],i=1/e[1],a=1/e[2],s=t[0]*n,o=t[1]*i,l=t[2]*a,u=t[4]*n,c=t[5]*i,h=t[6]*a,d=t[8]*n,g=t[9]*i,p=t[10]*a,v=s+c+p,m=0;return v>0?(m=Math.sqrt(v+1)*2,r[3]=.25*m,r[0]=(h-g)/m,r[1]=(d-l)/m,r[2]=(o-u)/m):s>c&&s>p?(m=Math.sqrt(1+s-c-p)*2,r[3]=(h-g)/m,r[0]=.25*m,r[1]=(o+u)/m,r[2]=(d+l)/m):c>p?(m=Math.sqrt(1+c-s-p)*2,r[3]=(d-l)/m,r[0]=(o+u)/m,r[1]=.25*m,r[2]=(h+g)/m):(m=Math.sqrt(1+p-s-c)*2,r[3]=(o-u)/m,r[0]=(d+l)/m,r[1]=(h+g)/m,r[2]=.25*m),r}function zq(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3],l=i+i,u=a+a,c=s+s,h=i*l,d=i*u,g=i*c,p=a*u,v=a*c,m=s*c,b=o*l,w=o*u,x=o*c,S=n[0],_=n[1],M=n[2];return r[0]=(1-(p+m))*S,r[1]=(d+x)*S,r[2]=(g-w)*S,r[3]=0,r[4]=(d-x)*_,r[5]=(1-(h+m))*_,r[6]=(v+b)*_,r[7]=0,r[8]=(g+w)*M,r[9]=(v-b)*M,r[10]=(1-(h+p))*M,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function tc(r,t,e,n,i){var a=t[0],s=t[1],o=t[2],l=t[3],u=a+a,c=s+s,h=o+o,d=a*u,g=a*c,p=a*h,v=s*c,m=s*h,b=o*h,w=l*u,x=l*c,S=l*h,_=n[0],M=n[1],k=n[2],C=i[0],P=i[1],T=i[2],A=(1-(v+b))*_,R=(g+S)*_,L=(p-x)*_,$=(g-S)*M,q=(1-(d+b))*M,j=(m+w)*M,B=(p+x)*k,D=(m-w)*k,G=(1-(d+v))*k;return r[0]=A,r[1]=R,r[2]=L,r[3]=0,r[4]=$,r[5]=q,r[6]=j,r[7]=0,r[8]=B,r[9]=D,r[10]=G,r[11]=0,r[12]=e[0]+C-(A*C+$*P+B*T),r[13]=e[1]+P-(R*C+q*P+D*T),r[14]=e[2]+T-(L*C+j*P+G*T),r[15]=1,r}function Ox(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e+e,o=n+n,l=i+i,u=e*s,c=n*s,h=n*o,d=i*s,g=i*o,p=i*l,v=a*s,m=a*o,b=a*l;return r[0]=1-h-p,r[1]=c+b,r[2]=d-m,r[3]=0,r[4]=c-b,r[5]=1-u-p,r[6]=g+v,r[7]=0,r[8]=d+m,r[9]=g-v,r[10]=1-u-h,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function $q(r,t,e,n,i,a,s){var o=1/(e-t),l=1/(i-n),u=1/(a-s);return r[0]=a*2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a*2*l,r[6]=0,r[7]=0,r[8]=(e+t)*o,r[9]=(i+n)*l,r[10]=(s+a)*u,r[11]=-1,r[12]=0,r[13]=0,r[14]=s*a*2*u,r[15]=0,r}function BR(r,t,e,n,i){var a=1/Math.tan(t/2),s;return r[0]=a/e,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0?(s=1/(n-i),r[10]=(i+n)*s,r[14]=2*i*n*s):(r[10]=-1,r[14]=-2*n),r}var jq=BR;function qq(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 Wq(r,t,e,n){var i=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),s=Math.tan(t.leftDegrees*Math.PI/180),o=Math.tan(t.rightDegrees*Math.PI/180),l=2/(s+o),u=2/(i+a);return r[0]=l,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=u,r[6]=0,r[7]=0,r[8]=-((s-o)*l*.5),r[9]=(i-a)*u*.5,r[10]=n/(e-n),r[11]=-1,r[12]=0,r[13]=0,r[14]=n*e/(e-n),r[15]=0,r}function zR(r,t,e,n,i,a,s){var o=1/(t-e),l=1/(n-i),u=1/(a-s);return r[0]=-2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*u,r[11]=0,r[12]=(t+e)*o,r[13]=(i+n)*l,r[14]=(s+a)*u,r[15]=1,r}var $R=zR;function jR(r,t,e,n,i,a,s){var o=1/(t-e),l=1/(n-i),u=1/(a-s);return r[0]=-2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=u,r[11]=0,r[12]=(t+e)*o,r[13]=(i+n)*l,r[14]=a*u,r[15]=1,r}function qR(r,t,e,n){var i,a,s,o,l,u,c,h,d,g,p=t[0],v=t[1],m=t[2],b=n[0],w=n[1],x=n[2],S=e[0],_=e[1],M=e[2];return Math.abs(p-S)<De&&Math.abs(v-_)<De&&Math.abs(m-M)<De?Bs(r):(c=p-S,h=v-_,d=m-M,g=1/Math.hypot(c,h,d),c*=g,h*=g,d*=g,i=w*d-x*h,a=x*c-b*d,s=b*h-w*c,g=Math.hypot(i,a,s),g?(g=1/g,i*=g,a*=g,s*=g):(i=0,a=0,s=0),o=h*s-d*a,l=d*i-c*s,u=c*a-h*i,g=Math.hypot(o,l,u),g?(g=1/g,o*=g,l*=g,u*=g):(o=0,l=0,u=0),r[0]=i,r[1]=o,r[2]=c,r[3]=0,r[4]=a,r[5]=l,r[6]=h,r[7]=0,r[8]=s,r[9]=u,r[10]=d,r[11]=0,r[12]=-(i*p+a*v+s*m),r[13]=-(o*p+l*v+u*m),r[14]=-(c*p+h*v+d*m),r[15]=1,r)}function Gq(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=n[0],l=n[1],u=n[2],c=i-e[0],h=a-e[1],d=s-e[2],g=c*c+h*h+d*d;g>0&&(g=1/Math.sqrt(g),c*=g,h*=g,d*=g);var p=l*d-u*h,v=u*c-o*d,m=o*h-l*c;return g=p*p+v*v+m*m,g>0&&(g=1/Math.sqrt(g),p*=g,v*=g,m*=g),r[0]=p,r[1]=v,r[2]=m,r[3]=0,r[4]=h*m-d*v,r[5]=d*p-c*m,r[6]=c*v-h*p,r[7]=0,r[8]=c,r[9]=h,r[10]=d,r[11]=0,r[12]=i,r[13]=a,r[14]=s,r[15]=1,r}function Vq(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 Hq(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 Uq(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r[3]=t[3]+e[3],r[4]=t[4]+e[4],r[5]=t[5]+e[5],r[6]=t[6]+e[6],r[7]=t[7]+e[7],r[8]=t[8]+e[8],r[9]=t[9]+e[9],r[10]=t[10]+e[10],r[11]=t[11]+e[11],r[12]=t[12]+e[12],r[13]=t[13]+e[13],r[14]=t[14]+e[14],r[15]=t[15]+e[15],r}function WR(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r[3]=t[3]-e[3],r[4]=t[4]-e[4],r[5]=t[5]-e[5],r[6]=t[6]-e[6],r[7]=t[7]-e[7],r[8]=t[8]-e[8],r[9]=t[9]-e[9],r[10]=t[10]-e[10],r[11]=t[11]-e[11],r[12]=t[12]-e[12],r[13]=t[13]-e[13],r[14]=t[14]-e[14],r[15]=t[15]-e[15],r}function Yq(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 Xq(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 lw(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 Kq(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],s=r[4],o=r[5],l=r[6],u=r[7],c=r[8],h=r[9],d=r[10],g=r[11],p=r[12],v=r[13],m=r[14],b=r[15],w=t[0],x=t[1],S=t[2],_=t[3],M=t[4],k=t[5],C=t[6],P=t[7],T=t[8],A=t[9],R=t[10],L=t[11],$=t[12],q=t[13],j=t[14],B=t[15];return Math.abs(e-w)<=De*Math.max(1,Math.abs(e),Math.abs(w))&&Math.abs(n-x)<=De*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(i-S)<=De*Math.max(1,Math.abs(i),Math.abs(S))&&Math.abs(a-_)<=De*Math.max(1,Math.abs(a),Math.abs(_))&&Math.abs(s-M)<=De*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(o-k)<=De*Math.max(1,Math.abs(o),Math.abs(k))&&Math.abs(l-C)<=De*Math.max(1,Math.abs(l),Math.abs(C))&&Math.abs(u-P)<=De*Math.max(1,Math.abs(u),Math.abs(P))&&Math.abs(c-T)<=De*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(h-A)<=De*Math.max(1,Math.abs(h),Math.abs(A))&&Math.abs(d-R)<=De*Math.max(1,Math.abs(d),Math.abs(R))&&Math.abs(g-L)<=De*Math.max(1,Math.abs(g),Math.abs(L))&&Math.abs(p-$)<=De*Math.max(1,Math.abs(p),Math.abs($))&&Math.abs(v-q)<=De*Math.max(1,Math.abs(v),Math.abs(q))&&Math.abs(m-j)<=De*Math.max(1,Math.abs(m),Math.abs(j))&&Math.abs(b-B)<=De*Math.max(1,Math.abs(b),Math.abs(B))}var GR=Jn,Zq=WR;const Jq=Object.freeze(Object.defineProperty({__proto__:null,add:Uq,adjoint:Iq,clone:CR,copy:ql,create:Se,determinant:AR,equals:Kq,exactEquals:lw,frob:Hq,fromQuat:Ox,fromQuat2:Bq,fromRotation:LR,fromRotationTranslation:FR,fromRotationTranslationScale:zq,fromRotationTranslationScaleOrigin:tc,fromScaling:po,fromTranslation:bs,fromValues:TR,fromXRotation:IR,fromYRotation:DR,fromZRotation:ow,frustum:$q,getRotation:df,getScaling:Wl,getTranslation:hf,identity:Bs,invert:Ji,lookAt:qR,mul:GR,multiply:Jn,multiplyScalar:Yq,multiplyScalarAndAdd:Xq,ortho:$R,orthoNO:zR,orthoZO:jR,perspective:jq,perspectiveFromFieldOfView:Wq,perspectiveNO:BR,perspectiveZO:qq,rotate:Dq,rotateX:NR,rotateY:RR,rotateZ:Fq,scale:PR,set:sw,str:Vq,sub:Zq,subtract:WR,targetTo:Gq,translate:Il,transpose:OR},Symbol.toStringTag,{value:"Module"}));function Qt(){var r=new gn(3);return gn!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function _a(r){var t=new gn(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t}function Ca(r){var t=r[0],e=r[1],n=r[2];return Math.hypot(t,e,n)}function Ae(r,t,e){var n=new gn(3);return n[0]=r,n[1]=t,n[2]=e,n}function Qi(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r}function Kn(r,t,e,n){return r[0]=t,r[1]=e,r[2]=n,r}function As(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r}function uw(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r}function Qq(r,t,e){return r[0]=t[0]*e[0],r[1]=t[1]*e[1],r[2]=t[2]*e[2],r}function tW(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 eW(r,t,e){return r[0]=Math.max(t[0],e[0]),r[1]=Math.max(t[1],e[1]),r[2]=Math.max(t[2],e[2]),r}function ff(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r}function nW(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 Mo(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 ta(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]}function Zd(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 cw(r,t,e,n){var i=t[0],a=t[1],s=t[2];return r[0]=i+n*(e[0]-i),r[1]=a+n*(e[1]-a),r[2]=s+n*(e[2]-s),r}function Qn(r,t,e){var n=t[0],i=t[1],a=t[2],s=e[3]*n+e[7]*i+e[11]*a+e[15];return s=s||1,r[0]=(e[0]*n+e[4]*i+e[8]*a+e[12])/s,r[1]=(e[1]*n+e[5]*i+e[9]*a+e[13])/s,r[2]=(e[2]*n+e[6]*i+e[10]*a+e[14])/s,r}function rW(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 iW(r,t,e){var n=e[0],i=e[1],a=e[2],s=e[3],o=t[0],l=t[1],u=t[2],c=i*u-a*l,h=a*o-n*u,d=n*l-i*o,g=i*d-a*h,p=a*c-n*d,v=n*h-i*c,m=s*2;return c*=m,h*=m,d*=m,g*=2,p*=2,v*=2,r[0]=o+c+g,r[1]=l+h+p,r[2]=u+d+v,r}function Mu(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)<=De*Math.max(1,Math.abs(e),Math.abs(a))&&Math.abs(n-s)<=De*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-o)<=De*Math.max(1,Math.abs(i),Math.abs(o))}var aW=uw,F3=nW,VR=Ca;(function(){var r=Qt();return function(t,e,n,i,a,s){var o,l;for(e||(e=3),n||(n=0),i?l=Math.min(i*e+n,t.length):l=t.length,o=n;o<l;o+=e)r[0]=t[o],r[1]=t[o+1],r[2]=t[o+2],a(r,r,s),t[o]=r[0],t[o+1]=r[1],t[o+2]=r[2];return t}})();function ea(){var r=new gn(4);return gn!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function Fu(r,t,e,n){var i=new gn(4);return i[0]=r,i[1]=t,i[2]=e,i[3]=n,i}function sW(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r}function oW(r,t,e,n,i){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r}function lW(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 Na(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=ea();return function(t,e,n,i,a,s){var o,l;for(e||(e=4),n||(n=0),i?l=Math.min(i*e+n,t.length):l=t.length,o=n;o<l;o+=e)r[0]=t[o],r[1]=t[o+1],r[2]=t[o+2],r[3]=t[o+3],a(r,r,s),t[o]=r[0],t[o+1]=r[1],t[o+2]=r[2],t[o+3]=r[3];return t}})();function wn(){var r=new gn(4);return gn!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Es(r,t,e){e=e*.5;var n=Math.sin(e);return r[0]=n*t[0],r[1]=n*t[1],r[2]=n*t[2],r[3]=Math.cos(e),r}function Ps(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=e[0],l=e[1],u=e[2],c=e[3];return r[0]=n*c+s*o+i*u-a*l,r[1]=i*c+s*l+a*o-n*u,r[2]=a*c+s*u+n*l-i*o,r[3]=s*c-n*o-i*l-a*u,r}function dv(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3],l=e[0],u=e[1],c=e[2],h=e[3],d,g,p,v,m;return g=i*l+a*u+s*c+o*h,g<0&&(g=-g,l=-l,u=-u,c=-c,h=-h),1-g>De?(d=Math.acos(g),p=Math.sin(d),v=Math.sin((1-n)*d)/p,m=Math.sin(n*d)/p):(v=1-n,m=n),r[0]=v*i+m*l,r[1]=v*a+m*u,r[2]=v*s+m*c,r[3]=v*o+m*h,r}function fv(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 uW(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 Wh(r,t,e,n){var i=.5*Math.PI/180;t*=i,e*=i,n*=i;var a=Math.sin(t),s=Math.cos(t),o=Math.sin(e),l=Math.cos(e),u=Math.sin(n),c=Math.cos(n);return r[0]=a*l*c-s*o*u,r[1]=s*o*c+a*l*u,r[2]=s*l*u-a*o*c,r[3]=s*l*c+a*o*u,r}var cW=Fu,Gh=sW,B3=oW,z3=Ps,gf=lW;(function(){var r=Qt(),t=Ae(1,0,0),e=Ae(0,1,0);return function(n,i,a){var s=ta(i,a);return s<-.999999?(Zd(r,t,i),VR(r)<1e-6&&Zd(r,e,i),Mo(r,r),Es(n,r,Math.PI),n):s>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Zd(r,i,a),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+s,gf(n,n))}})();(function(){var r=wn(),t=wn();return function(e,n,i,a,s,o){return dv(r,n,s,o),dv(t,i,a,o),dv(e,r,t,2*o*(1-o)),e}})();(function(){var r=kR();return function(t,e,n,i){return r[0]=n[0],r[3]=n[1],r[6]=n[2],r[1]=i[0],r[4]=i[1],r[7]=i[2],r[2]=-e[0],r[5]=-e[1],r[8]=-e[2],gf(t,uW(t,r))}})();function Ax(){var r=new gn(2);return gn!=Float32Array&&(r[0]=0,r[1]=0),r}function hW(r,t){return r[0]=t[0],r[1]=t[1],r}function dW(r,t,e){return r[0]=t,r[1]=e,r}function fW(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 gW(r,t){return r[0]*t[0]+r[1]*t[1]}function pW(r,t){return r[0]===t[0]&&r[1]===t[1]}(function(){var r=Ax();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 cc=function(r){return r!==null&&typeof r!="function"&&isFinite(r.length)},vW=function(r,t){return cc(r)?r.indexOf(t)>-1:!1},mW=function(r,t){if(!cc(r))return r;for(var e=[],n=0;n<r.length;n++){var i=r[n];t(i,n)&&e.push(i)}return e},yW=function(r,t){return t===void 0&&(t=[]),mW(r,function(e){return!vW(t,e)})};function Et(r){return typeof r=="function"}function kt(r){return r==null}function Xr(r){return Array.isArray(r)}const sn=function(r){var t=typeof r;return r!==null&&t==="object"||t==="function"};function HR(r,t){if(r){var e;if(Xr(r))for(var n=0,i=r.length;n<i&&(e=t(r[n],n),e!==!1);n++);else if(sn(r)){for(var a in r)if(r.hasOwnProperty(a)&&(e=t(r[a],a),e===!1))break}}}var hw=function(r){return typeof r=="object"&&r!==null},bW={}.toString,UR=function(r,t){return bW.call(r)==="[object "+t+"]"},Gl=function(r){if(!hw(r)||!UR(r,"Object"))return!1;if(Object.getPrototypeOf(r)===null)return!0;for(var t=r;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(r)===t};function pf(r){if(!Array.isArray(r))return-1/0;var t=r.length;if(!t)return-1/0;for(var e=r[0],n=1;n<t;n++)e=Math.max(e,r[n]);return e}const vf=function(r){if(Xr(r))return r.reduce(function(t,e){return Math.min(t,e)},r[0])};var wW=function(r,t,e){if(!Xr(r)&&!Gl(r))return r;var n=e;return HR(r,function(i,a){n=t(n,i,a)}),n};function oe(r){return typeof r=="string"}function xW(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 EW=Object.prototype.hasOwnProperty;function a0(r,t){if(!t||!Xr(r))return{};for(var e={},n=Et(t)?t:function(o){return o[t]},i,a=0;a<r.length;a++){var s=r[a];i=n(s),EW.call(e,i)?e[i].push(s):e[i]=[s]}return e}var Ue=function(r,t,e){return r<t?t:r>e?e:r};function bt(r){return typeof r=="number"}var _W=1e-5;function ec(r,t,e){return e===void 0&&(e=_W),r===t||Math.abs(r-t)<e}const SW=function(r,t){if(Xr(r)){for(var e,n=-1/0,i=0;i<r.length;i++){var a=r[i],s=Et(t)?t(a):a[t];s>n&&(e=a,n=s)}return e}},MW=function(r,t){if(Xr(r)){for(var e,n=1/0,i=0;i<r.length;i++){var a=r[i],s=Et(t)?t(a):a[t];s<n&&(e=a,n=s)}return e}};var YR=function(r,t){return(r%t+t)%t};const XR=function(r){return kt(r)?"":r.toString()};var kW=function(r){var t=XR(r);return t.charAt(0).toLowerCase()+t.substring(1)};function CW(r,t){return!r||!t?r:r.replace(/\\?\{([^{}]+)\}/g,function(e,n){return e.charAt(0)==="\\"?e.slice(1):t[n]===void 0?"":t[n]})}var mf=function(r){var t=XR(r);return t.charAt(0).toUpperCase()+t.substring(1)},TW={}.toString,OW=function(r){return TW.call(r).replace(/^\[object /,"").replace(/]$/,"")},yf=function(r){return UR(r,"Boolean")};function AW(r){return r instanceof Date}function PW(r){return r===null}var NW=Object.prototype,RW=function(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||NW;return r===e},Pt=function(r){return r===void 0},zs=function(r){if(typeof r!="object"||r===null)return r;var t;if(Xr(r)){t=[];for(var e=0,n=r.length;e<n;e++)typeof r[e]=="object"&&r[e]!=null?t[e]=zs(r[e]):t[e]=r[e]}else{t={};for(var i in r)typeof r[i]=="object"&&r[i]!=null?t[i]=zs(r[i]):t[i]=r[i]}return t};function Ac(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 LW(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 gv=new Map;function dw(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];gv.has(r)||gv.set(r,LW(e));var o=gv.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 IW=5;function DW(r,t){if(Object.hasOwn)return Object.hasOwn(r,t);if(r==null)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(r),t)}function KR(r,t,e,n){e=e||0,n=n||IW;for(var i in t)if(DW(t,i)){var a=t[i];a!==null&&Gl(a)?(Gl(r[i])||(r[i]={}),e<n?KR(r[i],a,e+1,n):r[i]=t[i]):Xr(a)?(r[i]=[],r[i]=r[i].concat(a)):a!==void 0&&(r[i]=a)}}var cr=function(r){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];for(var n=0;n<t.length;n+=1)KR(r,t[n]);return r},FW=Object.prototype.hasOwnProperty;function Zi(r){if(kt(r))return!0;if(cc(r))return!r.length;var t=OW(r);if(t==="Map"||t==="Set")return!r.size;if(RW(r))return!Object.keys(r).length;for(var e in r)if(FW.call(r,e))return!1;return!0}var Ye=function(r,t){if(r===t)return!0;if(!r||!t||oe(r)||oe(t))return!1;if(cc(r)||cc(t)){if(r.length!==t.length)return!1;for(var e=!0,n=0;n<r.length&&(e=Ye(r[n],t[n]),!!e);n++);return e}if(hw(r)||hw(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=Ye(r[i[n]],t[i[n]]),!!e);n++);return e}return!1};const sr=function(r,t,e){for(var n=0,i=oe(t)?t.split("."):t;r&&n<i.length;)r=r[i[n++]];return r===void 0||n<i.length?e:r},hc=function(r,t,e){var n=r,i=oe(t)?t.split("."):t;return i.forEach(function(a,s){s<i.length-1?(sn(n[a])||(n[a]=bt(i[s+1])?[]:{}),n=n[a]):n[a]=e}),r};var BW=Object.prototype.hasOwnProperty;const Ro=function(r,t){if(r===null||!Gl(r))return{};var e={};return HR(t,function(n){BW.call(r,n)&&(e[n]=r[n])}),e},Px=function(r,t){return wW(r,function(e,n,i){return t.includes(i)||(e[i]=n),e},{})},ZR=function(r,t,e){var n,i,a,s,o=0;e||(e={});var l=function(){o=e.leading===!1?0:Date.now(),n=null,s=r.apply(i,a),n||(i=a=null)},u=function(){var c=Date.now();!o&&e.leading===!1&&(o=c);var h=t-(c-o);return i=this,a=arguments,h<=0||h>t?(n&&(clearTimeout(n),n=null),o=c,s=r.apply(i,a),n||(i=a=null)):!n&&e.trailing!==!1&&(n=setTimeout(l,h)),s};return u.cancel=function(){clearTimeout(n),o=0,n=i=a=null},u};var Vh={};const zW=function(r){return r=r||"g",Vh[r]?Vh[r]+=1:Vh[r]=1,r+Vh[r]},pv=function(){},fw=function(r){return r};var gw=function(r,t){return gw=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])},gw(r,t)};function Ut(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");gw(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var et=function(){return et=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a])}return t},et.apply(this,arguments)};function Je(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e}function Ht(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})}function Pc(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function z(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),i,a=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(o){s={error:o}}finally{try{i&&!i.done&&(e=n.return)&&e.call(n)}finally{if(s)throw s.error}}return a}function $W(){for(var r=0,t=0,e=arguments.length;t<e;t++)r+=arguments[t].length;for(var n=Array(r),i=0,t=0;t<e;t++)for(var a=arguments[t],s=0,o=a.length;s<o;s++,i++)n[i]=a[s];return n}function vt(r,t,e){if(e||arguments.length===2)for(var n=0,i=t.length,a;n<i;n++)(a||!(n in t))&&(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return r.concat(a||Array.prototype.slice.call(t))}function vv(r,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?r!==t||!n:!t.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(r):n?n.value:t.get(r)}var JR={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function jW(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 nc={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function QR(r){return Array.isArray(r)&&r.every(function(t){var e=t[0].toLowerCase();return nc[e]===t.length-1&&"achlmqstvz".includes(e)})}function tL(r){return QR(r)&&r.every(function(t){var e=t[0];return e===e.toUpperCase()})}function eL(r){return tL(r)&&r.every(function(t){var e=t[0];return"ACLMQZ".includes(e)})}function $3(r){for(var t=r.pathValue[r.segmentStart],e=t.toLowerCase(),n=r.data;n.length>=nc[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,nc[e]))),!!nc[e]););}function qW(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 WW(r){return r>=48&&r<=57||r===43||r===45||r===46}function gl(r){return r>=48&&r<=57}function GW(r){var t=r.max,e=r.pathValue,n=r.index,i=n,a=!1,s=!1,o=!1,l=!1,u;if(i>=t){r.err="[path-util]: Invalid path value at index ".concat(i,', "pathValue" is missing param');return}if(u=e.charCodeAt(i),(u===43||u===45)&&(i+=1,u=e.charCodeAt(i)),!gl(u)&&u!==46){r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(e[i],'" is not a number');return}if(u!==46){if(a=u===48,i+=1,u=e.charCodeAt(i),a&&i<t&&u&&gl(u)){r.err="[path-util]: Invalid path value at index ".concat(n,', "').concat(e[n],'" illegal number');return}for(;i<t&&gl(e.charCodeAt(i));)i+=1,s=!0;u=e.charCodeAt(i)}if(u===46){for(l=!0,i+=1;gl(e.charCodeAt(i));)i+=1,o=!0;u=e.charCodeAt(i)}if(u===101||u===69){if(l&&!s&&!o){r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(e[i],'" invalid float exponent');return}if(i+=1,u=e.charCodeAt(i),(u===43||u===45)&&(i+=1),i<t&&gl(e.charCodeAt(i)))for(;i<t&&gl(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 VW(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 Jd(r){for(var t=r.pathValue,e=r.max;r.index<e&&VW(t.charCodeAt(r.index));)r.index+=1}function HW(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 UW(r){return(r|32)===97}function YW(r){var t=r.max,e=r.pathValue,n=r.index,i=e.charCodeAt(n),a=nc[e[n].toLowerCase()];if(r.segmentStart=n,!HW(i)){r.err='[path-util]: Invalid path value "'.concat(e[n],'" is not a path command');return}if(r.index+=1,Jd(r),r.data=[],!a){$3(r);return}for(;;){for(var s=a;s>0;s-=1){if(UW(i)&&(s===3||s===4)?qW(r):GW(r),r.err.length)return;r.data.push(r.param),Jd(r),r.index<t&&e.charCodeAt(r.index)===44&&(r.index+=1,Jd(r))}if(r.index>=r.max||!WW(e.charCodeAt(r.index)))break}$3(r)}var XW=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 KW(r){if(QR(r))return[].concat(r);var t=new XW(r);for(Jd(t);t.index<t.max&&!t.err.length;)YW(t);return t.err?t.err:t.segments}function ZW(r){if(tL(r))return[].concat(r);var t=KW(r),e=0,n=0,i=0,a=0;return t.map(function(s){var o=s.slice(1).map(Number),l=s[0],u=l.toUpperCase();if(l==="M")return e=o[0],n=o[1],i=e,a=n,["M",e,n];var c;if(l!==u)switch(u){case"A":c=[u,o[0],o[1],o[2],o[3],o[4],o[5]+e,o[6]+n];break;case"V":c=[u,o[0]+n];break;case"H":c=[u,o[0]+e];break;default:{var h=o.map(function(g,p){return g+(p%2?n:e)});c=[u].concat(h)}}else c=[u].concat(o);var d=c.length;switch(u){case"Z":e=i,n=a;break;case"H":e=c[1];break;case"V":n=c[1];break;default:e=c[d-2],n=c[d-1],u==="M"&&(i=e,a=n)}return c})}function JW(r,t){var e=r[0],n=t.x1,i=t.y1,a=t.x2,s=t.y2,o=r.slice(1).map(Number),l=r;if("TQ".includes(e)||(t.qx=null,t.qy=null),e==="H")l=["L",r[1],i];else if(e==="V")l=["L",n,r[1]];else if(e==="S"){var u=n*2-a,c=i*2-s;t.x1=u,t.y1=c,l=["C",u,c].concat(o)}else if(e==="T"){var h=n*2-t.qx,d=i*2-t.qy;t.qx=h,t.qy=d,l=["Q",h,d].concat(o)}else if(e==="Q"){var g=o[0],p=o[1];t.qx=g,t.qy=p}return l}function bf(r){if(eL(r))return[].concat(r);for(var t=ZW(r),e=et({},JR),n=0;n<t.length;n+=1){t[n]=JW(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 QW(r){return eL(r)&&r.every(function(t){var e=t[0];return"MC".includes(e)})}function Hh(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 Nx(r,t,e,n,i,a,s,o,l,u){var c=r,h=t,d=e,g=n,p=o,v=l,m=Math.PI*120/180,b=Math.PI/180*(+i||0),w=[],x,S,_,M,k;if(u)S=u[0],_=u[1],M=u[2],k=u[3];else{x=Hh(c,h,-b),c=x.x,h=x.y,x=Hh(p,v,-b),p=x.x,v=x.y;var C=(c-p)/2,P=(h-v)/2,T=C*C/(d*d)+P*P/(g*g);T>1&&(T=Math.sqrt(T),d*=T,g*=T);var A=d*d,R=g*g,L=(a===s?-1:1)*Math.sqrt(Math.abs((A*R-A*P*P-R*C*C)/(A*P*P+R*C*C)));M=L*d*P/g+(c+p)/2,k=L*-g*C/d+(h+v)/2,S=Math.asin(((h-k)/g*Math.pow(10,9)>>0)/Math.pow(10,9)),_=Math.asin(((v-k)/g*Math.pow(10,9)>>0)/Math.pow(10,9)),S=c<M?Math.PI-S:S,_=p<M?Math.PI-_:_,S<0&&(S=Math.PI*2+S),_<0&&(_=Math.PI*2+_),s&&S>_&&(S-=Math.PI*2),!s&&_>S&&(_-=Math.PI*2)}var $=_-S;if(Math.abs($)>m){var q=_,j=p,B=v;_=S+m*(s&&_>S?1:-1),p=M+d*Math.cos(_),v=k+g*Math.sin(_),w=Nx(p,v,d,g,i,0,s,j,B,[_,q,M,k])}$=_-S;var D=Math.cos(S),G=Math.sin(S),X=Math.cos(_),K=Math.sin(_),ht=Math.tan($/4),ut=4/3*d*ht,ct=4/3*g*ht,dt=[c,h],pt=[c+ut*G,h-ct*D],mt=[p+ut*K,v-ct*X],It=[p,v];if(pt[0]=2*dt[0]-pt[0],pt[1]=2*dt[1]-pt[1],u)return pt.concat(mt,It,w);w=pt.concat(mt,It,w);for(var zt=[],Te=0,Rn=w.length;Te<Rn;Te+=1)zt[Te]=Te%2?Hh(w[Te-1],w[Te],b).y:Hh(w[Te],w[Te+1],b).x;return zt}function tG(r,t,e,n,i,a){var s=.3333333333333333,o=2/3;return[s*r+o*e,s*t+o*n,s*i+o*e,s*a+o*n,i,a]}function ms(r,t,e){var n=r[0],i=r[1],a=t[0],s=t[1];return[n+(a-n)*e,i+(s-i)*e]}var j3=function(r,t,e,n){var i=.5,a=ms([r,t],[e,n],i);return vt(vt([],a,!0),[e,n,e,n],!1)};function eG(r,t){var e=r[0],n=r.slice(1).map(Number),i=n[0],a=n[1],s,o=t.x1,l=t.y1,u=t.x,c=t.y;switch("TQ".includes(e)||(t.qx=null,t.qy=null),e){case"M":return t.x=i,t.y=a,r;case"A":return s=[o,l].concat(n),["C"].concat(Nx(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(tG(s[0],s[1],s[2],s[3],s[4],s[5]));case"L":return["C"].concat(j3(o,l,i,a));case"Z":return o===u&&l===c?["C",o,l,u,c,u,c]:["C"].concat(j3(o,l,u,c))}return r}function pw(r,t){if(t===void 0&&(t=!1),QW(r)){var e=[].concat(r);return t?[e,[]]:e}for(var n=bf(r),i=et({},JR),a=[],s="",o=n.length,l,u,c=[],h=0;h<o;h+=1){n[h]&&(s=n[h][0]),a[h]=s;var d=eG(n[h],i);n[h]=d,jW(n,a,h),o=n.length,s==="Z"&&c.push(h),l=n[h],u=l.length,i.x1=+l[u-2],i.y1=+l[u-1],i.x2=+l[u-4]||i.x1,i.y2=+l[u-3]||i.y1}return t?[n,c]:n}function nG(r){return r.map(function(t){return Array.isArray(t)?[].concat(t):t})}function rG(r){var t=r.slice(1).map(function(e,n,i){return n?i[n-1].slice(-2).concat(e.slice(1)):r[0].slice(1).concat(e.slice(1))}).map(function(e){return e.map(function(n,i){return e[e.length-i-2*(1-i%2)]})}).reverse();return[["M"].concat(t[0].slice(0,2))].concat(t.map(function(e){return["C"].concat(e.slice(2))}))}function wr(r,t){return Math.sqrt((r[0]-t[0])*(r[0]-t[0])+(r[1]-t[1])*(r[1]-t[1]))}function vw(r,t,e,n,i){var a=wr([r,t],[e,n]),s={x:0,y:0};if(typeof i=="number")if(i<=0)s={x:r,y:t};else if(i>=a)s={x:e,y:n};else{var o=ms([r,t],[e,n],i/a),l=o[0],u=o[1];s={x:l,y:u}}return{length:a,point:s,min:{x:Math.min(r,e),y:Math.min(t,n)},max:{x:Math.max(r,e),y:Math.max(t,n)}}}function q3(r,t){var e=r.x,n=r.y,i=t.x,a=t.y,s=e*i+n*a,o=Math.sqrt((Math.pow(e,2)+Math.pow(n,2))*(Math.pow(i,2)+Math.pow(a,2))),l=e*a-n*i<0?-1:1,u=l*Math.acos(s/o);return u}function iG(r,t,e,n,i,a,s,o,l,u){var c=Math.abs,h=Math.sin,d=Math.cos,g=Math.sqrt,p=Math.PI,v=c(e),m=c(n),b=(i%360+360)%360,w=b*(p/180);if(r===o&&t===l)return{x:r,y:t};if(v===0||m===0)return vw(r,t,o,l,u).point;var x=(r-o)/2,S=(t-l)/2,_={x:d(w)*x+h(w)*S,y:-h(w)*x+d(w)*S},M=Math.pow(_.x,2)/Math.pow(v,2)+Math.pow(_.y,2)/Math.pow(m,2);M>1&&(v*=g(M),m*=g(M));var k=Math.pow(v,2)*Math.pow(m,2)-Math.pow(v,2)*Math.pow(_.y,2)-Math.pow(m,2)*Math.pow(_.x,2),C=Math.pow(v,2)*Math.pow(_.y,2)+Math.pow(m,2)*Math.pow(_.x,2),P=k/C;P=P<0?0:P;var T=(a!==s?1:-1)*g(P),A={x:T*(v*_.y/m),y:T*(-(m*_.x)/v)},R={x:d(w)*A.x-h(w)*A.y+(r+o)/2,y:h(w)*A.x+d(w)*A.y+(t+l)/2},L={x:(_.x-A.x)/v,y:(_.y-A.y)/m},$=q3({x:1,y:0},L),q={x:(-_.x-A.x)/v,y:(-_.y-A.y)/m},j=q3(L,q);!s&&j>0?j-=2*p:s&&j<0&&(j+=2*p),j%=2*p;var B=$+j*u,D=v*d(B),G=m*h(B),X={x:d(w)*D-h(w)*G+R.x,y:h(w)*D+d(w)*G+R.y};return X}function aG(r,t,e,n,i,a,s,o,l,u,c){var h,d=c.bbox,g=d===void 0?!0:d,p=c.length,v=p===void 0?!0:p,m=c.sampleSize,b=m===void 0?30:m,w=typeof u=="number",x=r,S=t,_=0,M=[x,S,_],k=[x,S],C=0,P={x:0,y:0},T=[{x,y:S}];w&&u<=0&&(P={x,y:S});for(var A=0;A<=b;A+=1){if(C=A/b,h=iG(r,t,e,n,i,a,s,o,l,C),x=h.x,S=h.y,g&&T.push({x,y:S}),v&&(_+=wr(k,[x,S])),k=[x,S],w&&_>=u&&u>M[2]){var R=(_-u)/(_-M[2]);P={x:k[0]*(1-R)+M[0]*R,y:k[1]*(1-R)+M[1]*R}}M=[x,S,_]}return w&&u>=_&&(P={x:o,y:l}),{length:_,point:P,min:{x:Math.min.apply(null,T.map(function(L){return L.x})),y:Math.min.apply(null,T.map(function(L){return L.y}))},max:{x:Math.max.apply(null,T.map(function(L){return L.x})),y:Math.max.apply(null,T.map(function(L){return L.y}))}}}function sG(r,t,e,n,i,a,s,o,l){var u=1-l;return{x:Math.pow(u,3)*r+3*Math.pow(u,2)*l*e+3*u*Math.pow(l,2)*i+Math.pow(l,3)*s,y:Math.pow(u,3)*t+3*Math.pow(u,2)*l*n+3*u*Math.pow(l,2)*a+Math.pow(l,3)*o}}function nL(r,t,e,n,i,a,s,o,l,u){var c,h=u.bbox,d=h===void 0?!0:h,g=u.length,p=g===void 0?!0:g,v=u.sampleSize,m=v===void 0?10:v,b=typeof l=="number",w=r,x=t,S=0,_=[w,x,S],M=[w,x],k=0,C={x:0,y:0},P=[{x:w,y:x}];b&&l<=0&&(C={x:w,y:x});for(var T=0;T<=m;T+=1){if(k=T/m,c=sG(r,t,e,n,i,a,s,o,k),w=c.x,x=c.y,d&&P.push({x:w,y:x}),p&&(S+=wr(M,[w,x])),M=[w,x],b&&S>=l&&l>_[2]){var A=(S-l)/(S-_[2]);C={x:M[0]*(1-A)+_[0]*A,y:M[1]*(1-A)+_[1]*A}}_=[w,x,S]}return b&&l>=S&&(C={x:s,y:o}),{length:S,point:C,min:{x:Math.min.apply(null,P.map(function(R){return R.x})),y:Math.min.apply(null,P.map(function(R){return R.y}))},max:{x:Math.max.apply(null,P.map(function(R){return R.x})),y:Math.max.apply(null,P.map(function(R){return R.y}))}}}function oG(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 lG(r,t,e,n,i,a,s,o){var l,u=o.bbox,c=u===void 0?!0:u,h=o.length,d=h===void 0?!0:h,g=o.sampleSize,p=g===void 0?10:g,v=typeof s=="number",m=r,b=t,w=0,x=[m,b,w],S=[m,b],_=0,M={x:0,y:0},k=[{x:m,y:b}];v&&s<=0&&(M={x:m,y:b});for(var C=0;C<=p;C+=1){if(_=C/p,l=oG(r,t,e,n,i,a,_),m=l.x,b=l.y,c&&k.push({x:m,y:b}),d&&(w+=wr(S,[m,b])),S=[m,b],v&&w>=s&&s>x[2]){var P=(w-s)/(w-x[2]);M={x:S[0]*(1-P)+x[0]*P,y:S[1]*(1-P)+x[1]*P}}x=[m,b,w]}return v&&s>=w&&(M={x:i,y:a}),{length:w,point:M,min:{x:Math.min.apply(null,k.map(function(T){return T.x})),y:Math.min.apply(null,k.map(function(T){return T.y}))},max:{x:Math.max.apply(null,k.map(function(T){return T.x})),y:Math.max.apply(null,k.map(function(T){return T.y}))}}}function rL(r,t,e){for(var n,i,a,s,o,l,u=bf(r),c=typeof t=="number",h,d=[],g,p=0,v=0,m=0,b=0,w,x=[],S=[],_=0,M={x:0,y:0},k=M,C=M,P=M,T=0,A=0,R=u.length;A<R;A+=1)w=u[A],g=w[0],h=g==="M",d=h?d:[p,v].concat(w.slice(1)),h?(m=w[1],b=w[2],M={x:m,y:b},k=M,_=0,c&&t<.001&&(P=M)):g==="L"?(n=vw(d[0],d[1],d[2],d[3],(t||0)-T),_=n.length,M=n.min,k=n.max,C=n.point):g==="A"?(i=aG(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],d[8],(t||0)-T,e||{}),_=i.length,M=i.min,k=i.max,C=i.point):g==="C"?(a=nL(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],(t||0)-T,e||{}),_=a.length,M=a.min,k=a.max,C=a.point):g==="Q"?(s=lG(d[0],d[1],d[2],d[3],d[4],d[5],(t||0)-T,e||{}),_=s.length,M=s.min,k=s.max,C=s.point):g==="Z"&&(d=[p,v,m,b],o=vw(d[0],d[1],d[2],d[3],(t||0)-T),_=o.length,M=o.min,k=o.max,C=o.point),c&&T<t&&T+_>=t&&(P=C),S.push(k),x.push(M),T+=_,l=g!=="Z"?w.slice(-2):[m,b],p=l[0],v=l[1];return c&&t>=T&&(P={x:p,y:v}),{length:T,point:P,min:{x:Math.min.apply(null,x.map(function(L){return L.x})),y:Math.min.apply(null,x.map(function(L){return L.y}))},max:{x:Math.max.apply(null,S.map(function(L){return L.x})),y:Math.max.apply(null,S.map(function(L){return L.y}))}}}function uG(r,t){return rL(r,void 0,et(et({},t),{bbox:!1,length:!0})).length}function cG(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 hG(r,t){var e=r.length-1,n=[],i=0,a=0,s=cG(r);return s.forEach(function(o,l){r.slice(1).forEach(function(u,c){a+=wr(r[(l+c)%e].slice(-2),t[c%e].slice(-2))}),n[l]=a,a=0}),i=n.indexOf(Math.min.apply(null,n)),s[i]}function dG(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 fG(r){var t=0,e=0,n=0;return pw(r).map(function(i){var a;switch(i[0]){case"M":return t=i[1],e=i[2],0;default:var s=i.slice(1),o=s[0],l=s[1],u=s[2],c=s[3],h=s[4],d=s[5];return n=dG(t,e,o,l,u,c,h,d),a=i.slice(-2),t=a[0],e=a[1],n}}).reduce(function(i,a){return i+a},0)}function W3(r){return fG(r)>=0}function gG(r,t,e){return rL(r,t,et(et({},e),{bbox:!1,length:!0})).point}function pG(r,t){t===void 0&&(t=.5);var e=r.slice(0,2),n=r.slice(2,4),i=r.slice(4,6),a=r.slice(6,8),s=ms(e,n,t),o=ms(n,i,t),l=ms(i,a,t),u=ms(s,o,t),c=ms(o,l,t),h=ms(u,c,t);return[["C"].concat(s,u,h),["C"].concat(c,l,a)]}function G3(r){return r.map(function(t,e,n){var i=e&&n[e-1].slice(-2).concat(t.slice(1)),a=e?nL(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],{bbox:!1}).length:0,s;return e?s=a?pG(i):[t,t]:s=[t],{s:t,ss:s,l:a}})}function iL(r,t,e){var n=G3(r),i=G3(t),a=n.length,s=i.length,o=n.filter(function(m){return m.l}).length,l=i.filter(function(m){return m.l}).length,u=n.filter(function(m){return m.l}).reduce(function(m,b){var w=b.l;return m+w},0)/o||0,c=i.filter(function(m){return m.l}).reduce(function(m,b){var w=b.l;return m+w},0)/l||0,h=e||Math.max(a,s),d=[u,c],g=[h-a,h-s],p=0,v=[n,i].map(function(m,b){return m.l===h?m.map(function(w){return w.s}):m.map(function(w,x){return p=x&&g[b]&&w.l>=d[b],g[b]-=p?1:0,p?w.ss:[w.s]}).flat()});return v[0].length===v[1].length?v:iL(v[0],v[1],h)}function mw(r){var t=document.createElement("div");t.innerHTML=r;var e=t.childNodes[0];return e&&t.contains(e)&&t.removeChild(e),e}function vG(r,t){for(;!{}.hasOwnProperty.call(r,t)&&(r=cf(r))!==null;);return r}function yw(){return yw=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(r,t,e){var n=vG(r,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?r:e):i.value}},yw.apply(null,arguments)}function V3(r,t,e,n){var i=yw(cf(r.prototype),t,e);return typeof i=="function"?function(a){return i.apply(e,a)}:i}function Ba(r,t,e,n){var i=r-e,a=t-n;return Math.sqrt(i*i+a*a)}function aL(r,t){var e=Math.min.apply(Math,vt([],z(r),!1)),n=Math.min.apply(Math,vt([],z(t),!1)),i=Math.max.apply(Math,vt([],z(r),!1)),a=Math.max.apply(Math,vt([],z(t),!1));return{x:e,y:n,width:i-e,height:a-n}}function mG(r,t,e){return Math.atan(-t/r*Math.tan(e))}function yG(r,t,e){return Math.atan(t/(r*Math.tan(e)))}function bG(r,t,e,n,i,a){return e*Math.cos(i)*Math.cos(a)-n*Math.sin(i)*Math.sin(a)+r}function wG(r,t,e,n,i,a){return e*Math.sin(i)*Math.cos(a)+n*Math.cos(i)*Math.sin(a)+t}function xG(r,t,e,n,i,a,s){for(var o=mG(e,n,i),l=1/0,u=-1/0,c=[a,s],h=-Math.PI*2;h<=Math.PI*2;h+=Math.PI){var d=o+h;a<s?a<d&&d<s&&c.push(d):s<d&&d<a&&c.push(d)}for(var h=0;h<c.length;h++){var g=bG(r,t,e,n,i,c[h]);g<l&&(l=g),g>u&&(u=g)}for(var p=yG(e,n,i),v=1/0,m=-1/0,b=[a,s],h=-Math.PI*2;h<=Math.PI*2;h+=Math.PI){var w=p+h;a<s?a<w&&w<s&&b.push(w):s<w&&w<a&&b.push(w)}for(var h=0;h<b.length;h++){var x=wG(r,t,e,n,i,b[h]);x<v&&(v=x),x>m&&(m=x)}return{x:l,y:v,width:u-l,height:m-v}}var EG=1e-4;function sL(r,t,e,n,i,a){var s=-1,o=1/0,l=[e,n],u=20;a&&a>200&&(u=a/10);for(var c=1/u,h=c/10,d=0;d<=u;d++){var g=d*c,p=[i.apply(void 0,vt([],z(r.concat([g])),!1)),i.apply(void 0,vt([],z(t.concat([g])),!1))],v=Ba(l[0],l[1],p[0],p[1]);v<o&&(s=g,o=v)}if(s===0)return{x:r[0],y:t[0]};if(s===1){var m=r.length;return{x:r[m-1],y:t[m-1]}}o=1/0;for(var d=0;d<32&&!(h<EG);d++){var b=s-h,w=s+h,p=[i.apply(void 0,vt([],z(r.concat([b])),!1)),i.apply(void 0,vt([],z(t.concat([b])),!1))],v=Ba(l[0],l[1],p[0],p[1]);if(b>=0&&v<o)s=b,o=v;else{var x=[i.apply(void 0,vt([],z(r.concat([w])),!1)),i.apply(void 0,vt([],z(t.concat([w])),!1))],S=Ba(l[0],l[1],x[0],x[1]);w<=1&&S<o?(s=w,o=S):h*=.5}}return{x:i.apply(void 0,vt([],z(r.concat([s])),!1)),y:i.apply(void 0,vt([],z(t.concat([s])),!1))}}function oL(r,t,e,n){return Ba(r,t,e,n)}function lL(r,t,e,n,i){return{x:(1-i)*r+i*e,y:(1-i)*t+i*n}}function _G(r,t,e,n,i,a){var s=[e-r,n-t];if(pW(s,[0,0]))return Math.sqrt((i-r)*(i-r)+(a-t)*(a-t));var o=[-s[1],s[0]];fW(o,o);var l=[i-r,a-t];return Math.abs(gW(l,o))}function bw(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 H3(r,t,e,n){var i=-3*r+9*t-9*e+3*n,a=6*r-12*t+6*e,s=3*t-3*r,o=[],l,u,c;if(ec(i,0))ec(a,0)||(l=-s/a,l>=0&&l<=1&&o.push(l));else{var h=a*a-4*i*s;ec(h,0)?o.push(-a/(2*i)):h>0&&(c=Math.sqrt(h),l=(-a+c)/(2*i),u=(-a-c)/(2*i),l>=0&&l<=1&&o.push(l),u>=0&&u<=1&&o.push(u))}return o}function SG(r,t,e,n,i,a,s,o){for(var l=[r,s],u=[t,o],c=H3(r,e,i,s),h=H3(t,n,a,o),d=0;d<c.length;d++)l.push(bw(r,e,i,s,c[d]));for(var d=0;d<h.length;d++)u.push(bw(t,n,a,o,h[d]));return aL(l,u)}function MG(r,t,e,n,i,a,s,o,l,u,c){return sL([r,e,i,s],[t,n,a,o],l,u,bw,c)}function U3(r,t,e,n,i,a,s,o,l,u,c){var h=MG(r,t,e,n,i,a,s,o,l,u,c);return Ba(h.x,h.y,l,u)}function kG(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+=Ba(n[0],n[1],i[0],i[1])}return t}function CG(r){return kG(r)}function ww(r,t,e,n){var i=1-n;return i*i*r+2*n*i*t+n*n*e}function Y3(r,t,e){var n=r+e-2*t;if(ec(n,0))return[.5];var i=(r-t)/n;return i<=1&&i>=0?[i]:[]}function TG(r,t,e,n,i,a){var s=Y3(r,e,i)[0],o=Y3(t,n,a)[0],l=[r,i],u=[t,a];return s!==void 0&&l.push(ww(r,e,i,s)),o!==void 0&&u.push(ww(t,n,a,o)),aL(l,u)}function OG(r,t,e,n,i,a,s,o){return sL([r,e,i],[t,n,a],s,o,ww)}function AG(r,t,e,n,i,a,s,o){var l=OG(r,t,e,n,i,a,s,o);return Ba(l.x,l.y,s,o)}function jn(){jn=function(){return t};var r,t={},e=Object.prototype,n=e.hasOwnProperty,i=Object.defineProperty||function(j,B,D){j[B]=D.value},a=typeof Symbol=="function"?Symbol:{},s=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(j,B,D){return Object.defineProperty(j,B,{value:D,enumerable:!0,configurable:!0,writable:!0}),j[B]}try{u({},"")}catch{u=function(D,G,X){return D[G]=X}}function c(j,B,D,G){var X=B&&B.prototype instanceof b?B:b,K=Object.create(X.prototype),ht=new $(G||[]);return i(K,"_invoke",{value:T(j,D,ht)}),K}function h(j,B,D){try{return{type:"normal",arg:j.call(B,D)}}catch(G){return{type:"throw",arg:G}}}t.wrap=c;var d="suspendedStart",g="suspendedYield",p="executing",v="completed",m={};function b(){}function w(){}function x(){}var S={};u(S,s,function(){return this});var _=Object.getPrototypeOf,M=_&&_(_(q([])));M&&M!==e&&n.call(M,s)&&(S=M);var k=x.prototype=b.prototype=Object.create(S);function C(j){["next","throw","return"].forEach(function(B){u(j,B,function(D){return this._invoke(B,D)})})}function P(j,B){function D(X,K,ht,ut){var ct=h(j[X],j,K);if(ct.type!=="throw"){var dt=ct.arg,pt=dt.value;return pt&&P3(pt)=="object"&&n.call(pt,"__await")?B.resolve(pt.__await).then(function(mt){D("next",mt,ht,ut)},function(mt){D("throw",mt,ht,ut)}):B.resolve(pt).then(function(mt){dt.value=mt,ht(dt)},function(mt){return D("throw",mt,ht,ut)})}ut(ct.arg)}var G;i(this,"_invoke",{value:function(K,ht){function ut(){return new B(function(ct,dt){D(K,ht,ct,dt)})}return G=G?G.then(ut,ut):ut()}})}function T(j,B,D){var G=d;return function(X,K){if(G===p)throw Error("Generator is already running");if(G===v){if(X==="throw")throw K;return{value:r,done:!0}}for(D.method=X,D.arg=K;;){var ht=D.delegate;if(ht){var ut=A(ht,D);if(ut){if(ut===m)continue;return ut}}if(D.method==="next")D.sent=D._sent=D.arg;else if(D.method==="throw"){if(G===d)throw G=v,D.arg;D.dispatchException(D.arg)}else D.method==="return"&&D.abrupt("return",D.arg);G=p;var ct=h(j,B,D);if(ct.type==="normal"){if(G=D.done?v:g,ct.arg===m)continue;return{value:ct.arg,done:D.done}}ct.type==="throw"&&(G=v,D.method="throw",D.arg=ct.arg)}}}function A(j,B){var D=B.method,G=j.iterator[D];if(G===r)return B.delegate=null,D==="throw"&&j.iterator.return&&(B.method="return",B.arg=r,A(j,B),B.method==="throw")||D!=="return"&&(B.method="throw",B.arg=new TypeError("The iterator does not provide a '"+D+"' method")),m;var X=h(G,j.iterator,B.arg);if(X.type==="throw")return B.method="throw",B.arg=X.arg,B.delegate=null,m;var K=X.arg;return K?K.done?(B[j.resultName]=K.value,B.next=j.nextLoc,B.method!=="return"&&(B.method="next",B.arg=r),B.delegate=null,m):K:(B.method="throw",B.arg=new TypeError("iterator result is not an object"),B.delegate=null,m)}function R(j){var B={tryLoc:j[0]};1 in j&&(B.catchLoc=j[1]),2 in j&&(B.finallyLoc=j[2],B.afterLoc=j[3]),this.tryEntries.push(B)}function L(j){var B=j.completion||{};B.type="normal",delete B.arg,j.completion=B}function $(j){this.tryEntries=[{tryLoc:"root"}],j.forEach(R,this),this.reset(!0)}function q(j){if(j||j===""){var B=j[s];if(B)return B.call(j);if(typeof j.next=="function")return j;if(!isNaN(j.length)){var D=-1,G=function X(){for(;++D<j.length;)if(n.call(j,D))return X.value=j[D],X.done=!1,X;return X.value=r,X.done=!0,X};return G.next=G}}throw new TypeError(P3(j)+" is not iterable")}return w.prototype=x,i(k,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=u(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(j){var B=typeof j=="function"&&j.constructor;return!!B&&(B===w||(B.displayName||B.name)==="GeneratorFunction")},t.mark=function(j){return Object.setPrototypeOf?Object.setPrototypeOf(j,x):(j.__proto__=x,u(j,l,"GeneratorFunction")),j.prototype=Object.create(k),j},t.awrap=function(j){return{__await:j}},C(P.prototype),u(P.prototype,o,function(){return this}),t.AsyncIterator=P,t.async=function(j,B,D,G,X){X===void 0&&(X=Promise);var K=new P(c(j,B,D,G),X);return t.isGeneratorFunction(B)?K:K.next().then(function(ht){return ht.done?ht.value:K.next()})},C(k),u(k,l,"Generator"),u(k,s,function(){return this}),u(k,"toString",function(){return"[object Generator]"}),t.keys=function(j){var B=Object(j),D=[];for(var G in B)D.push(G);return D.reverse(),function X(){for(;D.length;){var K=D.pop();if(K in B)return X.value=K,X.done=!1,X}return X.done=!0,X}},t.values=q,$.prototype={constructor:$,reset:function(B){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(L),!B)for(var D in this)D.charAt(0)==="t"&&n.call(this,D)&&!isNaN(+D.slice(1))&&(this[D]=r)},stop:function(){this.done=!0;var B=this.tryEntries[0].completion;if(B.type==="throw")throw B.arg;return this.rval},dispatchException:function(B){if(this.done)throw B;var D=this;function G(dt,pt){return ht.type="throw",ht.arg=B,D.next=dt,pt&&(D.method="next",D.arg=r),!!pt}for(var X=this.tryEntries.length-1;X>=0;--X){var K=this.tryEntries[X],ht=K.completion;if(K.tryLoc==="root")return G("end");if(K.tryLoc<=this.prev){var ut=n.call(K,"catchLoc"),ct=n.call(K,"finallyLoc");if(ut&&ct){if(this.prev<K.catchLoc)return G(K.catchLoc,!0);if(this.prev<K.finallyLoc)return G(K.finallyLoc)}else if(ut){if(this.prev<K.catchLoc)return G(K.catchLoc,!0)}else{if(!ct)throw Error("try statement without catch or finally");if(this.prev<K.finallyLoc)return G(K.finallyLoc)}}}},abrupt:function(B,D){for(var G=this.tryEntries.length-1;G>=0;--G){var X=this.tryEntries[G];if(X.tryLoc<=this.prev&&n.call(X,"finallyLoc")&&this.prev<X.finallyLoc){var K=X;break}}K&&(B==="break"||B==="continue")&&K.tryLoc<=D&&D<=K.finallyLoc&&(K=null);var ht=K?K.completion:{};return ht.type=B,ht.arg=D,K?(this.method="next",this.next=K.finallyLoc,m):this.complete(ht)},complete:function(B,D){if(B.type==="throw")throw B.arg;return B.type==="break"||B.type==="continue"?this.next=B.arg:B.type==="return"?(this.rval=this.arg=B.arg,this.method="return",this.next="end"):B.type==="normal"&&D&&(this.next=D),m},finish:function(B){for(var D=this.tryEntries.length-1;D>=0;--D){var G=this.tryEntries[D];if(G.finallyLoc===B)return this.complete(G.completion,G.afterLoc),L(G),m}},catch:function(B){for(var D=this.tryEntries.length-1;D>=0;--D){var G=this.tryEntries[D];if(G.tryLoc===B){var X=G.completion;if(X.type==="throw"){var K=X.arg;L(G)}return K}}throw Error("illegal catch attempt")},delegateYield:function(B,D,G){return this.delegate={iterator:q(B),resultName:D,nextLoc:G},this.method==="next"&&(this.arg=r),m}},t}function vo(r,t){var e=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!e){if(Array.isArray(r)||(e=bj(r))||t){e&&(r=e);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,s=!0,o=!1;return{s:function(){e=e.call(r)},n:function(){var u=e.next();return s=u.done,u},e:function(u){o=!0,a=u},f:function(){try{s||e.return==null||e.return()}finally{if(o)throw a}}}}function PG(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 Wo(r,t){if(r==null)return{};var e,n,i=PG(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 NG=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},uL={exports:{}};(function(r,t){(function(e,n){r.exports=n()})(NG,function(){function e(_,M,k,C,P){n(_,M,k||0,C||_.length-1,P||a)}function n(_,M,k,C,P){for(;C>k;){if(C-k>600){var T=C-k+1,A=M-k+1,R=Math.log(T),L=.5*Math.exp(2*R/3),$=.5*Math.sqrt(R*L*(T-L)/T)*(A-T/2<0?-1:1),q=Math.max(k,Math.floor(M-A*L/T+$)),j=Math.min(C,Math.floor(M+(T-A)*L/T+$));n(_,M,q,j,P)}var B=_[M],D=k,G=C;for(i(_,k,M),P(_[C],B)>0&&i(_,k,C);D<G;){for(i(_,D,G),D++,G--;P(_[D],B)<0;)D++;for(;P(_[G],B)>0;)G--}P(_[k],B)===0?i(_,k,G):(G++,i(_,G,C)),G<=M&&(k=G+1),M<=G&&(C=G-1)}}function i(_,M,k){var C=_[M];_[M]=_[k],_[k]=C}function a(_,M){return _<M?-1:_>M?1:0}var s=function(M){M===void 0&&(M=9),this._maxEntries=Math.max(4,M),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()};s.prototype.all=function(){return this._all(this.data,[])},s.prototype.search=function(M){var k=this.data,C=[];if(!w(M,k))return C;for(var P=this.toBBox,T=[];k;){for(var A=0;A<k.children.length;A++){var R=k.children[A],L=k.leaf?P(R):R;w(M,L)&&(k.leaf?C.push(R):b(M,L)?this._all(R,C):T.push(R))}k=T.pop()}return C},s.prototype.collides=function(M){var k=this.data;if(!w(M,k))return!1;for(var C=[];k;){for(var P=0;P<k.children.length;P++){var T=k.children[P],A=k.leaf?this.toBBox(T):T;if(w(M,A)){if(k.leaf||b(M,A))return!0;C.push(T)}}k=C.pop()}return!1},s.prototype.load=function(M){if(!(M&&M.length))return this;if(M.length<this._minEntries){for(var k=0;k<M.length;k++)this.insert(M[k]);return this}var C=this._build(M.slice(),0,M.length-1,0);if(!this.data.children.length)this.data=C;else if(this.data.height===C.height)this._splitRoot(this.data,C);else{if(this.data.height<C.height){var P=this.data;this.data=C,C=P}this._insert(C,this.data.height-C.height-1,!0)}return this},s.prototype.insert=function(M){return M&&this._insert(M,this.data.height-1),this},s.prototype.clear=function(){return this.data=x([]),this},s.prototype.remove=function(M,k){if(!M)return this;for(var C=this.data,P=this.toBBox(M),T=[],A=[],R,L,$;C||T.length;){if(C||(C=T.pop(),L=T[T.length-1],R=A.pop(),$=!0),C.leaf){var q=o(M,C.children,k);if(q!==-1)return C.children.splice(q,1),T.push(C),this._condense(T),this}!$&&!C.leaf&&b(C,P)?(T.push(C),A.push(R),R=0,L=C,C=C.children[0]):L?(R++,C=L.children[R],$=!1):C=null}return this},s.prototype.toBBox=function(M){return M},s.prototype.compareMinX=function(M,k){return M.minX-k.minX},s.prototype.compareMinY=function(M,k){return M.minY-k.minY},s.prototype.toJSON=function(){return this.data},s.prototype.fromJSON=function(M){return this.data=M,this},s.prototype._all=function(M,k){for(var C=[];M;)M.leaf?k.push.apply(k,M.children):C.push.apply(C,M.children),M=C.pop();return k},s.prototype._build=function(M,k,C,P){var T=C-k+1,A=this._maxEntries,R;if(T<=A)return R=x(M.slice(k,C+1)),l(R,this.toBBox),R;P||(P=Math.ceil(Math.log(T)/Math.log(A)),A=Math.ceil(T/Math.pow(A,P-1))),R=x([]),R.leaf=!1,R.height=P;var L=Math.ceil(T/A),$=L*Math.ceil(Math.sqrt(A));S(M,k,C,$,this.compareMinX);for(var q=k;q<=C;q+=$){var j=Math.min(q+$-1,C);S(M,q,j,L,this.compareMinY);for(var B=q;B<=j;B+=L){var D=Math.min(B+L-1,j);R.children.push(this._build(M,B,D,P-1))}}return l(R,this.toBBox),R},s.prototype._chooseSubtree=function(M,k,C,P){for(;P.push(k),!(k.leaf||P.length-1===C);){for(var T=1/0,A=1/0,R=void 0,L=0;L<k.children.length;L++){var $=k.children[L],q=g($),j=v(M,$)-q;j<A?(A=j,T=q<T?q:T,R=$):j===A&&q<T&&(T=q,R=$)}k=R||k.children[0]}return k},s.prototype._insert=function(M,k,C){var P=C?M:this.toBBox(M),T=[],A=this._chooseSubtree(P,this.data,k,T);for(A.children.push(M),c(A,P);k>=0&&T[k].children.length>this._maxEntries;)this._split(T,k),k--;this._adjustParentBBoxes(P,T,k)},s.prototype._split=function(M,k){var C=M[k],P=C.children.length,T=this._minEntries;this._chooseSplitAxis(C,T,P);var A=this._chooseSplitIndex(C,T,P),R=x(C.children.splice(A,C.children.length-A));R.height=C.height,R.leaf=C.leaf,l(C,this.toBBox),l(R,this.toBBox),k?M[k-1].children.push(R):this._splitRoot(C,R)},s.prototype._splitRoot=function(M,k){this.data=x([M,k]),this.data.height=M.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},s.prototype._chooseSplitIndex=function(M,k,C){for(var P,T=1/0,A=1/0,R=k;R<=C-k;R++){var L=u(M,0,R,this.toBBox),$=u(M,R,C,this.toBBox),q=m(L,$),j=g(L)+g($);q<T?(T=q,P=R,A=j<A?j:A):q===T&&j<A&&(A=j,P=R)}return P||C-k},s.prototype._chooseSplitAxis=function(M,k,C){var P=M.leaf?this.compareMinX:h,T=M.leaf?this.compareMinY:d,A=this._allDistMargin(M,k,C,P),R=this._allDistMargin(M,k,C,T);A<R&&M.children.sort(P)},s.prototype._allDistMargin=function(M,k,C,P){M.children.sort(P);for(var T=this.toBBox,A=u(M,0,k,T),R=u(M,C-k,C,T),L=p(A)+p(R),$=k;$<C-k;$++){var q=M.children[$];c(A,M.leaf?T(q):q),L+=p(A)}for(var j=C-k-1;j>=k;j--){var B=M.children[j];c(R,M.leaf?T(B):B),L+=p(R)}return L},s.prototype._adjustParentBBoxes=function(M,k,C){for(var P=C;P>=0;P--)c(k[P],M)},s.prototype._condense=function(M){for(var k=M.length-1,C=void 0;k>=0;k--)M[k].children.length===0?k>0?(C=M[k-1].children,C.splice(C.indexOf(M[k]),1)):this.clear():l(M[k],this.toBBox)};function o(_,M,k){if(!k)return M.indexOf(_);for(var C=0;C<M.length;C++)if(k(_,M[C]))return C;return-1}function l(_,M){u(_,0,_.children.length,M,_)}function u(_,M,k,C,P){P||(P=x(null)),P.minX=1/0,P.minY=1/0,P.maxX=-1/0,P.maxY=-1/0;for(var T=M;T<k;T++){var A=_.children[T];c(P,_.leaf?C(A):A)}return P}function c(_,M){return _.minX=Math.min(_.minX,M.minX),_.minY=Math.min(_.minY,M.minY),_.maxX=Math.max(_.maxX,M.maxX),_.maxY=Math.max(_.maxY,M.maxY),_}function h(_,M){return _.minX-M.minX}function d(_,M){return _.minY-M.minY}function g(_){return(_.maxX-_.minX)*(_.maxY-_.minY)}function p(_){return _.maxX-_.minX+(_.maxY-_.minY)}function v(_,M){return(Math.max(M.maxX,_.maxX)-Math.min(M.minX,_.minX))*(Math.max(M.maxY,_.maxY)-Math.min(M.minY,_.minY))}function m(_,M){var k=Math.max(_.minX,M.minX),C=Math.max(_.minY,M.minY),P=Math.min(_.maxX,M.maxX),T=Math.min(_.maxY,M.maxY);return Math.max(0,P-k)*Math.max(0,T-C)}function b(_,M){return _.minX<=M.minX&&_.minY<=M.minY&&M.maxX<=_.maxX&&M.maxY<=_.maxY}function w(_,M){return M.minX<=_.maxX&&M.minY<=_.maxY&&M.maxX>=_.minX&&M.maxY>=_.minY}function x(_){return{children:_,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function S(_,M,k,C,P){for(var T=[M,k];T.length;)if(k=T.pop(),M=T.pop(),!(k-M<=C)){var A=M+Math.ceil((k-M)/C/2)*C;e(_,A,M,k,P),T.push(M,A,A,k)}}return s})})(uL);var RG=uL.exports,Q=function(r){return r.GROUP="g",r.FRAGMENT="fragment",r.CIRCLE="circle",r.ELLIPSE="ellipse",r.IMAGE="image",r.RECT="rect",r.LINE="line",r.POLYLINE="polyline",r.POLYGON="polygon",r.TEXT="text",r.PATH="path",r.HTML="html",r.MESH="mesh",r}({}),Qd=function(r){return r[r.ZERO=0]="ZERO",r[r.NEGATIVE_ONE=1]="NEGATIVE_ONE",r}({}),Vs=function(){function r(){at(this,r),this.plugins=[]}return it(r,[{key:"addRenderingPlugin",value:function(e){this.plugins.push(e),this.context.renderingPlugins.push(e)}},{key:"removeAllRenderingPlugins",value:function(){var e=this;this.plugins.forEach(function(n){var i=e.context.renderingPlugins.indexOf(n);i>=0&&e.context.renderingPlugins.splice(i,1)})}}])}(),LG=function(){function r(t){at(this,r),this.clipSpaceNearZ=Qd.NEGATIVE_ONE,this.plugins=[],this.config=Bt({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1,enableSizeAttenuation:!0,enableRenderingOptimization:!1},t)}return it(r,[{key:"registerPlugin",value:function(e){var n=this.plugins.findIndex(function(i){return i===e});n===-1&&this.plugins.push(e)}},{key:"unregisterPlugin",value:function(e){var n=this.plugins.findIndex(function(i){return i===e});n>-1&&this.plugins.splice(n,1)}},{key:"getPlugins",value:function(){return this.plugins}},{key:"getPlugin",value:function(e){return this.plugins.find(function(n){return n.name===e})}},{key:"getConfig",value:function(){return this.config}},{key:"setConfig",value:function(e){Object.assign(this.config,e)}}])}(),mv=As,pl=Qi,IG=eW,DG=tW,X3=ff,yv=aW,Me=function(){function r(){at(this,r),this.center=[0,0,0],this.halfExtents=[0,0,0],this.min=[0,0,0],this.max=[0,0,0]}return it(r,[{key:"update",value:function(e,n){pl(this.center,e),pl(this.halfExtents,n),yv(this.min,this.center,this.halfExtents),mv(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(e,n){mv(this.center,n,e),X3(this.center,this.center,.5),yv(this.halfExtents,n,e),X3(this.halfExtents,this.halfExtents,.5),pl(this.min,e),pl(this.max,n)}},{key:"getMin",value:function(){return this.min}},{key:"getMax",value:function(){return this.max}},{key:"add",value:function(e){if(!r.isEmpty(e)){if(r.isEmpty(this)){this.setMinMax(e.getMin(),e.getMax());return}var n=this.center,i=n[0],a=n[1],s=n[2],o=this.halfExtents,l=o[0],u=o[1],c=o[2],h=i-l,d=i+l,g=a-u,p=a+u,v=s-c,m=s+c,b=e.center,w=b[0],x=b[1],S=b[2],_=e.halfExtents,M=_[0],k=_[1],C=_[2],P=w-M,T=w+M,A=x-k,R=x+k,L=S-C,$=S+C;P<h&&(h=P),T>d&&(d=T),A<g&&(g=A),R>p&&(p=R),L<v&&(v=L),$>m&&(m=$),n[0]=(h+d)*.5,n[1]=(g+p)*.5,n[2]=(v+m)*.5,o[0]=(d-h)*.5,o[1]=(p-g)*.5,o[2]=(m-v)*.5,this.min[0]=h,this.min[1]=g,this.min[2]=v,this.max[0]=d,this.max[1]=p,this.max[2]=m}}},{key:"setFromTransformedAABB",value:function(e,n){var i=this.center,a=this.halfExtents,s=e.center,o=e.halfExtents,l=n[0],u=n[4],c=n[8],h=n[1],d=n[5],g=n[9],p=n[2],v=n[6],m=n[10],b=Math.abs(l),w=Math.abs(u),x=Math.abs(c),S=Math.abs(h),_=Math.abs(d),M=Math.abs(g),k=Math.abs(p),C=Math.abs(v),P=Math.abs(m);i[0]=n[12]+l*s[0]+u*s[1]+c*s[2],i[1]=n[13]+h*s[0]+d*s[1]+g*s[2],i[2]=n[14]+p*s[0]+v*s[1]+m*s[2],a[0]=b*o[0]+w*o[1]+x*o[2],a[1]=S*o[0]+_*o[1]+M*o[2],a[2]=k*o[0]+C*o[1]+P*o[2],yv(this.min,i,a),mv(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=IG([0,0,0],this.getMin(),e.getMin()),a=DG([0,0,0],this.getMax(),e.getMax());return n.setMinMax(i,a),n}},{key:"getNegativeFarPoint",value:function(e){return e.pnVertexFlag===273?pl([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?pl([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}}])}(),FG=function(){function r(t,e){at(this,r),this.distance=t||0,this.normal=e||Ae(0,1,0),this.updatePNVertexFlag()}return it(r,[{key:"updatePNVertexFlag",value:function(){this.pnVertexFlag=(+(this.normal[0]>=0)<<8)+(+(this.normal[1]>=0)<<4)+ +(this.normal[2]>=0)}},{key:"distanceToPoint",value:function(e){return ta(e,this.normal)-this.distance}},{key:"normalize",value:function(){var e=1/VR(this.normal);ff(this.normal,this.normal,e),this.distance*=e}},{key:"intersectsLine",value:function(e,n,i){var a=this.distanceToPoint(e),s=this.distanceToPoint(n),o=a/(a-s),l=o>=0&&o<=1;return l&&i&&cw(i,e,n,o),l}}])}(),vl=function(r){return r[r.OUTSIDE=4294967295]="OUTSIDE",r[r.INSIDE=0]="INSIDE",r[r.INDETERMINATE=2147483647]="INDETERMINATE",r}({}),BG=function(){function r(t){if(at(this,r),this.planes=[],t)this.planes=t;else for(var e=0;e<6;e++)this.planes.push(new FG)}return it(r,[{key:"extractFromVPMatrix",value:function(e){var n=Rt(e,16),i=n[0],a=n[1],s=n[2],o=n[3],l=n[4],u=n[5],c=n[6],h=n[7],d=n[8],g=n[9],p=n[10],v=n[11],m=n[12],b=n[13],w=n[14],x=n[15];Kn(this.planes[0].normal,o-i,h-l,v-d),this.planes[0].distance=x-m,Kn(this.planes[1].normal,o+i,h+l,v+d),this.planes[1].distance=x+m,Kn(this.planes[2].normal,o+a,h+u,v+g),this.planes[2].distance=x+b,Kn(this.planes[3].normal,o-a,h-u,v-g),this.planes[3].distance=x-b,Kn(this.planes[4].normal,o-s,h-c,v-p),this.planes[4].distance=x-w,Kn(this.planes[5].normal,o+s,h+c,v+p),this.planes[5].distance=x+w,this.planes.forEach(function(S){S.normalize(),S.updatePNVertexFlag()})}}])}(),zn=function(){function r(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;at(this,r),this.x=0,this.y=0,this.x=t,this.y=e}return it(r,[{key:"clone",value:function(){return new r(this.x,this.y)}},{key:"copyFrom",value:function(e){this.x=e.x,this.y=e.y}}])}(),Vl=function(){function r(t,e,n,i){at(this,r),this.x=t,this.y=e,this.width=n,this.height=i,this.left=t,this.right=t+n,this.top=e,this.bottom=e+i}return it(r,[{key:"toJSON",value:function(){}}],[{key:"fromRect",value:function(e){return new r(e.x,e.y,e.width,e.height)}},{key:"applyTransform",value:function(e,n){var i=Fu(e.x,e.y,0,1),a=Fu(e.x+e.width,e.y,0,1),s=Fu(e.x,e.y+e.height,0,1),o=Fu(e.x+e.width,e.y+e.height,0,1),l=ea(),u=ea(),c=ea(),h=ea();Na(l,i,n),Na(u,a,n),Na(c,s,n),Na(h,o,n);var d=Math.min(l[0],u[0],c[0],h[0]),g=Math.min(l[1],u[1],c[1],h[1]),p=Math.max(l[0],u[0],c[0],h[0]),v=Math.max(l[1],u[1],c[1],h[1]);return r.fromRect({x:d,y:g,width:p-d,height:v-g})}}])}(),pe="Method not implemented.",ml="Use document.documentElement instead.",zG="Cannot append a destroyed element.";function Dl(r){return r===void 0?0:r>360||r<-360?r%360:r}var bv=Qt();function ar(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;return Array.isArray(r)&&r.length===3?n?_a(r):Qi(bv,r):bt(r)?n?Ae(r,t,e):Kn(bv,r,t,e):n?Ae(r[0],r[1]||t,r[2]||e):Kn(bv,r[0],r[1]||t,r[2]||e)}var $G=Math.PI/180;function me(r){return r*$G}var jG=180/Math.PI;function xr(r){return r*jG}function qG(r){return 360*r}var wf=Math.PI/2;function WG(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e*e,o=n*n,l=i*i,u=a*a,c=s+o+l+u,h=e*a-n*i;return h>.499995*c?(r[0]=wf,r[1]=2*Math.atan2(n,e),r[2]=0):h<-.499995*c?(r[0]=-wf,r[1]=2*Math.atan2(n,e),r[2]=0):(r[0]=Math.asin(2*(e*i-a*n)),r[1]=Math.atan2(2*(e*a+n*i),1-2*(l+u)),r[2]=Math.atan2(2*(e*n+i*a),1-2*(o+l))),r}function GG(r,t){var e,n,i=Wl(Qt(),t),a=Rt(i,3),s=a[0],o=a[1],l=a[2],u=Math.asin(-t[2]/s);return u<wf?u>-wf?(e=Math.atan2(t[6]/o,t[10]/l),n=Math.atan2(t[1]/s,t[0]/s)):(n=0,e=-Math.atan2(t[4]/o,t[5]/o)):(n=0,e=Math.atan2(t[4]/o,t[5]/o)),r[0]=e,r[1]=u,r[2]=n,r}function wv(r,t){return t.length===16?GG(r,t):WG(r,t)}function VG(r,t,e,n,i){var a=Math.cos(r),s=Math.sin(r);return Lq(n*a,i*s,0,-n*s,i*a,0,t,e,1)}function HG(r,t,e,n,i,a,s){var o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1,l=2*a,u=e-t,c=n-i,h=l/u,d=l/c,g=(e+t)/u,p=(n+i)/c,v,m,b=s-a,w=s*a;return o?(v=-s/b,m=-w/b):(v=-(s+a)/b,m=-2*w/b),r[0]=h,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=d,r[6]=0,r[7]=0,r[8]=g,r[9]=p,r[10]=v,r[11]=-1,r[12]=0,r[13]=0,r[14]=m,r[15]=0,r}function K3(r){var t=r[0],e=r[1],n=r[3],i=r[4],a=Math.sqrt(t*t+e*e),s=Math.sqrt(n*n+i*i),o=t*i-e*n;if(o<0&&(t<i?a=-a:s=-s),a){var l=1/a;t*=l,e*=l}if(s){var u=1/s;n*=u,i*=u}var c=Math.atan2(e,t),h=xr(c);return[r[6],r[7],a,s,h]}var Hi=Se(),Ci=Se(),ku=ea(),At=[Qt(),Qt(),Qt()],Z3=Qt();function UG(r,t,e,n,i,a){if(!YG(Hi,r)||(ql(Ci,Hi),Ci[3]=0,Ci[7]=0,Ci[11]=0,Ci[15]=1,Math.abs(AR(Ci))<1e-8))return!1;var s=Hi[3],o=Hi[7],l=Hi[11],u=Hi[12],c=Hi[13],h=Hi[14],d=Hi[15];if(s!==0||o!==0||l!==0){ku[0]=s,ku[1]=o,ku[2]=l,ku[3]=d;var g=Ji(Ci,Ci);if(!g)return!1;OR(Ci,Ci),Na(i,ku,Ci)}else i[0]=i[1]=i[2]=0,i[3]=1;if(t[0]=u,t[1]=c,t[2]=h,XG(At,Hi),e[0]=Ca(At[0]),Mo(At[0],At[0]),n[0]=ta(At[0],At[1]),xv(At[1],At[1],At[0],1,-n[0]),e[1]=Ca(At[1]),Mo(At[1],At[1]),n[0]/=e[1],n[1]=ta(At[0],At[2]),xv(At[2],At[2],At[0],1,-n[1]),n[2]=ta(At[1],At[2]),xv(At[2],At[2],At[1],1,-n[2]),e[2]=Ca(At[2]),Mo(At[2],At[2]),n[1]/=e[2],n[2]/=e[2],Zd(Z3,At[1],At[2]),ta(At[0],Z3)<0)for(var p=0;p<3;p++)e[p]*=-1,At[p][0]*=-1,At[p][1]*=-1,At[p][2]*=-1;return a[0]=.5*Math.sqrt(Math.max(1+At[0][0]-At[1][1]-At[2][2],0)),a[1]=.5*Math.sqrt(Math.max(1-At[0][0]+At[1][1]-At[2][2],0)),a[2]=.5*Math.sqrt(Math.max(1-At[0][0]-At[1][1]+At[2][2],0)),a[3]=.5*Math.sqrt(Math.max(1+At[0][0]+At[1][1]+At[2][2],0)),At[2][1]>At[1][2]&&(a[0]=-a[0]),At[0][2]>At[2][0]&&(a[1]=-a[1]),At[1][0]>At[0][1]&&(a[2]=-a[2]),!0}function YG(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 XG(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 xv(r,t,e,n,i){r[0]=t[0]*n+e[0]*i,r[1]=t[1]*n+e[1]*i,r[2]=t[2]*n+e[2]*i}var ge=function(r){return r[r.ORBITING=0]="ORBITING",r[r.EXPLORING=1]="EXPLORING",r[r.TRACKING=2]="TRACKING",r}({}),xw=function(r){return r[r.DEFAULT=0]="DEFAULT",r[r.ROTATIONAL=1]="ROTATIONAL",r[r.TRANSLATIONAL=2]="TRANSLATIONAL",r[r.CINEMATIC=3]="CINEMATIC",r}({}),ci=function(r){return r[r.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",r[r.PERSPECTIVE=1]="PERSPECTIVE",r}({}),cL={UPDATED:"updated"},J3=2e-4,hL=function(){function r(){at(this,r),this.clipSpaceNearZ=Qd.NEGATIVE_ONE,this.eventEmitter=new MR,this.matrix=Se(),this.right=Ae(1,0,0),this.up=Ae(0,1,0),this.forward=Ae(0,0,1),this.position=Ae(0,0,1),this.focalPoint=Ae(0,0,0),this.distanceVector=Ae(0,0,-1),this.distance=1,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.dollyingStep=0,this.maxDistance=1/0,this.minDistance=-1/0,this.zoom=1,this.rotateWorld=!1,this.fov=30,this.near=.1,this.far=1e3,this.aspect=1,this.projectionMatrix=Se(),this.projectionMatrixInverse=Se(),this.jitteredProjectionMatrix=void 0,this.enableUpdate=!0,this.type=ge.EXPLORING,this.trackingMode=xw.DEFAULT,this.projectionMode=ci.PERSPECTIVE,this.frustum=new BG,this.orthoMatrix=Se()}return it(r,[{key:"isOrtho",value:function(){return this.projectionMode===ci.ORTHOGRAPHIC}},{key:"getProjectionMode",value:function(){return this.projectionMode}},{key:"getPerspective",value:function(){return this.jitteredProjectionMatrix||this.projectionMatrix}},{key:"getPerspectiveInverse",value:function(){return this.projectionMatrixInverse}},{key:"getFrustum",value:function(){return this.frustum}},{key:"getPosition",value:function(){return this.position}},{key:"getFocalPoint",value:function(){return this.focalPoint}},{key:"getDollyingStep",value:function(){return this.dollyingStep}},{key:"getNear",value:function(){return this.near}},{key:"getFar",value:function(){return this.far}},{key:"getZoom",value:function(){return this.zoom}},{key:"getOrthoMatrix",value:function(){return this.orthoMatrix}},{key:"getView",value:function(){return this.view}},{key:"setEnableUpdate",value:function(e){this.enableUpdate=e}},{key:"setType",value:function(e,n){return this.type=e,this.type===ge.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===ge.TRACKING&&n!==void 0&&this.setTrackingMode(n),this}},{key:"setProjectionMode",value:function(e){return this.projectionMode=e,this}},{key:"setTrackingMode",value:function(e){if(this.type!==ge.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=e,this}},{key:"setWorldRotation",value:function(e){return this.rotateWorld=e,this._getAngles(),this}},{key:"getViewTransform",value:function(){return Ji(Se(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"jitterProjectionMatrix",value:function(e,n){var i=bs(Se(),[e,n,0]);this.jitteredProjectionMatrix=Jn(Se(),i,this.projectionMatrix)}},{key:"clearJitterProjectionMatrix",value:function(){this.jitteredProjectionMatrix=void 0}},{key:"setMatrix",value:function(e){return this.matrix=e,this._update(),this}},{key:"setProjectionMatrix",value:function(e){this.projectionMatrix=e}},{key:"setFov",value:function(e){return this.setPerspective(this.near,this.far,e,this.aspect),this}},{key:"setAspect",value:function(e){return this.setPerspective(this.near,this.far,this.fov,e),this}},{key:"setNear",value:function(e){return this.projectionMode===ci.PERSPECTIVE?this.setPerspective(e,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,e,this.far),this}},{key:"setFar",value:function(e){return this.projectionMode===ci.PERSPECTIVE?this.setPerspective(this.near,e,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,e),this}},{key:"setViewOffset",value:function(e,n,i,a,s,o){return this.aspect=e/n,this.view===void 0&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=a,this.view.width=s,this.view.height=o,this.projectionMode===ci.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"clearViewOffset",value:function(){return this.view!==void 0&&(this.view.enabled=!1),this.projectionMode===ci.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"setZoom",value:function(e){return this.zoom=e,this.projectionMode===ci.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===ci.PERSPECTIVE&&this.setPerspective(this.near,this.far,this.fov,this.aspect),this}},{key:"setZoomByViewportPoint",value:function(e,n){var i=this.canvas.viewport2Canvas({x:n[0],y:n[1]}),a=i.x,s=i.y,o=this.roll;this.rotate(0,0,-o),this.setPosition(a,s),this.setFocalPoint(a,s),this.setZoom(e),this.rotate(0,0,o);var l=this.canvas.viewport2Canvas({x:n[0],y:n[1]}),u=l.x,c=l.y,h=Ae(u-a,c-s,0),d=ta(h,this.right)/Ca(this.right),g=ta(h,this.up)/Ca(this.up),p=this.getPosition(),v=Rt(p,2),m=v[0],b=v[1],w=this.getFocalPoint(),x=Rt(w,2),S=x[0],_=x[1];return this.setPosition(m-d,b-g),this.setFocalPoint(S-d,_-g),this}},{key:"setPerspective",value:function(e,n,i,a){var s;this.projectionMode=ci.PERSPECTIVE,this.fov=i,this.near=e,this.far=n,this.aspect=a;var o=this.near*Math.tan(me(.5*this.fov))/this.zoom,l=2*o,u=this.aspect*l,c=-.5*u;if((s=this.view)!==null&&s!==void 0&&s.enabled){var h=this.view.fullWidth,d=this.view.fullHeight;c+=this.view.offsetX*u/h,o-=this.view.offsetY*l/d,u*=this.view.width/h,l*=this.view.height/d}return HG(this.projectionMatrix,c,c+u,o-l,o,e,this.far,this.clipSpaceNearZ===Qd.ZERO),Ji(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this}},{key:"setOrthographic",value:function(e,n,i,a,s,o){var l;this.projectionMode=ci.ORTHOGRAPHIC,this.rright=n,this.left=e,this.top=i,this.bottom=a,this.near=s,this.far=o;var u=(this.rright-this.left)/(2*this.zoom),c=(this.top-this.bottom)/(2*this.zoom),h=(this.rright+this.left)/2,d=(this.top+this.bottom)/2,g=h-u,p=h+u,v=d+c,m=d-c;if((l=this.view)!==null&&l!==void 0&&l.enabled){var b=(this.rright-this.left)/this.view.fullWidth/this.zoom,w=(this.top-this.bottom)/this.view.fullHeight/this.zoom;g+=b*this.view.offsetX,p=g+b*this.view.width,v-=w*this.view.offsetY,m=v-w*this.view.height}return this.clipSpaceNearZ===Qd.NEGATIVE_ONE?$R(this.projectionMatrix,g,p,v,m,s,o):jR(this.projectionMatrix,g,p,v,m,s,o),Ji(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.triggerUpdate(),this}},{key:"setPosition",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.position[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.position[2],a=ar(e,n,i);return this._setPosition(a),this.setFocalPoint(this.focalPoint),this.triggerUpdate(),this}},{key:"setFocalPoint",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.focalPoint[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.focalPoint[2],a=Ae(0,1,0);if(this.focalPoint=ar(e,n,i),this.trackingMode===xw.CINEMATIC){var s=uw(Qt(),this.focalPoint,this.position);e=s[0],n=s[1],i=s[2];var o=Ca(s),l=xr(Math.asin(n/o)),u=90+xr(Math.atan2(i,e)),c=Se();RR(c,c,me(u)),NR(c,c,me(l)),a=Qn(Qt(),[0,1,0],c)}return Ji(this.matrix,qR(Se(),this.position,this.focalPoint,a)),this._getAxes(),this._getDistance(),this._getAngles(),this.triggerUpdate(),this}},{key:"getDistance",value:function(){return this.distance}},{key:"getDistanceVector",value:function(){return this.distanceVector}},{key:"setDistance",value:function(e){if(this.distance===e||e<0)return this;this.distance=e,this.distance<J3&&(this.distance=J3),this.dollyingStep=this.distance/100;var n=Qt();e=this.distance;var i=this.forward,a=this.focalPoint;return n[0]=e*i[0]+a[0],n[1]=e*i[1]+a[1],n[2]=e*i[2]+a[2],this._setPosition(n),this.triggerUpdate(),this}},{key:"setMaxDistance",value:function(e){return this.maxDistance=e,this}},{key:"setMinDistance",value:function(e){return this.minDistance=e,this}},{key:"setAzimuth",value:function(e){return this.azimuth=Dl(e),this.computeMatrix(),this._getAxes(),this.type===ge.ORBITING||this.type===ge.EXPLORING?this._getPosition():this.type===ge.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getAzimuth",value:function(){return this.azimuth}},{key:"setElevation",value:function(e){return this.elevation=Dl(e),this.computeMatrix(),this._getAxes(),this.type===ge.ORBITING||this.type===ge.EXPLORING?this._getPosition():this.type===ge.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getElevation",value:function(){return this.elevation}},{key:"setRoll",value:function(e){return this.roll=Dl(e),this.computeMatrix(),this._getAxes(),this.type===ge.ORBITING||this.type===ge.EXPLORING?this._getPosition():this.type===ge.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getRoll",value:function(){return this.roll}},{key:"_update",value:function(){this._getAxes(),this._getPosition(),this._getDistance(),this._getAngles(),this._getOrthoMatrix(),this.triggerUpdate()}},{key:"computeMatrix",value:function(){var e=Es(wn(),[0,0,1],me(this.roll));Bs(this.matrix);var n=Es(wn(),[1,0,0],me((this.rotateWorld&&this.type!==ge.TRACKING||this.type===ge.TRACKING?1:-1)*this.elevation)),i=Es(wn(),[0,1,0],me((this.rotateWorld&&this.type!==ge.TRACKING||this.type===ge.TRACKING?1:-1)*this.azimuth)),a=Ps(wn(),i,n);a=Ps(wn(),a,e);var s=Ox(Se(),a);this.type===ge.ORBITING||this.type===ge.EXPLORING?(Il(this.matrix,this.matrix,this.focalPoint),Jn(this.matrix,this.matrix,s),Il(this.matrix,this.matrix,[0,0,this.distance])):this.type===ge.TRACKING&&(Il(this.matrix,this.matrix,this.position),Jn(this.matrix,this.matrix,s))}},{key:"_setPosition",value:function(e,n,i){this.position=ar(e,n,i);var a=this.matrix;a[12]=this.position[0],a[13]=this.position[1],a[14]=this.position[2],a[15]=1,this._getOrthoMatrix()}},{key:"_getAxes",value:function(){Qi(this.right,ar(Na(ea(),[1,0,0,0],this.matrix))),Qi(this.up,ar(Na(ea(),[0,1,0,0],this.matrix))),Qi(this.forward,ar(Na(ea(),[0,0,1,0],this.matrix))),Mo(this.right,this.right),Mo(this.up,this.up),Mo(this.forward,this.forward)}},{key:"_getAngles",value:function(){var e=this.distanceVector[0],n=this.distanceVector[1],i=this.distanceVector[2],a=Ca(this.distanceVector);if(a===0){this.elevation=0,this.azimuth=0;return}this.type===ge.TRACKING?(this.elevation=xr(Math.asin(n/a)),this.azimuth=xr(Math.atan2(-e,-i))):this.rotateWorld?(this.elevation=xr(Math.asin(n/a)),this.azimuth=xr(Math.atan2(-e,-i))):(this.elevation=-xr(Math.asin(n/a)),this.azimuth=-xr(Math.atan2(-e,-i)))}},{key:"_getPosition",value:function(){Qi(this.position,ar(Na(ea(),[0,0,0,1],this.matrix))),this._getDistance()}},{key:"_getFocalPoint",value:function(){rW(this.distanceVector,[0,0,-this.distance],Rq(kR(),this.matrix)),As(this.focalPoint,this.position,this.distanceVector),this._getDistance()}},{key:"_getDistance",value:function(){this.distanceVector=uw(Qt(),this.focalPoint,this.position),this.distance=Ca(this.distanceVector),this.dollyingStep=this.distance/100}},{key:"_getOrthoMatrix",value:function(){if(this.projectionMode===ci.ORTHOGRAPHIC){var e=this.position,n=Es(wn(),[0,0,1],-this.roll*Math.PI/180);tc(this.orthoMatrix,n,Ae((this.rright-this.left)/2-e[0],(this.top-this.bottom)/2-e[1],0),Ae(this.zoom,this.zoom,1),e)}}},{key:"triggerUpdate",value:function(){if(this.enableUpdate){var e=this.getViewTransform(),n=Jn(Se(),this.getPerspective(),e);this.getFrustum().extractFromVPMatrix(n),this.eventEmitter.emit(cL.UPDATED)}}},{key:"rotate",value:function(e,n,i){throw new Error(pe)}},{key:"pan",value:function(e,n){throw new Error(pe)}},{key:"dolly",value:function(e){throw new Error(pe)}},{key:"createLandmark",value:function(e,n){throw new Error(pe)}},{key:"gotoLandmark",value:function(e,n){throw new Error(pe)}},{key:"cancelLandmarkAnimation",value:function(){throw new Error(pe)}}])}(),KG=function(r){return r[r.Standard=0]="Standard",r}({}),xf=function(r){return r[r.ADDED=0]="ADDED",r[r.REMOVED=1]="REMOVED",r[r.Z_INDEX_CHANGED=2]="Z_INDEX_CHANGED",r}({}),dL={absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Vl(0,0,0,0)},ft=function(r){return r.COORDINATE="<coordinate>",r.COLOR="<color>",r.PAINT="<paint>",r.NUMBER="<number>",r.ANGLE="<angle>",r.OPACITY_VALUE="<opacity-value>",r.SHADOW_BLUR="<shadow-blur>",r.LENGTH="<length>",r.PERCENTAGE="<percentage>",r.LENGTH_PERCENTAGE="<length> | <percentage>",r.LENGTH_PERCENTAGE_12="[<length> | <percentage>]{1,2}",r.LENGTH_PERCENTAGE_14="[<length> | <percentage>]{1,4}",r.LIST_OF_POINTS="<list-of-points>",r.PATH="<path>",r.FILTER="<filter>",r.Z_INDEX="<z-index>",r.OFFSET_DISTANCE="<offset-distance>",r.DEFINED_PATH="<defined-path>",r.MARKER="<marker>",r.TRANSFORM="<transform>",r.TRANSFORM_ORIGIN="<transform-origin>",r.TEXT="<text>",r.TEXT_TRANSFORM="<text-transform>",r}({});function Rx(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function fL(r,t){var e=Object.create(r.prototype);for(var n in t)e[n]=t[n];return e}function Nc(){}var dc=.7,Ef=1/dc,Fl="\\s*([+-]?\\d+)\\s*",fc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ra="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ZG=/^#([0-9a-f]{3,8})$/,JG=new RegExp(`^rgb\\(${Fl},${Fl},${Fl}\\)$`),QG=new RegExp(`^rgb\\(${ra},${ra},${ra}\\)$`),tV=new RegExp(`^rgba\\(${Fl},${Fl},${Fl},${fc}\\)$`),eV=new RegExp(`^rgba\\(${ra},${ra},${ra},${fc}\\)$`),nV=new RegExp(`^hsl\\(${fc},${ra},${ra}\\)$`),rV=new RegExp(`^hsla\\(${fc},${ra},${ra},${fc}\\)$`),Q3={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};Rx(Nc,s0,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:tM,formatHex:tM,formatHex8:iV,formatHsl:aV,formatRgb:eM,toString:eM});function tM(){return this.rgb().formatHex()}function iV(){return this.rgb().formatHex8()}function aV(){return gL(this).formatHsl()}function eM(){return this.rgb().formatRgb()}function s0(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=ZG.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?nM(t):e===3?new kr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?Uh(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?Uh(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=JG.exec(r))?new kr(t[1],t[2],t[3],1):(t=QG.exec(r))?new kr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=tV.exec(r))?Uh(t[1],t[2],t[3],t[4]):(t=eV.exec(r))?Uh(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=nV.exec(r))?aM(t[1],t[2]/100,t[3]/100,1):(t=rV.exec(r))?aM(t[1],t[2]/100,t[3]/100,t[4]):Q3.hasOwnProperty(r)?nM(Q3[r]):r==="transparent"?new kr(NaN,NaN,NaN,0):null}function nM(r){return new kr(r>>16&255,r>>8&255,r&255,1)}function Uh(r,t,e,n){return n<=0&&(r=t=e=NaN),new kr(r,t,e,n)}function sV(r){return r instanceof Nc||(r=s0(r)),r?(r=r.rgb(),new kr(r.r,r.g,r.b,r.opacity)):new kr}function oV(r,t,e,n){return arguments.length===1?sV(r):new kr(r,t,e,n??1)}function kr(r,t,e,n){this.r=+r,this.g=+t,this.b=+e,this.opacity=+n}Rx(kr,oV,fL(Nc,{brighter(r){return r=r==null?Ef:Math.pow(Ef,r),new kr(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?dc:Math.pow(dc,r),new kr(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new kr(ko(this.r),ko(this.g),ko(this.b),_f(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:rM,formatHex:rM,formatHex8:lV,formatRgb:iM,toString:iM}));function rM(){return`#${yo(this.r)}${yo(this.g)}${yo(this.b)}`}function lV(){return`#${yo(this.r)}${yo(this.g)}${yo(this.b)}${yo((isNaN(this.opacity)?1:this.opacity)*255)}`}function iM(){const r=_f(this.opacity);return`${r===1?"rgb(":"rgba("}${ko(this.r)}, ${ko(this.g)}, ${ko(this.b)}${r===1?")":`, ${r})`}`}function _f(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function ko(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function yo(r){return r=ko(r),(r<16?"0":"")+r.toString(16)}function aM(r,t,e,n){return n<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new Pi(r,t,e,n)}function gL(r){if(r instanceof Pi)return new Pi(r.h,r.s,r.l,r.opacity);if(r instanceof Nc||(r=s0(r)),!r)return new Pi;if(r instanceof Pi)return r;r=r.rgb();var t=r.r/255,e=r.g/255,n=r.b/255,i=Math.min(t,e,n),a=Math.max(t,e,n),s=NaN,o=a-i,l=(a+i)/2;return o?(t===a?s=(e-n)/o+(e<n)*6:e===a?s=(n-t)/o+2:s=(t-e)/o+4,o/=l<.5?a+i:2-a-i,s*=60):o=l>0&&l<1?0:s,new Pi(s,o,l,r.opacity)}function uV(r,t,e,n){return arguments.length===1?gL(r):new Pi(r,t,e,n??1)}function Pi(r,t,e,n){this.h=+r,this.s=+t,this.l=+e,this.opacity=+n}Rx(Pi,uV,fL(Nc,{brighter(r){return r=r==null?Ef:Math.pow(Ef,r),new Pi(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?dc:Math.pow(dc,r),new Pi(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,t=isNaN(r)||isNaN(this.s)?0:this.s,e=this.l,n=e+(e<.5?e:1-e)*t,i=2*e-n;return new kr(Ev(r>=240?r-240:r+120,i,n),Ev(r,i,n),Ev(r<120?r+240:r-120,i,n),this.opacity)},clamp(){return new Pi(sM(this.h),Yh(this.s),Yh(this.l),_f(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const r=_f(this.opacity);return`${r===1?"hsl(":"hsla("}${sM(this.h)}, ${Yh(this.s)*100}%, ${Yh(this.l)*100}%${r===1?")":`, ${r})`}`}}));function sM(r){return r=(r||0)%360,r<0?r+360:r}function Yh(r){return Math.max(0,Math.min(1,r||0))}function Ev(r,t,e){return(r<60?t+(e-t)*r/60:r<180?e:r<240?t+(e-t)*(240-r)/60:t)*255}function pn(r,t){if(typeof r!="function"||t!=null&&typeof t!="function")throw new TypeError("Expected a function");var e=function(){for(var i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];var o=t?t.apply(this,a):a[0],l=e.cache;if(l.has(o))return l.get(o);var u=r.apply(this,a);return e.cache=l.set(o,u)||l,u};return e.cache=new(pn.Cache||Map),pn.cacheList.push(e.cache),e}pn.Cache=Map;pn.cacheList=[];pn.clearCache=function(){pn.cacheList.forEach(function(r){return r.clear()})};var gt=function(r){return r[r.kUnknown=0]="kUnknown",r[r.kNumber=1]="kNumber",r[r.kPercentage=2]="kPercentage",r[r.kEms=3]="kEms",r[r.kPixels=4]="kPixels",r[r.kRems=5]="kRems",r[r.kDegrees=6]="kDegrees",r[r.kRadians=7]="kRadians",r[r.kGradians=8]="kGradians",r[r.kTurns=9]="kTurns",r[r.kMilliseconds=10]="kMilliseconds",r[r.kSeconds=11]="kSeconds",r[r.kInteger=12]="kInteger",r}({}),Ai=function(r){return r[r.kUNumber=0]="kUNumber",r[r.kUPercent=1]="kUPercent",r[r.kULength=2]="kULength",r[r.kUAngle=3]="kUAngle",r[r.kUTime=4]="kUTime",r[r.kUOther=5]="kUOther",r}({}),cV=function(r){return r[r.kYes=0]="kYes",r[r.kNo=1]="kNo",r}({}),hV=function(r){return r[r.kYes=0]="kYes",r[r.kNo=1]="kNo",r}({}),dV=[{name:"em",unit_type:gt.kEms},{name:"px",unit_type:gt.kPixels},{name:"deg",unit_type:gt.kDegrees},{name:"rad",unit_type:gt.kRadians},{name:"grad",unit_type:gt.kGradians},{name:"ms",unit_type:gt.kMilliseconds},{name:"s",unit_type:gt.kSeconds},{name:"rem",unit_type:gt.kRems},{name:"turn",unit_type:gt.kTurns}],Hl=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}({}),fV=function(t){return dV.find(function(e){return e.name===t}).unit_type},gV=function(t){return t?t==="number"?gt.kNumber:t==="percent"||t==="%"?gt.kPercentage:fV(t):gt.kUnknown},pV=function(t){switch(t){case gt.kNumber:case gt.kInteger:return Ai.kUNumber;case gt.kPercentage:return Ai.kUPercent;case gt.kPixels:return Ai.kULength;case gt.kMilliseconds:case gt.kSeconds:return Ai.kUTime;case gt.kDegrees:case gt.kRadians:case gt.kGradians:case gt.kTurns:return Ai.kUAngle;default:return Ai.kUOther}},vV=function(t){switch(t){case Ai.kUNumber:return gt.kNumber;case Ai.kULength:return gt.kPixels;case Ai.kUPercent:return gt.kPercentage;case Ai.kUTime:return gt.kSeconds;case Ai.kUAngle:return gt.kDegrees;default:return gt.kUnknown}},oM=function(t){var e=1;switch(t){case gt.kPixels:case gt.kDegrees:case gt.kSeconds:break;case gt.kMilliseconds:e=.001;break;case gt.kRadians:e=180/Math.PI;break;case gt.kGradians:e=.9;break;case gt.kTurns:e=360;break}return e},Ew=function(t){switch(t){case gt.kNumber:case gt.kInteger:return"";case gt.kPercentage:return"%";case gt.kEms:return"em";case gt.kRems:return"rem";case gt.kPixels:return"px";case gt.kDegrees:return"deg";case gt.kRadians:return"rad";case gt.kGradians:return"grad";case gt.kMilliseconds:return"ms";case gt.kSeconds:return"s";case gt.kTurns:return"turn"}return""},o0=function(){function r(){at(this,r)}return it(r,[{key:"toString",value:function(){return this.buildCSSText(cV.kNo,hV.kNo,"")}},{key:"isNumericValue",value:function(){return this.getType()>=Hl.kUnitType&&this.getType()<=Hl.kClampType}}],[{key:"isAngle",value:function(e){return e===gt.kDegrees||e===gt.kRadians||e===gt.kGradians||e===gt.kTurns}},{key:"isLength",value:function(e){return e>=gt.kEms&&e<gt.kDegrees}},{key:"isRelativeUnit",value:function(e){return e===gt.kPercentage||e===gt.kEms||e===gt.kRems}},{key:"isTime",value:function(e){return e===gt.kSeconds||e===gt.kMilliseconds}}])}(),mV=function(r){function t(e){var n;return at(this,t),n=Wt(this,t),n.colorSpace=e,n}return qt(t,r),it(t,[{key:"getType",value:function(){return Hl.kColorType}},{key:"to",value:function(n){return this}}])}(o0),_s=function(r){return r[r.Constant=0]="Constant",r[r.LinearGradient=1]="LinearGradient",r[r.RadialGradient=2]="RadialGradient",r}({}),Xh=function(r){function t(e,n){var i;return at(this,t),i=Wt(this,t),i.type=e,i.value=n,i}return qt(t,r),it(t,[{key:"clone",value:function(){return new t(this.type,this.value)}},{key:"buildCSSText",value:function(n,i,a){return a}},{key:"getType",value:function(){return Hl.kColorType}}])}(o0),pi=function(r){function t(e){var n;return at(this,t),n=Wt(this,t),n.value=e,n}return qt(t,r),it(t,[{key:"clone",value:function(){return new t(this.value)}},{key:"getType",value:function(){return Hl.kKeywordType}},{key:"buildCSSText",value:function(n,i,a){return a+this.value}}])}(o0),yV=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},_w=function(t){return vV(pV(t))},On=function(r){function t(e){var n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gt.kNumber;at(this,t),n=Wt(this,t);var a;return typeof i=="string"?a=gV(i):a=i,n.unit=a,n.value=e,n}return qt(t,r),it(t,[{key:"clone",value:function(){return new t(this.value,this.unit)}},{key:"equals",value:function(n){var i=n;return this.value===i.value&&this.unit===i.unit}},{key:"getType",value:function(){return Hl.kUnitType}},{key:"convertTo",value:function(n){if(this.unit===n)return new t(this.value,this.unit);var i=_w(this.unit);if(i!==_w(n)||i===gt.kUnknown)return null;var a=oM(this.unit)/oM(n);return new t(this.value*a,n)}},{key:"buildCSSText",value:function(n,i,a){var s;switch(this.unit){case gt.kUnknown:break;case gt.kInteger:s=Number(this.value).toFixed(0);break;case gt.kNumber:case gt.kPercentage:case gt.kEms:case gt.kRems:case gt.kPixels:case gt.kDegrees:case gt.kRadians:case gt.kGradians:case gt.kMilliseconds:case gt.kSeconds:case gt.kTurns:{var o=-999999,l=999999,u=this.value,c=Ew(this.unit);if(u<o||u>l){var h=Ew(this.unit);!Number.isFinite(u)||Number.isNaN(u)?s=yV(u,h):s=u+(h||"")}else s="".concat(u).concat(c)}}return a+=s,a}}])}(o0),Ti=new On(0,"px");new On(1,"px");var Lo=new On(0,"deg"),Lx=function(r){function t(e,n,i){var a,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return at(this,t),a=Wt(this,t,["rgb"]),a.r=e,a.g=n,a.b=i,a.alpha=s,a.isNone=o,a}return qt(t,r),it(t,[{key:"clone",value:function(){return new t(this.r,this.g,this.b,this.alpha)}},{key:"buildCSSText",value:function(n,i,a){return"".concat(a,"rgba(").concat(this.r,",").concat(this.g,",").concat(this.b,",").concat(this.alpha,")")}}])}(mV),lM=new pi("unset"),bV=new pi("initial"),wV=new pi("inherit"),_v={"":lM,unset:lM,initial:bV,inherit:wV},xV=function(t){return _v[t]||(_v[t]=new pi(t)),_v[t]},pL=new Lx(0,0,0,0,!0),vL=new Lx(0,0,0,0),EV=pn(function(r,t,e,n){return new Lx(r,t,e,n)},function(r,t,e,n){return"rgba(".concat(r,",").concat(t,",").concat(e,",").concat(n,")")}),Fe=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gt.kNumber;return new On(t,e)};new On(50,"%");function _V(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 SV=function(){var r={linearGradient:/^(linear\-gradient)/i,repeatingLinearGradient:/^(repeating\-linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,repeatingRadialGradient:/^(repeating\-radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},t="";function e(B){throw new Error("".concat(t,": ").concat(B))}function n(){var B=i();return t.length>0&&e("Invalid input not EOF"),B}function i(){return x(a)}function a(){return s("linear-gradient",r.linearGradient,l)||s("repeating-linear-gradient",r.repeatingLinearGradient,l)||s("radial-gradient",r.radialGradient,h)||s("repeating-radial-gradient",r.repeatingRadialGradient,h)||s("conic-gradient",r.conicGradient,h)}function s(B,D,G){return o(D,function(X){var K=G();return K&&(q(r.comma)||e("Missing comma before color stops")),{type:B,orientation:K,colorStops:x(S)}})}function o(B,D){var G=q(B);if(G){q(r.startCall)||e("Missing (");var X=D(G);return q(r.endCall)||e("Missing )"),X}}function l(){return u()||c()}function u(){return $("directional",r.sideOrCorner,1)}function c(){return $("angular",r.angleValue,1)}function h(){var B,D=d(),G;return D&&(B=[],B.push(D),G=t,q(r.comma)&&(D=d(),D?B.push(D):t=G)),B}function d(){var B=g()||p();if(B)B.at=m();else{var D=v();if(D){B=D;var G=m();G&&(B.at=G)}else{var X=b();X&&(B={type:"default-radial",at:X})}}return B}function g(){var B=$("shape",/^(circle)/i,0);return B&&(B.style=L()||v()),B}function p(){var B=$("shape",/^(ellipse)/i,0);return B&&(B.style=A()||v()),B}function v(){return $("extent-keyword",r.extentKeywords,1)}function m(){if($("position",/^at/,0)){var B=b();return B||e("Missing positioning value"),B}}function b(){var B=w();if(B.x||B.y)return{type:"position",value:B}}function w(){return{x:A(),y:A()}}function x(B){var D=B(),G=[];if(D)for(G.push(D);q(r.comma);)D=B(),D?G.push(D):e("One extra comma");return G}function S(){var B=_();return B||e("Expected color definition"),B.length=A(),B}function _(){return k()||P()||C()||M()}function M(){return $("literal",r.literalColor,0)}function k(){return $("hex",r.hexColor,1)}function C(){return o(r.rgbColor,function(){return{type:"rgb",value:x(T)}})}function P(){return o(r.rgbaColor,function(){return{type:"rgba",value:x(T)}})}function T(){return q(r.number)[1]}function A(){return $("%",r.percentageValue,1)||R()||L()}function R(){return $("position-keyword",r.positionKeywords,1)}function L(){return $("px",r.pixelValue,1)||$("em",r.emValue,1)}function $(B,D,G){var X=q(D);if(X)return{type:B,value:X[G]}}function q(B){var D=/^[\n\r\t\s]+/.exec(t);D&&j(D[0].length);var G=B.exec(t);return G&&j(G[0].length),G}function j(B){t=t.substring(B)}return function(B){return t=B,n()}}();function MV(r,t,e,n){var i=me(n.value),a=0,s=0,o=a+t/2,l=s+e/2,u=Math.abs(t*Math.cos(i))+Math.abs(e*Math.sin(i)),c=r[0]+o-Math.cos(i)*u/2,h=r[1]+l-Math.sin(i)*u/2,d=r[0]+o+Math.cos(i)*u/2,g=r[1]+l+Math.sin(i)*u/2;return{x1:c,y1:h,x2:d,y2:g}}function kV(r,t,e,n,i,a){var s=n.value,o=i.value;n.unit===gt.kPercentage&&(s=n.value/100*t),i.unit===gt.kPercentage&&(o=i.value/100*e);var l=Math.max(wr([0,0],[s,o]),wr([0,e],[s,o]),wr([t,e],[s,o]),wr([t,0],[s,o]));return a&&(a instanceof On?l=a.value:a instanceof pi&&(a.value==="closest-side"?l=Math.min(s,t-s,o,e-o):a.value==="farthest-side"?l=Math.max(s,t-s,o,e-o):a.value==="closest-corner"&&(l=Math.min(wr([0,0],[s,o]),wr([0,e],[s,o]),wr([t,e],[s,o]),wr([t,0],[s,o]))))),{x:s+r[0],y:o+r[1],r:l}}var CV=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,TV=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,OV=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,mL=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function AV(r){var t,e=r.length;if(r[e-1].length=(t=r[e-1].length)!==null&&t!==void 0?t:{type:"%",value:"100"},e>1){var n;r[0].length=(n=r[0].length)!==null&&n!==void 0?n:{type:"%",value:"0"}}for(var i=0,a=Number(r[0].length.value),s=1;s<e;s++){var o,l=(o=r[s].length)===null||o===void 0?void 0:o.value;if(!kt(l)&&!kt(a)){for(var u=1;u<s-i;u++)r[i+u].length={type:"%",value:"".concat(a+(Number(l)-a)*u/(s-i))};i=s,a=Number(l)}}}var PV={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},NV=pn(function(r){var t;return r.type==="angular"?t=Number(r.value):t=PV[r.value]||0,Fe(t,"deg")}),RV=pn(function(r){var t=50,e=50,n="%",i="%";if((r==null?void 0:r.type)==="position"){var a=r.value,s=a.x,o=a.y;(s==null?void 0:s.type)==="position-keyword"&&(s.value==="left"?t=0:s.value==="center"?t=50:s.value==="right"?t=100:s.value==="top"?e=0:s.value==="bottom"&&(e=100)),(o==null?void 0:o.type)==="position-keyword"&&(o.value==="left"?t=0:o.value==="center"?e=50:o.value==="right"?t=100:o.value==="top"?e=0:o.value==="bottom"&&(e=100)),((s==null?void 0:s.type)==="px"||(s==null?void 0:s.type)==="%"||(s==null?void 0:s.type)==="em")&&(n=s==null?void 0:s.type,t=Number(s.value)),((o==null?void 0:o.type)==="px"||(o==null?void 0:o.type)==="%"||(o==null?void 0:o.type)==="em")&&(i=o==null?void 0:o.type,e=Number(o.value))}return{cx:Fe(t,n),cy:Fe(e,i)}}),LV=pn(function(r){if(r.indexOf("linear")>-1||r.indexOf("radial")>-1){var t=SV(r);return t.map(function(o){var l=o.type,u=o.orientation,c=o.colorStops;AV(c);var h=c.map(function(x){return{offset:Fe(Number(x.length.value),"%"),color:_V(x)}});if(l==="linear-gradient")return new Xh(_s.LinearGradient,{angle:u?NV(u):Lo,steps:h});if(l==="radial-gradient"&&(u||(u=[{type:"shape",value:"circle"}]),u[0].type==="shape"&&u[0].value==="circle")){var d=RV(u[0].at),g=d.cx,p=d.cy,v;if(u[0].style){var m=u[0].style,b=m.type,w=m.value;b==="extent-keyword"?v=xV(w):v=Fe(w,b)}return new Xh(_s.RadialGradient,{cx:g,cy:p,size:v,steps:h})}})}var e=r[0];if(r[1]==="("||r[2]==="("){if(e==="l"){var n=CV.exec(r);if(n){var i,a=((i=n[2].match(mL))===null||i===void 0?void 0:i.map(function(o){return o.split(":")}))||[];return[new Xh(_s.LinearGradient,{angle:Fe(parseFloat(n[1]),"deg"),steps:a.map(function(o){var l=Rt(o,2),u=l[0],c=l[1];return{offset:Fe(Number(u)*100,"%"),color:c}})})]}}else if(e==="r"){var s=IV(r);if(s)if(oe(s))r=s;else return[new Xh(_s.RadialGradient,s)]}else if(e==="p")return DV(r)}});function IV(r){var t=TV.exec(r);if(t){var e,n=((e=t[4].match(mL))===null||e===void 0?void 0:e.map(function(i){return i.split(":")}))||[];return{cx:Fe(50,"%"),cy:Fe(50,"%"),steps:n.map(function(i){var a=Rt(i,2),s=a[0],o=a[1];return{offset:Fe(Number(s)*100,"%"),color:o}})}}return null}function DV(r){var t=OV.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 Io(r){return r&&!!r.image}function Sf(r){return r&&!kt(r.r)&&!kt(r.g)&&!kt(r.b)}var rc=pn(function(r){if(Io(r))return Bt({repetition:"repeat"},r);if(kt(r)&&(r=""),r==="transparent")return vL;if(r==="currentColor")r="black";else if(r==="none")return pL;var t=LV(r);if(t)return t;var e=s0(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),EV.apply(void 0,n)});function FV(r,t){if(!(!Sf(r)||!Sf(t)))return[[Number(r.r),Number(r.g),Number(r.b),Number(r.alpha)],[Number(t.r),Number(t.g),Number(t.b),Number(t.alpha)],function(e){var n=e.slice();if(n[3])for(var i=0;i<3;i++)n[i]=Math.round(Ue(n[i],0,255));return n[3]=Ue(n[3],0,1),"rgba(".concat(n.join(","),")")}]}function Rc(r,t){if(kt(t))return Fe(0,"px");if(t="".concat(t).trim().toLowerCase(),isFinite(Number(t))){if("px".search(r)>=0)return Fe(Number(t),"px");if("deg".search(r)>=0)return Fe(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 Fe(Number(t.replace(new RegExp("U".concat(i),"g"),"").replace(new RegExp(n,"g"),"*0")),i)})[0]}var yL=function(t){return Rc(new RegExp("px","g"),t)},BV=pn(yL),zV=function(t){return Rc(new RegExp("%","g"),t)};pn(zV);var bL=function(t){return bt(t)||isFinite(Number(t))?Fe(Number(t)||0,"px"):Rc(new RegExp("px|%|em|rem","g"),t)},Sw=pn(bL),wL=function(t){return Rc(new RegExp("deg|rad|grad|turn","g"),t)},$V=pn(wL);function jV(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=_w(r.unit),u=r.convertTo(l),c=t.convertTo(l);return u&&c?(s=u.value,o=c.value,a=Ew(r.unit)):(On.isLength(r.unit)||On.isLength(t.unit))&&(s=Br(r,i,e),o=Br(t,i,e),a="px"),[s,o,function(h){return h+a}]}function Er(r){var t=0;return r.unit===gt.kDegrees?t=r.value:r.unit===gt.kRadians?t=xr(Number(r.value)):r.unit===gt.kTurns?t=qG(Number(r.value)):r.value&&(t=r.value),t}function uM(r,t){var e;return Array.isArray(r)?e=r.map(function(n){return Number(n)}):oe(r)?e=r.split(" ").map(function(n){return Number(n)}):bt(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(Ce(e),Ce(e)):e}function Br(r,t,e){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r.unit===gt.kPixels)return Number(r.value);if(r.unit===gt.kPercentage&&e){var i=e.nodeName===Q.GROUP?e.getLocalBounds():e.getGeometryBounds();return(n?i.min[t]:0)+r.value/100*i.halfExtents[t]*2}return 0}var qV=function(t){return Rc(/deg|rad|grad|turn|px|%/g,t)},WV=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function GV(){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,WV.indexOf(n[1])>-1&&e.push({name:n[1],params:n[2].split(" ").map(function(a){return qV(a)||rc(a)})}),t.lastIndex===r.length)return e}return[]}function xL(r){return r.toString()}var EL=function(t){return typeof t=="number"?Fe(t):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?Fe(Number(t)):Fe(0)},Mw=pn(EL);pn(function(r){return oe(r)?r.split(" ").map(Mw):r.map(Mw)});function Ix(r,t){return[r,t,xL]}function Dx(r,t){return function(e,n){return[e,n,function(i){return xL(Ue(i,r,t))}]}}function _L(r,t){if(r.length===t.length)return[r,t,function(e){return e}]}function kw(r){return r.parsedStyle.d.totalLength===0&&(r.parsedStyle.d.totalLength=uG(r.parsedStyle.d.absolutePath)),r.parsedStyle.d.totalLength}function VV(r){return r.parsedStyle.points.totalLength===0&&(r.parsedStyle.points.totalLength=CG(r.parsedStyle.points.points)),r.parsedStyle.points.totalLength}function HV(r){for(var t=0;t<r.length;t++){var e=r[t-1],n=r[t],i=n[0];if(i==="M"&&e){var a=e[0],s=[n[1],n[2]],o=void 0;a==="L"||a==="M"?o=[e[1],e[2]]:(a==="C"||a==="A"||a==="Q")&&(o=[e[e.length-2],e[e.length-1]]),o&&Mf(s,o)&&(r.splice(t,1),t--)}}}function UV(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 YV(r){for(var t=[],e=[],n=[],i=0;i<r.length;i++){var a=r[i],s=a[0];s==="M"?(n.length&&(e.push(n),n=[]),n.push([a[1],a[2]])):s==="Z"?n.length&&(t.push(n),n=[]):n.push([a[1],a[2]])}return n.length>0&&e.push(n),{polygons:t,polylines:e}}function Mf(r,t){return r[0]===t[0]&&r[1]===t[1]}function XV(r,t){for(var e=[],n=[],i=[],a=0;a<r.length;a++){var s=r[a],o=s.currentPoint,l=s.params,u=s.prePoint,c=void 0;switch(s.command){case"Q":c=TG(u[0],u[1],l[1],l[2],l[3],l[4]);break;case"C":c=SG(u[0],u[1],l[1],l[2],l[3],l[4],l[5],l[6]);break;case"A":var h=s.arcParams;c=xG(h.cx,h.cy,h.rx,h.ry,h.xRotation,h.startAngle,h.endAngle);break;default:e.push(o[0]),n.push(o[1]);break}c&&(s.box=c,e.push(c.x,c.x+c.width),n.push(c.y,c.y+c.height))}e=e.filter(function(S){return!Number.isNaN(S)&&S!==1/0&&S!==-1/0}),n=n.filter(function(S){return!Number.isNaN(S)&&S!==1/0&&S!==-1/0});var d=vf(e),g=vf(n),p=pf(e),v=pf(n);if(i.length===0)return{x:d,y:g,width:p-d,height:v-g};for(var m=0;m<i.length;m++){var b=i[m],w=b.currentPoint,x=void 0;w[0]===d?(x=Kh(b,t),d-=x.xExtra):w[0]===p&&(x=Kh(b,t),p+=x.xExtra),w[1]===g?(x=Kh(b,t),g-=x.yExtra):w[1]===v&&(x=Kh(b,t),v+=x.yExtra)}return{x:d,y:g,width:p-d,height:v-g}}function Kh(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||ec(l,0))return{xExtra:0,yExtra:0};var u=Math.abs(Math.atan2(i[1]-n[1],i[0]-n[0])),c=Math.abs(Math.atan2(i[0]-n[0],i[1]-n[1]));u=u>Math.PI/2?Math.PI-u:u,c=c>Math.PI/2?Math.PI-c:c;var h={xExtra:Math.cos(l/2-u)*(t/2*(1/Math.sin(l/2)))-t/2||0,yExtra:Math.cos(c-l/2)*(t/2*(1/Math.sin(l/2)))-t/2||0};return h}function cM(r,t){return[t[0]+(t[0]-r[0]),t[1]+(t[1]-r[1])]}var hM=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},dM=function(t,e,n,i,a,s,o,l){e=Math.abs(e),n=Math.abs(n),i=YR(i,360);var u=me(i);if(t.x===o.x&&t.y===o.y)return{x:t.x,y:t.y,ellipticalArcAngle:0};if(e===0||n===0)return{x:0,y:0,ellipticalArcAngle:0};var c=(t.x-o.x)/2,h=(t.y-o.y)/2,d={x:Math.cos(u)*c+Math.sin(u)*h,y:-Math.sin(u)*c+Math.cos(u)*h},g=Math.pow(d.x,2)/Math.pow(e,2)+Math.pow(d.y,2)/Math.pow(n,2);g>1&&(e*=Math.sqrt(g),n*=Math.sqrt(g));var p=Math.pow(e,2)*Math.pow(n,2)-Math.pow(e,2)*Math.pow(d.y,2)-Math.pow(n,2)*Math.pow(d.x,2),v=Math.pow(e,2)*Math.pow(d.y,2)+Math.pow(n,2)*Math.pow(d.x,2),m=p/v;m=m<0?0:m;var b=(a!==s?1:-1)*Math.sqrt(m),w={x:b*(e*d.y/n),y:b*(-(n*d.x)/e)},x={x:Math.cos(u)*w.x-Math.sin(u)*w.y+(t.x+o.x)/2,y:Math.sin(u)*w.x+Math.cos(u)*w.y+(t.y+o.y)/2},S={x:(d.x-w.x)/e,y:(d.y-w.y)/n},_=hM({x:1,y:0},S),M={x:(-d.x-w.x)/e,y:(-d.y-w.y)/n},k=hM(S,M);!s&&k>0?k-=2*Math.PI:s&&k<0&&(k+=2*Math.PI),k%=2*Math.PI;var C=_+k*l,P=e*Math.cos(C),T=n*Math.sin(C),A={x:Math.cos(u)*P-Math.sin(u)*T+x.x,y:Math.sin(u)*P+Math.cos(u)*T+x.y,ellipticalArcStartAngle:_,ellipticalArcEndAngle:_+k,ellipticalArcAngle:C,ellipticalArcCenter:x,resultantRx:e,resultantRy:n};return A};function KV(r){for(var t=[],e=null,n=null,i=null,a=0,s=r.length,o=0;o<s;o++){var l=r[o];n=r[o+1];var u=l[0],c={command:u,prePoint:e,params:l,startTangent:null,endTangent:null,currentPoint:null,nextPoint:null,arcParams:null,box:null,cubicParams:null};switch(u){case"M":i=[l[1],l[2]],a=o;break;case"A":var h=ZV(e,l);c.arcParams=h;break}if(u==="Z")e=i,n=r[a+1];else{var d=l.length;e=[l[d-2],l[d-1]]}n&&n[0]==="Z"&&(n=r[a],t[a]&&(t[a].prePoint=e)),c.currentPoint=e,t[a]&&Mf(e,t[a].currentPoint)&&(t[a].prePoint=c.prePoint);var g=n?[n[n.length-2],n[n.length-1]]:null;c.nextPoint=g;var p=c.prePoint;if(["L","H","V"].includes(u))c.startTangent=[p[0]-e[0],p[1]-e[1]],c.endTangent=[e[0]-p[0],e[1]-p[1]];else if(u==="Q"){var v=[l[1],l[2]];c.startTangent=[p[0]-v[0],p[1]-v[1]],c.endTangent=[e[0]-v[0],e[1]-v[1]]}else if(u==="T"){var m=t[o-1],b=cM(m.currentPoint,p);m.command==="Q"?(c.command="Q",c.startTangent=[p[0]-b[0],p[1]-b[1]],c.endTangent=[e[0]-b[0],e[1]-b[1]]):(c.command="TL",c.startTangent=[p[0]-e[0],p[1]-e[1]],c.endTangent=[e[0]-p[0],e[1]-p[1]])}else if(u==="C"){var w=[l[1],l[2]],x=[l[3],l[4]];c.startTangent=[p[0]-w[0],p[1]-w[1]],c.endTangent=[e[0]-x[0],e[1]-x[1]],c.startTangent[0]===0&&c.startTangent[1]===0&&(c.startTangent=[w[0]-x[0],w[1]-x[1]]),c.endTangent[0]===0&&c.endTangent[1]===0&&(c.endTangent=[x[0]-w[0],x[1]-w[1]])}else if(u==="S"){var S=t[o-1],_=cM(S.currentPoint,p),M=[l[1],l[2]];S.command==="C"?(c.command="C",c.startTangent=[p[0]-_[0],p[1]-_[1]],c.endTangent=[e[0]-M[0],e[1]-M[1]]):(c.command="SQ",c.startTangent=[p[0]-M[0],p[1]-M[1]],c.endTangent=[e[0]-M[0],e[1]-M[1]])}else if(u==="A"){var k=fM(c,0),C=k.x,P=k.y,T=fM(c,1,!1),A=T.x,R=T.y;c.startTangent=[C,P],c.endTangent=[A,R]}t.push(c)}return t}function fM(r,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,n=r.arcParams,i=n.rx,a=i===void 0?0:i,s=n.ry,o=s===void 0?0:s,l=n.xRotation,u=n.arcFlag,c=n.sweepFlag,h=dM({x:r.prePoint[0],y:r.prePoint[1]},a,o,l,!!u,!!c,{x:r.currentPoint[0],y:r.currentPoint[1]},t),d=dM({x:r.prePoint[0],y:r.prePoint[1]},a,o,l,!!u,!!c,{x:r.currentPoint[0],y:r.currentPoint[1]},e?t+.005:t-.005),g=d.x-h.x,p=d.y-h.y,v=Math.sqrt(g*g+p*p);return{x:-g/v,y:-p/v}}function Zh(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Cw(r,t){return Zh(r)*Zh(t)?(r[0]*t[0]+r[1]*t[1])/(Zh(r)*Zh(t)):1}function gM(r,t){return(r[0]*t[1]<r[1]*t[0]?-1:1)*Math.acos(Cw(r,t))}function ZV(r,t){var e=t[1],n=t[2],i=YR(me(t[3]),Math.PI*2),a=t[4],s=t[5],o=r[0],l=r[1],u=t[6],c=t[7],h=Math.cos(i)*(o-u)/2+Math.sin(i)*(l-c)/2,d=-1*Math.sin(i)*(o-u)/2+Math.cos(i)*(l-c)/2,g=h*h/(e*e)+d*d/(n*n);g>1&&(e*=Math.sqrt(g),n*=Math.sqrt(g));var p=e*e*(d*d)+n*n*(h*h),v=p?Math.sqrt((e*e*(n*n)-p)/p):1;a===s&&(v*=-1),isNaN(v)&&(v=0);var m=n?v*e*d/n:0,b=e?v*-n*h/e:0,w=(o+u)/2+Math.cos(i)*m-Math.sin(i)*b,x=(l+c)/2+Math.sin(i)*m+Math.cos(i)*b,S=[(h-m)/e,(d-b)/n],_=[(-1*h-m)/e,(-1*d-b)/n],M=gM([1,0],S),k=gM(S,_);return Cw(S,_)<=-1&&(k=Math.PI),Cw(S,_)>=1&&(k=0),s===0&&k>0&&(k-=2*Math.PI),s===1&&k<0&&(k+=2*Math.PI),{cx:w,cy:x,rx:Mf(r,[u,c])?0:e,ry:Mf(r,[u,c])?0:n,startAngle:M,endAngle:M+k,xRotation:i,arcFlag:a,sweepFlag:s}}var SL=function(t){if(t===""||Array.isArray(t)&&t.length===0)return{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:{x:0,y:0,width:0,height:0}};var e;try{e=bf(t)}catch{e=bf(""),console.error("[g]: Invalid SVG Path definition: ".concat(t))}HV(e);var n=UV(e),i=YV(e),a=i.polygons,s=i.polylines,o=KV(e),l=XV(o,0),u=l.x,c=l.y,h=l.width,d=l.height;return{absolutePath:e,hasArc:n,segments:o,polygons:a,polylines:s,totalLength:0,rect:{x:Number.isFinite(u)?u:0,y:Number.isFinite(c)?c:0,width:Number.isFinite(h)?h:0,height:Number.isFinite(d)?d:0}}},JV=pn(SL);function ML(r){return oe(r)?JV(r):SL(r)}function QV(r,t,e){var n=r.curve,i=t.curve;(!n||n.length===0)&&(n=pw(r.absolutePath,!1),r.curve=n),(!i||i.length===0)&&(i=pw(t.absolutePath,!1),t.curve=i);var a=[n,i];n.length!==i.length&&(a=iL(n,i));var s=W3(a[0])!==W3(a[1])?rG(a[0]):nG(a[0]);return[s,hG(a[1],s),function(o){return o}]}function tH(r,t){var e;return oe(r)?e=r.split(" ").map(function(n){var i=n.split(","),a=Rt(i,2),s=a[0],o=a[1];return[Number(s),Number(o)]}):e=r,{points:e,totalLength:0,segments:[]}}function eH(r,t){return[r.points,t.points,function(e){return e}]}var Ge=null,Bl=/\s*(\w+)\(([^)]*)\)/g;function mr(r){return function(t){var e=0;return r.map(function(n){return n===Ge?t[e++]:n})}}function lo(r){return r}var gc={matrix:["NNNNNN",[Ge,Ge,0,0,Ge,Ge,0,0,0,0,1,0,Ge,Ge,0,1],lo],matrix3d:["NNNNNNNNNNNNNNNN",lo],rotate:["A"],rotateX:["A"],rotateY:["A"],rotateZ:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",mr([Ge,Ge,new On(1)]),lo],scaleX:["N",mr([Ge,new On(1),new On(1)]),mr([Ge,new On(1)])],scaleY:["N",mr([new On(1),Ge,new On(1)]),mr([new On(1),Ge])],scaleZ:["N",mr([new On(1),new On(1),Ge])],scale3d:["NNN",lo],skew:["Aa",null,lo],skewX:["A",null,mr([Ge,Lo])],skewY:["A",null,mr([Lo,Ge])],translate:["Tt",mr([Ge,Ge,Ti]),lo],translateX:["T",mr([Ge,Ti,Ti]),mr([Ge,Ti])],translateY:["T",mr([Ti,Ge,Ti]),mr([Ti,Ge])],translateZ:["L",mr([Ti,Ti,Ge])],translate3d:["TTL",lo]};function kL(r){for(var t=[],e=r.length,n=0;n<e;n++){var i=r[n],a=i[0],s=i.slice(1);a==="translate"||a==="skew"?s.length===1&&s.push(0):a==="scale"&&s.length===1&&s.push(s[0]);var o=gc[a];if(!o)return[];var l=s.map(function(u){return Fe(u)});t.push({t:a,d:l})}return t}function CL(r){if(Array.isArray(r))return kL(r);if(r=(r||"none").trim(),r==="none")return[];var t=[],e,n=0;for(Bl.lastIndex=0;e=Bl.exec(r);){if(e.index!==n)return[];n=e.index+e[0].length;var i=e[1],a=gc[i];if(!a)return[];var s=e[2].split(","),o=a[0];if(o.length<s.length)return[];for(var l=[],u=0;u<o.length;u++){var c=s[u],h=o[u],d=void 0;if(c?d={A:function(p){return p.trim()==="0"?Lo:$V(p)},N:Mw,T:Sw,L:BV}[h.toUpperCase()](c):d={a:Lo,n:l[0],t:Ti}[h],d===void 0)return[];l.push(d)}if(t.push({t:i,d:l}),Bl.lastIndex===r.length)return t}return[]}function nH(r){if(Array.isArray(r))return kL(r);if(r=(r||"none").trim(),r==="none")return[];var t=[],e,n=0;for(Bl.lastIndex=0;e=Bl.exec(r);){if(e.index!==n)return[];n=e.index+e[0].length;var i=e[1],a=gc[i];if(!a)return[];var s=e[2].split(","),o=a[0];if(o.length<s.length)return[];for(var l=[],u=0;u<o.length;u++){var c=s[u],h=o[u],d=void 0;if(c?d={A:function(p){return p.trim()==="0"?Lo:wL(p)},N:EL,T:bL,L:yL}[h.toUpperCase()](c):d={a:Lo,n:l[0],t:Ti}[h],d===void 0)return[];l.push(d)}if(t.push({t:i,d:l}),Bl.lastIndex===r.length)return t}return[]}function rH(r){var t,e,n,i;switch(r.t){case"rotateX":return i=me(Er(r.d[0])),[1,0,0,0,0,Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1];case"rotateY":return i=me(Er(r.d[0])),[Math.cos(i),0,-Math.sin(i),0,0,1,0,0,Math.sin(i),0,Math.cos(i),0,0,0,0,1];case"rotate":case"rotateZ":return i=me(Er(r.d[0])),[Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1,0,0,0,0,1];case"rotate3d":t=r.d[0].value,e=r.d[1].value,n=r.d[2].value,i=me(Er(r.d[3]));var a=t*t+e*e+n*n;if(a===0)t=1,e=0,n=0;else if(a!==1){var s=Math.sqrt(a);t/=s,e/=s,n/=s}var o=Math.sin(i/2),l=o*Math.cos(i/2),u=o*o;return[1-2*(e*e+n*n)*u,2*(t*e*u+n*l),2*(t*n*u-e*l),0,2*(t*e*u-n*l),1-2*(t*t+n*n)*u,2*(e*n*u+t*l),0,2*(t*n*u+e*l),2*(e*n*u-t*l),1-2*(t*t+e*e)*u,0,0,0,0,1];case"scale":return[r.d[0].value,0,0,0,0,r.d[1].value,0,0,0,0,1,0,0,0,0,1];case"scaleX":return[r.d[0].value,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"scaleY":return[1,0,0,0,0,r.d[0].value,0,0,0,0,1,0,0,0,0,1];case"scaleZ":return[1,0,0,0,0,1,0,0,0,0,r.d[0].value,0,0,0,0,1];case"scale3d":return[r.d[0].value,0,0,0,0,r.d[1].value,0,0,0,0,r.d[2].value,0,0,0,0,1];case"skew":var c=me(Er(r.d[0])),h=me(Er(r.d[1]));return[1,Math.tan(h),0,0,Math.tan(c),1,0,0,0,0,1,0,0,0,0,1];case"skewX":return i=me(Er(r.d[0])),[1,0,0,0,Math.tan(i),1,0,0,0,0,1,0,0,0,0,1];case"skewY":return i=me(Er(r.d[0])),[1,Math.tan(i),0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"translate":return t=Br(r.d[0],0,null)||0,e=Br(r.d[1],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,t,e,0,1];case"translateX":return t=Br(r.d[0],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,t,0,0,1];case"translateY":return e=Br(r.d[0],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,0,e,0,1];case"translateZ":return n=Br(r.d[0],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,n,1];case"translate3d":return t=Br(r.d[0],0,null)||0,e=Br(r.d[1],0,null)||0,n=Br(r.d[2],0,null)||0,[1,0,0,0,0,1,0,0,0,0,1,0,t,e,n,1];case"perspective":var d=Br(r.d[0],0,null)||0,g=d?-1/d:0;return[1,0,0,0,0,1,0,0,0,0,1,g,0,0,0,1];case"matrix":return[r.d[0].value,r.d[1].value,0,0,r.d[2].value,r.d[3].value,0,0,0,0,1,0,r.d[4].value,r.d[5].value,0,1];case"matrix3d":return r.d.map(function(p){return p.value})}}function iH(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 aH(r){return r.length===0?[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]:r.map(rH).reduce(iH)}function pM(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 UG(aH(r),t,e,n,i,a),[[t,e,n,a,i]]}var sH=function(){function r(n,i){for(var a=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],s=0;s<4;s++)for(var o=0;o<4;o++)for(var l=0;l<4;l++)a[s][o]+=i[s][l]*n[l][o];return a}function t(n){return n[0][2]===0&&n[0][3]===0&&n[1][2]===0&&n[1][3]===0&&n[2][0]===0&&n[2][1]===0&&n[2][2]===1&&n[2][3]===0&&n[3][2]===0&&n[3][3]===1}function e(n,i,a,s,o){for(var l=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],u=0;u<4;u++)l[u][3]=o[u];for(var c=0;c<3;c++)for(var h=0;h<3;h++)l[3][c]+=n[h]*l[h][c];var d=s[0],g=s[1],p=s[2],v=s[3],m=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];m[0][0]=1-2*(g*g+p*p),m[0][1]=2*(d*g-p*v),m[0][2]=2*(d*p+g*v),m[1][0]=2*(d*g+p*v),m[1][1]=1-2*(d*d+p*p),m[1][2]=2*(g*p-d*v),m[2][0]=2*(d*p-g*v),m[2][1]=2*(g*p+d*v),m[2][2]=1-2*(d*d+g*g),l=r(l,m);var b=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];a[2]&&(b[2][1]=a[2],l=r(l,b)),a[1]&&(b[2][1]=0,b[2][0]=a[0],l=r(l,b)),a[0]&&(b[2][0]=0,b[1][0]=a[0],l=r(l,b));for(var w=0;w<3;w++)for(var x=0;x<3;x++)l[w][x]*=i[w];return t(l)?[l[0][0],l[0][1],l[1][0],l[1][1],l[3][0],l[3][1]]:l[0].concat(l[1],l[2],l[3])}return e}();function oH(r){return r.toFixed(6).replace(".000000","")}function Sv(r,t){var e,n;return r.decompositionPair!==t&&(r.decompositionPair=t,e=pM(r)),t.decompositionPair!==r&&(t.decompositionPair=r,n=pM(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=uH(e[0][3],n[0][3],i[5]),s=sH(i[0],i[1],i[2],a,i[4]),o=s.map(oH).join(",");return o}])}function lH(r,t){for(var e=0,n=0;n<r.length;n++)e+=r[n]*t[n];return e}function uH(r,t,e){var n=lH(r,t);n=Ue(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 Mv(r){return r.replace(/[XY]/,"")}function kv(r){return r.replace(/(X|Y|Z|3d)?$/,"3d")}var cH=function(t,e){return t==="perspective"&&e==="perspective"||(t==="matrix"||t==="matrix3d")&&(e==="matrix"||e==="matrix3d")};function hH(r,t,e){var n=!1;if(!r.length||!t.length){r.length||(n=!0,r=t,t=[]);for(var i=function(){var A=r[a],R=A.t,L=A.d,$=R.substring(0,5)==="scale"?1:0;t.push({t:R,d:L.map(function(q){return typeof q=="number"?Fe($):Fe($,q.unit)})})},a=0;a<r.length;a++)i()}var s=[],o=[],l=[];if(r.length!==t.length){var u=Sv(r,t);s=[u[0]],o=[u[1]],l=[["matrix",[u[2]]]]}else for(var c=0;c<r.length;c++){var h=r[c].t,d=t[c].t,g=r[c].d,p=t[c].d,v=gc[h],m=gc[d],b=void 0;if(cH(h,d)){var w=Sv([r[c]],[t[c]]);s.push(w[0]),o.push(w[1]),l.push(["matrix",[w[2]]]);continue}else if(h===d)b=h;else if(v[2]&&m[2]&&Mv(h)===Mv(d))b=Mv(h),g=v[2](g),p=m[2](p);else if(v[1]&&m[1]&&kv(h)===kv(d))b=kv(h),g=v[1](g),p=m[1](p);else{var x=Sv(r,t);s=[x[0]],o=[x[1]],l=[["matrix",[x[2]]]];break}for(var S=[],_=[],M=[],k=0;k<g.length;k++){var C=jV(g[k],p[k],e,!1,k);S[k]=C[0],_[k]=C[1],M.push(C[2])}s.push(S),o.push(_),l.push([b,M])}if(n){var P=s;s=o,o=P}return[s,o,function(T){return T.map(function(A,R){var L=A.map(function($,q){return l[R][1][q]($)}).join(",");return l[R][0]==="matrix"&&L.split(",").length===16&&(l[R][0]="matrix3d"),l[R][0]==="matrix3d"&&L.split(",").length===6&&(l[R][0]="matrix"),"".concat(l[R][0],"(").concat(L,")")}).join(" ")}]}var dH=pn(function(r){if(oe(r)){if(r==="text-anchor")return[Fe(0,"px"),Fe(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:[Sw(vM(t[0])),Sw(vM(t[1]))]}return[Fe(r[0]||0,"px"),Fe(r[1]||0,"px")]});function vM(r){return r==="center"?"50%":r==="left"||r==="top"?"0%":r==="right"||r==="bottom"?"100%":r}var Fx=[{n:"display",k:["none"]},{n:"opacity",int:!0,inh:!0,d:"1",syntax:ft.OPACITY_VALUE},{n:"fillOpacity",int:!0,inh:!0,d:"1",syntax:ft.OPACITY_VALUE},{n:"strokeOpacity",int:!0,inh:!0,d:"1",syntax:ft.OPACITY_VALUE},{n:"fill",int:!0,k:["none"],d:"none",syntax:ft.PAINT},{n:"fillRule",k:["nonzero","evenodd"],d:"nonzero"},{n:"stroke",int:!0,k:["none"],d:"none",syntax:ft.PAINT,l:!0},{n:"shadowType",k:["inner","outer","both"],d:"outer",l:!0},{n:"shadowColor",int:!0,syntax:ft.COLOR},{n:"shadowOffsetX",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"shadowOffsetY",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"shadowBlur",int:!0,l:!0,d:"0",syntax:ft.SHADOW_BLUR},{n:"lineWidth",int:!0,inh:!0,d:"1",l:!0,a:["strokeWidth"],syntax:ft.LENGTH_PERCENTAGE},{n:"increasedLineWidthForHitTesting",inh:!0,d:"0",l:!0,syntax:ft.LENGTH_PERCENTAGE},{n:"lineJoin",inh:!0,l:!0,a:["strokeLinejoin"],k:["miter","bevel","round"],d:"miter"},{n:"lineCap",inh:!0,l:!0,a:["strokeLinecap"],k:["butt","round","square"],d:"butt"},{n:"lineDash",int:!0,inh:!0,k:["none"],a:["strokeDasharray"],syntax:ft.LENGTH_PERCENTAGE_12},{n:"lineDashOffset",int:!0,inh:!0,d:"0",a:["strokeDashoffset"],syntax:ft.LENGTH_PERCENTAGE},{n:"offsetPath",syntax:ft.DEFINED_PATH},{n:"offsetDistance",int:!0,syntax:ft.OFFSET_DISTANCE},{n:"dx",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"dy",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"zIndex",ind:!0,int:!0,d:"0",k:["auto"],syntax:ft.Z_INDEX},{n:"visibility",k:["visible","hidden"],ind:!0,inh:!0,int:!0,d:"visible"},{n:"pointerEvents",inh:!0,k:["none","auto","stroke","fill","painted","visible","visiblestroke","visiblefill","visiblepainted","all"],d:"auto"},{n:"filter",ind:!0,l:!0,k:["none"],d:"none",syntax:ft.FILTER},{n:"clipPath",syntax:ft.DEFINED_PATH},{n:"textPath",syntax:ft.DEFINED_PATH},{n:"textPathSide",k:["left","right"],d:"left"},{n:"textPathStartOffset",l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"transform",p:100,int:!0,k:["none"],d:"none",syntax:ft.TRANSFORM},{n:"transformOrigin",p:100,d:"0 0",l:!0,syntax:ft.TRANSFORM_ORIGIN},{n:"cx",int:!0,l:!0,d:"0",syntax:ft.COORDINATE},{n:"cy",int:!0,l:!0,d:"0",syntax:ft.COORDINATE},{n:"cz",int:!0,l:!0,d:"0",syntax:ft.COORDINATE},{n:"r",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"rx",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"ry",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"x",int:!0,l:!0,d:"0",syntax:ft.COORDINATE},{n:"y",int:!0,l:!0,d:"0",syntax:ft.COORDINATE},{n:"z",int:!0,l:!0,d:"0",syntax:ft.COORDINATE},{n:"width",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"height",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:ft.LENGTH_PERCENTAGE},{n:"radius",int:!0,l:!0,d:"0",syntax:ft.LENGTH_PERCENTAGE_14},{n:"x1",int:!0,l:!0,syntax:ft.COORDINATE},{n:"y1",int:!0,l:!0,syntax:ft.COORDINATE},{n:"z1",int:!0,l:!0,syntax:ft.COORDINATE},{n:"x2",int:!0,l:!0,syntax:ft.COORDINATE},{n:"y2",int:!0,l:!0,syntax:ft.COORDINATE},{n:"z2",int:!0,l:!0,syntax:ft.COORDINATE},{n:"d",int:!0,l:!0,d:"",syntax:ft.PATH,p:50},{n:"points",int:!0,l:!0,syntax:ft.LIST_OF_POINTS,p:50},{n:"text",l:!0,d:"",syntax:ft.TEXT,p:50},{n:"textTransform",l:!0,inh:!0,k:["capitalize","uppercase","lowercase","none"],d:"none",syntax:ft.TEXT_TRANSFORM,p:51},{n:"font",l:!0},{n:"fontSize",int:!0,inh:!0,d:"16px",l:!0,syntax:ft.LENGTH_PERCENTAGE},{n:"fontFamily",l:!0,inh:!0,d:"sans-serif"},{n:"fontStyle",l:!0,inh:!0,k:["normal","italic","oblique"],d:"normal"},{n:"fontWeight",l:!0,inh:!0,k:["normal","bold","bolder","lighter"],d:"normal"},{n:"fontVariant",l:!0,inh:!0,k:["normal","small-caps"],d:"normal"},{n:"lineHeight",l:!0,syntax:ft.LENGTH,int:!0,d:"0"},{n:"letterSpacing",l:!0,syntax:ft.LENGTH,int:!0,d:"0"},{n:"miterLimit",l:!0,syntax:ft.NUMBER,d:function(t){return t===Q.PATH||t===Q.POLYGON||t===Q.POLYLINE?"4":"10"}},{n:"wordWrap",l:!0},{n:"wordWrapWidth",l:!0},{n:"maxLines",l:!0},{n:"textOverflow",l:!0,d:"clip"},{n:"leading",l:!0},{n:"textBaseline",l:!0,inh:!0,k:["top","hanging","middle","alphabetic","ideographic","bottom"],d:"alphabetic"},{n:"textAlign",l:!0,inh:!0,k:["start","center","middle","end","left","right"],d:"start"},{n:"markerStart",syntax:ft.MARKER},{n:"markerEnd",syntax:ft.MARKER},{n:"markerMid",syntax:ft.MARKER},{n:"markerStartOffset",syntax:ft.LENGTH,l:!0,int:!0,d:"0"},{n:"markerEndOffset",syntax:ft.LENGTH,l:!0,int:!0,d:"0"}],fH=new Set(Fx.filter(function(r){return!!r.l}).map(function(r){return r.n})),TL={},gH=function(){function r(t){var e=this;at(this,r),this.runtime=t,Fx.forEach(function(n){e.registerMetadata(n)})}return it(r,[{key:"registerMetadata",value:function(e){[e.n].concat(Ce(e.a||[])).forEach(function(n){TL[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;pH(e,n);var o=!!i.forceUpdateGeometry;if(!o){for(var l in n)if(fH.has(l)){o=!0;break}}var u=OL(e);u.has("fill")&&n.fill&&(e.parsedStyle.fill=rc(n.fill)),u.has("stroke")&&n.stroke&&(e.parsedStyle.stroke=rc(n.stroke)),u.has("shadowColor")&&n.shadowColor&&(e.parsedStyle.shadowColor=rc(n.shadowColor)),u.has("filter")&&n.filter&&(e.parsedStyle.filter=GV(n.filter)),u.has("radius")&&!kt(n.radius)&&(e.parsedStyle.radius=uM(n.radius,4)),u.has("lineDash")&&!kt(n.lineDash)&&(e.parsedStyle.lineDash=uM(n.lineDash,"even")),u.has("points")&&n.points&&(e.parsedStyle.points=tH(n.points)),u.has("d")&&n.d===""&&(e.parsedStyle.d=Bt({},dL)),u.has("d")&&n.d&&(e.parsedStyle.d=ML(n.d)),u.has("textTransform")&&n.textTransform&&this.runtime.CSSPropertySyntaxFactory[ft.TEXT_TRANSFORM].calculator(null,null,{value:n.textTransform},e,null),u.has("clipPath")&&!Pt(n.clipPath)&&this.runtime.CSSPropertySyntaxFactory[ft.DEFINED_PATH].calculator("clipPath",a,n.clipPath,e,this.runtime),u.has("offsetPath")&&n.offsetPath&&this.runtime.CSSPropertySyntaxFactory[ft.DEFINED_PATH].calculator("offsetPath",s,n.offsetPath,e,this.runtime),u.has("transform")&&n.transform&&(e.parsedStyle.transform=CL(n.transform)),u.has("transformOrigin")&&n.transformOrigin&&(e.parsedStyle.transformOrigin=dH(n.transformOrigin)),u.has("markerStart")&&n.markerStart&&(e.parsedStyle.markerStart=this.runtime.CSSPropertySyntaxFactory[ft.MARKER].calculator(null,n.markerStart,n.markerStart,null,null)),u.has("markerEnd")&&n.markerEnd&&(e.parsedStyle.markerEnd=this.runtime.CSSPropertySyntaxFactory[ft.MARKER].calculator(null,n.markerEnd,n.markerEnd,null,null)),u.has("markerMid")&&n.markerMid&&(e.parsedStyle.markerMid=this.runtime.CSSPropertySyntaxFactory[ft.MARKER].calculator("",n.markerMid,n.markerMid,null,null)),u.has("zIndex")&&!kt(n.zIndex)&&this.runtime.CSSPropertySyntaxFactory[ft.Z_INDEX].postProcessor(e),u.has("offsetDistance")&&!kt(n.offsetDistance)&&this.runtime.CSSPropertySyntaxFactory[ft.OFFSET_DISTANCE].postProcessor(e),u.has("transform")&&n.transform&&this.runtime.CSSPropertySyntaxFactory[ft.TRANSFORM].postProcessor(e),u.has("transformOrigin")&&n.transformOrigin&&this.runtime.CSSPropertySyntaxFactory[ft.TRANSFORM_ORIGIN].postProcessor(e),o&&(e.geometry.dirty=!0,e.renderable.boundsDirty=!0,e.renderable.renderBoundsDirty=!0,i.forceUpdateGeometry||this.runtime.sceneGraphService.dirtifyToRoot(e))}},{key:"updateGeometry",value:function(e){var n=e.nodeName,i=this.runtime.geometryUpdaterFactory[n];if(i){var a=e.geometry;a.contentBounds||(a.contentBounds=new Me),a.renderBounds||(a.renderBounds=new Me);var s=e.parsedStyle,o=i.update(s,e),l=o.cx,u=l===void 0?0:l,c=o.cy,h=c===void 0?0:c,d=o.cz,g=d===void 0?0:d,p=o.hwidth,v=p===void 0?0:p,m=o.hheight,b=m===void 0?0:m,w=o.hdepth,x=w===void 0?0:w,S=[Math.abs(v),Math.abs(b),x],_=s.stroke,M=s.lineWidth,k=M===void 0?1:M,C=s.increasedLineWidthForHitTesting,P=C===void 0?0:C,T=s.shadowType,A=T===void 0?"outer":T,R=s.shadowColor,L=s.filter,$=L===void 0?[]:L,q=s.transformOrigin,j=[u,h,g];a.contentBounds.update(j,S);var B=n===Q.POLYLINE||n===Q.POLYGON||n===Q.PATH?Math.SQRT2:.5,D=_&&!_.isNone;if(D){var G=((k||0)+(P||0))*B;S[0]+=G,S[1]+=G}if(a.renderBounds.update(j,S),R&&A&&A!=="inner"){var X=a.renderBounds,K=X.min,ht=X.max,ut=s.shadowBlur,ct=s.shadowOffsetX,dt=s.shadowOffsetY,pt=ut||0,mt=ct||0,It=dt||0,zt=K[0]-pt+mt,Te=ht[0]+pt+mt,Rn=K[1]-pt+It,ln=ht[1]+pt+It;K[0]=Math.min(K[0],zt),ht[0]=Math.max(ht[0],Te),K[1]=Math.min(K[1],Rn),ht[1]=Math.max(ht[1],ln),a.renderBounds.setMinMax(K,ht)}$.forEach(function(Gt){var Kr=Gt.name,Or=Gt.params;if(Kr==="blur"){var ji=Or[0].value;a.renderBounds.update(a.renderBounds.center,As(a.renderBounds.halfExtents,a.renderBounds.halfExtents,[ji,ji,0]))}else if(Kr==="drop-shadow"){var mn=Or[0].value,In=Or[1].value,Be=Or[2].value,da=a.renderBounds,kn=da.min,wi=da.max,qi=kn[0]-Be+mn,tr=wi[0]+Be+mn,Ja=kn[1]-Be+In,Qa=wi[1]+Be+In;kn[0]=Math.min(kn[0],qi),wi[0]=Math.max(wi[0],tr),kn[1]=Math.min(kn[1],Ja),wi[1]=Math.max(wi[1],Qa),a.renderBounds.setMinMax(kn,wi)}}),e.geometry.dirty=!1;var dr=v<0,Ln=b<0,te=(dr?-1:1)*(q?Br(q[0],0,e,!0):0),bi=(Ln?-1:1)*(q?Br(q[1],1,e,!0):0);(te||bi)&&e.setOrigin(te,bi)}}},{key:"updateSizeAttenuation",value:function(e,n){e.style.isSizeAttenuation?(e.style.rawLineWidth||(e.style.rawLineWidth=e.style.lineWidth),e.style.lineWidth=(e.style.rawLineWidth||1)/n,e.nodeName===Q.CIRCLE&&(e.style.rawR||(e.style.rawR=e.style.r),e.style.r=(e.style.rawR||1)/n)):(e.style.rawLineWidth&&(e.style.lineWidth=e.style.rawLineWidth,delete e.style.rawLineWidth),e.nodeName===Q.CIRCLE&&e.style.rawR&&(e.style.r=e.style.rawR,delete e.style.rawR))}}])}();function pH(r,t){var e=OL(r);for(var n in t)e.has(n)&&(r.parsedStyle[n]=t[n])}function OL(r){return r.constructor.PARSED_STYLE_LIST}var vH=function(){function r(){at(this,r),this.mixer=Ix}return it(r,[{key:"calculator",value:function(e,n,i,a){return Er(i)}}])}(),mH=function(){function r(){at(this,r)}return it(r,[{key:"calculator",value:function(e,n,i,a,s){return i instanceof pi&&(i=null),s.sceneGraphService.updateDisplayObjectDependency(e,n,i,a),e==="clipPath"&&a.forEach(function(o){o.childNodes.length===0&&s.sceneGraphService.dirtifyToRoot(o)}),i}}])}(),yH=function(){function r(){at(this,r),this.parser=rc,this.mixer=FV}return it(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof pi?i.value==="none"?pL:vL:i}}])}(),bH=function(){function r(){at(this,r)}return it(r,[{key:"calculator",value:function(e,n,i){return i instanceof pi?[]:i}}])}();function mM(r){var t=r.parsedStyle,e=t.fontSize;return kt(e)?null:e}var Tw=function(){function r(){at(this,r),this.mixer=Ix}return it(r,[{key:"calculator",value:function(e,n,i,a,s){if(bt(i))return i;if(On.isRelativeUnit(i.unit)){if(i.unit===gt.kPercentage)return 0;if(i.unit===gt.kEms){if(a.parentNode){var o=mM(a.parentNode);if(o)return o*=i.value,o}return 0}if(i.unit===gt.kRems){var l;if(a!=null&&(l=a.ownerDocument)!==null&&l!==void 0&&l.documentElement){var u=mM(a.ownerDocument.documentElement);if(u)return u*=i.value,u}return 0}}else return i.value}}])}(),wH=function(){function r(){at(this,r),this.mixer=_L}return it(r,[{key:"calculator",value:function(e,n,i){return i.map(function(a){return a.value})}}])}(),xH=function(){function r(){at(this,r),this.mixer=_L}return it(r,[{key:"calculator",value:function(e,n,i){return i.map(function(a){return a.value})}}])}(),EH=function(){function r(){at(this,r)}return it(r,[{key:"calculator",value:function(e,n,i,a){var s;i instanceof pi&&(i=null);var o=(s=i)===null||s===void 0?void 0:s.cloneNode(!0);return o&&(o.style.isMarker=!0),o}}])}(),_H=function(){function r(){at(this,r),this.mixer=Ix}return it(r,[{key:"calculator",value:function(e,n,i){return i.value}}])}(),SH=function(){function r(){at(this,r),this.mixer=Dx(0,1)}return it(r,[{key:"calculator",value:function(e,n,i){return i.value}},{key:"postProcessor",value:function(e){var n=e.parsedStyle,i=n.offsetPath,a=n.offsetDistance;if(i){var s=i.nodeName;if(s===Q.LINE||s===Q.PATH||s===Q.POLYLINE){var o=i.getPoint(a);o&&e.setLocalPosition(o.x,o.y)}}}}])}(),MH=function(){function r(){at(this,r),this.mixer=Dx(0,1)}return it(r,[{key:"calculator",value:function(e,n,i){return i.value}}])}(),kH=function(){function r(){at(this,r),this.parser=ML,this.mixer=QV}return it(r,[{key:"calculator",value:function(e,n,i){return i instanceof pi&&i.value==="unset"?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Vl(0,0,0,0)}:i}}])}(),CH=it(function r(){at(this,r),this.mixer=eH}),TH=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Wt(this,t,[].concat(i)),e.mixer=Dx(0,1/0),e}return qt(t,r),it(t)}(Tw),OH=function(){function r(){at(this,r)}return it(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof pi?i.value==="unset"?"":i.value:"".concat(i)}},{key:"postProcessor",value:function(e){e.nodeValue="".concat(e.parsedStyle.text)||""}}])}(),AH=function(){function r(){at(this,r)}return it(r,[{key:"calculator",value:function(e,n,i,a){var s=a.getAttribute("text");if(s){var o=s;i.value==="capitalize"?o=s.charAt(0).toUpperCase()+s.slice(1):i.value==="lowercase"?o=s.toLowerCase():i.value==="uppercase"&&(o=s.toUpperCase()),a.parsedStyle.text=o}return i.value}}])}(),Cv=new WeakMap;function PH(r,t,e){if(r){var n=typeof r=="string"?document.getElementById(r):r;Cv.has(n)&&Cv.get(n).destroy(e),Cv.set(n,t)}}var Bx=typeof window<"u"&&typeof window.document<"u";function NH(r){return!!r.getAttribute}function RH(r,t){for(var e=0,n=r.length;e<n;){var i=e+n>>>1;AL(r[i],t)<0?e=i+1:n=i}return e}function AL(r,t){var e=Number(r.parsedStyle.zIndex||0),n=Number(t.parsedStyle.zIndex||0);if(e===n){var i=r.parentNode;if(i){var a=i.childNodes||[];return a.indexOf(r)-a.indexOf(t)}}return e-n}function PL(r){var t=r;do{var e,n=(e=t.parsedStyle)===null||e===void 0?void 0:e.clipPath;if(n)return t;t=t.parentElement}while(t!==null);return null}var yM="px";function LH(r,t,e){Bx&&r.style&&(r.style.width=t+yM,r.style.height=e+yM)}function NL(r,t){if(Bx)return document.defaultView.getComputedStyle(r,null).getPropertyValue(t)}function IH(r){var t=NL(r,"width");return t==="auto"?r.offsetWidth:parseFloat(t)}function DH(r){var t=NL(r,"height");return t==="auto"?r.offsetHeight:parseFloat(t)}var FH=1,BH={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Ow=typeof performance=="object"&&performance.now?performance:Date;function kf(r){return r.nodeName===Q.FRAGMENT?!0:r.getRootNode().nodeName===Q.FRAGMENT}function Go(){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 zH=1,$H=function(){return zH++},ia=typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:{},jH=Date.now(),qH=function(){return ia.performance&&typeof ia.performance.now=="function"?ia.performance.now():Date.now()-jH},Bu={},bM=Date.now(),WH=function(t){if(typeof t!="function")throw new TypeError("".concat(t," is not a function"));var e=Date.now(),n=e-bM,i=n>16?0:16-n,a=$H();return Bu[a]=t,Object.keys(Bu).length>1||setTimeout(function(){bM=e;var s=Bu;Bu={},Object.keys(s).forEach(function(o){return s[o](qH())})},i),a},GH=function(t){delete Bu[t]},VH=["","webkit","moz","ms","o"],RL=function(t){return typeof t!="string"?WH:t===""?ia.requestAnimationFrame:ia["".concat(t,"RequestAnimationFrame")]},HH=function(t){return typeof t!="string"?GH:t===""?ia.cancelAnimationFrame:ia["".concat(t,"CancelAnimationFrame")]||ia["".concat(t,"CancelRequestAnimationFrame")]},UH=function(t,e){for(var n=0;t[n]!==void 0;){if(e(t[n]))return t[n];n+=1}},LL=UH(VH,function(r){return!!RL(r)}),zx=RL(LL),IL=HH(LL);ia.requestAnimationFrame=zx;ia.cancelAnimationFrame=IL;var YH=function(){function r(){at(this,r),this.callbacks=[]}return it(r,[{key:"getCallbacksNum",value:function(){return this.callbacks.length}},{key:"tapPromise",value:function(e,n){this.callbacks.push(n)}},{key:"promise",value:function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return Promise.all(this.callbacks.map(function(a){return a.apply(void 0,n)}))}}])}(),XH=function(){function r(){at(this,r),this.callbacks=[]}return it(r,[{key:"tapPromise",value:function(e,n){this.callbacks.push(n)}},{key:"promise",value:function(){var t=Fs(jn().mark(function n(){var i,a,s,o,l=arguments;return jn().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(!this.callbacks.length){c.next=14;break}return c.next=3,(i=this.callbacks)[0].apply(i,l);case 3:a=c.sent,s=0;case 5:if(!(s<this.callbacks.length-1)){c.next=13;break}return o=this.callbacks[s],c.next=9,o(a);case 9:a=c.sent;case 10:s++,c.next=5;break;case 13:return c.abrupt("return",a);case 14:return c.abrupt("return",null);case 15:case"end":return c.stop()}},n,this)}));function e(){return t.apply(this,arguments)}return e}()}])}(),ir=function(){function r(){at(this,r),this.callbacks=[]}return it(r,[{key:"tap",value:function(e,n){this.callbacks.push(n)}},{key:"call",value:function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];var a=arguments;this.callbacks.forEach(function(s){s.apply(void 0,a)})}}])}(),Tv=function(){function r(){at(this,r),this.callbacks=[]}return it(r,[{key:"tap",value:function(e,n){this.callbacks.push(n)}},{key:"call",value:function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];if(this.callbacks.length){for(var a=arguments,s=this.callbacks[0].apply(void 0,a),o=0;o<this.callbacks.length-1;o++){var l=this.callbacks[o];s=l(s)}return s}return null}}])}(),KH=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],ZH=/([\"\'])[^\'\"]+\1/;function JH(r){for(var t=r.fontSize,e=t===void 0?16:t,n=r.fontFamily,i=n===void 0?"sans-serif":n,a=r.fontStyle,s=a===void 0?"normal":a,o=r.fontVariant,l=o===void 0?"normal":o,u=r.fontWeight,c=u===void 0?"normal":u,h=bt(e)&&"".concat(e,"px")||"16px",d=i.split(","),g=d.length-1;g>=0;g--){var p=d[g].trim();!ZH.test(p)&&KH.indexOf(p)<0&&(p='"'.concat(p,'"')),d[g]=p}return"".concat(s," ").concat(l," ").concat(c," ").concat(h," ").concat(d.join(","))}function Ov(r,t,e){return Bs(r),r[4]=Math.tan(t),r[1]=Math.tan(e),r}var rn=Se(),QH=Se(),tU={scale:function(t){po(rn,[t[0].value,t[1].value,1])},scaleX:function(t){po(rn,[t[0].value,1,1])},scaleY:function(t){po(rn,[1,t[0].value,1])},scaleZ:function(t){po(rn,[1,1,t[0].value])},scale3d:function(t){po(rn,[t[0].value,t[1].value,t[2].value])},translate:function(t){bs(rn,[t[0].value,t[1].value,0])},translateX:function(t){bs(rn,[t[0].value,0,0])},translateY:function(t){bs(rn,[0,t[0].value,0])},translateZ:function(t){bs(rn,[0,0,t[0].value])},translate3d:function(t){bs(rn,[t[0].value,t[1].value,t[2].value])},rotate:function(t){ow(rn,me(Er(t[0])))},rotateX:function(t){IR(rn,me(Er(t[0])))},rotateY:function(t){DR(rn,me(Er(t[0])))},rotateZ:function(t){ow(rn,me(Er(t[0])))},rotate3d:function(t){LR(rn,me(Er(t[3])),[t[0].value,t[1].value,t[2].value])},skew:function(t){Ov(rn,me(t[0].value),me(t[1].value))},skewX:function(t){Ov(rn,me(t[0].value),0)},skewY:function(t){Ov(rn,0,me(t[0].value))},matrix:function(t){sw(rn,t[0].value,t[1].value,0,0,t[2].value,t[3].value,0,0,0,0,1,0,t[4].value,t[5].value,0,1)},matrix3d:function(t){sw.apply(Jq,[rn].concat(Ce(t.map(function(e){return e.value}))))}},eU=Ae(1,1,1),nU=Qt(),wM={translate:function(t,e){st.sceneGraphService.setLocalScale(t,eU,!1),st.sceneGraphService.setLocalEulerAngles(t,nU,void 0,void 0,!1),st.sceneGraphService.setLocalPosition(t,[e[0].value,e[1].value,0],!1),st.sceneGraphService.dirtifyLocal(t,t.transformable)}};function DL(r,t){if(r.length){if(r.length===1&&wM[r[0].t]){wM[r[0].t](t,r[0].d);return}for(var e=Bs(QH),n=0;n<r.length;n++){var i=r[n],a=i.t,s=i.d,o=tU[a];o&&(o(s),GR(e,e,rn))}t.setLocalTransform(e)}else t.resetLocalTransform();return t.getLocalTransform()}var rU=function(){function r(){at(this,r),this.parser=nH,this.mixer=hH}return it(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof pi?[]:i}},{key:"postProcessor",value:function(e){DL(e.parsedStyle.transform,e)}}])}(),iU=function(){function r(){at(this,r)}return it(r,[{key:"postProcessor",value:function(e){var n=e.parsedStyle.transformOrigin;n[0].unit===gt.kPixels&&n[1].unit===gt.kPixels?e.setOrigin(n[0].value,n[1].value):e.getGeometryBounds()}}])}(),aU=function(){function r(){at(this,r)}return it(r,[{key:"calculator",value:function(e,n,i,a){return i.value}},{key:"postProcessor",value:function(e){if(e.parentNode){var n=e.parentNode,i=n.renderable,a=n.sortable;i&&(i.dirty=!0),a&&(a.dirty=!0,a.dirtyReason=xf.Z_INDEX_CHANGED)}}}])}(),sU=function(){function r(){at(this,r)}return it(r,[{key:"update",value:function(e,n){var i=e.cx,a=i===void 0?0:i,s=e.cy,o=s===void 0?0:s,l=e.r,u=l===void 0?0:l;return{cx:a,cy:o,hwidth:u,hheight:u}}}])}(),oU=function(){function r(){at(this,r)}return it(r,[{key:"update",value:function(e,n){var i=e.cx,a=i===void 0?0:i,s=e.cy,o=s===void 0?0:s,l=e.rx,u=l===void 0?0:l,c=e.ry,h=c===void 0?0:c;return{cx:a,cy:o,hwidth:u,hheight:h}}}])}(),lU=function(){function r(){at(this,r)}return it(r,[{key:"update",value:function(e){var n=e.x1,i=e.y1,a=e.x2,s=e.y2,o=Math.min(n,a),l=Math.max(n,a),u=Math.min(i,s),c=Math.max(i,s),h=l-o,d=c-u,g=h/2,p=d/2;return{cx:o+g,cy:u+p,hwidth:g,hheight:p}}}])}(),uU=function(){function r(){at(this,r)}return it(r,[{key:"update",value:function(e){var n=e.d,i=n.rect,a=i.x,s=i.y,o=i.width,l=i.height,u=o/2,c=l/2;return{cx:a+u,cy:s+c,hwidth:u,hheight:c}}}])}(),cU=function(){function r(){at(this,r)}return it(r,[{key:"update",value:function(e){if(e.points&&Xr(e.points.points)){var n=e.points.points,i=Math.min.apply(Math,Ce(n.map(function(d){return d[0]}))),a=Math.max.apply(Math,Ce(n.map(function(d){return d[0]}))),s=Math.min.apply(Math,Ce(n.map(function(d){return d[1]}))),o=Math.max.apply(Math,Ce(n.map(function(d){return d[1]}))),l=a-i,u=o-s,c=l/2,h=u/2;return{cx:i+c,cy:s+h,hwidth:c,hheight:h}}return{cx:0,cy:0,hwidth:0,hheight:0}}}])}(),hU=function(){function r(){at(this,r)}return it(r,[{key:"update",value:function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s,l=e.src,u=e.width,c=u===void 0?0:u,h=e.height,d=h===void 0?0:h,g=c,p=d;return l&&!oe(l)&&(g||(g=l.width,e.width=g),p||(p=l.height,e.height=p)),{cx:a+g/2,cy:o+p/2,hwidth:g/2,hheight:p/2}}}])}(),dU=function(){function r(t){at(this,r),this.globalRuntime=t}return it(r,[{key:"isReadyToMeasure",value:function(e,n){var i=e.text;return i}},{key:"update",value:function(e,n){var i,a=e.text,s=e.textAlign,o=s===void 0?"start":s,l=e.lineWidth,u=l===void 0?1:l,c=e.textBaseline,h=c===void 0?"alphabetic":c,d=e.dx,g=d===void 0?0:d,p=e.dy,v=p===void 0?0:p,m=e.x,b=m===void 0?0:m,w=e.y,x=w===void 0?0:w;if(!this.isReadyToMeasure(e,n))return e.metrics={font:"",width:0,height:0,lines:[],lineWidths:[],lineHeight:0,maxLineWidth:0,fontProperties:{ascent:0,descent:0,fontSize:0},lineMetrics:[]},{hwidth:0,hheight:0,cx:0,cy:0};var S=(n==null||(i=n.ownerDocument)===null||i===void 0||(i=i.defaultView)===null||i===void 0?void 0:i.getConfig())||{},_=S.offscreenCanvas,M=this.globalRuntime.textService.measureText(a,e,_);e.metrics=M;var k=M.width,C=M.height,P=k/2,T=C/2,A=b+P;o==="center"||o==="middle"?A+=u/2-P:(o==="right"||o==="end")&&(A+=u-P*2);var R=x-T;return h==="middle"?R+=T:h==="top"||h==="hanging"?R+=T*2:h==="alphabetic"||(h==="bottom"||h==="ideographic")&&(R+=0),g&&(A+=g),v&&(R+=v),{cx:A,cy:R,hwidth:P,hheight:T}}}])}(),fU=function(){function r(){at(this,r)}return it(r,[{key:"update",value:function(e,n){return{cx:0,cy:0,hwidth:0,hheight:0}}}])}(),gU=function(){function r(){at(this,r)}return it(r,[{key:"update",value:function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s,l=e.width,u=l===void 0?0:l,c=e.height,h=c===void 0?0:c;return{cx:a+u/2,cy:o+h/2,hwidth:u/2,hheight:h/2}}}])}(),l0=function(){function r(t){at(this,r),this.eventPhase=r.prototype.NONE,this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.defaultPrevented=!1,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new zn,this.page=new zn,this.canvas=new zn,this.viewport=new zn,this.composed=!1,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}return it(r,[{key:"name",get:function(){return this.type}},{key:"layerX",get:function(){return this.layer.x}},{key:"layerY",get:function(){return this.layer.y}},{key:"pageX",get:function(){return this.page.x}},{key:"pageY",get:function(){return this.page.y}},{key:"x",get:function(){return this.canvas.x}},{key:"y",get:function(){return this.canvas.y}},{key:"canvasX",get:function(){return this.canvas.x}},{key:"canvasY",get:function(){return this.canvas.y}},{key:"viewportX",get:function(){return this.viewport.x}},{key:"viewportY",get:function(){return this.viewport.y}},{key:"composedPath",value:function(){return this.manager&&(!this.path||this.path[0]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}},{key:"propagationPath",get:function(){return this.composedPath()}},{key:"preventDefault",value:function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}},{key:"stopImmediatePropagation",value:function(){this.propagationImmediatelyStopped=!0}},{key:"stopPropagation",value:function(){this.propagationStopped=!0}},{key:"initEvent",value:function(){}},{key:"initUIEvent",value:function(){}},{key:"clone",value:function(){throw new Error(pe)}}])}(),FL=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Wt(this,t,[].concat(i)),e.client=new zn,e.movement=new zn,e.offset=new zn,e.global=new zn,e.screen=new zn,e}return qt(t,r),it(t,[{key:"clientX",get:function(){return this.client.x}},{key:"clientY",get:function(){return this.client.y}},{key:"movementX",get:function(){return this.movement.x}},{key:"movementY",get:function(){return this.movement.y}},{key:"offsetX",get:function(){return this.offset.x}},{key:"offsetY",get:function(){return this.offset.y}},{key:"globalX",get:function(){return this.global.x}},{key:"globalY",get:function(){return this.global.y}},{key:"screenX",get:function(){return this.screen.x}},{key:"screenY",get:function(){return this.screen.y}},{key:"getModifierState",value:function(n){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(n)}},{key:"initMouseEvent",value:function(){throw new Error(pe)}}])}(l0),Cf=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Wt(this,t,[].concat(i)),e.width=0,e.height=0,e.isPrimary=!1,e}return qt(t,r),it(t,[{key:"getCoalescedEvents",value:function(){return this.type==="pointermove"||this.type==="mousemove"||this.type==="touchmove"?[this]:[]}},{key:"getPredictedEvents",value:function(){throw new Error("getPredictedEvents is not supported!")}},{key:"clone",value:function(){return this.manager.clonePointerEvent(this)}}])}(FL),Aw=function(r){function t(){return at(this,t),Wt(this,t,arguments)}return qt(t,r),it(t,[{key:"clone",value:function(){return this.manager.cloneWheelEvent(this)}}])}(FL),cn=function(r){function t(e,n){var i;return at(this,t),i=Wt(this,t,[null]),i.type=e,i.detail=n,Object.assign(i,n),i}return qt(t,r),it(t)}(l0),xM=new WeakMap,BL=function(){function r(){at(this,r),this.emitter=new MR}return it(r,[{key:"on",value:function(e,n,i){return this.addEventListener(e,n,i),this}},{key:"addEventListener",value:function(e,n,i){var a=!1,s=!1;if(yf(i))a=i;else if(i){var o=i.capture;a=o===void 0?!1:o;var l=i.once;s=l===void 0?!1:l}a&&(e+="capture"),n=Et(n)?n:n.handleEvent;var u=Et(n)?void 0:n;return s?this.emitter.once(e,n,u):this.emitter.on(e,n,u),this}},{key:"off",value:function(e,n,i){return e?this.removeEventListener(e,n,i):this.removeAllEventListeners(),this}},{key:"removeAllEventListeners",value:function(){var e;(e=this.emitter)===null||e===void 0||e.removeAllListeners()}},{key:"removeEventListener",value:function(e,n,i){var a;if(!this.emitter)return this;var s=yf(i)?i:i==null?void 0:i.capture;s&&(e+="capture"),n=Et(n)?n:(a=n)===null||a===void 0?void 0:a.handleEvent;var o=Et(n)?void 0:n;return this.emitter.off(e,n,o),this}},{key:"emit",value:function(e,n){this.dispatchEvent(new cn(e,n))}},{key:"dispatchEvent",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=xM.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&&xM.set(this,i)}if(i){if(e.manager=i.getEventService(),!e.manager)return!1;e.defaultPrevented=!1,e.path?e.path.length=0:e.page=[],n||(e.target=this),e.manager.dispatchEvent(e,e.type,n)}else this.emitter.emit(e.type,e);return!e.defaultPrevented}}])}(),$e=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Wt(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 qt(t,r),it(t,[{key:"textContent",get:function(){var n="";this.nodeName===Q.TEXT&&(n+=this.style.text);var i=vo(this.childNodes),a;try{for(i.s();!(a=i.n()).done;){var s=a.value;s.nodeName===Q.TEXT?n+=s.nodeValue:n+=s.textContent}}catch(o){i.e(o)}finally{i.f()}return n},set:function(n){var i=this;this.childNodes.slice().forEach(function(a){i.removeChild(a)}),this.nodeName===Q.TEXT&&(this.style.text="".concat(n))}},{key:"getRootNode",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.parentNode?this.parentNode.getRootNode(n):n.composed&&this.host?this.host.getRootNode(n):this}},{key:"hasChildNodes",value:function(){return this.childNodes.length>0}},{key:"isDefaultNamespace",value:function(n){throw new Error(pe)}},{key:"lookupNamespaceURI",value:function(n){throw new Error(pe)}},{key:"lookupPrefix",value:function(n){throw new Error(pe)}},{key:"normalize",value:function(){throw new Error(pe)}},{key:"isEqualNode",value:function(n){return this===n}},{key:"isSameNode",value:function(n){return this.isEqualNode(n)}},{key:"parent",get:function(){return this.parentNode}},{key:"parentElement",get:function(){return null}},{key:"nextSibling",get:function(){return null}},{key:"previousSibling",get:function(){return null}},{key:"firstChild",get:function(){return this.childNodes.length>0?this.childNodes[0]:null}},{key:"lastChild",get:function(){return this.childNodes.length>0?this.childNodes[this.childNodes.length-1]:null}},{key:"compareDocumentPosition",value:function(n){if(n===this)return 0;for(var i=n,a=this,s=[i],o=[a];(l=i.parentNode)!==null&&l!==void 0?l:a.parentNode;){var l;i=i.parentNode?(s.push(i.parentNode),i.parentNode):i,a=a.parentNode?(o.push(a.parentNode),a.parentNode):a}if(i!==a)return t.DOCUMENT_POSITION_DISCONNECTED|t.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|t.DOCUMENT_POSITION_PRECEDING;var u=s.length>o.length?s:o,c=u===s?o:s;if(u[u.length-c.length]===c[0])return u===s?t.DOCUMENT_POSITION_CONTAINED_BY|t.DOCUMENT_POSITION_FOLLOWING:t.DOCUMENT_POSITION_CONTAINS|t.DOCUMENT_POSITION_PRECEDING;for(var h=u.length-c.length,d=c.length-1;d>=0;d--){var g=c[d],p=u[h+d];if(p!==g){var v=g.parentNode.childNodes;return v.indexOf(g)<v.indexOf(p)?c===s?t.DOCUMENT_POSITION_PRECEDING:t.DOCUMENT_POSITION_FOLLOWING:u===s?t.DOCUMENT_POSITION_PRECEDING:t.DOCUMENT_POSITION_FOLLOWING}}return t.DOCUMENT_POSITION_FOLLOWING}},{key:"contain",value:function(n){return this.contains(n)}},{key:"contains",value:function(n){for(var i=n;i&&this!==i;)i=i.parentNode;return!!i}},{key:"getAncestor",value:function(n){for(var i=this;n>0&&i;)i=i.parentNode,n--;return i}},{key:"forEach",value:function(n){for(var i=[this];i.length>0;){var a=i.pop(),s=n(a);if(s===!1)break;for(var o=a.childNodes.length-1;o>=0;o--)i.push(a.childNodes[o])}}}],[{key:"isNode",value:function(n){return!!n.childNodes}}])}(BL);$e.DOCUMENT_POSITION_DISCONNECTED=1;$e.DOCUMENT_POSITION_PRECEDING=2;$e.DOCUMENT_POSITION_FOLLOWING=4;$e.DOCUMENT_POSITION_CONTAINS=8;$e.DOCUMENT_POSITION_CONTAINED_BY=16;$e.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;var pU=2048,vU=function(){function r(t,e){var n=this;at(this,r),this.nativeHTMLMap=new WeakMap,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.tmpMatrix=Se(),this.tmpVec3=Qt(),this.onPointerDown=function(i){var a=n.createPointerEvent(i);if(n.dispatchEvent(a,"pointerdown"),a.pointerType==="touch")n.dispatchEvent(a,"touchstart");else if(a.pointerType==="mouse"||a.pointerType==="pen"){var s=a.button===2;n.dispatchEvent(a,s?"rightdown":"mousedown")}var o=n.trackingData(i.pointerId);o.pressTargetsByButton[i.button]=a.composedPath(),n.freeEvent(a)},this.onPointerUp=function(i){var a=Ow.now(),s=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);if(n.dispatchEvent(s,"pointerup"),s.pointerType==="touch")n.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var o=s.button===2;n.dispatchEvent(s,o?"rightup":"mouseup")}var l=n.trackingData(i.pointerId),u=n.findMountedTarget(l.pressTargetsByButton[i.button]),c=u;if(u&&!s.composedPath().includes(u)){for(var h=u;h&&!s.composedPath().includes(h);){if(s.currentTarget=h,n.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")n.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var d=s.button===2;n.notifyTarget(s,d?"rightupoutside":"mouseupoutside")}$e.isNode(h)&&(h=h.parentNode)}delete l.pressTargetsByButton[i.button],c=h}if(c){var g,p=n.clonePointerEvent(s,"click");p.target=c,p.path=[],l.clicksByButton[i.button]||(l.clicksByButton[i.button]={clickCount:0,target:p.target,timeStamp:a});var v=n.context.renderingContext.root.ownerDocument.defaultView,m=l.clicksByButton[i.button];m.target===p.target&&a-m.timeStamp<v.getConfig().dblClickSpeed?++m.clickCount:m.clickCount=1,m.target=p.target,m.timeStamp=a,p.detail=m.clickCount,(g=s.detail)!==null&&g!==void 0&&g.preventClick||(!n.context.config.useNativeClickEvent&&(p.pointerType==="mouse"||p.pointerType==="touch")&&n.dispatchEvent(p,"click"),n.dispatchEvent(p,"pointertap")),n.freeEvent(p)}n.freeEvent(s)},this.onPointerMove=function(i){var a=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0),s=a.pointerType==="mouse"||a.pointerType==="pen",o=n.trackingData(i.pointerId),l=n.findMountedTarget(o.overTargets);if(o.overTargets&&l!==a.target){var u=i.type==="mousemove"?"mouseout":"pointerout",c=n.createPointerEvent(i,u,l||void 0);if(n.dispatchEvent(c,"pointerout"),s&&n.dispatchEvent(c,"mouseout"),!a.composedPath().includes(l)){var h=n.createPointerEvent(i,"pointerleave",l||void 0);for(h.eventPhase=h.AT_TARGET;h.target&&!a.composedPath().includes(h.target);)h.currentTarget=h.target,n.notifyTarget(h),s&&n.notifyTarget(h,"mouseleave"),$e.isNode(h.target)&&(h.target=h.target.parentNode);n.freeEvent(h)}n.freeEvent(c)}if(l!==a.target){var d=i.type==="mousemove"?"mouseover":"pointerover",g=n.clonePointerEvent(a,d);n.dispatchEvent(g,"pointerover"),s&&n.dispatchEvent(g,"mouseover");for(var p=l&&$e.isNode(l)&&l.parentNode;p&&p!==($e.isNode(n.rootTarget)&&n.rootTarget.parentNode)&&p!==a.target;)p=p.parentNode;var v=!p||p===($e.isNode(n.rootTarget)&&n.rootTarget.parentNode);if(v){var m=n.clonePointerEvent(a,"pointerenter");for(m.eventPhase=m.AT_TARGET;m.target&&m.target!==l&&m.target!==($e.isNode(n.rootTarget)&&n.rootTarget.parentNode);)m.currentTarget=m.target,n.notifyTarget(m),s&&n.notifyTarget(m,"mouseenter"),$e.isNode(m.target)&&(m.target=m.target.parentNode);n.freeEvent(m)}n.freeEvent(g)}n.dispatchEvent(a,"pointermove"),a.pointerType==="touch"&&n.dispatchEvent(a,"touchmove"),s&&(n.dispatchEvent(a,"mousemove"),n.cursor=n.getCursor(a.target)),o.overTargets=a.composedPath(),n.freeEvent(a)},this.onPointerOut=function(i){var a=n.trackingData(i.pointerId);if(a.overTargets){var s=i.pointerType==="mouse"||i.pointerType==="pen",o=n.findMountedTarget(a.overTargets),l=n.createPointerEvent(i,"pointerout",o||void 0);n.dispatchEvent(l),s&&n.dispatchEvent(l,"mouseout");var u=n.createPointerEvent(i,"pointerleave",o||void 0);for(u.eventPhase=u.AT_TARGET;u.target&&u.target!==($e.isNode(n.rootTarget)&&n.rootTarget.parentNode);)u.currentTarget=u.target,n.notifyTarget(u),s&&n.notifyTarget(u,"mouseleave"),$e.isNode(u.target)&&(u.target=u.target.parentNode);a.overTargets=null,n.freeEvent(l),n.freeEvent(u)}n.cursor=null},this.onPointerOver=function(i){var a=n.trackingData(i.pointerId),s=n.createPointerEvent(i),o=s.pointerType==="mouse"||s.pointerType==="pen";n.dispatchEvent(s,"pointerover"),o&&n.dispatchEvent(s,"mouseover"),s.pointerType==="mouse"&&(n.cursor=n.getCursor(s.target));var l=n.clonePointerEvent(s,"pointerenter");for(l.eventPhase=l.AT_TARGET;l.target&&l.target!==($e.isNode(n.rootTarget)&&n.rootTarget.parentNode);)l.currentTarget=l.target,n.notifyTarget(l),o&&n.notifyTarget(l,"mouseenter"),$e.isNode(l.target)&&(l.target=l.target.parentNode);a.overTargets=s.composedPath(),n.freeEvent(s),n.freeEvent(l)},this.onPointerUpOutside=function(i){var a=n.trackingData(i.pointerId),s=n.findMountedTarget(a.pressTargetsByButton[i.button]),o=n.createPointerEvent(i);if(s){for(var l=s;l;)o.currentTarget=l,n.notifyTarget(o,"pointerupoutside"),o.pointerType==="touch"||(o.pointerType==="mouse"||o.pointerType==="pen")&&n.notifyTarget(o,o.button===2?"rightupoutside":"mouseupoutside"),$e.isNode(l)&&(l=l.parentNode);delete a.pressTargetsByButton[i.button]}n.freeEvent(o)},this.onWheel=function(i){var a=n.createWheelEvent(i);n.dispatchEvent(a),n.freeEvent(a)},this.onClick=function(i){if(n.context.config.useNativeClickEvent){var a=n.createPointerEvent(i);n.dispatchEvent(a),n.freeEvent(a)}},this.onPointerCancel=function(i){var a=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);n.dispatchEvent(a),n.freeEvent(a)},this.globalRuntime=t,this.context=e}return it(r,[{key:"init",value:function(){this.rootTarget=this.context.renderingContext.root.parentNode,this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointercancel",this.onPointerCancel),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel),this.addEventMapping("click",this.onClick)}},{key:"destroy",value:function(){this.mappingTable={},this.mappingState={},this.eventPool.clear()}},{key:"getScale",value:function(){var e=this.context.contextService.getBoundingClientRect(),n=1,i=1,a=this.context.contextService.getDomElement();if(a&&e){var s=a.offsetWidth,o=a.offsetHeight;s&&o&&(n=e.width/s,i=e.height/o)}return{scaleX:n,scaleY:i,bbox:e}}},{key:"client2Viewport",value:function(e){var n=this.getScale(),i=n.scaleX,a=n.scaleY,s=n.bbox;return new zn((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 zn((e.x+((s==null?void 0:s.left)||0))*i,(e.y+((s==null?void 0:s.top)||0))*a)}},{key:"viewport2Canvas",value:function(e){var n=e.x,i=e.y,a=this.rootTarget.defaultView,s=a.getCamera(),o=this.context.config,l=o.width,u=o.height,c=s.getPerspectiveInverse(),h=s.getWorldTransform(),d=Jn(this.tmpMatrix,h,c),g=Kn(this.tmpVec3,n/l*2-1,(1-i/u)*2-1,0);return Qn(g,g,d),new zn(g[0],g[1])}},{key:"canvas2Viewport",value:function(e){var n=this.rootTarget.defaultView,i=n.getCamera(),a=i.getPerspective(),s=i.getViewTransform(),o=Jn(this.tmpMatrix,a,s),l=Kn(this.tmpVec3,e.x,e.y,0);Qn(this.tmpVec3,this.tmpVec3,o);var u=this.context.config,c=u.width,h=u.height;return new zn((l[0]+1)/2*c,(1-(l[1]+1)/2)*h)}},{key:"setPickHandler",value:function(e){this.pickHandler=e}},{key:"addEventMapping",value:function(e,n){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:n,priority:0}),this.mappingTable[e].sort(function(i,a){return i.priority-a.priority})}},{key:"mapEvent",value:function(e){if(this.rootTarget){var n=this.mappingTable[e.type];if(n)for(var i=0,a=n.length;i<a;i++)n[i].fn(e);else console.warn("[EventService]: Event mapping not defined for ".concat(e.type))}}},{key:"dispatchEvent",value:function(e,n,i){if(!i)e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,n);else{e.eventPhase=e.AT_TARGET;var a=this.rootTarget.defaultView||null;e.currentTarget=a,this.notifyListeners(e,n)}}},{key:"propagate",value:function(e,n){if(e.target){var i=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(var a=i.length-1;a>=1;a--)if(e.currentTarget=i[a],this.notifyTarget(e,n),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,n),!(e.propagationStopped||e.propagationImmediatelyStopped)){var s=i.indexOf(e.currentTarget);e.eventPhase=e.BUBBLING_PHASE;for(var o=s+1;o<i.length;o++)if(e.currentTarget=i[o],this.notifyTarget(e,n),e.propagationStopped||e.propagationImmediatelyStopped)return}}}},{key:"propagationPath",value:function(e){var n=[e],i=this.rootTarget.defaultView||null;if(i&&i===e)return n.unshift(i.document),n;for(var a=0;a<pU&&e!==this.rootTarget;a++)$e.isNode(e)&&e.parentNode&&(n.push(e.parentNode),e=e.parentNode);return i&&n.push(i),n}},{key:"hitTest",value:function(e){var n=e.viewportX,i=e.viewportY,a=this.context.config,s=a.width,o=a.height,l=a.disableHitTesting;return n<0||i<0||n>s||i>o?null:!l&&this.pickHandler(e)||this.rootTarget||null}},{key:"isNativeEventFromCanvas",value:function(e,n){var i,a=n==null?void 0:n.target;if((i=a)!==null&&i!==void 0&&i.shadowRoot&&(a=n.composedPath()[0]),a){if(a===e)return!0;if(e&&e.contains)return e.contains(a)}return n!=null&&n.composedPath?n.composedPath().indexOf(e)>-1:!1}},{key:"getExistedHTML",value:function(e){if(e.nativeEvent.composedPath)for(var n=0,i=e.nativeEvent.composedPath();n<i.length;n++){var a=i[n],s=this.nativeHTMLMap.get(a);if(s)return s}return null}},{key:"pickTarget",value:function(e){return this.hitTest({clientX:e.clientX,clientY:e.clientY,viewportX:e.viewportX,viewportY:e.viewportY,x:e.canvasX,y:e.canvasY})}},{key:"createPointerEvent",value:function(e,n,i,a){var s=this.allocateEvent(Cf);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(Aw);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(Aw);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(Cf);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=Ow.now(),n.type=e.type,n.detail=e.detail,n.view=e.view,n.page.copyFrom(e.page),n.viewport.copyFrom(e.viewport)}},{key:"allocateEvent",value:function(e){this.eventPool.has(e)||this.eventPool.set(e,[]);var n=this.eventPool.get(e).pop()||new e(this);return n.eventPhase=n.NONE,n.currentTarget=null,n.path=[],n.target=null,n}},{key:"freeEvent",value:function(e){if(e.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var n=e.constructor;this.eventPool.has(n)||this.eventPool.set(n,[]),this.eventPool.get(n).push(e)}},{key:"notifyTarget",value:function(e,n){n=n??e.type;var i=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?"".concat(n,"capture"):n;this.notifyListeners(e,i),e.eventPhase===e.AT_TARGET&&this.notifyListeners(e,n)}},{key:"notifyListeners",value:function(e,n){var i=e.currentTarget.emitter,a=i._events[n];if(a)if("fn"in a)a.once&&i.removeListener(n,a.fn,void 0,!0),a.fn.call(e.currentTarget||a.context,e);else for(var s=0;s<a.length&&!e.propagationImmediatelyStopped;s++)a[s].once&&i.removeListener(n,a[s].fn,void 0,!0),a[s].fn.call(e.currentTarget||a[s].context,e)}},{key:"findMountedTarget",value:function(e){if(!e)return null;for(var n=e[e.length-1],i=e.length-2;i>=0;i--){var a=e[i];if(a===this.rootTarget||$e.isNode(a)&&a.parentNode===n)n=e[i];else break}return n}},{key:"getCursor",value:function(e){for(var n=e;n;){var i=NH(n)&&n.getAttribute("cursor");if(i)return i;n=$e.isNode(n)&&n.parentNode}}}])}(),$x=function(){function r(){at(this,r)}return it(r,[{key:"getOrCreateCanvas",value:function(e,n){if(this.canvas)return this.canvas;if(e||st.offscreenCanvas)this.canvas=e||st.offscreenCanvas,this.context=this.canvas.getContext("2d",Bt({willReadFrequently:!0},n));else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",Bt({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",Bt({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}}])}(),zl=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}({}),mU=function(){function r(t,e){at(this,r),this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.hooks={init:new ir,initAsync:new YH,dirtycheck:new Tv,cull:new Tv,beginFrame:new ir,beforeRender:new ir,render:new ir,afterRender:new ir,endFrame:new ir,destroy:new ir,pick:new XH,pickSync:new Tv,pointerDown:new ir,pointerUp:new ir,pointerMove:new ir,pointerOut:new ir,pointerOver:new ir,pointerWheel:new ir,pointerCancel:new ir,click:new ir},this.globalRuntime=t,this.context=e}return it(r,[{key:"init",value:function(e){var n=this,i=Bt(Bt({},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(zl.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(zl.CAMERA_CHANGED),l=!e.disableRenderHooks||!(e.disableRenderHooks&&o);l&&this.renderDisplayObject(s.root,e,s),this.hooks.beginFrame.call(n),l&&s.renderListCurrentFrame.forEach(function(u){a.hooks.beforeRender.call(u),a.hooks.render.call(u),a.hooks.afterRender.call(u)}),this.hooks.endFrame.call(n),s.renderListCurrentFrame=[],s.renderReasons.clear(),i()}}},{key:"renderDisplayObject",value:function(e,n,i){var a=this,s=n.renderer.getConfig(),o=s.enableDirtyCheck,l=s.enableCulling;function u(p){var v=p.renderable,m=p.sortable,b=o?v.dirty||i.dirtyRectangleRenderingDisabled?p:null:p;if(b){var w=l?a.hooks.cull.call(b,a.context.camera):b;w&&(a.stats.rendered+=1,i.renderListCurrentFrame.push(w))}v.dirty=!1,m.renderOrder=a.zIndexCounter,a.zIndexCounter+=1,a.stats.total+=1,m.dirty&&(a.sort(p,m),m.dirty=!1,m.dirtyChildren=[],m.dirtyReason=void 0)}for(var c=[e];c.length>0;){var h=c.pop();u(h);for(var d=h.sortable.sorted||h.childNodes,g=d.length-1;g>=0;g--)c.push(d[g])}}},{key:"sort",value:function(e,n){n.sorted&&n.dirtyReason!==xf.Z_INDEX_CHANGED?n.dirtyChildren.forEach(function(i){var a=e.childNodes.indexOf(i);if(a===-1){var s=n.sorted.indexOf(i);s>=0&&n.sorted.splice(s,1)}else if(n.sorted.length===0)n.sorted.push(i);else{var o=RH(n.sorted,i);n.sorted.splice(o,0,i)}}):n.sorted=e.childNodes.slice().sort(AL)}},{key:"destroy",value:function(){this.inited=!1,this.hooks.destroy.call(),this.globalRuntime.sceneGraphService.clearPendingEvents()}},{key:"dirtify",value:function(){this.context.renderingContext.renderReasons.add(zl.DISPLAY_OBJECT_CHANGED)}}])}(),yU=/\[\s*(.*)=(.*)\s*\]/,bU=function(){function r(){at(this,r)}return it(r,[{key:"selectOne",value:function(e,n){var i=this;if(e.startsWith("."))return n.find(function(l){return((l==null?void 0:l.classList)||[]).indexOf(i.getIdOrClassname(e))>-1});if(e.startsWith("#"))return n.find(function(l){return l.id===i.getIdOrClassname(e)});if(e.startsWith("[")){var a=this.getAttribute(e),s=a.name,o=a.value;return s?n.find(function(l){return n!==l&&(s==="name"?l.name===o:i.attributeToString(l,s)===o)}):null}return n.find(function(l){return n!==l&&l.nodeName===e})}},{key:"selectAll",value:function(e,n){var i=this;if(e.startsWith("."))return n.findAll(function(l){return n!==l&&((l==null?void 0:l.classList)||[]).indexOf(i.getIdOrClassname(e))>-1});if(e.startsWith("#"))return n.findAll(function(l){return n!==l&&l.id===i.getIdOrClassname(e)});if(e.startsWith("[")){var a=this.getAttribute(e),s=a.name,o=a.value;return s?n.findAll(function(l){return n!==l&&(s==="name"?l.name===o:i.attributeToString(l,s)===o)}):[]}return n.findAll(function(l){return n!==l&&l.nodeName===e})}},{key:"is",value:function(e,n){if(e.startsWith("."))return n.className===this.getIdOrClassname(e);if(e.startsWith("#"))return n.id===this.getIdOrClassname(e);if(e.startsWith("[")){var i=this.getAttribute(e),a=i.name,s=i.value;return a==="name"?n.name===s:this.attributeToString(n,a)===s}return n.nodeName===e}},{key:"getIdOrClassname",value:function(e){return e.substring(1)}},{key:"getAttribute",value:function(e){var n=e.match(yU),i="",a="";return n&&n.length>2&&(i=n[1].replace(/"/g,""),a=n[2].replace(/"/g,"")),{name:i,value:a}}},{key:"attributeToString",value:function(e,n){if(!e.getAttribute)return"";var i=e.getAttribute(n);return kt(i)?"":i.toString?i.toString():""}}])}(),Xt=function(r){return r.ATTR_MODIFIED="DOMAttrModified",r.INSERTED="DOMNodeInserted",r.MOUNTED="DOMNodeInsertedIntoDocument",r.REMOVED="removed",r.UNMOUNTED="DOMNodeRemovedFromDocument",r.REPARENT="reparent",r.DESTROY="destroy",r.BOUNDS_CHANGED="bounds-changed",r.CULLED="culled",r}({}),aa=function(r){function t(e,n,i,a,s,o,l,u){var c;return at(this,t),c=Wt(this,t,[null]),c.relatedNode=n,c.prevValue=i,c.newValue=a,c.attrName=s,c.attrChange=o,c.prevParsedValue=l,c.newParsedValue=u,c.type=e,c}return qt(t,r),it(t)}(l0);aa.ADDITION=2;aa.MODIFICATION=1;aa.REMOVAL=3;function EM(r){var t=r.renderable;t&&(t.renderBoundsDirty=!0,t.boundsDirty=!0)}var wU=new aa(Xt.REPARENT,null,"","","",0,"",""),xU=Ax(),Jh=Qt(),EU=Ae(1,1,1),_U=Se(),SU=Ax(),us=Qt(),yl=Se(),cs=wn(),MU=Qt(),kU=wn(),CU=Qt(),Cu=Qt(),uo=Qt(),Qh=Se(),_M=wn(),SM=wn(),td=wn(),Av={affectChildren:!0},TU=function(){function r(t){at(this,r),this.pendingEvents=new Map,this.boundsChangedEvent=new cn(Xt.BOUNDS_CHANGED),this.displayObjectDependencyMap=new WeakMap,this.runtime=t}return it(r,[{key:"matches",value:function(e,n){return this.runtime.sceneGraphSelector.is(e,n)}},{key:"querySelector",value:function(e,n){return this.runtime.sceneGraphSelector.selectOne(e,n)}},{key:"querySelectorAll",value:function(e,n){return this.runtime.sceneGraphSelector.selectAll(e,n)}},{key:"attach",value:function(e,n,i){var a,s=!1;e.parentNode&&(s=e.parentNode!==n,this.detach(e));var o=e.nodeName===Q.FRAGMENT,l=kf(n);e.parentNode=n;var u=o?e.childNodes:[e];bt(i)?u.forEach(function(g){n.childNodes.splice(i,0,g),g.parentNode=n}):u.forEach(function(g){n.childNodes.push(g),g.parentNode=n});var c=n,h=c.sortable;if((h!=null&&(a=h.sorted)!==null&&a!==void 0&&a.length||e.parsedStyle.zIndex)&&(h.dirtyChildren.indexOf(e)===-1&&h.dirtyChildren.push(e),h.dirty=!0,h.dirtyReason=xf.ADDED),!l){if(o)this.dirtifyFragment(e);else{var d=e.transformable;d&&this.dirtifyWorld(e,d)}s&&e.dispatchEvent(wU)}}},{key:"detach",value:function(e){if(e.parentNode){var n,i,a=e.transformable,s=e.parentNode,o=s.sortable;(o!=null&&(n=o.sorted)!==null&&n!==void 0&&n.length||(i=e.style)!==null&&i!==void 0&&i.zIndex)&&(o.dirtyChildren.indexOf(e)===-1&&o.dirtyChildren.push(e),o.dirty=!0,o.dirtyReason=xf.REMOVED);var l=e.parentNode.childNodes.indexOf(e);l>-1&&e.parentNode.childNodes.splice(l,1),a&&this.dirtifyWorld(e,a),e.parentNode=null}}},{key:"getOrigin",value:function(e){return e.getGeometryBounds(),e.transformable.origin}},{key:"setOrigin",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=[n,i,a]);var s=e.transformable;if(!(n[0]===s.origin[0]&&n[1]===s.origin[1]&&n[2]===s.origin[2])){var o=s.origin;o[0]=n[0],o[1]=n[1],o[2]=n[2]||0,this.dirtifyLocal(e,s)}}},{key:"rotate",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Ae(n,i,a));var s=e.transformable;if(e.parentNode===null||!e.parentNode.transformable)this.rotateLocal(e,n);else{var o=cs;Wh(o,n[0],n[1],n[2]);var l=this.getRotation(e),u=this.getRotation(e.parentNode);Gh(td,u),fv(td,td),Ps(o,td,o),Ps(s.localRotation,o,l),gf(s.localRotation,s.localRotation),this.dirtifyLocal(e,s)}}},{key:"rotateLocal",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Ae(n,i,a));var s=e.transformable;Wh(SM,n[0],n[1],n[2]),z3(s.localRotation,s.localRotation,SM),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=Ae(n,i,a));var s=e.transformable;if(e.parentNode===null||!e.parentNode.transformable)this.setLocalEulerAngles(e,n);else{Wh(s.localRotation,n[0],n[1],n[2]);var o=this.getRotation(e.parentNode);Gh(_M,fv(cs,o)),z3(s.localRotation,s.localRotation,_M),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=Ae(n,i,a));var o=e.transformable;Wh(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=Ae(n,i,a));var s=e.transformable;Mu(n,Jh)||(iW(n,n,s.localRotation),As(s.localPosition,s.localPosition,n),this.dirtifyLocal(e,s))}},{key:"setPosition",value:function(e,n){var i,a=e.transformable;if(uo[0]=n[0],uo[1]=n[1],uo[2]=(i=n[2])!==null&&i!==void 0?i:0,!Mu(this.getPosition(e),uo)){if(Qi(a.position,uo),e.parentNode===null||!e.parentNode.transformable)Qi(a.localPosition,uo);else{var s=e.parentNode.transformable;ql(Qh,s.worldTransform),Ji(Qh,Qh),Qn(a.localPosition,uo,Qh)}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;Cu[0]=n[0],Cu[1]=n[1],Cu[2]=(i=n[2])!==null&&i!==void 0?i:0,!Mu(s.localPosition,Cu)&&(Qi(s.localPosition,Cu),a&&this.dirtifyLocal(e,s))}},{key:"scaleLocal",value:function(e,n){var i,a=e.transformable;Qq(a.localScale,a.localScale,Kn(us,n[0],n[1],(i=n[2])!==null&&i!==void 0?i:1)),this.dirtifyLocal(e,a)}},{key:"setLocalScale",value:function(e,n){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=e.transformable;Kn(us,n[0],n[1],(i=n[2])!==null&&i!==void 0?i:s.localScale[2]),!Mu(us,s.localScale)&&(Qi(s.localScale,us),a&&this.dirtifyLocal(e,s))}},{key:"translate",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Kn(us,n,i,a)),!Mu(n,Jh)&&(As(us,this.getPosition(e),n),this.setPosition(e,us))}},{key:"setRotation",value:function(e,n,i,a,s){var o=e.transformable;if(typeof n=="number"&&(n=cW(n,i,a,s)),e.parentNode===null||!e.parentNode.transformable)this.setLocalRotation(e,n);else{var l=this.getRotation(e.parentNode);Gh(cs,l),fv(cs,cs),Ps(o.localRotation,cs,n),gf(o.localRotation,o.localRotation),this.dirtifyLocal(e,o)}}},{key:"setLocalRotation",value:function(e,n,i,a,s){var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;typeof n=="number"&&(n=B3(cs,n,i,a,s));var l=e.transformable;Gh(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=dW(SU,n,i));var s=e.transformable;hW(s.localSkew,n),a&&this.dirtifyLocal(e,s)}},{key:"dirtifyLocal",value:function(e,n){kf(e)||n.localDirtyFlag||(n.localDirtyFlag=!0,n.dirtyFlag||this.dirtifyWorld(e,n))}},{key:"dirtifyWorld",value:function(e,n){n.dirtyFlag||this.unfreezeParentToRoot(e),this.dirtifyWorldInternal(e,n),this.dirtifyToRoot(e,!0)}},{key:"dirtifyFragment",value:function(e){var n=e.transformable;n&&(n.frozen=!1,n.dirtyFlag=!0,n.localDirtyFlag=!0);var i=e.renderable;i&&(i.renderBoundsDirty=!0,i.boundsDirty=!0,i.dirty=!0);for(var a=e.childNodes.length,s=0;s<a;s++)this.dirtifyFragment(e.childNodes[s]);e.nodeName===Q.FRAGMENT&&this.pendingEvents.set(e,!1)}},{key:"triggerPendingEvents",value:function(){var e=this,n=new Set,i=function(s,o){!s.isConnected||n.has(s)||s.nodeName===Q.FRAGMENT||(e.boundsChangedEvent.detail=o,e.boundsChangedEvent.target=s,s.isMutationObserved?s.dispatchEvent(e.boundsChangedEvent):s.ownerDocument.defaultView.dispatchEvent(e.boundsChangedEvent,!0),n.add(s))};this.pendingEvents.forEach(function(a,s){s.nodeName!==Q.FRAGMENT&&(Av.affectChildren=a,a?s.forEach(function(o){i(o,Av)}):i(s,Av))}),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;)EM(i),i=i.parentNode;n&&e.forEach(function(a){EM(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 aa(Xt.ATTR_MODIFIED,s,n,n,a,aa.MODIFICATION,n,n)),s.isCustomElement&&s.isConnected&&s.attributeChangedCallback&&s.attributeChangedCallback(a,n,n)})})}},{key:"getPosition",value:function(e){var n=e.transformable;return hf(n.position,this.getWorldTransform(e,n))}},{key:"getRotation",value:function(e){var n=e.transformable;return df(n.rotation,this.getWorldTransform(e,n))}},{key:"getScale",value:function(e){var n=e.transformable;return Wl(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){tc(e.localTransform,e.localRotation,e.localPosition,Ae(1,1,1),e.origin),(e.localSkew[0]!==0||e.localSkew[1]!==0)&&(Bs(yl),yl[4]=Math.tan(e.localSkew[0]),yl[1]=Math.tan(e.localSkew[1]),Jn(e.localTransform,e.localTransform,yl));var i=tc(yl,B3(cs,0,0,0,1),Kn(us,1,1,1),e.localScale,e.origin);Jn(e.localTransform,e.localTransform,i)}else{var a=e.localTransform,s=e.localPosition,o=e.localRotation,l=e.localScale,u=e.origin,c=s[0]!==0||s[1]!==0||s[2]!==0,h=o[3]!==1||o[0]!==0||o[1]!==0||o[2]!==0,d=l[0]!==1||l[1]!==1||l[2]!==1,g=u[0]!==0||u[1]!==0||u[2]!==0;!h&&!d&&!g?c?bs(a,s):Bs(a):tc(a,o,s,l,u)}}},{key:"getLocalTransform",value:function(e){var n=e.transformable;return n.localDirtyFlag&&(this.calcLocalTransform(n),n.localDirtyFlag=!1),n.localTransform}},{key:"setLocalTransform",value:function(e,n){var i=hf(MU,n),a=df(kU,n),s=Wl(CU,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,EU,!1),this.setLocalPosition(e,Jh,!1),this.setLocalEulerAngles(e,Jh,void 0,void 0,!1),this.setLocalSkew(e,xU,void 0,!1),this.dirtifyLocal(e,e.transformable)}},{key:"getTransformedGeometryBounds",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2?arguments[2]:void 0,a=this.getGeometryBounds(e,n);if(!Me.isEmpty(a)){var s=i||new Me;return s.setFromTransformedAABB(a,this.getWorldTransform(e)),s}return null}},{key:"getGeometryBounds",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=e,a=i.geometry;a.dirty&&st.styleValueRegistry.updateGeometry(e);var s=n?a.renderBounds:a.contentBounds||null;return s||new Me}},{key:"getBounds",value:function(e){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=e,s=a.renderable;if(!s.boundsDirty&&!i&&s.bounds)return s.bounds;if(!s.renderBoundsDirty&&i&&s.renderBounds)return s.renderBounds;var o=i?s.renderBounds:s.bounds,l=this.getTransformedGeometryBounds(e,i,o),u=e.childNodes;if(u.forEach(function(d){var g=n.getBounds(d,i);g&&(l?l.add(g):(l=o||new Me,l.update(g.center,g.halfExtents)))}),l||(l=new Me),i){var c=PL(e);if(c){var h=c.parsedStyle.clipPath.getBounds(i);l?h&&(l=h.intersection(l)):l.update(h.center,h.halfExtents)}}return i?(s.renderBounds=l,s.renderBoundsDirty=!1):(s.bounds=l,s.boundsDirty=!1),l}},{key:"getLocalBounds",value:function(e){if(e.parentNode){var n=_U;e.parentNode.transformable&&(n=Ji(yl,this.getWorldTransform(e.parentNode)));var i=this.getBounds(e);if(!Me.isEmpty(i)){var a=new Me;return a.setFromTransformedAABB(i,n),a}}return this.getBounds(e)}},{key:"getBoundingClientRect",value:function(e){var n,i,a=this.getGeometryBounds(e);Me.isEmpty(a)||(i=new Me,i.setFromTransformedAABB(a,this.getWorldTransform(e)));var s=(n=e.ownerDocument)===null||n===void 0||(n=n.defaultView)===null||n===void 0?void 0:n.getContextService().getBoundingClientRect();if(i){var o=i.getMin(),l=Rt(o,2),u=l[0],c=l[1],h=i.getMax(),d=Rt(h,2),g=d[0],p=d[1];return new Vl(u+((s==null?void 0:s.left)||0),c+((s==null?void 0:s.top)||0),g-u,p-c)}return new Vl((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?ql(n.worldTransform,n.localTransform):Jn(n.worldTransform,a.worldTransform,n.localTransform),n.dirtyFlag=!1}}},{key:"unfreezeParentToRoot",value:function(e){for(var n=e.parentNode;n;){var i=n.transformable;i&&(i.frozen=!1),n=n.parentNode}}}])}(),co={MetricsString:"|ÉqÅ",BaselineSymbol:"M",BaselineMultiplier:1.4,HeightMultiplier:2,Newlines:[10,13],BreakingSpaces:[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]},MM=/[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff!"#$%&'()*+,-./:;]/,OU=/[!%),.:;?\]}¢°·'""†‡›℃∶、。〃〆〕〗〞﹚﹜!"%'),.:;?!]}~]/,AU=/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/,PU=/[!),.:;?\]}¢·–—'"•"、。〆〞〕〉》」︰︱︲︳﹐﹑﹒﹔﹕﹖﹘﹚﹜!),.:;?︶︸︺︼︾﹀﹂﹗]|}、]/,NU=/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/,RU=/[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、:;,。.]/,LU=/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/,IU=/[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/,DU=/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/,FU=new RegExp("".concat(OU.source,"|").concat(PU.source,"|").concat(RU.source,"|").concat(IU.source)),BU=new RegExp("".concat(AU.source,"|").concat(NU.source,"|").concat(LU.source,"|").concat(DU.source)),zU=function(){function r(t){var e=this;at(this,r),this.fontMetricsCache={},this.shouldBreakByKinsokuShorui=function(n,i){return e.isBreakingSpace(i)?!1:!!(n&&(BU.exec(i)||FU.exec(n)))},this.trimByKinsokuShorui=function(n){var i=Ce(n),a=i[i.length-2];if(!a)return n;var s=a[a.length-1];return i[i.length-2]=a.slice(0,-1),i[i.length-1]=s+i[i.length-1],i},this.runtime=t}return it(r,[{key:"measureFont",value:function(e,n){if(this.fontMetricsCache[e])return this.fontMetricsCache[e];var i={ascent:0,descent:0,fontSize:0},a=this.runtime.offscreenCanvasCreator.getOrCreateCanvas(n),s=this.runtime.offscreenCanvasCreator.getOrCreateContext(n,{willReadFrequently:!0});s.font=e;var o=co.MetricsString+co.BaselineSymbol,l=Math.ceil(s.measureText(o).width),u=Math.ceil(s.measureText(co.BaselineSymbol).width),c=co.HeightMultiplier*u;u=u*co.BaselineMultiplier|0,a.width=l,a.height=c,s.fillStyle="#f00",s.fillRect(0,0,l,c),s.font=e,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(o,0,u);var h=s.getImageData(0,0,l||1,c||1).data,d=h.length,g=l*4,p=0,v=0,m=!1;for(p=0;p<u;++p){for(var b=0;b<g;b+=4)if(h[v+b]!==255){m=!0;break}if(!m)v+=g;else break}for(i.ascent=u-p,v=d-g,m=!1,p=c;p>u;--p){for(var w=0;w<g;w+=4)if(h[v+w]!==255){m=!0;break}if(!m)v-=g;else break}return i.descent=p-u,i.fontSize=i.ascent+i.descent,this.fontMetricsCache[e]=i,i}},{key:"measureText",value:function(e,n,i){var a=n.fontSize,s=a===void 0?16:a,o=n.wordWrap,l=o===void 0?!1:o,u=n.lineHeight,c=n.lineWidth,h=c===void 0?1:c,d=n.textBaseline,g=d===void 0?"alphabetic":d,p=n.textAlign,v=p===void 0?"start":p,m=n.letterSpacing,b=m===void 0?0:m,w=n.textPath;n.textPathSide,n.textPathStartOffset;var x=n.leading,S=x===void 0?0:x,_=JH(n),M=this.measureFont(_,i);M.fontSize===0&&(M.fontSize=s,M.ascent=s);var k=this.runtime.offscreenCanvasCreator.getOrCreateContext(i);k.font=_,n.isOverflowing=!1;var C=l?this.wordWrap(e,n,i):e,P=C.split(/(?:\r\n|\r|\n)/),T=new Array(P.length),A=0;if(w){w.getTotalLength();for(var R=0;R<P.length;R++)k.measureText(P[R]).width+(P[R].length-1)*b}else{for(var L=0;L<P.length;L++){var $=k.measureText(P[L]).width+(P[L].length-1)*b;T[L]=$,A=Math.max(A,$)}var q=A+h,j=u||M.fontSize+h,B=Math.max(j,M.fontSize+h)+(P.length-1)*(j+S);j+=S;var D=0;return g==="middle"?D=-B/2:g==="bottom"||g==="alphabetic"||g==="ideographic"?D=-B:(g==="top"||g==="hanging")&&(D=0),{font:_,width:q,height:B,lines:P,lineWidths:T,lineHeight:j,maxLineWidth:A,fontProperties:M,lineMetrics:T.map(function(G,X){var K=0;return v==="center"||v==="middle"?K-=G/2:(v==="right"||v==="end")&&(K-=G),new Vl(K-h/2,D+X*j,G+h,j)})}}}},{key:"wordWrap",value:function(e,n,i){var a=this,s=this,o=n.wordWrapWidth,l=o===void 0?0:o,u=n.letterSpacing,c=u===void 0?0:u,h=n.maxLines,d=h===void 0?1/0:h,g=n.textOverflow,p=this.runtime.offscreenCanvasCreator.getOrCreateContext(i),v=l+c,m="";g==="ellipsis"?m="...":g&&g!=="clip"&&(m=g);var b=Array.from(e),w=[],x=0,S=0,_=0,M={},k=function(D){return a.getFromCache(D,c,M,p)},C=k(m);function P(B,D,G,X){for(;k(B)<X&&D<b.length-1&&!s.isNewline(b[D+1]);)D+=1,B+=b[D];for(;k(B)>X&&D>G;)D-=1,B=B.slice(0,-1);return{lineTxt:B,txtLastCharIndex:D}}function T(B,D){if(!(C<=0||C>v)){if(!w[B]){w[B]=m;return}var G=P(w[B],D,_+1,v-C);w[B]=G.lineTxt+m}}for(var A=0;A<b.length;A++){var R=b[A],L=b[A-1],$=b[A+1],q=k(R);if(this.isNewline(R)){if(x+1>=d){n.isOverflowing=!0,A<b.length-1&&T(x,A-1);break}_=A-1,x+=1,S=0,w[x]="";continue}if(S>0&&S+q>v){var j=P(w[x],A-1,_+1,v);if(j.txtLastCharIndex!==A-1){if(w[x]=j.lineTxt,j.txtLastCharIndex===b.length-1)break;A=j.txtLastCharIndex+1,R=b[A],L=b[A-1],$=b[A+1],q=k(R)}if(x+1>=d){n.isOverflowing=!0,T(x,A-1);break}if(_=A-1,x+=1,S=0,w[x]="",this.isBreakingSpace(R))continue;this.canBreakInLastChar(R)||(w=this.trimToBreakable(w),S=this.sumTextWidthByCache(w[x]||"",k)),this.shouldBreakByKinsokuShorui(R,$)&&(w=this.trimByKinsokuShorui(w),S+=k(L||""))}S+=q,w[x]=(w[x]||"")+R}return w.join(`
- `)}},{key:"isBreakingSpace",value:function(e){return typeof e!="string"?!1:co.BreakingSpaces.indexOf(e.charCodeAt(0))>=0}},{key:"isNewline",value:function(e){return typeof e!="string"?!1:co.Newlines.indexOf(e.charCodeAt(0))>=0}},{key:"trimToBreakable",value:function(e){var n=Ce(e),i=n[n.length-2],a=this.findBreakableIndex(i);if(a===-1||!i)return n;var s=i.slice(a,a+1),o=this.isBreakingSpace(s),l=a+1,u=a+(o?0:1);return n[n.length-1]+=i.slice(l,i.length),n[n.length-2]=i.slice(0,u),n}},{key:"canBreakInLastChar",value:function(e){return!(e&&MM.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(!MM.test(e[n]))return n;return-1}},{key:"getFromCache",value:function(e,n,i,a){var s=i[e];if(typeof s!="number"){var o=e.length*n,l=a.measureText(e);s=l.width+o,i[e]=s}return s}}])}(),st={},$U=function(r){var t=new hU,e=new cU;return r={},wt(wt(wt(wt(wt(wt(wt(wt(wt(wt(r,Q.FRAGMENT,null),Q.CIRCLE,new sU),Q.ELLIPSE,new oU),Q.RECT,t),Q.IMAGE,t),Q.GROUP,new fU),Q.LINE,new lU),Q.TEXT,new dU(st)),Q.POLYLINE,e),Q.POLYGON,e),wt(wt(wt(r,Q.PATH,new uU),Q.HTML,new gU),Q.MESH,null)}(),jU=function(r){var t=new yH,e=new Tw;return r={},wt(wt(wt(wt(wt(wt(wt(wt(wt(wt(r,ft.PERCENTAGE,null),ft.NUMBER,new _H),ft.ANGLE,new vH),ft.DEFINED_PATH,new mH),ft.PAINT,t),ft.COLOR,t),ft.FILTER,new bH),ft.LENGTH,e),ft.LENGTH_PERCENTAGE,e),ft.LENGTH_PERCENTAGE_12,new wH),wt(wt(wt(wt(wt(wt(wt(wt(wt(wt(r,ft.LENGTH_PERCENTAGE_14,new xH),ft.COORDINATE,new Tw),ft.OFFSET_DISTANCE,new SH),ft.OPACITY_VALUE,new MH),ft.PATH,new kH),ft.LIST_OF_POINTS,new CH),ft.SHADOW_BLUR,new TH),ft.TEXT,new OH),ft.TEXT_TRANSFORM,new AH),ft.TRANSFORM,new rU),wt(wt(wt(r,ft.TRANSFORM_ORIGIN,new iU),ft.Z_INDEX,new aU),ft.MARKER,new EH)}(),qU=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}};st.CameraContribution=hL;st.AnimationTimeline=null;st.EasingFunction=null;st.offscreenCanvasCreator=new $x;st.sceneGraphSelector=new bU;st.sceneGraphService=new TU(st);st.textService=new zU(st);st.geometryUpdaterFactory=$U;st.CSSPropertySyntaxFactory=jU;st.styleValueRegistry=new gH(st);st.layoutRegistry=null;st.globalThis=qU();st.enableStyleSyntax=!0;st.enableSizeAttenuation=!1;var WU=0,Pw=new aa(Xt.INSERTED,null,"","","",0,"",""),Nw=new aa(Xt.REMOVED,null,"","","",0,"",""),zL=new cn(Xt.DESTROY),GU=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Wt(this,t,[].concat(i)),e.entity=WU++,e.renderable={bounds:void 0,boundsDirty:!0,renderBounds:void 0,renderBoundsDirty:!0,dirtyRenderBounds:void 0,dirty:!1},e.cullable={strategy:KG.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 qt(t,r),it(t,[{key:"className",get:function(){return this.getAttribute("class")||""},set:function(n){this.setAttribute("class",n)}},{key:"classList",get:function(){return this.className.split(" ").filter(function(n){return n!==""})}},{key:"tagName",get:function(){return this.nodeName}},{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"parentElement",get:function(){return this.parentNode}},{key:"nextSibling",get:function(){if(this.parentNode){var n=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[n+1]||null}return null}},{key:"previousSibling",get:function(){if(this.parentNode){var n=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[n-1]||null}return null}},{key:"cloneNode",value:function(n){throw new Error(pe)}},{key:"appendChild",value:function(n,i){var a;if(n.destroyed)throw new Error(zG);return st.sceneGraphService.attach(n,this,i),(a=this.ownerDocument)!==null&&a!==void 0&&a.defaultView&&(!kf(this)&&n.nodeName===Q.FRAGMENT?this.ownerDocument.defaultView.mountFragment(n):this.ownerDocument.defaultView.mountChildren(n)),this.isMutationObserved&&(Pw.relatedNode=this,n.dispatchEvent(Pw)),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 Nw.relatedNode=this,n.dispatchEvent(Nw),(i=n.ownerDocument)!==null&&i!==void 0&&i.defaultView&&n.ownerDocument.defaultView.unmountChildren(n),st.sceneGraphService.detach(n),n}},{key:"removeChildren",value:function(){for(var n=this.childNodes.length-1;n>=0;n--){var i=this.childNodes[n];this.removeChild(i)}}},{key:"destroyChildren",value:function(){for(var n=this.childNodes.length-1;n>=0;n--){var i=this.childNodes[n];i.childNodes.length>0&&i.destroyChildren(),i.destroy()}}},{key:"matches",value:function(n){return st.sceneGraphService.matches(n,this)}},{key:"getElementById",value:function(n){return st.sceneGraphService.querySelector("#".concat(n),this)}},{key:"getElementsByName",value:function(n){return st.sceneGraphService.querySelectorAll('[name="'.concat(n,'"]'),this)}},{key:"getElementsByClassName",value:function(n){return st.sceneGraphService.querySelectorAll(".".concat(n),this)}},{key:"getElementsByTagName",value:function(n){return st.sceneGraphService.querySelectorAll(n,this)}},{key:"querySelector",value:function(n){return st.sceneGraphService.querySelector(n,this)}},{key:"querySelectorAll",value:function(n){return st.sceneGraphService.querySelectorAll(n,this)}},{key:"closest",value:function(n){var i=this;do{if(st.sceneGraphService.matches(n,i))return i;i=i.parentElement}while(i!==null);return null}},{key:"find",value:function(n){var i=this,a=null;return this.forEach(function(s){return s!==i&&n(s)?(a=s,!1):!0}),a}},{key:"findAll",value:function(n){var i=this,a=[];return this.forEach(function(s){s!==i&&n(s)&&a.push(s)}),a}},{key:"after",value:function(){var n=this;if(this.parentNode){for(var i=this.parentNode.childNodes.indexOf(this),a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];s.forEach(function(l,u){var c;return(c=n.parentNode)===null||c===void 0?void 0:c.appendChild(l,i+u+1)})}}},{key:"before",value:function(){if(this.parentNode){for(var n,i=this.parentNode.childNodes.indexOf(this),a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];var l=s[0],u=s.slice(1);this.parentNode.appendChild(l,i),(n=l).after.apply(n,Ce(u))}}},{key:"replaceWith",value:function(){this.after.apply(this,arguments),this.remove()}},{key:"append",value:function(){for(var n=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];a.forEach(function(o){return n.appendChild(o)})}},{key:"prepend",value:function(){for(var n=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];a.forEach(function(o,l){return n.appendChild(o,l)})}},{key:"replaceChildren",value:function(){for(;this.childNodes.length&&this.firstChild;)this.removeChild(this.firstChild);this.append.apply(this,arguments)}},{key:"remove",value:function(){return this.parentNode?this.parentNode.removeChild(this):this}},{key:"destroy",value:function(){this.destroyChildren(),this.dispatchEvent(zL),this.remove(),this.emitter.removeAllListeners(),this.destroyed=!0}},{key:"getGeometryBounds",value:function(){return st.sceneGraphService.getGeometryBounds(this)}},{key:"getRenderBounds",value:function(){return st.sceneGraphService.getBounds(this,!0)}},{key:"getBounds",value:function(){return st.sceneGraphService.getBounds(this)}},{key:"getLocalBounds",value:function(){return st.sceneGraphService.getLocalBounds(this)}},{key:"getBoundingClientRect",value:function(){return st.sceneGraphService.getBoundingClientRect(this)}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"computedStyleMap",value:function(){return new Map(Object.entries(this.computedStyle))}},{key:"getAttributeNames",value:function(){return Object.keys(this.attributes)}},{key:"getAttribute",value:function(n){if(typeof n!="symbol"){var i=this.attributes[n];return i}}},{key:"hasAttribute",value:function(n){return this.getAttributeNames().includes(n)}},{key:"hasAttributes",value:function(){return!!this.getAttributeNames().length}},{key:"removeAttribute",value:function(n){this.setAttribute(n,null),delete this.attributes[n]}},{key:"setAttribute",value:function(n,i,a,s){this.attributes[n]=i}},{key:"getAttributeNS",value:function(n,i){throw new Error(pe)}},{key:"getAttributeNode",value:function(n){throw new Error(pe)}},{key:"getAttributeNodeNS",value:function(n,i){throw new Error(pe)}},{key:"hasAttributeNS",value:function(n,i){throw new Error(pe)}},{key:"removeAttributeNS",value:function(n,i){throw new Error(pe)}},{key:"removeAttributeNode",value:function(n){throw new Error(pe)}},{key:"setAttributeNS",value:function(n,i,a){throw new Error(pe)}},{key:"setAttributeNode",value:function(n){throw new Error(pe)}},{key:"setAttributeNodeNS",value:function(n){throw new Error(pe)}},{key:"toggleAttribute",value:function(n,i){throw new Error(pe)}}])}($e);function se(r){return!!(r!=null&&r.nodeName)}var VU=st.globalThis.Proxy?st.globalThis.Proxy:function(){},Ki=new aa(Xt.ATTR_MODIFIED,null,null,null,null,aa.MODIFICATION,null,null),Tu=Qt(),HU=wn(),Ne=function(r){function t(e){var n;return at(this,t),n=Wt(this,t),n.isCustomElement=!1,n.isMutationObserved=!1,n.activeAnimations=[],n.config=e,n.id=e.id||"",n.name=e.name||"",(e.className||e.class)&&(n.className=e.className||e.class),n.nodeName=e.type||Q.GROUP,e.initialParsedStyle&&Object.assign(n.parsedStyle,e.initialParsedStyle),n.initAttributes(e.style),st.enableStyleSyntax&&(n.style=new VU({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 qt(t,r),it(t,[{key:"destroy",value:function(){V3(t,"destroy",this)([]),this.getAnimations().forEach(function(n){n.cancel()})}},{key:"cloneNode",value:function(n,i){var a=Bt({},this.attributes);for(var s in a){var o=a[s];se(o)&&s!=="clipPath"&&s!=="offsetPath"&&s!=="textPath"&&(a[s]=o.cloneNode(n)),i&&(a[s]=i(s,o))}var l=new this.constructor(Bt(Bt({},this.config),{},{style:a}));return l.setLocalTransform(this.getLocalTransform()),n&&this.children.forEach(function(u){if(!u.style.isMarker){var c=u.cloneNode(n);l.appendChild(c)}}),l}},{key:"initAttributes",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i={forceUpdateGeometry:!0};st.styleValueRegistry.processProperties(this,n,i),this.renderable.dirty=!0}},{key:"setAttribute",value:function(n,i){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;Pt(i)||(a||i!==this.attributes[n])&&(this.internalSetAttribute(n,i,{memoize:s}),V3(t,"setAttribute",this)([n,i]))}},{key:"internalSetAttribute",value:function(n,i){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=this.renderable,o=this.attributes[n],l=this.parsedStyle[n];st.styleValueRegistry.processProperties(this,wt({},n,i),a),s.dirty=!0;var u=this.parsedStyle[n];if(this.isConnected&&(Ki.relatedNode=this,Ki.prevValue=o,Ki.newValue=i,Ki.attrName=n,Ki.prevParsedValue=l,Ki.newParsedValue=u,this.isMutationObserved?this.dispatchEvent(Ki):(Ki.target=this,this.ownerDocument.defaultView.dispatchEvent(Ki,!0))),this.isCustomElement&&this.isConnected||!this.isCustomElement){var c,h;(c=(h=this).attributeChangedCallback)===null||c===void 0||c.call(h,n,o,i,l,u)}}},{key:"getBBox",value:function(){var n=this.getBounds(),i=n.getMin(),a=Rt(i,2),s=a[0],o=a[1],l=n.getMax(),u=Rt(l,2),c=u[0],h=u[1];return new Vl(s,o,c-s,h-o)}},{key:"setOrigin",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return st.sceneGraphService.setOrigin(this,ar(n,i,a,!1)),this}},{key:"getOrigin",value:function(){return st.sceneGraphService.getOrigin(this)}},{key:"setPosition",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return st.sceneGraphService.setPosition(this,ar(n,i,a,!1)),this}},{key:"setLocalPosition",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return st.sceneGraphService.setLocalPosition(this,ar(n,i,a,!1)),this}},{key:"translate",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return st.sceneGraphService.translate(this,ar(n,i,a,!1)),this}},{key:"translateLocal",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return st.sceneGraphService.translateLocal(this,ar(n,i,a,!1)),this}},{key:"getPosition",value:function(){return st.sceneGraphService.getPosition(this)}},{key:"getLocalPosition",value:function(){return st.sceneGraphService.getLocalPosition(this)}},{key:"scale",value:function(n,i,a){return this.scaleLocal(n,i,a)}},{key:"scaleLocal",value:function(n,i,a){return typeof n=="number"&&(i=i||n,a=a||n,n=ar(n,i,a,!1)),st.sceneGraphService.scaleLocal(this,n),this}},{key:"setLocalScale",value:function(n,i,a){return typeof n=="number"&&(i=i||n,a=a||n,n=ar(n,i,a,!1)),st.sceneGraphService.setLocalScale(this,n),this}},{key:"getLocalScale",value:function(){return st.sceneGraphService.getLocalScale(this)}},{key:"getScale",value:function(){return st.sceneGraphService.getScale(this)}},{key:"getEulerAngles",value:function(){var n=wv(Tu,st.sceneGraphService.getWorldTransform(this)),i=Rt(n,3),a=i[2];return xr(a)}},{key:"getLocalEulerAngles",value:function(){var n=wv(Tu,st.sceneGraphService.getLocalRotation(this)),i=Rt(n,3),a=i[2];return xr(a)}},{key:"setEulerAngles",value:function(n){return st.sceneGraphService.setEulerAngles(this,0,0,n),this}},{key:"setLocalEulerAngles",value:function(n){return st.sceneGraphService.setLocalEulerAngles(this,0,0,n),this}},{key:"rotateLocal",value:function(n,i,a){return kt(i)&&kt(a)?st.sceneGraphService.rotateLocal(this,0,0,n):st.sceneGraphService.rotateLocal(this,n,i,a),this}},{key:"rotate",value:function(n,i,a){return kt(i)&&kt(a)?st.sceneGraphService.rotate(this,0,0,n):st.sceneGraphService.rotate(this,n,i,a),this}},{key:"setRotation",value:function(n,i,a,s){return st.sceneGraphService.setRotation(this,n,i,a,s),this}},{key:"setLocalRotation",value:function(n,i,a,s){return st.sceneGraphService.setLocalRotation(this,n,i,a,s),this}},{key:"setLocalSkew",value:function(n,i){return st.sceneGraphService.setLocalSkew(this,n,i),this}},{key:"getRotation",value:function(){return st.sceneGraphService.getRotation(this)}},{key:"getLocalRotation",value:function(){return st.sceneGraphService.getLocalRotation(this)}},{key:"getLocalSkew",value:function(){return st.sceneGraphService.getLocalSkew(this)}},{key:"getLocalTransform",value:function(){return st.sceneGraphService.getLocalTransform(this)}},{key:"getWorldTransform",value:function(){return st.sceneGraphService.getWorldTransform(this)}},{key:"setLocalTransform",value:function(n){return st.sceneGraphService.setLocalTransform(this,n),this}},{key:"resetLocalTransform",value:function(){st.sceneGraphService.resetLocalTransform(this)}},{key:"getAnimations",value:function(){return this.activeAnimations}},{key:"animate",value:function(n,i){var a,s=(a=this.ownerDocument)===null||a===void 0?void 0:a.timeline;return s?s.play(this,n,i):null}},{key:"isVisible",value:function(){var n;return((n=this.parsedStyle)===null||n===void 0?void 0:n.visibility)!=="hidden"}},{key:"interactive",get:function(){return this.isInteractive()},set:function(n){this.style.pointerEvents=n?"auto":"none"}},{key:"isInteractive",value:function(){var n;return((n=this.parsedStyle)===null||n===void 0?void 0:n.pointerEvents)!=="none"}},{key:"isCulled",value:function(){return!!(this.cullable&&this.cullable.enable&&!this.cullable.visible)}},{key:"toFront",value:function(){return this.parentNode&&(this.style.zIndex=Math.max.apply(Math,Ce(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,Ce(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?sn(o)?(Object.keys(o).forEach(function(u){n.setAttribute(u,o[u])}),this):a.length===2?(this.setAttribute(o,l),this):this.attributes[o]:this.attributes}},{key:"getMatrix",value:function(n){var i=n||this.getWorldTransform(),a=hf(Tu,i),s=Rt(a,2),o=s[0],l=s[1],u=Wl(Tu,i),c=Rt(u,2),h=c[0],d=c[1],g=df(HU,i),p=wv(Tu,g),v=Rt(p,3),m=v[0],b=v[2];return VG(m||b,o,l,h,d)}},{key:"getLocalMatrix",value:function(){return this.getMatrix(this.getLocalTransform())}},{key:"setMatrix",value:function(n){var i=K3(n),a=Rt(i,5),s=a[0],o=a[1],l=a[2],u=a[3],c=a[4];this.setEulerAngles(c).setPosition(s,o).setLocalScale(l,u)}},{key:"setLocalMatrix",value:function(n){var i=K3(n),a=Rt(i,5),s=a[0],o=a[1],l=a[2],u=a[3],c=a[4];this.setLocalEulerAngles(c).setLocalPosition(s,o).setLocalScale(l,u)}},{key:"show",value:function(){this.forEach(function(n){n.style.visibility="visible"})}},{key:"hide",value:function(){this.forEach(function(n){n.style.visibility="hidden"})}},{key:"getCount",value:function(){return this.childElementCount}},{key:"getParent",value:function(){return this.parentElement}},{key:"getChildren",value:function(){return this.children}},{key:"getFirst",value:function(){return this.firstElementChild}},{key:"getLast",value:function(){return this.lastElementChild}},{key:"getChildByIndex",value:function(n){return this.children[n]||null}},{key:"add",value:function(n,i){return this.appendChild(n,i)}},{key:"set",value:function(n,i){this.config[n]=i}},{key:"get",value:function(n){return this.config[n]}},{key:"moveTo",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return this.setPosition(n,i,a),this}},{key:"move",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return this.setPosition(n,i,a),this}},{key:"setZIndex",value:function(n){return this.style.zIndex=n,this}}])}(GU);Ne.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 Ua=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return at(this,t),Wt(this,t,[Bt({type:Q.CIRCLE},e)])}return qt(t,r),it(t)}(Ne);Ua.PARSED_STYLE_LIST=new Set([].concat(Ce(Ne.PARSED_STYLE_LIST),["cx","cy","cz","r","isBillboard","isSizeAttenuation"]));var UU=["style"],jx=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=Wo(n,UU);return at(this,t),e=Wt(this,t,[Bt({style:i},a)]),e.isCustomElement=!0,e}return qt(t,r),it(t)}(Ne);jx.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var Lc=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return at(this,t),Wt(this,t,[Bt({type:Q.ELLIPSE},e)])}return qt(t,r),it(t)}(Ne);Lc.PARSED_STYLE_LIST=new Set([].concat(Ce(Ne.PARSED_STYLE_LIST),["cx","cy","cz","rx","ry","isBillboard","isSizeAttenuation"]));var YU=function(r){function t(){return at(this,t),Wt(this,t,[{type:Q.FRAGMENT}])}return qt(t,r),it(t)}(Ne);YU.PARSED_STYLE_LIST=new Set(["class","className"]);var _n=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return at(this,t),Wt(this,t,[Bt({type:Q.GROUP},e)])}return qt(t,r),it(t)}(Ne);_n.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var XU=["style"],Ic=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=Wo(n,XU);return at(this,t),e=Wt(this,t,[Bt({type:Q.HTML,style:i},a)]),e.cullable.enable=!1,e}return qt(t,r),it(t,[{key:"getDomElement",value:function(){return this.parsedStyle.$el}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"getLocalBounds",value:function(){if(this.parentNode){var n=Ji(Se(),this.parentNode.getWorldTransform()),i=this.getBounds();if(!Me.isEmpty(i)){var a=new Me;return a.setFromTransformedAABB(i,n),a}}return this.getBounds()}}])}(Ne);Ic.PARSED_STYLE_LIST=new Set([].concat(Ce(Ne.PARSED_STYLE_LIST),["x","y","$el","innerHTML","width","height"]));var Dc=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return at(this,t),Wt(this,t,[Bt({type:Q.IMAGE},e)])}return qt(t,r),it(t)}(Ne);Dc.PARSED_STYLE_LIST=new Set([].concat(Ce(Ne.PARSED_STYLE_LIST),["x","y","z","src","width","height","isBillboard","billboardRotation","isSizeAttenuation","keepAspectRatio"]));var KU=["style"],Do=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=Wo(n,KU);at(this,t),e=Wt(this,t,[Bt({type:Q.LINE,style:Bt({x1:0,y1:0,x2:0,y2:0,z1:0,z2:0},i)},a)]),e.markerStartAngle=0,e.markerEndAngle=0;var s=e.parsedStyle,o=s.markerStart,l=s.markerEnd;return o&&se(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),l&&se(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return qt(t,r),it(t,[{key:"attributeChangedCallback",value:function(n,i,a,s,o){n==="x1"||n==="y1"||n==="x2"||n==="y2"||n==="markerStartOffset"||n==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):n==="markerStart"?(s&&se(s)&&(this.markerStartAngle=0,s.remove()),o&&se(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"&&(s&&se(s)&&(this.markerEndAngle=0,s.remove()),o&&se(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1)))}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,l=i.markerEndOffset,u=i.x1,c=i.x2,h=i.y1,d=i.y2,g=n?a:s;if(!(!g||!se(g))){var p=0,v,m,b,w,x,S;n?(b=u,w=h,v=c-u,m=d-h,x=o||0,S=this.markerStartAngle):(b=c,w=d,v=u-c,m=h-d,x=l||0,S=this.markerEndAngle),p=Math.atan2(m,v),g.setLocalEulerAngles(p*180/Math.PI+S),g.setLocalPosition(b+Math.cos(p)*x,w+Math.sin(p)*x)}}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle,s=a.x1,o=a.y1,l=a.x2,u=a.y2,c=lL(s,o,l,u,n),h=c.x,d=c.y,g=Qn(Qt(),Ae(h,d,0),i?this.getWorldTransform():this.getLocalTransform());return new zn(g[0],g[1])}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPoint(n/this.getTotalLength(),i)}},{key:"getTotalLength",value:function(){var n=this.parsedStyle,i=n.x1,a=n.y1,s=n.x2,o=n.y2;return oL(i,a,s,o)}}])}(Ne);Do.PARSED_STYLE_LIST=new Set([].concat(Ce(Ne.PARSED_STYLE_LIST),["x1","y1","x2","y2","z1","z2","isBillboard","isSizeAttenuation","markerStart","markerEnd","markerStartOffset","markerEndOffset"]));var ZU=["style"],qr=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=Wo(n,ZU);at(this,t),e=Wt(this,t,[Bt({type:Q.PATH,style:i,initialParsedStyle:{miterLimit:4,d:Bt({},dL)}},a)]),e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[];var s=e.parsedStyle,o=s.markerStart,l=s.markerEnd,u=s.markerMid;return o&&se(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),u&&se(u)&&e.placeMarkerMid(u),l&&se(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return qt(t,r),it(t,[{key:"attributeChangedCallback",value:function(n,i,a,s,o){n==="d"?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):n==="markerStartOffset"||n==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):n==="markerStart"?(s&&se(s)&&(this.markerStartAngle=0,s.remove()),o&&se(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"?(s&&se(s)&&(this.markerEndAngle=0,s.remove()),o&&se(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1))):n==="markerMid"&&this.placeMarkerMid(o)}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,l=i.markerEndOffset,u=n?a:s;if(!(!u||!se(u))){var c=0,h,d,g,p,v,m;if(n){var b=this.getStartTangent(),w=Rt(b,2),x=w[0],S=w[1];g=S[0],p=S[1],h=x[0]-S[0],d=x[1]-S[1],v=o||0,m=this.markerStartAngle}else{var _=this.getEndTangent(),M=Rt(_,2),k=M[0],C=M[1];g=C[0],p=C[1],h=k[0]-C[0],d=k[1]-C[1],v=l||0,m=this.markerEndAngle}c=Math.atan2(d,h),u.setLocalEulerAngles(c*180/Math.PI+m),u.setLocalPosition(g+Math.cos(c)*v,p+Math.sin(c)*v)}}},{key:"placeMarkerMid",value:function(n){var i=this.parsedStyle.d.segments;if(this.markerMidList.forEach(function(c){c.remove()}),n&&se(n))for(var a=1;a<i.length-1;a++){var s=Rt(i[a].currentPoint,2),o=s[0],l=s[1],u=a===1?n:n.cloneNode(!0);this.markerMidList.push(u),this.appendChild(u),u.setLocalPosition(o,l)}}},{key:"getTotalLength",value:function(){return kw(this)}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle.d.absolutePath,s=gG(a,n),o=s.x,l=s.y,u=Qn(Qt(),Ae(o,l,0),i?this.getWorldTransform():this.getLocalTransform());return new zn(u[0],u[1])}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPointAtLength(n*kw(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}}])}(Ne);qr.PARSED_STYLE_LIST=new Set([].concat(Ce(Ne.PARSED_STYLE_LIST),["d","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard","isSizeAttenuation"]));var JU=["style"],Vo=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=Wo(n,JU);at(this,t),e=Wt(this,t,[Bt({type:Q.POLYGON,style:i,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!0}},a)]),e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[];var s=e.parsedStyle,o=s.markerStart,l=s.markerEnd,u=s.markerMid;return o&&se(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),u&&se(u)&&e.placeMarkerMid(u),l&&se(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return qt(t,r),it(t,[{key:"attributeChangedCallback",value:function(n,i,a,s,o){n==="points"?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):n==="markerStartOffset"||n==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):n==="markerStart"?(s&&se(s)&&(this.markerStartAngle=0,s.remove()),o&&se(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"?(s&&se(s)&&(this.markerEndAngle=0,s.remove()),o&&se(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1))):n==="markerMid"&&this.placeMarkerMid(o)}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,l=i.markerEndOffset,u=i.points,c=u||{},h=c.points,d=n?a:s;if(!(!d||!se(d)||!h)){var g=0,p,v,m,b,w,x;if(m=h[0][0],b=h[0][1],n)p=h[1][0]-h[0][0],v=h[1][1]-h[0][1],w=o||0,x=this.markerStartAngle;else{var S=h.length;this.parsedStyle.isClosed?(p=h[S-1][0]-h[0][0],v=h[S-1][1]-h[0][1]):(m=h[S-1][0],b=h[S-1][1],p=h[S-2][0]-h[S-1][0],v=h[S-2][1]-h[S-1][1]),w=l||0,x=this.markerEndAngle}g=Math.atan2(v,p),d.setLocalEulerAngles(g*180/Math.PI+x),d.setLocalPosition(m+Math.cos(g)*w,b+Math.sin(g)*w)}}},{key:"placeMarkerMid",value:function(n){var i=this.parsedStyle.points,a=i||{},s=a.points;if(this.markerMidList.forEach(function(h){h.remove()}),this.markerMidList=[],n&&se(n)&&s)for(var o=1;o<(this.parsedStyle.isClosed?s.length:s.length-1);o++){var l=s[o][0],u=s[o][1],c=o===1?n:n.cloneNode(!0);this.markerMidList.push(c),this.appendChild(c),c.setLocalPosition(l,u)}}}])}(Ne);Vo.PARSED_STYLE_LIST=new Set([].concat(Ce(Ne.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isClosed","isBillboard","isSizeAttenuation"]));var QU=["style"],u0=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.style,i=Wo(e,QU);return at(this,t),Wt(this,t,[Bt({type:Q.POLYLINE,style:n,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!1}},i)])}return qt(t,r),it(t,[{key:"getTotalLength",value:function(){return VV(this)}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPoint(n/this.getTotalLength(),i)}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle.points.points;if(this.parsedStyle.points.segments.length===0){var s=[],o=0,l,u,c=this.getTotalLength();a.forEach(function(b,w){a[w+1]&&(l=[0,0],l[0]=o/c,u=oL(b[0],b[1],a[w+1][0],a[w+1][1]),o+=u,l[1]=o/c,s.push(l))}),this.parsedStyle.points.segments=s}var h=0,d=0;this.parsedStyle.points.segments.forEach(function(b,w){n>=b[0]&&n<=b[1]&&(h=(n-b[0])/(b[1]-b[0]),d=w)});var g=lL(a[d][0],a[d][1],a[d+1][0],a[d+1][1],h),p=g.x,v=g.y,m=Qn(Qt(),Ae(p,v,0),i?this.getWorldTransform():this.getLocalTransform());return new zn(m[0],m[1])}},{key:"getStartTangent",value:function(){var n=this.parsedStyle.points.points,i=[];return i.push([n[1][0],n[1][1]]),i.push([n[0][0],n[0][1]]),i}},{key:"getEndTangent",value:function(){var n=this.parsedStyle.points.points,i=n.length-1,a=[];return a.push([n[i-1][0],n[i-1][1]]),a.push([n[i][0],n[i][1]]),a}}])}(Vo);u0.PARSED_STYLE_LIST=new Set([].concat(Ce(Vo.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard"]));var Sn=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return at(this,t),Wt(this,t,[Bt({type:Q.RECT},e)])}return qt(t,r),it(t)}(Ne);Sn.PARSED_STYLE_LIST=new Set([].concat(Ce(Ne.PARSED_STYLE_LIST),["x","y","z","width","height","isBillboard","isSizeAttenuation","radius"]));var tY=["style"],Hs=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.style,i=Wo(e,tY);return at(this,t),Wt(this,t,[Bt({type:Q.TEXT,style:Bt({fill:"black"},n)},i)])}return qt(t,r),it(t,[{key:"getComputedTextLength",value:function(){var n;return this.getGeometryBounds(),((n=this.parsedStyle.metrics)===null||n===void 0?void 0:n.maxLineWidth)||0}},{key:"getLineBoundingRects",value:function(){var n;return this.getGeometryBounds(),((n=this.parsedStyle.metrics)===null||n===void 0?void 0:n.lineMetrics)||[]}},{key:"isOverflowing",value:function(){return this.getGeometryBounds(),!!this.parsedStyle.isOverflowing}}])}(Ne);Hs.PARSED_STYLE_LIST=new Set([].concat(Ce(Ne.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 eY=function(){function r(){at(this,r),this.registry={},this.define(Q.CIRCLE,Ua),this.define(Q.ELLIPSE,Lc),this.define(Q.RECT,Sn),this.define(Q.IMAGE,Dc),this.define(Q.LINE,Do),this.define(Q.GROUP,_n),this.define(Q.PATH,qr),this.define(Q.POLYGON,Vo),this.define(Q.POLYLINE,u0),this.define(Q.TEXT,Hs),this.define(Q.HTML,Ic)}return it(r,[{key:"define",value:function(e,n){this.registry[e]=n}},{key:"get",value:function(e){return this.registry[e]}}])}(),$L=function(r){function t(){var e;at(this,t),e=Wt(this,t),e.defaultView=null,e.ownerDocument=null,e.nodeName="document";try{e.timeline=new st.AnimationTimeline(e)}catch{}var n={};return Fx.forEach(function(i){var a=i.n,s=i.inh,o=i.d;s&&o&&(n[a]=Et(o)?o(Q.GROUP):o)}),e.documentElement=new _n({id:"g-root",style:n}),e.documentElement.ownerDocument=e,e.documentElement.parentNode=e,e.childNodes=[e.documentElement],e}return qt(t,r),it(t,[{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"createElement",value:function(n,i){if(n==="svg")return this.documentElement;var a=this.defaultView.customElements.get(n);a||(console.warn("Unsupported tagName: ",n),a=n==="tspan"?Hs:_n);var s=new a(i);return s.ownerDocument=this,s}},{key:"createElementNS",value:function(n,i,a){return this.createElement(i,a)}},{key:"cloneNode",value:function(n){throw new Error(pe)}},{key:"destroy",value:function(){try{this.documentElement.destroyChildren(),this.timeline.destroy()}catch{}}},{key:"elementsFromBBox",value:function(n,i,a,s){var o=this.defaultView.context.rBushRoot,l=o.search({minX:n,minY:i,maxX:a,maxY:s}),u=[];return l.forEach(function(c){var h=c.displayObject,d=h.parsedStyle.pointerEvents,g=d===void 0?"auto":d,p=["auto","visiblepainted","visiblefill","visiblestroke","visible"].includes(g);(!p||p&&h.isVisible())&&!h.isCulled()&&h.isInteractive()&&u.push(h)}),u.sort(function(c,h){return h.sortable.renderOrder-c.sortable.renderOrder}),u}},{key:"elementFromPointSync",value:function(n,i){var a=this.defaultView.canvas2Viewport({x:n,y:i}),s=a.x,o=a.y,l=this.defaultView.getConfig(),u=l.width,c=l.height;if(s<0||o<0||s>u||o>c)return null;var h=this.defaultView.viewport2Client({x:s,y:o}),d=h.x,g=h.y,p=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!0,position:{x:n,y:i,viewportX:s,viewportY:o,clientX:d,clientY:g},picked:[]}),v=p.picked;return v&&v[0]||this.documentElement}},{key:"elementFromPoint",value:function(){var e=Fs(jn().mark(function i(a,s){var o,l,u,c,h,d,g,p,v,m,b;return jn().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:if(o=this.defaultView.canvas2Viewport({x:a,y:s}),l=o.x,u=o.y,c=this.defaultView.getConfig(),h=c.width,d=c.height,!(l<0||u<0||l>h||u>d)){x.next=4;break}return x.abrupt("return",null);case 4:return g=this.defaultView.viewport2Client({x:l,y:u}),p=g.x,v=g.y,x.next=7,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!0,position:{x:a,y:s,viewportX:l,viewportY:u,clientX:p,clientY:v},picked:[]});case 7:return m=x.sent,b=m.picked,x.abrupt("return",b&&b[0]||this.documentElement);case 10:case"end":return x.stop()}},i,this)}));function n(i,a){return e.apply(this,arguments)}return n}()},{key:"elementsFromPointSync",value:function(n,i){var a=this.defaultView.canvas2Viewport({x:n,y:i}),s=a.x,o=a.y,l=this.defaultView.getConfig(),u=l.width,c=l.height;if(s<0||o<0||s>u||o>c)return[];var h=this.defaultView.viewport2Client({x:s,y:o}),d=h.x,g=h.y,p=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!1,position:{x:n,y:i,viewportX:s,viewportY:o,clientX:d,clientY:g},picked:[]}),v=p.picked;return v[v.length-1]!==this.documentElement&&v.push(this.documentElement),v}},{key:"elementsFromPoint",value:function(){var e=Fs(jn().mark(function i(a,s){var o,l,u,c,h,d,g,p,v,m,b;return jn().wrap(function(x){for(;;)switch(x.prev=x.next){case 0:if(o=this.defaultView.canvas2Viewport({x:a,y:s}),l=o.x,u=o.y,c=this.defaultView.getConfig(),h=c.width,d=c.height,!(l<0||u<0||l>h||u>d)){x.next=4;break}return x.abrupt("return",[]);case 4:return g=this.defaultView.viewport2Client({x:l,y:u}),p=g.x,v=g.y,x.next=7,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!1,position:{x:a,y:s,viewportX:l,viewportY:u,clientX:p,clientY:v},picked:[]});case 7:return m=x.sent,b=m.picked,b[b.length-1]!==this.documentElement&&b.push(this.documentElement),x.abrupt("return",b);case 11:case"end":return x.stop()}},i,this)}));function n(i,a){return e.apply(this,arguments)}return n}()},{key:"appendChild",value:function(n,i){throw new Error(ml)}},{key:"insertBefore",value:function(n,i){throw new Error(ml)}},{key:"removeChild",value:function(n,i){throw new Error(ml)}},{key:"replaceChild",value:function(n,i,a){throw new Error(ml)}},{key:"append",value:function(){throw new Error(ml)}},{key:"prepend",value:function(){throw new Error(ml)}},{key:"getElementById",value:function(n){return this.documentElement.getElementById(n)}},{key:"getElementsByName",value:function(n){return this.documentElement.getElementsByName(n)}},{key:"getElementsByTagName",value:function(n){return this.documentElement.getElementsByTagName(n)}},{key:"getElementsByClassName",value:function(n){return this.documentElement.getElementsByClassName(n)}},{key:"querySelector",value:function(n){return this.documentElement.querySelector(n)}},{key:"querySelectorAll",value:function(n){return this.documentElement.querySelectorAll(n)}},{key:"find",value:function(n){return this.documentElement.find(n)}},{key:"findAll",value:function(n){return this.documentElement.findAll(n)}}])}($e),jL=function(){function r(t){at(this,r),this.strategies=t}return it(r,[{key:"apply",value:function(e){var n=e.camera,i=e.renderingService,a=e.renderingContext,s=this.strategies;i.hooks.cull.tap(r.tag,function(o){if(o){var l=o.cullable;return s.length===0?l.visible=a.unculledEntities.indexOf(o.entity)>-1:l.visible=s.every(function(u){return u.isVisible(n,o)}),!o.isCulled()&&o.isVisible()?o:(o.dispatchEvent(new cn(Xt.CULLED)),null)}return o}),i.hooks.afterRender.tap(r.tag,function(o){o.cullable.visibilityPlaneMask=-1})}}])}();jL.tag="Culling";var qL=function(){function r(){var t=this;at(this,r),this.autoPreventDefault=!1,this.rootPointerEvent=new Cf(null),this.rootWheelEvent=new Aw(null),this.onPointerMove=function(e){var n,i=(n=t.context.renderingContext.root)===null||n===void 0||(n=n.ownerDocument)===null||n===void 0?void 0:n.defaultView;if(!(i.supportsTouchEvents&&e.pointerType==="touch")){var a=t.normalizeToPointerEvent(e,i),s=vo(a),o;try{for(s.s();!(o=s.n()).done;){var l=o.value,u=t.bootstrapEvent(t.rootPointerEvent,l,i,e);t.context.eventService.mapEvent(u)}}catch(c){s.e(c)}finally{s.f()}t.setCursor(t.context.eventService.cursor)}},this.onClick=function(e){var n,i=(n=t.context.renderingContext.root)===null||n===void 0||(n=n.ownerDocument)===null||n===void 0?void 0:n.defaultView,a=t.normalizeToPointerEvent(e,i),s=vo(a),o;try{for(s.s();!(o=s.n()).done;){var l=o.value,u=t.bootstrapEvent(t.rootPointerEvent,l,i,e);t.context.eventService.mapEvent(u)}}catch(c){s.e(c)}finally{s.f()}t.setCursor(t.context.eventService.cursor)}}return it(r,[{key:"apply",value:function(e){var n=this;this.context=e;var i=e.renderingService,a=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler(function(s){var o=n.context.renderingService.hooks.pickSync.call({position:s,picked:[],topmost:!0}),l=o.picked;return l[0]||null}),i.hooks.pointerWheel.tap(r.tag,function(s){var o=n.normalizeWheelEvent(s);n.context.eventService.mapEvent(o)}),i.hooks.pointerDown.tap(r.tag,function(s){if(!(a.supportsTouchEvents&&s.pointerType==="touch")){var o=n.normalizeToPointerEvent(s,a);if(n.autoPreventDefault&&o[0].isNormalized){var l=s.cancelable||!("cancelable"in s);l&&s.preventDefault()}var u=vo(o),c;try{for(u.s();!(c=u.n()).done;){var h=c.value,d=n.bootstrapEvent(n.rootPointerEvent,h,a,s);n.context.eventService.mapEvent(d)}}catch(g){u.e(g)}finally{u.f()}n.setCursor(n.context.eventService.cursor)}}),i.hooks.pointerUp.tap(r.tag,function(s){if(!(a.supportsTouchEvents&&s.pointerType==="touch")){var o=n.context.contextService.getDomElement(),l=n.context.eventService.isNativeEventFromCanvas(o,s),u=l?"":"outside",c=n.normalizeToPointerEvent(s,a),h=vo(c),d;try{for(h.s();!(d=h.n()).done;){var g=d.value,p=n.bootstrapEvent(n.rootPointerEvent,g,a,s);p.type+=u,n.context.eventService.mapEvent(p)}}catch(v){h.e(v)}finally{h.f()}n.setCursor(n.context.eventService.cursor)}}),i.hooks.pointerMove.tap(r.tag,this.onPointerMove),i.hooks.pointerOver.tap(r.tag,this.onPointerMove),i.hooks.pointerOut.tap(r.tag,this.onPointerMove),i.hooks.click.tap(r.tag,this.onClick),i.hooks.pointerCancel.tap(r.tag,function(s){var o=n.normalizeToPointerEvent(s,a),l=vo(o),u;try{for(l.s();!(u=l.n()).done;){var c=u.value,h=n.bootstrapEvent(n.rootPointerEvent,c,a,s);n.context.eventService.mapEvent(h)}}catch(d){l.e(d)}finally{l.f()}n.setCursor(n.context.eventService.cursor)})}},{key:"bootstrapEvent",value:function(e,n,i,a){e.view=i,e.originalEvent=null,e.nativeEvent=a,e.pointerId=n.pointerId,e.width=n.width,e.height=n.height,e.isPrimary=n.isPrimary,e.pointerType=n.pointerType,e.pressure=n.pressure,e.tangentialPressure=n.tangentialPressure,e.tiltX=n.tiltX,e.tiltY=n.tiltY,e.twist=n.twist,this.transferMouseData(e,n);var s=this.context.eventService.client2Viewport({x:n.clientX,y:n.clientY}),o=s.x,l=s.y;e.viewport.x=o,e.viewport.y=l;var u=this.context.eventService.viewport2Canvas(e.viewport),c=u.x,h=u.y;return e.canvas.x=c,e.canvas.y=h,e.global.copyFrom(e.canvas),e.offset.copyFrom(e.canvas),e.isTrusted=a.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=BH[e.type]||e.type),e}},{key:"normalizeWheelEvent",value:function(e){var n=this.rootWheelEvent;this.transferMouseData(n,e),n.deltaMode=e.deltaMode,n.deltaX=e.deltaX,n.deltaY=e.deltaY,n.deltaZ=e.deltaZ;var i=this.context.eventService.client2Viewport({x:e.clientX,y:e.clientY}),a=i.x,s=i.y;n.viewport.x=a,n.viewport.y=s;var o=this.context.eventService.viewport2Canvas(n.viewport),l=o.x,u=o.y;return n.canvas.x=l,n.canvas.y=u,n.global.copyFrom(n.canvas),n.offset.copyFrom(n.canvas),n.nativeEvent=e,n.type=e.type,n}},{key:"transferMouseData",value:function(e,n){e.isTrusted=n.isTrusted,e.srcElement=n.srcElement,e.timeStamp=Ow.now(),e.type=n.type,e.altKey=n.altKey,e.metaKey=n.metaKey,e.shiftKey=n.shiftKey,e.ctrlKey=n.ctrlKey,e.button=n.button,e.buttons=n.buttons,e.client.x=n.clientX,e.client.y=n.clientY,e.movement.x=n.movementX,e.movement.y=n.movementY,e.page.x=n.pageX,e.page.y=n.pageY,e.screen.x=n.screenX,e.screen.y=n.screenY,e.relatedTarget=null}},{key:"setCursor",value:function(e){this.context.contextService.applyCursorStyle(e||this.context.config.cursor||"default")}},{key:"normalizeToPointerEvent",value:function(e,n){var i=[];if(n.isTouchEvent(e))for(var a=0;a<e.changedTouches.length;a++){var s=e.changedTouches[a];Pt(s.button)&&(s.button=0),Pt(s.buttons)&&(s.buttons=1),Pt(s.isPrimary)&&(s.isPrimary=e.touches.length===1&&e.type==="touchstart"),Pt(s.width)&&(s.width=s.radiusX||1),Pt(s.height)&&(s.height=s.radiusY||1),Pt(s.tiltX)&&(s.tiltX=0),Pt(s.tiltY)&&(s.tiltY=0),Pt(s.pointerType)&&(s.pointerType="touch"),Pt(s.pointerId)&&(s.pointerId=s.identifier||0),Pt(s.pressure)&&(s.pressure=s.force||.5),Pt(s.twist)&&(s.twist=0),Pt(s.tangentialPressure)&&(s.tangentialPressure=0),s.isNormalized=!0,s.type=e.type,i.push(s)}else if(n.isMouseEvent(e)){var o=e;Pt(o.isPrimary)&&(o.isPrimary=!0),Pt(o.width)&&(o.width=1),Pt(o.height)&&(o.height=1),Pt(o.tiltX)&&(o.tiltX=0),Pt(o.tiltY)&&(o.tiltY=0),Pt(o.pointerType)&&(o.pointerType="mouse"),Pt(o.pointerId)&&(o.pointerId=FH),Pt(o.pressure)&&(o.pressure=.5),Pt(o.twist)&&(o.twist=0),Pt(o.tangentialPressure)&&(o.tangentialPressure=0),o.isNormalized=!0,i.push(o)}else i.push(e);return i}}])}();qL.tag="Event";var nY=[Q.CIRCLE,Q.ELLIPSE,Q.IMAGE,Q.RECT,Q.LINE,Q.POLYLINE,Q.POLYGON,Q.TEXT,Q.PATH,Q.HTML],rY=function(){function r(){at(this,r)}return it(r,[{key:"isVisible",value:function(e,n){var i,a=n.cullable;if(!a.enable)return!0;var s=n.getRenderBounds();if(Me.isEmpty(s))return!1;var o=e.getFrustum(),l=(i=n.parentNode)===null||i===void 0||(i=i.cullable)===null||i===void 0?void 0:i.visibilityPlaneMask;return a.visibilityPlaneMask=this.computeVisibilityWithPlaneMask(n,s,l||vl.INDETERMINATE,o.planes),a.visible=a.visibilityPlaneMask!==vl.OUTSIDE,a.visible}},{key:"computeVisibilityWithPlaneMask",value:function(e,n,i,a){if(i===vl.OUTSIDE||i===vl.INSIDE)return i;for(var s=vl.INSIDE,o=nY.indexOf(e.nodeName)>-1,l=0,u=a.length;l<u;++l){var c=1<<l;if(i&c&&!(o&&(l===4||l===5))){var h=a[l],d=h.normal,g=h.distance;if(ta(d,n.getPositiveFarPoint(a[l]))+g<0)return vl.OUTSIDE;ta(d,n.getNegativeFarPoint(a[l]))+g<0&&(s|=c)}}return s}}])}(),WL=function(){function r(){at(this,r),this.syncTasks=new Map,this.isFirstTimeRendering=!0,this.syncing=!1,this.isFirstTimeRenderingFinished=!1}return it(r,[{key:"apply",value:function(e){var n=this,i,a=e.renderingService,s=e.renderingContext,o=e.rBushRoot,l=s.root.ownerDocument.defaultView;this.rBush=o;var u=function(v){var m=v.target;m.renderable.dirty=!0,a.dirtify()},c=function(v){n.syncTasks.set(v.target,v.detail.affectChildren),a.dirtify()},h=function(v){var m=v.target;st.enableSizeAttenuation&&st.styleValueRegistry.updateSizeAttenuation(m,l.getCamera().getZoom())},d=function(v){var m=v.target,b=m.rBushNode;b.aabb&&n.rBush.remove(b.aabb),n.syncTasks.delete(m),st.sceneGraphService.dirtifyToRoot(m),a.dirtify()};a.hooks.init.tap(r.tag,function(){l.addEventListener(Xt.MOUNTED,h),l.addEventListener(Xt.UNMOUNTED,d),l.addEventListener(Xt.ATTR_MODIFIED,u),l.addEventListener(Xt.BOUNDS_CHANGED,c)}),a.hooks.destroy.tap(r.tag,function(){l.removeEventListener(Xt.MOUNTED,h),l.removeEventListener(Xt.UNMOUNTED,d),l.removeEventListener(Xt.ATTR_MODIFIED,u),l.removeEventListener(Xt.BOUNDS_CHANGED,c),n.syncTasks.clear()});var g=(i=st.globalThis.requestIdleCallback)!==null&&i!==void 0?i:zx.bind(st.globalThis);a.hooks.endFrame.tap(r.tag,function(){n.isFirstTimeRendering?(n.isFirstTimeRendering=!1,n.syncing=!0,g(function(){n.syncRTree(!0),n.isFirstTimeRenderingFinished=!0})):n.syncRTree()})}},{key:"syncNode",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(e.isConnected){var i=e.rBushNode;i.aabb&&this.rBush.remove(i.aabb);var a=e.getRenderBounds();if(a){var s=e.renderable;n&&(s.dirtyRenderBounds||(s.dirtyRenderBounds=new Me),s.dirtyRenderBounds.update(a.center,a.halfExtents));var o=a.getMin(),l=Rt(o,2),u=l[0],c=l[1],h=a.getMax(),d=Rt(h,2),g=d[0],p=d[1];i.aabb||(i.aabb={}),i.aabb.displayObject=e,i.aabb.minX=u,i.aabb.minY=c,i.aabb.maxX=g,i.aabb.maxY=p}if(i.aabb&&!isNaN(i.aabb.maxX)&&!isNaN(i.aabb.maxX)&&!isNaN(i.aabb.minX)&&!isNaN(i.aabb.minY))return i.aabb}}},{key:"syncRTree",value:function(){var e=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!(!n&&(this.syncing||this.syncTasks.size===0))){this.syncing=!0;var i=[],a=new Set,s=function(l){if(!a.has(l)&&l.renderable){var u=e.syncNode(l,n);u&&(i.push(u),a.add(l))}};this.syncTasks.forEach(function(o,l){o&&l.forEach(s);for(var u=l;u;)s(u),u=u.parentElement}),this.rBush.load(i),i.length=0,this.syncing=!1}}}])}();WL.tag="Prepare";var $r=function(r){return r.READY="ready",r.BEFORE_RENDER="beforerender",r.RERENDER="rerender",r.AFTER_RENDER="afterrender",r.BEFORE_DESTROY="beforedestroy",r.AFTER_DESTROY="afterdestroy",r.RESIZE="resize",r.DIRTY_RECTANGLE="dirtyrectangle",r.RENDERER_CHANGED="rendererchanged",r}({}),kM=500,iY=.1,aY=1e3,ed=new cn(Xt.MOUNTED),nd=new cn(Xt.UNMOUNTED),Pv=new cn($r.BEFORE_RENDER),CM=new cn($r.RERENDER),Nv=new cn($r.AFTER_RENDER),Rw=function(r){function t(e){var n;at(this,t),n=Wt(this,t),n.Element=Ne,n.inited=!1,n.context={};var i=e.container,a=e.canvas,s=e.renderer,o=e.width,l=e.height,u=e.background,c=e.cursor,h=e.supportsMutipleCanvasesInOneContainer,d=e.cleanUpOnDestroy,g=d===void 0?!0:d,p=e.offscreenCanvas,v=e.devicePixelRatio,m=e.requestAnimationFrame,b=e.cancelAnimationFrame,w=e.createImage,x=e.supportsTouchEvents,S=e.supportsPointerEvents,_=e.isTouchEvent,M=e.isMouseEvent,k=e.dblClickSpeed,C=o,P=l,T=v||Bx&&window.devicePixelRatio||1;return T=T>=1?Math.ceil(T):1,a&&(C=o||IH(a)||a.width/T,P=l||DH(a)||a.height/T),n.customElements=new eY,n.devicePixelRatio=T,n.requestAnimationFrame=m??zx.bind(st.globalThis),n.cancelAnimationFrame=b??IL.bind(st.globalThis),n.supportsTouchEvents=x??"ontouchstart"in st.globalThis,n.supportsPointerEvents=S??!!st.globalThis.PointerEvent,n.isTouchEvent=_??function(A){return n.supportsTouchEvents&&A instanceof st.globalThis.TouchEvent},n.isMouseEvent=M??function(A){return!st.globalThis.MouseEvent||A instanceof st.globalThis.MouseEvent&&(!n.supportsPointerEvents||!(A instanceof st.globalThis.PointerEvent))},p&&(st.offscreenCanvas=p),n.document=new $L,n.document.defaultView=n,h||PH(i,n,g),n.initRenderingContext(Bt(Bt({},e),{},{width:C,height:P,background:u??"transparent",cursor:c??"default",cleanUpOnDestroy:g,devicePixelRatio:T,requestAnimationFrame:n.requestAnimationFrame,cancelAnimationFrame:n.cancelAnimationFrame,supportsTouchEvents:n.supportsTouchEvents,supportsPointerEvents:n.supportsPointerEvents,isTouchEvent:n.isTouchEvent,isMouseEvent:n.isMouseEvent,dblClickSpeed:k??200,createImage:w??function(){return new window.Image}})),n.initDefaultCamera(C,P,s.clipSpaceNearZ),n.initRenderer(s,!0),n}return qt(t,r),it(t,[{key:"initRenderingContext",value:function(n){this.context.config=n,this.context.renderingContext={root:this.document.documentElement,renderListCurrentFrame:[],unculledEntities:[],renderReasons:new Set,force:!1,dirty:!1}}},{key:"initDefaultCamera",value:function(n,i,a){var s=this,o=new st.CameraContribution;o.clipSpaceNearZ=a,o.setType(ge.EXPLORING,xw.DEFAULT).setPosition(n/2,i/2,kM).setFocalPoint(n/2,i/2,0).setOrthographic(n/-2,n/2,i/2,i/-2,iY,aY),o.canvas=this,o.eventEmitter.on(cL.UPDATED,function(){s.context.renderingContext.renderReasons.add(zl.CAMERA_CHANGED),st.enableSizeAttenuation&&s.getConfig().renderer.getConfig().enableSizeAttenuation&&s.updateSizeAttenuation()}),this.context.camera=o}},{key:"updateSizeAttenuation",value:function(){var n=this.getCamera().getZoom();this.document.documentElement.forEach(function(i){st.styleValueRegistry.updateSizeAttenuation(i,n)})}},{key:"getConfig",value:function(){return this.context.config}},{key:"getRoot",value:function(){return this.document.documentElement}},{key:"getCamera",value:function(){return this.context.camera}},{key:"getContextService",value:function(){return this.context.contextService}},{key:"getEventService",value:function(){return this.context.eventService}},{key:"getRenderingService",value:function(){return this.context.renderingService}},{key:"getRenderingContext",value:function(){return this.context.renderingContext}},{key:"getStats",value:function(){return this.getRenderingService().getStats()}},{key:"ready",get:function(){var n=this;return this.readyPromise||(this.readyPromise=new Promise(function(i){n.resolveReadyPromise=function(){i(n)}}),this.inited&&this.resolveReadyPromise()),this.readyPromise}},{key:"destroy",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,i=arguments.length>1?arguments[1]:void 0;pn.clearCache(),i||this.dispatchEvent(new cn($r.BEFORE_DESTROY)),this.frameId&&this.cancelAnimationFrame(this.frameId);var a=this.getRoot();n&&(this.unmountChildren(a),this.document.destroy(),this.getEventService().destroy()),this.getRenderingService().destroy(),this.getContextService().destroy(),this.context.rBushRoot&&this.context.rBushRoot.clear(),i||this.dispatchEvent(new cn($r.AFTER_DESTROY));var s=function(l){l.currentTarget=null,l.manager=null,l.target=null,l.relatedNode=null};s(ed),s(nd),s(Pv),s(CM),s(Nv),s(Ki),s(Pw),s(Nw),s(zL)}},{key:"changeSize",value:function(n,i){this.resize(n,i)}},{key:"resize",value:function(n,i){var a=this.context.config;a.width=n,a.height=i,this.getContextService().resize(n,i);var s=this.context.camera,o=s.getProjectionMode();s.setPosition(n/2,i/2,kM).setFocalPoint(n/2,i/2,0),o===ci.ORTHOGRAPHIC?s.setOrthographic(n/-2,n/2,i/2,i/-2,s.getNear(),s.getFar()):s.setAspect(n/i),this.dispatchEvent(new cn($r.RESIZE,{width:n,height:i}))}},{key:"appendChild",value:function(n,i){return this.document.documentElement.appendChild(n,i)}},{key:"insertBefore",value:function(n,i){return this.document.documentElement.insertBefore(n,i)}},{key:"removeChild",value:function(n){return this.document.documentElement.removeChild(n)}},{key:"removeChildren",value:function(){this.document.documentElement.removeChildren()}},{key:"destroyChildren",value:function(){this.document.documentElement.destroyChildren()}},{key:"render",value:function(n){var i=this;n&&(Pv.detail=n,Nv.detail=n),this.dispatchEvent(Pv);var a=this.getRenderingService();a.render(this.getConfig(),n,function(){i.dispatchEvent(CM)}),this.dispatchEvent(Nv)}},{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 RG,this.context.renderingPlugins=[],this.context.renderingPlugins.push(new qL,new WL,new jL([new rY])),this.loadRendererContainerModule(n),this.context.contextService=new this.context.ContextService(Bt(Bt({},st),this.context)),this.context.renderingService=new mU(st,this.context),this.context.eventService=new vU(st,this.context),this.context.eventService.init(),this.context.contextService.init?(this.context.contextService.init(),this.initRenderingService(n,a,!0)):this.context.contextService.initAsync().then(function(){i.initRenderingService(n,a)}).catch(function(s){console.error(s)})}},{key:"initRenderingService",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.context.renderingService.init(function(){i.inited=!0,a?s?i.requestAnimationFrame(function(){i.dispatchEvent(new cn($r.READY))}):i.dispatchEvent(new cn($r.READY)):i.dispatchEvent(new cn($r.RENDERER_CHANGED)),i.readyPromise&&i.resolveReadyPromise(),a||i.getRoot().forEach(function(o){var l=o,u=l.renderable;u&&(u.renderBoundsDirty=!0,u.boundsDirty=!0,u.dirty=!0)}),i.mountChildren(i.getRoot()),n.getConfig().enableAutoRendering&&i.run()})}},{key:"loadRendererContainerModule",value:function(n){var i=this,a=n.getPlugins();a.forEach(function(s){s.context=i.context,s.init(st)})}},{key:"setRenderer",value:function(n){var i=this.getConfig();if(i.renderer!==n){var a=i.renderer;i.renderer=n,this.destroy(!1,!0),Ce((a==null?void 0:a.getPlugins())||[]).reverse().forEach(function(s){s.destroy(st)}),this.initRenderer(n)}}},{key:"setCursor",value:function(n){var i=this.getConfig();i.cursor=n,this.getContextService().applyCursorStyle(n)}},{key:"unmountChildren",value:function(n){var i=this;n.childNodes.forEach(function(a){i.unmountChildren(a)}),this.inited&&(n.isMutationObserved?n.dispatchEvent(nd):(nd.target=n,this.dispatchEvent(nd,!0)),n!==this.document.documentElement&&(n.ownerDocument=null),n.isConnected=!1),n.isCustomElement&&n.disconnectedCallback&&n.disconnectedCallback()}},{key:"mountChildren",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kf(n);this.inited?n.isConnected||(n.ownerDocument=this.document,n.isConnected=!0,a||(n.isMutationObserved?n.dispatchEvent(ed):(ed.target=n,this.dispatchEvent(ed,!0)))):console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.","appended child: ",n.nodeName),n.childNodes.forEach(function(s){i.mountChildren(s,a)}),n.isCustomElement&&n.connectedCallback&&n.connectedCallback()}},{key:"mountFragment",value:function(n){this.mountChildren(n,!1)}},{key:"client2Viewport",value:function(n){return this.getEventService().client2Viewport(n)}},{key:"viewport2Client",value:function(n){return this.getEventService().viewport2Client(n)}},{key:"viewport2Canvas",value:function(n){return this.getEventService().viewport2Canvas(n)}},{key:"canvas2Viewport",value:function(n){return this.getEventService().canvas2Viewport(n)}},{key:"getPointByClient",value:function(n,i){return this.client2Viewport({x:n,y:i})}},{key:"getClientByPoint",value:function(n,i){return this.viewport2Client({x:n,y:i})}}])}(BL);/*!
- * @antv/g-camera-api
- * @description A simple implementation of Camera API.
- * @version 2.0.35
- * @date 1/23/2025, 8:32:08 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var sY=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Wt(this,t,[].concat(i)),e.landmarks=[],e}return qt(t,r),it(t,[{key:"rotate",value:function(n,i,a){if(this.relElevation=Dl(i),this.relAzimuth=Dl(n),this.relRoll=Dl(a),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.type===ge.EXPLORING){var s=Es(wn(),[1,0,0],me((this.rotateWorld?1:-1)*this.relElevation)),o=Es(wn(),[0,1,0],me((this.rotateWorld?1:-1)*this.relAzimuth)),l=Es(wn(),[0,0,1],me(this.relRoll)),u=Ps(wn(),o,s);u=Ps(wn(),u,l);var c=Ox(Se(),u);Il(this.matrix,this.matrix,[0,0,-this.distance]),Jn(this.matrix,this.matrix,c),Il(this.matrix,this.matrix,[0,0,this.distance])}else{if(Math.abs(this.elevation)>90)return this;this.computeMatrix()}return this._getAxes(),this.type===ge.ORBITING||this.type===ge.EXPLORING?this._getPosition():this.type===ge.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(n,i){var a=ar(n,i,0),s=_a(this.position);return As(s,s,ff(Qt(),this.right,a[0])),As(s,s,ff(Qt(),this.up,a[1])),this._setPosition(s),this.triggerUpdate(),this}},{key:"dolly",value:function(n){var i=this.forward,a=_a(this.position),s=n*this.dollyingStep,o=this.distance+n*this.dollyingStep;return s=Math.max(Math.min(o,this.maxDistance),this.minDistance)-this.distance,a[0]+=s*i[0],a[1]+=s*i[1],a[2]+=s*i[2],this._setPosition(a),this.type===ge.ORBITING||this.type===ge.EXPLORING?this._getDistance():this.type===ge.TRACKING&&As(this.focalPoint,a,this.distanceVector),this.triggerUpdate(),this}},{key:"cancelLandmarkAnimation",value:function(){this.landmarkAnimationID!==void 0&&this.canvas.cancelAnimationFrame(this.landmarkAnimationID)}},{key:"createLandmark",value:function(n){var i,a,s,o,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=l.position,c=u===void 0?this.position:u,h=l.focalPoint,d=h===void 0?this.focalPoint:h,g=l.roll,p=l.zoom,v=new st.CameraContribution;v.setType(this.type,void 0),v.setPosition(c[0],(i=c[1])!==null&&i!==void 0?i:this.position[1],(a=c[2])!==null&&a!==void 0?a:this.position[2]),v.setFocalPoint(d[0],(s=d[1])!==null&&s!==void 0?s:this.focalPoint[1],(o=d[2])!==null&&o!==void 0?o:this.focalPoint[2]),v.setRoll(g??this.roll),v.setZoom(p??this.zoom);var m={name:n,matrix:CR(v.getWorldTransform()),right:_a(v.right),up:_a(v.up),forward:_a(v.forward),position:_a(v.getPosition()),focalPoint:_a(v.getFocalPoint()),distanceVector:_a(v.getDistanceVector()),distance:v.getDistance(),dollyingStep:v.getDollyingStep(),azimuth:v.getAzimuth(),elevation:v.getElevation(),roll:v.getRoll(),relAzimuth:v.relAzimuth,relElevation:v.relElevation,relRoll:v.relRoll,zoom:v.getZoom()};return this.landmarks.push(m),m}},{key:"gotoLandmark",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=oe(n)?this.landmarks.find(function(A){return A.name===n}):n;if(s){var o=bt(a)?{duration:a}:a,l=o.easing,u=l===void 0?"linear":l,c=o.duration,h=c===void 0?100:c,d=o.easingFunction,g=d===void 0?void 0:d,p=o.onfinish,v=p===void 0?void 0:p,m=o.onframe,b=m===void 0?void 0:m,w=.01;this.cancelLandmarkAnimation();var x=s.position,S=s.focalPoint,_=s.zoom,M=s.roll,k=g||st.EasingFunction(u),C,P=function(){i.setFocalPoint(S),i.setPosition(x),i.setRoll(M),i.setZoom(_),i.computeMatrix(),i.triggerUpdate(),v==null||v()};if(h===0)return P();var T=function(R){C===void 0&&(C=R);var L=R-C;if(L>=h){P();return}var $=k(L/h),q=Qt(),j=Qt(),B=1,D=0;cw(q,i.focalPoint,S,$),cw(j,i.position,x,$),D=i.roll*(1-$)+M*$,B=i.zoom*(1-$)+_*$,i.setFocalPoint(q),i.setPosition(j),i.setRoll(D),i.setZoom(B);var G=F3(q,S)+F3(j,x);if(G<=w&&_===void 0&&M===void 0)return P();i.computeMatrix(),i.triggerUpdate(),L<h&&(b==null||b($),i.landmarkAnimationID=i.canvas.requestAnimationFrame(T))};this.canvas.requestAnimationFrame(T)}}}])}(hL);st.CameraContribution=sY;/*!
- * @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 Rv=function(r){function t(e,n,i,a){var s;return at(this,t),s=Wt(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 qt(t,r),it(t)}(l0),oY=0,lY=function(){function r(t,e){var n;at(this,r),this.currentTimePending=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._playbackRate=1,this._inTimeline=!0,this.effect=t,t.animation=this,this.timeline=e,this.id="".concat(oY++),this._inEffect=!!this.effect.update(0),this._totalDuration=Number((n=this.effect)===null||n===void 0?void 0:n.getComputedTiming().endTime),this._holdTime=0,this._paused=!1,this.oldPlayState="idle",this.updatePromises()}return it(r,[{key:"pending",get:function(){return this._startTime===null&&!this._paused&&this.playbackRate!==0||this.currentTimePending}},{key:"playState",get:function(){return this._idle?"idle":this._isFinished?"finished":this._paused?"paused":"running"}},{key:"ready",get:function(){var e=this;return this.readyPromise||(this.timeline.animationsWithPromises.indexOf(this)===-1&&this.timeline.animationsWithPromises.push(this),this.readyPromise=new Promise(function(n,i){e.resolveReadyPromise=function(){n(e)},e.rejectReadyPromise=function(){i(new Error)}}),this.pending||this.resolveReadyPromise()),this.readyPromise}},{key:"finished",get:function(){var e=this;return this.finishedPromise||(this.timeline.animationsWithPromises.indexOf(this)===-1&&this.timeline.animationsWithPromises.push(this),this.finishedPromise=new Promise(function(n,i){e.resolveFinishedPromise=function(){n(e)},e.rejectFinishedPromise=function(){i(new Error)}}),this.playState==="finished"&&this.resolveFinishedPromise()),this.finishedPromise}},{key:"currentTime",get:function(){return this.updatePromises(),this._idle||this.currentTimePending?null:this._currentTime},set:function(e){if(e=Number(e),!isNaN(e)){if(this.timeline.restart(),!this._paused&&this._startTime!==null){var n;this._startTime=Number((n=this.timeline)===null||n===void 0?void 0:n.currentTime)-e/this.playbackRate}this.currentTimePending=!1,this._currentTime!==e&&(this._idle&&(this._idle=!1,this._paused=!0),this.tickCurrentTime(e,!0),this.timeline.applyDirtiedAnimation(this))}}},{key:"startTime",get:function(){return this._startTime},set:function(e){if(e!==null){if(this.updatePromises(),e=Number(e),isNaN(e)||this._paused||this._idle)return;this._startTime=e,this.tickCurrentTime((Number(this.timeline.currentTime)-this._startTime)*this.playbackRate),this.timeline.applyDirtiedAnimation(this),this.updatePromises()}}},{key:"playbackRate",get:function(){return this._playbackRate},set:function(e){if(e!==this._playbackRate){this.updatePromises();var n=this.currentTime;this._playbackRate=e,this.startTime=null,this.playState!=="paused"&&this.playState!=="idle"&&(this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this)),n!==null&&(this.currentTime=n),this.updatePromises()}}},{key:"_isFinished",get:function(){return!this._idle&&(this._playbackRate>0&&Number(this._currentTime)>=this._totalDuration||this._playbackRate<0&&Number(this._currentTime)<=0)}},{key:"totalDuration",get:function(){return this._totalDuration}},{key:"_needsTick",get:function(){return this.pending||this.playState==="running"||!this._finishedFlag}},{key:"updatePromises",value:function(){var e=this.oldPlayState,n=this.pending?"pending":this.playState;return this.readyPromise&&n!==e&&(n==="idle"?(this.rejectReadyPromise(),this.readyPromise=void 0):e==="pending"?this.resolveReadyPromise():n==="pending"&&(this.readyPromise=void 0)),this.finishedPromise&&n!==e&&(n==="idle"?(this.rejectFinishedPromise(),this.finishedPromise=void 0):n==="finished"?this.resolveFinishedPromise():e==="finished"&&(this.finishedPromise=void 0)),this.oldPlayState=n,this.readyPromise||this.finishedPromise}},{key:"play",value:function(){this.updatePromises(),this._paused=!1,(this._isFinished||this._idle)&&(this.rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this),this.timeline.animations.indexOf(this)===-1&&this.timeline.animations.push(this),this.updatePromises()}},{key:"pause",value:function(){this.updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),!this._isFinished&&!this._paused&&!this._idle?this.currentTimePending=!0:this._idle&&(this.rewind(),this._idle=!1),this._startTime=null,this._paused=!0,this.updatePromises()}},{key:"finish",value:function(){this.updatePromises(),!this._idle&&(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this.currentTimePending=!1,this.timeline.applyDirtiedAnimation(this),this.updatePromises())}},{key:"cancel",value:function(){var e=this;if(this.updatePromises(),!!this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises(),this.oncancel)){var n=new Rv(null,this,this.currentTime,null);setTimeout(function(){e.oncancel(n)})}}},{key:"reverse",value:function(){this.updatePromises();var e=this.currentTime;this.playbackRate*=-1,this.play(),e!==null&&(this.currentTime=e),this.updatePromises()}},{key:"updatePlaybackRate",value:function(e){this.playbackRate=e}},{key:"targetAnimations",value:function(){var e,n=(e=this.effect)===null||e===void 0?void 0:e.target;return n.getAnimations()}},{key:"markTarget",value:function(){var e=this.targetAnimations();e.indexOf(this)===-1&&e.push(this)}},{key:"unmarkTarget",value:function(){var e=this.targetAnimations(),n=e.indexOf(this);n!==-1&&e.splice(n,1)}},{key:"tick",value:function(e,n){!this._idle&&!this._paused&&(this._startTime===null?n&&(this.startTime=e-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((e-this._startTime)*this.playbackRate)),n&&(this.currentTimePending=!1,this.fireEvents(e))}},{key:"rewind",value:function(){if(this.playbackRate>=0)this.currentTime=0;else if(this._totalDuration<1/0)this.currentTime=this._totalDuration;else throw new Error("Unable to rewind negative playback rate animation with infinite duration")}},{key:"persist",value:function(){throw new Error(pe)}},{key:"addEventListener",value:function(e,n,i){throw new Error(pe)}},{key:"removeEventListener",value:function(e,n,i){throw new Error(pe)}},{key:"dispatchEvent",value:function(e){throw new Error(pe)}},{key:"commitStyles",value:function(){throw new Error(pe)}},{key:"ensureAlive",value:function(){if(this.playbackRate<0&&this.currentTime===0){var e;this._inEffect=!!((e=this.effect)!==null&&e!==void 0&&e.update(-1))}else{var n;this._inEffect=!!((n=this.effect)!==null&&n!==void 0&&n.update(this.currentTime))}!this._inTimeline&&(this._inEffect||!this._finishedFlag)&&(this._inTimeline=!0,this.timeline.animations.push(this))}},{key:"tickCurrentTime",value:function(e,n){e!==this._currentTime&&(this._currentTime=e,this._isFinished&&!n&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this.ensureAlive())}},{key:"fireEvents",value:function(e){var n=this;if(this._isFinished){if(!this._finishedFlag){if(this.onfinish){var i=new Rv(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 Rv(null,this,this.currentTime,e);this.onframe(a)}this._finishedFlag=!1}}}])}(),uY=4,cY=.001,hY=1e-7,dY=10,zu=11,rd=1/(zu-1),fY=typeof Float32Array=="function",GL=function(t,e){return 1-3*e+3*t},VL=function(t,e){return 3*e-6*t},HL=function(t){return 3*t},Tf=function(t,e,n){return((GL(e,n)*t+VL(e,n))*t+HL(e))*t},UL=function(t,e,n){return 3*GL(e,n)*t*t+2*VL(e,n)*t+HL(e)},gY=function(t,e,n,i,a){var s,o,l=0;do o=e+(n-e)/2,s=Tf(o,i,a)-t,s>0?n=o:e=o;while(Math.abs(s)>hY&&++l<dY);return o},pY=function(t,e,n,i){for(var a=0;a<uY;++a){var s=UL(e,n,i);if(s===0)return e;var o=Tf(e,n,i)-t;e-=o/s}return e},qx=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=fY?new Float32Array(zu):new Array(zu),s=0;s<zu;++s)a[s]=Tf(s*rd,t,n);var o=function(u){for(var c=0,h=1,d=zu-1;h!==d&&a[h]<=u;++h)c+=rd;--h;var g=(u-a[h])/(a[h+1]-a[h]),p=c+g*rd,v=UL(p,t,n);return v>=cY?pY(u,p,t,n):v===0?p:gY(u,c,c+rd,t,n)};return function(l){return l===0||l===1?l:Tf(o(l),e,i)}},vY=function(t){return t=t.replace(/([A-Z])/g,function(e){return"-".concat(e.toLowerCase())}),t.charAt(0)==="-"?t.substring(1):t},id=function(t){return Math.pow(t,2)},ad=function(t){return Math.pow(t,3)},sd=function(t){return Math.pow(t,4)},od=function(t){return Math.pow(t,5)},ld=function(t){return Math.pow(t,6)},ud=function(t){return 1-Math.cos(t*Math.PI/2)},cd=function(t){return 1-Math.sqrt(1-t*t)},hd=function(t){return t*t*(3*t-2)},dd=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)},fd=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=Rt(e,2),i=n[0],a=i===void 0?1:i,s=n[1],o=s===void 0?.5:s,l=Ue(Number(a),1,10),u=Ue(Number(o),.1,2);return t===0||t===1?t:-l*Math.pow(2,10*(t-1))*Math.sin((t-1-u/(Math.PI*2)*Math.asin(1/l))*(Math.PI*2)/u)},Ou=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,i=Rt(e,4),a=i[0],s=a===void 0?1:a,o=i[1],l=o===void 0?100:o,u=i[2],c=u===void 0?10:u,h=i[3],d=h===void 0?0:h;s=Ue(s,.1,1e3),l=Ue(l,.1,1e3),c=Ue(c,.1,1e3),d=Ue(d,.1,1e3);var g=Math.sqrt(l/s),p=c/(2*Math.sqrt(l*s)),v=p<1?g*Math.sqrt(1-p*p):0,m=1,b=p<1?(p*g+-d)/v:-d+g,w=n?n*t/1e3:t;return p<1?w=Math.exp(-w*p*g)*(m*Math.cos(v*w)+b*Math.sin(v*w)):w=(m+b*w)*Math.exp(-w*g),t===0||t===1?t:1-w},Lv=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=e,i=Rt(n,2),a=i[0],s=a===void 0?10:a,o=i[1],l=o==="start"?Math.ceil:Math.floor;return l(Ue(t,0,1)*s)/s},TM=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=Rt(e,4),i=n[0],a=n[1],s=n[2],o=n[3];return qx(i,a,s,o)(t)},gd=qx(.42,0,1,1),si=function(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return 1-t(1-e,n,i)}},oi=function(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return e<.5?t(e*2,n,i)/2:1-t(e*-2+2,n,i)/2}},li=function(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return e<.5?(1-t(1-e*2,n,i))/2:(t(e*2-1,n,i)+1)/2}},OM={steps:Lv,"step-start":function(t){return Lv(t,[1,"start"])},"step-end":function(t){return Lv(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":TM,ease:function(t){return TM(t,[.25,.1,.25,1])},in:gd,out:si(gd),"in-out":oi(gd),"out-in":li(gd),"in-quad":id,"out-quad":si(id),"in-out-quad":oi(id),"out-in-quad":li(id),"in-cubic":ad,"out-cubic":si(ad),"in-out-cubic":oi(ad),"out-in-cubic":li(ad),"in-quart":sd,"out-quart":si(sd),"in-out-quart":oi(sd),"out-in-quart":li(sd),"in-quint":od,"out-quint":si(od),"in-out-quint":oi(od),"out-in-quint":li(od),"in-expo":ld,"out-expo":si(ld),"in-out-expo":oi(ld),"out-in-expo":li(ld),"in-sine":ud,"out-sine":si(ud),"in-out-sine":oi(ud),"out-in-sine":li(ud),"in-circ":cd,"out-circ":si(cd),"in-out-circ":oi(cd),"out-in-circ":li(cd),"in-back":hd,"out-back":si(hd),"in-out-back":oi(hd),"out-in-back":li(hd),"in-bounce":dd,"out-bounce":si(dd),"in-out-bounce":oi(dd),"out-in-bounce":li(dd),"in-elastic":fd,"out-elastic":si(fd),"in-out-elastic":oi(fd),"out-in-elastic":li(fd),spring:Ou,"spring-in":Ou,"spring-out":si(Ou),"spring-in-out":oi(Ou),"spring-out-in":li(Ou)},mY=function(t){return vY(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()},yY=function(t){return OM[mY(t)]||OM.linear},bY=function(t){return t},wY=1,xY=.5,AM=0;function PM(r,t){return function(e){if(e>=1)return 1;var n=1/r;return e+=t*n,e-e%n}}var pd="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",EY=new RegExp("cubic-bezier\\(".concat(pd,",").concat(pd,",").concat(pd,",").concat(pd,"\\)")),_Y=/steps\(\s*(\d+)\s*\)/,SY=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function Wx(r){var t=EY.exec(r);if(t)return qx.apply(void 0,Ce(t.slice(1).map(Number)));var e=_Y.exec(r);if(e)return PM(Number(e[1]),AM);var n=SY.exec(r);return n?PM(Number(n[1]),{start:wY,middle:xY,end:AM}[n[2]]):yY(r)}function MY(r){return Math.abs(kY(r)/(r.playbackRate||1))}function kY(r){var t;return r.duration===0||r.iterations===0?0:(r.duration==="auto"?0:Number(r.duration))*((t=r.iterations)!==null&&t!==void 0?t:1)}var YL=0,Gx=1,c0=2,XL=3;function CY(r,t,e){if(t===null)return YL;var n=e.endTime;return t<Math.min(e.delay,n)?Gx:t>=Math.min(e.delay+r+e.endDelay,n)?c0:XL}function TY(r,t,e,n,i){switch(n){case Gx:return t==="backwards"||t==="both"?0:null;case XL:return e-i;case c0:return t==="forwards"||t==="both"?r:null;case YL:return null}}function OY(r,t,e,n,i){var a=i;return r===0?t!==Gx&&(a+=e):a+=n/r,a}function AY(r,t,e,n,i,a){var s=r===1/0?t%1:r%1;return s===0&&e===c0&&n!==0&&(i!==0||a===0)&&(s=1),s}function PY(r,t,e,n){return r===c0&&t===1/0?1/0:e===1?Math.floor(n)-1:Math.floor(n)}function NY(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 RY(r,t,e){var n=CY(r,t,e),i=TY(r,e.fill,t,n,e.delay);if(i===null)return null;var a=e.duration==="auto"?0:e.duration,s=OY(a,n,e.iterations,i,e.iterationStart),o=AY(s,e.iterationStart,n,e.iterations,i,a),l=PY(n,e.iterations,o,s),u=NY(e.direction,l,o);return e.currentIteration=l,e.progress=u,e.easingFunction(u)}function LY(r,t,e){var n=IY(r,t),i=DY(n,e);return function(a,s){if(s!==null)i.filter(function(l){return s>=l.applyFrom&&s<l.applyTo}).forEach(function(l){var u=s-l.startOffset,c=l.endOffset-l.startOffset,h=c===0?0:u/c;a.setAttribute(l.property,l.interpolation(h),!1,!1)});else for(var o in n)KL(o)&&a.setAttribute(o,null)}}function KL(r){return r!=="offset"&&r!=="easing"&&r!=="composite"&&r!=="computedOffset"}function IY(r,t){for(var e={},n=0;n<r.length;n++)for(var i in r[n])if(KL(i)){var a={offset:r[n].offset,computedOffset:r[n].computedOffset,easing:r[n].easing,easingFunction:Wx(r[n].easing)||t.easingFunction,value:r[n][i]};e[i]=e[i]||[],e[i].push(a)}return e}function DY(r,t){var e=[];for(var n in r)for(var i=r[n],a=0;a<i.length-1;a++){var s=a,o=a+1,l=i[s].computedOffset,u=i[o].computedOffset,c=l,h=u;a===0&&(c=-1/0,u===0&&(o=s)),a===i.length-2&&(h=1/0,l===1&&(s=o)),e.push({applyFrom:c,applyTo:h,startOffset:i[s].computedOffset,endOffset:i[o].computedOffset,easingFunction:i[s].easingFunction,property:n,interpolation:FY(n,i[s].value,i[o].value,t)})}return e.sort(function(d,g){return d.startOffset-g.startOffset}),e}var NM=function(t,e,n){return function(i){var a=ZL(t,e,i);return bt(a)?a:n(a)}};function FY(r,t,e,n){var i=TL[r];if(i&&i.syntax&&i.int){var a=st.styleValueRegistry.getPropertySyntax(i.syntax);if(a){var s=a.parser,o=s?s(t,n):t,l=s?s(e,n):e,u=a.mixer(o,l,n);if(u){var c=NM.apply(void 0,Ce(u));return function(h){return h===0?t:h===1?e:c(h)}}}}return NM(!1,!0,function(h){return h?e:t})}function ZL(r,t,e){if(typeof r=="number"&&typeof t=="number")return r*(1-e)+t*e;if(typeof r=="boolean"&&typeof t=="boolean"||typeof r=="string"&&typeof t=="string")return e<.5?r:t;if(Array.isArray(r)&&Array.isArray(t)){for(var n=r.length,i=t.length,a=Math.max(n,i),s=[],o=0;o<a;o++)s.push(ZL(r[o<n?o:n-1],t[o<i?o:i-1],e));return s}throw new Error("Mismatched interpolation arguments ".concat(r,":").concat(t))}var BY=function(){function r(){at(this,r),this.delay=0,this.direction="normal",this.duration="auto",this._easing="linear",this.easingFunction=bY,this.endDelay=0,this.fill="auto",this.iterationStart=0,this.iterations=1,this.currentIteration=null,this.progress=null}return it(r,[{key:"easing",get:function(){return this._easing},set:function(e){this.easingFunction=Wx(e),this._easing=e}}])}();function zY(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 RM(r,t){if(r===null)return[];Array.isArray(r)||(r=zY(r));for(var e=r.map(function(l){var u={};t!=null&&t.composite&&(u.composite="auto");for(var c in l){var h=l[c];if(c==="offset"){if(h!==null){if(h=Number(h),!isFinite(h))throw new Error("Keyframe offsets must be numbers.");if(h<0||h>1)throw new Error("Keyframe offsets must be between 0 and 1.");u.computedOffset=h}}else if(c==="composite"&&["replace","add","accumulate","auto"].indexOf(h)===-1)throw new Error("".concat(h," compositing is not supported"));u[c]=h}return u.offset===void 0&&(u.offset=null),u.easing===void 0&&(u.easing=(t==null?void 0:t.easing)||"linear"),u.composite===void 0&&(u.composite="auto"),u}),n=!0,i=-1/0,a=0;a<e.length;a++){var s=e[a].offset;if(kt(s))n=!1;else{if(s<i)throw new TypeError("Keyframes are not loosely sorted by offset. Sort or specify offsets.");i=s}}e=e.filter(function(l){return Number(l.offset)>=0&&Number(l.offset)<=1});function o(){var l,u=e,c=u.length;if(e[c-1].computedOffset=Number((l=e[c-1].offset)!==null&&l!==void 0?l:1),c>1){var h;e[0].computedOffset=Number((h=e[0].offset)!==null&&h!==void 0?h:0)}for(var d=0,g=Number(e[0].computedOffset),p=1;p<c;p++){var v=e[p].computedOffset;if(!kt(v)&&!kt(g)){for(var m=1;m<p-d;m++)e[d+m].computedOffset=g+(Number(v)-g)*m/(p-d);d=p,g=Number(v)}}}return n||o(),e}var $Y="backwards|forwards|both|none".split("|"),jY="reverse|alternate|alternate-reverse".split("|");function qY(r,t){var e=new BY;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"&&$Y.indexOf(r[n])===-1||n==="direction"&&jY.indexOf(r[n])===-1)return;e[n]=r[n]}}),e}function WY(r,t){return r=GY(r??{duration:"auto"}),qY(r)}function GY(r){return typeof r=="number"&&(isNaN(r)?r={duration:"auto"}:r={duration:r}),r}var VY=function(){function r(t,e,n){var i=this;at(this,r),this.composite="replace",this.iterationComposite="replace",this.target=t,this.timing=WY(n),this.timing.effect=this,this.timing.activeDuration=MY(this.timing),this.timing.endTime=Math.max(0,this.timing.delay+this.timing.activeDuration+this.timing.endDelay),this.normalizedKeyframes=RM(e,this.timing),this.interpolations=LY(this.normalizedKeyframes,this.timing,this.target);var a=st.globalThis.Proxy;this.computedTiming=a?new a(this.timing,{get:function(o,l){return l==="duration"?o.duration==="auto"?0:o.duration:l==="fill"?o.fill==="auto"?"none":o.fill:l==="localTime"?i.animation&&i.animation.currentTime||null:l==="currentIteration"?!i.animation||i.animation.playState!=="running"?null:o.currentIteration||0:l==="progress"?!i.animation||i.animation.playState!=="running"?null:o.progress||0:o[l]},set:function(){return!0}}):this.timing}return it(r,[{key:"applyInterpolations",value:function(){this.interpolations(this.target,Number(this.timeFraction))}},{key:"update",value:function(e){return e===null?!1:(this.timeFraction=RY(this.timing.activeDuration,e,this.timing),this.timeFraction!==null)}},{key:"getKeyframes",value:function(){return this.normalizedKeyframes}},{key:"setKeyframes",value:function(e){this.normalizedKeyframes=RM(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 LM(r,t){return Number(r.id)-Number(t.id)}var HY=function(){function r(t){var e=this;at(this,r),this.animations=[],this.ticking=!1,this.timelineTicking=!1,this.hasRestartedThisFrame=!1,this.animationsWithPromises=[],this.inTick=!1,this.pendingEffects=[],this.currentTime=null,this.rafId=0,this.rafCallbacks=[],this.webAnimationsNextTick=function(n){e.currentTime=n,e.discardAnimations(),e.animations.length===0?e.timelineTicking=!1:e.requestAnimationFrame(e.webAnimationsNextTick)},this.processRafCallbacks=function(n){var i=e.rafCallbacks;e.rafCallbacks=[],n<Number(e.currentTime)&&(n=Number(e.currentTime)),e.animations.sort(LM),e.animations=e.tick(n,!0,e.animations)[0],i.forEach(function(a){a[1](n)}),e.applyPendingEffects()},this.document=t}return it(r,[{key:"getAnimations",value:function(){return this.discardAnimations(),this.animations.slice()}},{key:"isTicking",value:function(){return this.inTick}},{key:"play",value:function(e,n,i){var a=new VY(e,n,i),s=new lY(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(LM);var a=this.tick(Number(this.currentTime),!1,i.slice())[1];a.forEach(function(s){var o=n.animations.indexOf(s);o!==-1&&n.animations.splice(o,1)}),this.applyPendingEffects()}}},{key:"restart",value:function(){return this.ticking||(this.ticking=!0,this.requestAnimationFrame(function(){}),this.hasRestartedThisFrame=!0),this.hasRestartedThisFrame}},{key:"destroy",value:function(){this.document.defaultView.cancelAnimationFrame(this.frameId)}},{key:"applyPendingEffects",value:function(){this.pendingEffects.forEach(function(e){e==null||e.applyInterpolations()}),this.pendingEffects=[]}},{key:"updateAnimationsPromises",value:function(){this.animationsWithPromises=this.animationsWithPromises.filter(function(e){return e.updatePromises()})}},{key:"discardAnimations",value:function(){this.updateAnimationsPromises(),this.animations=this.animations.filter(function(e){return e.playState!=="finished"&&e.playState!=="idle"})}},{key:"restartWebAnimationsNextTick",value:function(){this.timelineTicking||(this.timelineTicking=!0,this.requestAnimationFrame(this.webAnimationsNextTick))}},{key:"rAF",value:function(e){var n=this.rafId++;return this.rafCallbacks.length===0&&(this.frameId=this.document.defaultView.requestAnimationFrame(this.processRafCallbacks)),this.rafCallbacks.push([n,e]),n}},{key:"requestAnimationFrame",value:function(e){var n=this;return this.rAF(function(i){n.updateAnimationsPromises(),e(i),n.updateAnimationsPromises()})}},{key:"tick",value:function(e,n,i){var a=this,s,o;this.inTick=!0,this.hasRestartedThisFrame=!1,this.currentTime=e,this.ticking=!1;var l=[],u=[],c=[],h=[];return i.forEach(function(d){d.tick(e,n),d._inEffect?(u.push(d.effect),d.markTarget()):(l.push(d.effect),d.unmarkTarget()),d._needsTick&&(a.ticking=!0);var g=d._inEffect||d._needsTick;d._inTimeline=g,g?c.push(d):h.push(d)}),(s=this.pendingEffects).push.apply(s,l),(o=this.pendingEffects).push.apply(o,u),this.ticking&&this.requestAnimationFrame(function(){}),this.inTick=!1,[c,h]}}])}();st.EasingFunction=Wx;st.AnimationTimeline=HY;const UY={duration:500},YY={duration:1e3,easing:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",iterations:1,fill:"both"};var Ie;(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"})(Ie||(Ie={}));var br;(function(r){r.DRAW="draw",r.COLLAPSE="collapse",r.EXPAND="expand",r.TRANSFORM="transform"})(br||(br={}));var ja;(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"})(ja||(ja={}));var bo;(function(r){r.CLICK="combo:click",r.DBLCLICK="combo:dblclick",r.POINTER_OVER="combo:pointerover",r.POINTER_LEAVE="combo:pointerleave",r.POINTER_ENTER="combo:pointerenter",r.POINTER_MOVE="combo:pointermove",r.POINTER_OUT="combo:pointerout",r.POINTER_DOWN="combo:pointerdown",r.POINTER_UP="combo:pointerup",r.CONTEXT_MENU="combo:contextmenu",r.DRAG_START="combo:dragstart",r.DRAG="combo:drag",r.DRAG_END="combo:dragend",r.DRAG_ENTER="combo:dragenter",r.DRAG_OVER="combo:dragover",r.DRAG_LEAVE="combo:dragleave",r.DROP="combo:drop"})(bo||(bo={}));var J;(function(r){r.CLICK="click",r.DBLCLICK="dblclick",r.POINTER_OVER="pointerover",r.POINTER_LEAVE="pointerleave",r.POINTER_ENTER="pointerenter",r.POINTER_MOVE="pointermove",r.POINTER_OUT="pointerout",r.POINTER_DOWN="pointerdown",r.POINTER_UP="pointerup",r.CONTEXT_MENU="contextmenu",r.DRAG_START="dragstart",r.DRAG="drag",r.DRAG_END="dragend",r.DRAG_ENTER="dragenter",r.DRAG_OVER="dragover",r.DRAG_LEAVE="dragleave",r.DROP="drop",r.KEY_DOWN="keydown",r.KEY_UP="keyup",r.WHEEL="wheel",r.PINCH="pinch"})(J||(J={}));var Nl;(function(r){r.KEY_DOWN="keydown",r.KEY_UP="keyup"})(Nl||(Nl={}));var Of;(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"})(Of||(Of={}));var lt;(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"})(lt||(lt={}));var ys;(function(r){r.UNDO="undo",r.REDO="redo",r.CANCEL="cancel",r.ADD="add",r.CLEAR="clear",r.CHANGE="change"})(ys||(ys={}));var Zn;(function(r){r.CLICK="node:click",r.DBLCLICK="node:dblclick",r.POINTER_OVER="node:pointerover",r.POINTER_LEAVE="node:pointerleave",r.POINTER_ENTER="node:pointerenter",r.POINTER_MOVE="node:pointermove",r.POINTER_OUT="node:pointerout",r.POINTER_DOWN="node:pointerdown",r.POINTER_UP="node:pointerup",r.CONTEXT_MENU="node:contextmenu",r.DRAG_START="node:dragstart",r.DRAG="node:drag",r.DRAG_END="node:dragend",r.DRAG_ENTER="node:dragenter",r.DRAG_OVER="node:dragover",r.DRAG_LEAVE="node:dragleave",r.DROP="node:drop"})(Zn||(Zn={}));const we="combo",jr="tree";var Ra;(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"})(Ra||(Ra={}));const Lw={animation:{},behavior:{},combo:{},edge:{},layout:{},node:{},palette:{},theme:{},plugin:{},transform:{},shape:{}};function qa(r,t){var e;const n=(e=Lw[r])===null||e===void 0?void 0:e[t];if(n)return n}const XY="5.0.43",KY="G6";function La(r){return`[${KY} v${XY}] ${r}`}const oa={mute:!1,debug:r=>{console.debug(La(r))},info:r=>{console.info(La(r))},warn:r=>{console.warn(La(r))},error:r=>{console.error(La(r))}};function JL(r){const{theme:t}=r;if(!t)return{};const e=qa(Ra.THEME,t);return e||(oa.warn(`The theme of ${t} is not registered.`),{})}function Vx(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 Iw(r){const t=r.reduce((n,i)=>(Object.entries(i).forEach(([a,s])=>{n[a]===void 0?n[a]=[s]:n[a].push(s)}),n),{});Object.entries(t).forEach(([n,i])=>{(i.length!==r.length||i.some(a=>kt(a))||i.every(a=>!["sourceNode","targetNode","childrenNode"].includes(n)&&Ye(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 pc(r){switch(r){case"opacity":return 1;case"x":case"y":case"z":case"zIndex":return 0;case"visibility":return"visible";case"collapsed":return!1;case"states":return[];default:return}}function QL(r,t){const{animation:e}=r;if(e===!1||t===!1)return!1;const n=Object.assign({},UY);return sn(e)&&Object.assign(n,e),sn(t)&&Object.assign(n,t),n}function ZY(r){if(typeof r=="string"){const t=qa(Ra.ANIMATION,r);return t||(oa.warn(`The animation of ${r} is not registered.`),[])}return r}function JY(r,t,e,n){var i,a;const{animation:s}=r;if(s===!1||n===!1)return[];const o=(i=r==null?void 0:r[t])===null||i===void 0?void 0:i.animation;if(o===!1)return[];const l=o==null?void 0:o[e];if(l===!1)return[];const u=(a=JL(r)[t])===null||a===void 0?void 0:a.animation,c=(d=[])=>ZY(d).map(g=>Object.assign(Object.assign(Object.assign(Object.assign({},YY),sn(s)&&s),g),sn(n)&&n));if(l)return c(l);if(!u)return[];const h=u[e];return h===!1?[]:c(h)}function tI(r,t,e,n=[]){if(!n&&r===0&&t===0&&e===0)return null;if(Array.isArray(n)){let a=-1;const s=[];for(let o=0;o<n.length;o++){const l=n[o];if(l[0]==="translate"){if(l[1]===r&&l[2]===t)return null;a=o,s.push(["translate",r,t])}else if(l[0]==="translate3d"){if(l[1]===r&&l[2]===t&&l[3]===e)return null;a=o,s.push(["translate3d",r,t,e??0])}else s.push(l)}return a===-1&&s.splice(0,0,bt(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 QY=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 tX=(r,t,e)=>{if(!e.length)return null;const[n,i]=t,a=u=>{var c;if(u){const h=r.getShape(u);if(!h)return null;const d=`get${mf(u)}Style`,g=((c=r==null?void 0:r[d])===null||c===void 0?void 0:c.bind(r))||(m=>m),p=(g==null?void 0:g(n))||{},v=(g==null?void 0:g(i))||{};return{shape:h,fromStyle:p,toStyle:v}}else return{shape:r,fromStyle:n,toStyle:i}};let s;const o=e.map(u=>{var{fields:c,shape:h,states:d}=u,g=QY(u,["fields","shape","states"]);const p=a(h);if(!p)return null;const{shape:v,fromStyle:m,toStyle:b}=p,w=[{},{}];if(c.forEach(S=>{var _,M;Object.assign(w[0],{[S]:(_=m[S])!==null&&_!==void 0?_:pc(S)}),Object.assign(w[1],{[S]:(M=b[S])!==null&&M!==void 0?M:pc(S)})}),w.some(S=>Object.keys(S).some(_=>["x","y","z"].includes(_)))){const{x:S=0,y:_=0,z:M,transform:k=""}=v.attributes||{};w.forEach(C=>{var P,T,A;C.transform=tI((P=C.x)!==null&&P!==void 0?P:S,(T=C.y)!==null&&T!==void 0?T:_,(A=C.z)!==null&&A!==void 0?A:M,k)})}const x=v.animate(Iw(w),g);return h===void 0&&(s=x),x}).filter(Boolean),l=s||(o==null?void 0:o[0]);return l?Vx(l,o.filter(u=>u!==u)):null},eX=[{fields:["opacity"]}],nX=[{fields:["x","y"]}],eI=[{fields:["x","y"]}],rX=eI,nI=[{fields:["sourceNode","targetNode"]}],iX=nI,rI=[{fields:["childrenNode","x","y"]}],aX=rI;function sX(r){return"source"in r&&"target"in r}function oX(r){return r.length===2}function Ul(r){return r instanceof Float32Array?!0:Array.isArray(r)&&(r.length===2||r.length===3)?r.every(t=>typeof t=="number"):!1}function sa(r,t,e){return r>=t&&r<=e}function la(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 lX(r=0){const t=la(r);return t[0]+t[2]}function ua(r){return r.max[0]-r.min[0]}function ca(r){return r.max[1]-r.min[1]}function Us(r){return[ua(r),ca(r)]}function Ss(r,t){const e=Ul(r)?Hx(r):r.getShape("key").getBounds();return t?Ys(e,t):e}function Hx(r){const[t,e,n=0]=r,i=new Me;return i.setMinMax([t,e,n],[t,e,n]),i}function Ys(r,t){const[e,n,i,a]=la(t),[s,o,l]=r.min,[u,c,h]=r.max,d=new Me;return d.setMinMax([s-a,o-e,l],[u+n,c+i,h]),d}function Fc(r){if(r.length===0)return new Me;if(r.length===1)return r[0];const t=new Me;t.setMinMax(r[0].min,r[0].max);for(let e=1;e<r.length;e++){const n=r[e];t.setMinMax([Math.min(t.min[0],n.min[0]),Math.min(t.min[1],n.min[1]),Math.min(t.min[2],n.min[2])],[Math.max(t.max[0],n.max[0]),Math.max(t.max[1],n.max[1]),Math.max(t.max[2],n.max[2])])}return t}function uX(r,t){const[e,n]=r.min,[i,a]=r.max,[s,o]=t.min,[l,u]=t.max;return e>=s&&i<=l&&n>=o&&a<=u}function Ii(r,t){return sa(r[0],t.min[0],t.max[0])&&sa(r[1],t.min[1],t.max[1])}function iI(r,t,e=!1){const{min:[n,i],max:[a,s]}=t,o=(r[1]===i||r[1]===s)&&(e||sa(r[0],n,a)),l=(r[0]===n||r[0]===a)&&(e||sa(r[1],i,s));return o||l}function cX(r,t){return!Ii(r,t)}function Af(r,t){const{center:e}=t;return r[0]===e[0]&&r[1]===e[1]}function ic(r,t){const[e,n]=r,[i,a]=t.min,[s,o]=t.max,l=e-i,u=s-e,c=n-a,h=o-n,d=Math.min(l,u,c,h);return d===l?"left":d===u?"right":d===c?"top":d===h?"bottom":"left"}function Co(r,t){const e=zs(r);if(Ii(r,t))switch(ic(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]=sa(n,a,o)?n:n<a?a:o,e[1]=sa(i,s,l)?i:i<s?s:l}return e}function hX(r,t){const{center:e}=r,[n,i]=Us(r),a=t==="up"||t==="down"?e[0]:t==="right"?e[0]-n/6:e[0]+n/6,s=t==="left"||t==="right"?e[1]:t==="down"?e[1]-i/6:e[1]+i/6;return[a,s]}function dX(r,t){let[e,n]=Us(r);return[e,n]=t==="up"||t==="down"?[e,n]:[n,e],(Math.pow(n,2)-Math.pow(Math.sqrt(Math.pow(e/2,2)+Math.pow(n,2))-e/2,2))/(2*n)}function fX(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 gX=function(t,e){return t===e},IM=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}(),pX=function(){function r(t){t===void 0&&(t=gX),this.head=null,this.tail=null,this.compare=t}return r.prototype.prepend=function(t){var e=new IM(t,this.head);return this.head=e,this.tail||(this.tail=e),this},r.prototype.append=function(t){var e=new IM(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}(),vX=function(t,e,n){e===void 0&&(e=[]);var i=e.filter(function(l){return l.source===t||l.target===t});if(n==="target"){var a=function(u){return u.source===t};return i.filter(a).map(function(l){return l.target})}if(n==="source"){var s=function(u){return u.target===t};return i.filter(s).map(function(l){return l.source})}var o=function(u){return u.source===t?u.target:u.source};return i.map(o)},mX=function(t,e){return e.filter(function(n){return n.source===t})},yX=function(t,e){return e.filter(function(n){return n.source===t||n.target===t})},bX=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},wX={}.toString,Ux=function(r,t){return wX.call(r)==="[object "+t+"]"};const aI=function(r){return Ux(r,"Function")},sI=function(r){return Array.isArray?Array.isArray(r):Ux(r,"Array")},xX=function(r){var t=typeof r;return r!==null&&t==="object"||t==="function"};function EX(r,t){if(r){var e;if(sI(r))for(var n=0,i=r.length;n<i&&(e=t(r[n],n),e!==!1);n++);else if(xX(r)){for(var a in r)if(r.hasOwnProperty(a)&&(e=t(r[a],a),e===!1))break}}}const _X=function(r){return Ux(r,"String")};var SX=Object.values?function(r){return Object.values(r)}:function(r){var t=[];return EX(r,function(e,n){aI(r)&&n==="prototype"||t.push(e)}),t};const MX=function(r,t){if(!aI(r))throw new TypeError("Expected a function");var e=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];var a=t?t.apply(this,n):n[0],s=e.cache;if(s.has(a))return s.get(a);var o=r.apply(this,n);return s.set(a,o),o};return e.cache=new Map,e};var vd;MX(function(r,t){t===void 0&&(t={});var e=t.fontSize,n=t.fontFamily,i=t.fontWeight,a=t.fontStyle,s=t.fontVariant;return vd||(vd=document.createElement("canvas").getContext("2d")),vd.font=[a,s,i,e+"px",n].join(" "),vd.measureText(_X(r)?r:"").width},function(r,t){return t===void 0&&(t={}),$W([r],SX(t)).join("")});var kX=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},CX=function(t,e,n,i){var a=t.nodes,s=a===void 0?[]:a,o=t.edges,l=o===void 0?[]:o,u={},c={},h={};s.forEach(function(w,x){var S=w.id;c[S]=1/0,S===e&&(c[S]=0)});for(var d=s.length,g=function(x){var S=kX(c,s,u),_=S.id;if(u[_]=!0,c[_]===1/0)return"continue";var M=[];n?M=mX(_,l):M=yX(_,l),M.forEach(function(k){var C=k.target,P=k.source,T=C===_?P:C,A=i&&k[i]?k[i]:1;c[T]>c[S.id]+A?(c[T]=c[S.id]+A,h[T]=[S.id]):c[T]===c[S.id]+A&&h[T].push(S.id)})},p=0;p<d;p++)g();h[e]=[e];var v={};for(var m in c)c[m]!==1/0&&oI(e,m,h,v);var b={};for(var m in v)b[m]=v[m][0];return{length:c,path:b,allPath:v}};function oI(r,t,e,n){if(r===t)return[r];if(n[t])return n[t];for(var i=[],a=0,s=e[t];a<s.length;a++){var o=s[a],l=oI(r,o,e,n);if(!l)return;for(var u=0,c=l;u<c.length;u++){var h=c[u];sI(h)?i.push(vt(vt([],h,!0),[t],!1)):i.push([h,t])}}return n[t]=i,n[t]}var lI=function(t,e,n,i,a){var s=CX(t,e,i,a),o=s.length,l=s.path,u=s.allPath;return{length:o[n],path:l[n],allPath:u[n]}},DM;(function(r){r.EuclideanDistance="euclideanDistance"})(DM||(DM={}));var TX=function(t,e,n){typeof e!="number"&&(e=1e-6),typeof n!="number"&&(n=.85);for(var i=1,a=0,s=1e3,o=t.nodes,l=o===void 0?[]:o,u=t.edges,c=u===void 0?[]:u,h=l.length,d,g={},p={},v=0;v<h;++v){var m=l[v],b=m.id;g[b]=1/h,p[b]=1/h}for(var w=bX(t);s>0&&i>e;){a=0;for(var v=0;v<h;++v){var m=l[v],b=m.id;if(d=0,w[m.id].inDegree===0)g[b]=0;else{for(var x=vX(b,c,"source"),S=0;S<x.length;++S){var _=x[S],M=w[_].outDegree;M>0&&(d+=p[_]/M)}g[b]=n*d,a+=g[b]}}a=(1-a)/h,i=0;for(var v=0;v<h;++v){var m=l[v],b=m.id;d=g[b]+a,i+=Math.abs(d-p[b]),p[b]=d}s-=1}return p};(function(){function r(t){t===void 0&&(t=10),this.linkedList=new pX,this.maxStep=t}return Object.defineProperty(r.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),r.prototype.isEmpty=function(){return!this.linkedList.head},r.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},r.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},r.prototype.push=function(t){this.linkedList.prepend(t),this.length>this.maxStep&&this.linkedList.deleteTail()},r.prototype.pop=function(){var t=this.linkedList.deleteHead();return t?t.value:null},r.prototype.toArray=function(){return this.linkedList.toArray().map(function(t){return t.value})},r.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},r})();function H(r){if(r.id!==void 0)return r.id;if(r.source!==void 0&&r.target!==void 0)return`${r.source}-${r.target}`;throw new Error(La("The datum does not have available id."))}function md(r){return r.combo}function uI(r,t){const e={nodes:(r.nodes||[]).map(H),edges:(r.edges||[]).map(H),combos:(r.combos||[]).map(H)};return t?Object.values(e).flat():e}const cI=(r,t,e)=>{var n;switch(e.type){case"degree":{const i=new Map;return(n=r.nodes)===null||n===void 0||n.forEach(a=>{const s=t(H(a),e.direction).length;i.set(H(a),s)}),i}case"betweenness":return OX(r,e.directed,e.weightPropertyName);case"closeness":return AX(r,e.directed,e.weightPropertyName);case"eigenvector":return NX(r,e.directed);case"pagerank":return PX(r,e.epsilon,e.linkProb);default:return hI(r)}},hI=r=>{var t;const e=new Map;return(t=r.nodes)===null||t===void 0||t.forEach(n=>{e.set(H(n),0)}),e},OX=(r,t,e)=>{const n=hI(r),{nodes:i=[]}=r;return i.forEach(a=>{i.forEach(s=>{if(a!==s){const{allPath:o}=lI(r,H(a),H(s),t,e),l=o.length;o.flat().forEach(u=>{u!==H(a)&&u!==H(s)&&n.set(u,n.get(u)+1/l)})}})}),n},AX=(r,t,e)=>{const n=new Map,{nodes:i=[]}=r;return i.forEach(a=>{const s=i.reduce((o,l)=>{if(a!==l){const{length:u}=lI(r,H(a),H(l),t,e);o+=u}return o},0);n.set(H(a),1/s)}),n},PX=(r,t,e)=>{var n;const i=new Map,a=TX(r,t,e);return(n=r.nodes)===null||n===void 0||n.forEach(s=>{i.set(H(s),a[H(s)])}),i},NX=(r,t)=>{const{nodes:e=[]}=r,n=RX(r,t),i=LX(n,e.length),a=new Map;return e.forEach((s,o)=>{a.set(H(s),i[o])}),a},RX=(r,t)=>{const{nodes:e=[],edges:n=[]}=r,i=Array(e.length).fill(null).map(()=>Array(e.length).fill(0));return n.forEach(({source:a,target:s})=>{const o=e.findIndex(u=>H(u)===a),l=e.findIndex(u=>H(u)===s);t?i[o][l]=1:(i[o][l]=1,i[l][o]=1)}),i},LX=(r,t,e=100,n=1e-6)=>{let i=Array(t).fill(1),a=1/0;for(let s=0;s<e&&a>n;s++){const o=Array(t).fill(0);for(let u=0;u<t;u++)for(let c=0;c<t;c++)o[u]+=r[u][c]*i[c];const l=Math.sqrt(o.reduce((u,c)=>u+c*c,0));for(let u=0;u<t;u++)o[u]/=l;a=Math.sqrt(o.reduce((u,c,h)=>u+(c-i[h])*c,0)),i=o}return i};function Ns(r,t,e,n=Ye){const i=new Map(r.map(d=>[e(d),d])),a=new Map(t.map(d=>[e(d),d])),s=new Set(i.keys()),o=new Set(a.keys()),l=[],u=[],c=[],h=[];return o.forEach(d=>{s.has(d)?n(i.get(d),a.get(d))?h.push(a.get(d)):u.push(a.get(d)):l.push(a.get(d))}),s.forEach(d=>{o.has(d)||c.push(i.get(d))}),{enter:l,exit:c,keep:h,update:u}}function Fo(r,t,e){const n=i=>{e&&!e(i)||(i.style.visibility=t)};r.forEach(i=>{n(i)})}function IX(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 Yx{constructor(t){this.extensions=[],this.extensionMap={},this.context=t}setExtensions(t){const e=IX(this.context.graph,this.category,t),{enter:n,update:i,exit:a,keep:s}=Ns(this.extensions,e,o=>o.key);this.createExtensions(n),this.updateExtensions([...i,...s]),this.destroyExtensions(a),this.extensions=e}createExtension(t){const{category:e}=this,{key:n,type:i}=t,a=qa(e,i);if(!a)return oa.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 Xx{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 Tr extends Xx{}class h0 extends Tr{constructor(t,e){super(t,Object.assign({},h0.defaultOptions,e)),this.isOverlapping=(n,i)=>i.some(a=>n.intersects(a)),this.occupiedBounds=[],this.detectLabelCollision=n=>{const i=this.context.viewport,a={show:[],hide:[]};return this.occupiedBounds=[],n.forEach(s=>{const o=s.getShape("label").getRenderBounds();i.isInViewport(o,!0)&&!this.isOverlapping(o,this.occupiedBounds)?(a.show.push(s),this.occupiedBounds.push(Ys(o,this.options.padding))):a.hide.push(s)}),a},this.hideLabelIfExceedViewport=(n,i)=>{const{exit:a}=Ns(n,i,s=>s.id);a==null||a.forEach(this.hideLabel)},this.nodeCentralities=new Map,this.sortNodesByCentrality=(n,i)=>{const{model:a}=this.context,s=a.getData(),o=a.getRelatedEdgesData.bind(a);return n.map(u=>(this.nodeCentralities.has(u.id)||(this.nodeCentralities=cI(s,o,i)),{node:u,centrality:this.nodeCentralities.get(u.id)})).sort((u,c)=>c.centrality-u.centrality).map(u=>u.node)},this.sortLabelElementsInView=n=>{const{sort:i,sortNode:a,sortCombo:s,sortEdge:o}=this.options,{model:l}=this.context;if(Et(i))return n.sort((v,m)=>i(l.getElementDataById(v.id),l.getElementDataById(m.id)));const{node:u=[],edge:c=[],combo:h=[]}=a0(n,v=>v.type),d=Et(s)?h.sort((v,m)=>s(...l.getComboData([v.id,m.id]))):h,g=Et(a)?u.sort((v,m)=>a(...l.getNodeData([v.id,m.id]))):this.sortNodesByCentrality(u,a),p=Et(o)?c.sort((v,m)=>o(...l.getEdgeData([v.id,m.id]))):c;return[...d,...g,...p]},this.labelElementsInView=[],this.isFirstRender=!0,this.onToggleVisibility=n=>{var i;if(((i=n.data)===null||i===void 0?void 0:i.stage)==="zIndex")return;if(!this.validate(n)){this.hiddenElements.size>0&&(this.hiddenElements.forEach(this.showLabel),this.hiddenElements.clear());return}const a=this.isFirstRender?this.getLabelElements():this.getLabelElementsInView();this.hideLabelIfExceedViewport(this.labelElementsInView,a),this.labelElementsInView=a;const s=this.sortLabelElementsInView(this.labelElementsInView),{show:o,hide:l}=this.detectLabelCollision(s);for(let u=o.length-1;u>=0;u--)this.showLabel(o[u]);l.forEach(this.hideLabel)},this.hiddenElements=new Map,this.hideLabel=n=>{const i=n.getShape("label");i&&Fo(i,"hidden"),this.hiddenElements.set(n.id,n)},this.showLabel=n=>{const i=n.getShape("label");i&&Fo(i,"visible"),n.toFront(),this.hiddenElements.delete(n.id)},this.onTransform=ZR(this.onToggleVisibility,this.options.throttle,{leading:!0}),this.enableToggle=!0,this.toggle=n=>{this.enableToggle&&this.onToggleVisibility(n)},this.onBeforeRender=()=>{this.enableToggle=!1},this.onAfterRender=n=>{this.onToggleVisibility(n),this.enableToggle=!0},this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents(),this.onToggleVisibility({})}getLabelElements(){const{elementMap:t}=this.context.element,e=[];for(const n in t){const i=t[n];i.isVisible()&&i.getShape("label")&&e.push(i)}return e}getLabelElementsInView(){const t=this.context.viewport;return this.getLabelElements().filter(e=>t.isInViewport(e.getShape("key").getRenderBounds()))}bindEvents(){const{graph:t}=this.context;t.on(lt.BEFORE_RENDER,this.onBeforeRender),t.on(lt.AFTER_RENDER,this.onAfterRender),t.on(lt.AFTER_DRAW,this.toggle),t.on(lt.AFTER_LAYOUT,this.toggle),t.on(lt.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:t}=this.context;t.off(lt.BEFORE_RENDER,this.onBeforeRender),t.off(lt.AFTER_RENDER,this.onAfterRender),t.off(lt.AFTER_DRAW,this.toggle),t.off(lt.AFTER_LAYOUT,this.toggle),t.off(lt.AFTER_TRANSFORM,this.onTransform)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}h0.defaultOptions={enable:!0,throttle:100,padding:0,sortNode:{type:"degree"}};const FM=[0,0,0];function Lt(r,t){return r.map((e,n)=>e+t[n])}function be(r,t){return r.map((e,n)=>e-t[n])}function Ta(r,t){return typeof t=="number"?r.map(e=>e*t):r.map((e,n)=>e*t[n])}function Di(r,t){return typeof t=="number"?r.map(e=>e/t):r.map((e,n)=>e/t[n])}function DX(r,t){return r.reduce((e,n,i)=>e+n*t[i],0)}function FX(r,t){const e=vc(r),n=vc(t);return[e[1]*n[2]-e[2]*n[1],e[2]*n[0]-e[0]*n[2],e[0]*n[1]-e[1]*n[0]]}function Ms(r,t){return r.map(e=>e*t)}function Pe(r,t){return Math.sqrt(r.reduce((e,n,i)=>e+Math.pow(n-t[i]||0,2),0))}function Pf(r,t){return r.reduce((e,n,i)=>e+Math.abs(n-t[i]),0)}function za(r){const t=r.reduce((e,n)=>e+Math.pow(n,2),0);return r.map(e=>e/Math.sqrt(t))}function Kx(r,t,e=!1){const n=r[0]*t[1]-r[1]*t[0];let i=Math.acos(Ta(r,t).reduce((a,s)=>a+s,0)/(Pe(r,FM)*Pe(t,FM)));return e&&n<0&&(i=2*Math.PI-i),i}function d0(r,t=!0){return t?[-r[1],r[0]]:[r[1],-r[0]]}function BX(r,t){return r.map(e=>e%t)}function Bo(r){return[r[0],r[1]]}function vc(r){return oX(r)?[r[0],r[1],0]:r}function dI(r){const[t,e]=r;return!t&&!e?0:Math.atan2(e,t)}function fI(r,t){const[e,n]=r,[i,a]=t,s=be(e,n),o=be(i,a);return FX(s,o).every(l=>l===0)}function Zx(r,t,e=!1){if(fI(r,t))return;const[n,i]=r,[a,s]=t,o=((n[0]-a[0])*(a[1]-s[1])-(n[1]-a[1])*(a[0]-s[0]))/((n[0]-i[0])*(a[1]-s[1])-(n[1]-i[1])*(a[0]-s[0])),l=s[0]-a[0]?(n[0]-a[0]+o*(i[0]-n[0]))/(s[0]-a[0]):(n[1]-a[1]+o*(i[1]-n[1]))/(s[1]-a[1]);if(!(!e&&(!sa(o,0,1)||!sa(l,0,1))))return[n[0]+o*(i[0]-n[0]),n[1]+o*(i[1]-n[1])]}function gI(r){if(Array.isArray(r))return sa(r[0],0,1)&&sa(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 on(r){const{x:t=0,y:e=0,z:n=0}=r.style||{};return[+t,+e,+n]}function zX(r){const{x:t,y:e,z:n}=r.style||{};return t!==void 0||e!==void 0||n!==void 0}function $X(r,t){const[e,n]=t,{min:i,max:a}=r;return[i[0]+e*(a[0]-i[0]),i[1]+n*(a[1]-i[1])]}function Oa(r,t="center"){const e=gI(t);return $X(r,e)}function $n(r){var t;return[r.x,r.y,(t=r.z)!==null&&t!==void 0?t:0]}function Ni(r){var t;return{x:r[0],y:r[1],z:(t=r[2])!==null&&t!==void 0?t:0}}function Au(r,t=0){return r.map(e=>parseFloat(e.toFixed(t)))}function Rs(r,t,e,n=!1){if(Ye(r,t))return r;const i=n?be(r,t):be(t,r),a=za(i),s=[a[0]*e,a[1]*e];return Lt(Bo(r),s)}function pI(r,t){return r[1]===t[1]}function jX(r,t){return r[0]===t[0]}function qX(r,t){return pI(r,t)||jX(r,t)}function vI(r,t,e){return fI([r,t],[t,e])}function mI(r,t){return[2*t[0]-r[0],2*t[1]-r[1]]}function yI(r,t,e,n=!0,i=!1){for(let a=0;a<e.length;a++){let s=e[a],o=e[(a+1)%e.length];n&&(s=Lt(t,s),o=Lt(t,o));const l=i?mI(r,t):r,u=Zx([t,l],[s,o]);if(u)return{point:u,line:[s,o]}}return{point:t,line:void 0}}function WX(r,t,e,n){const i=r[0],a=r[1];let s=!1;e===void 0&&(e=0),n===void 0&&(n=t.length);const o=n-e;for(let l=0,u=o-1;l<o;u=l++){const c=t[l+e][0],h=t[l+e][1],d=t[u+e][0],g=t[u+e][1];h>a!=g>a&&i<(d-c)*(a-h)/(g-h)+c&&(s=!s)}return s}function GX(r,t,e=!1){const n=Oa(t,"center"),i=[Oa(t,"left-top"),Oa(t,"right-top"),Oa(t,"right-bottom"),Oa(t,"left-bottom")];return yI(r,n,i,!1,e).point}function f0(r,t,e=!1){const n=t.center,i=e?mI(r,n):r,a=be(i,t.center),s=Math.atan2(a[1],a[0]);if(isNaN(s))return n;const o=ua(t)/2,l=ca(t)/2,u=n[0]+o*Math.cos(s),c=n[1]+l*Math.sin(s);return[u,c]}function VX(r,t){let e=1/0,n=[r[0],t[0]];return r.forEach(i=>{t.forEach(a=>{const s=Pe(i,a);s<e&&(e=s,n=[i,a])})}),n}function HX(r,t){let e=1/0,n=[[0,0],[0,0]];return t.forEach(i=>{const a=UX(r,i);a<e&&(e=a,n=i)}),n}function UX(r,t){const e=bI(r,t);return Pe(r,e)}function bI(r,t){const[e,n]=t[0],[i,a]=t[1],[s,o]=r,l=i-e,u=a-n;if(l===0&&u===0)return[e,n];let c=((s-e)*l+(o-n)*u)/(l*l+u*u);c>1?c=1:c<0&&(c=0);const h=e+c*l,d=n+c*u;return[h,d]}function YX(r){const t=r.reduce((e,n)=>Lt(e,n),[0,0]);return Di(t,r.length)}function Jx(r,t=!0){const e=YX(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 BM(r,t){return[r,[r[0],t[1]],t,[t[0],r[1]]]}class XX{constructor(t,e){this.callback=e,this.pointerByTouch=[],this.initialDistance=null,this.emitter=t,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.bindEvents()}bindEvents(){const{emitter:t}=this;t.on(J.POINTER_DOWN,this.onPointerDown),t.on(J.POINTER_MOVE,this.onPointerMove),t.on(J.POINTER_UP,this.onPointerUp)}updatePointerPosition(t,e,n){const i=this.pointerByTouch.findIndex(a=>a.pointerId===t);i>=0&&(this.pointerByTouch[i]={x:e,y:n,pointerId:t})}onPointerDown(t){const{x:e,y:n}=t.client;if(!(e===void 0||n===void 0)&&(this.pointerByTouch.push({x:e,y:n,pointerId:t.pointerId}),t.pointerType==="touch"&&this.pointerByTouch.length===2)){const i=this.pointerByTouch[0].x-this.pointerByTouch[1].x,a=this.pointerByTouch[0].y-this.pointerByTouch[1].y;this.initialDistance=Math.sqrt(i*i+a*a)}}onPointerMove(t){if(this.pointerByTouch.length!==2||this.initialDistance===null)return;const{x:e,y:n}=t.client;if(e===void 0||n===void 0)return;this.updatePointerPosition(t.pointerId,e,n);const i=this.pointerByTouch[0].x-this.pointerByTouch[1].x,a=this.pointerByTouch[0].y-this.pointerByTouch[1].y,o=Math.sqrt(i*i+a*a)/this.initialDistance;this.callback(t,{scale:(o-1)*5})}onPointerUp(){this.initialDistance=null,this.pointerByTouch=[]}destroy(){this.emitter.off(J.POINTER_DOWN,this.onPointerDown),this.emitter.off(J.POINTER_MOVE,this.onPointerMove),this.emitter.off(J.POINTER_UP,this.onPointerUp)}}const zM=r=>r.map(t=>oe(t)?t.toLocaleLowerCase():t);class Zl{constructor(t){this.map=new Map,this.recordKey=new Set,this.onKeyDown=e=>{e!=null&&e.key&&(this.recordKey.add(e.key),this.trigger(e))},this.onKeyUp=e=>{e!=null&&e.key&&this.recordKey.delete(e.key)},this.onWheel=e=>{this.triggerExtendKey(J.WHEEL,e)},this.onDrag=e=>{this.triggerExtendKey(J.DRAG,e)},this.handlePinch=(e,n)=>{this.triggerExtendKey(J.PINCH,Object.assign(Object.assign({},e),n))},this.onFocus=()=>{this.recordKey.clear()},this.emitter=t,this.bindEvents()}bind(t,e){t.length!==0&&(t.includes(J.PINCH)&&!this.pinchHandler&&(this.pinchHandler=new XX(this.emitter,this.handlePinch.bind(this))),this.map.set(t,e))}unbind(t,e){this.map.forEach((n,i)=>{Ye(i,t)&&(!e||e===n)&&this.map.delete(i)})}unbindAll(){this.map.clear()}match(t){const e=zM(Array.from(this.recordKey)).sort(),n=zM(t).sort();return Ye(e,n)}bindEvents(){var t;const{emitter:e}=this;e.on(J.KEY_DOWN,this.onKeyDown),e.on(J.KEY_UP,this.onKeyUp),e.on(J.WHEEL,this.onWheel),e.on(J.DRAG,this.onDrag),(t=globalThis.addEventListener)===null||t===void 0||t.call(globalThis,"focus",this.onFocus)}trigger(t){this.map.forEach((e,n)=>{this.match(n)&&e(t)})}triggerExtendKey(t,e){this.map.forEach((n,i)=>{i.includes(t)&&Ye(Array.from(this.recordKey),i.filter(a=>a!==t))&&n(e)})}destroy(){var t,e;this.unbindAll(),this.emitter.off(J.KEY_DOWN,this.onKeyDown),this.emitter.off(J.KEY_UP,this.onKeyUp),this.emitter.off(J.WHEEL,this.onWheel),this.emitter.off(J.DRAG,this.onDrag),(t=this.pinchHandler)===null||t===void 0||t.destroy(),(e=globalThis.removeEventListener)===null||e===void 0||e.call(globalThis,"blur",this.onFocus)}}class Bc extends Tr{constructor(t,e){super(t,cr({},Bc.defaultOptions,e)),this.shortcut=new Zl(t.graph),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.clearStates=this.clearStates.bind(this),this.bindEvents()}onPointerDown(t){if(!this.validate(t)||!this.isKeydown()||this.startPoint)return;const{canvas:e,graph:n}=this.context,i=Object.assign({},this.options.style);this.options.style.lineWidth&&(i.lineWidth=+this.options.style.lineWidth/n.getZoom()),this.rectShape=new Sn({id:"g6-brush-select",style:i}),e.appendChild(this.rectShape),this.startPoint=[t.canvas.x,t.canvas.y]}onPointerMove(t){var e;if(!this.startPoint)return;const{immediately:n,mode:i}=this.options;this.endPoint=Nf(t),(e=this.rectShape)===null||e===void 0||e.attr({x:Math.min(this.endPoint[0],this.startPoint[0]),y:Math.min(this.endPoint[1],this.startPoint[1]),width:Math.abs(this.endPoint[0]-this.startPoint[0]),height:Math.abs(this.endPoint[1]-this.startPoint[1])}),n&&i==="default"&&this.updateElementsStates(BM(this.startPoint,this.endPoint))}onPointerUp(t){if(this.startPoint){if(!this.endPoint){this.clearBrush();return}this.endPoint=Nf(t),this.updateElementsStates(BM(this.startPoint,this.endPoint)),this.clearBrush()}}clearStates(){this.endPoint||this.clearElementsStates()}clearElementsStates(){const{graph:t}=this.context,e=Object.values(t.getData()).reduce((n,i)=>Object.assign({},n,i.reduce((a,s)=>(a[H(s)]=[],a),{})),{});t.setElementState(e,this.options.animation)}updateElementsStates(t){const{graph:e}=this.context,{enableElements:n,state:i,mode:a,onSelect:s}=this.options,o=this.selector(e,t,n);let l={};switch(a){case"union":o.forEach(u=>{l[u]=[...e.getElementState(u),i]});break;case"diff":o.forEach(u=>{const c=e.getElementState(u);l[u]=c.includes(i)?c.filter(h=>h!==i):[...c,i]});break;case"intersect":o.forEach(u=>{const c=e.getElementState(u);l[u]=c.includes(i)?[i]:[]});break;case"default":default:o.forEach(u=>{l[u]=[i]});break}Et(s)&&(l=s(l)),e.setElementState(l,this.options.animation)}selector(t,e,n){if(!n||n.length===0)return[];const i=[],a=t.getData();if(n.forEach(s=>{a[`${s}s`].forEach(o=>{const l=H(o);t.getElementVisibility(l)!=="hidden"&&WX(t.getElementPosition(l),e)&&i.push(l)})}),n.includes("edge")){const s=a.edges;s==null||s.forEach(o=>{const{source:l,target:u}=o;i.includes(l)&&i.includes(u)&&i.push(H(o))})}return i}clearBrush(){var t;(t=this.rectShape)===null||t===void 0||t.remove(),this.rectShape=void 0,this.startPoint=void 0,this.endPoint=void 0}isKeydown(){const{trigger:t}=this.options,e=Array.isArray(t)?t:[t];return this.shortcut.match(e.filter(n=>n!=="drag"))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}bindEvents(){const{graph:t}=this.context;t.on(J.POINTER_DOWN,this.onPointerDown),t.on(J.POINTER_MOVE,this.onPointerMove),t.on(J.POINTER_UP,this.onPointerUp),t.on(ja.CLICK,this.clearStates)}unbindEvents(){const{graph:t}=this.context;t.off(J.POINTER_DOWN,this.onPointerDown),t.off(J.POINTER_MOVE,this.onPointerMove),t.off(J.POINTER_UP,this.onPointerUp),t.off(ja.CLICK,this.clearStates)}update(t){this.unbindEvents(),this.options=cr(this.options,t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}Bc.defaultOptions={animation:!1,enable:!0,enableElements:["node","combo","edge"],immediately:!1,mode:"default",state:"selected",trigger:["shift"],style:{width:0,height:0,lineWidth:1,fill:"#1677FF",stroke:"#1677FF",fillOpacity:.1,zIndex:2,pointerEvents:"none"}};const Nf=r=>[r.canvas.x,r.canvas.y],Wa=.8,zo=["node","edge","combo"];function To(r,t,e,n,i=0){n==="TB"&&t(r,i);const a=e(r);if(a)for(const s of a)To(s,t,e,n,i+1);n==="BT"&&t(r,i)}function KX(r,t,e){const n=[[r,0]];for(;n.length;){const[i,a]=n.shift();t(i,a);const s=e(i);if(s)for(const o of s)n.push([o,a+1])}}function wI(r,t,e,n,i="both"){if(t==="combo"||t==="node")return Iv(r,e,n,i);const a=r.getEdgeData(e);if(!a)return[];const s=Iv(r,a.source,n-1,i),o=Iv(r,a.target,n-1,i);return Array.from(new Set([...s,...o,e]))}function Iv(r,t,e,n="both"){const i=new Set,a=new Set,s=new Set;return KX(t,(o,l)=>{l>e||(s.add(o),r.getRelatedEdgesData(o,n).forEach(u=>{const c=H(u);!a.has(c)&&l<e&&(s.add(c),a.add(c))}))},o=>r.getRelatedEdgesData(o,n).map(l=>l.source===o?l.target:l.source).filter(l=>i.has(l)?!1:(i.add(l),!0))),Array.from(s)}function Dv(r){return r.states||[]}var yd=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class g0 extends Tr{constructor(t,e){super(t,Object.assign({},g0.defaultOptions,e)),this.onClickSelect=n=>yd(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=>yd(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 Zl(t.graph),this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),zo.forEach(e=>{t.on(`${e}:${J.CLICK}`,this.onClickSelect)}),t.on(ja.CLICK,this.onClickCanvas)}get isMultipleSelect(){const{multiple:t,trigger:e}=this.options;return t&&this.shortcut.match(e)}getNeighborIds(t){const{target:e,targetType:n}=t,{graph:i}=this.context,{degree:a}=this.options;return wI(i,n,e.id,typeof a=="function"?a(t):a).filter(s=>s!==e.id)}updateState(t){return yd(this,void 0,void 0,function*(){const{state:e,unselectedState:n,neighborState:i,animation:a}=this.options;if(!e&&!i&&!n)return;const{target:s}=t,{graph:o}=this.context,l=o.getElementData(s.id),u=Dv(l).includes(e)?"unselect":"select",c={},h=this.isMultipleSelect,d=[s.id],g=this.getNeighborIds(t);if(h)if(Object.assign(c,this.getDataStates()),u==="select"){const p=(v,m)=>{v.forEach(b=>{const w=new Set(o.getElementState(b));w.add(m),w.delete(n),c[b]=Array.from(w)})};p(d,e),p(g,i),n&&Object.keys(c).forEach(v=>{const m=c[v];!m.includes(e)&&!m.includes(i)&&!m.includes(n)&&c[v].push(n)})}else{const p=c[s.id];c[s.id]=p.filter(v=>v!==e&&v!==i),p.includes(n)||c[s.id].push(n),g.forEach(v=>{c[v]=c[v].filter(m=>m!==i),c[v].includes(e)||c[v].push(n)})}else if(u==="select"){Object.assign(c,this.getClearStates(!!n));const p=(v,m)=>{v.forEach(b=>{c[b]||(c[b]=o.getElementState(b)),c[b].push(m)})};p(d,e),p(g,i),n&&Object.keys(c).forEach(v=>{!d.includes(v)&&!g.includes(v)&&c[v].push(n)})}else Object.assign(c,this.getClearStates());yield o.setElementState(c,a)})}getDataStates(){const{graph:t}=this.context,{nodes:e,edges:n,combos:i}=t.getData(),a={};return[...e,...n,...i].forEach(s=>{a[H(s)]=Dv(s)}),a}getClearStates(t=!1){const{graph:e}=this.context,{state:n,unselectedState:i,neighborState:a}=this.options,s=new Set([n,i,a]),{nodes:o,edges:l,combos:u}=e.getData(),c={};return[...o,...l,...u].forEach(h=>{const d=Dv(h),g=d.filter(p=>!s.has(p));(t||g.length!==d.length)&&(c[H(h)]=g)}),c}clearState(){return yd(this,void 0,void 0,function*(){const{graph:t}=this.context;yield t.setElementState(this.getClearStates(),this.options.animation)})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;zo.forEach(e=>{t.off(`${e}:${J.CLICK}`,this.onClickSelect)}),t.off(ja.CLICK,this.onClickCanvas)}destroy(){this.unbindEvents(),super.destroy()}}g0.defaultOptions={animation:!0,enable:!0,multiple:!1,trigger:["shift"],state:"selected",neighborState:"selected",unselectedState:void 0,degree:0};function Sr(r){var t;return!!(!((t=r.style)===null||t===void 0)&&t.collapsed)}function Rf(r,t){if(!r.startsWith(t))return!1;const e=r[t.length];return e>="A"&&e<="Z"}function ZX(r,t){return`${t}${mf(r)}`}function JX(r,t,e=!0){if(!t||!Rf(r,t))return r;const n=r.slice(t.length);return e?kW(n):n}function fn(r,t){const e=Object.entries(r).reduce((n,[i,a])=>(i==="className"||i==="class"||Rf(i,t)&&Object.assign(n,{[JX(i,t)]:a}),n),{});if("opacity"in r){const n=ZX("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 Dw(r,t){const e=t.length;return Object.keys(r).reduce((n,i)=>{if(i.startsWith(t)){const a=i.slice(e);n[a]=r[i]}return n},{})}function xI(r,t){const e=typeof t=="string"?[t]:t,n={};return Object.keys(r).forEach(i=>{e.find(a=>i.startsWith(a))||(n[i]=r[i])}),n}function Hr(r=0){if(typeof r=="number")return[r,r,r];const[t,e=t,n=t]=r;return[t,e,n]}var QX=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,t){const{datum:e,graph:n}=t;return typeof r=="function"?r.call(n,e):Object.fromEntries(Object.entries(r).map(([i,a])=>typeof a=="function"?[i,a.call(n,e)]:[i,a]))}function Nn(r,t){const e=(r==null?void 0:r.style)||{},n=(t==null?void 0:t.style)||{};for(const i in e)i in n||(n[i]=e[i]);return Object.assign({},r,t,{style:n})}function tK(r){const{x:t,y:e,z:n,class:i,className:a,transform:s,transformOrigin:o,zIndex:l,visibility:u}=r;return QX(r,["x","y","z","class","className","transform","transformOrigin","zIndex","visibility"])}function eK(r,t){const e=Hr(r);let n={};return t.text&&!t.fontSize&&(n={fontSize:Math.min(...e)*.5}),t.src&&(!t.width||!t.height)&&(n={width:e[0]*.5,height:e[1]*.5}),n}function jM(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 nK(r,t){if(!t)return{};const{type:e,color:n,field:i,invert:a}=t,s=l=>{const u=typeof n=="string"?qa("palette",n):n;if(typeof u=="function"){const c={};return l.forEach(([h,d])=>{c[h]=u(a?1-d:d)}),c}else if(Array.isArray(u)){const c=a?[...u].reverse():u,h={};return l.forEach(([d,g])=>{h[d]=c[g%u.length]}),h}return{}},o=(l,u)=>{var c;return typeof l=="string"?(c=u.data)===null||c===void 0?void 0:c[l]:l==null?void 0:l(u)};if(e==="group"){const l=a0(r,d=>{if(!i)return"default";const g=o(i,d);return g?String(g):"default"}),u=Object.keys(l),c=s(u.map((d,g)=>[d,g])),h={};return Object.entries(l).forEach(([d,g])=>{g.forEach(p=>{h[H(p)]=c[d]})}),h}else if(e==="value"){const[l,u]=r.reduce(([h,d],g)=>{const p=o(i,g);if(typeof p!="number")throw new Error(La(`Palette field ${i} is not a number`));return[Math.min(h,p),Math.max(d,p)]},[1/0,-1/0]),c=u-l;return s(r.map(h=>[h.id,(o(i,h)-l)/c]))}}function EI(r){const t=typeof r=="string"?qa("palette",r):r;if(typeof t!="function")return t}function _I(r,t){let e=2*r;return typeof t=="string"?e=r*Number(t.replace("%",""))/100:typeof t=="number"&&(e=t),isNaN(e)&&(e=2*r),e}function SI(r,t,e=1,n=!1){const i=n?e:1,a=(r.max[0]-r.min[0])*i;return _I(a,t)}function rK(r,t,e=1){const n=Pe(r[0],r[1])*e;return _I(n,t)}class zc extends jx{constructor(t){qM(t.style),super(t),this.shapeMap={},this.animateMap={},this.render(this.attributes,this),this.setVisibility(),this.bindEvents()}get parsedAttributes(){return this.attributes}upsert(t,e,n,i,a){var s,o,l,u,c,h,d,g;const p=this.shapeMap[t];if(n===!1){p&&((s=a==null?void 0:a.beforeDestroy)===null||s===void 0||s.call(a,p),i.removeChild(p),delete this.shapeMap[t],(o=a==null?void 0:a.afterDestroy)===null||o===void 0||o.call(a,p));return}const v=typeof e=="string"?qa(Ra.SHAPE,e):e;if(!v)throw new Error(La(`Shape ${e} not found`));if(!p||p.destroyed||!(p instanceof v)){p&&((l=a==null?void 0:a.beforeDestroy)===null||l===void 0||l.call(a,p),p==null||p.destroy(),(u=a==null?void 0:a.afterDestroy)===null||u===void 0||u.call(a,p)),(c=a==null?void 0:a.beforeCreate)===null||c===void 0||c.call(a);const m=new v({className:t,style:n});return i.appendChild(m),this.shapeMap[t]=m,(h=a==null?void 0:a.afterCreate)===null||h===void 0||h.call(a,m),m}return(d=a==null?void 0:a.beforeUpdate)===null||d===void 0||d.call(a,p),Gw(p,n),(g=a==null?void 0:a.afterUpdate)===null||g===void 0||g.call(a,p),p}update(t={}){const e=Object.assign({},this.attributes,t);qM(e),JZ(this,e),this.render(e,this),this.setVisibility()}bindEvents(){}getGraphicStyle(t){return tK(t)}get compositeShapes(){return[["badges","badge-"],["ports","port-"]]}animate(t,e){if(t.length===0)return null;const n=[];if(t[0].x!==void 0||t[0].y!==void 0||t[0].z!==void 0){const{x:a=0,y:s=0,z:o=0}=this.attributes;t.forEach(l=>{const{x:u=a,y:c=s,z:h=o}=l;Object.assign(l,{transform:h?[["translate3d",u,c,h]]:[["translate",u,c]]})})}const i=super.animate(t,e);if(i&&(Fv(this,i),n.push(i)),Array.isArray(t)&&t.length>0){const a=["transform","transformOrigin","x","y","z","zIndex"];if(Object.keys(t[0]).some(s=>!a.includes(s))){Object.entries(this.shapeMap).forEach(([o,l])=>{const u=`get${mf(o)}Style`,c=this[u];if(Et(c)){const h=t.map(g=>c.call(this,Object.assign(Object.assign({},this.attributes),g))),d=l.animate(Iw(h),e);d&&(Fv(l,d),n.push(d))}});const s=(o,l)=>{if(!Zi(o)){const u=`get${mf(l)}Style`,c=this[u];if(Et(c)){const h=t.map(d=>c.call(this,Object.assign(Object.assign({},this.attributes),d)));Object.entries(h[0]).map(([d])=>{const g=h.map(v=>v[d]),p=o[d];if(p){const v=p.animate(Iw(g),e);v&&(Fv(p,v),n.push(v))}})}}};this.compositeShapes.forEach(([o,l])=>{const u=Dw(this.shapeMap,l);s(u,o)})}}return Vx(n)}getShape(t){return this.shapeMap[t]}setVisibility(){const{visibility:t}=this.attributes;Fo(this,t)}destroy(){this.shapeMap={},this.animateMap={},super.destroy()}}function Fv(r,t){t==null||t.finished.then(()=>{const e=r.activeAnimations.findIndex(n=>n===t);e>-1&&r.activeAnimations.splice(e,1)})}function qM(r){if(!r)return{};if("x"in r||"y"in r||"z"in r){const{x:t=0,y:e=0,z:n,transform:i}=r,a=tI(t,e,n,i);a&&(r.transform=a)}return r}var iK=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class Xs extends zc{constructor(t){super(Nn({style:Xs.defaultStyleProps},t))}isTextStyle(t){return Rf(t,"label")}isBackgroundStyle(t){return Rf(t,"background")}getTextStyle(t){const e=this.getGraphicStyle(t),{padding:n}=e,i=iK(e,["padding"]);return xI(i,"background")}getBackgroundStyle(t){if(t.background===!1)return!1;const e=this.getGraphicStyle(t),{wordWrap:n,wordWrapWidth:i,padding:a}=e,s=fn(e,"background"),{min:[o,l],center:[u,c],halfExtents:[h,d]}=this.shapeMap.text.getGeometryBounds(),[g,p,v,m]=la(a),b=h*2+m+p,{width:w,height:x}=s;w&&x?Object.assign(s,{x:u-Number(w)/2,y:c-Number(x)/2}):Object.assign(s,{x:o-m,y:l-g,width:n?Math.min(b,i+m+p):b,height:d*2+g+v});const{radius:S}=s;if(typeof S=="string"&&S.endsWith("%")){const _=Number(S.replace("%",""))/100;s.radius=Math.min(+s.width,+s.height)*_}return s}render(t=this.parsedAttributes,e=this){this.upsert("text",Hs,this.getTextStyle(t),e),this.upsert("background",Sn,this.getBackgroundStyle(t),e)}getGeometryBounds(){return(this.getShape("background")||this.getShape("text")).getGeometryBounds()}}Xs.defaultStyleProps={padding:0,fontSize:12,fontFamily:"system-ui, sans-serif",wordWrap:!0,maxLines:1,wordWrapWidth:128,textOverflow:"...",textBaseline:"middle",backgroundOpacity:.75,backgroundZIndex:-1,backgroundLineWidth:0};class $a extends zc{constructor(t){super(Nn({style:$a.defaultStyleProps},t))}getBadgeStyle(t){return this.getGraphicStyle(t)}render(t=this.parsedAttributes,e=this){this.upsert("label",Xs,this.getBadgeStyle(t),e)}getGeometryBounds(){const t=this.getShape("label");return(t.getShape("background")||t.getShape("text")).getGeometryBounds()}}$a.defaultStyleProps={padding:[2,4,2,4],fontSize:10,wordWrap:!1,backgroundRadius:"50%",backgroundOpacity:1};function aK(r,t=!0){const e=[];return r.forEach((n,i)=>{e.push([i===0?"M":"L",...n])}),t&&e.push(["Z"]),e}const WM={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 sK(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 WM?n=a:t.unshift(a),i={type:n},WM[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 oK(r){const t=[];return(typeof r=="string"?sK(r):r).forEach(n=>{const i=n[0];if(i==="Z"){t.push(t[0]);return}if(i!=="A")for(let a=1;a<n.length;a=a+2)t.push([n[a],n[a+1],0]);else{const a=n.length;t.push([n[a-2],n[a-1],0])}}),t}const MI=r=>{if(r.length<2)return[["M",0,0],["L",0,0]];const t=r[0],e=r[1],n=r[r.length-1],i=r[r.length-2];r.unshift(i,n),r.push(t,e);const a=[["M",n[0],n[1]]];for(let s=1;s<r.length-2;s+=1){const[o,l]=r[s-1],[u,c]=r[s],[h,d]=r[s+1],[g,p]=s!==r.length-2?r[s+2]:[h,d],v=u+(h-o)/6,m=c+(d-l)/6,b=h-(g-u)/6,w=d-(p-c)/6;a.push(["C",v,m,b,w,h,d])}return a};function lK(r,t,e,n,i,a,s){const[o,l]=Oa(r,t),u={textAlign:t==="left"?"right":t==="right"?"left":"center",textBaseline:t==="top"?"bottom":t==="bottom"?"top":"middle",transform:[["translate",o+e,l+n]]};if(t==="center"||!i)return u;const c=oK(a);if(!c||c.length<=3)return u;const h=c.map((p,v)=>{const m=p,b=c[(v+1)%c.length];return Ye(m,b)?null:[m,b]}).filter(Boolean),d=HX([o,l],h),g=bI([o,l],d);if(g&&d&&(u.transform=[["translate",g[0]+e,g[1]+n]],s)){const p=Math.atan((d[0][1]-d[1][1])/(d[0][0]-d[1][0]));u.transform.push(["rotate",p/Math.PI*180]),u.textAlign="center",(t==="right"||t==="left")&&(p>0?u.textBaseline=t==="right"?"bottom":"top":u.textBaseline=t==="right"?"top":"bottom")}return u}var uK=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 $c extends zc{constructor(t){super(Nn({style:$c.defaultStyleProps},t))}getLabelStyle(t){if(!t.label||!t.d||t.d.length===0)return!1;const e=fn(this.getGraphicStyle(t),"label"),{maxWidth:n,offsetX:i,offsetY:a,autoRotate:s,placement:o,closeToPath:l}=e,u=uK(e,["maxWidth","offsetX","offsetY","autoRotate","placement","closeToPath"]),c=this.shapeMap.key,h=c==null?void 0:c.getRenderBounds();return Object.assign(lK(h,o,i,a,l,t.d,s),{wordWrapWidth:SI(h,n)},u)}getKeyStyle(t){return this.getGraphicStyle(t)}render(t,e){this.upsert("key",qr,this.getKeyStyle(t),e),this.upsert("label",Xs,this.getLabelStyle(t),e)}}$c.defaultStyleProps={label:!0,labelPlacement:"bottom",labelCloseToPath:!0,labelAutoRotate:!0,labelOffsetX:0,labelOffsetY:0};function cK(r){const t=[],e=n=>{n!=null&&n.children.length&&n.children.forEach(i=>{t.push(i),e(i)})};return e(r),t}function hK(r){const t=[];let e=r.parentNode;for(;e;)t.push(e),e=e.parentNode;return t}let Qx=class extends Dc{constructor(t){super(t),this.onMounted=()=>{this.handleRadius()},this.onAttrModified=()=>{this.handleRadius()},Cl=this,this.isMutationObserved=!0,this.addEventListener(Xt.MOUNTED,this.onMounted),this.addEventListener(Xt.ATTR_MODIFIED,this.onAttrModified)}handleRadius(){const{radius:t,clipPath:e,width:n=0,height:i=0}=this.attributes;if(t&&n&&i){const[a,s]=this.getBounds().min,o={x:a,y:s,radius:t,width:n,height:i};if(e)Object.assign(this.parsedStyle.clipPath.style,o);else{const l=new Sn({style:o});this.style.clipPath=l}}else e&&(this.style.clipPath=null)}};const Fw=new WeakMap;let Cl=null;const tE=r=>{if(Cl&&hK(Cl).includes(r)){const t=Fw.get(r);t?t.includes(Cl)||t.push(Cl):Fw.set(r,[Cl])}},eE=r=>{const t=Fw.get(r);t&&t.forEach(e=>e.handleRadius())};class kI extends zc{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()?Qx:Hs,this.getIconStyle(t),e)}}class CI extends zc{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 bd=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class vi extends CI{constructor(t){super(Nn({style:vi.defaultStyleProps},t)),this.type="node"}getSize(t=this.attributes){const{size:e}=t;return Hr(e)}getKeyStyle(t){const e=this.getGraphicStyle(t);return Object.assign(xI(e,["label","halo","icon","badge","port"]))}getLabelStyle(t){if(t.label===!1||!t.labelText)return!1;const e=fn(this.getGraphicStyle(t),"label"),{placement:n,maxWidth:i,offsetX:a,offsetY:s}=e,o=bd(e,["placement","maxWidth","offsetX","offsetY"]),l=this.getShape("key").getLocalBounds();return Object.assign(ak(l,n,a,s),{wordWrapWidth:SI(l,i)},o)}getHaloStyle(t){if(t.halo===!1)return!1;const e=this.getKeyStyle(t),{fill:n}=e,i=bd(e,["fill"]),a=fn(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign(Object.assign({},i),{stroke:n}),a)}getIconStyle(t){if(t.icon===!1||!t.iconText&&!t.iconSrc)return!1;const e=fn(this.getGraphicStyle(t),"icon");return Object.assign(eK(t.size,e),e)}getBadgesStyle(t){var e;const n=Dw(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=bd(t,["badges","badgePalette","opacity"]),u=EI(s),c=fn(this.getGraphicStyle(l),"badge");return a.forEach((h,d)=>{i[d]=Object.assign(Object.assign({backgroundFill:u?u[d%(u==null?void 0:u.length)]:void 0,opacity:o},c),this.getBadgeStyle(h))}),i}getBadgeStyle(t){const e=this.getShape("key"),{placement:n="top",offsetX:i,offsetY:a}=t,s=bd(t,["placement","offsetX","offsetY"]),o=ak(e.getLocalBounds(),n,i,a,!0);return Object.assign(Object.assign({},o),s)}getPortsStyle(t){var e;const n=this.getPorts(),i={};if(Object.keys(n).forEach(o=>{i[o]=!1}),t.port===!1||!(!((e=t.ports)===null||e===void 0)&&e.length))return i;const a=fn(this.getGraphicStyle(t),"port"),{ports:s=[]}=t;return s.forEach((o,l)=>{const u=o.key||l,c=Object.assign(Object.assign({},a),o);if(YI(c))i[u]=!1;else{const[h,d]=this.getPortXY(t,o);i[u]=Object.assign({transform:[["translate",h,d]]},c)}}),i}getPortXY(t,e){const{placement:n="left"}=e,i=this.getShape("key");return sE(dK(this.context,i),n)}getPorts(){return Dw(this.shapeMap,"port-")}getCenter(){return this.getShape("key").getBounds().center}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return GX(t,n,e)}drawHaloShape(t,e){const n=this.getHaloStyle(t),i=this.getShape("key");this.upsert("halo",i.constructor,n,e)}drawIconShape(t,e){const n=this.getIconStyle(t);this.upsert("icon",kI,n,e),tE(this)}drawBadgeShapes(t,e){const n=this.getBadgesStyle(t);Object.keys(n).forEach(i=>{const a=n[i];this.upsert(`badge-${i}`,$a,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,Ua,a,e)})}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",Xs,n,e)}_drawKeyShape(t,e){return this.drawKeyShape(t,e)}render(t=this.parsedAttributes,e=this){this._drawKeyShape(t,e),this.getShape("key")&&(this.drawHaloShape(t,e),this.drawIconShape(t,e),this.drawBadgeShapes(t,e),this.drawLabelShape(t,e),this.drawPortShapes(t,e))}update(t){super.update(t),t&&("x"in t||"y"in t||"z"in t)&&eE(this)}onframe(){this.drawBadgeShapes(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this)}}vi.defaultStyleProps={x:0,y:0,size:32,droppable:!0,draggable:!0,port:!0,ports:[],portZIndex:2,portLinkToCenter:!1,badge:!0,badges:[],badgeZIndex:3,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloStrokeOpacity:.25,haloPointerEvents:"none",haloZIndex:-1,icon:!0,iconZIndex:1,label:!0,labelIsBillboard:!0,labelMaxWidth:"200%",labelPlacement:"bottom",labelWordWrap:!1,labelZIndex:0};function dK(r,t){if(!r)return t.getLocalBounds();const e=r.canvas.getLayer(),n=t.cloneNode();Fo(n,"hidden"),e.appendChild(n);const i=n.getLocalBounds();return n.destroy(),i}let jc=class TI extends vi{constructor(t){super(Nn({style:TI.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",Ua,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*Wa;return e?Object.assign({width:i,height:i},e):!1}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return f0(t,n,e)}};jc.defaultStyleProps={size:32};class p0 extends vi{constructor(t){super(t)}get parsedAttributes(){return this.attributes}drawKeyShape(t,e){return this.upsert("key",Vo,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t);return Object.assign(Object.assign({},e),{points:this.getPoints(t)})}getIntersectPoint(t,e=!1){var n,i;const{points:a}=this.getShape("key").attributes,s=[+(((n=this.attributes)===null||n===void 0?void 0:n.x)||0),+(((i=this.attributes)===null||i===void 0?void 0:i.y)||0)];return yI(t,s,a,!0,e).point}}class fK extends p0{constructor(t){super(t)}getPoints(t){const[e,n]=this.getSize(t);return KZ(e,n)}}var gK=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 v0 extends jc{constructor(t){super(Nn({style:v0.defaultStyleProps},t))}parseOuterR(){const{size:t}=this.parsedAttributes;return Math.min(...Hr(t))/2}parseInnerR(){const{innerR:t}=this.parsedAttributes;return oe(t)?parseInt(t)/100*this.parseOuterR():t}drawDonutShape(t,e){const{donuts:n}=t;if(!(n!=null&&n.length))return;const i=n.map(h=>bt(h)?{value:h}:h),a=fn(this.getGraphicStyle(t),"donut"),s=EI(t.donutPalette);if(!s)return;const o=i.reduce((h,d)=>{var g;return h+((g=d.value)!==null&&g!==void 0?g:0)},0),l=this.parseOuterR(),u=this.parseInnerR();let c=0;i.forEach((h,d)=>{const{value:g=0,color:p=s[d%s.length]}=h,v=gK(h,["value","color"]),m=(o===0?1/i.length:g/o)*360;this.upsert(`round${d}`,qr,Object.assign(Object.assign(Object.assign({},a),{d:mK(l,u,c,c+m),fill:p}),v),e),c+=m})}render(t,e=this){super.render(t,e),this.drawDonutShape(t,e)}}v0.defaultStyleProps={innerR:"50%",donuts:[],donutPalette:"tableau"};const wd=(r,t,e,n)=>[r+Math.sin(n)*e,t-Math.cos(n)*e],pK=(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"]],vK=(r,t,e,n,i,a)=>{const[s,o]=[i/360*2*Math.PI,a/360*2*Math.PI],l=[wd(r,t,n,s),wd(r,t,e,s),wd(r,t,e,o),wd(r,t,n,o)],u=o-s>Math.PI?1:0;return[["M",l[0][0],l[0][1]],["L",l[1][0],l[1][1]],["A",e,e,0,u,1,l[2][0],l[2][1]],["L",l[3][0],l[3][1]],["A",n,n,0,u,0,l[0][0],l[0][1]],["Z"]]},mK=(r=0,t=0,e,n)=>{const[i,a]=[0,0];return Math.abs(e-n)%360<1e-6?pK(i,a,r,t):vK(i,a,r,t,e,n)};class m0 extends vi{constructor(t){super(Nn({style:m0.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",Lc,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*Wa;return e?Object.assign({width:a,height:a},e):!1}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return f0(t,n,e)}}m0.defaultStyleProps={size:[45,35]};class yK extends p0{constructor(t){super(t)}getOuterR(t){return t.outerR||Math.min(...this.getSize(t))/2}getPoints(t){return QZ(this.getOuterR(t))}getIconStyle(t){const e=super.getIconStyle(t),n=this.getOuterR(t)*Wa;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 bK(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 wK(r,t){var e=t.cx,n=e===void 0?0:e,i=t.cy,a=i===void 0?0:i,s=t.rx,o=t.ry;if(r.ellipse)r.ellipse(n,a,s,o,0,0,Math.PI*2,!1);else{var l=s>o?s:o,u=s>o?1:s/o,c=s>o?o/s:1;r.save(),r.scale(u,c),r.arc(n,a,l,0,Math.PI*2)}}function xK(r,t){var e=t.x1,n=t.y1,i=t.x2,a=t.y2,s=t.markerStart,o=t.markerEnd,l=t.markerStartOffset,u=t.markerEndOffset,c=0,h=0,d=0,g=0,p=0,v,m;s&&se(s)&&l&&(v=i-e,m=a-n,p=Math.atan2(m,v),c=Math.cos(p)*(l||0),h=Math.sin(p)*(l||0)),o&&se(o)&&u&&(v=e-i,m=n-a,p=Math.atan2(m,v),d=Math.cos(p)*(u||0),g=Math.sin(p)*(u||0)),r.moveTo(e+c,n+h),r.lineTo(i+d,a+g)}function EK(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.d,o=s.absolutePath,l=s.segments,u=0,c=0,h=0,d=0,g=0,p,v;if(e&&se(e)&&i){var m=e.parentNode.getStartTangent(),b=Rt(m,2),w=b[0],x=b[1];p=w[0]-x[0],v=w[1]-x[1],g=Math.atan2(v,p),u=Math.cos(g)*(i||0),c=Math.sin(g)*(i||0)}if(n&&se(n)&&a){var S=n.parentNode.getEndTangent(),_=Rt(S,2),M=_[0],k=_[1];p=M[0]-k[0],v=M[1]-k[1],g=Math.atan2(v,p),h=Math.cos(g)*(a||0),d=Math.sin(g)*(a||0)}for(var C=0;C<o.length;C++){var P=o[C],T=P[0],A=o[C+1],R=C===0&&(u!==0||c!==0),L=(C===o.length-1||A&&(A[0]==="M"||A[0]==="Z"))&&h!==0&&d!==0,$=R?[u,c]:[0,0],q=Rt($,2),j=q[0],B=q[1],D=L?[h,d]:[0,0],G=Rt(D,2),X=G[0],K=G[1];switch(T){case"M":r.moveTo(P[1]+j,P[2]+B);break;case"L":r.lineTo(P[1]+X,P[2]+K);break;case"Q":r.quadraticCurveTo(P[1],P[2],P[3]+X,P[4]+K);break;case"C":r.bezierCurveTo(P[1],P[2],P[3],P[4],P[5]+X,P[6]+K);break;case"A":{var ht=l[C].arcParams,ut=ht.cx,ct=ht.cy,dt=ht.rx,pt=ht.ry,mt=ht.startAngle,It=ht.endAngle,zt=ht.xRotation,Te=ht.sweepFlag;if(r.ellipse)r.ellipse(ut,ct,dt,pt,zt,mt,It,!!(1-Te));else{var Rn=dt>pt?dt:pt,ln=dt>pt?1:dt/pt,dr=dt>pt?pt/dt:1;r.translate(ut,ct),r.rotate(zt),r.scale(ln,dr),r.arc(0,0,Rn,mt,It,!!(1-Te)),r.scale(1/ln,1/dr),r.rotate(-zt),r.translate(-ut,-ct)}L&&r.lineTo(P[6]+h,P[7]+d);break}case"Z":r.closePath();break}}}function _K(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.points.points,o=s.length,l=s[0][0],u=s[0][1],c=s[o-1][0],h=s[o-1][1],d=0,g=0,p=0,v=0,m=0,b,w;e&&se(e)&&i&&(b=s[1][0]-s[0][0],w=s[1][1]-s[0][1],m=Math.atan2(w,b),d=Math.cos(m)*(i||0),g=Math.sin(m)*(i||0)),n&&se(n)&&a&&(b=s[o-1][0]-s[0][0],w=s[o-1][1]-s[0][1],m=Math.atan2(w,b),p=Math.cos(m)*(a||0),v=Math.sin(m)*(a||0)),r.moveTo(l+(d||p),u+(g||v));for(var x=1;x<o-1;x++){var S=s[x];r.lineTo(S[0],S[1])}r.lineTo(c,h)}function SK(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.points.points,o=s.length,l=s[0][0],u=s[0][1],c=s[o-1][0],h=s[o-1][1],d=0,g=0,p=0,v=0,m=0,b,w;e&&se(e)&&i&&(b=s[1][0]-s[0][0],w=s[1][1]-s[0][1],m=Math.atan2(w,b),d=Math.cos(m)*(i||0),g=Math.sin(m)*(i||0)),n&&se(n)&&a&&(b=s[o-2][0]-s[o-1][0],w=s[o-2][1]-s[o-1][1],m=Math.atan2(w,b),p=Math.cos(m)*(a||0),v=Math.sin(m)*(a||0)),r.moveTo(l+d,u+g);for(var x=1;x<o-1;x++){var S=s[x];r.lineTo(S[0],S[1])}r.lineTo(c+p,h+v)}function MK(r,t){var e=t.x,n=e===void 0?0:e,i=t.y,a=i===void 0?0:i,s=t.radius,o=t.width,l=t.height,u=o,c=l,h=s&&s.some(function(_){return _!==0});if(!h)r.rect(n,a,u,c);else{var d=o>0?1:-1,g=l>0?1:-1,p=d+g===0,v=s.map(function(_){return Ue(_,0,Math.min(Math.abs(u)/2,Math.abs(c)/2))}),m=Rt(v,4),b=m[0],w=m[1],x=m[2],S=m[3];r.moveTo(d*b+n,a),r.lineTo(u-d*w+n,a),w!==0&&r.arc(u-d*w+n,g*w+a,w,-g*Math.PI/2,d>0?0:Math.PI,p),r.lineTo(u+n,c-g*x+a),x!==0&&r.arc(u-d*x+n,c-g*x+a,x,d>0?0:Math.PI,g>0?Math.PI/2:1.5*Math.PI,p),r.lineTo(d*S+n,c+a),S!==0&&r.arc(d*S+n,c-g*S+a,S,g>0?Math.PI/2:-Math.PI/2,d>0?Math.PI:0,p),r.lineTo(n,g*b+a),b!==0&&r.arc(d*b+n,g*b+a,b,d>0?Math.PI:0,g>0?Math.PI*1.5:Math.PI/2,p)}}var kK=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Wt(this,t,[].concat(i)),e.name="canvas-path-generator",e}return qt(t,r),it(t,[{key:"init",value:function(){var n,i=(n={},wt(wt(wt(wt(wt(wt(wt(wt(wt(wt(n,Q.CIRCLE,bK),Q.ELLIPSE,wK),Q.RECT,MK),Q.LINE,xK),Q.POLYLINE,SK),Q.POLYGON,_K),Q.PATH,EK),Q.TEXT,void 0),Q.GROUP,void 0),Q.IMAGE,void 0),wt(wt(wt(n,Q.HTML,void 0),Q.MESH,void 0),Q.FRAGMENT,void 0));this.context.pathGeneratorFactory=i}},{key:"destroy",value:function(){delete this.context.pathGeneratorFactory}}])}(Vs);/*!
- * @antv/g-plugin-canvas-picker
- * @description A G plugin for picking in canvas
- * @version 2.1.18
- * @date 1/23/2025, 8:35:03 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var CK=Qt(),TK=Qt(),OK=Qt(),AK=Se(),OI=function(){function r(){var t=this;at(this,r),this.isHit=function(e,n,i,a){var s=t.context.pointInPathPickerFactory[e.nodeName];if(s){var o=Ji(AK,i),l=Qn(TK,Kn(OK,n[0],n[1],0),o);if(s(e,new zn(l[0],l[1]),a,t.isPointInPath,t.context,t.runtime))return!0}return!1},this.isPointInPath=function(e,n){var i=t.runtime.offscreenCanvasCreator.getOrCreateContext(t.context.config.offscreenCanvas),a=t.context.pathGeneratorFactory[e.nodeName];return a&&(i.beginPath(),a(i,e.parsedStyle),i.closePath()),i.isPointInPath(n.x,n.y)}}return it(r,[{key:"apply",value:function(e,n){var i,a=this,s=e.renderingService,o=e.renderingContext;this.context=e,this.runtime=n;var l=(i=o.root)===null||i===void 0?void 0:i.ownerDocument;s.hooks.pick.tapPromise(r.tag,function(){var u=Fs(jn().mark(function c(h){return jn().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return g.abrupt("return",a.pick(l,h));case 1:case"end":return g.stop()}},c)}));return function(c){return u.apply(this,arguments)}}()),s.hooks.pickSync.tap(r.tag,function(u){return a.pick(l,u)})}},{key:"pick",value:function(e,n){var i=n.topmost,a=n.position,s=a.x,o=a.y,l=Kn(CK,s,o,0),u=e.elementsFromBBox(l[0],l[1],l[0],l[1]),c=[],h=vo(u),d;try{for(h.s();!(d=h.n()).done;){var g=d.value,p=g.getWorldTransform(),v=this.isHit(g,l,p,!1);if(v){var m=PL(g);if(m){var b=m.parsedStyle.clipPath,w=this.isHit(b,l,b.getWorldTransform(),!0);if(w){if(i)return n.picked=[g],n;c.push(g)}}else{if(i)return n.picked=[g],n;c.push(g)}}}}catch(x){h.e(x)}finally{h.f()}return n.picked=c,n}}])}();OI.tag="CanvasPicker";function PK(r,t,e){var n=r.parsedStyle,i=n.cx,a=i===void 0?0:i,s=n.cy,o=s===void 0?0:s,l=n.r,u=n.fill,c=n.stroke,h=n.lineWidth,d=h===void 0?1:h,g=n.increasedLineWidthForHitTesting,p=g===void 0?0:g,v=n.pointerEvents,m=v===void 0?"auto":v,b=(d+p)/2,w=Ba(a,o,t.x,t.y),x=Go(m,u,c),S=Rt(x,2),_=S[0],M=S[1];return _&&M||e?w<=l+b:_?w<=l:M?w>=l-b&&w<=l+b:!1}function xd(r,t,e,n){return r/(e*e)+t/(n*n)}function NK(r,t,e){var n=r.parsedStyle,i=n.cx,a=i===void 0?0:i,s=n.cy,o=s===void 0?0:s,l=n.rx,u=n.ry,c=n.fill,h=n.stroke,d=n.lineWidth,g=d===void 0?1:d,p=n.increasedLineWidthForHitTesting,v=p===void 0?0:p,m=n.pointerEvents,b=m===void 0?"auto":m,w=t.x,x=t.y,S=Go(b,c,h),_=Rt(S,2),M=_[0],k=_[1],C=(g+v)/2,P=(w-a)*(w-a),T=(x-o)*(x-o);return M&&k||e?xd(P,T,l+C,u+C)<=1:M?xd(P,T,l,u)<=1:k?xd(P,T,l-C,u-C)>=1&&xd(P,T,l+C,u+C)<=1:!1}function wo(r,t,e,n,i,a){return i>=r&&i<=r+e&&a>=t&&a<=t+n}function RK(r,t,e,n,i,a,s){var o=i/2;return wo(r-o,t-o,e,i,a,s)||wo(r+e-o,t-o,i,n,a,s)||wo(r+o,t+n-o,e,i,a,s)||wo(r-o,t+o,i,n,a,s)}function Ed(r,t,e,n,i,a,s,o){var l=(Math.atan2(o-t,s-r)+Math.PI*2)%(Math.PI*2),u={x:r+e*Math.cos(l),y:t+e*Math.sin(l)};return Ba(u.x,u.y,s,o)<=a/2}function ks(r,t,e,n,i,a,s){var o=Math.min(r,e),l=Math.max(r,e),u=Math.min(t,n),c=Math.max(t,n),h=i/2;return a>=o-h&&a<=l+h&&s>=u-h&&s<=c+h?_G(r,t,e,n,a,s)<=i/2:!1}function AI(r,t,e,n,i){var a=r.length;if(a<2)return!1;for(var s=0;s<a-1;s++){var o=r[s][0],l=r[s][1],u=r[s+1][0],c=r[s+1][1];if(ks(o,l,u,c,t,e,n))return!0}if(i){var h=r[0],d=r[a-1];if(ks(h[0],h[1],d[0],d[1],t,e,n))return!0}return!1}var LK=1e-6;function Bv(r){return Math.abs(r)<LK?0:r<0?-1:1}function IK(r,t,e){return(e[0]-r[0])*(t[1]-r[1])===(t[0]-r[0])*(e[1]-r[1])&&Math.min(r[0],t[0])<=e[0]&&e[0]<=Math.max(r[0],t[0])&&Math.min(r[1],t[1])<=e[1]&&e[1]<=Math.max(r[1],t[1])}function PI(r,t,e){var n=!1,i=r.length;if(i<=2)return!1;for(var a=0;a<i;a++){var s=r[a],o=r[(a+1)%i];if(IK(s,o,[t,e]))return!0;Bv(s[1]-e)>0!=Bv(o[1]-e)>0&&Bv(t-(e-s[1])*(s[0]-o[0])/(s[1]-o[1])-s[0])<0&&(n=!n)}return n}function GM(r,t,e){for(var n=!1,i=0;i<r.length;i++){var a=r[i];if(n=PI(a,t,e),n)break}return n}function DK(r,t,e){var n=r.parsedStyle,i=n.x1,a=n.y1,s=n.x2,o=n.y2,l=n.lineWidth,u=l===void 0?1:l,c=n.increasedLineWidthForHitTesting,h=c===void 0?0:c,d=n.pointerEvents,g=d===void 0?"auto":d,p=n.fill,v=n.stroke,m=Go(g,p,v),b=Rt(m,2),w=b[1];return!w&&!e||!u?!1:ks(i,a,s,o,u+h,t.x,t.y)}function FK(r,t,e,n,i){for(var a=!1,s=t/2,o=0;o<r.length;o++){var l=r[o],u=l.currentPoint,c=l.params,h=l.prePoint,d=l.box;if(!(d&&!wo(d.x-s,d.y-s,d.width+t,d.height+t,e,n)))switch(l.command){case"L":case"Z":if(a=ks(h[0],h[1],u[0],u[1],t,e,n),a)return!0;break;case"Q":var g=AG(h[0],h[1],c[1],c[2],c[3],c[4],e,n);if(a=g<=t/2,a)return!0;break;case"C":var p=U3(h[0],h[1],c[1],c[2],c[3],c[4],c[5],c[6],e,n,i);if(a=p<=t/2,a)return!0;break;case"A":l.cubicParams||(l.cubicParams=Nx(h[0],h[1],c[1],c[2],c[3],c[4],c[5],c[6],c[7],void 0));for(var v=l.cubicParams,m=h,b=0;b<v.length;b+=6){var w=U3(m[0],m[1],v[b],v[b+1],v[b+2],v[b+3],v[b+4],v[b+5],e,n,i);if(m=[v[b+4],v[b+5]],a=w<=t/2,a)return!0}break}}return a}function BK(r,t,e,n,i,a){var s=r.parsedStyle,o=s.lineWidth,l=o===void 0?1:o,u=s.increasedLineWidthForHitTesting,c=u===void 0?0:u,h=s.stroke,d=s.fill,g=s.d,p=s.pointerEvents,v=p===void 0?"auto":p,m=g.segments,b=g.hasArc,w=g.polylines,x=g.polygons,S=Go(v,(x==null?void 0:x.length)&&d,h),_=Rt(S,2),M=_[0],k=_[1],C=kw(r),P=!1;return M||e?(b?P=n(r,t):P=GM(x,t.x,t.y)||GM(w,t.x,t.y),P):((k||e)&&(P=FK(m,l+c,t.x,t.y,C)),P)}function zK(r,t,e){var n=r.parsedStyle,i=n.stroke,a=n.fill,s=n.lineWidth,o=s===void 0?1:s,l=n.increasedLineWidthForHitTesting,u=l===void 0?0:l,c=n.points,h=n.pointerEvents,d=h===void 0?"auto":h,g=Go(d,a,i),p=Rt(g,2),v=p[0],m=p[1],b=!1;return(m||e)&&(b=AI(c.points,o+u,t.x,t.y,!0)),!b&&(v||e)&&(b=PI(c.points,t.x,t.y)),b}function $K(r,t,e){var n=r.parsedStyle,i=n.lineWidth,a=i===void 0?1:i,s=n.increasedLineWidthForHitTesting,o=s===void 0?0:s,l=n.points,u=n.pointerEvents,c=u===void 0?"auto":u,h=n.fill,d=n.stroke,g=Go(c,h,d),p=Rt(g,2),v=p[1];return!v&&!e||!a?!1:AI(l.points,a+o,t.x,t.y,!1)}function jK(r,t,e,n,i){var a=r.parsedStyle,s=a.radius,o=a.fill,l=a.stroke,u=a.lineWidth,c=u===void 0?1:u,h=a.increasedLineWidthForHitTesting,d=h===void 0?0:h,g=a.x,p=g===void 0?0:g,v=a.y,m=v===void 0?0:v,b=a.width,w=a.height,x=a.pointerEvents,S=x===void 0?"auto":x,_=Go(S,o,l),M=Rt(_,2),k=M[0],C=M[1],P=s&&s.some(function(L){return L!==0}),T=c+d;if(P){var R=!1;return(C||e)&&(R=qK(p,m,b,w,s.map(function(L){return Ue(L,0,Math.min(Math.abs(b)/2,Math.abs(w)/2))}),T,t.x,t.y)),!R&&(k||e)&&(R=n(r,t)),R}else{var A=T/2;if(k&&C||e)return wo(p-A,m-A,b+A,w+A,t.x,t.y);if(k)return wo(p,m,b,w,t.x,t.y);if(C)return RK(p,m,b,w,T,t.x,t.y)}return!1}function qK(r,t,e,n,i,a,s,o){var l=Rt(i,4),u=l[0],c=l[1],h=l[2],d=l[3];return ks(r+u,t,r+e-c,t,a,s,o)||ks(r+e,t+c,r+e,t+n-h,a,s,o)||ks(r+e-h,t+n,r+d,t+n,a,s,o)||ks(r,t+n-d,r,t+u,a,s,o)||Ed(r+e-c,t+c,c,1.5*Math.PI,2*Math.PI,a,s,o)||Ed(r+e-h,t+n-h,h,0,.5*Math.PI,a,s,o)||Ed(r+d,t+n-d,d,.5*Math.PI,Math.PI,a,s,o)||Ed(r+u,t+u,u,Math.PI,1.5*Math.PI,a,s,o)}function WK(r,t,e,n,i,a){var s=r.parsedStyle,o=s.pointerEvents,l=o===void 0?"auto":o,u=s.x,c=u===void 0?0:u,h=s.y,d=h===void 0?0:h,g=s.width,p=s.height;if(l==="non-transparent-pixel"){var v=i.config.offscreenCanvas,m=a.offscreenCanvasCreator.getOrCreateCanvas(v),b=a.offscreenCanvasCreator.getOrCreateContext(v,{willReadFrequently:!0});m.width=g,m.height=p,i.defaultStyleRendererFactory[Q.IMAGE].render(b,Bt(Bt({},r.parsedStyle),{},{x:0,y:0}),r,void 0,void 0,void 0);var w=b.getImageData(t.x-c,t.y-d,1,1).data;return w.every(function(x){return x!==0})}return!0}function GK(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 VK=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Wt(this,t,[].concat(i)),e.name="canvas-picker",e}return qt(t,r),it(t,[{key:"init",value:function(){var n,i=(n={},wt(wt(wt(wt(wt(wt(wt(wt(wt(wt(n,Q.CIRCLE,PK),Q.ELLIPSE,NK),Q.RECT,jK),Q.LINE,DK),Q.POLYLINE,$K),Q.POLYGON,zK),Q.PATH,BK),Q.TEXT,GK),Q.GROUP,null),Q.IMAGE,WK),wt(wt(n,Q.HTML,null),Q.MESH,null));this.context.pointInPathPickerFactory=i,this.addRenderingPlugin(new OI)}},{key:"destroy",value:function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()}}])}(Vs);function Ui(r,t){if(!{}.hasOwnProperty.call(r,t))throw new TypeError("attempted to use private field on non-instance");return r}var HK=0;function UK(r){return"__private_"+HK+++"_"+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 YK=function(){function r(){at(this,r),this.cacheStore=new Map}return it(r,[{key:"onRefAdded",value:function(e){}},{key:"has",value:function(e){return this.cacheStore.has(e)}},{key:"put",value:function(e,n,i){return this.cacheStore.has(e)?!1:(this.cacheStore.set(e,{value:n,counter:new Set([i])}),this.onRefAdded(i),!0)}},{key:"get",value:function(e,n){var i=this.cacheStore.get(e);return i?(i.counter.has(n)||(i.counter.add(n),this.onRefAdded(n)),i.value):null}},{key:"update",value:function(e,n,i){var a=this.cacheStore.get(e);return a?(a.value=Bt(Bt({},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()}}])}(),zv=[],$v=[],Bw=function(){function r(){at(this,r)}return it(r,null,[{key:"stop",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:r.api;r.rafId&&(e.cancelAnimationFrame(r.rafId),r.rafId=null)}},{key:"executeTask",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:r.api;zv.length<=0&&$v.length<=0||($v.forEach(function(n){return n()}),$v=zv.splice(0,r.TASK_NUM_PER_FRAME),r.rafId=e.requestAnimationFrame(function(){r.executeTask(e)}))}},{key:"sliceImage",value:function(e,n,i,a){for(var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:r.api,l=e.naturalWidth||e.width,u=e.naturalHeight||e.height,c=n-s,h=i-s,d=Math.ceil(l/c),g=Math.ceil(u/h),p={tileSize:[n,i],gridSize:[g,d],tiles:Array(g).fill(null).map(function(){return Array(d).fill(null)})},v=function(w){for(var x=function(M){zv.push(function(){var k=M*c,C=w*h,P=[Math.min(n,l-k),Math.min(i,u-C)],T=P[0],A=P[1],R=o.createCanvas();R.width=n,R.height=i;var L=R.getContext("2d");L.drawImage(e,k,C,T,A,0,0,T,A),p.tiles[w][M]={x:k,y:C,tileX:M,tileY:w,data:R},a()})},S=0;S<d;S++)x(S)},m=0;m<g;m++)v(m);return r.stop(),r.executeTask(),p}}])}();Bw.TASK_NUM_PER_FRAME=10;var Dr=new YK;Dr.onRefAdded=function(t){var e=this;t.addEventListener(Xt.DESTROY,function(){e.releaseRef(t)},{once:!0})};var nE=function(){function r(t,e){at(this,r),this.gradientCache={},this.patternCache={},this.context=t,this.runtime=e}return it(r,[{key:"getImageSync",value:function(e,n,i){var a=oe(e)?e:e.src;if(Dr.has(a)){var s=Dr.get(a,n);if(s.img.complete)return i==null||i(s),s}return this.getOrCreateImage(e,n).then(function(o){i==null||i(o)}).catch(function(){}),null}},{key:"getOrCreateImage",value:function(e,n){var i=this,a=oe(e)?e:e.src;if(!oe(e)&&!Dr.has(a)){var s={img:e,size:[e.naturalWidth||e.width,e.naturalHeight||e.height],tileSize:_d(e)};Dr.put(a,s,n)}if(Dr.has(a)){var o=Dr.get(a,n);return o.img.complete?Promise.resolve(o):new Promise(function(l,u){o.img.addEventListener("load",function(){o.size=[o.img.naturalWidth||o.img.width,o.img.naturalHeight||o.img.height],o.tileSize=_d(o.img),l(o)}),o.img.addEventListener("error",function(c){u(c)})})}return new Promise(function(l,u){var c=i.context.config.createImage();if(c){var h={img:c,size:[0,0],tileSize:_d(c)};Dr.put(a,h,n),c.onload=function(){h.size=[c.naturalWidth||c.width,c.naturalHeight||c.height],h.tileSize=_d(h.img),l(h)},c.onerror=function(d){u(d)},c.crossOrigin="Anonymous",c.src=a}})}},{key:"createDownSampledImage",value:function(){var t=Fs(jn().mark(function n(i,a){var s,o,l,u,c,h,d,g,p,v,m,b,w,x;return jn().wrap(function(_){for(;;)switch(_.prev=_.next){case 0:return _.next=2,this.getOrCreateImage(i,a);case 2:if(s=_.sent,!(typeof s.downSamplingRate<"u")){_.next=5;break}return _.abrupt("return",s);case 5:if(o=this.context.config.enableLargeImageOptimization,l=typeof o=="boolean"?{}:o,u=l.maxDownSampledImageSize,c=u===void 0?2048:u,h=l.downSamplingRateThreshold,d=h===void 0?.5:h,g=this.runtime.globalThis.createImageBitmap,p=Rt(s.size,2),v=p[0],m=p[1],b=s.img,w=Math.min((c+c)/(v+m),Math.max(.01,Math.min(d,.5))),x=Bt(Bt({},s),{},{downSamplingRate:w}),Dr.update(s.img.src,x,a),!g){_.next=25;break}return _.prev=14,_.next=17,g(s.img,{resizeWidth:v*w,resizeHeight:m*w});case 17:b=_.sent,_.next=23;break;case 20:_.prev=20,_.t0=_.catch(14),w=1;case 23:_.next=26;break;case 25:w=1;case 26:return x=Bt(Bt({},this.getImageSync(i,a)),{},{downSampled:b,downSamplingRate:w}),Dr.update(s.img.src,x,a),_.abrupt("return",x);case 29:case"end":return _.stop()}},n,this,[[14,20]])}));function e(n,i){return t.apply(this,arguments)}return e}()},{key:"createImageTiles",value:function(){var t=Fs(jn().mark(function n(i,a,s,o){var l,u,c,h,d;return jn().wrap(function(p){for(;;)switch(p.prev=p.next){case 0:return p.next=2,this.getOrCreateImage(i,o);case 2:return l=p.sent,u=o.ownerDocument.defaultView,c=u.requestAnimationFrame,h=u.cancelAnimationFrame,Bw.api={requestAnimationFrame:c,cancelAnimationFrame:h,createCanvas:function(){return $x.createCanvas()}},d=Bt(Bt({},l),Bw.sliceImage(l.img,l.tileSize[0],l.tileSize[0],s)),Dr.update(l.img.src,d,o),p.abrupt("return",d);case 8:case"end":return p.stop()}},n,this)}));function e(n,i,a,s){return t.apply(this,arguments)}return e}()},{key:"releaseImage",value:function(e,n){Dr.release(oe(e)?e:e.src,n)}},{key:"releaseImageRef",value:function(e){Dr.releaseRef(e)}},{key:"getOrCreatePatternSync",value:function(e,n,i,a,s,o,l){var u=this.generatePatternKey(n);if(u&&this.patternCache[u])return this.patternCache[u];var c=n.image,h=n.repetition,d=n.transform,g,p=!1;if(oe(c)){var v=this.getImageSync(c,e,l);g=v==null?void 0:v.img}else a?(g=a,p=!0):g=c;var m=g&&i.createPattern(g,h);if(m){var b;d?b=DL(CL(d),new Ne({})):b=Bs(Se()),p&&PR(b,b,[1/s,1/s,1]),m.setTransform({a:b[0],b:b[1],c:b[4],d:b[5],e:b[12]+o[0],f:b[13]+o[1]})}return u&&m&&(this.patternCache[u]=m),m}},{key:"getOrCreateGradient",value:function(e,n){var i=this.generateGradientKey(e),a=e.type,s=e.steps,o=e.min,l=e.width,u=e.height,c=e.angle,h=e.cx,d=e.cy,g=e.size;if(this.gradientCache[i])return this.gradientCache[i];var p=null;if(a===_s.LinearGradient){var v=MV(o,l,u,c),m=v.x1,b=v.y1,w=v.x2,x=v.y2;p=n.createLinearGradient(m,b,w,x)}else if(a===_s.RadialGradient){var S=kV(o,l,u,h,d,g),_=S.x,M=S.y,k=S.r;p=n.createRadialGradient(_,M,0,_,M,k)}return p&&(s.forEach(function(C){var P=C.offset,T=C.color;if(P.unit===gt.kPercentage){var A;(A=p)===null||A===void 0||A.addColorStop(P.value/100,T.toString())}}),this.gradientCache[i]=p),this.gradientCache[i]}},{key:"generateGradientKey",value:function(e){var n=e.type,i=e.min,a=e.width,s=e.height,o=e.steps,l=e.angle,u=e.cx,c=e.cy,h=e.size;return"gradient-".concat(n,"-").concat((l==null?void 0:l.toString())||0,"-").concat((u==null?void 0:u.toString())||0,"-").concat((c==null?void 0:c.toString())||0,"-").concat((h==null?void 0:h.toString())||0,"-").concat(i[0],"-").concat(i[1],"-").concat(a,"-").concat(s,"-").concat(o.map(function(d){var g=d.offset,p=d.color;return"".concat(g).concat(p)}).join("-"))}},{key:"generatePatternKey",value:function(e){var n=e.image,i=e.repetition;if(oe(n))return"pattern-".concat(n,"-").concat(i);if(n.nodeName==="rect")return"pattern-".concat(n.entity,"-").concat(i)}}])}();nE.isSupportTile=!!$x.createCanvas();function _d(r){if(!r.complete)return[0,0];var t=r.naturalWidth||r.width,e=r.naturalHeight||r.height,n=256;return[256,512].forEach(function(i){var a=Math.ceil(e/i),s=Math.ceil(t/i);a*s<1e3&&(n=i)}),[n,n]}var NI=function(){function r(){at(this,r)}return it(r,[{key:"apply",value:function(e){var n=e.renderingService,i=e.renderingContext,a=e.imagePool,s=i.root.ownerDocument.defaultView,o=function(h,d,g){var p=h.parsedStyle,v=p.width,m=p.height;v&&!m?h.setAttribute("height",g/d*v):!v&&m&&h.setAttribute("width",d/g*m)},l=function(h){var d=h.target,g=d.nodeName,p=d.attributes;if(g===Q.IMAGE){var v=p.src,m=p.keepAspectRatio;a.getImageSync(v,d,function(b){var w=b.img,x=w.width,S=w.height;m&&o(d,x,S),d.renderable.dirty=!0,n.dirtify()})}},u=function(h){var d=h.target,g=h.attrName,p=h.prevValue,v=h.newValue;d.nodeName!==Q.IMAGE||g!=="src"||(p!==v&&a.releaseImage(p,d),oe(v)&&a.getOrCreateImage(v,d).then(function(m){var b=m.img,w=b.width,x=b.height;d.attributes.keepAspectRatio&&o(d,w,x),d.renderable.dirty=!0,n.dirtify()}).catch(function(){}))};n.hooks.init.tap(r.tag,function(){s.addEventListener(Xt.MOUNTED,l),s.addEventListener(Xt.ATTR_MODIFIED,u)}),n.hooks.destroy.tap(r.tag,function(){s.removeEventListener(Xt.MOUNTED,l),s.removeEventListener(Xt.ATTR_MODIFIED,u)})}}])}();NI.tag="LoadImage";var XK=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Wt(this,t,[].concat(i)),e.name="image-loader",e}return qt(t,r),it(t,[{key:"init",value:function(n){this.context.imagePool=new nE(this.context,n),this.addRenderingPlugin(new NI)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(Vs);/*!
- * @antv/g-plugin-canvas-renderer
- * @description A G plugin of renderer implementation with Canvas2D API
- * @version 2.2.18
- * @date 1/23/2025, 8:34:11 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var nn=UK("renderState"),RI=function(){function r(t){at(this,r),this.removedRBushNodeAABBs=[],this.renderQueue=[],Object.defineProperty(this,nn,{writable:!0,value:{restoreStack:[],prevObject:null,currentContext:new Map}}),this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=Se(),this.dprMatrix=Se(),this.tmpMat4=Se(),this.vec3a=Qt(),this.vec3b=Qt(),this.vec3c=Qt(),this.vec3d=Qt(),this.canvasRendererPluginOptions=t}return it(r,[{key:"apply",value:function(e,n){var i=this;this.context=e;var a=this.context,s=a.config,o=a.camera,l=a.renderingService,u=a.renderingContext,c=a.rBushRoot,h=a.pathGeneratorFactory,d=s.renderer.getConfig().enableRenderingOptimization;s.renderer.getConfig().enableDirtyCheck=!1,s.renderer.getConfig().enableDirtyRectangleRendering=!1,this.rBush=c,this.pathGeneratorFactory=h;var g=e.contextService,p=u.root.ownerDocument.defaultView,v=function(x){var S=x.target,_=S.rBushNode;_.aabb&&i.removedRBushNodeAABBs.push(_.aabb)},m=function(x){var S=x.target,_=S.rBushNode;_.aabb&&i.removedRBushNodeAABBs.push(_.aabb)};l.hooks.init.tap(r.tag,function(){p.addEventListener(Xt.UNMOUNTED,v),p.addEventListener(Xt.CULLED,m);var w=g.getDPR(),x=s.width,S=s.height,_=g.getContext();i.clearRect(_,0,0,x*w,S*w,s.background)}),l.hooks.destroy.tap(r.tag,function(){p.removeEventListener(Xt.UNMOUNTED,v),p.removeEventListener(Xt.CULLED,m),i.renderQueue=[],i.removedRBushNodeAABBs=[],Ui(i,nn)[nn]={restoreStack:[],prevObject:null,currentContext:null}}),l.hooks.beginFrame.tap(r.tag,function(){var w,x=g.getContext(),S=g.getDPR(),_=s.width,M=s.height,k=i.canvasRendererPluginOptions,C=k.dirtyObjectNumThreshold,P=k.dirtyObjectRatioThreshold,T=l.getStats(),A=T.total,R=T.rendered,L=R/A;i.clearFullScreen=i.clearFullScreenLastFrame||!((w=p.context.renderingPlugins[1])!==null&&w!==void 0&&w.isFirstTimeRenderingFinished)||l.disableDirtyRectangleRendering()||R>C&&L>P,x&&(typeof x.resetTransform=="function"?x.resetTransform():x.setTransform(1,0,0,1,0,0),i.clearFullScreen&&i.clearRect(x,0,0,_*S,M*S,s.background))});var b=function(x,S){for(var _=[x];_.length>0;){var M=_.pop();M.isVisible()&&!M.isCulled()&&(d?i.renderDisplayObjectOptimized(M,S,i.context,Ui(i,nn)[nn],n):i.renderDisplayObject(M,S,i.context,Ui(i,nn)[nn],n));for(var k=M.sortable.sorted||M.childNodes,C=k.length-1;C>=0;C--)_.push(k[C])}};l.hooks.endFrame.tap(r.tag,function(){if(u.root.childNodes.length===0){i.clearFullScreenLastFrame=!0;return}d=s.renderer.getConfig().enableRenderingOptimization,Ui(i,nn)[nn]={restoreStack:[],prevObject:null,currentContext:Ui(i,nn)[nn].currentContext},Ui(i,nn)[nn].currentContext.clear(),i.clearFullScreenLastFrame=!1;var w=g.getContext(),x=g.getDPR();if(po(i.dprMatrix,[x,x,1]),Jn(i.vpMatrix,i.dprMatrix,o.getOrthoMatrix()),i.clearFullScreen)d?(w.save(),b(u.root,w),w.restore()):b(u.root,w),i.removedRBushNodeAABBs=[];else{var S=i.safeMergeAABB.apply(i,[i.mergeDirtyAABBs(i.renderQueue)].concat(Ce(i.removedRBushNodeAABBs.map(function(dt){var pt=dt.minX,mt=dt.minY,It=dt.maxX,zt=dt.maxY,Te=new Me;return Te.setMinMax([pt,mt,0],[It,zt,0]),Te}))));if(i.removedRBushNodeAABBs=[],Me.isEmpty(S)){i.renderQueue=[];return}var _=i.convertAABB2Rect(S),M=_.x,k=_.y,C=_.width,P=_.height,T=Qn(i.vec3a,[M,k,0],i.vpMatrix),A=Qn(i.vec3b,[M+C,k,0],i.vpMatrix),R=Qn(i.vec3c,[M,k+P,0],i.vpMatrix),L=Qn(i.vec3d,[M+C,k+P,0],i.vpMatrix),$=Math.min(T[0],A[0],L[0],R[0]),q=Math.min(T[1],A[1],L[1],R[1]),j=Math.max(T[0],A[0],L[0],R[0]),B=Math.max(T[1],A[1],L[1],R[1]),D=Math.floor($),G=Math.floor(q),X=Math.ceil(j-$),K=Math.ceil(B-q);w.save(),i.clearRect(w,D,G,X,K,s.background),w.beginPath(),w.rect(D,G,X,K),w.clip(),w.setTransform(i.vpMatrix[0],i.vpMatrix[1],i.vpMatrix[4],i.vpMatrix[5],i.vpMatrix[12],i.vpMatrix[13]);var ht=s.renderer.getConfig(),ut=ht.enableDirtyRectangleRenderingDebug;ut&&p.dispatchEvent(new cn($r.DIRTY_RECTANGLE,{dirtyRect:{x:D,y:G,width:X,height:K}}));var ct=i.searchDirtyObjects(S);ct.sort(function(dt,pt){return dt.sortable.renderOrder-pt.sortable.renderOrder}).forEach(function(dt){dt&&dt.isVisible()&&!dt.isCulled()&&i.renderDisplayObject(dt,w,i.context,Ui(i,nn)[nn],n)}),w.restore(),i.renderQueue.forEach(function(dt){i.saveDirtyAABB(dt)}),i.renderQueue=[]}Ui(i,nn)[nn].restoreStack.forEach(function(){w.restore()}),Ui(i,nn)[nn].restoreStack=[]}),l.hooks.render.tap(r.tag,function(w){i.clearFullScreen||i.renderQueue.push(w)})}},{key:"clearRect",value:function(e,n,i,a,s,o){e.clearRect(n,i,a,s),o&&(e.fillStyle=o,e.fillRect(n,i,a,s))}},{key:"renderDisplayObjectOptimized",value:function(e,n,i,a,s){var o=e.nodeName,l=!1,u=!1,c=this.context.styleRendererFactory[o],h=this.pathGeneratorFactory[o],d=e.parsedStyle.clipPath;if(d){l=!a.prevObject||!lw(d.getWorldTransform(),a.prevObject.getWorldTransform()),l&&(this.applyWorldTransform(n,d),a.prevObject=null);var g=this.pathGeneratorFactory[d.nodeName];g&&(n.save(),u=!0,n.beginPath(),g(n,d.parsedStyle),n.closePath(),n.clip())}if(c){l=!a.prevObject||!lw(e.getWorldTransform(),a.prevObject.getWorldTransform()),l&&this.applyWorldTransform(n,e);var p=!a.prevObject;if(!p){var v=a.prevObject.nodeName;o===Q.TEXT?p=v!==Q.TEXT:o===Q.IMAGE?p=v!==Q.IMAGE:p=v===Q.TEXT||v===Q.IMAGE}c.applyStyleToContext(n,e,p,a),a.prevObject=e}h&&(n.beginPath(),h(n,e.parsedStyle),o!==Q.LINE&&o!==Q.PATH&&o!==Q.POLYLINE&&n.closePath()),c&&c.drawToContext(n,e,Ui(this,nn)[nn],this,s),u&&n.restore(),e.renderable.dirty=!1}},{key:"renderDisplayObject",value:function(e,n,i,a,s){var o=e.nodeName,l=a.restoreStack[a.restoreStack.length-1];l&&!(e.compareDocumentPosition(l)&$e.DOCUMENT_POSITION_CONTAINS)&&(n.restore(),a.restoreStack.pop());var u=this.context.styleRendererFactory[o],c=this.pathGeneratorFactory[o],h=e.parsedStyle.clipPath;if(h){this.applyWorldTransform(n,h);var d=this.pathGeneratorFactory[h.nodeName];d&&(n.save(),a.restoreStack.push(e),n.beginPath(),d(n,h.parsedStyle),n.closePath(),n.clip())}u&&(this.applyWorldTransform(n,e),n.save(),this.applyAttributesToContext(n,e)),c&&(n.beginPath(),c(n,e.parsedStyle),o!==Q.LINE&&o!==Q.PATH&&o!==Q.POLYLINE&&n.closePath()),u&&(u.render(n,e.parsedStyle,e,i,this,s),n.restore()),e.renderable.dirty=!1}},{key:"applyAttributesToContext",value:function(e,n){var i=n.parsedStyle,a=i.stroke,s=i.fill,o=i.opacity,l=i.lineDash,u=i.lineDashOffset;l&&e.setLineDash(l),kt(u)||(e.lineDashOffset=u),kt(o)||(e.globalAlpha*=o),!kt(a)&&!Array.isArray(a)&&!a.isNone&&(e.strokeStyle=n.attributes.stroke),!kt(s)&&!Array.isArray(s)&&!s.isNone&&(e.fillStyle=n.attributes.fill)}},{key:"convertAABB2Rect",value:function(e){var n=e.getMin(),i=e.getMax(),a=Math.floor(n[0]),s=Math.floor(n[1]),o=Math.ceil(i[0]),l=Math.ceil(i[1]),u=o-a,c=l-s;return{x:a,y:s,width:u,height:c}}},{key:"mergeDirtyAABBs",value:function(e){var n=new Me;return e.forEach(function(i){var a=i.getRenderBounds();n.add(a);var s=i.renderable.dirtyRenderBounds;s&&n.add(s)}),n}},{key:"searchDirtyObjects",value:function(e){var n=e.getMin(),i=Rt(n,2),a=i[0],s=i[1],o=e.getMax(),l=Rt(o,2),u=l[0],c=l[1],h=this.rBush.search({minX:a,minY:s,maxX:u,maxY:c});return h.map(function(d){var g=d.displayObject;return g})}},{key:"saveDirtyAABB",value:function(e){var n=e.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new Me);var i=e.getRenderBounds();i&&n.dirtyRenderBounds.update(i.center,i.halfExtents)}},{key:"applyWorldTransform",value:function(e,n,i){i?(ql(this.tmpMat4,n.getLocalTransform()),Jn(this.tmpMat4,i,this.tmpMat4),Jn(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(ql(this.tmpMat4,n.getWorldTransform()),Jn(this.tmpMat4,this.vpMatrix,this.tmpMat4)),e.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])}},{key:"safeMergeAABB",value:function(){for(var e=new Me,n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return i.forEach(function(s){e.add(s)}),e}}])}();RI.tag="CanvasRenderer";function Lf(r,t,e,n,i,a,s){var o,l;if(r.image.nodeName==="rect"){var u=r.image.parsedStyle,c=u.width,h=u.height;l=n.contextService.getDPR();var d=n.config.offscreenCanvas;o=a.offscreenCanvasCreator.getOrCreateCanvas(d),o.width=c*l,o.height=h*l;var g=a.offscreenCanvasCreator.getOrCreateContext(d),p={restoreStack:[],prevObject:null,currentContext:new Map};r.image.forEach(function(m){i.renderDisplayObject(m,g,n,p,a)}),p.restoreStack.forEach(function(){g.restore()})}var v=s.getOrCreatePatternSync(t,r,e,o,l,t.getGeometryBounds().min,function(){t.renderable.dirty=!0,n.renderingService.dirtify()});return v}function If(r,t,e,n){var i;if(r.type===_s.LinearGradient||r.type===_s.RadialGradient){var a=t.getGeometryBounds(),s=a&&a.halfExtents[0]*2||1,o=a&&a.halfExtents[1]*2||1,l=a&&a.min||[0,0];i=n.getOrCreateGradient(Bt(Bt({type:r.type},r.value),{},{min:l,width:s,height:o}),e)}return i}var Sd=["shadowBlur","shadowOffsetX","shadowOffsetY"],VM=["lineCap","lineJoin","miterLimit"],un={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},HM={};function We(r,t,e,n){var i=n.has(t)?n.get(t):un[t];return i!==e&&(t==="lineDash"?r.setLineDash(e):r[t]=e,n.set(t,e)),i}var KK=function(){function r(t){at(this,r),this.imagePool=t}return it(r,[{key:"applyAttributesToContext",value:function(e,n){}},{key:"render",value:function(e,n,i,a,s,o){}},{key:"applyCommonStyleToContext",value:function(e,n,i,a){var s=i?HM:a.prevObject.parsedStyle,o=n.parsedStyle;(i||o.opacity!==s.opacity)&&We(e,"globalAlpha",kt(o.opacity)?un.globalAlpha:o.opacity,a.currentContext),(i||o.blend!==s.blend)&&We(e,"globalCompositeOperation",kt(o.blend)?un.globalCompositeOperation:o.blend,a.currentContext)}},{key:"applyStrokeFillStyleToContext",value:function(e,n,i,a){var s=i?HM:a.prevObject.parsedStyle,o=n.parsedStyle,l=o.lineWidth,u=l===void 0?un.lineWidth:l,c=o.fill&&!o.fill.isNone,h=o.stroke&&!o.stroke.isNone&&u>0;if(h){if(i||n.attributes.stroke!==a.prevObject.attributes.stroke){var d=!kt(o.stroke)&&!Array.isArray(o.stroke)&&!o.stroke.isNone?n.attributes.stroke:un.strokeStyle;We(e,"strokeStyle",d,a.currentContext)}(i||o.lineWidth!==s.lineWidth)&&We(e,"lineWidth",kt(o.lineWidth)?un.lineWidth:o.lineWidth,a.currentContext),(i||o.lineDash!==s.lineDash)&&We(e,"lineDash",o.lineDash||un.lineDash,a.currentContext),(i||o.lineDashOffset!==s.lineDashOffset)&&We(e,"lineDashOffset",kt(o.lineDashOffset)?un.lineDashOffset:o.lineDashOffset,a.currentContext);for(var g=0;g<VM.length;g++){var p=VM[g];(i||o[p]!==s[p])&&We(e,p,kt(o[p])?un[p]:o[p],a.currentContext)}}if(c&&(i||n.attributes.fill!==a.prevObject.attributes.fill)){var v=!kt(o.fill)&&!Array.isArray(o.fill)&&!o.fill.isNone?n.attributes.fill:un.fillStyle;We(e,"fillStyle",v,a.currentContext)}}},{key:"applyStyleToContext",value:function(e,n,i,a){var s=n.nodeName;this.applyCommonStyleToContext(e,n,i,a),s===Q.IMAGE||this.applyStrokeFillStyleToContext(e,n,i,a)}},{key:"applyShadowAndFilterStyleToContext",value:function(e,n,i,a){var s=n.parsedStyle;if(i){We(e,"shadowColor",s.shadowColor.toString(),a.currentContext);for(var o=0;o<Sd.length;o++){var l=Sd[o];We(e,l,s[l]||un[l],a.currentContext)}}s.filter&&s.filter.length&&We(e,"filter",n.attributes.filter,a.currentContext)}},{key:"clearShadowAndFilterStyleForContext",value:function(e,n,i,a){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;if(n){We(e,"shadowColor",un.shadowColor,a.currentContext);for(var o=0;o<Sd.length;o++){var l=Sd[o];We(e,l,un[l],a.currentContext)}}if(i)if(n&&s){var u=e.filter;!kt(u)&&u.indexOf("drop-shadow")>-1&&We(e,"filter",u.replace(/drop-shadow\([^)]*\)/,"").trim()||un.filter,a.currentContext)}else We(e,"filter",un.filter,a.currentContext)}},{key:"fillToContext",value:function(e,n,i,a,s){var o=this,l=n.parsedStyle,u=l.fill,c=l.fillRule,h=null;if(Array.isArray(u)&&u.length>0)u.forEach(function(g){var p=We(e,"fillStyle",If(g,n,e,o.imagePool),i.currentContext);h=h??p,c?e.fill(c):e.fill()});else{if(Io(u)){var d=Lf(u,n,e,n.ownerDocument.defaultView.context,a,s,this.imagePool);d&&(e.fillStyle=d,h=!0)}c?e.fill(c):e.fill()}h!==null&&We(e,"fillStyle",h,i.currentContext)}},{key:"strokeToContext",value:function(e,n,i,a,s){var o=this,l=n.parsedStyle.stroke,u=null;if(Array.isArray(l)&&l.length>0)l.forEach(function(d){var g=We(e,"strokeStyle",If(d,n,e,o.imagePool),i.currentContext);u=u??g,e.stroke()});else{if(Io(l)){var c=Lf(l,n,e,n.ownerDocument.defaultView.context,a,s,this.imagePool);if(c){var h=We(e,"strokeStyle",c,i.currentContext);u=u??h}}e.stroke()}u!==null&&We(e,"strokeStyle",u,i.currentContext)}},{key:"drawToContext",value:function(e,n,i,a,s){var o,l=n.nodeName,u=n.parsedStyle,c=u.opacity,h=c===void 0?un.globalAlpha:c,d=u.fillOpacity,g=d===void 0?un.fillOpacity:d,p=u.strokeOpacity,v=p===void 0?un.strokeOpacity:p,m=u.lineWidth,b=m===void 0?un.lineWidth:m,w=u.fill&&!u.fill.isNone,x=u.stroke&&!u.stroke.isNone&&b>0;if(!(!w&&!x)){var S=!kt(u.shadowColor)&&u.shadowBlur>0,_=u.shadowType==="inner",M=((o=u.fill)===null||o===void 0?void 0:o.alpha)===0,k=!!(u.filter&&u.filter.length),C=S&&x&&(l===Q.PATH||l===Q.LINE||l===Q.POLYLINE||M||_),P=null;if(w){C||this.applyShadowAndFilterStyleToContext(e,n,S,i);var T=h*g;P=We(e,"globalAlpha",T,i.currentContext),this.fillToContext(e,n,i,a,s),C||this.clearShadowAndFilterStyleForContext(e,S,k,i)}if(x){var A=!1,R=h*v,L=We(e,"globalAlpha",R,i.currentContext);if(P=w?P:L,C&&(this.applyShadowAndFilterStyleToContext(e,n,S,i),A=!0,_)){var $=e.globalCompositeOperation;e.globalCompositeOperation="source-atop",this.strokeToContext(e,n,i,a,s),e.globalCompositeOperation=$,this.clearShadowAndFilterStyleForContext(e,S,k,i,!0)}this.strokeToContext(e,n,i,a,s),A&&this.clearShadowAndFilterStyleForContext(e,S,k,i)}P!==null&&We(e,"globalAlpha",P,i.currentContext)}}}])}(),rE=function(r){function t(){return at(this,t),Wt(this,t,arguments)}return qt(t,r),it(t,[{key:"render",value:function(n,i,a,s,o,l){var u=i.fill,c=i.fillRule,h=i.opacity,d=h===void 0?1:h,g=i.fillOpacity,p=g===void 0?1:g,v=i.stroke,m=i.strokeOpacity,b=m===void 0?1:m,w=i.lineWidth,x=w===void 0?1:w,S=i.lineCap,_=i.lineJoin,M=i.shadowType,k=i.shadowColor,C=i.shadowBlur,P=i.filter,T=i.miterLimit,A=u&&!u.isNone,R=v&&!v.isNone&&x>0,L=(u==null?void 0:u.alpha)===0,$=!!(P&&P.length),q=!kt(k)&&C>0,j=a.nodeName,B=M==="inner",D=R&&q&&(j===Q.PATH||j===Q.LINE||j===Q.POLYLINE||L||B);A&&(n.globalAlpha=d*p,D||Df(a,n,q),LI(n,a,u,c,s,o,l,this.imagePool),D||this.clearShadowAndFilter(n,$,q)),R&&(n.globalAlpha=d*b,n.lineWidth=x,kt(T)||(n.miterLimit=T),kt(S)||(n.lineCap=S),kt(_)||(n.lineJoin=_),D&&(B&&(n.globalCompositeOperation="source-atop"),Df(a,n,!0),B&&(zw(n,a,v,s,o,l,this.imagePool),n.globalCompositeOperation=un.globalCompositeOperation,this.clearShadowAndFilter(n,$,!0))),zw(n,a,v,s,o,l,this.imagePool))}},{key:"clearShadowAndFilter",value:function(n,i,a){if(a&&(n.shadowColor="transparent",n.shadowBlur=0),i){var s=n.filter;!kt(s)&&s.indexOf("drop-shadow")>-1&&(n.filter=s.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}}}])}(KK);function Df(r,t,e){var n=r.parsedStyle,i=n.filter,a=n.shadowColor,s=n.shadowBlur,o=n.shadowOffsetX,l=n.shadowOffsetY;i&&i.length&&(t.filter=r.style.filter),e&&(t.shadowColor=a.toString(),t.shadowBlur=s||0,t.shadowOffsetX=o||0,t.shadowOffsetY=l||0)}function LI(r,t,e,n,i,a,s,o){var l=arguments.length>8&&arguments[8]!==void 0?arguments[8]:!1;Array.isArray(e)?e.forEach(function(u){r.fillStyle=If(u,t,r,o),l||(n?r.fill(n):r.fill())}):(Io(e)&&(r.fillStyle=Lf(e,t,r,i,a,s,o)),l||(n?r.fill(n):r.fill()))}function zw(r,t,e,n,i,a,s){var o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1;Array.isArray(e)?e.forEach(function(l){r.strokeStyle=If(l,t,r,s),o||r.stroke()}):(Io(e)&&(r.strokeStyle=Lf(e,t,r,n,i,a,s)),o||r.stroke())}function ZK(r,t){var e=Rt(r,4),n=e[0],i=e[1],a=e[2],s=e[3],o=Rt(t,4),l=o[0],u=o[1],c=o[2],h=o[3],d=Math.max(n,l),g=Math.max(i,u),p=Math.min(n+a,l+c),v=Math.min(i+s,u+h);return p<=d||v<=g?null:[d,g,p-d,v-g]}function JK(r,t){var e=Qn(Qt(),[r[0],r[1],0],t),n=Qn(Qt(),[r[0]+r[2],r[1],0],t),i=Qn(Qt(),[r[0],r[1]+r[3],0],t),a=Qn(Qt(),[r[0]+r[2],r[1]+r[3],0],t);return[Math.min(e[0],n[0],i[0],a[0]),Math.min(e[1],n[1],i[1],a[1]),Math.max(e[0],n[0],i[0],a[0])-Math.min(e[0],n[0],i[0],a[0]),Math.max(e[1],n[1],i[1],a[1])-Math.min(e[1],n[1],i[1],a[1])]}var QK=function(r){function t(){return at(this,t),Wt(this,t,arguments)}return qt(t,r),it(t,[{key:"renderDownSampled",value:function(n,i,a,s){var o=s.src,l=s.imageCache;if(!l.downSampled){this.imagePool.createDownSampledImage(o,a).then(function(u){a.renderable.dirty=!0,a.ownerDocument.defaultView.context.renderingService.dirtify()}).catch(function(){});return}n.drawImage(l.downSampled,Math.floor(s.drawRect[0]),Math.floor(s.drawRect[1]),Math.ceil(s.drawRect[2]),Math.ceil(s.drawRect[3]))}},{key:"renderTile",value:function(n,i,a,s){var o=s.src,l=s.imageCache,u=s.imageRect,c=s.drawRect,h=l.size,d=n.getTransform(),g=d.a,p=d.b,v=d.c,m=d.d,b=d.e,w=d.f;if(n.resetTransform(),!(l!=null&&l.gridSize)){this.imagePool.createImageTiles(o,[],function(){a.renderable.dirty=!0,a.ownerDocument.defaultView.context.renderingService.dirtify()},a).catch(function(){});return}for(var x=[h[0]/u[2],h[1]/u[3]],S=[l.tileSize[0]/x[0],l.tileSize[1]/x[1]],_=[Math.floor((c[0]-u[0])/S[0]),Math.ceil((c[0]+c[2]-u[0])/S[0])],M=_[0],k=_[1],C=[Math.floor((c[1]-u[1])/S[1]),Math.ceil((c[1]+c[3]-u[1])/S[1])],P=C[0],T=C[1],A=P;A<=T;A++)for(var R=M;R<=k;R++){var L=l.tiles[A][R];if(L){var $=[Math.floor(u[0]+L.tileX*S[0]),Math.floor(u[1]+L.tileY*S[1]),Math.ceil(S[0]),Math.ceil(S[1])];n.drawImage(L.data,$[0],$[1],$[2],$[3])}}n.setTransform(g,p,v,m,b,w)}},{key:"render",value:function(n,i,a){var s=i.x,o=s===void 0?0:s,l=i.y,u=l===void 0?0:l,c=i.width,h=i.height,d=i.src,g=i.shadowColor,p=i.shadowBlur,v=this.imagePool.getImageSync(d,a),m=v==null?void 0:v.img,b=c,w=h;if(m){b||(b=m.width),w||(w=m.height);var x=!kt(g)&&p>0;Df(a,n,x);try{var S=a.ownerDocument.defaultView.getContextService().getDomElement(),_=S.width,M=S.height,k=n.getTransform(),C=k.a,P=k.b,T=k.c,A=k.d,R=k.e,L=k.f,$=TR(C,T,0,0,P,A,0,0,0,0,1,0,R,L,0,1),q=JK([o,u,b,w],$),j=ZK([0,0,_,M],q);if(!j)return;if(!a.ownerDocument.defaultView.getConfig().enableLargeImageOptimization){t.renderFull(n,i,a,{image:m,drawRect:[o,u,b,w]});return}var B=q[2]/v.size[0];if(B<(v.downSamplingRate||.5)){this.renderDownSampled(n,i,a,{src:d,imageCache:v,drawRect:[o,u,b,w]});return}if(!nE.isSupportTile){t.renderFull(n,i,a,{image:m,drawRect:[o,u,b,w]});return}this.renderTile(n,i,a,{src:d,imageCache:v,imageRect:q,drawRect:j})}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]))}}])}(rE),tZ=function(r){function t(){return at(this,t),Wt(this,t,arguments)}return qt(t,r),it(t,[{key:"render",value:function(n,i,a,s,o,l){a.getBounds();var u=i.lineWidth,c=u===void 0?1:u,h=i.textAlign,d=h===void 0?"start":h,g=i.textBaseline,p=g===void 0?"alphabetic":g,v=i.lineJoin,m=v===void 0?"miter":v,b=i.miterLimit,w=b===void 0?10:b,x=i.letterSpacing,S=x===void 0?0:x,_=i.stroke,M=i.fill,k=i.fillRule,C=i.fillOpacity,P=C===void 0?1:C,T=i.strokeOpacity,A=T===void 0?1:T,R=i.opacity,L=R===void 0?1:R,$=i.metrics,q=i.x,j=q===void 0?0:q,B=i.y,D=B===void 0?0:B,G=i.dx,X=i.dy,K=i.shadowColor,ht=i.shadowBlur,ut=$.font,ct=$.lines,dt=$.height,pt=$.lineHeight,mt=$.lineMetrics;n.font=ut,n.lineWidth=c,n.textAlign=d==="middle"?"center":d;var It=p;It==="alphabetic"&&(It="bottom"),n.lineJoin=m,kt(w)||(n.miterLimit=w);var zt=D;p==="middle"?zt+=-dt/2-pt/2:p==="bottom"||p==="alphabetic"||p==="ideographic"?zt+=-dt:(p==="top"||p==="hanging")&&(zt+=-pt);var Te=j+(G||0);zt+=X||0,ct.length===1&&(It==="bottom"?(It="middle",zt-=.5*dt):It==="top"&&(It="middle",zt+=.5*dt)),n.textBaseline=It;var Rn=!kt(K)&&ht>0;Df(a,n,Rn);for(var ln=0;ln<ct.length;ln++){var dr=c/2+Te;zt+=pt,!kt(_)&&!_.isNone&&c&&this.drawLetterSpacing(n,a,ct[ln],mt[ln],d,dr,zt,S,M,k,P,_,A,L,!0,s,o,l),kt(M)||this.drawLetterSpacing(n,a,ct[ln],mt[ln],d,dr,zt,S,M,k,P,_,A,L,!1,s,o,l)}}},{key:"drawLetterSpacing",value:function(n,i,a,s,o,l,u,c,h,d,g,p,v,m,b,w,x,S){if(c===0){b?this.strokeText(n,i,a,l,u,p,v,w,x,S):this.fillText(n,i,a,l,u,h,d,g,m,w,x,S);return}var _=n.textAlign;n.textAlign="left";var M=l;o==="center"||o==="middle"?M=l-s.width/2:(o==="right"||o==="end")&&(M=l-s.width);for(var k=Array.from(a),C=n.measureText(a).width,P=0,T=0;T<k.length;++T){var A=k[T];b?this.strokeText(n,i,A,M,u,p,v,w,x,S):this.fillText(n,i,A,M,u,h,d,g,m,w,x,S),P=n.measureText(a.substring(T+1)).width,M+=C-P+c,C=P}n.textAlign=_}},{key:"fillText",value:function(n,i,a,s,o,l,u,c,h,d,g,p){LI(n,i,l,u,d,g,p,this.imagePool,!0);var v,m=!kt(c)&&c!==1;m&&(v=n.globalAlpha,n.globalAlpha=c*h),n.fillText(a,s,o),m&&(n.globalAlpha=v)}},{key:"strokeText",value:function(n,i,a,s,o,l,u,c,h,d){zw(n,i,l,c,h,d,this.imagePool,!0);var g,p=!kt(u)&&u!==1;p&&(g=n.globalAlpha,n.globalAlpha=u),n.strokeText(a,s,o),p&&(n.globalAlpha=g)}},{key:"drawToContext",value:function(n,i,a,s,o){this.render(n,i.parsedStyle,i,i.ownerDocument.defaultView.context,s,o)}}])}(rE),eZ=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return at(this,t),e=Wt(this,t),e.name="canvas-renderer",e.options=n,e}return qt(t,r),it(t,[{key:"init",value:function(){var n,i=Bt({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),a=this.context.imagePool,s=new rE(a),o=(n={},wt(wt(wt(wt(wt(wt(wt(wt(wt(wt(n,Q.CIRCLE,s),Q.ELLIPSE,s),Q.RECT,s),Q.IMAGE,new QK(a)),Q.TEXT,new tZ(a)),Q.LINE,s),Q.POLYLINE,s),Q.POLYGON,s),Q.PATH,s),Q.GROUP,void 0),wt(wt(wt(n,Q.HTML,void 0),Q.MESH,void 0),Q.FRAGMENT,void 0));this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new RI(i))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory}}])}(Vs);/*!
- * @antv/g-plugin-dom-interaction
- * @description A G plugin
- * @version 2.1.21
- * @date 1/23/2025, 8:33:09 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var II=function(){function r(){at(this,r)}return it(r,[{key:"apply",value:function(e,n){var i=this,a=e.renderingService,s=e.renderingContext,o=e.config;this.context=e;var l=s.root.ownerDocument.defaultView,u=function(C){a.hooks.pointerMove.call(C)},c=function(C){a.hooks.pointerUp.call(C)},h=function(C){a.hooks.pointerDown.call(C)},d=function(C){a.hooks.pointerOver.call(C)},g=function(C){a.hooks.pointerOut.call(C)},p=function(C){a.hooks.pointerCancel.call(C)},v=function(C){a.hooks.pointerWheel.call(C)},m=function(C){a.hooks.click.call(C)},b=function(C){n.globalThis.document.addEventListener("pointermove",u,!0),C.addEventListener("pointerdown",h,!0),C.addEventListener("pointerleave",g,!0),C.addEventListener("pointerover",d,!0),n.globalThis.addEventListener("pointerup",c,!0),n.globalThis.addEventListener("pointercancel",p,!0)},w=function(C){C.addEventListener("touchstart",h,!0),C.addEventListener("touchend",c,!0),C.addEventListener("touchmove",u,!0),C.addEventListener("touchcancel",p,!0)},x=function(C){n.globalThis.document.addEventListener("mousemove",u,!0),C.addEventListener("mousedown",h,!0),C.addEventListener("mouseout",g,!0),C.addEventListener("mouseover",d,!0),n.globalThis.addEventListener("mouseup",c,!0)},S=function(C){n.globalThis.document.removeEventListener("pointermove",u,!0),C.removeEventListener("pointerdown",h,!0),C.removeEventListener("pointerleave",g,!0),C.removeEventListener("pointerover",d,!0),n.globalThis.removeEventListener("pointerup",c,!0),n.globalThis.removeEventListener("pointercancel",p,!0)},_=function(C){C.removeEventListener("touchstart",h,!0),C.removeEventListener("touchend",c,!0),C.removeEventListener("touchmove",u,!0),C.removeEventListener("touchcancel",p,!0)},M=function(C){n.globalThis.document.removeEventListener("mousemove",u,!0),C.removeEventListener("mousedown",h,!0),C.removeEventListener("mouseout",g,!0),C.removeEventListener("mouseover",d,!0),n.globalThis.removeEventListener("mouseup",c,!0)};a.hooks.init.tap(r.tag,function(){var k=i.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(k.style.msContentZooming="none",k.style.msTouchAction="none"):l.supportsPointerEvents&&(k.style.touchAction="none"),l.supportsPointerEvents?b(k):x(k),l.supportsTouchEvents&&w(k),o.useNativeClickEvent&&k.addEventListener("click",m,!0),k.addEventListener("wheel",v,{passive:!0,capture:!0})}),a.hooks.destroy.tap(r.tag,function(){var k=i.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(k.style.msContentZooming="",k.style.msTouchAction=""):l.supportsPointerEvents&&(k.style.touchAction=""),l.supportsPointerEvents?S(k):M(k),l.supportsTouchEvents&&_(k),o.useNativeClickEvent&&k.removeEventListener("click",m,!0),k.removeEventListener("wheel",v,!0)})}}])}();II.tag="DOMInteraction";var nZ=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Wt(this,t,[].concat(i)),e.name="dom-interaction",e}return qt(t,r),it(t,[{key:"init",value:function(){this.addRenderingPlugin(new II)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(Vs);/*!
- * @antv/g-plugin-html-renderer
- * @description A G plugin for rendering HTML
- * @version 2.1.21
- * @date 1/23/2025, 8:33:20 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var rZ="g-canvas-camera",DI=function(){function r(){at(this,r),this.displayObjectHTMLElementMap=new WeakMap}return it(r,[{key:"joinTransformMatrix",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0];return"matrix(".concat([e[0],e[1],e[4],e[5],e[12]+n[0],e[13]+n[1]].join(","),")")}},{key:"apply",value:function(e,n){var i=this,a=e.camera,s=e.renderingContext,o=e.renderingService;this.context=e;var l=s.root.ownerDocument.defaultView,u=l.context.eventService.nativeHTMLMap,c=function(b,w){w.style.transform=i.joinTransformMatrix(b.getWorldTransform(),b.getOrigin())},h=function(b){var w=b.target;if(w.nodeName===Q.HTML){i.$camera||(i.$camera=i.createCamera(a));var x=i.getOrCreateEl(w);i.$camera.appendChild(x),Object.keys(w.attributes).forEach(function(S){i.updateAttribute(S,w)}),c(w,x),u.set(x,w)}},d=function(b){var w=b.target;if(w.nodeName===Q.HTML&&i.$camera){var x=i.getOrCreateEl(w);x&&(x.remove(),u.delete(x))}},g=function(b){var w=b.target;if(w.nodeName===Q.HTML){var x=b.attrName;i.updateAttribute(x,w)}},p=function(b){var w=b.target,x=w.nodeName===Q.FRAGMENT?w.childNodes:[w];x.forEach(function(S){if(S.nodeName===Q.HTML){var _=i.getOrCreateEl(S);c(S,_)}})},v=function(){if(i.$camera){var b=i.context.config,w=b.width,x=b.height;i.$camera.parentElement.style.width="".concat(w||0,"px"),i.$camera.parentElement.style.height="".concat(x||0,"px")}};o.hooks.init.tap(r.tag,function(){l.addEventListener($r.RESIZE,v),l.addEventListener(Xt.MOUNTED,h),l.addEventListener(Xt.UNMOUNTED,d),l.addEventListener(Xt.ATTR_MODIFIED,g),l.addEventListener(Xt.BOUNDS_CHANGED,p)}),o.hooks.endFrame.tap(r.tag,function(){i.$camera&&s.renderReasons.has(zl.CAMERA_CHANGED)&&(i.$camera.style.transform=i.joinTransformMatrix(a.getOrthoMatrix()))}),o.hooks.destroy.tap(r.tag,function(){i.$camera&&i.$camera.remove(),l.removeEventListener($r.RESIZE,v),l.removeEventListener(Xt.MOUNTED,h),l.removeEventListener(Xt.UNMOUNTED,d),l.removeEventListener(Xt.ATTR_MODIFIED,g),l.removeEventListener(Xt.BOUNDS_CHANGED,p)})}},{key:"createCamera",value:function(e){var n=this.context.config,i=n.document,a=n.width,s=n.height,o=this.context.contextService.getDomElement(),l=o.parentNode;if(l){var u=rZ,c=l.querySelector("#".concat(u));if(!c){var h=(i||document).createElement("div");h.style.overflow="hidden",h.style.pointerEvents="none",h.style.position="absolute",h.style.left="0px",h.style.top="0px",h.style.width="".concat(a||0,"px"),h.style.height="".concat(s||0,"px");var d=(i||document).createElement("div");c=d,d.id=u,d.style.position="absolute",d.style.left="".concat(o.offsetLeft||0,"px"),d.style.top="".concat(o.offsetTop||0,"px"),d.style.transformOrigin="left top",d.style.transform=this.joinTransformMatrix(e.getOrthoMatrix()),d.style.pointerEvents="none",d.style.width="100%",d.style.height="100%",h.appendChild(d),l.appendChild(h)}return c}return null}},{key:"getOrCreateEl",value:function(e){var n=this.context.config.document,i=this.displayObjectHTMLElementMap.get(e);return i||(i=(n||document).createElement("div"),e.parsedStyle.$el=i,this.displayObjectHTMLElementMap.set(e,i),e.id&&(i.id=e.id),e.name&&i.setAttribute("name",e.name),e.className&&(i.className=e.className),i.style.position="absolute",i.style["will-change"]="transform",i.style.transform=this.joinTransformMatrix(e.getWorldTransform(),e.getOrigin())),i}},{key:"updateAttribute",value:function(e,n){var i=this.getOrCreateEl(n);switch(e){case"innerHTML":var a=n.parsedStyle.innerHTML;oe(a)?i.innerHTML=a:(i.innerHTML="",i.appendChild(a));break;case"x":i.style.left="".concat(n.parsedStyle.x,"px");break;case"y":i.style.top="".concat(n.parsedStyle.y,"px");break;case"transformOrigin":var s=n.parsedStyle.transformOrigin;i.style["transform-origin"]="".concat(s[0].buildCSSText(null,null,"")," ").concat(s[1].buildCSSText(null,null,""));break;case"width":var o=n.parsedStyle.width;i.style.width=bt(o)?"".concat(o,"px"):o.toString();break;case"height":var l=n.parsedStyle.height;i.style.height=bt(l)?"".concat(l,"px"):l.toString();break;case"zIndex":var u=n.parsedStyle.zIndex;i.style["z-index"]="".concat(u);break;case"visibility":var c=n.parsedStyle.visibility;i.style.visibility=c;break;case"pointerEvents":var h=n.parsedStyle.pointerEvents,d=h===void 0?"auto":h;i.style.pointerEvents=d;break;case"opacity":var g=n.parsedStyle.opacity;i.style.opacity="".concat(g);break;case"fill":var p=n.parsedStyle.fill,v="";Sf(p)?p.isNone?v="transparent":v=n.getAttribute("fill"):Array.isArray(p)?v=n.getAttribute("fill"):Io(p),i.style.background=v;break;case"stroke":var m=n.parsedStyle.stroke,b="";Sf(m)?m.isNone?b="transparent":b=n.getAttribute("stroke"):Array.isArray(m)?b=n.getAttribute("stroke"):Io(m),i.style["border-color"]=b,i.style["border-style"]="solid";break;case"lineWidth":var w=n.parsedStyle.lineWidth;i.style["border-width"]="".concat(w||0,"px");break;case"lineDash":i.style["border-style"]="dashed";break;case"filter":var x=n.style.filter;i.style.filter=x;break;default:!kt(n.style[e])&&n.style[e]!==""&&(i.style[e]=n.style[e])}}}])}();DI.tag="HTMLRendering";var iZ=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Wt(this,t,[].concat(i)),e.name="html-renderer",e}return qt(t,r),it(t,[{key:"init",value:function(){this.addRenderingPlugin(new DI)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(Vs);/*!
- * @antv/g-canvas
- * @description A renderer implemented by Canvas 2D API
- * @version 2.0.39
- * @date 1/23/2025, 8:35:49 AM
- * @author AntVis
- * @docs https://g.antv.antgroup.com/
- */var aZ=function(){function r(t){at(this,r),this.renderingContext=t.renderingContext,this.canvasConfig=t.config}return it(r,[{key:"init",value:function(){var e=this.canvasConfig,n=e.container,i=e.canvas;if(i)this.$canvas=i,n&&i.parentElement!==n&&n.appendChild(i),this.$container=i.parentElement,this.canvasConfig.container=this.$container;else if(n&&(this.$container=oe(n)?document.getElementById(n):n,this.$container)){var a=document.createElement("canvas");this.$container.appendChild(a),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=a}this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height)}},{key:"getContext",value:function(){return this.context}},{key:"getDomElement",value:function(){return this.$canvas}},{key:"getDPR",value:function(){return this.dpr}},{key:"getBoundingClientRect",value:function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()}},{key:"destroy",value:function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)}},{key:"resize",value:function(e,n){var i=this.canvasConfig.devicePixelRatio;this.dpr=i,this.$canvas&&(this.$canvas.width=this.dpr*e,this.$canvas.height=this.dpr*n,LH(this.$canvas,e,n)),this.renderingContext.renderReasons.add(zl.CAMERA_CHANGED)}},{key:"applyCursorStyle",value:function(e){this.$container&&this.$container.style&&(this.$container.style.cursor=e)}},{key:"toDataURL",value:function(){var t=Fs(jn().mark(function n(){var i,a,s,o=arguments;return jn().wrap(function(u){for(;;)switch(u.prev=u.next){case 0:return i=o.length>0&&o[0]!==void 0?o[0]:{},a=i.type,s=i.encoderOptions,u.abrupt("return",this.context.canvas.toDataURL(a,s));case 3:case"end":return u.stop()}},n,this)}));function e(){return t.apply(this,arguments)}return e}()}])}(),sZ=function(r){function t(){var e;at(this,t);for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];return e=Wt(this,t,[].concat(i)),e.name="canvas-context-register",e}return qt(t,r),it(t,[{key:"init",value:function(){this.context.ContextService=aZ}},{key:"destroy",value:function(){delete this.context.ContextService}}])}(Vs),mc=function(r){function t(e){var n;return at(this,t),n=Wt(this,t,[e]),n.registerPlugin(new sZ),n.registerPlugin(new XK),n.registerPlugin(new kK),n.registerPlugin(new eZ),n.registerPlugin(new nZ),n.registerPlugin(new VK),n.registerPlugin(new iZ),n}return qt(t,r),it(t)}(LG),oZ=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class y0 extends vi{constructor(t){super(Object.assign(Object.assign({},t),{style:Object.assign({},y0.defaultStyleProps,t.style)})),this.rootPointerEvent=new Cf(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);hc(n.context.eventService,"mappingTable.pointerupoutside",[]),n.context.eventService.mapEvent(o)})}}get eventService(){return this.context.canvas.context.eventService}get events(){return[J.CLICK,J.POINTER_DOWN,J.POINTER_MOVE,J.POINTER_UP,J.POINTER_OVER,J.POINTER_LEAVE]}getDomElement(){return this.getShape("key").getDomElement()}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e),this.drawPortShapes(t,e)}getKeyStyle(t){const e=Ro(t,["dx","dy","innerHTML","pointerEvents","cursor"]),{dx:n=0,dy:i=0}=e,a=oZ(e,["dx","dy"]),[s,o]=this.getSize(t);return Object.assign(Object.assign({x:n,y:i},a),{width:s,height:o})}drawKeyShape(t,e){const n=this.getKeyStyle(t),{x:i,y:a,width:s=0,height:o=0}=n,l=this.upsert("key-container",Sn,{x:i,y:a,width:s,height:o,opacity:0},e);return this.upsert("key",Ic,n,l)}connectedCallback(){if(!(this.context.canvas.getRenderer("main")instanceof mc))return;const n=this.getDomElement();this.events.forEach(i=>{n.addEventListener(i,this.forwardEvents)})}attributeChangedCallback(t,e,n){t==="zIndex"&&e!==n&&(this.getDomElement().style.zIndex=n)}destroy(){const t=this.getDomElement();this.events.forEach(e=>{t.removeEventListener(e,this.forwardEvents)}),super.destroy()}normalizeToPointerEvent(t,e){const n=[];if(e.isTouchEvent(t))for(let i=0;i<t.changedTouches.length;i++){const a=t.changedTouches[i];Pt(a.button)&&(a.button=0),Pt(a.buttons)&&(a.buttons=1),Pt(a.isPrimary)&&(a.isPrimary=t.touches.length===1&&t.type==="touchstart"),Pt(a.width)&&(a.width=a.radiusX||1),Pt(a.height)&&(a.height=a.radiusY||1),Pt(a.tiltX)&&(a.tiltX=0),Pt(a.tiltY)&&(a.tiltY=0),Pt(a.pointerType)&&(a.pointerType="touch"),Pt(a.pointerId)&&(a.pointerId=a.identifier||0),Pt(a.pressure)&&(a.pressure=a.force||.5),Pt(a.twist)&&(a.twist=0),Pt(a.tangentialPressure)&&(a.tangentialPressure=0),a.isNormalized=!0,a.type=t.type,n.push(a)}else if(e.isMouseEvent(t)){const i=t;Pt(i.isPrimary)&&(i.isPrimary=!0),Pt(i.width)&&(i.width=1),Pt(i.height)&&(i.height=1),Pt(i.tiltX)&&(i.tiltX=0),Pt(i.tiltY)&&(i.tiltY=0),Pt(i.pointerType)&&(i.pointerType="mouse"),Pt(i.pointerId)&&(i.pointerId=1),Pt(i.pressure)&&(i.pressure=.5),Pt(i.twist)&&(i.twist=0),Pt(i.tangentialPressure)&&(i.tangentialPressure=0),i.isNormalized=!0,n.push(i)}else n.push(t);return n}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.metaKey=e.metaKey,t.shiftKey=e.shiftKey,t.ctrlKey=e.ctrlKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.screen.x=e.screenX,t.screen.y=e.screenY,t.relatedTarget=null}bootstrapEvent(t,e,n,i){t.view=n,t.originalEvent=null,t.nativeEvent=i,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e);const{x:a,y:s}=this.getViewportXY(e);t.viewport.x=a,t.viewport.y=s;const[o,l]=this.context.canvas.getCanvasByViewport([a,s]);return t.canvas.x=o,t.canvas.y=l,t.global.copyFrom(t.canvas),t.offset.copyFrom(t.canvas),t.isTrusted=i.isTrusted,t.type==="pointerleave"&&(t.type="pointerout"),t}getViewportXY(t){let e,n;const{offsetX:i,offsetY:a,clientX:s,clientY:o}=t;if(!kt(i)&&!kt(a))e=i,n=a;else{const l=this.eventService.client2Viewport({x:s,y:o});e=l.x,n=l.y}return{x:e,y:n}}onframe(){super.onframe();const{opacity:t}=this.attributes;this.getDomElement().style.opacity=`${t}`}}y0.defaultStyleProps={size:[160,80],halo:!1,icon:!1,label:!1,pointerEvents:"auto"};var UM=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};let FI=class BI extends vi{constructor(t){super(Nn({style:BI.defaultStyleProps},t))}getKeyStyle(t){const[e,n]=this.getSize(t),i=super.getKeyStyle(t),{fillOpacity:a,opacity:s=a}=i,o=UM(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;UM(e,["fill","stroke"]);const a=fn(this.getGraphicStyle(t),"halo"),s=Number(a.lineWidth),[o,l]=Lt(this.getSize(t),[s,s]);return Object.assign(Object.assign({},a),{width:o,height:l,fill:"transparent",x:-o/2,y:-l/2})}getIconStyle(t){const e=super.getIconStyle(t),[n,i]=this.getSize(t);return e?Object.assign({width:n*Wa,height:i*Wa},e):!1}drawKeyShape(t,e){const n=this.upsert("key",Qx,this.getKeyStyle(t),e);return tE(this),n}drawHaloShape(t,e){this.upsert("halo",Sn,this.getHaloStyle(t),e)}update(t){super.update(t),t&&("x"in t||"y"in t||"z"in t)&&eE(this)}};FI.defaultStyleProps={size:32};class lZ extends vi{constructor(t){super(t)}getKeyStyle(t){const[e,n]=this.getSize(t);return Object.assign(Object.assign({},super.getKeyStyle(t)),{width:e,height:n,x:-e/2,y:-n/2})}getIconStyle(t){const e=super.getIconStyle(t),{width:n,height:i}=this.getShape("key").attributes;return e?Object.assign({width:n*Wa,height:i*Wa},e):!1}drawKeyShape(t,e){return this.upsert("key",Sn,this.getKeyStyle(t),e)}}class uZ extends p0{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 HZ(this.getOuterR(t),this.getInnerR(t))}getIconStyle(t){const e=super.getIconStyle(t),n=this.getInnerR(t)*2*Wa;return e?Object.assign({width:n,height:n},e):!1}getPortXY(t,e){const{placement:n="top"}=e,i=this.getShape("key").getLocalBounds(),a=UZ(this.getOuterR(t),this.getInnerR(t));return sE(i,n,a,!1)}}class b0 extends p0{constructor(t){super(Nn({style:b0.defaultStyleProps},t))}getPoints(t){const{direction:e}=t,[n,i]=this.getSize(t);return YZ(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=XZ(s,o,n);return sE(a,i,l,!1)}getIconStyle(t){const{icon:e,iconText:n,iconSrc:i,direction:a}=t;if(e===!1||Zi(n||i))return!1;const s=fn(this.getGraphicStyle(t),"icon"),o=this.getShape("key").getLocalBounds(),[l,u]=hX(o,a),c=dX(o,a)*2*Wa;return Object.assign({x:l,y:u,width:c,height:c},s)}}b0.defaultStyleProps={size:40,direction:"up"};var YM=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 Jl extends vi{constructor(t){super(Nn({style:Jl.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]=la(e);return Lt(Hr(n),[o+a,i+s,0])}getCollapsedKeySize(t){return Hr(t.collapsedSize)}getExpandedKeySize(t){const e=this.getContentBBox(t);return[ua(e),ca(e),0]}getContentBBox(t){const{childrenNode:e=[],padding:n}=t,i=e.map(s=>this.context.element.getElement(s)).filter(Boolean);if(i.length===0){const s=new Me,{x:o=0,y:l=0,size:u}=t,[c,h]=Hr(u);return s.setMinMax([o-c/2,l-h/2,0],[o+c/2,l+h/2,0]),s}const a=Fc(i.map(s=>s.getBounds()));return n?Ys(a,n):a}drawCollapsedMarkerShape(t,e){const n=this.getCollapsedMarkerStyle(t);this.upsert("collapsed-marker",kI,n,e),tE(this)}getCollapsedMarkerStyle(t){if(!t.collapsed||!t.collapsedMarker)return!1;const e=fn(this.getGraphicStyle(t),"collapsedMarker"),{type:n}=e,i=YM(e,["type"]),a=this.getShape("key"),[s,o]=Oa(a.getLocalBounds(),"center"),l=Object.assign(Object.assign({},i),{x:s,y:o});if(n){const u=this.getCollapsedMarkerText(n,t);Object.assign(l,{text:u})}return l}getCollapsedMarkerText(t,e){const{childrenData:n=[]}=e,{model:i}=this.context;return t==="descendant-count"?i.getDescendantsData(this.id).length.toString():t==="child-count"?n.length.toString():t==="node-count"?i.getDescendantsData(this.id).filter(a=>i.getElementType(H(a))==="node").length.toString():Et(t)?t(n):""}getComboPosition(t){const{x:e=0,y:n=0,collapsed:i,childrenData:a=[]}=t;if(a.length===0)return[+e,+n,0];if(i){const{model:s}=this.context,o=s.getDescendantsData(this.id).filter(l=>!s.isCombo(H(l)));if(o.length>0&&o.some(zX)){const l=o.reduce((u,c)=>Lt(u,on(c)),[0,0,0]);return Di(l,o.length)}return[+e,+n,0]}return this.getContentBBox(t).center}getComboStyle(t){const[e,n]=this.getComboPosition(t);return{x:e,y:n,transform:[["translate",e,n]]}}updateComboPosition(t){const e=this.getComboStyle(t);Object.assign(this.style,e);const{x:n,y:i}=e;this.context.model.syncNodeLikeDatum({id:this.id,style:{x:n,y:i}}),eE(this)}render(t,e=this){super.render(t,e),this.drawCollapsedMarkerShape(t,e)}update(t={}){super.update(t),this.updateComboPosition(this.parsedAttributes)}onframe(){super.onframe(),this.attributes.collapsed||this.updateComboPosition(this.parsedAttributes),this.drawKeyShape(this.parsedAttributes,this)}animate(t,e){const n=super.animate(this.attributes.collapsed?t:t.map(i=>{var{x:a,y:s,z:o,transform:l}=i,u=YM(i,["x","y","z","transform"]);return u}),e);return n&&new Proxy(n,{set:(i,a,s)=>(a==="currentTime"&&Promise.resolve().then(()=>this.onframe()),Reflect.set(i,a,s))})}}Jl.defaultStyleProps={childrenNode:[],droppable:!0,draggable:!0,collapsed:!1,collapsedSize:32,collapsedMarker:!0,collapsedMarkerZIndex:1,collapsedMarkerFontSize:12,collapsedMarkerTextAlign:"center",collapsedMarkerTextBaseline:"middle",collapsedMarkerType:"child-count"};class cZ extends Jl{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",Ua,this.getKeyStyle(t),e)}getKeyStyle(t){const{collapsed:e}=t,n=super.getKeyStyle(t),[i]=this.getKeySize(t);return Object.assign(Object.assign(Object.assign({},n),e&&fn(n,"collapsed")),{r:i/2})}getCollapsedKeySize(t){const[e,n]=Hr(t.collapsedSize),i=Math.max(e,n)/2;return[i*2,i*2,0]}getExpandedKeySize(t){const e=this.getContentBBox(t),[n,i]=Us(e),a=Math.sqrt(Math.pow(n,2)+Math.pow(i,2))/2;return[a*2,a*2,0]}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return f0(t,n,e)}}class hZ extends Jl{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",Sn,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,i]=this.getKeySize(t);return Object.assign(Object.assign(Object.assign({},e),t.collapsed&&fn(e,"collapsed")),{width:n,height:i,x:-n/2,y:-i/2})}}const dZ={padding:10};function XM(r,t,e,n,i,a){const{padding:s}=Object.assign(dZ,a),o=Ss(e,s),l=Ss(n,s),u=[r,...i,t];let c=null;const h=[];for(let d=0,g=u.length;d<g-1;d++){const p=d+1,v=u[d],m=u[p],b=qX(v,m);let w=null;if(d===0)if(p===g-1)if(o.intersects(l))w=jv(v,m,o,l);else if(!Af(v,o)&&!Af(m,l)){const x=Co(v,o),S=Co(m,l);w=ZM(x,S,lr(x,S)),w.points.unshift(x),w.points.push(S)}else b||(w=gZ(v,m,o,l));else Ii(m,o)?w=jv(v,m,o,Ss(m,s),c):b||(w=tf(v,m,o));else p===g-1?Ii(v,l)?w=jv(v,m,Ss(v,s),l,c):b||(w=zI(v,m,l,c)):b||(w=ZM(v,m,c));w?(h.push(...w.points),c=w.direction):c=lr(v,m),p<g-1&&h.push(m)}return h.map(Bo)}const fZ={N:"S",S:"N",W:"E",E:"W"},KM={N:-Math.PI/2,S:Math.PI/2,E:0,W:Math.PI};function lr(r,t){const[e,n]=r,[i,a]=t;return e===i?n>a?"N":"S":n===a?e>i?"W":"E":null}function $w(r,t){return t==="N"||t==="S"?ca(r):ua(r)}function ZM(r,t,e){const n=[r[0],t[1]],i=[t[0],r[1]],a=lr(r,n),s=lr(r,i),o=e?fZ[e]:null,l=a===e||a!==o&&s!==e?n:i;return{points:[l],direction:lr(l,t)}}function tf(r,t,e){if(Af(r,e)){const n=yc(r,t,e);return{points:[n],direction:lr(n,t)}}else{const n=Co(r,e),a=["left","right"].includes(ic(r,e))?[t[0],n[1]]:[n[0],t[1]];return{points:[a],direction:lr(a,t)}}}function zI(r,t,e,n){const i=Af(t,e)?t:Co(t,e),a=[[i[0],r[1]],[r[0],i[1]]],s=a.filter(l=>cX(l,e)&&!iI(l,e,!0)),o=s.filter(l=>lr(l,r)!==n);if(o.length>0){const l=o.find(u=>lr(r,u)===n)||o[0];return{points:[l],direction:lr(l,t)}}else{const l=yW(a,s)[0],u=Rs(t,l,$w(e,n)/2);return{points:[yc(u,r,e),u],direction:lr(u,t)}}}function gZ(r,t,e,n){let i=tf(r,t,e);const a=vc(i.points[0]);if(Ii(a,n)){i=tf(t,r,n);const s=vc(i.points[0]);if(Ii(s,e)){const o=Rs(r,a,$w(e,lr(r,a))/2),l=Rs(t,s,$w(n,lr(t,s))/2),u=[(o[0]+l[0])/2,(o[1]+l[1])/2],c=tf(r,u,e),h=zI(u,t,n,c.direction);i.points=[c.points[0],h.points[0]],i.direction=h.direction}}return i}function jv(r,t,e,n,i){const s=Fc([e,n]),o=Pe(t,s.center)>Pe(r,s.center),[l,u]=o?[t,r]:[r,t],c=ca(s)+ua(s);let h;if(i){const p=[l[0]+c*Math.cos(KM[i]),l[1]+c*Math.sin(KM[i])];h=Rs(Co(p,s),p,.01)}else h=Rs(Co(l,s),l,-.01);let d=yc(h,u,s),g=[Au(h,2),Au(d,2)];if(Ye(Au(h),Au(d))){const p=Kx(be(h,l),[1,0,0])+Math.PI/2;d=[u[0]+c*Math.cos(p),u[1]+c*Math.sin(p),0],d=Au(Rs(Co(d,s),u,-.01),2);const v=yc(h,d,s);g=[h,v,d]}return{points:o?g.reverse():g,direction:lr(o?h:d,t)}}function yc(r,t,e){let n=[r[0],t[1]];return Ii(n,e)&&(n=[t[0],r[1]]),n}function $I(r,t,e,n,i){let l=typeof t=="number"?t:.5;t==="start"&&(l=0),t==="end"&&(l=.99);const u=$n(r.getPoint(l)),c=$n(r.getPoint(l+.01));let h=t==="start"?"left":t==="end"?"right":"center";if(pI(u,c)||!e){const[b,w]=JM(r,l,n,i);return{transform:[["translate",b,w]],textAlign:h}}let d=Math.atan2(c[1]-u[1],c[0]-u[0]);c[0]<u[0]&&(h=h==="center"?h:h==="left"?"right":"left",n*=-1,d+=Math.PI);const[p,v]=JM(r,l,n,i,d),m=[["translate",p,v],["rotate",d/Math.PI*180]];return{textAlign:h,transform:m}}function pZ(r,t,e,n,i){var a,s;const o=((a=r.badge)===null||a===void 0?void 0:a.getGeometryBounds().halfExtents[0])*2||0,l=((s=r.label)===null||s===void 0?void 0:s.getGeometryBounds().halfExtents[0])*2||0;return $I(r.key,e,!0,(l?(l/2+o/2)*(t==="suffix"?1:-1):0)+n,i)}function JM(r,t,e,n,i){const[a,s]=$n(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 jw(r,t,e,n){if(Ye(r,t))return r;const i=be(t,r),a=[r[0]+e*i[0],r[1]+e*i[1]],s=za(d0(i,!1));return a[0]+=n*s[0],a[1]+=n*s[1],a}function vZ(r){return bt(r)?[r,-r]:r}function mZ(r){return bt(r)?[r,1-r]:r}function yZ(r,t,e){return[["M",r[0],r[1]],["Q",e[0],e[1],t[0],t[1]]]}function jI(r,t,e){return[["M",r[0],r[1]],["C",e[0][0],e[0][1],e[1][0],e[1][1],t[0],t[1]]]}function iE(r,t=0,e=!1){const n=r[0],i=r[r.length-1],a=r.slice(1,r.length-1),s=[["M",n[0],n[1]]];return a.forEach((o,l)=>{const u=a[l-1]||n,c=a[l+1]||i;if(!vI(u,o,c)&&t){const[h,d]=bZ(u,o,c,t);s.push(["L",h[0],h[1]],["Q",o[0],o[1],d[0],d[1]],["L",d[0],d[1]])}else s.push(["L",o[0],o[1]])}),s.push(["L",i[0],i[1]]),e&&s.push(["Z"]),s}function bZ(r,t,e,n){const i=Pf(r,t),a=Pf(e,t),s=Math.min(n,Math.min(i,a)/2),o=[t[0]-s/i*(t[0]-r[0]),t[1]-s/i*(t[1]-r[1])],l=[t[0]-s/a*(t[0]-e[0]),t[1]-s/a*(t[1]-e[1])];return[o,l]}const wZ=r=>{const t=Math.PI/2,e=ca(r)/2,n=ua(r)/2,i=Math.atan2(e,n)/2,a=Math.atan2(n,e)/2;return{top:[-t-a,-t+a],"top-right":[-t+a,-i],"right-top":[-t+a,-i],right:[-i,i],"bottom-right":[i,t-a],"right-bottom":[i,t-a],bottom:[t-a,t+a],"bottom-left":[t+a,Math.PI-i],"left-bottom":[t+a,Math.PI-i],left:[Math.PI-i,Math.PI+i],"top-left":[Math.PI+i,-t-a],"left-top":[Math.PI+i,-t-a]}};function qI(r,t,e,n,i){const a=Ss(r),s=r.getCenter();let o=n&&$s(n),l=i&&$s(i);if(!o||!l){const u=wZ(a),c=u[t][0],h=u[t][1],[d,g]=Us(a),p=Math.max(d,g),v=Lt(s,[p*Math.cos(c),p*Math.sin(c),0]),m=Lt(s,[p*Math.cos(h),p*Math.sin(h),0]);o=Ww(r,v),l=Ww(r,m),e||([o,l]=[l,o])}return[o,l]}function xZ(r,t,e,n,i,a){const s=r.getPorts()[i||a],o=r.getPorts()[a||i];let[l,u]=qI(r,t,e,s,o);const c=EZ(r,l,u,n);return s&&(l=bc(s,c[0])),o&&(u=bc(o,c[c.length-1])),jI(l,u,c)}function EZ(r,t,e,n){const i=r.getCenter();if(Ye(t,e)){const a=be(t,i),s=[n*Math.sign(a[0])||n/2,n*Math.sign(a[1])||-n/2,0];return[Lt(t,s),Lt(e,Ta(s,[1,-1,1]))]}return[Rs(i,t,Pe(i,t)+n),Rs(i,e,Pe(i,e)+n)]}function _Z(r,t,e,n,i,a,s){const o=oE(r),l=o[a||s],u=o[s||a];let[c,h]=qI(r,e,n,l,u);const d=SZ(r,c,h,i);return l&&(c=bc(l,d[0])),u&&(h=bc(u,d[d.length-1])),iE([c,...d,h],t)}function SZ(r,t,e,n){const i=[],a=Ss(r);if(Ye(t,e))switch(ic(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=ic(t,a),o=ic(e,a);if(s===o){const l=s;let u,c;switch(l){case"left":u=Math.min(t[0],e[0])-n,i.push([u,t[1]]),i.push([u,e[1]]);break;case"right":u=Math.max(t[0],e[0])+n,i.push([u,t[1]]),i.push([u,e[1]]);break;case"top":c=Math.min(t[1],e[1])-n,i.push([t[0],c]),i.push([e[0],c]);break;case"bottom":c=Math.max(t[1],e[1])+n,i.push([t[0],c]),i.push([e[0],c]);break}}else{const l=(d,g)=>({left:[g[0]-n,g[1]],right:[g[0]+n,g[1]],top:[g[0],g[1]-n],bottom:[g[0],g[1]+n]})[d],u=l(s,t),c=l(o,e),h=yc(u,c,a);i.push(u,h,c)}}return i}function qw(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 QM(r,t){const e=[];let n=r;for(;n;){e.push(n);const i=t(H(n));if(i)n=i;else break}if(e.some(i=>{var a;return(a=i.style)===null||a===void 0?void 0:a.collapsed})){const i=e.reverse().findIndex(Sr);return e[i]||e.at(-1)}return r}function MZ(r,t){return t||(r<4?10:r===4?12:r*2.5)}const kZ=(r,t)=>{const e=Math.max(r,t)/2;return[["M",-r/2,0],["A",e,e,0,1,0,2*e-r/2,0],["A",e,e,0,1,0,-r/2,0],["Z"]]},WI=(r,t)=>[["M",-r/2,0],["L",r/2,-t/2],["L",r/2,t/2],["Z"]],CZ=(r,t)=>[["M",-r/2,0],["L",0,-t/2],["L",r/2,0],["L",0,t/2],["Z"]],TZ=(r,t)=>[["M",-r/2,0],["L",r/2,-t/2],["L",4*r/5-r/2,0],["L",r/2,t/2],["Z"]],OZ=(r,t)=>[["M",-r/2,-t/2],["L",r/2,-t/2],["L",r/2,t/2],["L",-r/2,t/2],["Z"]],AZ=(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"]]},PZ=(r,t)=>[["M",r/2,-t/2],["L",-r/2,0],["L",r/2,0],["L",-r/2,0],["L",r/2,t/2]],NZ=Object.freeze(Object.defineProperty({__proto__:null,circle:kZ,diamond:CZ,rect:OZ,simple:PZ,triangle:WI,triangleRect:AZ,vee:TZ},Symbol.toStringTag,{value:"Module"}));var Md=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};class Ks extends CI{constructor(t){super(Nn({style:Ks.defaultStyleProps},t)),this.type="edge"}get sourceNode(){const{sourceNode:t}=this.parsedAttributes;return this.context.element.getElement(t)}get targetNode(){const{targetNode:t}=this.parsedAttributes;return this.context.element.getElement(t)}getKeyStyle(t){const e=this.getGraphicStyle(t),{loop:n}=e,i=Md(e,["loop"]),{sourceNode:a,targetNode:s}=this,l={d:n&&qZ(a,s)?this.getLoopPath(t):this.getKeyPath(t)};return qr.PARSED_STYLE_LIST.forEach(u=>{u in i&&(l[u]=i[u])}),l}getLoopPath(t){const{sourcePort:e,targetPort:n}=t,i=this.sourceNode,a=Ss(i),s=Math.max(ua(a),ca(a)),{placement:o,clockwise:l,dist:u=s}=fn(this.getGraphicStyle(t),"loop");return xZ(i,o,l,u,e,n)}getEndpoints(t,e=!0,n=[]){const{sourcePort:i,targetPort:a}=t,{sourceNode:s,targetNode:o}=this,[l,u]=GZ(s,o,i,a);if(!e){const g=l?$s(l):s.getCenter(),p=u?$s(u):o.getCenter();return[g,p]}const c=typeof n=="function"?n():n,h=ik(l||s,c[0]||u||o),d=ik(u||o,c[c.length-1]||l||s);return[h,d]}getHaloStyle(t){if(t.halo===!1)return!1;const e=this.getKeyStyle(t),n=fn(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign({},e),n)}getLabelStyle(t){if(t.label===!1||!t.labelText)return!1;const e=fn(this.getGraphicStyle(t),"label"),{placement:n,offsetX:i,offsetY:a,autoRotate:s,maxWidth:o}=e,l=Md(e,["placement","offsetX","offsetY","autoRotate","maxWidth"]),u=$I(this.shapeMap.key,n,s,i,a),c=this.shapeMap.key.getLocalBounds(),h=rK([c.min,c.max],o);return Object.assign({wordWrapWidth:h},u,l)}getBadgeStyle(t){if(t.badge===!1||!t.badgeText)return!1;const e=fn(t,"badge"),{offsetX:n,offsetY:i,placement:a}=e,s=Md(e,["offsetX","offsetY","placement"]);return Object.assign(s,pZ(this.shapeMap,a,t.labelPlacement,n,i))}drawArrow(t,e){var n;const i=e==="start",s=t[e==="start"?"startArrow":"endArrow"],o=this.shapeMap.key;if(s){const l=this.getArrowStyle(t,i),[u,c,h]=i?["markerStart","markerStartOffset","startArrowOffset"]:["markerEnd","markerEndOffset","endArrowOffset"],d=o.parsedStyle[u];if(d)d.attr(l);else{const g=l.src?Dc:qr,p=new g({style:l});o.style[u]=p}o.style[c]=t[h]||l.width/2+ +l.lineWidth}else{const l=i?"markerStart":"markerEnd";(n=o.style[l])===null||n===void 0||n.destroy(),o.style[l]=null}}getArrowStyle(t,e){const n=this.getShape("key").attributes,i=e?"startArrow":"endArrow",a=fn(this.getGraphicStyle(t),i),{size:s,type:o}=a,l=Md(a,["size","type"]),[u,c]=Hr(MZ(n.lineWidth,s)),d=(Et(o)?o:NZ[o]||WI)(u,c);return Object.assign(Ro(n,["stroke","strokeOpacity","fillOpacity"]),{width:u,height:c},Object.assign({},d&&{d,fill:o==="simple"?"":n.stroke}),l)}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",Xs,n,e)}drawHaloShape(t,e){const n=this.getHaloStyle(t);this.upsert("halo",qr,n,e)}drawBadgeShape(t,e){const n=this.getBadgeStyle(t);this.upsert("badge",$a,n,e)}drawSourceArrow(t){this.drawArrow(t,"start")}drawTargetArrow(t){this.drawArrow(t,"end")}drawKeyShape(t,e){const n=this.getKeyStyle(t);return this.upsert("key",qr,n,e)}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e),this.getShape("key")&&(this.drawSourceArrow(t),this.drawTargetArrow(t),this.drawLabelShape(t,e),this.drawHaloShape(t,e),this.drawBadgeShape(t,e))}onframe(){this.drawKeyShape(this.parsedAttributes,this),this.drawSourceArrow(this.parsedAttributes),this.drawTargetArrow(this.parsedAttributes),this.drawHaloShape(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this),this.drawBadgeShape(this.parsedAttributes,this)}animate(t,e){const n=super.animate(t,e);return n&&new Proxy(n,{set:(i,a,s)=>(a==="currentTime"&&Promise.resolve().then(()=>this.onframe()),Reflect.set(i,a,s))})}}Ks.defaultStyleProps={badge:!0,badgeOffsetX:0,badgeOffsetY:0,badgePlacement:"suffix",isBillboard:!0,label:!0,labelAutoRotate:!0,labelIsBillboard:!0,labelMaxWidth:"80%",labelOffsetX:4,labelOffsetY:0,labelPlacement:"center",labelTextBaseline:"middle",labelWordWrap:!1,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloPointerEvents:"none",haloStrokeOpacity:.25,haloZIndex:-1,loop:!0,startArrow:!1,startArrowLineDash:0,startArrowLineJoin:"round",startArrowLineWidth:1,startArrowTransformOrigin:"center",startArrowType:"vee",endArrow:!1,endArrowLineDash:0,endArrowLineJoin:"round",endArrowLineWidth:1,endArrowTransformOrigin:"center",endArrowType:"vee",loopPlacement:"top",loopClockwise:!0};class Ho extends Ks{constructor(t){super(Nn({style:Ho.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t),{controlPoints:i,curvePosition:a,curveOffset:s}=t,o=this.getControlPoints(e,n,mZ(a),vZ(s),i);return jI(e,n,o)}getControlPoints(t,e,n,i,a){return(a==null?void 0:a.length)===2?a:[jw(t,e,n[0],i[0]),jw(t,e,n[1],i[1])]}}Ho.defaultStyleProps={curvePosition:.5,curveOffset:20};class qc extends Ho{constructor(t){super(Nn({style:qc.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]]]}}qc.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};class w0 extends Ho{constructor(t){super(Nn({style:w0.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=on(this.ref),n=this.sourceNode.getIntersectPoint(e,!0),i=this.targetNode.getIntersectPoint(e);return[n,i]}toRadialCoordinate(t){const e=on(this.ref),n=Pe(t,e),i=dI(be(t,e));return[n,i]}getControlPoints(t,e,n,i){const[a,s]=this.toRadialCoordinate(t),[o]=this.toRadialCoordinate(e),l=o-a;return[[t[0]+(l*n[0]+i[0])*Math.cos(s),t[1]+(l*n[0]+i[0])*Math.sin(s)],[e[0]-(l*n[1]-i[0])*Math.cos(s),e[1]-(l*n[1]-i[0])*Math.sin(s)]]}}w0.defaultStyleProps={curvePosition:.5,curveOffset:20};class x0 extends Ho{constructor(t){super(Nn({style:x0.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]]]}}x0.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};let GI=class VI extends Ks{constructor(t){super(Nn({style:VI.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t);return[["M",e[0],e[1]],["L",n[0],n[1]]]}};GI.defaultStyleProps={};const RZ={enableObstacleAvoidance:!1,offset:10,maxAllowedDirectionChange:Math.PI/2,maximumLoops:3e3,gridSize:5,startDirections:["top","right","bottom","left"],endDirections:["top","right","bottom","left"],directionMap:{right:{stepX:1,stepY:0},left:{stepX:-1,stepY:0},bottom:{stepX:0,stepY:1},top:{stepX:0,stepY:-1}},penalties:{0:0,90:0},distFunc:Pf},Sa=r=>`${Math.round(r[0])}|||${Math.round(r[1])}`;function xo(r,t){const e=n=>Math.round(n/t);return bt(r)?e(r):r.map(e)}function LZ(r,t){const e=Math.abs(r-t);return e>Math.PI?2*Math.PI-e:e}function tk(r,t){const e=t[0]-r[0],n=t[1]-r[1];return!e&&!n?0:Math.atan2(n,e)}function HI(r,t,e,n){const i=tk(r,t),a=e[Sa(r)],o=tk(a||n,r);return LZ(o,i)}const IZ=(r,t)=>{const{offset:e,gridSize:n}=t,i={};return r.forEach(a=>{if(!a||a.destroyed||!a.isVisible())return;const s=Ys(a.getRenderBounds(),e);for(let o=xo(s.min[0],n);o<=xo(s.max[0],n);o+=1)for(let l=xo(s.min[1],n);l<=xo(s.max[1],n);l+=1)i[`${o}|||${l}`]=!0}),i};function ek(r,t,e){return Math.min(...t.map(n=>e(r,n)))}function DZ(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 nk=(r,t,e,n)=>{if(!t)return[r];const{directionMap:i,offset:a}=n,s=Ys(t.getRenderBounds(),a),o=Object.keys(i).reduce((l,u)=>{if(e.includes(u)){const c=i[u],[h,d]=Us(s),g=[r[0]+c.stepX*h,r[1]+c.stepY*d],p=fX(s);for(let v=0;v<p.length;v++){const m=Zx([r,g],p[v]);m&&iI(m,s)&&l.push(m)}}return l},[]);return Ii(r,s)||o.push(r),o.map(l=>xo(l,n.gridSize))},FZ=(r,t,e,n,i,a,s)=>{const o=[];let l=[a[0]===n[0]?n[0]:r[0]*s,a[1]===n[1]?n[1]:r[1]*s];o.unshift(l);let u=r,c=t[Sa(u)];for(;c;){const g=c,p=u;HI(g,p,t,e)&&(l=[g[0]===p[0]?l[0]:g[0]*s,g[1]===p[1]?l[1]:g[1]*s],o.unshift(l)),c=t[Sa(g)],u=g}const h=i.map(g=>[g[0]*s,g[1]*s]),d=DZ(h,l,Pf);return o.unshift(d),o};function BZ(r,t,e,n){const i=Bo(r.getCenter()),a=Bo(t.getCenter()),s=Object.assign(RZ,n),{gridSize:o}=s,l=s.enableObstacleAvoidance?e:[r,t],u=IZ(l,s),c=xo(i,o),h=xo(a,o),d=nk(i,r,s.startDirections,s),g=nk(a,t,s.endDirections,s);d.forEach(C=>delete u[Sa(C)]),g.forEach(C=>delete u[Sa(C)]);const p={},v={},m={},b={},w={},x=new zZ;for(let C=0;C<d.length;C++){const P=d[C],T=Sa(P);p[T]=P,b[T]=0,w[T]=ek(P,g,s.distFunc),x.add({id:T,value:w[T]})}const S=g.map(C=>Sa(C));let _=s.maximumLoops,M,k=1/0;for(const[C,P]of Object.entries(p))w[C]<=k&&(k=w[C],M=P);for(;Object.keys(p).length>0&&_>0;){const C=x.minId(!1);if(C)M=p[C];else break;const P=Sa(M);if(S.includes(P))return FZ(M,m,c,a,d,h,o);delete p[P],x.remove(P),v[P]=!0;for(const T of Object.values(s.directionMap)){const A=Lt(M,[T.stepX,T.stepY]),R=Sa(A);if(v[R])continue;const L=HI(M,A,m,c);if(L>s.maxAllowedDirectionChange||u[R])continue;p[R]||(p[R]=A);const $=s.penalties[L],q=s.distFunc(M,A)+(isNaN($)?o:$),j=b[P]+q,B=b[R];B&&j>=B||(m[R]=M,b[R]=j,w[R]=j+ek(A,g,s.distFunc),x.add({id:R,value:w[R]}))}_-=1}return[]}class zZ{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 E0 extends Ks{constructor(t){super(Nn({style:E0.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=BZ(n,i,l,e),o.length||(o=XM(a,s,n,i,t.controlPoints,{padding:e.offset}))}else e.type==="orth"&&(o=XM(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 iE(e,t.radius)}getLoopPath(t){const{sourcePort:e,targetPort:n,radius:i}=t,a=this.sourceNode,s=Ss(a),o=Math.max(ua(s),ca(s))/4,{placement:l,clockwise:u,dist:c=o}=fn(this.getGraphicStyle(t),"loop");return _Z(a,i,l,u,c,e,n)}}E0.defaultStyleProps={radius:0,controlPoints:[],router:!1};class _0 extends Ks{constructor(t){super(Nn({style:_0.defaultStyleProps},t))}getKeyPath(t){const{curvePosition:e,curveOffset:n}=t,[i,a]=this.getEndpoints(t),s=t.controlPoint||jw(i,a,e,n);return yZ(i,a,s)}}_0.defaultStyleProps={curvePosition:.5,curveOffset:30};var $Z=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 Wc(r){return r instanceof vi&&r.type==="node"}function UI(r){return r instanceof Ks}function aE(r){return r instanceof Jl}function jZ(r){return Wc(r)||UI(r)||aE(r)}function qZ(r,t){return!r||!t?!1:r===t}const WZ={top:[.5,0],right:[1,.5],bottom:[.5,1],left:[0,.5],default:[.5,.5]};function sE(r,t,e=WZ,n=!0){const i=[.5,.5],a=oe(t)?sr(e,t.toLocaleLowerCase(),i):t;if(!n&&oe(t))return a;const[s,o]=a||i;return[r.min[0]+ua(r)*s,r.min[1]+ca(r)*o]}function oE(r){if(!r)return{};const t=r.getPorts();return(r.attributes.ports||[]).forEach((n,i)=>{var a;const{key:s,placement:o}=n;YI(n)&&(t[a=s||i]||(t[a]=Oa(r.getShape("key").getBounds(),o)))}),t}function YI(r){const{r:t}=r;return!t||Number(t)===0}function $s(r){return Ul(r)?r:r.getPosition()}function GZ(r,t,e,n){const i=rk(r,t,e,n),a=rk(t,r,n,e);return[i,a]}function rk(r,t,e,n){const i=oE(r);if(e)return i[e];const a=Object.values(i);if(a.length===0)return;const s=a.map(u=>$s(u)),o=VZ(t,n),[l]=VX(s,o);return a.find(u=>$s(u)===l)}function VZ(r,t){const e=oE(r);if(t)return[$s(e[t])];const n=Object.values(e);return n.length>0?n.map(i=>$s(i)):[r.getCenter()]}function ik(r,t){return aE(r)||Wc(r)?Ww(r,t):bc(r,t)}function bc(r,t){if(!r||!t)return[0,0,0];if(Ul(r))return r;if(r.attributes.linkToCenter)return r.getPosition();const e=Ul(t)?t:Wc(t)?t.getCenter():t.getPosition();return f0(e,r.getBounds())}function Ww(r,t){if(!r||!t)return[0,0,0];const e=Ul(t)?t:Wc(t)?t.getCenter():t.getPosition();return r.getIntersectPoint(e)||r.getCenter()}function ak(r,t="bottom",e=0,n=0,i=!1){const a=t.split("-"),[s,o]=Oa(r,t),l=a.includes("left")?"right":a.includes("right")?"left":"center";let u=a.includes("top")?"bottom":a.includes("bottom")?"top":"middle";return i&&(u=u==="top"?"bottom":u==="bottom"?"top":u),{transform:[["translate",s+e,o+n]],textBaseline:u,textAlign:l}}function HZ(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 UZ(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 YZ(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 XZ(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 KZ(r,t){return[[0,-t/2],[r/2,0],[0,t/2],[-r/2,0]]}function ZZ(r){return sr(r,["style","visibility"])!=="hidden"}function JZ(r,t){const{zIndex:e,transform:n,transformOrigin:i,visibility:a,cursor:s,clipPath:o,component:l}=t,u=$Z(t,["zIndex","transform","transformOrigin","visibility","cursor","clipPath","component"]);Object.assign(r.attributes,u),n&&r.setAttribute("transform",n),bt(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 Gw(r,t){"update"in r?r.update(t):r.attr(t)}function QZ(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 tJ(r){hc(r,"__to_be_destroyed__",!0)}function S0(r){return sr(r,"__to_be_destroyed__",!1)}var eJ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class M0 extends Tr{constructor(t,e){super(t,Object.assign({},M0.defaultOptions,e)),this.onCollapseExpand=n=>eJ(this,void 0,void 0,function*(){if(!this.validate(n))return;const{target:i}=n;if(!jZ(i))return;const a=i.id,{model:s,graph:o}=this.context,l=s.getElementDataById(a);if(!l)return!1;const{onCollapse:u,onExpand:c,animation:h,align:d}=this.options;Sr(l)?(yield o.expandElement(a,{animation:h,align:d}),c==null||c(a)):(yield o.collapseElement(a,{animation:h,align:d}),u==null||u(a))}),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`node:${e}`,this.onCollapseExpand),t.on(`combo:${e}`,this.onCollapseExpand)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`node:${e}`,this.onCollapseExpand),t.off(`combo:${e}`,this.onCollapseExpand)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}M0.defaultOptions={enable:!0,animation:!0,trigger:J.DBLCLICK,align:!0};var kd=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};const nJ="g6-create-edge-assist-edge-id",Cd="g6-create-edge-assist-node-id";class k0 extends Tr{constructor(t,e){super(t,Object.assign({},k0.defaultOptions,e)),this.drop=n=>kd(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=>kd(this,void 0,void 0,function*(){var i,a,s;if(!this.validate(n))return;const{graph:o,canvas:l,batch:u,element:c}=this.context,{style:h}=this.options;if(this.source){this.createEdge(n),yield this.cancelEdge();return}u.startBatch(),l.setCursor("crosshair"),this.source=this.getSelectedNodeIDs([n.target.id])[0];const d=o.getElementData(this.source);o.addNodeData([{id:Cd,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:nJ,source:this.source,target:Cd,style:Object.assign({pointerEvents:"none"},h)}]),yield(s=c.draw({animation:!1}))===null||s===void 0?void 0:s.finished}),this.updateAssistEdge=n=>kd(this,void 0,void 0,function*(){var i;if(!this.source)return;const{model:a,element:s}=this.context;a.translateNodeTo(Cd,[n.canvas.x,n.canvas.y]),yield(i=s.draw({animation:!1,silence:!0}))===null||i===void 0?void 0:i.finished}),this.createEdge=n=>{var i,a;const{graph:s}=this.context,{style:o,onFinish:l,onCreate:u}=this.options;if(((i=n.target)===null||i===void 0?void 0:i.id)===void 0||this.source===void 0)return;const h=(a=this.getSelectedNodeIDs([n.target.id]))===null||a===void 0?void 0:a[0],d=`${this.source}-${h}-${zW()}`,g=u({id:d,source:this.source,target:h,style:o});s.addEdgeData([g]),l(g)},this.cancelEdge=()=>kd(this,void 0,void 0,function*(){var n;if(!this.source)return;const{graph:i,element:a,batch:s}=this.context;i.removeNodeData([Cd]),this.source=void 0,yield(n=a.draw({animation:!1}))===null||n===void 0?void 0:n.finished,s.endBatch()}),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;this.unbindEvents(),e==="click"?(t.on(Zn.CLICK,this.handleCreateEdge),t.on(bo.CLICK,this.handleCreateEdge),t.on(ja.CLICK,this.cancelEdge),t.on(Of.CLICK,this.cancelEdge)):(t.on(Zn.DRAG_START,this.handleCreateEdge),t.on(bo.DRAG_START,this.handleCreateEdge),t.on(J.POINTER_UP,this.drop)),t.on(J.POINTER_MOVE,this.updateAssistEdge)}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map(e=>e.id).concat(t)))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;t.off(Zn.CLICK,this.handleCreateEdge),t.off(bo.CLICK,this.handleCreateEdge),t.off(ja.CLICK,this.cancelEdge),t.off(Of.CLICK,this.cancelEdge),t.off(Zn.DRAG_START,this.handleCreateEdge),t.off(bo.DRAG_START,this.handleCreateEdge),t.off(J.POINTER_UP,this.drop),t.off(J.POINTER_MOVE,this.updateAssistEdge)}destroy(){this.unbindEvents(),super.destroy()}}k0.defaultOptions={animation:!0,enable:!0,style:{},trigger:"drag",onCreate:r=>r,onFinish:()=>{}};var sk=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class C0 extends Tr{constructor(t,e){super(t,Object.assign({},C0.defaultOptions,e)),this.isDragging=!1,this.onDragStart=n=>{this.validate(n)&&(this.isDragging=!0,this.context.canvas.setCursor("grabbing"))},this.onDrag=n=>{var i,a,s,o;if(!this.isDragging)return;const l=(a=(i=n.movement)===null||i===void 0?void 0:i.x)!==null&&a!==void 0?a:n.dx,u=(o=(s=n.movement)===null||s===void 0?void 0:s.y)!==null&&o!==void 0?o:n.dy;l|u&&this.translate([l,u],!1)},this.onDragEnd=()=>{var n,i;this.isDragging=!1,this.context.canvas.setCursor(this.defaultCursor),(i=(n=this.options).onFinish)===null||i===void 0||i.call(n)},this.invokeOnFinish=Ac(()=>{var n,i;(i=(n=this.options).onFinish)===null||i===void 0||i.call(n)},300),this.shortcut=new Zl(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(sn(t)){const{up:e=[],down:n=[],left:i=[],right:a=[]}=t;this.shortcut.bind(e,s=>this.onTranslate([0,1],s)),this.shortcut.bind(n,s=>this.onTranslate([0,-1],s)),this.shortcut.bind(i,s=>this.onTranslate([1,0],s)),this.shortcut.bind(a,s=>this.onTranslate([-1,0],s))}else{const{graph:e}=this.context;e.on(J.DRAG_START,this.onDragStart),e.on(J.DRAG,this.onDrag),e.on(J.DRAG_END,this.onDragEnd)}}onTranslate(t,e){return sk(this,void 0,void 0,function*(){if(!this.validate(e))return;const{sensitivity:n}=this.options,i=n*-1;yield this.translate(Ta(t,i),this.options.animation),this.invokeOnFinish()})}translate(t,e){return sk(this,void 0,void 0,function*(){t=this.clampByDirection(t),t=this.clampByRange(t),yield this.context.graph.translateBy(t,e)})}clampByDirection([t,e]){const{direction:n}=this.options;return n==="x"?e=0:n==="y"&&(t=0),[t,e]}clampByRange([t,e]){const{viewport:n,canvas:i}=this.context,[a,s]=i.getSize(),[o,l,u,c]=la(this.options.range),h=[s*o,a*l,s*u,a*c],d=Ys(Hx(n.getCanvasCenter()),h),g=be(n.getViewportCenter(),[t,e,0]);if(!Ii(g,d)){const{min:[p,v],max:[m,b]}=d;(g[0]<p&&t>0||g[0]>m&&t<0)&&(t=0),(g[1]<v&&e>0||g[1]>b&&e<0)&&(e=0)}return[t,e]}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return typeof e=="function"?e(t):!!e}unbindEvents(){this.shortcut.unbindAll();const{graph:t}=this.context;t.off(J.DRAG_START,this.onDragStart),t.off(J.DRAG,this.onDrag),t.off(J.DRAG_END,this.onDragEnd)}destroy(){this.shortcut.destroy(),this.unbindEvents(),this.context.canvas.setCursor(this.defaultCursor),super.destroy()}}C0.defaultOptions={enable:r=>"targetType"in r?r.targetType==="canvas":!0,sensitivity:10,direction:"both",range:1/0};var ok=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Gc extends Tr{constructor(t,e){super(t,Object.assign({},Gc.defaultOptions,e)),this.enable=!1,this.enableElements=["node","combo"],this.target=[],this.shadowOrigin=[0,0],this.hiddenEdges=[],this.isDragging=!1,this.onDrop=n=>ok(this,void 0,void 0,function*(){var i;if(this.options.dropEffect!=="link")return;const{model:a,element:s}=this.context,o=n.target.id;this.target.forEach(l=>{const u=a.getParentData(l,we);u&&H(u)===o&&a.refreshComboData(o),a.setParent(l,o,we)}),yield(i=s==null?void 0:s.draw({animation:!0}))===null||i===void 0?void 0:i.finished}),this.setCursor=n=>{if(this.isDragging)return;const{type:i}=n,{canvas:a}=this.context,{cursor:s}=this.options;i===J.POINTER_ENTER?a.setCursor((s==null?void 0:s.grab)||"grab"):a.setCursor((s==null?void 0:s.default)||"default")},this.onDragStart=this.onDragStart.bind(this),this.onDrag=this.onDrag.bind(this),this.onDragEnd=this.onDragEnd.bind(this),this.onDrop=this.onDrop.bind(this),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{graph:t,canvas:e}=this.context,n=e.getLayer().getContextService().$canvas;n&&(n.addEventListener("blur",this.onDragEnd),n.addEventListener("contextmenu",this.onDragEnd)),this.enableElements.forEach(i=>{t.on(`${i}:${J.DRAG_START}`,this.onDragStart),t.on(`${i}:${J.DRAG}`,this.onDrag),t.on(`${i}:${J.DRAG_END}`,this.onDragEnd),t.on(`${i}:${J.POINTER_ENTER}`,this.setCursor),t.on(`${i}:${J.POINTER_LEAVE}`,this.setCursor)}),["link"].includes(this.options.dropEffect)&&(t.on(bo.DROP,this.onDrop),t.on(ja.DROP,this.onDrop))}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map(e=>e.id).concat(t)))}getDelta(t){const e=this.context.graph.getZoom();return Di([t.dx,t.dy],e)}onDragStart(t){var e;if(this.enable=this.validate(t),!this.enable)return;const{batch:n,canvas:i,graph:a}=this.context;i.setCursor(((e=this.options.cursor)===null||e===void 0?void 0:e.grabbing)||"grabbing"),this.isDragging=!0,n.startBatch();const s=t.target.id;a.getElementState(s).includes(this.options.state)?this.target=this.getSelectedNodeIDs([s]):this.target=[s],this.hideEdge(),this.context.graph.frontElement(this.target),this.options.shadow&&this.createShadow(this.target)}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.options.shadow?this.moveShadow(e):this.moveElement(this.target,e)}onDragEnd(){var t,e,n;if(this.enable=!1,this.options.shadow){if(!this.shadow)return;this.shadow.style.visibility="hidden";const{x:s=0,y:o=0}=this.shadow.attributes,[l,u]=be([+s,+o],this.shadowOrigin);this.moveElement(this.target,[l,u])}this.showEdges(),(e=(t=this.options).onFinish)===null||e===void 0||e.call(t,this.target);const{batch:i,canvas:a}=this.context;i.endBatch(),a.setCursor(((n=this.options.cursor)===null||n===void 0?void 0:n.grab)||"grab"),this.isDragging=!1,this.target=[]}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}moveElement(t,e){return ok(this,void 0,void 0,function*(){const{graph:n,model:i}=this.context,{dropEffect:a}=this.options;a==="move"&&t.forEach(s=>i.refreshComboData(s)),n.translateElementBy(Object.fromEntries(t.map(s=>[s,e])),!1)})}moveShadow(t){if(!this.shadow)return;const{x:e=0,y:n=0}=this.shadow.attributes,[i,a]=t;this.shadow.attr({x:+e+i,y:+n+a})}createShadow(t){const e=fn(this.options,"shadow"),n=Fc(t.map(u=>this.context.element.getElement(u).getBounds())),[i,a]=n.min;this.shadowOrigin=[i,a];const[s,o]=Us(n),l={width:s,height:o,x:i,y:a};this.shadow?this.shadow.attr(Object.assign(Object.assign(Object.assign({},e),l),{visibility:"visible"})):(this.shadow=new Sn({style:Object.assign(Object.assign(Object.assign({$layer:"transient"},e),l),{pointerEvents:"none"})}),this.context.canvas.appendChild(this.shadow))}showEdges(){this.options.shadow||this.hiddenEdges.length===0||(this.context.graph.showElement(this.hiddenEdges),this.hiddenEdges=[])}hideEdge(){const{hideEdge:t,shadow:e}=this.options;if(t==="none"||e)return;const{graph:n}=this.context;t==="all"?this.hiddenEdges=n.getEdgeData().map(H):this.hiddenEdges=Array.from(new Set(this.target.map(i=>n.getRelatedEdgesData(i,t).map(H)).flat())),n.hideElement(this.hiddenEdges)}unbindEvents(){const{graph:t,canvas:e}=this.context,n=e.getLayer().getContextService().$canvas;n&&(n.removeEventListener("blur",this.onDragEnd),n.removeEventListener("contextmenu",this.onDragEnd)),this.enableElements.forEach(i=>{t.off(`${i}:${J.DRAG_START}`,this.onDragStart),t.off(`${i}:${J.DRAG}`,this.onDrag),t.off(`${i}:${J.DRAG_END}`,this.onDragEnd),t.off(`${i}:${J.POINTER_ENTER}`,this.setCursor),t.off(`${i}:${J.POINTER_LEAVE}`,this.setCursor)}),t.off(`combo:${J.DROP}`,this.onDrop),t.off(`canvas:${J.DROP}`,this.onDrop)}destroy(){var t;this.unbindEvents(),(t=this.shadow)===null||t===void 0||t.destroy(),super.destroy()}}Gc.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 rJ="*",T0=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[rJ]||[],o=function(l){for(var u=l.length,c=0;c<u;c++)if(l[c]){var h=l[c],d=h.callback,g=h.once;g&&(l.splice(c,1),l.length===0&&delete e._events[t],u--,c--),d.apply(e,n)}};o(a),o(s)},r.prototype.off=function(t,e){if(!t)this._events={};else if(!e)delete this._events[t];else{for(var n=this._events[t]||[],i=n.length,a=0;a<i;a++)n[a].callback===e&&(n.splice(a,1),i--,a--);n.length===0&&delete this._events[t]}return this},r.prototype.getEvents=function(){return this._events},r}();function Vw(r,t,e,n){for(;r.length;){const i=r.shift();if(e(i))return!0;t.add(i.id),n(i.id).forEach(s=>{t.has(s.id)||(t.add(s.id),r.push(s))})}return!1}function Ff(r,t,e,n){if(e(r))return!0;t.add(r.id);for(const a of n(r.id))if(!t.has(a.id)&&Ff(a,t,e,n))return!0;return!1}const lk=()=>!0;class iJ{constructor(t){le(this,"graph");le(this,"nodeFilter");le(this,"edgeFilter");le(this,"cacheEnabled");le(this,"inEdgesMap",new Map);le(this,"outEdgesMap",new Map);le(this,"bothEdgesMap",new Map);le(this,"allNodesMap",new Map);le(this,"allEdgesMap",new Map);le(this,"clearCache",()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()});le(this,"refreshCache",()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map(t=>t.id))});le(this,"updateCache",t=>{const e=new Set;t.forEach(n=>{const i=this.bothEdgesMap.get(n);if(i&&i.forEach(a=>e.add(a.id)),!this.hasNode(n))this.inEdgesMap.delete(n),this.outEdgesMap.delete(n),this.bothEdgesMap.delete(n),this.allNodesMap.delete(n);else{const a=this.graph.getRelatedEdges(n,"in").filter(this.edgeFilter),s=this.graph.getRelatedEdges(n,"out").filter(this.edgeFilter),o=Array.from(new Set([...a,...s]));o.forEach(l=>e.add(l.id)),this.inEdgesMap.set(n,a),this.outEdgesMap.set(n,s),this.bothEdgesMap.set(n,o),this.allNodesMap.set(n,this.graph.getNode(n))}}),e.forEach(n=>{this.hasEdge(n)?this.allEdgesMap.set(n,this.graph.getEdge(n)):this.allEdgesMap.delete(n)})});le(this,"handleGraphChanged",t=>{const e=new Set;t.changes.forEach(n=>{switch(n.type){case"NodeAdded":e.add(n.value.id);break;case"NodeDataUpdated":e.add(n.id);break;case"EdgeAdded":e.add(n.value.source),e.add(n.value.target);break;case"EdgeUpdated":(n.propertyName==="source"||n.propertyName==="target")&&(e.add(n.oldValue),e.add(n.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(n.id)){const i=t.graph.getEdge(n.id);e.add(i.source),e.add(i.target)}break;case"EdgeRemoved":e.add(n.value.source),e.add(n.value.target);break;case"NodeRemoved":e.add(n.value.id);break}}),this.updateCache(e)});this.graph=t.graph;const e=t.nodeFilter||lk,n=t.edgeFilter||lk;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];Vw([this.getNode(t)],new Set,e,i)}dfs(t,e,n="out"){const i={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];Ff(this.getNode(t),new Set,e,i)}}let Mn=class XI extends T0{constructor(e){super();le(this,"nodeMap",new Map);le(this,"edgeMap",new Map);le(this,"inEdgesMap",new Map);le(this,"outEdgesMap",new Map);le(this,"bothEdgesMap",new Map);le(this,"treeIndices",new Map);le(this,"changes",[]);le(this,"batchCount",0);le(this,"onChanged",()=>{});le(this,"batch",e=>{this.batchCount+=1,e(),this.batchCount-=1,this.batchCount||this.commit()});e&&(e.nodes&&this.addNodes(e.nodes),e.edges&&this.addEdges(e.edges),e.tree&&this.addTree(e.tree),e.onChanged&&(this.onChanged=e.onChanged))}commit(){const e=this.changes;this.changes=[];const n={graph:this,changes:e};this.emit("changed",n),this.onChanged(n)}reduceChanges(e){let n=[];return e.forEach(i=>{switch(i.type){case"NodeRemoved":{let a=!1;n=n.filter(s=>{if(s.type==="NodeAdded"){const o=s.value.id===i.value.id;return o&&(a=!0),!o}else{if(s.type==="NodeDataUpdated")return s.id!==i.value.id;if(s.type==="TreeStructureChanged")return s.nodeId!==i.value.id}return!0}),a||n.push(i);break}case"EdgeRemoved":{let a=!1;n=n.filter(s=>{if(s.type==="EdgeAdded"){const o=s.value.id===i.value.id;return o&&(a=!0),!o}else if(s.type==="EdgeDataUpdated"||s.type==="EdgeUpdated")return s.id!==i.value.id;return!0}),a||n.push(i);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const a=n.findIndex(o=>o.type===i.type&&o.id===i.id&&(i.propertyName===void 0||o.propertyName===i.propertyName)),s=n[a];s?i.propertyName!==void 0?s.newValue=i.newValue:(n.splice(a,1),n.push(i)):n.push(i);break}case"TreeStructureDetached":{n=n.filter(a=>a.type==="TreeStructureAttached"||a.type==="TreeStructureChanged"?a.treeKey!==i.treeKey:!0),n.push(i);break}case"TreeStructureChanged":{const a=n.find(s=>s.type==="TreeStructureChanged"&&s.treeKey===i.treeKey&&s.nodeId===i.nodeId);a?a.newParentId=i.newParentId:n.push(i);break}default:n.push(i);break}}),n}checkNodeExistence(e){this.getNode(e)}hasNode(e){return this.nodeMap.has(e)}areNeighbors(e,n){return this.getNeighbors(n).some(i=>i.id===e)}getNode(e){const n=this.nodeMap.get(e);if(!n)throw new Error("Node not found for id: "+e);return n}getRelatedEdges(e,n){if(this.checkNodeExistence(e),n==="in"){const i=this.inEdgesMap.get(e);return Array.from(i)}else if(n==="out"){const i=this.outEdgesMap.get(e);return Array.from(i)}else{const i=this.bothEdgesMap.get(e);return Array.from(i)}}getDegree(e,n){return this.getRelatedEdges(e,n).length}getSuccessors(e){const i=this.getRelatedEdges(e,"out").map(a=>this.getNode(a.target));return Array.from(new Set(i))}getPredecessors(e){const i=this.getRelatedEdges(e,"in").map(a=>this.getNode(a.source));return Array.from(new Set(i))}getNeighbors(e){const n=this.getPredecessors(e),i=this.getSuccessors(e);return Array.from(new Set([...n,...i]))}doAddNode(e){if(this.hasNode(e.id))throw new Error("Node already exists: "+e.id);this.nodeMap.set(e.id,e),this.inEdgesMap.set(e.id,new Set),this.outEdgesMap.set(e.id,new Set),this.bothEdgesMap.set(e.id,new Set),this.treeIndices.forEach(n=>{n.childrenMap.set(e.id,new Set)}),this.changes.push({type:"NodeAdded",value:e})}addNodes(e){this.batch(()=>{for(const n of e)this.doAddNode(n)})}addNode(e){this.addNodes([e])}doRemoveNode(e){const n=this.getNode(e),i=this.bothEdgesMap.get(e);i==null||i.forEach(a=>this.doRemoveEdge(a.id)),this.nodeMap.delete(e),this.treeIndices.forEach(a=>{var o,l;(o=a.childrenMap.get(e))==null||o.forEach(u=>{a.parentMap.delete(u.id)});const s=a.parentMap.get(e);s&&((l=a.childrenMap.get(s.id))==null||l.delete(n)),a.parentMap.delete(e),a.childrenMap.delete(e)}),this.bothEdgesMap.delete(e),this.inEdgesMap.delete(e),this.outEdgesMap.delete(e),this.changes.push({type:"NodeRemoved",value:n})}removeNodes(e){this.batch(()=>{e.forEach(n=>this.doRemoveNode(n))})}removeNode(e){this.removeNodes([e])}updateNodeDataProperty(e,n,i){const a=this.getNode(e);this.batch(()=>{const s=a.data[n],o=i;a.data[n]=o,this.changes.push({type:"NodeDataUpdated",id:e,propertyName:n,oldValue:s,newValue:o})})}mergeNodeData(e,n){this.batch(()=>{Object.entries(n).forEach(([i,a])=>{this.updateNodeDataProperty(e,i,a)})})}updateNodeData(...e){const n=e[0],i=this.getNode(n);if(typeof e[1]=="string"){this.updateNodeDataProperty(n,e[1],e[2]);return}let a;if(typeof e[1]=="function"){const s=e[1];a=s(i.data)}else typeof e[1]=="object"&&(a=e[1]);this.batch(()=>{const s=i.data,o=a;i.data=a,this.changes.push({type:"NodeDataUpdated",id:n,oldValue:s,newValue:o})})}checkEdgeExistence(e){if(!this.hasEdge(e))throw new Error("Edge not found for id: "+e)}hasEdge(e){return this.edgeMap.has(e)}getEdge(e){return this.checkEdgeExistence(e),this.edgeMap.get(e)}getEdgeDetail(e){const n=this.getEdge(e);return{edge:n,source:this.getNode(n.source),target:this.getNode(n.target)}}doAddEdge(e){if(this.hasEdge(e.id))throw new Error("Edge already exists: "+e.id);this.checkNodeExistence(e.source),this.checkNodeExistence(e.target),this.edgeMap.set(e.id,e);const n=this.inEdgesMap.get(e.target),i=this.outEdgesMap.get(e.source),a=this.bothEdgesMap.get(e.source),s=this.bothEdgesMap.get(e.target);n.add(e),i.add(e),a.add(e),s.add(e),this.changes.push({type:"EdgeAdded",value:e})}addEdges(e){this.batch(()=>{for(const n of e)this.doAddEdge(n)})}addEdge(e){this.addEdges([e])}doRemoveEdge(e){const n=this.getEdge(e),i=this.outEdgesMap.get(n.source),a=this.inEdgesMap.get(n.target),s=this.bothEdgesMap.get(n.source),o=this.bothEdgesMap.get(n.target);i.delete(n),a.delete(n),s.delete(n),o.delete(n),this.edgeMap.delete(e),this.changes.push({type:"EdgeRemoved",value:n})}removeEdges(e){this.batch(()=>{e.forEach(n=>this.doRemoveEdge(n))})}removeEdge(e){this.removeEdges([e])}updateEdgeSource(e,n){const i=this.getEdge(e);this.checkNodeExistence(n);const a=i.source,s=n;this.outEdgesMap.get(a).delete(i),this.bothEdgesMap.get(a).delete(i),this.outEdgesMap.get(s).add(i),this.bothEdgesMap.get(s).add(i),i.source=n,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:e,propertyName:"source",oldValue:a,newValue:s})})}updateEdgeTarget(e,n){const i=this.getEdge(e);this.checkNodeExistence(n);const a=i.target,s=n;this.inEdgesMap.get(a).delete(i),this.bothEdgesMap.get(a).delete(i),this.inEdgesMap.get(s).add(i),this.bothEdgesMap.get(s).add(i),i.target=n,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:e,propertyName:"target",oldValue:a,newValue:s})})}updateEdgeDataProperty(e,n,i){const a=this.getEdge(e);this.batch(()=>{const s=a.data[n],o=i;a.data[n]=o,this.changes.push({type:"EdgeDataUpdated",id:e,propertyName:n,oldValue:s,newValue:o})})}updateEdgeData(...e){const n=e[0],i=this.getEdge(n);if(typeof e[1]=="string"){this.updateEdgeDataProperty(n,e[1],e[2]);return}let a;if(typeof e[1]=="function"){const s=e[1];a=s(i.data)}else typeof e[1]=="object"&&(a=e[1]);this.batch(()=>{const s=i.data,o=a;i.data=a,this.changes.push({type:"EdgeDataUpdated",id:n,oldValue:s,newValue:o})})}mergeEdgeData(e,n){this.batch(()=>{Object.entries(n).forEach(([i,a])=>{this.updateEdgeDataProperty(e,i,a)})})}checkTreeExistence(e){if(!this.hasTreeStructure(e))throw new Error("Tree structure not found for treeKey: "+e)}hasTreeStructure(e){return this.treeIndices.has(e)}attachTreeStructure(e){this.treeIndices.has(e)||(this.treeIndices.set(e,{parentMap:new Map,childrenMap:new Map}),this.batch(()=>{this.changes.push({type:"TreeStructureAttached",treeKey:e})}))}detachTreeStructure(e){this.checkTreeExistence(e),this.treeIndices.delete(e),this.batch(()=>{this.changes.push({type:"TreeStructureDetached",treeKey:e})})}addTree(e,n){this.batch(()=>{this.attachTreeStructure(n);const i=[],a=Array.isArray(e)?e:[e];for(;a.length;){const s=a.shift();i.push(s),s.children&&a.push(...s.children)}this.addNodes(i),i.forEach(s=>{var o;(o=s.children)==null||o.forEach(l=>{this.setParent(l.id,s.id,n)})})})}getRoots(e){return this.checkTreeExistence(e),this.getAllNodes().filter(n=>!this.getParent(n.id,e))}getChildren(e,n){this.checkNodeExistence(e),this.checkTreeExistence(n);const a=this.treeIndices.get(n).childrenMap.get(e);return Array.from(a||[])}getParent(e,n){return this.checkNodeExistence(e),this.checkTreeExistence(n),this.treeIndices.get(n).parentMap.get(e)||null}getAncestors(e,n){const i=[];let a=this.getNode(e),s;for(;s=this.getParent(a.id,n);)i.push(s),a=s;return i}setParent(e,n,i){var c,h;this.checkTreeExistence(i);const a=this.treeIndices.get(i);if(!a)return;const s=this.getNode(e),o=a.parentMap.get(e);if((o==null?void 0:o.id)===n)return;if(n==null){o&&((c=a.childrenMap.get(o.id))==null||c.delete(s)),a.parentMap.delete(e);return}const l=this.getNode(n);a.parentMap.set(e,l),o&&((h=a.childrenMap.get(o.id))==null||h.delete(s));let u=a.childrenMap.get(l.id);u||(u=new Set,a.childrenMap.set(l.id,u)),u.add(s),this.batch(()=>{this.changes.push({type:"TreeStructureChanged",treeKey:i,nodeId:e,oldParentId:o==null?void 0:o.id,newParentId:l.id})})}dfsTree(e,n,i){const a=s=>this.getChildren(s,i);return Ff(this.getNode(e),new Set,n,a)}bfsTree(e,n,i){const a=s=>this.getChildren(s,i);return Vw([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 Vw([this.getNode(e)],new Set,n,a)}dfs(e,n,i="out"){const a={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[i];return Ff(this.getNode(e),new Set,n,a)}clone(){const e=this.getAllNodes().map(a=>({...a,data:{...a.data}})),n=this.getAllEdges().map(a=>({...a,data:{...a.data}})),i=new XI({nodes:e,edges:n});return this.treeIndices.forEach(({parentMap:a,childrenMap:s},o)=>{const l=new Map;a.forEach((c,h)=>{l.set(h,i.getNode(c.id))});const u=new Map;s.forEach((c,h)=>{u.set(h,new Set(Array.from(c).map(d=>i.getNode(d.id))))}),i.treeIndices.set(o,{parentMap:l,childrenMap:u})}),i}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(e){return new iJ({graph:this,...e})}};class O0{constructor(t,e){this.context=t,this.options=e||{}}}var aJ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},sJ=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 oJ(r){const{type:t}=r;return["compact-box","mindmap","dendrogram","indented"].includes(t)}function lJ(r){return!Array.isArray(r)&&(r==null?void 0:r.preLayout)}function ef(r){const{nodes:t,edges:e}=r,n={nodes:[],edges:[],combos:[]};return t.forEach(i=>{const a=i.data._isCombo?n.combos:n.nodes,{x:s,y:o,z:l=0}=i.data;a==null||a.push({id:i.id,style:{x:s,y:o,z:l}})}),e.forEach(i=>{const{id:a,source:s,target:o,data:{points:l=[],controlPoints:u=l.slice(1,l.length-1)}}=i;n.edges.push({id:a,source:s,target:o,style:Object.assign({},u!=null&&u.length?{controlPoints:u.map($n)}:{})})}),n}function uJ(r,t){class e extends O0{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 ef(l)}}}execute(i,a){return aJ(this,void 0,void 0,function*(){return ef(yield this.instance.execute(this.graphData2LayoutModel(i),this.transformOptions(cr({},this.options,a))))})}transformOptions(i){const{onTick:a}=i;return a&&(i.onTick=s=>a(ef(s))),i}graphData2LayoutModel(i){const{nodes:a=[],edges:s=[],combos:o=[]}=i,l=a.map(g=>{const p=H(g),{data:v,style:m,combo:b}=g,w=sJ(g,["data","style","combo"]),x={id:p,data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},v),{data:v}),b?{parentId:b}:{}),{style:m}),w)};return m!=null&&m.x&&Object.assign(x.data,{x:m.x}),m!=null&&m.y&&Object.assign(x.data,{y:m.y}),m!=null&&m.z&&Object.assign(x.data,{z:m.z}),x}),u=new Map(l.map(g=>[g.id,g])),c=s.filter(g=>{const{source:p,target:v}=g;return u.has(p)&&u.has(v)}).map(g=>{const{source:p,target:v,data:m,style:b}=g;return{id:H(g),source:p,target:v,data:Object.assign({},m),style:Object.assign({},b)}}),h=o.map(g=>({id:H(g),data:Object.assign({_isCombo:!0},g.data),style:Object.assign({},g.style)})),d=new Mn({nodes:[...l,...h],edges:c});return t.model.model.hasTreeStructure(we)&&(d.attachTreeStructure(we),l.forEach(g=>{const p=t.model.model.getParent(g.id,we);p&&d.hasNode(p.id)&&d.setParent(g.id,p.id,we)})),d}}return e}function qv(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 uk(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 cJ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class hJ extends Gc{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):(oa.warn("DragElementForce only works with d3-force or d3-force-3d layout"),!1):!1}moveElement(t,e){return cJ(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&&qv(n,"setFixedPosition",t[a],[...Lt([+s,+o],e)])})})}onDragStart(t){if(this.enable=this.validate(t),!this.enable)return;this.target=this.getSelectedNodeIDs([t.target.id]),this.hideEdge(),this.context.graph.frontElement(this.target);const e=this.forceLayoutInstance;e&&uk(e,"simulation").alphaTarget(.3).restart(),this.context.graph.getNodeData(this.target).forEach(n=>{const{x:i=0,y:a=0}=n.style||{};e&&qv(e,"setFixedPosition",H(n),[+i,+a])})}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.moveElement(this.target,e)}onDragEnd(){const t=this.forceLayoutInstance;t&&uk(t,"simulation").alphaTarget(0),!this.options.fixed&&this.context.graph.getNodeData(this.target).forEach(e=>{t&&qv(t,"setFixedPosition",H(e),[null,null,null])})}}var ck=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class A0 extends Tr{constructor(t,e){super(t,Object.assign({},A0.defaultOptions,e)),this.isZoomEvent=n=>!!(n.data&&"scale"in n.data),this.relatedEdgeToUpdate=new Set,this.zoom=this.context.graph.getZoom(),this.fixElementSize=n=>ck(this,void 0,void 0,function*(){if(!this.validate(n))return;const{graph:i}=this.context,{state:a,nodeFilter:s,edgeFilter:o,comboFilter:l}=this.options,u=(a?i.getElementDataByState("node",a):i.getNodeData()).filter(s),c=(a?i.getElementDataByState("edge",a):i.getEdgeData()).filter(o),h=(a?i.getElementDataByState("combo",a):i.getComboData()).filter(l),d=this.isZoomEvent(n)?this.zoom=Math.max(.01,Math.min(n.data.scale,10)):this.zoom,g=[...u,...h];g.length>0&&g.forEach(p=>this.fixNodeLike(p,d)),this.updateRelatedEdges(),c.length>0&&c.forEach(p=>this.fixEdge(p,d))}),this.cachedStyles=new Map,this.getOriginalFieldValue=(n,i,a)=>{var s;const o=this.cachedStyles.get(n)||[],l=((s=o.find(u=>u.shape===i))===null||s===void 0?void 0:s.style)||{};return a in l||(l[a]=i.attributes[a],this.cachedStyles.set(n,[...o.filter(u=>u.shape!==i),{shape:i,style:l}])),l[a]},this.scaleEntireElement=(n,i,a)=>{i.setLocalScale(1/a);const s=this.cachedStyles.get(n)||[];s.push({shape:i}),this.cachedStyles.set(n,s)},this.scaleSpecificShapes=(n,i,a)=>{const s=cK(n);(Array.isArray(a)?a:[a]).forEach(l=>{const{shape:u,fields:c}=l,h=typeof u=="function"?u(s):n.getShape(u);if(h){if(!c){this.scaleEntireElement(n.id,h,i);return}c.forEach(d=>{const g=this.getOriginalFieldValue(n.id,h,d);bt(g)&&(h.style[d]=g/i)})}})},this.skipIfExceedViewport=n=>{const{viewport:i}=this.context;return!(i!=null&&i.isInViewport(n.getRenderBounds(),!1,30))},this.fixNodeLike=(n,i)=>{const a=H(n),{element:s,model:o}=this.context,l=s.getElement(a);if(!l||this.skipIfExceedViewport(l))return;o.getRelatedEdgesData(a).forEach(h=>this.relatedEdgeToUpdate.add(H(h)));const c=this.options[l.type];if(!c){this.scaleEntireElement(a,l,i);return}this.scaleSpecificShapes(l,i,c)},this.fixEdge=(n,i)=>{const a=H(n),s=this.context.element.getElement(a);if(!s||this.skipIfExceedViewport(s))return;const o=this.options.edge;if(!o){s.style.transformOrigin="center",this.scaleEntireElement(a,s,i);return}this.scaleSpecificShapes(s,i,o)},this.updateRelatedEdges=()=>{const{element:n}=this.context;this.relatedEdgeToUpdate.size>0&&this.relatedEdgeToUpdate.forEach(i=>{const a=n.getElement(i);a==null||a.update({})}),this.relatedEdgeToUpdate.clear()},this.resetTransform=n=>ck(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(Zi(s))a.setLocalScale(1);else{if(this.options.state)return;Object.entries(s).forEach(([o,l])=>a.style[o]=l)}})});const{graph:t,element:e}=this.context,n=Object.keys(Object.fromEntries(this.cachedStyles)).filter(i=>i&&t.getElementType(i)==="node");if(n.length>0){const i=new Set;n.forEach(a=>{t.getRelatedEdgesData(a).forEach(s=>i.add(H(s)))}),i.forEach(a=>{const s=e==null?void 0:e.getElement(a);s==null||s.update({})})}}}bindEvents(){const{graph:t}=this.context;t.on(lt.AFTER_DRAW,this.resetTransform),t.on(lt.AFTER_TRANSFORM,this.fixElementSize)}unbindEvents(){const{graph:t}=this.context;t.off(lt.AFTER_DRAW,this.resetTransform),t.off(lt.AFTER_TRANSFORM,this.fixElementSize)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}A0.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 dJ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class P0 extends Tr{constructor(t,e){super(t,Object.assign({},P0.defaultOptions,e)),this.focus=n=>dJ(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(),zo.forEach(e=>{t.on(`${e}:${J.CLICK}`,this.focus)})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;zo.forEach(e=>{t.off(`${e}:${J.CLICK}`,this.focus)})}destroy(){this.unbindEvents(),super.destroy()}}P0.defaultOptions={animation:{easing:"ease-in",duration:500},enable:!0};class N0 extends Tr{constructor(t,e){super(t,Object.assign({},N0.defaultOptions,e)),this.isFrozen=!1,this.toggleFrozen=n=>{this.isFrozen=n.type==="dragstart"},this.hoverElement=n=>{if(!this.validate(n))return;const i=n.type===J.POINTER_ENTER;this.updateElementsState(n,i);const{onHover:a,onHoverEnd:s}=this.options;i?a==null||a(n):s==null||s(n)},this.updateElementsState=(n,i)=>{if(!this.options.state&&!this.options.inactiveState)return;const{graph:a}=this.context,{state:s,animation:o,inactiveState:l}=this.options,u=this.getActiveIds(n),c={};if(s&&Object.assign(c,this.getElementsState(u,s,i)),l){const h=uI(a.getData(),!0).filter(d=>!u.includes(d));Object.assign(c,this.getElementsState(h,l,i))}a.setElementState(c,o)},this.getElementsState=(n,i,a)=>{const{graph:s}=this.context,o={};return n.forEach(l=>{const u=s.getElementState(l);a?o[l]=u.includes(i)?u:[...u,i]:o[l]=u.filter(c=>c!==i)}),o},this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),zo.forEach(n=>{t.on(`${n}:${J.POINTER_ENTER}`,this.hoverElement),t.on(`${n}:${J.POINTER_LEAVE}`,this.hoverElement)});const e=this.context.canvas.document;e.addEventListener(`${J.DRAG_START}`,this.toggleFrozen),e.addEventListener(`${J.DRAG_END}`,this.toggleFrozen)}getActiveIds(t){const{graph:e}=this.context,{degree:n,direction:i}=this.options,a=t.target.id;return n?wI(e,t.targetType,a,typeof n=="function"?n(t):n,i):[a]}validate(t){if(this.destroyed||this.isFrozen||S0(t.target)||this.context.graph.isCollapsingExpanding)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;zo.forEach(n=>{t.off(`${n}:${J.POINTER_ENTER}`,this.hoverElement),t.off(`${n}:${J.POINTER_LEAVE}`,this.hoverElement)});const e=this.context.canvas.document;e.removeEventListener(`${J.DRAG_START}`,this.toggleFrozen),e.removeEventListener(`${J.DRAG_END}`,this.toggleFrozen)}destroy(){this.unbindEvents(),super.destroy()}}N0.defaultOptions={animation:!1,enable:!0,degree:0,direction:"both",state:"active",inactiveState:void 0};class fJ extends Bc{onPointerDown(t){if(!super.validate(t)||!super.isKeydown()||this.points)return;const{canvas:e}=this.context;this.pathShape=new qr({id:"g6-lasso-select",style:this.options.style}),e.appendChild(this.pathShape),this.points=[Nf(t)]}onPointerMove(t){var e;if(!this.points)return;const{immediately:n,mode:i}=this.options;this.points.push(Nf(t)),(e=this.pathShape)===null||e===void 0||e.setAttribute("d",aK(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 R0 extends Tr{constructor(t,e){super(t,Object.assign({},R0.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):Fo(s,i,a)})},this.filterShapes=(n,i)=>{if(Et(i))return s=>!i(n,s);const a=i==null?void 0:i[n];return s=>s.className?!(a!=null&&a.includes(s.className)):!0},this.hideShapes=n=>{if(!this.validate(n)||!this.isVisible)return;const{element:i}=this.context,{shapes:a={}}=this.options;this.setElementsVisibility(i.getNodes(),"hidden",this.filterShapes("node",a)),this.setElementsVisibility(i.getEdges(),"hidden",this.filterShapes("edge",a)),this.setElementsVisibility(i.getCombos(),"hidden",this.filterShapes("combo",a)),this.isVisible=!1},this.showShapes=Ac(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(lt.BEFORE_TRANSFORM,this.hideShapes),t.on(lt.AFTER_TRANSFORM,this.showShapes)}unbindEvents(){const{graph:t}=this.context;t.off(lt.BEFORE_TRANSFORM,this.hideShapes),t.off(lt.AFTER_TRANSFORM,this.showShapes)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}R0.defaultOptions={enable:!0,debounce:200,shapes:r=>r==="node"};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(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class L0 extends Tr{constructor(t,e){super(t,Object.assign({},L0.defaultOptions,e)),this.onWheel=n=>hk(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 Zl(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){var t,e;const{trigger:n}=this.options;if(this.shortcut.unbindAll(),sn(n)){(t=this.graphDom)===null||t===void 0||t.removeEventListener(J.WHEEL,this.onWheel);const{up:i=[],down:a=[],left:s=[],right:o=[]}=n;this.shortcut.bind(i,l=>this.scroll([0,-10],l)),this.shortcut.bind(a,l=>this.scroll([0,10],l)),this.shortcut.bind(s,l=>this.scroll([-10,0],l)),this.shortcut.bind(o,l=>this.scroll([10,0],l))}else(e=this.graphDom)===null||e===void 0||e.addEventListener(J.WHEEL,this.onWheel,{passive:!1})}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}formatDisplacement(t){const{sensitivity:e}=this.options;return t=Ta(t,e),t=this.clampByDirection(t),t=this.clampByRange(t),t}clampByDirection([t,e]){const{direction:n}=this.options;return n==="x"?e=0:n==="y"&&(t=0),[t,e]}clampByRange([t,e]){const{viewport:n,canvas:i}=this.context,[a,s]=i.getSize(),[o,l,u,c]=la(this.options.range),h=[s*o,a*l,s*u,a*c],d=Ys(Hx(n.getCanvasCenter()),h),g=be(n.getViewportCenter(),[t,e,0]);if(!Ii(g,d)){const{min:[p,v],max:[m,b]}=d;(g[0]<p&&t>0||g[0]>m&&t<0)&&(t=0),(g[1]<v&&e>0||g[1]>b&&e<0)&&(e=0)}return[t,e]}scroll(t,e){return hk(this,void 0,void 0,function*(){if(!this.validate(e))return;const{onFinish:n}=this.options,i=this.context.graph,a=this.formatDisplacement(t);yield i.translateBy(a,!1),n==null||n()})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}destroy(){var t;this.shortcut.destroy(),(t=this.graphDom)===null||t===void 0||t.removeEventListener(J.WHEEL,this.onWheel),super.destroy()}}L0.defaultOptions={enable:!0,sensitivity:1,preventDefault:!0,range:1/0};var dk=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class I0 extends Tr{constructor(t,e){super(t,Object.assign({},I0.defaultOptions,e)),this.zoom=(n,i,a)=>dk(this,void 0,void 0,function*(){if(!this.validate(i))return;const{graph:s}=this.context;let o;"viewport"in i&&(o=$n(i.viewport));const{sensitivity:l,onFinish:u}=this.options,c=1+Ue(n,-50,50)*l/100,h=s.getZoom();yield s.zoomTo(h*c,a,o),u==null||u()}),this.onReset=()=>dk(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 Zl(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{trigger:t}=this.options;if(this.shortcut.unbindAll(),Array.isArray(t))if(t.includes(J.PINCH))this.shortcut.bind([J.PINCH],e=>{this.zoom(e.scale,e,!1)});else{const e=this.context.canvas.getContainer();e==null||e.addEventListener(J.WHEEL,this.preventDefault),this.shortcut.bind([...t,J.WHEEL],n=>{const{deltaX:i,deltaY:a}=n;this.zoom(-(a??i),n,!1)})}if(typeof t=="object"){const{zoomIn:e=[],zoomOut:n=[],reset:i=[]}=t;this.shortcut.bind(e,a=>this.zoom(10,a,this.options.animation)),this.shortcut.bind(n,a=>this.zoom(-10,a,this.options.animation)),this.shortcut.bind(i,this.onReset)}}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Et(e)?e(t):!!e}destroy(){var t;this.shortcut.destroy(),(t=this.context.canvas.getContainer())===null||t===void 0||t.removeEventListener(J.WHEEL,this.preventDefault),super.destroy()}}I0.defaultOptions={animation:{duration:200},enable:!0,sensitivity:1,trigger:[],preventDefault:!0};function gJ(r,t,e,n){return n===void 0&&(n="height"),e==="center"?(r[n]+t[n])/2:r.height}var Zs={assign:Object.assign,getHeight:gJ},KI=Zs,lE=18,pJ=lE*2,fk=lE,vJ={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||fk},getVGap:function(t){return t.vgap||fk},getChildren:function(t){return t.children},getHeight:function(t){return t.height||pJ},getWidth:function(t){var e=t.label||" ";return t.width||e.split("").length*lE}};function Bf(r,t){var e=this;if(e.vgap=e.hgap=0,r instanceof Bf)return r;e.data=r;var n=t.getHGap(r),i=t.getVGap(r);return e.preH=t.getPreH(r),e.preV=t.getPreV(r),e.width=t.getWidth(r),e.height=t.getHeight(r),e.width+=e.preH,e.height+=e.preV,e.id=t.getId(r),e.x=e.y=0,e.depth=0,e.children||(e.children=[]),e.addGap(n,i),e}KI.assign(Bf.prototype,{isRoot:function(){return this.depth===0},isLeaf:function(){return this.children.length===0},addGap:function(t,e){var n=this;n.hgap+=t,n.vgap+=e,n.width+=2*t,n.height+=2*e},eachNode:function(t){for(var e=this,n=[e],i;i=n.shift();)t(i),n=i.children.concat(n)},DFTraverse:function(t){this.eachNode(t)},BFTraverse:function(t){for(var e=this,n=[e],i;i=n.shift();)t(i),n=n.concat(i.children)},getBoundingBox:function(){var t={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(function(e){t.left=Math.min(t.left,e.x),t.top=Math.min(t.top,e.y),t.width=Math.max(t.width,e.x+e.width),t.height=Math.max(t.height,e.y+e.height)}),t},translate:function(t,e){t===void 0&&(t=0),e===void 0&&(e=0),this.eachNode(function(n){n.x+=t,n.y+=e,n.x+=n.preH,n.y+=n.preV})},right2left:function(){var t=this,e=t.getBoundingBox();t.eachNode(function(n){n.x=n.x-(n.x-e.left)*2-n.width}),t.translate(e.width,0)},bottom2top:function(){var t=this,e=t.getBoundingBox();t.eachNode(function(n){n.y=n.y-(n.y-e.top)*2-n.height}),t.translate(0,e.height)}});function mJ(r,t,e){t===void 0&&(t={}),t=KI.assign({},vJ,t);var n=new Bf(r,t),i=[n],a;if(!e&&!r.collapsed){for(;a=i.shift();)if(!a.data.collapsed){var s=t.getChildren(a.data),o=s?s.length:0;if(a.children=new Array(o),s&&o)for(var l=0;l<o;l++){var u=new Bf(s[l],t);a.children[l]=u,i.push(u),u.parent=a,u.depth=a.depth+1}}}return n}var ZI=mJ,yJ=ZI,bJ=function(){function r(e,n){n===void 0&&(n={});var i=this;i.options=n,i.rootNode=yJ(e,n)}var t=r.prototype;return t.execute=function(){throw new Error("please override this method")},r}(),D0=bJ;function $u(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}$u.fromNode=function(r,t){if(!r)return null;var e=[];return r.children.forEach(function(n){e.push($u.fromNode(n,t))}),t?new $u(r.height,r.width,r.x,e):new $u(r.width,r.height,r.y,e)};function JI(r,t,e){e?r.y+=t:r.x+=t,r.children.forEach(function(n){JI(n,t,e)})}function QI(r,t){var e=t?r.y:r.x;return r.children.forEach(function(n){e=Math.min(QI(n,t),e)}),e}function wJ(r,t){var e=QI(r,t);JI(r,-e,t)}function t6(r,t,e){e?t.y=r.x:t.x=r.x,r.c.forEach(function(n,i){t6(n,t.children[i],e)})}function e6(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){e6(n,t,e)})}var xJ=function(r,t){t===void 0&&(t={});var e=t.isHorizontal;function n(w){if(w.cs===0){i(w);return}n(w.c[0]);for(var x=m(u(w.c[0].el),0,null),S=1;S<w.cs;++S){n(w.c[S]);var _=u(w.c[S].er);a(w,S,x),x=m(_,S,x)}d(w),i(w)}function i(w){w.cs===0?(w.el=w,w.er=w,w.msel=w.mser=0):(w.el=w.c[0].el,w.msel=w.c[0].msel,w.er=w.c[w.cs-1].er,w.mser=w.c[w.cs-1].mser)}function a(w,x,S){for(var _=w.c[x-1],M=_.mod,k=w.c[x],C=k.mod;_!==null&&k!==null;){u(_)>S.low&&(S=S.nxt);var P=M+_.prelim+_.w-(C+k.prelim);P>0&&(C+=P,s(w,x,S.index,P));var T=u(_),A=u(k);T<=A&&(_=l(_),_!==null&&(M+=_.mod)),T>=A&&(k=o(k),k!==null&&(C+=k.mod))}!_&&k?c(w,x,k,C):_&&!k&&h(w,x,_,M)}function s(w,x,S,_){w.c[x].mod+=_,w.c[x].msel+=_,w.c[x].mser+=_,p(w,x,S,_)}function o(w){return w.cs===0?w.tl:w.c[0]}function l(w){return w.cs===0?w.tr:w.c[w.cs-1]}function u(w){return w.y+w.h}function c(w,x,S,_){var M=w.c[0].el;M.tl=S;var k=_-S.mod-w.c[0].msel;M.mod+=k,M.prelim-=k,w.c[0].el=w.c[x].el,w.c[0].msel=w.c[x].msel}function h(w,x,S,_){var M=w.c[x].er;M.tr=S;var k=_-S.mod-w.c[x].mser;M.mod+=k,M.prelim-=k,w.c[x].er=w.c[x-1].er,w.c[x].mser=w.c[x-1].mser}function d(w){w.prelim=(w.c[0].prelim+w.c[0].mod+w.c[w.cs-1].mod+w.c[w.cs-1].prelim+w.c[w.cs-1].w)/2-w.w/2}function g(w,x){x+=w.mod,w.x=w.prelim+x,v(w);for(var S=0;S<w.cs;S++)g(w.c[S],x)}function p(w,x,S,_){if(S!==x-1){var M=x-S;w.c[S+1].shift+=_/M,w.c[x].shift-=_/M,w.c[x].change-=_-_/M}}function v(w){for(var x=0,S=0,_=0;_<w.cs;_++)x+=w.c[_].shift,S+=x+w.c[_].change,w.c[_].mod+=S}function m(w,x,S){for(;S!==null&&w>=S.low;)S=S.nxt;return{low:w,index:x,nxt:S}}e6(r,e);var b=$u.fromNode(r,e);return n(b),g(b,0),t6(b,r,e),wJ(r,e),r},gk=ZI,n6=function(r,t){for(var e=gk(r.data,t,!0),n=gk(r.data,t,!0),i=r.children.length,a=Math.round(i/2),s=t.getSide||function(c,h){return h<a?"right":"left"},o=0;o<i;o++){var l=r.children[o],u=s(l,o);u==="right"?n.children.push(l):e.children.push(l)}return e.eachNode(function(c){c.isRoot()||(c.side="left")}),n.eachNode(function(c){c.isRoot()||(c.side="right")}),{left:e,right:n}},EJ=n6,vs=["LR","RL","TB","BT","H","V"],_J=["LR","RL","H"],SJ=function(t){return _J.indexOf(t)>-1},MJ=vs[0],uE=function(r,t,e){var n=t.direction||MJ;if(t.isHorizontal=SJ(n),vs.indexOf(n)===-1)throw new TypeError("Invalid direction: "+n);if(n===vs[0])e(r,t);else if(n===vs[1])e(r,t),r.right2left();else if(n===vs[2])e(r,t);else if(n===vs[3])e(r,t),r.bottom2top();else if(n===vs[4]||n===vs[5]){var i=EJ(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)),kJ(r,t),r};function kJ(r,t){if(t.radial){var e=t.isHorizontal?["x","y"]:["y","x"],n=e[0],i=e[1],a={x:1/0,y:1/0},s={x:-1/0,y:-1/0},o=0;r.DFTraverse(function(c){o++;var h=c.x,d=c.y;a.x=Math.min(a.x,h),a.y=Math.min(a.y,d),s.x=Math.max(s.x,h),s.y=Math.max(s.y,d)});var l=s[i]-a[i];if(l===0)return;var u=Math.PI*2/o;r.DFTraverse(function(c){var h=(c[i]-a[i])/l*(Math.PI*2-u)+u,d=c[n]-r[n];c.x=Math.cos(h)*d,c.y=Math.sin(h)*d})}}function CJ(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,Hw(r,t)}function Hw(r,t){return Hw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Hw(r,t)}var TJ=D0,OJ=xJ,AJ=uE,PJ=Zs,NJ=function(r){function t(){return r.apply(this,arguments)||this}CJ(t,r);var e=t.prototype;return e.execute=function(){var i=this;return AJ(i.rootNode,i.options,OJ)},t}(TJ),RJ={};function LJ(r,t){return t=PJ.assign({},RJ,t),new NJ(r,t).execute()}var IJ=LJ,DJ=Zs;function FJ(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 BJ={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function r6(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){r6(n,t.children[i],e)})}var zJ=function(r,t){t===void 0&&(t={}),t=DJ.assign({},BJ,t);var e=0;function n(l){if(!l)return null;l.width=0,l.depth&&l.depth>e&&(e=l.depth);var u=l.children,c=u.length,h=new FJ(l.height,[]);return u.forEach(function(d,g){var p=n(d);h.children.push(p),g===0&&(h.leftChild=p),g===c-1&&(h.rightChild=p)}),h.originNode=l,h.isLeaf=l.isLeaf(),h}function i(l){if(l.isLeaf||l.children.length===0)l.drawingDepth=e;else{var u=l.children.map(function(h){return i(h)}),c=Math.min.apply(null,u);l.drawingDepth=c-1}return l.drawingDepth}var a;function s(l){l.x=l.drawingDepth*t.rankSep,l.isLeaf?(l.y=0,a&&(l.y=a.y+a.height+t.nodeSep,l.originNode.parent!==a.originNode.parent&&(l.y+=t.subTreeSep)),a=l):(l.children.forEach(function(u){s(u)}),l.y=(l.leftChild.y+l.rightChild.y)/2)}var o=n(r);return i(o),s(o),r6(o,r,t.isHorizontal),r};function $J(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,Uw(r,t)}function Uw(r,t){return Uw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Uw(r,t)}var jJ=D0,qJ=zJ,WJ=uE,GJ=Zs,VJ=function(r){function t(){return r.apply(this,arguments)||this}$J(t,r);var e=t.prototype;return e.execute=function(){var i=this;return i.rootNode.width=0,WJ(i.rootNode,i.options,qJ)},t}(jJ),HJ={};function UJ(r,t){return t=GJ.assign({},HJ,t),new VJ(r,t).execute()}var YJ=UJ,pk=Zs;function XJ(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+pk.getHeight(t,r,i),t.parent&&r.parent.id!==t.parent.id){var s=t.parent,o=s.y+pk.getHeight(s,r,i);r.y=o>r.y?o:r.y}}else r.y=0}var KJ=function(r,t,e,n){var i=null;r.eachNode(function(a){XJ(a,i,t,e,n),i=a})};function ZJ(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,Yw(r,t)}function Yw(r,t){return Yw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Yw(r,t)}var JJ=D0,Td=KJ,QJ=n6,tQ=Zs,ju=["LR","RL","H"],eQ=ju[0],nQ=function(r){function t(){return r.apply(this,arguments)||this}ZJ(t,r);var e=t.prototype;return e.execute=function(){var i=this,a=i.options,s=i.rootNode;a.isHorizontal=!0;var o=a.indent,l=o===void 0?20:o,u=a.dropCap,c=u===void 0?!0:u,h=a.direction,d=h===void 0?eQ:h,g=a.align;if(d&&ju.indexOf(d)===-1)throw new TypeError("Invalid direction: "+d);if(d===ju[0])Td(s,l,c,g);else if(d===ju[1])Td(s,l,c,g),s.right2left();else if(d===ju[2]){var p=QJ(s,a),v=p.left,m=p.right;Td(v,l,c,g),v.right2left(),Td(m,l,c,g);var b=v.getBoundingBox();m.translate(b.width,0),s.x=m.x-s.width/2}return s},t}(JJ),rQ={};function iQ(r,t){return t=tQ.assign({},rQ,t),new nQ(r,t).execute()}var aQ=iQ,sQ=Zs;function i6(r,t){var e=0;return r.children.length?r.children.forEach(function(n){e+=i6(n,t)}):e=r.height,r._subTreeSep=t.getSubTreeSep(r.data),r.totalHeight=Math.max(r.height,e)+2*r._subTreeSep,r.totalHeight}function a6(r){var t=r.children,e=t.length;if(e){t.forEach(function(l){a6(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 oQ={getSubTreeSep:function(){return 0}},lQ=function(r,t){t===void 0&&(t={}),t=sQ.assign({},oQ,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,i6(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}}}}),a6(r)};function uQ(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,Xw(r,t)}function Xw(r,t){return Xw=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Xw(r,t)}var cQ=D0,hQ=lQ,dQ=uE,fQ=Zs,gQ=function(r){function t(){return r.apply(this,arguments)||this}uQ(t,r);var e=t.prototype;return e.execute=function(){var i=this;return dQ(i.rootNode,i.options,hQ)},t}(cQ),pQ={};function vQ(r,t){return t=fQ.assign({},pQ,t),new gQ(r,t).execute()}var mQ=vQ,yQ={compactBox:IJ,dendrogram:YJ,indented:aQ,mindmap:mQ},Od=yQ;const bQ=(r,t)=>{if(r!=="next"&&r!=="prev")return t},vk=r=>{r.prev.next=r.next,r.next.prev=r.prev,delete r.next,delete r.prev};let wQ=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 vk(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&vk(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,bQ)),n=n==null?void 0:n.prev;return`[${t.join(", ")}]`}},xQ=class extends wQ{};const EQ=()=>1,_Q=(r,t)=>{var e;if(r.getAllNodes().length<=1)return[];const n=MQ(r,t||EQ);return(e=SQ(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()},SQ=(r,t,e)=>{let n=[];const i=t[t.length-1],a=t[0];let s;for(;r.getAllNodes().length;){for(;s=a.dequeue();)Wv(r,t,e,s);for(;s=i.dequeue();)Wv(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(Wv(r,t,e,s,!0));break}}}return n},Wv=(r,t,e,n,i)=>{var a,s;const o=[];return r.hasNode(n.v)&&((a=r.getRelatedEdges(n.v,"in"))===null||a===void 0||a.forEach(l=>{const u=l.data.weight,c=r.getNode(l.source);i&&o.push({v:l.source,w:l.target,in:0,out:0}),c.data.out===void 0&&(c.data.out=0),c.data.out-=u,Kw(t,e,Object.assign({v:c.id},c.data))}),(s=r.getRelatedEdges(n.v,"out"))===null||s===void 0||s.forEach(l=>{const u=l.data.weight,c=l.target,h=r.getNode(c);h.data.in===void 0&&(h.data.in=0),h.data.in-=u,Kw(t,e,Object.assign({v:h.id},h.data))}),r.removeNode(n.v)),i?o:void 0},MQ=(r,t)=>{const e=new Mn;let n=0,i=0;r.getAllNodes().forEach(l=>{e.addNode({id:l.id,data:{v:l.id,in:0,out:0}})}),r.getAllEdges().forEach(l=>{const u=e.getRelatedEdges(l.source,"out").find(h=>h.target===l.target),c=(t==null?void 0:t(l))||1;u?e.updateEdgeData(u==null?void 0:u.id,Object.assign(Object.assign({},u.data),{weight:u.data.weight+c})):e.addEdge({id:l.id,source:l.source,target:l.target,data:{weight:c}}),i=Math.max(i,e.getNode(l.source).data.out+=c),n=Math.max(n,e.getNode(l.target).data.in+=c)});const a=[],s=i+n+3;for(let l=0;l<s;l++)a.push(new xQ);const o=n+1;return e.getAllNodes().forEach(l=>{Kw(a,o,Object.assign({v:l.id},e.getNode(l.id).data))}),{buckets:a,zeroIdx:o,graph:e}},Kw=(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)},kQ=(r,t)=>{const n=_Q(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)})})},CQ=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})})}})},TQ=(r,t)=>Number(r)-Number(t),Ql=(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},OQ=r=>{const t=new Mn;return r.getAllNodes().forEach(e=>{t.addNode(Object.assign({},e))}),r.getAllEdges().forEach(e=>{const n=t.getRelatedEdges(e.source,"out").find(i=>i.target===e.target);n?t.updateEdgeData(n==null?void 0:n.id,Object.assign(Object.assign({},n.data),{weight:n.data.weight+e.data.weight||0,minlen:Math.max(n.data.minlen,e.data.minlen||1)})):t.addEdge({id:e.id,source:e.source,target:e.target,data:{weight:e.data.weight||0,minlen:e.data.minlen||1}})}),t},s6=r=>{const t=new Mn;return r.getAllNodes().forEach(e=>{r.getChildren(e.id).length||t.addNode(Object.assign({},e))}),r.getAllEdges().forEach(e=>{t.addEdge(e)}),t},AQ=(r,t)=>r==null?void 0:r.reduce((e,n,i)=>(e[n]=t[i],e),{}),mk=(r,t)=>{const e=Number(r.x),n=Number(r.y),i=Number(t.x)-e,a=Number(t.y)-n;let s=Number(r.width)/2,o=Number(r.height)/2;if(!i&&!a)return{x:0,y:0};let l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,u=o):(i<0&&(s=-s),l=s,u=s*a/i),{x:e+l,y:n+u}},wc=r=>{const t=[],e=o6(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)=>TQ(r.getNode(i).data.order,r.getNode(a).data.order));return t},PQ=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)})},NQ=(r,t=0)=>{const e=r.getAllNodes(),n=e.filter(o=>o.data.rank!==void 0).map(o=>o.data.rank),i=Math.min(...n),a=[];e.forEach(o=>{const l=(o.data.rank||0)-i;a[l]||(a[l]=[]),a[l].push(o.id)});let s=0;for(let o=0;o<a.length;o++){const l=a[o];l===void 0?o%t!==0&&(s-=1):s&&(l==null||l.forEach(u=>{const c=r.getNode(u);c&&(c.data.rank=c.data.rank||0,c.data.rank+=s)}))}},yk=(r,t,e,n)=>{const i={width:0,height:0};return bt(e)&&bt(n)&&(i.rank=e,i.order=n),Ql(r,"border",i,t)},o6=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},RQ=(r,t)=>{const e={lhs:[],rhs:[]};return r==null||r.forEach(n=>{t(n)?e.lhs.push(n):e.rhs.push(n)}),e},cE=(r,t)=>r.reduce((e,n)=>{const i=t(e),a=t(n);return i>a?n:e}),l6=(r,t,e,n,i,a)=>{n.includes(t.id)||(n.push(t.id),e||a.push(t.id),i(t.id).forEach(s=>l6(r,s,e,n,i,a)),e&&a.push(t.id))},u6=(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))l6(r,l,e==="post",o,a,s);else throw new Error(`Graph does not have node: ${l}`)}),s},LQ=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)bk(r,"borderLeft","_bl",e,i,a),bk(r,"borderRight","_br",e,i,a)}};r.getRoots().forEach(e=>t(e.id))},bk=(r,t,e,n,i,a)=>{const s={rank:a,borderType:t,width:0,height:0},o=i.data[t][a-1],l=Ql(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}})},IQ=(r,t)=>{const e=t.toLowerCase();(e==="lr"||e==="rl")&&c6(r)},DQ=(r,t)=>{const e=t.toLowerCase();(e==="bt"||e==="rl")&&FQ(r),(e==="lr"||e==="rl")&&(BQ(r),c6(r))},c6=r=>{r.getAllNodes().forEach(t=>{wk(t)}),r.getAllEdges().forEach(t=>{wk(t)})},wk=r=>{const t=r.data.width;r.data.width=r.data.height,r.data.height=t},FQ=r=>{r.getAllNodes().forEach(t=>{Gv(t.data)}),r.getAllEdges().forEach(t=>{var e;(e=t.data.points)===null||e===void 0||e.forEach(n=>Gv(n)),t.data.hasOwnProperty("y")&&Gv(t.data)})},Gv=r=>{r!=null&&r.y&&(r.y=-r.y)},BQ=r=>{r.getAllNodes().forEach(t=>{Vv(t.data)}),r.getAllEdges().forEach(t=>{var e;(e=t.data.points)===null||e===void 0||e.forEach(n=>Vv(n)),t.data.hasOwnProperty("x")&&Vv(t.data)})},Vv=r=>{const t=r.x;r.x=r.y,r.y=t},zQ=r=>{const t=Ql(r,"root",{},"_root"),e=$Q(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=jQ(r)+1;return r.getRoots().forEach(o=>{h6(r,t,a,s,i,e,o.id)}),{nestingRoot:t,nodeRankFactor:a}},h6=(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=yk(r,"_bt"),u=yk(r,"_bb"),c=r.getNode(s);r.setParent(l,s),c.data.borderTop=l,r.setParent(u,s),c.data.borderBottom=u,o==null||o.forEach(h=>{h6(r,t,e,n,i,a,h.id);const d=h.data.borderTop?h.data.borderTop:h.id,g=h.data.borderBottom?h.data.borderBottom:h.id,p=h.data.borderTop?n:2*n,v=d!==g?1:i-a[s]+1;r.addEdge({id:`e${Math.random()}`,source:l,target:d,data:{minlen:v,weight:p,nestingEdge:!0}}),r.addEdge({id:`e${Math.random()}`,source:g,target:u,data:{minlen:v,weight:p,nestingEdge:!0}})}),r.getParent(s)||r.addEdge({id:`e${Math.random()}`,source:t,target:l,data:{weight:0,minlen:i+a[s]}})},$Q=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},jQ=r=>{let t=0;return r.getAllEdges().forEach(e=>{t+=e.data.weight}),t},qQ=(r,t)=>{t&&r.removeNode(t),r.getAllEdges().forEach(e=>{e.data.nestingEdge&&r.removeEdge(e.id)})},WQ="edge",d6="edge-label",GQ=(r,t)=>{r.getAllEdges().forEach(e=>VQ(r,e,t))},VQ=(r,t,e)=>{let n=t.source,i=r.getNode(n).data.rank;const a=t.target,s=r.getNode(a).data.rank,o=t.data.labelRank;if(s===i+1)return;r.removeEdge(t.id);let l,u,c;for(c=0,++i;i<s;++c,++i)t.data.points=[],u={originalEdge:t,width:0,height:0,rank:i},l=Ql(r,WQ,u,"_d"),i===o&&(u.width=t.data.width,u.height=t.data.height,u.dummy=d6,u.labelpos=t.data.labelpos),r.addEdge({id:`e${Math.random()}`,source:n,target:l,data:{weight:t.data.weight}}),c===0&&e.push(l),n=l;r.addEdge({id:`e${Math.random()}`,source:n,target:a,data:{weight:t.data.weight}})},HQ=(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===d6&&(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)})},UQ=(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}})},YQ=(r,t,e)=>{const n=XQ(r),i=new Mn({tree:[{id:n,children:[],data:{}}]});return r.getAllNodes().forEach(a=>{const s=r.getParent(a.id);(a.data.rank===t||a.data.minRank<=t&&t<=a.data.maxRank)&&(i.hasNode(a.id)||i.addNode(Object.assign({},a)),s!=null&&s.id&&!i.hasNode(s==null?void 0:s.id)&&i.addNode(Object.assign({},s)),i.setParent(a.id,(s==null?void 0:s.id)||n),r.getRelatedEdges(a.id,e).forEach(o=>{const l=o.source===a.id?o.target:o.source;i.hasNode(l)||i.addNode(Object.assign({},r.getNode(l)));const u=i.getRelatedEdges(l,"out").find(({target:h})=>h===a.id),c=u!==void 0?u.data.weight:0;u?i.updateEdgeData(u.id,Object.assign(Object.assign({},u.data),{weight:o.data.weight+c})):i.addEdge({id:o.id,source:l,target:a.id,data:{weight:o.data.weight+c}})}),a.data.hasOwnProperty("minRank")&&i.updateNodeData(a.id,Object.assign(Object.assign({},a.data),{borderLeft:a.data.borderLeft[t],borderRight:a.data.borderRight[t]})))}),i},XQ=r=>{let t;for(;r.hasNode(t=`_root${Math.random()}`););return t},KQ=(r,t,e)=>{const n=AQ(e,e.map((c,h)=>h)),a=t.map(c=>{const h=r.getRelatedEdges(c,"out").map(d=>({pos:n[d.target]||0,weight:d.data.weight}));return h==null?void 0:h.sort((d,g)=>d.pos-g.pos)}).flat().filter(c=>c!==void 0);let s=1;for(;s<e.length;)s<<=1;const o=2*s-1;s-=1;const l=Array(o).fill(0,0,o);let u=0;return a==null||a.forEach(c=>{if(c){let h=c.pos+s;l[h]+=c.weight;let d=0;for(;h>0;)h%2&&(d+=l[h+1]),h=h-1>>1,l[h]+=c.weight;u+=c.weight*d}}),u},xk=(r,t)=>{let e=0;for(let n=1;n<(t==null?void 0:t.length);n+=1)e+=KQ(r,t[n-1],t[n]);return e},Ek=r=>{const t={},e=r.getAllNodes(),n=e.map(u=>{var c;return(c=u.data.rank)!==null&&c!==void 0?c:-1/0}),i=Math.max(...n),a=[];for(let u=0;u<i+1;u++)a.push([]);const s=e.sort((u,c)=>r.getNode(u.id).data.rank-r.getNode(c.id).data.rank),l=s.filter(u=>r.getNode(u.id).data.fixorder!==void 0).sort((u,c)=>r.getNode(u.id).data.fixorder-r.getNode(c.id).data.fixorder);return l==null||l.forEach(u=>{isNaN(r.getNode(u.id).data.rank)||a[r.getNode(u.id).data.rank].push(u.id),t[u.id]=!0}),s==null||s.forEach(u=>r.dfsTree(u.id,c=>{if(t.hasOwnProperty(c.id))return!0;t[c.id]=!0,isNaN(c.data.rank)||a[c.data.rank].push(c.id)})),a},ZQ=(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}}),JQ=(r,t)=>{var e,n,i;const a={};r==null||r.forEach((o,l)=>{a[o.v]={i:l,indegree:0,in:[],out:[],vs:[o.v]};const u=a[o.v];o.barycenter!==void 0&&(u.barycenter=o.barycenter,u.weight=o.weight)}),(e=t.getAllEdges())===null||e===void 0||e.forEach(o=>{const l=a[o.source],u=a[o.target];l!==void 0&&u!==void 0&&(u.indegree++,l.out.push(a[o.target]))});const s=(i=(n=Object.values(a)).filter)===null||i===void 0?void 0:i.call(n,o=>!o.indegree);return QQ(s)},QQ=r=>{var t,e;const n=[],i=l=>u=>{u.merged||(u.barycenter===void 0||l.barycenter===void 0||u.barycenter>=l.barycenter)&&ttt(l,u)},a=l=>u=>{u.in.push(l),--u.indegree===0&&r.push(u)};for(;r!=null&&r.length;){const l=r.pop();n.push(l),(t=l.in.reverse())===null||t===void 0||t.forEach(u=>i(l)(u)),(e=l.out)===null||e===void 0||e.forEach(u=>a(l)(u))}const s=n.filter(l=>!l.merged),o=["vs","i","barycenter","weight"];return s.map(l=>{const u={};return o==null||o.forEach(c=>{l[c]!==void 0&&(u[c]=l[c])}),u})},ttt=(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},ett=(r,t,e,n)=>{const i=RQ(r,d=>{const g=d.hasOwnProperty("fixorder")&&!isNaN(d.fixorder);return n?!g&&d.hasOwnProperty("barycenter"):g||d.hasOwnProperty("barycenter")}),a=i.lhs,s=i.rhs.sort((d,g)=>-d.i- -g.i),o=[];let l=0,u=0,c=0;a==null||a.sort(ntt(!!t,!!e)),c=_k(o,s,c),a==null||a.forEach(d=>{var g;c+=(g=d.vs)===null||g===void 0?void 0:g.length,o.push(d.vs),l+=d.barycenter*d.weight,u+=d.weight,c=_k(o,s,c)});const h={vs:o.flat()};return u&&(h.barycenter=l/u,h.weight=u),h},_k=(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},ntt=(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},f6=(r,t,e,n,i,a)=>{var s,o,l,u;let c=r.getChildren(t).map(w=>w.id);const h=r.getNode(t),d=h?h.data.borderLeft:void 0,g=h?h.data.borderRight:void 0,p={};d&&(c=c==null?void 0:c.filter(w=>w!==d&&w!==g));const v=ZQ(r,c||[]);v==null||v.forEach(w=>{var x;if(!((x=r.getChildren(w.v))===null||x===void 0)&&x.length){const S=f6(r,w.v,e,n,a);p[w.v]=S,S.hasOwnProperty("barycenter")&&itt(w,S)}});const m=JQ(v,e);rtt(m,p),(s=m.filter(w=>w.vs.length>0))===null||s===void 0||s.forEach(w=>{const x=r.getNode(w.vs[0]);x&&(w.fixorder=x.data.fixorder,w.order=x.data.order)});const b=ett(m,n,i,a);if(d&&(b.vs=[d,b.vs,g].flat(),!((o=r.getPredecessors(d))===null||o===void 0)&&o.length)){const w=r.getNode(((l=r.getPredecessors(d))===null||l===void 0?void 0:l[0].id)||""),x=r.getNode(((u=r.getPredecessors(g))===null||u===void 0?void 0:u[0].id)||"");b.hasOwnProperty("barycenter")||(b.barycenter=0,b.weight=0),b.barycenter=(b.barycenter*b.weight+w.data.order+x.data.order)/(b.weight+2),b.weight+=2}return b},rtt=(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()})},itt=(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)},att=(r,t)=>{const e=o6(r),n=[],i=[];for(let c=1;c<e+1;c++)n.push(c);for(let c=e-1;c>-1;c--)i.push(c);const a=Sk(r,n,"in"),s=Sk(r,i,"out");let o=Ek(r);Hv(r,o);let l=Number.POSITIVE_INFINITY,u;for(let c=0,h=0;h<4;++c,++h){Mk(c%2?a:s,c%4>=2,!1,t),o=wc(r);const d=xk(r,o);d<l&&(h=0,u=zs(o),l=d)}o=Ek(r),Hv(r,o);for(let c=0,h=0;h<4;++c,++h){Mk(c%2?a:s,c%4>=2,!0,t),o=wc(r);const d=xk(r,o);d<l&&(h=0,u=zs(o),l=d)}Hv(r,u)},Sk=(r,t,e)=>t.map(n=>YQ(r,n,e)),Mk=(r,t,e,n)=>{const i=new Mn;r==null||r.forEach(a=>{var s;const o=a.getRoots()[0].id,l=f6(a,o,i,t,e,n);for(let u=0;u<((s=l.vs)===null||s===void 0?void 0:s.length);u++){const c=a.getNode(l.vs[u]);c&&(c.data.order=u)}UQ(a,i,l.vs)})},Hv=(r,t)=>{t==null||t.forEach(e=>{e==null||e.forEach((n,i)=>{r.getNode(n).data.order=i})})},stt=(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))})},ott=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},ltt=(r,t,e,n)=>{var i,a;const s=[],o=[],l=Math.min(t[e].low,t[n].low),u=Math.max(t[e].lim,t[n].lim);let c,h;c=e;do c=(i=r.getParent(c))===null||i===void 0?void 0:i.id,s.push(c);while(c&&(t[c].low>l||u>t[c].lim));for(h=c,c=n;c&&c!==h;)o.push(c),c=(a=r.getParent(c))===null||a===void 0?void 0:a.id;return{lca:h,path:s.concat(o.reverse())}},utt=(r,t)=>{const e=ott(r);t.forEach(n=>{var i,a;let s=n,o=r.getNode(s);const l=o.data.originalEdge;if(!l)return;const u=ltt(r,e,l.source,l.target),c=u.path,h=u.lca;let d=0,g=c[d],p=!0;for(;s!==l.target;){if(o=r.getNode(s),p){for(;g!==h&&((i=r.getNode(g))===null||i===void 0?void 0:i.data.maxRank)<o.data.rank;)d++,g=c[d];g===h&&(p=!1)}if(!p){for(;d<c.length-1&&((a=r.getNode(c[d+1]))===null||a===void 0?void 0:a.data.minRank)<=o.data.rank;)d++;g=c[d]}r.hasNode(g)&&r.setParent(s,g),s=r.getSuccessors(s)[0].id}})},ctt=(r,t)=>{const e={},n=(i,a)=>{let s=0,o=0;const l=i.length,u=a==null?void 0:a[(a==null?void 0:a.length)-1];return a==null||a.forEach((c,h)=>{var d;const g=dtt(r,c),p=g?r.getNode(g.id).data.order:l;(g||c===u)&&((d=a.slice(o,h+1))===null||d===void 0||d.forEach(v=>{var m;(m=r.getPredecessors(v))===null||m===void 0||m.forEach(b=>{var w;const x=r.getNode(b.id),S=x.data.order;(S<s||p<S)&&!(x.data.dummy&&(!((w=r.getNode(v))===null||w===void 0)&&w.data.dummy))&&g6(e,b.id,v)})}),o=h+1,s=p)}),a};return t!=null&&t.length&&t.reduce(n),e},htt=(r,t)=>{const e={};function n(o,l,u,c,h){var d,g;let p;for(let v=l;v<u;v++)p=o[v],!((d=r.getNode(p))===null||d===void 0)&&d.data.dummy&&((g=r.getPredecessors(p))===null||g===void 0||g.forEach(m=>{const b=r.getNode(m.id);b.data.dummy&&(b.data.order<c||b.data.order>h)&&g6(e,m.id,p)}))}function i(o){return JSON.stringify(o.slice(1))}function a(o,l){const u=i(o);l.get(u)||(n(...o),l.set(u,!0))}const s=(o,l)=>{let u=-1,c,h=0;const d=new Map;return l==null||l.forEach((g,p)=>{var v;if(((v=r.getNode(g))===null||v===void 0?void 0:v.data.dummy)==="border"){const m=r.getPredecessors(g)||[];m.length&&(c=r.getNode(m[0].id).data.order,a([l,h,p,u,c],d),h=p,u=c)}a([l,h,l.length,c,o.length],d)}),l};return t!=null&&t.length&&t.reduce(s),e},dtt=(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)},g6=(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},ftt=(r,t,e)=>{let n=t,i=e;if(n>i){const a=t;n=i,i=a}return!!r[n]},gtt=(r,t,e,n)=>{const i={},a={},s={};return t==null||t.forEach(o=>{o==null||o.forEach((l,u)=>{i[l]=l,a[l]=l,s[l]=u})}),t==null||t.forEach(o=>{let l=-1;o==null||o.forEach(u=>{let c=n(u).map(h=>h.id);if(c.length){c=c.sort((d,g)=>s[d]-s[g]);const h=(c.length-1)/2;for(let d=Math.floor(h),g=Math.ceil(h);d<=g;++d){const p=c[d];a[u]===u&&l<s[p]&&!ftt(e,u,p)&&(a[p]=u,a[u]=i[u]=i[p],l=s[p])}}})}),{root:i,align:a}},ptt=(r,t,e,n,i,a,s)=>{var o;const l={},u=vtt(r,t,e,i,a,s),c=s?"borderLeft":"borderRight",h=(p,v)=>{let m=u.getAllNodes(),b=m.pop();const w={};for(;b;)w[b.id]?p(b.id):(w[b.id]=!0,m.push(b),m=m.concat(v(b.id))),b=m.pop()},d=p=>{l[p]=(u.getRelatedEdges(p,"in")||[]).reduce((v,m)=>Math.max(v,(l[m.source]||0)+m.data.weight),0)},g=p=>{const v=(u.getRelatedEdges(p,"out")||[]).reduce((b,w)=>Math.min(b,(l[w.target]||0)-w.data.weight),Number.POSITIVE_INFINITY),m=r.getNode(p);v!==Number.POSITIVE_INFINITY&&m.data.borderType!==c&&(l[p]=Math.max(l[p],v))};return h(d,u.getPredecessors.bind(u)),h(g,u.getSuccessors.bind(u)),(o=Object.values(n))===null||o===void 0||o.forEach(p=>{l[p]=l[e[p]]}),l},vtt=(r,t,e,n,i,a)=>{const s=new Mn,o=wtt(n,i,a);return t==null||t.forEach(l=>{let u;l==null||l.forEach(c=>{const h=e[c];if(s.hasNode(h)||s.addNode({id:h,data:{}}),u){const d=e[u],g=s.getRelatedEdges(d,"out").find(p=>p.target===h);g?s.updateEdgeData(g.id,Object.assign(Object.assign({},g.data),{weight:Math.max(o(r,c,u),g.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:d,target:h,data:{weight:Math.max(o(r,c,u),0)}})}u=c})}),s},mtt=(r,t)=>cE(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=xtt(r,s)/2;i=Math.max(o+l,i),a=Math.min(o-l,a)}),i-a});function ytt(r,t){const e=Object.values(t),n=Math.min(...e),i=Math.max(...e);["u","d"].forEach(a=>{["l","r"].forEach(s=>{const o=a+s,l=r[o];let u;if(l===t)return;const c=Object.values(l);u=s==="l"?n-Math.min(...c):i-Math.max(...c),u&&(r[o]={},Object.keys(l).forEach(h=>{r[o][h]=l[h]+u}))})})}const btt=(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},wtt=(r,t,e)=>(n,i,a)=>{const s=n.getNode(i),o=n.getNode(a);let l=0,u=0;if(l+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":u=-s.data.width/2;break;case"r":u=s.data.width/2;break}if(u&&(l+=e?u:-u),u=0,l+=(s.data.dummy?t:r)/2,l+=(o.data.dummy?t:r)/2,l+=o.data.width/2,o.data.labelpos)switch((o.data.labelpos||"").toLowerCase()){case"l":u=o.data.width/2;break;case"r":u=-o.data.width/2;break}return u&&(l+=e?u:-u),u=0,l},xtt=(r,t)=>r.getNode(t).data.width||0,Ett=(r,t)=>{const{ranksep:e=0}=t||{},n=wc(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})},_tt=(r,t)=>{const{align:e,nodesep:n=0,edgesep:i=0}=t||{},a=wc(r),s=Object.assign(ctt(r,a),htt(r,a)),o={};let l=[];["u","d"].forEach(c=>{l=c==="u"?a:Object.values(a).reverse(),["l","r"].forEach(h=>{h==="r"&&(l=l.map(v=>Object.values(v).reverse()));const d=(c==="u"?r.getPredecessors:r.getSuccessors).bind(r),g=gtt(r,l,s,d),p=ptt(r,l,g.root,g.align,n,i,h==="r");h==="r"&&Object.keys(p).forEach(v=>p[v]=-p[v]),o[c+h]=p})});const u=mtt(r,o);return u&&ytt(o,u),btt(o,e)},Stt=(r,t)=>{var e;const n=s6(r);Ett(n,t);const i=_tt(n,t);(e=Object.keys(i))===null||e===void 0||e.forEach(a=>{n.getNode(a).data.x=i[a]})},p6=r=>{const t={},e=n=>{var i;const a=r.getNode(n);if(!a)return 0;if(t[n])return a.data.rank;t[n]=!0;let s;return(i=r.getRelatedEdges(n,"out"))===null||i===void 0||i.forEach(o=>{const l=e(o.target),u=o.data.minlen,c=l-u;c&&(s===void 0||c<s)&&(s=c)}),s||(s=0),a.data.rank=s,s};r.getAllNodes().filter(n=>r.getRelatedEdges(n.id,"in").length===0).forEach(n=>e(n.id))},Mtt=r=>{const t={};let e;const n=s=>{var o;const l=r.getNode(s);if(!l)return 0;if(t[s])return l.data.rank;t[s]=!0;let u;return(o=r.getRelatedEdges(s,"out"))===null||o===void 0||o.forEach(c=>{const h=n(c.target),d=c.data.minlen,g=h-d;g&&(u===void 0||g<u)&&(u=g)}),u||(u=0),(e===void 0||u<e)&&(e=u),l.data.rank=u,u};r.getAllNodes().filter(s=>r.getRelatedEdges(s.id,"in").length===0).forEach(s=>{s&&n(s.id)}),e===void 0&&(e=0);const i={},a=(s,o)=>{var l;const u=r.getNode(s),c=isNaN(u.data.layer)?o:u.data.layer;(u.data.rank===void 0||u.data.rank<c)&&(u.data.rank=c),!i[s]&&(i[s]=!0,(l=r.getRelatedEdges(s,"out"))===null||l===void 0||l.forEach(h=>{a(h.target,c+h.data.minlen)}))};r.getAllNodes().forEach(s=>{const o=s.data;o&&(isNaN(o.layer)?o.rank-=e:a(s.id,o.layer))})},js=(r,t)=>r.getNode(t.target).data.rank-r.getNode(t.source).data.rank-t.data.minlen,ktt=r=>{const t=new Mn({tree:[]}),e=r.getAllNodes()[0],n=r.getAllNodes().length;t.addNode(e);let i,a;for(;Ctt(t,r)<n;)i=v6(t,r),a=t.hasNode(i.source)?js(r,i):-js(r,i),m6(t,r,a);return t},Ctt=(r,t)=>{const e=n=>{t.getRelatedEdges(n,"both").forEach(i=>{const a=i.source,s=n===a?i.target:a;!r.hasNode(s)&&!js(t,i)&&(r.addNode({id:s,data:{}}),r.addEdge({id:i.id,source:n,target:s,data:{}}),e(s))})};return r.getAllNodes().forEach(n=>e(n.id)),r.getAllNodes().length},Ttt=r=>{const t=new Mn({tree:[]}),e=r.getAllNodes()[0],n=r.getAllNodes().length;t.addNode(e);let i,a;for(;Ott(t,r)<n;)i=v6(t,r),a=t.hasNode(i.source)?js(r,i):-js(r,i),m6(t,r,a);return t},Ott=(r,t)=>{const e=n=>{var i;(i=t.getRelatedEdges(n,"both"))===null||i===void 0||i.forEach(a=>{const s=a.source,o=n===s?a.target:s;!r.hasNode(o)&&(t.getNode(o).data.layer!==void 0||!js(t,a))&&(r.addNode({id:o,data:{}}),r.addEdge({id:a.id,source:n,target:o,data:{}}),e(o))})};return r.getAllNodes().forEach(n=>e(n.id)),r.getAllNodes().length},v6=(r,t)=>cE(t.getAllEdges(),e=>r.hasNode(e.source)!==r.hasNode(e.target)?js(t,e):1/0),m6=(r,t,e)=>{r.getAllNodes().forEach(n=>{const i=t.getNode(n.id);i.data.rank||(i.data.rank=0),i.data.rank+=e})},Att=r=>{const t=OQ(r);p6(t);const e=ktt(t);b6(e),y6(e,t);let n,i;for(;n=Rtt(e);)i=Ltt(e,t,n),Itt(e,t,n,i)},y6=(r,t)=>{let e=u6(r,r.getAllNodes(),"post");e=e.slice(0,(e==null?void 0:e.length)-1),e.forEach(n=>{Ptt(r,t,n)})},Ptt=(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=Ntt(r,t,e)},Ntt=(r,t,e)=>{const i=r.getNode(e).data.parent;let a=!0,s=t.getRelatedEdges(e,"out").find(l=>l.target===i),o=0;return s||(a=!1,s=t.getRelatedEdges(i,"out").find(l=>l.target===e)),o=s.data.weight,t.getRelatedEdges(e,"both").forEach(l=>{const u=l.source===e,c=u?l.target:l.source;if(c!==i){const h=u===a,d=l.data.weight;if(o+=h?d:-d,Ftt(r,e,c)){const g=r.getRelatedEdges(e,"both").find(p=>p.source===c||p.target===c).data.cutvalue;o+=h?-g:g}}}),o},b6=(r,t=r.getAllNodes()[0].id)=>{w6(r,{},1,t)},w6=(r,t,e,n,i)=>{var a;const s=e;let o=e;const l=r.getNode(n);return t[n]=!0,(a=r.getNeighbors(n))===null||a===void 0||a.forEach(u=>{t[u.id]||(o=w6(r,t,o,u.id,n))}),l.data.low=s,l.data.lim=o++,i?l.data.parent=i:delete l.data.parent,o},Rtt=r=>r.getAllEdges().find(t=>t.data.cutvalue<0),Ltt=(r,t,e)=>{let n=e.source,i=e.target;t.getRelatedEdges(n,"out").find(c=>c.target===i)||(n=e.target,i=e.source);const a=r.getNode(n),s=r.getNode(i);let o=a,l=!1;a.data.lim>s.data.lim&&(o=s,l=!0);const u=t.getAllEdges().filter(c=>l===kk(r.getNode(c.source),o)&&l!==kk(r.getNode(c.target),o));return cE(u,c=>js(t,c))},Itt=(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:{}}),b6(r),y6(r,t),Dtt(r,t)},Dtt=(r,t)=>{const e=r.getAllNodes().find(i=>!i.data.parent);let n=u6(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))})},Ftt=(r,t,e)=>r.getRelatedEdges(t,"both").find(n=>n.source===e||n.target===e),kk=(r,t)=>t.data.low<=r.data.lim&&r.data.lim<=t.data.lim,Btt=(r,t)=>{switch(t){case"network-simplex":$tt(r);break;case"tight-tree":Ck(r);break;case"longest-path":ztt(r);break;default:Ck(r)}},ztt=p6,Ck=r=>{Mtt(r),Ttt(r)},$tt=r=>{Att(r)},jtt=(r,t)=>{const{edgeLabelSpace:e,keepNodeOrder:n,prevGraph:i,rankdir:a,ranksep:s}=t;!n&&i&&Wtt(r,i);const o=Xtt(r);e&&(t.ranksep=Ktt(o,{rankdir:a,ranksep:s}));let l;try{l=qtt(o,t)}catch(u){if(u.message==="Not possible to find intersection inside of the rectangle"){console.error(`The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:
- `,u);return}throw u}return Gtt(r,o),l},qtt=(r,t)=>{const{ranker:e,rankdir:n="tb",nodeOrder:i,keepNodeOrder:a,align:s,nodesep:o=50,edgesep:l=20,ranksep:u=50}=t;aet(r),kQ(r);const{nestingRoot:c,nodeRankFactor:h}=zQ(r);Btt(s6(r),e),Ztt(r),NQ(r,h),qQ(r,c),PQ(r),Jtt(r),Qtt(r);const d=[];GQ(r,d),utt(r,d),LQ(r),a&&stt(r,i),att(r,a),set(r),IQ(r,n),Stt(r,{align:s,nodesep:o,edgesep:l,ranksep:u}),oet(r),iet(r),HQ(r,d),net(r),DQ(r,n);const{width:g,height:p}=tet(r);return eet(r),ret(r),CQ(r),{width:g,height:p}},Wtt=(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})},Gtt=(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)})},Vtt=["width","height","layer","fixorder"],Htt={width:0,height:0},Utt=["minlen","weight","width","height","labeloffset"],Ytt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Uv=["labelpos"],Xtt=r=>{const t=new Mn({tree:[]});return r.getAllNodes().forEach(e=>{const n=Ok(r.getNode(e.id).data),i=Object.assign(Object.assign({},Htt),n),a=Tk(i,Vtt);t.hasNode(e.id)||t.addNode({id:e.id,data:Object.assign({},a)});const s=r.hasTreeStructure("combo")?r.getParent(e.id,"combo"):r.getParent(e.id);kt(s)||(t.hasNode(s.id)||t.addNode(Object.assign({},s)),t.setParent(e.id,s.id))}),r.getAllEdges().forEach(e=>{const n=Ok(r.getEdge(e.id).data),i={};Uv==null||Uv.forEach(a=>{n[a]!==void 0&&(i[a]=n[a])}),t.addEdge({id:e.id,source:e.source,target:e.target,data:Object.assign({},Ytt,Tk(n,Utt),i)})}),t},Ktt=(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},Ztt=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};Ql(r,"edge-proxy",i,"_ep")}})},Jtt=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},Qtt=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))})},tet=(r,t)=>{let e,n=0,i,a=0;const{marginx:s=0,marginy:o=0}={},l=u=>{if(!u.data)return;const c=u.data.x,h=u.data.y,d=u.data.width,g=u.data.height;!isNaN(c)&&!isNaN(d)&&(e===void 0&&(e=c-d/2),e=Math.min(e,c-d/2),n=Math.max(n,c+d/2)),!isNaN(h)&&!isNaN(g)&&(i===void 0&&(i=h-g/2),i=Math.min(i,h-g/2),a=Math.max(a,h+g/2))};return r.getAllNodes().forEach(u=>{l(u)}),r.getAllEdges().forEach(u=>{u!=null&&u.data.hasOwnProperty("x")&&l(u)}),e-=s,i-=o,r.getAllNodes().forEach(u=>{u.data.x-=e,u.data.y-=i}),r.getAllEdges().forEach(u=>{var c;(c=u.data.points)===null||c===void 0||c.forEach(h=>{h.x-=e,h.y-=i}),u.data.hasOwnProperty("x")&&(u.data.x-=e),u.data.hasOwnProperty("y")&&(u.data.y-=i)}),{width:n-e+s,height:a-i+o}},eet=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(mk(e.data,i)),t.data.points.push(mk(n.data,a))})},net=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}})},ret=r=>{r.getAllEdges().forEach(t=>{var e;t.data.reversed&&((e=t.data.points)===null||e===void 0||e.reverse())})},iet=r=>{r.getAllNodes().forEach(t=>{var e,n,i;if(!((e=r.getChildren(t.id))===null||e===void 0)&&e.length){const a=r.getNode(t.id),s=r.getNode(a.data.borderTop),o=r.getNode(a.data.borderBottom),l=r.getNode(a.data.borderLeft[((n=a.data.borderLeft)===null||n===void 0?void 0:n.length)-1]),u=r.getNode(a.data.borderRight[((i=a.data.borderRight)===null||i===void 0?void 0:i.length)-1]);a.data.width=Math.abs((u==null?void 0:u.data.x)-(l==null?void 0:l.data.x))||10,a.data.height=Math.abs((o==null?void 0:o.data.y)-(s==null?void 0:s.data.y))||10,a.data.x=((l==null?void 0:l.data.x)||0)+a.data.width/2,a.data.y=((s==null?void 0:s.data.y)||0)+a.data.height/2}}),r.getAllNodes().forEach(t=>{t.data.dummy==="border"&&r.removeNode(t.id)})},aet=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)}})},set=r=>{const t=wc(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=>{Ql(r,"selfedge",{width:l.data.width,height:l.data.height,rank:o.data.rank,order:a+ ++n,e:l},"_se")}),delete o.data.selfEdges})})},oet=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}})},Tk=(r,t)=>{const e={};return t==null||t.forEach(n=>{r[n]!==void 0&&(e[n]=+r[n])}),e},Ok=(r={})=>{const t={};return Object.keys(r).forEach(e=>{t[e.toLowerCase()]=r[e]}),t},Aa=Array.isArray,x6=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},E6=(r,t)=>{const{nodes:e,edges:n}=r,i=[],a={};if(!e)throw new Error("invalid nodes data!");return e&&e.forEach((s,o)=>{a[s.id]=o;const l=[];i.push(l)}),n==null||n.forEach(s=>{const{source:o,target:l}=s,u=a[o],c=a[l];u===void 0||c===void 0||(i[u][c]=1,i[c][u]=1)}),i},uet=(r,t)=>{const e=[];return r.forEach(n=>{const i=[];n.forEach(a=>{i.push(a*t)}),e.push(i)}),e},cet=r=>{let t=1/0,e=1/0,n=-1/0,i=-1/0;return r.forEach(a=>{let s=a.data.size;Aa(s)?s.length===1&&(s=[s[0],s[0]]):bt(s)?s=[s,s]:(s===void 0||isNaN(s))&&(s=[30,30]);const o=[s[0]/2,s[1]/2],l=a.data.x-o[0],u=a.data.x+o[0],c=a.data.y-o[1],h=a.data.y+o[1];t>l&&(t=l),e>c&&(e=c),n<u&&(n=u),i<h&&(i=h)}),{minX:t,minY:e,maxX:n,maxY:i}},Ak=(r,t)=>Math.sqrt((r.x-t.x)*(r.x-t.x)+(r.y-t.y)*(r.y-t.y)),Zw=(r,t,e,n="TB",i,a={})=>{if(!(t!=null&&t.length))return;const{stopBranchFn:s,stopAllFn:o}=a;for(let l=0;l<t.length;l++){const u=t[l];if(r.hasNode(u.id)&&!(s!=null&&s(u))){if(o!=null&&o(u))return;n==="TB"&&e(u),Zw(r,r.getChildren(u.id,i),e,n,i,a),n!=="TB"&&e(u)}}},Jw=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=>Jw(e))}if(typeof r=="object"){const t={};return Object.keys(r).forEach(e=>{t[e]=Jw(r[e])}),t}return r},Wr=(r,t)=>{const e=Jw(r);return e.data=e.data||{},t&&(bt(e.data.x)||(e.data.x=Math.random()*t[0]),bt(e.data.y)||(e.data.y=Math.random()*t[1])),e};function Vc(r){if(!r)return[0,0,0];if(bt(r))return[r,r,r];if(r.length===0)return[0,0,0];const[t,e=t,n=t]=r;return[t,e,n]}function Oo(r,t){let e;return Et(t)?e=t:bt(t)?e=()=>t:e=()=>r,e}function hE(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:sn(i)&&i.width&&i.height?e?Math.max(i.width,i.height)||r:[i.width,i.height]:i:r}:Et(t)?t:bt(t)?()=>t:Array.isArray(t)?()=>e?Math.max(...t)||r:t:sn(t)&&t.width&&t.height?()=>e?Math.max(t.width,t.height)||r:[t.width,t.height]:()=>r}const dE=(r,t,e=10)=>{let n;const i=typeof t=="function"?t:()=>t||0;return r?Array.isArray(r)?n=s=>r:Et(r)?n=r:n=s=>r:n=s=>{var o,l,u;if(!((o=s.data)===null||o===void 0)&&o.bboxSize)return(l=s.data)===null||l===void 0?void 0:l.bboxSize;if(!((u=s.data)===null||u===void 0)&&u.size){const c=s.data.size;return Array.isArray(c)?c:sn(c)?[c.width,c.height]:c}return e},s=>{const o=n(s),l=i(s);return Math.max(...Vc(o))+l}},het={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};class det{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},het),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,e)})}genericDagreLayout(t,e,n){return Ht(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{nodeSize:a,align:s,rankdir:o="TB",ranksep:l,nodesep:u,ranksepFunc:c,nodesepFunc:h,edgeLabelSpace:d,ranker:g,nodeOrder:p,begin:v,controlPoints:m,radial:b,sortByCombo:w,preset:x}=i,S=new Mn({tree:[]}),_=Oo(l||50,c),M=Oo(u||50,h);let k=M,C=_;(o==="LR"||o==="RL")&&(k=_,C=M);const P=hE(10,a,!1),T=e.getAllNodes(),A=e.getAllEdges();T.forEach(D=>{const G=Vc(P(D)),X=C(D),K=k(D),ht=G[0]+2*K,ut=G[1]+2*X,ct=D.data.layer;bt(ct)?S.addNode({id:D.id,data:{width:ht,height:ut,layer:ct}}):S.addNode({id:D.id,data:{width:ht,height:ut}})}),w&&(S.attachTreeStructure("combo"),T.forEach(D=>{const{parentId:G}=D.data;G!==void 0&&S.hasNode(G)&&S.setParent(D.id,G,"combo")})),A.forEach(D=>{S.addEdge({id:D.id,source:D.source,target:D.target,data:{weight:D.data.weight||1}})});let R;x!=null&&x.length&&(R=new Mn({nodes:x})),jtt(S,{prevGraph:R,edgeLabelSpace:d,keepNodeOrder:!!p,nodeOrder:p||[],acyclicer:"greedy",ranker:g,rankdir:o,nodesep:u,align:s});const L=[0,0];if(v){let D=1/0,G=1/0;S.getAllNodes().forEach(X=>{D>X.data.x&&(D=X.data.x),G>X.data.y&&(G=X.data.y)}),S.getAllEdges().forEach(X=>{var K;(K=X.data.points)===null||K===void 0||K.forEach(ht=>{D>ht.x&&(D=ht.x),G>ht.y&&(G=ht.y)})}),L[0]=v[0]-D,L[1]=v[1]-G}const $=o==="LR"||o==="RL";if(!b){const D=new Set,X=o==="BT"||o==="RL"?(ct,dt)=>dt-ct:(ct,dt)=>ct-dt;S.getAllNodes().forEach(ct=>{ct.data.x=ct.data.x+L[0],ct.data.y=ct.data.y+L[1],D.add($?ct.data.x:ct.data.y)});const K=Array.from(D).sort(X),ht=$?(ct,dt)=>ct.x!==dt.x:(ct,dt)=>ct.y!==dt.y,ut=$?(ct,dt,pt)=>{const mt=Math.max(dt.y,pt.y),It=Math.min(dt.y,pt.y);return ct.filter(zt=>zt.y<=mt&&zt.y>=It)}:(ct,dt,pt)=>{const mt=Math.max(dt.x,pt.x),It=Math.min(dt.x,pt.x);return ct.filter(zt=>zt.x<=mt&&zt.x>=It)};S.getAllEdges().forEach((ct,dt)=>{var pt;d&&m&&ct.data.type!=="loop"&&(ct.data.controlPoints=fet((pt=ct.data.points)===null||pt===void 0?void 0:pt.map(({x:mt,y:It})=>({x:mt+L[0],y:It+L[1]})),S.getNode(ct.source),S.getNode(ct.target),K,$,ht,ut))})}let q=[];q=S.getAllNodes().map(D=>Wr(D));const j=S.getAllEdges();return t&&(q.forEach(D=>{e.mergeNodeData(D.id,{x:D.data.x,y:D.data.y})}),j.forEach(D=>{e.mergeEdgeData(D.id,{controlPoints:D.data.controlPoints})})),{nodes:q,edges:j}})}}const fet=(r,t,e,n,i,a,s)=>{let o=(r==null?void 0:r.slice(1,r.length-1))||[];if(t&&e){let{x:l,y:u}=t.data,{x:c,y:h}=e.data;if(i&&(l=t.data.y,u=t.data.x,c=e.data.y,h=e.data.x),h!==u&&l!==c){const d=n.indexOf(u),g=n[d+1];if(g){const m=o[0],b=i?{x:(u+g)/2,y:(m==null?void 0:m.y)||c}:{x:(m==null?void 0:m.x)||c,y:(u+g)/2};(!m||a(m,b))&&o.unshift(b)}const p=n.indexOf(h),v=Math.abs(p-d);if(v===1)o=s(o,t.data,e.data),o.length||o.push(i?{x:(u+h)/2,y:l}:{x:l,y:(u+h)/2});else if(v>1){const m=n[p-1];if(m){const b=o[o.length-1],w=i?{x:(h+m)/2,y:(b==null?void 0:b.y)||c}:{x:(b==null?void 0:b.x)||l,y:(h+m)/2};(!b||a(b,w))&&o.push(w)}}}}return o},Uo=(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}},get={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};class pet{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},get),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericCircularLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericCircularLayout(!0,t,e)})}genericCircularLayout(t,e,n){return Ht(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,divisions:l,startAngle:u=0,endAngle:c=2*Math.PI,angleRatio:h,ordering:d,clockwise:g,nodeSpacing:p,nodeSize:v}=i,m=e.getAllNodes(),b=e.getAllEdges(),[w,x,S]=met(a,s,o),_=m==null?void 0:m.length;if(!_||_===1)return Uo(e,t,S);const M=(c-u)/_;let{radius:k,startRadius:C,endRadius:P}=i;if(p){const $=Oo(10,p),q=hE(10,v);let j=-1/0;m.forEach(D=>{const G=q(D);j<G&&(j=G)});let B=0;m.forEach((D,G)=>{G===0?B+=j||10:B+=($(D)||0)+(j||10)}),k=B/(2*Math.PI)}else!k&&!C&&!P?k=Math.min(x,w)/2:!C&&P?C=P:C&&!P&&(P=C);const T=M*h;let A=[];d==="topology"?A=Pk(e,m):d==="topology-directed"?A=Pk(e,m,!0):d==="degree"?A=vet(e,m):A=m.map($=>Wr($));const R=Math.ceil(_/l);for(let $=0;$<_;++$){let q=k;!q&&C!==null&&P!==null&&(q=C+$*(P-C)/(_-1)),q||(q=10+$*100/(_-1));let j=u+$%R*T+2*Math.PI/l*Math.floor($/R);g||(j=c-$%R*T-2*Math.PI/l*Math.floor($/R)),A[$].data.x=S[0]+Math.cos(j)*q,A[$].data.y=S[1]+Math.sin(j)*q}return t&&A.forEach($=>{e.mergeNodeData($.id,{x:$.data.x,y:$.data.y})}),{nodes:A,edges:b}})}}const Pk=(r,t,e=!1)=>{const n=[Wr(t[0])],i={},a=t.length;i[t[0].id]=!0;let s=0;return t.forEach((o,l)=>{if(l!==0)if((l===a-1||r.getDegree(o.id,"both")!==r.getDegree(t[l+1].id,"both")||r.areNeighbors(n[s].id,o.id))&&!i[o.id])n.push(Wr(o)),i[o.id]=!0,s++;else{const u=e?r.getSuccessors(n[s].id):r.getNeighbors(n[s].id);let c=!1;for(let d=0;d<u.length;d++){const g=u[d];if(r.getDegree(g.id)===r.getDegree(o.id)&&!i[g.id]){n.push(Wr(g)),i[g.id]=!0,c=!0;break}}let h=0;for(;!c&&(i[t[h].id]||(n.push(Wr(t[h])),i[t[h].id]=!0,c=!0),h++,h!==a););}}),n};function vet(r,t){const e=[];return t.forEach((n,i)=>{e.push(Wr(n))}),e.sort((n,i)=>r.getDegree(n.id,"both")-r.getDegree(i.id,"both")),e}const met=(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]},yet={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:3/2*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class Qw{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},yet),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericConcentricLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericConcentricLayout(!0,t,e)})}genericConcentricLayout(t,e,n){return Ht(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o,sortBy:l,maxLevelDiff:u,sweep:c,clockwise:h,equidistant:d,preventOverlap:g,startAngle:p=3/2*Math.PI,nodeSize:v,nodeSpacing:m}=i,b=e.getAllNodes(),w=e.getAllEdges(),x=!s&&typeof window<"u"?window.innerWidth:s,S=!o&&typeof window<"u"?window.innerHeight:o,_=a||[x/2,S/2];if(!(b!=null&&b.length)||b.length===1)return Uo(e,t,_);const M=[];let k,C=0;Aa(v)?k=Math.max(v[0],v[1]):Et(v)?(k=-1/0,b.forEach(D=>{const G=Math.max(...Vc(v(D)));G>k&&(k=G)})):k=v,Aa(m)?C=Math.max(m[0],m[1]):bt(m)&&(C=m),b.forEach(D=>{const G=Wr(D);M.push(G);let X=k;const{data:K}=G;Aa(K.size)?X=Math.max(K.size[0],K.size[1]):bt(K.size)?X=K.size:sn(K.size)&&(X=Math.max(K.size.width,K.size.height)),k=Math.max(k,X),Et(m)&&(C=Math.max(m(D),C))});const P={};M.forEach((D,G)=>{P[D.id]=G});let T=l;(!oe(T)||M[0].data[T]===void 0)&&(T="degree"),T==="degree"?M.sort((D,G)=>e.getDegree(G.id,"both")-e.getDegree(D.id,"both")):M.sort((D,G)=>G.data[T]-D.data[T]);const A=M[0],R=(u||(T==="degree"?e.getDegree(A.id,"both"):A.data[T]))/4,L=[{nodes:[]}];let $=L[0];M.forEach(D=>{if($.nodes.length>0){const G=Math.abs(T==="degree"?e.getDegree($.nodes[0].id,"both")-e.getDegree(D.id,"both"):$.nodes[0].data[T]-D.data[T]);R&&G>=R&&($={nodes:[]},L.push($))}$.nodes.push(D)});let q=k+C;if(!g){const D=L.length>0&&L[0].nodes.length>1,X=(Math.min(x,S)/2-q)/(L.length+(D?1:0));q=Math.min(q,X)}let j=0;if(L.forEach(D=>{const G=c===void 0?2*Math.PI-2*Math.PI/D.nodes.length:c;if(D.dTheta=G/Math.max(1,D.nodes.length-1),D.nodes.length>1&&g){const X=Math.cos(D.dTheta)-Math.cos(0),K=Math.sin(D.dTheta)-Math.sin(0),ht=Math.sqrt(q*q/(X*X+K*K));j=Math.max(ht,j)}D.r=j,j+=q}),d){let D=0,G=0;for(let X=0;X<L.length;X++){const ht=(L[X].r||0)-G;D=Math.max(D,ht)}G=0,L.forEach((X,K)=>{K===0&&(G=X.r||0),X.r=G,G+=D})}return L.forEach(D=>{const G=D.dTheta||0,X=D.r||0;D.nodes.forEach((K,ht)=>{const ut=p+(h?1:-1)*G*ht;K.data.x=_[0]+X*Math.cos(ut),K.data.y=_[1]+X*Math.sin(ut)})}),t&&M.forEach(D=>e.mergeNodeData(D.id,{x:D.data.x,y:D.data.y})),{nodes:M,edges:w}})}}function bet(r){const t=+this._x.call(null,r),e=+this._y.call(null,r);return _6(this.cover(t,e),t,e,r)}function _6(r,t,e,n){if(isNaN(t)||isNaN(e))return r;var i,a=r._root,s={data:n},o=r._x0,l=r._y0,u=r._x1,c=r._y1,h,d,g,p,v,m,b,w;if(!a)return r._root=s,r;for(;a.length;)if((v=t>=(h=(o+u)/2))?o=h:u=h,(m=e>=(d=(l+c)/2))?l=d:c=d,i=a,!(a=a[b=m<<1|v]))return i[b]=s,r;if(g=+r._x.call(null,a.data),p=+r._y.call(null,a.data),t===g&&e===p)return s.next=a,i?i[b]=s:r._root=s,r;do i=i?i[b]=new Array(4):r._root=new Array(4),(v=t>=(h=(o+u)/2))?o=h:u=h,(m=e>=(d=(l+c)/2))?l=d:c=d;while((b=m<<1|v)===(w=(p>=d)<<1|g>=h));return i[w]=a,i[b]=s,r}function wet(r){var t,e,n=r.length,i,a,s=new Array(n),o=new Array(n),l=1/0,u=1/0,c=-1/0,h=-1/0;for(e=0;e<n;++e)isNaN(i=+this._x.call(null,t=r[e]))||isNaN(a=+this._y.call(null,t))||(s[e]=i,o[e]=a,i<l&&(l=i),i>c&&(c=i),a<u&&(u=a),a>h&&(h=a));if(l>c||u>h)return this;for(this.cover(l,u).cover(c,h),e=0;e<n;++e)_6(this,s[e],o[e],r[e]);return this}function xet(r,t){if(isNaN(r=+r)||isNaN(t=+t))return this;var e=this._x0,n=this._y0,i=this._x1,a=this._y1;if(isNaN(e))i=(e=Math.floor(r))+1,a=(n=Math.floor(t))+1;else{for(var s=i-e||1,o=this._root,l,u;e>r||r>=i||n>t||t>=a;)switch(u=(t<n)<<1|r<e,l=new Array(4),l[u]=o,o=l,s*=2,u){case 0:i=e+s,a=n+s;break;case 1:e=i-s,a=n+s;break;case 2:i=e+s,n=a-s;break;case 3:e=i-s,n=a-s;break}this._root&&this._root.length&&(this._root=o)}return this._x0=e,this._y0=n,this._x1=i,this._y1=a,this}function Eet(){var r=[];return this.visit(function(t){if(!t.length)do r.push(t.data);while(t=t.next)}),r}function _et(r){return arguments.length?this.cover(+r[0][0],+r[0][1]).cover(+r[1][0],+r[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function or(r,t,e,n,i){this.node=r,this.x0=t,this.y0=e,this.x1=n,this.y1=i}function Met(r,t,e){var n,i=this._x0,a=this._y0,s,o,l,u,c=this._x1,h=this._y1,d=[],g=this._root,p,v;for(g&&d.push(new or(g,i,a,c,h)),e==null?e=1/0:(i=r-e,a=t-e,c=r+e,h=t+e,e*=e);p=d.pop();)if(!(!(g=p.node)||(s=p.x0)>c||(o=p.y0)>h||(l=p.x1)<i||(u=p.y1)<a))if(g.length){var m=(s+l)/2,b=(o+u)/2;d.push(new or(g[3],m,b,l,u),new or(g[2],s,b,m,u),new or(g[1],m,o,l,b),new or(g[0],s,o,m,b)),(v=(t>=b)<<1|r>=m)&&(p=d[d.length-1],d[d.length-1]=d[d.length-1-v],d[d.length-1-v]=p)}else{var w=r-+this._x.call(null,g.data),x=t-+this._y.call(null,g.data),S=w*w+x*x;if(S<e){var _=Math.sqrt(e=S);i=r-_,a=t-_,c=r+_,h=t+_,n=g.data}}return n}function ket(r){if(isNaN(c=+this._x.call(null,r))||isNaN(h=+this._y.call(null,r)))return this;var t,e=this._root,n,i,a,s=this._x0,o=this._y0,l=this._x1,u=this._y1,c,h,d,g,p,v,m,b;if(!e)return this;if(e.length)for(;;){if((p=c>=(d=(s+l)/2))?s=d:l=d,(v=h>=(g=(o+u)/2))?o=g:u=g,t=e,!(e=e[m=v<<1|p]))return this;if(!e.length)break;(t[m+1&3]||t[m+2&3]||t[m+3&3])&&(n=t,b=m)}for(;e.data!==r;)if(i=e,!(e=e.next))return this;return(a=e.next)&&delete e.next,i?(a?i.next=a:delete i.next,this):t?(a?t[m]=a:delete t[m],(e=t[0]||t[1]||t[2]||t[3])&&e===(t[3]||t[2]||t[1]||t[0])&&!e.length&&(n?n[b]=e:this._root=e),this):(this._root=a,this)}function Cet(r){for(var t=0,e=r.length;t<e;++t)this.remove(r[t]);return this}function Tet(){return this._root}function Oet(){var r=0;return this.visit(function(t){if(!t.length)do++r;while(t=t.next)}),r}function Aet(r){var t=[],e,n=this._root,i,a,s,o,l;for(n&&t.push(new or(n,this._x0,this._y0,this._x1,this._y1));e=t.pop();)if(!r(n=e.node,a=e.x0,s=e.y0,o=e.x1,l=e.y1)&&n.length){var u=(a+o)/2,c=(s+l)/2;(i=n[3])&&t.push(new or(i,u,c,o,l)),(i=n[2])&&t.push(new or(i,a,c,u,l)),(i=n[1])&&t.push(new or(i,u,s,o,c)),(i=n[0])&&t.push(new or(i,a,s,u,c))}return this}function Pet(r){var t=[],e=[],n;for(this._root&&t.push(new or(this._root,this._x0,this._y0,this._x1,this._y1));n=t.pop();){var i=n.node;if(i.length){var a,s=n.x0,o=n.y0,l=n.x1,u=n.y1,c=(s+l)/2,h=(o+u)/2;(a=i[0])&&t.push(new or(a,s,o,c,h)),(a=i[1])&&t.push(new or(a,c,o,l,h)),(a=i[2])&&t.push(new or(a,s,h,c,u)),(a=i[3])&&t.push(new or(a,c,h,l,u))}e.push(n)}for(;n=e.pop();)r(n.node,n.x0,n.y0,n.x1,n.y1);return this}function Net(r){return r[0]}function Ret(r){return arguments.length?(this._x=r,this):this._x}function Let(r){return r[1]}function Iet(r){return arguments.length?(this._y=r,this):this._y}function F0(r,t,e){var n=new fE(t??Net,e??Let,NaN,NaN,NaN,NaN);return r==null?n:n.addAll(r)}function fE(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 Nk(r){for(var t={data:r.data},e=t;r=r.next;)e=e.next={data:r.data};return t}var hr=F0.prototype=fE.prototype;hr.copy=function(){var r=new fE(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=Nk(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]=Nk(n));return r};hr.add=bet;hr.addAll=wet;hr.cover=xet;hr.data=Eet;hr.extent=_et;hr.find=Met;hr.remove=ket;hr.removeAll=Cet;hr.root=Tet;hr.size=Oet;hr.visit=Aet;hr.visitAfter=Pet;hr.x=Ret;hr.y=Iet;function Det(r){const t=+this._x.call(null,r),e=+this._y.call(null,r),n=+this._z.call(null,r);return S6(this.cover(t,e,n),t,e,n,r)}function S6(r,t,e,n,i){if(isNaN(t)||isNaN(e)||isNaN(n))return r;var a,s=r._root,o={data:i},l=r._x0,u=r._y0,c=r._z0,h=r._x1,d=r._y1,g=r._z1,p,v,m,b,w,x,S,_,M,k,C;if(!s)return r._root=o,r;for(;s.length;)if((S=t>=(p=(l+h)/2))?l=p:h=p,(_=e>=(v=(u+d)/2))?u=v:d=v,(M=n>=(m=(c+g)/2))?c=m:g=m,a=s,!(s=s[k=M<<2|_<<1|S]))return a[k]=o,r;if(b=+r._x.call(null,s.data),w=+r._y.call(null,s.data),x=+r._z.call(null,s.data),t===b&&e===w&&n===x)return o.next=s,a?a[k]=o:r._root=o,r;do a=a?a[k]=new Array(8):r._root=new Array(8),(S=t>=(p=(l+h)/2))?l=p:h=p,(_=e>=(v=(u+d)/2))?u=v:d=v,(M=n>=(m=(c+g)/2))?c=m:g=m;while((k=M<<2|_<<1|S)===(C=(x>=m)<<2|(w>=v)<<1|b>=p));return a[C]=s,a[k]=o,r}function Fet(r){Array.isArray(r)||(r=Array.from(r));const t=r.length,e=new Float64Array(t),n=new Float64Array(t),i=new Float64Array(t);let a=1/0,s=1/0,o=1/0,l=-1/0,u=-1/0,c=-1/0;for(let h=0,d,g,p,v;h<t;++h)isNaN(g=+this._x.call(null,d=r[h]))||isNaN(p=+this._y.call(null,d))||isNaN(v=+this._z.call(null,d))||(e[h]=g,n[h]=p,i[h]=v,g<a&&(a=g),g>l&&(l=g),p<s&&(s=p),p>u&&(u=p),v<o&&(o=v),v>c&&(c=v));if(a>l||s>u||o>c)return this;this.cover(a,s,o).cover(l,u,c);for(let h=0;h<t;++h)S6(this,e[h],n[h],i[h],r[h]);return this}function Bet(r,t,e){if(isNaN(r=+r)||isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,i=this._y0,a=this._z0,s=this._x1,o=this._y1,l=this._z1;if(isNaN(n))s=(n=Math.floor(r))+1,o=(i=Math.floor(t))+1,l=(a=Math.floor(e))+1;else{for(var u=s-n||1,c=this._root,h,d;n>r||r>=s||i>t||t>=o||a>e||e>=l;)switch(d=(e<a)<<2|(t<i)<<1|r<n,h=new Array(8),h[d]=c,c=h,u*=2,d){case 0:s=n+u,o=i+u,l=a+u;break;case 1:n=s-u,o=i+u,l=a+u;break;case 2:s=n+u,i=o-u,l=a+u;break;case 3:n=s-u,i=o-u,l=a+u;break;case 4:s=n+u,o=i+u,a=l-u;break;case 5:n=s-u,o=i+u,a=l-u;break;case 6:s=n+u,i=o-u,a=l-u;break;case 7:n=s-u,i=o-u,a=l-u;break}this._root&&this._root.length&&(this._root=c)}return this._x0=n,this._y0=i,this._z0=a,this._x1=s,this._y1=o,this._z1=l,this}function zet(){var r=[];return this.visit(function(t){if(!t.length)do r.push(t.data);while(t=t.next)}),r}function $et(r){return arguments.length?this.cover(+r[0][0],+r[0][1],+r[0][2]).cover(+r[1][0],+r[1][1],+r[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function ke(r,t,e,n,i,a,s){this.node=r,this.x0=t,this.y0=e,this.z0=n,this.x1=i,this.y1=a,this.z1=s}function jet(r,t,e,n){var i,a=this._x0,s=this._y0,o=this._z0,l,u,c,h,d,g,p=this._x1,v=this._y1,m=this._z1,b=[],w=this._root,x,S;for(w&&b.push(new ke(w,a,s,o,p,v,m)),n==null?n=1/0:(a=r-n,s=t-n,o=e-n,p=r+n,v=t+n,m=e+n,n*=n);x=b.pop();)if(!(!(w=x.node)||(l=x.x0)>p||(u=x.y0)>v||(c=x.z0)>m||(h=x.x1)<a||(d=x.y1)<s||(g=x.z1)<o))if(w.length){var _=(l+h)/2,M=(u+d)/2,k=(c+g)/2;b.push(new ke(w[7],_,M,k,h,d,g),new ke(w[6],l,M,k,_,d,g),new ke(w[5],_,u,k,h,M,g),new ke(w[4],l,u,k,_,M,g),new ke(w[3],_,M,c,h,d,k),new ke(w[2],l,M,c,_,d,k),new ke(w[1],_,u,c,h,M,k),new ke(w[0],l,u,c,_,M,k)),(S=(e>=k)<<2|(t>=M)<<1|r>=_)&&(x=b[b.length-1],b[b.length-1]=b[b.length-1-S],b[b.length-1-S]=x)}else{var C=r-+this._x.call(null,w.data),P=t-+this._y.call(null,w.data),T=e-+this._z.call(null,w.data),A=C*C+P*P+T*T;if(A<n){var R=Math.sqrt(n=A);a=r-R,s=t-R,o=e-R,p=r+R,v=t+R,m=e+R,i=w.data}}return i}const qet=(r,t,e,n,i,a)=>Math.sqrt((r-n)**2+(t-i)**2+(e-a)**2);function Wet(r,t,e,n){const i=[],a=r-n,s=t-n,o=e-n,l=r+n,u=t+n,c=e+n;return this.visit((h,d,g,p,v,m,b)=>{if(!h.length)do{const w=h.data;qet(r,t,e,this._x(w),this._y(w),this._z(w))<=n&&i.push(w)}while(h=h.next);return d>l||g>u||p>c||v<a||m<s||b<o}),i}function Get(r){if(isNaN(d=+this._x.call(null,r))||isNaN(g=+this._y.call(null,r))||isNaN(p=+this._z.call(null,r)))return this;var t,e=this._root,n,i,a,s=this._x0,o=this._y0,l=this._z0,u=this._x1,c=this._y1,h=this._z1,d,g,p,v,m,b,w,x,S,_,M;if(!e)return this;if(e.length)for(;;){if((w=d>=(v=(s+u)/2))?s=v:u=v,(x=g>=(m=(o+c)/2))?o=m:c=m,(S=p>=(b=(l+h)/2))?l=b:h=b,t=e,!(e=e[_=S<<2|x<<1|w]))return this;if(!e.length)break;(t[_+1&7]||t[_+2&7]||t[_+3&7]||t[_+4&7]||t[_+5&7]||t[_+6&7]||t[_+7&7])&&(n=t,M=_)}for(;e.data!==r;)if(i=e,!(e=e.next))return this;return(a=e.next)&&delete e.next,i?(a?i.next=a:delete i.next,this):t?(a?t[_]=a:delete t[_],(e=t[0]||t[1]||t[2]||t[3]||t[4]||t[5]||t[6]||t[7])&&e===(t[7]||t[6]||t[5]||t[4]||t[3]||t[2]||t[1]||t[0])&&!e.length&&(n?n[M]=e:this._root=e),this):(this._root=a,this)}function Vet(r){for(var t=0,e=r.length;t<e;++t)this.remove(r[t]);return this}function Het(){return this._root}function Uet(){var r=0;return this.visit(function(t){if(!t.length)do++r;while(t=t.next)}),r}function Yet(r){var t=[],e,n=this._root,i,a,s,o,l,u,c;for(n&&t.push(new ke(n,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=t.pop();)if(!r(n=e.node,a=e.x0,s=e.y0,o=e.z0,l=e.x1,u=e.y1,c=e.z1)&&n.length){var h=(a+l)/2,d=(s+u)/2,g=(o+c)/2;(i=n[7])&&t.push(new ke(i,h,d,g,l,u,c)),(i=n[6])&&t.push(new ke(i,a,d,g,h,u,c)),(i=n[5])&&t.push(new ke(i,h,s,g,l,d,c)),(i=n[4])&&t.push(new ke(i,a,s,g,h,d,c)),(i=n[3])&&t.push(new ke(i,h,d,o,l,u,g)),(i=n[2])&&t.push(new ke(i,a,d,o,h,u,g)),(i=n[1])&&t.push(new ke(i,h,s,o,l,d,g)),(i=n[0])&&t.push(new ke(i,a,s,o,h,d,g))}return this}function Xet(r){var t=[],e=[],n;for(this._root&&t.push(new ke(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=t.pop();){var i=n.node;if(i.length){var a,s=n.x0,o=n.y0,l=n.z0,u=n.x1,c=n.y1,h=n.z1,d=(s+u)/2,g=(o+c)/2,p=(l+h)/2;(a=i[0])&&t.push(new ke(a,s,o,l,d,g,p)),(a=i[1])&&t.push(new ke(a,d,o,l,u,g,p)),(a=i[2])&&t.push(new ke(a,s,g,l,d,c,p)),(a=i[3])&&t.push(new ke(a,d,g,l,u,c,p)),(a=i[4])&&t.push(new ke(a,s,o,p,d,g,h)),(a=i[5])&&t.push(new ke(a,d,o,p,u,g,h)),(a=i[6])&&t.push(new ke(a,s,g,p,d,c,h)),(a=i[7])&&t.push(new ke(a,d,g,p,u,c,h))}e.push(n)}for(;n=e.pop();)r(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this}function Ket(r){return r[0]}function Zet(r){return arguments.length?(this._x=r,this):this._x}function Jet(r){return r[1]}function Qet(r){return arguments.length?(this._y=r,this):this._y}function tnt(r){return r[2]}function ent(r){return arguments.length?(this._z=r,this):this._z}function M6(r,t,e,n){var i=new gE(t??Ket,e??Jet,n??tnt,NaN,NaN,NaN,NaN,NaN,NaN);return r==null?i:i.addAll(r)}function gE(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 Rk(r){for(var t={data:r.data},e=t;r=r.next;)e=e.next={data:r.data};return t}var Wn=M6.prototype=gE.prototype;Wn.copy=function(){var r=new gE(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=Rk(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]=Rk(n));return r};Wn.add=Det;Wn.addAll=Fet;Wn.cover=Bet;Wn.data=zet;Wn.extent=$et;Wn.find=jet;Wn.findAllWithinRadius=Wet;Wn.remove=Get;Wn.removeAll=Vet;Wn.root=Het;Wn.size=Uet;Wn.visit=Yet;Wn.visitAfter=Xet;Wn.x=Zet;Wn.y=Qet;Wn.z=ent;const nnt=.81,Yv=.1;function rnt(r,t,e,n,i=2){const a=t/e,s=r.getAllNodes(),o=s.map((c,h)=>{const{nodeStrength:d,x:g,y:p,z:v,size:m}=c.data;return{x:g,y:p,z:v,size:m,index:h,id:c.id,vx:0,vy:0,vz:0,weight:a*d}}),l=(i===2?F0(o,c=>c.x,c=>c.y):M6(o,c=>c.x,c=>c.y,c=>c.z)).visitAfter(int),u=new Map;return o.forEach(c=>{u.set(c.id,c),snt(c,l,i)}),o.map((c,h)=>{const{id:d,data:g}=s[h],{mass:p=1}=g;n[d]={x:c.vx/p,y:c.vy/p,z:c.vz/p}}),n}function int(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 ant=(r,t,e,n,i,a,s)=>{var o;if(((o=r.data)===null||o===void 0?void 0:o.id)===a.id)return;const l=[e,n,i][s-1],u=a.x-r.x||Yv,c=a.y-r.y||Yv,h=a.z-r.z||Yv,d=[u,c,h],g=l-t;let p=0;for(let b=0;b<s;b++)p+=d[b]*d[b];const m=Math.sqrt(p)*p;if(g*g*nnt<p){const b=r.weight/m;return a.vx+=u*b,a.vy+=c*b,a.vz+=h*b,!0}if(r.length)return!1;if(r.data!==a){const b=r.data.weight/m;a.vx+=u*b,a.vy+=c*b,a.vz+=h*b}};function snt(r,t,e){t.visit((n,i,a,s,o)=>ant(n,i,a,s,o,r,e))}const ont={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 k6{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},ont),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericForceLayout(!1,t,e)})}assign(t,e){return Ht(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 Ht(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),a=e.getAllNodes(),s=e.getAllEdges(),o=this.formatOptions(i,e),{dimensions:l,width:u,height:c,nodeSize:h,getMass:d,nodeStrength:g,edgeStrength:p,linkDistance:v}=o,m=a.map((C,P)=>Object.assign(Object.assign({},C),{data:Object.assign(Object.assign({},C.data),{x:bt(C.data.x)?C.data.x:Math.random()*u,y:bt(C.data.y)?C.data.y:Math.random()*c,z:bt(C.data.z)?C.data.z:Math.random()*Math.sqrt(u*c),size:h(C)||30,mass:d(C),nodeStrength:g(C)})})),b=s.map(C=>Object.assign(Object.assign({},C),{data:Object.assign(Object.assign({},C.data),{edgeStrength:p(C),linkDistance:v(C,e.getNode(C.source),e.getNode(C.target))})}));if(!(a!=null&&a.length))return this.lastResult={nodes:[],edges:s},{nodes:[],edges:s};const w={};a.forEach((C,P)=>{w[C.id]={x:0,y:0,z:0}});const x=new Mn({nodes:m,edges:b});this.formatCentripetal(o,x);const{maxIteration:S,minMovement:_,onTick:M}=o;if(this.lastLayoutNodes=m,this.lastLayoutEdges=b,this.lastAssign=t,this.lastGraph=e,this.lastCalcGraph=x,this.lastOptions=o,this.lastVelMap=w,typeof window>"u")return;let k=0;return new Promise(C=>{this.timeInterval=window.setInterval(()=>{(!a||!this.running)&&C({nodes:Xv(e,m),edges:s}),this.runOneStep(x,e,k,w,o),this.updatePosition(e,x,w,o),t&&m.forEach(P=>e.mergeNodeData(P.id,{x:P.data.x,y:P.data.y,z:l===3?P.data.z:void 0})),M==null||M({nodes:Xv(e,m),edges:s}),k++,(k>=S||this.judgingDistance<_)&&(window.clearInterval(this.timeInterval),C({nodes:Xv(e,m),edges:s}))},0),this.running=!0})})}formatOptions(t,e){const n=Object.assign({},t),{width:i,height:a,getMass:s}=t;n.width=!i&&typeof window<"u"?window.innerWidth:i,n.height=!a&&typeof window<"u"?window.innerHeight:a,t.center||(n.center=[n.width/2,n.height/2]),s||(n.getMass=l=>{let u=1;bt(l==null?void 0:l.data.mass)&&(u=l==null?void 0:l.data.mass);const c=e.getDegree(l.id,"both");return!c||c<5?u:c*5*u}),n.nodeSize=dE(t.nodeSize,t.nodeSpacing);const o=t.linkDistance?Oo(1,t.linkDistance):l=>1+n.nodeSize(e.getNode(l.source))+n.nodeSize(e.getNode(l.target));return n.linkDistance=o,n.nodeStrength=Oo(1,t.nodeStrength),n.edgeStrength=Oo(1,t.edgeStrength),n}formatCentripetal(t,e){const{dimensions:n,centripetalOptions:i,center:a,clusterNodeStrength:s,leafCluster:o,clustering:l,nodeClusterBy:u}=t,c=e.getAllNodes(),h=i||{leaf:2,single:2,others:1,center:b=>({x:a[0],y:a[1],z:n===3?a[2]:void 0})};typeof s!="function"&&(t.clusterNodeStrength=b=>s);let d,g;if(o&&u&&(d=Lk(e,u),g=Array.from(new Set(c==null?void 0:c.map(b=>b.data[u])))||[],t.centripetalOptions=Object.assign(h,{single:100,leaf:b=>{const{siblingLeaves:w,sameTypeLeaves:x}=d[b.id]||{};return(x==null?void 0:x.length)===(w==null?void 0:w.length)||(g==null?void 0:g.length)===1?1:t.clusterNodeStrength(b)},others:1,center:b=>{const w=e.getDegree(b.id,"both");if(!w)return{x:100,y:100,z:0};let x;if(w===1){const{sameTypeLeaves:S=[]}=d[b.id]||{};S.length===1?x=void 0:S.length>1&&(x=Ik(S))}else x=void 0;return{x:x==null?void 0:x.x,y:x==null?void 0:x.y,z:x==null?void 0:x.z}}})),l&&u){d||(d=Lk(e,u)),g||(g=Array.from(new Set(c.map(w=>w.data[u])))),g=g.filter(w=>w!==void 0);const b={};g.forEach(w=>{const x=c.filter(S=>S.data[u]===w).map(S=>e.getNode(S.id));b[w]=Ik(x)}),t.centripetalOptions=Object.assign(h,{single:w=>t.clusterNodeStrength(w),leaf:w=>t.clusterNodeStrength(w),others:w=>t.clusterNodeStrength(w),center:w=>{const x=b[w.data[u]];return{x:x==null?void 0:x.x,y:x==null?void 0:x.y,z:x==null?void 0:x.z}}})}const{leaf:p,single:v,others:m}=t.centripetalOptions||{};p&&typeof p!="function"&&(t.centripetalOptions.leaf=()=>p),v&&typeof v!="function"&&(t.centripetalOptions.single=()=>v),m&&typeof m!="function"&&(t.centripetalOptions.others=()=>m)}runOneStep(t,e,n,i,a){const s={},o=t.getAllNodes(),l=t.getAllEdges();if(!(o!=null&&o.length))return;const{monitor:u}=a;if(this.calRepulsive(t,s,a),l&&this.calAttractive(t,s,a),this.calGravity(t,e,s,a),this.updateVelocity(t,s,i,a),u){const c=this.calTotalEnergy(s,o);u({energy:c,nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:n})}}calTotalEnergy(t,e){if(!(e!=null&&e.length))return 0;let n=0;return e.forEach((i,a)=>{const s=t[i.id].x,o=t[i.id].y,l=this.options.dimensions===3?t[i.id].z:0,u=s*s+o*o+l*l,{mass:c=1}=i.data;n+=c*u*.5}),n}calRepulsive(t,e,n){const{dimensions:i,factor:a,coulombDisScale:s}=n;rnt(t,a,s*s,e,i)}calAttractive(t,e,n){const{dimensions:i,nodeSize:a}=n;t.getAllEdges().forEach((s,o)=>{const{source:l,target:u}=s,c=t.getNode(l),h=t.getNode(u);if(!c||!h)return;let d=h.data.x-c.data.x,g=h.data.y-c.data.y,p=i===3?h.data.z-c.data.z:0;!d&&!g&&(d=Math.random()*.01,g=Math.random()*.01,i===3&&!p&&(p=Math.random()*.01));const v=Math.sqrt(d*d+g*g+p*p);if(v<a(c)+a(h))return;const m=d/v,b=g/v,w=p/v,{linkDistance:x=200,edgeStrength:S=200}=s.data||{},M=(x-v)*S,k=c.data.mass||1,C=h.data.mass||1,P=1/k,T=1/C,A=m*M,R=b*M,L=w*M;e[l].x-=A*P,e[l].y-=R*P,e[l].z-=L*P,e[u].x+=A*T,e[u].y+=R*T,e[u].z+=L*T})}calGravity(t,e,n,i){const{getCenter:a}=i,s=t.getAllNodes(),o=e.getAllNodes(),l=e.getAllEdges(),{width:u,height:c,center:h,gravity:d,centripetalOptions:g}=i;s&&s.forEach(p=>{const{id:v,data:m}=p,{mass:b,x:w,y:x,z:S}=m,_=e.getNode(v);let M=0,k=0,C=0,P=d;const T=t.getDegree(v,"in"),A=t.getDegree(v,"out"),R=t.getDegree(v,"both"),L=a==null?void 0:a(_,R);if(L){const[$,q,j]=L;M=w-$,k=x-q,P=j}else M=w-h[0],k=x-h[1],C=S-h[2];if(P&&(n[v].x-=P*M/b,n[v].y-=P*k/b,n[v].z-=P*C/b),g){const{leaf:$,single:q,others:j,center:B}=g,{x:D,y:G,z:X,centerStrength:K}=(B==null?void 0:B(_,o,l,u,c))||{x:0,y:0,z:0,centerStrength:0};if(!bt(D)||!bt(G))return;const ht=(w-D)/b,ut=(x-G)/b,ct=(S-X)/b;if(K&&(n[v].x-=K*ht,n[v].y-=K*ut,n[v].z-=K*ct),R===0){const pt=q(_);if(!pt)return;n[v].x-=pt*ht,n[v].y-=pt*ut,n[v].z-=pt*ct;return}if(T===0||A===0){const pt=$(_,o,l);if(!pt)return;n[v].x-=pt*ht,n[v].y-=pt*ut,n[v].z-=pt*ct;return}const dt=j(_);if(!dt)return;n[v].x-=dt*ht,n[v].y-=dt*ut,n[v].z-=dt*ct}})}updateVelocity(t,e,n,i){const{damping:a,maxSpeed:s,interval:o,dimensions:l}=i,u=t.getAllNodes();u!=null&&u.length&&u.forEach(c=>{const{id:h}=c;let d=(n[h].x+e[h].x*o)*a||.01,g=(n[h].y+e[h].y*o)*a||.01,p=l===3?(n[h].z+e[h].z*o)*a||.01:0;const v=Math.sqrt(d*d+g*g+p*p);if(v>s){const m=s/v;d=m*d,g=m*g,p=m*p}n[h]={x:d,y:g,z:p}})}updatePosition(t,e,n,i){const{distanceThresholdMode:a,interval:s,dimensions:o}=i,l=e.getAllNodes();if(!(l!=null&&l.length)){this.judgingDistance=0;return}let u=0;a==="max"?this.judgingDistance=-1/0:a==="min"&&(this.judgingDistance=1/0),l.forEach(c=>{const{id:h}=c,d=t.getNode(h);if(bt(d.data.fx)&&bt(d.data.fy)){e.mergeNodeData(h,{x:d.data.fx,y:d.data.fy,z:o===3?d.data.fz:void 0});return}const g=n[h].x*s,p=n[h].y*s,v=o===3?n[h].z*s:0;e.mergeNodeData(h,{x:c.data.x+g,y:c.data.y+p,z:c.data.z+v});const m=Math.sqrt(g*g+p*p+v*v);switch(a){case"max":this.judgingDistance<m&&(this.judgingDistance=m);break;case"min":this.judgingDistance>m&&(this.judgingDistance=m);break;default:u=u+m;break}}),(!a||a==="mean")&&(this.judgingDistance=u/l.length)}}const Lk=(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]=lnt(r,"leaf",i,t))}),n},lnt=(r,t,e,n)=>{const i=r.getDegree(e.id,"in"),a=r.getDegree(e.id,"out");let s=e,o=[];i===0?(s=r.getSuccessors(e.id)[0],o=r.getNeighbors(s.id)):a===0&&(s=r.getPredecessors(e.id)[0],o=r.getNeighbors(s.id)),o=o.filter(u=>r.getDegree(u.id,"in")===0||r.getDegree(u.id,"out")===0);const l=unt(r,t,n,e,o);return{coreNode:s,siblingLeaves:o,sameTypeLeaves:l}},unt=(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},Ik=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}},Xv=(r,t)=>t.map(e=>{const{id:n,data:i}=e,a=r.getNode(n);return Object.assign(Object.assign({},a),{data:Object.assign(Object.assign({},a.data),{x:i.x,y:i.y,z:i.z})})});var ne={};const cnt=Object.prototype.toString;function xc(r){const t=cnt.call(r);return t.endsWith("Array]")&&!t.includes("Big")}const hnt=Object.freeze(Object.defineProperty({__proto__:null,isAnyArray:xc},Symbol.toStringTag,{value:"Module"})),dnt=xR(hnt);function fnt(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!xc(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 gnt(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!xc(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 pnt(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(xc(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(!xc(t.output))throw new TypeError("output option must be an array if specified");e=t.output}else e=new Array(r.length);var n=gnt(r),i=fnt(r);if(n===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var a=t.min,s=a===void 0?t.autoMinMax?n:0:a,o=t.max,l=o===void 0?t.autoMinMax?i:1:o;if(s>=l)throw new RangeError("min option must be smaller than max option");for(var u=(l-s)/(i-n),c=0;c<r.length;c++)e[c]=(r[c]-n)*u+s;return e}const vnt=Object.freeze(Object.defineProperty({__proto__:null,default:pnt},Symbol.toStringTag,{value:"Module"})),mnt=xR(vnt);Object.defineProperty(ne,"__esModule",{value:!0});var _r=dnt,Dk=mnt;const Ad=" ".repeat(2),C6=" ".repeat(4);function ynt(){return T6(this)}function T6(r,t={}){const{maxRows:e=15,maxColumns:n=10,maxNumSize:i=8,padMinus:a="auto"}=t;return`${r.constructor.name} {
- ${Ad}[
- ${C6}${bnt(r,e,n,i,a)}
- ${Ad}]
- ${Ad}rows: ${r.rows}
- ${Ad}columns: ${r.columns}
- }`}function bnt(r,t,e,n,i){const{rows:a,columns:s}=r,o=Math.min(a,t),l=Math.min(s,e),u=[];if(i==="auto"){i=!1;t:for(let c=0;c<o;c++)for(let h=0;h<l;h++)if(r.get(c,h)<0){i=!0;break t}}for(let c=0;c<o;c++){let h=[];for(let d=0;d<l;d++)h.push(wnt(r.get(c,d),n,i));u.push(`${h.join(" ")}`)}return l!==s&&(u[u.length-1]+=` ... ${s-e} more columns`),o!==a&&u.push(`... ${a-t} more rows`),u.join(`
- ${C6}`)}function wnt(r,t,e){return(r>=0&&e?` ${Fk(r,t-1)}`:Fk(r,t)).padEnd(t)}function Fk(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 xnt(r,t){r.prototype.add=function(n){return typeof n=="number"?this.addS(n):this.addM(n)},r.prototype.addS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)+n);return this},r.prototype.addM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)+n.get(i,a));return this},r.add=function(n,i){return new t(n).add(i)},r.prototype.sub=function(n){return typeof n=="number"?this.subS(n):this.subM(n)},r.prototype.subS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)-n);return this},r.prototype.subM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)-n.get(i,a));return this},r.sub=function(n,i){return new t(n).sub(i)},r.prototype.subtract=r.prototype.sub,r.prototype.subtractS=r.prototype.subS,r.prototype.subtractM=r.prototype.subM,r.subtract=r.sub,r.prototype.mul=function(n){return typeof n=="number"?this.mulS(n):this.mulM(n)},r.prototype.mulS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)*n);return this},r.prototype.mulM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)*n.get(i,a));return this},r.mul=function(n,i){return new t(n).mul(i)},r.prototype.multiply=r.prototype.mul,r.prototype.multiplyS=r.prototype.mulS,r.prototype.multiplyM=r.prototype.mulM,r.multiply=r.mul,r.prototype.div=function(n){return typeof n=="number"?this.divS(n):this.divM(n)},r.prototype.divS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)/n);return this},r.prototype.divM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)/n.get(i,a));return this},r.div=function(n,i){return new t(n).div(i)},r.prototype.divide=r.prototype.div,r.prototype.divideS=r.prototype.divS,r.prototype.divideM=r.prototype.divM,r.divide=r.div,r.prototype.mod=function(n){return typeof n=="number"?this.modS(n):this.modM(n)},r.prototype.modS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)%n);return this},r.prototype.modM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)%n.get(i,a));return this},r.mod=function(n,i){return new t(n).mod(i)},r.prototype.modulus=r.prototype.mod,r.prototype.modulusS=r.prototype.modS,r.prototype.modulusM=r.prototype.modM,r.modulus=r.mod,r.prototype.and=function(n){return typeof n=="number"?this.andS(n):this.andM(n)},r.prototype.andS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)&n);return this},r.prototype.andM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)&n.get(i,a));return this},r.and=function(n,i){return new t(n).and(i)},r.prototype.or=function(n){return typeof n=="number"?this.orS(n):this.orM(n)},r.prototype.orS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)|n);return this},r.prototype.orM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)|n.get(i,a));return this},r.or=function(n,i){return new t(n).or(i)},r.prototype.xor=function(n){return typeof n=="number"?this.xorS(n):this.xorM(n)},r.prototype.xorS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)^n);return this},r.prototype.xorM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)^n.get(i,a));return this},r.xor=function(n,i){return new t(n).xor(i)},r.prototype.leftShift=function(n){return typeof n=="number"?this.leftShiftS(n):this.leftShiftM(n)},r.prototype.leftShiftS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)<<n);return this},r.prototype.leftShiftM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)<<n.get(i,a));return this},r.leftShift=function(n,i){return new t(n).leftShift(i)},r.prototype.signPropagatingRightShift=function(n){return typeof n=="number"?this.signPropagatingRightShiftS(n):this.signPropagatingRightShiftM(n)},r.prototype.signPropagatingRightShiftS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>n);return this},r.prototype.signPropagatingRightShiftM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>n.get(i,a));return this},r.signPropagatingRightShift=function(n,i){return new t(n).signPropagatingRightShift(i)},r.prototype.rightShift=function(n){return typeof n=="number"?this.rightShiftS(n):this.rightShiftM(n)},r.prototype.rightShiftS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>>n);return this},r.prototype.rightShiftM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)>>>n.get(i,a));return this},r.rightShift=function(n,i){return new t(n).rightShift(i)},r.prototype.zeroFillRightShift=r.prototype.rightShift,r.prototype.zeroFillRightShiftS=r.prototype.rightShiftS,r.prototype.zeroFillRightShiftM=r.prototype.rightShiftM,r.zeroFillRightShift=r.rightShift,r.prototype.not=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,~this.get(n,i));return this},r.not=function(n){return new t(n).not()},r.prototype.abs=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.abs(this.get(n,i)));return this},r.abs=function(n){return new t(n).abs()},r.prototype.acos=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.acos(this.get(n,i)));return this},r.acos=function(n){return new t(n).acos()},r.prototype.acosh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.acosh(this.get(n,i)));return this},r.acosh=function(n){return new t(n).acosh()},r.prototype.asin=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.asin(this.get(n,i)));return this},r.asin=function(n){return new t(n).asin()},r.prototype.asinh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.asinh(this.get(n,i)));return this},r.asinh=function(n){return new t(n).asinh()},r.prototype.atan=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.atan(this.get(n,i)));return this},r.atan=function(n){return new t(n).atan()},r.prototype.atanh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.atanh(this.get(n,i)));return this},r.atanh=function(n){return new t(n).atanh()},r.prototype.cbrt=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.cbrt(this.get(n,i)));return this},r.cbrt=function(n){return new t(n).cbrt()},r.prototype.ceil=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.ceil(this.get(n,i)));return this},r.ceil=function(n){return new t(n).ceil()},r.prototype.clz32=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.clz32(this.get(n,i)));return this},r.clz32=function(n){return new t(n).clz32()},r.prototype.cos=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.cos(this.get(n,i)));return this},r.cos=function(n){return new t(n).cos()},r.prototype.cosh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.cosh(this.get(n,i)));return this},r.cosh=function(n){return new t(n).cosh()},r.prototype.exp=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.exp(this.get(n,i)));return this},r.exp=function(n){return new t(n).exp()},r.prototype.expm1=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.expm1(this.get(n,i)));return this},r.expm1=function(n){return new t(n).expm1()},r.prototype.floor=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.floor(this.get(n,i)));return this},r.floor=function(n){return new t(n).floor()},r.prototype.fround=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.fround(this.get(n,i)));return this},r.fround=function(n){return new t(n).fround()},r.prototype.log=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log(this.get(n,i)));return this},r.log=function(n){return new t(n).log()},r.prototype.log1p=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log1p(this.get(n,i)));return this},r.log1p=function(n){return new t(n).log1p()},r.prototype.log10=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log10(this.get(n,i)));return this},r.log10=function(n){return new t(n).log10()},r.prototype.log2=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.log2(this.get(n,i)));return this},r.log2=function(n){return new t(n).log2()},r.prototype.round=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.round(this.get(n,i)));return this},r.round=function(n){return new t(n).round()},r.prototype.sign=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sign(this.get(n,i)));return this},r.sign=function(n){return new t(n).sign()},r.prototype.sin=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sin(this.get(n,i)));return this},r.sin=function(n){return new t(n).sin()},r.prototype.sinh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sinh(this.get(n,i)));return this},r.sinh=function(n){return new t(n).sinh()},r.prototype.sqrt=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.sqrt(this.get(n,i)));return this},r.sqrt=function(n){return new t(n).sqrt()},r.prototype.tan=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.tan(this.get(n,i)));return this},r.tan=function(n){return new t(n).tan()},r.prototype.tanh=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.tanh(this.get(n,i)));return this},r.tanh=function(n){return new t(n).tanh()},r.prototype.trunc=function(){for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.set(n,i,Math.trunc(this.get(n,i)));return this},r.trunc=function(n){return new t(n).trunc()},r.pow=function(n,i){return new t(n).pow(i)},r.prototype.pow=function(n){return typeof n=="number"?this.powS(n):this.powM(n)},r.prototype.powS=function(n){for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)**n);return this},r.prototype.powM=function(n){if(n=t.checkMatrix(n),this.rows!==n.rows||this.columns!==n.columns)throw new RangeError("Matrices dimensions must be equal");for(let i=0;i<this.rows;i++)for(let a=0;a<this.columns;a++)this.set(i,a,this.get(i,a)**n.get(i,a));return this}}function di(r,t,e){let n=e?r.rows:r.rows-1;if(t<0||t>n)throw new RangeError("Row index out of range")}function fi(r,t,e){let n=e?r.columns:r.columns-1;if(t<0||t>n)throw new RangeError("Column index out of range")}function Tl(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 Ol(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 pE(r,t){if(!_r.isAnyArray(t))throw new TypeError("row indices must be an array");for(let e=0;e<t.length;e++)if(t[e]<0||t[e]>=r.rows)throw new RangeError("row indices are out of range")}function vE(r,t){if(!_r.isAnyArray(t))throw new TypeError("column indices must be an array");for(let e=0;e<t.length;e++)if(t[e]<0||t[e]>=r.columns)throw new RangeError("column indices are out of range")}function tx(r,t,e,n,i){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(Pd("startRow",t),Pd("endRow",e),Pd("startColumn",n),Pd("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 B0(r,t=0){let e=[];for(let n=0;n<r;n++)e.push(t);return e}function Pd(r,t){if(typeof t!="number")throw new TypeError(`${r} must be a number`)}function bl(r){if(r.isEmpty())throw new Error("Empty matrix has no elements to index")}function Ent(r){let t=B0(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 _nt(r){let t=B0(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 Snt(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 Mnt(r){let t=B0(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 knt(r){let t=B0(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 Cnt(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 Tnt(r,t,e){const n=r.rows,i=r.columns,a=[];for(let s=0;s<n;s++){let o=0,l=0,u=0;for(let c=0;c<i;c++)u=r.get(s,c)-e[s],o+=u,l+=u*u;t?a.push((l-o*o/i)/(i-1)):a.push((l-o*o/i)/i)}return a}function Ont(r,t,e){const n=r.rows,i=r.columns,a=[];for(let s=0;s<i;s++){let o=0,l=0,u=0;for(let c=0;c<n;c++)u=r.get(c,s)-e[s],o+=u,l+=u*u;t?a.push((l-o*o/n)/(n-1)):a.push((l-o*o/n)/n)}return a}function Ant(r,t,e){const n=r.rows,i=r.columns,a=n*i;let s=0,o=0,l=0;for(let u=0;u<n;u++)for(let c=0;c<i;c++)l=r.get(u,c)-e,s+=l,o+=l*l;return t?(o-s*s/a)/(a-1):(o-s*s/a)/a}function Pnt(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)-t[e])}function Nnt(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 Rnt(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)-t)}function Lnt(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 Int(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)/t[e])}function Dnt(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 Fnt(r,t){for(let e=0;e<r.rows;e++)for(let n=0;n<r.columns;n++)r.set(e,n,r.get(e,n)/t[n])}function Bnt(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 znt(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 Vt{static from1DArray(t,e,n){if(t*e!==n.length)throw new RangeError("data length does not match given dimensions");let a=new yt(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 yt(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 yt(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 yt(t,e)}static ones(t,e){return new yt(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 yt(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 yt(t,e);for(let u=0;u<t;u++)for(let c=0;c<e;c++){let h=i+Math.round(s()*o);l.set(u,c,h)}return l}static eye(t,e,n){e===void 0&&(e=t),n===void 0&&(n=1);let i=Math.min(t,e),a=this.zeros(t,e);for(let s=0;s<i;s++)a.set(s,s,n);return a}static diag(t,e,n){let i=t.length;e===void 0&&(e=i),n===void 0&&(n=e);let a=Math.min(i,e,n),s=this.zeros(e,n);for(let o=0;o<a;o++)s.set(o,o,t[o]);return s}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,i=t.columns,a=new yt(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 Vt.isMatrix(t)?t:new yt(t)}static isMatrix(t){return t!=null&&t.klass==="Matrix"}get size(){return this.rows*this.columns}apply(t){if(typeof t!="function")throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.call(this,e,n);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let n=0;n<this.columns;n++)t[e].push(this.get(e,n))}return t}toJSON(){return this.to2DArray()}isRowVector(){return this.rows===1}isColumnVector(){return this.columns===1}isVector(){return this.rows===1||this.columns===1}isSquare(){return this.rows===this.columns}isEmpty(){return this.rows===0||this.columns===0}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(this.get(t,t)!==0)return!1;return!0}isEchelonForm(){let t=0,e=0,n=-1,i=!0,a=!1;for(;t<this.rows&&i;){for(e=0,a=!1;e<this.columns&&a===!1;)this.get(t,e)===0?e++:this.get(t,e)===1&&e>n?(a=!0,n=e):(i=!1,a=!0);t++}return i}isReducedEchelonForm(){let t=0,e=0,n=-1,i=!0,a=!1;for(;t<this.rows&&i;){for(e=0,a=!1;e<this.columns&&a===!1;)this.get(t,e)===0?e++:this.get(t,e)===1&&e>n?(a=!0,n=e):(i=!1,a=!0);for(let s=e+1;s<this.rows;s++)this.get(t,s)!==0&&(i=!1);t++}return i}echelonForm(){let t=this.clone(),e=0,n=0;for(;e<t.rows&&n<t.columns;){let i=e;for(let a=e;a<t.rows;a++)t.get(a,n)>t.get(i,n)&&(i=a);if(t.get(i,n)===0)n++;else{t.swapRows(e,i);let a=t.get(e,n);for(let s=n;s<t.columns;s++)t.set(e,s,t.get(e,s)/a);for(let s=e+1;s<t.rows;s++){let o=t.get(s,n)/t.get(e,n);t.set(s,n,0);for(let l=n+1;l<t.columns;l++)t.set(s,l,t.get(s,l)-t.get(e,l)*o)}e++,n++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,n=t.rows,i=n-1;for(;i>=0;)if(t.maxRow(i)===0)i--;else{let a=0,s=!1;for(;a<n&&s===!1;)t.get(i,a)===1?s=!0:a++;for(let o=0;o<i;o++){let l=t.get(o,a);for(let u=a;u<e;u++){let c=t.get(o,u)-l*t.get(i,u);t.set(o,u,c)}}i--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{rows:e=1,columns:n=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(n)||n<=0)throw new TypeError("columns must be a positive integer");let i=new yt(this.rows*e,this.columns*n);for(let a=0;a<e;a++)for(let s=0;s<n;s++)i.setSubMatrix(this,this.rows*a,this.columns*s);return i}fill(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,t);return this}neg(){return this.mulS(-1)}getRow(t){di(this,t);let e=[];for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}getRowVector(t){return yt.rowVector(this.getRow(t))}setRow(t,e){di(this,t),e=Tl(this,e);for(let n=0;n<this.columns;n++)this.set(t,n,e[n]);return this}swapRows(t,e){di(this,t),di(this,e);for(let n=0;n<this.columns;n++){let i=this.get(t,n);this.set(t,n,this.get(e,n)),this.set(e,n,i)}return this}getColumn(t){fi(this,t);let e=[];for(let n=0;n<this.rows;n++)e.push(this.get(n,t));return e}getColumnVector(t){return yt.columnVector(this.getColumn(t))}setColumn(t,e){fi(this,t),e=Ol(this,e);for(let n=0;n<this.rows;n++)this.set(n,t,e[n]);return this}swapColumns(t,e){fi(this,t),fi(this,e);for(let n=0;n<this.rows;n++){let i=this.get(n,t);this.set(n,t,this.get(n,e)),this.set(n,e,i)}return this}addRowVector(t){t=Tl(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[n]);return this}subRowVector(t){t=Tl(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[n]);return this}mulRowVector(t){t=Tl(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[n]);return this}divRowVector(t){t=Tl(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[n]);return this}addColumnVector(t){t=Ol(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=Ol(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=Ol(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=Ol(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[e]);return this}mulRow(t,e){di(this,t);for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e);return this}mulColumn(t,e){fi(this,t);for(let n=0;n<this.rows;n++)this.set(n,t,this.get(n,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const e=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>e[n]&&(e[n]=this.get(n,i));return e}case"column":{const e=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>e[i]&&(e[i]=this.get(n,i));return e}case void 0:{let e=this.get(0,0);for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)>e&&(e=this.get(n,i));return e}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){bl(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(){bl(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let i=0;i<this.columns;i++)this.get(n,i)<t&&(t=this.get(n,i),e[0]=n,e[1]=i);return e}maxRow(t){if(di(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n));return e}maxRowIndex(t){di(this,t),bl(this);let e=this.get(t,0),n=[t,0];for(let i=1;i<this.columns;i++)this.get(t,i)>e&&(e=this.get(t,i),n[1]=i);return n}minRow(t){if(di(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n));return e}minRowIndex(t){di(this,t),bl(this);let e=this.get(t,0),n=[t,0];for(let i=1;i<this.columns;i++)this.get(t,i)<e&&(e=this.get(t,i),n[1]=i);return n}maxColumn(t){if(fi(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t));return e}maxColumnIndex(t){fi(this,t),bl(this);let e=this.get(0,t),n=[0,t];for(let i=1;i<this.rows;i++)this.get(i,t)>e&&(e=this.get(i,t),n[0]=i);return n}minColumn(t){if(fi(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t));return e}minColumnIndex(t){fi(this,t),bl(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){Vt.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=yt.checkMatrix(t);let e=this.rows,n=this.columns,i=t.columns,a=new yt(e,i),s=new Float64Array(n);for(let o=0;o<i;o++){for(let l=0;l<n;l++)s[l]=t.get(l,o);for(let l=0;l<e;l++){let u=0;for(let c=0;c<n;c++)u+=this.get(l,c)*s[c];a.set(l,o,u)}}return a}mpow(t){if(!this.isSquare())throw new RangeError("Matrix must be square");if(!Number.isInteger(t)||t<0)throw new RangeError("Exponent must be a non-negative integer");let e=yt.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=yt.checkMatrix(t);let e=new yt(2,2);const n=this.get(0,0),i=t.get(0,0),a=this.get(0,1),s=t.get(0,1),o=this.get(1,0),l=t.get(1,0),u=this.get(1,1),c=t.get(1,1),h=(n+u)*(i+c),d=(o+u)*i,g=n*(s-c),p=u*(l-i),v=(n+a)*c,m=(o-n)*(i+s),b=(a-u)*(l+c),w=h+p-v+b,x=g+v,S=d+p,_=h-d+g+m;return e.set(0,0,w),e.set(0,1,x),e.set(1,0,S),e.set(1,1,_),e}strassen3x3(t){t=yt.checkMatrix(t);let e=new yt(3,3);const n=this.get(0,0),i=this.get(0,1),a=this.get(0,2),s=this.get(1,0),o=this.get(1,1),l=this.get(1,2),u=this.get(2,0),c=this.get(2,1),h=this.get(2,2),d=t.get(0,0),g=t.get(0,1),p=t.get(0,2),v=t.get(1,0),m=t.get(1,1),b=t.get(1,2),w=t.get(2,0),x=t.get(2,1),S=t.get(2,2),_=(n+i+a-s-o-c-h)*m,M=(n-s)*(-g+m),k=o*(-d+g+v-m-b-w+S),C=(-n+s+o)*(d-g+m),P=(s+o)*(-d+g),T=n*d,A=(-n+u+c)*(d-p+b),R=(-n+u)*(p-b),L=(u+c)*(-d+p),$=(n+i+a-o-l-u-c)*b,q=c*(-d+p+v-m-b-w+x),j=(-a+c+h)*(m+w-x),B=(a-h)*(m-x),D=a*w,G=(c+h)*(-w+x),X=(-a+o+l)*(b+w-S),K=(a-l)*(b-S),ht=(o+l)*(-w+S),ut=i*v,ct=l*x,dt=s*p,pt=u*g,mt=h*S,It=T+D+ut,zt=_+C+P+T+j+D+G,Te=T+A+L+$+D+X+ht,Rn=M+k+C+T+D+X+K,ln=M+C+P+T+ct,dr=D+X+K+ht+dt,Ln=T+A+R+q+j+B+D,te=j+B+D+G+pt,bi=T+A+R+L+mt;return e.set(0,0,It),e.set(0,1,zt),e.set(0,2,Te),e.set(1,0,Rn),e.set(1,1,ln),e.set(1,2,dr),e.set(2,0,Ln),e.set(2,1,te),e.set(2,2,bi),e}mmulStrassen(t){t=yt.checkMatrix(t);let e=this.clone(),n=e.rows,i=e.columns,a=t.rows,s=t.columns;i!==a&&console.warn(`Multiplying ${n} x ${i} and ${a} x ${s} matrix: dimensions do not match.`);function o(h,d,g){let p=h.rows,v=h.columns;if(p===d&&v===g)return h;{let m=Vt.zeros(d,g);return m=m.setSubMatrix(h,0,0),m}}let l=Math.max(n,a),u=Math.max(i,s);e=o(e,l,u),t=o(t,l,u);function c(h,d,g,p){if(g<=512||p<=512)return h.mmul(d);g%2===1&&p%2===1?(h=o(h,g+1,p+1),d=o(d,g+1,p+1)):g%2===1?(h=o(h,g+1,p),d=o(d,g+1,p)):p%2===1&&(h=o(h,g,p+1),d=o(d,g,p+1));let v=parseInt(h.rows/2,10),m=parseInt(h.columns/2,10),b=h.subMatrix(0,v-1,0,m-1),w=d.subMatrix(0,v-1,0,m-1),x=h.subMatrix(0,v-1,m,h.columns-1),S=d.subMatrix(0,v-1,m,d.columns-1),_=h.subMatrix(v,h.rows-1,0,m-1),M=d.subMatrix(v,d.rows-1,0,m-1),k=h.subMatrix(v,h.rows-1,m,h.columns-1),C=d.subMatrix(v,d.rows-1,m,d.columns-1),P=c(Vt.add(b,k),Vt.add(w,C),v,m),T=c(Vt.add(_,k),w,v,m),A=c(b,Vt.sub(S,C),v,m),R=c(k,Vt.sub(M,w),v,m),L=c(Vt.add(b,x),C,v,m),$=c(Vt.sub(_,b),Vt.add(w,S),v,m),q=c(Vt.sub(x,k),Vt.add(M,C),v,m),j=Vt.add(P,R);j.sub(L),j.add(q);let B=Vt.add(A,L),D=Vt.add(T,R),G=Vt.sub(P,T);G.add(A),G.add($);let X=Vt.zeros(2*j.rows,2*j.columns);return X=X.setSubMatrix(j,0,0),X=X.setSubMatrix(B,j.rows,0),X=X.setSubMatrix(D,0,j.columns),X=X.setSubMatrix(G,j.rows,j.columns),X.subMatrix(0,g-1,0,p-1)}return c(e,t,l,u)}scaleRows(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let i=new yt(this.rows,this.columns);for(let a=0;a<this.rows;a++){const s=this.getRow(a);s.length>0&&Dk(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 yt(this.rows,this.columns);for(let a=0;a<this.columns;a++){const s=this.getColumn(a);s.length&&Dk(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=yt.checkMatrix(t);let e=this.rows,n=this.columns,i=t.rows,a=t.columns,s=new yt(e*i,n*a);for(let o=0;o<e;o++)for(let l=0;l<n;l++)for(let u=0;u<i;u++)for(let c=0;c<a;c++)s.set(i*o+u,a*l+c,this.get(o,l)*t.get(u,c));return s}kroneckerSum(t){if(t=yt.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(yt.eye(n,n)),a=yt.eye(e,e).kroneckerProduct(t);return i.add(a)}transpose(){let t=new yt(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=Bk){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=Bk){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,n,i){tx(this,t,e,n,i);let a=new yt(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 yt(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 yt(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=yt.checkMatrix(t),t.isEmpty())return this;let i=e+t.rows-1,a=n+t.columns-1;tx(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){pE(this,t),vE(this,e);let n=new yt(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 yt(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 Ent(this);case"column":return _nt(this);case void 0:return Snt(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return Mnt(this);case"column":return knt(this);case void 0:return Cnt(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":{for(let n=0;n<this.rows;n++)e[n]/=this.columns;return e}case"column":{for(let n=0;n<this.columns;n++)e[n]/=this.rows;return e}case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");const{unbiased:n=!0,mean:i=this.mean(t)}=e;if(typeof n!="boolean")throw new TypeError("unbiased must be a boolean");switch(t){case"row":{if(!_r.isAnyArray(i))throw new TypeError("mean must be an array");return Tnt(this,n,i)}case"column":{if(!_r.isAnyArray(i))throw new TypeError("mean must be an array");return Ont(this,n,i)}case void 0:{if(typeof i!="number")throw new TypeError("mean must be a number");return Ant(this,n,i)}default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){typeof t=="object"&&(e=t,t=void 0);const n=this.variance(t,e);if(t===void 0)return Math.sqrt(n);for(let i=0;i<n.length;i++)n[i]=Math.sqrt(n[i]);return n}center(t,e={}){if(typeof t=="object"&&(e=t,t=void 0),typeof e!="object")throw new TypeError("options must be an object");const{center:n=this.mean(t)}=e;switch(t){case"row":{if(!_r.isAnyArray(n))throw new TypeError("center must be an array");return Pnt(this,n),this}case"column":{if(!_r.isAnyArray(n))throw new TypeError("center must be an array");return Nnt(this,n),this}case void 0:{if(typeof n!="number")throw new TypeError("center must be a number");return Rnt(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=Lnt(this);else if(!_r.isAnyArray(n))throw new TypeError("scale must be an array");return Int(this,n),this}case"column":{if(n===void 0)n=Dnt(this);else if(!_r.isAnyArray(n))throw new TypeError("scale must be an array");return Fnt(this,n),this}case void 0:{if(n===void 0)n=Bnt(this);else if(typeof n!="number")throw new TypeError("scale must be a number");return znt(this,n),this}default:throw new Error(`invalid option: ${t}`)}}toString(t){return T6(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)}}Vt.prototype.klass="Matrix";typeof Symbol<"u"&&(Vt.prototype[Symbol.for("nodejs.util.inspect.custom")]=ynt);function Bk(r,t){return r-t}function $nt(r){return r.every(t=>typeof t=="number")}Vt.random=Vt.rand;Vt.randomInt=Vt.randInt;Vt.diagonal=Vt.diag;Vt.prototype.diagonal=Vt.prototype.diag;Vt.identity=Vt.eye;Vt.prototype.negate=Vt.prototype.neg;Vt.prototype.tensorProduct=Vt.prototype.kroneckerProduct;var Cc,ex,No;let yt=(No=class extends Vt{constructor(e,n){super();ev(this,Cc);le(this,"data");if(No.isMatrix(e))nv(this,Cc,ex).call(this,e.rows,e.columns),No.copy(e,this);else if(Number.isInteger(e)&&e>=0)nv(this,Cc,ex).call(this,e,n);else if(_r.isAnyArray(e)){const i=e;if(e=i.length,n=e?i[0].length:0,typeof n!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let a=0;a<e;a++){if(i[a].length!==n)throw new RangeError("Inconsistent array dimensions");if(!$nt(i[a]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(i[a]))}this.rows=e,this.columns=n}else throw new TypeError("First argument must be a positive number or an array")}set(e,n,i){return this.data[e][n]=i,this}get(e,n){return this.data[e][n]}removeRow(e){return di(this,e),this.data.splice(e,1),this.rows-=1,this}addRow(e,n){return n===void 0&&(n=e,e=this.rows),di(this,e,!0),n=Float64Array.from(Tl(this,n)),this.data.splice(e,0,n),this.rows+=1,this}removeColumn(e){fi(this,e);for(let n=0;n<this.rows;n++){const i=new Float64Array(this.columns-1);for(let a=0;a<e;a++)i[a]=this.data[n][a];for(let a=e+1;a<this.columns;a++)i[a-1]=this.data[n][a];this.data[n]=i}return this.columns-=1,this}addColumn(e,n){typeof n>"u"&&(n=e,e=this.columns),fi(this,e,!0),n=Ol(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}},Cc=new WeakSet,ex=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},No);xnt(Vt,yt);var Yn;const Qf=class Qf extends Vt{constructor(e){super();ev(this,Yn);if(yt.isMatrix(e)){if(!e.isSymmetric())throw new TypeError("not symmetric data");qh(this,Yn,yt.copy(e,new yt(e.rows,e.rows)))}else if(Number.isInteger(e)&&e>=0)qh(this,Yn,new yt(e,e));else if(qh(this,Yn,new yt(e)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return ki(this,Yn).size}get rows(){return ki(this,Yn).rows}get columns(){return ki(this,Yn).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(e){return yt.isMatrix(e)&&e.klassType==="SymmetricMatrix"}static zeros(e){return new this(e)}static ones(e){return new this(e).fill(1)}clone(){const e=new Qf(this.diagonalSize);for(const[n,i,a]of this.upperRightEntries())e.set(n,i,a);return e}toMatrix(){return new yt(this)}get(e,n){return ki(this,Yn).get(e,n)}set(e,n,i){return ki(this,Yn).set(e,n,i),ki(this,Yn).set(n,e,i),this}removeCross(e){return ki(this,Yn).removeRow(e),ki(this,Yn).removeColumn(e),this}addCross(e,n){n===void 0&&(n=e,e=this.diagonalSize);const i=n.slice();return i.splice(e,1),ki(this,Yn).addRow(e,i),ki(this,Yn).addColumn(e,n),this}applyMask(e){if(e.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const n=[];for(const[i,a]of e.entries())a||n.push(i);n.reverse();for(const i of n)this.removeCross(i);return this}toCompact(){const{diagonalSize:e}=this,n=new Array(e*(e+1)/2);for(let i=0,a=0,s=0;s<n.length;s++)n[s]=this.get(a,i),++i>=e&&(i=++a);return n}static fromCompact(e){const n=e.length,i=(Math.sqrt(8*n+1)-1)/2;if(!Number.isInteger(i))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(e)}`);const a=new Qf(i);for(let s=0,o=0,l=0;l<n;l++)a.set(s,o,e[l]),++s>=i&&(s=++o);return a}*upperRightEntries(){for(let e=0,n=0;e<this.diagonalSize;void 0){const i=this.get(e,n);yield[e,n,i],++n>=this.diagonalSize&&(n=++e)}}*upperRightValues(){for(let e=0,n=0;e<this.diagonalSize;void 0)yield this.get(e,n),++n>=this.diagonalSize&&(n=++e)}};Yn=new WeakMap;let Ao=Qf;Ao.prototype.klassType="SymmetricMatrix";class z0 extends Ao{static isDistanceMatrix(t){return Ao.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 Ao(this)}clone(){const t=new z0(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}}z0.prototype.klassSubType="DistanceMatrix";class Ya extends Vt{constructor(t,e,n){super(),this.matrix=t,this.rows=e,this.columns=n}}class jnt extends Ya{constructor(t,e){fi(t,e),super(t,t.rows,1),this.column=e}set(t,e,n){return this.matrix.set(t,this.column,n),this}get(t){return this.matrix.get(t,this.column)}}class qnt extends Ya{constructor(t,e){vE(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 Wnt extends Ya{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 Gnt extends Ya{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 Vnt extends Ya{constructor(t,e){di(t,e),super(t,1,t.columns),this.row=e}set(t,e,n){return this.matrix.set(this.row,e,n),this}get(t,e){return this.matrix.get(this.row,e)}}class Hnt extends Ya{constructor(t,e){pE(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 nf extends Ya{constructor(t,e,n){pE(t,e),vE(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 Unt extends Ya{constructor(t,e,n,i,a){tx(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 Ynt extends Ya{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 O6 extends Vt{constructor(t,e={}){const{rows:n=1}=e;if(t.length%n!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=n,this.columns=t.length/n,this.data=t}set(t,e,n){let i=this._calculateIndex(t,e);return this.data[i]=n,this}get(t,e){let n=this._calculateIndex(t,e);return this.data[n]}_calculateIndex(t,e){return t*this.columns+e}}class Yr extends Vt{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 Xnt(r,t){if(_r.isAnyArray(r))return r[0]&&_r.isAnyArray(r[0])?new Yr(r):new O6(r,t);throw new Error("the argument is not an array")}class $0{constructor(t){t=Yr.checkMatrix(t);let e=t.clone(),n=e.rows,i=e.columns,a=new Float64Array(n),s=1,o,l,u,c,h,d,g,p,v;for(o=0;o<n;o++)a[o]=o;for(p=new Float64Array(n),l=0;l<i;l++){for(o=0;o<n;o++)p[o]=e.get(o,l);for(o=0;o<n;o++){for(v=Math.min(o,l),h=0,u=0;u<v;u++)h+=e.get(o,u)*p[u];p[o]-=h,e.set(o,l,p[o])}for(c=l,o=l+1;o<n;o++)Math.abs(p[o])>Math.abs(p[c])&&(c=o);if(c!==l){for(u=0;u<i;u++)d=e.get(c,u),e.set(c,u,e.get(l,u)),e.set(l,u,d);g=a[c],a[c]=a[l],a[l]=g,s=-s}if(l<n&&e.get(l,l)!==0)for(o=l+1;o<n;o++)e.set(o,l,e.get(o,l)/e.get(l,l))}this.LU=e,this.pivotVector=a,this.pivotSign=s}isSingular(){let t=this.LU,e=t.columns;for(let n=0;n<e;n++)if(t.get(n,n)===0)return!0;return!1}solve(t){t=yt.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let i=t.columns,a=t.subMatrixRow(this.pivotVector,0,i-1),s=e.columns,o,l,u;for(u=0;u<s;u++)for(o=u+1;o<s;o++)for(l=0;l<i;l++)a.set(o,l,a.get(o,l)-a.get(u,l)*e.get(o,u));for(u=s-1;u>=0;u--){for(l=0;l<i;l++)a.set(u,l,a.get(u,l)/e.get(u,u));for(o=0;o<u;o++)for(l=0;l<i;l++)a.set(o,l,a.get(o,l)-a.get(u,l)*e.get(o,u))}return a}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,n=t.columns;for(let i=0;i<n;i++)e*=t.get(i,i);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,i=new yt(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 yt(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 Ma(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 mE{constructor(t){t=Yr.checkMatrix(t);let e=t.clone(),n=t.rows,i=t.columns,a=new Float64Array(i),s,o,l,u;for(l=0;l<i;l++){let c=0;for(s=l;s<n;s++)c=Ma(c,e.get(s,l));if(c!==0){for(e.get(l,l)<0&&(c=-c),s=l;s<n;s++)e.set(s,l,e.get(s,l)/c);for(e.set(l,l,e.get(l,l)+1),o=l+1;o<i;o++){for(u=0,s=l;s<n;s++)u+=e.get(s,l)*e.get(s,o);for(u=-u/e.get(l,l),s=l;s<n;s++)e.set(s,o,e.get(s,o)+u*e.get(s,l))}}a[l]=-c}this.QR=e,this.Rdiag=a}solve(t){t=yt.checkMatrix(t);let e=this.QR,n=e.rows;if(t.rows!==n)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let i=t.columns,a=t.clone(),s=e.columns,o,l,u,c;for(u=0;u<s;u++)for(l=0;l<i;l++){for(c=0,o=u;o<n;o++)c+=e.get(o,u)*a.get(o,l);for(c=-c/e.get(u,u),o=u;o<n;o++)a.set(o,l,a.get(o,l)+c*e.get(o,u))}for(u=s-1;u>=0;u--){for(l=0;l<i;l++)a.set(u,l,a.get(u,l)/this.Rdiag[u]);for(o=0;o<u;o++)for(l=0;l<i;l++)a.set(o,l,a.get(o,l)-a.get(u,l)*e.get(o,u))}return a.subMatrix(0,s-1,0,i-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(this.Rdiag[e]===0)return!1;return!0}get upperTriangularMatrix(){let t=this.QR,e=t.columns,n=new yt(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 yt(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 tu=class{constructor(t,e={}){if(t=Yr.checkMatrix(t),t.isEmpty())throw new Error("Matrix must be non-empty");let n=t.rows,i=t.columns;const{computeLeftSingularVectors:a=!0,computeRightSingularVectors:s=!0,autoTranspose:o=!1}=e;let l=!!a,u=!!s,c=!1,h;if(n<i)if(!o)h=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else{h=t.transpose(),n=h.rows,i=h.columns,c=!0;let T=l;l=u,u=T}else h=t.clone();let d=Math.min(n,i),g=Math.min(n+1,i),p=new Float64Array(g),v=new yt(n,d),m=new yt(i,i),b=new Float64Array(i),w=new Float64Array(n),x=new Float64Array(g);for(let T=0;T<g;T++)x[T]=T;let S=Math.min(n-1,i),_=Math.max(0,Math.min(i-2,n)),M=Math.max(S,_);for(let T=0;T<M;T++){if(T<S){p[T]=0;for(let A=T;A<n;A++)p[T]=Ma(p[T],h.get(A,T));if(p[T]!==0){h.get(T,T)<0&&(p[T]=-p[T]);for(let A=T;A<n;A++)h.set(A,T,h.get(A,T)/p[T]);h.set(T,T,h.get(T,T)+1)}p[T]=-p[T]}for(let A=T+1;A<i;A++){if(T<S&&p[T]!==0){let R=0;for(let L=T;L<n;L++)R+=h.get(L,T)*h.get(L,A);R=-R/h.get(T,T);for(let L=T;L<n;L++)h.set(L,A,h.get(L,A)+R*h.get(L,T))}b[A]=h.get(T,A)}if(l&&T<S)for(let A=T;A<n;A++)v.set(A,T,h.get(A,T));if(T<_){b[T]=0;for(let A=T+1;A<i;A++)b[T]=Ma(b[T],b[A]);if(b[T]!==0){b[T+1]<0&&(b[T]=0-b[T]);for(let A=T+1;A<i;A++)b[A]/=b[T];b[T+1]+=1}if(b[T]=-b[T],T+1<n&&b[T]!==0){for(let A=T+1;A<n;A++)w[A]=0;for(let A=T+1;A<n;A++)for(let R=T+1;R<i;R++)w[A]+=b[R]*h.get(A,R);for(let A=T+1;A<i;A++){let R=-b[A]/b[T+1];for(let L=T+1;L<n;L++)h.set(L,A,h.get(L,A)+R*w[L])}}if(u)for(let A=T+1;A<i;A++)m.set(A,T,b[A])}}let k=Math.min(i,n+1);if(S<i&&(p[S]=h.get(S,S)),n<k&&(p[k-1]=0),_+1<k&&(b[_]=h.get(_,k-1)),b[k-1]=0,l){for(let T=S;T<d;T++){for(let A=0;A<n;A++)v.set(A,T,0);v.set(T,T,1)}for(let T=S-1;T>=0;T--)if(p[T]!==0){for(let A=T+1;A<d;A++){let R=0;for(let L=T;L<n;L++)R+=v.get(L,T)*v.get(L,A);R=-R/v.get(T,T);for(let L=T;L<n;L++)v.set(L,A,v.get(L,A)+R*v.get(L,T))}for(let A=T;A<n;A++)v.set(A,T,-v.get(A,T));v.set(T,T,1+v.get(T,T));for(let A=0;A<T-1;A++)v.set(A,T,0)}else{for(let A=0;A<n;A++)v.set(A,T,0);v.set(T,T,1)}}if(u)for(let T=i-1;T>=0;T--){if(T<_&&b[T]!==0)for(let A=T+1;A<i;A++){let R=0;for(let L=T+1;L<i;L++)R+=m.get(L,T)*m.get(L,A);R=-R/m.get(T+1,T);for(let L=T+1;L<i;L++)m.set(L,A,m.get(L,A)+R*m.get(L,T))}for(let A=0;A<i;A++)m.set(A,T,0);m.set(T,T,1)}let C=k-1,P=Number.EPSILON;for(;k>0;){let T,A;for(T=k-2;T>=-1&&T!==-1;T--){const R=Number.MIN_VALUE+P*Math.abs(p[T]+Math.abs(p[T+1]));if(Math.abs(b[T])<=R||Number.isNaN(b[T])){b[T]=0;break}}if(T===k-2)A=4;else{let R;for(R=k-1;R>=T&&R!==T;R--){let L=(R!==k?Math.abs(b[R]):0)+(R!==T+1?Math.abs(b[R-1]):0);if(Math.abs(p[R])<=P*L){p[R]=0;break}}R===T?A=3:R===k-1?A=1:(A=2,T=R)}switch(T++,A){case 1:{let R=b[k-2];b[k-2]=0;for(let L=k-2;L>=T;L--){let $=Ma(p[L],R),q=p[L]/$,j=R/$;if(p[L]=$,L!==T&&(R=-j*b[L-1],b[L-1]=q*b[L-1]),u)for(let B=0;B<i;B++)$=q*m.get(B,L)+j*m.get(B,k-1),m.set(B,k-1,-j*m.get(B,L)+q*m.get(B,k-1)),m.set(B,L,$)}break}case 2:{let R=b[T-1];b[T-1]=0;for(let L=T;L<k;L++){let $=Ma(p[L],R),q=p[L]/$,j=R/$;if(p[L]=$,R=-j*b[L],b[L]=q*b[L],l)for(let B=0;B<n;B++)$=q*v.get(B,L)+j*v.get(B,T-1),v.set(B,T-1,-j*v.get(B,L)+q*v.get(B,T-1)),v.set(B,L,$)}break}case 3:{const R=Math.max(Math.abs(p[k-1]),Math.abs(p[k-2]),Math.abs(b[k-2]),Math.abs(p[T]),Math.abs(b[T])),L=p[k-1]/R,$=p[k-2]/R,q=b[k-2]/R,j=p[T]/R,B=b[T]/R,D=(($+L)*($-L)+q*q)/2,G=L*q*(L*q);let X=0;(D!==0||G!==0)&&(D<0?X=0-Math.sqrt(D*D+G):X=Math.sqrt(D*D+G),X=G/(D+X));let K=(j+L)*(j-L)+X,ht=j*B;for(let ut=T;ut<k-1;ut++){let ct=Ma(K,ht);ct===0&&(ct=Number.MIN_VALUE);let dt=K/ct,pt=ht/ct;if(ut!==T&&(b[ut-1]=ct),K=dt*p[ut]+pt*b[ut],b[ut]=dt*b[ut]-pt*p[ut],ht=pt*p[ut+1],p[ut+1]=dt*p[ut+1],u)for(let mt=0;mt<i;mt++)ct=dt*m.get(mt,ut)+pt*m.get(mt,ut+1),m.set(mt,ut+1,-pt*m.get(mt,ut)+dt*m.get(mt,ut+1)),m.set(mt,ut,ct);if(ct=Ma(K,ht),ct===0&&(ct=Number.MIN_VALUE),dt=K/ct,pt=ht/ct,p[ut]=ct,K=dt*b[ut]+pt*p[ut+1],p[ut+1]=-pt*b[ut]+dt*p[ut+1],ht=pt*b[ut+1],b[ut+1]=dt*b[ut+1],l&&ut<n-1)for(let mt=0;mt<n;mt++)ct=dt*v.get(mt,ut)+pt*v.get(mt,ut+1),v.set(mt,ut+1,-pt*v.get(mt,ut)+dt*v.get(mt,ut+1)),v.set(mt,ut,ct)}b[k-2]=K;break}case 4:{if(p[T]<=0&&(p[T]=p[T]<0?-p[T]:0,u))for(let R=0;R<=C;R++)m.set(R,T,-m.get(R,T));for(;T<C&&!(p[T]>=p[T+1]);){let R=p[T];if(p[T]=p[T+1],p[T+1]=R,u&&T<i-1)for(let L=0;L<i;L++)R=m.get(L,T+1),m.set(L,T+1,m.get(L,T)),m.set(L,T,R);if(l&&T<n-1)for(let L=0;L<n;L++)R=v.get(L,T+1),v.set(L,T+1,v.get(L,T)),v.set(L,T,R);T++}k--;break}}}if(c){let T=m;m=v,v=T}this.m=n,this.n=i,this.s=p,this.U=v,this.V=m}solve(t){let e=t,n=this.threshold,i=this.s.length,a=yt.zeros(i,i);for(let d=0;d<i;d++)Math.abs(this.s[d])<=n?a.set(d,d,0):a.set(d,d,1/this.s[d]);let s=this.U,o=this.rightSingularVectors,l=o.mmul(a),u=o.rows,c=s.rows,h=yt.zeros(u,c);for(let d=0;d<u;d++)for(let g=0;g<c;g++){let p=0;for(let v=0;v<i;v++)p+=l.get(d,v)*s.get(g,v);h.set(d,g,p)}return h.mmul(e)}solveForDiagonal(t){return this.solve(yt.diag(t))}inverse(){let t=this.V,e=this.threshold,n=t.rows,i=t.columns,a=new yt(n,this.s.length);for(let c=0;c<n;c++)for(let h=0;h<i;h++)Math.abs(this.s[h])>e&&a.set(c,h,t.get(c,h)/this.s[h]);let s=this.U,o=s.rows,l=s.columns,u=new yt(n,o);for(let c=0;c<n;c++)for(let h=0;h<o;h++){let d=0;for(let g=0;g<l;g++)d+=a.get(c,g)*s.get(h,g);u.set(c,h,d)}return u}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,n=this.s;for(let i=0,a=n.length;i<a;i++)n[i]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return yt.diag(this.s)}};function Knt(r,t=!1){return r=Yr.checkMatrix(r),t?new tu(r).inverse():A6(r,yt.eye(r.rows))}function A6(r,t,e=!1){return r=Yr.checkMatrix(r),t=Yr.checkMatrix(t),e?new tu(r).solve(t):r.isSquare()?new $0(r).solve(t):new mE(r).solve(t)}function rf(r){if(r=yt.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 nf(r,[1,2],[1,2]),s=new nf(r,[1,2],[0,2]),o=new nf(r,[1,2],[0,1]),t=r.get(0,0),e=r.get(0,1),n=r.get(0,2),t*rf(a)-e*rf(s)+n*rf(o)}else return new $0(r).determinant}else throw Error("determinant can only be calculated for a square matrix")}function Znt(r,t){let e=[];for(let n=0;n<r;n++)n!==t&&e.push(n);return e}function Jnt(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 Qnt(r,t={}){const{thresholdValue:e=1e-9,thresholdError:n=1e-9}=t;r=yt.checkMatrix(r);let i=r.rows,a=new yt(i,i);for(let s=0;s<i;s++){let o=yt.columnVector(r.getRow(s)),l=r.subMatrixRow(Znt(i,s)).transpose(),c=new tu(l).solve(o),h=yt.sub(o,l.mmul(c)).abs().max();a.setRow(s,Jnt(h,c,s,e,n))}return a}function trt(r,t=Number.EPSILON){if(r=yt.checkMatrix(r),r.isEmpty())return r.transpose();let e=new tu(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(yt.diag(a).mmul(n.transpose()))}function ert(r,t=r,e={}){r=new yt(r);let n=!1;if(typeof t=="object"&&!yt.isMatrix(t)&&!_r.isAnyArray(t)?(e=t,t=r,n=!0):t=new yt(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 nrt(r,t=r,e={}){r=new yt(r);let n=!1;if(typeof t=="object"&&!yt.isMatrix(t)&&!_r.isAnyArray(t)?(e=t,t=r,n=!0):t=new yt(t),r.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0,scale:a=!0}=e;i&&(r.center("column"),n||t.center("column")),a&&(r.scale("column"),n||t.scale("column"));const s=r.standardDeviation("column",{unbiased:!0}),o=n?s:t.standardDeviation("column",{unbiased:!0}),l=r.transpose().mmul(t);for(let u=0;u<l.rows;u++)for(let c=0;c<l.columns;c++)l.set(u,c,l.get(u,c)*(1/(s[u]*o[c]))*(1/(r.rows-1)));return l}class P6{constructor(t,e={}){const{assumeSymmetric:n=!1}=e;if(t=Yr.checkMatrix(t),!t.isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let i=t.columns,a=new yt(i,i),s=new Float64Array(i),o=new Float64Array(i),l=t,u,c,h=!1;if(n?h=!0:h=t.isSymmetric(),h){for(u=0;u<i;u++)for(c=0;c<i;c++)a.set(u,c,l.get(u,c));rrt(i,o,s,a),irt(i,o,s,a)}else{let d=new yt(i,i),g=new Float64Array(i);for(c=0;c<i;c++)for(u=0;u<i;u++)d.set(u,c,l.get(u,c));art(i,d,g,a),srt(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 yt(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 rrt(r,t,e,n){let i,a,s,o,l,u,c,h;for(l=0;l<r;l++)e[l]=n.get(r-1,l);for(o=r-1;o>0;o--){for(h=0,s=0,u=0;u<o;u++)h=h+Math.abs(e[u]);if(h===0)for(t[o]=e[o-1],l=0;l<o;l++)e[l]=n.get(o-1,l),n.set(o,l,0),n.set(l,o,0);else{for(u=0;u<o;u++)e[u]/=h,s+=e[u]*e[u];for(i=e[o-1],a=Math.sqrt(s),i>0&&(a=-a),t[o]=h*a,s=s-i*a,e[o-1]=i-a,l=0;l<o;l++)t[l]=0;for(l=0;l<o;l++){for(i=e[l],n.set(l,o,i),a=t[l]+n.get(l,l)*i,u=l+1;u<=o-1;u++)a+=n.get(u,l)*e[u],t[u]+=n.get(u,l)*i;t[l]=a}for(i=0,l=0;l<o;l++)t[l]/=s,i+=t[l]*e[l];for(c=i/(s+s),l=0;l<o;l++)t[l]-=c*e[l];for(l=0;l<o;l++){for(i=e[l],a=t[l],u=l;u<=o-1;u++)n.set(u,l,n.get(u,l)-(i*t[u]+a*e[u]));e[l]=n.get(o-1,l),n.set(o,l,0)}}e[o]=s}for(o=0;o<r-1;o++){if(n.set(r-1,o,n.get(o,o)),n.set(o,o,1),s=e[o+1],s!==0){for(u=0;u<=o;u++)e[u]=n.get(u,o+1)/s;for(l=0;l<=o;l++){for(a=0,u=0;u<=o;u++)a+=n.get(u,o+1)*n.get(u,l);for(u=0;u<=o;u++)n.set(u,l,n.get(u,l)-a*e[u])}}for(u=0;u<=o;u++)n.set(u,o+1,0)}for(l=0;l<r;l++)e[l]=n.get(r-1,l),n.set(r-1,l,0);n.set(r-1,r-1,1),t[0]=0}function irt(r,t,e,n){let i,a,s,o,l,u,c,h,d,g,p,v,m,b,w,x;for(s=1;s<r;s++)t[s-1]=t[s];t[r-1]=0;let S=0,_=0,M=Number.EPSILON;for(u=0;u<r;u++){for(_=Math.max(_,Math.abs(e[u])+Math.abs(t[u])),c=u;c<r&&!(Math.abs(t[c])<=M*_);)c++;if(c>u)do{for(i=e[u],h=(e[u+1]-i)/(2*t[u]),d=Ma(h,1),h<0&&(d=-d),e[u]=t[u]/(h+d),e[u+1]=t[u]*(h+d),g=e[u+1],a=i-e[u],s=u+2;s<r;s++)e[s]-=a;for(S=S+a,h=e[c],p=1,v=p,m=p,b=t[u+1],w=0,x=0,s=c-1;s>=u;s--)for(m=v,v=p,x=w,i=p*t[s],a=p*h,d=Ma(h,t[s]),t[s+1]=w*d,w=t[s]/d,p=h/d,h=p*e[s]-w*i,e[s+1]=a+w*(p*i+w*e[s]),l=0;l<r;l++)a=n.get(l,s+1),n.set(l,s+1,w*n.get(l,s)+p*a),n.set(l,s,p*n.get(l,s)-w*a);h=-w*x*m*b*t[u]/g,t[u]=w*h,e[u]=p*h}while(Math.abs(t[u])>M*_);e[u]=e[u]+S,t[u]=0}for(s=0;s<r-1;s++){for(l=s,h=e[s],o=s+1;o<r;o++)e[o]<h&&(l=o,h=e[o]);if(l!==s)for(e[l]=e[s],e[s]=h,o=0;o<r;o++)h=n.get(o,s),n.set(o,s,n.get(o,l)),n.set(o,l,h)}}function art(r,t,e,n){let i=0,a=r-1,s,o,l,u,c,h,d;for(h=i+1;h<=a-1;h++){for(d=0,u=h;u<=a;u++)d=d+Math.abs(t.get(u,h-1));if(d!==0){for(l=0,u=a;u>=h;u--)e[u]=t.get(u,h-1)/d,l+=e[u]*e[u];for(o=Math.sqrt(l),e[h]>0&&(o=-o),l=l-e[h]*o,e[h]=e[h]-o,c=h;c<r;c++){for(s=0,u=a;u>=h;u--)s+=e[u]*t.get(u,c);for(s=s/l,u=h;u<=a;u++)t.set(u,c,t.get(u,c)-s*e[u])}for(u=0;u<=a;u++){for(s=0,c=a;c>=h;c--)s+=e[c]*t.get(u,c);for(s=s/l,c=h;c<=a;c++)t.set(u,c,t.get(u,c)-s*e[c])}e[h]=d*e[h],t.set(h,h-1,d*o)}}for(u=0;u<r;u++)for(c=0;c<r;c++)n.set(u,c,u===c?1:0);for(h=a-1;h>=i+1;h--)if(t.get(h,h-1)!==0){for(u=h+1;u<=a;u++)e[u]=t.get(u,h-1);for(c=h;c<=a;c++){for(o=0,u=h;u<=a;u++)o+=e[u]*n.get(u,c);for(o=o/e[h]/t.get(h,h-1),u=h;u<=a;u++)n.set(u,c,n.get(u,c)+o*e[u])}}}function srt(r,t,e,n,i){let a=r-1,s=0,o=r-1,l=Number.EPSILON,u=0,c=0,h=0,d=0,g=0,p=0,v=0,m=0,b,w,x,S,_,M,k,C,P,T,A,R,L,$,q;for(b=0;b<r;b++)for((b<s||b>o)&&(e[b]=i.get(b,b),t[b]=0),w=Math.max(b-1,0);w<r;w++)c=c+Math.abs(i.get(b,w));for(;a>=s;){for(S=a;S>s&&(p=Math.abs(i.get(S-1,S-1))+Math.abs(i.get(S,S)),p===0&&(p=c),!(Math.abs(i.get(S,S-1))<l*p));)S--;if(S===a)i.set(a,a,i.get(a,a)+u),e[a]=i.get(a,a),t[a]=0,a--,m=0;else if(S===a-1){if(k=i.get(a,a-1)*i.get(a-1,a),h=(i.get(a-1,a-1)-i.get(a,a))/2,d=h*h+k,v=Math.sqrt(Math.abs(d)),i.set(a,a,i.get(a,a)+u),i.set(a-1,a-1,i.get(a-1,a-1)+u),C=i.get(a,a),d>=0){for(v=h>=0?h+v:h-v,e[a-1]=C+v,e[a]=e[a-1],v!==0&&(e[a]=C-k/v),t[a-1]=0,t[a]=0,C=i.get(a,a-1),p=Math.abs(C)+Math.abs(v),h=C/p,d=v/p,g=Math.sqrt(h*h+d*d),h=h/g,d=d/g,w=a-1;w<r;w++)v=i.get(a-1,w),i.set(a-1,w,d*v+h*i.get(a,w)),i.set(a,w,d*i.get(a,w)-h*v);for(b=0;b<=a;b++)v=i.get(b,a-1),i.set(b,a-1,d*v+h*i.get(b,a)),i.set(b,a,d*i.get(b,a)-h*v);for(b=s;b<=o;b++)v=n.get(b,a-1),n.set(b,a-1,d*v+h*n.get(b,a)),n.set(b,a,d*n.get(b,a)-h*v)}else e[a-1]=C+h,e[a]=C+h,t[a-1]=v,t[a]=-v;a=a-2,m=0}else{if(C=i.get(a,a),P=0,k=0,S<a&&(P=i.get(a-1,a-1),k=i.get(a,a-1)*i.get(a-1,a)),m===10){for(u+=C,b=s;b<=a;b++)i.set(b,b,i.get(b,b)-C);p=Math.abs(i.get(a,a-1))+Math.abs(i.get(a-1,a-2)),C=P=.75*p,k=-.4375*p*p}if(m===30&&(p=(P-C)/2,p=p*p+k,p>0)){for(p=Math.sqrt(p),P<C&&(p=-p),p=C-k/((P-C)/2+p),b=s;b<=a;b++)i.set(b,b,i.get(b,b)-p);u+=p,C=P=k=.964}for(m=m+1,_=a-2;_>=S&&(v=i.get(_,_),g=C-v,p=P-v,h=(g*p-k)/i.get(_+1,_)+i.get(_,_+1),d=i.get(_+1,_+1)-v-g-p,g=i.get(_+2,_+1),p=Math.abs(h)+Math.abs(d)+Math.abs(g),h=h/p,d=d/p,g=g/p,!(_===S||Math.abs(i.get(_,_-1))*(Math.abs(d)+Math.abs(g))<l*(Math.abs(h)*(Math.abs(i.get(_-1,_-1))+Math.abs(v)+Math.abs(i.get(_+1,_+1))))));)_--;for(b=_+2;b<=a;b++)i.set(b,b-2,0),b>_+2&&i.set(b,b-3,0);for(x=_;x<=a-1&&($=x!==a-1,x!==_&&(h=i.get(x,x-1),d=i.get(x+1,x-1),g=$?i.get(x+2,x-1):0,C=Math.abs(h)+Math.abs(d)+Math.abs(g),C!==0&&(h=h/C,d=d/C,g=g/C)),C!==0);x++)if(p=Math.sqrt(h*h+d*d+g*g),h<0&&(p=-p),p!==0){for(x!==_?i.set(x,x-1,-p*C):S!==_&&i.set(x,x-1,-i.get(x,x-1)),h=h+p,C=h/p,P=d/p,v=g/p,d=d/h,g=g/h,w=x;w<r;w++)h=i.get(x,w)+d*i.get(x+1,w),$&&(h=h+g*i.get(x+2,w),i.set(x+2,w,i.get(x+2,w)-h*v)),i.set(x,w,i.get(x,w)-h*C),i.set(x+1,w,i.get(x+1,w)-h*P);for(b=0;b<=Math.min(a,x+3);b++)h=C*i.get(b,x)+P*i.get(b,x+1),$&&(h=h+v*i.get(b,x+2),i.set(b,x+2,i.get(b,x+2)-h*g)),i.set(b,x,i.get(b,x)-h),i.set(b,x+1,i.get(b,x+1)-h*d);for(b=s;b<=o;b++)h=C*n.get(b,x)+P*n.get(b,x+1),$&&(h=h+v*n.get(b,x+2),n.set(b,x+2,n.get(b,x+2)-h*g)),n.set(b,x,n.get(b,x)-h),n.set(b,x+1,n.get(b,x+1)-h*d)}}}if(c!==0){for(a=r-1;a>=0;a--)if(h=e[a],d=t[a],d===0)for(S=a,i.set(a,a,1),b=a-1;b>=0;b--){for(k=i.get(b,b)-h,g=0,w=S;w<=a;w++)g=g+i.get(b,w)*i.get(w,a);if(t[b]<0)v=k,p=g;else if(S=b,t[b]===0?i.set(b,a,k!==0?-g/k:-g/(l*c)):(C=i.get(b,b+1),P=i.get(b+1,b),d=(e[b]-h)*(e[b]-h)+t[b]*t[b],M=(C*p-v*g)/d,i.set(b,a,M),i.set(b+1,a,Math.abs(C)>Math.abs(v)?(-g-k*M)/C:(-p-P*M)/v)),M=Math.abs(i.get(b,a)),l*M*M>1)for(w=b;w<=a;w++)i.set(w,a,i.get(w,a)/M)}else if(d<0)for(S=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))):(q=Nd(0,-i.get(a-1,a),i.get(a-1,a-1)-h,d),i.set(a-1,a-1,q[0]),i.set(a-1,a,q[1])),i.set(a,a-1,0),i.set(a,a,1),b=a-2;b>=0;b--){for(T=0,A=0,w=S;w<=a;w++)T=T+i.get(b,w)*i.get(w,a-1),A=A+i.get(b,w)*i.get(w,a);if(k=i.get(b,b)-h,t[b]<0)v=k,g=T,p=A;else if(S=b,t[b]===0?(q=Nd(-T,-A,k,d),i.set(b,a-1,q[0]),i.set(b,a,q[1])):(C=i.get(b,b+1),P=i.get(b+1,b),R=(e[b]-h)*(e[b]-h)+t[b]*t[b]-d*d,L=(e[b]-h)*2*d,R===0&&L===0&&(R=l*c*(Math.abs(k)+Math.abs(d)+Math.abs(C)+Math.abs(P)+Math.abs(v))),q=Nd(C*g-v*T+d*A,C*p-v*A-d*T,R,L),i.set(b,a-1,q[0]),i.set(b,a,q[1]),Math.abs(C)>Math.abs(v)+Math.abs(d)?(i.set(b+1,a-1,(-T-k*i.get(b,a-1)+d*i.get(b,a))/C),i.set(b+1,a,(-A-k*i.get(b,a)-d*i.get(b,a-1))/C)):(q=Nd(-g-P*i.get(b,a-1),-p-P*i.get(b,a),v,d),i.set(b+1,a-1,q[0]),i.set(b+1,a,q[1]))),M=Math.max(Math.abs(i.get(b,a-1)),Math.abs(i.get(b,a))),l*M*M>1)for(w=b;w<=a;w++)i.set(w,a-1,i.get(w,a-1)/M),i.set(w,a,i.get(w,a)/M)}for(b=0;b<r;b++)if(b<s||b>o)for(w=b;w<r;w++)n.set(b,w,i.get(b,w));for(w=r-1;w>=s;w--)for(b=s;b<=o;b++){for(v=0,x=s;x<=Math.min(w,o);x++)v=v+n.get(b,x)*i.get(x,w);n.set(b,w,v)}}}function Nd(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 N6{constructor(t){if(t=Yr.checkMatrix(t),!t.isSymmetric())throw new Error("Matrix is not symmetric");let e=t,n=e.rows,i=new yt(n,n),a=!0,s,o,l;for(o=0;o<n;o++){let u=0;for(l=0;l<o;l++){let c=0;for(s=0;s<l;s++)c+=i.get(l,s)*i.get(o,s);c=(e.get(o,l)-c)/i.get(l,l),i.set(o,l,c),u=u+c*c}for(u=e.get(o,o)-u,a&&(a=u>0),i.set(o,o,Math.sqrt(Math.max(u,0))),l=o+1;l<n;l++)i.set(o,l,0)}this.L=i,this.positiveDefinite=a}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=Yr.checkMatrix(t);let e=this.L,n=e.rows;if(t.rows!==n)throw new Error("Matrix dimensions do not match");if(this.isPositiveDefinite()===!1)throw new Error("Matrix is not positive definite");let i=t.columns,a=t.clone(),s,o,l;for(l=0;l<n;l++)for(o=0;o<i;o++){for(s=0;s<l;s++)a.set(l,o,a.get(l,o)-a.get(s,o)*e.get(l,s));a.set(l,o,a.get(l,o)/e.get(l,l))}for(l=n-1;l>=0;l--)for(o=0;o<i;o++){for(s=l+1;s<n;s++)a.set(l,o,a.get(l,o)-a.get(s,o)*e.get(s,l));a.set(l,o,a.get(l,o)/e.get(l,l))}return a}get lowerTriangularMatrix(){return this.L}}class R6{constructor(t,e={}){t=Yr.checkMatrix(t);let{Y:n}=e;const{scaleScores:i=!1,maxIterations:a=1e3,terminationCriteria:s=1e-10}=e;let o;if(n){if(_r.isAnyArray(n)&&typeof n[0]=="number"?n=yt.columnVector(n):n=Yr.checkMatrix(n),n.rows!==t.rows)throw new Error("Y should have the same number of rows as X");o=n.getColumnVector(0)}else o=t.getColumnVector(0);let l=1,u,c,h,d;for(let g=0;g<a&&l>s;g++)h=t.transpose().mmul(o).div(o.transpose().mmul(o).get(0,0)),h=h.div(h.norm()),u=t.mmul(h).div(h.transpose().mmul(h).get(0,0)),g>0&&(l=u.clone().sub(d).pow(2).sum()),d=u.clone(),n?(c=n.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),c=c.div(c.norm()),o=n.mmul(c).div(c.transpose().mmul(c).get(0,0))):o=u;if(n){let g=t.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0));g=g.div(g.norm());let p=t.clone().sub(u.clone().mmul(g.transpose())),v=o.transpose().mmul(u).div(u.transpose().mmul(u).get(0,0)),m=n.clone().sub(u.clone().mulS(v.get(0,0)).mmul(c.transpose()));this.t=u,this.p=g.transpose(),this.w=h.transpose(),this.q=c,this.u=o,this.s=u.transpose().mmul(u),this.xResidual=p,this.yResidual=m,this.betas=v}else this.w=h.transpose(),this.s=u.transpose().mmul(u).sqrt(),i?this.t=u.clone().div(this.s.get(0,0)):this.t=u,this.xResidual=t.sub(u.mmul(h.transpose()))}}ne.AbstractMatrix=Vt;ne.CHO=N6;ne.CholeskyDecomposition=N6;ne.DistanceMatrix=z0;ne.EVD=P6;ne.EigenvalueDecomposition=P6;ne.LU=$0;ne.LuDecomposition=$0;var L6=ne.Matrix=yt;ne.MatrixColumnSelectionView=qnt;ne.MatrixColumnView=jnt;ne.MatrixFlipColumnView=Wnt;ne.MatrixFlipRowView=Gnt;ne.MatrixRowSelectionView=Hnt;ne.MatrixRowView=Vnt;ne.MatrixSelectionView=nf;ne.MatrixSubView=Unt;ne.MatrixTransposeView=Ynt;ne.NIPALS=R6;ne.Nipals=R6;ne.QR=mE;ne.QrDecomposition=mE;ne.SVD=tu;var ort=ne.SingularValueDecomposition=tu;ne.SymmetricMatrix=Ao;ne.WrapperMatrix1D=O6;ne.WrapperMatrix2D=Yr;ne.correlation=nrt;ne.covariance=ert;var zk=ne.default=yt;ne.determinant=rf;ne.inverse=Knt;ne.linearDependencies=Qnt;ne.pseudoInverse=trt;ne.solve=A6;ne.wrap=Xnt;const Cs=L6,I6=ort;zk.Matrix&&zk.Matrix;const lrt={center:[0,0],linkDistance:50};class D6{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},lrt),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericMDSLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericMDSLayout(!0,t,e)})}genericMDSLayout(t,e,n){return Ht(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 Uo(e,t,a);const u=E6({nodes:o,edges:l}),c=x6(u);urt(c);const h=uet(c,s),d=crt(h),g=[];return d.forEach((v,m)=>{const b=Wr(o[m]);b.data.x=v[0]+a[0],b.data.y=v[1]+a[1],g.push(b)}),t&&g.forEach(v=>e.mergeNodeData(v.id,{x:v.data.x,y:v.data.y})),{nodes:g,edges:l}})}}const urt=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)})})},crt=r=>{const e=Cs.mul(Cs.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 I6(e),o=Cs.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map(l=>Cs.mul([l],[o]).toJSON()[0].splice(0,2))};function nx(r){return!!r.tick&&!!r.stop}const hrt={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},drt={center:[0,0],comboPadding:10,treeKey:"combo"};class frt{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},drt),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericComboCombinedLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericComboCombinedLayout(!0,t,e)})}genericComboCombinedLayout(t,e,n){return Ht(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(C=>!C.data._isCombo),u=e.getAllNodes().filter(C=>C.data._isCombo),c=e.getAllEdges(),h=l==null?void 0:l.length;if(!h||h===1)return Uo(e,t,a);const d=[],g=new Map;l.forEach(C=>{g.set(C.id,C)});const p=new Map;u.forEach(C=>{p.set(C.id,C)});const v=new Map,m=this.getInnerGraphs(e,s,g,p,c,i,v);yield Promise.all(m);const b=new Map,w=[],x=new Map;let S=!0;e.getRoots(s).forEach(C=>{const P=v.get(C.id),T=p.get(C.id)||g.get(C.id),A={id:C.id,data:Object.assign(Object.assign({},C.data),{x:P.data.x||T.data.x,y:P.data.y||T.data.y,fx:P.data.fx||T.data.fx,fy:P.data.fy||T.data.fy,mass:P.data.mass||T.data.mass,size:P.data.size})};w.push(A),b.set(C.id,!0),!isNaN(A.data.x)&&A.data.x!==0&&!isNaN(A.data.y)&&A.data.y!==0?S=!1:(A.data.x=Math.random()*100,A.data.y=Math.random()*100),Zw(e,[C],R=>{R.id!==C.id&&x.set(R.id,C.id)},"TB",s)});const _=[];c.forEach(C=>{const P=x.get(C.source)||C.source,T=x.get(C.target)||C.target;P!==T&&b.has(P)&&b.has(T)&&_.push({id:C.id,source:P,target:T,data:{}})});let M;if(w!=null&&w.length){if(w.length===1)w[0].data.x=a[0],w[0].data.y=a[1];else{const C=new Mn({nodes:w,edges:_}),P=o||new k6;S&&hrt[P.id]&&(yield(w.length<100?new D6:new Qw).assign(C));const T=Object.assign({center:a,kg:5,preventOverlap:!0,animate:!1},P.id==="force"?{gravity:1,factor:4,linkDistance:(A,R,L)=>{const $=Math.max(...R.data.size)||32,q=Math.max(...L.data.size)||32;return $/2+q/2+200}}:{});M=yield $k(P,C,T)}v.forEach(C=>{var P;const T=M.nodes.find(L=>L.id===C.id);if(T){const{x:L,y:$}=T.data;C.data.visited=!0,C.data.x=L,C.data.y=$,d.push({id:C.id,data:{x:L,y:$}})}const{x:A,y:R}=C.data;(P=C.data.nodes)===null||P===void 0||P.forEach(L=>{d.push({id:L.id,data:{x:L.data.x+A,y:L.data.y+R}})})}),v.forEach(({data:C})=>{const{x:P,y:T,visited:A,nodes:R}=C;R==null||R.forEach(L=>{if(!A){const $=d.find(q=>q.id===L.id);$.data.x+=P||0,$.data.y+=T||0}})})}return t&&d.forEach(C=>{e.mergeNodeData(C.id,{x:C.data.x,y:C.data.y})}),{nodes:d,edges:c}})}initVals(t){const e=Object.assign({},t),{nodeSize:n,spacing:i,comboPadding:a}=t;let s,o;if(bt(i)?o=()=>i:Et(i)?o=i:o=()=>0,e.spacing=o,!n)s=u=>{const c=o(u);return u.size?Aa(u.size)?((u.size[0]>u.size[1]?u.size[0]:u.size[1])+c)/2:sn(u.size)?((u.size.width>u.size.height?u.size.width:u.size.height)+c)/2:(u.size+c)/2:32+c/2};else if(Et(n))s=u=>{const c=n(u),h=o(u);return Aa(u.size)?((u.size[0]>u.size[1]?u.size[0]:u.size[1])+h)/2:((c||32)+h)/2};else if(Aa(n)){const c=(n[0]>n[1]?n[0]:n[1])/2;s=h=>c+o(h)/2}else{const u=n/2;s=c=>u+o(c)/2}e.nodeSize=s;let l;return bt(a)?l=()=>a:Aa(a)?l=()=>Math.max.apply(null,a):Et(a)?l=a:l=()=>0,e.comboPadding=l,e}getInnerGraphs(t,e,n,i,a,s,o){const{nodeSize:l,comboPadding:u,spacing:c,innerLayout:h}=s,d=h||new Qw({}),g={center:[0,0],preventOverlap:!0,nodeSpacing:c},p=[],v=m=>{let b=(u==null?void 0:u(m))||10;return Aa(b)&&(b=Math.max(...b)),{size:b?[b*2,b*2]:[30,30],padding:b}};return t.getRoots(e).forEach(m=>{o.set(m.id,{id:m.id,data:{nodes:[],size:v(m).size}});let b=Promise.resolve();Zw(t,[m],w=>{var x;if(!w.data._isCombo)return;const{size:S,padding:_}=v(w);if(!(!((x=t.getChildren(w.id,e))===null||x===void 0)&&x.length))o.set(w.id,{id:w.id,data:Object.assign(Object.assign({},w.data),{size:S})});else{const M=o.get(w.id);o.set(w.id,{id:w.id,data:Object.assign({nodes:[]},M==null?void 0:M.data)});const k=new Map,C=t.getChildren(w.id,e).map(A=>{if(A.data._isCombo)return o.has(A.id)||o.set(A.id,{id:A.id,data:Object.assign({},A.data)}),k.set(A.id,!0),o.get(A.id);const R=n.get(A.id)||i.get(A.id);return k.set(A.id,!0),{id:A.id,data:Object.assign(Object.assign({},R.data),A.data)}}),P={nodes:C,edges:a.filter(A=>k.has(A.source)&&k.has(A.target))};let T=1/0;C.forEach(A=>{var R;let{size:L}=A.data;L||(L=((R=o.get(A.id))===null||R===void 0?void 0:R.data.size)||(l==null?void 0:l(A))||[30,30]),bt(L)&&(L=[L,L]);const[$,q]=L;T>$&&(T=$),T>q&&(T=q),A.data.size=L}),b=b.then(()=>Ht(this,void 0,void 0,function*(){const A=new Mn(P);yield $k(d,A,g,!0);const{minX:R,minY:L,maxX:$,maxY:q}=cet(C),j={x:($+R)/2,y:(q+L)/2};P.nodes.forEach(D=>{D.data.x-=j.x,D.data.y-=j.y});const B=[Math.max($-R,T)+_*2,Math.max(q-L,T)+_*2];o.get(w.id).data.size=B,o.get(w.id).data.nodes=C}))}return!0},"BT",e),p.push(b)}),p}}function $k(r,t,e,n){var i;return Ht(this,void 0,void 0,function*(){return nx(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 grt(r,t){var e,n=1;r==null&&(r=0),t==null&&(t=0);function i(){var a,s=e.length,o,l=0,u=0;for(a=0;a<s;++a)o=e[a],l+=o.x,u+=o.y;for(l=(l/s-r)*n,u=(u/s-t)*n,a=0;a<s;++a)o=e[a],o.x-=l,o.y-=u}return i.initialize=function(a){e=a},i.x=function(a){return arguments.length?(r=+a,i):r},i.y=function(a){return arguments.length?(t=+a,i):t},i.strength=function(a){return arguments.length?(n=+a,i):n},i}function En(r){return function(){return r}}function Ts(r){return(r()-.5)*1e-6}function prt(r){return r.x+r.vx}function vrt(r){return r.y+r.vy}function mrt(r){var t,e,n,i=1,a=1;typeof r!="function"&&(r=En(r==null?1:+r));function s(){for(var u,c=t.length,h,d,g,p,v,m,b=0;b<a;++b)for(h=F0(t,prt,vrt).visitAfter(o),u=0;u<c;++u)d=t[u],v=e[d.index],m=v*v,g=d.x+d.vx,p=d.y+d.vy,h.visit(w);function w(x,S,_,M,k){var C=x.data,P=x.r,T=v+P;if(C){if(C.index>d.index){var A=g-C.x-C.vx,R=p-C.y-C.vy,L=A*A+R*R;L<T*T&&(A===0&&(A=Ts(n),L+=A*A),R===0&&(R=Ts(n),L+=R*R),L=(T-(L=Math.sqrt(L)))/L*i,d.vx+=(A*=L)*(T=(P*=P)/(m+P)),d.vy+=(R*=L)*T,C.vx-=A*(T=1-T),C.vy-=R*T)}return}return S>g+T||M<g-T||_>p+T||k<p-T}}function o(u){if(u.data)return u.r=e[u.data.index];for(var c=u.r=0;c<4;++c)u[c]&&u[c].r>u.r&&(u.r=u[c].r)}function l(){if(t){var u,c=t.length,h;for(e=new Array(c),u=0;u<c;++u)h=t[u],e[h.index]=+r(h,u,t)}}return s.initialize=function(u,c){t=u,n=c,l()},s.iterations=function(u){return arguments.length?(a=+u,s):a},s.strength=function(u){return arguments.length?(i=+u,s):i},s.radius=function(u){return arguments.length?(r=typeof u=="function"?u:En(+u),l(),s):r},s}function yrt(r){return r.index}function jk(r,t){var e=r.get(t);if(!e)throw new Error("node not found: "+t);return e}function brt(r){var t=yrt,e=h,n,i=En(30),a,s,o,l,u,c=1;r==null&&(r=[]);function h(m){return 1/Math.min(o[m.source.index],o[m.target.index])}function d(m){for(var b=0,w=r.length;b<c;++b)for(var x=0,S,_,M,k,C,P,T;x<w;++x)S=r[x],_=S.source,M=S.target,k=M.x+M.vx-_.x-_.vx||Ts(u),C=M.y+M.vy-_.y-_.vy||Ts(u),P=Math.sqrt(k*k+C*C),P=(P-a[x])/P*m*n[x],k*=P,C*=P,M.vx-=k*(T=l[x]),M.vy-=C*T,_.vx+=k*(T=1-T),_.vy+=C*T}function g(){if(s){var m,b=s.length,w=r.length,x=new Map(s.map((_,M)=>[t(_,M,s),_])),S;for(m=0,o=new Array(b);m<w;++m)S=r[m],S.index=m,typeof S.source!="object"&&(S.source=jk(x,S.source)),typeof S.target!="object"&&(S.target=jk(x,S.target)),o[S.source.index]=(o[S.source.index]||0)+1,o[S.target.index]=(o[S.target.index]||0)+1;for(m=0,l=new Array(w);m<w;++m)S=r[m],l[m]=o[S.source.index]/(o[S.source.index]+o[S.target.index]);n=new Array(w),p(),a=new Array(w),v()}}function p(){if(s)for(var m=0,b=r.length;m<b;++m)n[m]=+e(r[m],m,r)}function v(){if(s)for(var m=0,b=r.length;m<b;++m)a[m]=+i(r[m],m,r)}return d.initialize=function(m,b){s=m,u=b,g()},d.links=function(m){return arguments.length?(r=m,g(),d):r},d.id=function(m){return arguments.length?(t=m,d):t},d.iterations=function(m){return arguments.length?(c=+m,d):c},d.strength=function(m){return arguments.length?(e=typeof m=="function"?m:En(+m),p(),d):e},d.distance=function(m){return arguments.length?(i=typeof m=="function"?m:En(+m),v(),d):i},d}var wrt={value:()=>{}};function F6(){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 af(e)}function af(r){this._=r}function xrt(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}})}af.prototype=F6.prototype={constructor:af,on:function(r,t){var e=this._,n=xrt(r+"",e),i,a=-1,s=n.length;if(arguments.length<2){for(;++a<s;)if((i=(r=n[a]).type)&&(i=Ert(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]=qk(e[i],r.name,t);else if(t==null)for(i in e)e[i]=qk(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 af(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 Ert(r,t){for(var e=0,n=r.length,i;e<n;++e)if((i=r[e]).name===t)return i.value}function qk(r,t,e){for(var n=0,i=r.length;n<i;++n)if(r[n].name===t){r[n]=wrt,r=r.slice(0,n).concat(r.slice(n+1));break}return e!=null&&r.push({name:t,value:e}),r}var Yl=0,qu=0,Pu=0,B6=1e3,zf,Wu,$f=0,$o=0,j0=0,Ec=typeof performance=="object"&&performance.now?performance:Date,z6=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(r){setTimeout(r,17)};function $6(){return $o||(z6(_rt),$o=Ec.now()+j0)}function _rt(){$o=0}function rx(){this._call=this._time=this._next=null}rx.prototype=j6.prototype={constructor:rx,restart:function(r,t,e){if(typeof r!="function")throw new TypeError("callback is not a function");e=(e==null?$6():+e)+(t==null?0:+t),!this._next&&Wu!==this&&(Wu?Wu._next=this:zf=this,Wu=this),this._call=r,this._time=e,ix()},stop:function(){this._call&&(this._call=null,this._time=1/0,ix())}};function j6(r,t,e){var n=new rx;return n.restart(r,t,e),n}function Srt(){$6(),++Yl;for(var r=zf,t;r;)(t=$o-r._time)>=0&&r._call.call(void 0,t),r=r._next;--Yl}function Wk(){$o=($f=Ec.now())+j0,Yl=qu=0;try{Srt()}finally{Yl=0,krt(),$o=0}}function Mrt(){var r=Ec.now(),t=r-$f;t>B6&&(j0-=t,$f=r)}function krt(){for(var r,t=zf,e,n=1/0;t;)t._call?(n>t._time&&(n=t._time),r=t,t=t._next):(e=t._next,t._next=null,t=r?r._next=e:zf=e);Wu=r,ix(n)}function ix(r){if(!Yl){qu&&(qu=clearTimeout(qu));var t=r-$o;t>24?(r<1/0&&(qu=setTimeout(Wk,r-Ec.now()-j0)),Pu&&(Pu=clearInterval(Pu))):(Pu||($f=Ec.now(),Pu=setInterval(Mrt,B6)),Yl=1,z6(Wk))}}const Crt=1664525,Trt=1013904223,Gk=4294967296;function Ort(){let r=1;return()=>(r=(Crt*r+Trt)%Gk)/Gk}function Art(r){return r.x}function Prt(r){return r.y}var Nrt=10,Rrt=Math.PI*(3-Math.sqrt(5));function Lrt(r){var t,e=1,n=.001,i=1-Math.pow(n,1/300),a=0,s=.6,o=new Map,l=j6(h),u=F6("tick","end"),c=Ort();r==null&&(r=[]);function h(){d(),u.call("tick",t),e<n&&(l.stop(),u.call("end",t))}function d(v){var m,b=r.length,w;v===void 0&&(v=1);for(var x=0;x<v;++x)for(e+=(a-e)*i,o.forEach(function(S){S(e)}),m=0;m<b;++m)w=r[m],w.fx==null?w.x+=w.vx*=s:(w.x=w.fx,w.vx=0),w.fy==null?w.y+=w.vy*=s:(w.y=w.fy,w.vy=0);return t}function g(){for(var v=0,m=r.length,b;v<m;++v){if(b=r[v],b.index=v,b.fx!=null&&(b.x=b.fx),b.fy!=null&&(b.y=b.fy),isNaN(b.x)||isNaN(b.y)){var w=Nrt*Math.sqrt(.5+v),x=v*Rrt;b.x=w*Math.cos(x),b.y=w*Math.sin(x)}(isNaN(b.vx)||isNaN(b.vy))&&(b.vx=b.vy=0)}}function p(v){return v.initialize&&v.initialize(r,c),v}return g(),t={tick:d,restart:function(){return l.restart(h),t},stop:function(){return l.stop(),t},nodes:function(v){return arguments.length?(r=v,g(),o.forEach(p),t):r},alpha:function(v){return arguments.length?(e=+v,t):e},alphaMin:function(v){return arguments.length?(n=+v,t):n},alphaDecay:function(v){return arguments.length?(i=+v,t):+i},alphaTarget:function(v){return arguments.length?(a=+v,t):a},velocityDecay:function(v){return arguments.length?(s=1-v,t):1-s},randomSource:function(v){return arguments.length?(c=v,o.forEach(p),t):c},force:function(v,m){return arguments.length>1?(m==null?o.delete(v):o.set(v,p(m)),t):o.get(v)},find:function(v,m,b){var w=0,x=r.length,S,_,M,k,C;for(b==null?b=1/0:b*=b,w=0;w<x;++w)k=r[w],S=v-k.x,_=m-k.y,M=S*S+_*_,M<b&&(C=k,b=M);return C},on:function(v,m){return arguments.length>1?(u.on(v,m),t):u.on(v)}}}function Irt(){var r,t,e,n,i=En(-30),a,s=1,o=1/0,l=.81;function u(g){var p,v=r.length,m=F0(r,Art,Prt).visitAfter(h);for(n=g,p=0;p<v;++p)t=r[p],m.visit(d)}function c(){if(r){var g,p=r.length,v;for(a=new Array(p),g=0;g<p;++g)v=r[g],a[v.index]=+i(v,g,r)}}function h(g){var p=0,v,m,b=0,w,x,S;if(g.length){for(w=x=S=0;S<4;++S)(v=g[S])&&(m=Math.abs(v.value))&&(p+=v.value,b+=m,w+=m*v.x,x+=m*v.y);g.x=w/b,g.y=x/b}else{v=g,v.x=v.data.x,v.y=v.data.y;do p+=a[v.data.index];while(v=v.next)}g.value=p}function d(g,p,v,m){if(!g.value)return!0;var b=g.x-t.x,w=g.y-t.y,x=m-p,S=b*b+w*w;if(x*x/l<S)return S<o&&(b===0&&(b=Ts(e),S+=b*b),w===0&&(w=Ts(e),S+=w*w),S<s&&(S=Math.sqrt(s*S)),t.vx+=b*g.value*n/S,t.vy+=w*g.value*n/S),!0;if(g.length||S>=o)return;(g.data!==t||g.next)&&(b===0&&(b=Ts(e),S+=b*b),w===0&&(w=Ts(e),S+=w*w),S<s&&(S=Math.sqrt(s*S)));do g.data!==t&&(x=a[g.data.index]*n/S,t.vx+=b*x,t.vy+=w*x);while(g=g.next)}return u.initialize=function(g,p){r=g,e=p,c()},u.strength=function(g){return arguments.length?(i=typeof g=="function"?g:En(+g),c(),u):i},u.distanceMin=function(g){return arguments.length?(s=g*g,u):Math.sqrt(s)},u.distanceMax=function(g){return arguments.length?(o=g*g,u):Math.sqrt(o)},u.theta=function(g){return arguments.length?(l=g*g,u):Math.sqrt(l)},u}function Drt(r,t,e){var n,i=En(.1),a,s;typeof r!="function"&&(r=En(+r)),t==null&&(t=0),e==null&&(e=0);function o(u){for(var c=0,h=n.length;c<h;++c){var d=n[c],g=d.x-t||1e-6,p=d.y-e||1e-6,v=Math.sqrt(g*g+p*p),m=(s[c]-v)*a[c]*u/v;d.vx+=g*m,d.vy+=p*m}}function l(){if(n){var u,c=n.length;for(a=new Array(c),s=new Array(c),u=0;u<c;++u)s[u]=+r(n[u],u,n),a[u]=isNaN(s[u])?0:+i(n[u],u,n)}}return o.initialize=function(u){n=u,l()},o.strength=function(u){return arguments.length?(i=typeof u=="function"?u:En(+u),l(),o):i},o.radius=function(u){return arguments.length?(r=typeof u=="function"?u:En(+u),l(),o):r},o.x=function(u){return arguments.length?(t=+u,o):t},o.y=function(u){return arguments.length?(e=+u,o):e},o}function Frt(r){var t=En(.1),e,n,i;typeof r!="function"&&(r=En(r==null?0:+r));function a(o){for(var l=0,u=e.length,c;l<u;++l)c=e[l],c.vx+=(i[l]-c.x)*n[l]*o}function s(){if(e){var o,l=e.length;for(n=new Array(l),i=new Array(l),o=0;o<l;++o)n[o]=isNaN(i[o]=+r(e[o],o,e))?0:+t(e[o],o,e)}}return a.initialize=function(o){e=o,s()},a.strength=function(o){return arguments.length?(t=typeof o=="function"?o:En(+o),s(),a):t},a.x=function(o){return arguments.length?(r=typeof o=="function"?o:En(+o),s(),a):r},a}function Brt(r){var t=En(.1),e,n,i;typeof r!="function"&&(r=En(r==null?0:+r));function a(o){for(var l=0,u=e.length,c;l<u;++l)c=e[l],c.vy+=(i[l]-c.y)*n[l]*o}function s(){if(e){var o,l=e.length;for(n=new Array(l),i=new Array(l),o=0;o<l;++o)n[o]=isNaN(i[o]=+r(e[o],o,e))?0:+t(e[o],o,e)}}return a.initialize=function(o){e=o,s()},a.strength=function(o){return arguments.length?(t=typeof o=="function"?o:En(+o),s(),a):t},a.y=function(o){return arguments.length?(r=typeof o=="function"?o:En(+o),s(),a):r},a}class zrt{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:brt,manyBody:Irt,center:grt,collide:mrt,radial:Drt,x:Frt,y:Brt},this.options={link:{id:e=>e.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},cr(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericLayout(!0,t,e)})}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(t,e){const n=this.context.nodes.find(i=>i.id===t);n&&e.forEach((i,a)=>{if(typeof i=="number"||i===null){const s=["fx","fy","fz"][a];n[s]=i}})}getOptions(t){var e,n;const i=cr({},this.options,t);return i.collide&&((e=i.collide)===null||e===void 0?void 0:e.radius)===void 0&&(i.collide=i.collide||{},i.collide.radius=(n=i.nodeSize)!==null&&n!==void 0?n:10),i.iterations===void 0&&(i.link&&i.link.iterations===void 0&&(i.iterations=i.link.iterations),i.collide&&i.collide.iterations===void 0&&(i.iterations=i.collide.iterations)),this.context.options=i,i}genericLayout(t,e,n){var i;return Ht(this,void 0,void 0,function*(){const a=this.getOptions(n),s=e.getAllNodes().map(({id:c,data:h})=>Object.assign(Object.assign({id:c},h),Ro(h.data,this.config.inputNodeAttrs))),o=e.getAllEdges().map(c=>Object.assign({},c));Object.assign(this.context,{assign:t,nodes:s,edges:o,graph:e});const l=new Promise(c=>{this.resolver=c}),u=this.setSimulation(a);return u.nodes(s),(i=u.force("link"))===null||i===void 0||i.links(o),l})}getResult(){const{assign:t,nodes:e,edges:n,graph:i}=this.context,a=e.map(o=>({id:o.id,data:Object.assign(Object.assign({},o.data),Ro(o,this.config.outputNodeAttrs))})),s=n.map(({id:o,source:l,target:u,data:c})=>({id:o,source:typeof l=="object"?l.id:l,target:typeof u=="object"?u.id:u,data:c}));return t&&a.forEach(o=>i.mergeNodeData(o.id,o.data)),{nodes:a,edges:s}}initSimulation(){return Lrt()}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())})),Vk(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)),Vk(s,Object.entries(t[a]))}else e.force(a,null)}),e}}const Vk=(r,t)=>t.reduce((e,[n,i])=>!e[n]||i===void 0?e:e[n].call(r,i),r);var Kv,Hk;function $rt(){if(Hk)return Kv;Hk=1;function r(){this.__data__=[],this.size=0}return Kv=r,Kv}var Zv,Uk;function eu(){if(Uk)return Zv;Uk=1;function r(t,e){return t===e||t!==t&&e!==e}return Zv=r,Zv}var Jv,Yk;function q0(){if(Yk)return Jv;Yk=1;var r=eu();function t(e,n){for(var i=e.length;i--;)if(r(e[i][0],n))return i;return-1}return Jv=t,Jv}var Qv,Xk;function jrt(){if(Xk)return Qv;Xk=1;var r=q0(),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 Qv=n,Qv}var tm,Kk;function qrt(){if(Kk)return tm;Kk=1;var r=q0();function t(e){var n=this.__data__,i=r(n,e);return i<0?void 0:n[i][1]}return tm=t,tm}var em,Zk;function Wrt(){if(Zk)return em;Zk=1;var r=q0();function t(e){return r(this.__data__,e)>-1}return em=t,em}var nm,Jk;function Grt(){if(Jk)return nm;Jk=1;var r=q0();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 nm=t,nm}var rm,Qk;function W0(){if(Qk)return rm;Qk=1;var r=$rt(),t=jrt(),e=qrt(),n=Wrt(),i=Grt();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=e,a.prototype.has=n,a.prototype.set=i,rm=a,rm}var im,tC;function Vrt(){if(tC)return im;tC=1;var r=W0();function t(){this.__data__=new r,this.size=0}return im=t,im}var am,eC;function Hrt(){if(eC)return am;eC=1;function r(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}return am=r,am}var sm,nC;function Urt(){if(nC)return sm;nC=1;function r(t){return this.__data__.get(t)}return sm=r,sm}var om,rC;function Yrt(){if(rC)return om;rC=1;function r(t){return this.__data__.has(t)}return om=r,om}var lm,iC;function q6(){if(iC)return lm;iC=1;var r=typeof ka=="object"&&ka&&ka.Object===Object&&ka;return lm=r,lm}var um,aC;function Fi(){if(aC)return um;aC=1;var r=q6(),t=typeof self=="object"&&self&&self.Object===Object&&self,e=r||t||Function("return this")();return um=e,um}var cm,sC;function nu(){if(sC)return cm;sC=1;var r=Fi(),t=r.Symbol;return cm=t,cm}var hm,oC;function Xrt(){if(oC)return hm;oC=1;var r=nu(),t=Object.prototype,e=t.hasOwnProperty,n=t.toString,i=r?r.toStringTag:void 0;function a(s){var o=e.call(s,i),l=s[i];try{s[i]=void 0;var u=!0}catch{}var c=n.call(s);return u&&(o?s[i]=l:delete s[i]),c}return hm=a,hm}var dm,lC;function Krt(){if(lC)return dm;lC=1;var r=Object.prototype,t=r.toString;function e(n){return t.call(n)}return dm=e,dm}var fm,uC;function Yo(){if(uC)return fm;uC=1;var r=nu(),t=Xrt(),e=Krt(),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 fm=s,fm}var gm,cC;function mi(){if(cC)return gm;cC=1;function r(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}return gm=r,gm}var pm,hC;function Hc(){if(hC)return pm;hC=1;var r=Yo(),t=mi(),e="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function s(o){if(!t(o))return!1;var l=r(o);return l==n||l==i||l==e||l==a}return pm=s,pm}var vm,dC;function Zrt(){if(dC)return vm;dC=1;var r=Fi(),t=r["__core-js_shared__"];return vm=t,vm}var mm,fC;function Jrt(){if(fC)return mm;fC=1;var r=Zrt(),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 mm=e,mm}var ym,gC;function W6(){if(gC)return ym;gC=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 ym=e,ym}var bm,pC;function Qrt(){if(pC)return bm;pC=1;var r=Hc(),t=Jrt(),e=mi(),n=W6(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,l=s.toString,u=o.hasOwnProperty,c=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function h(d){if(!e(d)||t(d))return!1;var g=r(d)?c:a;return g.test(n(d))}return bm=h,bm}var wm,vC;function tit(){if(vC)return wm;vC=1;function r(t,e){return t==null?void 0:t[e]}return wm=r,wm}var xm,mC;function Xo(){if(mC)return xm;mC=1;var r=Qrt(),t=tit();function e(n,i){var a=t(n,i);return r(a)?a:void 0}return xm=e,xm}var Em,yC;function yE(){if(yC)return Em;yC=1;var r=Xo(),t=Fi(),e=r(t,"Map");return Em=e,Em}var _m,bC;function G0(){if(bC)return _m;bC=1;var r=Xo(),t=r(Object,"create");return _m=t,_m}var Sm,wC;function eit(){if(wC)return Sm;wC=1;var r=G0();function t(){this.__data__=r?r(null):{},this.size=0}return Sm=t,Sm}var Mm,xC;function nit(){if(xC)return Mm;xC=1;function r(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}return Mm=r,Mm}var km,EC;function rit(){if(EC)return km;EC=1;var r=G0(),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 km=i,km}var Cm,_C;function iit(){if(_C)return Cm;_C=1;var r=G0(),t=Object.prototype,e=t.hasOwnProperty;function n(i){var a=this.__data__;return r?a[i]!==void 0:e.call(a,i)}return Cm=n,Cm}var Tm,SC;function ait(){if(SC)return Tm;SC=1;var r=G0(),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 Tm=e,Tm}var Om,MC;function sit(){if(MC)return Om;MC=1;var r=eit(),t=nit(),e=rit(),n=iit(),i=ait();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=e,a.prototype.has=n,a.prototype.set=i,Om=a,Om}var Am,kC;function oit(){if(kC)return Am;kC=1;var r=sit(),t=W0(),e=yE();function n(){this.size=0,this.__data__={hash:new r,map:new(e||t),string:new r}}return Am=n,Am}var Pm,CC;function lit(){if(CC)return Pm;CC=1;function r(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}return Pm=r,Pm}var Nm,TC;function V0(){if(TC)return Nm;TC=1;var r=lit();function t(e,n){var i=e.__data__;return r(n)?i[typeof n=="string"?"string":"hash"]:i.map}return Nm=t,Nm}var Rm,OC;function uit(){if(OC)return Rm;OC=1;var r=V0();function t(e){var n=r(this,e).delete(e);return this.size-=n?1:0,n}return Rm=t,Rm}var Lm,AC;function cit(){if(AC)return Lm;AC=1;var r=V0();function t(e){return r(this,e).get(e)}return Lm=t,Lm}var Im,PC;function hit(){if(PC)return Im;PC=1;var r=V0();function t(e){return r(this,e).has(e)}return Im=t,Im}var Dm,NC;function dit(){if(NC)return Dm;NC=1;var r=V0();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 Dm=t,Dm}var Fm,RC;function bE(){if(RC)return Fm;RC=1;var r=oit(),t=uit(),e=cit(),n=hit(),i=dit();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=r,a.prototype.delete=t,a.prototype.get=e,a.prototype.has=n,a.prototype.set=i,Fm=a,Fm}var Bm,LC;function fit(){if(LC)return Bm;LC=1;var r=W0(),t=yE(),e=bE(),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 Bm=i,Bm}var zm,IC;function H0(){if(IC)return zm;IC=1;var r=W0(),t=Vrt(),e=Hrt(),n=Urt(),i=Yrt(),a=fit();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,zm=s,zm}var $m,DC;function wE(){if(DC)return $m;DC=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 $m=r,$m}var jm,FC;function G6(){if(FC)return jm;FC=1;var r=Xo(),t=function(){try{var e=r(Object,"defineProperty");return e({},"",{}),e}catch{}}();return jm=t,jm}var qm,BC;function U0(){if(BC)return qm;BC=1;var r=G6();function t(e,n,i){n=="__proto__"&&r?r(e,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[n]=i}return qm=t,qm}var Wm,zC;function Y0(){if(zC)return Wm;zC=1;var r=U0(),t=eu(),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 Wm=i,Wm}var Gm,$C;function Uc(){if($C)return Gm;$C=1;var r=Y0(),t=U0();function e(n,i,a,s){var o=!a;a||(a={});for(var l=-1,u=i.length;++l<u;){var c=i[l],h=s?s(a[c],n[c],c,a,n):void 0;h===void 0&&(h=n[c]),o?t(a,c,h):r(a,c,h)}return a}return Gm=e,Gm}var Vm,jC;function git(){if(jC)return Vm;jC=1;function r(t,e){for(var n=-1,i=Array(t);++n<t;)i[n]=e(n);return i}return Vm=r,Vm}var Hm,qC;function ha(){if(qC)return Hm;qC=1;function r(t){return t!=null&&typeof t=="object"}return Hm=r,Hm}var Um,WC;function pit(){if(WC)return Um;WC=1;var r=Yo(),t=ha(),e="[object Arguments]";function n(i){return t(i)&&r(i)==e}return Um=n,Um}var Ym,GC;function Yc(){if(GC)return Ym;GC=1;var r=pit(),t=ha(),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 Ym=a,Ym}var Xm,VC;function vn(){if(VC)return Xm;VC=1;var r=Array.isArray;return Xm=r,Xm}var Gu={exports:{}},Km,HC;function vit(){if(HC)return Km;HC=1;function r(){return!1}return Km=r,Km}Gu.exports;var UC;function ru(){return UC||(UC=1,function(r,t){var e=Fi(),n=vit(),i=t&&!t.nodeType&&t,a=i&&!0&&r&&!r.nodeType&&r,s=a&&a.exports===i,o=s?e.Buffer:void 0,l=o?o.isBuffer:void 0,u=l||n;r.exports=u}(Gu,Gu.exports)),Gu.exports}var Zm,YC;function X0(){if(YC)return Zm;YC=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 Zm=e,Zm}var Jm,XC;function xE(){if(XC)return Jm;XC=1;var r=9007199254740991;function t(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=r}return Jm=t,Jm}var Qm,KC;function mit(){if(KC)return Qm;KC=1;var r=Yo(),t=xE(),e=ha(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",s="[object Date]",o="[object Error]",l="[object Function]",u="[object Map]",c="[object Number]",h="[object Object]",d="[object RegExp]",g="[object Set]",p="[object String]",v="[object WeakMap]",m="[object ArrayBuffer]",b="[object DataView]",w="[object Float32Array]",x="[object Float64Array]",S="[object Int8Array]",_="[object Int16Array]",M="[object Int32Array]",k="[object Uint8Array]",C="[object Uint8ClampedArray]",P="[object Uint16Array]",T="[object Uint32Array]",A={};A[w]=A[x]=A[S]=A[_]=A[M]=A[k]=A[C]=A[P]=A[T]=!0,A[n]=A[i]=A[m]=A[a]=A[b]=A[s]=A[o]=A[l]=A[u]=A[c]=A[h]=A[d]=A[g]=A[p]=A[v]=!1;function R(L){return e(L)&&t(L.length)&&!!A[r(L)]}return Qm=R,Qm}var ty,ZC;function K0(){if(ZC)return ty;ZC=1;function r(t){return function(e){return t(e)}}return ty=r,ty}var Vu={exports:{}};Vu.exports;var JC;function EE(){return JC||(JC=1,function(r,t){var e=q6(),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}(Vu,Vu.exports)),Vu.exports}var ey,QC;function Xc(){if(QC)return ey;QC=1;var r=mit(),t=K0(),e=EE(),n=e&&e.isTypedArray,i=n?t(n):r;return ey=i,ey}var ny,tT;function V6(){if(tT)return ny;tT=1;var r=git(),t=Yc(),e=vn(),n=ru(),i=X0(),a=Xc(),s=Object.prototype,o=s.hasOwnProperty;function l(u,c){var h=e(u),d=!h&&t(u),g=!h&&!d&&n(u),p=!h&&!d&&!g&&a(u),v=h||d||g||p,m=v?r(u.length,String):[],b=m.length;for(var w in u)(c||o.call(u,w))&&!(v&&(w=="length"||g&&(w=="offset"||w=="parent")||p&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||i(w,b)))&&m.push(w);return m}return ny=l,ny}var ry,eT;function Z0(){if(eT)return ry;eT=1;var r=Object.prototype;function t(e){var n=e&&e.constructor,i=typeof n=="function"&&n.prototype||r;return e===i}return ry=t,ry}var iy,nT;function H6(){if(nT)return iy;nT=1;function r(t,e){return function(n){return t(e(n))}}return iy=r,iy}var ay,rT;function yit(){if(rT)return ay;rT=1;var r=H6(),t=r(Object.keys,Object);return ay=t,ay}var sy,iT;function _E(){if(iT)return sy;iT=1;var r=Z0(),t=yit(),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 sy=i,sy}var oy,aT;function Xa(){if(aT)return oy;aT=1;var r=Hc(),t=xE();function e(n){return n!=null&&t(n.length)&&!r(n)}return oy=e,oy}var ly,sT;function Js(){if(sT)return ly;sT=1;var r=V6(),t=_E(),e=Xa();function n(i){return e(i)?r(i):t(i)}return ly=n,ly}var uy,oT;function bit(){if(oT)return uy;oT=1;var r=Uc(),t=Js();function e(n,i){return n&&r(i,t(i),n)}return uy=e,uy}var cy,lT;function wit(){if(lT)return cy;lT=1;function r(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}return cy=r,cy}var hy,uT;function xit(){if(uT)return hy;uT=1;var r=mi(),t=Z0(),e=wit(),n=Object.prototype,i=n.hasOwnProperty;function a(s){if(!r(s))return e(s);var o=t(s),l=[];for(var u in s)u=="constructor"&&(o||!i.call(s,u))||l.push(u);return l}return hy=a,hy}var dy,cT;function Ko(){if(cT)return dy;cT=1;var r=V6(),t=xit(),e=Xa();function n(i){return e(i)?r(i,!0):t(i)}return dy=n,dy}var fy,hT;function Eit(){if(hT)return fy;hT=1;var r=Uc(),t=Ko();function e(n,i){return n&&r(i,t(i),n)}return fy=e,fy}var Hu={exports:{}};Hu.exports;var dT;function U6(){return dT||(dT=1,function(r,t){var e=Fi(),n=t&&!t.nodeType&&t,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,s=a?e.Buffer:void 0,o=s?s.allocUnsafe:void 0;function l(u,c){if(c)return u.slice();var h=u.length,d=o?o(h):new u.constructor(h);return u.copy(d),d}r.exports=l}(Hu,Hu.exports)),Hu.exports}var gy,fT;function Y6(){if(fT)return gy;fT=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 gy=r,gy}var py,gT;function X6(){if(gT)return py;gT=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 py=r,py}var vy,pT;function K6(){if(pT)return vy;pT=1;function r(){return[]}return vy=r,vy}var my,vT;function SE(){if(vT)return my;vT=1;var r=X6(),t=K6(),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 my=a,my}var yy,mT;function _it(){if(mT)return yy;mT=1;var r=Uc(),t=SE();function e(n,i){return r(n,t(n),i)}return yy=e,yy}var by,yT;function ME(){if(yT)return by;yT=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 by=r,by}var wy,bT;function J0(){if(bT)return wy;bT=1;var r=H6(),t=r(Object.getPrototypeOf,Object);return wy=t,wy}var xy,wT;function Z6(){if(wT)return xy;wT=1;var r=ME(),t=J0(),e=SE(),n=K6(),i=Object.getOwnPropertySymbols,a=i?function(s){for(var o=[];s;)r(o,e(s)),s=t(s);return o}:n;return xy=a,xy}var Ey,xT;function Sit(){if(xT)return Ey;xT=1;var r=Uc(),t=Z6();function e(n,i){return r(n,t(n),i)}return Ey=e,Ey}var _y,ET;function J6(){if(ET)return _y;ET=1;var r=ME(),t=vn();function e(n,i,a){var s=i(n);return t(n)?s:r(s,a(n))}return _y=e,_y}var Sy,_T;function Q6(){if(_T)return Sy;_T=1;var r=J6(),t=SE(),e=Js();function n(i){return r(i,e,t)}return Sy=n,Sy}var My,ST;function Mit(){if(ST)return My;ST=1;var r=J6(),t=Z6(),e=Ko();function n(i){return r(i,e,t)}return My=n,My}var ky,MT;function kit(){if(MT)return ky;MT=1;var r=Xo(),t=Fi(),e=r(t,"DataView");return ky=e,ky}var Cy,kT;function Cit(){if(kT)return Cy;kT=1;var r=Xo(),t=Fi(),e=r(t,"Promise");return Cy=e,Cy}var Ty,CT;function tD(){if(CT)return Ty;CT=1;var r=Xo(),t=Fi(),e=r(t,"Set");return Ty=e,Ty}var Oy,TT;function Tit(){if(TT)return Oy;TT=1;var r=Xo(),t=Fi(),e=r(t,"WeakMap");return Oy=e,Oy}var Ay,OT;function iu(){if(OT)return Ay;OT=1;var r=kit(),t=yE(),e=Cit(),n=tD(),i=Tit(),a=Yo(),s=W6(),o="[object Map]",l="[object Object]",u="[object Promise]",c="[object Set]",h="[object WeakMap]",d="[object DataView]",g=s(r),p=s(t),v=s(e),m=s(n),b=s(i),w=a;return(r&&w(new r(new ArrayBuffer(1)))!=d||t&&w(new t)!=o||e&&w(e.resolve())!=u||n&&w(new n)!=c||i&&w(new i)!=h)&&(w=function(x){var S=a(x),_=S==l?x.constructor:void 0,M=_?s(_):"";if(M)switch(M){case g:return d;case p:return o;case v:return u;case m:return c;case b:return h}return S}),Ay=w,Ay}var Py,AT;function Oit(){if(AT)return Py;AT=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 Py=e,Py}var Ny,PT;function eD(){if(PT)return Ny;PT=1;var r=Fi(),t=r.Uint8Array;return Ny=t,Ny}var Ry,NT;function kE(){if(NT)return Ry;NT=1;var r=eD();function t(e){var n=new e.constructor(e.byteLength);return new r(n).set(new r(e)),n}return Ry=t,Ry}var Ly,RT;function Ait(){if(RT)return Ly;RT=1;var r=kE();function t(e,n){var i=n?r(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}return Ly=t,Ly}var Iy,LT;function Pit(){if(LT)return Iy;LT=1;var r=/\w*$/;function t(e){var n=new e.constructor(e.source,r.exec(e));return n.lastIndex=e.lastIndex,n}return Iy=t,Iy}var Dy,IT;function Nit(){if(IT)return Dy;IT=1;var r=nu(),t=r?r.prototype:void 0,e=t?t.valueOf:void 0;function n(i){return e?Object(e.call(i)):{}}return Dy=n,Dy}var Fy,DT;function nD(){if(DT)return Fy;DT=1;var r=kE();function t(e,n){var i=n?r(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}return Fy=t,Fy}var By,FT;function Rit(){if(FT)return By;FT=1;var r=kE(),t=Ait(),e=Pit(),n=Nit(),i=nD(),a="[object Boolean]",s="[object Date]",o="[object Map]",l="[object Number]",u="[object RegExp]",c="[object Set]",h="[object String]",d="[object Symbol]",g="[object ArrayBuffer]",p="[object DataView]",v="[object Float32Array]",m="[object Float64Array]",b="[object Int8Array]",w="[object Int16Array]",x="[object Int32Array]",S="[object Uint8Array]",_="[object Uint8ClampedArray]",M="[object Uint16Array]",k="[object Uint32Array]";function C(P,T,A){var R=P.constructor;switch(T){case g:return r(P);case a:case s:return new R(+P);case p:return t(P,A);case v:case m:case b:case w:case x:case S:case _:case M:case k:return i(P,A);case o:return new R;case l:case h:return new R(P);case u:return e(P);case c:return new R;case d:return n(P)}}return By=C,By}var zy,BT;function rD(){if(BT)return zy;BT=1;var r=mi(),t=Object.create,e=function(){function n(){}return function(i){if(!r(i))return{};if(t)return t(i);n.prototype=i;var a=new n;return n.prototype=void 0,a}}();return zy=e,zy}var $y,zT;function iD(){if(zT)return $y;zT=1;var r=rD(),t=J0(),e=Z0();function n(i){return typeof i.constructor=="function"&&!e(i)?r(t(i)):{}}return $y=n,$y}var jy,$T;function Lit(){if($T)return jy;$T=1;var r=iu(),t=ha(),e="[object Map]";function n(i){return t(i)&&r(i)==e}return jy=n,jy}var qy,jT;function Iit(){if(jT)return qy;jT=1;var r=Lit(),t=K0(),e=EE(),n=e&&e.isMap,i=n?t(n):r;return qy=i,qy}var Wy,qT;function Dit(){if(qT)return Wy;qT=1;var r=iu(),t=ha(),e="[object Set]";function n(i){return t(i)&&r(i)==e}return Wy=n,Wy}var Gy,WT;function Fit(){if(WT)return Gy;WT=1;var r=Dit(),t=K0(),e=EE(),n=e&&e.isSet,i=n?t(n):r;return Gy=i,Gy}var Vy,GT;function aD(){if(GT)return Vy;GT=1;var r=H0(),t=wE(),e=Y0(),n=bit(),i=Eit(),a=U6(),s=Y6(),o=_it(),l=Sit(),u=Q6(),c=Mit(),h=iu(),d=Oit(),g=Rit(),p=iD(),v=vn(),m=ru(),b=Iit(),w=mi(),x=Fit(),S=Js(),_=Ko(),M=1,k=2,C=4,P="[object Arguments]",T="[object Array]",A="[object Boolean]",R="[object Date]",L="[object Error]",$="[object Function]",q="[object GeneratorFunction]",j="[object Map]",B="[object Number]",D="[object Object]",G="[object RegExp]",X="[object Set]",K="[object String]",ht="[object Symbol]",ut="[object WeakMap]",ct="[object ArrayBuffer]",dt="[object DataView]",pt="[object Float32Array]",mt="[object Float64Array]",It="[object Int8Array]",zt="[object Int16Array]",Te="[object Int32Array]",Rn="[object Uint8Array]",ln="[object Uint8ClampedArray]",dr="[object Uint16Array]",Ln="[object Uint32Array]",te={};te[P]=te[T]=te[ct]=te[dt]=te[A]=te[R]=te[pt]=te[mt]=te[It]=te[zt]=te[Te]=te[j]=te[B]=te[D]=te[G]=te[X]=te[K]=te[ht]=te[Rn]=te[ln]=te[dr]=te[Ln]=!0,te[L]=te[$]=te[ut]=!1;function bi(Gt,Kr,Or,ji,mn,In){var Be,da=Kr&M,kn=Kr&k,wi=Kr&C;if(Or&&(Be=mn?Or(Gt,ji,mn,In):Or(Gt)),Be!==void 0)return Be;if(!w(Gt))return Gt;var qi=v(Gt);if(qi){if(Be=d(Gt),!da)return s(Gt,Be)}else{var tr=h(Gt),Ja=tr==$||tr==q;if(m(Gt))return a(Gt,da);if(tr==D||tr==P||Ja&&!mn){if(Be=kn||Ja?{}:p(Gt),!da)return kn?l(Gt,i(Be,Gt)):o(Gt,n(Be,Gt))}else{if(!te[tr])return mn?Gt:{};Be=g(Gt,tr,da)}}In||(In=new r);var Qa=In.get(Gt);if(Qa)return Qa;In.set(Gt,Be),x(Gt)?Gt.forEach(function(Zr){Be.add(bi(Zr,Kr,Or,Zr,Gt,In))}):b(Gt)&&Gt.forEach(function(Zr,xi){Be.set(xi,bi(Zr,Kr,Or,xi,Gt,In))});var uu=wi?kn?c:u:kn?_:S,Qo=qi?void 0:uu(Gt);return t(Qo||Gt,function(Zr,xi){Qo&&(xi=Zr,Zr=Gt[xi]),e(Be,xi,bi(Zr,Kr,Or,xi,Gt,In))}),Be}return Vy=bi,Vy}var Hy,VT;function Bit(){if(VT)return Hy;VT=1;var r=aD(),t=4;function e(n){return r(n,t)}return Hy=e,Hy}var Uy,HT;function CE(){if(HT)return Uy;HT=1;function r(t){return function(){return t}}return Uy=r,Uy}var Yy,UT;function zit(){if(UT)return Yy;UT=1;function r(t){return function(e,n,i){for(var a=-1,s=Object(e),o=i(e),l=o.length;l--;){var u=o[t?l:++a];if(n(s[u],u,s)===!1)break}return e}}return Yy=r,Yy}var Xy,YT;function TE(){if(YT)return Xy;YT=1;var r=zit(),t=r();return Xy=t,Xy}var Ky,XT;function OE(){if(XT)return Ky;XT=1;var r=TE(),t=Js();function e(n,i){return n&&r(n,i,t)}return Ky=e,Ky}var Zy,KT;function $it(){if(KT)return Zy;KT=1;var r=Xa();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 Zy=t,Zy}var Jy,ZT;function Q0(){if(ZT)return Jy;ZT=1;var r=OE(),t=$it(),e=t(r);return Jy=e,Jy}var Qy,JT;function Zo(){if(JT)return Qy;JT=1;function r(t){return t}return Qy=r,Qy}var t1,QT;function sD(){if(QT)return t1;QT=1;var r=Zo();function t(e){return typeof e=="function"?e:r}return t1=t,t1}var e1,tO;function oD(){if(tO)return e1;tO=1;var r=wE(),t=Q0(),e=sD(),n=vn();function i(a,s){var o=n(a)?r:t;return o(a,e(s))}return e1=i,e1}var n1,eO;function lD(){return eO||(eO=1,n1=oD()),n1}var r1,nO;function jit(){if(nO)return r1;nO=1;var r=Q0();function t(e,n){var i=[];return r(e,function(a,s,o){n(a,s,o)&&i.push(a)}),i}return r1=t,r1}var i1,rO;function qit(){if(rO)return i1;rO=1;var r="__lodash_hash_undefined__";function t(e){return this.__data__.set(e,r),this}return i1=t,i1}var a1,iO;function Wit(){if(iO)return a1;iO=1;function r(t){return this.__data__.has(t)}return a1=r,a1}var s1,aO;function uD(){if(aO)return s1;aO=1;var r=bE(),t=qit(),e=Wit();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,s1=n,s1}var o1,sO;function Git(){if(sO)return o1;sO=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 o1=r,o1}var l1,oO;function cD(){if(oO)return l1;oO=1;function r(t,e){return t.has(e)}return l1=r,l1}var u1,lO;function hD(){if(lO)return u1;lO=1;var r=uD(),t=Git(),e=cD(),n=1,i=2;function a(s,o,l,u,c,h){var d=l&n,g=s.length,p=o.length;if(g!=p&&!(d&&p>g))return!1;var v=h.get(s),m=h.get(o);if(v&&m)return v==o&&m==s;var b=-1,w=!0,x=l&i?new r:void 0;for(h.set(s,o),h.set(o,s);++b<g;){var S=s[b],_=o[b];if(u)var M=d?u(_,S,b,o,s,h):u(S,_,b,s,o,h);if(M!==void 0){if(M)continue;w=!1;break}if(x){if(!t(o,function(k,C){if(!e(x,C)&&(S===k||c(S,k,l,u,h)))return x.push(C)})){w=!1;break}}else if(!(S===_||c(S,_,l,u,h))){w=!1;break}}return h.delete(s),h.delete(o),w}return u1=a,u1}var c1,uO;function Vit(){if(uO)return c1;uO=1;function r(t){var e=-1,n=Array(t.size);return t.forEach(function(i,a){n[++e]=[a,i]}),n}return c1=r,c1}var h1,cO;function AE(){if(cO)return h1;cO=1;function r(t){var e=-1,n=Array(t.size);return t.forEach(function(i){n[++e]=i}),n}return h1=r,h1}var d1,hO;function Hit(){if(hO)return d1;hO=1;var r=nu(),t=eD(),e=eu(),n=hD(),i=Vit(),a=AE(),s=1,o=2,l="[object Boolean]",u="[object Date]",c="[object Error]",h="[object Map]",d="[object Number]",g="[object RegExp]",p="[object Set]",v="[object String]",m="[object Symbol]",b="[object ArrayBuffer]",w="[object DataView]",x=r?r.prototype:void 0,S=x?x.valueOf:void 0;function _(M,k,C,P,T,A,R){switch(C){case w:if(M.byteLength!=k.byteLength||M.byteOffset!=k.byteOffset)return!1;M=M.buffer,k=k.buffer;case b:return!(M.byteLength!=k.byteLength||!A(new t(M),new t(k)));case l:case u:case d:return e(+M,+k);case c:return M.name==k.name&&M.message==k.message;case g:case v:return M==k+"";case h:var L=i;case p:var $=P&s;if(L||(L=a),M.size!=k.size&&!$)return!1;var q=R.get(M);if(q)return q==k;P|=o,R.set(M,k);var j=n(L(M),L(k),P,T,A,R);return R.delete(M),j;case m:if(S)return S.call(M)==S.call(k)}return!1}return d1=_,d1}var f1,dO;function Uit(){if(dO)return f1;dO=1;var r=Q6(),t=1,e=Object.prototype,n=e.hasOwnProperty;function i(a,s,o,l,u,c){var h=o&t,d=r(a),g=d.length,p=r(s),v=p.length;if(g!=v&&!h)return!1;for(var m=g;m--;){var b=d[m];if(!(h?b in s:n.call(s,b)))return!1}var w=c.get(a),x=c.get(s);if(w&&x)return w==s&&x==a;var S=!0;c.set(a,s),c.set(s,a);for(var _=h;++m<g;){b=d[m];var M=a[b],k=s[b];if(l)var C=h?l(k,M,b,s,a,c):l(M,k,b,a,s,c);if(!(C===void 0?M===k||u(M,k,o,l,c):C)){S=!1;break}_||(_=b=="constructor")}if(S&&!_){var P=a.constructor,T=s.constructor;P!=T&&"constructor"in a&&"constructor"in s&&!(typeof P=="function"&&P instanceof P&&typeof T=="function"&&T instanceof T)&&(S=!1)}return c.delete(a),c.delete(s),S}return f1=i,f1}var g1,fO;function Yit(){if(fO)return g1;fO=1;var r=H0(),t=hD(),e=Hit(),n=Uit(),i=iu(),a=vn(),s=ru(),o=Xc(),l=1,u="[object Arguments]",c="[object Array]",h="[object Object]",d=Object.prototype,g=d.hasOwnProperty;function p(v,m,b,w,x,S){var _=a(v),M=a(m),k=_?c:i(v),C=M?c:i(m);k=k==u?h:k,C=C==u?h:C;var P=k==h,T=C==h,A=k==C;if(A&&s(v)){if(!s(m))return!1;_=!0,P=!1}if(A&&!P)return S||(S=new r),_||o(v)?t(v,m,b,w,x,S):e(v,m,k,b,w,x,S);if(!(b&l)){var R=P&&g.call(v,"__wrapped__"),L=T&&g.call(m,"__wrapped__");if(R||L){var $=R?v.value():v,q=L?m.value():m;return S||(S=new r),x($,q,b,w,S)}}return A?(S||(S=new r),n(v,m,b,w,x,S)):!1}return g1=p,g1}var p1,gO;function dD(){if(gO)return p1;gO=1;var r=Yit(),t=ha();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 p1=e,p1}var v1,pO;function Xit(){if(pO)return v1;pO=1;var r=H0(),t=dD(),e=1,n=2;function i(a,s,o,l){var u=o.length,c=u,h=!l;if(a==null)return!c;for(a=Object(a);u--;){var d=o[u];if(h&&d[2]?d[1]!==a[d[0]]:!(d[0]in a))return!1}for(;++u<c;){d=o[u];var g=d[0],p=a[g],v=d[1];if(h&&d[2]){if(p===void 0&&!(g in a))return!1}else{var m=new r;if(l)var b=l(p,v,g,a,s,m);if(!(b===void 0?t(v,p,e|n,l,m):b))return!1}}return!0}return v1=i,v1}var m1,vO;function fD(){if(vO)return m1;vO=1;var r=mi();function t(e){return e===e&&!r(e)}return m1=t,m1}var y1,mO;function Kit(){if(mO)return y1;mO=1;var r=fD(),t=Js();function e(n){for(var i=t(n),a=i.length;a--;){var s=i[a],o=n[s];i[a]=[s,o,r(o)]}return i}return y1=e,y1}var b1,yO;function gD(){if(yO)return b1;yO=1;function r(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}return b1=r,b1}var w1,bO;function Zit(){if(bO)return w1;bO=1;var r=Xit(),t=Kit(),e=gD();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 w1=n,w1}var x1,wO;function au(){if(wO)return x1;wO=1;var r=Yo(),t=ha(),e="[object Symbol]";function n(i){return typeof i=="symbol"||t(i)&&r(i)==e}return x1=n,x1}var E1,xO;function PE(){if(xO)return E1;xO=1;var r=vn(),t=au(),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 E1=i,E1}var _1,EO;function Jit(){if(EO)return _1;EO=1;var r=bE(),t="Expected a function";function e(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var s=arguments,o=i?i.apply(this,s):s[0],l=a.cache;if(l.has(o))return l.get(o);var u=n.apply(this,s);return a.cache=l.set(o,u)||l,u};return a.cache=new(e.Cache||r),a}return e.Cache=r,_1=e,_1}var S1,_O;function Qit(){if(_O)return S1;_O=1;var r=Jit(),t=500;function e(n){var i=r(n,function(s){return a.size===t&&a.clear(),s}),a=i.cache;return i}return S1=e,S1}var M1,SO;function tat(){if(SO)return M1;SO=1;var r=Qit(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,e=/\\(\\)?/g,n=r(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(s,o,l,u){a.push(l?u.replace(e,"$1"):o||s)}),a});return M1=n,M1}var k1,MO;function tg(){if(MO)return k1;MO=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 k1=r,k1}var C1,kO;function eat(){if(kO)return C1;kO=1;var r=nu(),t=tg(),e=vn(),n=au(),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 C1=s,C1}var T1,CO;function pD(){if(CO)return T1;CO=1;var r=eat();function t(e){return e==null?"":r(e)}return T1=t,T1}var O1,TO;function eg(){if(TO)return O1;TO=1;var r=vn(),t=PE(),e=tat(),n=pD();function i(a,s){return r(a)?a:t(a,s)?[a]:e(n(a))}return O1=i,O1}var A1,OO;function Kc(){if(OO)return A1;OO=1;var r=au();function t(e){if(typeof e=="string"||r(e))return e;var n=e+"";return n=="0"&&1/e==-1/0?"-0":n}return A1=t,A1}var P1,AO;function ng(){if(AO)return P1;AO=1;var r=eg(),t=Kc();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 P1=e,P1}var N1,PO;function nat(){if(PO)return N1;PO=1;var r=ng();function t(e,n,i){var a=e==null?void 0:r(e,n);return a===void 0?i:a}return N1=t,N1}var R1,NO;function rat(){if(NO)return R1;NO=1;function r(t,e){return t!=null&&e in Object(t)}return R1=r,R1}var L1,RO;function vD(){if(RO)return L1;RO=1;var r=eg(),t=Yc(),e=vn(),n=X0(),i=xE(),a=Kc();function s(o,l,u){l=r(l,o);for(var c=-1,h=l.length,d=!1;++c<h;){var g=a(l[c]);if(!(d=o!=null&&u(o,g)))break;o=o[g]}return d||++c!=h?d:(h=o==null?0:o.length,!!h&&i(h)&&n(g,h)&&(e(o)||t(o)))}return L1=s,L1}var I1,LO;function mD(){if(LO)return I1;LO=1;var r=rat(),t=vD();function e(n,i){return n!=null&&t(n,i,r)}return I1=e,I1}var D1,IO;function iat(){if(IO)return D1;IO=1;var r=dD(),t=nat(),e=mD(),n=PE(),i=fD(),a=gD(),s=Kc(),o=1,l=2;function u(c,h){return n(c)&&i(h)?a(s(c),h):function(d){var g=t(d,c);return g===void 0&&g===h?e(d,c):r(h,g,o|l)}}return D1=u,D1}var F1,DO;function yD(){if(DO)return F1;DO=1;function r(t){return function(e){return e==null?void 0:e[t]}}return F1=r,F1}var B1,FO;function aat(){if(FO)return B1;FO=1;var r=ng();function t(e){return function(n){return r(n,e)}}return B1=t,B1}var z1,BO;function sat(){if(BO)return z1;BO=1;var r=yD(),t=aat(),e=PE(),n=Kc();function i(a){return e(a)?r(n(a)):t(a)}return z1=i,z1}var $1,zO;function Ka(){if(zO)return $1;zO=1;var r=Zit(),t=iat(),e=Zo(),n=vn(),i=sat();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 $1=a,$1}var j1,$O;function bD(){if($O)return j1;$O=1;var r=X6(),t=jit(),e=Ka(),n=vn();function i(a,s){var o=n(a)?r:t;return o(a,e(s,3))}return j1=i,j1}var q1,jO;function oat(){if(jO)return q1;jO=1;var r=Object.prototype,t=r.hasOwnProperty;function e(n,i){return n!=null&&t.call(n,i)}return q1=e,q1}var W1,qO;function wD(){if(qO)return W1;qO=1;var r=oat(),t=vD();function e(n,i){return n!=null&&t(n,i,r)}return W1=e,W1}var G1,WO;function lat(){if(WO)return G1;WO=1;var r=_E(),t=iu(),e=Yc(),n=vn(),i=Xa(),a=ru(),s=Z0(),o=Xc(),l="[object Map]",u="[object Set]",c=Object.prototype,h=c.hasOwnProperty;function d(g){if(g==null)return!0;if(i(g)&&(n(g)||typeof g=="string"||typeof g.splice=="function"||a(g)||o(g)||e(g)))return!g.length;var p=t(g);if(p==l||p==u)return!g.size;if(s(g))return!r(g).length;for(var v in g)if(h.call(g,v))return!1;return!0}return G1=d,G1}var V1,GO;function xD(){if(GO)return V1;GO=1;function r(t){return t===void 0}return V1=r,V1}var H1,VO;function ED(){if(VO)return H1;VO=1;var r=Q0(),t=Xa();function e(n,i){var a=-1,s=t(n)?Array(n.length):[];return r(n,function(o,l,u){s[++a]=i(o,l,u)}),s}return H1=e,H1}var U1,HO;function _D(){if(HO)return U1;HO=1;var r=tg(),t=Ka(),e=ED(),n=vn();function i(a,s){var o=n(a)?r:e;return o(a,t(s,3))}return U1=i,U1}var Y1,UO;function uat(){if(UO)return Y1;UO=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 Y1=r,Y1}var X1,YO;function cat(){if(YO)return X1;YO=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 X1=r,X1}var K1,XO;function SD(){if(XO)return K1;XO=1;var r=uat(),t=Q0(),e=Ka(),n=cat(),i=vn();function a(s,o,l){var u=i(s)?r:n,c=arguments.length<3;return u(s,e(o,4),l,c,t)}return K1=a,K1}var Z1,KO;function hat(){if(KO)return Z1;KO=1;var r=Yo(),t=vn(),e=ha(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&e(a)&&r(a)==n}return Z1=i,Z1}var J1,ZO;function dat(){if(ZO)return J1;ZO=1;var r=yD(),t=r("length");return J1=t,J1}var Q1,JO;function fat(){if(JO)return Q1;JO=1;var r="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+e+n,a="\\ufe0e\\ufe0f",s="\\u200d",o=RegExp("["+s+r+i+a+"]");function l(u){return o.test(u)}return Q1=l,Q1}var t2,QO;function gat(){if(QO)return t2;QO=1;var r="\\ud800-\\udfff",t="\\u0300-\\u036f",e="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+e+n,a="\\ufe0e\\ufe0f",s="["+r+"]",o="["+i+"]",l="\\ud83c[\\udffb-\\udfff]",u="(?:"+o+"|"+l+")",c="[^"+r+"]",h="(?:\\ud83c[\\udde6-\\uddff]){2}",d="[\\ud800-\\udbff][\\udc00-\\udfff]",g="\\u200d",p=u+"?",v="["+a+"]?",m="(?:"+g+"(?:"+[c,h,d].join("|")+")"+v+p+")*",b=v+p+m,w="(?:"+[c+o+"?",o,h,d,s].join("|")+")",x=RegExp(l+"(?="+l+")|"+w+b,"g");function S(_){for(var M=x.lastIndex=0;x.test(_);)++M;return M}return t2=S,t2}var e2,tA;function pat(){if(tA)return e2;tA=1;var r=dat(),t=fat(),e=gat();function n(i){return t(i)?e(i):r(i)}return e2=n,e2}var n2,eA;function vat(){if(eA)return n2;eA=1;var r=_E(),t=iu(),e=Xa(),n=hat(),i=pat(),a="[object Map]",s="[object Set]";function o(l){if(l==null)return 0;if(e(l))return n(l)?i(l):l.length;var u=t(l);return u==a||u==s?l.size:r(l).length}return n2=o,n2}var r2,nA;function mat(){if(nA)return r2;nA=1;var r=wE(),t=rD(),e=OE(),n=Ka(),i=J0(),a=vn(),s=ru(),o=Hc(),l=mi(),u=Xc();function c(h,d,g){var p=a(h),v=p||s(h)||u(h);if(d=n(d,4),g==null){var m=h&&h.constructor;v?g=p?new m:[]:l(h)?g=o(m)?t(i(h)):{}:g={}}return(v?r:e)(h,function(b,w,x){return d(g,b,w,x)}),g}return r2=c,r2}var i2,rA;function yat(){if(rA)return i2;rA=1;var r=nu(),t=Yc(),e=vn(),n=r?r.isConcatSpreadable:void 0;function i(a){return e(a)||t(a)||!!(n&&a&&a[n])}return i2=i,i2}var a2,iA;function NE(){if(iA)return a2;iA=1;var r=ME(),t=yat();function e(n,i,a,s,o){var l=-1,u=n.length;for(a||(a=t),o||(o=[]);++l<u;){var c=n[l];i>0&&a(c)?i>1?e(c,i-1,a,s,o):r(o,c):s||(o[o.length]=c)}return o}return a2=e,a2}var s2,aA;function bat(){if(aA)return s2;aA=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 s2=r,s2}var o2,sA;function MD(){if(sA)return o2;sA=1;var r=bat(),t=Math.max;function e(n,i,a){return i=t(i===void 0?n.length-1:i,0),function(){for(var s=arguments,o=-1,l=t(s.length-i,0),u=Array(l);++o<l;)u[o]=s[i+o];o=-1;for(var c=Array(i+1);++o<i;)c[o]=s[o];return c[i]=a(u),r(n,this,c)}}return o2=e,o2}var l2,oA;function wat(){if(oA)return l2;oA=1;var r=CE(),t=G6(),e=Zo(),n=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:r(a),writable:!0})}:e;return l2=n,l2}var u2,lA;function xat(){if(lA)return u2;lA=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 u2=n,u2}var c2,uA;function kD(){if(uA)return c2;uA=1;var r=wat(),t=xat(),e=t(r);return c2=e,c2}var h2,cA;function rg(){if(cA)return h2;cA=1;var r=Zo(),t=MD(),e=kD();function n(i,a){return e(t(i,a,r),i+"")}return h2=n,h2}var d2,hA;function CD(){if(hA)return d2;hA=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 d2=r,d2}var f2,dA;function Eat(){if(dA)return f2;dA=1;function r(t){return t!==t}return f2=r,f2}var g2,fA;function _at(){if(fA)return g2;fA=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 g2=r,g2}var p2,gA;function Sat(){if(gA)return p2;gA=1;var r=CD(),t=Eat(),e=_at();function n(i,a,s){return a===a?e(i,a,s):r(i,t,s)}return p2=n,p2}var v2,pA;function Mat(){if(pA)return v2;pA=1;var r=Sat();function t(e,n){var i=e==null?0:e.length;return!!i&&r(e,n,0)>-1}return v2=t,v2}var m2,vA;function kat(){if(vA)return m2;vA=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 m2=r,m2}var y2,mA;function Cat(){if(mA)return y2;mA=1;function r(){}return y2=r,y2}var b2,yA;function Tat(){if(yA)return b2;yA=1;var r=tD(),t=Cat(),e=AE(),n=1/0,i=r&&1/e(new r([,-0]))[1]==n?function(a){return new r(a)}:t;return b2=i,b2}var w2,bA;function Oat(){if(bA)return w2;bA=1;var r=uD(),t=Mat(),e=kat(),n=cD(),i=Tat(),a=AE(),s=200;function o(l,u,c){var h=-1,d=t,g=l.length,p=!0,v=[],m=v;if(c)p=!1,d=e;else if(g>=s){var b=u?null:i(l);if(b)return a(b);p=!1,d=n,m=new r}else m=u?[]:v;t:for(;++h<g;){var w=l[h],x=u?u(w):w;if(w=c||w!==0?w:0,p&&x===x){for(var S=m.length;S--;)if(m[S]===x)continue t;u&&m.push(x),v.push(w)}else d(m,x,c)||(m!==v&&m.push(x),v.push(w))}return v}return w2=o,w2}var x2,wA;function TD(){if(wA)return x2;wA=1;var r=Xa(),t=ha();function e(n){return t(n)&&r(n)}return x2=e,x2}var E2,xA;function Aat(){if(xA)return E2;xA=1;var r=NE(),t=rg(),e=Oat(),n=TD(),i=t(function(a){return e(r(a,1,n,!0))});return E2=i,E2}var _2,EA;function Pat(){if(EA)return _2;EA=1;var r=tg();function t(e,n){return r(n,function(i){return e[i]})}return _2=t,_2}var S2,_A;function OD(){if(_A)return S2;_A=1;var r=Pat(),t=Js();function e(n){return n==null?[]:r(n,t(n))}return S2=e,S2}var M2,SA;function yi(){if(SA)return M2;SA=1;var r;if(typeof Sx=="function")try{r={clone:Bit(),constant:CE(),each:lD(),filter:bD(),has:wD(),isArray:vn(),isEmpty:lat(),isFunction:Hc(),isUndefined:xD(),keys:Js(),map:_D(),reduce:SD(),size:vat(),transform:mat(),union:Aat(),values:OD()}}catch{}return r||(r=window._),M2=r,M2}var k2,MA;function RE(){if(MA)return k2;MA=1;var r=yi();k2=i;var t="\0",e="\0",n="";function i(c){this._isDirected=r.has(c,"directed")?c.directed:!0,this._isMultigraph=r.has(c,"multigraph")?c.multigraph:!1,this._isCompound=r.has(c,"compound")?c.compound:!1,this._label=void 0,this._defaultNodeLabelFn=r.constant(void 0),this._defaultEdgeLabelFn=r.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[e]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(c){return this._label=c,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(c){return r.isFunction(c)||(c=r.constant(c)),this._defaultNodeLabelFn=c,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return r.keys(this._nodes)},i.prototype.sources=function(){var c=this;return r.filter(this.nodes(),function(h){return r.isEmpty(c._in[h])})},i.prototype.sinks=function(){var c=this;return r.filter(this.nodes(),function(h){return r.isEmpty(c._out[h])})},i.prototype.setNodes=function(c,h){var d=arguments,g=this;return r.each(c,function(p){d.length>1?g.setNode(p,h):g.setNode(p)}),this},i.prototype.setNode=function(c,h){return r.has(this._nodes,c)?(arguments.length>1&&(this._nodes[c]=h),this):(this._nodes[c]=arguments.length>1?h:this._defaultNodeLabelFn(c),this._isCompound&&(this._parent[c]=e,this._children[c]={},this._children[e][c]=!0),this._in[c]={},this._preds[c]={},this._out[c]={},this._sucs[c]={},++this._nodeCount,this)},i.prototype.node=function(c){return this._nodes[c]},i.prototype.hasNode=function(c){return r.has(this._nodes,c)},i.prototype.removeNode=function(c){var h=this;if(r.has(this._nodes,c)){var d=function(g){h.removeEdge(h._edgeObjs[g])};delete this._nodes[c],this._isCompound&&(this._removeFromParentsChildList(c),delete this._parent[c],r.each(this.children(c),function(g){h.setParent(g)}),delete this._children[c]),r.each(r.keys(this._in[c]),d),delete this._in[c],delete this._preds[c],r.each(r.keys(this._out[c]),d),delete this._out[c],delete this._sucs[c],--this._nodeCount}return this},i.prototype.setParent=function(c,h){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(r.isUndefined(h))h=e;else{h+="";for(var d=h;!r.isUndefined(d);d=this.parent(d))if(d===c)throw new Error("Setting "+h+" as parent of "+c+" would create a cycle");this.setNode(h)}return this.setNode(c),this._removeFromParentsChildList(c),this._parent[c]=h,this._children[h][c]=!0,this},i.prototype._removeFromParentsChildList=function(c){delete this._children[this._parent[c]][c]},i.prototype.parent=function(c){if(this._isCompound){var h=this._parent[c];if(h!==e)return h}},i.prototype.children=function(c){if(r.isUndefined(c)&&(c=e),this._isCompound){var h=this._children[c];if(h)return r.keys(h)}else{if(c===e)return this.nodes();if(this.hasNode(c))return[]}},i.prototype.predecessors=function(c){var h=this._preds[c];if(h)return r.keys(h)},i.prototype.successors=function(c){var h=this._sucs[c];if(h)return r.keys(h)},i.prototype.neighbors=function(c){var h=this.predecessors(c);if(h)return r.union(h,this.successors(c))},i.prototype.isLeaf=function(c){var h;return this.isDirected()?h=this.successors(c):h=this.neighbors(c),h.length===0},i.prototype.filterNodes=function(c){var h=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});h.setGraph(this.graph());var d=this;r.each(this._nodes,function(v,m){c(m)&&h.setNode(m,v)}),r.each(this._edgeObjs,function(v){h.hasNode(v.v)&&h.hasNode(v.w)&&h.setEdge(v,d.edge(v))});var g={};function p(v){var m=d.parent(v);return m===void 0||h.hasNode(m)?(g[v]=m,m):m in g?g[m]:p(m)}return this._isCompound&&r.each(h.nodes(),function(v){h.setParent(v,p(v))}),h},i.prototype.setDefaultEdgeLabel=function(c){return r.isFunction(c)||(c=r.constant(c)),this._defaultEdgeLabelFn=c,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return r.values(this._edgeObjs)},i.prototype.setPath=function(c,h){var d=this,g=arguments;return r.reduce(c,function(p,v){return g.length>1?d.setEdge(p,v,h):d.setEdge(p,v),v}),this},i.prototype.setEdge=function(){var c,h,d,g,p=!1,v=arguments[0];typeof v=="object"&&v!==null&&"v"in v?(c=v.v,h=v.w,d=v.name,arguments.length===2&&(g=arguments[1],p=!0)):(c=v,h=arguments[1],d=arguments[3],arguments.length>2&&(g=arguments[2],p=!0)),c=""+c,h=""+h,r.isUndefined(d)||(d=""+d);var m=o(this._isDirected,c,h,d);if(r.has(this._edgeLabels,m))return p&&(this._edgeLabels[m]=g),this;if(!r.isUndefined(d)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(c),this.setNode(h),this._edgeLabels[m]=p?g:this._defaultEdgeLabelFn(c,h,d);var b=l(this._isDirected,c,h,d);return c=b.v,h=b.w,Object.freeze(b),this._edgeObjs[m]=b,a(this._preds[h],c),a(this._sucs[c],h),this._in[h][m]=b,this._out[c][m]=b,this._edgeCount++,this},i.prototype.edge=function(c,h,d){var g=arguments.length===1?u(this._isDirected,arguments[0]):o(this._isDirected,c,h,d);return this._edgeLabels[g]},i.prototype.hasEdge=function(c,h,d){var g=arguments.length===1?u(this._isDirected,arguments[0]):o(this._isDirected,c,h,d);return r.has(this._edgeLabels,g)},i.prototype.removeEdge=function(c,h,d){var g=arguments.length===1?u(this._isDirected,arguments[0]):o(this._isDirected,c,h,d),p=this._edgeObjs[g];return p&&(c=p.v,h=p.w,delete this._edgeLabels[g],delete this._edgeObjs[g],s(this._preds[h],c),s(this._sucs[c],h),delete this._in[h][g],delete this._out[c][g],this._edgeCount--),this},i.prototype.inEdges=function(c,h){var d=this._in[c];if(d){var g=r.values(d);return h?r.filter(g,function(p){return p.v===h}):g}},i.prototype.outEdges=function(c,h){var d=this._out[c];if(d){var g=r.values(d);return h?r.filter(g,function(p){return p.w===h}):g}},i.prototype.nodeEdges=function(c,h){var d=this.inEdges(c,h);if(d)return d.concat(this.outEdges(c,h))};function a(c,h){c[h]?c[h]++:c[h]=1}function s(c,h){--c[h]||delete c[h]}function o(c,h,d,g){var p=""+h,v=""+d;if(!c&&p>v){var m=p;p=v,v=m}return p+n+v+n+(r.isUndefined(g)?t:g)}function l(c,h,d,g){var p=""+h,v=""+d;if(!c&&p>v){var m=p;p=v,v=m}var b={v:p,w:v};return g&&(b.name=g),b}function u(c,h){return o(c,h.v,h.w,h.name)}return k2}var C2,kA;function Nat(){return kA||(kA=1,C2="2.1.8"),C2}var T2,CA;function Rat(){return CA||(CA=1,T2={Graph:RE(),version:Nat()}),T2}var O2,TA;function Lat(){if(TA)return O2;TA=1;var r=yi(),t=RE();O2={write:e,read:a};function e(s){var o={options:{directed:s.isDirected(),multigraph:s.isMultigraph(),compound:s.isCompound()},nodes:n(s),edges:i(s)};return r.isUndefined(s.graph())||(o.value=r.clone(s.graph())),o}function n(s){return r.map(s.nodes(),function(o){var l=s.node(o),u=s.parent(o),c={v:o};return r.isUndefined(l)||(c.value=l),r.isUndefined(u)||(c.parent=u),c})}function i(s){return r.map(s.edges(),function(o){var l=s.edge(o),u={v:o.v,w:o.w};return r.isUndefined(o.name)||(u.name=o.name),r.isUndefined(l)||(u.value=l),u})}function a(s){var o=new t(s.options).setGraph(s.value);return r.each(s.nodes,function(l){o.setNode(l.v,l.value),l.parent&&o.setParent(l.v,l.parent)}),r.each(s.edges,function(l){o.setEdge({v:l.v,w:l.w,name:l.name},l.value)}),o}return O2}var A2,OA;function Iat(){if(OA)return A2;OA=1;var r=yi();A2=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 A2}var P2,AA;function AD(){if(AA)return P2;AA=1;var r=yi();P2=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},P2}var N2,PA;function PD(){if(PA)return N2;PA=1;var r=yi(),t=AD();N2=n;var e=r.constant(1);function n(a,s,o,l){return i(a,String(s),o||e,l||function(u){return a.outEdges(u)})}function i(a,s,o,l){var u={},c=new t,h,d,g=function(p){var v=p.v!==h?p.v:p.w,m=u[v],b=o(p),w=d.distance+b;if(b<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+p+" Weight: "+b);w<m.distance&&(m.distance=w,m.predecessor=h,c.decrease(v,w))};for(a.nodes().forEach(function(p){var v=p===s?0:Number.POSITIVE_INFINITY;u[p]={distance:v},c.add(p,v)});c.size()>0&&(h=c.removeMin(),d=u[h],d.distance!==Number.POSITIVE_INFINITY);)l(h).forEach(g);return u}return N2}var R2,NA;function Dat(){if(NA)return R2;NA=1;var r=PD(),t=yi();R2=e;function e(n,i,a){return t.transform(n.nodes(),function(s,o){s[o]=r(n,o,i,a)},{})}return R2}var L2,RA;function ND(){if(RA)return L2;RA=1;var r=yi();L2=t;function t(e){var n=0,i=[],a={},s=[];function o(l){var u=a[l]={onStack:!0,lowlink:n,index:n++};if(i.push(l),e.successors(l).forEach(function(d){r.has(a,d)?a[d].onStack&&(u.lowlink=Math.min(u.lowlink,a[d].index)):(o(d),u.lowlink=Math.min(u.lowlink,a[d].lowlink))}),u.lowlink===u.index){var c=[],h;do h=i.pop(),a[h].onStack=!1,c.push(h);while(l!==h);s.push(c)}}return e.nodes().forEach(function(l){r.has(a,l)||o(l)}),s}return L2}var I2,LA;function Fat(){if(LA)return I2;LA=1;var r=yi(),t=ND();I2=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 I2}var D2,IA;function Bat(){if(IA)return D2;IA=1;var r=yi();D2=e;var t=r.constant(1);function e(i,a,s){return n(i,a||t,s||function(o){return i.outEdges(o)})}function n(i,a,s){var o={},l=i.nodes();return l.forEach(function(u){o[u]={},o[u][u]={distance:0},l.forEach(function(c){u!==c&&(o[u][c]={distance:Number.POSITIVE_INFINITY})}),s(u).forEach(function(c){var h=c.v===u?c.w:c.v,d=a(c);o[u][h]={distance:d,predecessor:u}})}),l.forEach(function(u){var c=o[u];l.forEach(function(h){var d=o[h];l.forEach(function(g){var p=d[u],v=c[g],m=d[g],b=p.distance+v.distance;b<m.distance&&(m.distance=b,m.predecessor=v.predecessor)})})}),o}return D2}var F2,DA;function RD(){if(DA)return F2;DA=1;var r=yi();F2=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,F2}var B2,FA;function zat(){if(FA)return B2;FA=1;var r=RD();B2=t;function t(e){try{r(e)}catch(n){if(n instanceof r.CycleException)return!1;throw n}return!0}return B2}var z2,BA;function LD(){if(BA)return z2;BA=1;var r=yi();z2=t;function t(n,i,a){r.isArray(i)||(i=[i]);var s=(n.isDirected()?n.successors:n.neighbors).bind(n),o=[],l={};return r.each(i,function(u){if(!n.hasNode(u))throw new Error("Graph does not have node: "+u);e(n,u,a==="post",l,s,o)}),o}function e(n,i,a,s,o,l){r.has(s,i)||(s[i]=!0,a||l.push(i),r.each(o(i),function(u){e(n,u,a,s,o,l)}),a&&l.push(i))}return z2}var $2,zA;function $at(){if(zA)return $2;zA=1;var r=LD();$2=t;function t(e,n){return r(e,n,"post")}return $2}var j2,$A;function jat(){if($A)return j2;$A=1;var r=LD();j2=t;function t(e,n){return r(e,n,"pre")}return j2}var q2,jA;function qat(){if(jA)return q2;jA=1;var r=yi(),t=RE(),e=AD();q2=n;function n(i,a){var s=new t,o={},l=new e,u;function c(d){var g=d.v===u?d.w:d.v,p=l.priority(g);if(p!==void 0){var v=a(d);v<p&&(o[g]=u,l.decrease(g,v))}}if(i.nodeCount()===0)return s;r.each(i.nodes(),function(d){l.add(d,Number.POSITIVE_INFINITY),s.setNode(d)}),l.decrease(i.nodes()[0],0);for(var h=!1;l.size()>0;){if(u=l.removeMin(),r.has(o,u))s.setEdge(u,o[u]);else{if(h)throw new Error("Input graph is not connected: "+i);h=!0}i.nodeEdges(u).forEach(c)}return s}return q2}var W2,qA;function Wat(){return qA||(qA=1,W2={components:Iat(),dijkstra:PD(),dijkstraAll:Dat(),findCycles:Fat(),floydWarshall:Bat(),isAcyclic:zat(),postorder:$at(),preorder:jat(),prim:qat(),tarjan:ND(),topsort:RD()}),W2}var G2,WA;function Gat(){if(WA)return G2;WA=1;var r=Rat();return G2={Graph:r.Graph,json:Lat(),alg:Wat(),version:r.version},G2}var jf;if(typeof Sx=="function")try{jf=Gat()}catch{}jf||(jf=window.graphlib);var Bi=jf,V2,GA;function Vat(){if(GA)return V2;GA=1;var r=aD(),t=1,e=4;function n(i){return r(i,t|e)}return V2=n,V2}var H2,VA;function ig(){if(VA)return H2;VA=1;var r=eu(),t=Xa(),e=X0(),n=mi();function i(a,s,o){if(!n(o))return!1;var l=typeof s;return(l=="number"?t(o)&&e(s,o.length):l=="string"&&s in o)?r(o[s],a):!1}return H2=i,H2}var U2,HA;function Hat(){if(HA)return U2;HA=1;var r=rg(),t=eu(),e=ig(),n=Ko(),i=Object.prototype,a=i.hasOwnProperty,s=r(function(o,l){o=Object(o);var u=-1,c=l.length,h=c>2?l[2]:void 0;for(h&&e(l[0],l[1],h)&&(c=1);++u<c;)for(var d=l[u],g=n(d),p=-1,v=g.length;++p<v;){var m=g[p],b=o[m];(b===void 0||t(b,i[m])&&!a.call(o,m))&&(o[m]=d[m])}return o});return U2=s,U2}var Y2,UA;function Uat(){if(UA)return Y2;UA=1;var r=Ka(),t=Xa(),e=Js();function n(i){return function(a,s,o){var l=Object(a);if(!t(a)){var u=r(s,3);a=e(a),s=function(h){return u(l[h],h,l)}}var c=i(a,s,o);return c>-1?l[u?a[c]:c]:void 0}}return Y2=n,Y2}var X2,YA;function Yat(){if(YA)return X2;YA=1;var r=/\s/;function t(e){for(var n=e.length;n--&&r.test(e.charAt(n)););return n}return X2=t,X2}var K2,XA;function Xat(){if(XA)return K2;XA=1;var r=Yat(),t=/^\s+/;function e(n){return n&&n.slice(0,r(n)+1).replace(t,"")}return K2=e,K2}var Z2,KA;function Kat(){if(KA)return Z2;KA=1;var r=Xat(),t=mi(),e=au(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;function l(u){if(typeof u=="number")return u;if(e(u))return n;if(t(u)){var c=typeof u.valueOf=="function"?u.valueOf():u;u=t(c)?c+"":c}if(typeof u!="string")return u===0?u:+u;u=r(u);var h=a.test(u);return h||s.test(u)?o(u.slice(2),h?2:8):i.test(u)?n:+u}return Z2=l,Z2}var J2,ZA;function ID(){if(ZA)return J2;ZA=1;var r=Kat(),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 J2=n,J2}var Q2,JA;function Zat(){if(JA)return Q2;JA=1;var r=ID();function t(e){var n=r(e),i=n%1;return n===n?i?n-i:n:0}return Q2=t,Q2}var tb,QA;function Jat(){if(QA)return tb;QA=1;var r=CD(),t=Ka(),e=Zat(),n=Math.max;function i(a,s,o){var l=a==null?0:a.length;if(!l)return-1;var u=o==null?0:e(o);return u<0&&(u=n(l+u,0)),r(a,t(s,3),u)}return tb=i,tb}var eb,tP;function Qat(){if(tP)return eb;tP=1;var r=Uat(),t=Jat(),e=r(t);return eb=e,eb}var nb,eP;function DD(){if(eP)return nb;eP=1;var r=NE();function t(e){var n=e==null?0:e.length;return n?r(e,1):[]}return nb=t,nb}var rb,nP;function tst(){if(nP)return rb;nP=1;var r=TE(),t=sD(),e=Ko();function n(i,a){return i==null?i:r(i,t(a),e)}return rb=n,rb}var ib,rP;function est(){if(rP)return ib;rP=1;function r(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}return ib=r,ib}var ab,iP;function nst(){if(iP)return ab;iP=1;var r=U0(),t=OE(),e=Ka();function n(i,a){var s={};return a=e(a,3),t(i,function(o,l,u){r(s,l,a(o,l,u))}),s}return ab=n,ab}var sb,aP;function LE(){if(aP)return sb;aP=1;var r=au();function t(e,n,i){for(var a=-1,s=e.length;++a<s;){var o=e[a],l=n(o);if(l!=null&&(u===void 0?l===l&&!r(l):i(l,u)))var u=l,c=o}return c}return sb=t,sb}var ob,sP;function rst(){if(sP)return ob;sP=1;function r(t,e){return t>e}return ob=r,ob}var lb,oP;function ist(){if(oP)return lb;oP=1;var r=LE(),t=rst(),e=Zo();function n(i){return i&&i.length?r(i,e,t):void 0}return lb=n,lb}var ub,lP;function FD(){if(lP)return ub;lP=1;var r=U0(),t=eu();function e(n,i,a){(a!==void 0&&!t(n[i],a)||a===void 0&&!(i in n))&&r(n,i,a)}return ub=e,ub}var cb,uP;function ast(){if(uP)return cb;uP=1;var r=Yo(),t=J0(),e=ha(),n="[object Object]",i=Function.prototype,a=Object.prototype,s=i.toString,o=a.hasOwnProperty,l=s.call(Object);function u(c){if(!e(c)||r(c)!=n)return!1;var h=t(c);if(h===null)return!0;var d=o.call(h,"constructor")&&h.constructor;return typeof d=="function"&&d instanceof d&&s.call(d)==l}return cb=u,cb}var hb,cP;function BD(){if(cP)return hb;cP=1;function r(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}return hb=r,hb}var db,hP;function sst(){if(hP)return db;hP=1;var r=Uc(),t=Ko();function e(n){return r(n,t(n))}return db=e,db}var fb,dP;function ost(){if(dP)return fb;dP=1;var r=FD(),t=U6(),e=nD(),n=Y6(),i=iD(),a=Yc(),s=vn(),o=TD(),l=ru(),u=Hc(),c=mi(),h=ast(),d=Xc(),g=BD(),p=sst();function v(m,b,w,x,S,_,M){var k=g(m,w),C=g(b,w),P=M.get(C);if(P){r(m,w,P);return}var T=_?_(k,C,w+"",m,b,M):void 0,A=T===void 0;if(A){var R=s(C),L=!R&&l(C),$=!R&&!L&&d(C);T=C,R||L||$?s(k)?T=k:o(k)?T=n(k):L?(A=!1,T=t(C,!0)):$?(A=!1,T=e(C,!0)):T=[]:h(C)||a(C)?(T=k,a(k)?T=p(k):(!c(k)||u(k))&&(T=i(C))):A=!1}A&&(M.set(C,T),S(T,C,x,_,M),M.delete(C)),r(m,w,T)}return fb=v,fb}var gb,fP;function lst(){if(fP)return gb;fP=1;var r=H0(),t=FD(),e=TE(),n=ost(),i=mi(),a=Ko(),s=BD();function o(l,u,c,h,d){l!==u&&e(u,function(g,p){if(d||(d=new r),i(g))n(l,u,p,c,o,h,d);else{var v=h?h(s(l,p),g,p+"",l,u,d):void 0;v===void 0&&(v=g),t(l,p,v)}},a)}return gb=o,gb}var pb,gP;function ust(){if(gP)return pb;gP=1;var r=rg(),t=ig();function e(n){return r(function(i,a){var s=-1,o=a.length,l=o>1?a[o-1]:void 0,u=o>2?a[2]:void 0;for(l=n.length>3&&typeof l=="function"?(o--,l):void 0,u&&t(a[0],a[1],u)&&(l=o<3?void 0:l,o=1),i=Object(i);++s<o;){var c=a[s];c&&n(i,c,s,l)}return i})}return pb=e,pb}var vb,pP;function cst(){if(pP)return vb;pP=1;var r=lst(),t=ust(),e=t(function(n,i,a){r(n,i,a)});return vb=e,vb}var mb,vP;function zD(){if(vP)return mb;vP=1;function r(t,e){return t<e}return mb=r,mb}var yb,mP;function hst(){if(mP)return yb;mP=1;var r=LE(),t=zD(),e=Zo();function n(i){return i&&i.length?r(i,e,t):void 0}return yb=n,yb}var bb,yP;function dst(){if(yP)return bb;yP=1;var r=LE(),t=Ka(),e=zD();function n(i,a){return i&&i.length?r(i,t(a,2),e):void 0}return bb=n,bb}var wb,bP;function fst(){if(bP)return wb;bP=1;var r=Fi(),t=function(){return r.Date.now()};return wb=t,wb}var xb,wP;function gst(){if(wP)return xb;wP=1;var r=Y0(),t=eg(),e=X0(),n=mi(),i=Kc();function a(s,o,l,u){if(!n(s))return s;o=t(o,s);for(var c=-1,h=o.length,d=h-1,g=s;g!=null&&++c<h;){var p=i(o[c]),v=l;if(p==="__proto__"||p==="constructor"||p==="prototype")return s;if(c!=d){var m=g[p];v=u?u(m,p,g):void 0,v===void 0&&(v=n(m)?m:e(o[c+1])?[]:{})}r(g,p,v),g=g[p]}return s}return xb=a,xb}var Eb,xP;function pst(){if(xP)return Eb;xP=1;var r=ng(),t=gst(),e=eg();function n(i,a,s){for(var o=-1,l=a.length,u={};++o<l;){var c=a[o],h=r(i,c);s(h,c)&&t(u,e(c,i),h)}return u}return Eb=n,Eb}var _b,EP;function vst(){if(EP)return _b;EP=1;var r=pst(),t=mD();function e(n,i){return r(n,i,function(a,s){return t(n,s)})}return _b=e,_b}var Sb,_P;function mst(){if(_P)return Sb;_P=1;var r=DD(),t=MD(),e=kD();function n(i){return e(t(i,void 0,r),i+"")}return Sb=n,Sb}var Mb,SP;function yst(){if(SP)return Mb;SP=1;var r=vst(),t=mst(),e=t(function(n,i){return n==null?{}:r(n,i)});return Mb=e,Mb}var kb,MP;function bst(){if(MP)return kb;MP=1;var r=Math.ceil,t=Math.max;function e(n,i,a,s){for(var o=-1,l=t(r((i-n)/(a||1)),0),u=Array(l);l--;)u[s?l:++o]=n,n+=a;return u}return kb=e,kb}var Cb,kP;function wst(){if(kP)return Cb;kP=1;var r=bst(),t=ig(),e=ID();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 Cb=n,Cb}var Tb,CP;function xst(){if(CP)return Tb;CP=1;var r=wst(),t=r();return Tb=t,Tb}var Ob,TP;function Est(){if(TP)return Ob;TP=1;function r(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}return Ob=r,Ob}var Ab,OP;function _st(){if(OP)return Ab;OP=1;var r=au();function t(e,n){if(e!==n){var i=e!==void 0,a=e===null,s=e===e,o=r(e),l=n!==void 0,u=n===null,c=n===n,h=r(n);if(!u&&!h&&!o&&e>n||o&&l&&c&&!u&&!h||a&&l&&c||!i&&c||!s)return 1;if(!a&&!o&&!h&&e<n||h&&i&&s&&!a&&!o||u&&i&&s||!l&&s||!c)return-1}return 0}return Ab=t,Ab}var Pb,AP;function Sst(){if(AP)return Pb;AP=1;var r=_st();function t(e,n,i){for(var a=-1,s=e.criteria,o=n.criteria,l=s.length,u=i.length;++a<l;){var c=r(s[a],o[a]);if(c){if(a>=u)return c;var h=i[a];return c*(h=="desc"?-1:1)}}return e.index-n.index}return Pb=t,Pb}var Nb,PP;function Mst(){if(PP)return Nb;PP=1;var r=tg(),t=ng(),e=Ka(),n=ED(),i=Est(),a=K0(),s=Sst(),o=Zo(),l=vn();function u(c,h,d){h.length?h=r(h,function(v){return l(v)?function(m){return t(m,v.length===1?v[0]:v)}:v}):h=[o];var g=-1;h=r(h,a(e));var p=n(c,function(v,m,b){var w=r(h,function(x){return x(v)});return{criteria:w,index:++g,value:v}});return i(p,function(v,m){return s(v,m,d)})}return Nb=u,Nb}var Rb,NP;function kst(){if(NP)return Rb;NP=1;var r=NE(),t=Mst(),e=rg(),n=ig(),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 Rb=i,Rb}var Lb,RP;function Cst(){if(RP)return Lb;RP=1;var r=pD(),t=0;function e(n){var i=++t;return r(n)+i}return Lb=e,Lb}var Ib,LP;function Tst(){if(LP)return Ib;LP=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 Ib=r,Ib}var Db,IP;function Ost(){if(IP)return Db;IP=1;var r=Y0(),t=Tst();function e(n,i){return t(n||[],i||[],r)}return Db=e,Db}var qf;if(typeof Sx=="function")try{qf={cloneDeep:Vat(),constant:CE(),defaults:Hat(),each:lD(),filter:bD(),find:Qat(),flatten:DD(),forEach:oD(),forIn:tst(),has:wD(),isUndefined:xD(),last:est(),map:_D(),mapValues:nst(),max:ist(),merge:cst(),min:hst(),minBy:dst(),now:fst(),pick:yst(),range:xst(),reduce:SD(),sortBy:kst(),uniqueId:Cst(),values:OD(),zipObject:Ost()}}catch{}qf||(qf=window._);var je=qf,Ast=ag;function ag(){var r={};r._next=r._prev=r,this._sentinel=r}ag.prototype.dequeue=function(){var r=this._sentinel,t=r._prev;if(t!==r)return $D(t),t};ag.prototype.enqueue=function(r){var t=this._sentinel;r._prev&&r._next&&$D(r),r._next=t._next,t._next._prev=r,t._next=r,r._prev=t};ag.prototype.toString=function(){for(var r=[],t=this._sentinel,e=t._prev;e!==t;)r.push(JSON.stringify(e,Pst)),e=e._prev;return"["+r.join(", ")+"]"};function $D(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function Pst(r,t){if(r!=="_next"&&r!=="_prev")return t}var Ia=je,Nst=Bi.Graph,Rst=Ast,Lst=Dst,Ist=Ia.constant(1);function Dst(r,t){if(r.nodeCount()<=1)return[];var e=Bst(r,t||Ist),n=Fst(e.graph,e.buckets,e.zeroIdx);return Ia.flatten(Ia.map(n,function(i){return r.outEdges(i.v,i.w)}),!0)}function Fst(r,t,e){for(var n=[],i=t[t.length-1],a=t[0],s;r.nodeCount();){for(;s=a.dequeue();)Fb(r,t,e,s);for(;s=i.dequeue();)Fb(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(Fb(r,t,e,s,!0));break}}}return n}function Fb(r,t,e,n,i){var a=i?[]:void 0;return Ia.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,ax(t,e,l)}),Ia.forEach(r.outEdges(n.v),function(s){var o=r.edge(s),l=s.w,u=r.node(l);u.in-=o,ax(t,e,u)}),r.removeNode(n.v),a}function Bst(r,t){var e=new Nst,n=0,i=0;Ia.forEach(r.nodes(),function(o){e.setNode(o,{v:o,in:0,out:0})}),Ia.forEach(r.edges(),function(o){var l=e.edge(o.v,o.w)||0,u=t(o),c=l+u;e.setEdge(o.v,o.w,c),i=Math.max(i,e.node(o.v).out+=u),n=Math.max(n,e.node(o.w).in+=u)});var a=Ia.range(i+n+3).map(function(){return new Rst}),s=n+1;return Ia.forEach(e.nodes(),function(o){ax(a,s,e.node(o))}),{graph:e,buckets:a,zeroIdx:s}}function ax(r,t,e){e.out?e.in?r[e.out-e.in+t].enqueue(e):r[r.length-1].enqueue(e):r[0].enqueue(e)}var Eo=je,zst=Lst,$st={run:jst,undo:Wst};function jst(r){var t=r.graph().acyclicer==="greedy"?zst(r,e(r)):qst(r);Eo.forEach(t,function(n){var i=r.edge(n);r.removeEdge(n),i.forwardName=n.name,i.reversed=!0,r.setEdge(n.w,n.v,i,Eo.uniqueId("rev"))});function e(n){return function(i){return n.edge(i).weight}}}function qst(r){var t=[],e={},n={};function i(a){Eo.has(n,a)||(n[a]=!0,e[a]=!0,Eo.forEach(r.outEdges(a),function(s){Eo.has(e,s.w)?t.push(s):i(s.w)}),delete e[a])}return Eo.forEach(r.nodes(),i),t}function Wst(r){Eo.forEach(r.edges(),function(t){var e=r.edge(t);if(e.reversed){r.removeEdge(t);var n=e.forwardName;delete e.reversed,delete e.forwardName,r.setEdge(t.w,t.v,e,n)}})}var he=je,jD=Bi.Graph,Cr={addDummyNode:qD,simplify:Gst,asNonCompoundGraph:Vst,successorWeights:Hst,predecessorWeights:Ust,intersectRect:Yst,buildLayerMatrix:Xst,normalizeRanks:Kst,removeEmptyRanks:Zst,addBorderNode:Jst,maxRank:WD,partition:Qst,time:tot,notime:eot};function qD(r,t,e,n){var i;do i=he.uniqueId(n);while(r.hasNode(i));return e.dummy=t,r.setNode(i,e),i}function Gst(r){var t=new jD().setGraph(r.graph());return he.forEach(r.nodes(),function(e){t.setNode(e,r.node(e))}),he.forEach(r.edges(),function(e){var n=t.edge(e.v,e.w)||{weight:0,minlen:1},i=r.edge(e);t.setEdge(e.v,e.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),t}function Vst(r){var t=new jD({multigraph:r.isMultigraph()}).setGraph(r.graph());return he.forEach(r.nodes(),function(e){r.children(e).length||t.setNode(e,r.node(e))}),he.forEach(r.edges(),function(e){t.setEdge(e,r.edge(e))}),t}function Hst(r){var t=he.map(r.nodes(),function(e){var n={};return he.forEach(r.outEdges(e),function(i){n[i.w]=(n[i.w]||0)+r.edge(i).weight}),n});return he.zipObject(r.nodes(),t)}function Ust(r){var t=he.map(r.nodes(),function(e){var n={};return he.forEach(r.inEdges(e),function(i){n[i.v]=(n[i.v]||0)+r.edge(i).weight}),n});return he.zipObject(r.nodes(),t)}function Yst(r,t){var e=r.x,n=r.y,i=t.x-e,a=t.y-n,s=r.width/2,o=r.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");var l,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,u=o):(i<0&&(s=-s),l=s,u=s*a/i),{x:e+l,y:n+u}}function Xst(r){var t=he.map(he.range(WD(r)+1),function(){return[]});return he.forEach(r.nodes(),function(e){var n=r.node(e),i=n.rank;he.isUndefined(i)||(t[i][n.order]=e)}),t}function Kst(r){var t=he.min(he.map(r.nodes(),function(e){return r.node(e).rank}));he.forEach(r.nodes(),function(e){var n=r.node(e);he.has(n,"rank")&&(n.rank-=t)})}function Zst(r){var t=he.min(he.map(r.nodes(),function(a){return r.node(a).rank})),e=[];he.forEach(r.nodes(),function(a){var s=r.node(a).rank-t;e[s]||(e[s]=[]),e[s].push(a)});var n=0,i=r.graph().nodeRankFactor;he.forEach(e,function(a,s){he.isUndefined(a)&&s%i!==0?--n:n&&he.forEach(a,function(o){r.node(o).rank+=n})})}function Jst(r,t,e,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=e,i.order=n),qD(r,"border",i,t)}function WD(r){return he.max(he.map(r.nodes(),function(t){var e=r.node(t).rank;if(!he.isUndefined(e))return e}))}function Qst(r,t){var e={lhs:[],rhs:[]};return he.forEach(r,function(n){t(n)?e.lhs.push(n):e.rhs.push(n)}),e}function tot(r,t){var e=he.now();try{return t()}finally{console.log(r+" time: "+(he.now()-e)+"ms")}}function eot(r,t){return t()}var GD=je,not=Cr,rot={run:iot,undo:sot};function iot(r){r.graph().dummyChains=[],GD.forEach(r.edges(),function(t){aot(r,t)})}function aot(r,t){var e=t.v,n=r.node(e).rank,i=t.w,a=r.node(i).rank,s=t.name,o=r.edge(t),l=o.labelRank;if(a!==n+1){r.removeEdge(t);var u,c,h;for(h=0,++n;n<a;++h,++n)o.points=[],c={width:0,height:0,edgeLabel:o,edgeObj:t,rank:n},u=not.addDummyNode(r,"edge",c,"_d"),n===l&&(c.width=o.width,c.height=o.height,c.dummy="edge-label",c.labelpos=o.labelpos),r.setEdge(e,u,{weight:o.weight},s),h===0&&r.graph().dummyChains.push(u),e=u;r.setEdge(e,i,{weight:o.weight},s)}}function sot(r){GD.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 Rd=je,sg={longestPath:oot,slack:lot};function oot(r){var t={};function e(n){var i=r.node(n);if(Rd.has(t,n))return i.rank;t[n]=!0;var a=Rd.min(Rd.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}Rd.forEach(r.sources(),e)}function lot(r,t){return r.node(t.w).rank-r.node(t.v).rank-r.edge(t).minlen}var Wf=je,uot=Bi.Graph,Gf=sg.slack,VD=cot;function cot(r){var t=new uot({directed:!1}),e=r.nodes()[0],n=r.nodeCount();t.setNode(e,{});for(var i,a;hot(t,r)<n;)i=dot(t,r),a=t.hasNode(i.v)?Gf(r,i):-Gf(r,i),fot(t,r,a);return t}function hot(r,t){function e(n){Wf.forEach(t.nodeEdges(n),function(i){var a=i.v,s=n===a?i.w:a;!r.hasNode(s)&&!Gf(t,i)&&(r.setNode(s,{}),r.setEdge(n,s,{}),e(s))})}return Wf.forEach(r.nodes(),e),r.nodeCount()}function dot(r,t){return Wf.minBy(t.edges(),function(e){if(r.hasNode(e.v)!==r.hasNode(e.w))return Gf(t,e)})}function fot(r,t,e){Wf.forEach(r.nodes(),function(n){t.node(n).rank+=e})}var Ga=je,got=VD,pot=sg.slack,vot=sg.longestPath,mot=Bi.alg.preorder,yot=Bi.alg.postorder,bot=Cr.simplify,wot=Jo;Jo.initLowLimValues=DE;Jo.initCutValues=IE;Jo.calcCutValue=HD;Jo.leaveEdge=YD;Jo.enterEdge=XD;Jo.exchangeEdges=KD;function Jo(r){r=bot(r),vot(r);var t=got(r);DE(t),IE(t,r);for(var e,n;e=YD(t);)n=XD(t,r,e),KD(t,r,e,n)}function IE(r,t){var e=yot(r,r.nodes());e=e.slice(0,e.length-1),Ga.forEach(e,function(n){xot(r,t,n)})}function xot(r,t,e){var n=r.node(e),i=n.parent;r.edge(e,i).cutvalue=HD(r,t,e)}function HD(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,Ga.forEach(t.nodeEdges(e),function(l){var u=l.v===e,c=u?l.w:l.v;if(c!==i){var h=u===a,d=t.edge(l).weight;if(o+=h?d:-d,_ot(r,e,c)){var g=r.edge(e,c).cutvalue;o+=h?-g:g}}}),o}function DE(r,t){arguments.length<2&&(t=r.nodes()[0]),UD(r,{},1,t)}function UD(r,t,e,n,i){var a=e,s=r.node(n);return t[n]=!0,Ga.forEach(r.neighbors(n),function(o){Ga.has(t,o)||(e=UD(r,t,e,o,n))}),s.low=a,s.lim=e++,i?s.parent=i:delete s.parent,e}function YD(r){return Ga.find(r.edges(),function(t){return r.edge(t).cutvalue<0})}function XD(r,t,e){var n=e.v,i=e.w;t.hasEdge(n,i)||(n=e.w,i=e.v);var a=r.node(n),s=r.node(i),o=a,l=!1;a.lim>s.lim&&(o=s,l=!0);var u=Ga.filter(t.edges(),function(c){return l===DP(r,r.node(c.v),o)&&l!==DP(r,r.node(c.w),o)});return Ga.minBy(u,function(c){return pot(t,c)})}function KD(r,t,e,n){var i=e.v,a=e.w;r.removeEdge(i,a),r.setEdge(n.v,n.w,{}),DE(r),IE(r,t),Eot(r,t)}function Eot(r,t){var e=Ga.find(r.nodes(),function(i){return!t.node(i).parent}),n=mot(r,e);n=n.slice(1),Ga.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 _ot(r,t,e){return r.hasEdge(t,e)}function DP(r,t,e){return e.low<=t.lim&&t.lim<=e.lim}var Sot=sg,ZD=Sot.longestPath,Mot=VD,kot=wot,Cot=Tot;function Tot(r){switch(r.graph().ranker){case"network-simplex":FP(r);break;case"tight-tree":Aot(r);break;case"longest-path":Oot(r);break;default:FP(r)}}var Oot=ZD;function Aot(r){ZD(r),Mot(r)}function FP(r){kot(r)}var sx=je,Pot=Not;function Not(r){var t=Lot(r);sx.forEach(r.graph().dummyChains,function(e){for(var n=r.node(e),i=n.edgeObj,a=Rot(r,t,i.v,i.w),s=a.path,o=a.lca,l=0,u=s[l],c=!0;e!==i.w;){if(n=r.node(e),c){for(;(u=s[l])!==o&&r.node(u).maxRank<n.rank;)l++;u===o&&(c=!1)}if(!c){for(;l<s.length-1&&r.node(u=s[l+1]).minRank<=n.rank;)l++;u=s[l]}r.setParent(e,u),e=r.successors(e)[0]}})}function Rot(r,t,e,n){var i=[],a=[],s=Math.min(t[e].low,t[n].low),o=Math.max(t[e].lim,t[n].lim),l,u;l=e;do l=r.parent(l),i.push(l);while(l&&(t[l].low>s||o>t[l].lim));for(u=l,l=n;(l=r.parent(l))!==u;)a.push(l);return{path:i.concat(a.reverse()),lca:u}}function Lot(r){var t={},e=0;function n(i){var a=e;sx.forEach(r.children(i),n),t[i]={low:a,lim:e++}}return sx.forEach(r.children(),n),t}var Da=je,ox=Cr,Iot={run:Dot,cleanup:zot};function Dot(r){var t=ox.addDummyNode(r,"root",{},"_root"),e=Fot(r),n=Da.max(Da.values(e))-1,i=2*n+1;r.graph().nestingRoot=t,Da.forEach(r.edges(),function(s){r.edge(s).minlen*=i});var a=Bot(r)+1;Da.forEach(r.children(),function(s){JD(r,t,i,a,n,e,s)}),r.graph().nodeRankFactor=i}function JD(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=ox.addBorderNode(r,"_bt"),u=ox.addBorderNode(r,"_bb"),c=r.node(s);r.setParent(l,s),c.borderTop=l,r.setParent(u,s),c.borderBottom=u,Da.forEach(o,function(h){JD(r,t,e,n,i,a,h);var d=r.node(h),g=d.borderTop?d.borderTop:h,p=d.borderBottom?d.borderBottom:h,v=d.borderTop?n:2*n,m=g!==p?1:i-a[s]+1;r.setEdge(l,g,{weight:v,minlen:m,nestingEdge:!0}),r.setEdge(p,u,{weight:v,minlen:m,nestingEdge:!0})}),r.parent(s)||r.setEdge(t,l,{weight:0,minlen:i+a[s]})}function Fot(r){var t={};function e(n,i){var a=r.children(n);a&&a.length&&Da.forEach(a,function(s){e(s,i+1)}),t[n]=i}return Da.forEach(r.children(),function(n){e(n,1)}),t}function Bot(r){return Da.reduce(r.edges(),function(t,e){return t+r.edge(e).weight},0)}function zot(r){var t=r.graph();r.removeNode(t.nestingRoot),delete t.nestingRoot,Da.forEach(r.edges(),function(e){var n=r.edge(e);n.nestingEdge&&r.removeEdge(e)})}var Bb=je,$ot=Cr,jot=qot;function qot(r){function t(e){var n=r.children(e),i=r.node(e);if(n.length&&Bb.forEach(n,t),Bb.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,s=i.maxRank+1;a<s;++a)BP(r,"borderLeft","_bl",e,i,a),BP(r,"borderRight","_br",e,i,a)}}Bb.forEach(r.children(),t)}function BP(r,t,e,n,i,a){var s={width:0,height:0,rank:a,borderType:t},o=i[t][a-1],l=$ot.addDummyNode(r,"border",s,e);i[t][a]=l,r.setParent(l,n),o&&r.setEdge(o,l,{weight:1})}var na=je,Wot={adjust:Got,undo:Vot};function Got(r){var t=r.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&QD(r)}function Vot(r){var t=r.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&Hot(r),(t==="lr"||t==="rl")&&(Uot(r),QD(r))}function QD(r){na.forEach(r.nodes(),function(t){zP(r.node(t))}),na.forEach(r.edges(),function(t){zP(r.edge(t))})}function zP(r){var t=r.width;r.width=r.height,r.height=t}function Hot(r){na.forEach(r.nodes(),function(t){zb(r.node(t))}),na.forEach(r.edges(),function(t){var e=r.edge(t);na.forEach(e.points,zb),na.has(e,"y")&&zb(e)})}function zb(r){r.y=-r.y}function Uot(r){na.forEach(r.nodes(),function(t){$b(r.node(t))}),na.forEach(r.edges(),function(t){var e=r.edge(t);na.forEach(e.points,$b),na.has(e,"x")&&$b(e)})}function $b(r){var t=r.x;r.x=r.y,r.y=t}var Ea=je,Yot=Xot;function Xot(r){var t={},e=Ea.filter(r.nodes(),function(o){return!r.children(o).length}),n=Ea.max(Ea.map(e,function(o){return r.node(o).rank})),i=Ea.map(Ea.range(n+1),function(){return[]});function a(o){if(!Ea.has(t,o)){t[o]=!0;var l=r.node(o);i[l.rank].push(o),Ea.forEach(r.successors(o),a)}}var s=Ea.sortBy(e,function(o){return r.node(o).rank});return Ea.forEach(s,a),i}var hs=je,Kot=Zot;function Zot(r,t){for(var e=0,n=1;n<t.length;++n)e+=Jot(r,t[n-1],t[n]);return e}function Jot(r,t,e){for(var n=hs.zipObject(e,hs.map(e,function(u,c){return c})),i=hs.flatten(hs.map(t,function(u){return hs.sortBy(hs.map(r.outEdges(u),function(c){return{pos:n[c.w],weight:r.edge(c).weight}}),"pos")}),!0),a=1;a<e.length;)a<<=1;var s=2*a-1;a-=1;var o=hs.map(new Array(s),function(){return 0}),l=0;return hs.forEach(i.forEach(function(u){var c=u.pos+a;o[c]+=u.weight;for(var h=0;c>0;)c%2&&(h+=o[c+1]),c=c-1>>1,o[c]+=u.weight;l+=u.weight*h})),l}var $P=je,Qot=tlt;function tlt(r,t){return $P.map(t,function(e){var n=r.inEdges(e);if(n.length){var i=$P.reduce(n,function(a,s){var o=r.edge(s),l=r.node(s.v);return{sum:a.sum+o.weight*l.order,weight:a.weight+o.weight}},{sum:0,weight:0});return{v:e,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:e}})}var zr=je,elt=nlt;function nlt(r,t){var e={};zr.forEach(r,function(i,a){var s=e[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};zr.isUndefined(i.barycenter)||(s.barycenter=i.barycenter,s.weight=i.weight)}),zr.forEach(t.edges(),function(i){var a=e[i.v],s=e[i.w];!zr.isUndefined(a)&&!zr.isUndefined(s)&&(s.indegree++,a.out.push(e[i.w]))});var n=zr.filter(e,function(i){return!i.indegree});return rlt(n)}function rlt(r){var t=[];function e(a){return function(s){s.merged||(zr.isUndefined(s.barycenter)||zr.isUndefined(a.barycenter)||s.barycenter>=a.barycenter)&&ilt(a,s)}}function n(a){return function(s){s.in.push(a),--s.indegree===0&&r.push(s)}}for(;r.length;){var i=r.pop();t.push(i),zr.forEach(i.in.reverse(),e(i)),zr.forEach(i.out,n(i))}return zr.map(zr.filter(t,function(a){return!a.merged}),function(a){return zr.pick(a,["vs","i","barycenter","weight"])})}function ilt(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 Uu=je,alt=Cr,slt=olt;function olt(r,t){var e=alt.partition(r,function(c){return Uu.has(c,"barycenter")}),n=e.lhs,i=Uu.sortBy(e.rhs,function(c){return-c.i}),a=[],s=0,o=0,l=0;n.sort(llt(!!t)),l=jP(a,i,l),Uu.forEach(n,function(c){l+=c.vs.length,a.push(c.vs),s+=c.barycenter*c.weight,o+=c.weight,l=jP(a,i,l)});var u={vs:Uu.flatten(a,!0)};return o&&(u.barycenter=s/o,u.weight=o),u}function jP(r,t,e){for(var n;t.length&&(n=Uu.last(t)).i<=e;)t.pop(),r.push(n.vs),e++;return e}function llt(r){return function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:r?e.i-t.i:t.i-e.i}}var ws=je,ult=Qot,clt=elt,hlt=slt,dlt=t5;function t5(r,t,e,n){var i=r.children(t),a=r.node(t),s=a?a.borderLeft:void 0,o=a?a.borderRight:void 0,l={};s&&(i=ws.filter(i,function(p){return p!==s&&p!==o}));var u=ult(r,i);ws.forEach(u,function(p){if(r.children(p.v).length){var v=t5(r,p.v,e,n);l[p.v]=v,ws.has(v,"barycenter")&&glt(p,v)}});var c=clt(u,e);flt(c,l);var h=hlt(c,n);if(s&&(h.vs=ws.flatten([s,h.vs,o],!0),r.predecessors(s).length)){var d=r.node(r.predecessors(s)[0]),g=r.node(r.predecessors(o)[0]);ws.has(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+d.order+g.order)/(h.weight+2),h.weight+=2}return h}function flt(r,t){ws.forEach(r,function(e){e.vs=ws.flatten(e.vs.map(function(n){return t[n]?t[n].vs:n}),!0)})}function glt(r,t){ws.isUndefined(r.barycenter)?(r.barycenter=t.barycenter,r.weight=t.weight):(r.barycenter=(r.barycenter*r.weight+t.barycenter*t.weight)/(r.weight+t.weight),r.weight+=t.weight)}var Yu=je,plt=Bi.Graph,vlt=mlt;function mlt(r,t,e){var n=ylt(r),i=new plt({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return r.node(a)});return Yu.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),Yu.forEach(r[e](a),function(l){var u=l.v===a?l.w:l.v,c=i.edge(u,a),h=Yu.isUndefined(c)?0:c.weight;i.setEdge(u,a,{weight:r.edge(l).weight+h})}),Yu.has(s,"minRank")&&i.setNode(a,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))}),i}function ylt(r){for(var t;r.hasNode(t=Yu.uniqueId("_root")););return t}var blt=je,wlt=xlt;function xlt(r,t,e){var n={},i;blt.forEach(e,function(a){for(var s=r.parent(a),o,l;s;){if(o=r.parent(s),o?(l=n[o],n[o]=s):(l=i,i=s),l&&l!==s){t.setEdge(l,s);return}s=o}})}var Ls=je,Elt=Yot,_lt=Kot,Slt=dlt,Mlt=vlt,klt=wlt,Clt=Bi.Graph,qP=Cr,Tlt=Olt;function Olt(r){var t=qP.maxRank(r),e=WP(r,Ls.range(1,t+1),"inEdges"),n=WP(r,Ls.range(t-1,-1,-1),"outEdges"),i=Elt(r);GP(r,i);for(var a=Number.POSITIVE_INFINITY,s,o=0,l=0;l<4;++o,++l){Alt(o%2?e:n,o%4>=2),i=qP.buildLayerMatrix(r);var u=_lt(r,i);u<a&&(l=0,s=Ls.cloneDeep(i),a=u)}GP(r,s)}function WP(r,t,e){return Ls.map(t,function(n){return Mlt(r,n,e)})}function Alt(r,t){var e=new Clt;Ls.forEach(r,function(n){var i=n.graph().root,a=Slt(n,i,e,t);Ls.forEach(a.vs,function(s,o){n.node(s).order=o}),klt(n,e,a.vs)})}function GP(r,t){Ls.forEach(t,function(e){Ls.forEach(e,function(n,i){r.node(n).order=i})})}var Ft=je,Plt=Bi.Graph,Nlt=Cr,Rlt={positionX:Glt};function Llt(r,t){var e={};function n(i,a){var s=0,o=0,l=i.length,u=Ft.last(a);return Ft.forEach(a,function(c,h){var d=Dlt(r,c),g=d?r.node(d).order:l;(d||c===u)&&(Ft.forEach(a.slice(o,h+1),function(p){Ft.forEach(r.predecessors(p),function(v){var m=r.node(v),b=m.order;(b<s||g<b)&&!(m.dummy&&r.node(p).dummy)&&e5(e,v,p)})}),o=h+1,s=g)}),a}return Ft.reduce(t,n),e}function Ilt(r,t){var e={};function n(a,s,o,l,u){var c;Ft.forEach(Ft.range(s,o),function(h){c=a[h],r.node(c).dummy&&Ft.forEach(r.predecessors(c),function(d){var g=r.node(d);g.dummy&&(g.order<l||g.order>u)&&e5(e,d,c)})})}function i(a,s){var o=-1,l,u=0;return Ft.forEach(s,function(c,h){if(r.node(c).dummy==="border"){var d=r.predecessors(c);d.length&&(l=r.node(d[0]).order,n(s,u,h,o,l),u=h,o=l)}n(s,u,s.length,l,a.length)}),s}return Ft.reduce(t,i),e}function Dlt(r,t){if(r.node(t).dummy)return Ft.find(r.predecessors(t),function(e){return r.node(e).dummy})}function e5(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 Flt(r,t,e){if(t>e){var n=t;t=e,e=n}return Ft.has(r[t],e)}function Blt(r,t,e,n){var i={},a={},s={};return Ft.forEach(t,function(o){Ft.forEach(o,function(l,u){i[l]=l,a[l]=l,s[l]=u})}),Ft.forEach(t,function(o){var l=-1;Ft.forEach(o,function(u){var c=n(u);if(c.length){c=Ft.sortBy(c,function(v){return s[v]});for(var h=(c.length-1)/2,d=Math.floor(h),g=Math.ceil(h);d<=g;++d){var p=c[d];a[u]===u&&l<s[p]&&!Flt(e,u,p)&&(a[p]=u,a[u]=i[u]=i[p],l=s[p])}}})}),{root:i,align:a}}function zlt(r,t,e,n,i){var a={},s=$lt(r,t,e,i),o=i?"borderLeft":"borderRight";function l(h,d){for(var g=s.nodes(),p=g.pop(),v={};p;)v[p]?h(p):(v[p]=!0,g.push(p),g=g.concat(d(p))),p=g.pop()}function u(h){a[h]=s.inEdges(h).reduce(function(d,g){return Math.max(d,a[g.v]+s.edge(g))},0)}function c(h){var d=s.outEdges(h).reduce(function(p,v){return Math.min(p,a[v.w]-s.edge(v))},Number.POSITIVE_INFINITY),g=r.node(h);d!==Number.POSITIVE_INFINITY&&g.borderType!==o&&(a[h]=Math.max(a[h],d))}return l(u,s.predecessors.bind(s)),l(c,s.successors.bind(s)),Ft.forEach(n,function(h){a[h]=a[e[h]]}),a}function $lt(r,t,e,n){var i=new Plt,a=r.graph(),s=Vlt(a.nodesep,a.edgesep,n);return Ft.forEach(t,function(o){var l;Ft.forEach(o,function(u){var c=e[u];if(i.setNode(c),l){var h=e[l],d=i.edge(h,c);i.setEdge(h,c,Math.max(s(r,u,l),d||0))}l=u})}),i}function jlt(r,t){return Ft.minBy(Ft.values(t),function(e){var n=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return Ft.forIn(e,function(a,s){var o=Hlt(r,s)/2;n=Math.max(a+o,n),i=Math.min(a-o,i)}),n-i})}function qlt(r,t){var e=Ft.values(t),n=Ft.min(e),i=Ft.max(e);Ft.forEach(["u","d"],function(a){Ft.forEach(["l","r"],function(s){var o=a+s,l=r[o],u;if(l!==t){var c=Ft.values(l);u=s==="l"?n-Ft.min(c):i-Ft.max(c),u&&(r[o]=Ft.mapValues(l,function(h){return h+u}))}})})}function Wlt(r,t){return Ft.mapValues(r.ul,function(e,n){if(t)return r[t.toLowerCase()][n];var i=Ft.sortBy(Ft.map(r,n));return(i[1]+i[2])/2})}function Glt(r){var t=Nlt.buildLayerMatrix(r),e=Ft.merge(Llt(r,t),Ilt(r,t)),n={},i;Ft.forEach(["u","d"],function(s){i=s==="u"?t:Ft.values(t).reverse(),Ft.forEach(["l","r"],function(o){o==="r"&&(i=Ft.map(i,function(h){return Ft.values(h).reverse()}));var l=(s==="u"?r.predecessors:r.successors).bind(r),u=Blt(r,i,e,l),c=zlt(r,i,u.root,u.align,o==="r");o==="r"&&(c=Ft.mapValues(c,function(h){return-h})),n[s+o]=c})});var a=jlt(r,n);return qlt(n,a),Wlt(n,r.graph().align)}function Vlt(r,t,e){return function(n,i,a){var s=n.node(i),o=n.node(a),l=0,u;if(l+=s.width/2,Ft.has(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=-s.width/2;break;case"r":u=s.width/2;break}if(u&&(l+=e?u:-u),u=0,l+=(s.dummy?t:r)/2,l+=(o.dummy?t:r)/2,l+=o.width/2,Ft.has(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=o.width/2;break;case"r":u=-o.width/2;break}return u&&(l+=e?u:-u),u=0,l}}function Hlt(r,t){return r.node(t).width}var Xu=je,n5=Cr,Ult=Rlt.positionX,Ylt=Xlt;function Xlt(r){r=n5.asNonCompoundGraph(r),Klt(r),Xu.forEach(Ult(r),function(t,e){r.node(e).x=t})}function Klt(r){var t=n5.buildLayerMatrix(r),e=r.graph().ranksep,n=0;Xu.forEach(t,function(i){var a=Xu.max(Xu.map(i,function(s){return r.node(s).height}));Xu.forEach(i,function(s){r.node(s).y=n+a/2}),n+=a+e})}var Jt=je,VP=$st,HP=rot,Zlt=Cot,Jlt=Cr.normalizeRanks,Qlt=Pot,tut=Cr.removeEmptyRanks,UP=Iot,eut=jot,YP=Wot,nut=Tlt,rut=Ylt,qs=Cr,iut=Bi.Graph,aut=sut;function sut(r,t){var e=t&&t.debugTiming?qs.time:qs.notime;e("layout",function(){var n=e(" buildLayoutGraph",function(){return mut(r)});e(" runLayout",function(){out(n,e)}),e(" updateInputGraph",function(){lut(r,n)})})}function out(r,t){t(" makeSpaceForEdgeLabels",function(){yut(r)}),t(" removeSelfEdges",function(){Cut(r)}),t(" acyclic",function(){VP.run(r)}),t(" nestingGraph.run",function(){UP.run(r)}),t(" rank",function(){Zlt(qs.asNonCompoundGraph(r))}),t(" injectEdgeLabelProxies",function(){but(r)}),t(" removeEmptyRanks",function(){tut(r)}),t(" nestingGraph.cleanup",function(){UP.cleanup(r)}),t(" normalizeRanks",function(){Jlt(r)}),t(" assignRankMinMax",function(){wut(r)}),t(" removeEdgeLabelProxies",function(){xut(r)}),t(" normalize.run",function(){HP.run(r)}),t(" parentDummyChains",function(){Qlt(r)}),t(" addBorderSegments",function(){eut(r)}),t(" order",function(){nut(r)}),t(" insertSelfEdges",function(){Tut(r)}),t(" adjustCoordinateSystem",function(){YP.adjust(r)}),t(" position",function(){rut(r)}),t(" positionSelfEdges",function(){Out(r)}),t(" removeBorderNodes",function(){kut(r)}),t(" normalize.undo",function(){HP.undo(r)}),t(" fixupEdgeLabelCoords",function(){Sut(r)}),t(" undoCoordinateSystem",function(){YP.undo(r)}),t(" translateGraph",function(){Eut(r)}),t(" assignNodeIntersects",function(){_ut(r)}),t(" reversePoints",function(){Mut(r)}),t(" acyclic.undo",function(){VP.undo(r)})}function lut(r,t){Jt.forEach(r.nodes(),function(e){var n=r.node(e),i=t.node(e);n&&(n.x=i.x,n.y=i.y,t.children(e).length&&(n.width=i.width,n.height=i.height))}),Jt.forEach(r.edges(),function(e){var n=r.edge(e),i=t.edge(e);n.points=i.points,Jt.has(i,"x")&&(n.x=i.x,n.y=i.y)}),r.graph().width=t.graph().width,r.graph().height=t.graph().height}var uut=["nodesep","edgesep","ranksep","marginx","marginy"],cut={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},hut=["acyclicer","ranker","rankdir","align"],dut=["width","height"],fut={width:0,height:0},gut=["minlen","weight","width","height","labeloffset"],put={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},vut=["labelpos"];function mut(r){var t=new iut({multigraph:!0,compound:!0}),e=qb(r.graph());return t.setGraph(Jt.merge({},cut,jb(e,uut),Jt.pick(e,hut))),Jt.forEach(r.nodes(),function(n){var i=qb(r.node(n));t.setNode(n,Jt.defaults(jb(i,dut),fut)),t.setParent(n,r.parent(n))}),Jt.forEach(r.edges(),function(n){var i=qb(r.edge(n));t.setEdge(n,Jt.merge({},put,jb(i,gut),Jt.pick(i,vut)))}),t}function yut(r){var t=r.graph();t.ranksep/=2,Jt.forEach(r.edges(),function(e){var n=r.edge(e);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function but(r){Jt.forEach(r.edges(),function(t){var e=r.edge(t);if(e.width&&e.height){var n=r.node(t.v),i=r.node(t.w),a={rank:(i.rank-n.rank)/2+n.rank,e:t};qs.addDummyNode(r,"edge-proxy",a,"_ep")}})}function wut(r){var t=0;Jt.forEach(r.nodes(),function(e){var n=r.node(e);n.borderTop&&(n.minRank=r.node(n.borderTop).rank,n.maxRank=r.node(n.borderBottom).rank,t=Jt.max(t,n.maxRank))}),r.graph().maxRank=t}function xut(r){Jt.forEach(r.nodes(),function(t){var e=r.node(t);e.dummy==="edge-proxy"&&(r.edge(e.e).labelRank=e.rank,r.removeNode(t))})}function Eut(r){var t=Number.POSITIVE_INFINITY,e=0,n=Number.POSITIVE_INFINITY,i=0,a=r.graph(),s=a.marginx||0,o=a.marginy||0;function l(u){var c=u.x,h=u.y,d=u.width,g=u.height;t=Math.min(t,c-d/2),e=Math.max(e,c+d/2),n=Math.min(n,h-g/2),i=Math.max(i,h+g/2)}Jt.forEach(r.nodes(),function(u){l(r.node(u))}),Jt.forEach(r.edges(),function(u){var c=r.edge(u);Jt.has(c,"x")&&l(c)}),t-=s,n-=o,Jt.forEach(r.nodes(),function(u){var c=r.node(u);c.x-=t,c.y-=n}),Jt.forEach(r.edges(),function(u){var c=r.edge(u);Jt.forEach(c.points,function(h){h.x-=t,h.y-=n}),Jt.has(c,"x")&&(c.x-=t),Jt.has(c,"y")&&(c.y-=n)}),a.width=e-t+s,a.height=i-n+o}function _ut(r){Jt.forEach(r.edges(),function(t){var e=r.edge(t),n=r.node(t.v),i=r.node(t.w),a,s;e.points?(a=e.points[0],s=e.points[e.points.length-1]):(e.points=[],a=i,s=n),e.points.unshift(qs.intersectRect(n,a)),e.points.push(qs.intersectRect(i,s))})}function Sut(r){Jt.forEach(r.edges(),function(t){var e=r.edge(t);if(Jt.has(e,"x"))switch((e.labelpos==="l"||e.labelpos==="r")&&(e.width-=e.labeloffset),e.labelpos){case"l":e.x-=e.width/2+e.labeloffset;break;case"r":e.x+=e.width/2+e.labeloffset;break}})}function Mut(r){Jt.forEach(r.edges(),function(t){var e=r.edge(t);e.reversed&&e.points.reverse()})}function kut(r){Jt.forEach(r.nodes(),function(t){if(r.children(t).length){var e=r.node(t),n=r.node(e.borderTop),i=r.node(e.borderBottom),a=r.node(Jt.last(e.borderLeft)),s=r.node(Jt.last(e.borderRight));e.width=Math.abs(s.x-a.x),e.height=Math.abs(i.y-n.y),e.x=a.x+e.width/2,e.y=n.y+e.height/2}}),Jt.forEach(r.nodes(),function(t){r.node(t).dummy==="border"&&r.removeNode(t)})}function Cut(r){Jt.forEach(r.edges(),function(t){if(t.v===t.w){var e=r.node(t.v);e.selfEdges||(e.selfEdges=[]),e.selfEdges.push({e:t,label:r.edge(t)}),r.removeEdge(t)}})}function Tut(r){var t=qs.buildLayerMatrix(r);Jt.forEach(t,function(e){var n=0;Jt.forEach(e,function(i,a){var s=r.node(i);s.order=a+n,Jt.forEach(s.selfEdges,function(o){qs.addDummyNode(r,"selfedge",{width:o.label.width,height:o.label.height,rank:s.rank,order:a+ ++n,e:o.e,label:o.label},"_se")}),delete s.selfEdges})})}function Out(r){Jt.forEach(r.nodes(),function(t){var e=r.node(t);if(e.dummy==="selfedge"){var n=r.node(e.e.v),i=n.x+n.width/2,a=n.y,s=e.x-i,o=n.height/2;r.setEdge(e.e,e.label),r.removeNode(t),e.label.points=[{x:i+2*s/3,y:a-o},{x:i+5*s/6,y:a-o},{x:i+s,y:a},{x:i+5*s/6,y:a+o},{x:i+2*s/3,y:a+o}],e.label.x=e.x,e.label.y=e.y}})}function jb(r,t){return Jt.mapValues(Jt.pick(r,t),Number)}function qb(r){var t={};return Jt.forEach(r,function(e,n){t[n.toLowerCase()]=e}),t}var Ld=je,Aut=Cr,Put=Bi.Graph,Nut={debugOrdering:Rut};function Rut(r){var t=Aut.buildLayerMatrix(r),e=new Put({compound:!0,multigraph:!0}).setGraph({});return Ld.forEach(r.nodes(),function(n){e.setNode(n,{label:n}),e.setParent(n,"layer"+r.node(n).rank)}),Ld.forEach(r.edges(),function(n){e.setEdge(n.v,n.w,{},n.name)}),Ld.forEach(t,function(n,i){var a="layer"+i;e.setNode(a,{rank:"same"}),Ld.reduce(n,function(s,o){return e.setEdge(s,o,{style:"invis"}),o})}),e}var Lut="0.8.5",r5={graphlib:Bi,layout:aut,debug:Nut,util:{time:Cr.time,notime:Cr.notime},version:Lut};const Iut=r0(r5);class og{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,og.defaultOptions,t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),e))})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,Object.assign(Object.assign({},this.options),e))})}genericDagreLayout(t,e,n){return Ht(this,void 0,void 0,function*(){const{nodeSize:i}=n,a=new r5.graphlib.Graph;a.setGraph(n),a.setDefaultEdgeLabel(()=>({}));const s=e.getAllNodes(),o=e.getAllEdges();[...s,...o].some(({id:u})=>bt(u))&&console.error("Dagre layout only support string id, it will convert number to string."),e.getAllNodes().forEach(u=>{const{id:c}=u,h=Object.assign({},u.data);if(i!==void 0){const[d,g]=Vc(Et(i)?i(u):i);Object.assign(h,{width:d,height:g})}a.setNode(c.toString(),h)}),e.getAllEdges().forEach(({id:u,source:c,target:h})=>{a.setEdge(c.toString(),h.toString(),{id:u})}),Iut.layout(a);const l={nodes:[],edges:[]};return a.nodes().forEach(u=>{const c=a.node(u);l.nodes.push({id:u,data:c}),t&&e.mergeNodeData(u,c)}),a.edges().forEach(u=>{const c=a.edge(u),{id:h}=c,d=Je(c,["id"]),{v:g,w:p}=u;l.edges.push({id:h,source:g,target:p,data:d}),t&&e.mergeEdgeData(h,d)}),l})}}og.defaultOptions={};class FE{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 FE(s)}}class Rl{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 Rl(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 Rl(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 Rl(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 Rl(i)}}class Ll{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 Ll(this.quad.NW()),this.NE=new Ll(this.quad.NE()),this.SW=new Ll(this.quad.SW()),this.SE=new Ll(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 Dut={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 Fut{constructor(t={}){this.options=t,this.id="forceAtlas2",this.options=Object.assign(Object.assign({},Dut),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericForceAtlas2Layout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericForceAtlas2Layout(!0,t,e)})}genericForceAtlas2Layout(t,e,n){return Ht(this,void 0,void 0,function*(){const i=e.getAllEdges(),a=e.getAllNodes(),s=this.formatOptions(n,a.length),{width:o,height:l,prune:u,maxIteration:c,nodeSize:h,center:d}=s;if(!(a!=null&&a.length)||a.length===1)return Uo(e,t,d);const g=a.map(b=>Wr(b,[o,l])),p=i.filter(b=>{const{source:w,target:x}=b;return w!==x}),v=new Mn({nodes:g,edges:p}),m=this.getSizes(v,h);if(this.run(v,e,c,m,t,s),u){for(let w=0;w<p.length;w+=1){const{source:x,target:S}=p[w],_=v.getDegree(x),M=v.getDegree(x);if(_<=1){const k=v.getNode(S);v.mergeNodeData(x,{x:k.data.x,y:k.data.y})}else if(M<=1){const k=v.getNode(x);v.mergeNodeData(S,{x:k.data.x,y:k.data.y})}}const b=Object.assign(Object.assign({},s),{prune:!1,barnesHut:!1});this.run(v,e,100,m,t,b)}return{nodes:g,edges:i}})}getSizes(t,e){const n=t.getAllNodes(),i={};for(let a=0;a<n.length;a+=1){const s=n[a];i[s.id]=dE(e,void 0)(s)}return i}formatOptions(t={},e){const n=Object.assign(Object.assign({},this.options),t),{center:i,width:a,height:s,barnesHut:o,prune:l,maxIteration:u,kr:c,kg:h}=n;return n.width=!a&&typeof window<"u"?window.innerWidth:a,n.height=!s&&typeof window<"u"?window.innerHeight:s,n.center=i||[n.width/2,n.height/2],o===void 0&&e>250&&(n.barnesHut=!0),l===void 0&&e>100&&(n.prune=!0),u===0&&!l?(n.maxIteration=250,e<=200&&e>100?n.maxIteration=1e3:e>200&&(n.maxIteration=1200)):u===0&&l&&(n.maxIteration=100,e<=200&&e>100?n.maxIteration=500:e>200&&(n.maxIteration=950)),c||(n.kr=50,e>100&&e<=500?n.kr=20:e>500&&(n.kr=1)),h||(n.kg=20,e>100&&e<=500?n.kg=10:e>500&&(n.kg=1)),n}run(t,e,n,i,a,s){const{kr:o,barnesHut:l,onTick:u}=s,c=t.getAllNodes();let h=0,d=n;const g={},p={},v={};for(let m=0;m<c.length;m+=1){const{data:b,id:w}=c[m];if(g[w]=[0,0],l){const x={id:m,rx:b.x,ry:b.y,mass:1,g:o,degree:t.getDegree(w)};v[w]=new FE(x)}}for(;d>0;)h=this.oneStep(t,{iter:d,preventOverlapIters:50,krPrime:100,sg:h,forces:g,preForces:p,bodies:v,sizes:i},s),d--,u==null||u({nodes:c,edges:e.getAllEdges()});return t}oneStep(t,e,n){const{iter:i,preventOverlapIters:a,krPrime:s,sg:o,preForces:l,bodies:u,sizes:c}=e;let{forces:h}=e;const{preventOverlap:d,barnesHut:g}=n,p=t.getAllNodes();for(let v=0;v<p.length;v+=1){const{id:m}=p[v];l[m]=[...h[m]],h[m]=[0,0]}return h=this.getAttrForces(t,i,a,c,h,n),g&&(d&&i>a||!d)?h=this.getOptRepGraForces(t,h,u,n):h=this.getRepGraForces(t,i,a,h,s,c,n),this.updatePos(t,h,l,o,n)}getAttrForces(t,e,n,i,a,s){const{preventOverlap:o,dissuadeHubs:l,mode:u,prune:c}=s,h=t.getAllEdges();for(let d=0;d<h.length;d+=1){const{source:g,target:p}=h[d],v=t.getNode(g),m=t.getNode(p),b=t.getDegree(g),w=t.getDegree(p);if(c&&(b<=1||w<=1))continue;const x=[m.data.x-v.data.x,m.data.y-v.data.y];let S=Math.hypot(x[0],x[1]);S=S<1e-4?1e-4:S,x[0]=x[0]/S,x[1]=x[1]/S,o&&e<n&&(S=S-i[g]-i[p]);let _=S,M=_;u==="linlog"&&(_=Math.log(1+S),M=_),l&&(_=S/b,M=S/w),o&&e<n&&S<=0?(_=0,M=0):o&&e<n&&S>0&&(_=S,M=S),a[g][0]+=_*x[0],a[p][0]-=M*x[0],a[g][1]+=_*x[1],a[p][1]-=M*x[1]}return a}getOptRepGraForces(t,e,n,i){const{kg:a,center:s,prune:o}=i,l=t.getAllNodes(),u=l.length;let c=9e10,h=-9e10,d=9e10,g=-9e10;for(let w=0;w<u;w+=1){const{id:x,data:S}=l[w];o&&t.getDegree(x)<=1||(n[x].setPos(S.x,S.y),S.x>=h&&(h=S.x),S.x<=c&&(c=S.x),S.y>=g&&(g=S.y),S.y<=d&&(d=S.y))}const p=Math.max(h-c,g-d),v={xmid:(h+c)/2,ymid:(g+d)/2,length:p,massCenter:s,mass:u},m=new Rl(v),b=new Ll(m);for(let w=0;w<u;w+=1){const{id:x}=l[w];o&&t.getDegree(x)<=1||n[x].in(m)&&b.insert(n[x])}for(let w=0;w<u;w+=1){const{id:x,data:S}=l[w],_=t.getDegree(x);if(o&&_<=1)continue;n[x].resetForce(),b.updateForce(n[x]),e[x][0]-=n[x].fx,e[x][1]-=n[x].fy;const M=[S.x-s[0],S.y-s[1]];let k=Math.hypot(M[0],M[1]);k=k<1e-4?1e-4:k,M[0]=M[0]/k,M[1]=M[1]/k;const C=a*(_+1);e[x][0]-=C*M[0],e[x][1]-=C*M[1]}return e}getRepGraForces(t,e,n,i,a,s,o){const{preventOverlap:l,kr:u,kg:c,center:h,prune:d}=o,g=t.getAllNodes(),p=g.length;for(let v=0;v<p;v+=1){const m=g[v],b=t.getDegree(m.id);for(let _=v+1;_<p;_+=1){const M=g[_],k=t.getDegree(M.id);if(d&&(b<=1||k<=1))continue;const C=[M.data.x-m.data.x,M.data.y-m.data.y];let P=Math.hypot(C[0],C[1]);P=P<1e-4?1e-4:P,C[0]=C[0]/P,C[1]=C[1]/P,l&&e<n&&(P=P-s[m.id]-s[M.id]);let T=u*(b+1)*(k+1)/P;l&&e<n&&P<0?T=a*(b+1)*(k+1):l&&e<n&&P===0?T=0:l&&e<n&&P>0&&(T=u*(b+1)*(k+1)/P),i[m.id][0]-=T*C[0],i[M.id][0]+=T*C[0],i[m.id][1]-=T*C[1],i[M.id][1]+=T*C[1]}const w=[m.data.x-h[0],m.data.y-h[1]],x=Math.hypot(w[0],w[1]);w[0]=w[0]/x,w[1]=w[1]/x;const S=c*(b+1);i[m.id][0]-=S*w[0],i[m.id][1]-=S*w[1]}return i}updatePos(t,e,n,i,a){const{ks:s,tao:o,prune:l,ksmax:u}=a,c=t.getAllNodes(),h=c.length,d=[],g=[];let p=0,v=0,m=i;for(let w=0;w<h;w+=1){const{id:x}=c[w],S=t.getDegree(x);if(l&&S<=1)continue;const _=[e[x][0]-n[x][0],e[x][1]-n[x][1]],M=Math.hypot(_[0],_[1]),k=[e[x][0]+n[x][0],e[x][1]+n[x][1]],C=Math.hypot(k[0],k[1]);d[w]=M,g[w]=C/2,p+=(S+1)*d[w],v+=(S+1)*g[w]}const b=m;m=o*v/p,b!==0&&(m=m>1.5*b?1.5*b:m);for(let w=0;w<h;w+=1){const{id:x,data:S}=c[w],_=t.getDegree(x);if(l&&_<=1||bt(S.fx)&&bt(S.fy))continue;let M=s*m/(1+m*Math.sqrt(d[w])),k=Math.hypot(e[x][0],e[x][1]);k=k<1e-4?1e-4:k;const C=u/k;M=M>C?C:M;const P=M*e[x][0],T=M*e[x][1];t.mergeNodeData(x,{x:S.x+P,y:S.y+T})}return m}}const But={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},zut=800;class $ut{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},But),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericFruchtermanLayout(!1,t,e)})}assign(t,e){return Ht(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 Ht(this,void 0,void 0,function*(){if(this.running)return;const i=this.formatOptions(n),{dimensions:a,width:s,height:o,center:l,clustering:u,nodeClusterBy:c,maxIteration:h,onTick:d}=i,g=e.getAllNodes(),p=e.getAllEdges();if(!(g!=null&&g.length)){const x={nodes:[],edges:p};return this.lastResult=x,x}if(g.length===1){t&&e.mergeNodeData(g[0].id,{x:l[0],y:l[1],z:a===3?l[2]:void 0});const x={nodes:[Object.assign(Object.assign({},g[0]),{data:Object.assign(Object.assign({},g[0].data),{x:l[0],y:l[1],z:a===3?l[2]:void 0})})],edges:p};return this.lastResult=x,x}const v=g.map(x=>Wr(x,[s,o])),m=new Mn({nodes:v,edges:p}),b={};if(u&&v.forEach(x=>{const S=x.data[c];b[S]||(b[S]={name:S,cx:0,cy:0,count:0})}),this.lastLayoutNodes=v,this.lastLayoutEdges=p,this.lastAssign=t,this.lastGraph=m,this.lastOptions=i,this.lastClusterMap=b,typeof window>"u")return;let w=0;return new Promise(x=>{this.timeInterval=window.setInterval(()=>{if(!this.running){x({nodes:v,edges:p});return}this.runOneStep(m,b,i),t&&v.forEach(({id:S,data:_})=>e.mergeNodeData(S,{x:_.x,y:_.y,z:a===3?_.z:void 0})),d==null||d({nodes:v,edges:p}),w++,w>=h&&(window.clearInterval(this.timeInterval),x({nodes:v,edges:p}))},0),this.running=!0})})}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:n,nodeClusterBy:i}=e,{center:a,width:s,height:o}=e;return e.width=!s&&typeof window<"u"?window.innerWidth:s,e.height=!o&&typeof window<"u"?window.innerHeight:o,e.center=a||[e.width/2,e.height/2],e.clustering=n&&!!i,e}runOneStep(t,e,n){const{dimensions:i,height:a,width:s,gravity:o,center:l,speed:u,clustering:c,nodeClusterBy:h,clusterGravity:d}=n,g=a*s,p=Math.sqrt(g)/10,v=t.getAllNodes(),m=g/(v.length+1),b=Math.sqrt(m),w={};if(this.applyCalculate(t,w,b,m),c){for(const S in e)e[S].cx=0,e[S].cy=0,e[S].count=0;v.forEach(S=>{const{data:_}=S,M=e[_[h]];bt(_.x)&&(M.cx+=_.x),bt(_.y)&&(M.cy+=_.y),M.count++});for(const S in e)e[S].cx/=e[S].count,e[S].cy/=e[S].count;const x=d||o;v.forEach((S,_)=>{const{id:M,data:k}=S;if(!bt(k.x)||!bt(k.y))return;const C=e[k[h]],P=Math.sqrt((k.x-C.cx)*(k.x-C.cx)+(k.y-C.cy)*(k.y-C.cy)),T=b*x;w[M].x-=T*(k.x-C.cx)/P,w[M].y-=T*(k.y-C.cy)/P})}v.forEach((x,S)=>{const{id:_,data:M}=x;if(!bt(M.x)||!bt(M.y))return;const k=.01*b*o;w[_].x-=k*(M.x-l[0]),w[_].y-=k*(M.y-l[1]),i===3&&(w[_].z-=k*(M.z-l[2]))}),v.forEach((x,S)=>{const{id:_,data:M}=x;if(bt(M.fx)&&bt(M.fy)){M.x=M.fx,M.y=M.fy,i===3&&(M.z=M.fz);return}if(!bt(M.x)||!bt(M.y))return;const k=Math.sqrt(w[_].x*w[_].x+w[_].y*w[_].y+(i===3?w[_].z*w[_].z:0));if(k>0){const C=Math.min(p*(u/zut),k);t.mergeNodeData(_,{x:M.x+w[_].x/k*C,y:M.y+w[_].y/k*C,z:i===3?M.z+w[_].z/k*C:void 0})}})}applyCalculate(t,e,n,i){this.calRepulsive(t,e,i),this.calAttractive(t,e,n)}calRepulsive(t,e,n){const i=t.getAllNodes();i.forEach(({data:a,id:s},o)=>{e[s]={x:0,y:0,z:0},i.forEach(({data:l,id:u},c)=>{if(o<=c||!bt(a.x)||!bt(l.x)||!bt(a.y)||!bt(l.y))return;let h=a.x-l.x,d=a.y-l.y,g=this.options.dimensions===3?a.z-l.z:0,p=h*h+d*d+g*g;p===0&&(p=1,h=.01,d=.01,g=.01);const v=n/p,m=h*v,b=d*v,w=g*v;e[s].x+=m,e[s].y+=b,e[u].x-=m,e[u].y-=b,this.options.dimensions===3&&(e[s].z+=w,e[u].z-=w)})})}calAttractive(t,e,n){t.getAllEdges().forEach(a=>{const{source:s,target:o}=a;if(!s||!o||s===o)return;const{data:l}=t.getNode(s),{data:u}=t.getNode(o);if(!bt(u.x)||!bt(l.x)||!bt(u.y)||!bt(l.y))return;const c=u.x-l.x,h=u.y-l.y,d=this.options.dimensions===3?u.z-l.z:0,g=Math.sqrt(c*c+h*h+d*d)/n,p=c*g,v=h*g,m=d*g;e[s].x+=p,e[s].y+=v,e[o].x-=p,e[o].y-=v,this.options.dimensions===3&&(e[s].z+=m,e[o].z-=m)})}}const jut={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 qut{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},jut),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericGridLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericGridLayout(!0,t,e)})}genericGridLayout(t,e,n){return Ht(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{begin:a=[0,0],condense:s,preventOverlapPadding:o,preventOverlap:l,rows:u,cols:c,nodeSpacing:h,nodeSize:d,width:g,height:p,position:v}=i;let{sortBy:m}=i;const b=e.getAllNodes(),w=e.getAllEdges(),x=b==null?void 0:b.length;if(!x||x===1)return Uo(e,t,a);const S=b.map(q=>Wr(q));m!=="id"&&(!oe(m)||S[0].data[m]===void 0)&&(m="degree"),m==="degree"?S.sort((q,j)=>e.getDegree(j.id,"both")-e.getDegree(q.id,"both")):m==="id"?S.sort((q,j)=>bt(j.id)&&bt(q.id)?j.id-q.id:`${q.id}`.localeCompare(`${j.id}`)):S.sort((q,j)=>j.data[m]-q.data[m]);const _=!g&&typeof window<"u"?window.innerWidth:g,M=!p&&typeof window<"u"?window.innerHeight:p,k=x,C={rows:u,cols:c};if(u!=null&&c!=null)C.rows=u,C.cols=c;else if(u!=null&&c==null)C.rows=u,C.cols=Math.ceil(k/C.rows);else if(u==null&&c!=null)C.cols=c,C.rows=Math.ceil(k/C.cols);else{const q=Math.sqrt(k*M/_);C.rows=Math.round(q),C.cols=Math.round(_/M*q)}if(C.rows=Math.max(C.rows,1),C.cols=Math.max(C.cols,1),C.cols*C.rows>k){const q=Id(C),j=Dd(C);(q-1)*j>=k?Id(C,q-1):(j-1)*q>=k&&Dd(C,j-1)}else for(;C.cols*C.rows<k;){const q=Id(C),j=Dd(C);(j+1)*q>=k?Dd(C,j+1):Id(C,q+1)}let P=s?0:_/C.cols,T=s?0:M/C.rows;if(l||h){const q=Oo(10,h),j=hE(30,d,!1);S.forEach(B=>{(!B.data.x||!B.data.y)&&(B.data.x=0,B.data.y=0);const D=e.getNode(B.id),[G,X]=Vc(j(D)||30),K=q!==void 0?q(B):o,ht=G+K,ut=X+K;P=Math.max(P,ht),T=Math.max(T,ut)})}const A={},R={row:0,col:0},L={};for(let q=0;q<S.length;q++){const j=S[q];let B;if(v&&(B=v(e.getNode(j.id))),B&&(B.row!==void 0||B.col!==void 0)){const D={row:B.row,col:B.col};if(D.col===void 0)for(D.col=0;lx(A,D);)D.col++;else if(D.row===void 0)for(D.row=0;lx(A,D);)D.row++;L[j.id]=D,i5(A,D)}Wut(j,a,P,T,L,C,R,A)}const $={nodes:S,edges:w};return t&&S.forEach(q=>{e.mergeNodeData(q.id,{x:q.data.x,y:q.data.y})}),$})}}const Id=(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},Dd=(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},lx=(r,t)=>r[`c-${t.row}-${t.col}`]||!1,i5=(r,t)=>r[`c-${t.row}-${t.col}`]=!0,XP=(r,t)=>{const e=r.cols||5;t.col++,t.col>=e&&(t.col=0,t.row++)},Wut=(r,t,e,n,i,a,s,o)=>{let l,u;const c=i[r.id];if(c)l=c.col*e+e/2+t[0],u=c.row*n+n/2+t[1];else{for(;lx(o,s);)XP(a,s);l=s.col*e+e/2+t[0],u=s.row*n+n/2+t[1],i5(o,s),XP(a,s)}r.data.x=l,r.data.y=u},Gut=(r,t,e)=>{try{const n=Cs.mul(Cs.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 I6(n),l=Cs.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map(u=>Cs.mul([u],[l]).toJSON()[0].splice(0,r))}catch{const i=[];for(let a=0;a<t.length;a++){const s=Math.random()*e,o=Math.random()*e;i.push([s,o])}return i}},Vut=800,Hut={iterations:10,height:10,width:10,speed:100,gravity:10,k:5},Uut=(r,t)=>{const e=Object.assign(Object.assign({},Hut),t),{positions:n,iterations:i,width:a,k:s,speed:o=100,strictRadial:l,focusIdx:u,radii:c=[],nodeSizeFunc:h}=e,d=r.getAllNodes(),g=[],p=a/10;for(let v=0;v<i;v++)n.forEach((m,b)=>{g[b]={x:0,y:0}}),Yut(d,n,g,s,c,h),Xut(n,g,o,l,u,p,a,c);return n},Yut=(r,t,e,n,i,a)=>{t.forEach((s,o)=>{e[o]={x:0,y:0},t.forEach((l,u)=>{if(o===u||i[o]!==i[u])return;let c=s.x-l.x,h=s.y-l.y,d=Math.sqrt(c*c+h*h);if(d===0){d=1;const g=o>u?1:-1;c=.01*g,h=.01*g}if(d<a(r[o])/2+a(r[u])/2){const g=n*n/d;e[o].x+=c/d*g,e[o].y+=h/d*g}})})},Xut=(r,t,e,n,i,a,s,o)=>{const l=a||s/10;return n&&t.forEach((u,c)=>{const h=r[c].x-r[i].x,d=r[c].y-r[i].y,g=Math.sqrt(h*h+d*d);let p=d/g,v=-h/g;const m=Math.sqrt(u.x*u.x+u.y*u.y);let b=Math.acos((p*u.x+v*u.y)/m);b>Math.PI/2&&(b-=Math.PI/2,p*=-1,v*=-1);const w=Math.cos(b)*m;u.x=p*w,u.y=v*w}),r.forEach((u,c)=>{if(c===i)return;const h=Math.sqrt(t[c].x*t[c].x+t[c].y*t[c].y);if(h>0&&c!==i){const d=Math.min(l*(e/Vut),h);if(u.x+=t[c].x/h*d,u.y+=t[c].y/h*d,n){let g=u.x-r[i].x,p=u.y-r[i].y;const v=Math.sqrt(g*g+p*p);g=g/v*o[c],p=p/v*o[c],u.x=r[i].x+g,u.y=r[i].y+p}}}),r},Kut={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class Zut{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},Kut),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericRadialLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericRadialLayout(!0,t,e)})}genericRadialLayout(t,e,n){return Ht(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,focusNode:l,unitRadius:u,nodeSize:c,nodeSpacing:h,strictRadial:d,preventOverlap:g,maxPreventOverlapIteration:p,sortBy:v,linkDistance:m=50,sortStrength:b=10,maxIteration:w=1e3}=i,x=e.getAllNodes(),S=e.getAllEdges(),_=!a&&typeof window<"u"?window.innerWidth:a,M=!s&&typeof window<"u"?window.innerHeight:s,k=o||[_/2,M/2];if(!(x!=null&&x.length)||x.length===1)return Uo(e,t,k);let C=x[0];if(oe(l)){for(let mt=0;mt<x.length;mt++)if(x[mt].id===l){C=x[mt];break}}else C=l||x[0];const P=tct(x,C.id),T=E6({nodes:x,edges:S}),A=x6(T),R=nct(A,P);ect(A,P,R+1);const L=A[P];let $=_-k[0]>k[0]?k[0]:_-k[0],q=M-k[1]>k[1]?k[1]:M-k[1];$===0&&($=_/2),q===0&&(q=M/2);const j=Math.min($,q),B=Math.max(...L),D=[],G=u||j/B;L.forEach((mt,It)=>{D[It]=mt*G});const X=Jut(x,A,m,D,G,v,b),K=Qut(X),ht=Gut(m,X,m);let ut=ht.map(([mt,It])=>({x:(isNaN(mt)?Math.random()*m:mt)-ht[P][0],y:(isNaN(It)?Math.random()*m:It)-ht[P][1]}));this.run(w,ut,K,X,D,P);let ct;if(g){ct=dE(c,h);const mt={nodes:x,nodeSizeFunc:ct,positions:ut,radii:D,height:M,width:_,strictRadial:!!d,focusIdx:P,iterations:p||200,k:ut.length/4.5};ut=Uut(e,mt)}const dt=[];return ut.forEach((mt,It)=>{const zt=Wr(x[It]);zt.data.x=mt.x+k[0],zt.data.y=mt.y+k[1],dt.push(zt)}),t&&dt.forEach(mt=>e.mergeNodeData(mt.id,{x:mt.data.x,y:mt.data.y})),{nodes:dt,edges:S}})}run(t,e,n,i,a,s){for(let o=0;o<=t;o++){const l=o/t;this.oneIteration(l,e,a,i,n,s)}}oneIteration(t,e,n,i,a,s){const o=1-t;e.forEach((l,u)=>{const c=Ak(l,{x:0,y:0}),h=c===0?0:1/c;if(u===s)return;let d=0,g=0,p=0;e.forEach((m,b)=>{if(u===b)return;const w=Ak(l,m),x=w===0?0:1/w,S=i[b][u];p+=a[u][b],d+=a[u][b]*(m.x+S*(l.x-m.x)*x),g+=a[u][b]*(m.y+S*(l.y-m.y)*x)});const v=n[u]===0?0:1/n[u];p*=o,p+=t*v*v,d*=o,d+=t*v*l.x*h,l.x=d/p,g*=o,g+=t*v*l.y*h,l.y=g/p})}}const Jut=(r,t,e,n,i,a,s)=>{if(!r)return[];const o=[];if(t){const l={};t.forEach((u,c)=>{const h=[];u.forEach((d,g)=>{var p,v;if(c===g)h.push(0);else if(n[c]===n[g])if(a==="data")h.push(d*(Math.abs(c-g)*s)/(n[c]/i));else if(a){let m,b;if(l[r[c].id])m=l[r[c].id];else{const w=(a==="id"?r[c].id:(p=r[c].data)===null||p===void 0?void 0:p[a])||0;oe(w)?m=w.charCodeAt(0):m=w,l[r[c].id]=m}if(l[r[g].id])b=l[r[g].id];else{const w=(a==="id"?r[g].id:(v=r[g].data)===null||v===void 0?void 0:v[a])||0;oe(w)?b=w.charCodeAt(0):b=w,l[r[g].id]=b}h.push(d*(Math.abs(m-b)*s)/(n[c]/i))}else h.push(d*e/(n[c]/i));else{const m=(e+i)/2;h.push(d*m)}}),o.push(h)})}return o},Qut=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},tct=(r,t)=>{let e=-1;return r.forEach((n,i)=>{n.id===t&&(e=i)}),Math.max(e,0)},ect=(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}}},nct=(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},rct={center:[0,0],width:300,height:300};class ict{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},rct),t)}execute(t,e){return Ht(this,void 0,void 0,function*(){return this.genericRandomLayout(!1,t,e)})}assign(t,e){return Ht(this,void 0,void 0,function*(){yield this.genericRandomLayout(!0,t,e)})}genericRandomLayout(t,e,n){return Ht(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o}=i,l=e.getAllNodes(),u=.9,c=!s&&typeof window<"u"?window.innerWidth:s,h=!o&&typeof window<"u"?window.innerHeight:o,d=a||[c/2,h/2],g=[];return l&&l.forEach(v=>{g.push({id:v.id,data:{x:(Math.random()-.5)*u*c+d[0],y:(Math.random()-.5)*u*h+d[1]}})}),t&&g.forEach(v=>e.mergeNodeData(v.id,{x:v.data.x,y:v.data.y})),{nodes:g,edges:e.getAllEdges()}})}}/**
- * @license
- * Copyright 2019 Google LLC
- * SPDX-License-Identifier: Apache-2.0
- */const a5=Symbol("Comlink.proxy"),act=Symbol("Comlink.endpoint"),s5=Symbol("Comlink.releaseProxy"),Wb=Symbol("Comlink.finalizer"),sf=Symbol("Comlink.thrown"),o5=r=>typeof r=="object"&&r!==null||typeof r=="function",sct={canHandle:r=>o5(r)&&r[a5],serialize(r){const{port1:t,port2:e}=new MessageChannel;return u5(r,t),[e,[e]]},deserialize(r){return r.start(),h5(r)}},oct={canHandle:r=>o5(r)&&sf 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}},l5=new Map([["proxy",sct],["throw",oct]]);function lct(r,t){for(const e of r)if(t===e||e==="*"||e instanceof RegExp&&e.test(t))return!0;return!1}function u5(r,t=globalThis,e=["*"]){t.addEventListener("message",function n(i){if(!i||!i.data)return;if(!lct(e,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:s,path:o}=Object.assign({path:[]},i.data),l=(i.data.argumentList||[]).map(mo);let u;try{const c=o.slice(0,-1).reduce((d,g)=>d[g],r),h=o.reduce((d,g)=>d[g],r);switch(s){case"GET":u=h;break;case"SET":c[o.slice(-1)[0]]=mo(i.data.value),u=!0;break;case"APPLY":u=h.apply(c,l);break;case"CONSTRUCT":{const d=new h(...l);u=gct(d)}break;case"ENDPOINT":{const{port1:d,port2:g}=new MessageChannel;u5(r,g),u=fct(d,[d])}break;case"RELEASE":u=void 0;break;default:return}}catch(c){u={value:c,[sf]:0}}Promise.resolve(u).catch(c=>({value:c,[sf]:0})).then(c=>{const[h,d]=Uf(c);t.postMessage(Object.assign(Object.assign({},h),{id:a}),d),s==="RELEASE"&&(t.removeEventListener("message",n),c5(t),Wb in r&&typeof r[Wb]=="function"&&r[Wb]())}).catch(c=>{const[h,d]=Uf({value:new TypeError("Unserializable return value"),[sf]:0});t.postMessage(Object.assign(Object.assign({},h),{id:a}),d)})}),t.start&&t.start()}function uct(r){return r.constructor.name==="MessagePort"}function c5(r){uct(r)&&r.close()}function h5(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)}}),ux(r,e,[],t)}function Fd(r){if(r)throw new Error("Proxy has been released and is not useable")}function d5(r){return Al(r,new Map,{type:"RELEASE"}).then(()=>{c5(r)})}const Vf=new WeakMap,Hf="FinalizationRegistry"in globalThis&&new FinalizationRegistry(r=>{const t=(Vf.get(r)||0)-1;Vf.set(r,t),t===0&&d5(r)});function cct(r,t){const e=(Vf.get(t)||0)+1;Vf.set(t,e),Hf&&Hf.register(r,t,r)}function hct(r){Hf&&Hf.unregister(r)}function ux(r,t,e=[],n=function(){}){let i=!1;const a=new Proxy(n,{get(s,o){if(Fd(i),o===s5)return()=>{hct(a),d5(r),t.clear(),i=!0};if(o==="then"){if(e.length===0)return{then:()=>a};const l=Al(r,t,{type:"GET",path:e.map(u=>u.toString())}).then(mo);return l.then.bind(l)}return ux(r,t,[...e,o])},set(s,o,l){Fd(i);const[u,c]=Uf(l);return Al(r,t,{type:"SET",path:[...e,o].map(h=>h.toString()),value:u},c).then(mo)},apply(s,o,l){Fd(i);const u=e[e.length-1];if(u===act)return Al(r,t,{type:"ENDPOINT"}).then(mo);if(u==="bind")return ux(r,t,e.slice(0,-1));const[c,h]=KP(l);return Al(r,t,{type:"APPLY",path:e.map(d=>d.toString()),argumentList:c},h).then(mo)},construct(s,o){Fd(i);const[l,u]=KP(o);return Al(r,t,{type:"CONSTRUCT",path:e.map(c=>c.toString()),argumentList:l},u).then(mo)}});return cct(a,r),a}function dct(r){return Array.prototype.concat.apply([],r)}function KP(r){const t=r.map(Uf);return[t.map(e=>e[0]),dct(t.map(e=>e[1]))]}const f5=new WeakMap;function fct(r,t){return f5.set(r,t),r}function gct(r){return Object.assign(r,{[a5]:!0})}function Uf(r){for(const[t,e]of l5)if(e.canHandle(r)){const[n,i]=e.serialize(r);return[{type:"HANDLER",name:t,value:n},i]}return[{type:"RAW",value:r},f5.get(r)||[]]}function mo(r){switch(r.type){case"HANDLER":return l5.get(r.name).deserialize(r.value);case"RAW":return r.value}}function Al(r,t,e,n){return new Promise(i=>{const a=pct();t.set(a,i),r.start&&r.start(),r.postMessage(Object.assign({id:a},e),n)})}function pct(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class vct extends T0{constructor(t,e,n){super(),this.graph=t,this.layout=e,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=h5(new Worker(new URL("/assets/worker-oDIEKZfz.js",import.meta.url),{type:"module"})),this.running&&(this.running=!1,this.execute())}execute(){var t;return Ht(this,void 0,void 0,function*(){if(this.running)return this;this.running=!0;const e=this.layout.options,{onTick:n}=e,i=Je(e,["onTick"]),a={};Object.keys(i).forEach(u=>{Et(i[u])||(a[u]=i[u])});const s={layout:{id:this.layout.id,options:a,iterations:(t=this.options)===null||t===void 0?void 0:t.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},o=new Float32Array([0]),[l]=yield this.proxy.calculateLayout(s,[o]);return l})}stop(){return this.running=!1,this.proxy.stopLayout(),this}kill(){this.proxy[s5]()}isRunning(){return this.running}}var mct=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class lg extends O0{constructor(){super(...arguments),this.id="fishbone"}getRoot(){const t=this.context.model.getRootsData();if(!(Zi(t)||t.length>2))return t[0]}formatSize(t){const e=typeof t=="function"?t:()=>t;return n=>Hr(e(n))}doLayout(t,e){const{hGap:n,getRibSep:i,vGap:a,nodeSize:s,height:o}=e,{model:l}=this.context,u=this.formatSize(s);let c=u(t)[0]+i(t);const h=(x,S=0)=>{var _;return S+=n*((x.children||[]).length+1),(_=x.children)===null||_===void 0||_.forEach(M=>{var k;(k=l.getNodeLikeDatum(M).children)===null||k===void 0||k.forEach(P=>{const T=l.getNodeLikeDatum(P);S=h(T,S)})}),S},d=x=>{if(x.depth===1)return c;const S=l.getParentData(x.id,"tree");if(wl(x)){const _=l.getParentData(S.id,"tree"),M=v(x)-v(_);return d(S)+M*n/a}else{const _=(S.children||[]).indexOf(x.id),M=l.getNodeData((S.children||[]).slice(_));return g(S)-M.reduce((k,C)=>k+h(C),0)-u(S)[0]/2}},g=dw(x=>{if(Gb(x))return u(x)[0]/2;const S=l.getParentData(x.id,"tree");if(wl(x))return d(x)+h(x)+u(x)[0]/2;{const _=v(x)-v(S),M=n/a;return d(x)+_*M}},x=>x.id),p=x=>v(l.getParentData(x,"tree")),v=dw(x=>{if(Gb(x))return o/2;if(wl(x)){const S=l.getParentData(x.id,"tree"),_=S.children.indexOf(x.id);if(_===0)return p(S.id)+a;const M=l.getNodeLikeDatum(S.children[_-1]);if(Zi(M.children))return v(M)+a;const k=l.getDescendantsData(M.id);return Math.max(...k.map(C=>wl(C)?p(C.id):v(C)))+a}else{if(Zi(x.children))return p(x.id)+a;const S=l.getNodeLikeDatum(x.children.slice(-1)[0]);if(Zi(S.children))return v(S)+a;const _=l.getDescendantsData(x.id).slice(-1)[0];return(wl(_)?p(_.id):v(_))+a}},x=>x.id);let m=0;const b={nodes:[],edges:[]},w=x=>{var S;(S=x.children)===null||S===void 0||S.forEach(P=>w(l.getNodeLikeDatum(P)));const _=v(x),M=g(x);if(b.nodes.push({id:x.id,x:M,y:_}),Gb(x))return;const k=l.getRelatedEdgesData(x.id,"in")[0],C=[d(x),wl(x)?_:p(x.id)];b.edges.push({id:H(k),controlPoints:[C],relatedNodeId:x.id}),m=Math.max(m,M+i(x)),x.depth===1&&(c=m)};return w(t),b}placeAlterative(t,e){const n=(e.children||[]).filter((o,l)=>l%2!==0);if(n.length===0)return t;const{model:i}=this.context,a=t.nodes.find(o=>o.id===e.id).y,s=o=>{const l=i.getAncestorsData(o,"tree");if(Zi(l))return!1;const u=l.length===1?o:l[l.length-2].id;return n.includes(u)};t.nodes.forEach(o=>{s(o.id)&&(o.y=2*a-o.y)}),t.edges.forEach(o=>{s(o.relatedNodeId)&&(o.controlPoints=o.controlPoints.map(l=>[l[0],2*a-l[1]]))})}rightToLeft(t,e){return t.nodes.forEach(n=>n.x=e.width-n.x),t.edges.forEach(n=>{n.controlPoints=n.controlPoints.map(i=>[e.width-i[0],i[1]])}),t}execute(t,e){return mct(this,void 0,void 0,function*(){const n=Object.assign(Object.assign(Object.assign({},lg.defaultOptions),this.options),e),{direction:i,nodeSize:a}=n,s=this.getRoot();if(!s)return t;const o=this.formatSize(a);n.vGap||(n.vGap=Math.max(...(t.nodes||[]).map(d=>o(d)[1]))),n.hGap||(n.hGap=Math.max(...(t.nodes||[]).map(d=>o(d)[0])));let l=this.doLayout(s,n);this.placeAlterative(l,s),i==="RL"&&(l=this.rightToLeft(l,n));const{model:u}=this.context,c=[],h=[];return l.nodes.forEach(d=>{const{id:g,x:p,y:v}=d,m=u.getNodeLikeDatum(g);c.push(ZP(m,{x:p,y:v}))}),l.edges.forEach(d=>{const{id:g,controlPoints:p}=d,v=u.getEdgeDatum(g);h.push(ZP(v,{controlPoints:p}))}),{nodes:c,edges:h}})}}lg.defaultOptions={direction:"RL",getRibSep:()=>60};const ZP=(r,t)=>Object.assign(Object.assign({},r),{style:Object.assign(Object.assign({},r.style||{}),t)}),Gb=r=>r.depth===0,wl=r=>(r.depth||(r.depth=0))%2===0;var yct=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class ug extends O0{constructor(){super(...arguments),this.id="snake"}formatSize(t,e){const n=typeof e=="function"?e:()=>e;return t.reduce((i,a)=>{const[s,o]=Hr(n(a))||[0,0];return[Math.max(i[0],s),Math.max(i[1],o)]},[0,0])}validate(t){const{nodes:e=[],edges:n=[]}=t,i={},a={},s={};e.forEach(d=>{i[d.id]=0,a[d.id]=0,s[d.id]=[]}),n.forEach(d=>{i[d.target]++,a[d.source]++,s[d.source].push(d.target)});const o=new Set,l=d=>{o.has(d)||(o.add(d),s[d].forEach(l))};if(l(e[0].id),o.size!==e.length)return!1;const u=e.filter(d=>i[d.id]===0),c=e.filter(d=>a[d.id]===0);return!(u.length!==1||c.length!==1||e.filter(d=>i[d.id]===1&&a[d.id]===1).length!==e.length-2)}execute(t,e){return yct(this,void 0,void 0,function*(){var n;if(!this.validate(t))return t;const{nodeSize:i,padding:a,sortBy:s,cols:o,colGap:l,rowGap:u,clockwise:c,width:h,height:d}=Object.assign({},ug.defaultOptions,this.options,e),[g,p,v,m]=la(a),b=this.formatSize(t.nodes||[],i),w=Math.ceil((t.nodes||[]).length/o);let x=l||(h-m-p-o*b[0])/(o-1),S=u||(d-g-v-w*b[1])/(w-1);return(S===1/0||S<0)&&(S=0),(x===1/0||x<0)&&(x=0),{nodes:((s?(n=t.nodes)===null||n===void 0?void 0:n.sort(s):bct(t))||[]).map((k,C)=>{const P=Math.floor(C/o),T=C%o,A=c?P%2===0?T:o-1-T:P%2===0?o-1-T:T,R=m+A*(b[0]+x)+b[0]/2,L=g+P*(b[1]+S)+b[1]/2;return{id:k.id,style:{x:R,y:L}}})}})}}ug.defaultOptions={padding:0,cols:5,clockwise:!0};function bct(r){const{nodes:t=[],edges:e=[]}=r,n={},i={};t.forEach(o=>{n[o.id]=0,i[o.id]=[]}),e.forEach(o=>{n[o.target]++,i[o.source].push(o.target)});const a=[],s=[];for(t.forEach(o=>{n[o.id]===0&&a.push(o.id)});a.length>0;){const o=a.shift(),l=t.find(u=>u.id===o);s.push(l),i[o].forEach(u=>{n[u]--,n[u]===0&&a.push(u)})}return s}const wct=["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)"],xct=["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)"],Ect=["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)"],_ct=["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)"],Sct=["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 Gn extends Xx{}function su(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 cx(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 Mct=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class cg extends Gn{constructor(t,e){super(t,Object.assign({},cg.defaultOptions,e)),this.$element=su("background"),this.context.canvas.getContainer().prepend(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return Mct(this,void 0,void 0,function*(){e.update.call(this,t),Object.assign(this.$element.style,Px(this.options,["key","type"]))})}destroy(){super.destroy(),this.$element.remove()}}cg.defaultOptions={transition:"background 0.5s",backgroundSize:"cover",zIndex:"-1"};function BE(r,t,e,n,i,a){const s=r,o=t,l=e-s,u=n-o;let c=i-s,h=a-o,d=c*l+h*u,g=0;d<=0?g=0:(c=l-c,h=u-h,d=c*l+h*u,d<=0?g=0:g=d*d/(l*l+u*u));const p=c*c+h*h-g;return p<0?0:p}function Os(r,t,e,n){return(r-e)*(r-e)+(t-n)*(t-n)}function JP(r,t,e,n,i){return Os(r,t,e,n)<i*i}function kct(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 g5(r){const t=Math.min(r.x1,r.x2),e=Math.max(r.x1,r.x2),n=Math.min(r.y1,r.y2),i=Math.max(r.y1,r.y2);return{x:t,y:n,x2:e,y2:i,width:e-t,height:i-n}}class An{constructor(t,e,n,i){this.x1=t,this.y1=e,this.x2=n,this.y2=i}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}draw(t){t.moveTo(this.x1,this.y1),t.lineTo(this.x2,this.y2)}toString(){return`Line(from=(${this.x1},${this.y1}),to=(${this.x2},${this.y2}))`}static from(t){return new An(t.x1,t.y1,t.x2,t.y2)}cuts(t,e){if(this.y1===this.y2||e<this.y1&&e<=this.y2||e>this.y1&&e>=this.y2||t>this.x1&&t>=this.x2)return!1;if(t<this.x1&&t<=this.x2)return!0;const n=this.x1+(e-this.y1)*(this.x2-this.x1)/(this.y2-this.y1);return t<=n}distSquare(t,e){return BE(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 Ke;(function(r){r[r.POINT=1]="POINT",r[r.PARALLEL=2]="PARALLEL",r[r.COINCIDENT=3]="COINCIDENT",r[r.NONE=4]="NONE"})(Ke||(Ke={}));class Vb{constructor(t,e=0,n=0){this.state=t,this.x=e,this.y=n}}function Bd(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 Vb(Ke.POINT,r.x1+a*(r.x2-r.x1),r.y1+a*(r.y2-r.y1)):new Vb(Ke.NONE)}return new Vb(e===0||n===0?Ke.COINCIDENT:Ke.PARALLEL)}function p5(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 Cct(r,t){function e(i,a,s,o){let l=p5(t,new An(i,a,s,o));return l=Math.abs(l-.5),l>=0&&l<=1?1:0}let n=e(r.x,r.y,r.x2,r.y);return n+=e(r.x,r.y,r.x,r.y2),n>1||(n+=e(r.x,r.y2,r.x2,r.y2),n>1)?!0:(n+=e(r.x2,r.y,r.x2,r.y2),n>0)}var Ze;(function(r){r[r.LEFT=0]="LEFT",r[r.TOP=1]="TOP",r[r.RIGHT=2]="RIGHT",r[r.BOTTOM=3]="BOTTOM"})(Ze||(Ze={}));function of(r,t,e){const n=new Set;return r.width<=0?(n.add(Ze.LEFT),n.add(Ze.RIGHT)):t<r.x?n.add(Ze.LEFT):t>r.x+r.width&&n.add(Ze.RIGHT),r.height<=0?(n.add(Ze.TOP),n.add(Ze.BOTTOM)):e<r.y?n.add(Ze.TOP):e>r.y+r.height&&n.add(Ze.BOTTOM),n}function v5(r,t){let e=t.x1,n=t.y1;const i=t.x2,a=t.y2,s=Array.from(of(r,i,a));if(s.length===0)return!0;let o=of(r,e,n);for(;o.size!==0;){for(const l of s)if(o.has(l))return!1;if(o.has(Ze.RIGHT)||o.has(Ze.LEFT)){let l=r.x;o.has(Ze.RIGHT)&&(l+=r.width),n=n+(l-e)*(a-n)/(i-e),e=l}else{let l=r.y;o.has(Ze.BOTTOM)&&(l+=r.height),e=e+(l-n)*(i-e)/(a-n),n=l}o=of(r,e,n)}return!0}function Tct(r,t){let e=Number.POSITIVE_INFINITY,n=0;function i(a,s,o,l){let u=p5(t,new An(a,s,o,l));u=Math.abs(u-.5),u>=0&&u<=1&&(n++,u<e&&(e=u))}return i(r.x,r.y,r.x2,r.y),i(r.x,r.y,r.x,r.y2),n>1||(i(r.x,r.y2,r.x2,r.y2),n>1)?e:(i(r.x2,r.y,r.x2,r.y2),n===0?-1:e)}function Oct(r,t){let e=0;const n=Bd(r,new An(t.x,t.y,t.x2,t.y));e+=n.state===Ke.POINT?1:0;const i=Bd(r,new An(t.x,t.y,t.x,t.y2));e+=i.state===Ke.POINT?1:0;const a=Bd(r,new An(t.x,t.y2,t.x2,t.y2));e+=a.state===Ke.POINT?1:0;const s=Bd(r,new An(t.x2,t.y,t.x2,t.y2));return e+=s.state===Ke.POINT?1:0,{top:n,left:i,bottom:a,right:s,count:e}}class Xn{constructor(t,e,n,i){this.x=t,this.y=e,this.width=n,this.height=i}get x2(){return this.x+this.width}get y2(){return this.y+this.height}get cx(){return this.x+this.width/2}get cy(){return this.y+this.height/2}get radius(){return Math.max(this.width,this.height)/2}static from(t){return new Xn(t.x,t.y,t.width,t.height)}equals(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}clone(){return new Xn(this.x,this.y,this.width,this.height)}add(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x2,t.x+t.width),a=Math.max(this.y2,t.y+t.height);this.x=e,this.y=n,this.width=i-e,this.height=a-n}addPoint(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x2,t.x),a=Math.max(this.y2,t.y);this.x=e,this.y=n,this.width=i-e,this.height=a-n}toString(){return`Rectangle[x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height}]`}draw(t){t.rect(this.x,this.y,this.width,this.height)}containsPt(t,e){return t>=this.x&&t<=this.x2&&e>=this.y&&e<=this.y2}get area(){return this.width*this.height}intersects(t){return this.area<=0||t.width<=0||t.height<=0?!1:t.x+t.width>this.x&&t.y+t.height>this.y&&t.x<this.x2&&t.y<this.y2}distSquare(t,e){if(this.containsPt(t,e))return 0;const n=of(this,t,e);return n.has(Ze.TOP)?n.has(Ze.LEFT)?Os(t,e,this.x,this.y):n.has(Ze.RIGHT)?Os(t,e,this.x2,this.y):(this.y-e)*(this.y-e):n.has(Ze.BOTTOM)?n.has(Ze.LEFT)?Os(t,e,this.x,this.y2):n.has(Ze.RIGHT)?Os(t,e,this.x2,this.y2):(e-this.y2)*(e-this.y2):n.has(Ze.LEFT)?(this.x-t)*(this.x-t):n.has(Ze.RIGHT)?(t-this.x2)*(t-this.x2):0}}function Act(r){if(r.length===0)return null;const t=r[0],e=new Xn(t.x,t.y,0,0);for(const n of r)e.addPoint(n);return e}class Yf{constructor(t,e,n){this.cx=t,this.cy=e,this.radius=n}get x(){return this.cx-this.radius}get x2(){return this.cx+this.radius}get width(){return this.radius*2}get y(){return this.cy-this.radius}get y2(){return this.cy+this.radius}get height(){return this.radius*2}static from(t){return new Yf(t.cx,t.cy,t.radius)}containsPt(t,e){return Os(this.cx,this.cy,t,e)<this.radius*this.radius}distSquare(t,e){const n=Os(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 Po{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 Po(this.pixelGroup,t.x,t.y,e.x,e.y,t.width,t.height)}static fromPixelRegion(t,e){return new Po(e,0,0,t.x,t.y,Math.ceil(t.width/e),Math.ceil(t.height/e))}copy(t,e){return new Po(this.pixelGroup,this.scaleX(e.x),this.scaleY(e.y),e.x,e.y,t.width,t.height,t.area)}boundX(t){return t<this.i?this.i:t>=this.width?this.width-1:t}boundY(t){return t<this.j?this.j:t>=this.height?this.height-1:t}scaleX(t){return this.boundX(Math.floor((t-this.pixelX)/this.pixelGroup))}scaleY(t){return this.boundY(Math.floor((t-this.pixelY)/this.pixelGroup))}scale(t){const e=this.scaleX(t.x),n=this.scaleY(t.y),i=this.boundX(Math.ceil((t.x+t.width-this.pixelX)/this.pixelGroup)),a=this.boundY(Math.ceil((t.y+t.height-this.pixelY)/this.pixelGroup)),s=i-e,o=a-n;return new Xn(e,n,s,o)}invertScaleX(t){return Math.round(t*this.pixelGroup+this.pixelX)}invertScaleY(t){return Math.round(t*this.pixelGroup+this.pixelY)}addPadding(t,e){const n=Math.ceil(e/this.pixelGroup),i=this.boundX(t.x-n),a=this.boundY(t.y-n),s=this.boundX(t.x2+n),o=this.boundY(t.y2+n),l=s-i,u=o-a;return new Xn(i,a,l,u)}get(t,e){return t<0||e<0||t>=this.width||e>=this.height?Number.NaN:this.area[t+e*this.width]}inc(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]+=n)}set(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]=n)}incArea(t,e){if(t.width<=0||t.height<=0||e===0)return;const n=this.width,i=t.width,a=Math.max(0,t.i),s=Math.max(0,t.j),o=Math.min(t.i+t.width,n),l=Math.min(t.j+t.height,this.height);if(!(l<=0||o<=0||a>=n||l>=this.height))for(let u=s;u<l;u++){const c=(u-t.j)*i,h=u*n;for(let d=a;d<o;d++){const g=t.area[d-t.i+c];g!==0&&(this.area[d+h]+=e*g)}}}fill(t){this.area.fill(t)}fillArea(t,e){const n=t.x+t.y*this.width;for(let i=0;i<t.height;i++){const a=n+i*this.width;this.area.fill(e,a,a+t.width)}}fillHorizontalLine(t,e,n,i){const a=t+e*this.width;this.area.fill(i,a,a+n)}fillVerticalLine(t,e,n,i){const a=t+e*this.width;for(let s=0;s<n;s++)this.area[a+s*this.width]=i}clear(){this.area.fill(0)}toString(){let t="";for(let e=0;e<this.height;e++){const n=e*this.width;for(let i=0;i<this.width;i++){const a=this.area[n+i];t+=a.toFixed(1).padStart(6),t+=" "}t+=`
- `}return t}draw(t,e=!0){if(this.width<=0||this.height<=0)return;t.save(),e&&t.translate(this.pixelX,this.pixelY);const n=this.area.reduce((s,o)=>Math.min(s,o),Number.POSITIVE_INFINITY),i=this.area.reduce((s,o)=>Math.max(s,o),Number.NEGATIVE_INFINITY),a=s=>(s-n)/(i-n);t.scale(this.pixelGroup,this.pixelGroup);for(let s=0;s<this.width;s++)for(let o=0;o<this.height;o++){const l=this.area[s+o*this.width];t.fillStyle=`rgba(0, 0, 0, ${a(l)})`,t.fillRect(s,o,1,1)}t.restore()}drawThreshold(t,e,n=!0){if(!(this.width<=0||this.height<=0)){t.save(),n&&t.translate(this.pixelX,this.pixelY),t.scale(this.pixelGroup,this.pixelGroup);for(let i=0;i<this.width;i++)for(let a=0;a<this.height;a++){const s=this.area[i+a*this.width];t.fillStyle=s>e?"black":"white",t.fillRect(i,a,1,1)}t.restore()}}}function m5(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 QP(r,t,e){return y5(Object.assign(g5(r),{distSquare:(n,i)=>BE(r.x1,r.y1,r.x2,r.y2,n,i)}),t,e)}function y5(r,t,e){const n=m5(r,e),i=t.scale(n),a=t.createSub(i,n);return Pct(a,t,e,(s,o)=>r.distSquare(s,o)),a}function Pct(r,t,e,n){const i=e*e;for(let a=0;a<r.height;a++)for(let s=0;s<r.width;s++){const o=t.invertScaleX(r.i+s),l=t.invertScaleY(r.j+a),u=n(o,l);if(u===0){r.set(s,a,i);continue}if(u<i){const c=e-Math.sqrt(u);r.set(s,a,c*c)}}return r}function Nct(r,t,e){const n=t.scale(r),i=t.addPadding(n,e),a=t.createSub(i,{x:r.x-e,y:r.y-e}),s=n.x-i.x,o=n.y-i.y,l=i.x2-n.x2,u=i.y2-n.y2,c=i.width-s-l,h=i.height-o-u,d=e*e;a.fillArea({x:s,y:o,width:c+1,height:h+1},d);const g=[0],p=Math.max(o,s,l,u);{const w=t.invertScaleX(n.x+n.width/2);for(let x=1;x<p;x++){const S=t.invertScaleY(n.y-x),_=r.distSquare(w,S);if(_<d){const M=e-Math.sqrt(_);g.push(M*M)}else break}}const v=[],m=Math.max(s,l),b=Math.max(o,l);for(let w=1;w<m;w++){const x=t.invertScaleX(n.x-w),S=[];for(let _=1;_<b;_++){const M=t.invertScaleY(n.y-_),k=r.distSquare(x,M);if(k<d){const C=e-Math.sqrt(k);S.push(C*C)}else S.push(0)}v.push(S)}for(let w=1;w<Math.min(o,g.length);w++){const x=g[w];a.fillHorizontalLine(s,o-w,c+1,x)}for(let w=1;w<Math.min(u,g.length);w++){const x=g[w];a.fillHorizontalLine(s,o+h+w,c+1,x)}for(let w=1;w<Math.min(s,g.length);w++){const x=g[w];a.fillVerticalLine(s-w,o,h+1,x)}for(let w=1;w<Math.min(u,g.length);w++){const x=g[w];a.fillVerticalLine(s+c+w,o,h+1,x)}for(let w=1;w<s;w++){const x=v[w-1],S=s-w;for(let _=1;_<o;_++)a.set(S,o-_,x[_-1]);for(let _=1;_<u;_++)a.set(S,o+h+_,x[_-1])}for(let w=1;w<l;w++){const x=v[w-1],S=s+c+w;for(let _=1;_<o;_++)a.set(S,o-_,x[_-1]);for(let _=1;_<u;_++)a.set(S,o+h+_,x[_-1])}return a}function Le(r,t){return{x:r,y:t}}function Rct(r,t,e,n){if(r.length===0)return[];const i=Bct(r);return i.map((a,s)=>{const o=i.slice(0,s);return Lct(t,a,o,e,n)}).flat()}function Lct(r,t,e,n,i){const a=Le(t.cx,t.cy),s=Fct(a,e,r);if(s==null)return[];const o=new An(a.x,a.y,s.cx,s.cy),l=Ict(o,r,n,i);return Dct(l,r)}function Ict(r,t,e,n){const i=[],a=[];a.push(r);let s=!0;for(let o=0;o<e&&s;o++)for(s=!1;!s&&a.length>0;){const l=a.pop(),u=b5(t,l),c=u?Oct(l,u):null;if(!u||!c||c.count!==2){s||i.push(l);continue}let h=n,d=$d(u,h,c,!0),g=ds(d,a)||ds(d,i),p=zd(d,t);for(;!g&&p&&h>=1;)h/=1.5,d=$d(u,h,c,!0),g=ds(d,a)||ds(d,i),p=zd(d,t);if(d&&!g&&!p&&(a.push(new An(l.x1,l.y1,d.x,d.y)),a.push(new An(d.x,d.y,l.x2,l.y2)),s=!0),s)continue;h=n,d=$d(u,h,c,!1);let v=ds(d,a)||ds(d,i);for(p=zd(d,t);!v&&p&&h>=1;)h/=1.5,d=$d(u,h,c,!1),v=ds(d,a)||ds(d,i),p=zd(d,t);d&&!v&&(a.push(new An(l.x1,l.y1,d.x,d.y)),a.push(new An(d.x,d.y,l.x2,l.y2)),s=!0),s||i.push(l)}for(;a.length>0;)i.push(a.pop());return i}function Dct(r,t){const e=[];for(;r.length>0;){const n=r.pop();if(r.length===0){e.push(n);break}const i=r.pop(),a=new An(n.x1,n.y1,i.x2,i.y2);b5(t,a)?(e.push(n),r.push(i)):r.push(a)}return e}function Fct(r,t,e){let n=Number.POSITIVE_INFINITY;return t.reduce((i,a)=>{const s=Os(r.x,r.y,a.cx,a.cy);if(s>n)return i;const o=new An(r.x,r.y,a.cx,a.cy),l=zct(e,o);return s*(l+1)*(l+1)<n&&(i=a,n=s*(l+1)*(l+1)),i},null)}function Bct(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 zd(r,t){return t.some(e=>e.containsPt(r.x,r.y))}function ds(r,t){return t.some(e=>!!(JP(e.x1,e.y1,r.x,r.y,.001)||JP(e.x2,e.y2,r.x,r.y,.001)))}function b5(r,t){let e=Number.POSITIVE_INFINITY,n=null;for(const i of r){if(!v5(i,t))continue;const a=Tct(i,t);a>=0&&a<e&&(n=i,e=a)}return n}function zct(r,t){return r.reduce((e,n)=>v5(n,t)&&Cct(n,t)?e+1:e,0)}function $d(r,t,e,n){const i=e.top,a=e.left,s=e.bottom,o=e.right;if(n){if(a.state===Ke.POINT){if(i.state===Ke.POINT)return Le(r.x-t,r.y-t);if(s.state===Ke.POINT)return Le(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?Le(r.x-t,r.y-t):Le(r.x2+t,r.y-t):a.y<o.y?Le(r.x-t,r.y2+t):Le(r.x2+t,r.y2+t)}if(o.state===Ke.POINT){if(i.state===Ke.POINT)return Le(r.x2+t,r.y-t);if(s.state===Ke.POINT)return Le(r.x2+t,r.y2+t)}const c=r.height*r.width;return r.height*((i.x-r.x+(o.x-r.x))*.5)<c*.5?i.x>s.x?Le(r.x-t,r.y-t):Le(r.x-t,r.y2+t):i.x<s.x?Le(r.x2+t,r.y-t):Le(r.x2+t,r.y2+t)}if(a.state===Ke.POINT){if(i.state===Ke.POINT)return Le(r.x2+t,r.y2+t);if(s.state===Ke.POINT)return Le(r.x2+t,r.y-t);const c=r.height*r.width;return r.width*((a.y-r.y+(o.y-r.y))*.5)<c*.5?a.y>o.y?Le(r.x2+t,r.y2+t):Le(r.x-t,r.y2+t):a.y<o.y?Le(r.x2+t,r.y-t):Le(r.x-t,r.y-t)}if(o.state===Ke.POINT){if(i.state===Ke.POINT)return Le(r.x-t,r.y2+t);if(s.state===Ke.POINT)return Le(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?Le(r.x2+t,r.y2+t):Le(r.x2+t,r.y-t):i.x<s.x?Le(r.x-t,r.y2+t):Le(r.x-t,r.y-t)}function $ct(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(BE(a.x,a.y,s.x,s.y,l.x,l.y)>n)return!1}return!0}function jct(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(;$ct(t,n,a,i);)a++;e.push(t.get(n)),n=a}return new ou(e)}}function qct(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 Wct(r=6){function a(s,o,l){let u=0,c=0;for(let h=-2;h<=1;h++){const d=s.get(o+h),g=qct(h,l);u+=g*d.x,c+=g*d.y}return{x:u,y:c}}return s=>{if(s.length<3)return s;const o=[],l=s.closed,u=s.length+3-1+(l?0:2);o.push(a(s,2-(l?0:2),0));for(let c=2-(l?0:2);c<u;c++)for(let h=1;h<=r;h++)o.push(a(s,c,h/r));return new ou(o)}}function Gct(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 ou(i)}}class ou{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:kct(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 Gct(t)(this)}simplify(t){return jct(t)(this)}bSplines(t){return Wct(t)(this)}apply(t){return t(this)}containsElements(t){const e=Act(this.points);return e?t.every(n=>e.containsPt(n.cx,n.cy)&&this.withinArea(n.cx,n.cy)):!1}withinArea(t,e){if(this.length===0)return!1;let n=0;const i=this.points[0],a=new An(i.x,i.y,i.x,i.y);for(let s=1;s<this.points.length;s++){const o=this.points[s];a.x1=a.x2,a.y1=a.y2,a.x2=o.x,a.y2=o.y,a.cuts(t,e)&&n++}return a.x1=a.x2,a.y1=a.y2,a.x2=i.x,a.y2=i.y,a.cuts(t,e)&&n++,n%2===1}}class Vct{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 ou(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 Nu=0,jd=1,qd=2,Hb=3;function Hct(r,t){const e=(Math.floor(r.width)+Math.floor(r.height))*2,n=new Vct(e);function i(l,u,c,h){const d=r.get(l,u);return Number.isNaN(d)?Number.NaN:d>t?c+h:c}function a(l,u){let c=Nu;return c=i(l,u,c,1),c=i(l+1,u,c,2),c=i(l,u+1,c,4),c=i(l+1,u+1,c,8),Number.isNaN(c)?-1:c}let s=jd;function o(l,u){let c=l,h=u,d=r.invertScaleX(c),g=r.invertScaleY(h);for(let p=0;p<r.width*r.height;p++){const v={x:d,y:g};if(n.contains(v)){if(n.isFirst(v))return!0}else n.add(v);const m=a(c,h);switch(m){case-1:return!0;case 0:case 3:case 2:case 7:s=qd;break;case 12:case 14:case 4:s=Hb;break;case 6:s=s===Nu?Hb:qd;break;case 1:case 13:case 5:s=Nu;break;case 9:s=s===qd?Nu:jd;break;case 10:case 8:case 11:s=jd;break;default:return console.warn("Marching squares invalid state: "+m),!0}switch(s){case Nu:h--,g-=r.pixelGroup;break;case jd:h++,g+=r.pixelGroup;break;case Hb:c--,d-=r.pixelGroup;break;case qd:c++,d+=r.pixelGroup;break;default:return console.warn("Marching squares invalid state: "+m),!0}}return!0}for(let l=0;l<r.width;l++)for(let u=0;u<r.height;u++){if(r.get(l,u)<=t)continue;const c=a(l,u);if(!(c<0||c===15)&&o(l,u))return n.path()}return null}const hg={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 ac(r){return r!=null&&typeof r.radius=="number"}function tN(r,t){if(ac(r)!==ac(t))return!1;if(ac(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 Oi;(function(r){r[r.MEMBERS=0]="MEMBERS",r[r.NON_MEMBERS=1]="NON_MEMBERS",r[r.EDGES=2]="EDGES"})(Oi||(Oi={}));let eN=class{constructor(t={}){this.dirty=new Set,this.members=[],this.nonMembers=[],this.virtualEdges=[],this.edges=[],this.activeRegion=new Xn(0,0,0,0),this.potentialArea=new Po(1,0,0,0,0,0,0),this.o=Object.assign({},hg,t)}pushMember(...t){if(t.length!==0){this.dirty.add(Oi.MEMBERS);for(const e of t)this.members.push({raw:e,obj:ac(e)?Yf.from(e):Xn.from(e),area:null})}}removeMember(t){const e=this.members.findIndex(n=>tN(n.raw,t));return e<0?!1:(this.members.splice(e,1),this.dirty.add(Oi.MEMBERS),!0)}removeNonMember(t){const e=this.nonMembers.findIndex(n=>tN(n.raw,t));return e<0?!1:(this.nonMembers.splice(e,1),this.dirty.add(Oi.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(Oi.NON_MEMBERS),!0)}pushNonMember(...t){if(t.length!==0){this.dirty.add(Oi.NON_MEMBERS);for(const e of t)this.nonMembers.push({raw:e,obj:ac(e)?Yf.from(e):Xn.from(e),area:null})}}pushEdge(...t){if(t.length!==0){this.dirty.add(Oi.EDGES);for(const e of t)this.edges.push({raw:e,obj:An.from(e),area:null})}}update(){const t=this.dirty.has(Oi.MEMBERS),e=this.dirty.has(Oi.NON_MEMBERS);let n=this.dirty.has(Oi.EDGES);this.dirty.clear();const i=this.members.map(u=>u.obj);if(this.o.virtualEdges&&(t||e)){const u=this.nonMembers.map(d=>d.obj),c=Rct(i,u,this.o.maxRoutingIterations,this.o.morphBuffer),h=new Map(this.virtualEdges.map(d=>[d.obj.toString(),d.area]));this.virtualEdges=c.map(d=>{var g;return{raw:d,obj:d,area:(g=h.get(d.toString()))!==null&&g!==void 0?g:null}}),n=!0}let a=!1;if(t||n){const u=this.virtualEdges.concat(this.edges).map(g=>g.obj),c=Yct(i,u),h=Math.max(this.o.edgeR1,this.o.nodeR1)+this.o.morphBuffer,d=Xn.from(m5(c,h));d.equals(this.activeRegion)||(a=!0,this.activeRegion=d)}if(a){const u=Math.ceil(this.activeRegion.width/this.o.pixelGroup),c=Math.ceil(this.activeRegion.height/this.o.pixelGroup);this.activeRegion.x!==this.potentialArea.pixelX||this.activeRegion.y!==this.potentialArea.pixelY?(this.potentialArea=Po.fromPixelRegion(this.activeRegion,this.o.pixelGroup),this.members.forEach(h=>h.area=null),this.nonMembers.forEach(h=>h.area=null),this.edges.forEach(h=>h.area=null),this.virtualEdges.forEach(h=>h.area=null)):(u!==this.potentialArea.width||c!==this.potentialArea.height)&&(this.potentialArea=Po.fromPixelRegion(this.activeRegion,this.o.pixelGroup))}const s=new Map,o=u=>{if(u.area){const c=`${u.obj.width}x${u.obj.height}x${u.obj instanceof Xn?"R":"C"}`;s.set(c,u.area)}},l=u=>{if(u.area)return;const c=`${u.obj.width}x${u.obj.height}x${u.obj instanceof Xn?"R":"C"}`;if(s.has(c)){const d=s.get(c);u.area=this.potentialArea.copy(d,{x:u.obj.x-this.o.nodeR1,y:u.obj.y-this.o.nodeR1});return}const h=u.obj instanceof Xn?Nct(u.obj,this.potentialArea,this.o.nodeR1):y5(u.obj,this.potentialArea,this.o.nodeR1);u.area=h,s.set(c,h)};this.members.forEach(o),this.nonMembers.forEach(o),this.members.forEach(l),this.nonMembers.forEach(u=>{this.activeRegion.intersects(u.obj)?l(u):u.area=null}),this.edges.forEach(u=>{u.area||(u.area=QP(u.obj,this.potentialArea,this.o.edgeR1))}),this.virtualEdges.forEach(u=>{u.area||(u.area=QP(u.obj,this.potentialArea,this.o.edgeR1))})}drawMembers(t){for(const e of this.members)e.obj.draw(t)}drawNonMembers(t){for(const e of this.nonMembers)e.obj.draw(t)}drawEdges(t){for(const e of this.edges)e.obj.draw(t)}drawPotentialArea(t,e=!0){this.potentialArea.draw(t,e)}compute(){if(this.members.length===0)return new ou([]);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 Uct(e,n,i,a,o=>o.containsElements(s),t)}};function Uct(r,t,e,n,i,a={}){const s=Object.assign({},hg,a);let o=s.threshold,l=s.memberInfluenceFactor,u=s.edgeInfluenceFactor,c=s.nonMemberInfluenceFactor;const h=(s.nodeR0-s.nodeR1)*(s.nodeR0-s.nodeR1),d=(s.edgeR0-s.edgeR1)*(s.edgeR0-s.edgeR1);for(let g=0;g<s.maxMarchingIterations;g++){if(r.clear(),l!==0){const v=l/h;for(const m of t)r.incArea(m,v)}if(u!==0){const v=u/d;for(const m of e)r.incArea(m,v)}if(c!==0){const v=c/h;for(const m of n)r.incArea(m,v)}const p=Hct(r,o);if(p&&i(p))return p;if(o*=.95,g<=s.maxMarchingIterations*.5)l*=1.2,u*=1.2;else if(c!==0&&n.length>0)c*=.8;else break}return new ou([])}function Yct(r,t){if(r.length===0)return new Xn(0,0,0,0);const e=Xn.from(r[0]);for(const n of r)e.add(n);for(const n of t)e.add(g5(n));return e}var Xct=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 dg extends Gn{constructor(t,e){super(t,cr({},dg.defaultOptions,e)),this.members=new Map,this.avoidMembers=new Map,this.bubbleSetOptions={},this.drawBubbleSets=()=>{const{style:n,bubbleSetOptions:i}=this.parseOptions();Ye(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 $c({style:a}),this.context.canvas.appendChild(this.shape))},this.updateBubbleSetsPath=n=>{if(!this.shape)return;const i=H(n.data);[...this.options.members,...this.options.avoidMembers].includes(i)&&this.shape.update(Object.assign(Object.assign({},this.parseOptions().style),{d:this.getPath(i)}))},this.getPath=n=>{const{graph:i}=this.context,a=this.options.members,s=[...this.members.keys()],o=this.options.avoidMembers,l=[...this.avoidMembers.keys()];if(!n&&Ye(a,s)&&Ye(o,l))return this.path;const{enter:u=[],exit:c=[]}=Ns(s,a,m=>m),{enter:h=[],exit:d=[]}=Ns(l,o,m=>m);n&&(c.push(n),u.push(n));const g=(m,b,w)=>{m.forEach(x=>{const S=w?this.members:this.avoidMembers,_=w?"pushMember":"pushNonMember",M=w?"removeMember":"removeNonMember";if(b){let k;i.getElementType(x)==="edge"?([k]=Zct(i,x),this.bubbleSets.pushEdge(k)):([k]=Kct(i,x),this.bubbleSets[_](k)),S.set(x,k)}else{const k=S.get(x);k&&(i.getElementType(x)==="edge"?this.bubbleSets.removeEdge(k):this.bubbleSets[M](k),S.delete(x))}})};g(c,!1,!0),g(u,!0,!0),g(d,!1,!1),g(h,!0,!1);const v=this.bubbleSets.compute().sample(8).simplify(0).bSplines().simplify(0);return this.path=MI(v.points.map($n)),this.path},this.bindEvents(),this.bubbleSets=new eN(this.options)}bindEvents(){this.context.graph.on(lt.AFTER_RENDER,this.drawBubbleSets),this.context.graph.on(lt.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath)}init(){this.bubbleSets=new eN(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=Xct(t,["type","key","members","avoidMembers"]),o=Object.keys(s).reduce((l,u)=>(u in hg?l.bubbleSetOptions[u]=s[u]:l.style[u]=s[u],l),{style:{},bubbleSetOptions:{}});return Object.assign({type:e,key:n,members:i,avoidMembers:a},o)}addMember(t){const e=Array.isArray(t)?t:[t];e.some(n=>this.options.avoidMembers.includes(n))&&(this.options.avoidMembers=this.options.avoidMembers.filter(n=>!e.includes(n))),this.options.members=[...new Set([...this.options.members,...e])],this.drawBubbleSets()}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter(n=>!e.includes(n)),this.drawBubbleSets()}updateMember(t){this.options.members=Et(t)?t(this.options.members):t,this.drawBubbleSets()}getMember(){return this.options.members}addAvoidMember(t){const e=Array.isArray(t)?t:[t];e.some(n=>this.options.members.includes(n))&&(this.options.members=this.options.members.filter(n=>!e.includes(n))),this.options.avoidMembers=[...new Set([...this.options.avoidMembers,...e])],this.drawBubbleSets()}removeAvoidMember(t){const e=Array.isArray(t)?t:[t];this.options.avoidMembers.some(n=>e.includes(n))&&(this.options.avoidMembers=this.options.avoidMembers.filter(n=>!e.includes(n)),this.drawBubbleSets())}updateAvoidMember(t){this.options.avoidMembers=Array.isArray(t)?t:[t],this.drawBubbleSets()}getAvoidMember(){return this.options.avoidMembers}destroy(){this.context.graph.off(lt.AFTER_RENDER,this.drawBubbleSets),this.context.graph.off(lt.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath),this.shape.destroy(),super.destroy()}}dg.defaultOptions=Object.assign({members:[],avoidMembers:[],fill:"lightblue",fillOpacity:.2,stroke:"blue",strokeOpacity:.2},hg);const Kct=(r,t)=>(Array.isArray(t)?t:[t]).map(n=>{const i=r.getElementRenderBounds(n);return new Xn(i.min[0],i.min[1],ua(i),ca(i))}),Zct=(r,t)=>(Array.isArray(t)?t:[t]).map(n=>{const i=r.getEdgeData(n),a=r.getElementPosition(i.source),s=r.getElementPosition(i.target);return An.from({x1:a[0],y1:a[1],x2:s[0],y2:s[1]})});function Jct(r){return`
- <ul class="g6-contextmenu-ul">
- ${r.map(t=>`<li class="g6-contextmenu-li" value="${t.value}">${t.name}</li>`).join("")}
- </ul>
- `}const Qct=`
- .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 nN=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class fg extends Gn{constructor(t,e){super(t,Object.assign({},fg.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=su("contextmenu",!1,{zIndex:"99"});const{className:t}=this.options;t&&this.$element.classList.add(t),this.context.canvas.getContainer().appendChild(this.$element),cx("g6-contextmenu-css","style",{},Qct,document.head)}show(t){return nN(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 nN(this,void 0,void 0,function*(){const{getContent:e,getItems:n}=this.options;return n?Jct(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)}}fg.defaultOptions={trigger:"contextmenu",offset:[4,4],loadingContent:'<div class="g6-contextmenu-loading">Loading...</div>',getContent:()=>"It is a empty context menu.",enable:()=>!0};class gg extends Gn{constructor(t,e){super(t,Object.assign({},gg.defaultOptions,e)),this.edgeBundles={},this.edgePoints={},this.onBundle=()=>{const{model:n,element:i}=this.context,a=n.getEdgeData();this.divideEdges(this.options.divisions);const{cycles:s,iterRate:o,divRate:l}=this.options;let{lambda:u,divisions:c,iterations:h}=this.options;for(let d=0;d<s;d++){for(let g=0;g<h;g++){const p={};a.forEach(v=>{var m;if(v.source===v.target)return;const b=H(v);p[b]=this.getEdgeForces(v,c,u);for(let w=0;w<c+1;w++)(m=this.edgePoints)[b]||(m[b]=[]),this.edgePoints[b][w]=Lt(this.edgePoints[b][w],p[b][w])})}u/=2,c*=l,h*=o,this.divideEdges(c)}a.forEach(d=>{const g=H(d),p=i.getElement(g);p==null||p.update({d:iE(this.edgePoints[g])})})},this.bindEvents()}get nodeMap(){const t=this.context.model.getNodeData();return Object.fromEntries(t.map(e=>[H(e),Bo(on(e))]))}divideEdges(t){this.context.model.getEdgeData().forEach(n=>{var i;const a=H(n);(i=this.edgePoints)[a]||(i[a]=[]);const s=this.nodeMap[n.source],o=this.nodeMap[n.target];if(t===1)this.edgePoints[a].push(s),this.edgePoints[a].push(Di(Lt(s,o),2)),this.edgePoints[a].push(o);else{const u=(this.edgePoints[a].length===0?Pe(s,o):iht(this.edgePoints[a]))/(t+1);let c=u;const h=[s];for(let d=1;d<this.edgePoints[a].length;d++){const g=this.edgePoints[a][d-1],p=this.edgePoints[a][d];let v=Pe(p,g);for(;v>c;){const m=c/v,b=Lt(g,Ta(be(p,g),m));h.push(b),v-=c,c=u}c-=v}h.push(o),this.edgePoints[a]=h}})}getVectorPosition(t){const e=this.nodeMap[t.source],n=this.nodeMap[t.target],[i,a]=be(n,e),s=Pe(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=tht(n,i),s=eht(n,i),o=nht(n,i),l=rht(n,i);return a*s*o*l}getEdgeBundles(){const t={},e=this.options.bundleThreshold,n=this.context.model.getEdgeData();return n.forEach((i,a)=>{n.forEach((s,o)=>{var l,u;if(o<=a)return;this.measureEdgeCompatibility(i,s)>=e&&(t[l=H(i)]||(t[l]=[]),t[H(i)].push(s),t[u=H(s)]||(t[u]=[]),t[H(s)].push(i))})}),t}getSpringForce(t,e){const{pre:n,cur:i,next:a}=t;return Ta(be(Lt(n,a),Ta(i,2)),e)}getElectrostaticForce(t,e){Zi(this.edgeBundles)&&(this.edgeBundles=this.getEdgeBundles());const n=this.edgeBundles[H(e)];let i=[0,0];return n==null||n.forEach(a=>{const s=this.edgePoints[H(a)][t],o=this.edgePoints[H(e)][t],l=be(s,o),u=Pe(s,o);i=Lt(i,Ta(l,1/u))}),i}getEdgeForces(t,e,n){const i=this.nodeMap[t.source],a=this.nodeMap[t.target],s=this.options.K/(Pe(i,a)*(e+1)),o=[[0,0]],l=H(t);for(let u=1;u<e;u++){const c=this.getSpringForce({pre:this.edgePoints[l][u-1],cur:this.edgePoints[l][u],next:this.edgePoints[l][u+1]||[0,0]},s),h=this.getElectrostaticForce(u,t);o.push(Ta(Lt(c,h),n))}return o.push([0,0]),o}bindEvents(){const{graph:t}=this.context;t.on(lt.AFTER_RENDER,this.onBundle)}unbindEvents(){const{graph:t}=this.context;t.off(lt.AFTER_RENDER,this.onBundle)}destroy(){this.unbindEvents(),super.destroy()}}gg.defaultOptions={K:.1,lambda:.1,divisions:1,divRate:2,cycles:6,iterations:90,iterRate:2/3,bundleThreshold:.6};const tht=(r,t)=>Math.abs(DX([r.vx,r.vy],[t.vx,t.vy])/(r.length*t.length)),eht=(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)},nht=(r,t)=>{const e=(r.length+t.length)/2,n=Di(Lt(r.source,r.target),2),i=Di(Lt(t.source,t.target),2);return e/(e+Pe(n,i))},rN=(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]},iN=(r,t)=>{const e=rN(t.source,r),n=rN(t.target,r),i=Di(Lt(e,n),2),a=Di(Lt(r.source,r.target),2);return Pe(e,n)===0?0:Math.max(0,1-2*Pe(a,i)/Pe(e,n))},rht=(r,t)=>Math.min(iN(r,t),iN(t,r)),iht=r=>{let t=0;for(let e=1;e<r.length;e++)t+=Pe(r[e],r[e-1]);return t},aht={fill:"#fff",fillOpacity:1,lineWidth:1,stroke:"#000",strokeOpacity:.8,zIndex:-1/0},aN=.05;class pg extends Gn{constructor(t,e){super(t,Object.assign({},pg.defaultOptions,e)),this.shapes=new Map,this.r=this.options.r,this.onEdgeFilter=n=>{if(this.options.trigger==="drag"&&this.isLensOn)return;const i=$n(n.canvas);this.renderLens(i),this.renderFocusElements()},this.renderLens=n=>{const i=Object.assign({},aht,this.options.style);this.isLensOn||(this.lens=new jc({style:i}),this.canvas.appendChild(this.lens)),Object.assign(i,Ni(n),{size:this.r*2}),this.lens.update(i)},this.getFilterData=()=>{const{filter:n}=this.options,{model:i}=this.context,a=i.getData();if(!n)return a;const{nodes:s,edges:o,combos:l}=a;return{nodes:s.filter(u=>n(H(u),"node")),edges:o.filter(u=>n(H(u),"edge")),combos:l.filter(u=>n(H(u),"combo"))}},this.getFocusElements=n=>{const{nodes:i,edges:a}=this.getFilterData(),s=i.filter(u=>Pe(on(u),n)<this.r),o=s.map(u=>H(u)),l=a.filter(u=>{const{source:c,target:h}=u,d=o.includes(c),g=o.includes(h);switch(this.options.nodeType){case"both":return d&&g;case"either":return d!==g;case"source":return d&&!g;case"target":return!d&&g;default:return!1}});return{nodes:s,edges:l}},this.renderFocusElements=()=>{const{element:n,graph:i}=this.context;if(!this.isLensOn)return;const a=this.lens.getCenter(),{nodes:s,edges:o}=this.getFocusElements(a),l=new Set,u=c=>{const h=H(c);l.add(h);const d=n.getElement(h);if(!d)return;const g=this.shapes.get(h)||d.cloneNode();g.setPosition(d.getPosition()),g.id=d.id,this.shapes.has(h)?Object.entries(d.attributes).forEach(([m,b])=>{g.style[m]!==b&&(g.style[m]=b)}):(this.canvas.appendChild(g),this.shapes.set(h,g));const p=i.getElementType(h),v=this.getElementStyle(p,c);g.update(v)};s.forEach(u),o.forEach(u),this.shapes.forEach((c,h)=>{l.has(h)||(c.destroy(),this.shapes.delete(h))})},this.scaleRByWheel=n=>{var i;this.options.preventDefault&&n.preventDefault();const{clientX:a,clientY:s,deltaX:o,deltaY:l}=n,{graph:u,canvas:c}=this.context,h=u.getCanvasByClient([a,s]),d=(i=this.lens)===null||i===void 0?void 0:i.getCenter();if(!this.isLensOn||Pe(h,d)>this.r)return;const{maxR:g,minR:p}=this.options,v=o+l>0?1/(1-aN):1-aN,m=Math.min(...c.getSize())/2;this.r=Math.max(p||0,Math.min(g||m,this.r*v)),this.renderLens(d),this.renderFocusElements()},this.isLensDragging=!1,this.onDragStart=n=>{var i;const a=$n(n.canvas),s=(i=this.lens)===null||i===void 0?void 0:i.getCenter();!this.isLensOn||Pe(a,s)>this.r||(this.isLensDragging=!0)},this.onDrag=n=>{if(!this.isLensDragging)return;const i=$n(n.canvas);this.renderLens(i),this.renderFocusElements()},this.onDragEnd=()=>{this.isLensDragging=!1},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}getElementStyle(t,e){const n=t==="node"?this.options.nodeStyle:this.options.edgeStyle;return typeof n=="function"?n(e):n}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i}=this.options,a=e.getCanvas().getLayer();["click","drag"].includes(n)&&a.addEventListener(J.CLICK,this.onEdgeFilter),n==="pointermove"?a.addEventListener(J.POINTER_MOVE,this.onEdgeFilter):n==="drag"&&(a.addEventListener(J.DRAG_START,this.onDragStart),a.addEventListener(J.DRAG,this.onDrag),a.addEventListener(J.DRAG_END,this.onDragEnd)),i==="wheel"&&((t=this.graphDom)===null||t===void 0||t.addEventListener(J.WHEEL,this.scaleRByWheel,{passive:!1}))}unbindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i}=this.options,a=e.getCanvas().getLayer();["click","drag"].includes(n)&&a.removeEventListener(J.CLICK,this.onEdgeFilter),n==="pointermove"?a.removeEventListener(J.POINTER_MOVE,this.onEdgeFilter):n==="drag"&&(a.removeEventListener(J.DRAG_START,this.onDragStart),a.removeEventListener(J.DRAG,this.onDrag),a.removeEventListener(J.DRAG_END,this.onDragEnd)),i==="wheel"&&((t=this.graphDom)===null||t===void 0||t.removeEventListener(J.WHEEL,this.scaleRByWheel))}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),this.isLensOn&&this.lens.destroy(),this.shapes.forEach((t,e)=>{t.destroy(),this.shapes.delete(e)}),super.destroy()}}pg.defaultOptions={trigger:"pointermove",r:60,nodeType:"both",filter:()=>!0,style:{lineWidth:2},nodeStyle:{label:!1},edgeStyle:{label:!0},scaleRBy:"wheel",preventDefault:!0};const sht={fill:"#ccc",fillOpacity:.1,lineWidth:2,stroke:"#000",strokeOpacity:.8,labelFontSize:12},sN=.05,oN=.1;class vg extends Gn{constructor(t,e){super(t,Object.assign({},vg.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=$n(n.canvas);this.onMagnify(i)},this.onMagnify=n=>{n.some(isNaN)||(this.renderLens(n),this.renderFocusElements())},this.renderLens=n=>{const i=Object.assign({},sht,this.options.style);this.isLensOn||(this.lens=new jc({style:i}),this.canvas.appendChild(this.lens)),Object.assign(i,Ni(n),{size:this.r*2,label:this.options.showDPercent,labelText:this.getDPercent()}),this.lens.update(i)},this.getDPercent=()=>{const{minD:n,maxD:i}=this.options;return`${Math.round((this.d-n)/(i-n)*100)}%`},this.prevMagnifiedStyleMap=new Map,this.prevOriginStyleMap=new Map,this.renderFocusElements=()=>{if(!this.isLensOn)return;const{graph:n}=this.context,i=this.lens.getCenter(),a=(this.d+1)*this.r,s=new Map,o=new Map;n.getNodeData().forEach(u=>{const c=on(u),h=Pe(c,i);if(h>this.r)return;const d=a*h/(this.d*h+this.r),[g,p]=c,[v,m]=i,b=(g-v)/h,w=(p-m)/h,x=[v+d*b,m+d*w],S=H(u),_=this.getNodeStyle(u),M=Ro(n.getElementRenderStyle(S),Object.keys(_));s.set(S,Object.assign(Object.assign({},Ni(x)),_)),o.set(S,Object.assign(Object.assign({},Ni(c)),M))}),this.updateStyle(s,o)},this.getNodeStyle=n=>{const{nodeStyle:i}=this.options;return typeof i=="function"?i(n):i},this.updateStyle=(n,i)=>{const{graph:a,element:s}=this.context,{enter:o,exit:l,keep:u}=Ns(Array.from(this.prevMagnifiedStyleMap.keys()),Array.from(n.keys()),d=>d),c=new Set,h=(d,g)=>{const p=s.getElement(d);p==null||p.update(g),a.getRelatedEdgesData(d).forEach(v=>{c.add(H(v))})};[...o,...u].forEach(d=>{h(d,n.get(d))}),l.forEach(d=>{h(d,this.prevOriginStyleMap.get(d)),this.prevOriginStyleMap.delete(d)}),c.forEach(d=>{const g=s.getElement(d);g==null||g.update({})}),this.prevMagnifiedStyleMap=n,i.forEach((d,g)=>{this.prevOriginStyleMap.has(g)||this.prevOriginStyleMap.set(g,d)})},this.isWheelValid=n=>{if(this.options.preventDefault&&n.preventDefault(),!this.isLensOn)return!1;const{clientX:i,clientY:a}=n,s=this.context.graph.getCanvasByClient([i,a]),o=this.lens.getCenter();return!(Pe(s,o)>this.r)},this.scaleR=n=>{const{maxR:i,minR:a}=this.options,s=n?1/(1-sN):1-sN,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+oN:this.d-oN;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=$n(n.canvas),a=this.lens.getCenter();return!(Pe(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=$n(n.canvas);this.onMagnify(i)},this.onDragEnd=()=>{this.isLensDragging=!1},this.scaleRByDrag=n=>{if(!this.isLensDragging)return;const{dx:i,dy:a}=n;this.scaleR(i-a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.scaleDByDrag=n=>{if(!this.isLensDragging)return;const{dx:i,dy:a}=n;this.scaleD(i-a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i,scaleDBy:a}=this.options,s=e.getCanvas().getLayer();if(["click","drag"].includes(n)&&s.addEventListener(J.CLICK,this.onCreateFisheye),n==="pointermove"&&s.addEventListener(J.POINTER_MOVE,this.onCreateFisheye),n==="drag"||i==="drag"||a==="drag"){s.addEventListener(J.DRAG_START,this.onDragStart),s.addEventListener(J.DRAG_END,this.onDragEnd);const o=n==="drag"?this.onDrag:i==="drag"?this.scaleRByDrag:this.scaleDByDrag;s.addEventListener(J.DRAG,o)}if(i==="wheel"||a==="wheel"){const o=i==="wheel"?this.scaleRByWheel:this.scaleDByWheel;(t=this.graphDom)===null||t===void 0||t.addEventListener(J.WHEEL,o,{passive:!1})}}unbindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i,scaleDBy:a}=this.options,s=e.getCanvas().getLayer();if(["click","drag"].includes(n)&&s.removeEventListener(J.CLICK,this.onCreateFisheye),n==="pointermove"&&s.removeEventListener(J.POINTER_MOVE,this.onCreateFisheye),n==="drag"||i==="drag"||a==="drag"){s.removeEventListener(J.DRAG_START,this.onDragStart),s.removeEventListener(J.DRAG_END,this.onDragEnd);const o=n==="drag"?this.onDrag:i==="drag"?this.scaleRByDrag:this.scaleDByDrag;s.removeEventListener(J.DRAG,o)}if(i==="wheel"||a==="wheel"){const o=i==="wheel"?this.scaleRByWheel:this.scaleDByWheel;(t=this.graphDom)===null||t===void 0||t.removeEventListener(J.WHEEL,o)}}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){var t;this.unbindEvents(),this.isLensOn&&((t=this.lens)===null||t===void 0||t.destroy()),this.prevMagnifiedStyleMap.clear(),this.prevOriginStyleMap.clear(),super.destroy()}}vg.defaultOptions={trigger:"pointermove",r:120,d:1.5,maxD:5,minD:0,showDPercent:!0,style:{},nodeStyle:{label:!0},preventDefault:!0};class mg extends Gn{constructor(t,e){super(t,Object.assign({},mg.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 Zl(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||!oht()||this.$el.requestFullscreen().catch(t=>{oa.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()}}mg.defaultOptions={trigger:{},autoFit:!0};function oht(){return document.fullscreenEnabled||Reflect.get(document,"webkitFullscreenEnabled")||Reflect.get(document,"mozFullscreenEnabled")||Reflect.get(document,"msFullscreenEnabled")}class yg extends Gn{constructor(t,e){super(t,Object.assign({},yg.defaultOptions,e)),this.$element=su("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(lt.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=BX(Lt(this.offset,t),this.options.size),this.$element.style.backgroundPosition=`${this.offset[0]}px ${this.offset[1]}px`}destroy(){this.context.graph.off(lt.AFTER_TRANSFORM,this.onTransform),this.$element.remove(),super.destroy()}}yg.defaultOptions={border:!0,borderLineWidth:1,borderStroke:"#eee",borderStyle:"solid",lineWidth:1,size:20,stroke:"#eee"};function zE(r){const t={Added:new Map,Updated:new Map,Removed:new Map};return r.forEach(e=>{const{type:n,value:i}=e,a=H(i);if(n==="NodeAdded"||n==="EdgeAdded"||n==="ComboAdded")t.Added.set(a,e);else if(n==="NodeUpdated"||n==="EdgeUpdated"||n==="ComboUpdated")if(t.Added.has(a))t.Added.set(a,{type:n.replace("Updated","Added"),value:i});else if(t.Updated.has(a)){const{original:s}=t.Updated.get(a);t.Updated.set(a,{type:n,value:i,original:s})}else t.Removed.has(a)||t.Updated.set(a,e);else(n==="NodeRemoved"||n==="EdgeRemoved"||n==="ComboRemoved")&&(t.Added.has(a)?t.Added.delete(a):(t.Updated.has(a)&&t.Updated.delete(a),t.Removed.set(a,e)))}),[...Array.from(t.Added.values()),...Array.from(t.Updated.values()),...Array.from(t.Removed.values())]}function w5(r){const{NodeAdded:t=[],NodeUpdated:e=[],NodeRemoved:n=[],EdgeAdded:i=[],EdgeUpdated:a=[],EdgeRemoved:s=[],ComboAdded:o=[],ComboUpdated:l=[],ComboRemoved:u=[]}=a0(r,c=>c.type);return{add:{nodes:t,edges:i,combos:o},update:{nodes:e,edges:a,combos:l},remove:{nodes:n,edges:s,combos:u}}}function x5(r,t){for(const e in r)sn(r[e])&&!Array.isArray(r[e])&&r[e]!==null?(t[e]||(t[e]={}),x5(r[e],t[e])):t[e]===void 0&&(t[e]=pc(e))}function lht(r,t=!1,e){const n={animation:t,current:{add:{},update:{},remove:{}},original:{add:{},update:{},remove:{}}},{add:i,update:a,remove:s}=w5(zE(r));return["nodes","edges","combos"].forEach(o=>{a[o]&&a[o].forEach(l=>{var u,c;const h=Object.assign({},l.value);let d=Object.assign({},l.original);if(e){const g=e.graph.getElementType(H(l.original)),p=g==="edge"?"stroke":"fill",v=e.element.getElementComputedStyle(g,l.original);d=Object.assign(Object.assign({},l.original),{style:Object.assign({[p]:v[p]},l.original.style)})}x5(h,d),(u=n.current.update)[o]||(u[o]=[]),n.current.update[o].push(h),(c=n.original.update)[o]||(c[o]=[]),n.original.update[o].push(d)}),i[o]&&i[o].forEach(l=>{var u,c;const h=Object.assign({},l.value);(u=n.current.add)[o]||(u[o]=[]),n.current.add[o].push(h),(c=n.original.remove)[o]||(c[o]=[]),n.original.remove[o].push(h)}),s[o]&&s[o].forEach(l=>{var u,c;const h=Object.assign({},l.value);(u=n.current.remove)[o]||(u[o]=[]),n.current.remove[o].push(h),(c=n.original.add)[o]||(c[o]=[]),n.original.add[o].push(h)})}),n}class bg extends Gn{constructor(t,e){super(t,Object.assign({},bg.defaultOptions,e)),this.batchChanges=null,this.batchAnimation=!1,this.undoStack=[],this.redoStack=[],this.freezed=!1,this.executeCommand=(i,a=!0)=>{var s,o,l;this.freezed=!0,(o=(s=this.options).executeCommand)===null||o===void 0||o.call(s,i);const u=a?i.original:i.current;this.context.graph.addData(u.add),this.context.graph.updateData(u.update),this.context.graph.removeData(uI(u.remove,!1)),(l=this.context.element)===null||l===void 0||l.draw({silence:!0,animation:i.animation}),this.freezed=!1},this.addCommand=i=>{var a;if(!this.freezed){if(i.type===lt.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(lht(this.batchChanges.flat(),this.batchAnimation,this.context)),this.notify(ys.ADD,this.undoStack[this.undoStack.length-1])}},this.initBatchCommand=i=>{const{initiate:a}=i.data;this.batchAnimation=!1,a?this.batchChanges=[]:this.undoStack.pop()||(this.batchChanges=null)},this.emitter=new T0;const{graph:n}=this.context;n.on(lt.AFTER_DRAW,this.addCommand),n.on(lt.BATCH_START,this.initBatchCommand),n.on(lt.BATCH_END,this.addCommand)}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}undo(){var t,e,n,i;const a=this.undoStack.pop();if(a){if(this.executeCommand(a),((e=(t=this.options).beforeAddCommand)===null||e===void 0?void 0:e.call(t,a,!1))===!1)return;this.redoStack.push(a),(i=(n=this.options).afterAddCommand)===null||i===void 0||i.call(n,a,!1),this.notify(ys.UNDO,a)}return this}redo(){const t=this.redoStack.pop();return t&&(this.executeCommand(t,!1),this.undoStackPush(t),this.notify(ys.REDO,t)),this}undoAndCancel(){const t=this.undoStack.pop();return t&&(this.executeCommand(t,!1),this.redoStack=[],this.notify(ys.CANCEL,t)),this}undoStackPush(t){var e,n,i,a;const{stackSize:s}=this.options;s!==0&&this.undoStack.length>=s&&this.undoStack.shift(),((n=(e=this.options).beforeAddCommand)===null||n===void 0?void 0:n.call(e,t,!0))!==!1&&(this.undoStack.push(t),(a=(i=this.options).afterAddCommand)===null||a===void 0||a.call(i,t,!0))}clear(){this.undoStack=[],this.redoStack=[],this.batchChanges=null,this.batchAnimation=!1,this.notify(ys.CLEAR,null)}notify(t,e){this.emitter.emit(t,{cmd:e}),this.emitter.emit(ys.CHANGE,{cmd:e})}on(t,e){this.emitter.on(t,e)}destroy(){const{graph:t}=this.context;t.off(lt.AFTER_DRAW,this.addCommand),t.off(lt.BATCH_START,this.initBatchCommand),t.off(lt.BATCH_END,this.addCommand),this.emitter.off(),super.destroy(),this.undoStack=[],this.redoStack=[]}}bg.defaultOptions={stackSize:0};function Wd(r,t,e,n,i,a){const s=(a-t)*(e-r)-(n-t)*(i-r);return s>0?!0:!(s<0)}function uht(r,t){const e=r[0][0],n=r[0][1],i=r[1][0],a=r[1][1],s=t[0][0],o=t[0][1],l=t[1][0],u=t[1][1];return Wd(e,n,s,o,l,u)!==Wd(i,a,s,o,l,u)&&Wd(e,n,i,a,s,o)!==Wd(e,n,i,a,l,u)}var cht=uht;function E5(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}}}E5.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 hht(r,t){return new E5(r,t)}var dht=hht,fht={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 _5(r,t,e){return(t[0]-r[0])*(e[1]-r[1])-(t[1]-r[1])*(e[0]-r[0])}function ght(r){const t=[];for(let e=0;e<r.length;e++){for(;t.length>=2&&_5(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}return t.pop(),t}function pht(r){const t=r.reverse(),e=[];for(let n=0;n<t.length;n++){for(;e.length>=2&&_5(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}return e.pop(),e}function vht(r){const t=ght(r),n=pht(r).concat(t);return n.push(r[0]),n}var mht=vht;const yht=cht,bht=dht,Ub=fht,wht=mht;function xht(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 Eht(r){return r.sort(function(t,e){return t[0]-e[0]||t[1]-e[1]})}function hx(r,t){return Math.pow(t[0]-r[0],2)+Math.pow(t[1]-r[1],2)}function lN(r,t,e){const n=[t[0]-r[0],t[1]-r[1]],i=[e[0]-r[0],e[1]-r[1]],a=hx(r,t),s=hx(r,e);return(n[0]*i[0]+n[1]*i[1])/Math.sqrt(a*s)}function uN(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])&&yht(r,n))return!0}return!1}function _ht(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 Sht(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 Mht(r,t,e){let n=null,i=cN,a=cN,s,o;for(let l=0;l<t.length;l++)s=lN(r[0],r[1],t[l]),o=lN(r[1],r[0],t[l]),s>i&&o>a&&!uN([r[0],t[l]],e)&&!uN([r[1],t[l]],e)&&(i=s,a=o,n=t[l]);return n}function S5(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(hx(o[0],o[1])<t||i.has(l))continue;let u=0,c=Sht(o),h,d,g;do c=n.extendBbox(c,u),h=c[2]-c[0],d=c[3]-c[1],g=Mht(o,n.rangePoints(c),r),u++;while(g===null&&(e[0]>h||e[1]>d));h>=e[0]&&d>=e[1]&&i.add(l),g!==null&&(r.splice(s+1,0,g),n.removePoint(g),a=!0)}return a?S5(r,t,e,n,i):r}function kht(r,t,e){let n=t||20;const i=xht(Eht(Ub.toXy(r,e)));if(i.length<4){const h=i.concat([i[0]]);return e?Ub.fromXy(h,e):h}const a=_ht(i),s=[a[0]*hN,a[1]*hN],o=wht(i),l=i.filter(function(h){return o.indexOf(h)<0}),u=Math.ceil(1/(i.length/(a[0]*a[1]))),c=S5(o,Math.pow(n,2),s,bht(l,u),new Set);return e?Ub.fromXy(c,e):c}const cN=Math.cos(90/(180/Math.PI)),hN=.6;var Cht=kht;const Tht=r0(Cht);function Oht(r,t,e){if(r.length===1)return Aht(r[0],t,e);if(r.length===2)return dN(r,t,e);if(r.length===3){const[n,i,a]=Jx(r);if(vI(n,i,a))return dN([n,a],t,e)}switch(e){case"smooth":return Nht(r,t);case"sharp":return Rht(r,t);case"rounded":default:return Pht(r,t)}}const Aht=(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]]},dN=(r,t,e)=>{const n=[t,t,0,0,0],i=e==="sharp"?Lt(r[0],Ms(za(be(r[0],r[1])),t)):r[0],a=e==="sharp"?Lt(r[1],Ms(za(be(r[1],r[0])),t)):r[1],s=Ms(za(d0(be(i,a),!1)),t),o=Ms(s,-1),l=Lt(i,s),u=Lt(a,s),c=Lt(a,o),h=Lt(i,o);return e==="sharp"?[["M",l[0],l[1]],["L",u[0],u[1]],["L",c[0],c[1]],["L",h[0],h[1]],["Z"]]:[["M",l[0],l[1]],["L",u[0],u[1]],["A",...n,c[0],c[1]],["L",h[0],h[1]],["A",...n,l[0],l[1]]]},Pht=(r,t)=>{const e=Jx(r).map((o,l)=>{const u=(l-2+r.length)%r.length,c=(l-1+r.length)%r.length,h=(l+1)%r.length,d=r[u],g=r[c],p=r[h],v=be(d,g),m=be(g,o),b=be(o,p),w=(k,C)=>Kx(k,C,!0)<Math.PI,x=w(v,m),S=w(m,b),_=k=>Ms(za(d0(k,!1)),t),M=_(m);return[{p:Bo(x?Lt(g,_(v)):Lt(g,M)),concave:x&&g},{p:Bo(S?Lt(o,_(b)):Lt(o,M)),concave:S&&o}]}),n=[t,t,0,0,0],i=e.findIndex((o,l)=>!e[(l-1+e.length)%e.length][0].concave&&!e[(l-1+e.length)%e.length][1].concave&&!o[0].concave&&!o[0].concave&&!o[1].concave),a=e.slice(i).concat(e.slice(0,i));let s=[];return a.flatMap((o,l)=>{const u=[],c=a[e.length-1];return l===0&&u.push(["M",...c[1].p]),o[0].concave?s.push(o[0].p,o[1].p):u.push(["A",...n,...o[0].p]),o[1].concave?s.unshift(o[1].p):u.push(["L",...o[1].p]),s.length===3&&(u.pop(),u.push(["C",...s.flat()]),s=[]),u})},Nht=(r,t)=>{const e=Jx(r).map((n,i)=>{const a=r[(i+1)%r.length];return{p:n,v:za(be(a,n))}});return e.forEach((n,i)=>{const a=i>0?i-1:r.length-1,s=e[a].v,o=za(Lt(s,Ms(n.v,Kx(s,n.v,!0)<Math.PI?1:-1)));n.p=Lt(n.p,Ms(o,t))}),MI(e.map(n=>n.p))},Rht=(r,t)=>{const n=r.map((a,s)=>{const o=r[s===0?r.length-1:s-1],l=vc(Ms(za(d0(be(o,a),!1)),t));return[Lt(o,l),Lt(a,l)]}).flat();return n.map((a,s)=>{if(s%2===0)return null;const o=[n[(s-1)%n.length],n[s%n.length]],l=[n[(s+1)%n.length],n[(s+2)%n.length]];return Zx(o,l,!0)}).filter(Boolean).map((a,s)=>[s===0?"M":"L",a[0],a[1]]).concat([["Z"]])};var Lht=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 wg extends Gn{constructor(t,e){super(t,Object.assign({},wg.defaultOptions,e)),this.hullMemberIds=[],this.drawHull=()=>{if(!this.shape)this.shape=new $c({style:this.getHullStyle()}),this.context.canvas.appendChild(this.shape);else{const n=!Ye(this.optionsCache,this.options);this.shape.update(this.getHullStyle(n))}this.optionsCache=Object.assign({},this.options)},this.updateHullPath=n=>{this.shape&&this.options.members.includes(H(n.data))&&this.shape.update({d:this.getHullPath(!0)})},this.getHullPath=(n=!1)=>{const{graph:i}=this.context,a=this.getMember();if(a.length===0)return"";const s=a.map(u=>i.getNodeData(u)),o=Tht(s.map(on),this.options.concavity).slice(1).reverse(),l=o.flatMap(u=>s.filter(c=>Ye(on(c),u)).map(H));return Ye(l,this.hullMemberIds)&&!n?this.path:(this.hullMemberIds=l,this.path=Oht(o,this.getPadding(),this.options.corner),this.path)},this.bindEvents()}bindEvents(){this.context.graph.on(lt.AFTER_RENDER,this.drawHull),this.context.graph.on(lt.AFTER_ELEMENT_UPDATE,this.updateHullPath)}getHullStyle(t){const e=this.options,{members:n,padding:i,corner:a}=e,s=Lht(e,["members","padding","corner"]);return Object.assign(Object.assign({},s),{d:this.getHullPath(t)})}getPadding(){const{graph:t}=this.context;return this.hullMemberIds.reduce((n,i)=>{const{halfExtents:a}=t.getElementRenderBounds(i),s=Math.max(a[0],a[1]);return Math.max(n,s)},0)+this.options.padding}addMember(t){const e=Array.isArray(t)?t:[t];this.options.members=[...new Set([...this.options.members,...e])],this.shape.update({d:this.getHullPath()})}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter(n=>!e.includes(n)),e.some(n=>this.hullMemberIds.includes(n))&&this.shape.update({d:this.getHullPath()})}updateMember(t){this.options.members=Et(t)?t(this.options.members):t,this.shape.update(this.getHullStyle(!0))}getMember(){return this.options.members}destroy(){this.context.graph.off(lt.AFTER_DRAW,this.drawHull),this.shape.destroy(),this.hullMemberIds=[],super.destroy()}}wg.defaultOptions={members:[],padding:10,corner:"rounded",concavity:1/0,fill:"lightblue",fillOpacity:.2,labelOpacity:1,stroke:"blue",strokeOpacity:.2};function M5(r,t){t(r),r.children&&r.children.forEach(function(e){e&&M5(e,t)})}function Zc(r){xg(r,!0)}function Ri(r){xg(r,!1)}function xg(r,t){var e=t?"visible":"hidden";M5(r,function(n){n.attr("visibility",e)})}var Iht=function(r){Ut(t,r);function t(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=r.apply(this,vt([],z(e),!1))||this;return i.isMutationObserved=!0,i.addEventListener(Xt.INSERTED,function(){Ri(i)}),i}return t}(_n);function k5(r){var t=r.appendChild(new Iht({class:"offscreen"}));return Ri(t),t}function Dht(r){for(var t=r;t;){if(t.className==="offscreen")return!0;t=t.parent}return!1}var $E=function(r){Ut(t,r);function t(e){e===void 0&&(e={});var n=e.style,i=Je(e,["style"]);return r.call(this,et({style:et({text:"",fill:"black",fontFamily:"sans-serif",fontSize:16,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",lineWidth:1,textAlign:"start",textBaseline:"middle"},n)},i))||this}return Object.defineProperty(t.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=k5(this)),this._offscreen},enumerable:!1,configurable:!0}),t.prototype.disconnectedCallback=function(){var e;(e=this._offscreen)===null||e===void 0||e.destroy()},t}(Hs);function Xl(r){return r*Math.PI/180}function C5(r){return Number((r*180/Math.PI).toPrecision(5))}var ur=function(){function r(t,e,n,i){t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=0),i===void 0&&(i=0),this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=n,this.height=i}return Object.defineProperty(r.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),r.fromRect=function(t){return new r(t.x,t.y,t.width,t.height)},r.prototype.toJSON=function(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.top,right:this.right,bottom:this.bottom,left:this.left}},r.prototype.isPointIn=function(t,e){return t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom},r}();function gi(r,t){return Et(r)?r.apply(void 0,vt([],z(t),!1)):r}var zi=function(r,t){var e=function(i){return"".concat(t,"-").concat(i)},n=Object.fromEntries(Object.entries(r).map(function(i){var a=z(i,2),s=a[0],o=a[1],l=e(o);return[s,{name:l,class:".".concat(l),id:"#".concat(l),toString:function(){return l}}]}));return Object.assign(n,{prefix:e}),n},Fht=5,T5=function(r,t,e,n){e===void 0&&(e=0),n===void 0&&(n=Fht),Object.entries(t).forEach(function(i){var a=z(i,2),s=a[0],o=a[1],l=r;Object.prototype.hasOwnProperty.call(t,s)&&(o?Gl(o)?(Gl(r[s])||(l[s]={}),e<n?T5(r[s],o,e+1,n):l[s]=t[s]):Xr(o)?(l[s]=[],l[s]=l[s].concat(o)):l[s]=o:l[s]=o)})},Pn=function(r){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];for(var n=0;n<t.length;n+=1)T5(r,t[n]);return r},O5=function(r){return r!==void 0&&r!=null&&!Number.isNaN(r)},Gd,Bht=dw(function(r,t){var e=t.fontSize,n=t.fontFamily,i=t.fontWeight,a=t.fontStyle,s=t.fontVariant;return Gd||(Gd=st.offscreenCanvasCreator.getOrCreateContext(void 0)),Gd.font=[a,s,i,"".concat(e,"px"),n].join(" "),Gd.measureText(r).width},function(r,t){return[r,Object.values(t||A5(r)).join()].join("")},4096),A5=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 P5(r){return r.nodeName==="text"?r:r.nodeName==="g"&&r.children.length===1&&r.children[0].nodeName==="text"?r.children[0]:null}function N5(r,t){var e=P5(r);e&&e.attr(t)}function dx(r,t,e){e===void 0&&(e="..."),N5(r,{wordWrap:!0,wordWrapWidth:t,maxLines:1,textOverflow:e})}function zht(r,t,e,n){e===void 0&&(e=2),n===void 0&&(n="top"),N5(r,{wordWrap:!0,wordWrapWidth:t,maxLines:e,textBaseline:n})}function fN(r){var t=r.canvas,e=r.touches,n=r.offsetX,i=r.offsetY;if(t){var a=t.x,s=t.y;return[a,s]}if(e){var o=e[0],l=o.clientX,u=o.clientY;return[l,u]}return n&&i?[n,i]:[0,0]}function Va(r){return typeof r=="function"?r():oe(r)||bt(r)?new $E({style:{text:String(r)}}):r}function $ht(r,t){return r.reduce(function(e,n){return(e[n[t]]=e[n[t]]||[]).push(n),e},{})}function Ur(r,t,e,n,i){return n===void 0&&(n=!0),i===void 0&&(i=function(a){a.node().removeChildren()}),r?e(t):(n&&i(t),null)}function Bn(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 jht=function(r,t){return function(e){return r*(1-e)+t*e}};function qht(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]=jE(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 Wht(r,t){r===void 0&&(r={}),t===void 0&&(t={});var e={},n={};return Object.entries(t).forEach(function(i){var a=z(i,2),s=a[0],o=a[1];s in r?e[s]=jE(r[s],o):n[s]=o}),function(i){return Object.entries(e).forEach(function(a){var s=z(a,2),o=s[0],l=s[1];return n[o]=l(i)}),n}}function jE(r,t){return typeof r=="number"&&typeof t=="number"?jht(r,t):Array.isArray(r)&&Array.isArray(t)?qht(r,t):typeof r=="object"&&typeof t=="object"?Wht(r,t):function(e){return r}}function Ght(r,t,e,n){if(!n)return r.attr("__keyframe_data__",e),null;var i=n.duration,a=i===void 0?0:i,s=jE(t,e),o=Math.ceil(+a/16),l=new Array(o).fill(0).map(function(u,c,h){return{__keyframe_data__:s(c/(h.length-1))}});return r.animate(l,et({fill:"both"},n))}function Pa(r,t){return[r[0]*t,r[1]*t]}function Ku(r,t){return[r[0]+t[0],r[1]+t[1]]}function Yb(r,t){return[r[0]-t[0],r[1]-t[1]]}function ho(r,t){return[Math.min(r[0],t[0]),Math.min(r[1],t[1])]}function fo(r,t){return[Math.max(r[0],t[0]),Math.max(r[1],t[1])]}function _c(r,t){return Math.sqrt(Math.pow(r[0]-t[0],2)+Math.pow(r[1]-t[1],2))}function R5(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 Vht(r,t){return t?[r[1],-r[0]]:[-r[1],r[0]]}function gN(r,t){return+r.toPrecision(t)}function pN(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 Hht(r,t,e,n){var i,a=[],s=!!n,o,l,u=[1/0,1/0],c=[-1/0,-1/0],h,d,g;if(s){i=z(n,2),u=i[0],c=i[1];for(var p=0,v=r.length;p<v;p+=1){var m=r[p];u=ho(u,m),c=fo(c,m)}}for(var p=0,b=r.length;p<b;p+=1){var m=r[p];if(p===0)g=m;else if(p===b-1)d=m,a.push(g),a.push(d);else{var w=[p?p-1:b-1,p-1][1];o=r[w],l=r[p+1];var x=[0,0];x=Yb(l,o),x=Pa(x,t);var S=_c(m,o),_=_c(m,l),M=S+_;M!==0&&(S/=M,_/=M);var k=Pa(x,-S),C=Pa(x,_);d=Ku(m,k),h=Ku(m,C),h=ho(h,fo(l,m)),h=fo(h,ho(l,m)),k=Yb(h,m),k=Pa(k,-S/_),d=Ku(m,k),d=ho(d,fo(o,m)),d=fo(d,ho(o,m)),C=Yb(m,d),C=Pa(C,_/S),h=Ku(m,C),s&&(d=fo(d,u),d=ho(d,c),h=fo(h,u),h=ho(h,c)),a.push(g),a.push(d),g=h}}return a}function Uht(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=Hht(i,.4,n,e),l=i.length,u=[],c,h,d,a=0;a<l-1;a+=1)c=o[a*2],h=o[a*2+1],d=i[a+1],u.push(["C",c[0],c[1],h[0],h[1],d[0],d[1]]);return u}var Yht=["$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 Xht(r){return Yht.includes(r)}function vN(r){var t={};for(var e in r)Xht(e)&&(t[e]=r[e]);return t}function Kht(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 qE(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 Zht(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 Jht(r){throw new Error(r)}var Qht=function(){function r(i,a,s,o,l,u,c){i===void 0&&(i=null),a===void 0&&(a=null),s===void 0&&(s=null),o===void 0&&(o=null),l===void 0&&(l=[null,null,null,null,null]),u===void 0&&(u=[]),c===void 0&&(c=[]),t.add(this),this._elements=Array.from(i),this._data=a,this._parent=s,this._document=o,this._enter=l[0],this._update=l[1],this._exit=l[2],this._merge=l[3],this._split=l[4],this._transitions=u,this._facetElements=c}r.prototype.selectAll=function(i){var a=typeof i=="string"?this._parent.querySelectorAll(i):i;return new e(a,null,this._elements[0],this._document)},r.prototype.selectFacetAll=function(i){var a=typeof i=="string"?this._parent.querySelectorAll(i):i;return new e(this._elements,null,this._parent,this._document,void 0,void 0,a)},r.prototype.select=function(i){var a=typeof i=="string"?this._parent.querySelectorAll(i)[0]||null:i;return new e([a],null,a,this._document)},r.prototype.append=function(i){var a=this,s=typeof i=="function"?i:function(){return a.createElement(i)},o=[];if(this._data!==null){for(var l=0;l<this._data.length;l++){var u=this._data[l],c=z(Array.isArray(u)?u:[u,null],2),h=c[0],d=c[1],g=s(h,l);g.__data__=h,d!==null&&(g.__fromElements__=d),this._parent.appendChild(g),o.push(g)}return new e(o,null,this._parent,this._document)}for(var l=0;l<this._elements.length;l++){var p=this._elements[l],h=p.__data__,g=s(h,l);p.appendChild(g),o.push(g)}return new e(o,null,o[0],this._document)},r.prototype.maybeAppend=function(i,a){var s=vv(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=vv(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=vv(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(T){return T}),s===void 0&&(s=function(){return null});for(var u=[],c=[],h=new Set(this._elements),d=[],g=new Set,p=new Map(this._elements.map(function(T,A){return[a(T.__data__,A),T]})),v=new Map(this._facetElements.map(function(T,A){return[a(T.__data__,A),T]})),m=Zht(this._elements,function(T){return s(T.__data__)}),b=0;b<i.length;b++){var w=i[b],x=a(w,b),S=s(w,b);if(p.has(x)){var _=p.get(x);_.__data__=w,_.__facet__=!1,c.push(_),h.delete(_),p.delete(x)}else if(v.has(x)){var _=v.get(x);_.__data__=w,_.__facet__=!0,c.push(_),v.delete(x)}else if(m.has(x)){var M=m.get(x);d.push([w,M]);try{for(var k=(o=void 0,Pc(M)),C=k.next();!C.done;C=k.next()){var _=C.value;h.delete(_)}}catch(T){o={error:T}}finally{try{C&&!C.done&&(l=k.return)&&l.call(k)}finally{if(o)throw o.error}}m.delete(x)}else if(p.has(S)){var _=p.get(S);_.__toData__?_.__toData__.push(w):_.__toData__=[w],g.add(_),h.delete(_)}else u.push(w)}var P=[new e([],u,this._parent,this._document),new e(c,null,this._parent,this._document),new e(h,null,this._parent,this._document),new e([],d,this._parent,this._document),new e(g,null,this._parent,this._document)];return new e(this._elements,null,this._parent,this._document,P)},r.prototype.merge=function(i){var a=vt(vt([],z(this._elements),!1),z(i._elements),!1),s=vt(vt([],z(this._transitions),!1),z(i._transitions),!1);return new e(a,null,this._parent,this._document,void 0,s)},r.prototype.createElement=function(i){if(this._document)return this._document.createElement(i,{});var a=e.registry[i];return a?new a:Jht("Unknown node type: ".concat(i))},r.prototype.join=function(i,a,s,o,l){i===void 0&&(i=function(p){return p}),a===void 0&&(a=function(p){return p}),s===void 0&&(s=function(p){return p.remove()}),o===void 0&&(o=function(p){return p}),l===void 0&&(l=function(p){return p.remove()});var u=i(this._enter),c=a(this._update),h=s(this._exit),d=o(this._merge),g=l(this._split);return c.merge(u).merge(h).merge(d).merge(g)},r.prototype.remove=function(){for(var i=function(o){var l=a._elements[o],u=a._transitions[o];u?u.then(function(){return l.remove()}):l.remove()},a=this,s=0;s<this._elements.length;s++)i(s);return new e([],null,this._parent,this._document,void 0,this._transitions)},r.prototype.each=function(i){for(var a=0;a<this._elements.length;a++){var s=this._elements[a],o=s.__data__;i.call(s,o,a)}return this},r.prototype.attr=function(i,a){var s=typeof a!="function"?function(){return a}:a;return this.each(function(o,l){a!==void 0&&(this[i]=s.call(this,o,l))})},r.prototype.style=function(i,a,s){s===void 0&&(s=!0);var o=typeof a!="function"||!s?function(){return a}:a;return this.each(function(l,u){a!==void 0&&(this.style[i]=o.call(this,l,u))})},r.prototype.styles=function(i,a){return i===void 0&&(i={}),a===void 0&&(a=!0),this.each(function(s,o){var l=this;Object.entries(i).forEach(function(u){var c=z(u,2),h=c[0],d=c[1],g=typeof d!="function"||!a?function(){return d}:d;d!==void 0&&l.attr(h,g.call(l,s,o))})})},r.prototype.update=function(i,a){a===void 0&&(a=!0);var s=typeof i!="function"||!a?function(){return i}:i;return this.each(function(o,l){i&&this.update&&this.update(s.call(this,o,l))})},r.prototype.maybeUpdate=function(i,a){a===void 0&&(a=!0);var s=typeof i!="function"||!a?function(){return i}:i;return this.each(function(o,l){i&&this.update&&this.update(s.call(this,o,l))})},r.prototype.transition=function(i){var a=this._transitions;return this.each(function(s,o){a[o]=i.call(this,s,o)})},r.prototype.on=function(i,a){return this.each(function(){this.addEventListener(i,a)}),this},r.prototype.call=function(i){for(var a=[],s=1;s<arguments.length;s++)a[s-1]=arguments[s];return i.call.apply(i,vt([this._parent,this],z(a),!1)),this},r.prototype.node=function(){return this._elements[0]},r.prototype.nodes=function(){return this._elements},r.prototype.transitions=function(){return this._transitions.filter(function(i){return!!i})},r.prototype.parent=function(){return this._parent};var t,e,n;return e=r,t=new WeakSet,n=function(a,s){var o=this._elements[0],l=o.querySelector(a);if(l)return new e([l],null,this._parent,this._document);var u=typeof s=="string"?this.createElement(s):s();return o.appendChild(u),new e([u],null,this._parent,this._document)},r.registry={g:_n,rect:Sn,circle:Ua,path:qr,text:$E,ellipse:Lc,image:Dc,line:Do,polygon:Vo,polyline:u0,html:Ic},r}();function _t(r){return new Qht([r],null,r,r.ownerDocument)}function tdt(r,t,e){return r.querySelector(t)?_t(r).select(t):_t(r).append(e)}function qn(r){if(bt(r))return[r,r,r,r];if(Xr(r)){var t=r.length;if(t===1)return[r[0],r[0],r[0],r[0]];if(t===2)return[r[0],r[1],r[0],r[1]];if(t===3)return[r[0],r[1],r[2],r[1]];if(t===4)return r}return[0,0,0,0]}function mN(r){var t=r.getLocalBounds(),e=t.min,n=t.max,i=z([e,n],2),a=z(i[0],2),s=a[0],o=a[1],l=z(i[1],2),u=l[0],c=l[1];return{x:s,y:o,width:u-s,height:c-o,left:s,bottom:c,top:o,right:u}}function edt(r,t){var e=z(r,2),n=e[0],i=e[1],a=z(t,2),s=a[0],o=a[1];return n!==s&&i===o}function ndt(r,t){var e,n,i=t.attributes;try{for(var a=Pc(Object.entries(i)),s=a.next();!s.done;s=a.next()){var o=z(s.value,2),l=o[0],u=o[1];l!=="id"&&l!=="className"&&r.attr(l,u)}}catch(c){e={error:c}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}}function WE(r){return r.toString().charAt(0).toUpperCase()+r.toString().slice(1)}function rdt(r){return r.toString().charAt(0).toLowerCase()+r.toString().slice(1)}function idt(r,t){return"".concat(t).concat(WE(r))}function yN(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?rdt(a):a}function adt(r,t){Object.entries(t).forEach(function(e){var n=z(e,2),i=n[0],a=n[1];vt([r],z(r.querySelectorAll(i)),!1).filter(function(s){return s.matches(i)}).forEach(function(s){if(s){var o=s;o.style.cssText+=Object.entries(a).reduce(function(l,u){return"".concat(l).concat(u.join(":"),";")},"")}})})}var Vd=function(r,t){if(!(r!=null&&r.startsWith(t)))return!1;var e=r[t.length];return e>="A"&&e<="Z"};function Nt(r,t,e){e===void 0&&(e=!1);var n={};return Object.entries(r).forEach(function(i){var a=z(i,2),s=a[0],o=a[1];if(!(s==="className"||s==="class")){if(Vd(s,"show")&&Vd(yN(s,"show"),t)!==e)s===idt(t,"show")?n[s]=o:n[s.replace(new RegExp(WE(t)),"")]=o;else if(!Vd(s,"show")&&Vd(s,t)!==e){var l=yN(s,t);l==="filter"&&typeof o=="function"||(n[l]=o)}}}),n}function Pl(r,t){return Object.entries(r).reduce(function(e,n){var i=z(n,2),a=i[0],s=i[1];return a.startsWith("show")?e["show".concat(t).concat(a.slice(4))]=s:e["".concat(t).concat(WE(a))]=s,e},{})}function Ha(r,t){t===void 0&&(t=["x","y","class","className"]);var e=["transform","transformOrigin","anchor","visibility","pointerEvents","zIndex","cursor","clipPath","clipPathTargets","offsetPath","offsetPathTargets","offsetDistance","draggable","droppable"],n={},i={};return Object.entries(r).forEach(function(a){var s=z(a,2),o=s[0],l=s[1];t.includes(o)||(e.indexOf(o)!==-1?i[o]=l:n[o]=l)}),[n,i]}function yr(r,t){var e={YYYY:r.getFullYear(),MM:r.getMonth()+1,DD:r.getDate(),HH:r.getHours(),mm:r.getMinutes(),ss:r.getSeconds()},n=t;return Object.keys(e).forEach(function(i){var a=e[i];n=n.replace(i,i==="YYYY"?"".concat(a):"".concat(a).padStart(2,"0"))}),n}function sdt(r,t,e){var n=r.getBBox(),i=n.width,a=n.height,s=z([t,e].map(function(u,c){var h;return u.includes("%")?parseFloat(((h=u.match(/[+-]?([0-9]*[.])?[0-9]+/))===null||h===void 0?void 0:h[0])||"0")/100*(c===0?i:a):u}),2),o=s[0],l=s[1];return[o,l]}function L5(r,t){if(t)try{var e=/translate\(([+-]*[\d]+[%]*),[ ]*([+-]*[\d]+[%]*)\)/g,n=t.replace(e,function(i,a,s){return"translate(".concat(sdt(r,a,s),")")});r.attr("transform",n)}catch{}}function odt(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 bN=function(r,t){if(t==null){r.innerHTML="";return}r.replaceChildren?Array.isArray(t)?r.replaceChildren.apply(r,vt([],z(t),!1)):r.replaceChildren(t):(r.innerHTML="",Array.isArray(t)?t.forEach(function(e){return r.appendChild(e)}):r.appendChild(t))};function ldt(){xg(this,this.attributes.visibility!=="hidden")}var Qe=function(r){Ut(t,r);function t(e,n){n===void 0&&(n={});var i=r.call(this,Pn({},{style:n},e))||this;return i.initialized=!1,i._defaultOptions=n,i}return Object.defineProperty(t.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=k5(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"&&ldt.call(this)},t.prototype.update=function(e,n){var i;return this.attr(Pn({},this.attributes,e||{})),(i=this.render)===null||i===void 0?void 0:i.call(this,this.attributes,this,n)},t.prototype.clear=function(){this.removeChildren()},t.prototype.bindEvents=function(e,n){},t.prototype.getSubShapeStyle=function(e){e.x,e.y,e.transform,e.transformOrigin,e.class,e.className,e.zIndex;var n=Je(e,["x","y","transform","transformOrigin","class","className","zIndex"]);return n},t}(jx),I5=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"]]},udt=I5,cdt=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"]]},hdt=function(r,t,e){return[["M",r-e,t],["L",r,t-e],["L",r+e,t],["L",r,t+e],["Z"]]},ddt=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"]]},fdt=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"]]},gdt=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"]]},pdt=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"]]},D5=function(r,t,e){return[["M",r,t+e],["L",r,t-e]]},vdt=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]]},mdt=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]]},ydt=function(r,t,e){return[["M",r-e,t],["L",r+e,t],["M",r,t-e],["L",r,t+e]]},bdt=function(r,t,e){return[["M",r-e,t],["L",r+e,t]]},F5=function(r,t,e){return[["M",r-e,t],["L",r+e,t]]},wdt=F5,xdt=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]]},Edt=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]]},_dt=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]]},Sdt=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 Mdt(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 kdt=function(r,t,e){return[["M",r-e,t-e],["L",r+e,t],["L",r-e,t+e],["Z"]]};function Cdt(r){var t="default";if(sn(r)&&r instanceof Image)t="image";else if(Et(r))t="symbol";else if(oe(r)){var e=new RegExp("data:(image|text)");r.match(e)?t="base64":/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(r)?t="url":t="symbol"}return t}function Tdt(r){var t=Cdt(r);return["base64","url","image"].includes(t)?"image":r&&t==="symbol"?"path":null}var xe=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s,l=this.getSubShapeStyle(e),u=l.symbol,c=l.size,h=c===void 0?16:c,d=Je(l,["symbol","size"]),g=Tdt(u);Ur(!!g,_t(n),function(p){p.maybeAppendByClassName("marker",g).attr("className","marker ".concat(g,"-marker")).call(function(v){if(g==="image"){var m=h*2;v.styles({img:u,width:m,height:m,x:a-h,y:o-h})}else{var m=h/2,b=Et(u)?u:t.getSymbol(u);v.styles(et({d:b==null?void 0:b(a,o,m)},d))}})})},t.MARKER_SYMBOL_MAP=new Map,t.registerSymbol=function(e,n){t.MARKER_SYMBOL_MAP.set(e,n)},t.getSymbol=function(e){return t.MARKER_SYMBOL_MAP.get(e)},t.getSymbols=function(){return Array.from(t.MARKER_SYMBOL_MAP.keys())},t}(Qe);xe.registerSymbol("cross",vdt);xe.registerSymbol("hyphen",bdt);xe.registerSymbol("line",D5);xe.registerSymbol("plus",ydt);xe.registerSymbol("tick",mdt);xe.registerSymbol("circle",I5);xe.registerSymbol("point",udt);xe.registerSymbol("bowtie",pdt);xe.registerSymbol("hexagon",gdt);xe.registerSymbol("square",cdt);xe.registerSymbol("diamond",hdt);xe.registerSymbol("triangle",ddt);xe.registerSymbol("triangle-down",fdt);xe.registerSymbol("line",D5);xe.registerSymbol("dot",F5);xe.registerSymbol("dash",wdt);xe.registerSymbol("smooth",xdt);xe.registerSymbol("hv",Edt);xe.registerSymbol("vh",_dt);xe.registerSymbol("hvh",Sdt);xe.registerSymbol("vhv",Mdt);function Xf(r,...t){return t.reduce((e,n)=>i=>e(n(i)),r)}function fx(r,t){return t-r?e=>(e-r)/(t-r):e=>.5}function Odt(r,t){const e=t<r?t:r,n=r>t?r:t;return i=>Math.min(Math.max(e,i),n)}function Adt(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 wN=Math.sqrt(50),xN=Math.sqrt(10),EN=Math.sqrt(2);function lf(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>=wN?10:a>=xN?5:a>=EN?2:1)*10**i:-(10**-i)/(a>=wN?10:a>=xN?5:a>=EN?2:1)}const Pdt=(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=lf(s,o,e),l>0?(s=Math.floor(s/l)*l,o=Math.ceil(o/l)*l,l=lf(s,o,e)):l<0&&(s=Math.ceil(s*l)/l,o=Math.floor(o*l)/l,l=lf(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 _N(r){return!Pt(r)&&!PW(r)&&!Number.isNaN(r)}var B5={exports:{}},Ndt={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]},z5={exports:{}},Rdt=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")},Ldt=Rdt,Idt=Array.prototype.concat,Ddt=Array.prototype.slice,SN=z5.exports=function(t){for(var e=[],n=0,i=t.length;n<i;n++){var a=t[n];Ldt(a)?e=Idt.call(e,Ddt.call(a)):e.push(a)}return e};SN.wrap=function(r){return function(){return r(SN(arguments))}};var Fdt=z5.exports,sc=Ndt,Jc=Fdt,$5=Object.hasOwnProperty,j5=Object.create(null);for(var Xb in sc)$5.call(sc,Xb)&&(j5[sc[Xb]]=Xb);var Gr=B5.exports={to:{},get:{}};Gr.get=function(r){var t=r.substring(0,3).toLowerCase(),e,n;switch(t){case"hsl":e=Gr.get.hsl(r),n="hsl";break;case"hwb":e=Gr.get.hwb(r),n="hwb";break;default:e=Gr.get.rgb(r),n="rgb";break}return e?{model:n,value:e}:null};Gr.get.rgb=function(r){if(!r)return null;var t=/^#([a-f0-9]{3,4})$/i,e=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,n=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,i=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,a=/^(\w+)$/,s=[0,0,0,1],o,l,u;if(o=r.match(e)){for(u=o[2],o=o[1],l=0;l<3;l++){var c=l*2;s[l]=parseInt(o.slice(c,c+2),16)}u&&(s[3]=parseInt(u,16)/255)}else if(o=r.match(t)){for(o=o[1],u=o[3],l=0;l<3;l++)s[l]=parseInt(o[l]+o[l],16);u&&(s[3]=parseInt(u+u,16)/255)}else if(o=r.match(n)){for(l=0;l<3;l++)s[l]=parseInt(o[l+1],0);o[4]&&(o[5]?s[3]=parseFloat(o[4])*.01:s[3]=parseFloat(o[4]))}else if(o=r.match(i)){for(l=0;l<3;l++)s[l]=Math.round(parseFloat(o[l+1])*2.55);o[4]&&(o[5]?s[3]=parseFloat(o[4])*.01:s[3]=parseFloat(o[4]))}else return(o=r.match(a))?o[1]==="transparent"?[0,0,0,0]:$5.call(sc,o[1])?(s=sc[o[1]],s[3]=1,s):null:null;for(l=0;l<3;l++)s[l]=Is(s[l],0,255);return s[3]=Is(s[3],0,1),s};Gr.get.hsl=function(r){if(!r)return null;var t=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,e=r.match(t);if(e){var n=parseFloat(e[4]),i=(parseFloat(e[1])%360+360)%360,a=Is(parseFloat(e[2]),0,100),s=Is(parseFloat(e[3]),0,100),o=Is(isNaN(n)?1:n,0,1);return[i,a,s,o]}return null};Gr.get.hwb=function(r){if(!r)return null;var t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,e=r.match(t);if(e){var n=parseFloat(e[4]),i=(parseFloat(e[1])%360+360)%360,a=Is(parseFloat(e[2]),0,100),s=Is(parseFloat(e[3]),0,100),o=Is(isNaN(n)?1:n,0,1);return[i,a,s,o]}return null};Gr.to.hex=function(){var r=Jc(arguments);return"#"+Hd(r[0])+Hd(r[1])+Hd(r[2])+(r[3]<1?Hd(Math.round(r[3]*255)):"")};Gr.to.rgb=function(){var r=Jc(arguments);return r.length<4||r[3]===1?"rgb("+Math.round(r[0])+", "+Math.round(r[1])+", "+Math.round(r[2])+")":"rgba("+Math.round(r[0])+", "+Math.round(r[1])+", "+Math.round(r[2])+", "+r[3]+")"};Gr.to.rgb.percent=function(){var r=Jc(arguments),t=Math.round(r[0]/255*100),e=Math.round(r[1]/255*100),n=Math.round(r[2]/255*100);return r.length<4||r[3]===1?"rgb("+t+"%, "+e+"%, "+n+"%)":"rgba("+t+"%, "+e+"%, "+n+"%, "+r[3]+")"};Gr.to.hsl=function(){var r=Jc(arguments);return r.length<4||r[3]===1?"hsl("+r[0]+", "+r[1]+"%, "+r[2]+"%)":"hsla("+r[0]+", "+r[1]+"%, "+r[2]+"%, "+r[3]+")"};Gr.to.hwb=function(){var r=Jc(arguments),t="";return r.length>=4&&r[3]!==1&&(t=", "+r[3]),"hwb("+r[0]+", "+r[1]+"%, "+r[2]+"%"+t+")"};Gr.to.keyword=function(r){return j5[r.slice(0,3)]};function Is(r,t,e){return Math.min(Math.max(t,r),e)}function Hd(r){var t=Math.round(r).toString(16).toUpperCase();return t.length<2?"0"+t:t}var Bdt=B5.exports;const zdt=r0(Bdt);function Kb(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 $dt(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=Kb(s,a,t+1/3),l=Kb(s,a,t),u=Kb(s,a,t-1/3);return[o*255,l*255,u*255,i]}function MN(r){const t=zdt.get(r);if(!t)return null;const{model:e,value:n}=t;return e==="rgb"?n:e==="hsl"?$dt(n):null}const Kf=(r,t)=>e=>r*(1-e)+t*e,jdt=(r,t)=>{const e=MN(r),n=MN(t);return e===null||n===null?e?()=>r:()=>t:i=>{const a=new Array(4);for(let c=0;c<4;c+=1){const h=e[c],d=n[c];a[c]=h*(1-i)+d*i}const[s,o,l,u]=a;return`rgba(${Math.round(s)}, ${Math.round(o)}, ${Math.round(l)}, ${u})`}},qdt=(r,t)=>typeof r=="number"&&typeof t=="number"?Kf(r,t):typeof r=="string"&&typeof t=="string"?jdt(r,t):()=>r,Wdt=(r,t)=>{const e=Kf(r,t);return n=>Math.round(e(n))};function kN({map:r,initKey:t},e){const n=t(e);return r.has(n)?r.get(n):e}function Gdt({map:r,initKey:t},e){const n=t(e);return r.has(n)?r.get(n):(r.set(n,e),e)}function Vdt({map:r,initKey:t},e){const n=t(e);return r.has(n)&&(e=r.get(n),r.delete(n)),e}function Hdt(r){return typeof r=="object"?r.valueOf():r}class CN extends Map{constructor(t){if(super(),this.map=new Map,this.initKey=Hdt,t!==null)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(kN({map:this.map,initKey:this.initKey},t))}has(t){return super.has(kN({map:this.map,initKey:this.initKey},t))}set(t,e){return super.set(Gdt({map:this.map,initKey:this.initKey},t),e)}delete(t){return super.delete(Vdt({map:this.map,initKey:this.initKey},t))}}class q5{constructor(t){this.options=cr({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=cr({},this.options,t),this.rescale(t)}rescale(t){}}const GE=Symbol("defaultUnknown");function TN(r,t,e){for(let n=0;n<t.length;n+=1)r.has(t[n])||r.set(e(t[n]),n)}function ON(r){const{value:t,from:e,to:n,mapper:i,notFoundReturn:a}=r;let s=i.get(t);if(s===void 0){if(a!==GE)return a;s=e.push(t)-1,i.set(t,s)}return n[s%n.length]}function AN(r){return r instanceof Date?t=>`${t}`:typeof r=="object"?t=>JSON.stringify(t):t=>t}class VE extends q5{getDefaultOptions(){return{domain:[],range:[],unknown:GE}}constructor(t){super(t)}map(t){return this.domainIndexMap.size===0&&TN(this.domainIndexMap,this.getDomain(),this.domainKey),ON({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return this.rangeIndexMap.size===0&&TN(this.rangeIndexMap,this.getRange(),this.rangeKey),ON({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=AN(e),this.rangeKey=AN(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 VE(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 Udt(r){const t=Math.min(...r);return r.map(e=>e/t)}function Ydt(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 Xdt(r){return Math.round(r*1e12)/1e12}function Kdt(r){const{domain:t,range:e,paddingOuter:n,paddingInner:i,flex:a,round:s,align:o}=r,l=t.length,u=Ydt(a,l),[c,h]=e,d=h-c,g=2/l*n+1-1/l*i,p=d/g,v=p*i/l,m=p-l*v,b=Udt(u),w=b.reduce((R,L)=>R+L),x=m/w,S=new CN(t.map((R,L)=>{const $=b[L]*x;return[R,s?Math.floor($):$]})),_=new CN(t.map((R,L)=>{const q=b[L]*x+v;return[R,s?Math.floor(q):q]})),M=Array.from(_.values()).reduce((R,L)=>R+L),C=(d-(M-M/l*i))*o,P=c+C;let T=s?Math.round(P):P;const A=new Array(l);for(let R=0;R<l;R+=1){A[R]=Xdt(T);const L=t[R];T+=_.get(L)}return{valueBandWidth:S,valueStep:_,adjustedRange:A}}function Zdt(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 Kdt(r);const{range:a,paddingOuter:s,paddingInner:o,round:l,align:u}=r;let c,h,d=a[0];const p=a[1]-d,v=s*2,m=n-o;c=p/Math.max(1,v+m),l&&(c=Math.floor(c)),d+=(p-c*(n-o))*u,h=c*(1-o),l&&(d=Math.round(d),h=Math.round(h));const b=new Array(n).fill(0).map((w,x)=>d+x*c);return{valueStep:c,valueBandWidth:h,adjustedRange:b}}class HE extends VE{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:GE,flex:[]}}constructor(t){super(t)}clone(){return new HE(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}=Zdt({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 Jdt=(r,t,e)=>{let n,i,a=r,s=t;if(a===s&&e>0)return[a];let o=lf(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},Qdt=(r,t,e)=>{const[n,i]=r,[a,s]=t;let o,l;return n<i?(o=fx(n,i),l=e(a,s)):(o=fx(i,n),l=e(s,a)),Xf(l,o)},tft=(r,t,e)=>{const n=Math.min(r.length,t.length)-1,i=new Array(n),a=new Array(n),s=r[0]>r[n],o=s?[...r].reverse():r,l=s?[...t].reverse():t;for(let u=0;u<n;u+=1)i[u]=fx(o[u],o[u+1]),a[u]=e(l[u],l[u+1]);return u=>{const c=Adt(r,u,1,n)-1,h=i[c],d=a[c];return Xf(d,h)(u)}},PN=(r,t,e,n)=>(Math.min(r.length,t.length)>2?tft:Qdt)(r,t,n?Wdt:e);class eft extends q5{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:Kf,tickCount:5}}map(t){return _N(t)?this.output(t):this.options.unknown}invert(t){return _N(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 Pdt}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?Odt(i[0],i[a-1]):fw}composeOutput(t,e){const{domain:n,range:i,round:a,interpolate:s}=this.options,o=PN(n.map(t),i,s,a);this.output=Xf(o,e,t)}composeInput(t,e,n){const{domain:i,range:a}=this.options,s=PN(a,i.map(t),Kf);this.input=Xf(e,n,s)}}class oc extends eft{getDefaultOptions(){return{domain:[0,1],range:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolate:qdt,tickMethod:Jdt,tickCount:5}}chooseTransforms(){return[fw,fw]}clone(){return new oc(this.options)}}var nft=function(r){Ut(t,r);function t(e){var n=this,i=e.style,a=Je(e,["style"]);return n=r.call(this,cr({},{type:"column"},et({style:i},a)))||this,n.columnsGroup=new _n({name:"columns"}),n.appendChild(n.columnsGroup),n.render(),n}return t.prototype.render=function(){var e=this.attributes,n=e.columns,i=e.x,a=e.y;this.columnsGroup.style.transform="translate(".concat(i,", ").concat(a,")"),_t(this.columnsGroup).selectAll(".column").data(n.flat()).join(function(s){return s.append("rect").attr("className","column").each(function(o){this.attr(o)})},function(s){return s.each(function(o){this.attr(o)})},function(s){return s.remove()})},t.prototype.update=function(e){this.attr(Pn({},this.attributes,e)),this.render()},t.prototype.clear=function(){this.removeChildren()},t}(Ne),rft=function(r){Ut(t,r);function t(e){var n=this,i=e.style,a=Je(e,["style"]);return n=r.call(this,cr({},{type:"lines"},et({style:i},a)))||this,n.linesGroup=n.appendChild(new _n),n.areasGroup=n.appendChild(new _n),n.render(),n}return t.prototype.render=function(){var e=this.attributes,n=e.lines,i=e.areas,a=e.x,s=e.y;this.style.transform="translate(".concat(a,", ").concat(s,")"),n&&this.renderLines(n),i&&this.renderAreas(i)},t.prototype.clear=function(){this.linesGroup.removeChildren(),this.areasGroup.removeChildren()},t.prototype.update=function(e){this.attr(Pn({},this.attributes,e)),this.render()},t.prototype.renderLines=function(e){_t(this.linesGroup).selectAll(".line").data(e).join(function(n){return n.append("path").attr("className","line").each(function(i){this.attr(i)})},function(n){return n.each(function(i){this.attr(i)})},function(n){return n.remove()})},t.prototype.renderAreas=function(e){_t(this.linesGroup).selectAll(".area").data(e).join(function(n){return n.append("path").attr("className","area").each(function(i){this.attr(i)})},function(n){return n.each(function(i){this.style(i)})},function(n){return n.remove()})},t}(Ne);function ift(r,t){var e,n=t.x,i=t.y,a=z(i.getOptions().range||[0,0],2),s=a[0],o=a[1];return o>s&&(e=z([s,o],2),o=e[0],s=e[1]),r.map(function(l){var u=l.map(function(c,h){return[n.map(h),Ue(i.map(c),o,s)]});return u})}function Sc(r,t){t===void 0&&(t=!1);var e=t?r.length-1:0,n=r.map(function(i,a){return vt([a===e?"M":"L"],z(i),!1)});return t?n.reverse():n}function Zf(r,t){if(t===void 0&&(t=!1),r.length<=2)return Sc(r);for(var e=[],n=r.length,i=0;i<n;i+=1){var a=t?r[n-i-1]:r[i];Ye(a,e.slice(-2))||e.push.apply(e,vt([],z(a),!1))}var s=Uht(e);return t?s.unshift(vt(["M"],z(r[n-1]),!1)):s.unshift(vt(["M"],z(r[0]),!1)),s}function UE(r,t,e){var n=zs(r);return n.push(["L",t,e],["L",0,e],["Z"]),n}function aft(r,t,e,n){return r.map(function(i){return UE(t?Zf(i):Sc(i),e,n)})}function sft(r,t,e){for(var n=[],i=r.length-1;i>=0;i-=1){var a=r[i],s=Sc(a),o=void 0;if(i===0)o=UE(s,t,e);else{var l=r[i-1],u=Sc(l,!0);u[0][0]="L",o=vt(vt(vt([],z(s),!1),z(u),!1),[["Z"]],!1)}n.push(o)}return n}function oft(r,t,e){for(var n=[],i=r.length-1;i>=0;i-=1){var a=r[i],s=Zf(a),o=void 0;if(i===0)o=UE(s,t,e);else{var l=r[i-1],u=Zf(l,!0),c=a[0];u[0][0]="L",o=vt(vt(vt([],z(s),!1),z(u),!1),[vt(["M"],z(c),!1),["Z"]],!1)}n.push(o)}return n}function NN(r){return r.length===0?[0,0]:[vf(MW(r,function(t){return vf(t)||0})),pf(SW(r,function(t){return pf(t)||0}))]}function RN(r){for(var t=zs(r),e=t[0].length,n=z([Array(e).fill(0),Array(e).fill(0)],2),i=n[0],a=n[1],s=0;s<t.length;s+=1)for(var o=t[s],l=0;l<e;l+=1)o[l]>=0?(o[l]+=i[l],i[l]=o[l]):(o[l]+=a[l],a[l]=o[l]);return t}var lft=function(r){Ut(t,r);function t(e){return r.call(this,e,{type:"line",x:0,y:0,width:200,height:20,isStack:!1,color:["#83daad","#edbf45","#d2cef9","#e290b3","#6f63f4"],smooth:!0,lineLineWidth:1,areaOpacity:0,isGroup:!1,columnLineWidth:1,columnStroke:"#fff",scale:1,spacing:0})||this}return Object.defineProperty(t.prototype,"rawData",{get:function(){var e=this.attributes.data;if(!e||(e==null?void 0:e.length)===0)return[[]];var n=zs(e);return bt(n[0])?[n]:n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this.attributes.isStack?RN(this.rawData):this.rawData},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scales",{get:function(){return this.createScales(this.data)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"baseline",{get:function(){var e=this.scales.y,n=z(e.getOptions().domain||[0,0],2),i=n[0],a=n[1];return a<0?e.map(a):e.map(i<0?0:i)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"containerShape",{get:function(){var e=this.attributes,n=e.width,i=e.height;return{width:n,height:i}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linesStyle",{get:function(){var e=this,n=this.attributes,i=n.type,a=n.isStack,s=n.smooth;if(i!=="line")throw new Error("linesStyle can only be used in line type");var o=Nt(this.attributes,"area"),l=Nt(this.attributes,"line"),u=this.containerShape.width,c=this.data;if(c[0].length===0)return{lines:[],areas:[]};var h=this.scales,d=h.x,g=h.y,p=ift(c,{x:d,y:g}),v=[];if(o){var m=this.baseline;a?v=s?oft(p,u,m):sft(p,u,m):v=aft(p,s,u,m)}return{lines:p.map(function(b,w){return et({stroke:e.getColor(w),d:s?Zf(b):Sc(b)},l)}),areas:v.map(function(b,w){return et({d:b,fill:e.getColor(w)},o)})}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"columnsStyle",{get:function(){var e=this,n=Nt(this.attributes,"column"),i=this.attributes,a=i.isStack,s=i.type,o=i.scale;if(s!=="column")throw new Error("columnsStyle can only be used in column type");var l=this.containerShape.height,u=this.rawData;if(!u)return{columns:[]};a&&(u=RN(u));var c=this.createScales(u),h=c.x,d=c.y,g=z(NN(u),2),p=g[0],v=g[1],m=new oc({domain:[0,v-(p>0?0:p)],range:[0,l*o]}),b=h.getBandWidth(),w=this.rawData;return{columns:u.map(function(x,S){return x.map(function(_,M){var k=b/u.length,C=function(){return{x:h.map(M)+k*S,y:_>=0?d.map(_):d.map(0),width:k,height:m.map(Math.abs(_))}},P=function(){return{x:h.map(M),y:d.map(_),width:b,height:m.map(w[S][M])}};return et(et({fill:e.getColor(S)},n),a?P():C())})})}},enumerable:!1,configurable:!0}),t.prototype.render=function(e,n){tdt(n,".container","rect").attr("className","container").node();var i=e.type,a=e.x,s=e.y,o="spark".concat(i),l=et({x:a,y:s},i==="line"?this.linesStyle:this.columnsStyle);_t(n).selectAll(".spark").data([i]).join(function(u){return u.append(function(c){return c==="line"?new rft({className:o,style:l}):new nft({className:o,style:l})}).attr("className","spark ".concat(o))},function(u){return u.update(l)},function(u){return u.remove()})},t.prototype.getColor=function(e){var n=this.attributes.color;return Xr(n)?n[e%n.length]:Et(n)?n.call(null,e):n},t.prototype.createScales=function(e){var n,i,a=this.attributes,s=a.type,o=a.scale,l=a.range,u=l===void 0?[]:l,c=a.spacing,h=this.containerShape,d=h.width,g=h.height,p=z(NN(e),2),v=p[0],m=p[1],b=new oc({domain:[(n=u[0])!==null&&n!==void 0?n:v,(i=u[1])!==null&&i!==void 0?i:m],range:[g,g*(1-o)]});return s==="line"?{type:s,x:new oc({domain:[0,e[0].length-1],range:[0,d]}),y:b}:{type:s,x:new HE({domain:e[0].map(function(w,x){return x}),range:[0,d],paddingInner:c,paddingOuter:c/2,align:.5}),y:b}},t.tag="sparkline",t}(Qe);function uft(r){return typeof r=="boolean"?!1:"enter"in r&&"update"in r&&"exit"in r}function LN(r){if(!r)return{enter:!1,update:!1,exit:!1};var t=["enter","update","exit"],e=Object.fromEntries(Object.entries(r).filter(function(n){var i=z(n,1),a=i[0];return!t.includes(a)}));return Object.fromEntries(t.map(function(n){return uft(r)?r[n]===!1?[n,!1]:[n,et(et({},r[n]),e)]:[n,e]}))}function lu(r,t){r?r.finished.then(t):t()}function cft(r,t){r.length===0?t():Promise.all(r.map(function(e){return e==null?void 0:e.finished})).then(t)}function W5(r,t){"update"in r?r.update(t):r.attr(t)}function G5(r,t,e){if(t.length===0)return null;if(!e){var n=t.slice(-1)[0];return W5(r,{style:n}),null}return r.animate(t,e)}function hft(r,t){return!(r.nodeName!=="text"||t.nodeName!=="text"||r.attributes.text!==t.attributes.text)}function dft(r,t,e,n){if(n===void 0&&(n="destroy"),hft(r,t))return r.remove(),[null];var i=function(){n==="destroy"?r.destroy():n==="hide"&&Ri(r),t.isVisible()&&Zc(t)};if(!e)return i(),[null];var a=e.duration,s=a===void 0?0:a,o=e.delay,l=o===void 0?0:o,u=Math.ceil(+s/2),c=+s/4,h=z(r.getGeometryBounds().center,2),d=h[0],g=h[1],p=z(t.getGeometryBounds().center,2),v=p[0],m=p[1],b=z([(d+v)/2-d,(g+m)/2-g],2),w=b[0],x=b[1],S=r.style.opacity,_=S===void 0?1:S,M=t.style.opacity,k=M===void 0?1:M,C=r.style.transform||"",P=t.style.transform||"",T=r.animate([{opacity:_,transform:"translate(0, 0) ".concat(C)},{opacity:0,transform:"translate(".concat(w,", ").concat(x,") ").concat(C)}],et(et({fill:"both"},e),{duration:l+u+c})),A=t.animate([{opacity:0,transform:"translate(".concat(-w,", ").concat(-x,") ").concat(P),offset:.01},{opacity:k,transform:"translate(0, 0) ".concat(P)}],et(et({fill:"both"},e),{duration:u+c,delay:l+u-c}));return lu(A,i),[T,A]}function Li(r,t,e){var n={},i={};return Object.entries(t).forEach(function(a){var s=z(a,2),o=s[0],l=s[1];if(!kt(l)){var u=r.style[o]||r.parsedStyle[o]||0;u!==l&&(n[o]=u,i[o]=l)}}),e?G5(r,[n,i],et({fill:"both"},e)):(W5(r,i),null)}function Eg(r,t){return r.style.opacity||(r.style.opacity=1),Li(r,{opacity:0},t)}var V5={fill:"#fff",lineWidth:1,radius:2,size:10,stroke:"#bfbfbf",strokeOpacity:1,zIndex:0},H5={fill:"#000",fillOpacity:.45,fontSize:12,textAlign:"center",textBaseline:"middle",zIndex:1},U5={x:0,y:0,orientation:"horizontal",showLabel:!0,type:"start"},Yi=zi({foreground:"foreground",handle:"handle",selection:"selection",sparkline:"sparkline",sparklineGroup:"sparkline-group",track:"track",brushArea:"brush-area"},"slider"),xs=zi({labelGroup:"label-group",label:"label",iconGroup:"icon-group",icon:"icon",iconRect:"icon-rect",iconLine:"icon-line"},"handle"),fft=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(e,n){var i=e.x,a=e.y,s=e.size,o=s===void 0?10:s,l=e.radius,u=l===void 0?o/4:l,c=e.orientation,h=Je(e,["x","y","size","radius","orientation"]),d=o,g=d*2.4,p=_t(n).maybeAppendByClassName(xs.iconRect,"rect").styles(et(et({},h),{width:d,height:g,radius:u,x:i-d/2,y:a-g/2,transformOrigin:"center"})),v=i+1/3*d-d/2,m=i+2/3*d-d/2,b=a+1/4*g-g/2,w=a+3/4*g-g/2;p.maybeAppendByClassName("".concat(xs.iconLine,"-1"),"line").styles(et({x1:v,x2:v,y1:b,y2:w},h)),p.maybeAppendByClassName("".concat(xs.iconLine,"-2"),"line").styles(et({x1:m,x2:m,y1:b,y2:w},h)),c==="vertical"&&(p.node().style.transform="rotate(90)")},t}(Qe),gft=function(r){Ut(t,r);function t(e){return r.call(this,e,U5)||this}return t.prototype.renderLabel=function(e){var n=this,i=this.attributes,a=i.x,s=i.y,o=i.showLabel,l=Nt(this.attributes,"label"),u=l.x,c=u===void 0?0:u,h=l.y,d=h===void 0?0:h,g=l.transform,p=l.transformOrigin,v=Je(l,["x","y","transform","transformOrigin"]),m=z(Ha(v,[]),2),b=m[0],w=m[1],x=_t(e).maybeAppendByClassName(xs.labelGroup,"g").styles(w),S=et(et({},H5),b),_=S.text,M=Je(S,["text"]);Ur(!!o,x,function(k){n.label=k.maybeAppendByClassName(xs.label,"text").styles(et(et({},M),{x:a+c,y:s+d,transform:g,transformOrigin:p,text:"".concat(_)})),n.label.on("mousedown",function(C){C.stopPropagation()}),n.label.on("touchstart",function(C){C.stopPropagation()})})},t.prototype.renderIcon=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.orientation,o=n.type,l=et(et({x:i,y:a,orientation:s},V5),Nt(this.attributes,"icon")),u=this.attributes.iconShape,c=u===void 0?function(){return new fft({style:l})}:u,h=_t(e).maybeAppendByClassName(xs.iconGroup,"g");h.selectAll(xs.icon.class).data([c]).join(function(d){return d.append(typeof c=="string"?c:function(){return c(o)}).attr("className",xs.icon.name)},function(d){return d.update(l)},function(d){return d.remove()})},t.prototype.render=function(e,n){this.renderIcon(n),this.renderLabel(n)},t}(Qe),pft=function(r){Ut(t,r);function t(e){var n=r.call(this,e,et(et(et({x:0,y:0,animate:{duration:100,fill:"both"},brushable:!0,formatter:function(i){return i.toString()},handleSpacing:2,orientation:"horizontal",padding:0,autoFitLabel:!0,scrollable:!0,selectionFill:"#5B8FF9",selectionFillOpacity:.45,selectionZIndex:2,showHandle:!0,showLabel:!0,slidable:!0,trackFill:"#416180",trackLength:200,trackOpacity:.05,trackSize:20,trackZIndex:-1,values:[0,1],type:"range",selectionType:"select",handleIconOffset:0},Pl(U5,"handle")),Pl(V5,"handleIcon")),Pl(H5,"handleLabel")))||this;return n.range=[0,1],n.onDragStart=function(i){return function(a){a.stopPropagation(),n.target=i,n.prevPos=n.getOrientVal(fN(a));var s=n.availableSpace,o=s.x,l=s.y,u=n.getBBox(),c=u.x,h=u.y;n.selectionStartPos=n.getRatio(n.prevPos-n.getOrientVal([o,l])-n.getOrientVal([+c,+h])),n.selectionWidth=0,document.addEventListener("pointermove",n.onDragging),document.addEventListener("pointerup",n.onDragEnd)}},n.onDragging=function(i){var a=n.attributes,s=a.slidable,o=a.brushable,l=a.type;i.stopPropagation();var u=n.getOrientVal(fN(i)),c=u-n.prevPos;if(c){var h=n.getRatio(c);switch(n.target){case"start":s&&n.setValuesOffset(h);break;case"end":s&&n.setValuesOffset(0,h);break;case"selection":s&&n.setValuesOffset(h,h);break;case"track":if(!o)return;n.selectionWidth+=h,l==="range"?n.innerSetValues([n.selectionStartPos,n.selectionStartPos+n.selectionWidth].sort(),!0):n.innerSetValues([0,n.selectionStartPos+n.selectionWidth],!0);break}n.prevPos=u}},n.onDragEnd=function(){document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointerup",n.onDragEnd),n.target="",n.updateHandlesPosition(!1)},n.onValueChange=function(i){var a=n.attributes,s=a.onChange,o=a.type,l=o==="range"?i:i[1],u=o==="range"?n.getValues():n.getValues()[1],c=new cn("valuechange",{detail:{oldValue:l,value:u}});n.dispatchEvent(c),s==null||s(u)},n.selectionStartPos=0,n.selectionWidth=0,n.prevPos=0,n.target="",n}return Object.defineProperty(t.prototype,"values",{get:function(){return this.attributes.values},set:function(e){this.attributes.values=this.clampValues(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sparklineStyle",{get:function(){var e=this.attributes.orientation;if(e!=="horizontal")return null;var n=Nt(this.attributes,"sparkline");return et(et({zIndex:0},this.availableSpace),n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shape",{get:function(){var e=this.attributes,n=e.trackLength,i=e.trackSize,a=z(this.getOrientVal([[n,i],[i,n]]),2),s=a[0],o=a[1];return{width:s,height:o}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"availableSpace",{get:function(){var e=this.attributes;e.x,e.y;var n=e.padding,i=z(qn(n),4),a=i[0],s=i[1],o=i[2],l=i[3],u=this.shape,c=u.width,h=u.height;return{x:l,y:a,width:c-(l+s),height:h-(a+o)}},enumerable:!1,configurable:!0}),t.prototype.getValues=function(){return this.values},t.prototype.setValues=function(e,n){e===void 0&&(e=[0,0]),n===void 0&&(n=!1),this.attributes.values=e;var i=n===!1?!1:this.attributes.animate;this.updateSelectionArea(i),this.updateHandlesPosition(i)},t.prototype.updateSelectionArea=function(e){var n=this.calcSelectionArea();this.foregroundGroup.selectAll(Yi.selection.class).each(function(i,a){Li(this,n[a],e)})},t.prototype.updateHandlesPosition=function(e){this.attributes.showHandle&&(this.startHandle&&Li(this.startHandle,this.getHandleStyle("start"),e),this.endHandle&&Li(this.endHandle,this.getHandleStyle("end"),e))},t.prototype.innerSetValues=function(e,n){e===void 0&&(e=[0,0]),n===void 0&&(n=!1);var i=this.values,a=this.clampValues(e);this.attributes.values=a,this.setValues(a),n&&this.onValueChange(i)},t.prototype.renderTrack=function(e){var n=this.attributes,i=n.x,a=n.y,s=Nt(this.attributes,"track");this.trackShape=_t(e).maybeAppendByClassName(Yi.track,"rect").styles(et(et({x:i,y:a},this.shape),s))},t.prototype.renderBrushArea=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.brushable;this.brushArea=_t(e).maybeAppendByClassName(Yi.brushArea,"rect").styles(et({x:i,y:a,fill:"transparent",cursor:s?"crosshair":"default"},this.shape))},t.prototype.renderSparkline=function(e){var n=this,i=this.attributes,a=i.x,s=i.y,o=i.orientation,l=_t(e).maybeAppendByClassName(Yi.sparklineGroup,"g");Ur(o==="horizontal",l,function(u){var c=et(et({},n.sparklineStyle),{x:a,y:s});u.maybeAppendByClassName(Yi.sparkline,function(){return new lft({style:c})}).update(c)})},t.prototype.renderHandles=function(){var e=this,n,i=this.attributes,a=i.showHandle,s=i.type,o=s==="range"?["start","end"]:["end"],l=a?o:[],u=this;(n=this.foregroundGroup)===null||n===void 0||n.selectAll(Yi.handle.class).data(l.map(function(c){return{type:c}}),function(c){return c.type}).join(function(c){return c.append(function(h){var d=h.type;return new gft({style:e.getHandleStyle(d)})}).each(function(h){var d=h.type;this.attr("class","".concat(Yi.handle.name," ").concat(d,"-handle"));var g="".concat(d,"Handle");u[g]=this,this.addEventListener("pointerdown",u.onDragStart(d))})},function(c){return c.each(function(h){var d=h.type;this.update(u.getHandleStyle(d))})},function(c){return c.each(function(h){var d=h.type,g="".concat(d,"Handle");u[g]=void 0}).remove()})},t.prototype.renderSelection=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.type,o=n.selectionType;this.foregroundGroup=_t(e).maybeAppendByClassName(Yi.foreground,"g");var l=Nt(this.attributes,"selection"),u=function(h){return h.style("visibility",function(d){return d.show?"visible":"hidden"}).style("cursor",function(d){return o==="select"?"grab":o==="invert"?"crosshair":"default"}).styles(et(et({},l),{transform:"translate(".concat(i,", ").concat(a,")")}))},c=this;this.foregroundGroup.selectAll(Yi.selection.class).data(s==="value"?[]:this.calcSelectionArea().map(function(h,d){return{style:et({},h),index:d,show:o==="select"?d===1:d!==1}}),function(h){return h.index}).join(function(h){return h.append("rect").attr("className",Yi.selection.name).call(u).each(function(d,g){var p=this;g===1?(c.selectionShape=_t(this),this.on("pointerdown",function(v){p.attr("cursor","grabbing"),c.onDragStart("selection")(v)}),c.dispatchCustomEvent(this,"pointerenter","selectionMouseenter"),c.dispatchCustomEvent(this,"pointerleave","selectionMouseleave"),c.dispatchCustomEvent(this,"click","selectionClick"),this.addEventListener("pointerdown",function(){p.attr("cursor","grabbing")}),this.addEventListener("pointerup",function(){p.attr("cursor","pointer")}),this.addEventListener("pointerover",function(){p.attr("cursor","pointer")})):this.on("pointerdown",c.onDragStart("track"))})},function(h){return h.call(u)},function(h){return h.remove()}),this.updateSelectionArea(!1),this.renderHandles()},t.prototype.render=function(e,n){this.renderTrack(n),this.renderSparkline(n),this.renderBrushArea(n),this.renderSelection(n)},t.prototype.clampValues=function(e,n){var i;n===void 0&&(n=4);var a=z(this.range,2),s=a[0],o=a[1],l=z(this.getValues().map(function(m){return gN(m,n)}),2),u=l[0],c=l[1],h=Array.isArray(e)?e:[u,e??c],d=z((h||[u,c]).map(function(m){return gN(m,n)}),2),g=d[0],p=d[1];if(this.attributes.type==="value")return[0,Ue(p,s,o)];g>p&&(i=z([p,g],2),g=i[0],p=i[1]);var v=p-g;return v>o-s?[s,o]:g<s?u===s&&c===p?[s,p]:[s,v+s]:p>o?c===o&&u===g?[g,o]:[o-v,o]:[g,p]},t.prototype.calcSelectionArea=function(e){var n=z(this.clampValues(e),2),i=n[0],a=n[1],s=this.availableSpace,o=s.x,l=s.y,u=s.width,c=s.height;return this.getOrientVal([[{y:l,height:c,x:o,width:i*u},{y:l,height:c,x:i*u+o,width:(a-i)*u},{y:l,height:c,x:a*u,width:(1-a)*u}],[{x:o,width:u,y:l,height:i*c},{x:o,width:u,y:i*c+l,height:(a-i)*c},{x:o,width:u,y:a*c,height:(1-a)*c}]])},t.prototype.calcHandlePosition=function(e){var n=this.attributes.handleIconOffset,i=this.availableSpace,a=i.x,s=i.y,o=i.width,l=i.height,u=z(this.clampValues(),2),c=u[0],h=u[1],d=e==="start"?-n:n,g=(e==="start"?c:h)*this.getOrientVal([o,l])+d;return{x:a+this.getOrientVal([g,o/2]),y:s+this.getOrientVal([l/2,g])}},t.prototype.inferTextStyle=function(e){var n=this.attributes.orientation;return n==="horizontal"?{}:e==="start"?{transformOrigin:"left center",transform:"rotate(90)",textAlign:"start"}:e==="end"?{transformOrigin:"right center",transform:"rotate(90)",textAlign:"end"}:{}},t.prototype.calcHandleText=function(e){var n,i=this.attributes,a=i.type,s=i.orientation,o=i.formatter,l=i.autoFitLabel,u=Nt(this.attributes,"handle"),c=Nt(u,"label"),h=u.spacing,d=this.getHandleSize(),g=this.clampValues(),p=e==="start"?g[0]:g[1],v=o(p),m=new $E({style:et(et(et({},c),this.inferTextStyle(e)),{text:v})}),b=m.getBBox(),w=b.width,x=b.height;if(m.destroy(),!l){if(a==="value")return{text:v,x:0,y:-x-h};var S=h+d+(s==="horizontal"?w/2:0);return n={text:v},n[s==="horizontal"?"x":"y"]=e==="start"?-S:S,n}var _=0,M=0,k=this.availableSpace,C=k.width,P=k.height,T=this.calcSelectionArea()[1],A=T.x,R=T.y,L=T.width,$=T.height,q=h+d;if(s==="horizontal"){var j=q+w/2;if(e==="start"){var B=A-q-w;_=B>0?-j:j}else{var D=C-A-L-q>w;_=D?j:-j}}else{var G=q,X=x+q;e==="start"?M=R-d>x?-X:G:M=P-(R+$)-d>x?X:-G}return{x:_,y:M,text:v}},t.prototype.getHandleLabelStyle=function(e){var n=Nt(this.attributes,"handleLabel");return et(et(et({},n),this.calcHandleText(e)),this.inferTextStyle(e))},t.prototype.getHandleIconStyle=function(){var e=this.attributes.handleIconShape,n=Nt(this.attributes,"handleIcon"),i=this.getOrientVal(["ew-resize","ns-resize"]),a=this.getHandleSize();return et({cursor:i,shape:e,size:a},n)},t.prototype.getHandleStyle=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.showLabel,o=n.showLabelOnInteraction,l=n.orientation,u=this.calcHandlePosition(e),c=u.x,h=u.y,d=this.calcHandleText(e),g=s;return!s&&o&&(this.target?g=!0:g=!1),et(et(et({},Pl(this.getHandleIconStyle(),"icon")),Pl(et(et({},this.getHandleLabelStyle(e)),d),"label")),{transform:"translate(".concat(c+i,", ").concat(h+a,")"),orientation:l,showLabel:g,type:e,zIndex:3})},t.prototype.getHandleSize=function(){var e=this.attributes,n=e.handleIconSize,i=e.width,a=e.height;return n||Math.floor((this.getOrientVal([+a,+i])+4)/2.4)},t.prototype.getOrientVal=function(e){var n=z(e,2),i=n[0],a=n[1],s=this.attributes.orientation;return s==="horizontal"?i:a},t.prototype.setValuesOffset=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var a=this.attributes.type,s=z(this.getValues(),2),o=s[0],l=s[1],u=a==="range"?e:0,c=[o+u,l+n].sort();i?this.setValues(c):this.innerSetValues(c,!0)},t.prototype.getRatio=function(e){var n=this.availableSpace,i=n.width,a=n.height;return e/this.getOrientVal([i,a])},t.prototype.dispatchCustomEvent=function(e,n,i){var a=this;e.on(n,function(s){s.stopPropagation(),a.dispatchEvent(new cn(i,{detail:s}))})},t.prototype.bindEvents=function(){this.addEventListener("wheel",this.onScroll);var e=this.brushArea;this.dispatchCustomEvent(e,"click","trackClick"),this.dispatchCustomEvent(e,"pointerenter","trackMouseenter"),this.dispatchCustomEvent(e,"pointerleave","trackMouseleave"),e.on("pointerdown",this.onDragStart("track"))},t.prototype.onScroll=function(e){var n=this.attributes.scrollable;if(n){var i=e.deltaX,a=e.deltaY,s=a||i,o=this.getRatio(s);this.setValuesOffset(o,o,!0)}},t.tag="slider",t}(Qe),YE={data:[],animate:{enter:!1,update:{duration:100,easing:"ease-in-out-sine",fill:"both"},exit:{duration:100,fill:"both"}},showArrow:!0,showGrid:!0,showLabel:!0,showLine:!0,showTick:!0,showTitle:!0,showTrunc:!1,dataThreshold:100,lineLineWidth:1,lineStroke:"black",crossPadding:10,titleFill:"black",titleFontSize:12,titlePosition:"lb",titleSpacing:0,titleTextAlign:"center",titleTextBaseline:"middle",lineArrow:function(){return new qr({style:{d:[["M",10,10],["L",-10,0],["L",10,-10],["L",0,0],["L",10,10],["Z"]],fill:"black",transformOrigin:"center"}})},labelAlign:"parallel",labelDirection:"positive",labelFontSize:12,labelSpacing:0,gridConnect:"line",gridControlAngles:[],gridDirection:"positive",gridLength:0,gridType:"segment",lineArrowOffset:15,lineArrowSize:10,tickDirection:"positive",tickLength:5,tickLineWidth:1,tickStroke:"black",labelOverlap:[]};cr({},YE,{style:{type:"arc"}});cr({},YE,{style:{}});var ye=zi({mainGroup:"main-group",gridGroup:"grid-group",grid:"grid",lineGroup:"line-group",line:"line",tickGroup:"tick-group",tick:"tick",tickItem:"tick-item",labelGroup:"label-group",label:"label",labelItem:"label-item",titleGroup:"title-group",title:"title",lineFirst:"line-first",lineSecond:"line-second"},"axis"),Kl=zi({lineGroup:"line-group",line:"line",regionGroup:"region-group",region:"region"},"grid");function Y5(r){return r.reduce(function(t,e,n){return t.push(vt([n===0?"M":"L"],z(e),!1)),t},[])}function vft(r,t,e){var n=t.connect,i=n===void 0?"line":n,a=t.center;if(i==="line")return Y5(r);if(!a)return[];var s=_c(r[0],a),o=e?0:1;return r.reduce(function(l,u,c){return c===0?l.push(vt(["M"],z(u),!1)):l.push(vt(["A",s,s,0,0,o],z(u),!1)),l},[])}function gx(r,t,e){return t.type==="surround"?vft(r,t,e):Y5(r)}function mft(r,t,e){var n=e.type,i=e.connect,a=e.center,s=e.closed,o=s?[["Z"]]:[],l=z([gx(r,e),gx(t.slice().reverse(),e,!0)],2),u=l[0],c=l[1],h=z([r[0],t.slice(-1)[0]],2),d=h[0],g=h[1],p=function(w,x){return[u,w,c,x,o].flat()};if(i==="line"||n==="surround")return p([vt(["L"],z(g),!1)],[vt(["L"],z(d),!1)]);if(!a)throw new Error("Arc grid need to specified center");var v=z([_c(g,a),_c(d,a)],2),m=v[0],b=v[1];return p([vt(["A",m,m,0,0,1],z(g),!1),vt(["L"],z(g),!1)],[vt(["A",b,b,0,0,0],z(d),!1),vt(["L"],z(d),!1)])}function yft(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:gx(o.points,e)}});return r.selectAll(Kl.line.class).data(s,function(o){return o.id}).join(function(o){return o.append("path").each(function(l,u){var c=gi(vN(et({d:l.d},n)),[l,u,s]);this.attr(et({class:Kl.line.name,stroke:"#D9D9D9",lineWidth:1,lineDash:[4,4],isBillboard:a},c))})},function(o){return o.transition(function(l,u){var c=gi(vN(et({d:l.d},n)),[l,u,s]);return Li(this,c,i.update)})},function(o){return o.transition(function(){var l=this,u=Eg(this,i.exit);return lu(u,function(){return l.remove()}),u})}).transitions()}function bft(r,t,e){var n=e.animate,i=e.connect,a=e.areaFill;if(t.length<2||!a||!i)return[];for(var s=Array.isArray(a)?a:[a,"transparent"],o=function(p){return s[p%s.length]},l=[],u=0;u<t.length-1;u++){var c=z([t[u].points,t[u+1].points],2),h=c[0],d=c[1],g=mft(h,d,e);l.push({d:g,fill:o(u)})}return r.selectAll(Kl.region.class).data(l,function(p,v){return v}).join(function(p){return p.append("path").each(function(v,m){var b=gi(v,[v,m,l]);this.attr(b)}).attr("className",Kl.region.name)},function(p){return p.transition(function(v,m){var b=gi(v,[v,m,l]);return Li(this,b,n.update)})},function(p){return p.transition(function(){var v=this,m=Eg(this,n.exit);return lu(m,function(){return v.remove()}),m})}).transitions()}function wft(r){var t=r.data,e=t===void 0?[]:t,n=r.closed;return n?e.map(function(i){var a=i.points,s=z(a,1),o=s[0];return et(et({},i),{points:vt(vt([],z(a),!1),[o],!1)})}):e}var xft=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(e,n){e.type,e.center,e.areaFill,e.closed;var i=Je(e,["type","center","areaFill","closed"]),a=wft(e),s=_t(n).maybeAppendByClassName(Kl.lineGroup,"g"),o=_t(n).maybeAppendByClassName(Kl.regionGroup,"g"),l=yft(s,a,e,i),u=bft(o,a,e);return vt(vt([],z(l),!1),z(u),!1)},t}(Qe);function X5(r,t){return Object.fromEntries(Object.entries(r).map(function(e){var n=z(e,2),i=n[0],a=n[1];return[i,gi(a,t)]}))}function XE(r,t){return t&&Et(t)?r.filter(t):r}function K5(r,t){var e=t.startAngle,n=t.endAngle;return(n-e)*r+e}function _g(r,t){if(t.type==="linear"){var e=z(t.startPos,2),n=e[0],i=e[1],a=z(t.endPos,2),s=a[0],o=a[1],l=z([s-n,o-i],2),u=l[0],c=l[1];return R5([u,c])}var h=Xl(K5(r,t));return[-Math.sin(h),Math.cos(h)]}function KE(r,t,e){var n=_g(r,e);return Vht(n,t!=="positive")}function Qc(r,t){return KE(r,t.labelDirection,t)}function Eft(r,t){var e=z(t.startPos,2),n=e[0],i=e[1],a=z(t.endPos,2),s=a[0],o=a[1],l=z([s-n,o-i],2),u=l[0],c=l[1];return[n+u*r,i+c*r]}function _ft(r,t){var e=t.radius,n=z(t.center,2),i=n[0],a=n[1],s=Xl(K5(r,t));return[i+e*Math.cos(s),a+e*Math.sin(s)]}function Sg(r,t){return t.type==="linear"?Eft(r,t):_ft(r,t)}function Z5(r){return _g(0,r)[1]===0}function J5(r){return _g(0,r)[0]===0}function Q5(r,t){return t-r===360}function IN(r,t,e,n,i){var a=t-r,s=z([i,i],2),o=s[0],l=s[1],u=z([Xl(r),Xl(t)],2),c=u[0],h=u[1],d=function(P){return[e+i*Math.cos(P),n+i*Math.sin(P)]},g=z(d(c),2),p=g[0],v=g[1],m=z(d(h),2),b=m[0],w=m[1];if(Q5(r,t)){var x=(h+c)/2,S=z(d(x),2),_=S[0],M=S[1];return[["M",p,v],["A",o,l,0,1,0,_,M],["A",o,l,0,1,0,b,w]]}var k=a>180?1:0,C=r>t?0:1;return"M".concat(p,",").concat(v,",A").concat(o,",").concat(l,",0,").concat(k,",").concat(C,",").concat(b,",").concat(w)}function Sft(r){var t=r.attributes,e=t.startAngle,n=t.endAngle,i=t.center,a=t.radius;return vt(vt([e,n],z(i),!1),[a],!1)}function Mft(r,t,e,n){var i=t.startAngle,a=t.endAngle,s=t.center,o=t.radius;return r.selectAll(ye.line.class).data([{d:IN.apply(void 0,vt(vt([i,a],z(s),!1),[o],!1))}],function(l,u){return u}).join(function(l){return l.append("path").attr("className",ye.line.name).styles(t).styles({d:function(u){return u.d}})},function(l){return l.transition(function(){var u=this,c=Ght(this,Sft(this),vt(vt([i,a],z(s),!1),[o],!1),n.update);if(c){var h=function(){var d=sr(u.attributes,"__keyframe_data__");u.style.d=IN.apply(void 0,vt([],z(d),!1))};c.onframe=h,c.onfinish=h}return c}).styles(t)},function(l){return l.remove()}).styles(e).transitions()}function kft(r,t){t.truncRange,t.truncShape,t.lineExtension}function Cft(r,t,e){e===void 0&&(e=[0,0]);var n=z([r,t,e],3),i=z(n[0],2),a=i[0],s=i[1],o=z(n[1],2),l=o[0],u=o[1],c=z(n[2],2),h=c[0],d=c[1],g=z([l-a,u-s],2),p=g[0],v=g[1],m=Math.sqrt(Math.pow(p,2)+Math.pow(v,2)),b=z([-h/m,d/m],2),w=b[0],x=b[1];return[w*p,w*v,x*p,x*v]}function DN(r){var t=z(r,2),e=z(t[0],2),n=e[0],i=e[1],a=z(t[1],2),s=a[0],o=a[1];return{x1:n,y1:i,x2:s,y2:o}}function Tft(r,t,e,n){var i=t.showTrunc,a=t.startPos,s=t.endPos,o=t.truncRange,l=t.lineExtension,u=z([a,s],2),c=z(u[0],2),h=c[0],d=c[1],g=z(u[1],2),p=g[0],v=g[1],m=z(l?Cft(a,s,l):new Array(4).fill(0),4),b=m[0],w=m[1],x=m[2],S=m[3],_=function(D){return r.selectAll(ye.line.class).data(D,function(G,X){return X}).join(function(G){return G.append("line").attr("className",function(X){return"".concat(ye.line.name," ").concat(X.className)}).styles(e).transition(function(X){return Li(this,DN(X.line),!1)})},function(G){return G.styles(e).transition(function(X){var K=X.line;return Li(this,DN(K),n.update)})},function(G){return G.remove()}).transitions()};if(!i||!o)return _([{line:[[h+b,d+w],[p+x,v+S]],className:ye.line.name}]);var M=z(o,2),k=M[0],C=M[1],P=p-h,T=v-d,A=z([h+P*k,d+T*k],2),R=A[0],L=A[1],$=z([h+P*C,d+T*C],2),q=$[0],j=$[1],B=_([{line:[[h+b,d+w],[R,L]],className:ye.lineFirst.name},{line:[[q,j],[p+x,v+S]],className:ye.lineSecond.name}]);return kft(r,t),B}function Oft(r,t,e,n){var i=e.showArrow,a=e.showTrunc,s=e.lineArrow,o=e.lineArrowOffset,l=e.lineArrowSize,u;if(t==="arc"?u=r.select(ye.line.class):a?u=r.select(ye.lineSecond.class):u=r.select(ye.line.class),!i||!s||e.type==="arc"&&Q5(e.startAngle,e.endAngle)){var c=u.node();c&&(c.style.markerEnd=void 0);return}var h=Va(s);h.attr(n),qE(h,l),u.style("markerEnd",h).style("markerEndOffset",-o)}function Aft(r,t,e){var n=t.type,i,a=Nt(t,"line");return n==="linear"?i=Tft(r,t,pN(a,"arrow"),e):i=Mft(r,t,pN(a,"arrow"),e),Oft(r,n,t,a),i}function Pft(r,t){return KE(r,t.gridDirection,t)}function t4(r){var t=r.type,e=r.gridCenter;return t==="linear"?e:e||r.center}function Nft(r,t){var e=t.gridLength;return r.map(function(n,i){var a=n.value,s=z(Sg(a,t),2),o=s[0],l=s[1],u=z(Pa(Pft(a,t),e),2),c=u[0],h=u[1];return{id:i,points:[[o,l],[o+c,l+h]]}})}function Rft(r,t){var e=t.gridControlAngles,n=t4(t);if(!n)throw new Error("grid center is not provide");if(r.length<2)throw new Error("Invalid grid data");if(!e||e.length===0)throw new Error("Invalid gridControlAngles");var i=z(n,2),a=i[0],s=i[1];return r.map(function(o,l){var u=o.value,c=z(Sg(u,t),2),h=c[0],d=c[1],g=z([h-a,d-s],2),p=g[0],v=g[1],m=[];return e.forEach(function(b){var w=Xl(b),x=z([Math.cos(w),Math.sin(w)],2),S=x[0],_=x[1],M=p*S-v*_+a,k=p*_+v*S+s;m.push([M,k])}),{points:m,id:l}})}function Lft(r,t,e,n){var i=Nt(e,"grid"),a=i.type,s=i.areaFill,o=t4(e),l=XE(t,e.gridFilter),u=a==="segment"?Nft(l,e):Rft(l,e),c=et(et({},i),{center:o,areaFill:Et(s)?l.map(function(h,d){return gi(s,[h,d,l])}):s,animate:n,data:u});return r.selectAll(ye.grid.class).data([1]).join(function(h){return h.append(function(){return new xft({style:c})}).attr("className",ye.grid.name)},function(h){return h.transition(function(){return this.update(c)})},function(h){return h.remove()}).transitions()}var px=function(){function r(t,e,n,i){this.set(t,e,n,i)}return Object.defineProperty(r.prototype,"left",{get:function(){return this.x1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"top",{get:function(){return this.y1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"right",{get:function(){return this.x2},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bottom",{get:function(){return this.y2},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"width",{get:function(){return this.defined("x2")&&this.defined("x1")?this.x2-this.x1:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.defined("y2")&&this.defined("y1")?this.y2-this.y1:void 0},enumerable:!1,configurable:!0}),r.prototype.rotatedPoints=function(t,e,n){var i=this,a=i.x1,s=i.y1,o=i.x2,l=i.y2,u=Math.cos(t),c=Math.sin(t),h=e-e*u+n*c,d=n-e*c-n*u,g=[[u*a-c*l+h,c*a+u*l+d],[u*o-c*l+h,c*o+u*l+d],[u*a-c*s+h,c*a+u*s+d],[u*o-c*s+h,c*o+u*s+d]];return g},r.prototype.set=function(t,e,n,i){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),i<e?(this.y2=e,this.y1=i):(this.y1=e,this.y2=i),this},r.prototype.defined=function(t){return this[t]!==Number.MAX_VALUE&&this[t]!==-Number.MAX_VALUE},r}();function vx(r,t){var e=r.getEulerAngles()||0;r.setEulerAngles(0);var n=r.getBounds(),i=z(n.min,2),a=i[0],s=i[1],o=z(n.max,2),l=o[0],u=o[1],c=r.getBBox(),h=c.width,d=c.height,g=d,p=0,v=0,m=a,b=s,w=P5(r);if(w){g-=1.5;var x=w.style.textAlign,S=w.style.textBaseline;x==="center"?m=(a+l)/2:(x==="right"||x==="end")&&(m=l),S==="middle"?b=(s+u)/2:S==="bottom"&&(b=u)}var _=z(qn(t),4),M=_[0],k=M===void 0?0:M,C=_[1],P=C===void 0?0:C,T=_[2],A=T===void 0?k:T,R=_[3],L=R===void 0?P:R,$=new px((p+=a)-L,(v+=s)-k,p+h+P,v+g+A);return r.setEulerAngles(e),$.rotatedPoints(Xl(e),m,b)}function Zu(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 Ju(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 Ift(r,t){var e=Ju(r[0],r[1],t[0]),n=Ju(r[0],r[1],t[1]),i=Ju(t[0],t[1],r[0]),a=Ju(t[0],t[1],r[1]);return!!(e!==n&&i!==a||e===0&&Zu(r,t[0])||n===0&&Zu(r,t[1])||i===0&&Zu(t,r[0])||a===0&&Zu(t,r[1]))}function Dft(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(Ift(s,n)){if(Ju(s[0],t,s[1])===0)return Zu(s,t);i++}a=(a+1)%e}while(a!==0);return!!(i&1)}function Fft(r,t){return t.every(function(e){return Dft(r,e)})}function Bft(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=vx(t,e);return Fft(o,l)}function zft(r,t){var e=z(r,4),n=e[0],i=e[1],a=e[2],s=e[3],o=z(t,4),l=o[0],u=o[1],c=o[2],h=o[3],d=a-n,g=s-i,p=c-l,v=h-u,m=d*v-p*g;if(m===0)return!1;var b=m>0,w=n-l,x=i-u,S=d*x-g*w;if(S<0===b)return!1;var _=p*x-v*w;return!(_<0===b||S>m===b||_>m===b)}function $ft(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 zft(t,n)})}function jft(r,t,e){var n,i,a=vx(r,e).flat(1),s=vx(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=Pc(o),u=l.next();!u.done;u=l.next()){var c=u.value;if($ft(s,c))return!0}}catch(h){n={error:h}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}return!1}function qft(r,t){var e=r.type,n=r.labelDirection,i=r.crossSize;if(!i)return!1;if(e==="arc"){var a=r.center,s=r.radius,o=z(a,2),l=o[0],u=o[1],c=n==="negative"?0:i,h=-s-c,d=s+c,g=z(qn(t),4),p=g[0],v=g[1],m=g[2],b=g[3];return new px(l+h-b,u+h-p,l+d+v,u+d+m)}var w=z(r.startPos,2),x=w[0],S=w[1],_=z(r.endPos,2),M=_[0],k=_[1],C=z(J5(r)?[-t,0,t,0]:[0,t,0,-t],4),P=C[0],T=C[1],A=C[2],R=C[3],L=Qc(0,r),$=Pa(L,i),q=new px(x,S,M,k);return q.x1+=R,q.y1+=P,q.x2+=T+$[0],q.y2+=A+$[1],q}function Mg(r,t,e){var n,i,a=t.crossPadding,s=new Set,o=null,l=qft(t,a),u=function(p){return l?Bft(l,p):!0},c=function(p,v){return!p||!p.firstChild?!0:!jft(p.firstChild,v.firstChild,qn(e))};try{for(var h=Pc(r),d=h.next();!d.done;d=h.next()){var g=d.value;u(g)?!o||c(o,g)?o=g:(s.add(o),s.add(g)):s.add(g)}}catch(p){n={error:p}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return Array.from(s)}function Zb(r,t){return t===void 0&&(t={}),kt(r)?0:typeof r=="number"?r:Math.floor(Bht(r,t))}function Wft(r,t,e,n){if(!(r.length<=1)){var i=t.suffix,a=i===void 0?"...":i,s=t.minLength,o=t.maxLength,l=o===void 0?1/0:o,u=t.step,c=u===void 0?" ":u,h=t.margin,d=h===void 0?[0,0,0,0]:h,g=A5(n.getTextShape(r[0])),p=Zb(c,g),v=s?Zb(s,g):p,m=Zb(l,g);(kt(m)||m===1/0)&&(m=Math.max.apply(null,r.map(function(M){return M.getBBox().width})));var b=r.slice(),w=z(d,4);w[0],w[1],w[2],w[3];for(var x=function(M){if(b.forEach(function(k){n.ellipsis(n.getTextShape(k),M,a)}),b=Mg(r,e,d),b.length<1)return{value:void 0}},S=m;S>v+p;S-=p){var _=x(S);if(typeof _=="object")return _.value}}}var Gft={parity:function(r,t){var e=t.seq,n=e===void 0?2:e;return r.filter(function(i,a){return a%n?(Ri(i),!1):!0})}},Vft=function(r){return r.filter(O5)};function Hft(r,t,e,n){var i=r.length,a=t.keepHeader,s=t.keepTail;if(!(i<=1||i===2&&a&&s)){var o=Gft.parity,l=function(x){return x.forEach(n.show),x},u=2,c=r.slice(),h=r.slice(),d=Math.min.apply(Math,vt([1],z(r.map(function(x){return x.getBBox().width})),!1));if(e.type==="linear"&&(Z5(e)||J5(e))){var g=mN(r[0]).left,p=mN(r[i-1]).right,v=Math.abs(p-g)||1;u=Math.max(Math.floor(i*d/v),u)}var m,b;for(a&&(m=c.splice(0,1)[0]),s&&(b=c.splice(-1,1)[0],c.reverse()),l(c);u<r.length&&Mg(Vft(b?vt(vt([b],z(h),!1),[m],!1):vt([m],z(h),!1)),e,t==null?void 0:t.margin).length;){if(b&&!m&&u%2===0){var w=c.splice(0,1);w.forEach(n.hide)}else if(b&&m){var w=c.splice(0,1);w.forEach(n.hide)}h=o(l(c),{seq:u}),u++}}}function Uft(r,t,e,n){var i,a,s=t.optionalAngles,o=s===void 0?[0,45,90]:s,l=t.margin,u=t.recoverWhenFailed,c=u===void 0?!0:u,h=r.map(function(b){return b.getLocalEulerAngles()}),d=function(){return Mg(r,e,l).length<1},g=function(b){return r.forEach(function(w,x){var S=Array.isArray(b)?b[x]:b;n.rotate(w,+S)})};try{for(var p=Pc(o),v=p.next();!v.done;v=p.next()){var m=v.value;if(g(m),d())return}}catch(b){i={error:b}}finally{try{v&&!v.done&&(a=p.return)&&a.call(p)}finally{if(i)throw i.error}}c&&g(h)}function Yft(r){var t=r.type,e=r.labelDirection;return t==="linear"&&Z5(r)?e==="negative"?"bottom":"top":"middle"}function Xft(r,t,e,n){var i=t.wordWrapWidth,a=i===void 0?50:i,s=t.maxLines,o=s===void 0?3:s,l=t.recoverWhenFailed,u=l===void 0?!0:l,c=t.margin,h=c===void 0?[0,0,0,0]:c,d=r.map(function(w){return w.attr("maxLines")||1}),g=Math.min.apply(Math,vt([],z(d),!1)),p=function(){return Mg(r,e,h).length<1},v=Yft(e),m=function(w){return r.forEach(function(x,S){var _=Array.isArray(w)?w[S]:w;n.wrap(x,a,_,v)})};if(!(g>o)){for(var b=g;b<=o;b++)if(m(b),p())return;u&&m(d)}}var Kft=new Map([["hide",Hft],["rotate",Uft],["ellipsis",Wft],["wrap",Xft]]);function Zft(r,t,e){return t.labelOverlap.length<1?!1:e==="hide"?!Dht(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 Jft(r,t,e){var n=t.labelOverlap,i=n===void 0?[]:n;i.length&&i.forEach(function(a){var s=a.type,o=Kft.get(s);Zft(r,t,s)&&(o==null||o(r,a,t,e))})}function Qft(){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 FN(r){for(var t=r;t<0;)t+=360;return Math.round(t%360)}function mx(r,t){var e=z(r,2),n=e[0],i=e[1],a=z(t,2),s=a[0],o=a[1],l=z([n*s+i*o,n*o-i*s],2),u=l[0],c=l[1];return Math.atan2(c,u)}function t0t(r){var t=(r+360)%180;return Bn(t,-90,90)||(t+=180),t}function e0t(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=Qc(r.value,e),l=_g(r.value,e);return i==="horizontal"?0:(i==="perpendicular"?s=mx([1,0],o):s=mx([l[0]<0?-1:1,0],l),t0t(C5(s)))}function e4(r,t,e){var n=e.type,i=e.labelAlign,a=Qc(r,e),s=FN(t),o=FN(C5(mx([1,0],a))),l="center",u="middle";return n==="linear"?[90,270].includes(o)&&s===0?(l="center",u=a[1]===1?"top":"bottom"):!(o%180)&&[90,270].includes(s)?l="center":o===0?(Bn(s,0,90,!1,!0)||Bn(s,0,90)||Bn(s,270,360))&&(l="start"):o===90?Bn(s,0,90,!1,!0)?l="start":(Bn(s,90,180)||Bn(s,270,360))&&(l="end"):o===270?Bn(s,0,90,!1,!0)?l="end":(Bn(s,90,180)||Bn(s,270,360))&&(l="start"):o===180&&(s===90?l="start":(Bn(s,0,90)||Bn(s,270,360))&&(l="end")):i==="parallel"?Bn(o,0,180,!0)?u="top":u="bottom":i==="horizontal"?Bn(o,90,270,!1)?l="end":(Bn(o,270,360,!1)||Bn(o,0,90))&&(l="start"):i==="perpendicular"&&(Bn(o,90,270)?l="end":l="start"),{textAlign:l,textBaseline:u}}function n0t(r,t,e){t.setLocalEulerAngles(r);var n=t.__data__.value,i=e4(n,r,e),a=t.querySelector(ye.labelItem.class);a&&n4(a,i)}function BN(r,t,e){var n=e.showTick,i=e.tickLength,a=e.tickDirection,s=e.labelDirection,o=e.labelSpacing,l=t.indexOf(r),u=gi(o,[r,l,t]),c=z([Qc(r.value,e),Qft(s,a)],2),h=c[0],d=c[1],g=d===1?gi(n?i:0,[r,l,t]):0,p=z(Ku(Pa(h,u+g),Sg(r.value,e)),2),v=p[0],m=p[1];return{x:v,y:m}}function r0t(r,t,e,n){var i=n.labelFormatter,a=Et(i)?function(){return Va(gi(i,[r,t,e,Qc(r.value,n)]))}:function(){return Va(r.label||"")};return a}function n4(r,t){r.nodeName==="text"&&r.attr(t)}function zN(r){Jft(this.node().childNodes,r,{hide:Ri,show:Zc,rotate:function(t,e){n0t(+e,t,r)},ellipsis:function(t,e,n){t&&dx(t,e||1/0,n)},wrap:function(t,e,n){t&&zht(t,e,n)},getTextShape:function(t){return t.querySelector("text")}})}function $N(r,t,e,n,i){var a=e.indexOf(t),s=_t(r).append(r0t(t,a,e,i)).attr("className",ye.labelItem.name).node(),o=z(Ha(X5(n,[t,a,e])),2),l=o[0],u=o[1],c=u.transform,h=Je(u,["transform"]);L5(s,c);var d=e0t(t,s,i);return s.getLocalEulerAngles()||s.setLocalEulerAngles(d),n4(s,et(et({},e4(t.value,d,i)),l)),r.attr(h),s}function i0t(r,t,e,n){var i=XE(t,e.labelFilter),a=Nt(e,"label");return r.selectAll(ye.label.class).data(i,function(s,o){return o}).join(function(s){return s.append("g").attr("className",ye.label.name).transition(function(o){$N(this,o,t,a,e);var l=BN(o,t,e),u=l.x,c=l.y;return this.style.transform="translate(".concat(u,", ").concat(c,")"),null}).call(function(){zN.call(r,e)})},function(s){return s.transition(function(o){var l=this.querySelector(ye.labelItem.class),u=$N(this,o,t,a,e),c=dft(l,u,n.update),h=BN(o,t,e),d=h.x,g=h.y,p=Li(this,{transform:"translate(".concat(d,", ").concat(g,")")},n.update);return vt(vt([],z(c),!1),[p],!1)}).call(function(o){var l=sr(o,"_transitions").flat().filter(O5);cft(l,function(){zN.call(r,e)})})},function(s){return s.transition(function(){var o=this,l=Eg(this.childNodes[0],n.exit);return lu(l,function(){return _t(o).remove()}),l})}).transitions()}function r4(r,t){return KE(r,t.tickDirection,t)}function a0t(r,t){var e=z(r,2),n=e[0],i=e[1];return[[0,0],[n*t,i*t]]}function s0t(r,t,e,n,i){var a=i.tickLength,s=z(a0t(n,gi(a,[r,t,e])),2),o=z(s[0],2),l=o[0],u=o[1],c=z(s[1],2),h=c[0],d=c[1];return{x1:l,x2:h,y1:u,y2:d}}function o0t(r,t,e,n,i){var a=i.tickFormatter,s=r4(t.value,i),o="line";return Et(a)&&(o=function(){return gi(a,[t,e,n,s])}),r.append(o).attr("className",ye.tickItem.name)}function l0t(r,t,e,n,i,a,s){var o=r4(r.value,a),l=s0t(r,t,e,o,a),u=l.x1,c=l.x2,h=l.y1,d=l.y2,g=z(Ha(X5(s,[r,t,e,o])),2),p=g[0],v=g[1];n.node().nodeName==="line"&&n.styles(et({x1:u,x2:c,y1:h,y2:d},p)),i.attr(v),n.styles(p)}function jN(r,t,e,n,i,a){var s=o0t(_t(this),r,t,e,n);l0t(r,t,e,s,this,n,i);var o=z(Sg(r.value,n),2),l=o[0],u=o[1];return Li(this,{transform:"translate(".concat(l,", ").concat(u,")")},a)}function u0t(r,t,e,n){var i=XE(t,e.tickFilter),a=Nt(e,"tick");return r.selectAll(ye.tick.class).data(i,function(s){return s.id||s.label}).join(function(s){return s.append("g").attr("className",ye.tick.name).transition(function(o,l){return jN.call(this,o,l,i,e,a,!1)})},function(s){return s.transition(function(o,l){return this.removeChildren(),jN.call(this,o,l,i,e,a,n.update)})},function(s){return s.transition(function(){var o=this,l=Eg(this.childNodes[0],n.exit);return lu(l,function(){return o.remove()}),l})}).transitions()}var qN=zi({text:"text"},"title");function kg(r){return/\S+-\S+/g.test(r)?r.split("-").map(function(t){return t[0]}):r.length>2?[r[0]]:r.split("")}function c0t(r,t){var e=r.attributes,n=e.position,i=e.spacing,a=e.inset,s=e.text,o=r.getBBox(),l=t.getBBox(),u=kg(n),c=z(qn(s?i:0),4),h=c[0],d=c[1],g=c[2],p=c[3],v=z(qn(a),4),m=v[0],b=v[1],w=v[2],x=v[3],S=z([p+d,h+g],2),_=S[0],M=S[1],k=z([x+b,m+w],2),C=k[0],P=k[1];if(u[0]==="l")return new ur(o.x,o.y,l.width+o.width+_+C,Math.max(l.height+P,o.height));if(u[0]==="t")return new ur(o.x,o.y,Math.max(l.width+C,o.width),l.height+o.height+M+P);var T=z([t.attributes.width||l.width,t.attributes.height||l.height],2),A=T[0],R=T[1];return new ur(l.x,l.y,A+o.width+_+C,R+o.height+M+P)}function h0t(r,t){var e=Object.entries(t).reduce(function(n,i){var a=z(i,2),s=a[0],o=a[1],l=r.node().attr(s);return l||(n[s]=o),n},{});r.styles(e)}function d0t(r){var t,e,n,i,a=r,s=a.width,o=a.height,l=a.position,u=z([+s/2,+o/2],2),c=u[0],h=u[1],d=z([+c,+h,"center","middle"],4),g=d[0],p=d[1],v=d[2],m=d[3],b=kg(l);return b.includes("l")&&(t=z([0,"start"],2),g=t[0],v=t[1]),b.includes("r")&&(e=z([+s,"end"],2),g=e[0],v=e[1]),b.includes("t")&&(n=z([0,"top"],2),p=n[0],m=n[1]),b.includes("b")&&(i=z([+o,"bottom"],2),p=i[0],m=i[1]),{x:g,y:p,textAlign:v,textBaseline:m}}var f0t=function(r){Ut(t,r);function t(e){return r.call(this,e,{text:"",width:0,height:0,fill:"#4a505a",fontWeight:"bold",fontSize:12,fontFamily:"sans-serif",inset:0,spacing:0,position:"top-left"})||this}return t.prototype.getAvailableSpace=function(){var e=this,n=this.attributes,i=n.width,a=n.height,s=n.position,o=n.spacing,l=n.inset,u=e.querySelector(qN.text.class);if(!u)return new ur(0,0,+i,+a);var c=u.getBBox(),h=c.width,d=c.height,g=z(qn(o),4),p=g[0],v=g[1],m=g[2],b=g[3],w=z([0,0,+i,+a],4),x=w[0],S=w[1],_=w[2],M=w[3],k=kg(s);if(k.includes("i"))return new ur(x,S,_,M);k.forEach(function(j,B){var D,G,X,K;j==="t"&&(D=z(B===0?[d+m,+a-d-m]:[0,+a],2),S=D[0],M=D[1]),j==="r"&&(G=z([+i-h-b],1),_=G[0]),j==="b"&&(X=z([+a-d-p],1),M=X[0]),j==="l"&&(K=z(B===0?[h+v,+i-h-v]:[0,+i],2),x=K[0],_=K[1])});var C=z(qn(l),4),P=C[0],T=C[1],A=C[2],R=C[3],L=z([R+T,P+A],2),$=L[0],q=L[1];return new ur(x+R,S+P,_-$,M-q)},t.prototype.getBBox=function(){return this.title?this.title.getBBox():new ur(0,0,0,0)},t.prototype.render=function(e,n){var i=this;e.width,e.height,e.position,e.spacing;var a=Je(e,["width","height","position","spacing"]),s=z(Ha(a),1),o=s[0],l=d0t(e),u=l.x,c=l.y,h=l.textAlign,d=l.textBaseline;Ur(!!a.text,_t(n),function(g){i.title=g.maybeAppendByClassName(qN.text,"text").styles(o).call(h0t,{x:u,y:c,textAlign:h,textBaseline:d}).node()})},t}(Qe);function g0t(r,t,e){var n=e.titlePosition,i=n===void 0?"lb":n,a=e.titleSpacing,s=kg(i),o=r.node().getLocalBounds(),l=z(o.min,2),u=l[0],c=l[1],h=z(o.halfExtents,2),d=h[0],g=h[1],p=z(t.node().getLocalBounds().halfExtents,2),v=p[0],m=p[1],b=z([u+d,c+g],2),w=b[0],x=b[1],S=z(qn(a),4),_=S[0],M=S[1],k=S[2],C=S[3];if(["start","end"].includes(i)&&e.type==="linear"){var P=e.startPos,T=e.endPos,A=z(i==="start"?[P,T]:[T,P],2),R=A[0],L=A[1],$=R5([-L[0]+R[0],-L[1]+R[1]]),q=z(Pa($,_),2),j=q[0],B=q[1];return{x:R[0]+j,y:R[1]+B}}return s.includes("t")&&(x-=g+m+_),s.includes("r")&&(w+=d+v+M),s.includes("l")&&(w-=d+v+C),s.includes("b")&&(x+=g+m+k),{x:w,y:x}}function p0t(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 WN(r,t,e,n,i){var a=Nt(n,"title"),s=z(Ha(a),2),o=s[0],l=s[1],u=l.transform,c=l.transformOrigin,h=Je(l,["transform","transformOrigin"]);t.styles(h);var d=u||p0t(r.node(),o.direction,o.position);r.styles(et(et({},o),{transformOrigin:c})),L5(r.node(),d);var g=g0t(_t(e._offscreen||e.querySelector(ye.mainGroup.class)),t,n),p=g.x,v=g.y,m=Li(t.node(),{transform:"translate(".concat(p,", ").concat(v,")")},i);return m}function v0t(r,t,e,n){var i=e.titleText;return r.selectAll(ye.title.class).data([{title:i}].filter(function(a){return!!a.title}),function(a,s){return a.title}).join(function(a){return a.append(function(){return Va(i)}).attr("className",ye.title.name).transition(function(){return WN(_t(this),r,t,e,n.enter)})},function(a){return a.transition(function(){return WN(_t(this),r,t,e,n.update)})},function(a){return a.remove()}).transitions()}function GN(r,t,e,n){var i=r.showLine,a=r.showTick,s=r.showLabel,o=t.maybeAppendByClassName(ye.lineGroup,"g"),l=Ur(i,o,function(g){return Aft(g,r,n)})||[],u=t.maybeAppendByClassName(ye.tickGroup,"g"),c=Ur(a,u,function(g){return u0t(g,e,r,n)})||[],h=t.maybeAppendByClassName(ye.labelGroup,"g"),d=Ur(s,h,function(g){return i0t(g,e,r,n)})||[];return vt(vt(vt([],z(l),!1),z(c),!1),z(d),!1).filter(function(g){return!!g})}var m0t=function(r){Ut(t,r);function t(e){return r.call(this,e,YE)||this}return t.prototype.render=function(e,n,i){var a=this,s=e.titleText,o=e.data,l=e.animate,u=e.showTitle,c=e.showGrid,h=e.dataThreshold,d=e.truncRange,g=Kht(o,h).filter(function(_){var M=_.value;return!(d&&M>d[0]&&M<d[1])}),p=LN(i===void 0?l:i),v=_t(n).maybeAppendByClassName(ye.gridGroup,"g"),m=Ur(c,v,function(_){return Lft(_,g,e,p)})||[],b=_t(n).maybeAppendByClassName(ye.mainGroup,"g");s&&(!this.initialized&&p.enter||this.initialized&&p.update)&&GN(e,_t(this.offscreenGroup),g,LN(!1));var w=GN(e,_t(b.node()),g,p),x=_t(n).maybeAppendByClassName(ye.titleGroup,"g"),S=Ur(u,x,function(_){return v0t(_,a,e,p)})||[];return vt(vt(vt([],z(m),!1),z(w),!1),z(S),!1).flat().filter(function(_){return!!_})},t}(Qe),ui=zi({prevBtnGroup:"prev-btn-group",prevBtn:"prev-btn",nextBtnGroup:"next-btn-group",nextBtn:"next-btn",pageInfoGroup:"page-info-group",pageInfo:"page-info",playWindow:"play-window",contentGroup:"content-group",controller:"controller",clipPath:"clip-path"},"navigator"),y0t=function(r){Ut(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:kdt(0,0,6),buttonSize:12,controllerPadding:5,controllerSpacing:5,formatter:function(i,a){return"".concat(i,"/").concat(a)},defaultPage:0,loop:!1,orientation:"horizontal",pageNumFill:"black",pageNumFontSize:12,pageNumTextAlign:"start",pageNumTextBaseline:"middle"})||this;return n.playState="idle",n.contentGroup=n.appendChild(new _n({class:ui.contentGroup.name})),n.playWindow=n.contentGroup.appendChild(new _n({class:ui.playWindow.name})),n.innerCurrPage=n.defaultPage,n}return Object.defineProperty(t.prototype,"defaultPage",{get:function(){var e=this.attributes.defaultPage;return Ue(e,0,Math.max(this.pageViews.length-1,0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageViews",{get:function(){return this.playWindow.children},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"controllerShape",{get:function(){return this.totalPages>1?{width:55,height:0}:{width:0,height:0}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageShape",{get:function(){var e=this.pageViews,n=z(odt(e.map(function(h){var d=h.getBBox(),g=d.width,p=d.height;return[g,p]})).map(function(h){return Math.max.apply(Math,vt([],z(h),!1))}),2),i=n[0],a=n[1],s=this.attributes,o=s.pageWidth,l=o===void 0?i:o,u=s.pageHeight,c=u===void 0?a:u;return{pageWidth:l,pageHeight:c}},enumerable:!1,configurable:!0}),t.prototype.getContainer=function(){return this.playWindow},Object.defineProperty(t.prototype,"totalPages",{get:function(){return this.pageViews.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currPage",{get:function(){return this.innerCurrPage},enumerable:!1,configurable:!0}),t.prototype.getBBox=function(){var e=r.prototype.getBBox.call(this),n=e.x,i=e.y,a=this.controllerShape,s=this.pageShape,o=s.pageWidth,l=s.pageHeight;return new ur(n,i,o+a.width,l)},t.prototype.goTo=function(e){var n=this,i=this.attributes.animate,a=this,s=a.currPage,o=a.playState,l=a.playWindow,u=a.pageViews;if(o!=="idle"||e<0||u.length<=0||e>=u.length)return null;u[s].setLocalPosition(0,0),this.prepareFollowingPage(e);var c=z(this.getFollowingPageDiff(e),2),h=c[0],d=c[1];this.playState="running";var g=G5(l,[{transform:"translate(0, 0)"},{transform:"translate(".concat(-h,", ").concat(-d,")")}],i);return lu(g,function(){n.innerCurrPage=e,n.playState="idle",n.setVisiblePages([e]),n.updatePageInfo()}),g},t.prototype.prev=function(){var e=this.attributes.loop,n=this.pageViews.length,i=this.currPage;if(!e&&i<=0)return null;var a=e?(i-1+n)%n:Ue(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:Ue(i+1,0,n);return this.goTo(a)},t.prototype.renderClipPath=function(e){var n=this.pageShape,i=n.pageWidth,a=n.pageHeight;if(!i||!a){this.contentGroup.style.clipPath=void 0;return}this.clipPath=e.maybeAppendByClassName(ui.clipPath,"rect").styles({width:i,height:a}),this.contentGroup.attr("clipPath",this.clipPath.node())},t.prototype.setVisiblePages=function(e){this.playWindow.children.forEach(function(n,i){e.includes(i)?Zc(n):Ri(n)})},t.prototype.adjustControllerLayout=function(){var e=this,n=e.prevBtnGroup,i=e.nextBtnGroup,a=e.pageInfoGroup,s=this.attributes,o=s.orientation,l=s.controllerPadding,u=a.getBBox(),c=u.width;u.height;var h=z(o==="horizontal"?[-180,0]:[-90,90],2),d=h[0],g=h[1];n.setLocalEulerAngles(d),i.setLocalEulerAngles(g);var p=n.getBBox(),v=p.width,m=p.height,b=i.getBBox(),w=b.width,x=b.height,S=Math.max(v,c,w),_=o==="horizontal"?{offset:[[0,0],[v/2+l,0],[v+c+l*2,0]],textAlign:"start"}:{offset:[[S/2,-m-l],[S/2,0],[S/2,x+l]],textAlign:"center"},M=z(_.offset,3),k=z(M[0],2),C=k[0],P=k[1],T=z(M[1],2),A=T[0],R=T[1],L=z(M[2],2),$=L[0],q=L[1],j=_.textAlign,B=a.querySelector("text");B&&(B.style.textAlign=j),n.setLocalPosition(C,P),a.setLocalPosition(A,R),i.setLocalPosition($,q)},t.prototype.updatePageInfo=function(){var e,n=this,i=n.currPage,a=n.pageViews,s=n.attributes.formatter;a.length<2||((e=this.pageInfoGroup.querySelector(ui.pageInfo.class))===null||e===void 0||e.attr("text",s(i+1,a.length)),this.adjustControllerLayout())},t.prototype.getFollowingPageDiff=function(e){var n=this.currPage;if(n===e)return[0,0];var i=this.attributes.orientation,a=this.pageShape,s=a.pageWidth,o=a.pageHeight,l=e<n?-1:1;return i==="horizontal"?[l*s,0]:[0,l*o]},t.prototype.prepareFollowingPage=function(e){var n=this,i=n.currPage,a=n.pageViews;if(this.setVisiblePages([e,i]),e!==i){var s=z(this.getFollowingPageDiff(e),2),o=s[0],l=s[1];a[e].setLocalPosition(o,l)}},t.prototype.renderController=function(e){var n=this,i=this.attributes.controllerSpacing,a=this.pageShape,s=a.pageWidth,o=a.pageHeight,l=this.pageViews.length>=2,u=e.maybeAppendByClassName(ui.controller,"g");if(xg(u.node(),l),!!l){var c=Nt(this.attributes,"button"),h=Nt(this.attributes,"pageNum"),d=z(Ha(c),2),g=d[0],p=d[1],v=g.size,m=Je(g,["size"]),b=!u.select(ui.prevBtnGroup.class).node(),w=u.maybeAppendByClassName(ui.prevBtnGroup,"g").styles(p);this.prevBtnGroup=w.node();var x=w.maybeAppendByClassName(ui.prevBtn,"path"),S=u.maybeAppendByClassName(ui.nextBtnGroup,"g").styles(p);this.nextBtnGroup=S.node();var _=S.maybeAppendByClassName(ui.nextBtn,"path");[x,_].forEach(function(k){k.styles(et(et({},m),{transformOrigin:"center"})),qE(k.node(),v)});var M=u.maybeAppendByClassName(ui.pageInfoGroup,"g");this.pageInfoGroup=M.node(),M.maybeAppendByClassName(ui.pageInfo,"text").styles(h),this.updatePageInfo(),u.node().setLocalPosition(s+i,o/2),b&&(this.prevBtnGroup.addEventListener("click",function(){n.prev()}),this.nextBtnGroup.addEventListener("click",function(){n.next()}))}},t.prototype.render=function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s;this.attr("transform","translate(".concat(a,", ").concat(o,")"));var l=_t(n);this.renderClipPath(l),this.renderController(l),this.setVisiblePages([this.defaultPage]),this.goTo(this.defaultPage)},t.prototype.bindEvents=function(){var e=this,n=Ac(function(){return e.render(e.attributes,e)},50);this.playWindow.addEventListener(Xt.INSERTED,n),this.playWindow.addEventListener(Xt.REMOVED,n)},t}(Qe);function b0t(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 i4=1.4,a4=.4;function w0t(r,t,e){var n=e,i=n*i4,a=n/2,s=n/6,o=r+i*a4;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 x0t(r,t,e){var n=e,i=n*i4,a=n/2,s=n/6,o=t+i*a4;return[["M",r,t],["L",r-a,o],["L",r-a,t+i],["L",r+a,t+i],["L",r+a,o],["Z"],["M",r-s,o],["L",r-s,t+i-2],["M",r+s,o],["L",r+s,t+i-2]]}xe.registerSymbol("hiddenHandle",b0t);xe.registerSymbol("verticalHandle",w0t);xe.registerSymbol("horizontalHandle",x0t);function yx(r,t,e){return r===void 0&&(r="horizontal"),r==="horizontal"?t:e}var Fr=zi({layout:"flex",markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label",valueGroup:"value-group",value:"value",backgroundGroup:"background-group",background:"background"},"legend-category-item");function E0t(r){var t=r.querySelector(Fr.marker.class);return t?t.style:{}}var _0t=function(r){Ut(t,r);function t(e){return r.call(this,e,{span:[1,1],marker:function(){return new Ua({style:{r:6}})},markerSize:10,labelFill:"#646464",valueFill:"#646464",labelFontSize:12,valueFontSize:12,labelTextBaseline:"middle",valueTextBaseline:"middle"})||this}return Object.defineProperty(t.prototype,"showValue",{get:function(){var e=this.attributes.valueText;return e?typeof e=="string"||typeof e=="number"?e!=="":typeof e=="function"?!0:e.attr("text")!=="":!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"actualSpace",{get:function(){var e=this.labelGroup,n=this.valueGroup,i=this.attributes.markerSize,a=e.node().getBBox(),s=a.width,o=a.height,l=n.node().getBBox(),u=l.width,c=l.height;return{markerWidth:i,labelWidth:s,valueWidth:u,height:Math.max(i,o,c)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"span",{get:function(){var e=this.attributes.span;if(!e)return[1,1];var n=z(qn(e),2),i=n[0],a=n[1],s=this.showValue?a:0,o=i+s;return[i/o,s/o]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shape",{get:function(){var e,n=this.attributes,i=n.markerSize,a=n.width,s=this.actualSpace,o=s.markerWidth,l=s.height,u=this.actualSpace,c=u.labelWidth,h=u.valueWidth,d=z(this.spacing,2),g=d[0],p=d[1];if(a){var v=a-i-g-p,m=z(this.span,2),b=m[0],w=m[1];e=z([b*v,w*v],2),c=e[0],h=e[1]}var x=o+c+h+g+p;return{width:x,height:l,markerWidth:o,labelWidth:c,valueWidth:h}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"spacing",{get:function(){var e=this.attributes.spacing;if(!e)return[0,0];var n=z(qn(e),2),i=n[0],a=n[1];return this.showValue?[i,a]:[i,0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layout",{get:function(){var e=this.shape,n=e.markerWidth,i=e.labelWidth,a=e.valueWidth,s=e.width,o=e.height,l=z(this.spacing,2),u=l[0],c=l[1];return{height:o,width:s,markerWidth:n,labelWidth:i,valueWidth:a,position:[n/2,n+u,n+i+u+c]}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleSize",{get:function(){var e=E0t(this.markerGroup.node()),n=this.attributes,i=n.markerSize,a=n.markerStrokeWidth,s=a===void 0?e.strokeWidth:a,o=n.markerLineWidth,l=o===void 0?e.lineWidth:o,u=n.markerStroke,c=u===void 0?e.stroke:u,h=+(s||l||(c?1:0))*Math.sqrt(2),d=this.markerGroup.node().getBBox(),g=d.width,p=d.height;return(1-h/Math.max(g,p))*i},enumerable:!1,configurable:!0}),t.prototype.renderMarker=function(e){var n=this,i=this.attributes.marker,a=Nt(this.attributes,"marker");this.markerGroup=e.maybeAppendByClassName(Fr.markerGroup,"g").style("zIndex",0),Ur(!!i,this.markerGroup,function(){var s,o=n.markerGroup.node(),l=(s=o.childNodes)===null||s===void 0?void 0:s[0],u=typeof i=="string"?new xe({style:{symbol:i},className:Fr.marker.name}):i();l?u.nodeName===l.nodeName?l instanceof xe?l.update(et(et({},a),{symbol:i})):(ndt(l,u),_t(l).styles(a)):(l.remove(),_t(u).attr("className",Fr.marker.name).styles(a),o.appendChild(u)):(u instanceof xe||_t(u).attr("className",Fr.marker.name).styles(a),o.appendChild(u)),n.markerGroup.node().scale(1/n.markerGroup.node().getScale()[0]);var c=qE(n.markerGroup.node(),n.scaleSize);n.markerGroup.node().style._transform="scale(".concat(c,")")})},t.prototype.renderLabel=function(e){var n=Nt(this.attributes,"label"),i=n.text,a=Je(n,["text"]);this.labelGroup=e.maybeAppendByClassName(Fr.labelGroup,"g").style("zIndex",0),this.labelGroup.maybeAppendByClassName(Fr.label,function(){return Va(i)}).styles(a)},t.prototype.renderValue=function(e){var n=this,i=Nt(this.attributes,"value"),a=i.text,s=Je(i,["text"]);this.valueGroup=e.maybeAppendByClassName(Fr.valueGroup,"g").style("zIndex",0),Ur(this.showValue,this.valueGroup,function(){n.valueGroup.maybeAppendByClassName(Fr.value,function(){return Va(a)}).styles(s)})},t.prototype.renderBackground=function(e){var n=this.shape,i=n.width,a=n.height,s=Nt(this.attributes,"background");this.background=e.maybeAppendByClassName(Fr.backgroundGroup,"g").style("zIndex",-1),this.background.maybeAppendByClassName(Fr.background,"rect").styles(et({width:i,height:a},s))},t.prototype.adjustLayout=function(){var e=this.layout,n=e.labelWidth,i=e.valueWidth,a=e.height,s=z(e.position,3),o=s[0],l=s[1],u=s[2],c=a/2;this.markerGroup.styles({transform:"translate(".concat(o,", ").concat(c,")").concat(this.markerGroup.node().style._transform)}),this.labelGroup.styles({transform:"translate(".concat(l,", ").concat(c,")")}),dx(this.labelGroup.select(Fr.label.class).node(),Math.ceil(n)),this.showValue&&(this.valueGroup.styles({transform:"translate(".concat(u,", ").concat(c,")")}),dx(this.valueGroup.select(Fr.value.class).node(),Math.ceil(i)))},t.prototype.render=function(e,n){var i=_t(n),a=e.x,s=a===void 0?0:a,o=e.y,l=o===void 0?0:o;i.styles({transform:"translate(".concat(s,", ").concat(l,")")}),this.renderMarker(i),this.renderLabel(i),this.renderValue(i),this.renderBackground(i),this.adjustLayout()},t}(Qe),go=zi({page:"item-page",navigator:"navigator",item:"item"},"items"),VN=function(r,t,e){return e===void 0&&(e=!0),r?t(r):e},S0t=function(r){Ut(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:pv,mouseenter:pv,mouseleave:pv})||this;return n.navigatorShape=[0,0],n}return Object.defineProperty(t.prototype,"pageViews",{get:function(){return this.navigator.getContainer()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"grid",{get:function(){var e=this.attributes,n=e.gridRow,i=e.gridCol,a=e.data;if(!n&&!i)throw new Error("gridRow and gridCol can not be set null at the same time");return n&&i?[n,i]:n?[n,a.length]:[a.length,i]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderData",{get:function(){var e=this.attributes,n=e.data,i=e.layout,a=Nt(this.attributes,"item"),s=n.map(function(o,l){var u=o.id,c=u===void 0?l:u,h=o.label,d=o.value;return{id:"".concat(c),index:l,style:et({layout:i,labelText:h,valueText:d},Object.fromEntries(Object.entries(a).map(function(g){var p=z(g,2),v=p[0],m=p[1];return[v,gi(m,[o,l,n])]})))}});return s},enumerable:!1,configurable:!0}),t.prototype.getGridLayout=function(){var e=this,n=this.attributes,i=n.orientation,a=n.width,s=n.rowPadding,o=n.colPadding,l=z(this.navigatorShape,1),u=l[0],c=z(this.grid,2),h=c[0],d=c[1],g=d*h,p=0;return this.pageViews.children.map(function(v,m){var b,w,x=Math.floor(m/g),S=m%g,_=e.ifHorizontal(d,h),M=[Math.floor(S/_),S%_];i==="vertical"&&M.reverse();var k=z(M,2),C=k[0],P=k[1],T=(a-u-(d-1)*o)/d,A=v.getBBox().height,R=z([0,0],2),L=R[0],$=R[1];return i==="horizontal"?(b=z([p,C*(A+s)],2),L=b[0],$=b[1],p=P===d-1?0:p+T+o):(w=z([P*(T+o),p],2),L=w[0],$=w[1],p=C===h-1?0:p+A+s),{page:x,index:m,row:C,col:P,pageIndex:S,width:T,height:A,x:L,y:$}})},t.prototype.getFlexLayout=function(){var e=this.attributes,n=e.width,i=e.height,a=e.rowPadding,s=e.colPadding,o=z(this.navigatorShape,1),l=o[0],u=z(this.grid,2),c=u[0],h=u[1],d=z([n-l,i],2),g=d[0],p=d[1],v=z([0,0,0,0,0,0,0,0],8),m=v[0],b=v[1],w=v[2],x=v[3],S=v[4],_=v[5],M=v[6],k=v[7];return this.pageViews.children.map(function(C,P){var T,A,R,L,$=C.getBBox(),q=$.width,j=$.height,B=M===0?0:s,D=M+B+q;if(D<=g&&VN(S,function(X){return X<h}))return T=z([M+B,k,D],3),m=T[0],b=T[1],M=T[2],{width:q,height:j,x:m,y:b,page:w,index:P,pageIndex:x++,row:_,col:S++};A=z([_+1,0,0,k+j+a],4),_=A[0],S=A[1],M=A[2],k=A[3];var G=k+j;return G<=p&&VN(_,function(X){return X<c})?(R=z([M,k,q],3),m=R[0],b=R[1],M=R[2],{width:q,height:j,x:m,y:b,page:w,index:P,pageIndex:x++,row:_,col:S++}):(L=z([0,0,q,0,w+1,0,0,0],8),m=L[0],b=L[1],M=L[2],k=L[3],w=L[4],x=L[5],_=L[6],S=L[7],{width:q,height:j,x:m,y:b,page:w,index:P,pageIndex:x++,row:_,col:S++})})},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 yx(i,e,n)},t.prototype.flattenPage=function(e){e.querySelectorAll(go.item.class).forEach(function(n){e.appendChild(n)}),e.querySelectorAll(go.page.class).forEach(function(n){var i=e.removeChild(n);i.destroy()})},t.prototype.renderItems=function(e){var n=this.attributes,i=n.click,a=n.mouseenter,s=n.mouseleave;this.flattenPage(e);var o=this.dispatchCustomEvent.bind(this);_t(e).selectAll(go.item.class).data(this.renderData,function(l){return l.id}).join(function(l){return l.append(function(u){var c=u.style;return new _0t({style:c})}).attr("className",go.item.name).on("click",function(){i==null||i(this),o("itemClick",{item:this})}).on("pointerenter",function(){a==null||a(this),o("itemMouseenter",{item:this})}).on("pointerleave",function(){s==null||s(this),o("itemMouseleave",{item:this})})},function(l){return l.each(function(u){var c=u.style;this.update(c)})},function(l){return l.remove()})},t.prototype.relayoutNavigator=function(){var e,n=this.attributes,i=n.layout,a=n.width,s=((e=this.pageViews.children[0])===null||e===void 0?void 0:e.getBBox().height)||0,o=z(this.navigatorShape,2),l=o[0],u=o[1];this.navigator.update(i==="grid"?{pageWidth:a-l,pageHeight:s-u}:{})},t.prototype.adjustLayout=function(){var e=this,n=Object.entries($ht(this.itemsLayout,"page")).map(function(a){var s=z(a,2),o=s[0],l=s[1];return{page:o,layouts:l}}),i=vt([],z(this.navigator.getContainer().children),!1);n.forEach(function(a){var s=a.layouts,o=e.pageViews.appendChild(new _n({className:go.page.name}));s.forEach(function(l){var u=l.x,c=l.y,h=l.index,d=l.width,g=l.height,p=i[h];o.appendChild(p),hc(p,"__layout__",l),p.update({x:u,y:c,width:d,height:g})})}),this.relayoutNavigator()},t.prototype.renderNavigator=function(e){var n=this.attributes.orientation,i=Nt(this.attributes,"nav"),a=Pn({orientation:n},i),s=this;return e.selectAll(go.navigator.class).data(["nav"]).join(function(o){return o.append(function(){return new y0t({style:a})}).attr("className",go.navigator.name).each(function(){s.navigator=this})},function(o){return o.each(function(){this.update(a)})},function(o){return o.remove()}),this.navigator},t.prototype.getBBox=function(){return this.navigator.getBBox()},t.prototype.render=function(e,n){var i=this.attributes.data;if(!(!i||i.length===0)){var a=this.renderNavigator(_t(n));this.renderItems(a.getContainer()),this.adjustLayout()}},t.prototype.dispatchCustomEvent=function(e,n){var i=new cn(e,{detail:n});this.dispatchEvent(i)},t}(Qe),Ru=zi({markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label"},"handle"),s4={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){Ut(t,r);function t(e){return r.call(this,e,s4)||this}return t.prototype.render=function(e,n){var i=_t(n).maybeAppendByClassName(Ru.markerGroup,"g");this.renderMarker(i);var a=_t(n).maybeAppendByClassName(Ru.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?yx(a,"horizontalHandle","verticalHandle"):s;Ur(!!o,e,function(l){var u=Nt(n.attributes,"marker"),c=et({symbol:o},u);n.marker=l.maybeAppendByClassName(Ru.marker,function(){return new xe({style:c})}).update(c)})},t.prototype.renderLabel=function(e){var n=this,i=this.attributes,a=i.showLabel,s=i.orientation,o=i.spacing,l=o===void 0?0:o,u=i.formatter;Ur(a,e,function(c){var h,d=Nt(n.attributes,"label"),g=d.text,p=Je(d,["text"]),v=((h=c.select(Ru.marker.class))===null||h===void 0?void 0:h.node().getBBox())||{},m=v.width,b=m===void 0?0:m,w=v.height,x=w===void 0?0:w,S=z(yx(s,[0,x+l,"center","top"],[b+l,0,"start","middle"]),4),_=S[0],M=S[1],k=S[2],C=S[3];c.maybeAppendByClassName(Ru.label,"text").styles(et(et({},p),{x:_,y:M,text:u(g).toString(),textAlign:k,textBaseline:C}))})},t})(Qe);var o4={showTitle:!0,padding:0,orientation:"horizontal",backgroundFill:"transparent",titleText:"",titleSpacing:4,titlePosition:"top-left",titleFill:"#2C3542",titleFontWeight:"bold",titleFontFamily:"sans-serif",titleFontSize:12},M0t=Pn({},o4,{});Pn({},o4,Pl(s4,"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 Lu=zi({title:"title",titleGroup:"title-group",items:"items",itemsGroup:"items-group",contentGroup:"content-group",ribbonGroup:"ribbon-group",ribbon:"ribbon",handlesGroup:"handles-group",handle:"handle",startHandle:"start-handle",endHandle:"end-handle",labelGroup:"label-group",label:"label",indicator:"indicator"},"legend"),k0t=function(r){Ut(t,r);function t(e){return r.call(this,e,M0t)||this}return t.prototype.renderTitle=function(e,n,i){var a=this.attributes,s=a.showTitle,o=a.titleText,l=Nt(this.attributes,"title"),u=z(Ha(l),2),c=u[0],h=u[1];this.titleGroup=e.maybeAppendByClassName(Lu.titleGroup,"g").styles(h);var d=et(et({width:n,height:i},c),{text:s?o:""});this.title=this.titleGroup.maybeAppendByClassName(Lu.title,function(){return new f0t({style:d})}).update(d)},t.prototype.renderItems=function(e,n){var i=n.x,a=n.y,s=n.width,o=n.height,l=Nt(this.attributes,"title",!0),u=z(Ha(l),2),c=u[0],h=u[1],d=et(et({},c),{width:s,height:o,x:0,y:0});this.itemsGroup=e.maybeAppendByClassName(Lu.itemsGroup,"g").styles(et(et({},h),{transform:"translate(".concat(i,", ").concat(a,")")}));var g=this;this.itemsGroup.selectAll(Lu.items.class).data(["items"]).join(function(p){return p.append(function(){return new S0t({style:d})}).attr("className",Lu.items.name).each(function(){g.items=_t(this)})},function(p){return p.update(d)},function(p){return p.remove()})},t.prototype.adjustLayout=function(){var e=this.attributes.showTitle;if(e){var n=this.title.node().getAvailableSpace(),i=n.x,a=n.y;this.itemsGroup.node().style.transform="translate(".concat(i,", ").concat(a,")")}},Object.defineProperty(t.prototype,"availableSpace",{get:function(){var e=this.attributes,n=e.showTitle,i=e.width,a=e.height;return n?this.title.node().getAvailableSpace():new ur(0,0,i,a)},enumerable:!1,configurable:!0}),t.prototype.getBBox=function(){var e,n,i=(e=this.title)===null||e===void 0?void 0:e.node(),a=(n=this.items)===null||n===void 0?void 0:n.node();return!i||!a?r.prototype.getBBox.call(this):c0t(i,a)},t.prototype.render=function(e,n){var i=this.attributes,a=i.width,s=i.height,o=i.x,l=o===void 0?0:o,u=i.y,c=u===void 0?0:u,h=_t(n);n.style.transform="translate(".concat(l,", ").concat(c,")"),this.renderTitle(h,a,s),this.renderItems(h,this.availableSpace),this.adjustLayout()},t}(Qe),C0t={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},Jb=zi({background:"background",labelGroup:"label-group",label:"label"},"indicator"),T0t=function(r){Ut(t,r);function t(e){var n=r.call(this,e,C0t)||this;return n.point=[0,0],n.group=n.appendChild(new _n({})),n.isMutationObserved=!0,n}return t.prototype.renderBackground=function(){if(this.label){var e=this.attributes,n=e.position,i=e.padding,a=z(qn(i),4),s=a[0],o=a[1],l=a[2],u=a[3],c=this.label.node().getLocalBounds(),h=c.min,d=c.max,g=new ur(h[0]-u,h[1]-s,d[0]+o-h[0]+u,d[1]+l-h[1]+s),p=this.getPath(n,g),v=Nt(this.attributes,"background");this.background=_t(this.group).maybeAppendByClassName(Jb.background,"path").styles(et(et({},v),{d:p})),this.group.appendChild(this.label.node())}},t.prototype.renderLabel=function(){var e=this.attributes,n=e.formatter,i=e.labelText,a=Nt(this.attributes,"label"),s=z(Ha(a),2),o=s[0],l=s[1];o.text;var u=Je(o,["text"]);if(this.label=_t(this.group).maybeAppendByClassName(Jb.labelGroup,"g").styles(l),!!i){var c=this.label.maybeAppendByClassName(Jb.label,function(){return Va(n(i))}).style("text",n(i).toString());c.selectAll("text").styles(u)}},t.prototype.adjustLayout=function(){var e=z(this.point,2),n=e[0],i=e[1],a=this.attributes,s=a.x,o=a.y;this.group.attr("transform","translate(".concat(s-n,", ").concat(o-i,")"))},t.prototype.getPath=function(e,n){var i=this.attributes.radius,a=n.x,s=n.y,o=n.width,l=n.height,u=[["M",a+i,s],["L",a+o-i,s],["A",i,i,0,0,1,a+o,s+i],["L",a+o,s+l-i],["A",i,i,0,0,1,a+o-i,s+l],["L",a+i,s+l],["A",i,i,0,0,1,a,s+l-i],["L",a,s+i],["A",i,i,0,0,1,a+i,s],["Z"]],c={top:4,right:6,bottom:0,left:2},h=c[e],d=this.createCorner([u[h].slice(-2),u[h+1].slice(-2)]);return u.splice.apply(u,vt([h+1,1],z(d),!1)),u[0][0]="M",u},t.prototype.createCorner=function(e,n){n===void 0&&(n=10);var i=.8,a=edt.apply(void 0,vt([],z(e),!1)),s=z(e,2),o=z(s[0],2),l=o[0],u=o[1],c=z(s[1],2),h=c[0],d=c[1],g=z(a?[h-l,[l,h]]:[d-u,[u,d]],2),p=g[0],v=z(g[1],2),m=v[0],b=v[1],w=p/2,x=p/Math.abs(p),S=n*x,_=S/2,M=S*Math.sqrt(3)/2*i,k=z([m,m+w-_,m+w,m+w+_,b],5),C=k[0],P=k[1],T=k[2],A=k[3],R=k[4];return a?(this.point=[T,u-M],[["L",C,u],["L",P,u],["L",T,u-M],["L",A,u],["L",R,u]]):(this.point=[l+M,T],[["L",l,C],["L",l,P],["L",l+M,T],["L",l,A],["L",l,R]])},t.prototype.applyVisibility=function(){var e=this.attributes.visibility;e==="hidden"?Ri(this):Zc(this)},t.prototype.bindEvents=function(){this.label.on(Xt.BOUNDS_CHANGED,this.renderBackground)},t.prototype.render=function(){this.renderLabel(),this.renderBackground(),this.adjustLayout(),this.applyVisibility()},t}(Qe);function bx(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 HN={overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"};function O0t(r){var t;r===void 0&&(r="");var e=bx(r);return t={},t[".".concat(e.CONTAINER)]={position:"absolute",visibility:"visible","z-index":8,transition:"visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)","background-color":"rgba(255, 255, 255, 0.96)","box-shadow":"0 6px 12px 0 rgba(0, 0, 0, 0.12)","border-radius":"4px",color:"rgba(0, 0, 0, 0.65)","font-size":"12px","line-height":"20px",padding:"12px","min-width":"120px","max-width":"360px","font-family":"Roboto-Regular"},t[".".concat(e.TITLE)]={color:"rgba(0, 0, 0, 0.45)"},t[".".concat(e.LIST)]={margin:"0px","list-style-type":"none",padding:"0px"},t[".".concat(e.LIST_ITEM)]={"list-style-type":"none",display:"flex","line-height":"2em","align-items":"center","justify-content":"space-between","white-space":"nowrap"},t[".".concat(e.MARKER)]={width:"8px",height:"8px","border-radius":"50%",display:"inline-block","margin-right":"4px"},t[".".concat(e.NAME)]={display:"flex","align-items":"center","max-width":"216px"},t[".".concat(e.NAME_LABEL)]=et({flex:1},HN),t[".".concat(e.VALUE)]=et({display:"inline-block",float:"right",flex:1,"text-align":"right","min-width":"28px","margin-left":"30px",color:"rgba(0, 0, 0, 0.85)"},HN),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 A0t=function(r){Ut(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=bx(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:O0t(s)})||this,n.timestamp=-1,n.prevCustomContentKey=n.attributes.contentKey,n.initShape(),n.render(n.attributes,n),n}return Object.defineProperty(t.prototype,"HTMLTooltipElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),t.prototype.getContainer=function(){return this.element},Object.defineProperty(t.prototype,"elementSize",{get:function(){var e=this.element.offsetWidth,n=this.element.offsetHeight;return{width:e,height:n}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HTMLTooltipItemsElements",{get:function(){var e=this.attributes,n=e.data,i=e.template;return n.map(function(a,s){var o=a.name,l=o===void 0?"":o,u=a.color,c=u===void 0?"black":u,h=a.index,d=Je(a,["name","color","index"]),g=et({name:l,color:c,index:h??s},d);return mw(CW(i.item,g))})},enumerable:!1,configurable:!0}),t.prototype.render=function(e,n){this.renderHTMLTooltipElement(),this.updatePosition()},t.prototype.destroy=function(){var e;(e=this.element)===null||e===void 0||e.remove(),r.prototype.destroy.call(this)},t.prototype.show=function(e,n){var i=this;if(e!==void 0&&n!==void 0){var a=this.element.style.visibility==="hidden",s=function(){i.attributes.x=e??i.attributes.x,i.attributes.y=n??i.attributes.y,i.updatePosition()};a?this.closeTransition(s):s()}this.element.style.visibility="visible"},t.prototype.hide=function(e,n){e===void 0&&(e=0),n===void 0&&(n=0);var i=this.attributes.enterable;i&&this.isCursorEntered(e,n)||(this.element.style.visibility="hidden")},t.prototype.initShape=function(){var e=this.attributes.template;this.element=mw(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:bN(this.element,e))}},t.prototype.renderHTMLTooltipElement=function(){var e,n,i=this.attributes,a=i.template,s=i.title,o=i.enterable,l=i.style,u=i.content,c=bx(a.prefixCls),h=this.element;if(this.element.style.pointerEvents=o?"auto":"none",u)this.renderCustomContent();else{s?(h.innerHTML=a.title,h.getElementsByClassName(c.TITLE)[0].innerHTML=s):(n=(e=h.getElementsByClassName(c.TITLE))===null||e===void 0?void 0:e[0])===null||n===void 0||n.remove();var d=this.HTMLTooltipItemsElements,g=document.createElement("ul");g.className=c.LIST,bN(g,d);var p=this.element.querySelector(".".concat(c.LIST));p?p.replaceWith(g):h.appendChild(g)}adt(h,l)},t.prototype.getRelativeOffsetFromCursor=function(e){var n=this.attributes,i=n.position,a=n.offset,s=e||i,o=s.split("-"),l={left:[-1,0],right:[1,0],top:[0,-1],bottom:[0,1]},u=this.elementSize,c=u.width,h=u.height,d=[-c/2,-h/2];return o.forEach(function(g){var p=z(d,2),v=p[0],m=p[1],b=z(l[g],2),w=b[0],x=b[1];d=[v+(c/2+a[0])*w,m+(h/2+a[1])*x]}),d},t.prototype.setOffsetPosition=function(e){var n=z(e,2),i=n[0],a=n[1],s=this.attributes,o=s.x,l=o===void 0?0:o,u=s.y,c=u===void 0?0:u,h=s.container,d=h.x,g=h.y;this.element.style.left="".concat(+l+d+i,"px"),this.element.style.top="".concat(+c+g+a,"px")},t.prototype.updatePosition=function(){var e=this.attributes.showDelay,n=e===void 0?60:e,i=Date.now();this.timestamp>0&&i-this.timestamp<n||(this.timestamp=i,this.setOffsetPosition(this.autoPosition(this.getRelativeOffsetFromCursor())))},t.prototype.autoPosition=function(e){var n=z(e,2),i=n[0],a=n[1],s=this.attributes,o=s.x,l=s.y,u=s.bounding,c=s.position;if(!u)return[i,a];var h=this.element,d=h.offsetWidth,g=h.offsetHeight,p=z([+o+i,+l+a],2),v=p[0],m=p[1],b={left:"right",right:"left",top:"bottom",bottom:"top"},w=u.x,x=u.y,S=u.width,_=u.height,M={left:v<w,right:v+d>w+S,top:m<x,bottom:m+g>x+_},k=[];c.split("-").forEach(function(P){M[P]?k.push(b[P]):k.push(P)});var C=k.join("-");return this.getRelativeOffsetFromCursor(C)},t.prototype.isCursorEntered=function(e,n){if(this.element){var i=this.element.getBoundingClientRect(),a=i.x,s=i.y,o=i.width,l=i.height;return new ur(a,s,o,l).isPointIn(e,n)}return!1},t.prototype.closeTransition=function(e){var n=this,i=this.element.style.transition;this.element.style.transition="none",e(),setTimeout(function(){n.element.style.transition=i},10)},t.tag="tooltip",t}(Qe),P0t=function(r){Ut(t,r);function t(e){var n=r.call(this,Pn({},t.defaultOptions,e))||this;return n.hoverColor="#f5f5f5",n.selectedColor="#e6f7ff",n.background=n.appendChild(new Sn({})),n.label=n.background.appendChild(new _n({})),n}return Object.defineProperty(t.prototype,"padding",{get:function(){return qn(this.style.padding)},enumerable:!1,configurable:!0}),t.prototype.renderLabel=function(){var e=this.style,n=e.label,i=e.value,a=Nt(this.attributes,"label");_t(this.label).maybeAppend(".label",function(){return Va(n)}).attr("className","label").styles(a),this.label.attr("__data__",i)},t.prototype.renderBackground=function(){var e=this.label.getBBox(),n=z(this.padding,4),i=n[0],a=n[1],s=n[2],o=n[3],l=e.width,u=e.height,c=l+o+a,h=u+i+s,d=Nt(this.attributes,"background"),g=this.style,p=g.width,v=p===void 0?0:p,m=g.height,b=m===void 0?0:m,w=g.selected;this.background.attr(et(et({},d),{width:Math.max(c,v),height:Math.max(h,b),fill:w?this.selectedColor:"#fff"})),this.label.attr({transform:"translate(".concat(o,", ").concat((h-u)/2,")")})},t.prototype.render=function(){this.renderLabel(),this.renderBackground()},t.prototype.bindEvents=function(){var e=this;this.addEventListener("pointerenter",function(){e.style.selected||e.background.attr("fill",e.hoverColor)}),this.addEventListener("pointerleave",function(){e.style.selected||e.background.attr("fill",e.style.backgroundFill)});var n=this;this.addEventListener("click",function(){var i=e.style,a=i.label,s=i.value,o=i.onClick;o==null||o(s,{label:a,value:s},n)})},t.defaultOptions={style:{value:"",label:"",cursor:"pointer"}},t}(Qe),N0t=function(r){Ut(t,r);function t(e){var n,i,a=r.call(this,Pn({},t.defaultOptions,e))||this;a.currentValue=(n=t.defaultOptions.style)===null||n===void 0?void 0:n.defaultValue,a.isPointerInSelect=!1,a.select=a.appendChild(new Sn({className:"select",style:{cursor:"pointer",width:0,height:0}})),a.dropdown=a.appendChild(new Sn({className:"dropdown"}));var s=a.style.defaultValue;return s&&(!((i=a.style.options)===null||i===void 0)&&i.some(function(o){return o.value===s}))&&(a.currentValue=s),a}return t.prototype.setValue=function(e){this.currentValue=e,this.render()},t.prototype.getValue=function(){return this.currentValue},Object.defineProperty(t.prototype,"dropdownPadding",{get:function(){return qn(this.style.dropdownPadding)},enumerable:!1,configurable:!0}),t.prototype.renderSelect=function(){var e=this,n,i=this.style,a=i.x,s=i.y,o=i.width,l=i.height,u=i.bordered,c=i.showDropdownIcon,h=Nt(this.attributes,"select"),d=Nt(this.attributes,"placeholder");this.select.attr(et(et({x:a,y:s,width:o,height:l},h),{fill:"#fff",strokeWidth:u?1:0}));var g=this.dropdownPadding,p=10;c&&_t(this.select).maybeAppend(".dropdown-icon","path").style("d","M-5,-3.5 L0,3.5 L5,-3.5").style("transform","translate(".concat(a+o-p-g[1]-g[3],", ").concat(s+l/2,")")).style("lineWidth",1).style("stroke",this.select.style.stroke);var v=(n=this.style.options)===null||n===void 0?void 0:n.find(function(x){return x.value===e.currentValue}),m=et({x:a+g[3]},d);_t(this.select).selectAll(".placeholder").data(v?[]:[1]).join(function(x){return x.append("text").attr("className","placeholder").styles(m).style("y",function(){var S=this.getBBox();return s+(l-S.height)/2})},function(x){return x.styles(m)},function(x){return x.remove()});var b=Nt(this.attributes,"optionLabel"),w=et({x:a+g[3]},b);_t(this.select).selectAll(".value").data(v?[v]:[]).join(function(x){return x.append(function(S){return Va(S.label)}).attr("className","value").styles(w).style("y",function(){var S=this.getBBox();return s+(l-S.height)/2})},function(x){return x.styles(w)},function(x){return x.remove()})},t.prototype.renderDropdown=function(){var e=this,n,i,a=this.style,s=a.x,o=a.y,l=a.width,u=a.height,c=a.options,h=a.onSelect,d=a.open,g=Nt(this.attributes,"dropdown"),p=Nt(this.attributes,"option"),v=this.dropdownPadding;_t(this.dropdown).maybeAppend(".dropdown-container","g").attr("className","dropdown-container").selectAll(".dropdown-item").data(c,function(w){return w.value}).join(function(w){return w.append(function(x){return new P0t({className:"dropdown-item",style:et(et(et({},x),p),{width:l-v[1]-v[3],selected:x.value===e.currentValue,onClick:function(S,_,M){e.setValue(S),h==null||h(S,_,M),e.dispatchEvent(new cn("change",{detail:{value:S,option:_,item:M}})),Ri(e.dropdown)}})})}).each(function(x,S){var _,M=(_=this.parentNode)===null||_===void 0?void 0:_.children,k=M.reduce(function(C,P,T){return T<S&&(C+=P.getBBox().height),C},0);this.attr("transform","translate(".concat(v[3],", ").concat(v[0]+k,")"))})},function(w){return w.update(function(x){return{selected:x.value===e.currentValue}})},function(w){return w.remove()});var m=(i=(n=this.dropdown.getElementsByClassName("dropdown-container"))===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.getBBox(),b=g.spacing;this.dropdown.attr(et({transform:"translate(".concat(s,", ").concat(o+u+b,")"),width:m.width+v[1]+v[3],height:m.height+v[0]+v[2]},g)),!d&&Ri(this.dropdown)},t.prototype.render=function(){this.renderSelect(),this.renderDropdown()},t.prototype.bindEvents=function(){var e=this;this.addEventListener("click",function(n){n.stopPropagation()}),this.select.addEventListener("click",function(){e.dropdown.style.visibility==="visible"?Ri(e.dropdown):Zc(e.dropdown)}),this.addEventListener("pointerenter",function(){e.isPointerInSelect=!0}),this.addEventListener("pointerleave",function(){e.isPointerInSelect=!1}),document==null||document.addEventListener("click",function(){e.isPointerInSelect||Ri(e.dropdown)})},t.defaultOptions={style:{x:0,y:0,width:140,height:32,options:[],bordered:!0,defaultValue:"",selectRadius:8,selectStroke:"#d9d9d9",showDropdownIcon:!0,placeholderText:"请选择",placeholderFontSize:12,placeholderTextBaseline:"top",placeholderFill:"#c2c2c2",dropdownFill:"#fff",dropdownStroke:"#d9d9d9",dropdownRadius:8,dropdownShadowBlur:4,dropdownShadowColor:"rgba(0, 0, 0, 0.08)",dropdownPadding:8,dropdownSpacing:10,optionPadding:[8,12],optionFontSize:12,optionTextBaseline:"top",optionBackgroundFill:"#fff",optionBackgroundRadius:4,optionLabelFontSize:12,optionLabelTextBaseline:"top"}},t}(Qe),$i=function(r){Ut(t,r);function t(e){var n=r.call(this,Pn({},{style:{backgroundOpacity:t.backgroundOpacities.default}},t.defaultOptions,e))||this;return n.showBackground=!0,n.background=n.appendChild(new Sn({})),n.icon=n.appendChild(new _n({})),n}return Object.defineProperty(t.prototype,"label",{get:function(){return"BaseIcon"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lineWidth",{get:function(){return Math.log10(this.attributes.size)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return qn(this.attributes.size/5)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"iconSize",{get:function(){var e=this.attributes.size,n=z(this.padding,4),i=n[0],a=n[1],s=n[2],o=n[3];return Math.max(e-Math.max(o+a,i+s),this.lineWidth*2+1)},enumerable:!1,configurable:!0}),t.prototype.renderBackground=function(){var e=this.attributes,n=e.x,i=e.y,a=e.size,s=a/2,o=Nt(this.attributes,"background");this.background.attr(et({x:n-s,y:i-s,width:a,height:a},o))},t.prototype.showIndicator=function(){if(this.label){var e=this.attributes.size,n=this.background.getBBox(),i=n.x,a=n.y;this.indicator.update({x:i+e/2,y:a-5,labelText:this.label,visibility:"visible"})}},t.prototype.hideIndicator=function(){this.indicator.update({visibility:"hidden"})},t.prototype.connectedCallback=function(){var e;r.prototype.connectedCallback.call(this);var n=this.attributes.size,i=this.background.getBBox(),a=i.x,s=i.y,o=(e=this.ownerDocument)===null||e===void 0?void 0:e.defaultView;o&&(this.indicator=o.appendChild(new T0t({style:{x:a+n/2,y:s-n/2,visibility:"hidden",position:"top",radius:3,zIndex:100}})))},t.prototype.disconnectedCallback=function(){this.indicator.destroy()},t.prototype.render=function(){this.renderIcon(),this.showBackground&&this.renderBackground()},t.prototype.bindEvents=function(){var e=this,n=this.attributes.onClick;if(this.addEventListener("click",function(){n==null||n(e)}),this.showBackground){var i=function(){return e.background.attr({opacity:t.backgroundOpacities.default})},a=function(){return e.background.attr({opacity:t.backgroundOpacities.hover})},s=function(){return e.background.attr({opacity:t.backgroundOpacities.active})};this.addEventListener("pointerenter",function(){a(),e.showIndicator()}),this.addEventListener("pointerleave",function(){i(),e.hideIndicator()}),this.addEventListener("pointerdown",function(){s()}),this.addEventListener("pointerup",function(){i()})}},t.tag="IconBase",t.defaultOptions={style:{x:0,y:0,size:10,color:"#565758",backgroundRadius:4,backgroundFill:"#e2e2e2"}},t.backgroundOpacities={default:0,hover:.8,active:1},t}(Qe),Mc=function(r,t){return t===void 0&&(t="#565758"),new qr({style:{fill:t,d:"M ".concat(r,",").concat(r," L -").concat(r,",0 L ").concat(r,",-").concat(r," Z"),transformOrigin:"center"}})},R0t=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.arcPath=function(e,n,i){var a=z([i,i],2),s=a[0],o=a[1],l=function(v){return[e+i*Math.cos(v),n+i*Math.sin(v)]},u=z(l(-5/4*Math.PI),2),c=u[0],h=u[1],d=z(l(1/4*Math.PI),2),g=d[0],p=d[1];return"M".concat(c,",").concat(h,",A").concat(s,",").concat(o,",0,1,1,").concat(g,",").concat(p)},Object.defineProperty(t.prototype,"label",{get:function(){return"重置"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=this.lineWidth,l=o+.5;_t(this.icon).maybeAppend(".reset","path").styles({stroke:a,lineWidth:o,d:this.arcPath(n,i,s/2-o),markerStart:Mc(l,a)})},t}($i),L0t=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"快退"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=s/2,l=s/2/Math.pow(3,.5),u=[[n,i],[n,i-l],[n-o,i],[n,i+l],[n,i],[n+o,i-l],[n+o,i+l],[n,i]];_t(this.icon).maybeAppend(".backward","polygon").styles({points:u,fill:a})},t}($i),I0t=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"快进"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=s/2,l=s/2/Math.pow(3,.5),u=[[n,i],[n,i-l],[n+o,i],[n,i+l],[n,i],[n-o,i-l],[n-o,i+l],[n,i]];_t(this.icon).maybeAppend(".forward","polygon").styles({points:u,fill:a})},t}($i),D0t=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"播放"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=s/3*Math.pow(3,.5)*.8,l=[[n+o,i],[n-o/2,i-s/2*.8],[n-o/2,i+s/2*.8],[n+o,i]];_t(this.icon).maybeAppend(".play","polygon").styles({points:l,fill:a})},t}($i),F0t=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"暂停"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this.iconSize,o=s/3,l=[[n-o,i-s/2],[n-o,i+s/2],[n-o/2,i+s/2],[n-o/2,i-s/2],[n-o,i-s/2],[n+o/2,i-s/2],[n+o/2,i+s/2],[n+o,i+s/2],[n+o,i-s/2]];_t(this.icon).maybeAppend(".pause","polygon").styles({points:l,fill:a})},t}($i),B0t=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"范围时间"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this,o=s.iconSize,l=s.lineWidth,u=l;_t(this.icon).maybeAppend(".left-line","line").styles({x1:n-o/2,y1:i-o/2,x2:n-o/2,y2:i+o/2,stroke:a,lineWidth:l}),_t(this.icon).maybeAppend(".right-line","line").styles({x1:n+o/2,y1:i-o/2,x2:n+o/2,y2:i+o/2,stroke:a,lineWidth:l}),_t(this.icon).maybeAppend(".left-arrow","line").styles({x1:n,y1:i,x2:n-o/2+u*2,y2:i,stroke:a,lineWidth:l,markerEnd:Mc(l*2,a)}),_t(this.icon).maybeAppend(".right-arrow","line").styles({x1:n,y1:i,x2:n+o/2-u*2,y2:i,stroke:a,lineWidth:l,markerEnd:Mc(l*2,a)})},t}($i),z0t=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"单一时间"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this,o=s.iconSize,l=s.lineWidth;_t(this.icon).maybeAppend(".line","line").styles({x1:n,y1:i-o/2,x2:n,y2:i+o/2,stroke:a,lineWidth:l});var u=l;_t(this.icon).maybeAppend(".left-arrow","line").styles({x1:n-o/2-u*2,y1:i,x2:n-u*2,y2:i,stroke:a,lineWidth:l,markerEnd:Mc(l*2,a)}),_t(this.icon).maybeAppend(".right-arrow","line").styles({x1:n+o/2+u*2,y1:i,x2:n+u*2,y2:i,stroke:a,lineWidth:l,markerEnd:Mc(l*2,a)})},t}($i),l4=function(r){return[[-r/2,-r/2],[-r/2,r/2],[r/2,r/2]]},$0t=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"折线图"},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this,o=s.iconSize,l=s.lineWidth,u=l,c=(o-u*2-l)/4,h=(o-u*2-l)/2,d=z([n-o/2+u,i+o/2-u*2],2),g=d[0],p=d[1];_t(this.icon).maybeAppend(".coordinate","polyline").styles({points:l4(o).map(function(v){var m=z(v,2),b=m[0],w=m[1];return[b+n,w+i]}),stroke:a,lineWidth:l}),_t(this.icon).maybeAppend(".line","polyline").styles({points:[[g,p],[g+c,p-h],[g+c*2,p],[g+c*4,p-h*2]],stroke:a,lineWidth:l})},t}($i),j0t=function(r){Ut(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"label",{get:function(){return"条形图"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return[1,4,2,4,3]},enumerable:!1,configurable:!0}),t.prototype.renderIcon=function(){var e=this.data,n=this.attributes,i=n.x,a=n.y,s=n.color,o=this,l=o.iconSize,u=o.lineWidth,c=u,h=(l-c)/e.length,d=(l-c*2)/4,g=z([i-l/2+c*2,a+l/2-c],2),p=g[0],v=g[1];_t(this.icon).maybeAppend(".coordinate","polyline").styles({points:l4(l).map(function(m){var b=z(m,2),w=b[0],x=b[1];return[w+i,x+a]}),stroke:s,lineWidth:u}),_t(this.icon).maybeAppend(".bars","g").selectAll(".column").data(this.data.map(function(m,b){return{value:m,index:b}})).join(function(m){return m.append("line").attr("className","column").style("x1",function(b){var w=b.index;return p+h*w}).style("y1",v).style("x2",function(b){var w=b.index;return p+h*w}).style("y2",function(b){var w=b.value;return v-d*w}).styles({y1:v,stroke:s,lineWidth:u})})},t}($i),q0t=function(r){Ut(t,r);function t(e){var n=r.call(this,Pn({},{style:{color:"#d8d9d9"}},e))||this;return n.showBackground=!1,n}return t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.color,s=this,o=s.iconSize,l=s.lineWidth;_t(this.icon).maybeAppend(".split","line").styles({x1:n,y1:i-o/2,x2:n,y2:i+o/2,stroke:a,lineWidth:l})},t}($i),wx=function(r){Ut(t,r);function t(){var e=r.apply(this,vt([],z(arguments),!1))||this;return e.showBackground=!1,e}return Object.defineProperty(t.prototype,"padding",{get:function(){return qn(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=Px(this.attributes,["x","y","transform","transformOrigin","width","height","size","color","speed"]),u=Ue(e,20,1/0),c=20,h=et(et({},l),{x:i-u/2,y:a-c/2,width:u,height:c,defaultValue:o,bordered:!1,showDropdownIcon:!1,selectRadius:2,dropdownPadding:this.padding,dropdownRadius:2,dropdownSpacing:e/5,placeholderFontSize:e/2,optionPadding:0,optionLabelFontSize:e/2,optionBackgroundRadius:1,options:[{label:"1x",value:1},{label:"1.5x",value:1.5},{label:"2x",value:2}]});_t(this.icon).maybeAppend(".speed",function(){return new N0t({style:h})}).attr("className","speed").each(function(){this.update(h)})},t.tag="SpeedSelect",t}($i),ZE=function(r){Ut(t,r);function t(e){var n=r.call(this,e)||this;return n.icon=n.appendChild(new _n({})),n.currentType=n.attributes.type,n}return t.prototype.getType=function(){return this.currentType},t.prototype.render=function(){var e=this,n=this.attributes;n.onChange;var i=Je(n,["onChange"]);_t(this.icon).selectAll(".icon").data([this.currentType]).join(function(a){return a.append(function(s){var o,l=(o=e.toggles.find(function(u){var c=z(u,1),h=c[0];return h===s}))===null||o===void 0?void 0:o[1];if(!l)throw new Error("Invalid type: ".concat(s));return new l({})}).attr("className","icon").styles(i,!1).update({})},function(a){return a.styles({restStyles:i}).update({})},function(a){return a.remove()})},t.prototype.bindEvents=function(){var e=this,n=this.attributes.onChange;this.addEventListener("click",function(i){i.preventDefault(),i.stopPropagation();var a=(e.toggles.findIndex(function(o){var l=z(o,1),u=l[0];return u===e.currentType})+1)%e.toggles.length,s=e.toggles[a][0];n==null||n(e.currentType),e.currentType=s,e.render()})},t.tag="ToggleIcon",t}(Qe),xx=function(r){Ut(t,r);function t(e){var n=r.call(this,Pn({},{style:{type:"play"}},e))||this;return n.toggles=[["play",D0t],["pause",F0t]],n}return t}(ZE),Ex=function(r){Ut(t,r);function t(e){var n=r.call(this,Pn({},{style:{type:"range"}},e))||this;return n.toggles=[["range",B0t],["value",z0t]],n}return t}(ZE),_x=function(r){Ut(t,r);function t(e){var n=r.call(this,Pn({},{style:{type:"column"}},e))||this;return n.toggles=[["line",$0t],["column",j0t]],n}return t}(ZE),W0t={reset:R0t,speed:wx,backward:L0t,playPause:xx,forward:I0t,selectionType:Ex,chartType:_x,split:q0t},G0t=function(r){Ut(t,r);function t(e){var n=r.call(this,Pn({},t.defaultOptions,e))||this;return n.background=n.appendChild(new Sn({})),n.functions=n.appendChild(new _n({})),n}return Object.defineProperty(t.prototype,"padding",{get:function(){return qn(this.attributes.padding)},enumerable:!1,configurable:!0}),t.prototype.renderBackground=function(){var e=this.style,n=e.x,i=e.y,a=e.width,s=e.height,o=Nt(this.attributes,"background");this.background.attr(et({x:n,y:i,width:a,height:s},o))},t.prototype.renderFunctions=function(){var e=this,n,i=this.attributes,a=i.functions,s=i.iconSize,o=i.iconSpacing,l=i.x,u=i.y,c=i.width,h=i.height,d=i.align,g=z(this.padding,4),p=g[1],v=g[3],m=a.reduce(function(x,S){return x.length&&S.length?x.concat.apply(x,vt(["split"],z(S),!1)):x.concat.apply(x,vt([],z(S),!1))},[]),b=m.length*(s+o)-o,w={left:v+s/2,center:(c-b)/2+s/2,right:c-b-v-p+s/2}[d]||0;(n=this.speedSelect)===null||n===void 0||n.destroy(),this.functions.removeChildren(),m.forEach(function(x,S){var _,M=W0t[x],k={x:l+S*(s+o)+w,y:u+h/2,size:s};if(M===wx?(k.speed=e.attributes.speed,k.onSelect=function(P){return e.handleFunctionChange(x,{value:P})}):[xx,Ex,_x].includes(M)?(k.onChange=function(P){return e.handleFunctionChange(x,{value:P})},M===xx&&(k.type=e.attributes.state==="play"?"pause":"play"),M===Ex&&(k.type=e.attributes.selectionType==="range"?"value":"range"),M===_x&&(k.type=e.attributes.chartType==="line"?"column":"line")):k.onClick=function(){return e.handleFunctionChange(x,{value:x})},M===wx){var C=(_=e.ownerDocument)===null||_===void 0?void 0:_.defaultView;C&&(e.speedSelect=new M({style:et(et({},k),{zIndex:100})}),C.appendChild(e.speedSelect))}else e.functions.appendChild(new M({style:k}))})},t.prototype.disconnectedCallback=function(){var e;r.prototype.disconnectedCallback.call(this),(e=this.speedSelect)===null||e===void 0||e.destroy()},t.prototype.render=function(){this.renderBackground(),this.renderFunctions()},t.prototype.handleFunctionChange=function(e,n){var i=this.attributes.onChange;i==null||i(e,n)},t.defaultOptions={style:{x:0,y:0,width:300,height:40,padding:0,align:"center",iconSize:25,iconSpacing:0,speed:1,state:"pause",chartType:"line",selectionType:"range",backgroundFill:"#fbfdff",backgroundStroke:"#ebedf0",functions:[["reset","speed"],["backward","playPause","forward"],["selectionType","chartType"]]}},t}(Qe),V0t=function(r){Ut(t,r);function t(e){var n=r.call(this,Pn({},t.defaultOptions,e))||this;return n.bindEvents(),n}return t.prototype.bindEvents=function(){var e=this;this.addEventListener("mouseenter",function(){e.attr("lineWidth",Math.ceil(+(e.style.r||0)/2))}),this.addEventListener("mouseleave",function(){e.attr("lineWidth",0)})},t.defaultOptions={style:{r:5,fill:"#3f7cf7",lineWidth:0,stroke:"#3f7cf7",strokeOpacity:.5,cursor:"pointer"}},t}(Ua),H0t=function(r){Ut(t,r);function t(e){return r.call(this,Pn({},t.defaultOptions,e))||this}return t.prototype.renderBackground=function(){var e=this.attributes,n=e.x,i=e.y,a=e.width,s=e.height,o=Nt(this.attributes,"background");_t(this).maybeAppend("background","rect").attr("className","background").styles(et({x:n-a/2,y:i-s/2,width:a,height:s},o))},t.prototype.renderIcon=function(){var e=this.attributes,n=e.x,i=e.y,a=e.iconSize,s=Nt(this.attributes,"icon"),o=1,l=a/2;_t(this).maybeAppend("icon-left-line","line").attr("className","icon-left-line").styles(et({x1:n-o,y1:i-l,x2:n-o,y2:i+l},s)),_t(this).maybeAppend("icon-right-line","line").attr("className","icon-right-line").styles(et({x1:n+o,y1:i-l,x2:n+o,y2:i+l},s))},t.prototype.renderBorder=function(){var e=this.attributes,n=e.x,i=e.y,a=e.width,s=e.height,o=e.type,l=Nt(this.attributes,"border"),u=o==="start"?+a/2:-a/2;_t(this).maybeAppend("border","line").attr("className","border").styles(et({x1:u+n,y1:i-s/2,x2:u+n,y2:i+s/2},l))},t.prototype.render=function(){this.renderBackground(),this.renderIcon(),this.renderBorder()},t.defaultOptions={style:{x:0,y:0,width:10,height:50,iconSize:10,type:"start",backgroundFill:"#fff",backgroundFillOpacity:.5,iconStroke:"#9a9a9a",iconLineWidth:1,borderStroke:"#e8e8e8",borderLineWidth:1}},t}(Qe);function U0t(r,t){return typeof r=="number"?u4(r):Y0t(r,t)}function Y0t(r,t){var e=new Date(r);switch(t){case"half-hour":case"hour":case"four-hour":return[0,6,12,18].includes(e.getHours())&&e.getMinutes()===0?yr(e,`HH:mm
- YYYY-MM-DD`):yr(e,"HH:mm");case"half-day":return e.getHours()<12?`AM
- `.concat(yr(e,"YYYY-MM-DD")):"PM";case"day":return[1,10,20].includes(e.getDate())?yr(e,`DD
- YYYY-MM`):yr(e,"DD");case"week":return e.getDate()<=7?yr(e,`DD
- YYYY-MM`):yr(e,"DD");case"month":return[0,6].includes(e.getMonth())?yr(e,`MM月
- YYYY`):yr(e,"MM月");case"season":return[0].includes(e.getMonth())?yr(e,`MM月
- YYYY`):yr(e,"MM月");case"year":return yr(e,"YYYY");default:return yr(e,"YYYY-MM-DD HH:mm")}}function u4(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 X0t=function(r){Ut(t,r);function t(e){var n=r.call(this,Pn({},t.defaultOptions,e))||this;n.axis=n.appendChild(new m0t({style:{type:"linear",startPos:[0,0],endPos:[0,0],data:[],showArrow:!1,animate:!1}})),n.timeline=n.appendChild(new pft({style:{onChange:function(h){n.handleSliderChange(h)}}})),n.controller=n.appendChild(new G0t({})),n.states={},n.handleSliderChange=function(h){var d=function(){var g=n.states.values;return Array.isArray(g)?vt([],z(g),!1):g}();n.setBySliderValues(h),n.dispatchOnChange(d)};var i=n.attributes,a=i.selectionType,s=i.chartType,o=i.speed,l=i.state,u=i.playMode,c=i.values;return n.states={chartType:s,playMode:u,selectionType:a,speed:o,state:l},n.setByTimebarValues(c),n}return Object.defineProperty(t.prototype,"data",{get:function(){var e=this.attributes.data,n=function(i,a){return i.time<a.time?-1:i.time>a.time?1:0};return e.sort(n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"space",{get:function(){var e=this.attributes,n=e.x,i=e.y,a=e.width,s=e.height,o=e.type,l=e.controllerHeight,u=Ue(+s-l,0,+s),c=new ur(n,i+ +s-l,+a,l),h,d=0;o==="chart"?(d=35,h=new ur(n,i+u-d,+a,d)):h=new ur;var g=o==="time"?10:u,p=new ur(n,i+(o==="time"?u:u-g),+a,g-d);return{axisBBox:h,controllerBBox:c,timelineBBox:p}},enumerable:!1,configurable:!0}),t.prototype.setBySliderValues=function(e){var n,i,a=this.data,s=z(Array.isArray(e)?e:[0,e],2),o=s[0],l=s[1],u=a.length,c=a[Math.floor(o*u)],h=a[Math.ceil(l*u)-(Array.isArray(e)?0:1)];this.states.values=[(n=c==null?void 0:c.time)!==null&&n!==void 0?n:a[0].time,(i=h==null?void 0:h.time)!==null&&i!==void 0?i:1/0]},t.prototype.setByTimebarValues=function(e){var n,i,a,s=this.data,o=z(Array.isArray(e)?e:[void 0,e],2),l=o[0],u=o[1],c=s.find(function(d){var g=d.time;return g===l}),h=s.find(function(d){var g=d.time;return g===u});this.states.values=[(n=c==null?void 0:c.time)!==null&&n!==void 0?n:(i=s[0])===null||i===void 0?void 0:i.time,(a=h==null?void 0:h.time)!==null&&a!==void 0?a:1/0]},t.prototype.setByIndex=function(e){var n,i,a,s,o=this.data,l=z(e,2),u=l[0],c=l[1];this.states.values=[(i=(n=o[u])===null||n===void 0?void 0:n.time)!==null&&i!==void 0?i:o[0].time,(s=(a=this.data[c])===null||a===void 0?void 0:a.time)!==null&&s!==void 0?s:1/0]},Object.defineProperty(t.prototype,"sliderValues",{get:function(){var e=this.states,n=e.values,i=e.selectionType,a=z(Array.isArray(n)?n:[void 0,n],2),s=a[0],o=a[1],l=this.data,u=l.length,c=i==="value",h=function(){var g=l.findIndex(function(p){var v=p.time;return v===s});return c?0:g>-1?g/u:0},d=function(){if(o===1/0)return 1;var g=l.findIndex(function(p){var v=p.time;return v===o});return g>-1?g/u:c?.5:1};return[h(),d()]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"values",{get:function(){var e=this.states,n=e.values,i=e.selectionType,a=z(Array.isArray(n)?n:[this.data[0].time,n],2),s=a[0],o=a[1];return i==="value"?o:[s,o]},enumerable:!1,configurable:!0}),t.prototype.getDatumByRatio=function(e){var n=this.data,i=n.length,a=Math.floor(e*(i-1));return n[a]},Object.defineProperty(t.prototype,"chartHandleIconShape",{get:function(){var e=this.states.selectionType,n=this.space.timelineBBox.height;return e==="range"?function(i){return new H0t({style:{type:i,height:n,iconSize:n/6}})}:function(){return new Do({style:{x1:0,y1:-n/2,x2:0,y2:n/2,lineWidth:2,stroke:"#c8c8c8"}})}},enumerable:!1,configurable:!0}),t.prototype.getChartStyle=function(e){var n=this,i=e.x,a=e.y,s=e.width,o=e.height,l=this.states,u=l.selectionType,c=l.chartType,h=this.data,d=this.attributes,g=d.type,p=d.labelFormatter,v=Nt(this.attributes,"chart");v.type;var m=Je(v,["type"]),b=u==="range";if(g==="time")return et({handleIconShape:function(){return new V0t({})},selectionFill:"#2e7ff8",selectionFillOpacity:1,showLabelOnInteraction:!0,handleLabelDy:b?-15:0,autoFitLabel:b,handleSpacing:b?-15:0,trackFill:"#edeeef",trackLength:s,trackOpacity:.5,trackRadius:o/2,trackSize:o/2,type:u,values:this.sliderValues,formatter:function(S){if(p)return p(S);var _=n.getDatumByRatio(S).time;return typeof _=="number"?u4(_):yr(_,"YYYY-MM-DD HH:mm:ss")},transform:"translate(".concat(i,", ").concat(a,")"),zIndex:1},m);var w=u==="range"?5:0,x=h.map(function(S){var _=S.value;return _});return et({handleIconOffset:w,handleIconShape:this.chartHandleIconShape,selectionFill:"#fff",selectionFillOpacity:.5,selectionType:"invert",sparklineSpacing:.1,sparklineColumnLineWidth:0,sparklineColor:"#d4e5fd",sparklineAreaOpacity:1,sparklineAreaLineWidth:0,sparklineData:x,sparklineType:c,sparklineScale:.8,trackLength:s,trackSize:o,type:u,values:this.sliderValues,transform:"translate(".concat(i,", ").concat(a,")"),zIndex:1},m)},t.prototype.renderChart=function(e){e===void 0&&(e=this.space.timelineBBox),this.timeline.update(this.getChartStyle(e))},t.prototype.updateSelection=function(){this.timeline.setValues(this.sliderValues,!0),this.handleSliderChange(this.sliderValues)},t.prototype.getAxisStyle=function(e){var n=this.data,i=this.attributes,a=i.interval,s=i.labelFormatter,o=Nt(this.attributes,"axis"),l=e.x,u=e.y,c=e.width,h=vt(vt([],z(n),!1),[{time:0}],!1).map(function(g,p,v){var m=g.time;return{label:"".concat(m),value:p/(v.length-1),time:m}}),d=et({startPos:[l,u],endPos:[l+c,u],data:h,labelFilter:function(g,p){return p<h.length-1},labelFormatter:function(g){var p=g.time;return s?s(p):U0t(p,a)}},o);return d},t.prototype.renderAxis=function(e){e===void 0&&(e=this.space.axisBBox);var n=this.attributes.type;n==="chart"&&this.axis.update(this.getAxisStyle(e))},t.prototype.renderController=function(e){e===void 0&&(e=this.space.controllerBBox);var n=this.attributes.type,i=this.states,a=i.state,s=i.speed,o=i.selectionType,l=i.chartType,u=Nt(this.attributes,"controller"),c=this,h=et(et(et({},e),{iconSize:20,speed:s,state:a,selectionType:o,chartType:l,onChange:function(d,g){var p=g.value;switch(d){case"reset":c.internalReset();break;case"speed":c.handleSpeedChange(p);break;case"backward":c.internalBackward();break;case"playPause":p==="play"?c.internalPlay():c.internalPause();break;case"forward":c.internalForward();break;case"selectionType":c.handleSelectionTypeChange(p);break;case"chartType":c.handleChartTypeChange(p);break}}}),u);n==="time"&&(h.functions=[["reset","speed"],["backward","playPause","forward"],["selectionType"]]),this.controller.update(h)},t.prototype.dispatchOnChange=function(e){var n=this.data,i=this.attributes.onChange,a=this.states,s=a.values,o=a.selectionType,l=z(s,2),u=l[0],c=l[1],h=c===1/0?n.at(-1).time:c,d=o==="range"?[u,h]:h,g=function(p,v){return Array.isArray(p)?Array.isArray(v)?p[0]===v[0]&&(p[1]===v[1]||p[1]===1/0||v[1]===1/0):!1:Array.isArray(v)?!1:p===v};(!e||!g(e,d))&&(i==null||i(o==="range"?[u,h]:h))},t.prototype.internalReset=function(e){var n,i,a=this.states.selectionType;this.internalPause(),this.setBySliderValues(a==="range"?[0,1]:[0,0]),this.renderController(),this.updateSelection(),e||((i=(n=this.attributes)===null||n===void 0?void 0:n.onReset)===null||i===void 0||i.call(n),this.dispatchOnChange())},t.prototype.reset=function(){this.internalReset()},t.prototype.moveSelection=function(e,n){var i=this.data,a=i.length,s=this.states,o=s.values,l=s.selectionType,u=s.playMode,c=z(o,2),h=c[0],d=c[1],g=i.findIndex(function(x){var S=x.time;return S===h}),p=i.findIndex(function(x){var S=x.time;return S===d});p===-1&&(p=a);var v=e==="backward"?-1:1,m;l==="range"?u==="acc"?(m=[g,p+v],v===-1&&g===p&&(m=[g,a])):m=[g+v,p+v]:m=[g,p+v];var b=function(x){var S=z(x.sort(function(C,P){return C-P}),2),_=S[0],M=S[1],k=function(C){return Ue(C,0,a)};return M>a?l==="value"?[0,0]:u==="acc"?[k(_),k(_)]:[0,k(M-_)]:_<0?u==="acc"?[0,k(M)]:[k(_+a-M),a]:[k(_),k(M)]},w=b(m);return this.setByIndex(w),this.updateSelection(),w},t.prototype.internalBackward=function(e){var n,i,a=this.moveSelection("backward",e);return e||((i=(n=this.attributes)===null||n===void 0?void 0:n.onBackward)===null||i===void 0||i.call(n),this.dispatchOnChange()),a},t.prototype.backward=function(){this.internalBackward()},t.prototype.internalPlay=function(e){var n=this,i,a,s=this.data,o=this.attributes.loop,l=this.states.speed,u=l===void 0?1:l;this.playInterval=window.setInterval(function(){var c=n.internalForward();c[1]===s.length&&!o&&(n.internalPause(),n.renderController())},1e3/u),this.states.state="play",!e&&((a=(i=this.attributes)===null||i===void 0?void 0:i.onPlay)===null||a===void 0||a.call(i))},t.prototype.play=function(){this.internalPlay()},t.prototype.internalPause=function(e){var n,i;clearInterval(this.playInterval),this.states.state="pause",!e&&((i=(n=this.attributes)===null||n===void 0?void 0:n.onPause)===null||i===void 0||i.call(n))},t.prototype.pause=function(){this.internalPause()},t.prototype.internalForward=function(e){var n,i,a=this.moveSelection("forward",e);return e||((i=(n=this.attributes)===null||n===void 0?void 0:n.onForward)===null||i===void 0||i.call(n),this.dispatchOnChange()),a},t.prototype.forward=function(){this.internalForward()},t.prototype.handleSpeedChange=function(e){var n,i;this.states.speed=e;var a=this.states.state;a==="play"&&(this.internalPause(!0),this.internalPlay(!0)),(i=(n=this.attributes)===null||n===void 0?void 0:n.onSpeedChange)===null||i===void 0||i.call(n,e)},t.prototype.handleSelectionTypeChange=function(e){var n,i;this.states.selectionType=e,this.renderChart(),(i=(n=this.attributes)===null||n===void 0?void 0:n.onSelectionTypeChange)===null||i===void 0||i.call(n,e)},t.prototype.handleChartTypeChange=function(e){var n,i;this.states.chartType=e,this.renderChart(),(i=(n=this.attributes)===null||n===void 0?void 0:n.onChartTypeChange)===null||i===void 0||i.call(n,e)},t.prototype.render=function(){var e=this.space,n=e.axisBBox,i=e.controllerBBox,a=e.timelineBBox;this.renderController(i),this.renderAxis(n),this.renderChart(a),this.states.state==="play"&&this.internalPlay()},t.prototype.destroy=function(){r.prototype.destroy.call(this),this.internalPause(!0)},t.defaultOptions={style:{x:0,y:0,axisLabelFill:"#6e6e6e",axisLabelTextAlign:"left",axisLabelTextBaseline:"top",axisLabelTransform:"translate(5, -12)",axisLineLineWidth:1,axisLineStroke:"#cacdd1",axisTickLength:15,axisTickLineWidth:1,axisTickStroke:"#cacdd1",chartShowLabel:!1,chartType:"line",controllerAlign:"center",controllerHeight:40,data:[],interval:"day",loop:!1,playMode:"acc",selectionType:"range",type:"time"}},t}(Qe);function JE(r){const{width:t,height:e,renderer:n}=r,i=K0t(r),a=new Rw({width:t,height:e,container:i,renderer:n||new mc});return[i,a]}function K0t(r){var t;const{container:e,className:n,graphCanvas:i}=r;if(e)return typeof e=="string"?document.getElementById(e):e;const a=su(n,!1),{width:s,height:o,containerStyle:l}=r,[u,c]=Z0t(r);return Object.assign(a.style,Object.assign({position:"absolute",left:u+"px",top:c+"px",width:s+"px",height:o+"px"},l)),(t=i.getContainer())===null||t===void 0||t.appendChild(a),a}function Z0t(r){const{width:t,height:e,placement:n,graphCanvas:i}=r,[a,s]=i.getSize(),[o,l]=gI(n);return[o*(a-t),l*(s-e)]}var J0t=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 Cg extends Gn{constructor(t,e){super(t,Object.assign({},Cg.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(lt.AFTER_DRAW,this.createElement)},this.changeState=(n,i)=>{const{graph:a}=this.context,{typePrefix:s}=this,o=sr(n,[s,"id"]),l=sr(n,[s,"style","labelText"]),[u]=o.split("__"),c=this.fieldMap[u].get(l)||[];a.setElementState(Object.fromEntries(c==null?void 0:c.map(h=>[h,i])))},this.click=n=>{if(this.options.trigger==="hover")return;const i=sr(n,[this.typePrefix,"id"]);this.selectedItems.includes(i)?(this.selectedItems=this.selectedItems.filter(a=>a!==i),this.changeState(n,[])):(this.selectedItems.push(i),this.changeState(n,"selected"))},this.mouseleave=n=>{this.options.trigger!=="click"&&(this.selectedItems=[],this.changeState(n,[]))},this.mouseenter=n=>{if(this.options.trigger==="click")return;const i=sr(n,[this.typePrefix,"id"]);this.selectedItems.includes(i)?this.selectedItems=this.selectedItems.filter(a=>a!==i):(this.selectedItems.push(i),this.changeState(n,"active"))},this.setFieldMap=(n,i,a)=>{if(!n)return;const s=this.fieldMap[a];if(s)if(!s.has(n))s.set(n,[i]);else{const o=s.get(n);o&&(o.push(i),s.set(n,o))}},this.getEvents=()=>({mouseenter:this.mouseenter,mouseleave:this.mouseleave,click:this.click}),this.getMarkerData=(n,i)=>{if(!n)return[];const{model:a,element:s}=this.context,{nodes:o,edges:l,combos:u}=a.getData(),c={},h=m=>Et(n)?n(m):n,d={node:"circle",edge:"line",combo:"rect"},g={circle:"circle",ellipse:"circle",image:"bowtie",rect:"square",star:"cross",triangle:"triangle",diamond:"diamond",cubic:"dot",line:"hyphen",polyline:"hyphen",quadratic:"hv","cubic-horizontal":"hyphen","cubic-vertical":"line"},p=(m,b)=>s==null?void 0:s.getElementComputedStyle(m,b),v=(m,b)=>{m.forEach(w=>{const{id:x}=w,S=sr(w,["data",h(w)]),_=(s==null?void 0:s.getElementType(b,w))||"circle",M=p(b,w),k=(b==="edge"?M==null?void 0:M.stroke:M==null?void 0:M.fill)||"#1783ff";x&&S&&S.replace(/\s+/g,"")&&(this.setFieldMap(S,x,b),c[S]||(c[S]={id:`${b}__${x}`,label:S,marker:g[_]||d[b],elementType:b,lineWidth:1,stroke:k,fill:k}))})};switch(i){case"node":v(o,"node");break;case"edge":v(l,"edge");break;case"combo":v(u,"combo");break;default:return[]}return Object.values(c)},this.createElement=()=>{if(this.draw){this.updateElement();return}const n=this.options,{width:i,height:a,nodeField:s,edgeField:o,comboField:l,trigger:u,position:c,container:h,containerStyle:d,className:g}=n,p=J0t(n,["width","height","nodeField","edgeField","comboField","trigger","position","container","containerStyle","className"]),v=this.getMarkerData(s,"node"),m=this.getMarkerData(o,"edge"),b=this.getMarkerData(l,"combo"),w=[...v,...b,...m],x=Object.assign({width:i,height:a,data:w,itemMarkerLineWidth:({lineWidth:M})=>M,itemMarker:({marker:M})=>M,itemMarkerStroke:({stroke:M})=>M,itemMarkerFill:({fill:M})=>M,gridCol:v.length},p,this.getEvents()),S=new k0t({className:"legend",style:x});this.category=S,this.upsertCanvas().appendChild(S),this.draw=!0},this.bindEvents()}update(t){super.update(t),this.clear(),this.createElement()}clear(){var t,e;(t=this.canvas)===null||t===void 0||t.destroy(),(e=this.container)===null||e===void 0||e.remove(),this.canvas=void 0,this.container=void 0,this.draw=!1}updateElement(){this.category&&this.category.update({itemMarkerOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5,itemLabelOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5})}upsertCanvas(){if(this.canvas)return this.canvas;const t=this.context.canvas,[e,n]=t.getSize(),{width:i=e,height:a=n,position:s,container:o,containerStyle:l,className:u}=this.options,[c,h]=JE({width:i,height:a,graphCanvas:t,container:o,containerStyle:l,placement:s,className:"legend"});return this.container=c,u&&c.classList.add(u),this.canvas=h,this.canvas}destroy(){this.clear(),this.context.graph.off(lt.AFTER_DRAW,this.createElement),super.destroy()}}Cg.defaultOptions={position:"bottom",trigger:"hover",orientation:"horizontal",layout:"flex",itemSpacing:4,rowPadding:10,colPadding:10,itemMarkerSize:16,itemLabelFontSize:16,width:240,height:160};class Tg extends Gn{constructor(t,e){super(t,Object.assign({},Tg.defaultOptions,e)),this.onDraw=n=>{var i;!((i=n==null?void 0:n.data)===null||i===void 0)&&i.render||this.onRender()},this.shapes=new Map,this.landmarkMap=new Map,this.mask=null,this.isMaskDragging=!1,this.onMaskDragStart=n=>{this.mask&&(this.isMaskDragging=!0,this.mask.setPointerCapture(n.pointerId),this.mask.addEventListener("pointermove",this.onMaskDrag),this.mask.addEventListener("pointerup",this.onMaskDragEnd),this.mask.addEventListener("pointercancel",this.onMaskDragEnd))},this.onMaskDrag=n=>{if(!this.mask||!this.isMaskDragging)return;const{size:[i,a]}=this.options,{movementX:s,movementY:o}=n,{left:l,top:u,width:c,height:h}=this.mask.style,[,,d,g]=this.maskBBox;let p=parseInt(l)+s,v=parseInt(u)+o,m=parseInt(c),b=parseInt(h);p<0&&(p=0),v<0&&(v=0),p+m>i&&(p=gs(i-m,0)),v+b>a&&(v=gs(a-b,0)),m<d&&(s>0?(p=gs(p-s,0),m=fs(m+s,i)):s<0&&(m=fs(m-s,i))),b<g&&(o>0?(v=gs(v-o,0),b=fs(b+o,a)):o<0&&(b=fs(b-o,a))),Object.assign(this.mask.style,{left:p+"px",top:v+"px",width:m+"px",height:b+"px"});const w=parseInt(l)-p,x=parseInt(u)-v;if(w===0&&x===0)return;const S=this.context.canvas.getCamera().getZoom(),_=this.canvas.getCamera().getZoom(),M=S/_;this.context.graph.translateBy([w*M,x*M],!1)},this.onMaskDragEnd=n=>{this.mask&&(this.isMaskDragging=!1,this.mask.releasePointerCapture(n.pointerId),this.mask.removeEventListener("pointermove",this.onMaskDrag),this.mask.removeEventListener("pointerup",this.onMaskDragEnd),this.mask.removeEventListener("pointercancel",this.onMaskDragEnd))},this.onTransform=ZR(()=>{this.isMaskDragging||(this.updateMask(),this.setCamera())},32,{leading:!0}),this.setOnRender(),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),"delay"in t&&this.setOnRender(),this.bindEvents()}setOnRender(){this.onRender=Ac(()=>{this.renderMinimap(),this.renderMask()},this.options.delay,!0)}bindEvents(){const{graph:t}=this.context;t.on(lt.AFTER_DRAW,this.onDraw),t.on(lt.AFTER_RENDER,this.onRender),t.on(lt.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:t}=this.context;t.off(lt.AFTER_DRAW,this.onDraw),t.off(lt.AFTER_RENDER,this.onRender),t.off(lt.AFTER_TRANSFORM,this.onTransform)}renderMinimap(){const t=this.getElements(),e=this.initCanvas();this.setShapes(e,t)}getElements(){const{filter:t}=this.options,{model:e}=this.context,n=e.getData();if(!t)return n;const{nodes:i,edges:a,combos:s}=n;return{nodes:i.filter(o=>t(H(o),"node")),edges:a.filter(o=>t(H(o),"edge")),combos:s.filter(o=>t(H(o),"combo"))}}setShapes(t,e){const{nodes:n,edges:i,combos:a}=e,{shape:s}=this.options,{element:o}=this.context;if(s==="key"){const u=new Set,c=h=>{const d=H(h);u.add(d);const g=o.getElement(d);if(!g)return;const p=g.getShape("key"),v=this.shapes.get(d)||p.cloneNode();v.setPosition(p.getPosition()),g.style.zIndex&&(v.style.zIndex=g.style.zIndex),v.id=g.id,this.shapes.has(d)?Object.entries(p.attributes).forEach(([m,b])=>{v.style[m]!==b&&(v.style[m]=b)}):(t.appendChild(v),this.shapes.set(d,v))};i.forEach(c),a.forEach(c),n.forEach(c),this.shapes.forEach((h,d)=>{u.has(d)||(t.removeChild(h),this.shapes.delete(d))});return}const l=(u,c)=>{const d=o.getElement(u).getPosition();return c.setPosition(d),c};t.removeChildren(),i.forEach(u=>t.appendChild(s(H(u),"edge"))),a.forEach(u=>{t.appendChild(l(H(u),s(H(u),"combo")))}),n.forEach(u=>{t.appendChild(l(H(u),s(H(u),"node")))})}initCanvas(){const{renderer:t,size:[e,n]}=this.options;if(this.canvas){const{width:i,height:a}=this.canvas.getConfig();(e!==i||n!==a)&&this.canvas.resize(e,n),t&&this.canvas.setRenderer(t)}else{const{className:i,position:a,container:s,containerStyle:o}=this.options,[l,u]=JE({renderer:t,width:e,height:n,placement:a,className:"minimap",container:s,containerStyle:o,graphCanvas:this.context.canvas});i&&l.classList.add(i),this.container=l,this.canvas=u}return this.setCamera(),this.canvas}createLandmark(t,e,n){const i=`${t.join(",")}-${e.join(",")}-${n}`;if(this.landmarkMap.has(i))return this.landmarkMap.get(i);const s=this.canvas.getCamera().createLandmark(i,{position:t,focalPoint:e,zoom:n});return this.landmarkMap.set(i,s),s}setCamera(){var t;const{canvas:e}=this.context,n=(t=this.canvas)===null||t===void 0?void 0:t.getCamera();if(!n)return;const{size:[i,a],padding:s}=this.options,[o,l,u,c]=la(s),{min:h,max:d,center:g}=e.getBounds("elements"),p=d[0]-h[0],v=d[1]-h[1],m=i-c-l,b=a-o-u,w=m/p,x=b/v,S=Math.min(w,x),_=this.createLandmark(g,g,S);n.gotoLandmark(_,0)}get maskBBox(){const{canvas:t}=this.context,e=t.getSize(),n=t.getCanvasByViewport([0,0]),i=t.getCanvasByViewport(e),a=this.canvas.canvas2Viewport(Ni(n)),s=this.canvas.canvas2Viewport(Ni(i)),o=s.x-a.x,l=s.y-a.y;return[a.x,a.y,o,l]}calculateMaskBBox(){const{size:[t,e]}=this.options;let[n,i,a,s]=this.maskBBox;return n<0&&(a=fs(a+n,t),n=0),i<0&&(s=fs(s+i,e),i=0),n+a>t&&(a=gs(t-n,0)),i+s>e&&(s=gs(e-i,0)),[fs(n,t),fs(i,e),gs(a,0),gs(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()}}Tg.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 fs=(r,t)=>Math.min(r,t),gs=(r,t)=>Math.max(r,t);var Qb=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};const tw={x1:0,y1:0,x2:0,y2:0,visibility:"hidden"};class Og extends Gn{constructor(t,e){super(t,Object.assign({},Og.defaultOptions,e)),this.initSnapline=()=>{const n=this.context.canvas.getLayer("transient");this.horizontalLine||(this.horizontalLine=n.appendChild(new Do({style:Object.assign(Object.assign({},tw),this.options.horizontalLineStyle)}))),this.verticalLine||(this.verticalLine=n.appendChild(new Do({style:Object.assign(Object.assign({},tw),this.options.verticalLineStyle)})))},this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!0,this.autoSnapToLine=(n,i,a)=>Qb(this,void 0,void 0,function*(){const{verticalX:s,horizontalY:o}=a,{tolerance:l}=this.options,{min:[u,c],max:[h,d],center:[g,p]}=i;let v=0,m=0;s!==null&&(Un(h,s)<l&&(v=s-h),Un(u,s)<l&&(v=s-u),Un(g,s)<l&&(v=s-g),v!==0&&(this.isVerticalSticking=!0)),o!==null&&(Un(d,o)<l&&(m=o-d),Un(c,o)<l&&(m=o-c),Un(p,o)<l&&(m=o-p),m!==0&&(this.isHorizontalSticking=!0)),(v!==0||m!==0)&&(yield this.context.graph.translateElementBy({[n]:[v,m]},!1))}),this.enableSnap=n=>{const{target:i}=n,a=.5;if(this.isHorizontalSticking||this.isVerticalSticking){const[s,o]=this.getDelta(n);if(this.isHorizontalSticking&&this.isVerticalSticking&&Math.abs(s)<=a&&Math.abs(o)<=a)return this.context.graph.translateElementBy({[i.id]:[-s,-o]},!1),!1;if(this.isHorizontalSticking&&Math.abs(o)<=a)return this.context.graph.translateElementBy({[i.id]:[0,-o]},!1),!1;if(this.isVerticalSticking&&Math.abs(s)<=a)return this.context.graph.translateElementBy({[i.id]:[-s,0]},!1),!1;this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!1,setTimeout(()=>{this.enableStick=!0},200)}return this.enableStick},this.calcSnaplineMetadata=(n,i)=>{const{tolerance:a,shape:s}=this.options,{min:[o,l],max:[u,c],center:[h,d]}=i;let g=null,p=null,v=null,m=null,b=null,w=null;return this.getNodes().some(x=>{if(Ye(n.id,x.id))return!1;const S=UN(x,s).getRenderBounds(),{min:[_,M],max:[k,C],center:[P,T]}=S;return g===null&&(Un(P,h)<a?g=P:Un(_,o)<a||Un(_,u)<a?g=_:(Un(k,u)<a||Un(k,o)<a)&&(g=k),g!==null&&(p=Math.min(M,l),v=Math.max(C,c))),m===null&&(Un(T,d)<a?m=T:Un(M,l)<a||Un(M,c)<a?m=M:(Un(C,c)<a||Un(C,l)<a)&&(m=C),m!==null&&(b=Math.min(_,o),w=Math.max(k,u))),g!==null&&m!==null}),{verticalX:g,verticalMinY:p,verticalMaxY:v,horizontalY:m,horizontalMinX:b,horizontalMaxX:w}},this.onDragStart=()=>{this.initSnapline()},this.onDrag=n=>Qb(this,void 0,void 0,function*(){const{target:i}=n;if(this.options.autoSnap&&!this.enableSnap(n))return;const a=UN(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 ZZ(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||tw.lineWidth||1)/this.context.graph.getZoom()}updateSnapline(t){const{verticalX:e,verticalMinY:n,verticalMaxY:i,horizontalY:a,horizontalMinX:s,horizontalMaxX:o}=t,[l,u]=this.context.canvas.getSize(),{offset:c}=this.options;a!==null?Object.assign(this.horizontalLine.style,{x1:c===1/0?0:s-c,y1:a,x2:c===1/0?l:o+c,y2:a,visibility:"visible",lineWidth:this.getLineWidth("horizontal")}):this.horizontalLine.style.visibility="hidden",e!==null?Object.assign(this.verticalLine.style,{x1:e,y1:c===1/0?0:n-c,x2:e,y2:c===1/0?u:i+c,visibility:"visible",lineWidth:this.getLineWidth("vertical")}):this.verticalLine.style.visibility="hidden"}getDelta(t){const e=this.context.graph.getZoom();return Di([t.dx,t.dy],e)}bindEvents(){return Qb(this,void 0,void 0,function*(){const{graph:t}=this.context;t.on(Zn.DRAG_START,this.onDragStart),t.on(Zn.DRAG,this.onDrag),t.on(Zn.DRAG_END,this.onDragEnd)})}unbindEvents(){const{graph:t}=this.context;t.off(Zn.DRAG_START,this.onDragStart),t.off(Zn.DRAG,this.onDrag),t.off(Zn.DRAG_END,this.onDragEnd)}destroyElements(){var t,e;(t=this.horizontalLine)===null||t===void 0||t.destroy(),(e=this.verticalLine)===null||e===void 0||e.destroy()}destroy(){this.destroyElements(),this.unbindEvents(),super.destroy()}}Og.defaultOptions={tolerance:5,offset:20,autoSnap:!0,shape:"key",verticalLineStyle:{stroke:"#1783FF"},horizontalLineStyle:{stroke:"#1783FF"},filter:()=>!0};const Un=(r,t)=>Math.abs(r-t),UN=(r,t)=>typeof t=="function"?t(r):r.getShape(t);var Q0t=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},tgt=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 egt=["timestamp","time","date","datetime"];class Ag extends Gn{get padding(){return la(this.options.padding)}constructor(t,e){super(t,Object.assign({},Ag.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=YN(this.context.graph.getData())}upsertTimebar(){const{canvas:t}=this.context,e=this.options,{onChange:n,timebarType:i,data:a,x:s,y:o,width:l,height:u,mode:c}=e,h=tgt(e,["onChange","timebarType","data","x","y","width","height","mode"]),d=t.getSize(),[g]=this.padding;this.upsertCanvas().ready.then(()=>{var p;const v=Object.assign(Object.assign({x:d[0]/2-l/2,y:g,onChange:m=>{const b=(Xr(m)?m:[m,m]).map(w=>AW(w)?w.getTime():w);this.options.mode==="modify"?this.filterElements(b):this.hiddenElements(b),n==null||n(b)}},h),{data:a.map(m=>bt(m)?{time:m,value:0}:m),width:l,height:u,type:i});this.timebar?this.timebar.update(v):(this.timebar=new X0t({style:v}),(p=this.canvas)===null||p===void 0||p.appendChild(this.timebar))})}upsertCanvas(){if(this.canvas)return this.canvas;const{className:t,height:e,position:n}=this.options,i=this.context.canvas,[a]=i.getSize(),[s,,o]=this.padding,[l,u]=JE({width:a,height:e+s+o,graphCanvas:i,className:"timebar",placement:n});return this.container=l,t&&l.classList.add(t),this.canvas=u,this.canvas}filterElements(t){return Q0t(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=YN(this.originalData);n.forEach(u=>{const c=`${u}s`;o[c]=(this.originalData[c]||[]).filter(h=>{const d=i(h);return!!XN(d,t)})});const l=[...o.nodes,...o.combos].map(u=>H(u));o.edges=o.edges.filter(u=>{const c=u.source,h=u.target;return l.includes(c)&&l.includes(h)}),a.setData(o),yield(e=s.draw({animation:!1,silence:!0}))===null||e===void 0?void 0:e.finished})}hiddenElements(t){const{graph:e}=this.context,{elementTypes:n,getTime:i}=this.options,a=[],s=[];n.forEach(o=>{var l;const u=`${o}s`;(((l=this.originalData)===null||l===void 0?void 0:l[u])||[]).forEach(h=>{const d=H(h),g=i(h);XN(g,t)?s.push(d):a.push(d)})}),e.hideElement(a,!1),e.showElement(s,!1)}destroy(){var t,e,n;const{graph:i}=this.context;this.originalData&&i.setData(Object.assign({},this.originalData)),(t=this.timebar)===null||t===void 0||t.destroy(),(e=this.canvas)===null||e===void 0||e.destroy(),(n=this.container)===null||n===void 0||n.remove(),this.originalData=void 0,this.container=void 0,this.timebar=void 0,this.canvas=void 0,super.destroy()}}Ag.defaultOptions={position:"bottom",enable:!0,timebarType:"time",className:"g6-timebar",width:450,height:60,zIndex:3,elementTypes:["node"],padding:10,mode:"modify",getTime:r=>ngt(r,egt,void 0),loop:!1};const YN=r=>{const{nodes:t=[],edges:e=[],combos:n=[]}=r;return{nodes:[...t],edges:[...e],combos:[...n]}},XN=(r,t)=>{if(bt(t))return r===t;const[e,n]=t;return r>=e&&r<=n},ngt=(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 rgt(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 igt=`
- .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;
- }
- `,agt=`
- <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 KN=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Pg extends Gn{constructor(t,e){super(t,Object.assign({},Pg.defaultOptions,e)),this.$element=su("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),cx("g6-toolbar-css","style",{},igt,document.head),cx("g6-toolbar-svgicon","div",{display:"none"},agt),this.$element.addEventListener("click",this.onToolbarItemClick),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return KN(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,rgt(i)),this.$element.innerHTML=yield this.getDOMContent()})}destroy(){this.$element.removeEventListener("click",this.onToolbarItemClick),this.$element.remove(),super.destroy()}getDOMContent(){return KN(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("")})}}Pg.defaultOptions={position:"top-left"};var ZN=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Ng extends Gn{constructor(t,e){super(t,Object.assign({},Ng.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=>ZN(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=>ZN(this,void 0,void 0,function*(){var i,a;const{client:s,target:{id:o}}=n;if(S0(n.target))return;const l=this.context.graph.getElementType(o),{getContent:u,title:c}=this.options,h=this.getElementData(o,l);if(!this.tooltipElement||!this.isEnable(n,h))return;let d={};if(u){if(d.content=yield u(n,h),!d.content)return}else{const v=this.context.graph.getElementRenderStyle(o),m=l==="node"?v.fill:v.stroke;d={title:c||l,data:h.map(b=>({name:"ID",value:b.id||`${b.source} -> ${b.target}`,color:m}))}}this.currentTarget=o;let g,p;if(s)g=s.x,p=s.y;else{const v=sr(h,"0.style",{x:0,y:0});g=v.x,p=v.y}(a=(i=this.options).onOpenChange)===null||a===void 0||a.call(i,!0),this.tooltipElement.update(Object.assign(Object.assign(Object.assign({},this.tooltipStyleProps),{x:g,y:p,style:{".tooltip":{visibility:"visible"}}}),d))}),this.hide=n=>{var i,a,s,o,l;if(!n){(a=(i=this.options).onOpenChange)===null||a===void 0||a.call(i,!1),(s=this.tooltipElement)===null||s===void 0||s.hide(),this.currentTarget=null;return}if(!this.tooltipElement||!this.currentTarget)return;const{client:{x:u,y:c}}=n;(l=(o=this.options).onOpenChange)===null||l===void 0||l.call(o,!1),this.tooltipElement.hide(u,c),this.currentTarget=null},this.initTooltip=()=>{var n;const i=new A0t({className:"tooltip",style:this.tooltipStyleProps});return(n=this.container)===null||n===void 0||n.appendChild(i.HTMLTooltipElement),i},this.render(),this.bindEvents()}getEvents(){return this.options.trigger==="click"?{"node:click":this.onClick,"edge:click":this.onClick,"combo:click":this.onClick,"canvas:click":this.onPointerLeave,contextmenu:this.onPointerLeave,drag:this.onPointerLeave}:{"node:pointerenter":this.onPointerEnter,"node:pointermove":this.onPointerMove,"canvas:pointermove":this.onCanvasMove,"edge:pointerenter":this.onPointerEnter,"edge:pointermove":this.onPointerMove,"combo:pointerenter":this.onPointerEnter,"combo:pointermove":this.onPointerMove,contextmenu:this.onPointerLeave,"node:drag":this.onPointerLeave}}update(t){var e;this.unbindEvents(),super.update(t),this.tooltipElement&&((e=this.container)===null||e===void 0||e.removeChild(this.tooltipElement.HTMLTooltipElement)),this.tooltipElement=this.initTooltip(),this.bindEvents()}render(){const{canvas:t}=this.context,e=t.getContainer();e&&(this.container=e,this.tooltipElement=this.initTooltip())}unbindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach(n=>{t.off(n,e[n])})}bindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach(n=>{t.on(n,e[n])})}get tooltipStyleProps(){const{canvas:t}=this.context,{center:e}=t.getBounds(),n=t.getContainer(),{top:i,left:a}=n.getBoundingClientRect(),{style:s,position:o,enterable:l,container:u={x:-a,y:-i},title:c,offset:h}=this.options,[d,g]=e,[p,v]=t.getSize();return{x:d,y:g,container:u,title:c,bounding:{x:0,y:0,width:p,height:v},position:o,enterable:l,offset:h,style:s}}destroy(){var t;this.unbindEvents(),this.tooltipElement&&((t=this.container)===null||t===void 0||t.removeChild(this.tooltipElement.HTMLTooltipElement)),super.destroy()}}Ng.defaultOptions={trigger:"hover",position:"top-right",enterable:!1,enable:!0,offset:[10,10],style:{".tooltip":{visibility:"hidden"}}};var c4=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};let xl;function h4(r,t){return xl||(xl=document.createElement("canvas")),xl.width=r,xl.height=t,xl.getContext("2d").clearRect(0,0,r,t),xl}function sgt(r,t,e,n){return c4(this,void 0,void 0,function*(){const i=h4(r,t),a=i.getContext("2d"),{rotate:s,opacity:o,textFill:l,textFontSize:u,textFontFamily:c,textFontVariant:h,textFontWeight:d,textAlign:g,textBaseline:p}=n;return a.textAlign=g,a.textBaseline=p,a.translate(r/2,t/2),a.font=`${u}px ${c} ${h} ${d}`,s&&a.rotate(s),o&&(a.globalAlpha=o),l&&(a.fillStyle=l,a.fillText(`${e}`,0,0)),i.toDataURL()})}function ogt(r,t,e,n){return c4(this,void 0,void 0,function*(){const i=h4(r,t),a=i.getContext("2d"),{rotate:s,opacity:o}=n;s&&a.rotate(s),o&&(a.globalAlpha=o);const l=new Image;return l.crossOrigin="anonymous",l.src=e,new Promise(u=>{l.onload=function(){const c=r>l.width?(r-l.width)/2:0,h=t>l.height?(t-l.height)/2:0;a.drawImage(l,0,0,l.width,l.height,c,h,r-c*2,t-h*2),u(i.toDataURL())}})})}var lgt=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},ugt=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 Rg extends Gn{constructor(t,e){super(t,Object.assign({},Rg.defaultOptions,e)),this.$element=su("watermark"),this.context.canvas.getContainer().appendChild(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return lgt(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=ugt(n,["width","height","text","imageURL"]);Object.keys(l).forEach(c=>{c.startsWith("background")&&(this.$element.style[c]=t[c])});const u=o?yield ogt(i,a,o,l):yield sgt(i,a,s,l);this.$element.style.backgroundImage=`url(${u})`})}destroy(){super.destroy(),this.$element.remove()}}Rg.defaultOptions={width:200,height:100,opacity:.2,rotate:Math.PI/12,text:"",textFill:"#000",textFontSize:16,textAlign:"center",textBaseline:"middle",backgroundRepeat:"repeat"};const cgt=["#7E92B5","#F4664A","#FFBE3A"],hgt={type:"group",color:["#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]},dgt={type:"group",color:["#99ADD1","#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]};function d4(r){const{bgColor:t,textColor:e,nodeColor:n,nodeColorDisabled:i,nodeStroke:a,nodeHaloStrokeOpacityActive:s=.15,nodeHaloStrokeOpacitySelected:o=.25,nodeOpacityDisabled:l=.06,nodeIconOpacityInactive:u=.85,nodeOpacityInactive:c=.25,nodeBadgePalette:h=cgt,nodePaletteOptions:d=hgt,edgeColor:g,edgeColorDisabled:p,edgePaletteOptions:v=dgt,comboColor:m,comboColorDisabled:b,comboStroke:w,comboStrokeDisabled:x,edgeColorInactive:S}=r;return{background:t,node:{palette:d,style:{donutOpacity:1,badgeBackgroundOpacity:1,badgeFill:"#fff",badgeFontSize:8,badgePadding:[0,4],badgePalette:h,fill:n,fillOpacity:1,halo:!1,iconFill:"#fff",iconOpacity:1,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelFill:e,labelFillOpacity:.85,labelLineHeight:16,labelPadding:[0,2],labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelOffsetY:2,lineWidth:0,portFill:n,portLineWidth:1,portStroke:a,portStrokeOpacity:.65,size:32,stroke:a,strokeOpacity:1,zIndex:2},state:{selected:{halo:!0,haloLineWidth:24,haloStrokeOpacity:o,labelFontSize:12,labelFontWeight:"bold",lineWidth:4,stroke:a},active:{halo:!0,haloLineWidth:12,haloStrokeOpacity:s},highlight:{labelFontWeight:"bold",lineWidth:4,stroke:a,strokeOpacity:.85},inactive:{badgeBackgroundOpacity:c,donutOpacity:c,fillOpacity:c,iconOpacity:u,labelFill:e,labelFillOpacity:c,strokeOpacity:c},disabled:{badgeBackgroundOpacity:.25,donutOpacity:l,fill:i,fillOpacity:l,iconFill:i,iconOpacity:.25,labelFill:e,labelFillOpacity:.25,strokeOpacity:l}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"node-expand",collapse:"node-collapse",update:[{fields:["x","y","fill","stroke"]}],translate:[{fields:["x","y"]}]}},edge:{palette:v,style:{badgeBackgroundFill:g,badgeFill:"#fff",badgeFontSize:8,badgeOffsetX:10,fillOpacity:1,halo:!1,haloLineWidth:12,haloStrokeOpacity:1,increasedLineWidthForHitTesting:2,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[4,4,4,4],labelFill:e,labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelPlacement:"center",labelTextBaseline:"middle",lineWidth:1,stroke:g,strokeOpacity:1,zIndex:1},state:{selected:{halo:!0,haloStrokeOpacity:.25,labelFontSize:14,labelFontWeight:"bold",lineWidth:3},active:{halo:!0,haloStrokeOpacity:.15},highlight:{labelFontWeight:"bold",lineWidth:3},inactive:{stroke:S,fillOpacity:.08,labelOpacity:.25,strokeOpacity:.08,badgeBackgroundOpacity:.25},disabled:{stroke:p,fillOpacity:.45,strokeOpacity:.45,labelOpacity:.25,badgeBackgroundOpacity:.45}},animation:{enter:"fade",exit:"fade",expand:"path-in",collapse:"path-out",show:"fade",hide:"fade",update:[{fields:["sourceNode","targetNode"]},{fields:["stroke"],shape:"key"}],translate:[{fields:["sourceNode","targetNode"]}]}},combo:{style:{collapsedMarkerFill:t,collapsedMarkerFontSize:12,collapsedMarkerFillOpacity:1,collapsedSize:32,collapsedFillOpacity:1,fill:m,halo:!1,haloLineWidth:12,haloStroke:w,haloStrokeOpacity:.25,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[2,4,2,4],labelFill:e,labelFontSize:12,labelFontWeight:400,labelOpacity:1,lineDash:0,lineWidth:1,fillOpacity:.04,strokeOpacity:1,padding:10,stroke:w},state:{selected:{halo:!0,labelFontSize:14,labelFontWeight:700,lineWidth:4},active:{halo:!0},highlight:{labelFontWeight:700,lineWidth:4},inactive:{fillOpacity:.65,labelOpacity:.25,strokeOpacity:.65},disabled:{fill:b,fillOpacity:.25,labelOpacity:.25,stroke:x,strokeOpacity:.25}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"combo-expand",collapse:"combo-collapse",update:[{fields:["x","y"]},{fields:["fill","stroke","lineWidth"],shape:"key"}],translate:[{fields:["x","y"]}]}}}}const fgt={type:"group",color:["#637088","#0F55A6","#008383","#9C5D38","#8B53A6","#4E40A6","#8F6608","#3E801D","#A65383","#175E75","#0F8248"]},ggt={bgColor:"#000000",comboColor:"#fdfdfd",comboColorDisabled:"#d0e4ff",comboStroke:"#99add1",comboStrokeDisabled:"#969696",edgeColor:"#637088",edgeColorDisabled:"#637088",edgeColorInactive:"#D0E4FF",edgePaletteOptions:fgt,nodeColor:"#1783ff",nodeColorDisabled:"#D0E4FF",nodeHaloStrokeOpacityActive:.25,nodeHaloStrokeOpacitySelected:.45,nodeIconOpacityInactive:.45,nodeOpacityDisabled:.25,nodeOpacityInactive:.45,nodeStroke:"#d0e4ff",textColor:"#ffffff"},pgt=d4(ggt),vgt={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"},mgt=d4(vgt);class Za extends Xx{beforeDraw(t,e){return t}afterLayout(t,e){}}class ygt extends Za{beforeDraw(t){const{model:e}=this.context,n=t.add.combos,i=a=>{const s=[];return a.forEach((o,l)=>{const c=e.getAncestorsData(l,"combo").map(h=>H(h)).reverse();s.push([l,o,c.length])}),new Map(s.sort(([,,o],[,,l])=>l-o).map(([o,l])=>[o,l]))};return t.add.combos=i(n),t.update.combos=i(t.update.combos),t}}function Vr(r,t,e,n,i){const a=H(n),s=`${e}s`,o=i?n:r.add[s].get(a)||r.update[s].get(a)||r.remove[s].get(a)||n;Object.entries(r).forEach(([l,u])=>{t===l?u[s].set(a,o):u[s].delete(a)})}function uf(r,t){return Object.keys(r).every(e=>r[e]===t[e])}class bgt extends Za{beforeDraw(t,e){if(e.stage==="visibility"||!this.context.model.model.hasTreeStructure(we))return t;const{model:n}=this.context,{add:i,update:a}=t,s=[...t.update.combos.entries(),...t.add.combos.entries()];for(;s.length;){const[o,l]=s.pop();if(Sr(l)){const u=n.getDescendantsData(o),c=u.map(H),{internal:h,external:d}=qw(c,g=>n.getRelatedEdgesData(g));u.forEach(g=>{const p=H(g),v=s.findIndex(([b])=>b===p);v!==-1&&s.splice(v,1);const m=n.getElementType(p);Vr(t,"remove",m,g)}),h.forEach(g=>Vr(t,"remove","edge",g)),d.forEach(g=>{var p;const v=H(g);((p=this.context.element)===null||p===void 0?void 0:p.getElement(v))?a.edges.set(v,g):i.edges.set(v,g)})}else{const u=n.getChildrenData(o),c=u.map(H),{edges:h}=qw(c,d=>n.getRelatedEdgesData(d));[...u,...h].forEach(d=>{var g;const p=H(d),v=n.getElementType(p);((g=this.context.element)===null||g===void 0?void 0:g.getElement(p))?Vr(t,"update",v,d):Vr(t,"add",v,d),v==="combo"&&s.push([p,d])})}}return t}}const JN=(r,t,e,n)=>{const i=`${e}s`,a=H(n);!r.add[i].has(a)&&!r.update[i].has(a)&&r[t][i].set(H(n),n)};class wgt extends Za{getElement(t){return this.context.element.getElement(t)}handleExpand(t,e){if(JN(e,"add","node",t),Sr(t))return;const n=H(t);JN(e,"add","node",t),this.context.model.getRelatedEdgesData(n,"out").forEach(s=>{Vr(e,"add","edge",s)}),this.context.model.getChildrenData(n).forEach(s=>{this.handleExpand(s,e)})}beforeDraw(t){const{graph:e,model:n}=this.context;if(!n.model.hasTreeStructure(jr))return t;const{add:{nodes:i,edges:a},update:{nodes:s}}=t,o=new Map,l=new Map;i.forEach((c,h)=>{Sr(c)&&o.set(h,c)}),a.forEach(c=>{if(e.getElementType(c.source)!=="node")return;const h=e.getNodeData(c.source);Sr(h)&&o.set(c.source,h)}),s.forEach((c,h)=>{const d=this.getElement(h);if(!d)return;const g=d.attributes.collapsed;Sr(c)?g||o.set(h,c):g&&l.set(h,c)});const u=new Set;return o.forEach((c,h)=>{n.getDescendantsData(h).forEach(g=>{const p=H(g);if(u.has(p))return;Vr(t,"remove","node",g),n.getRelatedEdgesData(p).forEach(m=>{Vr(t,"remove","edge",m)}),u.add(p)})}),l.forEach((c,h)=>{if(n.getAncestorsData(h,jr).some(Sr)){Vr(t,"remove","node",c);return}this.handleExpand(c,t)}),t}}function Qu(r,t,e,n=!1){const i=Lw[r][t];!n&&i?i!==e&&oa.warn(`The extension ${t} of ${r} has been registered before.`):Object.assign(Lw[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 f4=function(){function r(t){at(this,r),this.dragndropPluginOptions=t}return it(r,[{key:"apply",value:function(e){var n=this,i=e.renderingService,a=e.renderingContext,s=a.root.ownerDocument,o=s.defaultView,l=function(c){var h=c.target,d=h===s,g=d&&n.dragndropPluginOptions.isDocumentDraggable?s:h.closest&&h.closest("[draggable=true]");if(g){var p=!1,v=c.timeStamp,m=[c.clientX,c.clientY],b=null,w=[c.clientX,c.clientY],x=function(){var _=Fs(jn().mark(function M(k){var C,P,T,A,R,L;return jn().wrap(function(q){for(;;)switch(q.prev=q.next){case 0:if(p){q.next=8;break}if(C=k.timeStamp-v,P=wr([k.clientX,k.clientY],m),!(C<=n.dragndropPluginOptions.dragstartTimeThreshold||P<=n.dragndropPluginOptions.dragstartDistanceThreshold)){q.next=5;break}return q.abrupt("return");case 5:k.type="dragstart",g.dispatchEvent(k),p=!0;case 8:if(k.type="drag",k.dx=k.clientX-w[0],k.dy=k.clientY-w[1],g.dispatchEvent(k),w=[k.clientX,k.clientY],d){q.next=21;break}return T=n.dragndropPluginOptions.overlap==="pointer"?[k.canvasX,k.canvasY]:h.getBounds().center,q.next=17,s.elementsFromPoint(T[0],T[1]);case 17:A=q.sent,R=A[A.indexOf(h)+1],L=(R==null?void 0:R.closest("[droppable=true]"))||(n.dragndropPluginOptions.isDocumentDroppable?s:null),b!==L&&(b&&(k.type="dragleave",k.target=b,b.dispatchEvent(k)),L&&(k.type="dragenter",k.target=L,L.dispatchEvent(k)),b=L,b&&(k.type="dragover",k.target=b,b.dispatchEvent(k)));case 21:case"end":return q.stop()}},M)}));return function(k){return _.apply(this,arguments)}}();o.addEventListener("pointermove",x);var S=function(M){if(p){M.detail={preventClick:!0};var k=M.clone();b&&(k.type="drop",k.target=b,b.dispatchEvent(k)),k.type="dragend",g.dispatchEvent(k),p=!1}o.removeEventListener("pointermove",x)};h.addEventListener("pointerup",S,{once:!0}),h.addEventListener("pointerupoutside",S,{once:!0})}};i.hooks.init.tap(r.tag,function(){o.addEventListener("pointerdown",l)}),i.hooks.destroy.tap(r.tag,function(){o.removeEventListener("pointerdown",l)})}}])}();f4.tag="Dragndrop";var xgt=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return at(this,t),e=Wt(this,t),e.name="dragndrop",e.options=n,e}return qt(t,r),it(t,[{key:"init",value:function(){this.addRenderingPlugin(new f4(Bt({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}},{key:"setOptions",value:function(n){Object.assign(this.plugins[0].dragndropPluginOptions,n)}}])}(Vs),QN=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},tR=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 eR=["main"],nR=["background","main","label","transient"];function Egt(r){return r.main}class rR{getConfig(){return this.config}getLayer(t="main"){return this.extends.layers[t]||Egt(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=tR(e,["renderer","background","cursor","enableMultiLayer"]),l=s?nR:eR,u=iR(n,l),c=Object.fromEntries(l.map(h=>{const d=new Rw(Object.assign(Object.assign({},o),{supportsMutipleCanvasesInOneContainer:s,renderer:u[h],background:s?h==="background"?i:void 0:i}));return[h,d]}));aR(c),this.extends={config:this.config,renderer:n,renderers:u,layers:c}}get ready(){return Promise.all(Object.entries(this.getLayers()).map(([,t])=>t.ready))}resize(t,e){Object.assign(this.extends.config,{width:t,height:e}),Object.values(this.getLayers()).forEach(n=>{const i=n.getCamera(),a=i.getPosition(),s=i.getFocalPoint();n.resize(t,e),i.setPosition(a),i.setFocalPoint(s)})}getBounds(t){return Fc(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=iR(t,this.config.enableMultiLayer?nR:eR);this.extends.renderers=e,Object.entries(e).forEach(([n,i])=>this.getLayer(n).setRenderer(i)),aR(this.getLayers())}getCanvasByViewport(t){return $n(this.getLayer().viewport2Canvas(Ni(t)))}getViewportByCanvas(t){return $n(this.getLayer().canvas2Viewport(Ni(t)))}getViewportByClient(t){return $n(this.getLayer().client2Viewport(Ni(t)))}getClientByViewport(t){return $n(this.getLayer().viewport2Client(Ni(t)))}getClientByCanvas(t){return this.getClientByViewport(this.getViewportByCanvas(t))}getCanvasByClient(t){const e=this.getLayer(),n=e.client2Viewport(Ni(t));return $n(e.viewport2Canvas(n))}toDataURL(){return QN(this,arguments,void 0,function*(t={}){const e=globalThis.devicePixelRatio||1,{mode:n="viewport"}=t,i=tR(t,["mode"]);let[a,s,o,l]=[0,0,0,0];if(n==="viewport")[o,l]=this.getSize();else if(n==="overall"){const b=this.getBounds(),w=Us(b);[a,s]=b.min,[o,l]=w}const u=mw('<div id="virtual-image"></div>'),c=new Rw({width:o,height:l,renderer:new mc,devicePixelRatio:e,container:u,background:this.extends.config.background});yield c.ready,c.appendChild(this.getLayer("background").getRoot().cloneNode(!0)),c.appendChild(this.getRoot().cloneNode(!0));const h=this.getLayer("label").getRoot().cloneNode(!0),d=c.viewport2Canvas({x:0,y:0}),g=this.getCanvasByViewport([0,0]);h.translate([g[0]-d.x,g[1]-d.y]),h.scale(1/this.getCamera().getZoom()),c.appendChild(h),c.appendChild(this.getLayer("transient").getRoot().cloneNode(!0));const p=this.getCamera(),v=c.getCamera();if(n==="viewport")v.setZoom(p.getZoom()),v.setPosition(p.getPosition()),v.setFocalPoint(p.getFocalPoint());else if(n==="overall"){const[b,w,x]=v.getPosition(),[S,_,M]=v.getFocalPoint();v.setPosition([b+a,w+s,x]),v.setFocalPoint([S+a,_+s,M])}const m=c.getContextService();return new Promise(b=>{c.addEventListener($r.RERENDER,()=>QN(this,void 0,void 0,function*(){yield new Promise(x=>setTimeout(x,300));const w=yield m.toDataURL(i);b(w)}))})})}destroy(){Object.values(this.getLayers()).forEach(t=>{t.getCamera().cancelLandmarkAnimation(),t.destroy()})}}function iR(r,t){return Object.fromEntries(t.map(e=>{const n=(r==null?void 0:r(e))||new mc;return n instanceof mc&&n.setConfig({enableDirtyRectangleRendering:!1}),e==="main"?n.registerPlugin(new xgt({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):n.unregisterPlugin(n.getPlugin("dom-interaction")),[e,n]}))}function aR(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 El=r=>r?parseInt(r):0;function _gt(r){const t=getComputedStyle(r),e=r.clientWidth||El(t.width),n=r.clientHeight||El(t.height),i=El(t.paddingLeft)+El(t.paddingRight),a=El(t.paddingTop)+El(t.paddingBottom);return[e-i,n-a]}function sR(r){if(!r)return[0,0];let t=640,e=480;const[n,i]=_gt(r);t=n||t,e=i||e;const a=1,s=1;return[Math.max(bt(t)?t:a,a),Math.max(bt(e)?e:s,s)]}class Lg{constructor(t){this.type=t}}class hn extends Lg{constructor(t,e){super(t),this.data=e}}class hi extends Lg{constructor(t,e,n,i){super(t),this.animationType=e,this.animation=n,this.data=i}}class _l extends Lg{constructor(t,e,n){super(t),this.elementType=e,this.data=n}}class Ud extends Lg{constructor(t,e){super(t),this.data=e}}function xn(r,t){r.emit(t.type,t)}function Sgt(r){if(!r)return null;if(r instanceof $L)return{type:"canvas",element:r};let t=r;for(;t;){if(Wc(t))return{type:"node",element:t};if(UI(t))return{type:"edge",element:t};if(aE(t))return{type:"combo",element:t};t=t.parentElement}return null}function oR(r){var t;return((t=r==null?void 0:r.style)===null||t===void 0?void 0:t.zIndex)||0}const lc="cachedStyle",QE=r=>`__${r}__`;function Mgt(r,t){const e=Array.isArray(t)?t:[t];sr(r,lc)||hc(r,lc,{}),e.forEach(n=>{hc(sr(r,lc),QE(n),r.attributes[n])})}function lR(r,t){return sr(r,[lc,QE(t)])}function kgt(r,t){return QE(t)in(sr(r,lc)||{})}class Cgt{constructor(t){this.tasks=[],this.animations=new Set,this.context=t}getTasks(){const t=[...this.tasks];return this.tasks=[],t}add(t,e){this.tasks.push([t,e])}animate(t,e,n){var i,a,s;(i=e==null?void 0:e.before)===null||i===void 0||i.call(e);const o=this.getTasks().map(([u,c])=>{var h,d,g;const{element:p,elementType:v,stage:m}=u,b=JY(this.context.options,v,m,t);(h=c==null?void 0:c.before)===null||h===void 0||h.call(c);const w=b.length?tX(p,this.inferStyle(u,n),b):null;return w?((d=c==null?void 0:c.beforeAnimate)===null||d===void 0||d.call(c,w),w.finished.then(()=>{var x,S;(x=c==null?void 0:c.afterAnimate)===null||x===void 0||x.call(c,w),(S=c==null?void 0:c.after)===null||S===void 0||S.call(c),this.animations.delete(w)})):(g=c==null?void 0:c.after)===null||g===void 0||g.call(c),w}).filter(Boolean);o.forEach(u=>this.animations.add(u));const l=Vx(o);return l?((a=e==null?void 0:e.beforeAnimate)===null||a===void 0||a.call(e,l),l.finished.then(()=>{var u,c;(u=e==null?void 0:e.afterAnimate)===null||u===void 0||u.call(e,l),(c=e==null?void 0:e.after)===null||c===void 0||c.call(e),this.release()})):(s=e==null?void 0:e.after)===null||s===void 0||s.call(e),l}inferStyle(t,e){var n,i;const{element:a,elementType:s,stage:o,originalStyle:l,updatedStyle:u={}}=t;t.modifiedStyle||(t.modifiedStyle=Object.assign(Object.assign({},l),u));const{modifiedStyle:c}=t,h={},d={};if(o==="enter")Object.assign(h,{opacity:0});else if(o==="exit")Object.assign(d,{opacity:0});else if(o==="show")Object.assign(h,{opacity:0}),Object.assign(d,{opacity:(n=lR(a,"opacity"))!==null&&n!==void 0?n:pc("opacity")});else if(o==="hide")Object.assign(h,{opacity:(i=lR(a,"opacity"))!==null&&i!==void 0?i:pc("opacity")}),Object.assign(d,{opacity:0});else if(o==="collapse"){const{collapse:g}=e||{},{target:p,descendants:v,position:m}=g;if(s==="node"){if(v.includes(a.id)){const[b,w,x]=m;Object.assign(d,{x:b,y:w,z:x})}}else if(s==="combo"){if(a.id===p||v.includes(a.id)){const[b,w]=m;Object.assign(d,{x:b,y:w,childrenNode:l.childrenNode})}}else s==="edge"&&Object.assign(d,{sourceNode:c.sourceNode,targetNode:c.targetNode})}else if(o==="expand"){const{expand:g}=e||{},{target:p,descendants:v,position:m}=g;if(s==="node"){if(a.id===p||v.includes(a.id)){const[b,w,x]=m;Object.assign(h,{x:b,y:w,z:x})}}else if(s==="combo"){if(a.id===p||v.includes(a.id)){const[b,w,x]=m;Object.assign(h,{x:b,y:w,z:x,childrenNode:c.childrenNode})}}else s==="edge"&&Object.assign(h,{sourceNode:c.sourceNode,targetNode:c.targetNode})}return[Object.keys(h).length>0?Object.assign({},l,h):l,Object.keys(d).length>0?Object.assign({},c,d):c]}stop(){this.animations.forEach(t=>t.cancel())}clear(){this.tasks=[]}release(){var t,e;const{canvas:n}=this.context,i=(e=(t=n.document)===null||t===void 0?void 0:t.timeline)===null||e===void 0?void 0:e.animationsWithPromises;i&&(n.document.timeline.animationsWithPromises=i.filter(a=>a.playState!=="finished"))}destroy(){this.stop(),this.animations.clear(),this.tasks=[]}}class Tgt{constructor(t){this.batchCount=0,this.context=t}emit(t){const{graph:e}=this.context;e.emit(t.type,t)}startBatch(t=!0){this.batchCount++,this.batchCount===1&&this.emit(new hn(lt.BATCH_START,{initiate:t}))}endBatch(){this.batchCount--,this.batchCount===0&&this.emit(new hn(lt.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class Ogt extends Yx{constructor(t){super(t),this.currentTarget=null,this.currentTargetType=null,this.category="behavior",this.forwardCanvasEvents=e=>{const{target:n}=e,i=Sgt(n);if(!i)return;const{graph:a,canvas:s}=this.context,{type:o,element:l}=i;if("destroyed"in l&&(S0(l)||l.destroyed))return;const{type:u,detail:c,button:h}=e,d=Object.assign(Object.assign({},e),{target:l,targetType:o,originalTarget:n});u===J.POINTER_MOVE&&(this.currentTarget!==l&&(this.currentTarget&&a.emit(`${this.currentTargetType}:${J.POINTER_LEAVE}`,Object.assign(Object.assign({},d),{type:J.POINTER_LEAVE,target:this.currentTarget,targetType:this.currentTargetType})),l&&(Object.assign(d,{type:J.POINTER_ENTER}),a.emit(`${o}:${J.POINTER_ENTER}`,d))),this.currentTarget=l,this.currentTargetType=o),u===J.CLICK&&h===2||(a.emit(`${o}:${u}`,d),a.emit(u,d)),u===J.CLICK&&c===2&&(Object.assign(d,{type:J.DBLCLICK}),a.emit(`${o}:${J.DBLCLICK}`,d),a.emit(J.DBLCLICK,d)),u===J.POINTER_DOWN&&h===2&&(Object.assign(d,{type:J.CONTEXT_MENU,preventDefault:()=>{var g;(g=s.getContainer())===null||g===void 0||g.addEventListener(J.CONTEXT_MENU,p=>p.preventDefault(),{once:!0})}}),a.emit(`${o}:${J.CONTEXT_MENU}`,d),a.emit(J.CONTEXT_MENU,d))},this.forwardContainerEvents=e=>{this.context.graph.emit(e.type,e)},this.forwardEvents(),this.setBehaviors(this.context.options.behaviors||[])}setBehaviors(t){this.setExtensions(t)}forwardEvents(){const t=this.context.canvas.getContainer();t&&[Nl.KEY_DOWN,Nl.KEY_UP].forEach(n=>{t.addEventListener(n,this.forwardContainerEvents)});const e=this.context.canvas.document;e&&[J.CLICK,J.DBLCLICK,J.POINTER_OVER,J.POINTER_LEAVE,J.POINTER_ENTER,J.POINTER_MOVE,J.POINTER_OUT,J.POINTER_DOWN,J.POINTER_UP,J.CONTEXT_MENU,J.DRAG_START,J.DRAG,J.DRAG_END,J.DRAG_ENTER,J.DRAG_OVER,J.DRAG_LEAVE,J.DROP,J.WHEEL].forEach(n=>{e.addEventListener(n,this.forwardCanvasEvents)})}destroy(){const t=this.context.canvas.getContainer();t&&[Nl.KEY_DOWN,Nl.KEY_UP].forEach(e=>{t.removeEventListener(e,this.forwardContainerEvents)}),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}var kc=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 ps(r,t){const{data:e,style:n}=r,i=kc(r,["data","style"]),{data:a,style:s}=t,o=kc(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 ew(r){const{data:t,style:e}=r,i=kc(r,["data","style"]);return t&&(i.data=Object.assign({},t)),e&&(i.style=Object.assign({},e)),i}function Sl(r={},t={}){const{states:e=[],data:n={},style:i={},children:a=[]}=r,s=kc(r,["states","data","style","children"]),{states:o=[],data:l={},style:u={},children:c=[]}=t,h=kc(t,["states","data","style","children"]),d=(p,v)=>p.length!==v.length?!1:p.every((m,b)=>m===v[b]),g=(p,v)=>{const m=Object.keys(p),b=Object.keys(v);return m.length!==b.length?!1:m.every(w=>p[w]===v[w])};return!(!g(s,h)||!d(a,c)||!d(e,o)||!g(n,l)||!g(i,u))}var Agt=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 nw(r){const{id:t=H(r),style:e,data:n}=r,i=Agt(r,["id","style","data"]),a=Object.assign(Object.assign({},r),{style:Object.assign({},e),data:Object.assign({},n)});return sX(r)?Object.assign({id:t,data:a},i):{id:t,data:a}}function Tn(r){return r.data}function Pgt(r){if(r.hasTreeStructure(jr))return;r.attachTreeStructure(jr);const t=r.getAllEdges();for(const e of t){const{source:n,target:i}=e;r.setParent(i,n,jr)}}class Ngt{constructor(){this.latestRemovedComboIds=new Set,this.comboIds=new Set,this.changes=[],this.batchCount=0,this.isTraceless=!1,this.enableUpdateNodeLikeHierarchy=!0,this.model=new Mn}pushChange(t){if(this.isTraceless)return;const{type:e}=t;if(e===Ie.NodeUpdated||e===Ie.EdgeUpdated||e===Ie.ComboUpdated){const{value:n,original:i}=t;this.changes.push({value:ew(n),original:ew(i),type:e})}else this.changes.push({value:ew(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=Tn(n);return this.isCombo(H(i))||(t===void 0||t.includes(H(i)))&&e.push(i),e},[])}getEdgeDatum(t){return Tn(this.model.getEdge(t))}getEdgeData(t){return this.model.getAllEdges().reduce((e,n)=>{const i=Tn(n);return(t===void 0||t.includes(H(i)))&&e.push(i),e},[])}getComboData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=Tn(n);return this.isCombo(H(i))&&(t===void 0||t.includes(H(i)))&&e.push(i),e},[])}getRootsData(t=jr){return this.model.getRoots(t).map(Tn)}getAncestorsData(t,e){const{model:n}=this;return!n.hasNode(t)||!n.hasTreeStructure(e)?[]:n.getAncestors(t,e).map(Tn)}getDescendantsData(t){const e=this.getElementDataById(t),n=[];return To(e,i=>{i!==e&&n.push(i)},i=>this.getChildrenData(H(i)),"TB"),n}getParentData(t,e){const{model:n}=this;if(!e){oa.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?Tn(i):void 0}getChildrenData(t){const e=this.getElementType(t)==="node"?jr:we,{model:n}=this;return!n.hasNode(t)||!n.hasTreeStructure(e)?[]:n.getChildren(t,e).map(Tn)}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 Tn(e)}getNodeLikeData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=Tn(n);return t?t.includes(H(i))&&e.push(i):e.push(i),e},[])}getElementDataByState(t,e){return this.getElementsDataByType(t).filter(i=>{var a;return(a=i.states)===null||a===void 0?void 0:a.includes(e)})}getElementState(t){var e;return((e=this.getElementDataById(t))===null||e===void 0?void 0:e.states)||[]}hasNode(t){return this.model.hasNode(t)&&!this.isCombo(t)}hasEdge(t){return this.model.hasEdge(t)}hasCombo(t){return this.model.hasNode(t)&&this.isCombo(t)}getRelatedEdgesData(t,e="both"){return this.model.getRelatedEdges(t,e).map(Tn)}getNeighborNodesData(t){return this.model.getNeighbors(t).map(Tn)}setData(t){const{nodes:e=[],edges:n=[],combos:i=[]}=t,{nodes:a,edges:s,combos:o}=this.getData(),l=Ns(a,e,h=>H(h),Sl),u=Ns(s,n,h=>H(h),Sl),c=Ns(o,i,h=>H(h),Sl);this.batch(()=>{const h={nodes:l.enter,edges:u.enter,combos:c.enter};this.addData(h),this.computeZIndex(h,"add",!0);const d={nodes:l.update,edges:u.update,combos:c.update};this.updateData(d),this.computeZIndex(d,"update",!0);const g={nodes:l.exit.map(H),edges:u.exit.map(H),combos:c.exit.map(H)};this.removeData(g)})}addData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.addComboData(i),this.addNodeData(e),this.addEdgeData(n)}),this.computeZIndex(t,"add")}addNodeData(t=[]){t.length&&(this.model.addNodes(t.map(e=>(this.pushChange({value:e,type:Ie.NodeAdded}),nw(e)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({nodes:t},"add"))}addEdgeData(t=[]){t.length&&(this.model.addEdges(t.map(e=>(this.pushChange({value:e,type:Ie.EdgeAdded}),nw(e)))),this.computeZIndex({edges:t},"add"))}addComboData(t=[]){if(!t.length)return;const{model:e}=this;e.hasTreeStructure(we)||e.attachTreeStructure(we),e.addNodes(t.map(n=>(this.comboIds.add(H(n)),this.pushChange({value:n,type:Ie.ComboAdded}),nw(n)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({combos:t},"add")}addChildrenData(t,e){const n=this.getNodeLikeDatum(t),i=e.map(H);this.addNodeData(e),this.updateNodeData([{id:t,children:[...n.children||[],...i]}]),this.addEdgeData(i.map(a=>({source:t,target:a})))}computeZIndex(t,e,n=!1){!n&&this.isBatching()||this.batch(()=>{const{nodes:i=[],edges:a=[],combos:s=[]}=t;s.forEach(o=>{var l,u,c;const h=H(o);if(e==="add"&&bt((l=o.style)===null||l===void 0?void 0:l.zIndex)||e==="update"&&!("combo"in o))return;const d=this.getParentData(h,we),g=d?((c=(u=d.style)===null||u===void 0?void 0:u.zIndex)!==null&&c!==void 0?c:0)+1:0;this.preventUpdateNodeLikeHierarchy(()=>{this.updateComboData([{id:h,style:{zIndex:g}}])})}),i.forEach(o=>{var l,u,c;const h=H(o);if(e==="add"&&bt((l=o.style)===null||l===void 0?void 0:l.zIndex)||e==="update"&&!("combo"in o)&&!("children"in o))return;let d=0;const g=this.getParentData(h,we);if(g)d=(((u=g.style)===null||u===void 0?void 0:u.zIndex)||0)+1;else{const p=this.getParentData(h,jr);p&&(d=((c=p==null?void 0:p.style)===null||c===void 0?void 0:c.zIndex)||0)}this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:h,style:{zIndex:d}}])})}),a.forEach(o=>{var l,u,c,h,d;if(bt((l=o.style)===null||l===void 0?void 0:l.zIndex))return;let{id:g,source:p,target:v}=o;if(!g)g=H(o);else{const w=this.getEdgeDatum(g);p=w.source,v=w.target}if(!p||!v)return;const m=((c=(u=this.getNodeLikeDatum(p))===null||u===void 0?void 0:u.style)===null||c===void 0?void 0:c.zIndex)||0,b=((d=(h=this.getNodeLikeDatum(v))===null||h===void 0?void 0:h.style)===null||d===void 0?void 0:d.zIndex)||0;this.updateEdgeData([{id:H(o),style:{zIndex:Math.max(m,b)-1}}])})})}getFrontZIndex(t){var e;const n=this.getElementType(t),i=this.getElementDataById(t),a=this.getData();if(Object.assign(a,{[`${n}s`]:a[`${n}s`].filter(s=>H(s)!==t)}),n==="combo"&&!Sr(i)){const s=new Set(this.getAncestorsData(t,we).map(H));a.nodes=a.nodes.filter(o=>!s.has(H(o))),a.combos=a.combos.filter(o=>!s.has(H(o))),a.edges=a.edges.filter(({source:o,target:l})=>!s.has(o)&&!s.has(l))}return Math.max(((e=i.style)===null||e===void 0?void 0:e.zIndex)||0,0,...Object.values(a).flat().map(s=>{var o;return(((o=s==null?void 0:s.style)===null||o===void 0?void 0:o.zIndex)||0)+1}))}updateNodeLikeHierarchy(t){if(!this.enableUpdateNodeLikeHierarchy)return;const{model:e}=this;t.forEach(n=>{const i=H(n),a=md(n);a!==void 0&&(e.hasTreeStructure(we)||e.attachTreeStructure(we),a===null&&this.refreshComboData(i),this.setParent(i,md(n),we));const s=n.children||[];if(s.length){e.hasTreeStructure(jr)||e.attachTreeStructure(jr);const o=s.filter(l=>e.hasNode(l));o.forEach(l=>this.setParent(l,i,jr)),o.length!==s.length&&this.updateNodeData([{id:i,children:o}])}})}preventUpdateNodeLikeHierarchy(t){this.enableUpdateNodeLikeHierarchy=!1,t(),this.enableUpdateNodeLikeHierarchy=!0}updateData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.updateNodeData(e),this.updateComboData(i),this.updateEdgeData(n)}),this.computeZIndex(t,"update")}updateNodeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{const n=[];t.forEach(i=>{const a=H(i),s=Tn(e.getNode(a));if(Sl(s,i))return;const o=ps(s,i);this.pushChange({value:o,original:s,type:Ie.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:Ie.NodeUpdated})}),e.forEach(i=>{this.pushChange({value:i,original:i,type:Ie.EdgeUpdated})}),n.forEach(i=>{this.pushChange({value:i,original:i,type:Ie.ComboUpdated})})}syncNodeLikeDatum(t){const{model:e}=this,n=H(t);if(!e.hasNode(n))return;const i=Tn(e.getNode(n)),a=ps(i,t);e.mergeNodeData(n,a)}syncEdgeDatum(t){const{model:e}=this,n=H(t);if(!e.hasEdge(n))return;const i=Tn(e.getEdge(n)),a=ps(i,t);e.mergeEdgeData(n,a)}updateEdgeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{t.forEach(n=>{const i=H(n),a=Tn(e.getEdge(i));if(Sl(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=ps(a,n);this.pushChange({value:s,original:a,type:Ie.EdgeUpdated}),e.mergeEdgeData(i,s)})}),this.computeZIndex({edges:t},"update")}updateComboData(t=[]){if(!t.length)return;const{model:e}=this;e.batch(()=>{const n=[];t.forEach(i=>{const a=H(i),s=Tn(e.getNode(a));if(Sl(s,i))return;const o=ps(s,i);this.pushChange({value:o,original:s,type:Ie.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=md(a);if(s!==e&&n===we){const o={id:t,combo:e};this.isCombo(t)?this.syncNodeLikeDatum(o):this.syncNodeLikeDatum(o)}this.model.setParent(t,e,n),i&&n===we&&xW([s,e]).forEach(o=>{o!==void 0&&this.refreshComboData(o)})}refreshComboData(t){const e=this.getComboData([t])[0],n=this.getAncestorsData(t,we);e&&this.pushChange({value:e,original:e,type:Ie.ComboUpdated}),n.forEach(i=>{this.pushChange({value:i,original:i,type:Ie.ComboUpdated})})}getElementPosition(t){const e=this.getElementDataById(t);return on(e)}translateNodeLikeBy(t,e){this.isCombo(t)?this.translateComboBy(t,e):this.translateNodeBy(t,e)}translateNodeLikeTo(t,e){this.isCombo(t)?this.translateComboTo(t,e):this.translateNodeTo(t,e)}translateNodeBy(t,e){const n=this.getElementPosition(t),i=Lt(n,[...e,0].slice(0,3));this.translateNodeTo(t,i)}translateNodeTo(t,e){const[n=0,i=0,a=0]=e;this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:t,style:{x:n,y:i,z:a}}])})}translateComboBy(t,e){const[n=0,i=0,a=0]=e;if([n,i,a].some(isNaN)||[n,i,a].every(l=>l===0))return;const s=this.getComboData([t])[0];if(!s)return;const o=new Set;To(s,l=>{const u=H(l);if(o.has(u))return;o.add(u);const[c,h,d]=on(l),g=ps(l,{style:{x:c+n,y:h+i,z:d+a}});this.pushChange({value:g,original:l,type:this.isCombo(u)?Ie.ComboUpdated:Ie.NodeUpdated}),this.model.mergeNodeData(u,g)},l=>this.getChildrenData(H(l)),"BT")}translateComboTo(t,e){var n;if(e.some(isNaN))return;const[i=0,a=0,s=0]=e,o=(n=this.getComboData([t]))===null||n===void 0?void 0:n[0];if(!o)return;const[l,u,c]=on(o),h=i-l,d=a-u,g=s-c;To(o,p=>{const v=H(p),[m,b,w]=on(p),x=ps(p,{style:{x:m+h,y:b+d,z:w+g}});this.pushChange({value:x,original:p,type:this.isCombo(v)?Ie.ComboUpdated:Ie.NodeUpdated}),this.model.mergeNodeData(v,x)},p=>this.getChildrenData(H(p)),"BT")}removeData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.removeEdgeData(n),this.removeNodeData(e),this.removeComboData(i),this.latestRemovedComboIds=new Set(i)})}removeNodeData(t=[]){t.length&&this.batch(()=>{t.forEach(e=>{this.removeEdgeData(this.getRelatedEdgesData(e).map(H)),this.pushChange({value:this.getNodeData([e])[0],type:Ie.NodeRemoved}),this.removeNodeLikeHierarchy(e)}),this.model.removeNodes(t)})}removeEdgeData(t=[]){t.length&&(t.forEach(e=>this.pushChange({value:this.getEdgeData([e])[0],type:Ie.EdgeRemoved})),this.model.removeEdges(t))}removeComboData(t=[]){t.length&&this.batch(()=>{t.forEach(e=>{this.pushChange({value:this.getComboData([e])[0],type:Ie.ComboRemoved}),this.removeNodeLikeHierarchy(e),this.comboIds.delete(e)}),this.model.removeNodes(t)})}removeNodeLikeHierarchy(t){if(this.model.hasTreeStructure(we)){const e=md(this.getNodeLikeDatum(t));this.setParent(t,void 0,we,!1),this.model.getChildren(t,we).forEach(n=>{const i=Tn(n),a=H(i);this.setParent(H(i),e,we,!1);const s=ps(i,{id:H(i),combo:e});this.pushChange({value:s,original:i,type:this.isCombo(a)?Ie.ComboUpdated:Ie.NodeUpdated}),this.model.mergeNodeData(H(i),s)}),kt(e)||this.refreshComboData(e)}}getElementType(t){if(this.model.hasNode(t))return this.isCombo(t)?"combo":"node";if(this.model.hasEdge(t))return"edge";throw new Error(La(`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 Iu=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Rgt{constructor(t){this.elementMap={},this.shapeTypeMap={},this.paletteStyle={},this.defaultStyle={},this.stateStyle={},this.visibilityCache=new WeakMap,this.context=t}init(){this.initContainer()}initContainer(){if(!this.container||this.container.destroyed){const{canvas:t}=this.context;this.container=t.appendChild(new _n({className:"elements"}))}}emit(t,e){e.silence||xn(this.context.graph,t)}forEachElementData(t){zo.forEach(e=>{const n=this.context.model.getElementsDataByType(e);t(e,n)})}getElementType(t,e){var n;const{options:i,graph:a}=this.context,s=((n=i[t])===null||n===void 0?void 0:n.type)||e.type;return s?typeof s=="string"?s:s.call(a,e):t==="edge"?"line":"circle"}getTheme(t){return JL(this.context.options)[t]||{}}getThemeStyle(t){return this.getTheme(t).style||{}}getThemeStateStyle(t,e){const{state:n={}}=this.getTheme(t);return Object.assign({},...e.map(i=>n[i]||{}))}computePaletteStyle(){const{options:t}=this.context;this.paletteStyle={},this.forEachElementData((e,n)=>{var i,a;const s=Object.assign({},jM((i=this.getTheme(e))===null||i===void 0?void 0:i.palette),jM((a=t[e])===null||a===void 0?void 0:a.palette));s!=null&&s.field&&Object.assign(this.paletteStyle,nK(n,s))})}getPaletteStyle(t,e){const n=this.paletteStyle[e];return n?t==="edge"?{stroke:n}:{fill:n}:{}}computeElementDefaultStyle(t,e){var n;const{options:i}=this.context,a=((n=i[t])===null||n===void 0?void 0:n.style)||{};"transform"in a&&Array.isArray(a.transform)&&(a.transform=[...a.transform]),this.defaultStyle[H(e.datum)]=$M(a,e)}computeElementsDefaultStyle(t){const{graph:e}=this.context;this.forEachElementData((n,i)=>{const a=i.length;for(let s=0;s<a;s++){const o=i[s];(t===void 0||t.includes(H(o)))&&this.computeElementDefaultStyle(n,{datum:o,graph:e})}})}getDefaultStyle(t){return this.defaultStyle[t]||{}}getElementState(t){try{const{model:e}=this.context;return e.getElementState(t)}catch{return[]}}getElementStateStyle(t,e,n){var i,a;const{options:s}=this.context,o=((a=(i=s[t])===null||i===void 0?void 0:i.state)===null||a===void 0?void 0:a[e])||{};return $M(o,n)}computeElementStatesStyle(t,e,n){this.stateStyle[H(n.datum)]=Object.assign({},...e.map(i=>this.getElementStateStyle(t,i,n)))}computeElementsStatesStyle(t){const{graph:e}=this.context;this.forEachElementData((n,i)=>{const a=i.length;for(let s=0;s<a;s++){const o=i[s];if(t===void 0||t.includes(H(o))){const l=this.getElementState(H(o));this.computeElementStatesStyle(n,l,{datum:o,graph:e})}}})}getStateStyle(t){return this.stateStyle[t]||{}}computeStyle(t,e){t&&["translate","zIndex"].includes(t)||(this.computePaletteStyle(),this.computeElementsDefaultStyle(e),this.computeElementsStatesStyle(e))}getElement(t){return this.elementMap[t]}getNodes(){return this.context.model.getNodeData().map(({id:t})=>this.elementMap[t])}getEdges(){return this.context.model.getEdgeData().map(t=>this.elementMap[H(t)])}getCombos(){return this.context.model.getComboData().map(({id:t})=>this.elementMap[t])}getElementComputedStyle(t,e){const n=H(e),i=this.getThemeStyle(t),a=this.getPaletteStyle(t,n),s=e.style||{},o=this.getDefaultStyle(n),l=this.getThemeStateStyle(t,this.getElementState(n)),u=this.getStateStyle(n),c=Object.assign({},i,a,s,o,l,u);if(t==="combo"){const h=this.context.model.getChildrenData(n),g=!!c.collapsed?[]:h.map(H).filter(p=>this.getElement(p));Object.assign(c,{childrenNode:g,childrenData:h})}return c}getDrawData(t){this.init();const e=this.computeChangesAndDrawData(t);if(!e)return null;const{type:n="draw",stage:i=n}=t;return this.markDestroyElement(e.drawData),this.computeStyle(i),{type:n,stage:i,data:e}}draw(t={animation:!0}){const e=this.getDrawData(t);if(!e)return;const{data:{drawData:{add:n,update:i,remove:a}}}=e;return this.destroyElements(a,t),this.createElements(n,t),this.updateElements(i,t),this.setAnimationTask(t,e)}preLayoutDraw(){return Iu(this,arguments,void 0,function*(t={animation:!0}){var e,n;const i=this.getDrawData(t);if(!i)return;const{data:{drawData:a}}=i;yield(n=(e=this.context.layout)===null||e===void 0?void 0:e.preLayout)===null||n===void 0?void 0:n.call(e,a);const{add:s,update:o,remove:l}=a;return this.destroyElements(l,t),this.createElements(s,t),this.updateElements(o,t),this.setAnimationTask(t,i)})}setAnimationTask(t,e){const{animation:n,silence:i}=t,{data:{dataChanges:a,drawData:s},stage:o,type:l}=e;return this.context.animation.animate(n,i?{}:{before:()=>this.emit(new hn(lt.BEFORE_DRAW,{dataChanges:a,animation:n,stage:o,render:l==="render"}),t),beforeAnimate:u=>this.emit(new hi(lt.BEFORE_ANIMATE,br.DRAW,u,s),t),afterAnimate:u=>this.emit(new hi(lt.AFTER_ANIMATE,br.DRAW,u,s),t),after:()=>this.emit(new hn(lt.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=zE(n);if(i.length===0)return null;const{NodeAdded:a=[],NodeUpdated:s=[],NodeRemoved:o=[],EdgeAdded:l=[],EdgeUpdated:u=[],EdgeRemoved:c=[],ComboAdded:h=[],ComboUpdated:d=[],ComboRemoved:g=[]}=a0(i,b=>b.type),p=b=>new Map(b.map(w=>{const x=w.value;return[H(x),x]})),v={add:{nodes:p(a),edges:p(l),combos:p(h)},update:{nodes:p(s),edges:p(u),combos:p(d)},remove:{nodes:p(o),edges:p(c),combos:p(g)}},m=this.transformData(v,t);return e.clearChanges(),{dataChanges:n,drawData:m}}transformData(t,e){const n=this.context.transform.getTransformInstance();return Object.values(n).reduce((i,a)=>a.beforeDraw(i,e),t)}createElement(t,e,n){var i;const a=H(e);if(this.getElement(a))return;const o=this.getElementType(t,e),l=this.getElementComputedStyle(t,e),u=qa(t,o);if(!u)return oa.warn(`The element ${o} of ${t} is not registered.`);this.emit(new _l(lt.BEFORE_ELEMENT_CREATE,t,e),n);const c=this.container.appendChild(new u({id:a,context:this.context,style:l}));this.shapeTypeMap[a]=o,this.elementMap[a]=c;const{stage:h="enter"}=n;(i=this.context.animation)===null||i===void 0||i.add({element:c,elementType:t,stage:h,originalStyle:Object.assign({},c.attributes),updatedStyle:l},{after:()=>{var d;this.emit(new _l(lt.AFTER_ELEMENT_CREATE,t,e),n),(d=c.onCreate)===null||d===void 0||d.call(c)}})}createElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["node",n],["combo",a],["edge",i]].forEach(([o,l])=>{l.forEach(u=>this.createElement(o,u,e))})}getUpdateStageStyle(t,e,n){const{stage:i="update"}=n;if(i==="translate")if(t==="node"||t==="combo"){const{style:{x:a=0,y:s=0,z:o=0}={}}=e;return{x:a,y:s,z:o}}else return{};return this.getElementComputedStyle(t,e)}updateElement(t,e,n){var i;const a=H(e),{stage:s="update"}=n,o=this.getElement(a);if(!o)return()=>null;this.emit(new _l(lt.BEFORE_ELEMENT_UPDATE,t,e),n);const l=this.getElementType(t,e),u=this.getUpdateStageStyle(t,e,n);this.shapeTypeMap[a]!==l&&(o.destroy(),delete this.shapeTypeMap[a],delete this.elementMap[a],this.createElement(t,e,{animation:!1,silence:!0}));const c=s!=="visibility"?s:u.visibility==="hidden"?"hide":"show";c==="hide"&&delete u.visibility,(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:t,stage:c,originalStyle:Object.assign({},o.attributes),updatedStyle:u},{before:()=>{const h=this.elementMap[a];s!=="collapse"&&Gw(h,u),s==="visibility"&&(kgt(h,"opacity")||Mgt(h,"opacity"),this.visibilityCache.set(h,c==="show"?"visible":"hidden"),c==="show"&&Fo(h,"visible"))},after:()=>{var h;const d=this.elementMap[a];s==="collapse"&&Gw(d,u),c==="hide"&&Fo(d,this.visibilityCache.get(d)),this.emit(new _l(lt.AFTER_ELEMENT_UPDATE,t,e),n),(h=d.onUpdate)===null||h===void 0||h.call(d)}})}updateElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["node",n],["combo",a],["edge",i]].forEach(([o,l])=>{l.forEach(u=>this.updateElement(o,u,e))})}markDestroyElement(t){Object.values(t.remove).forEach(e=>{e.forEach(n=>{const i=H(n),a=this.getElement(i);a&&tJ(a)})})}destroyElement(t,e,n){var i;const{stage:a="exit"}=n,s=H(e),o=this.elementMap[s];if(!o)return()=>null;this.emit(new _l(lt.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 _l(lt.AFTER_ELEMENT_DESTROY,t,e),n)}})}destroyElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["combo",a],["edge",i],["node",n]].forEach(([o,l])=>{l.forEach(u=>this.destroyElement(o,u,e))})}clearElement(t){delete this.paletteStyle[t],delete this.defaultStyle[t],delete this.stateStyle[t],delete this.elementMap[t],delete this.shapeTypeMap[t]}alignLayoutResultToElement(t,e){var n,i;const a=(n=t.nodes)===null||n===void 0?void 0:n.find(s=>H(s)===e);if(a){const s=on(this.context.model.getNodeLikeDatum(e)),o=on(a),l=be(s,o);(i=t.nodes)===null||i===void 0||i.forEach(u=>{var c,h,d;!((c=u.style)===null||c===void 0)&&c.x&&(u.style.x+=l[0]),!((h=u.style)===null||h===void 0)&&h.y&&(u.style.y+=l[1]),!((d=u.style)===null||d===void 0)&&d.z&&(u.style.z+=l[2]||0)})}}collapseNode(t,e){return Iu(this,void 0,void 0,function*(){var n;const{animation:i,align:a}=e,{model:s,layout:o}=this.context,l=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!l)return;this.markDestroyElement(l.drawData);const u=yield o.simulate();a&&this.alignLayoutResultToElement(u,t),s.updateData(u);const c=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!c)return;const{drawData:h}=c,{add:d,remove:g,update:p}=h;this.markDestroyElement(h);const v={animation:i,stage:"collapse",data:h};this.destroyElements(g,v),this.createElements(d,v),this.updateElements(p,v),yield(n=this.context.animation.animate(i,{beforeAnimate:m=>this.emit(new hi(lt.BEFORE_ANIMATE,br.COLLAPSE,m,h),v),afterAnimate:m=>this.emit(new hi(lt.AFTER_ANIMATE,br.COLLAPSE,m,h),v)},{collapse:{target:t,descendants:Array.from(g.nodes).map(([,m])=>H(m)),position:on(p.nodes.get(t))}}))===null||n===void 0?void 0:n.finished})}expandNode(t,e){return Iu(this,void 0,void 0,function*(){var n;const{model:i,layout:a}=this.context,{animation:s,align:o}=e,l=on(i.getNodeData([t])[0]),u=this.computeChangesAndDrawData({stage:"expand",animation:s});if(!u)return;const{drawData:{add:c}}=u;this.createElements(c,{animation:!1,stage:"expand",target:t}),this.context.animation.clear();const h=yield a.simulate();o&&this.alignLayoutResultToElement(h,t),i.updateData(h),this.computeStyle("expand");const d=this.computeChangesAndDrawData({stage:"collapse",animation:s});if(!d)return;const{drawData:g}=d,{update:p}=g,v={animation:s,stage:"expand",data:g};c.edges.forEach(m=>p.edges.set(H(m),m)),c.nodes.forEach(m=>p.nodes.set(H(m),m)),this.updateElements(p,v),yield(n=this.context.animation.animate(s,{beforeAnimate:m=>this.emit(new hi(lt.BEFORE_ANIMATE,br.EXPAND,m,g),v),afterAnimate:m=>this.emit(new hi(lt.AFTER_ANIMATE,br.EXPAND,m,g),v)},{expand:{target:t,descendants:Array.from(c.nodes).map(([,m])=>H(m)),position:l}}))===null||n===void 0?void 0:n.finished})}collapseCombo(t,e){return Iu(this,void 0,void 0,function*(){var n;const{model:i,element:a}=this.context;if(i.getAncestorsData(t,we).some(v=>Sr(v)))return;const s=a.getElement(t),o=s.getComboPosition(Object.assign(Object.assign({},s.attributes),{collapsed:!0})),l=this.computeChangesAndDrawData({stage:"collapse",animation:e});if(!l)return;const{dataChanges:u,drawData:c}=l;this.markDestroyElement(c);const{update:h,remove:d}=c,g={animation:e,stage:"collapse",data:c};this.destroyElements(d,g),this.updateElements(h,g);const p=v=>Array.from(v).map(([,m])=>H(m));yield(n=this.context.animation.animate(e,{before:()=>this.emit(new hn(lt.BEFORE_DRAW,{dataChanges:u,animation:e}),g),beforeAnimate:v=>this.emit(new hi(lt.BEFORE_ANIMATE,br.COLLAPSE,v,c),g),afterAnimate:v=>this.emit(new hi(lt.AFTER_ANIMATE,br.COLLAPSE,v,c),g),after:()=>this.emit(new hn(lt.AFTER_DRAW,{dataChanges:u,animation:e}),g)},{collapse:{target:t,descendants:[...p(d.nodes),...p(d.combos)],position:o}}))===null||n===void 0?void 0:n.finished})}expandCombo(t,e){return Iu(this,void 0,void 0,function*(){var n;const{model:i}=this.context,a=on(i.getComboData([t])[0]);this.computeStyle("expand");const s=this.computeChangesAndDrawData({stage:"expand",animation:e});if(!s)return;const{dataChanges:o,drawData:l}=s,{add:u,update:c}=l,h={animation:e,stage:"expand",data:l,target:t};this.createElements(u,h),this.updateElements(c,h);const d=g=>Array.from(g).map(([,p])=>H(p));yield(n=this.context.animation.animate(e,{before:()=>this.emit(new hn(lt.BEFORE_DRAW,{dataChanges:o,animation:e}),h),beforeAnimate:g=>this.emit(new hi(lt.BEFORE_ANIMATE,br.EXPAND,g,l),h),afterAnimate:g=>this.emit(new hi(lt.AFTER_ANIMATE,br.EXPAND,g,l),h),after:()=>this.emit(new hn(lt.AFTER_DRAW,{dataChanges:o,animation:e}),h)},{expand:{target:t,descendants:[...d(u.nodes),...d(u.combos)],position:a}}))===null||n===void 0?void 0:n.finished})}clear(){this.container.destroy(),this.initContainer(),this.elementMap={},this.shapeTypeMap={},this.defaultStyle={},this.stateStyle={},this.paletteStyle={}}destroy(){this.clear(),this.container.destroy(),this.context={}}}var Ml=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})},Lgt=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 Igt{get presetOptions(){return{animation:!!QL(this.context.options,!0)}}get options(){const{options:t}=this.context;return t.layout}constructor(t){this.instances=[],this.context=t}getLayoutInstance(){return this.instances}preLayout(t){return Ml(this,void 0,void 0,function*(){var e,n,i,a;const{graph:s,model:o}=this.context,{add:l}=t;xn(s,new hn(lt.BEFORE_LAYOUT,{type:"pre"}));const u=yield(e=this.context.layout)===null||e===void 0?void 0:e.simulate();(n=u==null?void 0:u.nodes)===null||n===void 0||n.forEach(c=>{const h=H(c),d=l.nodes.get(h);o.syncNodeLikeDatum(c),d&&Object.assign(d.style,c.style)}),(i=u==null?void 0:u.edges)===null||i===void 0||i.forEach(c=>{const h=H(c),d=l.edges.get(h);o.syncEdgeDatum(c),d&&Object.assign(d.style,c.style)}),(a=u==null?void 0:u.combos)===null||a===void 0||a.forEach(c=>{const h=H(c),d=l.combos.get(h);o.syncNodeLikeDatum(c),d&&Object.assign(d.style,c.style)}),xn(s,new hn(lt.AFTER_LAYOUT,{type:"pre"})),this.transformDataAfterLayout("pre",t)})}postLayout(){return Ml(this,arguments,void 0,function*(t=this.options){if(!t)return;const e=Array.isArray(t)?t:[t],{graph:n}=this.context;xn(n,new hn(lt.BEFORE_LAYOUT,{type:"post"}));for(const i of e){const a=e.indexOf(i),s=this.getLayoutData(i),o=Object.assign(Object.assign({},this.presetOptions),i);xn(n,new hn(lt.BEFORE_STAGE_LAYOUT,{options:o,index:a}));const l=yield this.stepLayout(s,o,a);xn(n,new hn(lt.AFTER_STAGE_LAYOUT,{options:o,index:a})),i.animation||this.updateElementPosition(l,!1)}xn(n,new hn(lt.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 Ml(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 Ml(this,void 0,void 0,function*(){return oJ(e)?yield this.treeLayout(t,e,n):yield this.graphLayout(t,e,n)})}graphLayout(t,e,n){return Ml(this,void 0,void 0,function*(){const{animation:i,enableWorker:a,iterations:s=300}=e,o=this.initGraphLayout(e);if(!o)return{};if(this.instances[n]=o,this.instance=o,a){const u=o;return this.supervisor=new vct(u.graphData2LayoutModel(t),u.instance,{iterations:s}),ef(yield this.supervisor.execute())}if(nx(o))return i?yield o.execute(t,{onTick:u=>{this.updateElementPosition(u,!1)}}):(o.execute(t),o.stop(),o.tick(s));const l=yield o.execute(t);if(i){const u=this.updateElementPosition(l,i);yield u==null?void 0:u.finished}return l})}treeLayout(t,e,n){return Ml(this,void 0,void 0,function*(){const{type:i,animation:a}=e,s=qa("layout",i);if(!s)return{};const{nodes:o=[],edges:l=[]}=t,u=new Mn({nodes:o.map(p=>({id:H(p),data:p.data||{}})),edges:l.map(p=>({id:H(p),source:p.source,target:p.target,data:p.data||{}}))});Pgt(u);const c={nodes:[],edges:[]},h={nodes:[],edges:[]};u.getRoots(jr).forEach(p=>{To(p,x=>{x.children=u.getSuccessors(x.id)},x=>u.getSuccessors(x.id),"TB");const v=s(p,e),{x:m,y:b,z:w=0}=v;To(v,x=>{const{id:S,x:_,y:M,z:k=0}=x;c.nodes.push({id:S,style:{x:m,y:b,z:w}}),h.nodes.push({id:S,style:{x:_,y:M,z:k}})},x=>x.children,"TB")});const g=this.inferTreeLayoutOffset(h);if(uR(h,g),a){uR(c,g),this.updateElementPosition(c,!1);const p=this.updateElementPosition(h,a);yield p==null?void 0:p.finished}return h})}inferTreeLayoutOffset(t){var e;let[n,i]=[1/0,-1/0],[a,s]=[1/0,-1/0];(e=t.nodes)===null||e===void 0||e.forEach(v=>{const{x:m=0,y:b=0}=v.style||{};n=Math.min(n,m),i=Math.max(i,m),a=Math.min(a,b),s=Math.max(s,b)});const{canvas:o}=this.context,l=o.getSize(),[u,c]=o.getCanvasByViewport([0,0]),[h,d]=o.getCanvasByViewport(l);if(n>=u&&i<=h&&a>=c&&s<=d)return[0,0];const g=(u+h)/2,p=(c+d)/2;return[g-(n+i)/2,p-(a+s)/2]}stopLayout(){this.instance&&nx(this.instance)&&(this.instance.stop(),this.instance=void 0),this.supervisor&&(this.supervisor.stop(),this.supervisor=void 0),this.animationResult&&(this.animationResult.finish(),this.animationResult=void 0)}getLayoutData(t){const{nodeFilter:e=()=>!0,preLayout:n=!1,isLayoutInvisibleNodes:i=!1}=t,{nodes:a,edges:s,combos:o}=this.context.model.getData(),{element:l,model:u}=this.context,c=v=>l.getElement(v),h=n?v=>{var m;return!i&&(((m=v.style)===null||m===void 0?void 0:m.visibility)==="hidden"||u.getAncestorsData(v.id,jr).some(Sr)||u.getAncestorsData(v.id,we).some(Sr))?!1:e(v)}:v=>{const m=H(v),b=c(m);return!b||S0(b)?!1:e(v)},d=a.filter(h),g=new Map(d.map(v=>[H(v),v]));o.forEach(v=>g.set(H(v),v));const p=s.filter(({source:v,target:m})=>g.has(v)&&g.has(m));return{nodes:d,edges:p,combos:o}}initGraphLayout(t){var e;const{element:n,viewport:i}=this.context,{type:a,enableWorker:s,animation:o,iterations:l}=t,u=Lgt(t,["type","enableWorker","animation","iterations"]),[c,h]=i.getCanvasSize(),d=[c/2,h/2],g=(e=t==null?void 0:t.nodeSize)!==null&&e!==void 0?e:w=>{const x=n==null?void 0:n.getElement(w.id);return x?x.attributes.size:n==null?void 0:n.getElementComputedStyle("node",w).size},p=qa("layout",a);if(!p)return oa.warn(`The layout of ${a} is not registered.`);const v=Object.getPrototypeOf(p.prototype)===O0.prototype?p:uJ(p,this.context),m=new v(this.context),b={nodeSize:g,width:c,height:h,center:d};switch(m.id){case"d3-force":case"d3-force-3d":Object.assign(b,{center:{x:c/2,y:h/2,z:0}});break}return cr(m.options,b,u),m}updateElementPosition(t,e){const{model:n,element:i}=this.context;return i?(n.updateData(t),i.draw({animation:e,silence:!0})):null}destroy(){var t;this.stopLayout(),this.context={},(t=this.supervisor)===null||t===void 0||t.kill(),this.supervisor=void 0,this.instance=void 0,this.instances=[],this.animationResult=void 0}}const uR=(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 Dgt(r){return[Fgt].reduce((e,n)=>n(e),r)}function Fgt(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 Bgt extends Yx{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;oa.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 Yd=["update-related-edges","collapse-expand-node","collapse-expand-combo","get-edge-actual-ends","arrange-draw-order"];class zgt extends Yx{constructor(t){super(t),this.category="transform",this.setTransforms(this.context.options.transforms||[])}getTransforms(){}setTransforms(t){this.setExtensions([...Yd.slice(0,Yd.length-1),...t,Yd[Yd.length-1]])}getTransformInstance(t){return t?this.extensionMap[t]:this.extensionMap}}var Du=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class $gt{get padding(){return la(this.context.options.padding)}get paddingOffset(){const[t,e,n,i]=this.padding,[a,s,o]=[(i-e)/2,(t-n)/2,0];return[a,s,o]}constructor(t){this.landmarkCounter=0,this.context=t;const[e,n]=this.paddingOffset,{zoom:i,rotation:a,x:s=e,y:o=n}=t.options;this.transform({mode:"absolute",scale:i,translate:[s,o],rotate:a},!1)}get camera(){const{canvas:t}=this.context;return new Proxy(t.getCamera(),{get:(e,n)=>{const a=Object.entries(t.getLayers()).filter(([o])=>!["main"].includes(o)).map(([,o])=>o.getCamera()),s=e[n];if(typeof s=="function")return(...o)=>{const l=s.apply(e,o);return a.forEach(u=>{u[n].apply(u,o)}),l}}})}createLandmark(t){return this.camera.createLandmark(`landmark-${this.landmarkCounter++}`,t)}getAnimation(t){const e=QL(this.context.options,t);return e?Ro(Object.assign({},e),["easing","duration"]):!1}getCanvasSize(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e,n]}getCanvasCenter(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e/2,n/2,0]}getViewportCenter(){const[t,e]=this.camera.getPosition();return[t,e,0]}getGraphCenter(){return this.context.graph.getViewportByCanvas(this.getCanvasCenter())}getZoom(){return this.camera.getZoom()}getRotation(){return this.camera.getRoll()}getTranslateOptions(t){const{camera:e}=this,{mode:n,translate:i=[]}=t,a=this.getZoom(),s=e.getPosition(),o=e.getFocalPoint(),[l,u]=this.getCanvasCenter(),[c=0,h=0,d=0]=i,g=Di([-c,-h,-d],a);return n==="relative"?{position:Lt(s,g),focalPoint:Lt(o,g)}:{position:Lt([l,u,s[2]],g),focalPoint:Lt([l,u,o[2]],g)}}getRotateOptions(t){const{mode:e,rotate:n=0}=t;return{roll:e==="relative"?this.camera.getRoll()+n:n}}getZoomOptions(t){const{zoomRange:e}=this.context.options,n=this.camera.getZoom(),{mode:i,scale:a=1}=t;return Ue(i==="relative"?n*a:a,...e)}transform(t,e){return Du(this,void 0,void 0,function*(){const{graph:n}=this.context,{translate:i,rotate:a,scale:s,origin:o}=t;this.cancelAnimation();const l=this.getAnimation(e);if(xn(n,new Ud(lt.BEFORE_TRANSFORM,t)),!a&&s&&!i&&o&&!l){this.camera.setZoomByViewportPoint(this.getZoomOptions(t),o),xn(n,new Ud(lt.AFTER_TRANSFORM,t));return}const u={};if(i&&Object.assign(u,this.getTranslateOptions(t)),bt(a)&&Object.assign(u,this.getRotateOptions(t)),bt(s)&&Object.assign(u,{zoom:this.getZoomOptions(t)}),l)return xn(n,new hi(lt.BEFORE_ANIMATE,br.TRANSFORM,null,t)),new Promise(c=>{this.transformResolver=c,this.camera.gotoLandmark(this.createLandmark(u),Object.assign(Object.assign({},l),{onfinish:()=>{xn(n,new hi(lt.AFTER_ANIMATE,br.TRANSFORM,null,t)),xn(n,new Ud(lt.AFTER_TRANSFORM,t)),this.transformResolver=void 0,c()}}))});this.camera.gotoLandmark(this.createLandmark(u),{duration:0}),xn(n,new Ud(lt.AFTER_TRANSFORM,t))})}fitView(t,e){return Du(this,void 0,void 0,function*(){const[n,i,a,s]=this.padding,{when:o="always",direction:l="both"}=t||{},[u,c]=this.context.canvas.getSize(),h=u-s-i,d=c-n-a,g=this.context.canvas.getBounds(),p=this.getBBoxInViewport(g),[v,m]=Us(p),b=l==="x"&&v>=h||l==="y"&&m>=d||l==="both"&&v>=h&&m>=d;if(o==="overflow"&&!b)return yield this.fitCenter({animation:e});const w=h/v,x=d/m,S=l==="x"?w:l==="y"?x:Math.min(w,x),_=this.getAnimation(e);yield this.transform({mode:"relative",scale:S,translate:Lt(be(this.getCanvasCenter(),this.getBBoxInViewport(g).center),Di(this.paddingOffset,S))},_)})}fitCenter(t){return Du(this,void 0,void 0,function*(){const e=this.context.canvas.getBounds();yield this.focus(e,t)})}focusElements(t){return Du(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=Fc(e.map(o=>a(i.getElement(o))));yield this.focus(s,n)})}focus(t,e){return Du(this,void 0,void 0,function*(){const n=this.context.graph.getViewportByCanvas(t.center),i=e.position||this.getCanvasCenter(),a=be(i,n);yield this.transform({mode:"relative",translate:Lt(a,this.paddingOffset)},e.animation)})}getBBoxInViewport(t){const{min:e,max:n}=t,{graph:i}=this.context,[a,s]=i.getViewportByCanvas(e),[o,l]=i.getViewportByCanvas(n),u=new Me;return u.setMinMax([a,s,0],[o,l,0]),u}isInViewport(t,e=!1,n=0){const{graph:i}=this.context,a=this.getCanvasSize(),[s,o]=i.getCanvasByViewport([0,0]),[l,u]=i.getCanvasByViewport(a);let c=new Me;return c.setMinMax([s,o,0],[l,u,0]),n&&(c=Ys(c,n)),Ul(t)?Ii(t,c):e?uX(t,c):c.intersects(t)}cancelAnimation(){var t,e;!((t=this.camera.landmarks)===null||t===void 0)&&t.length&&this.camera.cancelLandmarkAnimation(),(e=this.transformResolver)===null||e===void 0||e.call(this)}}var _e=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{u(n.next(c))}catch(h){s(h)}}function l(c){try{u(n.throw(c))}catch(h){s(h)}}function u(c){c.done?a(c.value):i(c.value).then(o,l)}u((n=n.apply(r,t||[])).next())})};class Ig extends T0{constructor(t){var e;super(),this.options={},this.rendered=!1,this.destroyed=!1,this.context={model:new Ngt},this.isCollapsingExpanding=!1,this.onResize=Ac(()=>{this.resize()},300),this._setOptions(Object.assign({},Ig.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,Dgt(t)),e){const{data:d}=t;d&&this.addData(d);return}const{behaviors:n,combo:i,data:a,edge:s,layout:o,node:l,plugins:u,theme:c,transforms:h}=t;n&&this.setBehaviors(n),a&&this.setData(a),l&&this.setNode(l),s&&this.setEdge(s),i&&this.setCombo(i),o&&this.setLayout(o),c&&this.setTheme(c),u&&this.setPlugins(u),h&&this.setTransforms(h)}getSize(){return this.context.canvas?this.context.canvas.getSize():[this.options.width||0,this.options.height||0]}setSize(t,e){t&&(this.options.width=t),e&&(this.options.height=e),this.resize(t,e)}setZoomRange(t){this.options.zoomRange=t}getZoomRange(){return this.options.zoomRange}setNode(t){this.options.node=t,this.context.model.refreshData()}setEdge(t){this.options.edge=t,this.context.model.refreshData()}setCombo(t){this.options.combo=t,this.context.model.refreshData()}getTheme(){return this.options.theme}setTheme(t){this.options.theme=Et(t)?t(this.getTheme()):t}setLayout(t){this.options.layout=Et(t)?t(this.getLayout()):t}getLayout(){return this.options.layout}setBehaviors(t){var e;this.options.behaviors=Et(t)?t(this.getBehaviors()):t,(e=this.context.behavior)===null||e===void 0||e.setBehaviors(this.options.behaviors)}updateBehavior(t){this.setBehaviors(e=>e.map(n=>typeof n=="object"&&n.key===t.key?Object.assign(Object.assign({},n),t):n))}getBehaviors(){return this.options.behaviors||[]}setPlugins(t){var e;this.options.plugins=Et(t)?t(this.getPlugins()):t,(e=this.context.plugin)===null||e===void 0||e.setPlugins(this.options.plugins)}updatePlugin(t){this.setPlugins(e=>e.map(n=>typeof n=="object"&&n.key===t.key?Object.assign(Object.assign({},n),t):n))}getPlugins(){return this.options.plugins||[]}getPluginInstance(t){return this.context.plugin.getPluginInstance(t)}setTransforms(t){var e;this.options.transforms=Et(t)?t(this.getTransforms()):t,(e=this.context.transform)===null||e===void 0||e.setTransforms(this.options.transforms)}updateTransform(t){this.setTransforms(e=>e.map(n=>typeof n=="object"&&n.key===t.key?Object.assign(Object.assign({},n),t):n)),this.context.model.refreshData()}getTransforms(){return this.options.transforms||[]}getData(){return this.context.model.getData()}getElementData(t){return Array.isArray(t)?t.map(e=>this.context.model.getElementDataById(e)):this.context.model.getElementDataById(t)}getNodeData(t){var e;return t===void 0?this.context.model.getNodeData():Array.isArray(t)?this.context.model.getNodeData(t):(e=this.context.model.getNodeData([t]))===null||e===void 0?void 0:e[0]}getEdgeData(t){var e;return t===void 0?this.context.model.getEdgeData():Array.isArray(t)?this.context.model.getEdgeData(t):(e=this.context.model.getEdgeData([t]))===null||e===void 0?void 0:e[0]}getComboData(t){var e;return t===void 0?this.context.model.getComboData():Array.isArray(t)?this.context.model.getComboData(t):(e=this.context.model.getComboData([t]))===null||e===void 0?void 0:e[0]}setData(t){this.context.model.setData(Et(t)?t(this.getData()):t)}addData(t){this.context.model.addData(Et(t)?t(this.getData()):t)}addNodeData(t){this.context.model.addNodeData(Et(t)?t(this.getNodeData()):t)}addEdgeData(t){this.context.model.addEdgeData(Et(t)?t(this.getEdgeData()):t)}addComboData(t){this.context.model.addComboData(Et(t)?t(this.getComboData()):t)}addChildrenData(t,e){this.context.model.addChildrenData(t,e)}updateData(t){this.context.model.updateData(Et(t)?t(this.getData()):t)}updateNodeData(t){this.context.model.updateNodeData(Et(t)?t(this.getNodeData()):t)}updateEdgeData(t){this.context.model.updateEdgeData(Et(t)?t(this.getEdgeData()):t)}updateComboData(t){this.context.model.updateComboData(Et(t)?t(this.getComboData()):t)}removeData(t){this.context.model.removeData(Et(t)?t(this.getData()):t)}removeNodeData(t){this.context.model.removeNodeData(Et(t)?t(this.getNodeData()):t)}removeEdgeData(t){this.context.model.removeEdgeData(Et(t)?t(this.getEdgeData()):t)}removeComboData(t){this.context.model.removeComboData(Et(t)?t(this.getComboData()):t)}getElementType(t){return this.context.model.getElementType(t)}getRelatedEdgesData(t,e="both"){return this.context.model.getRelatedEdgesData(t,e)}getNeighborNodesData(t){return this.context.model.getNeighborNodesData(t)}getAncestorsData(t,e){return this.context.model.getAncestorsData(t,e)}getParentData(t,e){return this.context.model.getParentData(t,e)}getChildrenData(t){return this.context.model.getChildrenData(t)}getDescendantsData(t){return this.context.model.getDescendantsData(t)}getElementDataByState(t,e){return this.context.model.getElementDataByState(t,e)}initCanvas(){return _e(this,void 0,void 0,function*(){var t;if(this.context.canvas)return yield this.context.canvas.ready;const{container:e="container",width:n,height:i,renderer:a,cursor:s,background:o,canvas:l,devicePixelRatio:u=(t=globalThis.devicePixelRatio)!==null&&t!==void 0?t:1}=this.options;if(e instanceof rR)this.context.canvas=e,s&&e.setCursor(s),a&&e.setRenderer(a),yield e.ready;else{const c=oe(e)?document.getElementById(e):e,h=sR(c);this.emit(lt.BEFORE_CANVAS_INIT,{container:c,width:n,height:i});const d=Object.assign(Object.assign({},l),{container:c,width:n||h[0],height:i||h[1],background:o,renderer:a,cursor:s,devicePixelRatio:u}),g=new rR(d);this.context.canvas=g,yield g.ready,this.emit(lt.AFTER_CANVAS_INIT,{canvas:g})}})}updateCanvas(t){var e,n;const{renderer:i,cursor:a,height:s,width:o}=t,l=this.context.canvas;l&&(i&&(this.emit(lt.BEFORE_RENDERER_CHANGE,{renderer:this.options.renderer}),l.setRenderer(i),this.emit(lt.AFTER_RENDERER_CHANGE,{renderer:i})),a&&l.setCursor(a),(bt(o)||bt(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 Tgt(this.context)),this.context.plugin||(this.context.plugin=new Bgt(this.context)),this.context.viewport||(this.context.viewport=new $gt(this.context)),this.context.transform||(this.context.transform=new zgt(this.context)),this.context.element||(this.context.element=new Rgt(this.context)),this.context.animation||(this.context.animation=new Cgt(this.context)),this.context.layout||(this.context.layout=new Igt(this.context)),this.context.behavior||(this.context.behavior=new Ogt(this.context))}prepare(){return _e(this,void 0,void 0,function*(){if(yield Promise.resolve(),this.destroyed)throw new Error(La("The graph instance has been destroyed"));yield this.initCanvas(),this.initRuntime()})}render(){return _e(this,void 0,void 0,function*(){if(yield this.prepare(),xn(this,new hn(lt.BEFORE_RENDER)),this.options.layout)if(!this.rendered&&lJ(this.options.layout)){const t=yield this.context.element.preLayoutDraw({type:"render"});yield Promise.all([t==null?void 0:t.finished,this.autoFit()])}else{const t=this.context.element.draw({type:"render"});yield Promise.all([t==null?void 0:t.finished,this.context.layout.postLayout()]),yield this.autoFit()}else{const t=this.context.element.draw({type:"render"});yield Promise.all([t==null?void 0:t.finished,this.autoFit()])}this.rendered=!0,xn(this,new hn(lt.AFTER_RENDER))})}draw(){return _e(this,void 0,void 0,function*(){var t;yield this.prepare(),yield(t=this.context.element.draw())===null||t===void 0?void 0:t.finished})}layout(t){return _e(this,void 0,void 0,function*(){yield this.context.layout.postLayout(t)})}stopLayout(){this.context.layout.stopLayout()}clear(){return _e(this,void 0,void 0,function*(){const{model:t,element:e}=this.context;t.setData({}),t.clearChanges(),e==null||e.clear()})}destroy(){var t;xn(this,new hn(lt.BEFORE_DESTROY));const{layout:e,animation:n,element:i,model:a,canvas:s,behavior:o,plugin:l}=this.context;l==null||l.destroy(),o==null||o.destroy(),e==null||e.destroy(),n==null||n.destroy(),i==null||i.destroy(),a.destroy(),s==null||s.destroy(),this.options={},this.context={},this.off(),(t=globalThis.removeEventListener)===null||t===void 0||t.call(globalThis,"resize",this.onResize),this.destroyed=!0,xn(this,new hn(lt.AFTER_DESTROY))}getCanvas(){return this.context.canvas}resize(t,e){var n;const i=sR((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();Ye(a,s)||(xn(this,new hn(lt.BEFORE_SIZE_CHANGE,{size:a})),this.context.canvas.resize(...a),xn(this,new hn(lt.AFTER_SIZE_CHANGE,{size:a})))}fitView(t,e){return _e(this,void 0,void 0,function*(){var n;yield(n=this.context.viewport)===null||n===void 0?void 0:n.fitView(t,e)})}fitCenter(t){return _e(this,void 0,void 0,function*(){var e;yield(e=this.context.viewport)===null||e===void 0?void 0:e.fitCenter({animation:t})})}autoFit(){return _e(this,void 0,void 0,function*(){const{autoFit:t}=this.context.options;if(t)if(oe(t))t==="view"?yield this.fitView():t==="center"&&(yield this.fitCenter());else{const{type:e,animation:n}=t;e==="view"?yield this.fitView(t.options,n):e==="center"&&(yield this.fitCenter(n))}})}focusElement(t,e){return _e(this,void 0,void 0,function*(){var n;yield(n=this.context.viewport)===null||n===void 0?void 0:n.focusElements(Array.isArray(t)?t:[t],{animation:e})})}zoomBy(t,e,n){return _e(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",scale:t,origin:n},e)})}zoomTo(t,e,n){return _e(this,void 0,void 0,function*(){this.context.viewport.transform({mode:"absolute",scale:t,origin:n},e)})}getZoom(){return this.context.viewport.getZoom()}rotateBy(t,e,n){return _e(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",rotate:t,origin:n},e)})}rotateTo(t,e,n){return _e(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",rotate:t,origin:n},e)})}getRotation(){return this.context.viewport.getRotation()}translateBy(t,e){return _e(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",translate:t},e)})}translateTo(t,e){return _e(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",translate:t},e)})}getPosition(){return be([0,0],this.getCanvasByViewport([0,0]))}translateElementBy(t,e){return _e(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,u]=sn(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(l).forEach(([c,h])=>this.context.model.translateNodeLikeBy(c,h)),yield(o=this.context.element.draw({animation:u,stage:"translate"}))===null||o===void 0?void 0:o.finished})}translateElementTo(t,e){return _e(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,u]=sn(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(l).forEach(([c,h])=>this.context.model.translateNodeLikeTo(c,h)),yield(o=this.context.element.draw({animation:u,stage:"translate"}))===null||o===void 0?void 0:o.finished})}getElementPosition(t){return this.context.model.getElementPosition(t)}getElementRenderStyle(t){return Px(this.context.element.getElement(t).attributes,["context"])}setElementVisibility(t,e){return _e(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,u]=sn(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],c={nodes:[],edges:[],combos:[]};Object.entries(l).forEach(([g,p])=>{const v=this.getElementType(g);c[`${v}s`].push({id:g,style:{visibility:p}})});const{model:h,element:d}=this.context;h.preventUpdateNodeLikeHierarchy(()=>{h.updateData(c)}),yield(o=d.draw({animation:u,stage:"visibility"}))===null||o===void 0?void 0:o.finished})}showElement(t,e){return _e(this,void 0,void 0,function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map(i=>[i,"visible"])),e)})}hideElement(t,e){return _e(this,void 0,void 0,function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map(i=>[i,"hidden"])),e)})}getElementVisibility(t){var e,n;const i=this.context.element.getElement(t);return(n=(e=i==null?void 0:i.style)===null||e===void 0?void 0:e.visibility)!==null&&n!==void 0?n:"visible"}setElementZIndex(t,e){return _e(this,void 0,void 0,function*(){var n;const i={nodes:[],edges:[],combos:[]},a=sn(t)?t:{[t]:e};Object.entries(a).forEach(([l,u])=>{const c=this.getElementType(l);i[`${c}s`].push({id:l,style:{zIndex:u}})});const{model:s,element:o}=this.context;s.preventUpdateNodeLikeHierarchy(()=>s.updateData(i)),yield(n=o.draw({animation:!1,stage:"zIndex"}))===null||n===void 0?void 0:n.finished})}frontElement(t){return _e(this,void 0,void 0,function*(){const e=Array.isArray(t)?t:[t],{model:n}=this.context,i={};e.map(a=>{const s=n.getFrontZIndex(a);if(n.getElementType(a)==="combo"){const l=n.getAncestorsData(a,we).at(-1)||this.getComboData(a),u=[l,...n.getDescendantsData(H(l))],c=s-oR(l);u.forEach(d=>{i[H(d)]=this.getElementZIndex(H(d))+c});const{internal:h}=qw(u.map(H),d=>n.getRelatedEdgesData(d));h.forEach(d=>{const g=H(d);i[g]=this.getElementZIndex(g)+c})}else i[a]=s}),yield this.setElementZIndex(i)})}getElementZIndex(t){return oR(this.context.model.getElementDataById(t))}setElementState(t,e){return _e(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,u]=sn(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],c=d=>d?Array.isArray(d)?d:[d]:[],h={nodes:[],edges:[],combos:[]};Object.entries(l).forEach(([d,g])=>{const p=this.getElementType(d);h[`${p}s`].push({id:d,states:c(g)})}),this.updateData(h),yield(o=this.context.element.draw({animation:u,stage:"state"}))===null||o===void 0?void 0:o.finished})}getElementState(t){return this.context.model.getElementState(t)}getElementRenderBounds(t){return this.context.element.getElement(t).getRenderBounds()}collapseElement(t){return _e(this,arguments,void 0,function*(e,n=!0){const{model:i,element:a}=this.context;if(Sr(i.getNodeLikeData([e])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!0});const s=i.getElementType(e);yield this.frontElement(e),this.isCollapsingExpanding=!0,this.setElementCollapsibility(e,!0),s==="node"?yield a.collapseNode(e,n):s==="combo"&&(yield a.collapseCombo(e,!!n.animation)),this.isCollapsingExpanding=!1})}expandElement(t){return _e(this,arguments,void 0,function*(e,n=!0){const{model:i,element:a}=this.context;if(!Sr(i.getNodeLikeData([e])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!0});const s=i.getElementType(e);this.isCollapsingExpanding=!0,this.setElementCollapsibility(e,!1),s==="node"?yield a.expandNode(e,n):s==="combo"&&(yield a.expandCombo(e,!!n.animation)),this.isCollapsingExpanding=!1})}setElementCollapsibility(t,e){const n=this.getElementType(t);n==="node"?this.updateNodeData([{id:t,style:{collapsed:e}}]):n==="combo"&&this.updateComboData([{id:t,style:{collapsed:e}}])}toDataURL(){return _e(this,arguments,void 0,function*(t={}){return this.context.canvas.toDataURL(t)})}getCanvasByViewport(t){return this.context.canvas.getCanvasByViewport(t)}getViewportByCanvas(t){return this.context.canvas.getViewportByCanvas(t)}getClientByCanvas(t){return this.context.canvas.getClientByCanvas(t)}getCanvasByClient(t){return this.context.canvas.getCanvasByClient(t)}getViewportCenter(){return this.context.viewport.getViewportCenter()}getCanvasCenter(){return this.context.viewport.getCanvasCenter()}on(t,e,n){return super.on(t,e,n)}once(t,e){return super.once(t,e)}off(t,e){return super.off(t,e)}}Ig.defaultOptions={autoResize:!1,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};var jgt=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e};function qgt(r,t){const{getNodeData:e=(o,l)=>{if(o.depth=l,!o.children)return o;const{children:u}=o,c=jgt(o,["children"]);return Object.assign(Object.assign({},c),{children:u.map(h=>h.id)})},getEdgeData:n=(o,l)=>({source:o.id,target:l.id}),getChildren:i=o=>o.children||[]}={},a=[],s=[];return To(r,(o,l)=>{a.push(e(o,l));const u=i(o);for(const c of u)s.push(n(o,c))},o=>i(o),"TB"),{nodes:a,edges:s}}class Wgt extends Za{beforeDraw(t){const{add:e,update:n}=t,{model:i}=this.context;return[...e.edges.entries(),...n.edges.entries()].forEach(([,a])=>{g4(i,a)}),t}}const g4=(r,t)=>{const{source:e,target:n}=t,i=r.getElementDataById(e),a=r.getElementDataById(n),s=QM(i,h=>r.getParentData(h,we)),o=QM(a,h=>r.getParentData(h,we)),l=H(s),u=H(o),c={sourceNode:l,targetNode:u};return t.style?Object.assign(t.style,c):t.style=c,t},Ggt=(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)},Vgt=(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)},Hgt=(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)},Ugt=(r,t,e)=>{const[n,i]=t,[a,s]=e,o=Math.sqrt((r-n)/(i-n));return a+o*(s-a)};class Dg extends Za{constructor(t,e){super(t,cr({},Dg.defaultOptions,e)),this.assignSizeByCentrality=(n,i,a,s,o,l)=>{const u=[i,a],c=[s[0],o[0]],h=[s[1],o[1]],d=[s[2],o[2]],g=(p,v)=>{if(typeof l=="function")return l(p,u,v);switch(l){case"linear":return Ggt(p,u,v);case"log":return Vgt(p,u,v);case"pow":return Hgt(p,u,v,2);case"sqrt":return Ugt(p,u,v);default:return v[0]}};return[g(n,c),g(n,h),g(n,d)]}}beforeDraw(t){const{model:e}=this.context,n=e.getNodeData(),i=Hr(this.options.maxSize),a=Hr(this.options.minSize),s=this.getCentralities(this.options.centrality),o=s.size>0?Math.max(...s.values()):0,l=s.size>0?Math.min(...s.values()):0;return n.forEach(u=>{var c;const h=this.assignSizeByCentrality(s.get(H(u))||0,l,o,a,i,this.options.scale),d=(c=this.context.element)===null||c===void 0?void 0:c.getElement(H(u)),g={size:h};this.assignLabelStyle(g,h,u,d),(!d||!uf(g,d.attributes))&&Vr(t,d?"update":"add","node",cr(u,{style:g}),!0)}),t}assignLabelStyle(t,e,n,i){var a;const s=i?i.config.style:(a=this.context.element)===null||a===void 0?void 0:a.getElementComputedStyle("node",n);if(Object.assign(t,Ro(s,["labelFontSize","labelLineHeight"])),this.options.mapLabelSize){const o=this.getLabelSizeByNodeSize(e,1/0,Number(t.labelFontSize));Object.assign(t,{labelFontSize:o,labelLineHeight:o+lX(t.labelPadding)})}return t}getLabelSizeByNodeSize(t,e,n){const i=Math.min(...t)/2,[a,s]=Array.isArray(this.options.mapLabelSize)?this.options.mapLabelSize:[n,e];return Math.min(s,Math.max(i,a))}getCentralities(t){const{model:e}=this.context,n=e.getData();if(typeof t=="function")return t(n);const i=e.getRelatedEdgesData.bind(e);return cI(n,i,t)}}Dg.defaultOptions={centrality:{type:"degree"},maxSize:80,minSize:20,scale:"linear",mapLabelSize:!1};class Fg extends Za{constructor(t,e){super(t,Object.assign({},Fg.defaultOptions,e))}get ref(){return this.context.model.getRootsData()[0]}afterLayout(){var t;const e=on(this.ref),{graph:n,model:i}=this.context;(t=i.getData().nodes)===null||t===void 0||t.forEach(s=>{var o;if(H(s)===H(this.ref))return;const l=dI(be(on(s),e)),u=Math.abs(l)>Math.PI/2,c=!s.children||s.children.length===0,h=H(s),d=(o=this.context.element)===null||o===void 0?void 0:o.getElement(h);if(!d||!d.isVisible())return;const g=Hr(n.getElementRenderStyle(h).size)[0]/2,p=(c?1:-1)*(g+this.options.offset),v=[["translate",p*Math.cos(l),p*Math.sin(l)],["rotate",u?xr(l)+180:xr(l)]];i.updateNodeData([{id:H(s),style:{labelTextAlign:u===c?"right":"left",labelTextBaseline:"middle",labelTransform:v}}])}),n.draw()}}Fg.defaultOptions={offset:5};const Ygt="quadratic",cR=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class Bg extends Za{constructor(t,e){super(t,Object.assign({},Bg.defaultOptions,e)),this.cacheMergeStyle=new Map,this.getAffectedParallelEdges=n=>{const{add:{edges:i},update:{nodes:a,edges:s,combos:o},remove:{edges:l}}=n,{model:u}=this.context,c=new Map,h=(p,v)=>{u.getRelatedEdgesData(v).forEach(b=>!c.has(H(b))&&c.set(H(b),b))};a.forEach(h),o.forEach(h);const d=p=>{const v=u.getEdgeData().map(b=>g4(u,b));Xgt(p,v).forEach(b=>!c.has(H(b))&&c.set(H(b),b))};if(l.size&&l.forEach(d),i.size&&i.forEach(d),s.size){const p=w5(zE(u.getChanges())).update.edges;s.forEach(v=>{var m;d(v);const b=(m=p.find(w=>H(w.value)===H(v)))===null||m===void 0?void 0:m.original;b&&!t_(v,b)&&d(b)})}Zi(this.options.edges)||c.forEach((p,v)=>!this.options.edges.includes(v)&&c.delete(v));const g=u.getEdgeData().map(H);return new Map([...c].sort((p,v)=>g.indexOf(p[0])-g.indexOf(v[0])))},this.applyBundlingStyle=(n,i,a)=>{const{edgeMap:s,reverses:o}=hR(i);s.forEach(l=>{l.forEach((u,c,h)=>{var d;const g=h.length,p=u.style||{};if(u.source===u.target){const b=cR.length;p.loopPlacement=cR[c%b],p.loopDist=Math.floor(c/b)*a+50}else if(g===1)p.curveOffset=0;else{const b=(c%2===0?1:-1)*(o[`${u.source}|${u.target}|${c}`]?-1:1);p.curveOffset=g%2===1?b*Math.ceil(c/2)*a*2:b*(Math.floor(c/2)*a*2+a)}const v=Object.assign(u,{type:Ygt,style:p}),m=(d=this.context.element)===null||d===void 0?void 0:d.getElement(H(u));(!m||!uf(v.style,m.attributes))&&Vr(n,m?"update":"add","edge",v,!0)})})},this.resetEdgeStyle=n=>{const i=n.style||{},a=this.cacheMergeStyle.get(H(n))||{};return Object.keys(a).forEach(s=>{Ye(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}=hR(i);a.forEach(o=>{var l;if(o.length===1){const c=o[0],h=(l=this.context.element)===null||l===void 0?void 0:l.getElement(H(c)),d=this.resetEdgeStyle(c);(!h||!uf(d,h.attributes))&&Vr(n,h?"update":"add","edge",d);return}const u=o.map(({source:c,target:h,style:d={}},g)=>{const{startArrow:p,endArrow:v}=d,m={},[b,w]=s[`${c}|${h}|${g}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return yf(p)&&(m[b]=p),yf(v)&&(m[w]=v),m}).reduce((c,h)=>Object.assign(Object.assign({},c),h),{});o.forEach((c,h,d)=>{var g;if(h!==0){Vr(n,"remove","edge",c);return}const p=Object.assign({},Et(this.options.style)?this.options.style(d):this.options.style,{childrenData:d});this.cacheMergeStyle.set(H(c),p);const v=Object.assign(Object.assign({},c),{type:"line",style:Object.assign(Object.assign(Object.assign({},c.style),u),p)}),m=(g=this.context.element)===null||g===void 0?void 0:g.getElement(H(c));(!m||!uf(v.style,m.attributes))&&Vr(n,m?"update":"add","edge",v,!0)})})}}beforeDraw(t){const e=this.getAffectedParallelEdges(t);return e.size===0||(this.options.mode==="bundle"?this.applyBundlingStyle(t,e,this.options.distance):this.applyMergingStyle(t,e)),t}}Bg.defaultOptions={mode:"bundle",distance:15};const hR=r=>{const t=new Map,e=new Set,n={};for(const[i,a]of r){if(e.has(i))continue;const{source:s,target:o}=a,l=`${s}-${o}`;t.has(l)||t.set(l,[]),t.get(l).push(a),e.add(i);for(const[u,c]of r)e.has(u)||t_(a,c)&&(t.get(l).push(c),e.add(u),s===c.target&&o===c.source&&(n[`${c.source}|${c.target}|${t.get(l).length-1}`]=!0))}return{edgeMap:t,reverses:n}},Xgt=(r,t,e)=>t.filter(n=>t_(n,r)),t_=(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 Kgt extends Za{beforeDraw(t,e){const{stage:n}=e;if(n==="visibility")return t;const{model:i}=this.context,{update:{nodes:a,edges:s,combos:o}}=t,l=(u,c)=>{i.getRelatedEdgesData(c).forEach(d=>!s.has(H(d))&&s.set(H(d),d))};return a.forEach(l),o.forEach(l),t}}const Zgt={animation:{"combo-collapse":rI,"combo-expand":aX,"node-collapse":eI,"node-expand":rX,"path-in":nI,"path-out":iX,fade:eX,translate:nX},behavior:{"brush-select":Bc,"click-select":g0,"collapse-expand":M0,"create-edge":k0,"drag-canvas":C0,"drag-element-force":hJ,"drag-element":Gc,"fix-element-size":A0,"focus-element":P0,"hover-activate":N0,"lasso-select":fJ,"auto-adapt-label":h0,"optimize-viewport-transform":R0,"scroll-canvas":L0,"zoom-canvas":I0},combo:{circle:cZ,rect:hZ},edge:{cubic:Ho,line:GI,polyline:E0,quadratic:_0,"cubic-horizontal":qc,"cubic-radial":w0,"cubic-vertical":x0},layout:{"antv-dagre":det,"combo-combined":frt,"compact-box":Od.compactBox,"d3-force":zrt,"force-atlas2":Fut,circular:pet,concentric:Qw,dagre:og,dendrogram:Od.dendrogram,fishbone:lg,force:k6,fruchterman:$ut,grid:qut,indented:Od.indented,mds:D6,mindmap:Od.mindmap,radial:Zut,random:ict,snake:ug},node:{circle:jc,diamond:fK,ellipse:m0,hexagon:yK,html:y0,image:FI,rect:lZ,star:uZ,donut:v0,triangle:b0},palette:{spectral:wct,tableau:xct,oranges:Ect,greens:_ct,blues:Sct},theme:{dark:pgt,light:mgt},plugin:{"bubble-sets":dg,"edge-bundling":gg,"edge-filter-lens":pg,"grid-line":yg,background:cg,contextmenu:fg,fisheye:vg,fullscreen:mg,history:bg,hull:wg,legend:Cg,minimap:Tg,snapline:Og,timebar:Ag,toolbar:Pg,tooltip:Ng,watermark:Rg},transform:{"arrange-draw-order":ygt,"collapse-expand-combo":bgt,"collapse-expand-node":wgt,"get-edge-actual-ends":Wgt,"map-node-size":Dg,"place-radial-labels":Fg,"process-parallel-edges":Bg,"update-related-edges":Kgt},shape:{circle:Ua,ellipse:Lc,group:_n,html:Ic,image:Qx,line:Do,path:qr,polygon:Vo,polyline:u0,rect:Sn,text:Hs,label:Xs,badge:$a}};function Jgt(){Object.entries(Zgt).forEach(([r,t])=>{Object.entries(t).forEach(([e,n])=>{Qu(r,e,n)})})}Jgt();const Qgt={class:"progress"},tpt={__name:"MindMapping",props:{data:Object,loading:Boolean},setup(r){const t=r,e=ue(null),n=ue(0),i=ue(null),a=()=>{i.value=setInterval(()=>{n.value+=Math.random()>.5?3:2,n.value>98&&clearInterval(i.value)},1e3)};Oc(()=>{t.loading&&!t.data&&a()}),n0(()=>{clearInterval(i.value)}),aw(()=>t.loading,_=>{console.log("newLoading",_),_&&!t.data?a():clearInterval(i.value)}),aw(()=>t.data,_=>{_&&(console.log("newData",_),w(_))});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 u;const c=_=>(u||(u=new Hs({style:_})),u.attr(_),u.getBBox().width),h=(_,M)=>{const k=M?40:30;return c({text:_,fontSize:(M?s:o).labelFontSize,fontFamily:"Gill Sans"})+k},d=(_,M)=>[h(_,M),M?48:32],x=class x extends vi{constructor(M){Object.assign(M.style,x.defaultStyleProps),super(M)}get childrenData(){return this.context.model.getChildrenData(this.id)}get rootId(){return H(this.context.model.getRootsData()[0])}isShowCollapse(M){const{collapsed:k,showIcon:C}=M;return!k&&C&&this.childrenData.length>0}drawCircleShape(M,k){const{color:C="#000",radius:P=10}=M,[T,A]=this.getSize(M),R={fill:C,stroke:"#fff",lineWidth:1,r:P,x:T/2,y:A/2};this.upsert("circle","circle",R,k)}getCollapseStyle(M){const{showIcon:k,color:C,direction:P}=M;if(!this.isShowCollapse(M))return!1;const[T,A]=this.getSize(M);return{backgroundFill:C,backgroundHeight:12,backgroundWidth:12,cursor:"pointer",fill:"#fff",fontFamily:"iconfont",fontSize:8,text:"",textAlign:"center",transform:P==="left"?[["rotate",90]]:[["rotate",-90]],visibility:k?"visible":"hidden",x:P==="left"?-6:T+6,y:A}}drawCollapseShape(M,k){const C=this.getCollapseStyle(M),P=this.upsert("collapse-expand",$a,C,k);this.forwardEvent(P,J.CLICK,T=>{T.stopPropagation(),this.context.graph.emit(l.COLLAPSE_EXPAND,{id:this.id,collapsed:!M.collapsed})})}getCountStyle(M){const{collapsed:k,color:C,direction:P}=M,T=this.context.model.getDescendantsData(this.id).length;if(!k||T===0)return!1;const[A,R]=this.getSize(M);return{backgroundFill:C,backgroundHeight:12,backgroundWidth:12,cursor:"pointer",fill:"#fff",fontSize:8,text:T.toString(),textAlign:"center",x:P==="left"?-6:A+6,y:R}}drawCountShape(M,k){const C=this.getCountStyle(M),P=this.upsert("count",$a,C,k);this.forwardEvent(P,J.CLICK,T=>{T.stopPropagation(),this.context.graph.emit(l.COLLAPSE_EXPAND,{id:this.id,collapsed:!1})})}getAddStyle(M){const{collapsed:k,showIcon:C,direction:P}=M;if(k||!C)return!1;const[T,A]=this.getSize(M),R="#ddd",L=this.isShowCollapse(M)?24:12,$=this.id===this.rootId;return{backgroundFill:"#fff",backgroundHeight:12,backgroundLineWidth:1,backgroundStroke:R,backgroundWidth:12,cursor:"pointer",fill:R,fontFamily:"iconfont",fontSize:8,text:"",textAlign:"center",x:$?T+12:P==="left"?-L:T+L,y:$?A/2:A}}getAddBarStyle(M){const{collapsed:k,showIcon:C,direction:P,color:T="#1783FF"}=M;if(k||!C)return!1;const[A,R]=this.getSize(M),L=this.isShowCollapse(M)?12:0,$=this.id===this.rootId,q=2,j=6;return{cursor:"pointer",fill:P==="left"?`linear-gradient(180deg, #fff 20%, ${T})`:`linear-gradient(0deg, #fff 20%, ${T})`,height:q,width:j,x:$?A:P==="left"?-L-j:A+L,y:$?R/2-q/2:R-q/2,zIndex:-1}}drawAddShape(M,k){const C=this.getAddStyle(M),P=this.getAddBarStyle(M);this.upsert("add-bar",Sn,P,k);const T=this.upsert("add",$a,C,k);this.forwardEvent(T,J.CLICK,A=>{A.stopPropagation(),this.context.graph.emit(l.ADD_CHILD,{id:this.id,direction:M.direction})})}forwardEvent(M,k,C){M&&!Reflect.has(M,"__bind__")&&(Reflect.set(M,"__bind__",!0),M.addEventListener(k,C))}getKeyStyle(M){const[k,C]=this.getSize(M),P=super.getKeyStyle(M);return{width:k,height:C,...P}}drawKeyShape(M,k){const C=this.getKeyStyle(M);return this.upsert("key",Sn,C,k)}render(M=this.parsedAttributes,k=this){super.render(M,k),this.drawCollapseShape(M,k),this.drawAddShape(M,k),this.drawCountShape(M,k)}};le(x,"defaultStyleProps",{showIcon:!1});let g=x;class p extends qc{get rootId(){return H(this.context.model.getRootsData()[0])}getKeyPath(M){const k=super.getKeyPath(M),C=this.targetNode.id===this.rootId,P=h(this.targetNode.id,C),[,T]=this.getEndpoints(M),A=this.sourceNode.getCenter()[0]<this.targetNode.getCenter()[0]?1:-1;return[...k,["L",T[0]+P*A,T[1]]]}}class v extends Tr{constructor(k,C){super(k,C);le(this,"status","idle");le(this,"showIcon",k=>{this.setIcon(k,!0)});le(this,"hideIcon",k=>{this.setIcon(k,!1)});le(this,"setIcon",(k,C)=>{if(this.status!=="idle")return;const{target:P}=k,T=P.id,{graph:A,element:R}=this.context;A.updateNodeData([{id:T,style:{showIcon:C}}]),R.draw({animation:!1,silence:!0})});le(this,"onCollapseExpand",async k=>{this.status="busy";const{id:C,collapsed:P}=k,{graph:T}=this.context;await T.frontElement(C),P?await T.collapseElement(C):await T.expandElement(C),this.status="idle"});le(this,"addChild",async k=>{this.status="busy";const{onCreateChild:C=()=>({id:`新节点 in ${new Date(Date.now()).toLocaleString()}`})}=this.options,{graph:P}=this.context,T=C(k.id),A=P.getNodeData(k.id);P.addNodeData([T]),P.addEdgeData([{source:k.id,target:T.id}]),P.updateNodeData([{id:k.id,children:[...A.children||[],T.id],style:{collapsed:!1,showIcon:!1}}]),await P.render(),await P.focusElement(T.id),this.status="idle"});this.bindEvents()}update(k){this.unbindEvents(),super.update(k),this.bindEvents()}bindEvents(){const{graph:k}=this.context;k.on(Zn.POINTER_ENTER,this.showIcon),k.on(Zn.POINTER_LEAVE,this.hideIcon),k.on(l.COLLAPSE_EXPAND,this.onCollapseExpand),k.on(l.ADD_CHILD,this.addChild)}unbindEvents(){const{graph:k}=this.context;k.off(Zn.POINTER_ENTER,this.showIcon),k.off(Zn.POINTER_LEAVE,this.hideIcon),k.off(l.COLLAPSE_EXPAND,this.onCollapseExpand),k.off(l.ADD_CHILD,this.addChild)}}const S=class S extends Za{constructor(M,k){super(M,Object.assign({},S.defaultOptions,k))}beforeDraw(M){const k=this.context.model.getNodeData(),C=this.context.model.getEdgeData();if(k.length===0)return M;let P=0;return k.forEach(T=>{T.style||(T.style={}),T.style.color=this.options.colors[P++%this.options.colors.length]}),C.forEach(T=>{const A=k.find(R=>R.id===T.target);A&&(T.style||(T.style={}),T.style.stroke=A.style.color)}),M}};le(S,"defaultOptions",{colors:["#80B4FF","#FFC8A2","#E6C8FF","#A2E6E6","#C8B4FF","#FFD878","#A2E680","#FFA2D8","#80C8D8","#80E6A2","#FFD878","#D880D8","#80C880","#FFA280","#80E6E6","#FFA2D8","#C8C8D8","#FFC8C8","#FFD878","#C8FF80"]});let m=S;Qu(Ra.NODE,"mindmap",g),Qu(Ra.EDGE,"mindmap",p),Qu(Ra.BEHAVIOR,"collapse-expand-tree",v),Qu(Ra.TRANSFORM,"assign-color-by-branch",m);const b=(_,M)=>{if(!M)return"center";const k=on(_)[0];return on(M)[0]>k?"left":"right"},w=_=>{var C,P;const M=_.id,k=new Ig({container:e.value,width:((C=e.value)==null?void 0:C.clientWidth)||1e3,height:((P=e.value)==null?void 0:P.clientHeight)||800,fitView:!0,fitCenter:!0,data:qgt(_),node:{type:"mindmap",style:function(T){const A=b(T,this.getParentData(H(T),"tree")),R=H(T)===M;return{direction:A,labelText:H(T),size:d(H(T),R),labelFontFamily:"Gill Sans",labelBackground:!0,labelBackgroundFill:"transparent",labelPadding:A==="left"?[2,0,10,40]:[2,40,10,0],...R?s:o}}},edge:{type:"mindmap",style:{lineWidth:3,stroke:function(T){return this.getNodeData(T.target).style.color||"#99ADD1"}}},layout:{type:"mindmap",direction:"H",getHeight:()=>80,getWidth:T=>h(T.id,T.id===M),getVGap:()=>6,getHGap:()=>60,animation:!1,getSide:()=>"right"},behaviors:["drag-canvas","zoom-canvas","collapse-expand-tree"],transforms:["assign-color-by-branch"],animation:{duration:200}});k.once(lt.AFTER_RENDER,()=>{k.fitView()}),k.render()};return w(Pq),(_,M)=>{const k=Aj;return jt(),He($l,null,[oj(Ve("div",Qgt,[ae(k,{type:"circle",width:"250","stroke-width":"10",percent:n.value/100,"show-text":!1},null,8,["percent"]),Ve("h1",null,uc(`${n.value}%`),1)],512),[[lj,!r.data&&r.loading]]),Ve("div",{ref_key:"container",ref:e,class:"mindmap-container"},null,512)],64)}}},ept=jo(tpt,[["__scopeId","data-v-03e660d3"]]),npt="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",rpt="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",ipt="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",apt="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",spt="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",opt="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",lpt=["src","alt"],upt={__name:"FileIcon",props:{name:String},setup(r){const t=r,e=i=>(i==null?void 0:i.slice(i.lastIndexOf(".")+1).toLowerCase())??"",n=an(()=>new URL(Object.assign({"../../assets/AISearch/doc.svg":npt,"../../assets/AISearch/docx.svg":rpt,"../../assets/AISearch/pdf.svg":ipt,"../../assets/AISearch/selected-files-collapse.svg":apt,"../../assets/AISearch/xls.svg":spt,"../../assets/AISearch/xlsx.svg":opt})[`../../assets/AISearch/${e(t.name)}.svg`],import.meta.url).href);return(i,a)=>(jt(),He("img",{src:n.value,alt:i.fileType,class:"file-icon"},null,8,lpt))}},cpt=jo(upt,[["__scopeId","data-v-13988c05"]]),hpt={class:"chunk-list"},dpt={key:1},fpt={class:"card"},gpt={class:"documentReference"},ppt={class:"popupMarkdown"},vpt=["innerHTML"],mpt=["innerHTML"],ypt=["onClick"],bpt={key:0},wpt={__name:"ChunkList",props:{chunks:Array,total:{type:Number,required:!0},highlightWord:String,pageSize:{type:Number,default:10},loading:Boolean},emits:["clickDocumentButton","pageChange","pageSizeChange"],setup(r,{emit:t}){const e=r,n=t,i=(c,h)=>{n("clickDocumentButton",c,h)},a=c=>{if(!e.highlightWord)return c;const h=new RegExp(`(${e.highlightWord})`,"gi");return c.replace(h,'<span class="highlighted">$1</span>')},s=ue(1),o=ue(10),l=c=>{s.value=c,n("pageChange",c)},u=c=>{c.value=c,n("pageSizeChange",c)};return(c,h)=>{const d=fR,g=Pj,p=t0,v=gR,m=Cj;return jt(),He("div",hpt,[r.loading?(jt(),dn(d,{key:0,dot:"",loading:r.loading},null,8,["loading"])):(jt(),He("div",dpt,[(jt(!0),He($l,null,e0(r.chunks,(b,w)=>(jt(),He("div",{key:w},[Ve("div",fpt,[Ve("div",gpt,[ae(g,{trigger:"hover"},{content:ve(()=>[Ve("div",ppt,[Ve("div",{innerHTML:a(b.content_with_weight)},null,8,vpt)])]),default:ve(()=>[Ve("div",{innerHTML:a(b.highlight),class:"highlightContent"},null,8,mpt)]),_:2},1024),Ve("div",{class:"fileBtn",onClick:x=>i(b.docId,b)},[ae(p,null,{default:ve(()=>[ae(cpt,{name:b.docnm_kwd},null,8,["name"]),Ve("div",null,uc(b.docnm_kwd),1)]),_:2},1024)],8,ypt)])]),w<r.chunks.length-1?(jt(),dn(v,{key:0,margin:12})):Ds("",!0)]))),128)),r.chunks.length>1?(jt(),He("div",bpt,[ae(v),ae(m,{current:s.value,total:r.total,pageSize:o.value,"show-total":"","show-page-size":"",onChange:l,onPageSizeChange:u},null,8,["current","total","pageSize"])])):Ds("",!0)]))])}}},xpt=jo(wpt,[["__scopeId","data-v-ec89b890"]]),Ept="/v1/conversation/ask";function _pt(r){return kx({url:"/rgflow/v1/chunk/retrieval_test",method:"post",data:r})}function Spt(r){return kx({url:"/rgflow/v1/conversation/related_questions",method:"post",data:r})}function Mpt(r){return kx({url:"/rgflow/v1/conversation/mindmap",method:"post",data:r})}var kpt=Object.defineProperty,Cpt=(r,t,e)=>t in r?kpt(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Xd=(r,t,e)=>Cpt(r,typeof t!="symbol"?t+"":t,e);class dR extends Error{constructor(t,e){super(t),Xd(this,"type"),Xd(this,"field"),Xd(this,"value"),Xd(this,"line"),this.name="ParseError",this.type=e.type,this.field=e.field,this.value=e.value,this.line=e.line}}function rw(r){}function Tpt(r){const{onEvent:t=rw,onError:e=rw,onRetry:n=rw,onComment:i}=r;let a="",s=!0,o,l="",u="";function c(v){const m=s?v.replace(/^\xEF\xBB\xBF/,""):v,[b,w]=Opt(`${a}${m}`);for(const x of b)h(x);a=w,s=!1}function h(v){if(v===""){g();return}if(v.startsWith(":")){i&&i(v.slice(v.startsWith(": ")?2:1));return}const m=v.indexOf(":");if(m!==-1){const b=v.slice(0,m),w=v[m+1]===" "?2:1,x=v.slice(m+w);d(b,x,v);return}d(v,"",v)}function d(v,m,b){switch(v){case"event":u=m;break;case"data":l=`${l}${m}
- `;break;case"id":o=m.includes("\0")?void 0:m;break;case"retry":/^\d+$/.test(m)?n(parseInt(m,10)):e(new dR(`Invalid \`retry\` value: "${m}"`,{type:"invalid-retry",value:m,line:b}));break;default:e(new dR(`Unknown field "${v.length>20?`${v.slice(0,20)}…`:v}"`,{type:"unknown-field",field:v,value:m,line:b}));break}}function g(){l.length>0&&t({id:o,event:u||void 0,data:l.endsWith(`
- `)?l.slice(0,-1):l}),o=void 0,l="",u=""}function p(v={}){a&&v.consume&&h(a),o=void 0,l="",u="",a=""}return{feed:c,reset:p}}function Opt(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 Apt extends TransformStream{constructor({onError:t,onRetry:e,onComment:n}={}){let i;super({start(a){i=Tpt({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 Ppt(){var a;const r=ue({chunks:[],documents:[],total:0}),t=ue(!1),e=uj(),n=((a=e==null?void 0:e.query)==null?void 0:a.id)||"",i=async s=>{t.value=!0;try{const{data:o,code:l}=await _pt({...s,kb_id:s.kb_id??n});l===0?r.value={chunks:o.chunks,documents:o.doc_aggs,total:o.total}:r.value={chunks:[],documents:[],total:0}}catch{r.value={chunks:[],documents:[],total:0},i0.error("检索失败")}finally{t.value=!1}};return{chunksData:an(()=>r.value),loading:an(()=>t.value),testChunk:i}}function Npt(){const r=ue([]),t=ue(!1);return{data:r,loading:t,fetchRelatedQuestions:async n=>{t.value=!0;try{const{data:i}=await Spt({question:n});r.value=(i==null?void 0:i.slice(0,5))??[]}catch(i){i0.error(i.message)}finally{t.value=!1}}}}function Rpt(r){const t=ue({}),e=ue(!0),n=ue(null),i=()=>{n.value&&clearTimeout(n.value),n.value=setTimeout(()=>{t.value={},clearTimeout(n.value)},1e3)},a=async(s,o)=>{var l;try{e.value=!1;const u=wj.get(),c=await fetch(r,{method:"POST",headers:{Authorization:`Bearer ${u}`,"Content-Type":"application/json"},body:JSON.stringify(s),signal:o==null?void 0:o.signal}),h=c.clone().json(),d=(l=c==null?void 0:c.body)==null?void 0:l.pipeThrough(new TextDecoderStream).pipeThrough(new Apt).getReader();for(;;){const g=await(d==null?void 0:d.read());if(g){const{done:p,value:v}=g;if(p){console.info("done"),i();break}try{const m=JSON.parse((v==null?void 0:v.data)||""),b=m==null?void 0:m.data;typeof b!="boolean"&&(t.value={...b,conversationId:s==null?void 0:s.conversation_id})}catch(m){console.warn(m)}}}return console.info("done?"),e.value=!0,i(),{data:await h,response:c}}catch(u){e.value=!0,i(),console.warn(u)}};return n0(()=>{n.value&&clearTimeout(n.value)}),{send:a,answer:t,done:e,resetAnswer:i}}function Lpt(){const r=ue(null),t=ue(!1);return{data:r,loading:t,fetchMindmap:async n=>{t.value=!0;try{const{data:i}=await Mpt(n);r.value=i}catch{i0.error("获取思维导图失败")}finally{t.value=!1}}}}var Jf={exports:{}};/**
- * @license
- * Lodash <https://lodash.com/>
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
- * Released under MIT license <https://lodash.com/license>
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- */Jf.exports;(function(r,t){(function(){var e,n="4.17.21",i=200,a="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",s="Expected a function",o="Invalid `variable` option passed into `_.template`",l="__lodash_hash_undefined__",u=500,c="__lodash_placeholder__",h=1,d=2,g=4,p=1,v=2,m=1,b=2,w=4,x=8,S=16,_=32,M=64,k=128,C=256,P=512,T=30,A="...",R=800,L=16,$=1,q=2,j=3,B=1/0,D=9007199254740991,G=17976931348623157e292,X=NaN,K=4294967295,ht=K-1,ut=K>>>1,ct=[["ary",k],["bind",m],["bindKey",b],["curry",x],["curryRight",S],["flip",P],["partial",_],["partialRight",M],["rearg",C]],dt="[object Arguments]",pt="[object Array]",mt="[object AsyncFunction]",It="[object Boolean]",zt="[object Date]",Te="[object DOMException]",Rn="[object Error]",ln="[object Function]",dr="[object GeneratorFunction]",Ln="[object Map]",te="[object Number]",bi="[object Null]",Gt="[object Object]",Kr="[object Promise]",Or="[object Proxy]",ji="[object RegExp]",mn="[object Set]",In="[object String]",Be="[object Symbol]",da="[object Undefined]",kn="[object WeakMap]",wi="[object WeakSet]",qi="[object ArrayBuffer]",tr="[object DataView]",Ja="[object Float32Array]",Qa="[object Float64Array]",uu="[object Int8Array]",Qo="[object Int16Array]",Zr="[object Int32Array]",xi="[object Uint8Array]",zg="[object Uint8ClampedArray]",$g="[object Uint16Array]",jg="[object Uint32Array]",p4=/\b__p \+= '';/g,v4=/\b(__p \+=) '' \+/g,m4=/(__e\(.*?\)|\b__t\)) \+\n'';/g,e_=/&(?:amp|lt|gt|quot|#39);/g,n_=/[&<>"']/g,y4=RegExp(e_.source),b4=RegExp(n_.source),w4=/<%-([\s\S]+?)%>/g,x4=/<%([\s\S]+?)%>/g,r_=/<%=([\s\S]+?)%>/g,E4=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_4=/^\w*$/,S4=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,qg=/[\\^$.*+?()[\]{}|]/g,M4=RegExp(qg.source),Wg=/^\s+/,k4=/\s/,C4=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,T4=/\{\n\/\* \[wrapped with (.+)\] \*/,O4=/,? & /,A4=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,P4=/[()=,{}\[\]\/\s]/,N4=/\\(\\)?/g,R4=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,i_=/\w*$/,L4=/^[-+]0x[0-9a-f]+$/i,I4=/^0b[01]+$/i,D4=/^\[object .+?Constructor\]$/,F4=/^0o[0-7]+$/i,B4=/^(?:0|[1-9]\d*)$/,z4=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,th=/($^)/,$4=/['\n\r\u2028\u2029\\]/g,eh="\\ud800-\\udfff",j4="\\u0300-\\u036f",q4="\\ufe20-\\ufe2f",W4="\\u20d0-\\u20ff",a_=j4+q4+W4,s_="\\u2700-\\u27bf",o_="a-z\\xdf-\\xf6\\xf8-\\xff",G4="\\xac\\xb1\\xd7\\xf7",V4="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",H4="\\u2000-\\u206f",U4=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",l_="A-Z\\xc0-\\xd6\\xd8-\\xde",u_="\\ufe0e\\ufe0f",c_=G4+V4+H4+U4,Gg="['’]",Y4="["+eh+"]",h_="["+c_+"]",nh="["+a_+"]",d_="\\d+",X4="["+s_+"]",f_="["+o_+"]",g_="[^"+eh+c_+d_+s_+o_+l_+"]",Vg="\\ud83c[\\udffb-\\udfff]",K4="(?:"+nh+"|"+Vg+")",p_="[^"+eh+"]",Hg="(?:\\ud83c[\\udde6-\\uddff]){2}",Ug="[\\ud800-\\udbff][\\udc00-\\udfff]",tl="["+l_+"]",v_="\\u200d",m_="(?:"+f_+"|"+g_+")",Z4="(?:"+tl+"|"+g_+")",y_="(?:"+Gg+"(?:d|ll|m|re|s|t|ve))?",b_="(?:"+Gg+"(?:D|LL|M|RE|S|T|VE))?",w_=K4+"?",x_="["+u_+"]?",J4="(?:"+v_+"(?:"+[p_,Hg,Ug].join("|")+")"+x_+w_+")*",Q4="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",t8="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",E_=x_+w_+J4,e8="(?:"+[X4,Hg,Ug].join("|")+")"+E_,n8="(?:"+[p_+nh+"?",nh,Hg,Ug,Y4].join("|")+")",r8=RegExp(Gg,"g"),i8=RegExp(nh,"g"),Yg=RegExp(Vg+"(?="+Vg+")|"+n8+E_,"g"),a8=RegExp([tl+"?"+f_+"+"+y_+"(?="+[h_,tl,"$"].join("|")+")",Z4+"+"+b_+"(?="+[h_,tl+m_,"$"].join("|")+")",tl+"?"+m_+"+"+y_,tl+"+"+b_,t8,Q4,d_,e8].join("|"),"g"),s8=RegExp("["+v_+eh+a_+u_+"]"),o8=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,l8=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],u8=-1,Re={};Re[Ja]=Re[Qa]=Re[uu]=Re[Qo]=Re[Zr]=Re[xi]=Re[zg]=Re[$g]=Re[jg]=!0,Re[dt]=Re[pt]=Re[qi]=Re[It]=Re[tr]=Re[zt]=Re[Rn]=Re[ln]=Re[Ln]=Re[te]=Re[Gt]=Re[ji]=Re[mn]=Re[In]=Re[kn]=!1;var Oe={};Oe[dt]=Oe[pt]=Oe[qi]=Oe[tr]=Oe[It]=Oe[zt]=Oe[Ja]=Oe[Qa]=Oe[uu]=Oe[Qo]=Oe[Zr]=Oe[Ln]=Oe[te]=Oe[Gt]=Oe[ji]=Oe[mn]=Oe[In]=Oe[Be]=Oe[xi]=Oe[zg]=Oe[$g]=Oe[jg]=!0,Oe[Rn]=Oe[ln]=Oe[kn]=!1;var c8={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},h8={"&":"&","<":"<",">":">",'"':""","'":"'"},d8={"&":"&","<":"<",">":">",""":'"',"'":"'"},f8={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},g8=parseFloat,p8=parseInt,__=typeof ka=="object"&&ka&&ka.Object===Object&&ka,v8=typeof self=="object"&&self&&self.Object===Object&&self,Dn=__||v8||Function("return this")(),Xg=t&&!t.nodeType&&t,Qs=Xg&&!0&&r&&!r.nodeType&&r,S_=Qs&&Qs.exports===Xg,Kg=S_&&__.process,Jr=function(){try{var U=Qs&&Qs.require&&Qs.require("util").types;return U||Kg&&Kg.binding&&Kg.binding("util")}catch{}}(),M_=Jr&&Jr.isArrayBuffer,k_=Jr&&Jr.isDate,C_=Jr&&Jr.isMap,T_=Jr&&Jr.isRegExp,O_=Jr&&Jr.isSet,A_=Jr&&Jr.isTypedArray;function Ar(U,tt,Z){switch(Z.length){case 0:return U.call(tt);case 1:return U.call(tt,Z[0]);case 2:return U.call(tt,Z[0],Z[1]);case 3:return U.call(tt,Z[0],Z[1],Z[2])}return U.apply(tt,Z)}function m8(U,tt,Z,St){for(var Dt=-1,ce=U==null?0:U.length;++Dt<ce;){var yn=U[Dt];tt(St,yn,Z(yn),U)}return St}function Qr(U,tt){for(var Z=-1,St=U==null?0:U.length;++Z<St&&tt(U[Z],Z,U)!==!1;);return U}function y8(U,tt){for(var Z=U==null?0:U.length;Z--&&tt(U[Z],Z,U)!==!1;);return U}function P_(U,tt){for(var Z=-1,St=U==null?0:U.length;++Z<St;)if(!tt(U[Z],Z,U))return!1;return!0}function ts(U,tt){for(var Z=-1,St=U==null?0:U.length,Dt=0,ce=[];++Z<St;){var yn=U[Z];tt(yn,Z,U)&&(ce[Dt++]=yn)}return ce}function rh(U,tt){var Z=U==null?0:U.length;return!!Z&&el(U,tt,0)>-1}function Zg(U,tt,Z){for(var St=-1,Dt=U==null?0:U.length;++St<Dt;)if(Z(tt,U[St]))return!0;return!1}function ze(U,tt){for(var Z=-1,St=U==null?0:U.length,Dt=Array(St);++Z<St;)Dt[Z]=tt(U[Z],Z,U);return Dt}function es(U,tt){for(var Z=-1,St=tt.length,Dt=U.length;++Z<St;)U[Dt+Z]=tt[Z];return U}function Jg(U,tt,Z,St){var Dt=-1,ce=U==null?0:U.length;for(St&&ce&&(Z=U[++Dt]);++Dt<ce;)Z=tt(Z,U[Dt],Dt,U);return Z}function b8(U,tt,Z,St){var Dt=U==null?0:U.length;for(St&&Dt&&(Z=U[--Dt]);Dt--;)Z=tt(Z,U[Dt],Dt,U);return Z}function Qg(U,tt){for(var Z=-1,St=U==null?0:U.length;++Z<St;)if(tt(U[Z],Z,U))return!0;return!1}var w8=tp("length");function x8(U){return U.split("")}function E8(U){return U.match(A4)||[]}function N_(U,tt,Z){var St;return Z(U,function(Dt,ce,yn){if(tt(Dt,ce,yn))return St=ce,!1}),St}function ih(U,tt,Z,St){for(var Dt=U.length,ce=Z+(St?1:-1);St?ce--:++ce<Dt;)if(tt(U[ce],ce,U))return ce;return-1}function el(U,tt,Z){return tt===tt?L8(U,tt,Z):ih(U,R_,Z)}function _8(U,tt,Z,St){for(var Dt=Z-1,ce=U.length;++Dt<ce;)if(St(U[Dt],tt))return Dt;return-1}function R_(U){return U!==U}function L_(U,tt){var Z=U==null?0:U.length;return Z?np(U,tt)/Z:X}function tp(U){return function(tt){return tt==null?e:tt[U]}}function ep(U){return function(tt){return U==null?e:U[tt]}}function I_(U,tt,Z,St,Dt){return Dt(U,function(ce,yn,Ee){Z=St?(St=!1,ce):tt(Z,ce,yn,Ee)}),Z}function S8(U,tt){var Z=U.length;for(U.sort(tt);Z--;)U[Z]=U[Z].value;return U}function np(U,tt){for(var Z,St=-1,Dt=U.length;++St<Dt;){var ce=tt(U[St]);ce!==e&&(Z=Z===e?ce:Z+ce)}return Z}function rp(U,tt){for(var Z=-1,St=Array(U);++Z<U;)St[Z]=tt(Z);return St}function M8(U,tt){return ze(tt,function(Z){return[Z,U[Z]]})}function D_(U){return U&&U.slice(0,$_(U)+1).replace(Wg,"")}function Pr(U){return function(tt){return U(tt)}}function ip(U,tt){return ze(tt,function(Z){return U[Z]})}function cu(U,tt){return U.has(tt)}function F_(U,tt){for(var Z=-1,St=U.length;++Z<St&&el(tt,U[Z],0)>-1;);return Z}function B_(U,tt){for(var Z=U.length;Z--&&el(tt,U[Z],0)>-1;);return Z}function k8(U,tt){for(var Z=U.length,St=0;Z--;)U[Z]===tt&&++St;return St}var C8=ep(c8),T8=ep(h8);function O8(U){return"\\"+f8[U]}function A8(U,tt){return U==null?e:U[tt]}function nl(U){return s8.test(U)}function P8(U){return o8.test(U)}function N8(U){for(var tt,Z=[];!(tt=U.next()).done;)Z.push(tt.value);return Z}function ap(U){var tt=-1,Z=Array(U.size);return U.forEach(function(St,Dt){Z[++tt]=[Dt,St]}),Z}function z_(U,tt){return function(Z){return U(tt(Z))}}function ns(U,tt){for(var Z=-1,St=U.length,Dt=0,ce=[];++Z<St;){var yn=U[Z];(yn===tt||yn===c)&&(U[Z]=c,ce[Dt++]=Z)}return ce}function ah(U){var tt=-1,Z=Array(U.size);return U.forEach(function(St){Z[++tt]=St}),Z}function R8(U){var tt=-1,Z=Array(U.size);return U.forEach(function(St){Z[++tt]=[St,St]}),Z}function L8(U,tt,Z){for(var St=Z-1,Dt=U.length;++St<Dt;)if(U[St]===tt)return St;return-1}function I8(U,tt,Z){for(var St=Z+1;St--;)if(U[St]===tt)return St;return St}function rl(U){return nl(U)?F8(U):w8(U)}function Ei(U){return nl(U)?B8(U):x8(U)}function $_(U){for(var tt=U.length;tt--&&k4.test(U.charAt(tt)););return tt}var D8=ep(d8);function F8(U){for(var tt=Yg.lastIndex=0;Yg.test(U);)++tt;return tt}function B8(U){return U.match(Yg)||[]}function z8(U){return U.match(a8)||[]}var $8=function U(tt){tt=tt==null?Dn:il.defaults(Dn.Object(),tt,il.pick(Dn,l8));var Z=tt.Array,St=tt.Date,Dt=tt.Error,ce=tt.Function,yn=tt.Math,Ee=tt.Object,sp=tt.RegExp,j8=tt.String,ti=tt.TypeError,sh=Z.prototype,q8=ce.prototype,al=Ee.prototype,oh=tt["__core-js_shared__"],lh=q8.toString,fe=al.hasOwnProperty,W8=0,j_=function(){var f=/[^.]+$/.exec(oh&&oh.keys&&oh.keys.IE_PROTO||"");return f?"Symbol(src)_1."+f:""}(),uh=al.toString,G8=lh.call(Ee),V8=Dn._,H8=sp("^"+lh.call(fe).replace(qg,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ch=S_?tt.Buffer:e,rs=tt.Symbol,hh=tt.Uint8Array,q_=ch?ch.allocUnsafe:e,dh=z_(Ee.getPrototypeOf,Ee),W_=Ee.create,G_=al.propertyIsEnumerable,fh=sh.splice,V_=rs?rs.isConcatSpreadable:e,hu=rs?rs.iterator:e,to=rs?rs.toStringTag:e,gh=function(){try{var f=ao(Ee,"defineProperty");return f({},"",{}),f}catch{}}(),U8=tt.clearTimeout!==Dn.clearTimeout&&tt.clearTimeout,Y8=St&&St.now!==Dn.Date.now&&St.now,X8=tt.setTimeout!==Dn.setTimeout&&tt.setTimeout,ph=yn.ceil,vh=yn.floor,op=Ee.getOwnPropertySymbols,K8=ch?ch.isBuffer:e,H_=tt.isFinite,Z8=sh.join,J8=z_(Ee.keys,Ee),bn=yn.max,Vn=yn.min,Q8=St.now,t9=tt.parseInt,U_=yn.random,e9=sh.reverse,lp=ao(tt,"DataView"),du=ao(tt,"Map"),up=ao(tt,"Promise"),sl=ao(tt,"Set"),fu=ao(tt,"WeakMap"),gu=ao(Ee,"create"),mh=fu&&new fu,ol={},n9=so(lp),r9=so(du),i9=so(up),a9=so(sl),s9=so(fu),yh=rs?rs.prototype:e,pu=yh?yh.valueOf:e,Y_=yh?yh.toString:e;function I(f){if(Xe(f)&&!$t(f)&&!(f instanceof re)){if(f instanceof ei)return f;if(fe.call(f,"__wrapped__"))return XS(f)}return new ei(f)}var ll=function(){function f(){}return function(y){if(!qe(y))return{};if(W_)return W_(y);f.prototype=y;var E=new f;return f.prototype=e,E}}();function bh(){}function ei(f,y){this.__wrapped__=f,this.__actions__=[],this.__chain__=!!y,this.__index__=0,this.__values__=e}I.templateSettings={escape:w4,evaluate:x4,interpolate:r_,variable:"",imports:{_:I}},I.prototype=bh.prototype,I.prototype.constructor=I,ei.prototype=ll(bh.prototype),ei.prototype.constructor=ei;function re(f){this.__wrapped__=f,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=K,this.__views__=[]}function o9(){var f=new re(this.__wrapped__);return f.__actions__=fr(this.__actions__),f.__dir__=this.__dir__,f.__filtered__=this.__filtered__,f.__iteratees__=fr(this.__iteratees__),f.__takeCount__=this.__takeCount__,f.__views__=fr(this.__views__),f}function l9(){if(this.__filtered__){var f=new re(this);f.__dir__=-1,f.__filtered__=!0}else f=this.clone(),f.__dir__*=-1;return f}function u9(){var f=this.__wrapped__.value(),y=this.__dir__,E=$t(f),O=y<0,N=E?f.length:0,F=x7(0,N,this.__views__),W=F.start,V=F.end,Y=V-W,nt=O?V:W-1,rt=this.__iteratees__,ot=rt.length,xt=0,Mt=Vn(Y,this.__takeCount__);if(!E||!O&&N==Y&&Mt==Y)return yS(f,this.__actions__);var Tt=[];t:for(;Y--&&xt<Mt;){nt+=y;for(var Kt=-1,Ot=f[nt];++Kt<ot;){var ee=rt[Kt],ie=ee.iteratee,Lr=ee.type,rr=ie(Ot);if(Lr==q)Ot=rr;else if(!rr){if(Lr==$)continue t;break t}}Tt[xt++]=Ot}return Tt}re.prototype=ll(bh.prototype),re.prototype.constructor=re;function eo(f){var y=-1,E=f==null?0:f.length;for(this.clear();++y<E;){var O=f[y];this.set(O[0],O[1])}}function c9(){this.__data__=gu?gu(null):{},this.size=0}function h9(f){var y=this.has(f)&&delete this.__data__[f];return this.size-=y?1:0,y}function d9(f){var y=this.__data__;if(gu){var E=y[f];return E===l?e:E}return fe.call(y,f)?y[f]:e}function f9(f){var y=this.__data__;return gu?y[f]!==e:fe.call(y,f)}function g9(f,y){var E=this.__data__;return this.size+=this.has(f)?0:1,E[f]=gu&&y===e?l:y,this}eo.prototype.clear=c9,eo.prototype.delete=h9,eo.prototype.get=d9,eo.prototype.has=f9,eo.prototype.set=g9;function fa(f){var y=-1,E=f==null?0:f.length;for(this.clear();++y<E;){var O=f[y];this.set(O[0],O[1])}}function p9(){this.__data__=[],this.size=0}function v9(f){var y=this.__data__,E=wh(y,f);if(E<0)return!1;var O=y.length-1;return E==O?y.pop():fh.call(y,E,1),--this.size,!0}function m9(f){var y=this.__data__,E=wh(y,f);return E<0?e:y[E][1]}function y9(f){return wh(this.__data__,f)>-1}function b9(f,y){var E=this.__data__,O=wh(E,f);return O<0?(++this.size,E.push([f,y])):E[O][1]=y,this}fa.prototype.clear=p9,fa.prototype.delete=v9,fa.prototype.get=m9,fa.prototype.has=y9,fa.prototype.set=b9;function ga(f){var y=-1,E=f==null?0:f.length;for(this.clear();++y<E;){var O=f[y];this.set(O[0],O[1])}}function w9(){this.size=0,this.__data__={hash:new eo,map:new(du||fa),string:new eo}}function x9(f){var y=Nh(this,f).delete(f);return this.size-=y?1:0,y}function E9(f){return Nh(this,f).get(f)}function _9(f){return Nh(this,f).has(f)}function S9(f,y){var E=Nh(this,f),O=E.size;return E.set(f,y),this.size+=E.size==O?0:1,this}ga.prototype.clear=w9,ga.prototype.delete=x9,ga.prototype.get=E9,ga.prototype.has=_9,ga.prototype.set=S9;function no(f){var y=-1,E=f==null?0:f.length;for(this.__data__=new ga;++y<E;)this.add(f[y])}function M9(f){return this.__data__.set(f,l),this}function k9(f){return this.__data__.has(f)}no.prototype.add=no.prototype.push=M9,no.prototype.has=k9;function _i(f){var y=this.__data__=new fa(f);this.size=y.size}function C9(){this.__data__=new fa,this.size=0}function T9(f){var y=this.__data__,E=y.delete(f);return this.size=y.size,E}function O9(f){return this.__data__.get(f)}function A9(f){return this.__data__.has(f)}function P9(f,y){var E=this.__data__;if(E instanceof fa){var O=E.__data__;if(!du||O.length<i-1)return O.push([f,y]),this.size=++E.size,this;E=this.__data__=new ga(O)}return E.set(f,y),this.size=E.size,this}_i.prototype.clear=C9,_i.prototype.delete=T9,_i.prototype.get=O9,_i.prototype.has=A9,_i.prototype.set=P9;function X_(f,y){var E=$t(f),O=!E&&oo(f),N=!E&&!O&&ls(f),F=!E&&!O&&!N&&dl(f),W=E||O||N||F,V=W?rp(f.length,j8):[],Y=V.length;for(var nt in f)(y||fe.call(f,nt))&&!(W&&(nt=="length"||N&&(nt=="offset"||nt=="parent")||F&&(nt=="buffer"||nt=="byteLength"||nt=="byteOffset")||ya(nt,Y)))&&V.push(nt);return V}function K_(f){var y=f.length;return y?f[wp(0,y-1)]:e}function N9(f,y){return Rh(fr(f),ro(y,0,f.length))}function R9(f){return Rh(fr(f))}function cp(f,y,E){(E!==e&&!Si(f[y],E)||E===e&&!(y in f))&&pa(f,y,E)}function vu(f,y,E){var O=f[y];(!(fe.call(f,y)&&Si(O,E))||E===e&&!(y in f))&&pa(f,y,E)}function wh(f,y){for(var E=f.length;E--;)if(Si(f[E][0],y))return E;return-1}function L9(f,y,E,O){return is(f,function(N,F,W){y(O,N,E(N),W)}),O}function Z_(f,y){return f&&Gi(y,Cn(y),f)}function I9(f,y){return f&&Gi(y,pr(y),f)}function pa(f,y,E){y=="__proto__"&&gh?gh(f,y,{configurable:!0,enumerable:!0,value:E,writable:!0}):f[y]=E}function hp(f,y){for(var E=-1,O=y.length,N=Z(O),F=f==null;++E<O;)N[E]=F?e:Vp(f,y[E]);return N}function ro(f,y,E){return f===f&&(E!==e&&(f=f<=E?f:E),y!==e&&(f=f>=y?f:y)),f}function ni(f,y,E,O,N,F){var W,V=y&h,Y=y&d,nt=y&g;if(E&&(W=N?E(f,O,N,F):E(f)),W!==e)return W;if(!qe(f))return f;var rt=$t(f);if(rt){if(W=_7(f),!V)return fr(f,W)}else{var ot=Hn(f),xt=ot==ln||ot==dr;if(ls(f))return xS(f,V);if(ot==Gt||ot==dt||xt&&!N){if(W=Y||xt?{}:$S(f),!V)return Y?d7(f,I9(W,f)):h7(f,Z_(W,f))}else{if(!Oe[ot])return N?f:{};W=S7(f,ot,V)}}F||(F=new _i);var Mt=F.get(f);if(Mt)return Mt;F.set(f,W),p3(f)?f.forEach(function(Ot){W.add(ni(Ot,y,E,Ot,f,F))}):f3(f)&&f.forEach(function(Ot,ee){W.set(ee,ni(Ot,y,E,ee,f,F))});var Tt=nt?Y?Pp:Ap:Y?pr:Cn,Kt=rt?e:Tt(f);return Qr(Kt||f,function(Ot,ee){Kt&&(ee=Ot,Ot=f[ee]),vu(W,ee,ni(Ot,y,E,ee,f,F))}),W}function D9(f){var y=Cn(f);return function(E){return J_(E,f,y)}}function J_(f,y,E){var O=E.length;if(f==null)return!O;for(f=Ee(f);O--;){var N=E[O],F=y[N],W=f[N];if(W===e&&!(N in f)||!F(W))return!1}return!0}function Q_(f,y,E){if(typeof f!="function")throw new ti(s);return _u(function(){f.apply(e,E)},y)}function mu(f,y,E,O){var N=-1,F=rh,W=!0,V=f.length,Y=[],nt=y.length;if(!V)return Y;E&&(y=ze(y,Pr(E))),O?(F=Zg,W=!1):y.length>=i&&(F=cu,W=!1,y=new no(y));t:for(;++N<V;){var rt=f[N],ot=E==null?rt:E(rt);if(rt=O||rt!==0?rt:0,W&&ot===ot){for(var xt=nt;xt--;)if(y[xt]===ot)continue t;Y.push(rt)}else F(y,ot,O)||Y.push(rt)}return Y}var is=kS(Wi),tS=kS(fp,!0);function F9(f,y){var E=!0;return is(f,function(O,N,F){return E=!!y(O,N,F),E}),E}function xh(f,y,E){for(var O=-1,N=f.length;++O<N;){var F=f[O],W=y(F);if(W!=null&&(V===e?W===W&&!Rr(W):E(W,V)))var V=W,Y=F}return Y}function B9(f,y,E,O){var N=f.length;for(E=Yt(E),E<0&&(E=-E>N?0:N+E),O=O===e||O>N?N:Yt(O),O<0&&(O+=N),O=E>O?0:m3(O);E<O;)f[E++]=y;return f}function eS(f,y){var E=[];return is(f,function(O,N,F){y(O,N,F)&&E.push(O)}),E}function Fn(f,y,E,O,N){var F=-1,W=f.length;for(E||(E=k7),N||(N=[]);++F<W;){var V=f[F];y>0&&E(V)?y>1?Fn(V,y-1,E,O,N):es(N,V):O||(N[N.length]=V)}return N}var dp=CS(),nS=CS(!0);function Wi(f,y){return f&&dp(f,y,Cn)}function fp(f,y){return f&&nS(f,y,Cn)}function Eh(f,y){return ts(y,function(E){return ba(f[E])})}function io(f,y){y=ss(y,f);for(var E=0,O=y.length;f!=null&&E<O;)f=f[Vi(y[E++])];return E&&E==O?f:e}function rS(f,y,E){var O=y(f);return $t(f)?O:es(O,E(f))}function er(f){return f==null?f===e?da:bi:to&&to in Ee(f)?w7(f):R7(f)}function gp(f,y){return f>y}function z9(f,y){return f!=null&&fe.call(f,y)}function $9(f,y){return f!=null&&y in Ee(f)}function j9(f,y,E){return f>=Vn(y,E)&&f<bn(y,E)}function pp(f,y,E){for(var O=E?Zg:rh,N=f[0].length,F=f.length,W=F,V=Z(F),Y=1/0,nt=[];W--;){var rt=f[W];W&&y&&(rt=ze(rt,Pr(y))),Y=Vn(rt.length,Y),V[W]=!E&&(y||N>=120&&rt.length>=120)?new no(W&&rt):e}rt=f[0];var ot=-1,xt=V[0];t:for(;++ot<N&&nt.length<Y;){var Mt=rt[ot],Tt=y?y(Mt):Mt;if(Mt=E||Mt!==0?Mt:0,!(xt?cu(xt,Tt):O(nt,Tt,E))){for(W=F;--W;){var Kt=V[W];if(!(Kt?cu(Kt,Tt):O(f[W],Tt,E)))continue t}xt&&xt.push(Tt),nt.push(Mt)}}return nt}function q9(f,y,E,O){return Wi(f,function(N,F,W){y(O,E(N),F,W)}),O}function yu(f,y,E){y=ss(y,f),f=GS(f,y);var O=f==null?f:f[Vi(ii(y))];return O==null?e:Ar(O,f,E)}function iS(f){return Xe(f)&&er(f)==dt}function W9(f){return Xe(f)&&er(f)==qi}function G9(f){return Xe(f)&&er(f)==zt}function bu(f,y,E,O,N){return f===y?!0:f==null||y==null||!Xe(f)&&!Xe(y)?f!==f&&y!==y:V9(f,y,E,O,bu,N)}function V9(f,y,E,O,N,F){var W=$t(f),V=$t(y),Y=W?pt:Hn(f),nt=V?pt:Hn(y);Y=Y==dt?Gt:Y,nt=nt==dt?Gt:nt;var rt=Y==Gt,ot=nt==Gt,xt=Y==nt;if(xt&&ls(f)){if(!ls(y))return!1;W=!0,rt=!1}if(xt&&!rt)return F||(F=new _i),W||dl(f)?FS(f,y,E,O,N,F):y7(f,y,Y,E,O,N,F);if(!(E&p)){var Mt=rt&&fe.call(f,"__wrapped__"),Tt=ot&&fe.call(y,"__wrapped__");if(Mt||Tt){var Kt=Mt?f.value():f,Ot=Tt?y.value():y;return F||(F=new _i),N(Kt,Ot,E,O,F)}}return xt?(F||(F=new _i),b7(f,y,E,O,N,F)):!1}function H9(f){return Xe(f)&&Hn(f)==Ln}function vp(f,y,E,O){var N=E.length,F=N,W=!O;if(f==null)return!F;for(f=Ee(f);N--;){var V=E[N];if(W&&V[2]?V[1]!==f[V[0]]:!(V[0]in f))return!1}for(;++N<F;){V=E[N];var Y=V[0],nt=f[Y],rt=V[1];if(W&&V[2]){if(nt===e&&!(Y in f))return!1}else{var ot=new _i;if(O)var xt=O(nt,rt,Y,f,y,ot);if(!(xt===e?bu(rt,nt,p|v,O,ot):xt))return!1}}return!0}function aS(f){if(!qe(f)||T7(f))return!1;var y=ba(f)?H8:D4;return y.test(so(f))}function U9(f){return Xe(f)&&er(f)==ji}function Y9(f){return Xe(f)&&Hn(f)==mn}function X9(f){return Xe(f)&&zh(f.length)&&!!Re[er(f)]}function sS(f){return typeof f=="function"?f:f==null?vr:typeof f=="object"?$t(f)?uS(f[0],f[1]):lS(f):T3(f)}function mp(f){if(!Eu(f))return J8(f);var y=[];for(var E in Ee(f))fe.call(f,E)&&E!="constructor"&&y.push(E);return y}function K9(f){if(!qe(f))return N7(f);var y=Eu(f),E=[];for(var O in f)O=="constructor"&&(y||!fe.call(f,O))||E.push(O);return E}function yp(f,y){return f<y}function oS(f,y){var E=-1,O=gr(f)?Z(f.length):[];return is(f,function(N,F,W){O[++E]=y(N,F,W)}),O}function lS(f){var y=Rp(f);return y.length==1&&y[0][2]?qS(y[0][0],y[0][1]):function(E){return E===f||vp(E,f,y)}}function uS(f,y){return Ip(f)&&jS(y)?qS(Vi(f),y):function(E){var O=Vp(E,f);return O===e&&O===y?Hp(E,f):bu(y,O,p|v)}}function _h(f,y,E,O,N){f!==y&&dp(y,function(F,W){if(N||(N=new _i),qe(F))Z9(f,y,W,E,_h,O,N);else{var V=O?O(Fp(f,W),F,W+"",f,y,N):e;V===e&&(V=F),cp(f,W,V)}},pr)}function Z9(f,y,E,O,N,F,W){var V=Fp(f,E),Y=Fp(y,E),nt=W.get(Y);if(nt){cp(f,E,nt);return}var rt=F?F(V,Y,E+"",f,y,W):e,ot=rt===e;if(ot){var xt=$t(Y),Mt=!xt&&ls(Y),Tt=!xt&&!Mt&&dl(Y);rt=Y,xt||Mt||Tt?$t(V)?rt=V:tn(V)?rt=fr(V):Mt?(ot=!1,rt=xS(Y,!0)):Tt?(ot=!1,rt=ES(Y,!0)):rt=[]:Su(Y)||oo(Y)?(rt=V,oo(V)?rt=y3(V):(!qe(V)||ba(V))&&(rt=$S(Y))):ot=!1}ot&&(W.set(Y,rt),N(rt,Y,O,F,W),W.delete(Y)),cp(f,E,rt)}function cS(f,y){var E=f.length;if(E)return y+=y<0?E:0,ya(y,E)?f[y]:e}function hS(f,y,E){y.length?y=ze(y,function(F){return $t(F)?function(W){return io(W,F.length===1?F[0]:F)}:F}):y=[vr];var O=-1;y=ze(y,Pr(Ct()));var N=oS(f,function(F,W,V){var Y=ze(y,function(nt){return nt(F)});return{criteria:Y,index:++O,value:F}});return S8(N,function(F,W){return c7(F,W,E)})}function J9(f,y){return dS(f,y,function(E,O){return Hp(f,O)})}function dS(f,y,E){for(var O=-1,N=y.length,F={};++O<N;){var W=y[O],V=io(f,W);E(V,W)&&wu(F,ss(W,f),V)}return F}function Q9(f){return function(y){return io(y,f)}}function bp(f,y,E,O){var N=O?_8:el,F=-1,W=y.length,V=f;for(f===y&&(y=fr(y)),E&&(V=ze(f,Pr(E)));++F<W;)for(var Y=0,nt=y[F],rt=E?E(nt):nt;(Y=N(V,rt,Y,O))>-1;)V!==f&&fh.call(V,Y,1),fh.call(f,Y,1);return f}function fS(f,y){for(var E=f?y.length:0,O=E-1;E--;){var N=y[E];if(E==O||N!==F){var F=N;ya(N)?fh.call(f,N,1):_p(f,N)}}return f}function wp(f,y){return f+vh(U_()*(y-f+1))}function t7(f,y,E,O){for(var N=-1,F=bn(ph((y-f)/(E||1)),0),W=Z(F);F--;)W[O?F:++N]=f,f+=E;return W}function xp(f,y){var E="";if(!f||y<1||y>D)return E;do y%2&&(E+=f),y=vh(y/2),y&&(f+=f);while(y);return E}function Zt(f,y){return Bp(WS(f,y,vr),f+"")}function e7(f){return K_(fl(f))}function n7(f,y){var E=fl(f);return Rh(E,ro(y,0,E.length))}function wu(f,y,E,O){if(!qe(f))return f;y=ss(y,f);for(var N=-1,F=y.length,W=F-1,V=f;V!=null&&++N<F;){var Y=Vi(y[N]),nt=E;if(Y==="__proto__"||Y==="constructor"||Y==="prototype")return f;if(N!=W){var rt=V[Y];nt=O?O(rt,Y,V):e,nt===e&&(nt=qe(rt)?rt:ya(y[N+1])?[]:{})}vu(V,Y,nt),V=V[Y]}return f}var gS=mh?function(f,y){return mh.set(f,y),f}:vr,r7=gh?function(f,y){return gh(f,"toString",{configurable:!0,enumerable:!1,value:Yp(y),writable:!0})}:vr;function i7(f){return Rh(fl(f))}function ri(f,y,E){var O=-1,N=f.length;y<0&&(y=-y>N?0:N+y),E=E>N?N:E,E<0&&(E+=N),N=y>E?0:E-y>>>0,y>>>=0;for(var F=Z(N);++O<N;)F[O]=f[O+y];return F}function a7(f,y){var E;return is(f,function(O,N,F){return E=y(O,N,F),!E}),!!E}function Sh(f,y,E){var O=0,N=f==null?O:f.length;if(typeof y=="number"&&y===y&&N<=ut){for(;O<N;){var F=O+N>>>1,W=f[F];W!==null&&!Rr(W)&&(E?W<=y:W<y)?O=F+1:N=F}return N}return Ep(f,y,vr,E)}function Ep(f,y,E,O){var N=0,F=f==null?0:f.length;if(F===0)return 0;y=E(y);for(var W=y!==y,V=y===null,Y=Rr(y),nt=y===e;N<F;){var rt=vh((N+F)/2),ot=E(f[rt]),xt=ot!==e,Mt=ot===null,Tt=ot===ot,Kt=Rr(ot);if(W)var Ot=O||Tt;else nt?Ot=Tt&&(O||xt):V?Ot=Tt&&xt&&(O||!Mt):Y?Ot=Tt&&xt&&!Mt&&(O||!Kt):Mt||Kt?Ot=!1:Ot=O?ot<=y:ot<y;Ot?N=rt+1:F=rt}return Vn(F,ht)}function pS(f,y){for(var E=-1,O=f.length,N=0,F=[];++E<O;){var W=f[E],V=y?y(W):W;if(!E||!Si(V,Y)){var Y=V;F[N++]=W===0?0:W}}return F}function vS(f){return typeof f=="number"?f:Rr(f)?X:+f}function Nr(f){if(typeof f=="string")return f;if($t(f))return ze(f,Nr)+"";if(Rr(f))return Y_?Y_.call(f):"";var y=f+"";return y=="0"&&1/f==-1/0?"-0":y}function as(f,y,E){var O=-1,N=rh,F=f.length,W=!0,V=[],Y=V;if(E)W=!1,N=Zg;else if(F>=i){var nt=y?null:v7(f);if(nt)return ah(nt);W=!1,N=cu,Y=new no}else Y=y?[]:V;t:for(;++O<F;){var rt=f[O],ot=y?y(rt):rt;if(rt=E||rt!==0?rt:0,W&&ot===ot){for(var xt=Y.length;xt--;)if(Y[xt]===ot)continue t;y&&Y.push(ot),V.push(rt)}else N(Y,ot,E)||(Y!==V&&Y.push(ot),V.push(rt))}return V}function _p(f,y){return y=ss(y,f),f=GS(f,y),f==null||delete f[Vi(ii(y))]}function mS(f,y,E,O){return wu(f,y,E(io(f,y)),O)}function Mh(f,y,E,O){for(var N=f.length,F=O?N:-1;(O?F--:++F<N)&&y(f[F],F,f););return E?ri(f,O?0:F,O?F+1:N):ri(f,O?F+1:0,O?N:F)}function yS(f,y){var E=f;return E instanceof re&&(E=E.value()),Jg(y,function(O,N){return N.func.apply(N.thisArg,es([O],N.args))},E)}function Sp(f,y,E){var O=f.length;if(O<2)return O?as(f[0]):[];for(var N=-1,F=Z(O);++N<O;)for(var W=f[N],V=-1;++V<O;)V!=N&&(F[N]=mu(F[N]||W,f[V],y,E));return as(Fn(F,1),y,E)}function bS(f,y,E){for(var O=-1,N=f.length,F=y.length,W={};++O<N;){var V=O<F?y[O]:e;E(W,f[O],V)}return W}function Mp(f){return tn(f)?f:[]}function kp(f){return typeof f=="function"?f:vr}function ss(f,y){return $t(f)?f:Ip(f,y)?[f]:YS(de(f))}var s7=Zt;function os(f,y,E){var O=f.length;return E=E===e?O:E,!y&&E>=O?f:ri(f,y,E)}var wS=U8||function(f){return Dn.clearTimeout(f)};function xS(f,y){if(y)return f.slice();var E=f.length,O=q_?q_(E):new f.constructor(E);return f.copy(O),O}function Cp(f){var y=new f.constructor(f.byteLength);return new hh(y).set(new hh(f)),y}function o7(f,y){var E=y?Cp(f.buffer):f.buffer;return new f.constructor(E,f.byteOffset,f.byteLength)}function l7(f){var y=new f.constructor(f.source,i_.exec(f));return y.lastIndex=f.lastIndex,y}function u7(f){return pu?Ee(pu.call(f)):{}}function ES(f,y){var E=y?Cp(f.buffer):f.buffer;return new f.constructor(E,f.byteOffset,f.length)}function _S(f,y){if(f!==y){var E=f!==e,O=f===null,N=f===f,F=Rr(f),W=y!==e,V=y===null,Y=y===y,nt=Rr(y);if(!V&&!nt&&!F&&f>y||F&&W&&Y&&!V&&!nt||O&&W&&Y||!E&&Y||!N)return 1;if(!O&&!F&&!nt&&f<y||nt&&E&&N&&!O&&!F||V&&E&&N||!W&&N||!Y)return-1}return 0}function c7(f,y,E){for(var O=-1,N=f.criteria,F=y.criteria,W=N.length,V=E.length;++O<W;){var Y=_S(N[O],F[O]);if(Y){if(O>=V)return Y;var nt=E[O];return Y*(nt=="desc"?-1:1)}}return f.index-y.index}function SS(f,y,E,O){for(var N=-1,F=f.length,W=E.length,V=-1,Y=y.length,nt=bn(F-W,0),rt=Z(Y+nt),ot=!O;++V<Y;)rt[V]=y[V];for(;++N<W;)(ot||N<F)&&(rt[E[N]]=f[N]);for(;nt--;)rt[V++]=f[N++];return rt}function MS(f,y,E,O){for(var N=-1,F=f.length,W=-1,V=E.length,Y=-1,nt=y.length,rt=bn(F-V,0),ot=Z(rt+nt),xt=!O;++N<rt;)ot[N]=f[N];for(var Mt=N;++Y<nt;)ot[Mt+Y]=y[Y];for(;++W<V;)(xt||N<F)&&(ot[Mt+E[W]]=f[N++]);return ot}function fr(f,y){var E=-1,O=f.length;for(y||(y=Z(O));++E<O;)y[E]=f[E];return y}function Gi(f,y,E,O){var N=!E;E||(E={});for(var F=-1,W=y.length;++F<W;){var V=y[F],Y=O?O(E[V],f[V],V,E,f):e;Y===e&&(Y=f[V]),N?pa(E,V,Y):vu(E,V,Y)}return E}function h7(f,y){return Gi(f,Lp(f),y)}function d7(f,y){return Gi(f,BS(f),y)}function kh(f,y){return function(E,O){var N=$t(E)?m8:L9,F=y?y():{};return N(E,f,Ct(O,2),F)}}function ul(f){return Zt(function(y,E){var O=-1,N=E.length,F=N>1?E[N-1]:e,W=N>2?E[2]:e;for(F=f.length>3&&typeof F=="function"?(N--,F):e,W&&nr(E[0],E[1],W)&&(F=N<3?e:F,N=1),y=Ee(y);++O<N;){var V=E[O];V&&f(y,V,O,F)}return y})}function kS(f,y){return function(E,O){if(E==null)return E;if(!gr(E))return f(E,O);for(var N=E.length,F=y?N:-1,W=Ee(E);(y?F--:++F<N)&&O(W[F],F,W)!==!1;);return E}}function CS(f){return function(y,E,O){for(var N=-1,F=Ee(y),W=O(y),V=W.length;V--;){var Y=W[f?V:++N];if(E(F[Y],Y,F)===!1)break}return y}}function f7(f,y,E){var O=y&m,N=xu(f);function F(){var W=this&&this!==Dn&&this instanceof F?N:f;return W.apply(O?E:this,arguments)}return F}function TS(f){return function(y){y=de(y);var E=nl(y)?Ei(y):e,O=E?E[0]:y.charAt(0),N=E?os(E,1).join(""):y.slice(1);return O[f]()+N}}function cl(f){return function(y){return Jg(k3(M3(y).replace(r8,"")),f,"")}}function xu(f){return function(){var y=arguments;switch(y.length){case 0:return new f;case 1:return new f(y[0]);case 2:return new f(y[0],y[1]);case 3:return new f(y[0],y[1],y[2]);case 4:return new f(y[0],y[1],y[2],y[3]);case 5:return new f(y[0],y[1],y[2],y[3],y[4]);case 6:return new f(y[0],y[1],y[2],y[3],y[4],y[5]);case 7:return new f(y[0],y[1],y[2],y[3],y[4],y[5],y[6])}var E=ll(f.prototype),O=f.apply(E,y);return qe(O)?O:E}}function g7(f,y,E){var O=xu(f);function N(){for(var F=arguments.length,W=Z(F),V=F,Y=hl(N);V--;)W[V]=arguments[V];var nt=F<3&&W[0]!==Y&&W[F-1]!==Y?[]:ns(W,Y);if(F-=nt.length,F<E)return RS(f,y,Ch,N.placeholder,e,W,nt,e,e,E-F);var rt=this&&this!==Dn&&this instanceof N?O:f;return Ar(rt,this,W)}return N}function OS(f){return function(y,E,O){var N=Ee(y);if(!gr(y)){var F=Ct(E,3);y=Cn(y),E=function(V){return F(N[V],V,N)}}var W=f(y,E,O);return W>-1?N[F?y[W]:W]:e}}function AS(f){return ma(function(y){var E=y.length,O=E,N=ei.prototype.thru;for(f&&y.reverse();O--;){var F=y[O];if(typeof F!="function")throw new ti(s);if(N&&!W&&Ph(F)=="wrapper")var W=new ei([],!0)}for(O=W?O:E;++O<E;){F=y[O];var V=Ph(F),Y=V=="wrapper"?Np(F):e;Y&&Dp(Y[0])&&Y[1]==(k|x|_|C)&&!Y[4].length&&Y[9]==1?W=W[Ph(Y[0])].apply(W,Y[3]):W=F.length==1&&Dp(F)?W[V]():W.thru(F)}return function(){var nt=arguments,rt=nt[0];if(W&&nt.length==1&&$t(rt))return W.plant(rt).value();for(var ot=0,xt=E?y[ot].apply(this,nt):rt;++ot<E;)xt=y[ot].call(this,xt);return xt}})}function Ch(f,y,E,O,N,F,W,V,Y,nt){var rt=y&k,ot=y&m,xt=y&b,Mt=y&(x|S),Tt=y&P,Kt=xt?e:xu(f);function Ot(){for(var ee=arguments.length,ie=Z(ee),Lr=ee;Lr--;)ie[Lr]=arguments[Lr];if(Mt)var rr=hl(Ot),Ir=k8(ie,rr);if(O&&(ie=SS(ie,O,N,Mt)),F&&(ie=MS(ie,F,W,Mt)),ee-=Ir,Mt&&ee<nt){var en=ns(ie,rr);return RS(f,y,Ch,Ot.placeholder,E,ie,en,V,Y,nt-ee)}var Mi=ot?E:this,xa=xt?Mi[f]:f;return ee=ie.length,V?ie=L7(ie,V):Tt&&ee>1&&ie.reverse(),rt&&Y<ee&&(ie.length=Y),this&&this!==Dn&&this instanceof Ot&&(xa=Kt||xu(xa)),xa.apply(Mi,ie)}return Ot}function PS(f,y){return function(E,O){return q9(E,f,y(O),{})}}function Th(f,y){return function(E,O){var N;if(E===e&&O===e)return y;if(E!==e&&(N=E),O!==e){if(N===e)return O;typeof E=="string"||typeof O=="string"?(E=Nr(E),O=Nr(O)):(E=vS(E),O=vS(O)),N=f(E,O)}return N}}function Tp(f){return ma(function(y){return y=ze(y,Pr(Ct())),Zt(function(E){var O=this;return f(y,function(N){return Ar(N,O,E)})})})}function Oh(f,y){y=y===e?" ":Nr(y);var E=y.length;if(E<2)return E?xp(y,f):y;var O=xp(y,ph(f/rl(y)));return nl(y)?os(Ei(O),0,f).join(""):O.slice(0,f)}function p7(f,y,E,O){var N=y&m,F=xu(f);function W(){for(var V=-1,Y=arguments.length,nt=-1,rt=O.length,ot=Z(rt+Y),xt=this&&this!==Dn&&this instanceof W?F:f;++nt<rt;)ot[nt]=O[nt];for(;Y--;)ot[nt++]=arguments[++V];return Ar(xt,N?E:this,ot)}return W}function NS(f){return function(y,E,O){return O&&typeof O!="number"&&nr(y,E,O)&&(E=O=e),y=wa(y),E===e?(E=y,y=0):E=wa(E),O=O===e?y<E?1:-1:wa(O),t7(y,E,O,f)}}function Ah(f){return function(y,E){return typeof y=="string"&&typeof E=="string"||(y=ai(y),E=ai(E)),f(y,E)}}function RS(f,y,E,O,N,F,W,V,Y,nt){var rt=y&x,ot=rt?W:e,xt=rt?e:W,Mt=rt?F:e,Tt=rt?e:F;y|=rt?_:M,y&=~(rt?M:_),y&w||(y&=-4);var Kt=[f,y,N,Mt,ot,Tt,xt,V,Y,nt],Ot=E.apply(e,Kt);return Dp(f)&&VS(Ot,Kt),Ot.placeholder=O,HS(Ot,f,y)}function Op(f){var y=yn[f];return function(E,O){if(E=ai(E),O=O==null?0:Vn(Yt(O),292),O&&H_(E)){var N=(de(E)+"e").split("e"),F=y(N[0]+"e"+(+N[1]+O));return N=(de(F)+"e").split("e"),+(N[0]+"e"+(+N[1]-O))}return y(E)}}var v7=sl&&1/ah(new sl([,-0]))[1]==B?function(f){return new sl(f)}:Zp;function LS(f){return function(y){var E=Hn(y);return E==Ln?ap(y):E==mn?R8(y):M8(y,f(y))}}function va(f,y,E,O,N,F,W,V){var Y=y&b;if(!Y&&typeof f!="function")throw new ti(s);var nt=O?O.length:0;if(nt||(y&=-97,O=N=e),W=W===e?W:bn(Yt(W),0),V=V===e?V:Yt(V),nt-=N?N.length:0,y&M){var rt=O,ot=N;O=N=e}var xt=Y?e:Np(f),Mt=[f,y,E,O,N,rt,ot,F,W,V];if(xt&&P7(Mt,xt),f=Mt[0],y=Mt[1],E=Mt[2],O=Mt[3],N=Mt[4],V=Mt[9]=Mt[9]===e?Y?0:f.length:bn(Mt[9]-nt,0),!V&&y&(x|S)&&(y&=-25),!y||y==m)var Tt=f7(f,y,E);else y==x||y==S?Tt=g7(f,y,V):(y==_||y==(m|_))&&!N.length?Tt=p7(f,y,E,O):Tt=Ch.apply(e,Mt);var Kt=xt?gS:VS;return HS(Kt(Tt,Mt),f,y)}function IS(f,y,E,O){return f===e||Si(f,al[E])&&!fe.call(O,E)?y:f}function DS(f,y,E,O,N,F){return qe(f)&&qe(y)&&(F.set(y,f),_h(f,y,e,DS,F),F.delete(y)),f}function m7(f){return Su(f)?e:f}function FS(f,y,E,O,N,F){var W=E&p,V=f.length,Y=y.length;if(V!=Y&&!(W&&Y>V))return!1;var nt=F.get(f),rt=F.get(y);if(nt&&rt)return nt==y&&rt==f;var ot=-1,xt=!0,Mt=E&v?new no:e;for(F.set(f,y),F.set(y,f);++ot<V;){var Tt=f[ot],Kt=y[ot];if(O)var Ot=W?O(Kt,Tt,ot,y,f,F):O(Tt,Kt,ot,f,y,F);if(Ot!==e){if(Ot)continue;xt=!1;break}if(Mt){if(!Qg(y,function(ee,ie){if(!cu(Mt,ie)&&(Tt===ee||N(Tt,ee,E,O,F)))return Mt.push(ie)})){xt=!1;break}}else if(!(Tt===Kt||N(Tt,Kt,E,O,F))){xt=!1;break}}return F.delete(f),F.delete(y),xt}function y7(f,y,E,O,N,F,W){switch(E){case tr:if(f.byteLength!=y.byteLength||f.byteOffset!=y.byteOffset)return!1;f=f.buffer,y=y.buffer;case qi:return!(f.byteLength!=y.byteLength||!F(new hh(f),new hh(y)));case It:case zt:case te:return Si(+f,+y);case Rn:return f.name==y.name&&f.message==y.message;case ji:case In:return f==y+"";case Ln:var V=ap;case mn:var Y=O&p;if(V||(V=ah),f.size!=y.size&&!Y)return!1;var nt=W.get(f);if(nt)return nt==y;O|=v,W.set(f,y);var rt=FS(V(f),V(y),O,N,F,W);return W.delete(f),rt;case Be:if(pu)return pu.call(f)==pu.call(y)}return!1}function b7(f,y,E,O,N,F){var W=E&p,V=Ap(f),Y=V.length,nt=Ap(y),rt=nt.length;if(Y!=rt&&!W)return!1;for(var ot=Y;ot--;){var xt=V[ot];if(!(W?xt in y:fe.call(y,xt)))return!1}var Mt=F.get(f),Tt=F.get(y);if(Mt&&Tt)return Mt==y&&Tt==f;var Kt=!0;F.set(f,y),F.set(y,f);for(var Ot=W;++ot<Y;){xt=V[ot];var ee=f[xt],ie=y[xt];if(O)var Lr=W?O(ie,ee,xt,y,f,F):O(ee,ie,xt,f,y,F);if(!(Lr===e?ee===ie||N(ee,ie,E,O,F):Lr)){Kt=!1;break}Ot||(Ot=xt=="constructor")}if(Kt&&!Ot){var rr=f.constructor,Ir=y.constructor;rr!=Ir&&"constructor"in f&&"constructor"in y&&!(typeof rr=="function"&&rr instanceof rr&&typeof Ir=="function"&&Ir instanceof Ir)&&(Kt=!1)}return F.delete(f),F.delete(y),Kt}function ma(f){return Bp(WS(f,e,JS),f+"")}function Ap(f){return rS(f,Cn,Lp)}function Pp(f){return rS(f,pr,BS)}var Np=mh?function(f){return mh.get(f)}:Zp;function Ph(f){for(var y=f.name+"",E=ol[y],O=fe.call(ol,y)?E.length:0;O--;){var N=E[O],F=N.func;if(F==null||F==f)return N.name}return y}function hl(f){var y=fe.call(I,"placeholder")?I:f;return y.placeholder}function Ct(){var f=I.iteratee||Xp;return f=f===Xp?sS:f,arguments.length?f(arguments[0],arguments[1]):f}function Nh(f,y){var E=f.__data__;return C7(y)?E[typeof y=="string"?"string":"hash"]:E.map}function Rp(f){for(var y=Cn(f),E=y.length;E--;){var O=y[E],N=f[O];y[E]=[O,N,jS(N)]}return y}function ao(f,y){var E=A8(f,y);return aS(E)?E:e}function w7(f){var y=fe.call(f,to),E=f[to];try{f[to]=e;var O=!0}catch{}var N=uh.call(f);return O&&(y?f[to]=E:delete f[to]),N}var Lp=op?function(f){return f==null?[]:(f=Ee(f),ts(op(f),function(y){return G_.call(f,y)}))}:Jp,BS=op?function(f){for(var y=[];f;)es(y,Lp(f)),f=dh(f);return y}:Jp,Hn=er;(lp&&Hn(new lp(new ArrayBuffer(1)))!=tr||du&&Hn(new du)!=Ln||up&&Hn(up.resolve())!=Kr||sl&&Hn(new sl)!=mn||fu&&Hn(new fu)!=kn)&&(Hn=function(f){var y=er(f),E=y==Gt?f.constructor:e,O=E?so(E):"";if(O)switch(O){case n9:return tr;case r9:return Ln;case i9:return Kr;case a9:return mn;case s9:return kn}return y});function x7(f,y,E){for(var O=-1,N=E.length;++O<N;){var F=E[O],W=F.size;switch(F.type){case"drop":f+=W;break;case"dropRight":y-=W;break;case"take":y=Vn(y,f+W);break;case"takeRight":f=bn(f,y-W);break}}return{start:f,end:y}}function E7(f){var y=f.match(T4);return y?y[1].split(O4):[]}function zS(f,y,E){y=ss(y,f);for(var O=-1,N=y.length,F=!1;++O<N;){var W=Vi(y[O]);if(!(F=f!=null&&E(f,W)))break;f=f[W]}return F||++O!=N?F:(N=f==null?0:f.length,!!N&&zh(N)&&ya(W,N)&&($t(f)||oo(f)))}function _7(f){var y=f.length,E=new f.constructor(y);return y&&typeof f[0]=="string"&&fe.call(f,"index")&&(E.index=f.index,E.input=f.input),E}function $S(f){return typeof f.constructor=="function"&&!Eu(f)?ll(dh(f)):{}}function S7(f,y,E){var O=f.constructor;switch(y){case qi:return Cp(f);case It:case zt:return new O(+f);case tr:return o7(f,E);case Ja:case Qa:case uu:case Qo:case Zr:case xi:case zg:case $g:case jg:return ES(f,E);case Ln:return new O;case te:case In:return new O(f);case ji:return l7(f);case mn:return new O;case Be:return u7(f)}}function M7(f,y){var E=y.length;if(!E)return f;var O=E-1;return y[O]=(E>1?"& ":"")+y[O],y=y.join(E>2?", ":" "),f.replace(C4,`{
- /* [wrapped with `+y+`] */
- `)}function k7(f){return $t(f)||oo(f)||!!(V_&&f&&f[V_])}function ya(f,y){var E=typeof f;return y=y??D,!!y&&(E=="number"||E!="symbol"&&B4.test(f))&&f>-1&&f%1==0&&f<y}function nr(f,y,E){if(!qe(E))return!1;var O=typeof y;return(O=="number"?gr(E)&&ya(y,E.length):O=="string"&&y in E)?Si(E[y],f):!1}function Ip(f,y){if($t(f))return!1;var E=typeof f;return E=="number"||E=="symbol"||E=="boolean"||f==null||Rr(f)?!0:_4.test(f)||!E4.test(f)||y!=null&&f in Ee(y)}function C7(f){var y=typeof f;return y=="string"||y=="number"||y=="symbol"||y=="boolean"?f!=="__proto__":f===null}function Dp(f){var y=Ph(f),E=I[y];if(typeof E!="function"||!(y in re.prototype))return!1;if(f===E)return!0;var O=Np(E);return!!O&&f===O[0]}function T7(f){return!!j_&&j_ in f}var O7=oh?ba:Qp;function Eu(f){var y=f&&f.constructor,E=typeof y=="function"&&y.prototype||al;return f===E}function jS(f){return f===f&&!qe(f)}function qS(f,y){return function(E){return E==null?!1:E[f]===y&&(y!==e||f in Ee(E))}}function A7(f){var y=Fh(f,function(O){return E.size===u&&E.clear(),O}),E=y.cache;return y}function P7(f,y){var E=f[1],O=y[1],N=E|O,F=N<(m|b|k),W=O==k&&E==x||O==k&&E==C&&f[7].length<=y[8]||O==(k|C)&&y[7].length<=y[8]&&E==x;if(!(F||W))return f;O&m&&(f[2]=y[2],N|=E&m?0:w);var V=y[3];if(V){var Y=f[3];f[3]=Y?SS(Y,V,y[4]):V,f[4]=Y?ns(f[3],c):y[4]}return V=y[5],V&&(Y=f[5],f[5]=Y?MS(Y,V,y[6]):V,f[6]=Y?ns(f[5],c):y[6]),V=y[7],V&&(f[7]=V),O&k&&(f[8]=f[8]==null?y[8]:Vn(f[8],y[8])),f[9]==null&&(f[9]=y[9]),f[0]=y[0],f[1]=N,f}function N7(f){var y=[];if(f!=null)for(var E in Ee(f))y.push(E);return y}function R7(f){return uh.call(f)}function WS(f,y,E){return y=bn(y===e?f.length-1:y,0),function(){for(var O=arguments,N=-1,F=bn(O.length-y,0),W=Z(F);++N<F;)W[N]=O[y+N];N=-1;for(var V=Z(y+1);++N<y;)V[N]=O[N];return V[y]=E(W),Ar(f,this,V)}}function GS(f,y){return y.length<2?f:io(f,ri(y,0,-1))}function L7(f,y){for(var E=f.length,O=Vn(y.length,E),N=fr(f);O--;){var F=y[O];f[O]=ya(F,E)?N[F]:e}return f}function Fp(f,y){if(!(y==="constructor"&&typeof f[y]=="function")&&y!="__proto__")return f[y]}var VS=US(gS),_u=X8||function(f,y){return Dn.setTimeout(f,y)},Bp=US(r7);function HS(f,y,E){var O=y+"";return Bp(f,M7(O,I7(E7(O),E)))}function US(f){var y=0,E=0;return function(){var O=Q8(),N=L-(O-E);if(E=O,N>0){if(++y>=R)return arguments[0]}else y=0;return f.apply(e,arguments)}}function Rh(f,y){var E=-1,O=f.length,N=O-1;for(y=y===e?O:y;++E<y;){var F=wp(E,N),W=f[F];f[F]=f[E],f[E]=W}return f.length=y,f}var YS=A7(function(f){var y=[];return f.charCodeAt(0)===46&&y.push(""),f.replace(S4,function(E,O,N,F){y.push(N?F.replace(N4,"$1"):O||E)}),y});function Vi(f){if(typeof f=="string"||Rr(f))return f;var y=f+"";return y=="0"&&1/f==-1/0?"-0":y}function so(f){if(f!=null){try{return lh.call(f)}catch{}try{return f+""}catch{}}return""}function I7(f,y){return Qr(ct,function(E){var O="_."+E[0];y&E[1]&&!rh(f,O)&&f.push(O)}),f.sort()}function XS(f){if(f instanceof re)return f.clone();var y=new ei(f.__wrapped__,f.__chain__);return y.__actions__=fr(f.__actions__),y.__index__=f.__index__,y.__values__=f.__values__,y}function D7(f,y,E){(E?nr(f,y,E):y===e)?y=1:y=bn(Yt(y),0);var O=f==null?0:f.length;if(!O||y<1)return[];for(var N=0,F=0,W=Z(ph(O/y));N<O;)W[F++]=ri(f,N,N+=y);return W}function F7(f){for(var y=-1,E=f==null?0:f.length,O=0,N=[];++y<E;){var F=f[y];F&&(N[O++]=F)}return N}function B7(){var f=arguments.length;if(!f)return[];for(var y=Z(f-1),E=arguments[0],O=f;O--;)y[O-1]=arguments[O];return es($t(E)?fr(E):[E],Fn(y,1))}var z7=Zt(function(f,y){return tn(f)?mu(f,Fn(y,1,tn,!0)):[]}),$7=Zt(function(f,y){var E=ii(y);return tn(E)&&(E=e),tn(f)?mu(f,Fn(y,1,tn,!0),Ct(E,2)):[]}),j7=Zt(function(f,y){var E=ii(y);return tn(E)&&(E=e),tn(f)?mu(f,Fn(y,1,tn,!0),e,E):[]});function q7(f,y,E){var O=f==null?0:f.length;return O?(y=E||y===e?1:Yt(y),ri(f,y<0?0:y,O)):[]}function W7(f,y,E){var O=f==null?0:f.length;return O?(y=E||y===e?1:Yt(y),y=O-y,ri(f,0,y<0?0:y)):[]}function G7(f,y){return f&&f.length?Mh(f,Ct(y,3),!0,!0):[]}function V7(f,y){return f&&f.length?Mh(f,Ct(y,3),!0):[]}function H7(f,y,E,O){var N=f==null?0:f.length;return N?(E&&typeof E!="number"&&nr(f,y,E)&&(E=0,O=N),B9(f,y,E,O)):[]}function KS(f,y,E){var O=f==null?0:f.length;if(!O)return-1;var N=E==null?0:Yt(E);return N<0&&(N=bn(O+N,0)),ih(f,Ct(y,3),N)}function ZS(f,y,E){var O=f==null?0:f.length;if(!O)return-1;var N=O-1;return E!==e&&(N=Yt(E),N=E<0?bn(O+N,0):Vn(N,O-1)),ih(f,Ct(y,3),N,!0)}function JS(f){var y=f==null?0:f.length;return y?Fn(f,1):[]}function U7(f){var y=f==null?0:f.length;return y?Fn(f,B):[]}function Y7(f,y){var E=f==null?0:f.length;return E?(y=y===e?1:Yt(y),Fn(f,y)):[]}function X7(f){for(var y=-1,E=f==null?0:f.length,O={};++y<E;){var N=f[y];O[N[0]]=N[1]}return O}function QS(f){return f&&f.length?f[0]:e}function K7(f,y,E){var O=f==null?0:f.length;if(!O)return-1;var N=E==null?0:Yt(E);return N<0&&(N=bn(O+N,0)),el(f,y,N)}function Z7(f){var y=f==null?0:f.length;return y?ri(f,0,-1):[]}var J7=Zt(function(f){var y=ze(f,Mp);return y.length&&y[0]===f[0]?pp(y):[]}),Q7=Zt(function(f){var y=ii(f),E=ze(f,Mp);return y===ii(E)?y=e:E.pop(),E.length&&E[0]===f[0]?pp(E,Ct(y,2)):[]}),tF=Zt(function(f){var y=ii(f),E=ze(f,Mp);return y=typeof y=="function"?y:e,y&&E.pop(),E.length&&E[0]===f[0]?pp(E,e,y):[]});function eF(f,y){return f==null?"":Z8.call(f,y)}function ii(f){var y=f==null?0:f.length;return y?f[y-1]:e}function nF(f,y,E){var O=f==null?0:f.length;if(!O)return-1;var N=O;return E!==e&&(N=Yt(E),N=N<0?bn(O+N,0):Vn(N,O-1)),y===y?I8(f,y,N):ih(f,R_,N,!0)}function rF(f,y){return f&&f.length?cS(f,Yt(y)):e}var iF=Zt(t3);function t3(f,y){return f&&f.length&&y&&y.length?bp(f,y):f}function aF(f,y,E){return f&&f.length&&y&&y.length?bp(f,y,Ct(E,2)):f}function sF(f,y,E){return f&&f.length&&y&&y.length?bp(f,y,e,E):f}var oF=ma(function(f,y){var E=f==null?0:f.length,O=hp(f,y);return fS(f,ze(y,function(N){return ya(N,E)?+N:N}).sort(_S)),O});function lF(f,y){var E=[];if(!(f&&f.length))return E;var O=-1,N=[],F=f.length;for(y=Ct(y,3);++O<F;){var W=f[O];y(W,O,f)&&(E.push(W),N.push(O))}return fS(f,N),E}function zp(f){return f==null?f:e9.call(f)}function uF(f,y,E){var O=f==null?0:f.length;return O?(E&&typeof E!="number"&&nr(f,y,E)?(y=0,E=O):(y=y==null?0:Yt(y),E=E===e?O:Yt(E)),ri(f,y,E)):[]}function cF(f,y){return Sh(f,y)}function hF(f,y,E){return Ep(f,y,Ct(E,2))}function dF(f,y){var E=f==null?0:f.length;if(E){var O=Sh(f,y);if(O<E&&Si(f[O],y))return O}return-1}function fF(f,y){return Sh(f,y,!0)}function gF(f,y,E){return Ep(f,y,Ct(E,2),!0)}function pF(f,y){var E=f==null?0:f.length;if(E){var O=Sh(f,y,!0)-1;if(Si(f[O],y))return O}return-1}function vF(f){return f&&f.length?pS(f):[]}function mF(f,y){return f&&f.length?pS(f,Ct(y,2)):[]}function yF(f){var y=f==null?0:f.length;return y?ri(f,1,y):[]}function bF(f,y,E){return f&&f.length?(y=E||y===e?1:Yt(y),ri(f,0,y<0?0:y)):[]}function wF(f,y,E){var O=f==null?0:f.length;return O?(y=E||y===e?1:Yt(y),y=O-y,ri(f,y<0?0:y,O)):[]}function xF(f,y){return f&&f.length?Mh(f,Ct(y,3),!1,!0):[]}function EF(f,y){return f&&f.length?Mh(f,Ct(y,3)):[]}var _F=Zt(function(f){return as(Fn(f,1,tn,!0))}),SF=Zt(function(f){var y=ii(f);return tn(y)&&(y=e),as(Fn(f,1,tn,!0),Ct(y,2))}),MF=Zt(function(f){var y=ii(f);return y=typeof y=="function"?y:e,as(Fn(f,1,tn,!0),e,y)});function kF(f){return f&&f.length?as(f):[]}function CF(f,y){return f&&f.length?as(f,Ct(y,2)):[]}function TF(f,y){return y=typeof y=="function"?y:e,f&&f.length?as(f,e,y):[]}function $p(f){if(!(f&&f.length))return[];var y=0;return f=ts(f,function(E){if(tn(E))return y=bn(E.length,y),!0}),rp(y,function(E){return ze(f,tp(E))})}function e3(f,y){if(!(f&&f.length))return[];var E=$p(f);return y==null?E:ze(E,function(O){return Ar(y,e,O)})}var OF=Zt(function(f,y){return tn(f)?mu(f,y):[]}),AF=Zt(function(f){return Sp(ts(f,tn))}),PF=Zt(function(f){var y=ii(f);return tn(y)&&(y=e),Sp(ts(f,tn),Ct(y,2))}),NF=Zt(function(f){var y=ii(f);return y=typeof y=="function"?y:e,Sp(ts(f,tn),e,y)}),RF=Zt($p);function LF(f,y){return bS(f||[],y||[],vu)}function IF(f,y){return bS(f||[],y||[],wu)}var DF=Zt(function(f){var y=f.length,E=y>1?f[y-1]:e;return E=typeof E=="function"?(f.pop(),E):e,e3(f,E)});function n3(f){var y=I(f);return y.__chain__=!0,y}function FF(f,y){return y(f),f}function Lh(f,y){return y(f)}var BF=ma(function(f){var y=f.length,E=y?f[0]:0,O=this.__wrapped__,N=function(F){return hp(F,f)};return y>1||this.__actions__.length||!(O instanceof re)||!ya(E)?this.thru(N):(O=O.slice(E,+E+(y?1:0)),O.__actions__.push({func:Lh,args:[N],thisArg:e}),new ei(O,this.__chain__).thru(function(F){return y&&!F.length&&F.push(e),F}))});function zF(){return n3(this)}function $F(){return new ei(this.value(),this.__chain__)}function jF(){this.__values__===e&&(this.__values__=v3(this.value()));var f=this.__index__>=this.__values__.length,y=f?e:this.__values__[this.__index__++];return{done:f,value:y}}function qF(){return this}function WF(f){for(var y,E=this;E instanceof bh;){var O=XS(E);O.__index__=0,O.__values__=e,y?N.__wrapped__=O:y=O;var N=O;E=E.__wrapped__}return N.__wrapped__=f,y}function GF(){var f=this.__wrapped__;if(f instanceof re){var y=f;return this.__actions__.length&&(y=new re(this)),y=y.reverse(),y.__actions__.push({func:Lh,args:[zp],thisArg:e}),new ei(y,this.__chain__)}return this.thru(zp)}function VF(){return yS(this.__wrapped__,this.__actions__)}var HF=kh(function(f,y,E){fe.call(f,E)?++f[E]:pa(f,E,1)});function UF(f,y,E){var O=$t(f)?P_:F9;return E&&nr(f,y,E)&&(y=e),O(f,Ct(y,3))}function YF(f,y){var E=$t(f)?ts:eS;return E(f,Ct(y,3))}var XF=OS(KS),KF=OS(ZS);function ZF(f,y){return Fn(Ih(f,y),1)}function JF(f,y){return Fn(Ih(f,y),B)}function QF(f,y,E){return E=E===e?1:Yt(E),Fn(Ih(f,y),E)}function r3(f,y){var E=$t(f)?Qr:is;return E(f,Ct(y,3))}function i3(f,y){var E=$t(f)?y8:tS;return E(f,Ct(y,3))}var tB=kh(function(f,y,E){fe.call(f,E)?f[E].push(y):pa(f,E,[y])});function eB(f,y,E,O){f=gr(f)?f:fl(f),E=E&&!O?Yt(E):0;var N=f.length;return E<0&&(E=bn(N+E,0)),$h(f)?E<=N&&f.indexOf(y,E)>-1:!!N&&el(f,y,E)>-1}var nB=Zt(function(f,y,E){var O=-1,N=typeof y=="function",F=gr(f)?Z(f.length):[];return is(f,function(W){F[++O]=N?Ar(y,W,E):yu(W,y,E)}),F}),rB=kh(function(f,y,E){pa(f,E,y)});function Ih(f,y){var E=$t(f)?ze:oS;return E(f,Ct(y,3))}function iB(f,y,E,O){return f==null?[]:($t(y)||(y=y==null?[]:[y]),E=O?e:E,$t(E)||(E=E==null?[]:[E]),hS(f,y,E))}var aB=kh(function(f,y,E){f[E?0:1].push(y)},function(){return[[],[]]});function sB(f,y,E){var O=$t(f)?Jg:I_,N=arguments.length<3;return O(f,Ct(y,4),E,N,is)}function oB(f,y,E){var O=$t(f)?b8:I_,N=arguments.length<3;return O(f,Ct(y,4),E,N,tS)}function lB(f,y){var E=$t(f)?ts:eS;return E(f,Bh(Ct(y,3)))}function uB(f){var y=$t(f)?K_:e7;return y(f)}function cB(f,y,E){(E?nr(f,y,E):y===e)?y=1:y=Yt(y);var O=$t(f)?N9:n7;return O(f,y)}function hB(f){var y=$t(f)?R9:i7;return y(f)}function dB(f){if(f==null)return 0;if(gr(f))return $h(f)?rl(f):f.length;var y=Hn(f);return y==Ln||y==mn?f.size:mp(f).length}function fB(f,y,E){var O=$t(f)?Qg:a7;return E&&nr(f,y,E)&&(y=e),O(f,Ct(y,3))}var gB=Zt(function(f,y){if(f==null)return[];var E=y.length;return E>1&&nr(f,y[0],y[1])?y=[]:E>2&&nr(y[0],y[1],y[2])&&(y=[y[0]]),hS(f,Fn(y,1),[])}),Dh=Y8||function(){return Dn.Date.now()};function pB(f,y){if(typeof y!="function")throw new ti(s);return f=Yt(f),function(){if(--f<1)return y.apply(this,arguments)}}function a3(f,y,E){return y=E?e:y,y=f&&y==null?f.length:y,va(f,k,e,e,e,e,y)}function s3(f,y){var E;if(typeof y!="function")throw new ti(s);return f=Yt(f),function(){return--f>0&&(E=y.apply(this,arguments)),f<=1&&(y=e),E}}var jp=Zt(function(f,y,E){var O=m;if(E.length){var N=ns(E,hl(jp));O|=_}return va(f,O,y,E,N)}),o3=Zt(function(f,y,E){var O=m|b;if(E.length){var N=ns(E,hl(o3));O|=_}return va(y,O,f,E,N)});function l3(f,y,E){y=E?e:y;var O=va(f,x,e,e,e,e,e,y);return O.placeholder=l3.placeholder,O}function u3(f,y,E){y=E?e:y;var O=va(f,S,e,e,e,e,e,y);return O.placeholder=u3.placeholder,O}function c3(f,y,E){var O,N,F,W,V,Y,nt=0,rt=!1,ot=!1,xt=!0;if(typeof f!="function")throw new ti(s);y=ai(y)||0,qe(E)&&(rt=!!E.leading,ot="maxWait"in E,F=ot?bn(ai(E.maxWait)||0,y):F,xt="trailing"in E?!!E.trailing:xt);function Mt(en){var Mi=O,xa=N;return O=N=e,nt=en,W=f.apply(xa,Mi),W}function Tt(en){return nt=en,V=_u(ee,y),rt?Mt(en):W}function Kt(en){var Mi=en-Y,xa=en-nt,O3=y-Mi;return ot?Vn(O3,F-xa):O3}function Ot(en){var Mi=en-Y,xa=en-nt;return Y===e||Mi>=y||Mi<0||ot&&xa>=F}function ee(){var en=Dh();if(Ot(en))return ie(en);V=_u(ee,Kt(en))}function ie(en){return V=e,xt&&O?Mt(en):(O=N=e,W)}function Lr(){V!==e&&wS(V),nt=0,O=Y=N=V=e}function rr(){return V===e?W:ie(Dh())}function Ir(){var en=Dh(),Mi=Ot(en);if(O=arguments,N=this,Y=en,Mi){if(V===e)return Tt(Y);if(ot)return wS(V),V=_u(ee,y),Mt(Y)}return V===e&&(V=_u(ee,y)),W}return Ir.cancel=Lr,Ir.flush=rr,Ir}var vB=Zt(function(f,y){return Q_(f,1,y)}),mB=Zt(function(f,y,E){return Q_(f,ai(y)||0,E)});function yB(f){return va(f,P)}function Fh(f,y){if(typeof f!="function"||y!=null&&typeof y!="function")throw new ti(s);var E=function(){var O=arguments,N=y?y.apply(this,O):O[0],F=E.cache;if(F.has(N))return F.get(N);var W=f.apply(this,O);return E.cache=F.set(N,W)||F,W};return E.cache=new(Fh.Cache||ga),E}Fh.Cache=ga;function Bh(f){if(typeof f!="function")throw new ti(s);return function(){var y=arguments;switch(y.length){case 0:return!f.call(this);case 1:return!f.call(this,y[0]);case 2:return!f.call(this,y[0],y[1]);case 3:return!f.call(this,y[0],y[1],y[2])}return!f.apply(this,y)}}function bB(f){return s3(2,f)}var wB=s7(function(f,y){y=y.length==1&&$t(y[0])?ze(y[0],Pr(Ct())):ze(Fn(y,1),Pr(Ct()));var E=y.length;return Zt(function(O){for(var N=-1,F=Vn(O.length,E);++N<F;)O[N]=y[N].call(this,O[N]);return Ar(f,this,O)})}),qp=Zt(function(f,y){var E=ns(y,hl(qp));return va(f,_,e,y,E)}),h3=Zt(function(f,y){var E=ns(y,hl(h3));return va(f,M,e,y,E)}),xB=ma(function(f,y){return va(f,C,e,e,e,y)});function EB(f,y){if(typeof f!="function")throw new ti(s);return y=y===e?y:Yt(y),Zt(f,y)}function _B(f,y){if(typeof f!="function")throw new ti(s);return y=y==null?0:bn(Yt(y),0),Zt(function(E){var O=E[y],N=os(E,0,y);return O&&es(N,O),Ar(f,this,N)})}function SB(f,y,E){var O=!0,N=!0;if(typeof f!="function")throw new ti(s);return qe(E)&&(O="leading"in E?!!E.leading:O,N="trailing"in E?!!E.trailing:N),c3(f,y,{leading:O,maxWait:y,trailing:N})}function MB(f){return a3(f,1)}function kB(f,y){return qp(kp(y),f)}function CB(){if(!arguments.length)return[];var f=arguments[0];return $t(f)?f:[f]}function TB(f){return ni(f,g)}function OB(f,y){return y=typeof y=="function"?y:e,ni(f,g,y)}function AB(f){return ni(f,h|g)}function PB(f,y){return y=typeof y=="function"?y:e,ni(f,h|g,y)}function NB(f,y){return y==null||J_(f,y,Cn(y))}function Si(f,y){return f===y||f!==f&&y!==y}var RB=Ah(gp),LB=Ah(function(f,y){return f>=y}),oo=iS(function(){return arguments}())?iS:function(f){return Xe(f)&&fe.call(f,"callee")&&!G_.call(f,"callee")},$t=Z.isArray,IB=M_?Pr(M_):W9;function gr(f){return f!=null&&zh(f.length)&&!ba(f)}function tn(f){return Xe(f)&&gr(f)}function DB(f){return f===!0||f===!1||Xe(f)&&er(f)==It}var ls=K8||Qp,FB=k_?Pr(k_):G9;function BB(f){return Xe(f)&&f.nodeType===1&&!Su(f)}function zB(f){if(f==null)return!0;if(gr(f)&&($t(f)||typeof f=="string"||typeof f.splice=="function"||ls(f)||dl(f)||oo(f)))return!f.length;var y=Hn(f);if(y==Ln||y==mn)return!f.size;if(Eu(f))return!mp(f).length;for(var E in f)if(fe.call(f,E))return!1;return!0}function $B(f,y){return bu(f,y)}function jB(f,y,E){E=typeof E=="function"?E:e;var O=E?E(f,y):e;return O===e?bu(f,y,e,E):!!O}function Wp(f){if(!Xe(f))return!1;var y=er(f);return y==Rn||y==Te||typeof f.message=="string"&&typeof f.name=="string"&&!Su(f)}function qB(f){return typeof f=="number"&&H_(f)}function ba(f){if(!qe(f))return!1;var y=er(f);return y==ln||y==dr||y==mt||y==Or}function d3(f){return typeof f=="number"&&f==Yt(f)}function zh(f){return typeof f=="number"&&f>-1&&f%1==0&&f<=D}function qe(f){var y=typeof f;return f!=null&&(y=="object"||y=="function")}function Xe(f){return f!=null&&typeof f=="object"}var f3=C_?Pr(C_):H9;function WB(f,y){return f===y||vp(f,y,Rp(y))}function GB(f,y,E){return E=typeof E=="function"?E:e,vp(f,y,Rp(y),E)}function VB(f){return g3(f)&&f!=+f}function HB(f){if(O7(f))throw new Dt(a);return aS(f)}function UB(f){return f===null}function YB(f){return f==null}function g3(f){return typeof f=="number"||Xe(f)&&er(f)==te}function Su(f){if(!Xe(f)||er(f)!=Gt)return!1;var y=dh(f);if(y===null)return!0;var E=fe.call(y,"constructor")&&y.constructor;return typeof E=="function"&&E instanceof E&&lh.call(E)==G8}var Gp=T_?Pr(T_):U9;function XB(f){return d3(f)&&f>=-9007199254740991&&f<=D}var p3=O_?Pr(O_):Y9;function $h(f){return typeof f=="string"||!$t(f)&&Xe(f)&&er(f)==In}function Rr(f){return typeof f=="symbol"||Xe(f)&&er(f)==Be}var dl=A_?Pr(A_):X9;function KB(f){return f===e}function ZB(f){return Xe(f)&&Hn(f)==kn}function JB(f){return Xe(f)&&er(f)==wi}var QB=Ah(yp),tz=Ah(function(f,y){return f<=y});function v3(f){if(!f)return[];if(gr(f))return $h(f)?Ei(f):fr(f);if(hu&&f[hu])return N8(f[hu]());var y=Hn(f),E=y==Ln?ap:y==mn?ah:fl;return E(f)}function wa(f){if(!f)return f===0?f:0;if(f=ai(f),f===B||f===-1/0){var y=f<0?-1:1;return y*G}return f===f?f:0}function Yt(f){var y=wa(f),E=y%1;return y===y?E?y-E:y:0}function m3(f){return f?ro(Yt(f),0,K):0}function ai(f){if(typeof f=="number")return f;if(Rr(f))return X;if(qe(f)){var y=typeof f.valueOf=="function"?f.valueOf():f;f=qe(y)?y+"":y}if(typeof f!="string")return f===0?f:+f;f=D_(f);var E=I4.test(f);return E||F4.test(f)?p8(f.slice(2),E?2:8):L4.test(f)?X:+f}function y3(f){return Gi(f,pr(f))}function ez(f){return f?ro(Yt(f),-9007199254740991,D):f===0?f:0}function de(f){return f==null?"":Nr(f)}var nz=ul(function(f,y){if(Eu(y)||gr(y)){Gi(y,Cn(y),f);return}for(var E in y)fe.call(y,E)&&vu(f,E,y[E])}),b3=ul(function(f,y){Gi(y,pr(y),f)}),jh=ul(function(f,y,E,O){Gi(y,pr(y),f,O)}),rz=ul(function(f,y,E,O){Gi(y,Cn(y),f,O)}),iz=ma(hp);function az(f,y){var E=ll(f);return y==null?E:Z_(E,y)}var sz=Zt(function(f,y){f=Ee(f);var E=-1,O=y.length,N=O>2?y[2]:e;for(N&&nr(y[0],y[1],N)&&(O=1);++E<O;)for(var F=y[E],W=pr(F),V=-1,Y=W.length;++V<Y;){var nt=W[V],rt=f[nt];(rt===e||Si(rt,al[nt])&&!fe.call(f,nt))&&(f[nt]=F[nt])}return f}),oz=Zt(function(f){return f.push(e,DS),Ar(w3,e,f)});function lz(f,y){return N_(f,Ct(y,3),Wi)}function uz(f,y){return N_(f,Ct(y,3),fp)}function cz(f,y){return f==null?f:dp(f,Ct(y,3),pr)}function hz(f,y){return f==null?f:nS(f,Ct(y,3),pr)}function dz(f,y){return f&&Wi(f,Ct(y,3))}function fz(f,y){return f&&fp(f,Ct(y,3))}function gz(f){return f==null?[]:Eh(f,Cn(f))}function pz(f){return f==null?[]:Eh(f,pr(f))}function Vp(f,y,E){var O=f==null?e:io(f,y);return O===e?E:O}function vz(f,y){return f!=null&&zS(f,y,z9)}function Hp(f,y){return f!=null&&zS(f,y,$9)}var mz=PS(function(f,y,E){y!=null&&typeof y.toString!="function"&&(y=uh.call(y)),f[y]=E},Yp(vr)),yz=PS(function(f,y,E){y!=null&&typeof y.toString!="function"&&(y=uh.call(y)),fe.call(f,y)?f[y].push(E):f[y]=[E]},Ct),bz=Zt(yu);function Cn(f){return gr(f)?X_(f):mp(f)}function pr(f){return gr(f)?X_(f,!0):K9(f)}function wz(f,y){var E={};return y=Ct(y,3),Wi(f,function(O,N,F){pa(E,y(O,N,F),O)}),E}function xz(f,y){var E={};return y=Ct(y,3),Wi(f,function(O,N,F){pa(E,N,y(O,N,F))}),E}var Ez=ul(function(f,y,E){_h(f,y,E)}),w3=ul(function(f,y,E,O){_h(f,y,E,O)}),_z=ma(function(f,y){var E={};if(f==null)return E;var O=!1;y=ze(y,function(F){return F=ss(F,f),O||(O=F.length>1),F}),Gi(f,Pp(f),E),O&&(E=ni(E,h|d|g,m7));for(var N=y.length;N--;)_p(E,y[N]);return E});function Sz(f,y){return x3(f,Bh(Ct(y)))}var Mz=ma(function(f,y){return f==null?{}:J9(f,y)});function x3(f,y){if(f==null)return{};var E=ze(Pp(f),function(O){return[O]});return y=Ct(y),dS(f,E,function(O,N){return y(O,N[0])})}function kz(f,y,E){y=ss(y,f);var O=-1,N=y.length;for(N||(N=1,f=e);++O<N;){var F=f==null?e:f[Vi(y[O])];F===e&&(O=N,F=E),f=ba(F)?F.call(f):F}return f}function Cz(f,y,E){return f==null?f:wu(f,y,E)}function Tz(f,y,E,O){return O=typeof O=="function"?O:e,f==null?f:wu(f,y,E,O)}var E3=LS(Cn),_3=LS(pr);function Oz(f,y,E){var O=$t(f),N=O||ls(f)||dl(f);if(y=Ct(y,4),E==null){var F=f&&f.constructor;N?E=O?new F:[]:qe(f)?E=ba(F)?ll(dh(f)):{}:E={}}return(N?Qr:Wi)(f,function(W,V,Y){return y(E,W,V,Y)}),E}function Az(f,y){return f==null?!0:_p(f,y)}function Pz(f,y,E){return f==null?f:mS(f,y,kp(E))}function Nz(f,y,E,O){return O=typeof O=="function"?O:e,f==null?f:mS(f,y,kp(E),O)}function fl(f){return f==null?[]:ip(f,Cn(f))}function Rz(f){return f==null?[]:ip(f,pr(f))}function Lz(f,y,E){return E===e&&(E=y,y=e),E!==e&&(E=ai(E),E=E===E?E:0),y!==e&&(y=ai(y),y=y===y?y:0),ro(ai(f),y,E)}function Iz(f,y,E){return y=wa(y),E===e?(E=y,y=0):E=wa(E),f=ai(f),j9(f,y,E)}function Dz(f,y,E){if(E&&typeof E!="boolean"&&nr(f,y,E)&&(y=E=e),E===e&&(typeof y=="boolean"?(E=y,y=e):typeof f=="boolean"&&(E=f,f=e)),f===e&&y===e?(f=0,y=1):(f=wa(f),y===e?(y=f,f=0):y=wa(y)),f>y){var O=f;f=y,y=O}if(E||f%1||y%1){var N=U_();return Vn(f+N*(y-f+g8("1e-"+((N+"").length-1))),y)}return wp(f,y)}var Fz=cl(function(f,y,E){return y=y.toLowerCase(),f+(E?S3(y):y)});function S3(f){return Up(de(f).toLowerCase())}function M3(f){return f=de(f),f&&f.replace(z4,C8).replace(i8,"")}function Bz(f,y,E){f=de(f),y=Nr(y);var O=f.length;E=E===e?O:ro(Yt(E),0,O);var N=E;return E-=y.length,E>=0&&f.slice(E,N)==y}function zz(f){return f=de(f),f&&b4.test(f)?f.replace(n_,T8):f}function $z(f){return f=de(f),f&&M4.test(f)?f.replace(qg,"\\$&"):f}var jz=cl(function(f,y,E){return f+(E?"-":"")+y.toLowerCase()}),qz=cl(function(f,y,E){return f+(E?" ":"")+y.toLowerCase()}),Wz=TS("toLowerCase");function Gz(f,y,E){f=de(f),y=Yt(y);var O=y?rl(f):0;if(!y||O>=y)return f;var N=(y-O)/2;return Oh(vh(N),E)+f+Oh(ph(N),E)}function Vz(f,y,E){f=de(f),y=Yt(y);var O=y?rl(f):0;return y&&O<y?f+Oh(y-O,E):f}function Hz(f,y,E){f=de(f),y=Yt(y);var O=y?rl(f):0;return y&&O<y?Oh(y-O,E)+f:f}function Uz(f,y,E){return E||y==null?y=0:y&&(y=+y),t9(de(f).replace(Wg,""),y||0)}function Yz(f,y,E){return(E?nr(f,y,E):y===e)?y=1:y=Yt(y),xp(de(f),y)}function Xz(){var f=arguments,y=de(f[0]);return f.length<3?y:y.replace(f[1],f[2])}var Kz=cl(function(f,y,E){return f+(E?"_":"")+y.toLowerCase()});function Zz(f,y,E){return E&&typeof E!="number"&&nr(f,y,E)&&(y=E=e),E=E===e?K:E>>>0,E?(f=de(f),f&&(typeof y=="string"||y!=null&&!Gp(y))&&(y=Nr(y),!y&&nl(f))?os(Ei(f),0,E):f.split(y,E)):[]}var Jz=cl(function(f,y,E){return f+(E?" ":"")+Up(y)});function Qz(f,y,E){return f=de(f),E=E==null?0:ro(Yt(E),0,f.length),y=Nr(y),f.slice(E,E+y.length)==y}function t$(f,y,E){var O=I.templateSettings;E&&nr(f,y,E)&&(y=e),f=de(f),y=jh({},y,O,IS);var N=jh({},y.imports,O.imports,IS),F=Cn(N),W=ip(N,F),V,Y,nt=0,rt=y.interpolate||th,ot="__p += '",xt=sp((y.escape||th).source+"|"+rt.source+"|"+(rt===r_?R4:th).source+"|"+(y.evaluate||th).source+"|$","g"),Mt="//# sourceURL="+(fe.call(y,"sourceURL")?(y.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++u8+"]")+`
- `;f.replace(xt,function(Ot,ee,ie,Lr,rr,Ir){return ie||(ie=Lr),ot+=f.slice(nt,Ir).replace($4,O8),ee&&(V=!0,ot+=`' +
- __e(`+ee+`) +
- '`),rr&&(Y=!0,ot+=`';
- `+rr+`;
- __p += '`),ie&&(ot+=`' +
- ((__t = (`+ie+`)) == null ? '' : __t) +
- '`),nt=Ir+Ot.length,Ot}),ot+=`';
- `;var Tt=fe.call(y,"variable")&&y.variable;if(!Tt)ot=`with (obj) {
- `+ot+`
- }
- `;else if(P4.test(Tt))throw new Dt(o);ot=(Y?ot.replace(p4,""):ot).replace(v4,"$1").replace(m4,"$1;"),ot="function("+(Tt||"obj")+`) {
- `+(Tt?"":`obj || (obj = {});
- `)+"var __t, __p = ''"+(V?", __e = _.escape":"")+(Y?`, __j = Array.prototype.join;
- function print() { __p += __j.call(arguments, '') }
- `:`;
- `)+ot+`return __p
- }`;var Kt=C3(function(){return ce(F,Mt+"return "+ot).apply(e,W)});if(Kt.source=ot,Wp(Kt))throw Kt;return Kt}function e$(f){return de(f).toLowerCase()}function n$(f){return de(f).toUpperCase()}function r$(f,y,E){if(f=de(f),f&&(E||y===e))return D_(f);if(!f||!(y=Nr(y)))return f;var O=Ei(f),N=Ei(y),F=F_(O,N),W=B_(O,N)+1;return os(O,F,W).join("")}function i$(f,y,E){if(f=de(f),f&&(E||y===e))return f.slice(0,$_(f)+1);if(!f||!(y=Nr(y)))return f;var O=Ei(f),N=B_(O,Ei(y))+1;return os(O,0,N).join("")}function a$(f,y,E){if(f=de(f),f&&(E||y===e))return f.replace(Wg,"");if(!f||!(y=Nr(y)))return f;var O=Ei(f),N=F_(O,Ei(y));return os(O,N).join("")}function s$(f,y){var E=T,O=A;if(qe(y)){var N="separator"in y?y.separator:N;E="length"in y?Yt(y.length):E,O="omission"in y?Nr(y.omission):O}f=de(f);var F=f.length;if(nl(f)){var W=Ei(f);F=W.length}if(E>=F)return f;var V=E-rl(O);if(V<1)return O;var Y=W?os(W,0,V).join(""):f.slice(0,V);if(N===e)return Y+O;if(W&&(V+=Y.length-V),Gp(N)){if(f.slice(V).search(N)){var nt,rt=Y;for(N.global||(N=sp(N.source,de(i_.exec(N))+"g")),N.lastIndex=0;nt=N.exec(rt);)var ot=nt.index;Y=Y.slice(0,ot===e?V:ot)}}else if(f.indexOf(Nr(N),V)!=V){var xt=Y.lastIndexOf(N);xt>-1&&(Y=Y.slice(0,xt))}return Y+O}function o$(f){return f=de(f),f&&y4.test(f)?f.replace(e_,D8):f}var l$=cl(function(f,y,E){return f+(E?" ":"")+y.toUpperCase()}),Up=TS("toUpperCase");function k3(f,y,E){return f=de(f),y=E?e:y,y===e?P8(f)?z8(f):E8(f):f.match(y)||[]}var C3=Zt(function(f,y){try{return Ar(f,e,y)}catch(E){return Wp(E)?E:new Dt(E)}}),u$=ma(function(f,y){return Qr(y,function(E){E=Vi(E),pa(f,E,jp(f[E],f))}),f});function c$(f){var y=f==null?0:f.length,E=Ct();return f=y?ze(f,function(O){if(typeof O[1]!="function")throw new ti(s);return[E(O[0]),O[1]]}):[],Zt(function(O){for(var N=-1;++N<y;){var F=f[N];if(Ar(F[0],this,O))return Ar(F[1],this,O)}})}function h$(f){return D9(ni(f,h))}function Yp(f){return function(){return f}}function d$(f,y){return f==null||f!==f?y:f}var f$=AS(),g$=AS(!0);function vr(f){return f}function Xp(f){return sS(typeof f=="function"?f:ni(f,h))}function p$(f){return lS(ni(f,h))}function v$(f,y){return uS(f,ni(y,h))}var m$=Zt(function(f,y){return function(E){return yu(E,f,y)}}),y$=Zt(function(f,y){return function(E){return yu(f,E,y)}});function Kp(f,y,E){var O=Cn(y),N=Eh(y,O);E==null&&!(qe(y)&&(N.length||!O.length))&&(E=y,y=f,f=this,N=Eh(y,Cn(y)));var F=!(qe(E)&&"chain"in E)||!!E.chain,W=ba(f);return Qr(N,function(V){var Y=y[V];f[V]=Y,W&&(f.prototype[V]=function(){var nt=this.__chain__;if(F||nt){var rt=f(this.__wrapped__),ot=rt.__actions__=fr(this.__actions__);return ot.push({func:Y,args:arguments,thisArg:f}),rt.__chain__=nt,rt}return Y.apply(f,es([this.value()],arguments))})}),f}function b$(){return Dn._===this&&(Dn._=V8),this}function Zp(){}function w$(f){return f=Yt(f),Zt(function(y){return cS(y,f)})}var x$=Tp(ze),E$=Tp(P_),_$=Tp(Qg);function T3(f){return Ip(f)?tp(Vi(f)):Q9(f)}function S$(f){return function(y){return f==null?e:io(f,y)}}var M$=NS(),k$=NS(!0);function Jp(){return[]}function Qp(){return!1}function C$(){return{}}function T$(){return""}function O$(){return!0}function A$(f,y){if(f=Yt(f),f<1||f>D)return[];var E=K,O=Vn(f,K);y=Ct(y),f-=K;for(var N=rp(O,y);++E<f;)y(E);return N}function P$(f){return $t(f)?ze(f,Vi):Rr(f)?[f]:fr(YS(de(f)))}function N$(f){var y=++W8;return de(f)+y}var R$=Th(function(f,y){return f+y},0),L$=Op("ceil"),I$=Th(function(f,y){return f/y},1),D$=Op("floor");function F$(f){return f&&f.length?xh(f,vr,gp):e}function B$(f,y){return f&&f.length?xh(f,Ct(y,2),gp):e}function z$(f){return L_(f,vr)}function $$(f,y){return L_(f,Ct(y,2))}function j$(f){return f&&f.length?xh(f,vr,yp):e}function q$(f,y){return f&&f.length?xh(f,Ct(y,2),yp):e}var W$=Th(function(f,y){return f*y},1),G$=Op("round"),V$=Th(function(f,y){return f-y},0);function H$(f){return f&&f.length?np(f,vr):0}function U$(f,y){return f&&f.length?np(f,Ct(y,2)):0}return I.after=pB,I.ary=a3,I.assign=nz,I.assignIn=b3,I.assignInWith=jh,I.assignWith=rz,I.at=iz,I.before=s3,I.bind=jp,I.bindAll=u$,I.bindKey=o3,I.castArray=CB,I.chain=n3,I.chunk=D7,I.compact=F7,I.concat=B7,I.cond=c$,I.conforms=h$,I.constant=Yp,I.countBy=HF,I.create=az,I.curry=l3,I.curryRight=u3,I.debounce=c3,I.defaults=sz,I.defaultsDeep=oz,I.defer=vB,I.delay=mB,I.difference=z7,I.differenceBy=$7,I.differenceWith=j7,I.drop=q7,I.dropRight=W7,I.dropRightWhile=G7,I.dropWhile=V7,I.fill=H7,I.filter=YF,I.flatMap=ZF,I.flatMapDeep=JF,I.flatMapDepth=QF,I.flatten=JS,I.flattenDeep=U7,I.flattenDepth=Y7,I.flip=yB,I.flow=f$,I.flowRight=g$,I.fromPairs=X7,I.functions=gz,I.functionsIn=pz,I.groupBy=tB,I.initial=Z7,I.intersection=J7,I.intersectionBy=Q7,I.intersectionWith=tF,I.invert=mz,I.invertBy=yz,I.invokeMap=nB,I.iteratee=Xp,I.keyBy=rB,I.keys=Cn,I.keysIn=pr,I.map=Ih,I.mapKeys=wz,I.mapValues=xz,I.matches=p$,I.matchesProperty=v$,I.memoize=Fh,I.merge=Ez,I.mergeWith=w3,I.method=m$,I.methodOf=y$,I.mixin=Kp,I.negate=Bh,I.nthArg=w$,I.omit=_z,I.omitBy=Sz,I.once=bB,I.orderBy=iB,I.over=x$,I.overArgs=wB,I.overEvery=E$,I.overSome=_$,I.partial=qp,I.partialRight=h3,I.partition=aB,I.pick=Mz,I.pickBy=x3,I.property=T3,I.propertyOf=S$,I.pull=iF,I.pullAll=t3,I.pullAllBy=aF,I.pullAllWith=sF,I.pullAt=oF,I.range=M$,I.rangeRight=k$,I.rearg=xB,I.reject=lB,I.remove=lF,I.rest=EB,I.reverse=zp,I.sampleSize=cB,I.set=Cz,I.setWith=Tz,I.shuffle=hB,I.slice=uF,I.sortBy=gB,I.sortedUniq=vF,I.sortedUniqBy=mF,I.split=Zz,I.spread=_B,I.tail=yF,I.take=bF,I.takeRight=wF,I.takeRightWhile=xF,I.takeWhile=EF,I.tap=FF,I.throttle=SB,I.thru=Lh,I.toArray=v3,I.toPairs=E3,I.toPairsIn=_3,I.toPath=P$,I.toPlainObject=y3,I.transform=Oz,I.unary=MB,I.union=_F,I.unionBy=SF,I.unionWith=MF,I.uniq=kF,I.uniqBy=CF,I.uniqWith=TF,I.unset=Az,I.unzip=$p,I.unzipWith=e3,I.update=Pz,I.updateWith=Nz,I.values=fl,I.valuesIn=Rz,I.without=OF,I.words=k3,I.wrap=kB,I.xor=AF,I.xorBy=PF,I.xorWith=NF,I.zip=RF,I.zipObject=LF,I.zipObjectDeep=IF,I.zipWith=DF,I.entries=E3,I.entriesIn=_3,I.extend=b3,I.extendWith=jh,Kp(I,I),I.add=R$,I.attempt=C3,I.camelCase=Fz,I.capitalize=S3,I.ceil=L$,I.clamp=Lz,I.clone=TB,I.cloneDeep=AB,I.cloneDeepWith=PB,I.cloneWith=OB,I.conformsTo=NB,I.deburr=M3,I.defaultTo=d$,I.divide=I$,I.endsWith=Bz,I.eq=Si,I.escape=zz,I.escapeRegExp=$z,I.every=UF,I.find=XF,I.findIndex=KS,I.findKey=lz,I.findLast=KF,I.findLastIndex=ZS,I.findLastKey=uz,I.floor=D$,I.forEach=r3,I.forEachRight=i3,I.forIn=cz,I.forInRight=hz,I.forOwn=dz,I.forOwnRight=fz,I.get=Vp,I.gt=RB,I.gte=LB,I.has=vz,I.hasIn=Hp,I.head=QS,I.identity=vr,I.includes=eB,I.indexOf=K7,I.inRange=Iz,I.invoke=bz,I.isArguments=oo,I.isArray=$t,I.isArrayBuffer=IB,I.isArrayLike=gr,I.isArrayLikeObject=tn,I.isBoolean=DB,I.isBuffer=ls,I.isDate=FB,I.isElement=BB,I.isEmpty=zB,I.isEqual=$B,I.isEqualWith=jB,I.isError=Wp,I.isFinite=qB,I.isFunction=ba,I.isInteger=d3,I.isLength=zh,I.isMap=f3,I.isMatch=WB,I.isMatchWith=GB,I.isNaN=VB,I.isNative=HB,I.isNil=YB,I.isNull=UB,I.isNumber=g3,I.isObject=qe,I.isObjectLike=Xe,I.isPlainObject=Su,I.isRegExp=Gp,I.isSafeInteger=XB,I.isSet=p3,I.isString=$h,I.isSymbol=Rr,I.isTypedArray=dl,I.isUndefined=KB,I.isWeakMap=ZB,I.isWeakSet=JB,I.join=eF,I.kebabCase=jz,I.last=ii,I.lastIndexOf=nF,I.lowerCase=qz,I.lowerFirst=Wz,I.lt=QB,I.lte=tz,I.max=F$,I.maxBy=B$,I.mean=z$,I.meanBy=$$,I.min=j$,I.minBy=q$,I.stubArray=Jp,I.stubFalse=Qp,I.stubObject=C$,I.stubString=T$,I.stubTrue=O$,I.multiply=W$,I.nth=rF,I.noConflict=b$,I.noop=Zp,I.now=Dh,I.pad=Gz,I.padEnd=Vz,I.padStart=Hz,I.parseInt=Uz,I.random=Dz,I.reduce=sB,I.reduceRight=oB,I.repeat=Yz,I.replace=Xz,I.result=kz,I.round=G$,I.runInContext=U,I.sample=uB,I.size=dB,I.snakeCase=Kz,I.some=fB,I.sortedIndex=cF,I.sortedIndexBy=hF,I.sortedIndexOf=dF,I.sortedLastIndex=fF,I.sortedLastIndexBy=gF,I.sortedLastIndexOf=pF,I.startCase=Jz,I.startsWith=Qz,I.subtract=V$,I.sum=H$,I.sumBy=U$,I.template=t$,I.times=A$,I.toFinite=wa,I.toInteger=Yt,I.toLength=m3,I.toLower=e$,I.toNumber=ai,I.toSafeInteger=ez,I.toString=de,I.toUpper=n$,I.trim=r$,I.trimEnd=i$,I.trimStart=a$,I.truncate=s$,I.unescape=o$,I.uniqueId=N$,I.upperCase=l$,I.upperFirst=Up,I.each=r3,I.eachRight=i3,I.first=QS,Kp(I,function(){var f={};return Wi(I,function(y,E){fe.call(I.prototype,E)||(f[E]=y)}),f}(),{chain:!1}),I.VERSION=n,Qr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(f){I[f].placeholder=I}),Qr(["drop","take"],function(f,y){re.prototype[f]=function(E){E=E===e?1:bn(Yt(E),0);var O=this.__filtered__&&!y?new re(this):this.clone();return O.__filtered__?O.__takeCount__=Vn(E,O.__takeCount__):O.__views__.push({size:Vn(E,K),type:f+(O.__dir__<0?"Right":"")}),O},re.prototype[f+"Right"]=function(E){return this.reverse()[f](E).reverse()}}),Qr(["filter","map","takeWhile"],function(f,y){var E=y+1,O=E==$||E==j;re.prototype[f]=function(N){var F=this.clone();return F.__iteratees__.push({iteratee:Ct(N,3),type:E}),F.__filtered__=F.__filtered__||O,F}}),Qr(["head","last"],function(f,y){var E="take"+(y?"Right":"");re.prototype[f]=function(){return this[E](1).value()[0]}}),Qr(["initial","tail"],function(f,y){var E="drop"+(y?"":"Right");re.prototype[f]=function(){return this.__filtered__?new re(this):this[E](1)}}),re.prototype.compact=function(){return this.filter(vr)},re.prototype.find=function(f){return this.filter(f).head()},re.prototype.findLast=function(f){return this.reverse().find(f)},re.prototype.invokeMap=Zt(function(f,y){return typeof f=="function"?new re(this):this.map(function(E){return yu(E,f,y)})}),re.prototype.reject=function(f){return this.filter(Bh(Ct(f)))},re.prototype.slice=function(f,y){f=Yt(f);var E=this;return E.__filtered__&&(f>0||y<0)?new re(E):(f<0?E=E.takeRight(-f):f&&(E=E.drop(f)),y!==e&&(y=Yt(y),E=y<0?E.dropRight(-y):E.take(y-f)),E)},re.prototype.takeRightWhile=function(f){return this.reverse().takeWhile(f).reverse()},re.prototype.toArray=function(){return this.take(K)},Wi(re.prototype,function(f,y){var E=/^(?:filter|find|map|reject)|While$/.test(y),O=/^(?:head|last)$/.test(y),N=I[O?"take"+(y=="last"?"Right":""):y],F=O||/^find/.test(y);N&&(I.prototype[y]=function(){var W=this.__wrapped__,V=O?[1]:arguments,Y=W instanceof re,nt=V[0],rt=Y||$t(W),ot=function(ee){var ie=N.apply(I,es([ee],V));return O&&xt?ie[0]:ie};rt&&E&&typeof nt=="function"&&nt.length!=1&&(Y=rt=!1);var xt=this.__chain__,Mt=!!this.__actions__.length,Tt=F&&!xt,Kt=Y&&!Mt;if(!F&&rt){W=Kt?W:new re(this);var Ot=f.apply(W,V);return Ot.__actions__.push({func:Lh,args:[ot],thisArg:e}),new ei(Ot,xt)}return Tt&&Kt?f.apply(this,V):(Ot=this.thru(ot),Tt?O?Ot.value()[0]:Ot.value():Ot)})}),Qr(["pop","push","shift","sort","splice","unshift"],function(f){var y=sh[f],E=/^(?:push|sort|unshift)$/.test(f)?"tap":"thru",O=/^(?:pop|shift)$/.test(f);I.prototype[f]=function(){var N=arguments;if(O&&!this.__chain__){var F=this.value();return y.apply($t(F)?F:[],N)}return this[E](function(W){return y.apply($t(W)?W:[],N)})}}),Wi(re.prototype,function(f,y){var E=I[y];if(E){var O=E.name+"";fe.call(ol,O)||(ol[O]=[]),ol[O].push({name:y,func:E})}}),ol[Ch(e,b).name]=[{name:"wrapper",func:e}],re.prototype.clone=o9,re.prototype.reverse=l9,re.prototype.value=u9,I.prototype.at=BF,I.prototype.chain=zF,I.prototype.commit=$F,I.prototype.next=jF,I.prototype.plant=WF,I.prototype.reverse=GF,I.prototype.toJSON=I.prototype.valueOf=I.prototype.value=VF,I.prototype.first=I.prototype.head,hu&&(I.prototype[hu]=qF),I},il=$8();Qs?((Qs.exports=il)._=il,Xg._=il):Dn._=il}).call(ka)})(Jf,Jf.exports);var kl=Jf.exports;const Ipt={class:"ai-search-container"},Dpt={key:0,class:"search-results"},Fpt={__name:"index",setup(r){const t=ue(""),e=ue(!1),n=ue(!1),i=ue(1e3),a=ue("思维导图"),s=ue([]),o=ue([]),l=ue(!1),u=ue(!0),c=ue([]),h=So({page:1,pageSize:10}),d=ue(!1);Oc(async()=>{const D=ue([]),{data:{kbs:G}}=await Nj();G&&(D.value=G,o.value=s.value.filter(X=>D.value.some(K=>K.id===X)))});const{send:p,answer:v,done:m}=Rpt(Ept),{chunksData:b,testChunk:w}=Ppt(),{fetchRelatedQuestions:x,data:S}=Npt(),{data:_,loading:M,fetchMindmap:k}=Lpt(),C=async D=>{const G=kl.trim(D);kl.isEmpty(G)||(u.value=!1,l.value=!0,p({kb_ids:o.value,question:G}),w({kb_id:o.value,highlight:!0,question:G,page:1,size:h.pageSize}),await x(G))},P=D=>{l.value||(t.value=D,C(D))},T=async(D,G=1,X=10)=>{const K=kl.trim(t.value);l.value||kl.isEmpty(K)||(d.value=!0,await w({kb_id:o.value,highlight:!0,question:K,doc_ids:D??c.value,page:G,size:X}),d.value=!1)};aw(m,D=>{D&&(l.value=!1)});const A=(D,G)=>{console.log("文档点击:",D,G),a.value="文档详情",n.value=!0},R=()=>{a.value="思维导图",n.value=!0,k({question:t.value,kb_ids:o.value})},L=D=>{s.value=D},$=D=>{s.value=D},q=D=>{const G=kl.trim(D);if(kl.isEmpty(G)){i0.warning("请输入想要搜索的内容");return}b.value.documents=[],b.value.chunks=[],c.value=[],S.value=[],C(G),e.value=!0},j=D=>{h.page=D,T(c.value,D,h.pageSize)},B=D=>{h.pageSize=D,T(c.value,h.page,D)};return(D,G)=>{const X=nj,K=gR,ht=ej,ut=t0,ct=tj,dt=wR,pt=Q$;return jt(),He($l,null,[Ve("div",Ipt,[ae(wq,{onUpdateCheckedList:L,onInitSelectedKeys:$}),Ve("div",{class:Mr(["content-box",{"search-active":e.value}])},[ae(X,{class:"input-search",modelValue:t.value,"onUpdate:modelValue":G[0]||(G[0]=mt=>t.value=mt),placeholder:"请输入搜索内容","search-button":"",loading:l.value,onPressEnter:q,onSearch:q},null,8,["modelValue","loading"]),ae(cj,{name:"fade"},{default:ve(()=>{var mt,It;return[e.value?(jt(),He("div",Dpt,[ae(Tq,{content:(mt=Xi(v))==null?void 0:mt.answer},null,8,["content"]),ae(K),ae(Sq,{documents:Xi(b).documents,selectedDocumentIds:c.value,onOnFilesSelected:T},null,8,["documents","selectedDocumentIds"]),ae(K),ae(xpt,{chunks:Xi(b).chunks,total:Xi(b).total,highlightWord:t.value,loading:d.value,onClickDocumentButton:A,onPageChange:j,onPageSizeChange:B},null,8,["chunks","total","highlightWord","loading"]),ae(K),((It=Xi(S))==null?void 0:It.length)>0?(jt(),dn(ct,{key:0,title:"相关问题"},{default:ve(()=>[ae(ut,{wrap:""},{default:ve(()=>[(jt(!0),He($l,null,e0(Xi(S),(zt,Te)=>(jt(),dn(ht,{key:Te,onClick:Rn=>P(zt),class:"related-question-tag"},{default:ve(()=>[mR(uc(zt),1)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})):Ds("",!0),ae(K),ae(dt,{class:"floating-btn",shape:"circle",onClick:R},{default:ve(()=>[ae(Xi(Bj),{size:"32"})]),_:1})])):Ds("",!0)]}),_:1})],2)]),ae(pt,{visible:n.value,"onUpdate:visible":G[1]||(G[1]=mt=>n.value=mt),title:a.value,width:i.value,footer:!1},{default:ve(()=>[ae(ept,{loading:Xi(M),data:Xi(_)},null,8,["loading","data"])]),_:1},8,["visible","title","width"])],64)}}},Bpt=jo(Fpt,[["__scopeId","data-v-5701ea1c"]]),Avt={__name:"AISearch",setup(r){return(t,e)=>(jt(),dn(K$,null,{default:ve(()=>[ae(Z$,null,{default:ve(()=>[ae(Bpt)]),_:1})]),_:1}))}};export{Avt as default};
|