var dN=Object.defineProperty;var y2=r=>{throw TypeError(r)};var fN=(r,t,e)=>t in r?dN(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Ot=(r,t,e)=>fN(r,typeof t!="symbol"?t+"":t,e),hd=(r,t,e)=>t.has(r)||y2("Cannot "+e);var tr=(r,t,e)=>(hd(r,t,"read from private field"),e?e.call(r):t.get(r)),dd=(r,t,e)=>t.has(r)?y2("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),bl=(r,t,e,n)=>(hd(r,t,"write to private field"),n?n.call(r,e):t.set(r,e),e),fd=(r,t,e)=>(hd(r,t,"access private method"),e);import gN from"./LayoutExperience-B0EwKxuN.js";import vN from"./ContentContainer-D2EaeS6c.js";/* empty css */import{m as pN,t as mN,d as yN,c as Fy,V as bN,a as wN,D as xN}from"./ViewerDocxFromUrl-1aTHsrlL.js";import{S as nM}from"./index-Cyg5CKvp.js";import{C as EN}from"./index-BWYUA9XL.js";import{S as Tu}from"./index-B8PeqgBf.js";import{T as SN}from"./index-0ht_YeBn.js";import{D as rM}from"./index-D7U2mRb7.js";import"./index-B3ZmNbb2.js";import{d as Xi,c as le,o as ct,a as Xt,n as Wo,b as yn,e as Ee,u as By,p as _a,s as ee,A as Lt,q as Hn,m as Jr,F as Ss,Z as Ou,_ as _N,C as iM,$ as aM,r as Ii,j as Rt,i as kN,x as zy,N as $y,v as MN,w as $c,D as At,I as sM,J as ka,X as yr,B as CN,G as TN,a0 as ON,E as AN}from"./vue-vendor-BdC0yijC.js";import"./index-0f_b86g_.js";import{T as PN}from"./index-CuHgcYAn.js";import{a as Ki,c as ja,d as _s,l as gd,m as vd,s as oM,j as lM,n as NN,p as RN,_ as Zi,u as cM,B as uM,q as rt,r as LN,t as jc,v as DN,k as Au,w as b2,x as IN,y as pt,z as W,A as Ut,C as V,D as dt,E as Gi,F as hM,G as wl,H as jy,J as FN,g as dM}from"./index-CKglxn7a.js";import{I as BN}from"./index-Dn3Nr-vu.js";import{u as ym}from"./use-merge-state-DwhVbGFg.js";import{u as zN,L as $N,S as jN}from"./use-responsive-q0eIO4Cz.js";import{I as qN}from"./index-R6R9-_rt.js";import{R as GN}from"./index.es-BUk8i4T7.js";import{C as WN,a as VN,i as HN,b as UN,c as fM,S as w2,d as YN,e as XN,f as KN,g as ZN,h as JN,j as QN,k as tR}from"./_getTag-CGRqvi-g.js";/* empty css *//* empty css */import{T as eR,a as nR,P as rR}from"./index-Ct5z1Q_p.js";/* empty css */import{T as iR}from"./index-D0tSDWbf.js";import{P as aR}from"./index-DtV4o3Fg.js";import{P as gM}from"./index-DqQMUUx-.js";import{Q as sR}from"./common-vMOJyd5A.js";import{M as Pu}from"./index-6KO6Hcdq.js";import"./index-BveY6Fl9.js";import{a as oR}from"./index-BFXpcRM5.js";import"./Header-C-uVSSVm.js";import"./use-platform-information-CCFvVYoR.js";/* empty css */import"./index-DvVJ9IBw.js";import"./use-logout-Fu_ARg2z.js";import"./use-current-user-0eOt-j5a.js";import"./login-C1IypEvL.js";import"./index-Lig8XQVd.js";import"./index-WzgAysvp.js";import"./render-function-CV4zhQl4.js";import"./responsive-observe-4ACH6YSC.js";import"./index-D1DnNKEf.js";const lR=Xi({name:"IconAttachment",props:{size:{type:[Number,String]},strokeWidth:{type:Number,default:4},strokeLinecap:{type:String,default:"butt",validator:r=>["butt","round","square"].includes(r)},strokeLinejoin:{type:String,default:"miter",validator:r=>["arcs","bevel","miter","miter-clip","round"].includes(r)},rotate:Number,spin:Boolean},emits:{click:r=>!0},setup(r,{emit:t}){const e=ja("icon"),n=Ee(()=>[e,`${e}-attachment`,{[`${e}-spin`]:r.spin}]),i=Ee(()=>{const s={};return r.size&&(s.fontSize=_s(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)}}}}),cR=["stroke-width","stroke-linecap","stroke-linejoin"],uR=Xt("path",{d:"M29.037 15.236s-9.174 9.267-11.48 11.594c-2.305 2.327-1.646 4.987-.329 6.316 1.317 1.33 3.994 1.953 6.258-.332L37.32 18.851c3.623-3.657 2.092-8.492 0-10.639-2.093-2.147-6.916-3.657-10.54 0L11.3 23.838c-3.623 3.657-3.953 10.638.329 14.96 4.282 4.322 11.115 4.105 14.821.333 3.706-3.773 8.74-8.822 11.224-11.33"},null,-1),hR=[uR];function dR(r,t,e,n,i,a){return ct(),le("svg",{viewBox:"0 0 48 48",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg",class:yn(r.cls),style:Wo(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))},hR,14,cR)}var pd=Ki(lR,[["render",dR]]);const fR=Object.assign(pd,{install:(r,t)=>{var e;const n=(e=t==null?void 0:t.iconPrefix)!=null?e:"";r.component(n+pd.name,pd)}}),gR=Xi({name:"IconDragDot",props:{size:{type:[Number,String]},strokeWidth:{type:Number,default:4},strokeLinecap:{type:String,default:"butt",validator:r=>["butt","round","square"].includes(r)},strokeLinejoin:{type:String,default:"miter",validator:r=>["arcs","bevel","miter","miter-clip","round"].includes(r)},rotate:Number,spin:Boolean},emits:{click:r=>!0},setup(r,{emit:t}){const e=ja("icon"),n=Ee(()=>[e,`${e}-drag-dot`,{[`${e}-spin`]:r.spin}]),i=Ee(()=>{const s={};return r.size&&(s.fontSize=_s(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)}}}}),vR=["stroke-width","stroke-linecap","stroke-linejoin"],pR=Xt("path",{d:"M40 17v2h-2v-2h2ZM25 17v2h-2v-2h2ZM10 17v2H8v-2h2ZM40 29v2h-2v-2h2ZM25 29v2h-2v-2h2ZM10 29v2H8v-2h2Z",fill:"currentColor",stroke:"none"},null,-1),mR=Xt("path",{d:"M40 17v2h-2v-2h2ZM25 17v2h-2v-2h2ZM10 17v2H8v-2h2ZM40 29v2h-2v-2h2ZM25 29v2h-2v-2h2ZM10 29v2H8v-2h2Z"},null,-1),yR=[pR,mR];function bR(r,t,e,n,i,a){return ct(),le("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",stroke:"currentColor",class:yn(r.cls),style:Wo(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))},yR,14,vR)}var md=Ki(gR,[["render",bR]]);const wR=Object.assign(md,{install:(r,t)=>{var e;const n=(e=t==null?void 0:t.iconPrefix)!=null?e:"";r.component(n+md.name,md)}});var xR=Xi({name:"ResizeTrigger",components:{ResizeObserver:GN,IconDragDot:wR,IconDragDotVertical:qN},props:{prefixCls:{type:String,required:!0},direction:{type:String,default:"horizontal"}},emits:["resize"],setup(r,{emit:t}){const{direction:e,prefixCls:n}=By(r),i=Ee(()=>(e==null?void 0:e.value)==="horizontal");return{classNames:Ee(()=>[n.value,{[`${n.value}-horizontal`]:i.value,[`${n.value}-vertical`]:!i.value}]),onResize:o=>{t("resize",o)},isHorizontal:i}}});function ER(r,t,e,n,i,a){const s=_a("IconDragDot"),o=_a("IconDragDotVertical"),l=_a("ResizeObserver");return ct(),ee(l,{onResize:r.onResize},{default:Lt(()=>[Xt("div",{class:yn(r.classNames)},[Hn(" @slot 自定义内容 "),Jr(r.$slots,"default",{},()=>[Xt("div",{class:yn(`${r.prefixCls}-icon-wrapper`)},[Hn(" @slot 自定义 icon "),Jr(r.$slots,"icon",{},()=>[r.isHorizontal?(ct(),ee(s,{key:0,class:yn(`${r.prefixCls}-icon`)},null,8,["class"])):(ct(),ee(o,{key:1,class:yn(`${r.prefixCls}-icon`)},null,8,["class"]))])],2)])],2)]),_:3},8,["onResize"])}var SR=Ki(xR,[["render",ER]]),_R=Object.defineProperty,x2=Object.getOwnPropertySymbols,kR=Object.prototype.hasOwnProperty,MR=Object.prototype.propertyIsEnumerable,E2=(r,t,e)=>t in r?_R(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,yd=(r,t)=>{for(var e in t||(t={}))kR.call(t,e)&&E2(r,e,t[e]);if(x2)for(var e of x2(t))MR.call(t,e)&&E2(r,e,t[e]);return r};const vM="left",pM="right",qy="top",Gy="bottom",CR=[vM,pM,qy,Gy];function S2(r,t){if(r===0)return 0;const e=r-t;return e<=0?0:e}function bd(r){return[qy,Gy].indexOf(r)>-1}const TR=Xi({name:"ResizeBox",components:{ResizeTrigger:SR},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}=By(r),[a,s]=ym(null,Ii({value:n})),[o,l]=ym(null,Ii({value:e})),c=Rt(),u=Ii({}),h=ja("resizebox"),d=Ee(()=>[h]),f=Ee(()=>yd(yd(yd({},_s(a.value)?{width:`${a.value}px`}:{}),_s(o.value)?{height:`${o.value}px`}:{}),u)),g=Ee(()=>i.value.filter(w=>CR.includes(w))),v={direction:"",startPageX:0,startPageY:0,startWidth:0,startHeight:0,moving:!1,padding:{left:0,right:0,top:0,bottom:0}};function p(w){if(!v.moving)return;const{startPageX:x,startPageY:S,startWidth:E,startHeight:_,direction:C}=v;let k=E,M=_;const T=w.pageX-x,O=w.pageY-S;switch(C){case vM:k=E-T,s(k),t("update:width",k);break;case pM:k=E+T,s(k),t("update:width",k);break;case qy:M=_-O,l(M),t("update:height",M);break;case Gy:M=_+O,l(M),t("update:height",M);break}t("moving",{width:k,height:M},w)}function m(w){v.moving=!1,vd(window,"mousemove",p),vd(window,"mouseup",m),vd(window,"contextmenu",m),document.body.style.cursor="default",t("movingEnd",w)}function y(w,x){var S,E;t("movingStart",x),v.moving=!0,v.startPageX=x.pageX,v.startPageY=x.pageY,v.direction=w;const{top:_,left:C,right:k,bottom:M}=v.padding;v.startWidth=S2(((S=c.value)==null?void 0:S.clientWidth)||0,C+k),v.startHeight=S2(((E=c.value)==null?void 0:E.clientHeight)||0,_+M),gd(window,"mousemove",p),gd(window,"mouseup",m),gd(window,"contextmenu",m),document.body.style.cursor=bd(w)?"row-resize":"col-resize"}function b(w,x){const{width:S,height:E}=x.contentRect,_=bd(w)?E:S;v.padding[w]=_,u[`padding-${w}`]=`${_}px`}return{prefixCls:h,classNames:d,styles:f,wrapperRef:c,onMoveStart:y,isHorizontal:bd,allowDirections:g,onTiggerResize:b}}});function OR(r,t,e,n,i,a){const s=_a("ResizeTrigger");return ct(),ee(aM(r.component),iM({ref:"wrapperRef",class:r.classNames},r.$attrs,{style:r.styles}),{default:Lt(()=>[Jr(r.$slots,"default"),(ct(!0),le(Ss,null,Ou(r.allowDirections,o=>(ct(),ee(s,{key:o,"prefix-cls":`${r.prefixCls}-trigger`,class:yn(`${r.prefixCls}-direction-${o}`),direction:r.isHorizontal(o)?"horizontal":"vertical",onMousedown:l=>{r.onMoveStart(o,l)},onResize:l=>{r.onTiggerResize(o,l)}},_N({default:Lt(()=>[r.$slots["resize-trigger"]?Jr(r.$slots,"resize-trigger",{key:0,direction:o}):Hn("v-if",!0)]),_:2},[r.$slots["resize-trigger-icon"]?{name:"icon",fn:Lt(()=>[Jr(r.$slots,"resize-trigger-icon",{direction:o})])}:void 0]),1032,["prefix-cls","class","direction","onMousedown","onResize"]))),128))]),_:3},16,["class","style"])}var wd=Ki(TR,[["render",OR]]);const AR=Object.assign(wd,{install:(r,t)=>{oM(r,t);const e=lM(t);r.component(e+wd.name,wd)}}),PR=(()=>{let r=0;return(t="")=>(r+=1,`${t}${r}`)})();var NR=Xi({name:"LayoutSider",components:{IconLeft:NN,IconRight:BN,ResizeBox:AR},props:{theme:{type:String,default:"light"},collapsed:{type:Boolean,default:void 0},defaultCollapsed:{type:Boolean},collapsible:{type:Boolean},width:{type:Number,default:200},collapsedWidth:{type:Number,default:48},reverseArrow:{type:Boolean},breakpoint:{type:String},resizeDirections:{type:Array,default:void 0},hideTrigger:{type:Boolean}},emits:["collapse","update:collapsed","breakpoint"],setup(r,{emit:t}){const{theme:e,collapsed:n,defaultCollapsed:i,collapsible:a,hideTrigger:s,breakpoint:o,collapsedWidth:l,resizeDirections:c}=By(r),[u,h]=ym(i.value,Ii({value:n})),d=Ee(()=>c.value?"ResizeBox":"div"),f=Ee(()=>a.value&&!s.value),g=ja("layout-sider"),v=Ee(()=>[g,{[`${g}-light`]:e.value==="light",[`${g}-has-trigger`]:f.value,[`${g}-collapsed`]:n.value}]),p=Ee(()=>{const{width:x,collapsedWidth:S}=r,E=u.value?S:x;return _s(E)?`${E}px`:String(E)}),m=Ee(()=>[`${g}-trigger`,{[`${g}-trigger-light`]:e.value==="light"}]),y=()=>{const x=!u.value;h(x),t("update:collapsed",x),t("collapse",x,"clickTrigger")};zN(o,x=>{const S=!x;S!==u.value&&(h(S),t("update:collapsed",S),t("collapse",S,"responsive"),t("breakpoint",S))});const b=PR("__arco_layout_sider"),w=kN($N,void 0);return zy(()=>{var x;(x=w==null?void 0:w.onSiderMount)==null||x.call(w,b)}),$y(()=>{var x;(x=w==null?void 0:w.onSiderUnMount)==null||x.call(w,b)}),MN(jN,Ii({theme:e,collapsed:u,collapsedWidth:l})),{componentTag:d,prefixCls:g,classNames:v,triggerClassNames:m,localCollapsed:u,siderWidth:p,showTrigger:f,toggleTrigger:y}}});const RR={key:0},LR={key:1};function DR(r,t,e,n,i,a){const s=_a("IconLeft"),o=_a("IconRight");return ct(),ee(aM(r.componentTag),iM({class:r.classNames,style:{width:r.siderWidth}},r.resizeDirections?{directions:r.resizeDirections}:{}),{default:Lt(()=>[Xt("div",{class:yn(`${r.prefixCls}-children`)},[Jr(r.$slots,"default")],2),r.showTrigger?(ct(),le("div",{key:0,class:yn(r.triggerClassNames),style:Wo({width:r.siderWidth}),onClick:t[0]||(t[0]=(...l)=>r.toggleTrigger&&r.toggleTrigger(...l))},[Jr(r.$slots,"trigger",{collapsed:r.localCollapsed},()=>[r.reverseArrow?(ct(),le("div",LR,[r.localCollapsed?(ct(),ee(s,{key:0})):(ct(),ee(o,{key:1}))])):(ct(),le("div",RR,[r.localCollapsed?(ct(),ee(o,{key:1})):(ct(),ee(s,{key:0}))]))])],6)):Hn("v-if",!0)]),_:3},16,["class","style"])}var IR=Ki(NR,[["render",DR]]);const FR=Xi({name:"Skeleton",props:{loading:{type:Boolean,default:!0},animation:{type:Boolean,default:!1}},setup(r){const t=ja("skeleton"),e=Ee(()=>[t,{[`${t}-animation`]:r.animation}]);return{prefixCls:t,cls:e}}});function BR(r,t,e,n,i,a){return ct(),le("div",{class:yn(r.cls)},[r.loading?Jr(r.$slots,"default",{key:0}):Jr(r.$slots,"content",{key:1})],2)}var xd=Ki(FR,[["render",BR]]);const zR=Xi({name:"SkeletonLine",props:{rows:{type:Number,default:1},widths:{type:Array,default:()=>[]},lineHeight:{type:Number,default:20},lineSpacing:{type:Number,default:15}},setup(r){const t=ja("skeleton-line"),e=[];for(let n=0;n0&&(i.marginTop=`${r.lineSpacing}px`),e.push(i)}return{prefixCls:t,lines:e}}});function $R(r,t,e,n,i,a){return ct(!0),le(Ss,null,Ou(r.lines,(s,o)=>(ct(),le("ul",{key:o,class:yn(r.prefixCls)},[Xt("li",{class:yn(`${r.prefixCls}-row`),style:Wo(s)},null,6)],2))),128)}var Tc=Ki(zR,[["render",$R]]);const jR=Xi({name:"SkeletonShape",props:{shape:{type:String,default:"square"},size:{type:String,default:"medium"}},setup(r){const t=ja("skeleton-shape"),e=Ee(()=>[t,`${t}-${r.shape}`,`${t}-${r.size}`]);return{prefixCls:t,cls:e}}});function qR(r,t,e,n,i,a){return ct(),le("div",{class:yn(r.cls)},null,2)}var Ed=Ki(jR,[["render",qR]]);const GR=Object.assign(xd,{Line:Tc,Shape:Ed,install:(r,t)=>{oM(r,t);const e=lM(t);r.component(e+xd.name,xd),r.component(e+Tc.name,Tc),r.component(e+Ed.name,Ed)}}),WR={key:1,class:"no-data"},VR={__name:"Sidebar",props:{model_list:{type:Array,default:()=>[]}},emits:["updateCheckedList"],setup(r,{emit:t}){const e=Rt(!1),n=Rt([]),i=Rt([]),a=t,s=r;$c(()=>s.model_list,l=>{n.value=l.map(c=>c.id)},{immediate:!0});const o=l=>{n.value=l,a("updateCheckedList",l)};return(l,c)=>{const u=PN,h=nM,d=IR;return ct(),ee(d,{width:"18%"},{default:Lt(()=>[At(h,{loading:e.value},{default:Lt(()=>[r.model_list.length?(ct(),ee(u,{key:0,class:"tree",data:r.model_list,checkable:"","checked-keys":n.value,"selected-keys":i.value,"field-names":{title:"name",key:"id"},onCheck:o},null,8,["data","checked-keys","selected-keys"])):(ct(),le("div",WR,"暂无数据"))]),_:1},8,["loading"])]),_:1})}}},HR=Zi(VR,[["__scopeId","data-v-e7894828"]]),UR="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",YR=["src"],XR={__name:"RetrievalDocuments",props:{documents:String},emits:"onFilesSelected",setup(r,{emit:t}){const{t:e}=cM(),n=t,i=Rt([]),a=Rt([]),s=Ii({type:"checkbox",showCheckedAll:!0,onlyCurrent:!1}),o={pageSize:10},l=u=>{i.value=u},c=u=>{n("onFilesSelected",u),l(u)};return(u,h)=>{const d=Tu,f=nR,g=_a("icon-eye"),v=uM,p=iR,m=eR,y=WN,b=VN;return ct(),ee(b,{class:"select-files-collapse"},{default:Lt(()=>[(ct(),ee(y,{key:1},{"expand-icon":Lt(({active:w})=>[Xt("img",{src:yr(UR),style:Wo({transform:w?"rotate(180deg)":"rotate(0deg)"})},null,12,YR)]),header:Lt(()=>[At(d,null,{default:Lt(()=>{var w;return[sM(ka(i.value.length)+"/"+ka(((w=r.documents)==null?void 0:w.length)||0)+" "+ka(u.$t("ai_search.selected_files")),1)]}),_:1})]),default:Lt(()=>[At(m,{data:r.documents,onSelectionChange:c,rowKey:"doc_id","show-header":!1,bordered:!1,"row-selection":s,selectedKeys:a.value,"onUpdate:selectedKeys":h[0]||(h[0]=w=>a.value=w),pagination:o},{columns:Lt(()=>[At(f,{"data-index":"doc_name"}),At(f,{"data-index":"count",width:"80"}),At(f,{width:"80"},{cell:Lt(({record:w})=>[At(p,{content:u.$t("ai_search.preview")},{default:Lt(()=>[At(v,{type:"text"},{default:Lt(()=>[At(g)]),_:1})]),_:1},8,["content"])]),_:1})]),_:1},8,["data","row-selection","selectedKeys"])]),_:1}))]),_:1})}}},KR=Zi(XR,[["__scopeId","data-v-699b42a5"]]),ZR="/assets/logo-B-RMh_L1.png",JR={class:"markdown-content"},QR={class:"header"},tL=["innerHTML"],eL={__name:"MarkdownContent",props:{content:String},setup(r){const t=r,e=Ee(()=>pN(t.content||""));return(n,i)=>{const a=Tc,s=Tu,o=GR;return ct(),le("div",JR,[Xt("div",QR,[i[0]||(i[0]=Xt("img",{src:ZR,alt:"Logo",class:"logo"},null,-1)),Xt("h3",null,ka(n.$t("ai_search.intelligent_answer")),1)]),r.content?(ct(),le("div",{key:0,innerHTML:e.value,class:"content"},null,8,tL)):(ct(),ee(o,{key:1,class:"content",animation:!0},{default:Lt(()=>[At(s,{direction:"vertical",style:{width:"100%"},size:"large"},{default:Lt(()=>[At(a,{rows:3})]),_:1})]),_:1}))])}}},nL=Zi(eL,[["__scopeId","data-v-8eb0e748"]]);function _2(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),e.push.apply(e,n)}return e}function vt(r){for(var t=1;t0?(e[0]=(o*s+u*n+l*a-c*i)*2/h,e[1]=(l*s+u*i+c*n-o*a)*2/h,e[2]=(c*s+u*a+o*i-l*n)*2/h):(e[0]=(o*s+u*n+l*a-c*i)*2,e[1]=(l*s+u*i+c*n-o*a)*2,e[2]=(c*s+u*a+o*i-l*n)*2),AM(r,t,e),r}function qc(r,t){return r[0]=t[12],r[1]=t[13],r[2]=t[14],r}function Ms(r,t){var e=t[0],n=t[1],i=t[2],a=t[4],s=t[5],o=t[6],l=t[8],c=t[9],u=t[10];return r[0]=Math.hypot(e,n,i),r[1]=Math.hypot(a,s,o),r[2]=Math.hypot(l,c,u),r}function Gc(r,t){var e=new _e(3);Ms(e,t);var n=1/e[0],i=1/e[1],a=1/e[2],s=t[0]*n,o=t[1]*i,l=t[2]*a,c=t[4]*n,u=t[5]*i,h=t[6]*a,d=t[8]*n,f=t[9]*i,g=t[10]*a,v=s+u+g,p=0;return v>0?(p=Math.sqrt(v+1)*2,r[3]=.25*p,r[0]=(h-f)/p,r[1]=(d-l)/p,r[2]=(o-c)/p):s>u&&s>g?(p=Math.sqrt(1+s-u-g)*2,r[3]=(h-f)/p,r[0]=.25*p,r[1]=(o+c)/p,r[2]=(d+l)/p):u>g?(p=Math.sqrt(1+u-s-g)*2,r[3]=(d-l)/p,r[0]=(o+c)/p,r[1]=.25*p,r[2]=(h+f)/p):(p=Math.sqrt(1+g-s-u)*2,r[3]=(o-c)/p,r[0]=(d+l)/p,r[1]=(h+f)/p,r[2]=.25*p),r}function uL(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3],l=i+i,c=a+a,u=s+s,h=i*l,d=i*c,f=i*u,g=a*c,v=a*u,p=s*u,m=o*l,y=o*c,b=o*u,w=n[0],x=n[1],S=n[2];return r[0]=(1-(g+p))*w,r[1]=(d+b)*w,r[2]=(f-y)*w,r[3]=0,r[4]=(d-b)*x,r[5]=(1-(h+p))*x,r[6]=(v+m)*x,r[7]=0,r[8]=(f+y)*S,r[9]=(v-m)*S,r[10]=(1-(h+g))*S,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function yo(r,t,e,n,i){var a=t[0],s=t[1],o=t[2],l=t[3],c=a+a,u=s+s,h=o+o,d=a*c,f=a*u,g=a*h,v=s*u,p=s*h,m=o*h,y=l*c,b=l*u,w=l*h,x=n[0],S=n[1],E=n[2],_=i[0],C=i[1],k=i[2],M=(1-(v+m))*x,T=(f+w)*x,O=(g-b)*x,R=(f-w)*S,L=(1-(d+m))*S,D=(p+y)*S,P=(g+b)*E,A=(p-y)*E,I=(1-(d+v))*E;return r[0]=M,r[1]=T,r[2]=O,r[3]=0,r[4]=R,r[5]=L,r[6]=D,r[7]=0,r[8]=P,r[9]=A,r[10]=I,r[11]=0,r[12]=e[0]+_-(M*_+R*C+P*k),r[13]=e[1]+C-(T*_+L*C+A*k),r[14]=e[2]+k-(O*_+D*C+I*k),r[15]=1,r}function Wy(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e+e,o=n+n,l=i+i,c=e*s,u=n*s,h=n*o,d=i*s,f=i*o,g=i*l,v=a*s,p=a*o,m=a*l;return r[0]=1-h-g,r[1]=u+m,r[2]=d-p,r[3]=0,r[4]=u-m,r[5]=1-c-g,r[6]=f+v,r[7]=0,r[8]=d+p,r[9]=f-v,r[10]=1-c-h,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function hL(r,t,e,n,i,a,s){var o=1/(e-t),l=1/(i-n),c=1/(a-s);return r[0]=a*2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a*2*l,r[6]=0,r[7]=0,r[8]=(e+t)*o,r[9]=(i+n)*l,r[10]=(s+a)*c,r[11]=-1,r[12]=0,r[13]=0,r[14]=s*a*2*c,r[15]=0,r}function PM(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 dL=PM;function fL(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 gL(r,t,e,n){var i=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),s=Math.tan(t.leftDegrees*Math.PI/180),o=Math.tan(t.rightDegrees*Math.PI/180),l=2/(s+o),c=2/(i+a);return r[0]=l,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=c,r[6]=0,r[7]=0,r[8]=-((s-o)*l*.5),r[9]=(i-a)*c*.5,r[10]=n/(e-n),r[11]=-1,r[12]=0,r[13]=0,r[14]=n*e/(e-n),r[15]=0,r}function NM(r,t,e,n,i,a,s){var o=1/(t-e),l=1/(n-i),c=1/(a-s);return r[0]=-2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*c,r[11]=0,r[12]=(t+e)*o,r[13]=(i+n)*l,r[14]=(s+a)*c,r[15]=1,r}var RM=NM;function LM(r,t,e,n,i,a,s){var o=1/(t-e),l=1/(n-i),c=1/(a-s);return r[0]=-2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=c,r[11]=0,r[12]=(t+e)*o,r[13]=(i+n)*l,r[14]=a*c,r[15]=1,r}function DM(r,t,e,n){var i,a,s,o,l,c,u,h,d,f,g=t[0],v=t[1],p=t[2],m=n[0],y=n[1],b=n[2],w=e[0],x=e[1],S=e[2];return Math.abs(g-w)0&&(f=1/Math.sqrt(f),u*=f,h*=f,d*=f);var g=l*d-c*h,v=c*u-o*d,p=o*h-l*u;return f=g*g+v*v+p*p,f>0&&(f=1/Math.sqrt(f),g*=f,v*=f,p*=f),r[0]=g,r[1]=v,r[2]=p,r[3]=0,r[4]=h*p-d*v,r[5]=d*g-u*p,r[6]=u*v-h*g,r[7]=0,r[8]=u,r[9]=h,r[10]=d,r[11]=0,r[12]=i,r[13]=a,r[14]=s,r[15]=1,r}function pL(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 mL(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 yL(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 IM(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 bL(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 wL(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 xm(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 xL(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],s=r[4],o=r[5],l=r[6],c=r[7],u=r[8],h=r[9],d=r[10],f=r[11],g=r[12],v=r[13],p=r[14],m=r[15],y=t[0],b=t[1],w=t[2],x=t[3],S=t[4],E=t[5],_=t[6],C=t[7],k=t[8],M=t[9],T=t[10],O=t[11],R=t[12],L=t[13],D=t[14],P=t[15];return Math.abs(e-y)<=te*Math.max(1,Math.abs(e),Math.abs(y))&&Math.abs(n-b)<=te*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(i-w)<=te*Math.max(1,Math.abs(i),Math.abs(w))&&Math.abs(a-x)<=te*Math.max(1,Math.abs(a),Math.abs(x))&&Math.abs(s-S)<=te*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(o-E)<=te*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(l-_)<=te*Math.max(1,Math.abs(l),Math.abs(_))&&Math.abs(c-C)<=te*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(u-k)<=te*Math.max(1,Math.abs(u),Math.abs(k))&&Math.abs(h-M)<=te*Math.max(1,Math.abs(h),Math.abs(M))&&Math.abs(d-T)<=te*Math.max(1,Math.abs(d),Math.abs(T))&&Math.abs(f-O)<=te*Math.max(1,Math.abs(f),Math.abs(O))&&Math.abs(g-R)<=te*Math.max(1,Math.abs(g),Math.abs(R))&&Math.abs(v-L)<=te*Math.max(1,Math.abs(v),Math.abs(L))&&Math.abs(p-D)<=te*Math.max(1,Math.abs(p),Math.abs(D))&&Math.abs(m-P)<=te*Math.max(1,Math.abs(m),Math.abs(P))}var FM=Je,EL=IM;const SL=Object.freeze(Object.defineProperty({__proto__:null,add:yL,adjoint:sL,clone:wM,copy:ks,create:Wt,determinant:SM,equals:xL,exactEquals:xm,frob:mL,fromQuat:Wy,fromQuat2:cL,fromRotation:CM,fromRotationTranslation:AM,fromRotationTranslationScale:uL,fromRotationTranslationScaleOrigin:yo,fromScaling:pa,fromTranslation:ki,fromValues:xM,fromXRotation:TM,fromYRotation:OM,fromZRotation:wm,frustum:hL,getRotation:Gc,getScaling:Ms,getTranslation:qc,identity:Wi,invert:xr,lookAt:DM,mul:FM,multiply:Je,multiplyScalar:bL,multiplyScalarAndAdd:wL,ortho:RM,orthoNO:NM,orthoZO:LM,perspective:dL,perspectiveFromFieldOfView:gL,perspectiveNO:PM,perspectiveZO:fL,rotate:oL,rotateX:kM,rotateY:MM,rotateZ:lL,scale:_M,set:bm,str:pL,sub:EL,subtract:IM,targetTo:vL,translate:ys,transpose:EM},Symbol.toStringTag,{value:"Module"}));function St(){var r=new _e(3);return _e!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function zr(r){var t=new _e(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t}function qr(r){var t=r[0],e=r[1],n=r[2];return Math.hypot(t,e,n)}function Yt(r,t,e){var n=new _e(3);return n[0]=r,n[1]=t,n[2]=e,n}function Er(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r}function Ze(r,t,e,n){return r[0]=t,r[1]=e,r[2]=n,r}function Fi(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r}function Em(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r}function _L(r,t,e){return r[0]=t[0]*e[0],r[1]=t[1]*e[1],r[2]=t[2]*e[2],r}function kL(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 ML(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 Wc(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r}function CL(r,t){var e=t[0]-r[0],n=t[1]-r[1],i=t[2]-r[2];return Math.hypot(e,n,i)}function Ma(r,t){var e=t[0],n=t[1],i=t[2],a=e*e+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),r[0]=t[0]*a,r[1]=t[1]*a,r[2]=t[2]*a,r}function Sr(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]}function Oc(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 Sm(r,t,e,n){var i=t[0],a=t[1],s=t[2];return r[0]=i+n*(e[0]-i),r[1]=a+n*(e[1]-a),r[2]=s+n*(e[2]-s),r}function Qe(r,t,e){var n=t[0],i=t[1],a=t[2],s=e[3]*n+e[7]*i+e[11]*a+e[15];return s=s||1,r[0]=(e[0]*n+e[4]*i+e[8]*a+e[12])/s,r[1]=(e[1]*n+e[5]*i+e[9]*a+e[13])/s,r[2]=(e[2]*n+e[6]*i+e[10]*a+e[14])/s,r}function TL(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 OL(r,t,e){var n=e[0],i=e[1],a=e[2],s=e[3],o=t[0],l=t[1],c=t[2],u=i*c-a*l,h=a*o-n*c,d=n*l-i*o,f=i*d-a*h,g=a*u-n*d,v=n*h-i*u,p=s*2;return u*=p,h*=p,d*=p,f*=2,g*=2,v*=2,r[0]=o+u+f,r[1]=l+h+g,r[2]=c+d+v,r}function Vs(r,t){var e=r[0],n=r[1],i=r[2],a=t[0],s=t[1],o=t[2];return Math.abs(e-a)<=te*Math.max(1,Math.abs(e),Math.abs(a))&&Math.abs(n-s)<=te*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-o)<=te*Math.max(1,Math.abs(i),Math.abs(o))}var AL=Em,k2=CL,BM=qr;(function(){var r=St();return function(t,e,n,i,a,s){var o,l;for(e||(e=3),n||(n=0),i?l=Math.min(i*e+n,t.length):l=t.length,o=n;o0&&(s=1/Math.sqrt(s)),r[0]=e*s,r[1]=n*s,r[2]=i*s,r[3]=a*s,r}function Ur(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3];return r[0]=e[0]*n+e[4]*i+e[8]*a+e[12]*s,r[1]=e[1]*n+e[5]*i+e[9]*a+e[13]*s,r[2]=e[2]*n+e[6]*i+e[10]*a+e[14]*s,r[3]=e[3]*n+e[7]*i+e[11]*a+e[15]*s,r}(function(){var r=_r();return function(t,e,n,i,a,s){var o,l;for(e||(e=4),n||(n=0),i?l=Math.min(i*e+n,t.length):l=t.length,o=n;ote?(d=Math.acos(f),g=Math.sin(d),v=Math.sin((1-n)*d)/g,p=Math.sin(n*d)/g):(v=1-n,p=n),r[0]=v*i+p*l,r[1]=v*a+p*c,r[2]=v*s+p*u,r[3]=v*o+p*h,r}function _d(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 LL(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 xl(r,t,e,n){var i=.5*Math.PI/180;t*=i,e*=i,n*=i;var a=Math.sin(t),s=Math.cos(t),o=Math.sin(e),l=Math.cos(e),c=Math.sin(n),u=Math.cos(n);return r[0]=a*l*u-s*o*c,r[1]=s*o*u+a*l*c,r[2]=s*l*c-a*o*u,r[3]=s*l*u+a*o*c,r}var DL=no,El=PL,M2=NL,C2=Bi,Vc=RL;(function(){var r=St(),t=Yt(1,0,0),e=Yt(0,1,0);return function(n,i,a){var s=Sr(i,a);return s<-.999999?(Oc(r,t,i),BM(r)<1e-6&&Oc(r,e,i),Ma(r,r),Ti(n,r,Math.PI),n):s>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Oc(r,i,a),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+s,Vc(n,n))}})();(function(){var r=Te(),t=Te();return function(e,n,i,a,s,o){return Sd(r,n,s,o),Sd(t,i,a,o),Sd(e,r,t,2*o*(1-o)),e}})();(function(){var r=bM();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],Vc(t,LL(t,r))}})();function Vy(){var r=new _e(2);return _e!=Float32Array&&(r[0]=0,r[1]=0),r}function IL(r,t){return r[0]=t[0],r[1]=t[1],r}function FL(r,t,e){return r[0]=t,r[1]=e,r}function BL(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 zL(r,t){return r[0]*t[0]+r[1]*t[1]}function $L(r,t){return r[0]===t[0]&&r[1]===t[1]}(function(){var r=Vy();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-1:!1},qL=function(r,t){if(!Co(r))return r;for(var e=[],n=0;ne?e:r};function nt(r){return typeof r=="number"}var YL=1e-5;function bo(r,t,e){return e===void 0&&(e=YL),r===t||Math.abs(r-t)n&&(e=a,n=s)}return e}},KL=function(r,t){if(Dn(r)){for(var e,n=1/0,i=0;ii&&(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 kd=new Map;function km(r,t,e){e===void 0&&(e=128);var n=function(){for(var i=[],a=0;at?(n&&(clearTimeout(n),n=null),o=u,s=r.apply(i,a),n||(i=a=null)):!n&&e.trailing!==!1&&(n=setTimeout(l,h)),s};return c.cancel=function(){clearTimeout(n),o=0,n=i=a=null},c};var Sl={};const u6=function(r){return r=r||"g",Sl[r]?Sl[r]+=1:Sl[r]=1,r+Sl[r]},Md=function(){},Mm=function(r){return r};var Cm=function(r,t){return Cm=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])},Cm(r,t)};function wt(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Cm(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var q=function(){return q=Object.assign||function(t){for(var e,n=1,i=arguments.length;n=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function N(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),i,a=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(o){s={error:o}}finally{try{i&&!i.done&&(e=n.return)&&e.call(n)}finally{if(s)throw s.error}}return a}function h6(){for(var r=0,t=0,e=arguments.length;t7){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 wo={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function HM(r){return Array.isArray(r)&&r.every(function(t){var e=t[0].toLowerCase();return wo[e]===t.length-1&&"achlmqstvz".includes(e)})}function UM(r){return HM(r)&&r.every(function(t){var e=t[0];return e===e.toUpperCase()})}function YM(r){return UM(r)&&r.every(function(t){var e=t[0];return"ACLMQZ".includes(e)})}function T2(r){for(var t=r.pathValue[r.segmentStart],e=t.toLowerCase(),n=r.data;n.length>=wo[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,wo[e]))),!!wo[e]););}function f6(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 g6(r){return r>=48&&r<=57||r===43||r===45||r===46}function Ja(r){return r>=48&&r<=57}function v6(r){var t=r.max,e=r.pathValue,n=r.index,i=n,a=!1,s=!1,o=!1,l=!1,c;if(i>=t){r.err="[path-util]: Invalid path value at index ".concat(i,', "pathValue" is missing param');return}if(c=e.charCodeAt(i),(c===43||c===45)&&(i+=1,c=e.charCodeAt(i)),!Ja(c)&&c!==46){r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(e[i],'" is not a number');return}if(c!==46){if(a=c===48,i+=1,c=e.charCodeAt(i),a&&i=5760&&t.includes(r)}function Ac(r){for(var t=r.pathValue,e=r.max;r.index0;s-=1){if(y6(i)&&(s===3||s===4)?f6(r):v6(r),r.err.length)return;r.data.push(r.param),Ac(r),r.index=r.max||!g6(e.charCodeAt(r.index)))break}T2(r)}var w6=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 x6(r){if(HM(r))return[].concat(r);var t=new w6(r);for(Ac(t);t.index1&&(k=Math.sqrt(k),d*=k,f*=k);var M=d*d,T=f*f,O=(a===s?-1:1)*Math.sqrt(Math.abs((M*T-M*C*C-T*_*_)/(M*C*C+T*_*_)));S=O*d*C/f+(u+g)/2,E=O*-f*_/d+(h+v)/2,w=Math.asin(((h-E)/f*Math.pow(10,9)>>0)/Math.pow(10,9)),x=Math.asin(((v-E)/f*Math.pow(10,9)>>0)/Math.pow(10,9)),w=ux&&(w-=Math.PI*2),!s&&x>w&&(x-=Math.PI*2)}var R=x-w;if(Math.abs(R)>p){var L=x,D=g,P=v;x=w+p*(s&&x>w?1:-1),g=S+d*Math.cos(x),v=E+f*Math.sin(x),y=Uy(g,v,d,f,i,0,s,D,P,[x,L,S,E])}R=x-w;var A=Math.cos(w),I=Math.sin(w),B=Math.cos(x),j=Math.sin(x),G=Math.tan(R/4),H=4/3*d*G,Y=4/3*f*G,K=[u,h],tt=[u+H*I,h-Y*A],it=[g+H*j,v-Y*B],_t=[g,v];if(tt[0]=2*K[0]-tt[0],tt[1]=2*K[1]-tt[1],c)return tt.concat(it,_t,y);y=tt.concat(it,_t,y);for(var Mt=[],re=0,Re=y.length;re=a)s={x:e,y:n};else{var o=Si([r,t],[e,n],i/a),l=o[0],c=o[1];s={x:l,y:c}}return{length:a,point:s,min:{x:Math.min(r,e),y:Math.min(t,n)},max:{x:Math.max(r,e),y:Math.max(t,n)}}}function A2(r,t){var e=r.x,n=r.y,i=t.x,a=t.y,s=e*i+n*a,o=Math.sqrt((Math.pow(e,2)+Math.pow(n,2))*(Math.pow(i,2)+Math.pow(a,2))),l=e*a-n*i<0?-1:1,c=l*Math.acos(s/o);return c}function O6(r,t,e,n,i,a,s,o,l,c){var u=Math.abs,h=Math.sin,d=Math.cos,f=Math.sqrt,g=Math.PI,v=u(e),p=u(n),m=(i%360+360)%360,y=m*(g/180);if(r===o&&t===l)return{x:r,y:t};if(v===0||p===0)return Om(r,t,o,l,c).point;var b=(r-o)/2,w=(t-l)/2,x={x:d(y)*b+h(y)*w,y:-h(y)*b+d(y)*w},S=Math.pow(x.x,2)/Math.pow(v,2)+Math.pow(x.y,2)/Math.pow(p,2);S>1&&(v*=f(S),p*=f(S));var E=Math.pow(v,2)*Math.pow(p,2)-Math.pow(v,2)*Math.pow(x.y,2)-Math.pow(p,2)*Math.pow(x.x,2),_=Math.pow(v,2)*Math.pow(x.y,2)+Math.pow(p,2)*Math.pow(x.x,2),C=E/_;C=C<0?0:C;var k=(a!==s?1:-1)*f(C),M={x:k*(v*x.y/p),y:k*(-(p*x.x)/v)},T={x:d(y)*M.x-h(y)*M.y+(r+o)/2,y:h(y)*M.x+d(y)*M.y+(t+l)/2},O={x:(x.x-M.x)/v,y:(x.y-M.y)/p},R=A2({x:1,y:0},O),L={x:(-x.x-M.x)/v,y:(-x.y-M.y)/p},D=A2(O,L);!s&&D>0?D-=2*g:s&&D<0&&(D+=2*g),D%=2*g;var P=R+D*c,A=v*d(P),I=p*h(P),B={x:d(y)*A-h(y)*I+T.x,y:h(y)*A+d(y)*I+T.y};return B}function A6(r,t,e,n,i,a,s,o,l,c,u){var h,d=u.bbox,f=d===void 0?!0:d,g=u.length,v=g===void 0?!0:g,p=u.sampleSize,m=p===void 0?30:p,y=typeof c=="number",b=r,w=t,x=0,S=[b,w,x],E=[b,w],_=0,C={x:0,y:0},k=[{x:b,y:w}];y&&c<=0&&(C={x:b,y:w});for(var M=0;M<=m;M+=1){if(_=M/m,h=O6(r,t,e,n,i,a,s,o,l,_),b=h.x,w=h.y,f&&k.push({x:b,y:w}),v&&(x+=fn(E,[b,w])),E=[b,w],y&&x>=c&&c>S[2]){var T=(x-c)/(x-S[2]);C={x:E[0]*(1-T)+S[0]*T,y:E[1]*(1-T)+S[1]*T}}S=[b,w,x]}return y&&c>=x&&(C={x:o,y:l}),{length:x,point:C,min:{x:Math.min.apply(null,k.map(function(O){return O.x})),y:Math.min.apply(null,k.map(function(O){return O.y}))},max:{x:Math.max.apply(null,k.map(function(O){return O.x})),y:Math.max.apply(null,k.map(function(O){return O.y}))}}}function P6(r,t,e,n,i,a,s,o,l){var c=1-l;return{x:Math.pow(c,3)*r+3*Math.pow(c,2)*l*e+3*c*Math.pow(l,2)*i+Math.pow(l,3)*s,y:Math.pow(c,3)*t+3*Math.pow(c,2)*l*n+3*c*Math.pow(l,2)*a+Math.pow(l,3)*o}}function XM(r,t,e,n,i,a,s,o,l,c){var u,h=c.bbox,d=h===void 0?!0:h,f=c.length,g=f===void 0?!0:f,v=c.sampleSize,p=v===void 0?10:v,m=typeof l=="number",y=r,b=t,w=0,x=[y,b,w],S=[y,b],E=0,_={x:0,y:0},C=[{x:y,y:b}];m&&l<=0&&(_={x:y,y:b});for(var k=0;k<=p;k+=1){if(E=k/p,u=P6(r,t,e,n,i,a,s,o,E),y=u.x,b=u.y,d&&C.push({x:y,y:b}),g&&(w+=fn(S,[y,b])),S=[y,b],m&&w>=l&&l>x[2]){var M=(w-l)/(w-x[2]);_={x:S[0]*(1-M)+x[0]*M,y:S[1]*(1-M)+x[1]*M}}x=[y,b,w]}return m&&l>=w&&(_={x:s,y:o}),{length:w,point:_,min:{x:Math.min.apply(null,C.map(function(T){return T.x})),y:Math.min.apply(null,C.map(function(T){return T.y}))},max:{x:Math.max.apply(null,C.map(function(T){return T.x})),y:Math.max.apply(null,C.map(function(T){return T.y}))}}}function N6(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 R6(r,t,e,n,i,a,s,o){var l,c=o.bbox,u=c===void 0?!0:c,h=o.length,d=h===void 0?!0:h,f=o.sampleSize,g=f===void 0?10:f,v=typeof s=="number",p=r,m=t,y=0,b=[p,m,y],w=[p,m],x=0,S={x:0,y:0},E=[{x:p,y:m}];v&&s<=0&&(S={x:p,y:m});for(var _=0;_<=g;_+=1){if(x=_/g,l=N6(r,t,e,n,i,a,x),p=l.x,m=l.y,u&&E.push({x:p,y:m}),d&&(y+=fn(w,[p,m])),w=[p,m],v&&y>=s&&s>b[2]){var C=(y-s)/(y-b[2]);S={x:w[0]*(1-C)+b[0]*C,y:w[1]*(1-C)+b[1]*C}}b=[p,m,y]}return v&&s>=y&&(S={x:i,y:a}),{length:y,point:S,min:{x:Math.min.apply(null,E.map(function(k){return k.x})),y:Math.min.apply(null,E.map(function(k){return k.y}))},max:{x:Math.max.apply(null,E.map(function(k){return k.x})),y:Math.max.apply(null,E.map(function(k){return k.y}))}}}function KM(r,t,e){for(var n,i,a,s,o,l,c=Kc(r),u=typeof t=="number",h,d=[],f,g=0,v=0,p=0,m=0,y,b=[],w=[],x=0,S={x:0,y:0},E=S,_=S,C=S,k=0,M=0,T=c.length;M=t&&(C=_),w.push(E),b.push(S),k+=x,l=f!=="Z"?y.slice(-2):[p,m],g=l[0],v=l[1];return u&&t>=k&&(C={x:g,y:v}),{length:k,point:C,min:{x:Math.min.apply(null,b.map(function(O){return O.x})),y:Math.min.apply(null,b.map(function(O){return O.y}))},max:{x:Math.max.apply(null,w.map(function(O){return O.x})),y:Math.max.apply(null,w.map(function(O){return O.y}))}}}function L6(r,t){return KM(r,void 0,q(q({},t),{bbox:!1,length:!0})).length}function D6(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 I6(r,t){var e=r.length-1,n=[],i=0,a=0,s=D6(r);return s.forEach(function(o,l){r.slice(1).forEach(function(c,u){a+=fn(r[(l+u)%e].slice(-2),t[u%e].slice(-2))}),n[l]=a,a=0}),i=n.indexOf(Math.min.apply(null,n)),s[i]}function F6(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 B6(r){var t=0,e=0,n=0;return Tm(r).map(function(i){var a;switch(i[0]){case"M":return t=i[1],e=i[2],0;default:var s=i.slice(1),o=s[0],l=s[1],c=s[2],u=s[3],h=s[4],d=s[5];return n=F6(t,e,o,l,c,u,h,d),a=i.slice(-2),t=a[0],e=a[1],n}}).reduce(function(i,a){return i+a},0)}function P2(r){return B6(r)>=0}function z6(r,t,e){return KM(r,t,q(q({},e),{bbox:!1,length:!0})).point}function $6(r,t){t===void 0&&(t=.5);var e=r.slice(0,2),n=r.slice(2,4),i=r.slice(4,6),a=r.slice(6,8),s=Si(e,n,t),o=Si(n,i,t),l=Si(i,a,t),c=Si(s,o,t),u=Si(o,l,t),h=Si(c,u,t);return[["C"].concat(s,c,h),["C"].concat(u,l,a)]}function N2(r){return r.map(function(t,e,n){var i=e&&n[e-1].slice(-2).concat(t.slice(1)),a=e?XM(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?$6(i):[t,t]:s=[t],{s:t,ss:s,l:a}})}function ZM(r,t,e){var n=N2(r),i=N2(t),a=n.length,s=i.length,o=n.filter(function(p){return p.l}).length,l=i.filter(function(p){return p.l}).length,c=n.filter(function(p){return p.l}).reduce(function(p,m){var y=m.l;return p+y},0)/o||0,u=i.filter(function(p){return p.l}).reduce(function(p,m){var y=m.l;return p+y},0)/l||0,h=e||Math.max(a,s),d=[c,u],f=[h-a,h-s],g=0,v=[n,i].map(function(p,m){return p.l===h?p.map(function(y){return y.s}):p.map(function(y,b){return g=b&&f[m]&&y.l>=d[m],f[m]-=g?1:0,g?y.ss:[y.s]}).flat()});return v[0].length===v[1].length?v:ZM(v[0],v[1],h)}function Am(r){var t=document.createElement("div");t.innerHTML=r;var e=t.childNodes[0];return e&&t.contains(e)&&t.removeChild(e),e}function j6(r,t){for(;!{}.hasOwnProperty.call(r,t)&&(r=jc(r))!==null;);return r}function Pm(){return Pm=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(r,t,e){var n=j6(r,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?r:e):i.value}},Pm.apply(null,arguments)}function R2(r,t,e,n){var i=Pm(jc(r.prototype),t,e);return typeof i=="function"?function(a){return i.apply(e,a)}:i}function Qr(r,t,e,n){var i=r-e,a=t-n;return Math.sqrt(i*i+a*a)}function JM(r,t){var e=Math.min.apply(Math,Q([],N(r),!1)),n=Math.min.apply(Math,Q([],N(t),!1)),i=Math.max.apply(Math,Q([],N(r),!1)),a=Math.max.apply(Math,Q([],N(t),!1));return{x:e,y:n,width:i-e,height:a-n}}function q6(r,t,e){return Math.atan(-t/r*Math.tan(e))}function G6(r,t,e){return Math.atan(t/(r*Math.tan(e)))}function W6(r,t,e,n,i,a){return e*Math.cos(i)*Math.cos(a)-n*Math.sin(i)*Math.sin(a)+r}function V6(r,t,e,n,i,a){return e*Math.sin(i)*Math.cos(a)+n*Math.cos(i)*Math.sin(a)+t}function H6(r,t,e,n,i,a,s){for(var o=q6(e,n,i),l=1/0,c=-1/0,u=[a,s],h=-Math.PI*2;h<=Math.PI*2;h+=Math.PI){var d=o+h;ac&&(c=f)}for(var g=G6(e,n,i),v=1/0,p=-1/0,m=[a,s],h=-Math.PI*2;h<=Math.PI*2;h+=Math.PI){var y=g+h;ap&&(p=b)}return{x:l,y:v,width:c-l,height:p-v}}var U6=1e-4;function QM(r,t,e,n,i,a){var s=-1,o=1/0,l=[e,n],c=20;a&&a>200&&(c=a/10);for(var u=1/c,h=u/10,d=0;d<=c;d++){var f=d*u,g=[i.apply(void 0,Q([],N(r.concat([f])),!1)),i.apply(void 0,Q([],N(t.concat([f])),!1))],v=Qr(l[0],l[1],g[0],g[1]);v=0&&v=0&&l<=1&&o.push(l));else{var h=a*a-4*i*s;bo(h,0)?o.push(-a/(2*i)):h>0&&(u=Math.sqrt(h),l=(-a+u)/(2*i),c=(-a-u)/(2*i),l>=0&&l<=1&&o.push(l),c>=0&&c<=1&&o.push(c))}return o}function X6(r,t,e,n,i,a,s,o){for(var l=[r,s],c=[t,o],u=L2(r,e,i,s),h=L2(t,n,a,o),d=0;d=0?[i]:[]}function Q6(r,t,e,n,i,a){var s=I2(r,e,i)[0],o=I2(t,n,a)[0],l=[r,i],c=[t,a];return s!==void 0&&l.push(Rm(r,e,i,s)),o!==void 0&&c.push(Rm(t,n,a,o)),JM(l,c)}function tD(r,t,e,n,i,a,s,o){return QM([r,e,i],[t,n,a],s,o,Rm)}function eD(r,t,e,n,i,a,s,o){var l=tD(r,t,e,n,i,a,s,o);return Qr(l.x,l.y,s,o)}function We(){We=function(){return t};var r,t={},e=Object.prototype,n=e.hasOwnProperty,i=Object.defineProperty||function(D,P,A){D[P]=A.value},a=typeof Symbol=="function"?Symbol:{},s=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function c(D,P,A){return Object.defineProperty(D,P,{value:A,enumerable:!0,configurable:!0,writable:!0}),D[P]}try{c({},"")}catch{c=function(A,I,B){return A[I]=B}}function u(D,P,A,I){var B=P&&P.prototype instanceof m?P:m,j=Object.create(B.prototype),G=new R(I||[]);return i(j,"_invoke",{value:k(D,A,G)}),j}function h(D,P,A){try{return{type:"normal",arg:D.call(P,A)}}catch(I){return{type:"throw",arg:I}}}t.wrap=u;var d="suspendedStart",f="suspendedYield",g="executing",v="completed",p={};function m(){}function y(){}function b(){}var w={};c(w,s,function(){return this});var x=Object.getPrototypeOf,S=x&&x(x(L([])));S&&S!==e&&n.call(S,s)&&(w=S);var E=b.prototype=m.prototype=Object.create(w);function _(D){["next","throw","return"].forEach(function(P){c(D,P,function(A){return this._invoke(P,A)})})}function C(D,P){function A(B,j,G,H){var Y=h(D[B],D,j);if(Y.type!=="throw"){var K=Y.arg,tt=K.value;return tt&&b2(tt)=="object"&&n.call(tt,"__await")?P.resolve(tt.__await).then(function(it){A("next",it,G,H)},function(it){A("throw",it,G,H)}):P.resolve(tt).then(function(it){K.value=it,G(K)},function(it){return A("throw",it,G,H)})}H(Y.arg)}var I;i(this,"_invoke",{value:function(j,G){function H(){return new P(function(Y,K){A(j,G,Y,K)})}return I=I?I.then(H,H):H()}})}function k(D,P,A){var I=d;return function(B,j){if(I===g)throw Error("Generator is already running");if(I===v){if(B==="throw")throw j;return{value:r,done:!0}}for(A.method=B,A.arg=j;;){var G=A.delegate;if(G){var H=M(G,A);if(H){if(H===p)continue;return H}}if(A.method==="next")A.sent=A._sent=A.arg;else if(A.method==="throw"){if(I===d)throw I=v,A.arg;A.dispatchException(A.arg)}else A.method==="return"&&A.abrupt("return",A.arg);I=g;var Y=h(D,P,A);if(Y.type==="normal"){if(I=A.done?v:f,Y.arg===p)continue;return{value:Y.arg,done:A.done}}Y.type==="throw"&&(I=v,A.method="throw",A.arg=Y.arg)}}}function M(D,P){var A=P.method,I=D.iterator[A];if(I===r)return P.delegate=null,A==="throw"&&D.iterator.return&&(P.method="return",P.arg=r,M(D,P),P.method==="throw")||A!=="return"&&(P.method="throw",P.arg=new TypeError("The iterator does not provide a '"+A+"' method")),p;var B=h(I,D.iterator,P.arg);if(B.type==="throw")return P.method="throw",P.arg=B.arg,P.delegate=null,p;var j=B.arg;return j?j.done?(P[D.resultName]=j.value,P.next=D.nextLoc,P.method!=="return"&&(P.method="next",P.arg=r),P.delegate=null,p):j:(P.method="throw",P.arg=new TypeError("iterator result is not an object"),P.delegate=null,p)}function T(D){var P={tryLoc:D[0]};1 in D&&(P.catchLoc=D[1]),2 in D&&(P.finallyLoc=D[2],P.afterLoc=D[3]),this.tryEntries.push(P)}function O(D){var P=D.completion||{};P.type="normal",delete P.arg,D.completion=P}function R(D){this.tryEntries=[{tryLoc:"root"}],D.forEach(T,this),this.reset(!0)}function L(D){if(D||D===""){var P=D[s];if(P)return P.call(D);if(typeof D.next=="function")return D;if(!isNaN(D.length)){var A=-1,I=function B(){for(;++A=0;--B){var j=this.tryEntries[B],G=j.completion;if(j.tryLoc==="root")return I("end");if(j.tryLoc<=this.prev){var H=n.call(j,"catchLoc"),Y=n.call(j,"finallyLoc");if(H&&Y){if(this.prev=0;--I){var B=this.tryEntries[I];if(B.tryLoc<=this.prev&&n.call(B,"finallyLoc")&&this.prev=0;--A){var I=this.tryEntries[A];if(I.finallyLoc===P)return this.complete(I.completion,I.afterLoc),O(I),p}},catch:function(P){for(var A=this.tryEntries.length-1;A>=0;--A){var I=this.tryEntries[A];if(I.tryLoc===P){var B=I.completion;if(B.type==="throw"){var j=B.arg;O(I)}return j}}throw Error("illegal catch attempt")},delegateYield:function(P,A,I){return this.delegate={iterator:L(P),resultName:A,nextLoc:I},this.method==="next"&&(this.arg=r),p}},t}function ma(r,t){var e=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!e){if(Array.isArray(r)||(e=IN(r))||t){e&&(r=e);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(c){throw c},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,s=!0,o=!1;return{s:function(){e=e.call(r)},n:function(){var c=e.next();return s=c.done,c},e:function(c){o=!0,a=c},f:function(){try{s||e.return==null||e.return()}finally{if(o)throw a}}}}function nD(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 qa(r,t){if(r==null)return{};var e,n,i=nD(r,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);for(n=0;nE;){if(_-E>600){var k=_-E+1,M=S-E+1,T=Math.log(k),O=.5*Math.exp(2*T/3),R=.5*Math.sqrt(T*O*(k-O)/k)*(M-k/2<0?-1:1),L=Math.max(E,Math.floor(S-M*O/k+R)),D=Math.min(_,Math.floor(S+(k-M)*O/k+R));n(x,S,L,D,C)}var P=x[S],A=E,I=_;for(i(x,E,S),C(x[_],P)>0&&i(x,E,_);A0;)I--}C(x[E],P)===0?i(x,E,I):(I++,i(x,I,_)),I<=S&&(E=I+1),S<=I&&(_=I-1)}}function i(x,S,E){var _=x[S];x[S]=x[E],x[E]=_}function a(x,S){return xS?1:0}var s=function(S){S===void 0&&(S=9),this._maxEntries=Math.max(4,S),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()};s.prototype.all=function(){return this._all(this.data,[])},s.prototype.search=function(S){var E=this.data,_=[];if(!y(S,E))return _;for(var C=this.toBBox,k=[];E;){for(var M=0;M=0&&k[E].children.length>this._maxEntries;)this._split(k,E),E--;this._adjustParentBBoxes(C,k,E)},s.prototype._split=function(S,E){var _=S[E],C=_.children.length,k=this._minEntries;this._chooseSplitAxis(_,k,C);var M=this._chooseSplitIndex(_,k,C),T=b(_.children.splice(M,_.children.length-M));T.height=_.height,T.leaf=_.leaf,l(_,this.toBBox),l(T,this.toBBox),E?S[E-1].children.push(T):this._splitRoot(_,T)},s.prototype._splitRoot=function(S,E){this.data=b([S,E]),this.data.height=S.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},s.prototype._chooseSplitIndex=function(S,E,_){for(var C,k=1/0,M=1/0,T=E;T<=_-E;T++){var O=c(S,0,T,this.toBBox),R=c(S,T,_,this.toBBox),L=p(O,R),D=f(O)+f(R);L=E;D--){var P=S.children[D];u(T,S.leaf?k(P):P),O+=g(T)}return O},s.prototype._adjustParentBBoxes=function(S,E,_){for(var C=_;C>=0;C--)u(E[C],S)},s.prototype._condense=function(S){for(var E=S.length-1,_=void 0;E>=0;E--)S[E].children.length===0?E>0?(_=S[E-1].children,_.splice(_.indexOf(S[E]),1)):this.clear():l(S[E],this.toBBox)};function o(x,S,E){if(!E)return S.indexOf(x);for(var _=0;_=x.minX&&S.maxY>=x.minY}function b(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function w(x,S,E,_,C){for(var k=[S,E];k.length;)if(E=k.pop(),S=k.pop(),!(E-S<=_)){var M=S+Math.ceil((E-S)/_/2)*_;e(x,M,S,E,C),k.push(S,M,M,E)}}return s})})(nC);var iD=nC.exports,$=function(r){return r.GROUP="g",r.FRAGMENT="fragment",r.CIRCLE="circle",r.ELLIPSE="ellipse",r.IMAGE="image",r.RECT="rect",r.LINE="line",r.POLYLINE="polyline",r.POLYGON="polygon",r.TEXT="text",r.PATH="path",r.HTML="html",r.MESH="mesh",r}({}),Pc=function(r){return r[r.ZERO=0]="ZERO",r[r.NEGATIVE_ONE=1]="NEGATIVE_ONE",r}({}),Ji=function(){function r(){V(this,r),this.plugins=[]}return W(r,[{key:"addRenderingPlugin",value:function(e){this.plugins.push(e),this.context.renderingPlugins.push(e)}},{key:"removeAllRenderingPlugins",value:function(){var e=this;this.plugins.forEach(function(n){var i=e.context.renderingPlugins.indexOf(n);i>=0&&e.context.renderingPlugins.splice(i,1)})}}])}(),aD=function(){function r(t){V(this,r),this.clipSpaceNearZ=Pc.NEGATIVE_ONE,this.plugins=[],this.config=vt({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1,enableSizeAttenuation:!0,enableRenderingOptimization:!1},t)}return W(r,[{key:"registerPlugin",value:function(e){var n=this.plugins.findIndex(function(i){return i===e});n===-1&&this.plugins.push(e)}},{key:"unregisterPlugin",value:function(e){var n=this.plugins.findIndex(function(i){return i===e});n>-1&&this.plugins.splice(n,1)}},{key:"getPlugins",value:function(){return this.plugins}},{key:"getPlugin",value:function(e){return this.plugins.find(function(n){return n.name===e})}},{key:"getConfig",value:function(){return this.config}},{key:"setConfig",value:function(e){Object.assign(this.config,e)}}])}(),Td=Fi,Qa=Er,sD=ML,oD=kL,F2=Wc,Od=AL,Vt=function(){function r(){V(this,r),this.center=[0,0,0],this.halfExtents=[0,0,0],this.min=[0,0,0],this.max=[0,0,0]}return W(r,[{key:"update",value:function(e,n){Qa(this.center,e),Qa(this.halfExtents,n),Od(this.min,this.center,this.halfExtents),Td(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(e,n){Td(this.center,n,e),F2(this.center,this.center,.5),Od(this.halfExtents,n,e),F2(this.halfExtents,this.halfExtents,.5),Qa(this.min,e),Qa(this.max,n)}},{key:"getMin",value:function(){return this.min}},{key:"getMax",value:function(){return this.max}},{key:"add",value:function(e){if(!r.isEmpty(e)){if(r.isEmpty(this)){this.setMinMax(e.getMin(),e.getMax());return}var n=this.center,i=n[0],a=n[1],s=n[2],o=this.halfExtents,l=o[0],c=o[1],u=o[2],h=i-l,d=i+l,f=a-c,g=a+c,v=s-u,p=s+u,m=e.center,y=m[0],b=m[1],w=m[2],x=e.halfExtents,S=x[0],E=x[1],_=x[2],C=y-S,k=y+S,M=b-E,T=b+E,O=w-_,R=w+_;Cd&&(d=k),Mg&&(g=T),Op&&(p=R),n[0]=(h+d)*.5,n[1]=(f+g)*.5,n[2]=(v+p)*.5,o[0]=(d-h)*.5,o[1]=(g-f)*.5,o[2]=(p-v)*.5,this.min[0]=h,this.min[1]=f,this.min[2]=v,this.max[0]=d,this.max[1]=g,this.max[2]=p}}},{key:"setFromTransformedAABB",value:function(e,n){var i=this.center,a=this.halfExtents,s=e.center,o=e.halfExtents,l=n[0],c=n[4],u=n[8],h=n[1],d=n[5],f=n[9],g=n[2],v=n[6],p=n[10],m=Math.abs(l),y=Math.abs(c),b=Math.abs(u),w=Math.abs(h),x=Math.abs(d),S=Math.abs(f),E=Math.abs(g),_=Math.abs(v),C=Math.abs(p);i[0]=n[12]+l*s[0]+c*s[1]+u*s[2],i[1]=n[13]+h*s[0]+d*s[1]+f*s[2],i[2]=n[14]+g*s[0]+v*s[1]+p*s[2],a[0]=m*o[0]+y*o[1]+b*o[2],a[1]=w*o[0]+x*o[1]+S*o[2],a[2]=E*o[0]+_*o[1]+C*o[2],Od(this.min,i,a),Td(this.max,i,a)}},{key:"intersects",value:function(e){var n=this.getMax(),i=this.getMin(),a=e.getMax(),s=e.getMin();return i[0]<=a[0]&&n[0]>=s[0]&&i[1]<=a[1]&&n[1]>=s[1]&&i[2]<=a[2]&&n[2]>=s[2]}},{key:"intersection",value:function(e){if(!this.intersects(e))return null;var n=new r,i=sD([0,0,0],this.getMin(),e.getMin()),a=oD([0,0,0],this.getMax(),e.getMax());return n.setMinMax(i,a),n}},{key:"getNegativeFarPoint",value:function(e){return e.pnVertexFlag===273?Qa([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?Qa([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}}])}(),lD=function(){function r(t,e){V(this,r),this.distance=t||0,this.normal=e||Yt(0,1,0),this.updatePNVertexFlag()}return W(r,[{key:"updatePNVertexFlag",value:function(){this.pnVertexFlag=(+(this.normal[0]>=0)<<8)+(+(this.normal[1]>=0)<<4)+ +(this.normal[2]>=0)}},{key:"distanceToPoint",value:function(e){return Sr(e,this.normal)-this.distance}},{key:"normalize",value:function(){var e=1/BM(this.normal);Wc(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&&Sm(i,e,n,o),l}}])}(),ts=function(r){return r[r.OUTSIDE=4294967295]="OUTSIDE",r[r.INSIDE=0]="INSIDE",r[r.INDETERMINATE=2147483647]="INDETERMINATE",r}({}),cD=function(){function r(t){if(V(this,r),this.planes=[],t)this.planes=t;else for(var e=0;e<6;e++)this.planes.push(new lD)}return W(r,[{key:"extractFromVPMatrix",value:function(e){var n=dt(e,16),i=n[0],a=n[1],s=n[2],o=n[3],l=n[4],c=n[5],u=n[6],h=n[7],d=n[8],f=n[9],g=n[10],v=n[11],p=n[12],m=n[13],y=n[14],b=n[15];Ze(this.planes[0].normal,o-i,h-l,v-d),this.planes[0].distance=b-p,Ze(this.planes[1].normal,o+i,h+l,v+d),this.planes[1].distance=b+p,Ze(this.planes[2].normal,o+a,h+c,v+f),this.planes[2].distance=b+m,Ze(this.planes[3].normal,o-a,h-c,v-f),this.planes[3].distance=b-m,Ze(this.planes[4].normal,o-s,h-u,v-g),this.planes[4].distance=b-y,Ze(this.planes[5].normal,o+s,h+u,v+g),this.planes[5].distance=b+y,this.planes.forEach(function(w){w.normalize(),w.updatePNVertexFlag()})}}])}(),qe=function(){function r(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;V(this,r),this.x=0,this.y=0,this.x=t,this.y=e}return W(r,[{key:"clone",value:function(){return new r(this.x,this.y)}},{key:"copyFrom",value:function(e){this.x=e.x,this.y=e.y}}])}(),Ts=function(){function r(t,e,n,i){V(this,r),this.x=t,this.y=e,this.width=n,this.height=i,this.left=t,this.right=t+n,this.top=e,this.bottom=e+i}return W(r,[{key:"toJSON",value:function(){}}],[{key:"fromRect",value:function(e){return new r(e.x,e.y,e.width,e.height)}},{key:"applyTransform",value:function(e,n){var i=no(e.x,e.y,0,1),a=no(e.x+e.width,e.y,0,1),s=no(e.x,e.y+e.height,0,1),o=no(e.x+e.width,e.y+e.height,0,1),l=_r(),c=_r(),u=_r(),h=_r();Ur(l,i,n),Ur(c,a,n),Ur(u,s,n),Ur(h,o,n);var d=Math.min(l[0],c[0],u[0],h[0]),f=Math.min(l[1],c[1],u[1],h[1]),g=Math.max(l[0],c[0],u[0],h[0]),v=Math.max(l[1],c[1],u[1],h[1]);return r.fromRect({x:d,y:f,width:g-d,height:v-f})}}])}(),Ft="Method not implemented.",es="Use document.documentElement instead.",uD="Cannot append a destroyed element.";function bs(r){return r===void 0?0:r>360||r<-360?r%360:r}var Ad=St();function en(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;return Array.isArray(r)&&r.length===3?n?zr(r):Er(Ad,r):nt(r)?n?Yt(r,t,e):Ze(Ad,r,t,e):n?Yt(r[0],r[1]||t,r[2]||e):Ze(Ad,r[0],r[1]||t,r[2]||e)}var hD=Math.PI/180;function Bt(r){return r*hD}var dD=180/Math.PI;function gn(r){return r*dD}function fD(r){return 360*r}var Zc=Math.PI/2;function gD(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e*e,o=n*n,l=i*i,c=a*a,u=s+o+l+c,h=e*a-n*i;return h>.499995*u?(r[0]=Zc,r[1]=2*Math.atan2(n,e),r[2]=0):h<-.499995*u?(r[0]=-Zc,r[1]=2*Math.atan2(n,e),r[2]=0):(r[0]=Math.asin(2*(e*i-a*n)),r[1]=Math.atan2(2*(e*a+n*i),1-2*(l+c)),r[2]=Math.atan2(2*(e*n+i*a),1-2*(o+l))),r}function vD(r,t){var e,n,i=Ms(St(),t),a=dt(i,3),s=a[0],o=a[1],l=a[2],c=Math.asin(-t[2]/s);return c-Zc?(e=Math.atan2(t[6]/o,t[10]/l),n=Math.atan2(t[1]/s,t[0]/s)):(n=0,e=-Math.atan2(t[4]/o,t[5]/o)):(n=0,e=Math.atan2(t[4]/o,t[5]/o)),r[0]=e,r[1]=c,r[2]=n,r}function Pd(r,t){return t.length===16?vD(r,t):gD(r,t)}function pD(r,t,e,n,i){var a=Math.cos(r),s=Math.sin(r);return aL(n*a,i*s,0,-n*s,i*a,0,t,e,1)}function mD(r,t,e,n,i,a,s){var o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1,l=2*a,c=e-t,u=n-i,h=l/c,d=l/u,f=(e+t)/c,g=(n+i)/u,v,p,m=s-a,y=s*a;return o?(v=-s/m,p=-y/m):(v=-(s+a)/m,p=-2*y/m),r[0]=h,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=d,r[6]=0,r[7]=0,r[8]=f,r[9]=g,r[10]=v,r[11]=-1,r[12]=0,r[13]=0,r[14]=p,r[15]=0,r}function B2(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&&(tlt[1][2]&&(a[0]=-a[0]),lt[0][2]>lt[2][0]&&(a[1]=-a[1]),lt[1][0]>lt[0][1]&&(a[2]=-a[2]),!0}function bD(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 wD(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 Nd(r,t,e,n,i){r[0]=t[0]*n+e[0]*i,r[1]=t[1]*n+e[1]*i,r[2]=t[2]*n+e[2]*i}var It=function(r){return r[r.ORBITING=0]="ORBITING",r[r.EXPLORING=1]="EXPLORING",r[r.TRACKING=2]="TRACKING",r}({}),Lm=function(r){return r[r.DEFAULT=0]="DEFAULT",r[r.ROTATIONAL=1]="ROTATIONAL",r[r.TRANSLATIONAL=2]="TRANSLATIONAL",r[r.CINEMATIC=3]="CINEMATIC",r}({}),jn=function(r){return r[r.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",r[r.PERSPECTIVE=1]="PERSPECTIVE",r}({}),rC={UPDATED:"updated"},$2=2e-4,iC=function(){function r(){V(this,r),this.clipSpaceNearZ=Pc.NEGATIVE_ONE,this.eventEmitter=new yM,this.matrix=Wt(),this.right=Yt(1,0,0),this.up=Yt(0,1,0),this.forward=Yt(0,0,1),this.position=Yt(0,0,1),this.focalPoint=Yt(0,0,0),this.distanceVector=Yt(0,0,-1),this.distance=1,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.dollyingStep=0,this.maxDistance=1/0,this.minDistance=-1/0,this.zoom=1,this.rotateWorld=!1,this.fov=30,this.near=.1,this.far=1e3,this.aspect=1,this.projectionMatrix=Wt(),this.projectionMatrixInverse=Wt(),this.jitteredProjectionMatrix=void 0,this.enableUpdate=!0,this.type=It.EXPLORING,this.trackingMode=Lm.DEFAULT,this.projectionMode=jn.PERSPECTIVE,this.frustum=new cD,this.orthoMatrix=Wt()}return W(r,[{key:"isOrtho",value:function(){return this.projectionMode===jn.ORTHOGRAPHIC}},{key:"getProjectionMode",value:function(){return this.projectionMode}},{key:"getPerspective",value:function(){return this.jitteredProjectionMatrix||this.projectionMatrix}},{key:"getPerspectiveInverse",value:function(){return this.projectionMatrixInverse}},{key:"getFrustum",value:function(){return this.frustum}},{key:"getPosition",value:function(){return this.position}},{key:"getFocalPoint",value:function(){return this.focalPoint}},{key:"getDollyingStep",value:function(){return this.dollyingStep}},{key:"getNear",value:function(){return this.near}},{key:"getFar",value:function(){return this.far}},{key:"getZoom",value:function(){return this.zoom}},{key:"getOrthoMatrix",value:function(){return this.orthoMatrix}},{key:"getView",value:function(){return this.view}},{key:"setEnableUpdate",value:function(e){this.enableUpdate=e}},{key:"setType",value:function(e,n){return this.type=e,this.type===It.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===It.TRACKING&&n!==void 0&&this.setTrackingMode(n),this}},{key:"setProjectionMode",value:function(e){return this.projectionMode=e,this}},{key:"setTrackingMode",value:function(e){if(this.type!==It.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=e,this}},{key:"setWorldRotation",value:function(e){return this.rotateWorld=e,this._getAngles(),this}},{key:"getViewTransform",value:function(){return xr(Wt(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"jitterProjectionMatrix",value:function(e,n){var i=ki(Wt(),[e,n,0]);this.jitteredProjectionMatrix=Je(Wt(),i,this.projectionMatrix)}},{key:"clearJitterProjectionMatrix",value:function(){this.jitteredProjectionMatrix=void 0}},{key:"setMatrix",value:function(e){return this.matrix=e,this._update(),this}},{key:"setProjectionMatrix",value:function(e){this.projectionMatrix=e}},{key:"setFov",value:function(e){return this.setPerspective(this.near,this.far,e,this.aspect),this}},{key:"setAspect",value:function(e){return this.setPerspective(this.near,this.far,this.fov,e),this}},{key:"setNear",value:function(e){return this.projectionMode===jn.PERSPECTIVE?this.setPerspective(e,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,e,this.far),this}},{key:"setFar",value:function(e){return this.projectionMode===jn.PERSPECTIVE?this.setPerspective(this.near,e,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,e),this}},{key:"setViewOffset",value:function(e,n,i,a,s,o){return this.aspect=e/n,this.view===void 0&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=a,this.view.width=s,this.view.height=o,this.projectionMode===jn.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"clearViewOffset",value:function(){return this.view!==void 0&&(this.view.enabled=!1),this.projectionMode===jn.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"setZoom",value:function(e){return this.zoom=e,this.projectionMode===jn.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===jn.PERSPECTIVE&&this.setPerspective(this.near,this.far,this.fov,this.aspect),this}},{key:"setZoomByViewportPoint",value:function(e,n){var i=this.canvas.viewport2Canvas({x:n[0],y:n[1]}),a=i.x,s=i.y,o=this.roll;this.rotate(0,0,-o),this.setPosition(a,s),this.setFocalPoint(a,s),this.setZoom(e),this.rotate(0,0,o);var l=this.canvas.viewport2Canvas({x:n[0],y:n[1]}),c=l.x,u=l.y,h=Yt(c-a,u-s,0),d=Sr(h,this.right)/qr(this.right),f=Sr(h,this.up)/qr(this.up),g=this.getPosition(),v=dt(g,2),p=v[0],m=v[1],y=this.getFocalPoint(),b=dt(y,2),w=b[0],x=b[1];return this.setPosition(p-d,m-f),this.setFocalPoint(w-d,x-f),this}},{key:"setPerspective",value:function(e,n,i,a){var s;this.projectionMode=jn.PERSPECTIVE,this.fov=i,this.near=e,this.far=n,this.aspect=a;var o=this.near*Math.tan(Bt(.5*this.fov))/this.zoom,l=2*o,c=this.aspect*l,u=-.5*c;if((s=this.view)!==null&&s!==void 0&&s.enabled){var h=this.view.fullWidth,d=this.view.fullHeight;u+=this.view.offsetX*c/h,o-=this.view.offsetY*l/d,c*=this.view.width/h,l*=this.view.height/d}return mD(this.projectionMatrix,u,u+c,o-l,o,e,this.far,this.clipSpaceNearZ===Pc.ZERO),xr(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this}},{key:"setOrthographic",value:function(e,n,i,a,s,o){var l;this.projectionMode=jn.ORTHOGRAPHIC,this.rright=n,this.left=e,this.top=i,this.bottom=a,this.near=s,this.far=o;var c=(this.rright-this.left)/(2*this.zoom),u=(this.top-this.bottom)/(2*this.zoom),h=(this.rright+this.left)/2,d=(this.top+this.bottom)/2,f=h-c,g=h+c,v=d+u,p=d-u;if((l=this.view)!==null&&l!==void 0&&l.enabled){var m=(this.rright-this.left)/this.view.fullWidth/this.zoom,y=(this.top-this.bottom)/this.view.fullHeight/this.zoom;f+=m*this.view.offsetX,g=f+m*this.view.width,v-=y*this.view.offsetY,p=v-y*this.view.height}return this.clipSpaceNearZ===Pc.NEGATIVE_ONE?RM(this.projectionMatrix,f,g,v,p,s,o):LM(this.projectionMatrix,f,g,v,p,s,o),xr(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.triggerUpdate(),this}},{key:"setPosition",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.position[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.position[2],a=en(e,n,i);return this._setPosition(a),this.setFocalPoint(this.focalPoint),this.triggerUpdate(),this}},{key:"setFocalPoint",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.focalPoint[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.focalPoint[2],a=Yt(0,1,0);if(this.focalPoint=en(e,n,i),this.trackingMode===Lm.CINEMATIC){var s=Em(St(),this.focalPoint,this.position);e=s[0],n=s[1],i=s[2];var o=qr(s),l=gn(Math.asin(n/o)),c=90+gn(Math.atan2(i,e)),u=Wt();MM(u,u,Bt(c)),kM(u,u,Bt(l)),a=Qe(St(),[0,1,0],u)}return xr(this.matrix,DM(Wt(),this.position,this.focalPoint,a)),this._getAxes(),this._getDistance(),this._getAngles(),this.triggerUpdate(),this}},{key:"getDistance",value:function(){return this.distance}},{key:"getDistanceVector",value:function(){return this.distanceVector}},{key:"setDistance",value:function(e){if(this.distance===e||e<0)return this;this.distance=e,this.distance<$2&&(this.distance=$2),this.dollyingStep=this.distance/100;var n=St();e=this.distance;var i=this.forward,a=this.focalPoint;return n[0]=e*i[0]+a[0],n[1]=e*i[1]+a[1],n[2]=e*i[2]+a[2],this._setPosition(n),this.triggerUpdate(),this}},{key:"setMaxDistance",value:function(e){return this.maxDistance=e,this}},{key:"setMinDistance",value:function(e){return this.minDistance=e,this}},{key:"setAzimuth",value:function(e){return this.azimuth=bs(e),this.computeMatrix(),this._getAxes(),this.type===It.ORBITING||this.type===It.EXPLORING?this._getPosition():this.type===It.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getAzimuth",value:function(){return this.azimuth}},{key:"setElevation",value:function(e){return this.elevation=bs(e),this.computeMatrix(),this._getAxes(),this.type===It.ORBITING||this.type===It.EXPLORING?this._getPosition():this.type===It.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getElevation",value:function(){return this.elevation}},{key:"setRoll",value:function(e){return this.roll=bs(e),this.computeMatrix(),this._getAxes(),this.type===It.ORBITING||this.type===It.EXPLORING?this._getPosition():this.type===It.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getRoll",value:function(){return this.roll}},{key:"_update",value:function(){this._getAxes(),this._getPosition(),this._getDistance(),this._getAngles(),this._getOrthoMatrix(),this.triggerUpdate()}},{key:"computeMatrix",value:function(){var e=Ti(Te(),[0,0,1],Bt(this.roll));Wi(this.matrix);var n=Ti(Te(),[1,0,0],Bt((this.rotateWorld&&this.type!==It.TRACKING||this.type===It.TRACKING?1:-1)*this.elevation)),i=Ti(Te(),[0,1,0],Bt((this.rotateWorld&&this.type!==It.TRACKING||this.type===It.TRACKING?1:-1)*this.azimuth)),a=Bi(Te(),i,n);a=Bi(Te(),a,e);var s=Wy(Wt(),a);this.type===It.ORBITING||this.type===It.EXPLORING?(ys(this.matrix,this.matrix,this.focalPoint),Je(this.matrix,this.matrix,s),ys(this.matrix,this.matrix,[0,0,this.distance])):this.type===It.TRACKING&&(ys(this.matrix,this.matrix,this.position),Je(this.matrix,this.matrix,s))}},{key:"_setPosition",value:function(e,n,i){this.position=en(e,n,i);var a=this.matrix;a[12]=this.position[0],a[13]=this.position[1],a[14]=this.position[2],a[15]=1,this._getOrthoMatrix()}},{key:"_getAxes",value:function(){Er(this.right,en(Ur(_r(),[1,0,0,0],this.matrix))),Er(this.up,en(Ur(_r(),[0,1,0,0],this.matrix))),Er(this.forward,en(Ur(_r(),[0,0,1,0],this.matrix))),Ma(this.right,this.right),Ma(this.up,this.up),Ma(this.forward,this.forward)}},{key:"_getAngles",value:function(){var e=this.distanceVector[0],n=this.distanceVector[1],i=this.distanceVector[2],a=qr(this.distanceVector);if(a===0){this.elevation=0,this.azimuth=0;return}this.type===It.TRACKING?(this.elevation=gn(Math.asin(n/a)),this.azimuth=gn(Math.atan2(-e,-i))):this.rotateWorld?(this.elevation=gn(Math.asin(n/a)),this.azimuth=gn(Math.atan2(-e,-i))):(this.elevation=-gn(Math.asin(n/a)),this.azimuth=-gn(Math.atan2(-e,-i)))}},{key:"_getPosition",value:function(){Er(this.position,en(Ur(_r(),[0,0,0,1],this.matrix))),this._getDistance()}},{key:"_getFocalPoint",value:function(){TL(this.distanceVector,[0,0,-this.distance],iL(bM(),this.matrix)),Fi(this.focalPoint,this.position,this.distanceVector),this._getDistance()}},{key:"_getDistance",value:function(){this.distanceVector=Em(St(),this.focalPoint,this.position),this.distance=qr(this.distanceVector),this.dollyingStep=this.distance/100}},{key:"_getOrthoMatrix",value:function(){if(this.projectionMode===jn.ORTHOGRAPHIC){var e=this.position,n=Ti(Te(),[0,0,1],-this.roll*Math.PI/180);yo(this.orthoMatrix,n,Yt((this.rright-this.left)/2-e[0],(this.top-this.bottom)/2-e[1],0),Yt(this.zoom,this.zoom,1),e)}}},{key:"triggerUpdate",value:function(){if(this.enableUpdate){var e=this.getViewTransform(),n=Je(Wt(),this.getPerspective(),e);this.getFrustum().extractFromVPMatrix(n),this.eventEmitter.emit(rC.UPDATED)}}},{key:"rotate",value:function(e,n,i){throw new Error(Ft)}},{key:"pan",value:function(e,n){throw new Error(Ft)}},{key:"dolly",value:function(e){throw new Error(Ft)}},{key:"createLandmark",value:function(e,n){throw new Error(Ft)}},{key:"gotoLandmark",value:function(e,n){throw new Error(Ft)}},{key:"cancelLandmarkAnimation",value:function(){throw new Error(Ft)}}])}(),xD=function(r){return r[r.Standard=0]="Standard",r}({}),Jc=function(r){return r[r.ADDED=0]="ADDED",r[r.REMOVED=1]="REMOVED",r[r.Z_INDEX_CHANGED=2]="Z_INDEX_CHANGED",r}({}),aC={absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Ts(0,0,0,0)},Z=function(r){return r.COORDINATE="",r.COLOR="",r.PAINT="",r.NUMBER="",r.ANGLE="",r.OPACITY_VALUE="",r.SHADOW_BLUR="",r.LENGTH="",r.PERCENTAGE="",r.LENGTH_PERCENTAGE=" | ",r.LENGTH_PERCENTAGE_12="[ | ]{1,2}",r.LENGTH_PERCENTAGE_14="[ | ]{1,4}",r.LIST_OF_POINTS="",r.PATH="",r.FILTER="",r.Z_INDEX="",r.OFFSET_DISTANCE="",r.DEFINED_PATH="",r.MARKER="",r.TRANSFORM="",r.TRANSFORM_ORIGIN="",r.TEXT="",r.TEXT_TRANSFORM="",r}({});function Yy(r,t,e){r.prototype=t.prototype=e,e.constructor=r}function sC(r,t){var e=Object.create(r.prototype);for(var n in t)e[n]=t[n];return e}function Uo(){}var Oo=.7,Qc=1/Oo,ws="\\s*([+-]?\\d+)\\s*",Ao="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Mr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ED=/^#([0-9a-f]{3,8})$/,SD=new RegExp(`^rgb\\(${ws},${ws},${ws}\\)$`),_D=new RegExp(`^rgb\\(${Mr},${Mr},${Mr}\\)$`),kD=new RegExp(`^rgba\\(${ws},${ws},${ws},${Ao}\\)$`),MD=new RegExp(`^rgba\\(${Mr},${Mr},${Mr},${Ao}\\)$`),CD=new RegExp(`^hsl\\(${Ao},${Mr},${Mr}\\)$`),TD=new RegExp(`^hsla\\(${Ao},${Mr},${Mr},${Ao}\\)$`),j2={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};Yy(Uo,Ru,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:q2,formatHex:q2,formatHex8:OD,formatHsl:AD,formatRgb:G2,toString:G2});function q2(){return this.rgb().formatHex()}function OD(){return this.rgb().formatHex8()}function AD(){return oC(this).formatHsl()}function G2(){return this.rgb().formatRgb()}function Ru(r){var t,e;return r=(r+"").trim().toLowerCase(),(t=ED.exec(r))?(e=t[1].length,t=parseInt(t[1],16),e===6?W2(t):e===3?new bn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?kl(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?kl(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=SD.exec(r))?new bn(t[1],t[2],t[3],1):(t=_D.exec(r))?new bn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=kD.exec(r))?kl(t[1],t[2],t[3],t[4]):(t=MD.exec(r))?kl(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=CD.exec(r))?U2(t[1],t[2]/100,t[3]/100,1):(t=TD.exec(r))?U2(t[1],t[2]/100,t[3]/100,t[4]):j2.hasOwnProperty(r)?W2(j2[r]):r==="transparent"?new bn(NaN,NaN,NaN,0):null}function W2(r){return new bn(r>>16&255,r>>8&255,r&255,1)}function kl(r,t,e,n){return n<=0&&(r=t=e=NaN),new bn(r,t,e,n)}function PD(r){return r instanceof Uo||(r=Ru(r)),r?(r=r.rgb(),new bn(r.r,r.g,r.b,r.opacity)):new bn}function ND(r,t,e,n){return arguments.length===1?PD(r):new bn(r,t,e,n??1)}function bn(r,t,e,n){this.r=+r,this.g=+t,this.b=+e,this.opacity=+n}Yy(bn,ND,sC(Uo,{brighter(r){return r=r==null?Qc:Math.pow(Qc,r),new bn(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?Oo:Math.pow(Oo,r),new bn(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new bn(Ca(this.r),Ca(this.g),Ca(this.b),tu(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:V2,formatHex:V2,formatHex8:RD,formatRgb:H2,toString:H2}));function V2(){return`#${ba(this.r)}${ba(this.g)}${ba(this.b)}`}function RD(){return`#${ba(this.r)}${ba(this.g)}${ba(this.b)}${ba((isNaN(this.opacity)?1:this.opacity)*255)}`}function H2(){const r=tu(this.opacity);return`${r===1?"rgb(":"rgba("}${Ca(this.r)}, ${Ca(this.g)}, ${Ca(this.b)}${r===1?")":`, ${r})`}`}function tu(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function Ca(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function ba(r){return r=Ca(r),(r<16?"0":"")+r.toString(16)}function U2(r,t,e,n){return n<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new ar(r,t,e,n)}function oC(r){if(r instanceof ar)return new ar(r.h,r.s,r.l,r.opacity);if(r instanceof Uo||(r=Ru(r)),!r)return new ar;if(r instanceof ar)return r;r=r.rgb();var t=r.r/255,e=r.g/255,n=r.b/255,i=Math.min(t,e,n),a=Math.max(t,e,n),s=NaN,o=a-i,l=(a+i)/2;return o?(t===a?s=(e-n)/o+(e0&&l<1?0:s,new ar(s,o,l,r.opacity)}function LD(r,t,e,n){return arguments.length===1?oC(r):new ar(r,t,e,n??1)}function ar(r,t,e,n){this.h=+r,this.s=+t,this.l=+e,this.opacity=+n}Yy(ar,LD,sC(Uo,{brighter(r){return r=r==null?Qc:Math.pow(Qc,r),new ar(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?Oo:Math.pow(Oo,r),new ar(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,t=isNaN(r)||isNaN(this.s)?0:this.s,e=this.l,n=e+(e<.5?e:1-e)*t,i=2*e-n;return new bn(Rd(r>=240?r-240:r+120,i,n),Rd(r,i,n),Rd(r<120?r+240:r-120,i,n),this.opacity)},clamp(){return new ar(Y2(this.h),Ml(this.s),Ml(this.l),tu(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=tu(this.opacity);return`${r===1?"hsl(":"hsla("}${Y2(this.h)}, ${Ml(this.s)*100}%, ${Ml(this.l)*100}%${r===1?")":`, ${r})`}`}}));function Y2(r){return r=(r||0)%360,r<0?r+360:r}function Ml(r){return Math.max(0,Math.min(1,r||0))}function Rd(r,t,e){return(r<60?t+(e-t)*r/60:r<180?e:r<240?t+(e-t)*(240-r)/60:t)*255}function ke(r,t){if(typeof r!="function"||t!=null&&typeof t!="function")throw new TypeError("Expected a function");var e=function(){for(var i=arguments.length,a=new Array(i),s=0;s=Os.kUnitType&&this.getType()<=Os.kClampType}}],[{key:"isAngle",value:function(e){return e===J.kDegrees||e===J.kRadians||e===J.kGradians||e===J.kTurns}},{key:"isLength",value:function(e){return e>=J.kEms&&e1&&arguments[1]!==void 0?arguments[1]:"",n="";return Number.isFinite(t)?n="NaN":t>0?n="infinity":n="-infinity",n+=e},Im=function(t){return jD($D(t))},Ie=function(r){function t(e){var n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:J.kNumber;V(this,t),n=mt(this,t);var a;return typeof i=="string"?a=zD(i):a=i,n.unit=a,n.value=e,n}return pt(t,r),W(t,[{key:"clone",value:function(){return new t(this.value,this.unit)}},{key:"equals",value:function(n){var i=n;return this.value===i.value&&this.unit===i.unit}},{key:"getType",value:function(){return Os.kUnitType}},{key:"convertTo",value:function(n){if(this.unit===n)return new t(this.value,this.unit);var i=Im(this.unit);if(i!==Im(n)||i===J.kUnknown)return null;var a=X2(this.unit)/X2(n);return new t(this.value*a,n)}},{key:"buildCSSText",value:function(n,i,a){var s;switch(this.unit){case J.kUnknown:break;case J.kInteger:s=Number(this.value).toFixed(0);break;case J.kNumber:case J.kPercentage:case J.kEms:case J.kRems:case J.kPixels:case J.kDegrees:case J.kRadians:case J.kGradians:case J.kMilliseconds:case J.kSeconds:case J.kTurns:{var o=-999999,l=999999,c=this.value,u=Dm(this.unit);if(cl){var h=Dm(this.unit);!Number.isFinite(c)||Number.isNaN(c)?s=GD(c,h):s=c+(h||"")}else s="".concat(c).concat(u)}}return a+=s,a}}])}(Lu),nr=new Ie(0,"px");new Ie(1,"px");var Da=new Ie(0,"deg"),Xy=function(r){function t(e,n,i){var a,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return V(this,t),a=mt(this,t,["rgb"]),a.r=e,a.g=n,a.b=i,a.alpha=s,a.isNone=o,a}return pt(t,r),W(t,[{key:"clone",value:function(){return new t(this.r,this.g,this.b,this.alpha)}},{key:"buildCSSText",value:function(n,i,a){return"".concat(a,"rgba(").concat(this.r,",").concat(this.g,",").concat(this.b,",").concat(this.alpha,")")}}])}(qD),K2=new Yn("unset"),WD=new Yn("initial"),VD=new Yn("inherit"),Ld={"":K2,unset:K2,initial:WD,inherit:VD},HD=function(t){return Ld[t]||(Ld[t]=new Yn(t)),Ld[t]},lC=new Xy(0,0,0,0,!0),cC=new Xy(0,0,0,0),UD=ke(function(r,t,e,n){return new Xy(r,t,e,n)},function(r,t,e,n){return"rgba(".concat(r,",").concat(t,",").concat(e,",").concat(n,")")}),ne=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:J.kNumber;return new Ie(t,e)};new Ie(50,"%");function YD(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 XD=function(){var r={linearGradient:/^(linear\-gradient)/i,repeatingLinearGradient:/^(repeating\-linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,repeatingRadialGradient:/^(repeating\-radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},t="";function e(P){throw new Error("".concat(t,": ").concat(P))}function n(){var P=i();return t.length>0&&e("Invalid input not EOF"),P}function i(){return b(a)}function a(){return s("linear-gradient",r.linearGradient,l)||s("repeating-linear-gradient",r.repeatingLinearGradient,l)||s("radial-gradient",r.radialGradient,h)||s("repeating-radial-gradient",r.repeatingRadialGradient,h)||s("conic-gradient",r.conicGradient,h)}function s(P,A,I){return o(A,function(B){var j=I();return j&&(L(r.comma)||e("Missing comma before color stops")),{type:P,orientation:j,colorStops:b(w)}})}function o(P,A){var I=L(P);if(I){L(r.startCall)||e("Missing (");var B=A(I);return L(r.endCall)||e("Missing )"),B}}function l(){return c()||u()}function c(){return R("directional",r.sideOrCorner,1)}function u(){return R("angular",r.angleValue,1)}function h(){var P,A=d(),I;return A&&(P=[],P.push(A),I=t,L(r.comma)&&(A=d(),A?P.push(A):t=I)),P}function d(){var P=f()||g();if(P)P.at=p();else{var A=v();if(A){P=A;var I=p();I&&(P.at=I)}else{var B=m();B&&(P={type:"default-radial",at:B})}}return P}function f(){var P=R("shape",/^(circle)/i,0);return P&&(P.style=O()||v()),P}function g(){var P=R("shape",/^(ellipse)/i,0);return P&&(P.style=M()||v()),P}function v(){return R("extent-keyword",r.extentKeywords,1)}function p(){if(R("position",/^at/,0)){var P=m();return P||e("Missing positioning value"),P}}function m(){var P=y();if(P.x||P.y)return{type:"position",value:P}}function y(){return{x:M(),y:M()}}function b(P){var A=P(),I=[];if(A)for(I.push(A);L(r.comma);)A=P(),A?I.push(A):e("One extra comma");return I}function w(){var P=x();return P||e("Expected color definition"),P.length=M(),P}function x(){return E()||C()||_()||S()}function S(){return R("literal",r.literalColor,0)}function E(){return R("hex",r.hexColor,1)}function _(){return o(r.rgbColor,function(){return{type:"rgb",value:b(k)}})}function C(){return o(r.rgbaColor,function(){return{type:"rgba",value:b(k)}})}function k(){return L(r.number)[1]}function M(){return R("%",r.percentageValue,1)||T()||O()}function T(){return R("position-keyword",r.positionKeywords,1)}function O(){return R("px",r.pixelValue,1)||R("em",r.emValue,1)}function R(P,A,I){var B=L(A);if(B)return{type:P,value:B[I]}}function L(P){var A=/^[\n\r\t\s]+/.exec(t);A&&D(A[0].length);var I=P.exec(t);return I&&D(I[0].length),I}function D(P){t=t.substring(P)}return function(P){return t=P,n()}}();function KD(r,t,e,n){var i=Bt(n.value),a=0,s=0,o=a+t/2,l=s+e/2,c=Math.abs(t*Math.cos(i))+Math.abs(e*Math.sin(i)),u=r[0]+o-Math.cos(i)*c/2,h=r[1]+l-Math.sin(i)*c/2,d=r[0]+o+Math.cos(i)*c/2,f=r[1]+l+Math.sin(i)*c/2;return{x1:u,y1:h,x2:d,y2:f}}function ZD(r,t,e,n,i,a){var s=n.value,o=i.value;n.unit===J.kPercentage&&(s=n.value/100*t),i.unit===J.kPercentage&&(o=i.value/100*e);var l=Math.max(fn([0,0],[s,o]),fn([0,e],[s,o]),fn([t,e],[s,o]),fn([t,0],[s,o]));return a&&(a instanceof Ie?l=a.value:a instanceof Yn&&(a.value==="closest-side"?l=Math.min(s,t-s,o,e-o):a.value==="farthest-side"?l=Math.max(s,t-s,o,e-o):a.value==="closest-corner"&&(l=Math.min(fn([0,0],[s,o]),fn([0,e],[s,o]),fn([t,e],[s,o]),fn([t,0],[s,o]))))),{x:s+r[0],y:o+r[1],r:l}}var JD=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,QD=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,t5=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,uC=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function e5(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-1||r.indexOf("radial")>-1){var t=XD(r);return t.map(function(o){var l=o.type,c=o.orientation,u=o.colorStops;e5(u);var h=u.map(function(b){return{offset:ne(Number(b.length.value),"%"),color:YD(b)}});if(l==="linear-gradient")return new Cl(Oi.LinearGradient,{angle:c?r5(c):Da,steps:h});if(l==="radial-gradient"&&(c||(c=[{type:"shape",value:"circle"}]),c[0].type==="shape"&&c[0].value==="circle")){var d=i5(c[0].at),f=d.cx,g=d.cy,v;if(c[0].style){var p=c[0].style,m=p.type,y=p.value;m==="extent-keyword"?v=HD(y):v=ne(y,m)}return new Cl(Oi.RadialGradient,{cx:f,cy:g,size:v,steps:h})}})}var e=r[0];if(r[1]==="("||r[2]==="("){if(e==="l"){var n=JD.exec(r);if(n){var i,a=((i=n[2].match(uC))===null||i===void 0?void 0:i.map(function(o){return o.split(":")}))||[];return[new Cl(Oi.LinearGradient,{angle:ne(parseFloat(n[1]),"deg"),steps:a.map(function(o){var l=dt(o,2),c=l[0],u=l[1];return{offset:ne(Number(c)*100,"%"),color:u}})})]}}else if(e==="r"){var s=s5(r);if(s)if(Tt(s))r=s;else return[new Cl(Oi.RadialGradient,s)]}else if(e==="p")return o5(r)}});function s5(r){var t=QD.exec(r);if(t){var e,n=((e=t[4].match(uC))===null||e===void 0?void 0:e.map(function(i){return i.split(":")}))||[];return{cx:ne(50,"%"),cy:ne(50,"%"),steps:n.map(function(i){var a=dt(i,2),s=a[0],o=a[1];return{offset:ne(Number(s)*100,"%"),color:o}})}}return null}function o5(r){var t=t5.exec(r);if(t){var e=t[1],n=t[2];switch(e){case"a":e="repeat";break;case"x":e="repeat-x";break;case"y":e="repeat-y";break;case"n":e="no-repeat";break;default:e="no-repeat"}return{image:n,repetition:e}}return null}function Ia(r){return r&&!!r.image}function eu(r){return r&&!ot(r.r)&&!ot(r.g)&&!ot(r.b)}var xo=ke(function(r){if(Ia(r))return vt({repetition:"repeat"},r);if(ot(r)&&(r=""),r==="transparent")return cC;if(r==="currentColor")r="black";else if(r==="none")return lC;var t=a5(r);if(t)return t;var e=Ru(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),UD.apply(void 0,n)});function l5(r,t){if(!(!eu(r)||!eu(t)))return[[Number(r.r),Number(r.g),Number(r.b),Number(r.alpha)],[Number(t.r),Number(t.g),Number(t.b),Number(t.alpha)],function(e){var n=e.slice();if(n[3])for(var i=0;i<3;i++)n[i]=Math.round(ce(n[i],0,255));return n[3]=ce(n[3],0,1),"rgba(".concat(n.join(","),")")}]}function Yo(r,t){if(ot(t))return ne(0,"px");if(t="".concat(t).trim().toLowerCase(),isFinite(Number(t))){if("px".search(r)>=0)return ne(Number(t),"px");if("deg".search(r)>=0)return ne(Number(t),"deg")}var e=[];t=t.replace(r,function(i){return e.push(i),"U".concat(i)});var n="U(".concat(r.source,")");return e.map(function(i){return ne(Number(t.replace(new RegExp("U".concat(i),"g"),"").replace(new RegExp(n,"g"),"*0")),i)})[0]}var hC=function(t){return Yo(new RegExp("px","g"),t)},c5=ke(hC),u5=function(t){return Yo(new RegExp("%","g"),t)};ke(u5);var dC=function(t){return nt(t)||isFinite(Number(t))?ne(Number(t)||0,"px"):Yo(new RegExp("px|%|em|rem","g"),t)},Fm=ke(dC),fC=function(t){return Yo(new RegExp("deg|rad|grad|turn","g"),t)},h5=ke(fC);function d5(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=Im(r.unit),c=r.convertTo(l),u=t.convertTo(l);return c&&u?(s=c.value,o=u.value,a=Dm(r.unit)):(Ie.isLength(r.unit)||Ie.isLength(t.unit))&&(s=_n(r,i,e),o=_n(t,i,e),a="px"),[s,o,function(h){return h+a}]}function vn(r){var t=0;return r.unit===J.kDegrees?t=r.value:r.unit===J.kRadians?t=gn(Number(r.value)):r.unit===J.kTurns?t=fD(Number(r.value)):r.value&&(t=r.value),t}function Z2(r,t){var e;return Array.isArray(r)?e=r.map(function(n){return Number(n)}):Tt(r)?e=r.split(" ").map(function(n){return Number(n)}):nt(r)&&(e=[r]),t===2?e.length===1?[e[0],e[0]]:[e[0],e[1]]:t===4?e.length===1?[e[0],e[0],e[0],e[0]]:e.length===2?[e[0],e[1],e[0],e[1]]:e.length===3?[e[0],e[1],e[2],e[1]]:[e[0],e[1],e[2],e[3]]:t==="even"&&e.length%2===1?[].concat(Ut(e),Ut(e)):e}function _n(r,t,e){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r.unit===J.kPixels)return Number(r.value);if(r.unit===J.kPercentage&&e){var i=e.nodeName===$.GROUP?e.getLocalBounds():e.getGeometryBounds();return(n?i.min[t]:0)+r.value/100*i.halfExtents[t]*2}return 0}var f5=function(t){return Yo(/deg|rad|grad|turn|px|%/g,t)},g5=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function v5(){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,g5.indexOf(n[1])>-1&&e.push({name:n[1],params:n[2].split(" ").map(function(a){return f5(a)||xo(a)})}),t.lastIndex===r.length)return e}return[]}function gC(r){return r.toString()}var vC=function(t){return typeof t=="number"?ne(t):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?ne(Number(t)):ne(0)},Bm=ke(vC);ke(function(r){return Tt(r)?r.split(" ").map(Bm):r.map(Bm)});function Ky(r,t){return[r,t,gC]}function Zy(r,t){return function(e,n){return[e,n,function(i){return gC(ce(i,r,t))}]}}function pC(r,t){if(r.length===t.length)return[r,t,function(e){return e}]}function zm(r){return r.parsedStyle.d.totalLength===0&&(r.parsedStyle.d.totalLength=L6(r.parsedStyle.d.absolutePath)),r.parsedStyle.d.totalLength}function p5(r){return r.parsedStyle.points.totalLength===0&&(r.parsedStyle.points.totalLength=J6(r.parsedStyle.points.points)),r.parsedStyle.points.totalLength}function m5(r){for(var t=0;t0&&e.push(n),{polygons:t,polylines:e}}function nu(r,t){return r[0]===t[0]&&r[1]===t[1]}function w5(r,t){for(var e=[],n=[],i=[],a=0;aMath.PI/2?Math.PI-c:c,u=u>Math.PI/2?Math.PI-u:u;var h={xExtra:Math.cos(l/2-c)*(t/2*(1/Math.sin(l/2)))-t/2||0,yExtra:Math.cos(u-l/2)*(t/2*(1/Math.sin(l/2)))-t/2||0};return h}function J2(r,t){return[t[0]+(t[0]-r[0]),t[1]+(t[1]-r[1])]}var Q2=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},tb=function(t,e,n,i,a,s,o,l){e=Math.abs(e),n=Math.abs(n),i=jM(i,360);var c=Bt(i);if(t.x===o.x&&t.y===o.y)return{x:t.x,y:t.y,ellipticalArcAngle:0};if(e===0||n===0)return{x:0,y:0,ellipticalArcAngle:0};var u=(t.x-o.x)/2,h=(t.y-o.y)/2,d={x:Math.cos(c)*u+Math.sin(c)*h,y:-Math.sin(c)*u+Math.cos(c)*h},f=Math.pow(d.x,2)/Math.pow(e,2)+Math.pow(d.y,2)/Math.pow(n,2);f>1&&(e*=Math.sqrt(f),n*=Math.sqrt(f));var g=Math.pow(e,2)*Math.pow(n,2)-Math.pow(e,2)*Math.pow(d.y,2)-Math.pow(n,2)*Math.pow(d.x,2),v=Math.pow(e,2)*Math.pow(d.y,2)+Math.pow(n,2)*Math.pow(d.x,2),p=g/v;p=p<0?0:p;var m=(a!==s?1:-1)*Math.sqrt(p),y={x:m*(e*d.y/n),y:m*(-(n*d.x)/e)},b={x:Math.cos(c)*y.x-Math.sin(c)*y.y+(t.x+o.x)/2,y:Math.sin(c)*y.x+Math.cos(c)*y.y+(t.y+o.y)/2},w={x:(d.x-y.x)/e,y:(d.y-y.y)/n},x=Q2({x:1,y:0},w),S={x:(-d.x-y.x)/e,y:(-d.y-y.y)/n},E=Q2(w,S);!s&&E>0?E-=2*Math.PI:s&&E<0&&(E+=2*Math.PI),E%=2*Math.PI;var _=x+E*l,C=e*Math.cos(_),k=n*Math.sin(_),M={x:Math.cos(c)*C-Math.sin(c)*k+b.x,y:Math.sin(c)*C+Math.cos(c)*k+b.y,ellipticalArcStartAngle:x,ellipticalArcEndAngle:x+E,ellipticalArcAngle:_,ellipticalArcCenter:b,resultantRx:e,resultantRy:n};return M};function x5(r){for(var t=[],e=null,n=null,i=null,a=0,s=r.length,o=0;o2&&arguments[2]!==void 0?arguments[2]:!0,n=r.arcParams,i=n.rx,a=i===void 0?0:i,s=n.ry,o=s===void 0?0:s,l=n.xRotation,c=n.arcFlag,u=n.sweepFlag,h=tb({x:r.prePoint[0],y:r.prePoint[1]},a,o,l,!!c,!!u,{x:r.currentPoint[0],y:r.currentPoint[1]},t),d=tb({x:r.prePoint[0],y:r.prePoint[1]},a,o,l,!!c,!!u,{x:r.currentPoint[0],y:r.currentPoint[1]},e?t+.005:t-.005),f=d.x-h.x,g=d.y-h.y,v=Math.sqrt(f*f+g*g);return{x:-f/v,y:-g/v}}function Ol(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function $m(r,t){return Ol(r)*Ol(t)?(r[0]*t[0]+r[1]*t[1])/(Ol(r)*Ol(t)):1}function nb(r,t){return(r[0]*t[1]1&&(e*=Math.sqrt(f),n*=Math.sqrt(f));var g=e*e*(d*d)+n*n*(h*h),v=g?Math.sqrt((e*e*(n*n)-g)/g):1;a===s&&(v*=-1),isNaN(v)&&(v=0);var p=n?v*e*d/n:0,m=e?v*-n*h/e:0,y=(o+c)/2+Math.cos(i)*p-Math.sin(i)*m,b=(l+u)/2+Math.sin(i)*p+Math.cos(i)*m,w=[(h-p)/e,(d-m)/n],x=[(-1*h-p)/e,(-1*d-m)/n],S=nb([1,0],w),E=nb(w,x);return $m(w,x)<=-1&&(E=Math.PI),$m(w,x)>=1&&(E=0),s===0&&E>0&&(E-=2*Math.PI),s===1&&E<0&&(E+=2*Math.PI),{cx:y,cy:b,rx:nu(r,[c,u])?0:e,ry:nu(r,[c,u])?0:n,startAngle:S,endAngle:S+E,xRotation:i,arcFlag:a,sweepFlag:s}}var mC=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=Kc(t)}catch{e=Kc(""),console.error("[g]: Invalid SVG Path definition: ".concat(t))}m5(e);var n=y5(e),i=b5(e),a=i.polygons,s=i.polylines,o=x5(e),l=w5(o,0),c=l.x,u=l.y,h=l.width,d=l.height;return{absolutePath:e,hasArc:n,segments:o,polygons:a,polylines:s,totalLength:0,rect:{x:Number.isFinite(c)?c:0,y:Number.isFinite(u)?u:0,width:Number.isFinite(h)?h:0,height:Number.isFinite(d)?d:0}}},S5=ke(mC);function yC(r){return Tt(r)?S5(r):mC(r)}function _5(r,t,e){var n=r.curve,i=t.curve;(!n||n.length===0)&&(n=Tm(r.absolutePath,!1),r.curve=n),(!i||i.length===0)&&(i=Tm(t.absolutePath,!1),t.curve=i);var a=[n,i];n.length!==i.length&&(a=ZM(n,i));var s=P2(a[0])!==P2(a[1])?T6(a[0]):C6(a[0]);return[s,I6(a[1],s),function(o){return o}]}function k5(r,t){var e;return Tt(r)?e=r.split(" ").map(function(n){var i=n.split(","),a=dt(i,2),s=a[0],o=a[1];return[Number(s),Number(o)]}):e=r,{points:e,totalLength:0,segments:[]}}function M5(r,t){return[r.points,t.points,function(e){return e}]}var oe=null,xs=/\s*(\w+)\(([^)]*)\)/g;function un(r){return function(t){var e=0;return r.map(function(n){return n===oe?t[e++]:n})}}function ua(r){return r}var Po={matrix:["NNNNNN",[oe,oe,0,0,oe,oe,0,0,0,0,1,0,oe,oe,0,1],ua],matrix3d:["NNNNNNNNNNNNNNNN",ua],rotate:["A"],rotateX:["A"],rotateY:["A"],rotateZ:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",un([oe,oe,new Ie(1)]),ua],scaleX:["N",un([oe,new Ie(1),new Ie(1)]),un([oe,new Ie(1)])],scaleY:["N",un([new Ie(1),oe,new Ie(1)]),un([new Ie(1),oe])],scaleZ:["N",un([new Ie(1),new Ie(1),oe])],scale3d:["NNN",ua],skew:["Aa",null,ua],skewX:["A",null,un([oe,Da])],skewY:["A",null,un([Da,oe])],translate:["Tt",un([oe,oe,nr]),ua],translateX:["T",un([oe,nr,nr]),un([oe,nr])],translateY:["T",un([nr,oe,nr]),un([nr,oe])],translateZ:["L",un([nr,nr,oe])],translate3d:["TTL",ua]};function bC(r){for(var t=[],e=r.length,n=0;n2&&arguments[2]!==void 0?arguments[2]:{forceUpdateGeometry:!1};Object.assign(e.attributes,n);var a=e.parsedStyle.clipPath,s=e.parsedStyle.offsetPath;$5(e,n);var o=!!i.forceUpdateGeometry;if(!o){for(var l in n)if(B5.has(l)){o=!0;break}}var c=EC(e);c.has("fill")&&n.fill&&(e.parsedStyle.fill=xo(n.fill)),c.has("stroke")&&n.stroke&&(e.parsedStyle.stroke=xo(n.stroke)),c.has("shadowColor")&&n.shadowColor&&(e.parsedStyle.shadowColor=xo(n.shadowColor)),c.has("filter")&&n.filter&&(e.parsedStyle.filter=v5(n.filter)),c.has("radius")&&!ot(n.radius)&&(e.parsedStyle.radius=Z2(n.radius,4)),c.has("lineDash")&&!ot(n.lineDash)&&(e.parsedStyle.lineDash=Z2(n.lineDash,"even")),c.has("points")&&n.points&&(e.parsedStyle.points=k5(n.points)),c.has("d")&&n.d===""&&(e.parsedStyle.d=vt({},aC)),c.has("d")&&n.d&&(e.parsedStyle.d=yC(n.d)),c.has("textTransform")&&n.textTransform&&this.runtime.CSSPropertySyntaxFactory[Z.TEXT_TRANSFORM].calculator(null,null,{value:n.textTransform},e,null),c.has("clipPath")&&!ut(n.clipPath)&&this.runtime.CSSPropertySyntaxFactory[Z.DEFINED_PATH].calculator("clipPath",a,n.clipPath,e,this.runtime),c.has("offsetPath")&&n.offsetPath&&this.runtime.CSSPropertySyntaxFactory[Z.DEFINED_PATH].calculator("offsetPath",s,n.offsetPath,e,this.runtime),c.has("transform")&&n.transform&&(e.parsedStyle.transform=wC(n.transform)),c.has("transformOrigin")&&n.transformOrigin&&(e.parsedStyle.transformOrigin=F5(n.transformOrigin)),c.has("markerStart")&&n.markerStart&&(e.parsedStyle.markerStart=this.runtime.CSSPropertySyntaxFactory[Z.MARKER].calculator(null,n.markerStart,n.markerStart,null,null)),c.has("markerEnd")&&n.markerEnd&&(e.parsedStyle.markerEnd=this.runtime.CSSPropertySyntaxFactory[Z.MARKER].calculator(null,n.markerEnd,n.markerEnd,null,null)),c.has("markerMid")&&n.markerMid&&(e.parsedStyle.markerMid=this.runtime.CSSPropertySyntaxFactory[Z.MARKER].calculator("",n.markerMid,n.markerMid,null,null)),c.has("zIndex")&&!ot(n.zIndex)&&this.runtime.CSSPropertySyntaxFactory[Z.Z_INDEX].postProcessor(e),c.has("offsetDistance")&&!ot(n.offsetDistance)&&this.runtime.CSSPropertySyntaxFactory[Z.OFFSET_DISTANCE].postProcessor(e),c.has("transform")&&n.transform&&this.runtime.CSSPropertySyntaxFactory[Z.TRANSFORM].postProcessor(e),c.has("transformOrigin")&&n.transformOrigin&&this.runtime.CSSPropertySyntaxFactory[Z.TRANSFORM_ORIGIN].postProcessor(e),o&&(e.geometry.dirty=!0,e.renderable.boundsDirty=!0,e.renderable.renderBoundsDirty=!0,i.forceUpdateGeometry||this.runtime.sceneGraphService.dirtifyToRoot(e))}},{key:"updateGeometry",value:function(e){var n=e.nodeName,i=this.runtime.geometryUpdaterFactory[n];if(i){var a=e.geometry;a.contentBounds||(a.contentBounds=new Vt),a.renderBounds||(a.renderBounds=new Vt);var s=e.parsedStyle,o=i.update(s,e),l=o.cx,c=l===void 0?0:l,u=o.cy,h=u===void 0?0:u,d=o.cz,f=d===void 0?0:d,g=o.hwidth,v=g===void 0?0:g,p=o.hheight,m=p===void 0?0:p,y=o.hdepth,b=y===void 0?0:y,w=[Math.abs(v),Math.abs(m),b],x=s.stroke,S=s.lineWidth,E=S===void 0?1:S,_=s.increasedLineWidthForHitTesting,C=_===void 0?0:_,k=s.shadowType,M=k===void 0?"outer":k,T=s.shadowColor,O=s.filter,R=O===void 0?[]:O,L=s.transformOrigin,D=[c,h,f];a.contentBounds.update(D,w);var P=n===$.POLYLINE||n===$.POLYGON||n===$.PATH?Math.SQRT2:.5,A=x&&!x.isNone;if(A){var I=((E||0)+(C||0))*P;w[0]+=I,w[1]+=I}if(a.renderBounds.update(D,w),T&&M&&M!=="inner"){var B=a.renderBounds,j=B.min,G=B.max,H=s.shadowBlur,Y=s.shadowOffsetX,K=s.shadowOffsetY,tt=H||0,it=Y||0,_t=K||0,Mt=j[0]-tt+it,re=G[0]+tt+it,Re=j[1]-tt+_t,Le=G[1]+tt+_t;j[0]=Math.min(j[0],Mt),G[0]=Math.max(G[0],re),j[1]=Math.min(j[1],Re),G[1]=Math.max(G[1],Le),a.renderBounds.setMinMax(j,G)}R.forEach(function(Nt){var Ir=Nt.name,Jn=Nt.params;if(Ir==="blur"){var vl=Jn[0].value;a.renderBounds.update(a.renderBounds.center,Fi(a.renderBounds.halfExtents,a.renderBounds.halfExtents,[vl,vl,0]))}else if(Ir==="drop-shadow"){var oa=Jn[0].value,Qn=Jn[1].value,Ce=Jn[2].value,la=a.renderBounds,In=la.min,Fr=la.max,pl=In[0]-Ce+oa,fi=Fr[0]+Ce+oa,ml=In[1]-Ce+Qn,yl=Fr[1]+Ce+Qn;In[0]=Math.min(In[0],pl),Fr[0]=Math.max(Fr[0],fi),In[1]=Math.min(In[1],ml),Fr[1]=Math.max(Fr[1],yl),a.renderBounds.setMinMax(In,Fr)}}),e.geometry.dirty=!1;var cn=v<0,sa=m<0,Pt=(cn?-1:1)*(L?_n(L[0],0,e,!0):0),Dr=(sa?-1:1)*(L?_n(L[1],1,e,!0):0);(Pt||Dr)&&e.setOrigin(Pt,Dr)}}},{key:"updateSizeAttenuation",value:function(e,n){e.style.isSizeAttenuation?(e.style.rawLineWidth||(e.style.rawLineWidth=e.style.lineWidth),e.style.lineWidth=(e.style.rawLineWidth||1)/n,e.nodeName===$.CIRCLE&&(e.style.rawR||(e.style.rawR=e.style.r),e.style.r=(e.style.rawR||1)/n)):(e.style.rawLineWidth&&(e.style.lineWidth=e.style.rawLineWidth,delete e.style.rawLineWidth),e.nodeName===$.CIRCLE&&e.style.rawR&&(e.style.r=e.style.rawR,delete e.style.rawR))}}])}();function $5(r,t){var e=EC(r);for(var n in t)e.has(n)&&(r.parsedStyle[n]=t[n])}function EC(r){return r.constructor.PARSED_STYLE_LIST}var j5=function(){function r(){V(this,r),this.mixer=Ky}return W(r,[{key:"calculator",value:function(e,n,i,a){return vn(i)}}])}(),q5=function(){function r(){V(this,r)}return W(r,[{key:"calculator",value:function(e,n,i,a,s){return i instanceof Yn&&(i=null),s.sceneGraphService.updateDisplayObjectDependency(e,n,i,a),e==="clipPath"&&a.forEach(function(o){o.childNodes.length===0&&s.sceneGraphService.dirtifyToRoot(o)}),i}}])}(),G5=function(){function r(){V(this,r),this.parser=xo,this.mixer=l5}return W(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof Yn?i.value==="none"?lC:cC:i}}])}(),W5=function(){function r(){V(this,r)}return W(r,[{key:"calculator",value:function(e,n,i){return i instanceof Yn?[]:i}}])}();function ab(r){var t=r.parsedStyle,e=t.fontSize;return ot(e)?null:e}var jm=function(){function r(){V(this,r),this.mixer=Ky}return W(r,[{key:"calculator",value:function(e,n,i,a,s){if(nt(i))return i;if(Ie.isRelativeUnit(i.unit)){if(i.unit===J.kPercentage)return 0;if(i.unit===J.kEms){if(a.parentNode){var o=ab(a.parentNode);if(o)return o*=i.value,o}return 0}if(i.unit===J.kRems){var l;if(a!=null&&(l=a.ownerDocument)!==null&&l!==void 0&&l.documentElement){var c=ab(a.ownerDocument.documentElement);if(c)return c*=i.value,c}return 0}}else return i.value}}])}(),V5=function(){function r(){V(this,r),this.mixer=pC}return W(r,[{key:"calculator",value:function(e,n,i){return i.map(function(a){return a.value})}}])}(),H5=function(){function r(){V(this,r),this.mixer=pC}return W(r,[{key:"calculator",value:function(e,n,i){return i.map(function(a){return a.value})}}])}(),U5=function(){function r(){V(this,r)}return W(r,[{key:"calculator",value:function(e,n,i,a){var s;i instanceof Yn&&(i=null);var o=(s=i)===null||s===void 0?void 0:s.cloneNode(!0);return o&&(o.style.isMarker=!0),o}}])}(),Y5=function(){function r(){V(this,r),this.mixer=Ky}return W(r,[{key:"calculator",value:function(e,n,i){return i.value}}])}(),X5=function(){function r(){V(this,r),this.mixer=Zy(0,1)}return W(r,[{key:"calculator",value:function(e,n,i){return i.value}},{key:"postProcessor",value:function(e){var n=e.parsedStyle,i=n.offsetPath,a=n.offsetDistance;if(i){var s=i.nodeName;if(s===$.LINE||s===$.PATH||s===$.POLYLINE){var o=i.getPoint(a);o&&e.setLocalPosition(o.x,o.y)}}}}])}(),K5=function(){function r(){V(this,r),this.mixer=Zy(0,1)}return W(r,[{key:"calculator",value:function(e,n,i){return i.value}}])}(),Z5=function(){function r(){V(this,r),this.parser=yC,this.mixer=_5}return W(r,[{key:"calculator",value:function(e,n,i){return i instanceof Yn&&i.value==="unset"?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new Ts(0,0,0,0)}:i}}])}(),J5=W(function r(){V(this,r),this.mixer=M5}),Q5=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a>>1;SC(r[i],t)<0?e=i+1:n=i}return e}function SC(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 _C(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 sb="px";function aI(r,t,e){Qy&&r.style&&(r.style.width=t+sb,r.style.height=e+sb)}function kC(r,t){if(Qy)return document.defaultView.getComputedStyle(r,null).getPropertyValue(t)}function sI(r){var t=kC(r,"width");return t==="auto"?r.offsetWidth:parseFloat(t)}function oI(r){var t=kC(r,"height");return t==="auto"?r.offsetHeight:parseFloat(t)}var lI=1,cI={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},qm=typeof performance=="object"&&performance.now?performance:Date;function ru(r){return r.nodeName===$.FRAGMENT?!0:r.getRootNode().nodeName===$.FRAGMENT}function Ga(){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 uI=1,hI=function(){return uI++},Cr=typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:{},dI=Date.now(),fI=function(){return Cr.performance&&typeof Cr.performance.now=="function"?Cr.performance.now():Date.now()-dI},ro={},ob=Date.now(),gI=function(t){if(typeof t!="function")throw new TypeError("".concat(t," is not a function"));var e=Date.now(),n=e-ob,i=n>16?0:16-n,a=hI();return ro[a]=t,Object.keys(ro).length>1||setTimeout(function(){ob=e;var s=ro;ro={},Object.keys(s).forEach(function(o){return s[o](fI())})},i),a},vI=function(t){delete ro[t]},pI=["","webkit","moz","ms","o"],MC=function(t){return typeof t!="string"?gI:t===""?Cr.requestAnimationFrame:Cr["".concat(t,"RequestAnimationFrame")]},mI=function(t){return typeof t!="string"?vI:t===""?Cr.cancelAnimationFrame:Cr["".concat(t,"CancelAnimationFrame")]||Cr["".concat(t,"CancelRequestAnimationFrame")]},yI=function(t,e){for(var n=0;t[n]!==void 0;){if(e(t[n]))return t[n];n+=1}},CC=yI(pI,function(r){return!!MC(r)}),t1=MC(CC),TC=mI(CC);Cr.requestAnimationFrame=t1;Cr.cancelAnimationFrame=TC;var bI=function(){function r(){V(this,r),this.callbacks=[]}return W(r,[{key:"getCallbacksNum",value:function(){return this.callbacks.length}},{key:"tapPromise",value:function(e,n){this.callbacks.push(n)}},{key:"promise",value:function(){for(var e=arguments.length,n=new Array(e),i=0;i=0;f--){var g=d[f].trim();!EI.test(g)&&xI.indexOf(g)<0&&(g='"'.concat(g,'"')),d[f]=g}return"".concat(s," ").concat(l," ").concat(u," ").concat(h," ").concat(d.join(","))}function $d(r,t,e){return Wi(r),r[4]=Math.tan(t),r[1]=Math.tan(e),r}var pe=Wt(),_I=Wt(),kI={scale:function(t){pa(pe,[t[0].value,t[1].value,1])},scaleX:function(t){pa(pe,[t[0].value,1,1])},scaleY:function(t){pa(pe,[1,t[0].value,1])},scaleZ:function(t){pa(pe,[1,1,t[0].value])},scale3d:function(t){pa(pe,[t[0].value,t[1].value,t[2].value])},translate:function(t){ki(pe,[t[0].value,t[1].value,0])},translateX:function(t){ki(pe,[t[0].value,0,0])},translateY:function(t){ki(pe,[0,t[0].value,0])},translateZ:function(t){ki(pe,[0,0,t[0].value])},translate3d:function(t){ki(pe,[t[0].value,t[1].value,t[2].value])},rotate:function(t){wm(pe,Bt(vn(t[0])))},rotateX:function(t){TM(pe,Bt(vn(t[0])))},rotateY:function(t){OM(pe,Bt(vn(t[0])))},rotateZ:function(t){wm(pe,Bt(vn(t[0])))},rotate3d:function(t){CM(pe,Bt(vn(t[3])),[t[0].value,t[1].value,t[2].value])},skew:function(t){$d(pe,Bt(t[0].value),Bt(t[1].value))},skewX:function(t){$d(pe,Bt(t[0].value),0)},skewY:function(t){$d(pe,0,Bt(t[0].value))},matrix:function(t){bm(pe,t[0].value,t[1].value,0,0,t[2].value,t[3].value,0,0,0,0,1,0,t[4].value,t[5].value,0,1)},matrix3d:function(t){bm.apply(SL,[pe].concat(Ut(t.map(function(e){return e.value}))))}},MI=Yt(1,1,1),CI=St(),lb={translate:function(t,e){U.sceneGraphService.setLocalScale(t,MI,!1),U.sceneGraphService.setLocalEulerAngles(t,CI,void 0,void 0,!1),U.sceneGraphService.setLocalPosition(t,[e[0].value,e[1].value,0],!1),U.sceneGraphService.dirtifyLocal(t,t.transformable)}};function OC(r,t){if(r.length){if(r.length===1&&lb[r[0].t]){lb[r[0].t](t,r[0].d);return}for(var e=Wi(_I),n=0;n1&&arguments[1]!==void 0?arguments[1]:!1,i=cb.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&&cb.set(this,i)}if(i){if(e.manager=i.getEventService(),!e.manager)return!1;e.defaultPrevented=!1,e.path?e.path.length=0:e.page=[],n||(e.target=this),e.manager.dispatchEvent(e,e.type,n)}else this.emitter.emit(e.type,e);return!e.defaultPrevented}}])}(),ie=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a0&&arguments[0]!==void 0?arguments[0]:{};return this.parentNode?this.parentNode.getRootNode(n):n.composed&&this.host?this.host.getRootNode(n):this}},{key:"hasChildNodes",value:function(){return this.childNodes.length>0}},{key:"isDefaultNamespace",value:function(n){throw new Error(Ft)}},{key:"lookupNamespaceURI",value:function(n){throw new Error(Ft)}},{key:"lookupPrefix",value:function(n){throw new Error(Ft)}},{key:"normalize",value:function(){throw new Error(Ft)}},{key:"isEqualNode",value:function(n){return this===n}},{key:"isSameNode",value:function(n){return this.isEqualNode(n)}},{key:"parent",get:function(){return this.parentNode}},{key:"parentElement",get:function(){return null}},{key:"nextSibling",get:function(){return null}},{key:"previousSibling",get:function(){return null}},{key:"firstChild",get:function(){return this.childNodes.length>0?this.childNodes[0]:null}},{key:"lastChild",get:function(){return this.childNodes.length>0?this.childNodes[this.childNodes.length-1]:null}},{key:"compareDocumentPosition",value:function(n){if(n===this)return 0;for(var i=n,a=this,s=[i],o=[a];(l=i.parentNode)!==null&&l!==void 0?l:a.parentNode;){var l;i=i.parentNode?(s.push(i.parentNode),i.parentNode):i,a=a.parentNode?(o.push(a.parentNode),a.parentNode):a}if(i!==a)return t.DOCUMENT_POSITION_DISCONNECTED|t.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|t.DOCUMENT_POSITION_PRECEDING;var c=s.length>o.length?s:o,u=c===s?o:s;if(c[c.length-u.length]===u[0])return c===s?t.DOCUMENT_POSITION_CONTAINED_BY|t.DOCUMENT_POSITION_FOLLOWING:t.DOCUMENT_POSITION_CONTAINS|t.DOCUMENT_POSITION_PRECEDING;for(var h=c.length-u.length,d=u.length-1;d>=0;d--){var f=u[d],g=c[h+d];if(g!==f){var v=f.parentNode.childNodes;return v.indexOf(f)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}}])}(PC);ie.DOCUMENT_POSITION_DISCONNECTED=1;ie.DOCUMENT_POSITION_PRECEDING=2;ie.DOCUMENT_POSITION_FOLLOWING=4;ie.DOCUMENT_POSITION_CONTAINS=8;ie.DOCUMENT_POSITION_CONTAINED_BY=16;ie.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;var $I=2048,jI=function(){function r(t,e){var n=this;V(this,r),this.nativeHTMLMap=new WeakMap,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.tmpMatrix=Wt(),this.tmpVec3=St(),this.onPointerDown=function(i){var a=n.createPointerEvent(i);if(n.dispatchEvent(a,"pointerdown"),a.pointerType==="touch")n.dispatchEvent(a,"touchstart");else if(a.pointerType==="mouse"||a.pointerType==="pen"){var s=a.button===2;n.dispatchEvent(a,s?"rightdown":"mousedown")}var o=n.trackingData(i.pointerId);o.pressTargetsByButton[i.button]=a.composedPath(),n.freeEvent(a)},this.onPointerUp=function(i){var a=qm.now(),s=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);if(n.dispatchEvent(s,"pointerup"),s.pointerType==="touch")n.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var o=s.button===2;n.dispatchEvent(s,o?"rightup":"mouseup")}var l=n.trackingData(i.pointerId),c=n.findMountedTarget(l.pressTargetsByButton[i.button]),u=c;if(c&&!s.composedPath().includes(c)){for(var h=c;h&&!s.composedPath().includes(h);){if(s.currentTarget=h,n.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")n.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var d=s.button===2;n.notifyTarget(s,d?"rightupoutside":"mouseupoutside")}ie.isNode(h)&&(h=h.parentNode)}delete l.pressTargetsByButton[i.button],u=h}if(u){var f,g=n.clonePointerEvent(s,"click");g.target=u,g.path=[],l.clicksByButton[i.button]||(l.clicksByButton[i.button]={clickCount:0,target:g.target,timeStamp:a});var v=n.context.renderingContext.root.ownerDocument.defaultView,p=l.clicksByButton[i.button];p.target===g.target&&a-p.timeStamp=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;os||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=0;i--){var a=e[i];if(a===this.rootTarget||ie.isNode(a)&&a.parentNode===n)n=e[i];else break}return n}},{key:"getCursor",value:function(e){for(var n=e;n;){var i=rI(n)&&n.getAttribute("cursor");if(i)return i;n=ie.isNode(n)&&n.parentNode}}}])}(),e1=function(){function r(){V(this,r)}return W(r,[{key:"getOrCreateCanvas",value:function(e,n){if(this.canvas)return this.canvas;if(e||U.offscreenCanvas)this.canvas=e||U.offscreenCanvas,this.context=this.canvas.getContext("2d",vt({willReadFrequently:!0},n));else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",vt({willReadFrequently:!0},n)),(!this.context||!this.context.measureText)&&(this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"))}catch{this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d",vt({willReadFrequently:!0},n))}return this.canvas.width=10,this.canvas.height=10,this.canvas}},{key:"getOrCreateContext",value:function(e,n){return this.context?this.context:(this.getOrCreateCanvas(e,n),this.context)}}],[{key:"createCanvas",value:function(){try{return new window.OffscreenCanvas(0,0)}catch{}try{return document.createElement("canvas")}catch{}return null}}])}(),Es=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}({}),qI=function(){function r(t,e){V(this,r),this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.hooks={init:new tn,initAsync:new bI,dirtycheck:new zd,cull:new zd,beginFrame:new tn,beforeRender:new tn,render:new tn,afterRender:new tn,endFrame:new tn,destroy:new tn,pick:new wI,pickSync:new zd,pointerDown:new tn,pointerUp:new tn,pointerMove:new tn,pointerOut:new tn,pointerOver:new tn,pointerWheel:new tn,pointerCancel:new tn,click:new tn},this.globalRuntime=t,this.context=e}return W(r,[{key:"init",value:function(e){var n=this,i=vt(vt({},this.globalRuntime),this.context);this.context.renderingPlugins.forEach(function(a){a.apply(i,n.globalRuntime)}),this.hooks.init.call(),this.hooks.initAsync.getCallbacksNum()===0?(this.inited=!0,e()):this.hooks.initAsync.promise().then(function(){n.inited=!0,e()}).catch(function(a){})}},{key:"getStats",value:function(){return this.stats}},{key:"disableDirtyRectangleRendering",value:function(){var e=this.context.config.renderer,n=e.getConfig(),i=n.enableDirtyRectangleRendering;return!i||this.context.renderingContext.renderReasons.has(Es.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(Es.CAMERA_CHANGED),l=!e.disableRenderHooks||!(e.disableRenderHooks&&o);l&&this.renderDisplayObject(s.root,e,s),this.hooks.beginFrame.call(n),l&&s.renderListCurrentFrame.forEach(function(c){a.hooks.beforeRender.call(c),a.hooks.render.call(c),a.hooks.afterRender.call(c)}),this.hooks.endFrame.call(n),s.renderListCurrentFrame=[],s.renderReasons.clear(),i()}}},{key:"renderDisplayObject",value:function(e,n,i){var a=this,s=n.renderer.getConfig(),o=s.enableDirtyCheck,l=s.enableCulling;function c(g){var v=g.renderable,p=g.sortable,m=o?v.dirty||i.dirtyRectangleRenderingDisabled?g:null:g;if(m){var y=l?a.hooks.cull.call(m,a.context.camera):m;y&&(a.stats.rendered+=1,i.renderListCurrentFrame.push(y))}v.dirty=!1,p.renderOrder=a.zIndexCounter,a.zIndexCounter+=1,a.stats.total+=1,p.dirty&&(a.sort(g,p),p.dirty=!1,p.dirtyChildren=[],p.dirtyReason=void 0)}for(var u=[e];u.length>0;){var h=u.pop();c(h);for(var d=h.sortable.sorted||h.childNodes,f=d.length-1;f>=0;f--)u.push(d[f])}}},{key:"sort",value:function(e,n){n.sorted&&n.dirtyReason!==Jc.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=iI(n.sorted,i);n.sorted.splice(o,0,i)}}):n.sorted=e.childNodes.slice().sort(SC)}},{key:"destroy",value:function(){this.inited=!1,this.hooks.destroy.call(),this.globalRuntime.sceneGraphService.clearPendingEvents()}},{key:"dirtify",value:function(){this.context.renderingContext.renderReasons.add(Es.DISPLAY_OBJECT_CHANGED)}}])}(),GI=/\[\s*(.*)=(.*)\s*\]/,WI=function(){function r(){V(this,r)}return W(r,[{key:"selectOne",value:function(e,n){var i=this;if(e.startsWith("."))return n.find(function(l){return((l==null?void 0:l.classList)||[]).indexOf(i.getIdOrClassname(e))>-1});if(e.startsWith("#"))return n.find(function(l){return l.id===i.getIdOrClassname(e)});if(e.startsWith("[")){var a=this.getAttribute(e),s=a.name,o=a.value;return s?n.find(function(l){return n!==l&&(s==="name"?l.name===o:i.attributeToString(l,s)===o)}):null}return n.find(function(l){return n!==l&&l.nodeName===e})}},{key:"selectAll",value:function(e,n){var i=this;if(e.startsWith("."))return n.findAll(function(l){return n!==l&&((l==null?void 0:l.classList)||[]).indexOf(i.getIdOrClassname(e))>-1});if(e.startsWith("#"))return n.findAll(function(l){return n!==l&&l.id===i.getIdOrClassname(e)});if(e.startsWith("[")){var a=this.getAttribute(e),s=a.name,o=a.value;return s?n.findAll(function(l){return n!==l&&(s==="name"?l.name===o:i.attributeToString(l,s)===o)}):[]}return n.findAll(function(l){return n!==l&&l.nodeName===e})}},{key:"is",value:function(e,n){if(e.startsWith("."))return n.className===this.getIdOrClassname(e);if(e.startsWith("#"))return n.id===this.getIdOrClassname(e);if(e.startsWith("[")){var i=this.getAttribute(e),a=i.name,s=i.value;return a==="name"?n.name===s:this.attributeToString(n,a)===s}return n.nodeName===e}},{key:"getIdOrClassname",value:function(e){return e.substring(1)}},{key:"getAttribute",value:function(e){var n=e.match(GI),i="",a="";return n&&n.length>2&&(i=n[1].replace(/"/g,""),a=n[2].replace(/"/g,"")),{name:i,value:a}}},{key:"attributeToString",value:function(e,n){if(!e.getAttribute)return"";var i=e.getAttribute(n);return ot(i)?"":i.toString?i.toString():""}}])}(),xt=function(r){return r.ATTR_MODIFIED="DOMAttrModified",r.INSERTED="DOMNodeInserted",r.MOUNTED="DOMNodeInsertedIntoDocument",r.REMOVED="removed",r.UNMOUNTED="DOMNodeRemovedFromDocument",r.REPARENT="reparent",r.DESTROY="destroy",r.BOUNDS_CHANGED="bounds-changed",r.CULLED="culled",r}({}),Tr=function(r){function t(e,n,i,a,s,o,l,c){var u;return V(this,t),u=mt(this,t,[null]),u.relatedNode=n,u.prevValue=i,u.newValue=a,u.attrName=s,u.attrChange=o,u.prevParsedValue=l,u.newParsedValue=c,u.type=e,u}return pt(t,r),W(t)}(Du);Tr.ADDITION=2;Tr.MODIFICATION=1;Tr.REMOVAL=3;function ub(r){var t=r.renderable;t&&(t.renderBoundsDirty=!0,t.boundsDirty=!0)}var VI=new Tr(xt.REPARENT,null,"","","",0,"",""),HI=Vy(),Al=St(),UI=Yt(1,1,1),YI=Wt(),XI=Vy(),vi=St(),ns=Wt(),pi=Te(),KI=St(),ZI=Te(),JI=St(),Us=St(),ha=St(),Pl=Wt(),hb=Te(),db=Te(),Nl=Te(),jd={affectChildren:!0},QI=function(){function r(t){V(this,r),this.pendingEvents=new Map,this.boundsChangedEvent=new we(xt.BOUNDS_CHANGED),this.displayObjectDependencyMap=new WeakMap,this.runtime=t}return W(r,[{key:"matches",value:function(e,n){return this.runtime.sceneGraphSelector.is(e,n)}},{key:"querySelector",value:function(e,n){return this.runtime.sceneGraphSelector.selectOne(e,n)}},{key:"querySelectorAll",value:function(e,n){return this.runtime.sceneGraphSelector.selectAll(e,n)}},{key:"attach",value:function(e,n,i){var a,s=!1;e.parentNode&&(s=e.parentNode!==n,this.detach(e));var o=e.nodeName===$.FRAGMENT,l=ru(n);e.parentNode=n;var c=o?e.childNodes:[e];nt(i)?c.forEach(function(f){n.childNodes.splice(i,0,f),f.parentNode=n}):c.forEach(function(f){n.childNodes.push(f),f.parentNode=n});var u=n,h=u.sortable;if((h!=null&&(a=h.sorted)!==null&&a!==void 0&&a.length||e.parsedStyle.zIndex)&&(h.dirtyChildren.indexOf(e)===-1&&h.dirtyChildren.push(e),h.dirty=!0,h.dirtyReason=Jc.ADDED),!l){if(o)this.dirtifyFragment(e);else{var d=e.transformable;d&&this.dirtifyWorld(e,d)}s&&e.dispatchEvent(VI)}}},{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=Jc.REMOVED);var l=e.parentNode.childNodes.indexOf(e);l>-1&&e.parentNode.childNodes.splice(l,1),a&&this.dirtifyWorld(e,a),e.parentNode=null}}},{key:"getOrigin",value:function(e){return e.getGeometryBounds(),e.transformable.origin}},{key:"setOrigin",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=[n,i,a]);var s=e.transformable;if(!(n[0]===s.origin[0]&&n[1]===s.origin[1]&&n[2]===s.origin[2])){var o=s.origin;o[0]=n[0],o[1]=n[1],o[2]=n[2]||0,this.dirtifyLocal(e,s)}}},{key:"rotate",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Yt(n,i,a));var s=e.transformable;if(e.parentNode===null||!e.parentNode.transformable)this.rotateLocal(e,n);else{var o=pi;xl(o,n[0],n[1],n[2]);var l=this.getRotation(e),c=this.getRotation(e.parentNode);El(Nl,c),_d(Nl,Nl),Bi(o,Nl,o),Bi(s.localRotation,o,l),Vc(s.localRotation,s.localRotation),this.dirtifyLocal(e,s)}}},{key:"rotateLocal",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Yt(n,i,a));var s=e.transformable;xl(db,n[0],n[1],n[2]),C2(s.localRotation,s.localRotation,db),this.dirtifyLocal(e,s)}},{key:"setEulerAngles",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Yt(n,i,a));var s=e.transformable;if(e.parentNode===null||!e.parentNode.transformable)this.setLocalEulerAngles(e,n);else{xl(s.localRotation,n[0],n[1],n[2]);var o=this.getRotation(e.parentNode);El(hb,_d(pi,o)),C2(s.localRotation,s.localRotation,hb),this.dirtifyLocal(e,s)}}},{key:"setLocalEulerAngles",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;typeof n=="number"&&(n=Yt(n,i,a));var o=e.transformable;xl(o.localRotation,n[0],n[1],n[2]),s&&this.dirtifyLocal(e,o)}},{key:"translateLocal",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Yt(n,i,a));var s=e.transformable;Vs(n,Al)||(OL(n,n,s.localRotation),Fi(s.localPosition,s.localPosition,n),this.dirtifyLocal(e,s))}},{key:"setPosition",value:function(e,n){var i,a=e.transformable;if(ha[0]=n[0],ha[1]=n[1],ha[2]=(i=n[2])!==null&&i!==void 0?i:0,!Vs(this.getPosition(e),ha)){if(Er(a.position,ha),e.parentNode===null||!e.parentNode.transformable)Er(a.localPosition,ha);else{var s=e.parentNode.transformable;ks(Pl,s.worldTransform),xr(Pl,Pl),Qe(a.localPosition,ha,Pl)}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;Us[0]=n[0],Us[1]=n[1],Us[2]=(i=n[2])!==null&&i!==void 0?i:0,!Vs(s.localPosition,Us)&&(Er(s.localPosition,Us),a&&this.dirtifyLocal(e,s))}},{key:"scaleLocal",value:function(e,n){var i,a=e.transformable;_L(a.localScale,a.localScale,Ze(vi,n[0],n[1],(i=n[2])!==null&&i!==void 0?i:1)),this.dirtifyLocal(e,a)}},{key:"setLocalScale",value:function(e,n){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=e.transformable;Ze(vi,n[0],n[1],(i=n[2])!==null&&i!==void 0?i:s.localScale[2]),!Vs(vi,s.localScale)&&(Er(s.localScale,vi),a&&this.dirtifyLocal(e,s))}},{key:"translate",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Ze(vi,n,i,a)),!Vs(n,Al)&&(Fi(vi,this.getPosition(e),n),this.setPosition(e,vi))}},{key:"setRotation",value:function(e,n,i,a,s){var o=e.transformable;if(typeof n=="number"&&(n=DL(n,i,a,s)),e.parentNode===null||!e.parentNode.transformable)this.setLocalRotation(e,n);else{var l=this.getRotation(e.parentNode);El(pi,l),_d(pi,pi),Bi(o.localRotation,pi,n),Vc(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=M2(pi,n,i,a,s));var l=e.transformable;El(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=FL(XI,n,i));var s=e.transformable;IL(s.localSkew,n),a&&this.dirtifyLocal(e,s)}},{key:"dirtifyLocal",value:function(e,n){ru(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;s1&&arguments[1]!==void 0?arguments[1]:!1,i=e;for(i.renderable&&(i.renderable.dirty=!0);i;)ub(i),i=i.parentNode;n&&e.forEach(function(a){ub(a)}),this.informDependentDisplayObjects(e),this.pendingEvents.set(e,n)}},{key:"updateDisplayObjectDependency",value:function(e,n,i,a){if(n&&n!==i){var s=this.displayObjectDependencyMap.get(n);if(s&&s[e]){var o=s[e].indexOf(a);s[e].splice(o,1)}}if(i){var l=this.displayObjectDependencyMap.get(i);l||(this.displayObjectDependencyMap.set(i,{}),l=this.displayObjectDependencyMap.get(i)),l[e]||(l[e]=[]),l[e].push(a)}}},{key:"informDependentDisplayObjects",value:function(e){var n=this,i=this.displayObjectDependencyMap.get(e);i&&Object.keys(i).forEach(function(a){i[a].forEach(function(s){n.dirtifyToRoot(s,!0),s.dispatchEvent(new Tr(xt.ATTR_MODIFIED,s,n,n,a,Tr.MODIFICATION,n,n)),s.isCustomElement&&s.isConnected&&s.attributeChangedCallback&&s.attributeChangedCallback(a,n,n)})})}},{key:"getPosition",value:function(e){var n=e.transformable;return qc(n.position,this.getWorldTransform(e,n))}},{key:"getRotation",value:function(e){var n=e.transformable;return Gc(n.rotation,this.getWorldTransform(e,n))}},{key:"getScale",value:function(e){var n=e.transformable;return Ms(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){yo(e.localTransform,e.localRotation,e.localPosition,Yt(1,1,1),e.origin),(e.localSkew[0]!==0||e.localSkew[1]!==0)&&(Wi(ns),ns[4]=Math.tan(e.localSkew[0]),ns[1]=Math.tan(e.localSkew[1]),Je(e.localTransform,e.localTransform,ns));var i=yo(ns,M2(pi,0,0,0,1),Ze(vi,1,1,1),e.localScale,e.origin);Je(e.localTransform,e.localTransform,i)}else{var a=e.localTransform,s=e.localPosition,o=e.localRotation,l=e.localScale,c=e.origin,u=s[0]!==0||s[1]!==0||s[2]!==0,h=o[3]!==1||o[0]!==0||o[1]!==0||o[2]!==0,d=l[0]!==1||l[1]!==1||l[2]!==1,f=c[0]!==0||c[1]!==0||c[2]!==0;!h&&!d&&!f?u?ki(a,s):Wi(a):yo(a,o,s,l,c)}}},{key:"getLocalTransform",value:function(e){var n=e.transformable;return n.localDirtyFlag&&(this.calcLocalTransform(n),n.localDirtyFlag=!1),n.localTransform}},{key:"setLocalTransform",value:function(e,n){var i=qc(KI,n),a=Gc(ZI,n),s=Ms(JI,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,UI,!1),this.setLocalPosition(e,Al,!1),this.setLocalEulerAngles(e,Al,void 0,void 0,!1),this.setLocalSkew(e,HI,void 0,!1),this.dirtifyLocal(e,e.transformable)}},{key:"getTransformedGeometryBounds",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2?arguments[2]:void 0,a=this.getGeometryBounds(e,n);if(!Vt.isEmpty(a)){var s=i||new Vt;return s.setFromTransformedAABB(a,this.getWorldTransform(e)),s}return null}},{key:"getGeometryBounds",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=e,a=i.geometry;a.dirty&&U.styleValueRegistry.updateGeometry(e);var s=n?a.renderBounds:a.contentBounds||null;return s||new Vt}},{key:"getBounds",value:function(e){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=e,s=a.renderable;if(!s.boundsDirty&&!i&&s.bounds)return s.bounds;if(!s.renderBoundsDirty&&i&&s.renderBounds)return s.renderBounds;var o=i?s.renderBounds:s.bounds,l=this.getTransformedGeometryBounds(e,i,o),c=e.childNodes;if(c.forEach(function(d){var f=n.getBounds(d,i);f&&(l?l.add(f):(l=o||new Vt,l.update(f.center,f.halfExtents)))}),l||(l=new Vt),i){var u=_C(e);if(u){var h=u.parsedStyle.clipPath.getBounds(i);l?h&&(l=h.intersection(l)):l.update(h.center,h.halfExtents)}}return i?(s.renderBounds=l,s.renderBoundsDirty=!1):(s.bounds=l,s.boundsDirty=!1),l}},{key:"getLocalBounds",value:function(e){if(e.parentNode){var n=YI;e.parentNode.transformable&&(n=xr(ns,this.getWorldTransform(e.parentNode)));var i=this.getBounds(e);if(!Vt.isEmpty(i)){var a=new Vt;return a.setFromTransformedAABB(i,n),a}}return this.getBounds(e)}},{key:"getBoundingClientRect",value:function(e){var n,i,a=this.getGeometryBounds(e);Vt.isEmpty(a)||(i=new Vt,i.setFromTransformedAABB(a,this.getWorldTransform(e)));var s=(n=e.ownerDocument)===null||n===void 0||(n=n.defaultView)===null||n===void 0?void 0:n.getContextService().getBoundingClientRect();if(i){var o=i.getMin(),l=dt(o,2),c=l[0],u=l[1],h=i.getMax(),d=dt(h,2),f=d[0],g=d[1];return new Ts(c+((s==null?void 0:s.left)||0),u+((s==null?void 0:s.top)||0),f-c,g-u)}return new Ts((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;ac;--g){for(var y=0;yB&&A>I;)A-=1,P=P.slice(0,-1);return{lineTxt:P,txtLastCharIndex:A}}function k(P,A){if(!(_<=0||_>v)){if(!y[P]){y[P]=p;return}var I=C(y[P],A,x+1,v-_);y[P]=I.lineTxt+p}}for(var M=0;M=d){n.isOverflowing=!0,M0&&w+L>v){var D=C(y[b],M-1,x+1,v);if(D.txtLastCharIndex!==M-1){if(y[b]=D.lineTxt,D.txtLastCharIndex===m.length-1)break;M=D.txtLastCharIndex+1,T=m[M],O=m[M-1],R=m[M+1],L=E(T)}if(b+1>=d){n.isOverflowing=!0,k(b,M-1);break}if(x=M-1,b+=1,w=0,y[b]="",this.isBreakingSpace(T))continue;this.canBreakInLastChar(T)||(y=this.trimToBreakable(y),w=this.sumTextWidthByCache(y[b]||"",E)),this.shouldBreakByKinsokuShorui(T,R)&&(y=this.trimByKinsokuShorui(y),w+=E(O||""))}w+=L,y[b]=(y[b]||"")+T}return y.join(` `)}},{key:"isBreakingSpace",value:function(e){return typeof e!="string"?!1:da.BreakingSpaces.indexOf(e.charCodeAt(0))>=0}},{key:"isNewline",value:function(e){return typeof e!="string"?!1:da.Newlines.indexOf(e.charCodeAt(0))>=0}},{key:"trimToBreakable",value:function(e){var n=Ut(e),i=n[n.length-2],a=this.findBreakableIndex(i);if(a===-1||!i)return n;var s=i.slice(a,a+1),o=this.isBreakingSpace(s),l=a+1,c=a+(o?0:1);return n[n.length-1]+=i.slice(l,i.length),n[n.length-2]=i.slice(0,c),n}},{key:"canBreakInLastChar",value:function(e){return!(e&&fb.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(!fb.test(e[n]))return n;return-1}},{key:"getFromCache",value:function(e,n,i,a){var s=i[e];if(typeof s!="number"){var o=e.length*n,l=a.measureText(e);s=l.width+o,i[e]=s}return s}}])}(),U={},h4=function(r){var t=new II,e=new DI;return r={},rt(rt(rt(rt(rt(rt(rt(rt(rt(rt(r,$.FRAGMENT,null),$.CIRCLE,new PI),$.ELLIPSE,new NI),$.RECT,t),$.IMAGE,t),$.GROUP,new BI),$.LINE,new RI),$.TEXT,new FI(U)),$.POLYLINE,e),$.POLYGON,e),rt(rt(rt(r,$.PATH,new LI),$.HTML,new zI),$.MESH,null)}(),d4=function(r){var t=new G5,e=new jm;return r={},rt(rt(rt(rt(rt(rt(rt(rt(rt(rt(r,Z.PERCENTAGE,null),Z.NUMBER,new Y5),Z.ANGLE,new j5),Z.DEFINED_PATH,new q5),Z.PAINT,t),Z.COLOR,t),Z.FILTER,new W5),Z.LENGTH,e),Z.LENGTH_PERCENTAGE,e),Z.LENGTH_PERCENTAGE_12,new V5),rt(rt(rt(rt(rt(rt(rt(rt(rt(rt(r,Z.LENGTH_PERCENTAGE_14,new H5),Z.COORDINATE,new jm),Z.OFFSET_DISTANCE,new X5),Z.OPACITY_VALUE,new K5),Z.PATH,new Z5),Z.LIST_OF_POINTS,new J5),Z.SHADOW_BLUR,new Q5),Z.TEXT,new tI),Z.TEXT_TRANSFORM,new eI),Z.TRANSFORM,new TI),rt(rt(rt(r,Z.TRANSFORM_ORIGIN,new OI),Z.Z_INDEX,new AI),Z.MARKER,new U5)}(),f4=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}};U.CameraContribution=iC;U.AnimationTimeline=null;U.EasingFunction=null;U.offscreenCanvasCreator=new e1;U.sceneGraphSelector=new WI;U.sceneGraphService=new QI(U);U.textService=new u4(U);U.geometryUpdaterFactory=h4;U.CSSPropertySyntaxFactory=d4;U.styleValueRegistry=new z5(U);U.layoutRegistry=null;U.globalThis=f4();U.enableStyleSyntax=!0;U.enableSizeAttenuation=!1;var g4=0,Wm=new Tr(xt.INSERTED,null,"","","",0,"",""),Vm=new Tr(xt.REMOVED,null,"","","",0,"",""),NC=new we(xt.DESTROY),v4=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a=0;n--){var i=this.childNodes[n];this.removeChild(i)}}},{key:"destroyChildren",value:function(){for(var n=this.childNodes.length-1;n>=0;n--){var i=this.childNodes[n];i.childNodes.length>0&&i.destroyChildren(),i.destroy()}}},{key:"matches",value:function(n){return U.sceneGraphService.matches(n,this)}},{key:"getElementById",value:function(n){return U.sceneGraphService.querySelector("#".concat(n),this)}},{key:"getElementsByName",value:function(n){return U.sceneGraphService.querySelectorAll('[name="'.concat(n,'"]'),this)}},{key:"getElementsByClassName",value:function(n){return U.sceneGraphService.querySelectorAll(".".concat(n),this)}},{key:"getElementsByTagName",value:function(n){return U.sceneGraphService.querySelectorAll(n,this)}},{key:"querySelector",value:function(n){return U.sceneGraphService.querySelector(n,this)}},{key:"querySelectorAll",value:function(n){return U.sceneGraphService.querySelectorAll(n,this)}},{key:"closest",value:function(n){var i=this;do{if(U.sceneGraphService.matches(n,i))return i;i=i.parentElement}while(i!==null);return null}},{key:"find",value:function(n){var i=this,a=null;return this.forEach(function(s){return s!==i&&n(s)?(a=s,!1):!0}),a}},{key:"findAll",value:function(n){var i=this,a=[];return this.forEach(function(s){s!==i&&n(s)&&a.push(s)}),a}},{key:"after",value:function(){var n=this;if(this.parentNode){for(var i=this.parentNode.childNodes.indexOf(this),a=arguments.length,s=new Array(a),o=0;o0&&arguments[0]!==void 0?arguments[0]:{},i={forceUpdateGeometry:!0};U.styleValueRegistry.processProperties(this,n,i),this.renderable.dirty=!0}},{key:"setAttribute",value:function(n,i){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;ut(i)||(a||i!==this.attributes[n])&&(this.internalSetAttribute(n,i,{memoize:s}),R2(t,"setAttribute",this)([n,i]))}},{key:"internalSetAttribute",value:function(n,i){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=this.renderable,o=this.attributes[n],l=this.parsedStyle[n];U.styleValueRegistry.processProperties(this,rt({},n,i),a),s.dirty=!0;var c=this.parsedStyle[n];if(this.isConnected&&(br.relatedNode=this,br.prevValue=o,br.newValue=i,br.attrName=n,br.prevParsedValue=l,br.newParsedValue=c,this.isMutationObserved?this.dispatchEvent(br):(br.target=this,this.ownerDocument.defaultView.dispatchEvent(br,!0))),this.isCustomElement&&this.isConnected||!this.isCustomElement){var u,h;(u=(h=this).attributeChangedCallback)===null||u===void 0||u.call(h,n,o,i,l,c)}}},{key:"getBBox",value:function(){var n=this.getBounds(),i=n.getMin(),a=dt(i,2),s=a[0],o=a[1],l=n.getMax(),c=dt(l,2),u=c[0],h=c[1];return new Ts(s,o,u-s,h-o)}},{key:"setOrigin",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return U.sceneGraphService.setOrigin(this,en(n,i,a,!1)),this}},{key:"getOrigin",value:function(){return U.sceneGraphService.getOrigin(this)}},{key:"setPosition",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return U.sceneGraphService.setPosition(this,en(n,i,a,!1)),this}},{key:"setLocalPosition",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return U.sceneGraphService.setLocalPosition(this,en(n,i,a,!1)),this}},{key:"translate",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return U.sceneGraphService.translate(this,en(n,i,a,!1)),this}},{key:"translateLocal",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return U.sceneGraphService.translateLocal(this,en(n,i,a,!1)),this}},{key:"getPosition",value:function(){return U.sceneGraphService.getPosition(this)}},{key:"getLocalPosition",value:function(){return U.sceneGraphService.getLocalPosition(this)}},{key:"scale",value:function(n,i,a){return this.scaleLocal(n,i,a)}},{key:"scaleLocal",value:function(n,i,a){return typeof n=="number"&&(i=i||n,a=a||n,n=en(n,i,a,!1)),U.sceneGraphService.scaleLocal(this,n),this}},{key:"setLocalScale",value:function(n,i,a){return typeof n=="number"&&(i=i||n,a=a||n,n=en(n,i,a,!1)),U.sceneGraphService.setLocalScale(this,n),this}},{key:"getLocalScale",value:function(){return U.sceneGraphService.getLocalScale(this)}},{key:"getScale",value:function(){return U.sceneGraphService.getScale(this)}},{key:"getEulerAngles",value:function(){var n=Pd(Ys,U.sceneGraphService.getWorldTransform(this)),i=dt(n,3),a=i[2];return gn(a)}},{key:"getLocalEulerAngles",value:function(){var n=Pd(Ys,U.sceneGraphService.getLocalRotation(this)),i=dt(n,3),a=i[2];return gn(a)}},{key:"setEulerAngles",value:function(n){return U.sceneGraphService.setEulerAngles(this,0,0,n),this}},{key:"setLocalEulerAngles",value:function(n){return U.sceneGraphService.setLocalEulerAngles(this,0,0,n),this}},{key:"rotateLocal",value:function(n,i,a){return ot(i)&&ot(a)?U.sceneGraphService.rotateLocal(this,0,0,n):U.sceneGraphService.rotateLocal(this,n,i,a),this}},{key:"rotate",value:function(n,i,a){return ot(i)&&ot(a)?U.sceneGraphService.rotate(this,0,0,n):U.sceneGraphService.rotate(this,n,i,a),this}},{key:"setRotation",value:function(n,i,a,s){return U.sceneGraphService.setRotation(this,n,i,a,s),this}},{key:"setLocalRotation",value:function(n,i,a,s){return U.sceneGraphService.setLocalRotation(this,n,i,a,s),this}},{key:"setLocalSkew",value:function(n,i){return U.sceneGraphService.setLocalSkew(this,n,i),this}},{key:"getRotation",value:function(){return U.sceneGraphService.getRotation(this)}},{key:"getLocalRotation",value:function(){return U.sceneGraphService.getLocalRotation(this)}},{key:"getLocalSkew",value:function(){return U.sceneGraphService.getLocalSkew(this)}},{key:"getLocalTransform",value:function(){return U.sceneGraphService.getLocalTransform(this)}},{key:"getWorldTransform",value:function(){return U.sceneGraphService.getWorldTransform(this)}},{key:"setLocalTransform",value:function(n){return U.sceneGraphService.setLocalTransform(this,n),this}},{key:"resetLocalTransform",value:function(){U.sceneGraphService.resetLocalTransform(this)}},{key:"getAnimations",value:function(){return this.activeAnimations}},{key:"animate",value:function(n,i){var a,s=(a=this.ownerDocument)===null||a===void 0?void 0:a.timeline;return s?s.play(this,n,i):null}},{key:"isVisible",value:function(){var n;return((n=this.parsedStyle)===null||n===void 0?void 0:n.visibility)!=="hidden"}},{key:"interactive",get:function(){return this.isInteractive()},set:function(n){this.style.pointerEvents=n?"auto":"none"}},{key:"isInteractive",value:function(){var n;return((n=this.parsedStyle)===null||n===void 0?void 0:n.pointerEvents)!=="none"}},{key:"isCulled",value:function(){return!!(this.cullable&&this.cullable.enable&&!this.cullable.visible)}},{key:"toFront",value:function(){return this.parentNode&&(this.style.zIndex=Math.max.apply(Math,Ut(this.parentNode.children.map(function(n){return Number(n.style.zIndex)})))+1),this}},{key:"toBack",value:function(){return this.parentNode&&(this.style.zIndex=Math.min.apply(Math,Ut(this.parentNode.children.map(function(n){return Number(n.style.zIndex)})))-1),this}},{key:"getConfig",value:function(){return this.config}},{key:"attr",value:function(){for(var n=this,i=arguments.length,a=new Array(i),s=0;s1&&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}}])}(v4);Zt.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","display","draggable","droppable","fill","fillOpacity","fillRule","filter","increasedLineWidthForHitTesting","lineCap","lineDash","lineDashOffset","lineJoin","lineWidth","miterLimit","hitArea","offsetDistance","offsetPath","offsetX","offsetY","opacity","pointerEvents","shadowColor","shadowType","shadowBlur","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","strokeWidth","strokeLinecap","strokeLineJoin","strokeDasharray","strokeDashoffset","transform","transformOrigin","textTransform","visibility","zIndex"]);var li=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return V(this,t),mt(this,t,[vt({type:$.CIRCLE},e)])}return pt(t,r),W(t)}(Zt);li.PARSED_STYLE_LIST=new Set([].concat(Ut(Zt.PARSED_STYLE_LIST),["cx","cy","cz","r","isBillboard","isSizeAttenuation"]));var y4=["style"],n1=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=qa(n,y4);return V(this,t),e=mt(this,t,[vt({style:i},a)]),e.isCustomElement=!0,e}return pt(t,r),W(t)}(Zt);n1.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var Xo=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return V(this,t),mt(this,t,[vt({type:$.ELLIPSE},e)])}return pt(t,r),W(t)}(Zt);Xo.PARSED_STYLE_LIST=new Set([].concat(Ut(Zt.PARSED_STYLE_LIST),["cx","cy","cz","rx","ry","isBillboard","isSizeAttenuation"]));var b4=function(r){function t(){return V(this,t),mt(this,t,[{type:$.FRAGMENT}])}return pt(t,r),W(t)}(Zt);b4.PARSED_STYLE_LIST=new Set(["class","className"]);var Pe=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return V(this,t),mt(this,t,[vt({type:$.GROUP},e)])}return pt(t,r),W(t)}(Zt);Pe.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var w4=["style"],Ko=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=qa(n,w4);return V(this,t),e=mt(this,t,[vt({type:$.HTML,style:i},a)]),e.cullable.enable=!1,e}return pt(t,r),W(t,[{key:"getDomElement",value:function(){return this.parsedStyle.$el}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"getLocalBounds",value:function(){if(this.parentNode){var n=xr(Wt(),this.parentNode.getWorldTransform()),i=this.getBounds();if(!Vt.isEmpty(i)){var a=new Vt;return a.setFromTransformedAABB(i,n),a}}return this.getBounds()}}])}(Zt);Ko.PARSED_STYLE_LIST=new Set([].concat(Ut(Zt.PARSED_STYLE_LIST),["x","y","$el","innerHTML","width","height"]));var Zo=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return V(this,t),mt(this,t,[vt({type:$.IMAGE},e)])}return pt(t,r),W(t)}(Zt);Zo.PARSED_STYLE_LIST=new Set([].concat(Ut(Zt.PARSED_STYLE_LIST),["x","y","z","src","width","height","isBillboard","billboardRotation","isSizeAttenuation","keepAspectRatio"]));var x4=["style"],Fa=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=qa(n,x4);V(this,t),e=mt(this,t,[vt({type:$.LINE,style:vt({x1:0,y1:0,x2:0,y2:0,z1:0,z2:0},i)},a)]),e.markerStartAngle=0,e.markerEndAngle=0;var s=e.parsedStyle,o=s.markerStart,l=s.markerEnd;return o&&Ct(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),l&&Ct(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return pt(t,r),W(t,[{key:"attributeChangedCallback",value:function(n,i,a,s,o){n==="x1"||n==="y1"||n==="x2"||n==="y2"||n==="markerStartOffset"||n==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):n==="markerStart"?(s&&Ct(s)&&(this.markerStartAngle=0,s.remove()),o&&Ct(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"&&(s&&Ct(s)&&(this.markerEndAngle=0,s.remove()),o&&Ct(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1)))}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,l=i.markerEndOffset,c=i.x1,u=i.x2,h=i.y1,d=i.y2,f=n?a:s;if(!(!f||!Ct(f))){var g=0,v,p,m,y,b,w;n?(m=c,y=h,v=u-c,p=d-h,b=o||0,w=this.markerStartAngle):(m=u,y=d,v=c-u,p=h-d,b=l||0,w=this.markerEndAngle),g=Math.atan2(p,v),f.setLocalEulerAngles(g*180/Math.PI+w),f.setLocalPosition(m+Math.cos(g)*b,y+Math.sin(g)*b)}}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle,s=a.x1,o=a.y1,l=a.x2,c=a.y2,u=eC(s,o,l,c,n),h=u.x,d=u.y,f=Qe(St(),Yt(h,d,0),i?this.getWorldTransform():this.getLocalTransform());return new qe(f[0],f[1])}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPoint(n/this.getTotalLength(),i)}},{key:"getTotalLength",value:function(){var n=this.parsedStyle,i=n.x1,a=n.y1,s=n.x2,o=n.y2;return tC(i,a,s,o)}}])}(Zt);Fa.PARSED_STYLE_LIST=new Set([].concat(Ut(Zt.PARSED_STYLE_LIST),["x1","y1","x2","y2","z1","z2","isBillboard","isSizeAttenuation","markerStart","markerEnd","markerStartOffset","markerEndOffset"]));var E4=["style"],Tn=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=qa(n,E4);V(this,t),e=mt(this,t,[vt({type:$.PATH,style:i,initialParsedStyle:{miterLimit:4,d:vt({},aC)}},a)]),e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[];var s=e.parsedStyle,o=s.markerStart,l=s.markerEnd,c=s.markerMid;return o&&Ct(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),c&&Ct(c)&&e.placeMarkerMid(c),l&&Ct(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return pt(t,r),W(t,[{key:"attributeChangedCallback",value:function(n,i,a,s,o){n==="d"?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):n==="markerStartOffset"||n==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):n==="markerStart"?(s&&Ct(s)&&(this.markerStartAngle=0,s.remove()),o&&Ct(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"?(s&&Ct(s)&&(this.markerEndAngle=0,s.remove()),o&&Ct(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1))):n==="markerMid"&&this.placeMarkerMid(o)}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,l=i.markerEndOffset,c=n?a:s;if(!(!c||!Ct(c))){var u=0,h,d,f,g,v,p;if(n){var m=this.getStartTangent(),y=dt(m,2),b=y[0],w=y[1];f=w[0],g=w[1],h=b[0]-w[0],d=b[1]-w[1],v=o||0,p=this.markerStartAngle}else{var x=this.getEndTangent(),S=dt(x,2),E=S[0],_=S[1];f=_[0],g=_[1],h=E[0]-_[0],d=E[1]-_[1],v=l||0,p=this.markerEndAngle}u=Math.atan2(d,h),c.setLocalEulerAngles(u*180/Math.PI+p),c.setLocalPosition(f+Math.cos(u)*v,g+Math.sin(u)*v)}}},{key:"placeMarkerMid",value:function(n){var i=this.parsedStyle.d.segments;if(this.markerMidList.forEach(function(u){u.remove()}),n&&Ct(n))for(var a=1;a1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle.d.absolutePath,s=z6(a,n),o=s.x,l=s.y,c=Qe(St(),Yt(o,l,0),i?this.getWorldTransform():this.getLocalTransform());return new qe(c[0],c[1])}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPointAtLength(n*zm(this),i)}},{key:"getStartTangent",value:function(){var n=this.parsedStyle.d.segments,i=[];if(n.length>1){var a=n[0].currentPoint,s=n[1].currentPoint,o=n[1].startTangent;i=[],o?(i.push([a[0]-o[0],a[1]-o[1]]),i.push([a[0],a[1]])):(i.push([s[0],s[1]]),i.push([a[0],a[1]]))}return i}},{key:"getEndTangent",value:function(){var n=this.parsedStyle.d.segments,i=n.length,a=[];if(i>1){var s=n[i-2].currentPoint,o=n[i-1].currentPoint,l=n[i-1].endTangent;a=[],l?(a.push([o[0]-l[0],o[1]-l[1]]),a.push([o[0],o[1]])):(a.push([s[0],s[1]]),a.push([o[0],o[1]]))}return a}}])}(Zt);Tn.PARSED_STYLE_LIST=new Set([].concat(Ut(Zt.PARSED_STYLE_LIST),["d","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard","isSizeAttenuation"]));var S4=["style"],Wa=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=qa(n,S4);V(this,t),e=mt(this,t,[vt({type:$.POLYGON,style:i,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!0}},a)]),e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[];var s=e.parsedStyle,o=s.markerStart,l=s.markerEnd,c=s.markerMid;return o&&Ct(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),c&&Ct(c)&&e.placeMarkerMid(c),l&&Ct(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return pt(t,r),W(t,[{key:"attributeChangedCallback",value:function(n,i,a,s,o){n==="points"?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):n==="markerStartOffset"||n==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):n==="markerStart"?(s&&Ct(s)&&(this.markerStartAngle=0,s.remove()),o&&Ct(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"?(s&&Ct(s)&&(this.markerEndAngle=0,s.remove()),o&&Ct(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1))):n==="markerMid"&&this.placeMarkerMid(o)}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,l=i.markerEndOffset,c=i.points,u=c||{},h=u.points,d=n?a:s;if(!(!d||!Ct(d)||!h)){var f=0,g,v,p,m,y,b;if(p=h[0][0],m=h[0][1],n)g=h[1][0]-h[0][0],v=h[1][1]-h[0][1],y=o||0,b=this.markerStartAngle;else{var w=h.length;this.parsedStyle.isClosed?(g=h[w-1][0]-h[0][0],v=h[w-1][1]-h[0][1]):(p=h[w-1][0],m=h[w-1][1],g=h[w-2][0]-h[w-1][0],v=h[w-2][1]-h[w-1][1]),y=l||0,b=this.markerEndAngle}f=Math.atan2(v,g),d.setLocalEulerAngles(f*180/Math.PI+b),d.setLocalPosition(p+Math.cos(f)*y,m+Math.sin(f)*y)}}},{key:"placeMarkerMid",value:function(n){var i=this.parsedStyle.points,a=i||{},s=a.points;if(this.markerMidList.forEach(function(h){h.remove()}),this.markerMidList=[],n&&Ct(n)&&s)for(var o=1;o<(this.parsedStyle.isClosed?s.length:s.length-1);o++){var l=s[o][0],c=s[o][1],u=o===1?n:n.cloneNode(!0);this.markerMidList.push(u),this.appendChild(u),u.setLocalPosition(l,c)}}}])}(Zt);Wa.PARSED_STYLE_LIST=new Set([].concat(Ut(Zt.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isClosed","isBillboard","isSizeAttenuation"]));var _4=["style"],Iu=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.style,i=qa(e,_4);return V(this,t),mt(this,t,[vt({type:$.POLYLINE,style:n,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!1}},i)])}return pt(t,r),W(t,[{key:"getTotalLength",value:function(){return p5(this)}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPoint(n/this.getTotalLength(),i)}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle.points.points;if(this.parsedStyle.points.segments.length===0){var s=[],o=0,l,c,u=this.getTotalLength();a.forEach(function(m,y){a[y+1]&&(l=[0,0],l[0]=o/u,c=tC(m[0],m[1],a[y+1][0],a[y+1][1]),o+=c,l[1]=o/u,s.push(l))}),this.parsedStyle.points.segments=s}var h=0,d=0;this.parsedStyle.points.segments.forEach(function(m,y){n>=m[0]&&n<=m[1]&&(h=(n-m[0])/(m[1]-m[0]),d=y)});var f=eC(a[d][0],a[d][1],a[d+1][0],a[d+1][1],h),g=f.x,v=f.y,p=Qe(St(),Yt(g,v,0),i?this.getWorldTransform():this.getLocalTransform());return new qe(p[0],p[1])}},{key:"getStartTangent",value:function(){var n=this.parsedStyle.points.points,i=[];return i.push([n[1][0],n[1][1]]),i.push([n[0][0],n[0][1]]),i}},{key:"getEndTangent",value:function(){var n=this.parsedStyle.points.points,i=n.length-1,a=[];return a.push([n[i-1][0],n[i-1][1]]),a.push([n[i][0],n[i][1]]),a}}])}(Wa);Iu.PARSED_STYLE_LIST=new Set([].concat(Ut(Wa.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard"]));var Be=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return V(this,t),mt(this,t,[vt({type:$.RECT},e)])}return pt(t,r),W(t)}(Zt);Be.PARSED_STYLE_LIST=new Set([].concat(Ut(Zt.PARSED_STYLE_LIST),["x","y","z","width","height","isBillboard","isSizeAttenuation","radius"]));var k4=["style"],Qi=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.style,i=qa(e,k4);return V(this,t),mt(this,t,[vt({type:$.TEXT,style:vt({fill:"black"},n)},i)])}return pt(t,r),W(t,[{key:"getComputedTextLength",value:function(){var n;return this.getGeometryBounds(),((n=this.parsedStyle.metrics)===null||n===void 0?void 0:n.maxLineWidth)||0}},{key:"getLineBoundingRects",value:function(){var n;return this.getGeometryBounds(),((n=this.parsedStyle.metrics)===null||n===void 0?void 0:n.lineMetrics)||[]}},{key:"isOverflowing",value:function(){return this.getGeometryBounds(),!!this.parsedStyle.isOverflowing}}])}(Zt);Qi.PARSED_STYLE_LIST=new Set([].concat(Ut(Zt.PARSED_STYLE_LIST),["x","y","z","isBillboard","billboardRotation","isSizeAttenuation","text","textAlign","textBaseline","fontStyle","fontSize","fontFamily","fontWeight","fontVariant","lineHeight","letterSpacing","leading","wordWrap","wordWrapWidth","maxLines","textOverflow","isOverflowing","textPath","textDecorationLine","textDecorationColor","textDecorationStyle","textPathSide","textPathStartOffset","metrics","dx","dy"]));var M4=function(){function r(){V(this,r),this.registry={},this.define($.CIRCLE,li),this.define($.ELLIPSE,Xo),this.define($.RECT,Be),this.define($.IMAGE,Zo),this.define($.LINE,Fa),this.define($.GROUP,Pe),this.define($.PATH,Tn),this.define($.POLYGON,Wa),this.define($.POLYLINE,Iu),this.define($.TEXT,Qi),this.define($.HTML,Ko)}return W(r,[{key:"define",value:function(e,n){this.registry[e]=n}},{key:"get",value:function(e){return this.registry[e]}}])}(),RC=function(r){function t(){var e;V(this,t),e=mt(this,t),e.defaultView=null,e.ownerDocument=null,e.nodeName="document";try{e.timeline=new U.AnimationTimeline(e)}catch{}var n={};return Jy.forEach(function(i){var a=i.n,s=i.inh,o=i.d;s&&o&&(n[a]=at(o)?o($.GROUP):o)}),e.documentElement=new Pe({id:"g-root",style:n}),e.documentElement.ownerDocument=e,e.documentElement.parentNode=e,e.childNodes=[e.documentElement],e}return pt(t,r),W(t,[{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"createElement",value:function(n,i){if(n==="svg")return this.documentElement;var a=this.defaultView.customElements.get(n);a||(console.warn("Unsupported tagName: ",n),a=n==="tspan"?Qi:Pe);var s=new a(i);return s.ownerDocument=this,s}},{key:"createElementNS",value:function(n,i,a){return this.createElement(i,a)}},{key:"cloneNode",value:function(n){throw new Error(Ft)}},{key:"destroy",value:function(){try{this.documentElement.destroyChildren(),this.timeline.destroy()}catch{}}},{key:"elementsFromBBox",value:function(n,i,a,s){var o=this.defaultView.context.rBushRoot,l=o.search({minX:n,minY:i,maxX:a,maxY:s}),c=[];return l.forEach(function(u){var h=u.displayObject,d=h.parsedStyle.pointerEvents,f=d===void 0?"auto":d,g=["auto","visiblepainted","visiblefill","visiblestroke","visible"].includes(f);(!g||g&&h.isVisible())&&!h.isCulled()&&h.isInteractive()&&c.push(h)}),c.sort(function(u,h){return h.sortable.renderOrder-u.sortable.renderOrder}),c}},{key:"elementFromPointSync",value:function(n,i){var a=this.defaultView.canvas2Viewport({x:n,y:i}),s=a.x,o=a.y,l=this.defaultView.getConfig(),c=l.width,u=l.height;if(s<0||o<0||s>c||o>u)return null;var h=this.defaultView.viewport2Client({x:s,y:o}),d=h.x,f=h.y,g=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!0,position:{x:n,y:i,viewportX:s,viewportY:o,clientX:d,clientY:f},picked:[]}),v=g.picked;return v&&v[0]||this.documentElement}},{key:"elementFromPoint",value:function(){var e=Gi(We().mark(function i(a,s){var o,l,c,u,h,d,f,g,v,p,m;return We().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(o=this.defaultView.canvas2Viewport({x:a,y:s}),l=o.x,c=o.y,u=this.defaultView.getConfig(),h=u.width,d=u.height,!(l<0||c<0||l>h||c>d)){b.next=4;break}return b.abrupt("return",null);case 4:return f=this.defaultView.viewport2Client({x:l,y:c}),g=f.x,v=f.y,b.next=7,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!0,position:{x:a,y:s,viewportX:l,viewportY:c,clientX:g,clientY:v},picked:[]});case 7:return p=b.sent,m=p.picked,b.abrupt("return",m&&m[0]||this.documentElement);case 10:case"end":return b.stop()}},i,this)}));function n(i,a){return e.apply(this,arguments)}return n}()},{key:"elementsFromPointSync",value:function(n,i){var a=this.defaultView.canvas2Viewport({x:n,y:i}),s=a.x,o=a.y,l=this.defaultView.getConfig(),c=l.width,u=l.height;if(s<0||o<0||s>c||o>u)return[];var h=this.defaultView.viewport2Client({x:s,y:o}),d=h.x,f=h.y,g=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!1,position:{x:n,y:i,viewportX:s,viewportY:o,clientX:d,clientY:f},picked:[]}),v=g.picked;return v[v.length-1]!==this.documentElement&&v.push(this.documentElement),v}},{key:"elementsFromPoint",value:function(){var e=Gi(We().mark(function i(a,s){var o,l,c,u,h,d,f,g,v,p,m;return We().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(o=this.defaultView.canvas2Viewport({x:a,y:s}),l=o.x,c=o.y,u=this.defaultView.getConfig(),h=u.width,d=u.height,!(l<0||c<0||l>h||c>d)){b.next=4;break}return b.abrupt("return",[]);case 4:return f=this.defaultView.viewport2Client({x:l,y:c}),g=f.x,v=f.y,b.next=7,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!1,position:{x:a,y:s,viewportX:l,viewportY:c,clientX:g,clientY:v},picked:[]});case 7:return p=b.sent,m=p.picked,m[m.length-1]!==this.documentElement&&m.push(this.documentElement),b.abrupt("return",m);case 11:case"end":return b.stop()}},i,this)}));function n(i,a){return e.apply(this,arguments)}return n}()},{key:"appendChild",value:function(n,i){throw new Error(es)}},{key:"insertBefore",value:function(n,i){throw new Error(es)}},{key:"removeChild",value:function(n,i){throw new Error(es)}},{key:"replaceChild",value:function(n,i,a){throw new Error(es)}},{key:"append",value:function(){throw new Error(es)}},{key:"prepend",value:function(){throw new Error(es)}},{key:"getElementById",value:function(n){return this.documentElement.getElementById(n)}},{key:"getElementsByName",value:function(n){return this.documentElement.getElementsByName(n)}},{key:"getElementsByTagName",value:function(n){return this.documentElement.getElementsByTagName(n)}},{key:"getElementsByClassName",value:function(n){return this.documentElement.getElementsByClassName(n)}},{key:"querySelector",value:function(n){return this.documentElement.querySelector(n)}},{key:"querySelectorAll",value:function(n){return this.documentElement.querySelectorAll(n)}},{key:"find",value:function(n){return this.documentElement.find(n)}},{key:"findAll",value:function(n){return this.documentElement.findAll(n)}}])}(ie),LC=function(){function r(t){V(this,r),this.strategies=t}return W(r,[{key:"apply",value:function(e){var n=e.camera,i=e.renderingService,a=e.renderingContext,s=this.strategies;i.hooks.cull.tap(r.tag,function(o){if(o){var l=o.cullable;return s.length===0?l.visible=a.unculledEntities.indexOf(o.entity)>-1:l.visible=s.every(function(c){return c.isVisible(n,o)}),!o.isCulled()&&o.isVisible()?o:(o.dispatchEvent(new we(xt.CULLED)),null)}return o}),i.hooks.afterRender.tap(r.tag,function(o){o.cullable.visibilityPlaneMask=-1})}}])}();LC.tag="Culling";var DC=function(){function r(){var t=this;V(this,r),this.autoPreventDefault=!1,this.rootPointerEvent=new iu(null),this.rootWheelEvent=new Gm(null),this.onPointerMove=function(e){var n,i=(n=t.context.renderingContext.root)===null||n===void 0||(n=n.ownerDocument)===null||n===void 0?void 0:n.defaultView;if(!(i.supportsTouchEvents&&e.pointerType==="touch")){var a=t.normalizeToPointerEvent(e,i),s=ma(a),o;try{for(s.s();!(o=s.n()).done;){var l=o.value,c=t.bootstrapEvent(t.rootPointerEvent,l,i,e);t.context.eventService.mapEvent(c)}}catch(u){s.e(u)}finally{s.f()}t.setCursor(t.context.eventService.cursor)}},this.onClick=function(e){var n,i=(n=t.context.renderingContext.root)===null||n===void 0||(n=n.ownerDocument)===null||n===void 0?void 0:n.defaultView,a=t.normalizeToPointerEvent(e,i),s=ma(a),o;try{for(s.s();!(o=s.n()).done;){var l=o.value,c=t.bootstrapEvent(t.rootPointerEvent,l,i,e);t.context.eventService.mapEvent(c)}}catch(u){s.e(u)}finally{s.f()}t.setCursor(t.context.eventService.cursor)}}return W(r,[{key:"apply",value:function(e){var n=this;this.context=e;var i=e.renderingService,a=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler(function(s){var o=n.context.renderingService.hooks.pickSync.call({position:s,picked:[],topmost:!0}),l=o.picked;return l[0]||null}),i.hooks.pointerWheel.tap(r.tag,function(s){var o=n.normalizeWheelEvent(s);n.context.eventService.mapEvent(o)}),i.hooks.pointerDown.tap(r.tag,function(s){if(!(a.supportsTouchEvents&&s.pointerType==="touch")){var o=n.normalizeToPointerEvent(s,a);if(n.autoPreventDefault&&o[0].isNormalized){var l=s.cancelable||!("cancelable"in s);l&&s.preventDefault()}var c=ma(o),u;try{for(c.s();!(u=c.n()).done;){var h=u.value,d=n.bootstrapEvent(n.rootPointerEvent,h,a,s);n.context.eventService.mapEvent(d)}}catch(f){c.e(f)}finally{c.f()}n.setCursor(n.context.eventService.cursor)}}),i.hooks.pointerUp.tap(r.tag,function(s){if(!(a.supportsTouchEvents&&s.pointerType==="touch")){var o=n.context.contextService.getDomElement(),l=n.context.eventService.isNativeEventFromCanvas(o,s),c=l?"":"outside",u=n.normalizeToPointerEvent(s,a),h=ma(u),d;try{for(h.s();!(d=h.n()).done;){var f=d.value,g=n.bootstrapEvent(n.rootPointerEvent,f,a,s);g.type+=c,n.context.eventService.mapEvent(g)}}catch(v){h.e(v)}finally{h.f()}n.setCursor(n.context.eventService.cursor)}}),i.hooks.pointerMove.tap(r.tag,this.onPointerMove),i.hooks.pointerOver.tap(r.tag,this.onPointerMove),i.hooks.pointerOut.tap(r.tag,this.onPointerMove),i.hooks.click.tap(r.tag,this.onClick),i.hooks.pointerCancel.tap(r.tag,function(s){var o=n.normalizeToPointerEvent(s,a),l=ma(o),c;try{for(l.s();!(c=l.n()).done;){var u=c.value,h=n.bootstrapEvent(n.rootPointerEvent,u,a,s);n.context.eventService.mapEvent(h)}}catch(d){l.e(d)}finally{l.f()}n.setCursor(n.context.eventService.cursor)})}},{key:"bootstrapEvent",value:function(e,n,i,a){e.view=i,e.originalEvent=null,e.nativeEvent=a,e.pointerId=n.pointerId,e.width=n.width,e.height=n.height,e.isPrimary=n.isPrimary,e.pointerType=n.pointerType,e.pressure=n.pressure,e.tangentialPressure=n.tangentialPressure,e.tiltX=n.tiltX,e.tiltY=n.tiltY,e.twist=n.twist,this.transferMouseData(e,n);var s=this.context.eventService.client2Viewport({x:n.clientX,y:n.clientY}),o=s.x,l=s.y;e.viewport.x=o,e.viewport.y=l;var c=this.context.eventService.viewport2Canvas(e.viewport),u=c.x,h=c.y;return e.canvas.x=u,e.canvas.y=h,e.global.copyFrom(e.canvas),e.offset.copyFrom(e.canvas),e.isTrusted=a.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=cI[e.type]||e.type),e}},{key:"normalizeWheelEvent",value:function(e){var n=this.rootWheelEvent;this.transferMouseData(n,e),n.deltaMode=e.deltaMode,n.deltaX=e.deltaX,n.deltaY=e.deltaY,n.deltaZ=e.deltaZ;var i=this.context.eventService.client2Viewport({x:e.clientX,y:e.clientY}),a=i.x,s=i.y;n.viewport.x=a,n.viewport.y=s;var o=this.context.eventService.viewport2Canvas(n.viewport),l=o.x,c=o.y;return n.canvas.x=l,n.canvas.y=c,n.global.copyFrom(n.canvas),n.offset.copyFrom(n.canvas),n.nativeEvent=e,n.type=e.type,n}},{key:"transferMouseData",value:function(e,n){e.isTrusted=n.isTrusted,e.srcElement=n.srcElement,e.timeStamp=qm.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-1,l=0,c=a.length;l1&&arguments[1]!==void 0?arguments[1]:!1;if(e.isConnected){var i=e.rBushNode;i.aabb&&this.rBush.remove(i.aabb);var a=e.getRenderBounds();if(a){var s=e.renderable;n&&(s.dirtyRenderBounds||(s.dirtyRenderBounds=new Vt),s.dirtyRenderBounds.update(a.center,a.halfExtents));var o=a.getMin(),l=dt(o,2),c=l[0],u=l[1],h=a.getMax(),d=dt(h,2),f=d[0],g=d[1];i.aabb||(i.aabb={}),i.aabb.displayObject=e,i.aabb.minX=c,i.aabb.minY=u,i.aabb.maxX=f,i.aabb.maxY=g}if(i.aabb&&!isNaN(i.aabb.maxX)&&!isNaN(i.aabb.maxX)&&!isNaN(i.aabb.minX)&&!isNaN(i.aabb.minY))return i.aabb}}},{key:"syncRTree",value:function(){var e=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!(!n&&(this.syncing||this.syncTasks.size===0))){this.syncing=!0;var i=[],a=new Set,s=function(l){if(!a.has(l)&&l.renderable){var c=e.syncNode(l,n);c&&(i.push(c),a.add(l))}};this.syncTasks.forEach(function(o,l){o&&l.forEach(s);for(var c=l;c;)s(c),c=c.parentElement}),this.rBush.load(i),i.length=0,this.syncing=!1}}}])}();IC.tag="Prepare";var Mn=function(r){return r.READY="ready",r.BEFORE_RENDER="beforerender",r.RERENDER="rerender",r.AFTER_RENDER="afterrender",r.BEFORE_DESTROY="beforedestroy",r.AFTER_DESTROY="afterdestroy",r.RESIZE="resize",r.DIRTY_RECTANGLE="dirtyrectangle",r.RENDERER_CHANGED="rendererchanged",r}({}),gb=500,O4=.1,A4=1e3,Rl=new we(xt.MOUNTED),Ll=new we(xt.UNMOUNTED),qd=new we(Mn.BEFORE_RENDER),vb=new we(Mn.RERENDER),Gd=new we(Mn.AFTER_RENDER),Hm=function(r){function t(e){var n;V(this,t),n=mt(this,t),n.Element=Zt,n.inited=!1,n.context={};var i=e.container,a=e.canvas,s=e.renderer,o=e.width,l=e.height,c=e.background,u=e.cursor,h=e.supportsMutipleCanvasesInOneContainer,d=e.cleanUpOnDestroy,f=d===void 0?!0:d,g=e.offscreenCanvas,v=e.devicePixelRatio,p=e.requestAnimationFrame,m=e.cancelAnimationFrame,y=e.createImage,b=e.supportsTouchEvents,w=e.supportsPointerEvents,x=e.isTouchEvent,S=e.isMouseEvent,E=e.dblClickSpeed,_=o,C=l,k=v||Qy&&window.devicePixelRatio||1;return k=k>=1?Math.ceil(k):1,a&&(_=o||sI(a)||a.width/k,C=l||oI(a)||a.height/k),n.customElements=new M4,n.devicePixelRatio=k,n.requestAnimationFrame=p??t1.bind(U.globalThis),n.cancelAnimationFrame=m??TC.bind(U.globalThis),n.supportsTouchEvents=b??"ontouchstart"in U.globalThis,n.supportsPointerEvents=w??!!U.globalThis.PointerEvent,n.isTouchEvent=x??function(M){return n.supportsTouchEvents&&M instanceof U.globalThis.TouchEvent},n.isMouseEvent=S??function(M){return!U.globalThis.MouseEvent||M instanceof U.globalThis.MouseEvent&&(!n.supportsPointerEvents||!(M instanceof U.globalThis.PointerEvent))},g&&(U.offscreenCanvas=g),n.document=new RC,n.document.defaultView=n,h||nI(i,n,f),n.initRenderingContext(vt(vt({},e),{},{width:_,height:C,background:c??"transparent",cursor:u??"default",cleanUpOnDestroy:f,devicePixelRatio:k,requestAnimationFrame:n.requestAnimationFrame,cancelAnimationFrame:n.cancelAnimationFrame,supportsTouchEvents:n.supportsTouchEvents,supportsPointerEvents:n.supportsPointerEvents,isTouchEvent:n.isTouchEvent,isMouseEvent:n.isMouseEvent,dblClickSpeed:E??200,createImage:y??function(){return new window.Image}})),n.initDefaultCamera(_,C,s.clipSpaceNearZ),n.initRenderer(s,!0),n}return pt(t,r),W(t,[{key:"initRenderingContext",value:function(n){this.context.config=n,this.context.renderingContext={root:this.document.documentElement,renderListCurrentFrame:[],unculledEntities:[],renderReasons:new Set,force:!1,dirty:!1}}},{key:"initDefaultCamera",value:function(n,i,a){var s=this,o=new U.CameraContribution;o.clipSpaceNearZ=a,o.setType(It.EXPLORING,Lm.DEFAULT).setPosition(n/2,i/2,gb).setFocalPoint(n/2,i/2,0).setOrthographic(n/-2,n/2,i/2,i/-2,O4,A4),o.canvas=this,o.eventEmitter.on(rC.UPDATED,function(){s.context.renderingContext.renderReasons.add(Es.CAMERA_CHANGED),U.enableSizeAttenuation&&s.getConfig().renderer.getConfig().enableSizeAttenuation&&s.updateSizeAttenuation()}),this.context.camera=o}},{key:"updateSizeAttenuation",value:function(){var n=this.getCamera().getZoom();this.document.documentElement.forEach(function(i){U.styleValueRegistry.updateSizeAttenuation(i,n)})}},{key:"getConfig",value:function(){return this.context.config}},{key:"getRoot",value:function(){return this.document.documentElement}},{key:"getCamera",value:function(){return this.context.camera}},{key:"getContextService",value:function(){return this.context.contextService}},{key:"getEventService",value:function(){return this.context.eventService}},{key:"getRenderingService",value:function(){return this.context.renderingService}},{key:"getRenderingContext",value:function(){return this.context.renderingContext}},{key:"getStats",value:function(){return this.getRenderingService().getStats()}},{key:"ready",get:function(){var n=this;return this.readyPromise||(this.readyPromise=new Promise(function(i){n.resolveReadyPromise=function(){i(n)}}),this.inited&&this.resolveReadyPromise()),this.readyPromise}},{key:"destroy",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,i=arguments.length>1?arguments[1]:void 0;ke.clearCache(),i||this.dispatchEvent(new we(Mn.BEFORE_DESTROY)),this.frameId&&this.cancelAnimationFrame(this.frameId);var a=this.getRoot();n&&(this.unmountChildren(a),this.document.destroy(),this.getEventService().destroy()),this.getRenderingService().destroy(),this.getContextService().destroy(),this.context.rBushRoot&&this.context.rBushRoot.clear(),i||this.dispatchEvent(new we(Mn.AFTER_DESTROY));var s=function(l){l.currentTarget=null,l.manager=null,l.target=null,l.relatedNode=null};s(Rl),s(Ll),s(qd),s(vb),s(Gd),s(br),s(Wm),s(Vm),s(NC)}},{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,gb).setFocalPoint(n/2,i/2,0),o===jn.ORTHOGRAPHIC?s.setOrthographic(n/-2,n/2,i/2,i/-2,s.getNear(),s.getFar()):s.setAspect(n/i),this.dispatchEvent(new we(Mn.RESIZE,{width:n,height:i}))}},{key:"appendChild",value:function(n,i){return this.document.documentElement.appendChild(n,i)}},{key:"insertBefore",value:function(n,i){return this.document.documentElement.insertBefore(n,i)}},{key:"removeChild",value:function(n){return this.document.documentElement.removeChild(n)}},{key:"removeChildren",value:function(){this.document.documentElement.removeChildren()}},{key:"destroyChildren",value:function(){this.document.documentElement.destroyChildren()}},{key:"render",value:function(n){var i=this;n&&(qd.detail=n,Gd.detail=n),this.dispatchEvent(qd);var a=this.getRenderingService();a.render(this.getConfig(),n,function(){i.dispatchEvent(vb)}),this.dispatchEvent(Gd)}},{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 iD,this.context.renderingPlugins=[],this.context.renderingPlugins.push(new DC,new IC,new LC([new T4])),this.loadRendererContainerModule(n),this.context.contextService=new this.context.ContextService(vt(vt({},U),this.context)),this.context.renderingService=new qI(U,this.context),this.context.eventService=new jI(U,this.context),this.context.eventService.init(),this.context.contextService.init?(this.context.contextService.init(),this.initRenderingService(n,a,!0)):this.context.contextService.initAsync().then(function(){i.initRenderingService(n,a)}).catch(function(s){console.error(s)})}},{key:"initRenderingService",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.context.renderingService.init(function(){i.inited=!0,a?s?i.requestAnimationFrame(function(){i.dispatchEvent(new we(Mn.READY))}):i.dispatchEvent(new we(Mn.READY)):i.dispatchEvent(new we(Mn.RENDERER_CHANGED)),i.readyPromise&&i.resolveReadyPromise(),a||i.getRoot().forEach(function(o){var l=o,c=l.renderable;c&&(c.renderBoundsDirty=!0,c.boundsDirty=!0,c.dirty=!0)}),i.mountChildren(i.getRoot()),n.getConfig().enableAutoRendering&&i.run()})}},{key:"loadRendererContainerModule",value:function(n){var i=this,a=n.getPlugins();a.forEach(function(s){s.context=i.context,s.init(U)})}},{key:"setRenderer",value:function(n){var i=this.getConfig();if(i.renderer!==n){var a=i.renderer;i.renderer=n,this.destroy(!1,!0),Ut((a==null?void 0:a.getPlugins())||[]).reverse().forEach(function(s){s.destroy(U)}),this.initRenderer(n)}}},{key:"setCursor",value:function(n){var i=this.getConfig();i.cursor=n,this.getContextService().applyCursorStyle(n)}},{key:"unmountChildren",value:function(n){var i=this;n.childNodes.forEach(function(a){i.unmountChildren(a)}),this.inited&&(n.isMutationObserved?n.dispatchEvent(Ll):(Ll.target=n,this.dispatchEvent(Ll,!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]:ru(n);this.inited?n.isConnected||(n.ownerDocument=this.document,n.isConnected=!0,a||(n.isMutationObserved?n.dispatchEvent(Rl):(Rl.target=n,this.dispatchEvent(Rl,!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})}}])}(PC);/*! * @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 P4=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a90)return this;this.computeMatrix()}return this._getAxes(),this.type===It.ORBITING||this.type===It.EXPLORING?this._getPosition():this.type===It.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(n,i){var a=en(n,i,0),s=zr(this.position);return Fi(s,s,Wc(St(),this.right,a[0])),Fi(s,s,Wc(St(),this.up,a[1])),this._setPosition(s),this.triggerUpdate(),this}},{key:"dolly",value:function(n){var i=this.forward,a=zr(this.position),s=n*this.dollyingStep,o=this.distance+n*this.dollyingStep;return s=Math.max(Math.min(o,this.maxDistance),this.minDistance)-this.distance,a[0]+=s*i[0],a[1]+=s*i[1],a[2]+=s*i[2],this._setPosition(a),this.type===It.ORBITING||this.type===It.EXPLORING?this._getDistance():this.type===It.TRACKING&&Fi(this.focalPoint,a,this.distanceVector),this.triggerUpdate(),this}},{key:"cancelLandmarkAnimation",value:function(){this.landmarkAnimationID!==void 0&&this.canvas.cancelAnimationFrame(this.landmarkAnimationID)}},{key:"createLandmark",value:function(n){var i,a,s,o,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=l.position,u=c===void 0?this.position:c,h=l.focalPoint,d=h===void 0?this.focalPoint:h,f=l.roll,g=l.zoom,v=new U.CameraContribution;v.setType(this.type,void 0),v.setPosition(u[0],(i=u[1])!==null&&i!==void 0?i:this.position[1],(a=u[2])!==null&&a!==void 0?a:this.position[2]),v.setFocalPoint(d[0],(s=d[1])!==null&&s!==void 0?s:this.focalPoint[1],(o=d[2])!==null&&o!==void 0?o:this.focalPoint[2]),v.setRoll(f??this.roll),v.setZoom(g??this.zoom);var p={name:n,matrix:wM(v.getWorldTransform()),right:zr(v.right),up:zr(v.up),forward:zr(v.forward),position:zr(v.getPosition()),focalPoint:zr(v.getFocalPoint()),distanceVector:zr(v.getDistanceVector()),distance:v.getDistance(),dollyingStep:v.getDollyingStep(),azimuth:v.getAzimuth(),elevation:v.getElevation(),roll:v.getRoll(),relAzimuth:v.relAzimuth,relElevation:v.relElevation,relRoll:v.relRoll,zoom:v.getZoom()};return this.landmarks.push(p),p}},{key:"gotoLandmark",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=Tt(n)?this.landmarks.find(function(M){return M.name===n}):n;if(s){var o=nt(a)?{duration:a}:a,l=o.easing,c=l===void 0?"linear":l,u=o.duration,h=u===void 0?100:u,d=o.easingFunction,f=d===void 0?void 0:d,g=o.onfinish,v=g===void 0?void 0:g,p=o.onframe,m=p===void 0?void 0:p,y=.01;this.cancelLandmarkAnimation();var b=s.position,w=s.focalPoint,x=s.zoom,S=s.roll,E=f||U.EasingFunction(c),_,C=function(){i.setFocalPoint(w),i.setPosition(b),i.setRoll(S),i.setZoom(x),i.computeMatrix(),i.triggerUpdate(),v==null||v()};if(h===0)return C();var k=function(T){_===void 0&&(_=T);var O=T-_;if(O>=h){C();return}var R=E(O/h),L=St(),D=St(),P=1,A=0;Sm(L,i.focalPoint,w,R),Sm(D,i.position,b,R),A=i.roll*(1-R)+S*R,P=i.zoom*(1-R)+x*R,i.setFocalPoint(L),i.setPosition(D),i.setRoll(A),i.setZoom(P);var I=k2(L,w)+k2(D,b);if(I<=y&&x===void 0&&S===void 0)return C();i.computeMatrix(),i.triggerUpdate(),O0&&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 Wd(null,this,this.currentTime,null);setTimeout(function(){e.oncancel(n)})}}},{key:"reverse",value:function(){this.updatePromises();var e=this.currentTime;this.playbackRate*=-1,this.play(),e!==null&&(this.currentTime=e),this.updatePromises()}},{key:"updatePlaybackRate",value:function(e){this.playbackRate=e}},{key:"targetAnimations",value:function(){var e,n=(e=this.effect)===null||e===void 0?void 0:e.target;return n.getAnimations()}},{key:"markTarget",value:function(){var e=this.targetAnimations();e.indexOf(this)===-1&&e.push(this)}},{key:"unmarkTarget",value:function(){var e=this.targetAnimations(),n=e.indexOf(this);n!==-1&&e.splice(n,1)}},{key:"tick",value:function(e,n){!this._idle&&!this._paused&&(this._startTime===null?n&&(this.startTime=e-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((e-this._startTime)*this.playbackRate)),n&&(this.currentTimePending=!1,this.fireEvents(e))}},{key:"rewind",value:function(){if(this.playbackRate>=0)this.currentTime=0;else if(this._totalDuration<1/0)this.currentTime=this._totalDuration;else throw new Error("Unable to rewind negative playback rate animation with infinite duration")}},{key:"persist",value:function(){throw new Error(Ft)}},{key:"addEventListener",value:function(e,n,i){throw new Error(Ft)}},{key:"removeEventListener",value:function(e,n,i){throw new Error(Ft)}},{key:"dispatchEvent",value:function(e){throw new Error(Ft)}},{key:"commitStyles",value:function(){throw new Error(Ft)}},{key:"ensureAlive",value:function(){if(this.playbackRate<0&&this.currentTime===0){var e;this._inEffect=!!((e=this.effect)!==null&&e!==void 0&&e.update(-1))}else{var n;this._inEffect=!!((n=this.effect)!==null&&n!==void 0&&n.update(this.currentTime))}!this._inTimeline&&(this._inEffect||!this._finishedFlag)&&(this._inTimeline=!0,this.timeline.animations.push(this))}},{key:"tickCurrentTime",value:function(e,n){e!==this._currentTime&&(this._currentTime=e,this._isFinished&&!n&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this.ensureAlive())}},{key:"fireEvents",value:function(e){var n=this;if(this._isFinished){if(!this._finishedFlag){if(this.onfinish){var i=new Wd(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 Wd(null,this,this.currentTime,e);this.onframe(a)}this._finishedFlag=!1}}}])}(),L4=4,D4=.001,I4=1e-7,F4=10,io=11,Dl=1/(io-1),B4=typeof Float32Array=="function",FC=function(t,e){return 1-3*e+3*t},BC=function(t,e){return 3*e-6*t},zC=function(t){return 3*t},au=function(t,e,n){return((FC(e,n)*t+BC(e,n))*t+zC(e))*t},$C=function(t,e,n){return 3*FC(e,n)*t*t+2*BC(e,n)*t+zC(e)},z4=function(t,e,n,i,a){var s,o,l=0;do o=e+(n-e)/2,s=au(o,i,a)-t,s>0?n=o:e=o;while(Math.abs(s)>I4&&++l=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=B4?new Float32Array(io):new Array(io),s=0;s=D4?$4(c,g,t,n):v===0?g:z4(c,u,u+Dl,t,n)};return function(l){return l===0||l===1?l:au(o(l),e,i)}},j4=function(t){return t=t.replace(/([A-Z])/g,function(e){return"-".concat(e.toLowerCase())}),t.charAt(0)==="-"?t.substring(1):t},Il=function(t){return Math.pow(t,2)},Fl=function(t){return Math.pow(t,3)},Bl=function(t){return Math.pow(t,4)},zl=function(t){return Math.pow(t,5)},$l=function(t){return Math.pow(t,6)},jl=function(t){return 1-Math.cos(t*Math.PI/2)},ql=function(t){return 1-Math.sqrt(1-t*t)},Gl=function(t){return t*t*(3*t-2)},Wl=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)},Vl=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=dt(e,2),i=n[0],a=i===void 0?1:i,s=n[1],o=s===void 0?.5:s,l=ce(Number(a),1,10),c=ce(Number(o),.1,2);return t===0||t===1?t:-l*Math.pow(2,10*(t-1))*Math.sin((t-1-c/(Math.PI*2)*Math.asin(1/l))*(Math.PI*2)/c)},Xs=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,i=dt(e,4),a=i[0],s=a===void 0?1:a,o=i[1],l=o===void 0?100:o,c=i[2],u=c===void 0?10:c,h=i[3],d=h===void 0?0:h;s=ce(s,.1,1e3),l=ce(l,.1,1e3),u=ce(u,.1,1e3),d=ce(d,.1,1e3);var f=Math.sqrt(l/s),g=u/(2*Math.sqrt(l*s)),v=g<1?f*Math.sqrt(1-g*g):0,p=1,m=g<1?(g*f+-d)/v:-d+f,y=n?n*t/1e3:t;return g<1?y=Math.exp(-y*g*f)*(p*Math.cos(v*y)+m*Math.sin(v*y)):y=(p+m*y)*Math.exp(-y*f),t===0||t===1?t:1-y},Vd=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=e,i=dt(n,2),a=i[0],s=a===void 0?10:a,o=i[1],l=o==="start"?Math.ceil:Math.floor;return l(ce(t,0,1)*s)/s},pb=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=dt(e,4),i=n[0],a=n[1],s=n[2],o=n[3];return r1(i,a,s,o)(t)},Hl=r1(.42,0,1,1),Fn=function(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return 1-t(1-e,n,i)}},Bn=function(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return e<.5?t(e*2,n,i)/2:1-t(e*-2+2,n,i)/2}},zn=function(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return e<.5?(1-t(1-e*2,n,i))/2:(t(e*2-1,n,i)+1)/2}},mb={steps:Vd,"step-start":function(t){return Vd(t,[1,"start"])},"step-end":function(t){return Vd(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":pb,ease:function(t){return pb(t,[.25,.1,.25,1])},in:Hl,out:Fn(Hl),"in-out":Bn(Hl),"out-in":zn(Hl),"in-quad":Il,"out-quad":Fn(Il),"in-out-quad":Bn(Il),"out-in-quad":zn(Il),"in-cubic":Fl,"out-cubic":Fn(Fl),"in-out-cubic":Bn(Fl),"out-in-cubic":zn(Fl),"in-quart":Bl,"out-quart":Fn(Bl),"in-out-quart":Bn(Bl),"out-in-quart":zn(Bl),"in-quint":zl,"out-quint":Fn(zl),"in-out-quint":Bn(zl),"out-in-quint":zn(zl),"in-expo":$l,"out-expo":Fn($l),"in-out-expo":Bn($l),"out-in-expo":zn($l),"in-sine":jl,"out-sine":Fn(jl),"in-out-sine":Bn(jl),"out-in-sine":zn(jl),"in-circ":ql,"out-circ":Fn(ql),"in-out-circ":Bn(ql),"out-in-circ":zn(ql),"in-back":Gl,"out-back":Fn(Gl),"in-out-back":Bn(Gl),"out-in-back":zn(Gl),"in-bounce":Wl,"out-bounce":Fn(Wl),"in-out-bounce":Bn(Wl),"out-in-bounce":zn(Wl),"in-elastic":Vl,"out-elastic":Fn(Vl),"in-out-elastic":Bn(Vl),"out-in-elastic":zn(Vl),spring:Xs,"spring-in":Xs,"spring-out":Fn(Xs),"spring-in-out":Bn(Xs),"spring-out-in":zn(Xs)},q4=function(t){return j4(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()},G4=function(t){return mb[q4(t)]||mb.linear},W4=function(t){return t},V4=1,H4=.5,yb=0;function bb(r,t){return function(e){if(e>=1)return 1;var n=1/r;return e+=t*n,e-e%n}}var Ul="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",U4=new RegExp("cubic-bezier\\(".concat(Ul,",").concat(Ul,",").concat(Ul,",").concat(Ul,"\\)")),Y4=/steps\(\s*(\d+)\s*\)/,X4=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function i1(r){var t=U4.exec(r);if(t)return r1.apply(void 0,Ut(t.slice(1).map(Number)));var e=Y4.exec(r);if(e)return bb(Number(e[1]),yb);var n=X4.exec(r);return n?bb(Number(n[1]),{start:V4,middle:H4,end:yb}[n[2]]):G4(r)}function K4(r){return Math.abs(Z4(r)/(r.playbackRate||1))}function Z4(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 jC=0,a1=1,Fu=2,qC=3;function J4(r,t,e){if(t===null)return jC;var n=e.endTime;return t=Math.min(e.delay+r+e.endDelay,n)?Fu:qC}function Q4(r,t,e,n,i){switch(n){case a1:return t==="backwards"||t==="both"?0:null;case qC:return e-i;case Fu:return t==="forwards"||t==="both"?r:null;case jC:return null}}function t8(r,t,e,n,i){var a=i;return r===0?t!==a1&&(a+=e):a+=n/r,a}function e8(r,t,e,n,i,a){var s=r===1/0?t%1:r%1;return s===0&&e===Fu&&n!==0&&(i!==0||a===0)&&(s=1),s}function n8(r,t,e,n){return r===Fu&&t===1/0?1/0:e===1?Math.floor(n)-1:Math.floor(n)}function r8(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 i8(r,t,e){var n=J4(r,t,e),i=Q4(r,e.fill,t,n,e.delay);if(i===null)return null;var a=e.duration==="auto"?0:e.duration,s=t8(a,n,e.iterations,i,e.iterationStart),o=e8(s,e.iterationStart,n,e.iterations,i,a),l=n8(n,e.iterations,o,s),c=r8(e.direction,l,o);return e.currentIteration=l,e.progress=c,e.easingFunction(c)}function a8(r,t,e){var n=s8(r,t),i=o8(n,e);return function(a,s){if(s!==null)i.filter(function(l){return s>=l.applyFrom&&s1)throw new Error("Keyframe offsets must be between 0 and 1.");c.computedOffset=h}}else if(u==="composite"&&["replace","add","accumulate","auto"].indexOf(h)===-1)throw new Error("".concat(h," compositing is not supported"));c[u]=h}return c.offset===void 0&&(c.offset=null),c.easing===void 0&&(c.easing=(t==null?void 0:t.easing)||"linear"),c.composite===void 0&&(c.composite="auto"),c}),n=!0,i=-1/0,a=0;a=0&&Number(l.offset)<=1});function o(){var l,c=e,u=c.length;if(e[u-1].computedOffset=Number((l=e[u-1].offset)!==null&&l!==void 0?l:1),u>1){var h;e[0].computedOffset=Number((h=e[0].offset)!==null&&h!==void 0?h:0)}for(var d=0,f=Number(e[0].computedOffset),g=1;g{console.debug(Xr(r))},info:r=>{console.info(Xr(r))},warn:r=>{console.warn(Xr(r))},error:r=>{console.error(Xr(r))}};function VC(r){const{theme:t}=r;if(!t)return{};const e=ri(Yr.THEME,t);return e||(Ar.warn(`The theme of ${t} is not registered.`),{})}function s1(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 Ym(r){const t=r.reduce((n,i)=>(Object.entries(i).forEach(([a,s])=>{n[a]===void 0?n[a]=[s]:n[a].push(s)}),n),{});Object.entries(t).forEach(([n,i])=>{(i.length!==r.length||i.some(a=>ot(a))||i.every(a=>!["sourceNode","targetNode","childrenNode"].includes(n)&&ue(a,i[0])))&&delete t[n]});const e=Object.entries(t).reduce((n,[i,a])=>(a.forEach((s,o)=>{n[o]?n[o][i]=s:n[o]={[i]:s}}),n),[]);return r.length!==0&&e.length===0&&e.push({_:0},{_:0}),e}function No(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 HC(r,t){const{animation:e}=r;if(e===!1||t===!1)return!1;const n=Object.assign({},y8);return me(e)&&Object.assign(n,e),me(t)&&Object.assign(n,t),n}function E8(r){if(typeof r=="string"){const t=ri(Yr.ANIMATION,r);return t||(Ar.warn(`The animation of ${r} is not registered.`),[])}return r}function S8(r,t,e,n){var i,a;const{animation:s}=r;if(s===!1||n===!1)return[];const o=(i=r==null?void 0:r[t])===null||i===void 0?void 0:i.animation;if(o===!1)return[];const l=o==null?void 0:o[e];if(l===!1)return[];const c=(a=VC(r)[t])===null||a===void 0?void 0:a.animation,u=(d=[])=>E8(d).map(f=>Object.assign(Object.assign(Object.assign(Object.assign({},b8),me(s)&&s),f),me(n)&&n));if(l)return u(l);if(!c)return[];const h=c[e];return h===!1?[]:u(h)}function UC(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{if(!e.length)return null;const[n,i]=t,a=c=>{var u;if(c){const h=r.getShape(c);if(!h)return null;const d=`get${Yc(c)}Style`,f=((u=r==null?void 0:r[d])===null||u===void 0?void 0:u.bind(r))||(p=>p),g=(f==null?void 0:f(n))||{},v=(f==null?void 0:f(i))||{};return{shape:h,fromStyle:g,toStyle:v}}else return{shape:r,fromStyle:n,toStyle:i}};let s;const o=e.map(c=>{var{fields:u,shape:h,states:d}=c,f=_8(c,["fields","shape","states"]);const g=a(h);if(!g)return null;const{shape:v,fromStyle:p,toStyle:m}=g,y=[{},{}];if(u.forEach(w=>{var x,S;Object.assign(y[0],{[w]:(x=p[w])!==null&&x!==void 0?x:No(w)}),Object.assign(y[1],{[w]:(S=m[w])!==null&&S!==void 0?S:No(w)})}),y.some(w=>Object.keys(w).some(x=>["x","y","z"].includes(x)))){const{x:w=0,y:x=0,z:S,transform:E=""}=v.attributes||{};y.forEach(_=>{var C,k,M;_.transform=UC((C=_.x)!==null&&C!==void 0?C:w,(k=_.y)!==null&&k!==void 0?k:x,(M=_.z)!==null&&M!==void 0?M:S,E)})}const b=v.animate(Ym(y),f);return h===void 0&&(s=b),b}).filter(Boolean),l=s||(o==null?void 0:o[0]);return l?s1(l,o.filter(c=>c!==c)):null},M8=[{fields:["opacity"]}],C8=[{fields:["x","y"]}],YC=[{fields:["x","y"]}],T8=YC,XC=[{fields:["sourceNode","targetNode"]}],O8=XC,KC=[{fields:["childrenNode","x","y"]}],A8=KC;function P8(r){return"source"in r&&"target"in r}function N8(r){return r.length===2}function As(r){return r instanceof Float32Array?!0:Array.isArray(r)&&(r.length===2||r.length===3)?r.every(t=>typeof t=="number"):!1}function Or(r,t,e){return r>=t&&r<=e}function Pr(r=0){if(Array.isArray(r)){const[t=0,e=t,n=t,i=e]=r;return[t,e,n,i]}return[r,r,r,r]}function R8(r=0){const t=Pr(r);return t[0]+t[2]}function Nr(r){return r.max[0]-r.min[0]}function Rr(r){return r.max[1]-r.min[1]}function ta(r){return[Nr(r),Rr(r)]}function Ai(r,t){const e=As(r)?o1(r):r.getShape("key").getBounds();return t?ea(e,t):e}function o1(r){const[t,e,n=0]=r,i=new Vt;return i.setMinMax([t,e,n],[t,e,n]),i}function ea(r,t){const[e,n,i,a]=Pr(t),[s,o,l]=r.min,[c,u,h]=r.max,d=new Vt;return d.setMinMax([s-a,o-e,l],[c+n,u+i,h]),d}function Jo(r){if(r.length===0)return new Vt;if(r.length===1)return r[0];const t=new Vt;t.setMinMax(r[0].min,r[0].max);for(let e=1;e=s&&i<=l&&n>=o&&a<=c}function cr(r,t){return Or(r[0],t.min[0],t.max[0])&&Or(r[1],t.min[1],t.max[1])}function ZC(r,t,e=!1){const{min:[n,i],max:[a,s]}=t,o=(r[1]===i||r[1]===s)&&(e||Or(r[0],n,a)),l=(r[0]===n||r[0]===a)&&(e||Or(r[1],i,s));return o||l}function D8(r,t){return!cr(r,t)}function ou(r,t){const{center:e}=t;return r[0]===e[0]&&r[1]===e[1]}function Eo(r,t){const[e,n]=r,[i,a]=t.min,[s,o]=t.max,l=e-i,c=s-e,u=n-a,h=o-n,d=Math.min(l,c,u,h);return d===l?"left":d===c?"right":d===u?"top":d===h?"bottom":"left"}function Ta(r,t){const e=Vi(r);if(cr(r,t))switch(Eo(r,t)){case"left":e[0]=t.min[0];break;case"right":e[0]=t.max[0];break;case"top":e[1]=t.min[1];break;case"bottom":e[1]=t.max[1];break}else{const[n,i]=r,[a,s]=t.min,[o,l]=t.max;e[0]=Or(n,a,o)?n:nu[w.id]+M?(u[k]=u[w.id]+M,h[k]=[w.id]):u[k]===u[w.id]+M&&h[k].push(w.id)})},g=0;g0&&i>e;){a=0;for(var v=0;v0&&(d+=g[x]/S)}f[m]=n*d,a+=f[m]}}a=(1-a)/h,i=0;for(var v=0;v=this.maxStep},r.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},r.prototype.push=function(t){this.linkedList.prepend(t),this.length>this.maxStep&&this.linkedList.deleteTail()},r.prototype.pop=function(){var t=this.linkedList.deleteHead();return t?t.value:null},r.prototype.toArray=function(){return this.linkedList.toArray().map(function(t){return t.value})},r.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},r})();function F(r){if(r.id!==void 0)return r.id;if(r.source!==void 0&&r.target!==void 0)return`${r.source}-${r.target}`;throw new Error(Xr("The datum does not have available id."))}function Xl(r){return r.combo}function nT(r,t){const e={nodes:(r.nodes||[]).map(F),edges:(r.edges||[]).map(F),combos:(r.combos||[]).map(F)};return t?Object.values(e).flat():e}const rT=(r,t,e)=>{var n;switch(e.type){case"degree":{const i=new Map;return(n=r.nodes)===null||n===void 0||n.forEach(a=>{const s=t(F(a),e.direction).length;i.set(F(a),s)}),i}case"betweenness":return t9(r,e.directed,e.weightPropertyName);case"closeness":return e9(r,e.directed,e.weightPropertyName);case"eigenvector":return r9(r,e.directed);case"pagerank":return n9(r,e.epsilon,e.linkProb);default:return iT(r)}},iT=r=>{var t;const e=new Map;return(t=r.nodes)===null||t===void 0||t.forEach(n=>{e.set(F(n),0)}),e},t9=(r,t,e)=>{const n=iT(r),{nodes:i=[]}=r;return i.forEach(a=>{i.forEach(s=>{if(a!==s){const{allPath:o}=eT(r,F(a),F(s),t,e),l=o.length;o.flat().forEach(c=>{c!==F(a)&&c!==F(s)&&n.set(c,n.get(c)+1/l)})}})}),n},e9=(r,t,e)=>{const n=new Map,{nodes:i=[]}=r;return i.forEach(a=>{const s=i.reduce((o,l)=>{if(a!==l){const{length:c}=eT(r,F(a),F(l),t,e);o+=c}return o},0);n.set(F(a),1/s)}),n},n9=(r,t,e)=>{var n;const i=new Map,a=Q8(r,t,e);return(n=r.nodes)===null||n===void 0||n.forEach(s=>{i.set(F(s),a[F(s)])}),i},r9=(r,t)=>{const{nodes:e=[]}=r,n=i9(r,t),i=a9(n,e.length),a=new Map;return e.forEach((s,o)=>{a.set(F(s),i[o])}),a},i9=(r,t)=>{const{nodes:e=[],edges:n=[]}=r,i=Array(e.length).fill(null).map(()=>Array(e.length).fill(0));return n.forEach(({source:a,target:s})=>{const o=e.findIndex(c=>F(c)===a),l=e.findIndex(c=>F(c)===s);t?i[o][l]=1:(i[o][l]=1,i[l][o]=1)}),i},a9=(r,t,e=100,n=1e-6)=>{let i=Array(t).fill(1),a=1/0;for(let s=0;sn;s++){const o=Array(t).fill(0);for(let c=0;cc+u*u,0));for(let c=0;cc+(u-i[h])*u,0)),i=o}return i};function zi(r,t,e,n=ue){const i=new Map(r.map(d=>[e(d),d])),a=new Map(t.map(d=>[e(d),d])),s=new Set(i.keys()),o=new Set(a.keys()),l=[],c=[],u=[],h=[];return o.forEach(d=>{s.has(d)?n(i.get(d),a.get(d))?h.push(a.get(d)):c.push(a.get(d)):l.push(a.get(d))}),s.forEach(d=>{o.has(d)||u.push(i.get(d))}),{enter:l,exit:u,keep:h,update:c}}function Ba(r,t,e){const n=i=>{e&&!e(i)||(i.style.visibility=t)};r.forEach(i=>{n(i)})}function s9(r,t,e){const n={},i=a=>(a in n||(n[a]=0),`${t}-${a}-${n[a]++}`);return e.map(a=>typeof a=="string"?{type:a,key:i(a)}:typeof a=="function"?a.call(r):a.key?a:Object.assign(Object.assign({},a),{key:i(a.type)}))}class c1{constructor(t){this.extensions=[],this.extensionMap={},this.context=t}setExtensions(t){const e=s9(this.context.graph,this.category,t),{enter:n,update:i,exit:a,keep:s}=zi(this.extensions,e,o=>o.key);this.createExtensions(n),this.updateExtensions([...i,...s]),this.destroyExtensions(a),this.extensions=e}createExtension(t){const{category:e}=this,{key:n,type:i}=t,a=ri(e,i);if(!a)return Ar.warn(`The extension ${i} of ${e} is not registered.`);const s=new a(this.context,t);this.extensionMap[n]=s}createExtensions(t){t.forEach(e=>this.createExtension(e))}updateExtension(t){const{key:e}=t,n=this.extensionMap[e];n&&n.update(t)}updateExtensions(t){t.forEach(e=>this.updateExtension(e))}destroyExtension(t){const e=this.extensionMap[t];e&&(e.destroy(),delete this.extensionMap[t])}destroyExtensions(t){t.forEach(({key:e})=>this.destroyExtension(e))}destroy(){Object.values(this.extensionMap).forEach(t=>t.destroy()),this.context={},this.extensions=[],this.extensionMap={}}}class u1{constructor(t,e){this.events=[],this.destroyed=!1,this.context=t,this.options=e}update(t){this.options=Object.assign(this.options,t)}destroy(){this.context={},this.options={},this.destroyed=!0}}class xn extends u1{}class Bu extends xn{constructor(t,e){super(t,Object.assign({},Bu.defaultOptions,e)),this.isOverlapping=(n,i)=>i.some(a=>n.intersects(a)),this.occupiedBounds=[],this.detectLabelCollision=n=>{const i=this.context.viewport,a={show:[],hide:[]};return this.occupiedBounds=[],n.forEach(s=>{const o=s.getShape("label").getRenderBounds();i.isInViewport(o,!0)&&!this.isOverlapping(o,this.occupiedBounds)?(a.show.push(s),this.occupiedBounds.push(ea(o,this.options.padding))):a.hide.push(s)}),a},this.hideLabelIfExceedViewport=(n,i)=>{const{exit:a}=zi(n,i,s=>s.id);a==null||a.forEach(this.hideLabel)},this.nodeCentralities=new Map,this.sortNodesByCentrality=(n,i)=>{const{model:a}=this.context,s=a.getData(),o=a.getRelatedEdgesData.bind(a);return n.map(c=>(this.nodeCentralities.has(c.id)||(this.nodeCentralities=rT(s,o,i)),{node:c,centrality:this.nodeCentralities.get(c.id)})).sort((c,u)=>u.centrality-c.centrality).map(c=>c.node)},this.sortLabelElementsInView=n=>{const{sort:i,sortNode:a,sortCombo:s,sortEdge:o}=this.options,{model:l}=this.context;if(at(i))return n.sort((v,p)=>i(l.getElementDataById(v.id),l.getElementDataById(p.id)));const{node:c=[],edge:u=[],combo:h=[]}=Nu(n,v=>v.type),d=at(s)?h.sort((v,p)=>s(...l.getComboData([v.id,p.id]))):h,f=at(a)?c.sort((v,p)=>a(...l.getNodeData([v.id,p.id]))):this.sortNodesByCentrality(c,a),g=at(o)?u.sort((v,p)=>o(...l.getEdgeData([v.id,p.id]))):u;return[...d,...f,...g]},this.labelElementsInView=[],this.isFirstRender=!0,this.onToggleVisibility=n=>{var i;if(((i=n.data)===null||i===void 0?void 0:i.stage)==="zIndex")return;if(!this.validate(n)){this.hiddenElements.size>0&&(this.hiddenElements.forEach(this.showLabel),this.hiddenElements.clear());return}const a=this.isFirstRender?this.getLabelElements():this.getLabelElementsInView();this.hideLabelIfExceedViewport(this.labelElementsInView,a),this.labelElementsInView=a;const s=this.sortLabelElementsInView(this.labelElementsInView),{show:o,hide:l}=this.detectLabelCollision(s);for(let c=o.length-1;c>=0;c--)this.showLabel(o[c]);l.forEach(this.hideLabel)},this.hiddenElements=new Map,this.hideLabel=n=>{const i=n.getShape("label");i&&Ba(i,"hidden"),this.hiddenElements.set(n.id,n)},this.showLabel=n=>{const i=n.getShape("label");i&&Ba(i,"visible"),n.toFront(),this.hiddenElements.delete(n.id)},this.onTransform=WM(this.onToggleVisibility,this.options.throttle,{leading:!0}),this.enableToggle=!0,this.toggle=n=>{this.enableToggle&&this.onToggleVisibility(n)},this.onBeforeRender=()=>{this.enableToggle=!1},this.onAfterRender=n=>{this.onToggleVisibility(n),this.enableToggle=!0},this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents(),this.onToggleVisibility({})}getLabelElements(){const{elementMap:t}=this.context.element,e=[];for(const n in t){const i=t[n];i.isVisible()&&i.getShape("label")&&e.push(i)}return e}getLabelElementsInView(){const t=this.context.viewport;return this.getLabelElements().filter(e=>t.isInViewport(e.getShape("key").getRenderBounds()))}bindEvents(){const{graph:t}=this.context;t.on(X.BEFORE_RENDER,this.onBeforeRender),t.on(X.AFTER_RENDER,this.onAfterRender),t.on(X.AFTER_DRAW,this.toggle),t.on(X.AFTER_LAYOUT,this.toggle),t.on(X.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:t}=this.context;t.off(X.BEFORE_RENDER,this.onBeforeRender),t.off(X.AFTER_RENDER,this.onAfterRender),t.off(X.AFTER_DRAW,this.toggle),t.off(X.AFTER_LAYOUT,this.toggle),t.off(X.AFTER_TRANSFORM,this.onTransform)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return at(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}Bu.defaultOptions={enable:!0,throttle:100,padding:0,sortNode:{type:"degree"}};const kb=[0,0,0];function ft(r,t){return r.map((e,n)=>e+t[n])}function $t(r,t){return r.map((e,n)=>e-t[n])}function Gr(r,t){return typeof t=="number"?r.map(e=>e*t):r.map((e,n)=>e*t[n])}function ur(r,t){return typeof t=="number"?r.map(e=>e/t):r.map((e,n)=>e/t[n])}function o9(r,t){return r.reduce((e,n,i)=>e+n*t[i],0)}function l9(r,t){const e=Ro(r),n=Ro(t);return[e[1]*n[2]-e[2]*n[1],e[2]*n[0]-e[0]*n[2],e[0]*n[1]-e[1]*n[0]]}function Pi(r,t){return r.map(e=>e*t)}function Kt(r,t){return Math.sqrt(r.reduce((e,n,i)=>e+Math.pow(n-t[i]||0,2),0))}function lu(r,t){return r.reduce((e,n,i)=>e+Math.abs(n-t[i]),0)}function ti(r){const t=r.reduce((e,n)=>e+Math.pow(n,2),0);return r.map(e=>e/Math.sqrt(t))}function h1(r,t,e=!1){const n=r[0]*t[1]-r[1]*t[0];let i=Math.acos(Gr(r,t).reduce((a,s)=>a+s,0)/(Kt(r,kb)*Kt(t,kb)));return e&&n<0&&(i=2*Math.PI-i),i}function zu(r,t=!0){return t?[-r[1],r[0]]:[r[1],-r[0]]}function c9(r,t){return r.map(e=>e%t)}function za(r){return[r[0],r[1]]}function Ro(r){return N8(r)?[r[0],r[1],0]:r}function aT(r){const[t,e]=r;return!t&&!e?0:Math.atan2(e,t)}function sT(r,t){const[e,n]=r,[i,a]=t,s=$t(e,n),o=$t(i,a);return l9(s,o).every(l=>l===0)}function d1(r,t,e=!1){if(sT(r,t))return;const[n,i]=r,[a,s]=t,o=((n[0]-a[0])*(a[1]-s[1])-(n[1]-a[1])*(a[0]-s[0]))/((n[0]-i[0])*(a[1]-s[1])-(n[1]-i[1])*(a[0]-s[0])),l=s[0]-a[0]?(n[0]-a[0]+o*(i[0]-n[0]))/(s[0]-a[0]):(n[1]-a[1]+o*(i[1]-n[1]))/(s[1]-a[1]);if(!(!e&&(!Or(o,0,1)||!Or(l,0,1))))return[n[0]+o*(i[0]-n[0]),n[1]+o*(i[1]-n[1])]}function oT(r){if(Array.isArray(r))return Or(r[0],0,1)&&Or(r[1],0,1)?r:[.5,.5];const t=r.split("-"),e=t.includes("left")?0:t.includes("right")?1:.5,n=t.includes("top")?0:t.includes("bottom")?1:.5;return[e,n]}function ye(r){const{x:t=0,y:e=0,z:n=0}=r.style||{};return[+t,+e,+n]}function u9(r){const{x:t,y:e,z:n}=r.style||{};return t!==void 0||e!==void 0||n!==void 0}function h9(r,t){const[e,n]=t,{min:i,max:a}=r;return[i[0]+e*(a[0]-i[0]),i[1]+n*(a[1]-i[1])]}function Wr(r,t="center"){const e=oT(t);return h9(r,e)}function Ge(r){var t;return[r.x,r.y,(t=r.z)!==null&&t!==void 0?t:0]}function sr(r){var t;return{x:r[0],y:r[1],z:(t=r[2])!==null&&t!==void 0?t:0}}function Ks(r,t=0){return r.map(e=>parseFloat(e.toFixed(t)))}function $i(r,t,e,n=!1){if(ue(r,t))return r;const i=n?$t(r,t):$t(t,r),a=ti(i),s=[a[0]*e,a[1]*e];return ft(za(r),s)}function lT(r,t){return r[1]===t[1]}function d9(r,t){return r[0]===t[0]}function f9(r,t){return lT(r,t)||d9(r,t)}function cT(r,t,e){return sT([r,t],[t,e])}function uT(r,t){return[2*t[0]-r[0],2*t[1]-r[1]]}function hT(r,t,e,n=!0,i=!1){for(let a=0;aa!=f>a&&i<(d-u)*(a-h)/(f-h)+u&&(s=!s)}return s}function v9(r,t,e=!1){const n=Wr(t,"center"),i=[Wr(t,"left-top"),Wr(t,"right-top"),Wr(t,"right-bottom"),Wr(t,"left-bottom")];return hT(r,n,i,!1,e).point}function $u(r,t,e=!1){const n=t.center,i=e?uT(r,n):r,a=$t(i,t.center),s=Math.atan2(a[1],a[0]);if(isNaN(s))return n;const o=Nr(t)/2,l=Rr(t)/2,c=n[0]+o*Math.cos(s),u=n[1]+l*Math.sin(s);return[c,u]}function p9(r,t){let e=1/0,n=[r[0],t[0]];return r.forEach(i=>{t.forEach(a=>{const s=Kt(i,a);s{const a=y9(r,i);a1?u=1:u<0&&(u=0);const h=e+u*l,d=n+u*c;return[h,d]}function b9(r){const t=r.reduce((e,n)=>ft(e,n),[0,0]);return ur(t,r.length)}function f1(r,t=!0){const e=b9(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 Mb(r,t){return[r,[r[0],t[1]],t,[t[0],r[1]]]}class w9{constructor(t,e){this.callback=e,this.pointerByTouch=[],this.initialDistance=null,this.emitter=t,this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.bindEvents()}bindEvents(){const{emitter:t}=this;t.on(z.POINTER_DOWN,this.onPointerDown),t.on(z.POINTER_MOVE,this.onPointerMove),t.on(z.POINTER_UP,this.onPointerUp)}updatePointerPosition(t,e,n){const i=this.pointerByTouch.findIndex(a=>a.pointerId===t);i>=0&&(this.pointerByTouch[i]={x:e,y:n,pointerId:t})}onPointerDown(t){const{x:e,y:n}=t.client;if(!(e===void 0||n===void 0)&&(this.pointerByTouch.push({x:e,y:n,pointerId:t.pointerId}),t.pointerType==="touch"&&this.pointerByTouch.length===2)){const i=this.pointerByTouch[0].x-this.pointerByTouch[1].x,a=this.pointerByTouch[0].y-this.pointerByTouch[1].y;this.initialDistance=Math.sqrt(i*i+a*a)}}onPointerMove(t){if(this.pointerByTouch.length!==2||this.initialDistance===null)return;const{x:e,y:n}=t.client;if(e===void 0||n===void 0)return;this.updatePointerPosition(t.pointerId,e,n);const i=this.pointerByTouch[0].x-this.pointerByTouch[1].x,a=this.pointerByTouch[0].y-this.pointerByTouch[1].y,o=Math.sqrt(i*i+a*a)/this.initialDistance;this.callback(t,{scale:(o-1)*5})}onPointerUp(){this.initialDistance=null,this.pointerByTouch=[]}destroy(){this.emitter.off(z.POINTER_DOWN,this.onPointerDown),this.emitter.off(z.POINTER_MOVE,this.onPointerMove),this.emitter.off(z.POINTER_UP,this.onPointerUp)}}const Cb=r=>r.map(t=>Tt(t)?t.toLocaleLowerCase():t);class Rs{constructor(t){this.map=new Map,this.recordKey=new Set,this.onKeyDown=e=>{e!=null&&e.key&&(this.recordKey.add(e.key),this.trigger(e))},this.onKeyUp=e=>{e!=null&&e.key&&this.recordKey.delete(e.key)},this.onWheel=e=>{this.triggerExtendKey(z.WHEEL,e)},this.onDrag=e=>{this.triggerExtendKey(z.DRAG,e)},this.handlePinch=(e,n)=>{this.triggerExtendKey(z.PINCH,Object.assign(Object.assign({},e),n))},this.onFocus=()=>{this.recordKey.clear()},this.emitter=t,this.bindEvents()}bind(t,e){t.length!==0&&(t.includes(z.PINCH)&&!this.pinchHandler&&(this.pinchHandler=new w9(this.emitter,this.handlePinch.bind(this))),this.map.set(t,e))}unbind(t,e){this.map.forEach((n,i)=>{ue(i,t)&&(!e||e===n)&&this.map.delete(i)})}unbindAll(){this.map.clear()}match(t){const e=Cb(Array.from(this.recordKey)).sort(),n=Cb(t).sort();return ue(e,n)}bindEvents(){var t;const{emitter:e}=this;e.on(z.KEY_DOWN,this.onKeyDown),e.on(z.KEY_UP,this.onKeyUp),e.on(z.WHEEL,this.onWheel),e.on(z.DRAG,this.onDrag),(t=globalThis.addEventListener)===null||t===void 0||t.call(globalThis,"focus",this.onFocus)}trigger(t){this.map.forEach((e,n)=>{this.match(n)&&e(t)})}triggerExtendKey(t,e){this.map.forEach((n,i)=>{i.includes(t)&&ue(Array.from(this.recordKey),i.filter(a=>a!==t))&&n(e)})}destroy(){var t,e;this.unbindAll(),this.emitter.off(z.KEY_DOWN,this.onKeyDown),this.emitter.off(z.KEY_UP,this.onKeyUp),this.emitter.off(z.WHEEL,this.onWheel),this.emitter.off(z.DRAG,this.onDrag),(t=this.pinchHandler)===null||t===void 0||t.destroy(),(e=globalThis.removeEventListener)===null||e===void 0||e.call(globalThis,"blur",this.onFocus)}}class Qo extends xn{constructor(t,e){super(t,on({},Qo.defaultOptions,e)),this.shortcut=new Rs(t.graph),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.clearStates=this.clearStates.bind(this),this.bindEvents()}onPointerDown(t){if(!this.validate(t)||!this.isKeydown()||this.startPoint)return;const{canvas:e,graph:n}=this.context,i=Object.assign({},this.options.style);this.options.style.lineWidth&&(i.lineWidth=+this.options.style.lineWidth/n.getZoom()),this.rectShape=new Be({id:"g6-brush-select",style:i}),e.appendChild(this.rectShape),this.startPoint=[t.canvas.x,t.canvas.y]}onPointerMove(t){var e;if(!this.startPoint)return;const{immediately:n,mode:i}=this.options;this.endPoint=cu(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(Mb(this.startPoint,this.endPoint))}onPointerUp(t){if(this.startPoint){if(!this.endPoint){this.clearBrush();return}this.endPoint=cu(t),this.updateElementsStates(Mb(this.startPoint,this.endPoint)),this.clearBrush()}}clearStates(){this.endPoint||this.clearElementsStates()}clearElementsStates(){const{graph:t}=this.context,e=Object.values(t.getData()).reduce((n,i)=>Object.assign({},n,i.reduce((a,s)=>(a[F(s)]=[],a),{})),{});t.setElementState(e,this.options.animation)}updateElementsStates(t){const{graph:e}=this.context,{enableElements:n,state:i,mode:a,onSelect:s}=this.options,o=this.selector(e,t,n);let l={};switch(a){case"union":o.forEach(c=>{l[c]=[...e.getElementState(c),i]});break;case"diff":o.forEach(c=>{const u=e.getElementState(c);l[c]=u.includes(i)?u.filter(h=>h!==i):[...u,i]});break;case"intersect":o.forEach(c=>{const u=e.getElementState(c);l[c]=u.includes(i)?[i]:[]});break;case"default":default:o.forEach(c=>{l[c]=[i]});break}at(s)&&(l=s(l)),e.setElementState(l,this.options.animation)}selector(t,e,n){if(!n||n.length===0)return[];const i=[],a=t.getData();if(n.forEach(s=>{a[`${s}s`].forEach(o=>{const l=F(o);t.getElementVisibility(l)!=="hidden"&&g9(t.getElementPosition(l),e)&&i.push(l)})}),n.includes("edge")){const s=a.edges;s==null||s.forEach(o=>{const{source:l,target:c}=o;i.includes(l)&&i.includes(c)&&i.push(F(o))})}return i}clearBrush(){var t;(t=this.rectShape)===null||t===void 0||t.remove(),this.rectShape=void 0,this.startPoint=void 0,this.endPoint=void 0}isKeydown(){const{trigger:t}=this.options,e=Array.isArray(t)?t:[t];return this.shortcut.match(e.filter(n=>n!=="drag"))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return at(e)?e(t):!!e}bindEvents(){const{graph:t}=this.context;t.on(z.POINTER_DOWN,this.onPointerDown),t.on(z.POINTER_MOVE,this.onPointerMove),t.on(z.POINTER_UP,this.onPointerUp),t.on(ni.CLICK,this.clearStates)}unbindEvents(){const{graph:t}=this.context;t.off(z.POINTER_DOWN,this.onPointerDown),t.off(z.POINTER_MOVE,this.onPointerMove),t.off(z.POINTER_UP,this.onPointerUp),t.off(ni.CLICK,this.clearStates)}update(t){this.unbindEvents(),this.options=on(this.options,t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}Qo.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 cu=r=>[r.canvas.x,r.canvas.y],ii=.8,$a=["node","edge","combo"];function Oa(r,t,e,n,i=0){n==="TB"&&t(r,i);const a=e(r);if(a)for(const s of a)Oa(s,t,e,n,i+1);n==="BT"&&t(r,i)}function x9(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 fT(r,t,e,n,i="both"){if(t==="combo"||t==="node")return Hd(r,e,n,i);const a=r.getEdgeData(e);if(!a)return[];const s=Hd(r,a.source,n-1,i),o=Hd(r,a.target,n-1,i);return Array.from(new Set([...s,...o,e]))}function Hd(r,t,e,n="both"){const i=new Set,a=new Set,s=new Set;return x9(t,(o,l)=>{l>e||(s.add(o),r.getRelatedEdgesData(o,n).forEach(c=>{const u=F(c);!a.has(u)&&lr.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 Ud(r){return r.states||[]}var Kl=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class ju extends xn{constructor(t,e){super(t,Object.assign({},ju.defaultOptions,e)),this.onClickSelect=n=>Kl(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=>Kl(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 Rs(t.graph),this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),$a.forEach(e=>{t.on(`${e}:${z.CLICK}`,this.onClickSelect)}),t.on(ni.CLICK,this.onClickCanvas)}get isMultipleSelect(){const{multiple:t,trigger:e}=this.options;return t&&this.shortcut.match(e)}getNeighborIds(t){const{target:e,targetType:n}=t,{graph:i}=this.context,{degree:a}=this.options;return fT(i,n,e.id,typeof a=="function"?a(t):a).filter(s=>s!==e.id)}updateState(t){return Kl(this,void 0,void 0,function*(){const{state:e,unselectedState:n,neighborState:i,animation:a}=this.options;if(!e&&!i&&!n)return;const{target:s}=t,{graph:o}=this.context,l=o.getElementData(s.id),c=Ud(l).includes(e)?"unselect":"select",u={},h=this.isMultipleSelect,d=[s.id],f=this.getNeighborIds(t);if(h)if(Object.assign(u,this.getDataStates()),c==="select"){const g=(v,p)=>{v.forEach(m=>{const y=new Set(o.getElementState(m));y.add(p),y.delete(n),u[m]=Array.from(y)})};g(d,e),g(f,i),n&&Object.keys(u).forEach(v=>{const p=u[v];!p.includes(e)&&!p.includes(i)&&!p.includes(n)&&u[v].push(n)})}else{const g=u[s.id];u[s.id]=g.filter(v=>v!==e&&v!==i),g.includes(n)||u[s.id].push(n),f.forEach(v=>{u[v]=u[v].filter(p=>p!==i),u[v].includes(e)||u[v].push(n)})}else if(c==="select"){Object.assign(u,this.getClearStates(!!n));const g=(v,p)=>{v.forEach(m=>{u[m]||(u[m]=o.getElementState(m)),u[m].push(p)})};g(d,e),g(f,i),n&&Object.keys(u).forEach(v=>{!d.includes(v)&&!f.includes(v)&&u[v].push(n)})}else Object.assign(u,this.getClearStates());yield o.setElementState(u,a)})}getDataStates(){const{graph:t}=this.context,{nodes:e,edges:n,combos:i}=t.getData(),a={};return[...e,...n,...i].forEach(s=>{a[F(s)]=Ud(s)}),a}getClearStates(t=!1){const{graph:e}=this.context,{state:n,unselectedState:i,neighborState:a}=this.options,s=new Set([n,i,a]),{nodes:o,edges:l,combos:c}=e.getData(),u={};return[...o,...l,...c].forEach(h=>{const d=Ud(h),f=d.filter(g=>!s.has(g));(t||f.length!==d.length)&&(u[F(h)]=f)}),u}clearState(){return Kl(this,void 0,void 0,function*(){const{graph:t}=this.context;yield t.setElementState(this.getClearStates(),this.options.animation)})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return at(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;$a.forEach(e=>{t.off(`${e}:${z.CLICK}`,this.onClickSelect)}),t.off(ni.CLICK,this.onClickCanvas)}destroy(){this.unbindEvents(),super.destroy()}}ju.defaultOptions={animation:!0,enable:!0,multiple:!1,trigger:["shift"],state:"selected",neighborState:"selected",unselectedState:void 0,degree:0};function mn(r){var t;return!!(!((t=r.style)===null||t===void 0)&&t.collapsed)}function uu(r,t){if(!r.startsWith(t))return!1;const e=r[t.length];return e>="A"&&e<="Z"}function E9(r,t){return`${t}${Yc(r)}`}function S9(r,t,e=!0){if(!t||!uu(r,t))return r;const n=r.slice(t.length);return e?ZL(n):n}function Se(r,t){const e=Object.entries(r).reduce((n,[i,a])=>(i==="className"||i==="class"||uu(i,t)&&Object.assign(n,{[S9(i,t)]:a}),n),{});if("opacity"in r){const n=E9("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 Xm(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 gT(r,t){const e=typeof t=="string"?[t]:t,n={};return Object.keys(r).forEach(i=>{e.find(a=>i.startsWith(a))||(n[i]=r[i])}),n}function Nn(r=0){if(typeof r=="number")return[r,r,r];const[t,e=t,n=t]=r;return[t,e,n]}var _9=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);itypeof a=="function"?[i,a.call(n,e)]:[i,a]))}function $e(r,t){const e=(r==null?void 0:r.style)||{},n=(t==null?void 0:t.style)||{};for(const i in e)i in n||(n[i]=e[i]);return Object.assign({},r,t,{style:n})}function k9(r){const{x:t,y:e,z:n,class:i,className:a,transform:s,transformOrigin:o,zIndex:l,visibility:c}=r;return _9(r,["x","y","z","class","className","transform","transformOrigin","zIndex","visibility"])}function M9(r,t){const e=Nn(r);let n={};return t.text&&!t.fontSize&&(n={fontSize:Math.min(...e)*.5}),t.src&&(!t.width||!t.height)&&(n={width:e[0]*.5,height:e[1]*.5}),n}function Ob(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 C9(r,t){if(!t)return{};const{type:e,color:n,field:i,invert:a}=t,s=l=>{const c=typeof n=="string"?ri("palette",n):n;if(typeof c=="function"){const u={};return l.forEach(([h,d])=>{u[h]=c(a?1-d:d)}),u}else if(Array.isArray(c)){const u=a?[...c].reverse():c,h={};return l.forEach(([d,f])=>{h[d]=u[f%c.length]}),h}return{}},o=(l,c)=>{var u;return typeof l=="string"?(u=c.data)===null||u===void 0?void 0:u[l]:l==null?void 0:l(c)};if(e==="group"){const l=Nu(r,d=>{if(!i)return"default";const f=o(i,d);return f?String(f):"default"}),c=Object.keys(l),u=s(c.map((d,f)=>[d,f])),h={};return Object.entries(l).forEach(([d,f])=>{f.forEach(g=>{h[F(g)]=u[d]})}),h}else if(e==="value"){const[l,c]=r.reduce(([h,d],f)=>{const g=o(i,f);if(typeof g!="number")throw new Error(Xr(`Palette field ${i} is not a number`));return[Math.min(h,g),Math.max(d,g)]},[1/0,-1/0]),u=c-l;return s(r.map(h=>[h.id,(o(i,h)-l)/u]))}}function vT(r){const t=typeof r=="string"?ri("palette",r):r;if(typeof t!="function")return t}function pT(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 mT(r,t,e=1,n=!1){const i=n?e:1,a=(r.max[0]-r.min[0])*i;return pT(a,t)}function T9(r,t,e=1){const n=Kt(r[0],r[1])*e;return pT(n,t)}class tl extends n1{constructor(t){Ab(t.style),super(t),this.shapeMap={},this.animateMap={},this.render(this.attributes,this),this.setVisibility(),this.bindEvents()}get parsedAttributes(){return this.attributes}upsert(t,e,n,i,a){var s,o,l,c,u,h,d,f;const g=this.shapeMap[t];if(n===!1){g&&((s=a==null?void 0:a.beforeDestroy)===null||s===void 0||s.call(a,g),i.removeChild(g),delete this.shapeMap[t],(o=a==null?void 0:a.afterDestroy)===null||o===void 0||o.call(a,g));return}const v=typeof e=="string"?ri(Yr.SHAPE,e):e;if(!v)throw new Error(Xr(`Shape ${e} not found`));if(!g||g.destroyed||!(g instanceof v)){g&&((l=a==null?void 0:a.beforeDestroy)===null||l===void 0||l.call(a,g),g==null||g.destroy(),(c=a==null?void 0:a.afterDestroy)===null||c===void 0||c.call(a,g)),(u=a==null?void 0:a.beforeCreate)===null||u===void 0||u.call(a);const p=new v({className:t,style:n});return i.appendChild(p),this.shapeMap[t]=p,(h=a==null?void 0:a.afterCreate)===null||h===void 0||h.call(a,p),p}return(d=a==null?void 0:a.beforeUpdate)===null||d===void 0||d.call(a,g),ry(g,n),(f=a==null?void 0:a.afterUpdate)===null||f===void 0||f.call(a,g),g}update(t={}){const e=Object.assign({},this.attributes,t);Ab(e),SF(this,e),this.render(e,this),this.setVisibility()}bindEvents(){}getGraphicStyle(t){return k9(t)}get compositeShapes(){return[["badges","badge-"],["ports","port-"]]}animate(t,e){if(t.length===0)return null;const n=[];if(t[0].x!==void 0||t[0].y!==void 0||t[0].z!==void 0){const{x:a=0,y:s=0,z:o=0}=this.attributes;t.forEach(l=>{const{x:c=a,y:u=s,z:h=o}=l;Object.assign(l,{transform:h?[["translate3d",c,u,h]]:[["translate",c,u]]})})}const i=super.animate(t,e);if(i&&(Yd(this,i),n.push(i)),Array.isArray(t)&&t.length>0){const a=["transform","transformOrigin","x","y","z","zIndex"];if(Object.keys(t[0]).some(s=>!a.includes(s))){Object.entries(this.shapeMap).forEach(([o,l])=>{const c=`get${Yc(o)}Style`,u=this[c];if(at(u)){const h=t.map(f=>u.call(this,Object.assign(Object.assign({},this.attributes),f))),d=l.animate(Ym(h),e);d&&(Yd(l,d),n.push(d))}});const s=(o,l)=>{if(!wr(o)){const c=`get${Yc(l)}Style`,u=this[c];if(at(u)){const h=t.map(d=>u.call(this,Object.assign(Object.assign({},this.attributes),d)));Object.entries(h[0]).map(([d])=>{const f=h.map(v=>v[d]),g=o[d];if(g){const v=g.animate(Ym(f),e);v&&(Yd(g,v),n.push(v))}})}}};this.compositeShapes.forEach(([o,l])=>{const c=Xm(this.shapeMap,l);s(c,o)})}}return s1(n)}getShape(t){return this.shapeMap[t]}setVisibility(){const{visibility:t}=this.attributes;Ba(this,t)}destroy(){this.shapeMap={},this.animateMap={},super.destroy()}}function Yd(r,t){t==null||t.finished.then(()=>{const e=r.activeAnimations.findIndex(n=>n===t);e>-1&&r.activeAnimations.splice(e,1)})}function Ab(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=UC(t,e,n,i);a&&(r.transform=a)}return r}var O9=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{e.push([i===0?"M":"L",...n])}),t&&e.push(["Z"]),e}const Pb={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 P9(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 Pb?n=a:t.unshift(a),i={type:n},Pb[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 N9(r){const t=[];return(typeof r=="string"?P9(r):r).forEach(n=>{const i=n[0];if(i==="Z"){t.push(t[0]);return}if(i!=="A")for(let a=1;a{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{const p=g,m=u[(v+1)%u.length];return ue(p,m)?null:[p,m]}).filter(Boolean),d=m9([o,l],h),f=dT([o,l],d);if(f&&d&&(c.transform=[["translate",f[0]+e,f[1]+n]],s)){const g=Math.atan((d[0][1]-d[1][1])/(d[0][0]-d[1][0]));c.transform.push(["rotate",g/Math.PI*180]),c.textAlign="center",(t==="right"||t==="left")&&(g>0?c.textBaseline=t==="right"?"bottom":"top":c.textBaseline=t==="right"?"top":"bottom")}return c}var L9=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!=null&&n.children.length&&n.children.forEach(i=>{t.push(i),e(i)})};return e(r),t}function I9(r){const t=[];let e=r.parentNode;for(;e;)t.push(e),e=e.parentNode;return t}let g1=class extends Zo{constructor(t){super(t),this.onMounted=()=>{this.handleRadius()},this.onAttrModified=()=>{this.handleRadius()},us=this,this.isMutationObserved=!0,this.addEventListener(xt.MOUNTED,this.onMounted),this.addEventListener(xt.ATTR_MODIFIED,this.onAttrModified)}handleRadius(){const{radius:t,clipPath:e,width:n=0,height:i=0}=this.attributes;if(t&&n&&i){const[a,s]=this.getBounds().min,o={x:a,y:s,radius:t,width:n,height:i};if(e)Object.assign(this.parsedStyle.clipPath.style,o);else{const l=new Be({style:o});this.style.clipPath=l}}else e&&(this.style.clipPath=null)}};const Km=new WeakMap;let us=null;const v1=r=>{if(us&&I9(us).includes(r)){const t=Km.get(r);t?t.includes(us)||t.push(us):Km.set(r,[us])}},p1=r=>{const t=Km.get(r);t&&t.forEach(e=>e.handleRadius())};class bT extends tl{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()?g1:Qi,this.getIconStyle(t),e)}}class wT extends tl{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 Zl=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{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=Zl(t,["badges","badgePalette","opacity"]),c=vT(s),u=Se(this.getGraphicStyle(l),"badge");return a.forEach((h,d)=>{i[d]=Object.assign(Object.assign({backgroundFill:c?c[d%(c==null?void 0:c.length)]:void 0,opacity:o},u),this.getBadgeStyle(h))}),i}getBadgeStyle(t){const e=this.getShape("key"),{placement:n="top",offsetX:i,offsetY:a}=t,s=Zl(t,["placement","offsetX","offsetY"]),o=Ub(e.getLocalBounds(),n,i,a,!0);return Object.assign(Object.assign({},o),s)}getPortsStyle(t){var e;const n=this.getPorts(),i={};if(Object.keys(n).forEach(o=>{i[o]=!1}),t.port===!1||!(!((e=t.ports)===null||e===void 0)&&e.length))return i;const a=Se(this.getGraphicStyle(t),"port"),{ports:s=[]}=t;return s.forEach((o,l)=>{const c=o.key||l,u=Object.assign(Object.assign({},a),o);if(jT(u))i[c]=!1;else{const[h,d]=this.getPortXY(t,o);i[c]=Object.assign({transform:[["translate",h,d]]},u)}}),i}getPortXY(t,e){const{placement:n="left"}=e,i=this.getShape("key");return x1(F9(this.context,i),n)}getPorts(){return Xm(this.shapeMap,"port-")}getCenter(){return this.getShape("key").getBounds().center}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return v9(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",bT,n,e),v1(this)}drawBadgeShapes(t,e){const n=this.getBadgesStyle(t);Object.keys(n).forEach(i=>{const a=n[i];this.upsert(`badge-${i}`,ei,a,e)})}drawPortShapes(t,e){const n=this.getPortsStyle(t);Object.keys(n).forEach(i=>{const a=n[i],s=`port-${i}`;this.upsert(s,li,a,e)})}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",na,n,e)}_drawKeyShape(t,e){return this.drawKeyShape(t,e)}render(t=this.parsedAttributes,e=this){this._drawKeyShape(t,e),this.getShape("key")&&(this.drawHaloShape(t,e),this.drawIconShape(t,e),this.drawBadgeShapes(t,e),this.drawLabelShape(t,e),this.drawPortShapes(t,e))}update(t){super.update(t),t&&("x"in t||"y"in t||"z"in t)&&p1(this)}onframe(){this.drawBadgeShapes(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this)}}Xn.defaultStyleProps={x:0,y:0,size:32,droppable:!0,draggable:!0,port:!0,ports:[],portZIndex:2,portLinkToCenter:!1,badge:!0,badges:[],badgeZIndex:3,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloStrokeOpacity:.25,haloPointerEvents:"none",haloZIndex:-1,icon:!0,iconZIndex:1,label:!0,labelIsBillboard:!0,labelMaxWidth:"200%",labelPlacement:"bottom",labelWordWrap:!1,labelZIndex:0};function F9(r,t){if(!r)return t.getLocalBounds();const e=r.canvas.getLayer(),n=t.cloneNode();Ba(n,"hidden"),e.appendChild(n);const i=n.getLocalBounds();return n.destroy(),i}let nl=class xT extends Xn{constructor(t){super($e({style:xT.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",li,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t);return Object.assign(Object.assign({},e),{r:Math.min(...this.getSize(t))/2})}getIconStyle(t){const e=super.getIconStyle(t),{r:n}=this.getShape("key").attributes,i=n*2*ii;return e?Object.assign({width:i,height:i},e):!1}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return $u(t,n,e)}};nl.defaultStyleProps={size:32};class qu extends Xn{constructor(t){super(t)}get parsedAttributes(){return this.attributes}drawKeyShape(t,e){return this.upsert("key",Wa,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 hT(t,s,a,!0,e).point}}class B9 extends qu{constructor(t){super(t)}getPoints(t){const[e,n]=this.getSize(t);return xF(e,n)}}var z9=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);int(h)?{value:h}:h),a=Se(this.getGraphicStyle(t),"donut"),s=vT(t.donutPalette);if(!s)return;const o=i.reduce((h,d)=>{var f;return h+((f=d.value)!==null&&f!==void 0?f:0)},0),l=this.parseOuterR(),c=this.parseInnerR();let u=0;i.forEach((h,d)=>{const{value:f=0,color:g=s[d%s.length]}=h,v=z9(h,["value","color"]),p=(o===0?1/i.length:f/o)*360;this.upsert(`round${d}`,Tn,Object.assign(Object.assign(Object.assign({},a),{d:q9(l,c,u,u+p),fill:g}),v),e),u+=p})}render(t,e=this){super.render(t,e),this.drawDonutShape(t,e)}}Gu.defaultStyleProps={innerR:"50%",donuts:[],donutPalette:"tableau"};const Jl=(r,t,e,n)=>[r+Math.sin(n)*e,t-Math.cos(n)*e],$9=(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"]],j9=(r,t,e,n,i,a)=>{const[s,o]=[i/360*2*Math.PI,a/360*2*Math.PI],l=[Jl(r,t,n,s),Jl(r,t,e,s),Jl(r,t,e,o),Jl(r,t,n,o)],c=o-s>Math.PI?1:0;return[["M",l[0][0],l[0][1]],["L",l[1][0],l[1][1]],["A",e,e,0,c,1,l[2][0],l[2][1]],["L",l[3][0],l[3][1]],["A",n,n,0,c,0,l[0][0],l[0][1]],["Z"]]},q9=(r=0,t=0,e,n)=>{const[i,a]=[0,0];return Math.abs(e-n)%360<1e-6?$9(i,a,r,t):j9(i,a,r,t,e,n)};class Wu extends Xn{constructor(t){super($e({style:Wu.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",Xo,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,i]=this.getSize(t);return Object.assign(Object.assign({},e),{rx:n/2,ry:i/2})}getIconStyle(t){const e=super.getIconStyle(t),{rx:n,ry:i}=this.getShape("key").attributes,a=Math.min(+n,+i)*2*ii;return e?Object.assign({width:a,height:a},e):!1}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return $u(t,n,e)}}Wu.defaultStyleProps={size:[45,35]};class G9 extends qu{constructor(t){super(t)}getOuterR(t){return t.outerR||Math.min(...this.getSize(t))/2}getPoints(t){return _F(this.getOuterR(t))}getIconStyle(t){const e=super.getIconStyle(t),n=this.getOuterR(t)*ii;return e?Object.assign({width:n,height:n},e):!1}}/*! * @antv/g-plugin-canvas-path-generator * @description A G plugin of path generator with Canvas2D API * @version 2.1.16 * @date 1/23/2025, 8:32:57 AM * @author AntVis * @docs https://g.antv.antgroup.com/ */function W9(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 V9(r,t){var e=t.cx,n=e===void 0?0:e,i=t.cy,a=i===void 0?0:i,s=t.rx,o=t.ry;if(r.ellipse)r.ellipse(n,a,s,o,0,0,Math.PI*2,!1);else{var l=s>o?s:o,c=s>o?1:s/o,u=s>o?o/s:1;r.save(),r.scale(c,u),r.arc(n,a,l,0,Math.PI*2)}}function H9(r,t){var e=t.x1,n=t.y1,i=t.x2,a=t.y2,s=t.markerStart,o=t.markerEnd,l=t.markerStartOffset,c=t.markerEndOffset,u=0,h=0,d=0,f=0,g=0,v,p;s&&Ct(s)&&l&&(v=i-e,p=a-n,g=Math.atan2(p,v),u=Math.cos(g)*(l||0),h=Math.sin(g)*(l||0)),o&&Ct(o)&&c&&(v=e-i,p=n-a,g=Math.atan2(p,v),d=Math.cos(g)*(c||0),f=Math.sin(g)*(c||0)),r.moveTo(e+u,n+h),r.lineTo(i+d,a+f)}function U9(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.d,o=s.absolutePath,l=s.segments,c=0,u=0,h=0,d=0,f=0,g,v;if(e&&Ct(e)&&i){var p=e.parentNode.getStartTangent(),m=dt(p,2),y=m[0],b=m[1];g=y[0]-b[0],v=y[1]-b[1],f=Math.atan2(v,g),c=Math.cos(f)*(i||0),u=Math.sin(f)*(i||0)}if(n&&Ct(n)&&a){var w=n.parentNode.getEndTangent(),x=dt(w,2),S=x[0],E=x[1];g=S[0]-E[0],v=S[1]-E[1],f=Math.atan2(v,g),h=Math.cos(f)*(a||0),d=Math.sin(f)*(a||0)}for(var _=0;_tt?K:tt,Le=K>tt?1:K/tt,cn=K>tt?tt/K:1;r.translate(H,Y),r.rotate(Mt),r.scale(Le,cn),r.arc(0,0,Re,it,_t,!!(1-re)),r.scale(1/Le,1/cn),r.rotate(-Mt),r.translate(-H,-Y)}O&&r.lineTo(C[6]+h,C[7]+d);break}case"Z":r.closePath();break}}}function Y9(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.points.points,o=s.length,l=s[0][0],c=s[0][1],u=s[o-1][0],h=s[o-1][1],d=0,f=0,g=0,v=0,p=0,m,y;e&&Ct(e)&&i&&(m=s[1][0]-s[0][0],y=s[1][1]-s[0][1],p=Math.atan2(y,m),d=Math.cos(p)*(i||0),f=Math.sin(p)*(i||0)),n&&Ct(n)&&a&&(m=s[o-1][0]-s[0][0],y=s[o-1][1]-s[0][1],p=Math.atan2(y,m),g=Math.cos(p)*(a||0),v=Math.sin(p)*(a||0)),r.moveTo(l+(d||g),c+(f||v));for(var b=1;b0?1:-1,f=l>0?1:-1,g=d+f===0,v=s.map(function(x){return ce(x,0,Math.min(Math.abs(c)/2,Math.abs(u)/2))}),p=dt(v,4),m=p[0],y=p[1],b=p[2],w=p[3];r.moveTo(d*m+n,a),r.lineTo(c-d*y+n,a),y!==0&&r.arc(c-d*y+n,f*y+a,y,-f*Math.PI/2,d>0?0:Math.PI,g),r.lineTo(c+n,u-f*b+a),b!==0&&r.arc(c-d*b+n,u-f*b+a,b,d>0?0:Math.PI,f>0?Math.PI/2:1.5*Math.PI,g),r.lineTo(d*w+n,u+a),w!==0&&r.arc(d*w+n,u-f*w+a,w,f>0?Math.PI/2:-Math.PI/2,d>0?Math.PI:0,g),r.lineTo(n,f*m+a),m!==0&&r.arc(d*m+n,f*m+a,m,d>0?Math.PI:0,f>0?Math.PI*1.5:Math.PI/2,g)}}var Z9=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a=l-m&&y<=l+m:!1}function Ql(r,t,e,n){return r/(e*e)+t/(n*n)}function r7(r,t,e){var n=r.parsedStyle,i=n.cx,a=i===void 0?0:i,s=n.cy,o=s===void 0?0:s,l=n.rx,c=n.ry,u=n.fill,h=n.stroke,d=n.lineWidth,f=d===void 0?1:d,g=n.increasedLineWidthForHitTesting,v=g===void 0?0:g,p=n.pointerEvents,m=p===void 0?"auto":p,y=t.x,b=t.y,w=Ga(m,u,h),x=dt(w,2),S=x[0],E=x[1],_=(f+v)/2,C=(y-a)*(y-a),k=(b-o)*(b-o);return S&&E||e?Ql(C,k,l+_,c+_)<=1:S?Ql(C,k,l,c)<=1:E?Ql(C,k,l-_,c-_)>=1&&Ql(C,k,l+_,c+_)<=1:!1}function xa(r,t,e,n,i,a){return i>=r&&i<=r+e&&a>=t&&a<=t+n}function i7(r,t,e,n,i,a,s){var o=i/2;return xa(r-o,t-o,e,i,a,s)||xa(r+e-o,t-o,i,n,a,s)||xa(r+o,t+n-o,e,i,a,s)||xa(r-o,t+o,i,n,a,s)}function tc(r,t,e,n,i,a,s,o){var l=(Math.atan2(o-t,s-r)+Math.PI*2)%(Math.PI*2),c={x:r+e*Math.cos(l),y:t+e*Math.sin(l)};return Qr(c.x,c.y,s,o)<=a/2}function Ni(r,t,e,n,i,a,s){var o=Math.min(r,e),l=Math.max(r,e),c=Math.min(t,n),u=Math.max(t,n),h=i/2;return a>=o-h&&a<=l+h&&s>=c-h&&s<=u+h?Y6(r,t,e,n,a,s)<=i/2:!1}function ST(r,t,e,n,i){var a=r.length;if(a<2)return!1;for(var s=0;s0!=Xd(o[1]-e)>0&&Xd(t-(e-s[1])*(s[0]-o[0])/(s[1]-o[1])-s[0])<0&&(n=!n)}return n}function Nb(r,t,e){for(var n=!1,i=0;i=i.min[0]&&t.y>=i.min[1]&&t.x<=i.max[0]&&t.y<=i.max[1]}var p7=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a0&&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;Kd.length<=0&&Zd.length<=0||(Zd.forEach(function(n){return n()}),Zd=Kd.splice(0,r.TASK_NUM_PER_FRAME),r.rafId=e.requestAnimationFrame(function(){r.executeTask(e)}))}},{key:"sliceImage",value:function(e,n,i,a){for(var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:r.api,l=e.naturalWidth||e.width,c=e.naturalHeight||e.height,u=n-s,h=i-s,d=Math.ceil(l/u),f=Math.ceil(c/h),g={tileSize:[n,i],gridSize:[f,d],tiles:Array(f).fill(null).map(function(){return Array(d).fill(null)})},v=function(y){for(var b=function(S){Kd.push(function(){var E=S*u,_=y*h,C=[Math.min(n,l-E),Math.min(i,c-_)],k=C[0],M=C[1],T=o.createCanvas();T.width=n,T.height=i;var O=T.getContext("2d");O.drawImage(e,E,_,k,M,0,0,k,M),g.tiles[y][S]={x:E,y:_,tileX:S,tileY:y,data:T},a()})},w=0;w_&&O>C,b&&(typeof b.resetTransform=="function"?b.resetTransform():b.setTransform(1,0,0,1,0,0),i.clearFullScreen&&i.clearRect(b,0,0,x*w,S*w,s.background))});var m=function(b,w){for(var x=[b];x.length>0;){var S=x.pop();S.isVisible()&&!S.isCulled()&&(d?i.renderDisplayObjectOptimized(S,w,i.context,pr(i,ve)[ve],n):i.renderDisplayObject(S,w,i.context,pr(i,ve)[ve],n));for(var E=S.sortable.sorted||S.childNodes,_=E.length-1;_>=0;_--)x.push(E[_])}};l.hooks.endFrame.tap(r.tag,function(){if(c.root.childNodes.length===0){i.clearFullScreenLastFrame=!0;return}d=s.renderer.getConfig().enableRenderingOptimization,pr(i,ve)[ve]={restoreStack:[],prevObject:null,currentContext:pr(i,ve)[ve].currentContext},pr(i,ve)[ve].currentContext.clear(),i.clearFullScreenLastFrame=!1;var y=f.getContext(),b=f.getDPR();if(pa(i.dprMatrix,[b,b,1]),Je(i.vpMatrix,i.dprMatrix,o.getOrthoMatrix()),i.clearFullScreen)d?(y.save(),m(c.root,y),y.restore()):m(c.root,y),i.removedRBushNodeAABBs=[];else{var w=i.safeMergeAABB.apply(i,[i.mergeDirtyAABBs(i.renderQueue)].concat(Ut(i.removedRBushNodeAABBs.map(function(K){var tt=K.minX,it=K.minY,_t=K.maxX,Mt=K.maxY,re=new Vt;return re.setMinMax([tt,it,0],[_t,Mt,0]),re}))));if(i.removedRBushNodeAABBs=[],Vt.isEmpty(w)){i.renderQueue=[];return}var x=i.convertAABB2Rect(w),S=x.x,E=x.y,_=x.width,C=x.height,k=Qe(i.vec3a,[S,E,0],i.vpMatrix),M=Qe(i.vec3b,[S+_,E,0],i.vpMatrix),T=Qe(i.vec3c,[S,E+C,0],i.vpMatrix),O=Qe(i.vec3d,[S+_,E+C,0],i.vpMatrix),R=Math.min(k[0],M[0],O[0],T[0]),L=Math.min(k[1],M[1],O[1],T[1]),D=Math.max(k[0],M[0],O[0],T[0]),P=Math.max(k[1],M[1],O[1],T[1]),A=Math.floor(R),I=Math.floor(L),B=Math.ceil(D-R),j=Math.ceil(P-L);y.save(),i.clearRect(y,A,I,B,j,s.background),y.beginPath(),y.rect(A,I,B,j),y.clip(),y.setTransform(i.vpMatrix[0],i.vpMatrix[1],i.vpMatrix[4],i.vpMatrix[5],i.vpMatrix[12],i.vpMatrix[13]);var G=s.renderer.getConfig(),H=G.enableDirtyRectangleRenderingDebug;H&&g.dispatchEvent(new we(Mn.DIRTY_RECTANGLE,{dirtyRect:{x:A,y:I,width:B,height:j}}));var Y=i.searchDirtyObjects(w);Y.sort(function(K,tt){return K.sortable.renderOrder-tt.sortable.renderOrder}).forEach(function(K){K&&K.isVisible()&&!K.isCulled()&&i.renderDisplayObject(K,y,i.context,pr(i,ve)[ve],n)}),y.restore(),i.renderQueue.forEach(function(K){i.saveDirtyAABB(K)}),i.renderQueue=[]}pr(i,ve)[ve].restoreStack.forEach(function(){y.restore()}),pr(i,ve)[ve].restoreStack=[]}),l.hooks.render.tap(r.tag,function(y){i.clearFullScreen||i.renderQueue.push(y)})}},{key:"clearRect",value:function(e,n,i,a,s,o){e.clearRect(n,i,a,s),o&&(e.fillStyle=o,e.fillRect(n,i,a,s))}},{key:"renderDisplayObjectOptimized",value:function(e,n,i,a,s){var o=e.nodeName,l=!1,c=!1,u=this.context.styleRendererFactory[o],h=this.pathGeneratorFactory[o],d=e.parsedStyle.clipPath;if(d){l=!a.prevObject||!xm(d.getWorldTransform(),a.prevObject.getWorldTransform()),l&&(this.applyWorldTransform(n,d),a.prevObject=null);var f=this.pathGeneratorFactory[d.nodeName];f&&(n.save(),c=!0,n.beginPath(),f(n,d.parsedStyle),n.closePath(),n.clip())}if(u){l=!a.prevObject||!xm(e.getWorldTransform(),a.prevObject.getWorldTransform()),l&&this.applyWorldTransform(n,e);var g=!a.prevObject;if(!g){var v=a.prevObject.nodeName;o===$.TEXT?g=v!==$.TEXT:o===$.IMAGE?g=v!==$.IMAGE:g=v===$.TEXT||v===$.IMAGE}u.applyStyleToContext(n,e,g,a),a.prevObject=e}h&&(n.beginPath(),h(n,e.parsedStyle),o!==$.LINE&&o!==$.PATH&&o!==$.POLYLINE&&n.closePath()),u&&u.drawToContext(n,e,pr(this,ve)[ve],this,s),c&&n.restore(),e.renderable.dirty=!1}},{key:"renderDisplayObject",value:function(e,n,i,a,s){var o=e.nodeName,l=a.restoreStack[a.restoreStack.length-1];l&&!(e.compareDocumentPosition(l)&ie.DOCUMENT_POSITION_CONTAINS)&&(n.restore(),a.restoreStack.pop());var c=this.context.styleRendererFactory[o],u=this.pathGeneratorFactory[o],h=e.parsedStyle.clipPath;if(h){this.applyWorldTransform(n,h);var d=this.pathGeneratorFactory[h.nodeName];d&&(n.save(),a.restoreStack.push(e),n.beginPath(),d(n,h.parsedStyle),n.closePath(),n.clip())}c&&(this.applyWorldTransform(n,e),n.save(),this.applyAttributesToContext(n,e)),u&&(n.beginPath(),u(n,e.parsedStyle),o!==$.LINE&&o!==$.PATH&&o!==$.POLYLINE&&n.closePath()),c&&(c.render(n,e.parsedStyle,e,i,this,s),n.restore()),e.renderable.dirty=!1}},{key:"applyAttributesToContext",value:function(e,n){var i=n.parsedStyle,a=i.stroke,s=i.fill,o=i.opacity,l=i.lineDash,c=i.lineDashOffset;l&&e.setLineDash(l),ot(c)||(e.lineDashOffset=c),ot(o)||(e.globalAlpha*=o),!ot(a)&&!Array.isArray(a)&&!a.isNone&&(e.strokeStyle=n.attributes.stroke),!ot(s)&&!Array.isArray(s)&&!s.isNone&&(e.fillStyle=n.attributes.fill)}},{key:"convertAABB2Rect",value:function(e){var n=e.getMin(),i=e.getMax(),a=Math.floor(n[0]),s=Math.floor(n[1]),o=Math.ceil(i[0]),l=Math.ceil(i[1]),c=o-a,u=l-s;return{x:a,y:s,width:c,height:u}}},{key:"mergeDirtyAABBs",value:function(e){var n=new Vt;return e.forEach(function(i){var a=i.getRenderBounds();n.add(a);var s=i.renderable.dirtyRenderBounds;s&&n.add(s)}),n}},{key:"searchDirtyObjects",value:function(e){var n=e.getMin(),i=dt(n,2),a=i[0],s=i[1],o=e.getMax(),l=dt(o,2),c=l[0],u=l[1],h=this.rBush.search({minX:a,minY:s,maxX:c,maxY:u});return h.map(function(d){var f=d.displayObject;return f})}},{key:"saveDirtyAABB",value:function(e){var n=e.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new Vt);var i=e.getRenderBounds();i&&n.dirtyRenderBounds.update(i.center,i.halfExtents)}},{key:"applyWorldTransform",value:function(e,n,i){i?(ks(this.tmpMat4,n.getLocalTransform()),Je(this.tmpMat4,i,this.tmpMat4),Je(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(ks(this.tmpMat4,n.getWorldTransform()),Je(this.tmpMat4,this.vpMatrix,this.tmpMat4)),e.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])}},{key:"safeMergeAABB",value:function(){for(var e=new Vt,n=arguments.length,i=new Array(n),a=0;a0;if(h){if(i||n.attributes.stroke!==a.prevObject.attributes.stroke){var d=!ot(o.stroke)&&!Array.isArray(o.stroke)&&!o.stroke.isNone?n.attributes.stroke:be.strokeStyle;se(e,"strokeStyle",d,a.currentContext)}(i||o.lineWidth!==s.lineWidth)&&se(e,"lineWidth",ot(o.lineWidth)?be.lineWidth:o.lineWidth,a.currentContext),(i||o.lineDash!==s.lineDash)&&se(e,"lineDash",o.lineDash||be.lineDash,a.currentContext),(i||o.lineDashOffset!==s.lineDashOffset)&&se(e,"lineDashOffset",ot(o.lineDashOffset)?be.lineDashOffset:o.lineDashOffset,a.currentContext);for(var f=0;f4&&arguments[4]!==void 0?arguments[4]:!1;if(n){se(e,"shadowColor",be.shadowColor,a.currentContext);for(var o=0;o-1&&se(e,"filter",c.replace(/drop-shadow\([^)]*\)/,"").trim()||be.filter,a.currentContext)}else se(e,"filter",be.filter,a.currentContext)}},{key:"fillToContext",value:function(e,n,i,a,s){var o=this,l=n.parsedStyle,c=l.fill,u=l.fillRule,h=null;if(Array.isArray(c)&&c.length>0)c.forEach(function(f){var g=se(e,"fillStyle",du(f,n,e,o.imagePool),i.currentContext);h=h??g,u?e.fill(u):e.fill()});else{if(Ia(c)){var d=hu(c,n,e,n.ownerDocument.defaultView.context,a,s,this.imagePool);d&&(e.fillStyle=d,h=!0)}u?e.fill(u):e.fill()}h!==null&&se(e,"fillStyle",h,i.currentContext)}},{key:"strokeToContext",value:function(e,n,i,a,s){var o=this,l=n.parsedStyle.stroke,c=null;if(Array.isArray(l)&&l.length>0)l.forEach(function(d){var f=se(e,"strokeStyle",du(d,n,e,o.imagePool),i.currentContext);c=c??f,e.stroke()});else{if(Ia(l)){var u=hu(l,n,e,n.ownerDocument.defaultView.context,a,s,this.imagePool);if(u){var h=se(e,"strokeStyle",u,i.currentContext);c=c??h}}e.stroke()}c!==null&&se(e,"strokeStyle",c,i.currentContext)}},{key:"drawToContext",value:function(e,n,i,a,s){var o,l=n.nodeName,c=n.parsedStyle,u=c.opacity,h=u===void 0?be.globalAlpha:u,d=c.fillOpacity,f=d===void 0?be.fillOpacity:d,g=c.strokeOpacity,v=g===void 0?be.strokeOpacity:g,p=c.lineWidth,m=p===void 0?be.lineWidth:p,y=c.fill&&!c.fill.isNone,b=c.stroke&&!c.stroke.isNone&&m>0;if(!(!y&&!b)){var w=!ot(c.shadowColor)&&c.shadowBlur>0,x=c.shadowType==="inner",S=((o=c.fill)===null||o===void 0?void 0:o.alpha)===0,E=!!(c.filter&&c.filter.length),_=w&&b&&(l===$.PATH||l===$.LINE||l===$.POLYLINE||S||x),C=null;if(y){_||this.applyShadowAndFilterStyleToContext(e,n,w,i);var k=h*f;C=se(e,"globalAlpha",k,i.currentContext),this.fillToContext(e,n,i,a,s),_||this.clearShadowAndFilterStyleForContext(e,w,E,i)}if(b){var M=!1,T=h*v,O=se(e,"globalAlpha",T,i.currentContext);if(C=y?C:O,_&&(this.applyShadowAndFilterStyleToContext(e,n,w,i),M=!0,x)){var R=e.globalCompositeOperation;e.globalCompositeOperation="source-atop",this.strokeToContext(e,n,i,a,s),e.globalCompositeOperation=R,this.clearShadowAndFilterStyleForContext(e,w,E,i,!0)}this.strokeToContext(e,n,i,a,s),M&&this.clearShadowAndFilterStyleForContext(e,w,E,i)}C!==null&&se(e,"globalAlpha",C,i.currentContext)}}}])}(),y1=function(r){function t(){return V(this,t),mt(this,t,arguments)}return pt(t,r),W(t,[{key:"render",value:function(n,i,a,s,o,l){var c=i.fill,u=i.fillRule,h=i.opacity,d=h===void 0?1:h,f=i.fillOpacity,g=f===void 0?1:f,v=i.stroke,p=i.strokeOpacity,m=p===void 0?1:p,y=i.lineWidth,b=y===void 0?1:y,w=i.lineCap,x=i.lineJoin,S=i.shadowType,E=i.shadowColor,_=i.shadowBlur,C=i.filter,k=i.miterLimit,M=c&&!c.isNone,T=v&&!v.isNone&&b>0,O=(c==null?void 0:c.alpha)===0,R=!!(C&&C.length),L=!ot(E)&&_>0,D=a.nodeName,P=S==="inner",A=T&&L&&(D===$.PATH||D===$.LINE||D===$.POLYLINE||O||P);M&&(n.globalAlpha=d*g,A||fu(a,n,L),CT(n,a,c,u,s,o,l,this.imagePool),A||this.clearShadowAndFilter(n,R,L)),T&&(n.globalAlpha=d*m,n.lineWidth=b,ot(k)||(n.miterLimit=k),ot(w)||(n.lineCap=w),ot(x)||(n.lineJoin=x),A&&(P&&(n.globalCompositeOperation="source-atop"),fu(a,n,!0),P&&(Jm(n,a,v,s,o,l,this.imagePool),n.globalCompositeOperation=be.globalCompositeOperation,this.clearShadowAndFilter(n,R,!0))),Jm(n,a,v,s,o,l,this.imagePool))}},{key:"clearShadowAndFilter",value:function(n,i,a){if(a&&(n.shadowColor="transparent",n.shadowBlur=0),i){var s=n.filter;!ot(s)&&s.indexOf("drop-shadow")>-1&&(n.filter=s.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}}}])}(x7);function fu(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 CT(r,t,e,n,i,a,s,o){var l=arguments.length>8&&arguments[8]!==void 0?arguments[8]:!1;Array.isArray(e)?e.forEach(function(c){r.fillStyle=du(c,t,r,o),l||(n?r.fill(n):r.fill())}):(Ia(e)&&(r.fillStyle=hu(e,t,r,i,a,s,o)),l||(n?r.fill(n):r.fill()))}function Jm(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=du(l,t,r,s),o||r.stroke()}):(Ia(e)&&(r.strokeStyle=hu(e,t,r,n,i,a,s)),o||r.stroke())}function E7(r,t){var e=dt(r,4),n=e[0],i=e[1],a=e[2],s=e[3],o=dt(t,4),l=o[0],c=o[1],u=o[2],h=o[3],d=Math.max(n,l),f=Math.max(i,c),g=Math.min(n+a,l+u),v=Math.min(i+s,c+h);return g<=d||v<=f?null:[d,f,g-d,v-f]}function S7(r,t){var e=Qe(St(),[r[0],r[1],0],t),n=Qe(St(),[r[0]+r[2],r[1],0],t),i=Qe(St(),[r[0],r[1]+r[3],0],t),a=Qe(St(),[r[0]+r[2],r[1]+r[3],0],t);return[Math.min(e[0],n[0],i[0],a[0]),Math.min(e[1],n[1],i[1],a[1]),Math.max(e[0],n[0],i[0],a[0])-Math.min(e[0],n[0],i[0],a[0]),Math.max(e[1],n[1],i[1],a[1])-Math.min(e[1],n[1],i[1],a[1])]}var _7=function(r){function t(){return V(this,t),mt(this,t,arguments)}return pt(t,r),W(t,[{key:"renderDownSampled",value:function(n,i,a,s){var o=s.src,l=s.imageCache;if(!l.downSampled){this.imagePool.createDownSampledImage(o,a).then(function(){a.ownerDocument&&(a.renderable.dirty=!0,a.ownerDocument.defaultView.context.renderingService.dirtify())}).catch(function(c){console.error(c)});return}n.drawImage(l.downSampled,Math.floor(s.drawRect[0]),Math.floor(s.drawRect[1]),Math.ceil(s.drawRect[2]),Math.ceil(s.drawRect[3]))}},{key:"renderTile",value:function(n,i,a,s){var o=s.src,l=s.imageCache,c=s.imageRect,u=s.drawRect,h=l.size,d=n.getTransform(),f=d.a,g=d.b,v=d.c,p=d.d,m=d.e,y=d.f;if(n.resetTransform(),!(l!=null&&l.gridSize)){this.imagePool.createImageTiles(o,[],function(){a.ownerDocument&&(a.renderable.dirty=!0,a.ownerDocument.defaultView.context.renderingService.dirtify())},a).catch(function(L){console.error(L)});return}for(var b=[h[0]/c[2],h[1]/c[3]],w=[l.tileSize[0]/b[0],l.tileSize[1]/b[1]],x=[Math.floor((u[0]-c[0])/w[0]),Math.ceil((u[0]+u[2]-c[0])/w[0])],S=x[0],E=x[1],_=[Math.floor((u[1]-c[1])/w[1]),Math.ceil((u[1]+u[3]-c[1])/w[1])],C=_[0],k=_[1],M=C;M<=k;M++)for(var T=S;T<=E;T++){var O=l.tiles[M][T];if(O){var R=[Math.floor(c[0]+O.tileX*w[0]),Math.floor(c[1]+O.tileY*w[1]),Math.ceil(w[0]),Math.ceil(w[1])];n.drawImage(O.data,R[0],R[1],R[2],R[3])}}n.setTransform(f,g,v,p,m,y)}},{key:"render",value:function(n,i,a){var s=i.x,o=s===void 0?0:s,l=i.y,c=l===void 0?0:l,u=i.width,h=i.height,d=i.src,f=i.shadowColor,g=i.shadowBlur,v=this.imagePool.getImageSync(d,a),p=v==null?void 0:v.img,m=u,y=h;if(p){m||(m=p.width),y||(y=p.height);var b=!ot(f)&&g>0;fu(a,n,b);try{var w=a.ownerDocument.defaultView.getContextService().getDomElement(),x=w.width,S=w.height,E=n.getTransform(),_=E.a,C=E.b,k=E.c,M=E.d,T=E.e,O=E.f,R=xM(_,k,0,0,C,M,0,0,0,0,1,0,T,O,0,1),L=S7([o,c,m,y],R),D=E7([0,0,x,S],L);if(!D)return;if(!a.ownerDocument.defaultView.getConfig().enableLargeImageOptimization){t.renderFull(n,i,a,{image:p,drawRect:[o,c,m,y]});return}var P=L[2]/v.size[0];if(P<(v.downSamplingRate||.5)){this.renderDownSampled(n,i,a,{src:d,imageCache:v,drawRect:[o,c,m,y]});return}if(!m1.isSupportTile){t.renderFull(n,i,a,{image:p,drawRect:[o,c,m,y]});return}this.renderTile(n,i,a,{src:d,imageCache:v,imageRect:L,drawRect:D})}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]))}}])}(y1),k7=function(r){function t(){return V(this,t),mt(this,t,arguments)}return pt(t,r),W(t,[{key:"render",value:function(n,i,a,s,o,l){a.getBounds();var c=i.lineWidth,u=c===void 0?1:c,h=i.textAlign,d=h===void 0?"start":h,f=i.textBaseline,g=f===void 0?"alphabetic":f,v=i.lineJoin,p=v===void 0?"miter":v,m=i.miterLimit,y=m===void 0?10:m,b=i.letterSpacing,w=b===void 0?0:b,x=i.stroke,S=i.fill,E=i.fillRule,_=i.fillOpacity,C=_===void 0?1:_,k=i.strokeOpacity,M=k===void 0?1:k,T=i.opacity,O=T===void 0?1:T,R=i.metrics,L=i.x,D=L===void 0?0:L,P=i.y,A=P===void 0?0:P,I=i.dx,B=i.dy,j=i.shadowColor,G=i.shadowBlur,H=R.font,Y=R.lines,K=R.height,tt=R.lineHeight,it=R.lineMetrics;n.font=H,n.lineWidth=u,n.textAlign=d==="middle"?"center":d;var _t=g;_t==="alphabetic"&&(_t="bottom"),n.lineJoin=p,ot(y)||(n.miterLimit=y);var Mt=A;g==="middle"?Mt+=-K/2-tt/2:g==="bottom"||g==="alphabetic"||g==="ideographic"?Mt+=-K:(g==="top"||g==="hanging")&&(Mt+=-tt);var re=D+(I||0);Mt+=B||0,Y.length===1&&(_t==="bottom"?(_t="middle",Mt-=.5*K):_t==="top"&&(_t="middle",Mt+=.5*K)),n.textBaseline=_t;var Re=!ot(j)&&G>0;fu(a,n,Re);for(var Le=0;Le0&&arguments[0]!==void 0?arguments[0]:{};return V(this,t),e=mt(this,t),e.name="canvas-renderer",e.options=n,e}return pt(t,r),W(t,[{key:"init",value:function(){var n,i=vt({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),a=this.context.imagePool,s=new y1(a),o=(n={},rt(rt(rt(rt(rt(rt(rt(rt(rt(rt(n,$.CIRCLE,s),$.ELLIPSE,s),$.RECT,s),$.IMAGE,new _7(a)),$.TEXT,new k7(a)),$.LINE,s),$.POLYLINE,s),$.POLYGON,s),$.PATH,s),$.GROUP,void 0),rt(rt(rt(n,$.HTML,void 0),$.MESH,void 0),$.FRAGMENT,void 0));this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new MT(i))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory}}])}(Ji);/*! * @antv/g-plugin-dom-interaction * @description A G plugin * @version 2.1.21 * @date 1/23/2025, 8:33:09 AM * @author AntVis * @docs https://g.antv.antgroup.com/ */var TT=function(){function r(){V(this,r)}return W(r,[{key:"apply",value:function(e,n){var i=this,a=e.renderingService,s=e.renderingContext,o=e.config;this.context=e;var l=s.root.ownerDocument.defaultView,c=function(_){a.hooks.pointerMove.call(_)},u=function(_){a.hooks.pointerUp.call(_)},h=function(_){a.hooks.pointerDown.call(_)},d=function(_){a.hooks.pointerOver.call(_)},f=function(_){a.hooks.pointerOut.call(_)},g=function(_){a.hooks.pointerCancel.call(_)},v=function(_){a.hooks.pointerWheel.call(_)},p=function(_){a.hooks.click.call(_)},m=function(_){n.globalThis.document.addEventListener("pointermove",c,!0),_.addEventListener("pointerdown",h,!0),_.addEventListener("pointerleave",f,!0),_.addEventListener("pointerover",d,!0),n.globalThis.addEventListener("pointerup",u,!0),n.globalThis.addEventListener("pointercancel",g,!0)},y=function(_){_.addEventListener("touchstart",h,!0),_.addEventListener("touchend",u,!0),_.addEventListener("touchmove",c,!0),_.addEventListener("touchcancel",g,!0)},b=function(_){n.globalThis.document.addEventListener("mousemove",c,!0),_.addEventListener("mousedown",h,!0),_.addEventListener("mouseout",f,!0),_.addEventListener("mouseover",d,!0),n.globalThis.addEventListener("mouseup",u,!0)},w=function(_){n.globalThis.document.removeEventListener("pointermove",c,!0),_.removeEventListener("pointerdown",h,!0),_.removeEventListener("pointerleave",f,!0),_.removeEventListener("pointerover",d,!0),n.globalThis.removeEventListener("pointerup",u,!0),n.globalThis.removeEventListener("pointercancel",g,!0)},x=function(_){_.removeEventListener("touchstart",h,!0),_.removeEventListener("touchend",u,!0),_.removeEventListener("touchmove",c,!0),_.removeEventListener("touchcancel",g,!0)},S=function(_){n.globalThis.document.removeEventListener("mousemove",c,!0),_.removeEventListener("mousedown",h,!0),_.removeEventListener("mouseout",f,!0),_.removeEventListener("mouseover",d,!0),n.globalThis.removeEventListener("mouseup",u,!0)};a.hooks.init.tap(r.tag,function(){var E=i.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(E.style.msContentZooming="none",E.style.msTouchAction="none"):l.supportsPointerEvents&&(E.style.touchAction="none"),l.supportsPointerEvents?m(E):b(E),l.supportsTouchEvents&&y(E),o.useNativeClickEvent&&E.addEventListener("click",p,!0),E.addEventListener("wheel",v,{passive:!0,capture:!0})}),a.hooks.destroy.tap(r.tag,function(){var E=i.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(E.style.msContentZooming="",E.style.msTouchAction=""):l.supportsPointerEvents&&(E.style.touchAction=""),l.supportsPointerEvents?w(E):S(E),l.supportsTouchEvents&&x(E),o.useNativeClickEvent&&E.removeEventListener("click",p,!0),E.removeEventListener("wheel",v,!0)})}}])}();TT.tag="DOMInteraction";var C7=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a1&&arguments[1]!==void 0?arguments[1]:[0,0,0];return"matrix(".concat([e[0],e[1],e[4],e[5],e[12]+n[0],e[13]+n[1]].join(","),")")}},{key:"apply",value:function(e,n){var i=this,a=e.camera,s=e.renderingContext,o=e.renderingService;this.context=e;var l=s.root.ownerDocument.defaultView,c=l.context.eventService.nativeHTMLMap,u=function(m,y){y.style.transform=i.joinTransformMatrix(m.getWorldTransform(),m.getOrigin())},h=function(m){var y=m.target;if(y.nodeName===$.HTML){i.$camera||(i.$camera=i.createCamera(a));var b=i.getOrCreateEl(y);i.$camera.appendChild(b),Object.keys(y.attributes).forEach(function(w){i.updateAttribute(w,y)}),u(y,b),c.set(b,y)}},d=function(m){var y=m.target;if(y.nodeName===$.HTML&&i.$camera){var b=i.getOrCreateEl(y);b&&(b.remove(),c.delete(b))}},f=function(m){var y=m.target;if(y.nodeName===$.HTML){var b=m.attrName;i.updateAttribute(b,y)}},g=function(m){var y=m.target,b=y.nodeName===$.FRAGMENT?y.childNodes:[y];b.forEach(function(w){if(w.nodeName===$.HTML){var x=i.getOrCreateEl(w);u(w,x)}})},v=function(){if(i.$camera){var m=i.context.config,y=m.width,b=m.height;i.$camera.parentElement.style.width="".concat(y||0,"px"),i.$camera.parentElement.style.height="".concat(b||0,"px")}};o.hooks.init.tap(r.tag,function(){l.addEventListener(Mn.RESIZE,v),l.addEventListener(xt.MOUNTED,h),l.addEventListener(xt.UNMOUNTED,d),l.addEventListener(xt.ATTR_MODIFIED,f),l.addEventListener(xt.BOUNDS_CHANGED,g)}),o.hooks.endFrame.tap(r.tag,function(){i.$camera&&s.renderReasons.has(Es.CAMERA_CHANGED)&&(i.$camera.style.transform=i.joinTransformMatrix(a.getOrthoMatrix()))}),o.hooks.destroy.tap(r.tag,function(){i.$camera&&i.$camera.remove(),l.removeEventListener(Mn.RESIZE,v),l.removeEventListener(xt.MOUNTED,h),l.removeEventListener(xt.UNMOUNTED,d),l.removeEventListener(xt.ATTR_MODIFIED,f),l.removeEventListener(xt.BOUNDS_CHANGED,g)})}},{key:"createCamera",value:function(e){var n=this.context.config,i=n.document,a=n.width,s=n.height,o=this.context.contextService.getDomElement(),l=o.parentNode;if(l){var c=T7,u=l.querySelector("#".concat(c));if(!u){var h=(i||document).createElement("div");h.style.overflow="hidden",h.style.pointerEvents="none",h.style.position="absolute",h.style.left="0px",h.style.top="0px",h.style.width="".concat(a||0,"px"),h.style.height="".concat(s||0,"px");var d=(i||document).createElement("div");u=d,d.id=c,d.style.position="absolute",d.style.left="".concat(o.offsetLeft||0,"px"),d.style.top="".concat(o.offsetTop||0,"px"),d.style.transformOrigin="left top",d.style.transform=this.joinTransformMatrix(e.getOrthoMatrix()),d.style.pointerEvents="none",d.style.width="100%",d.style.height="100%",h.appendChild(d),l.appendChild(h)}return u}return null}},{key:"getOrCreateEl",value:function(e){var n=this.context.config.document,i=this.displayObjectHTMLElementMap.get(e);return i||(i=(n||document).createElement("div"),e.parsedStyle.$el=i,this.displayObjectHTMLElementMap.set(e,i),e.id&&(i.id=e.id),e.name&&i.setAttribute("name",e.name),e.className&&(i.className=e.className),i.style.position="absolute",i.style["will-change"]="transform",i.style.transform=this.joinTransformMatrix(e.getWorldTransform(),e.getOrigin())),i}},{key:"updateAttribute",value:function(e,n){var i=this.getOrCreateEl(n);switch(e){case"innerHTML":var a=n.parsedStyle.innerHTML;Tt(a)?i.innerHTML=a:(i.innerHTML="",i.appendChild(a));break;case"x":i.style.left="".concat(n.parsedStyle.x,"px");break;case"y":i.style.top="".concat(n.parsedStyle.y,"px");break;case"transformOrigin":var s=n.parsedStyle.transformOrigin;i.style["transform-origin"]="".concat(s[0].buildCSSText(null,null,"")," ").concat(s[1].buildCSSText(null,null,""));break;case"width":var o=n.parsedStyle.width;i.style.width=nt(o)?"".concat(o,"px"):o.toString();break;case"height":var l=n.parsedStyle.height;i.style.height=nt(l)?"".concat(l,"px"):l.toString();break;case"zIndex":var c=n.parsedStyle.zIndex;i.style["z-index"]="".concat(c);break;case"visibility":var u=n.parsedStyle.visibility;i.style.visibility=u;break;case"pointerEvents":var h=n.parsedStyle.pointerEvents,d=h===void 0?"auto":h;i.style.pointerEvents=d;break;case"opacity":var f=n.parsedStyle.opacity;i.style.opacity="".concat(f);break;case"fill":var g=n.parsedStyle.fill,v="";eu(g)?g.isNone?v="transparent":v=n.getAttribute("fill"):Array.isArray(g)?v=n.getAttribute("fill"):Ia(g),i.style.background=v;break;case"stroke":var p=n.parsedStyle.stroke,m="";eu(p)?p.isNone?m="transparent":m=n.getAttribute("stroke"):Array.isArray(p)?m=n.getAttribute("stroke"):Ia(p),i.style["border-color"]=m,i.style["border-style"]="solid";break;case"lineWidth":var y=n.parsedStyle.lineWidth;i.style["border-width"]="".concat(y||0,"px");break;case"lineDash":i.style["border-style"]="dashed";break;case"filter":var b=n.style.filter;i.style.filter=b;break;default:!ot(n.style[e])&&n.style[e]!==""&&(i.style[e]=n.style[e])}}}])}();OT.tag="HTMLRendering";var O7=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a0&&o[0]!==void 0?o[0]:{},a=i.type,s=i.encoderOptions,c.abrupt("return",this.context.canvas.toDataURL(a,s));case 3:case"end":return c.stop()}},n,this)}));function e(){return t.apply(this,arguments)}return e}()}])}(),P7=function(r){function t(){var e;V(this,t);for(var n=arguments.length,i=new Array(n),a=0;a{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);To(n.context.eventService,"mappingTable.pointerupoutside",[]),n.context.eventService.mapEvent(o)})}}get eventService(){return this.context.canvas.context.eventService}get events(){return[z.CLICK,z.POINTER_DOWN,z.POINTER_MOVE,z.POINTER_UP,z.POINTER_OVER,z.POINTER_LEAVE]}getDomElement(){return this.getShape("key").getDomElement()}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e),this.drawPortShapes(t,e)}getKeyStyle(t){const e=La(t,["dx","dy","innerHTML","pointerEvents","cursor"]),{dx:n=0,dy:i=0}=e,a=N7(e,["dx","dy"]),[s,o]=this.getSize(t);return Object.assign(Object.assign({x:n,y:i},a),{width:s,height:o})}drawKeyShape(t,e){const n=this.getKeyStyle(t),{x:i,y:a,width:s=0,height:o=0}=n,l=this.upsert("key-container",Be,{x:i,y:a,width:s,height:o,opacity:0},e);return this.upsert("key",Ko,n,l)}connectedCallback(){if(!(this.context.canvas.getRenderer("main")instanceof Lo))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;ithis.context.element.getElement(s)).filter(Boolean);if(i.length===0){const s=new Vt,{x:o=0,y:l=0,size:c}=t,[u,h]=Nn(c);return s.setMinMax([o-u/2,l-h/2,0],[o+u/2,l+h/2,0]),s}const a=Jo(i.map(s=>s.getBounds()));return n?ea(a,n):a}drawCollapsedMarkerShape(t,e){const n=this.getCollapsedMarkerStyle(t);this.upsert("collapsed-marker",bT,n,e),v1(this)}getCollapsedMarkerStyle(t){if(!t.collapsed||!t.collapsedMarker)return!1;const e=Se(this.getGraphicStyle(t),"collapsedMarker"),{type:n}=e,i=Ib(e,["type"]),a=this.getShape("key"),[s,o]=Wr(a.getLocalBounds(),"center"),l=Object.assign(Object.assign({},i),{x:s,y:o});if(n){const c=this.getCollapsedMarkerText(n,t);Object.assign(l,{text:c})}return l}getCollapsedMarkerText(t,e){const{childrenData:n=[]}=e,{model:i}=this.context;return t==="descendant-count"?i.getDescendantsData(this.id).length.toString():t==="child-count"?n.length.toString():t==="node-count"?i.getDescendantsData(this.id).filter(a=>i.getElementType(F(a))==="node").length.toString():at(t)?t(n):""}getComboPosition(t){const{x:e=0,y:n=0,collapsed:i,childrenData:a=[]}=t;if(a.length===0)return[+e,+n,0];if(i){const{model:s}=this.context,o=s.getDescendantsData(this.id).filter(l=>!s.isCombo(F(l)));if(o.length>0&&o.some(u9)){const l=o.reduce((c,u)=>ft(c,ye(u)),[0,0,0]);return ur(l,o.length)}return[+e,+n,0]}return this.getContentBBox(t).center}getComboStyle(t){const[e,n]=this.getComboPosition(t);return{x:e,y:n,transform:[["translate",e,n]]}}updateComboPosition(t){const e=this.getComboStyle(t);Object.assign(this.style,e);const{x:n,y:i}=e;this.context.model.syncNodeLikeDatum({id:this.id,style:{x:n,y:i}}),p1(this)}render(t,e=this){super.render(t,e),this.drawCollapsedMarkerShape(t,e)}update(t={}){super.update(t),this.updateComboPosition(this.parsedAttributes)}onframe(){super.onframe(),this.attributes.collapsed||this.updateComboPosition(this.parsedAttributes),this.drawKeyShape(this.parsedAttributes,this)}animate(t,e){const n=super.animate(this.attributes.collapsed?t:t.map(i=>{var{x:a,y:s,z:o,transform:l}=i,c=Ib(i,["x","y","z","transform"]);return c}),e);return n&&new Proxy(n,{set:(i,a,s)=>(a==="currentTime"&&Promise.resolve().then(()=>this.onframe()),Reflect.set(i,a,s))})}}Ls.defaultStyleProps={childrenNode:[],droppable:!0,draggable:!0,collapsed:!1,collapsedSize:32,collapsedMarker:!0,collapsedMarkerZIndex:1,collapsedMarkerFontSize:12,collapsedMarkerTextAlign:"center",collapsedMarkerTextBaseline:"middle",collapsedMarkerType:"child-count"};class D7 extends Ls{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",li,this.getKeyStyle(t),e)}getKeyStyle(t){const{collapsed:e}=t,n=super.getKeyStyle(t),[i]=this.getKeySize(t);return Object.assign(Object.assign(Object.assign({},n),e&&Se(n,"collapsed")),{r:i/2})}getCollapsedKeySize(t){const[e,n]=Nn(t.collapsedSize),i=Math.max(e,n)/2;return[i*2,i*2,0]}getExpandedKeySize(t){const e=this.getContentBBox(t),[n,i]=ta(e),a=Math.sqrt(Math.pow(n,2)+Math.pow(i,2))/2;return[a*2,a*2,0]}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return $u(t,n,e)}}class I7 extends Ls{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",Be,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,i]=this.getKeySize(t);return Object.assign(Object.assign(Object.assign({},e),t.collapsed&&Se(e,"collapsed")),{width:n,height:i,x:-n/2,y:-i/2})}}const F7={padding:10};function Fb(r,t,e,n,i,a){const{padding:s}=Object.assign(F7,a),o=Ai(e,s),l=Ai(n,s),c=[r,...i,t];let u=null;const h=[];for(let d=0,f=c.length;da?"N":"S":n===a?e>i?"W":"E":null}function Qm(r,t){return t==="N"||t==="S"?Rr(r):Nr(r)}function zb(r,t,e){const n=[r[0],t[1]],i=[t[0],r[1]],a=an(r,n),s=an(r,i),o=e?B7[e]:null,l=a===e||a!==o&&s!==e?n:i;return{points:[l],direction:an(l,t)}}function Nc(r,t,e){if(ou(r,e)){const n=Do(r,t,e);return{points:[n],direction:an(n,t)}}else{const n=Ta(r,e),a=["left","right"].includes(Eo(r,e))?[t[0],n[1]]:[n[0],t[1]];return{points:[a],direction:an(a,t)}}}function NT(r,t,e,n){const i=ou(t,e)?t:Ta(t,e),a=[[i[0],r[1]],[r[0],i[1]]],s=a.filter(l=>D8(l,e)&&!ZC(l,e,!0)),o=s.filter(l=>an(l,r)!==n);if(o.length>0){const l=o.find(c=>an(r,c)===n)||o[0];return{points:[l],direction:an(l,t)}}else{const l=GL(a,s)[0],c=$i(t,l,Qm(e,n)/2);return{points:[Do(c,r,e),c],direction:an(c,t)}}}function z7(r,t,e,n){let i=Nc(r,t,e);const a=Ro(i.points[0]);if(cr(a,n)){i=Nc(t,r,n);const s=Ro(i.points[0]);if(cr(s,e)){const o=$i(r,a,Qm(e,an(r,a))/2),l=$i(t,s,Qm(n,an(t,s))/2),c=[(o[0]+l[0])/2,(o[1]+l[1])/2],u=Nc(r,c,e),h=NT(c,t,n,u.direction);i.points=[u.points[0],h.points[0]],i.direction=h.direction}}return i}function Jd(r,t,e,n,i){const s=Jo([e,n]),o=Kt(t,s.center)>Kt(r,s.center),[l,c]=o?[t,r]:[r,t],u=Rr(s)+Nr(s);let h;if(i){const g=[l[0]+u*Math.cos(Bb[i]),l[1]+u*Math.sin(Bb[i])];h=$i(Ta(g,s),g,.01)}else h=$i(Ta(l,s),l,-.01);let d=Do(h,c,s),f=[Ks(h,2),Ks(d,2)];if(ue(Ks(h),Ks(d))){const g=h1($t(h,l),[1,0,0])+Math.PI/2;d=[c[0]+u*Math.cos(g),c[1]+u*Math.sin(g),0],d=Ks($i(Ta(d,s),c,-.01),2);const v=Do(h,d,s);f=[h,v,d]}return{points:o?f.reverse():f,direction:an(o?h:d,t)}}function Do(r,t,e){let n=[r[0],t[1]];return cr(n,e)&&(n=[t[0],r[1]]),n}function RT(r,t,e,n,i){let l=typeof t=="number"?t:.5;t==="start"&&(l=0),t==="end"&&(l=.99);const c=Ge(r.getPoint(l)),u=Ge(r.getPoint(l+.01));let h=t==="start"?"left":t==="end"?"right":"center";if(lT(c,u)||!e){const[m,y]=$b(r,l,n,i);return{transform:[["translate",m,y]],textAlign:h}}let d=Math.atan2(u[1]-c[1],u[0]-c[0]);u[0]{const c=a[l-1]||n,u=a[l+1]||i;if(!cT(c,o,u)&&t){const[h,d]=W7(c,o,u,t);s.push(["L",h[0],h[1]],["Q",o[0],o[1],d[0],d[1]],["L",d[0],d[1]])}else s.push(["L",o[0],o[1]])}),s.push(["L",i[0],i[1]]),e&&s.push(["Z"]),s}function W7(r,t,e,n){const i=lu(r,t),a=lu(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 V7=r=>{const t=Math.PI/2,e=Rr(r)/2,n=Nr(r)/2,i=Math.atan2(e,n)/2,a=Math.atan2(n,e)/2;return{top:[-t-a,-t+a],"top-right":[-t+a,-i],"right-top":[-t+a,-i],right:[-i,i],"bottom-right":[i,t-a],"right-bottom":[i,t-a],bottom:[t-a,t+a],"bottom-left":[t+a,Math.PI-i],"left-bottom":[t+a,Math.PI-i],left:[Math.PI-i,Math.PI+i],"top-left":[Math.PI+i,-t-a],"left-top":[Math.PI+i,-t-a]}};function DT(r,t,e,n,i){const a=Ai(r),s=r.getCenter();let o=n&&Hi(n),l=i&&Hi(i);if(!o||!l){const c=V7(a),u=c[t][0],h=c[t][1],[d,f]=ta(a),g=Math.max(d,f),v=ft(s,[g*Math.cos(u),g*Math.sin(u),0]),p=ft(s,[g*Math.cos(h),g*Math.sin(h),0]);o=ny(r,v),l=ny(r,p),e||([o,l]=[l,o])}return[o,l]}function H7(r,t,e,n,i,a){const s=r.getPorts()[i||a],o=r.getPorts()[a||i];let[l,c]=DT(r,t,e,s,o);const u=U7(r,l,c,n);return s&&(l=Io(s,u[0])),o&&(c=Io(o,u[u.length-1])),LT(l,c,u)}function U7(r,t,e,n){const i=r.getCenter();if(ue(t,e)){const a=$t(t,i),s=[n*Math.sign(a[0])||n/2,n*Math.sign(a[1])||-n/2,0];return[ft(t,s),ft(e,Gr(s,[1,-1,1]))]}return[$i(i,t,Kt(i,t)+n),$i(i,e,Kt(i,e)+n)]}function Y7(r,t,e,n,i,a,s){const o=E1(r),l=o[a||s],c=o[s||a];let[u,h]=DT(r,e,n,l,c);const d=X7(r,u,h,i);return l&&(u=Io(l,d[0])),c&&(h=Io(c,d[d.length-1])),b1([u,...d,h],t)}function X7(r,t,e,n){const i=[],a=Ai(r);if(ue(t,e))switch(Eo(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=Eo(t,a),o=Eo(e,a);if(s===o){const l=s;let c,u;switch(l){case"left":c=Math.min(t[0],e[0])-n,i.push([c,t[1]]),i.push([c,e[1]]);break;case"right":c=Math.max(t[0],e[0])+n,i.push([c,t[1]]),i.push([c,e[1]]);break;case"top":u=Math.min(t[1],e[1])-n,i.push([t[0],u]),i.push([e[0],u]);break;case"bottom":u=Math.max(t[1],e[1])+n,i.push([t[0],u]),i.push([e[0],u]);break}}else{const l=(d,f)=>({left:[f[0]-n,f[1]],right:[f[0]+n,f[1]],top:[f[0],f[1]-n],bottom:[f[0],f[1]+n]})[d],c=l(s,t),u=l(o,e),h=Do(c,u,a);i.push(c,h,u)}}return i}function ey(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 jb(r,t){const e=[];let n=r;for(;n;){e.push(n);const i=t(F(n));if(i)n=i;else break}if(e.some(i=>{var a;return(a=i.style)===null||a===void 0?void 0:a.collapsed})){const i=e.reverse().findIndex(mn);return e[i]||e.at(-1)}return r}function K7(r,t){return t||(r<4?10:r===4?12:r*2.5)}const Z7=(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"]]},IT=(r,t)=>[["M",-r/2,0],["L",r/2,-t/2],["L",r/2,t/2],["Z"]],J7=(r,t)=>[["M",-r/2,0],["L",0,-t/2],["L",r/2,0],["L",0,t/2],["Z"]],Q7=(r,t)=>[["M",-r/2,0],["L",r/2,-t/2],["L",4*r/5-r/2,0],["L",r/2,t/2],["Z"]],tF=(r,t)=>[["M",-r/2,-t/2],["L",r/2,-t/2],["L",r/2,t/2],["L",-r/2,t/2],["Z"]],eF=(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"]]},nF=(r,t)=>[["M",r/2,-t/2],["L",-r/2,0],["L",r/2,0],["L",-r/2,0],["L",r/2,t/2]],rF=Object.freeze(Object.defineProperty({__proto__:null,circle:Z7,diamond:J7,rect:tF,simple:nF,triangle:IT,triangleRect:eF,vee:Q7},Symbol.toStringTag,{value:"Module"}));var rc=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{c in i&&(l[c]=i[c])}),l}getLoopPath(t){const{sourcePort:e,targetPort:n}=t,i=this.sourceNode,a=Ai(i),s=Math.max(Nr(a),Rr(a)),{placement:o,clockwise:l,dist:c=s}=Se(this.getGraphicStyle(t),"loop");return H7(i,o,l,c,e,n)}getEndpoints(t,e=!0,n=[]){const{sourcePort:i,targetPort:a}=t,{sourceNode:s,targetNode:o}=this,[l,c]=vF(s,o,i,a);if(!e){const f=l?Hi(l):s.getCenter(),g=c?Hi(c):o.getCenter();return[f,g]}const u=typeof n=="function"?n():n,h=Hb(l||s,u[0]||c||o),d=Hb(c||o,u[u.length-1]||l||s);return[h,d]}getHaloStyle(t){if(t.halo===!1)return!1;const e=this.getKeyStyle(t),n=Se(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign({},e),n)}getLabelStyle(t){if(t.label===!1||!t.labelText)return!1;const e=Se(this.getGraphicStyle(t),"label"),{placement:n,offsetX:i,offsetY:a,autoRotate:s,maxWidth:o}=e,l=rc(e,["placement","offsetX","offsetY","autoRotate","maxWidth"]),c=RT(this.shapeMap.key,n,s,i,a),u=this.shapeMap.key.getLocalBounds(),h=T9([u.min,u.max],o);return Object.assign({wordWrapWidth:h},c,l)}getBadgeStyle(t){if(t.badge===!1||!t.badgeText)return!1;const e=Se(t,"badge"),{offsetX:n,offsetY:i,placement:a}=e,s=rc(e,["offsetX","offsetY","placement"]);return Object.assign(s,$7(this.shapeMap,a,t.labelPlacement,n,i))}drawArrow(t,e){var n;const i=e==="start",s=t[e==="start"?"startArrow":"endArrow"],o=this.shapeMap.key;if(s){const l=this.getArrowStyle(t,i),[c,u,h]=i?["markerStart","markerStartOffset","startArrowOffset"]:["markerEnd","markerEndOffset","endArrowOffset"],d=o.parsedStyle[c];if(d)d.attr(l);else{const f=l.src?Zo:Tn,g=new f({style:l});o.style[c]=g}o.style[u]=t[h]||l.width/2+ +l.lineWidth}else{const l=i?"markerStart":"markerEnd";(n=o.style[l])===null||n===void 0||n.destroy(),o.style[l]=null}}getArrowStyle(t,e){const n=this.getShape("key").attributes,i=e?"startArrow":"endArrow",a=Se(this.getGraphicStyle(t),i),{size:s,type:o}=a,l=rc(a,["size","type"]),[c,u]=Nn(K7(n.lineWidth,s)),d=(at(o)?o:rF[o]||IT)(c,u);return Object.assign(La(n,["stroke","strokeOpacity","fillOpacity"]),{width:c,height:u},Object.assign({},d&&{d,fill:o==="simple"?"":n.stroke}),l)}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",na,n,e)}drawHaloShape(t,e){const n=this.getHaloStyle(t);this.upsert("halo",Tn,n,e)}drawBadgeShape(t,e){const n=this.getBadgeStyle(t);this.upsert("badge",ei,n,e)}drawSourceArrow(t){this.drawArrow(t,"start")}drawTargetArrow(t){this.drawArrow(t,"end")}drawKeyShape(t,e){const n=this.getKeyStyle(t);return this.upsert("key",Tn,n,e)}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e),this.getShape("key")&&(this.drawSourceArrow(t),this.drawTargetArrow(t),this.drawLabelShape(t,e),this.drawHaloShape(t,e),this.drawBadgeShape(t,e))}onframe(){this.drawKeyShape(this.parsedAttributes,this),this.drawSourceArrow(this.parsedAttributes),this.drawTargetArrow(this.parsedAttributes),this.drawHaloShape(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this),this.drawBadgeShape(this.parsedAttributes,this)}animate(t,e){const n=super.animate(t,e);return n&&new Proxy(n,{set:(i,a,s)=>(a==="currentTime"&&Promise.resolve().then(()=>this.onframe()),Reflect.set(i,a,s))})}}ra.defaultStyleProps={badge:!0,badgeOffsetX:0,badgeOffsetY:0,badgePlacement:"suffix",isBillboard:!0,label:!0,labelAutoRotate:!0,labelIsBillboard:!0,labelMaxWidth:"80%",labelOffsetX:4,labelOffsetY:0,labelPlacement:"center",labelTextBaseline:"middle",labelWordWrap:!1,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloPointerEvents:"none",haloStrokeOpacity:.25,haloZIndex:-1,loop:!0,startArrow:!1,startArrowLineDash:0,startArrowLineJoin:"round",startArrowLineWidth:1,startArrowTransformOrigin:"center",startArrowType:"vee",endArrow:!1,endArrowLineDash:0,endArrowLineJoin:"round",endArrowLineWidth:1,endArrowTransformOrigin:"center",endArrowType:"vee",loopPlacement:"top",loopClockwise:!0};class Va extends ra{constructor(t){super($e({style:Va.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t),{controlPoints:i,curvePosition:a,curveOffset:s}=t,o=this.getControlPoints(e,n,q7(a),j7(s),i);return LT(e,n,o)}getControlPoints(t,e,n,i,a){return(a==null?void 0:a.length)===2?a:[ty(t,e,n[0],i[0]),ty(t,e,n[1],i[1])]}}Va.defaultStyleProps={curvePosition:.5,curveOffset:20};class rl extends Va{constructor(t){super($e({style:rl.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]]]}}rl.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};class Uu extends Va{constructor(t){super($e({style:Uu.defaultStyleProps},t))}get ref(){return this.context.model.getRootsData()[0]}getEndpoints(t){if(this.sourceNode.id===this.ref.id)return super.getEndpoints(t);const e=ye(this.ref),n=this.sourceNode.getIntersectPoint(e,!0),i=this.targetNode.getIntersectPoint(e);return[n,i]}toRadialCoordinate(t){const e=ye(this.ref),n=Kt(t,e),i=aT($t(t,e));return[n,i]}getControlPoints(t,e,n,i){const[a,s]=this.toRadialCoordinate(t),[o]=this.toRadialCoordinate(e),l=o-a;return[[t[0]+(l*n[0]+i[0])*Math.cos(s),t[1]+(l*n[0]+i[0])*Math.sin(s)],[e[0]-(l*n[1]-i[0])*Math.cos(s),e[1]-(l*n[1]-i[0])*Math.sin(s)]]}}Uu.defaultStyleProps={curvePosition:.5,curveOffset:20};class Yu extends Va{constructor(t){super($e({style:Yu.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]]]}}Yu.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};let FT=class BT extends ra{constructor(t){super($e({style:BT.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t);return[["M",e[0],e[1]],["L",n[0],n[1]]]}};FT.defaultStyleProps={};const iF={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:lu},$r=r=>`${Math.round(r[0])}|||${Math.round(r[1])}`;function Ea(r,t){const e=n=>Math.round(n/t);return nt(r)?e(r):r.map(e)}function aF(r,t){const e=Math.abs(r-t);return e>Math.PI?2*Math.PI-e:e}function qb(r,t){const e=t[0]-r[0],n=t[1]-r[1];return!e&&!n?0:Math.atan2(n,e)}function zT(r,t,e,n){const i=qb(r,t),a=e[$r(r)],o=qb(a||n,r);return aF(o,i)}const sF=(r,t)=>{const{offset:e,gridSize:n}=t,i={};return r.forEach(a=>{if(!a||a.destroyed||!a.isVisible())return;const s=ea(a.getRenderBounds(),e);for(let o=Ea(s.min[0],n);o<=Ea(s.max[0],n);o+=1)for(let l=Ea(s.min[1],n);l<=Ea(s.max[1],n);l+=1)i[`${o}|||${l}`]=!0}),i};function Gb(r,t,e){return Math.min(...t.map(n=>e(r,n)))}function oF(r,t,e){let n=r[0],i=e(r[0],t);for(let a=0;a{if(!t)return[r];const{directionMap:i,offset:a}=n,s=ea(t.getRenderBounds(),a),o=Object.keys(i).reduce((l,c)=>{if(e.includes(c)){const u=i[c],[h,d]=ta(s),f=[r[0]+u.stepX*h,r[1]+u.stepY*d],g=B8(s);for(let v=0;vEa(l,n.gridSize))},lF=(r,t,e,n,i,a,s)=>{const o=[];let l=[a[0]===n[0]?n[0]:r[0]*s,a[1]===n[1]?n[1]:r[1]*s];o.unshift(l);let c=r,u=t[$r(c)];for(;u;){const f=u,g=c;zT(f,g,t,e)&&(l=[f[0]===g[0]?l[0]:f[0]*s,f[1]===g[1]?l[1]:f[1]*s],o.unshift(l)),u=t[$r(f)],c=f}const h=i.map(f=>[f[0]*s,f[1]*s]),d=oF(h,l,lu);return o.unshift(d),o};function cF(r,t,e,n){const i=za(r.getCenter()),a=za(t.getCenter()),s=Object.assign(iF,n),{gridSize:o}=s,l=s.enableObstacleAvoidance?e:[r,t],c=sF(l,s),u=Ea(i,o),h=Ea(a,o),d=Wb(i,r,s.startDirections,s),f=Wb(a,t,s.endDirections,s);d.forEach(_=>delete c[$r(_)]),f.forEach(_=>delete c[$r(_)]);const g={},v={},p={},m={},y={},b=new uF;for(let _=0;_$r(_));let x=s.maximumLoops,S,E=1/0;for(const[_,C]of Object.entries(g))y[_]<=E&&(E=y[_],S=C);for(;Object.keys(g).length>0&&x>0;){const _=b.minId(!1);if(_)S=g[_];else break;const C=$r(S);if(w.includes(C))return lF(S,p,u,a,d,h,o);delete g[C],b.remove(C),v[C]=!0;for(const k of Object.values(s.directionMap)){const M=ft(S,[k.stepX,k.stepY]),T=$r(M);if(v[T])continue;const O=zT(S,M,p,u);if(O>s.maxAllowedDirectionChange||c[T])continue;g[T]||(g[T]=M);const R=s.penalties[O],L=s.distFunc(S,M)+(isNaN(R)?o:R),D=m[C]+L,P=m[T];P&&D>=P||(p[T]=S,m[T]=D,y[T]=D+Gb(M,f,s.distFunc),b.add({id:T,value:y[T]}))}x-=1}return[]}class uF{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=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 Xu extends ra{constructor(t){super($e({style:Xu.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=cF(n,i,l,e),o.length||(o=Fb(a,s,n,i,t.controlPoints,{padding:e.offset}))}else e.type==="orth"&&(o=Fb(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 b1(e,t.radius)}getLoopPath(t){const{sourcePort:e,targetPort:n,radius:i}=t,a=this.sourceNode,s=Ai(a),o=Math.max(Nr(s),Rr(s))/4,{placement:l,clockwise:c,dist:u=o}=Se(this.getGraphicStyle(t),"loop");return Y7(a,i,l,c,u,e,n)}}Xu.defaultStyleProps={radius:0,controlPoints:[],router:!1};class Ku extends ra{constructor(t){super($e({style:Ku.defaultStyleProps},t))}getKeyPath(t){const{curvePosition:e,curveOffset:n}=t,[i,a]=this.getEndpoints(t),s=t.controlPoint||ty(i,a,e,n);return G7(i,a,s)}}Ku.defaultStyleProps={curvePosition:.5,curveOffset:30};var hF=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{var a;const{key:s,placement:o}=n;jT(n)&&(t[a=s||i]||(t[a]=Wr(r.getShape("key").getBounds(),o)))}),t}function jT(r){const{r:t}=r;return!t||Number(t)===0}function Hi(r){return As(r)?r:r.getPosition()}function vF(r,t,e,n){const i=Vb(r,t,e,n),a=Vb(t,r,n,e);return[i,a]}function Vb(r,t,e,n){const i=E1(r);if(e)return i[e];const a=Object.values(i);if(a.length===0)return;const s=a.map(c=>Hi(c)),o=pF(t,n),[l]=p9(s,o);return a.find(c=>Hi(c)===l)}function pF(r,t){const e=E1(r);if(t)return[Hi(e[t])];const n=Object.values(e);return n.length>0?n.map(i=>Hi(i)):[r.getCenter()]}function Hb(r,t){return w1(r)||il(r)?ny(r,t):Io(r,t)}function Io(r,t){if(!r||!t)return[0,0,0];if(As(r))return r;if(r.attributes.linkToCenter)return r.getPosition();const e=As(t)?t:il(t)?t.getCenter():t.getPosition();return $u(e,r.getBounds())}function ny(r,t){if(!r||!t)return[0,0,0];const e=As(t)?t:il(t)?t.getCenter():t.getPosition();return r.getIntersectPoint(e)||r.getCenter()}function Ub(r,t="bottom",e=0,n=0,i=!1){const a=t.split("-"),[s,o]=Wr(r,t),l=a.includes("left")?"right":a.includes("right")?"left":"center";let c=a.includes("top")?"bottom":a.includes("bottom")?"top":"middle";return i&&(c=c==="top"?"bottom":c==="bottom"?"top":c),{transform:[["translate",s+e,o+n]],textBaseline:c,textAlign:l}}function mF(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 yF(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 bF(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 wF(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 xF(r,t){return[[0,-t/2],[r/2,0],[0,t/2],[-r/2,0]]}function EF(r){return nn(r,["style","visibility"])!=="hidden"}function SF(r,t){const{zIndex:e,transform:n,transformOrigin:i,visibility:a,cursor:s,clipPath:o,component:l}=t,c=hF(t,["zIndex","transform","transformOrigin","visibility","cursor","clipPath","component"]);Object.assign(r.attributes,c),n&&r.setAttribute("transform",n),nt(e)&&r.setAttribute("zIndex",e),i&&r.setAttribute("transformOrigin",i),a&&r.setAttribute("visibility",a),s&&r.setAttribute("cursor",s),o&&r.setAttribute("clipPath",o),l&&r.setAttribute("component",l)}function ry(r,t){"update"in r?r.update(t):r.attr(t)}function _F(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 kF(r){To(r,"__to_be_destroyed__",!0)}function Zu(r){return nn(r,"__to_be_destroyed__",!1)}var MF=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class Ju extends xn{constructor(t,e){super(t,Object.assign({},Ju.defaultOptions,e)),this.onCollapseExpand=n=>MF(this,void 0,void 0,function*(){if(!this.validate(n))return;const{target:i}=n;if(!dF(i))return;const a=i.id,{model:s,graph:o}=this.context,l=s.getElementDataById(a);if(!l)return!1;const{onCollapse:c,onExpand:u,animation:h,align:d}=this.options;mn(l)?(yield o.expandElement(a,{animation:h,align:d}),u==null||u(a)):(yield o.collapseElement(a,{animation:h,align:d}),c==null||c(a))}),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`node:${e}`,this.onCollapseExpand),t.on(`combo:${e}`,this.onCollapseExpand)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`node:${e}`,this.onCollapseExpand),t.off(`combo:${e}`,this.onCollapseExpand)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return at(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}Ju.defaultOptions={enable:!0,animation:!0,trigger:z.DBLCLICK,align:!0};var ic=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};const CF="g6-create-edge-assist-edge-id",ac="g6-create-edge-assist-node-id";class Qu extends xn{constructor(t,e){super(t,Object.assign({},Qu.defaultOptions,e)),this.drop=n=>ic(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=>ic(this,void 0,void 0,function*(){var i,a,s;if(!this.validate(n))return;const{graph:o,canvas:l,batch:c,element:u}=this.context,{style:h}=this.options;if(this.source){this.createEdge(n),yield this.cancelEdge();return}c.startBatch(),l.setCursor("crosshair"),this.source=this.getSelectedNodeIDs([n.target.id])[0];const d=o.getElementData(this.source);o.addNodeData([{id:ac,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:CF,source:this.source,target:ac,style:Object.assign({pointerEvents:"none"},h)}]),yield(s=u.draw({animation:!1}))===null||s===void 0?void 0:s.finished}),this.updateAssistEdge=n=>ic(this,void 0,void 0,function*(){var i;if(!this.source)return;const{model:a,element:s}=this.context;a.translateNodeTo(ac,[n.canvas.x,n.canvas.y]),yield(i=s.draw({animation:!1,silence:!0}))===null||i===void 0?void 0:i.finished}),this.createEdge=n=>{var i,a;const{graph:s}=this.context,{style:o,onFinish:l,onCreate:c}=this.options;if(((i=n.target)===null||i===void 0?void 0:i.id)===void 0||this.source===void 0)return;const h=(a=this.getSelectedNodeIDs([n.target.id]))===null||a===void 0?void 0:a[0],d=`${this.source}-${h}-${u6()}`,f=c({id:d,source:this.source,target:h,style:o});s.addEdgeData([f]),l(f)},this.cancelEdge=()=>ic(this,void 0,void 0,function*(){var n;if(!this.source)return;const{graph:i,element:a,batch:s}=this.context;i.removeNodeData([ac]),this.source=void 0,yield(n=a.draw({animation:!1}))===null||n===void 0?void 0:n.finished,s.endBatch()}),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;this.unbindEvents(),e==="click"?(t.on(Vn.CLICK,this.handleCreateEdge),t.on(wa.CLICK,this.handleCreateEdge),t.on(ni.CLICK,this.cancelEdge),t.on(su.CLICK,this.cancelEdge)):(t.on(Vn.DRAG_START,this.handleCreateEdge),t.on(wa.DRAG_START,this.handleCreateEdge),t.on(z.POINTER_UP,this.drop)),t.on(z.POINTER_MOVE,this.updateAssistEdge)}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map(e=>e.id).concat(t)))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return at(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;t.off(Vn.CLICK,this.handleCreateEdge),t.off(wa.CLICK,this.handleCreateEdge),t.off(ni.CLICK,this.cancelEdge),t.off(su.CLICK,this.cancelEdge),t.off(Vn.DRAG_START,this.handleCreateEdge),t.off(wa.DRAG_START,this.handleCreateEdge),t.off(z.POINTER_UP,this.drop),t.off(z.POINTER_MOVE,this.updateAssistEdge)}destroy(){this.unbindEvents(),super.destroy()}}Qu.defaultOptions={animation:!0,enable:!0,style:{},trigger:"drag",onCreate:r=>r,onFinish:()=>{}};var Yb=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class th extends xn{constructor(t,e){super(t,Object.assign({},th.defaultOptions,e)),this.isDragging=!1,this.onDragStart=n=>{this.validate(n)&&(this.isDragging=!0,this.context.canvas.setCursor("grabbing"))},this.onDrag=n=>{var i,a,s,o;if(!this.isDragging)return;const l=(a=(i=n.movement)===null||i===void 0?void 0:i.x)!==null&&a!==void 0?a:n.dx,c=(o=(s=n.movement)===null||s===void 0?void 0:s.y)!==null&&o!==void 0?o:n.dy;l|c&&this.translate([l,c],!1)},this.onDragEnd=()=>{var n,i;this.isDragging=!1,this.context.canvas.setCursor(this.defaultCursor),(i=(n=this.options).onFinish)===null||i===void 0||i.call(n)},this.invokeOnFinish=Vo(()=>{var n,i;(i=(n=this.options).onFinish)===null||i===void 0||i.call(n)},300),this.shortcut=new Rs(t.graph),this.bindEvents(),this.defaultCursor=this.context.canvas.getConfig().cursor||"default"}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{trigger:t}=this.options;if(me(t)){const{up:e=[],down:n=[],left:i=[],right:a=[]}=t;this.shortcut.bind(e,s=>this.onTranslate([0,1],s)),this.shortcut.bind(n,s=>this.onTranslate([0,-1],s)),this.shortcut.bind(i,s=>this.onTranslate([1,0],s)),this.shortcut.bind(a,s=>this.onTranslate([-1,0],s))}else{const{graph:e}=this.context;e.on(z.DRAG_START,this.onDragStart),e.on(z.DRAG,this.onDrag),e.on(z.DRAG_END,this.onDragEnd)}}onTranslate(t,e){return Yb(this,void 0,void 0,function*(){if(!this.validate(e))return;const{sensitivity:n}=this.options,i=n*-1;yield this.translate(Gr(t,i),this.options.animation),this.invokeOnFinish()})}translate(t,e){return Yb(this,void 0,void 0,function*(){t=this.clampByDirection(t),t=this.clampByRange(t),yield this.context.graph.translateBy(t,e)})}clampByDirection([t,e]){const{direction:n}=this.options;return n==="x"?e=0:n==="y"&&(t=0),[t,e]}clampByRange([t,e]){const{viewport:n,canvas:i}=this.context,[a,s]=i.getSize(),[o,l,c,u]=Pr(this.options.range),h=[s*o,a*l,s*c,a*u],d=ea(o1(n.getCanvasCenter()),h),f=$t(n.getViewportCenter(),[t,e,0]);if(!cr(f,d)){const{min:[g,v],max:[p,m]}=d;(f[0]0||f[0]>p&&t<0)&&(t=0),(f[1]0||f[1]>m&&e<0)&&(e=0)}return[t,e]}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return typeof e=="function"?e(t):!!e}unbindEvents(){this.shortcut.unbindAll();const{graph:t}=this.context;t.off(z.DRAG_START,this.onDragStart),t.off(z.DRAG,this.onDrag),t.off(z.DRAG_END,this.onDragEnd)}destroy(){this.shortcut.destroy(),this.unbindEvents(),this.context.canvas.setCursor(this.defaultCursor),super.destroy()}}th.defaultOptions={enable:r=>"targetType"in r?r.targetType==="canvas":!0,sensitivity:10,direction:"both",range:1/0};var Xb=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class al extends xn{constructor(t,e){super(t,Object.assign({},al.defaultOptions,e)),this.enable=!1,this.enableElements=["node","combo"],this.target=[],this.shadowOrigin=[0,0],this.hiddenEdges=[],this.isDragging=!1,this.onDrop=n=>Xb(this,void 0,void 0,function*(){var i;if(this.options.dropEffect!=="link")return;const{model:a,element:s}=this.context,o=n.target.id;this.target.forEach(l=>{const c=a.getParentData(l,jt);c&&F(c)===o&&a.refreshComboData(o),a.setParent(l,o,jt)}),yield(i=s==null?void 0:s.draw({animation:!0}))===null||i===void 0?void 0:i.finished}),this.setCursor=n=>{if(this.isDragging)return;const{type:i}=n,{canvas:a}=this.context,{cursor:s}=this.options;i===z.POINTER_ENTER?a.setCursor((s==null?void 0:s.grab)||"grab"):a.setCursor((s==null?void 0:s.default)||"default")},this.onDragStart=this.onDragStart.bind(this),this.onDrag=this.onDrag.bind(this),this.onDragEnd=this.onDragEnd.bind(this),this.onDrop=this.onDrop.bind(this),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{graph:t,canvas:e}=this.context,n=e.getLayer().getContextService().$canvas;n&&(n.addEventListener("blur",this.onDragEnd),n.addEventListener("contextmenu",this.onDragEnd)),this.enableElements.forEach(i=>{t.on(`${i}:${z.DRAG_START}`,this.onDragStart),t.on(`${i}:${z.DRAG}`,this.onDrag),t.on(`${i}:${z.DRAG_END}`,this.onDragEnd),t.on(`${i}:${z.POINTER_ENTER}`,this.setCursor),t.on(`${i}:${z.POINTER_LEAVE}`,this.setCursor)}),["link"].includes(this.options.dropEffect)&&(t.on(wa.DROP,this.onDrop),t.on(ni.DROP,this.onDrop))}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map(e=>e.id).concat(t)))}getDelta(t){const e=this.context.graph.getZoom();return ur([t.dx,t.dy],e)}onDragStart(t){var e;if(this.enable=this.validate(t),!this.enable)return;const{batch:n,canvas:i,graph:a}=this.context;i.setCursor(((e=this.options.cursor)===null||e===void 0?void 0:e.grabbing)||"grabbing"),this.isDragging=!0,n.startBatch();const s=t.target.id;a.getElementState(s).includes(this.options.state)?this.target=this.getSelectedNodeIDs([s]):this.target=[s],this.hideEdge(),this.context.graph.frontElement(this.target),this.options.shadow&&this.createShadow(this.target)}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.options.shadow?this.moveShadow(e):this.moveElement(this.target,e)}onDragEnd(){var t,e,n;if(this.enable=!1,this.options.shadow){if(!this.shadow)return;this.shadow.style.visibility="hidden";const{x:s=0,y:o=0}=this.shadow.attributes,[l,c]=$t([+s,+o],this.shadowOrigin);this.moveElement(this.target,[l,c])}this.showEdges(),(e=(t=this.options).onFinish)===null||e===void 0||e.call(t,this.target);const{batch:i,canvas:a}=this.context;i.endBatch(),a.setCursor(((n=this.options.cursor)===null||n===void 0?void 0:n.grab)||"grab"),this.isDragging=!1,this.target=[]}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return at(e)?e(t):!!e}moveElement(t,e){return Xb(this,void 0,void 0,function*(){const{graph:n,model:i}=this.context,{dropEffect:a}=this.options;a==="move"&&t.forEach(s=>i.refreshComboData(s)),n.translateElementBy(Object.fromEntries(t.map(s=>[s,e])),!1)})}moveShadow(t){if(!this.shadow)return;const{x:e=0,y:n=0}=this.shadow.attributes,[i,a]=t;this.shadow.attr({x:+e+i,y:+n+a})}createShadow(t){const e=Se(this.options,"shadow"),n=Jo(t.map(c=>this.context.element.getElement(c).getBounds())),[i,a]=n.min;this.shadowOrigin=[i,a];const[s,o]=ta(n),l={width:s,height:o,x:i,y:a};this.shadow?this.shadow.attr(Object.assign(Object.assign(Object.assign({},e),l),{visibility:"visible"})):(this.shadow=new Be({style:Object.assign(Object.assign(Object.assign({$layer:"transient"},e),l),{pointerEvents:"none"})}),this.context.canvas.appendChild(this.shadow))}showEdges(){this.options.shadow||this.hiddenEdges.length===0||(this.context.graph.showElement(this.hiddenEdges),this.hiddenEdges=[])}hideEdge(){const{hideEdge:t,shadow:e}=this.options;if(t==="none"||e)return;const{graph:n}=this.context;t==="all"?this.hiddenEdges=n.getEdgeData().map(F):this.hiddenEdges=Array.from(new Set(this.target.map(i=>n.getRelatedEdgesData(i,t).map(F)).flat())),n.hideElement(this.hiddenEdges)}unbindEvents(){const{graph:t,canvas:e}=this.context,n=e.getLayer().getContextService().$canvas;n&&(n.removeEventListener("blur",this.onDragEnd),n.removeEventListener("contextmenu",this.onDragEnd)),this.enableElements.forEach(i=>{t.off(`${i}:${z.DRAG_START}`,this.onDragStart),t.off(`${i}:${z.DRAG}`,this.onDrag),t.off(`${i}:${z.DRAG_END}`,this.onDragEnd),t.off(`${i}:${z.POINTER_ENTER}`,this.setCursor),t.off(`${i}:${z.POINTER_LEAVE}`,this.setCursor)}),t.off(`combo:${z.DROP}`,this.onDrop),t.off(`canvas:${z.DROP}`,this.onDrop)}destroy(){var t;this.unbindEvents(),(t=this.shadow)===null||t===void 0||t.destroy(),super.destroy()}}al.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 TF="*",eh=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{t.has(s.id)||(t.add(s.id),r.push(s))})}return!1}function gu(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)&&gu(a,t,e,n))return!0;return!1}const Kb=()=>!0;class OF{constructor(t){Ot(this,"graph");Ot(this,"nodeFilter");Ot(this,"edgeFilter");Ot(this,"cacheEnabled");Ot(this,"inEdgesMap",new Map);Ot(this,"outEdgesMap",new Map);Ot(this,"bothEdgesMap",new Map);Ot(this,"allNodesMap",new Map);Ot(this,"allEdgesMap",new Map);Ot(this,"clearCache",()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()});Ot(this,"refreshCache",()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map(t=>t.id))});Ot(this,"updateCache",t=>{const e=new Set;t.forEach(n=>{const i=this.bothEdgesMap.get(n);if(i&&i.forEach(a=>e.add(a.id)),!this.hasNode(n))this.inEdgesMap.delete(n),this.outEdgesMap.delete(n),this.bothEdgesMap.delete(n),this.allNodesMap.delete(n);else{const a=this.graph.getRelatedEdges(n,"in").filter(this.edgeFilter),s=this.graph.getRelatedEdges(n,"out").filter(this.edgeFilter),o=Array.from(new Set([...a,...s]));o.forEach(l=>e.add(l.id)),this.inEdgesMap.set(n,a),this.outEdgesMap.set(n,s),this.bothEdgesMap.set(n,o),this.allNodesMap.set(n,this.graph.getNode(n))}}),e.forEach(n=>{this.hasEdge(n)?this.allEdgesMap.set(n,this.graph.getEdge(n)):this.allEdgesMap.delete(n)})});Ot(this,"handleGraphChanged",t=>{const e=new Set;t.changes.forEach(n=>{switch(n.type){case"NodeAdded":e.add(n.value.id);break;case"NodeDataUpdated":e.add(n.id);break;case"EdgeAdded":e.add(n.value.source),e.add(n.value.target);break;case"EdgeUpdated":(n.propertyName==="source"||n.propertyName==="target")&&(e.add(n.oldValue),e.add(n.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(n.id)){const i=t.graph.getEdge(n.id);e.add(i.source),e.add(i.target)}break;case"EdgeRemoved":e.add(n.value.source),e.add(n.value.target);break;case"NodeRemoved":e.add(n.value.id);break}}),this.updateCache(e)});this.graph=t.graph;const e=t.nodeFilter||Kb,n=t.edgeFilter||Kb;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];iy([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];gu(this.getNode(t),new Set,e,i)}}let Ne=class qT extends eh{constructor(e){super();Ot(this,"nodeMap",new Map);Ot(this,"edgeMap",new Map);Ot(this,"inEdgesMap",new Map);Ot(this,"outEdgesMap",new Map);Ot(this,"bothEdgesMap",new Map);Ot(this,"treeIndices",new Map);Ot(this,"changes",[]);Ot(this,"batchCount",0);Ot(this,"onChanged",()=>{});Ot(this,"batch",e=>{this.batchCount+=1,e(),this.batchCount-=1,this.batchCount||this.commit()});e&&(e.nodes&&this.addNodes(e.nodes),e.edges&&this.addEdges(e.edges),e.tree&&this.addTree(e.tree),e.onChanged&&(this.onChanged=e.onChanged))}commit(){const e=this.changes;this.changes=[];const n={graph:this,changes:e};this.emit("changed",n),this.onChanged(n)}reduceChanges(e){let n=[];return e.forEach(i=>{switch(i.type){case"NodeRemoved":{let a=!1;n=n.filter(s=>{if(s.type==="NodeAdded"){const o=s.value.id===i.value.id;return o&&(a=!0),!o}else{if(s.type==="NodeDataUpdated")return s.id!==i.value.id;if(s.type==="TreeStructureChanged")return s.nodeId!==i.value.id}return!0}),a||n.push(i);break}case"EdgeRemoved":{let a=!1;n=n.filter(s=>{if(s.type==="EdgeAdded"){const o=s.value.id===i.value.id;return o&&(a=!0),!o}else if(s.type==="EdgeDataUpdated"||s.type==="EdgeUpdated")return s.id!==i.value.id;return!0}),a||n.push(i);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const a=n.findIndex(o=>o.type===i.type&&o.id===i.id&&(i.propertyName===void 0||o.propertyName===i.propertyName)),s=n[a];s?i.propertyName!==void 0?s.newValue=i.newValue:(n.splice(a,1),n.push(i)):n.push(i);break}case"TreeStructureDetached":{n=n.filter(a=>a.type==="TreeStructureAttached"||a.type==="TreeStructureChanged"?a.treeKey!==i.treeKey:!0),n.push(i);break}case"TreeStructureChanged":{const a=n.find(s=>s.type==="TreeStructureChanged"&&s.treeKey===i.treeKey&&s.nodeId===i.nodeId);a?a.newParentId=i.newParentId:n.push(i);break}default:n.push(i);break}}),n}checkNodeExistence(e){this.getNode(e)}hasNode(e){return this.nodeMap.has(e)}areNeighbors(e,n){return this.getNeighbors(n).some(i=>i.id===e)}getNode(e){const n=this.nodeMap.get(e);if(!n)throw new Error("Node not found for id: "+e);return n}getRelatedEdges(e,n){if(this.checkNodeExistence(e),n==="in"){const i=this.inEdgesMap.get(e);return Array.from(i)}else if(n==="out"){const i=this.outEdgesMap.get(e);return Array.from(i)}else{const i=this.bothEdgesMap.get(e);return Array.from(i)}}getDegree(e,n){return this.getRelatedEdges(e,n).length}getSuccessors(e){const i=this.getRelatedEdges(e,"out").map(a=>this.getNode(a.target));return Array.from(new Set(i))}getPredecessors(e){const i=this.getRelatedEdges(e,"in").map(a=>this.getNode(a.source));return Array.from(new Set(i))}getNeighbors(e){const n=this.getPredecessors(e),i=this.getSuccessors(e);return Array.from(new Set([...n,...i]))}doAddNode(e){if(this.hasNode(e.id))throw new Error("Node already exists: "+e.id);this.nodeMap.set(e.id,e),this.inEdgesMap.set(e.id,new Set),this.outEdgesMap.set(e.id,new Set),this.bothEdgesMap.set(e.id,new Set),this.treeIndices.forEach(n=>{n.childrenMap.set(e.id,new Set)}),this.changes.push({type:"NodeAdded",value:e})}addNodes(e){this.batch(()=>{for(const n of e)this.doAddNode(n)})}addNode(e){this.addNodes([e])}doRemoveNode(e){const n=this.getNode(e),i=this.bothEdgesMap.get(e);i==null||i.forEach(a=>this.doRemoveEdge(a.id)),this.nodeMap.delete(e),this.treeIndices.forEach(a=>{var o,l;(o=a.childrenMap.get(e))==null||o.forEach(c=>{a.parentMap.delete(c.id)});const s=a.parentMap.get(e);s&&((l=a.childrenMap.get(s.id))==null||l.delete(n)),a.parentMap.delete(e),a.childrenMap.delete(e)}),this.bothEdgesMap.delete(e),this.inEdgesMap.delete(e),this.outEdgesMap.delete(e),this.changes.push({type:"NodeRemoved",value:n})}removeNodes(e){this.batch(()=>{e.forEach(n=>this.doRemoveNode(n))})}removeNode(e){this.removeNodes([e])}updateNodeDataProperty(e,n,i){const a=this.getNode(e);this.batch(()=>{const s=a.data[n],o=i;a.data[n]=o,this.changes.push({type:"NodeDataUpdated",id:e,propertyName:n,oldValue:s,newValue:o})})}mergeNodeData(e,n){this.batch(()=>{Object.entries(n).forEach(([i,a])=>{this.updateNodeDataProperty(e,i,a)})})}updateNodeData(...e){const n=e[0],i=this.getNode(n);if(typeof e[1]=="string"){this.updateNodeDataProperty(n,e[1],e[2]);return}let a;if(typeof e[1]=="function"){const s=e[1];a=s(i.data)}else typeof e[1]=="object"&&(a=e[1]);this.batch(()=>{const s=i.data,o=a;i.data=a,this.changes.push({type:"NodeDataUpdated",id:n,oldValue:s,newValue:o})})}checkEdgeExistence(e){if(!this.hasEdge(e))throw new Error("Edge not found for id: "+e)}hasEdge(e){return this.edgeMap.has(e)}getEdge(e){return this.checkEdgeExistence(e),this.edgeMap.get(e)}getEdgeDetail(e){const n=this.getEdge(e);return{edge:n,source:this.getNode(n.source),target:this.getNode(n.target)}}doAddEdge(e){if(this.hasEdge(e.id))throw new Error("Edge already exists: "+e.id);this.checkNodeExistence(e.source),this.checkNodeExistence(e.target),this.edgeMap.set(e.id,e);const n=this.inEdgesMap.get(e.target),i=this.outEdgesMap.get(e.source),a=this.bothEdgesMap.get(e.source),s=this.bothEdgesMap.get(e.target);n.add(e),i.add(e),a.add(e),s.add(e),this.changes.push({type:"EdgeAdded",value:e})}addEdges(e){this.batch(()=>{for(const n of e)this.doAddEdge(n)})}addEdge(e){this.addEdges([e])}doRemoveEdge(e){const n=this.getEdge(e),i=this.outEdgesMap.get(n.source),a=this.inEdgesMap.get(n.target),s=this.bothEdgesMap.get(n.source),o=this.bothEdgesMap.get(n.target);i.delete(n),a.delete(n),s.delete(n),o.delete(n),this.edgeMap.delete(e),this.changes.push({type:"EdgeRemoved",value:n})}removeEdges(e){this.batch(()=>{e.forEach(n=>this.doRemoveEdge(n))})}removeEdge(e){this.removeEdges([e])}updateEdgeSource(e,n){const i=this.getEdge(e);this.checkNodeExistence(n);const a=i.source,s=n;this.outEdgesMap.get(a).delete(i),this.bothEdgesMap.get(a).delete(i),this.outEdgesMap.get(s).add(i),this.bothEdgesMap.get(s).add(i),i.source=n,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:e,propertyName:"source",oldValue:a,newValue:s})})}updateEdgeTarget(e,n){const i=this.getEdge(e);this.checkNodeExistence(n);const a=i.target,s=n;this.inEdgesMap.get(a).delete(i),this.bothEdgesMap.get(a).delete(i),this.inEdgesMap.get(s).add(i),this.bothEdgesMap.get(s).add(i),i.target=n,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:e,propertyName:"target",oldValue:a,newValue:s})})}updateEdgeDataProperty(e,n,i){const a=this.getEdge(e);this.batch(()=>{const s=a.data[n],o=i;a.data[n]=o,this.changes.push({type:"EdgeDataUpdated",id:e,propertyName:n,oldValue:s,newValue:o})})}updateEdgeData(...e){const n=e[0],i=this.getEdge(n);if(typeof e[1]=="string"){this.updateEdgeDataProperty(n,e[1],e[2]);return}let a;if(typeof e[1]=="function"){const s=e[1];a=s(i.data)}else typeof e[1]=="object"&&(a=e[1]);this.batch(()=>{const s=i.data,o=a;i.data=a,this.changes.push({type:"EdgeDataUpdated",id:n,oldValue:s,newValue:o})})}mergeEdgeData(e,n){this.batch(()=>{Object.entries(n).forEach(([i,a])=>{this.updateEdgeDataProperty(e,i,a)})})}checkTreeExistence(e){if(!this.hasTreeStructure(e))throw new Error("Tree structure not found for treeKey: "+e)}hasTreeStructure(e){return this.treeIndices.has(e)}attachTreeStructure(e){this.treeIndices.has(e)||(this.treeIndices.set(e,{parentMap:new Map,childrenMap:new Map}),this.batch(()=>{this.changes.push({type:"TreeStructureAttached",treeKey:e})}))}detachTreeStructure(e){this.checkTreeExistence(e),this.treeIndices.delete(e),this.batch(()=>{this.changes.push({type:"TreeStructureDetached",treeKey:e})})}addTree(e,n){this.batch(()=>{this.attachTreeStructure(n);const i=[],a=Array.isArray(e)?e:[e];for(;a.length;){const s=a.shift();i.push(s),s.children&&a.push(...s.children)}this.addNodes(i),i.forEach(s=>{var o;(o=s.children)==null||o.forEach(l=>{this.setParent(l.id,s.id,n)})})})}getRoots(e){return this.checkTreeExistence(e),this.getAllNodes().filter(n=>!this.getParent(n.id,e))}getChildren(e,n){this.checkNodeExistence(e),this.checkTreeExistence(n);const a=this.treeIndices.get(n).childrenMap.get(e);return Array.from(a||[])}getParent(e,n){return this.checkNodeExistence(e),this.checkTreeExistence(n),this.treeIndices.get(n).parentMap.get(e)||null}getAncestors(e,n){const i=[];let a=this.getNode(e),s;for(;s=this.getParent(a.id,n);)i.push(s),a=s;return i}setParent(e,n,i){var u,h;this.checkTreeExistence(i);const a=this.treeIndices.get(i);if(!a)return;const s=this.getNode(e),o=a.parentMap.get(e);if((o==null?void 0:o.id)===n)return;if(n==null){o&&((u=a.childrenMap.get(o.id))==null||u.delete(s)),a.parentMap.delete(e);return}const l=this.getNode(n);a.parentMap.set(e,l),o&&((h=a.childrenMap.get(o.id))==null||h.delete(s));let c=a.childrenMap.get(l.id);c||(c=new Set,a.childrenMap.set(l.id,c)),c.add(s),this.batch(()=>{this.changes.push({type:"TreeStructureChanged",treeKey:i,nodeId:e,oldParentId:o==null?void 0:o.id,newParentId:l.id})})}dfsTree(e,n,i){const a=s=>this.getChildren(s,i);return gu(this.getNode(e),new Set,n,a)}bfsTree(e,n,i){const a=s=>this.getChildren(s,i);return iy([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 iy([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 gu(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 qT({nodes:e,edges:n});return this.treeIndices.forEach(({parentMap:a,childrenMap:s},o)=>{const l=new Map;a.forEach((u,h)=>{l.set(h,i.getNode(u.id))});const c=new Map;s.forEach((u,h)=>{c.set(h,new Set(Array.from(u).map(d=>i.getNode(d.id))))}),i.treeIndices.set(o,{parentMap:l,childrenMap:c})}),i}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(e){return new OF({graph:this,...e})}};class nh{constructor(t,e){this.context=t,this.options=e||{}}}var AF=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})},PF=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{const a=i.data._isCombo?n.combos:n.nodes,{x:s,y:o,z:l=0}=i.data;a==null||a.push({id:i.id,style:{x:s,y:o,z:l}})}),e.forEach(i=>{const{id:a,source:s,target:o,data:{points:l=[],controlPoints:c=l.slice(1,l.length-1)}}=i;n.edges.push({id:a,source:s,target:o,style:Object.assign({},c!=null&&c.length?{controlPoints:c.map(Ge)}:{})})}),n}function LF(r,t){class e extends nh{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 Rc(l)}}}execute(i,a){return AF(this,void 0,void 0,function*(){return Rc(yield this.instance.execute(this.graphData2LayoutModel(i),this.transformOptions(on({},this.options,a))))})}transformOptions(i){const{onTick:a}=i;return a&&(i.onTick=s=>a(Rc(s))),i}graphData2LayoutModel(i){const{nodes:a=[],edges:s=[],combos:o=[]}=i,l=a.map(f=>{const g=F(f),{data:v,style:p,combo:m}=f,y=PF(f,["data","style","combo"]),b={id:g,data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},v),{data:v}),m?{parentId:m}:{}),{style:p}),y)};return p!=null&&p.x&&Object.assign(b.data,{x:p.x}),p!=null&&p.y&&Object.assign(b.data,{y:p.y}),p!=null&&p.z&&Object.assign(b.data,{z:p.z}),b}),c=new Map(l.map(f=>[f.id,f])),u=s.filter(f=>{const{source:g,target:v}=f;return c.has(g)&&c.has(v)}).map(f=>{const{source:g,target:v,data:p,style:m}=f;return{id:F(f),source:g,target:v,data:Object.assign({},p),style:Object.assign({},m)}}),h=o.map(f=>({id:F(f),data:Object.assign({_isCombo:!0},f.data),style:Object.assign({},f.style)})),d=new Ne({nodes:[...l,...h],edges:u});return t.model.model.hasTreeStructure(jt)&&(d.attachTreeStructure(jt),l.forEach(f=>{const g=t.model.model.getParent(f.id,jt);g&&d.hasNode(g.id)&&d.setParent(f.id,g.id,jt)})),d}}return e}function Qd(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 Zb(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 DF=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class IF extends al{get forceLayoutInstance(){return this.context.layout.getLayoutInstance().find(t=>["d3-force","d3-force-3d"].includes(t==null?void 0:t.id))}validate(t){return this.context.layout?this.forceLayoutInstance?super.validate(t):(Ar.warn("DragElementForce only works with d3-force or d3-force-3d layout"),!1):!1}moveElement(t,e){return DF(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&&Qd(n,"setFixedPosition",t[a],[...ft([+s,+o],e)])})})}onDragStart(t){if(this.enable=this.validate(t),!this.enable)return;this.target=this.getSelectedNodeIDs([t.target.id]),this.hideEdge(),this.context.graph.frontElement(this.target);const e=this.forceLayoutInstance;e&&Zb(e,"simulation").alphaTarget(.3).restart(),this.context.graph.getNodeData(this.target).forEach(n=>{const{x:i=0,y:a=0}=n.style||{};e&&Qd(e,"setFixedPosition",F(n),[+i,+a])})}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.moveElement(this.target,e)}onDragEnd(){const t=this.forceLayoutInstance;t&&Zb(t,"simulation").alphaTarget(0),!this.options.fixed&&this.context.graph.getNodeData(this.target).forEach(e=>{t&&Qd(t,"setFixedPosition",F(e),[null,null,null])})}}var Jb=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class rh extends xn{constructor(t,e){super(t,Object.assign({},rh.defaultOptions,e)),this.isZoomEvent=n=>!!(n.data&&"scale"in n.data),this.relatedEdgeToUpdate=new Set,this.zoom=this.context.graph.getZoom(),this.fixElementSize=n=>Jb(this,void 0,void 0,function*(){if(!this.validate(n))return;const{graph:i}=this.context,{state:a,nodeFilter:s,edgeFilter:o,comboFilter:l}=this.options,c=(a?i.getElementDataByState("node",a):i.getNodeData()).filter(s),u=(a?i.getElementDataByState("edge",a):i.getEdgeData()).filter(o),h=(a?i.getElementDataByState("combo",a):i.getComboData()).filter(l),d=this.isZoomEvent(n)?this.zoom=Math.max(.01,Math.min(n.data.scale,10)):this.zoom,f=[...c,...h];f.length>0&&f.forEach(g=>this.fixNodeLike(g,d)),this.updateRelatedEdges(),u.length>0&&u.forEach(g=>this.fixEdge(g,d))}),this.cachedStyles=new Map,this.getOriginalFieldValue=(n,i,a)=>{var s;const o=this.cachedStyles.get(n)||[],l=((s=o.find(c=>c.shape===i))===null||s===void 0?void 0:s.style)||{};return a in l||(l[a]=i.attributes[a],this.cachedStyles.set(n,[...o.filter(c=>c.shape!==i),{shape:i,style:l}])),l[a]},this.scaleEntireElement=(n,i,a)=>{i.setLocalScale(1/a);const s=this.cachedStyles.get(n)||[];s.push({shape:i}),this.cachedStyles.set(n,s)},this.scaleSpecificShapes=(n,i,a)=>{const s=D9(n);(Array.isArray(a)?a:[a]).forEach(l=>{const{shape:c,fields:u}=l,h=typeof c=="function"?c(s):n.getShape(c);if(h){if(!u){this.scaleEntireElement(n.id,h,i);return}u.forEach(d=>{const f=this.getOriginalFieldValue(n.id,h,d);nt(f)&&(h.style[d]=f/i)})}})},this.skipIfExceedViewport=n=>{const{viewport:i}=this.context;return!(i!=null&&i.isInViewport(n.getRenderBounds(),!1,30))},this.fixNodeLike=(n,i)=>{const a=F(n),{element:s,model:o}=this.context,l=s.getElement(a);if(!l||this.skipIfExceedViewport(l))return;o.getRelatedEdgesData(a).forEach(h=>this.relatedEdgeToUpdate.add(F(h)));const u=this.options[l.type];if(!u){this.scaleEntireElement(a,l,i);return}this.scaleSpecificShapes(l,i,u)},this.fixEdge=(n,i)=>{const a=F(n),s=this.context.element.getElement(a);if(!s||this.skipIfExceedViewport(s))return;const o=this.options.edge;if(!o){s.style.transformOrigin="center",this.scaleEntireElement(a,s,i);return}this.scaleSpecificShapes(s,i,o)},this.updateRelatedEdges=()=>{const{element:n}=this.context;this.relatedEdgeToUpdate.size>0&&this.relatedEdgeToUpdate.forEach(i=>{const a=n.getElement(i);a==null||a.update({})}),this.relatedEdgeToUpdate.clear()},this.resetTransform=n=>Jb(this,void 0,void 0,function*(){var i;!((i=n.data)===null||i===void 0)&&i.firstRender||(this.options.reset?this.restoreCachedStyles():this.fixElementSize({data:{scale:this.zoom}}))}),this.bindEvents()}restoreCachedStyles(){if(this.cachedStyles.size>0){this.cachedStyles.forEach(i=>{i.forEach(({shape:a,style:s})=>{if(wr(s))a.setLocalScale(1);else{if(this.options.state)return;Object.entries(s).forEach(([o,l])=>a.style[o]=l)}})});const{graph:t,element:e}=this.context,n=Object.keys(Object.fromEntries(this.cachedStyles)).filter(i=>i&&t.getElementType(i)==="node");if(n.length>0){const i=new Set;n.forEach(a=>{t.getRelatedEdgesData(a).forEach(s=>i.add(F(s)))}),i.forEach(a=>{const s=e==null?void 0:e.getElement(a);s==null||s.update({})})}}}bindEvents(){const{graph:t}=this.context;t.on(X.AFTER_DRAW,this.resetTransform),t.on(X.AFTER_TRANSFORM,this.fixElementSize)}unbindEvents(){const{graph:t}=this.context;t.off(X.AFTER_DRAW,this.resetTransform),t.off(X.AFTER_TRANSFORM,this.fixElementSize)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return at(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}rh.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 FF=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class ih extends xn{constructor(t,e){super(t,Object.assign({},ih.defaultOptions,e)),this.focus=n=>FF(this,void 0,void 0,function*(){if(!this.validate(n))return;const{graph:i}=this.context;yield i.focusElement(n.target.id,this.options.animation)}),this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),$a.forEach(e=>{t.on(`${e}:${z.CLICK}`,this.focus)})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return at(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;$a.forEach(e=>{t.off(`${e}:${z.CLICK}`,this.focus)})}destroy(){this.unbindEvents(),super.destroy()}}ih.defaultOptions={animation:{easing:"ease-in",duration:500},enable:!0};class ah extends xn{constructor(t,e){super(t,Object.assign({},ah.defaultOptions,e)),this.isFrozen=!1,this.toggleFrozen=n=>{this.isFrozen=n.type==="dragstart"},this.hoverElement=n=>{if(!this.validate(n))return;const i=n.type===z.POINTER_ENTER;this.updateElementsState(n,i);const{onHover:a,onHoverEnd:s}=this.options;i?a==null||a(n):s==null||s(n)},this.updateElementsState=(n,i)=>{if(!this.options.state&&!this.options.inactiveState)return;const{graph:a}=this.context,{state:s,animation:o,inactiveState:l}=this.options,c=this.getActiveIds(n),u={};if(s&&Object.assign(u,this.getElementsState(c,s,i)),l){const h=nT(a.getData(),!0).filter(d=>!c.includes(d));Object.assign(u,this.getElementsState(h,l,i))}a.setElementState(u,o)},this.getElementsState=(n,i,a)=>{const{graph:s}=this.context,o={};return n.forEach(l=>{const c=s.getElementState(l);a?o[l]=c.includes(i)?c:[...c,i]:o[l]=c.filter(u=>u!==i)}),o},this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),$a.forEach(n=>{t.on(`${n}:${z.POINTER_ENTER}`,this.hoverElement),t.on(`${n}:${z.POINTER_LEAVE}`,this.hoverElement)});const e=this.context.canvas.document;e.addEventListener(`${z.DRAG_START}`,this.toggleFrozen),e.addEventListener(`${z.DRAG_END}`,this.toggleFrozen)}getActiveIds(t){const{graph:e}=this.context,{degree:n,direction:i}=this.options,a=t.target.id;return n?fT(e,t.targetType,a,typeof n=="function"?n(t):n,i):[a]}validate(t){if(this.destroyed||this.isFrozen||Zu(t.target)||this.context.graph.isCollapsingExpanding)return!1;const{enable:e}=this.options;return at(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;$a.forEach(n=>{t.off(`${n}:${z.POINTER_ENTER}`,this.hoverElement),t.off(`${n}:${z.POINTER_LEAVE}`,this.hoverElement)});const e=this.context.canvas.document;e.removeEventListener(`${z.DRAG_START}`,this.toggleFrozen),e.removeEventListener(`${z.DRAG_END}`,this.toggleFrozen)}destroy(){this.unbindEvents(),super.destroy()}}ah.defaultOptions={animation:!1,enable:!0,degree:0,direction:"both",state:"active",inactiveState:void 0};class BF extends Qo{onPointerDown(t){if(!super.validate(t)||!super.isKeydown()||this.points)return;const{canvas:e}=this.context;this.pathShape=new Tn({id:"g6-lasso-select",style:this.options.style}),e.appendChild(this.pathShape),this.points=[cu(t)]}onPointerMove(t){var e;if(!this.points)return;const{immediately:n,mode:i}=this.options;this.points.push(cu(t)),(e=this.pathShape)===null||e===void 0||e.setAttribute("d",A9(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 sh extends xn{constructor(t,e){super(t,Object.assign({},sh.defaultOptions,e)),this.hiddenShapes=[],this.isVisible=!0,this.setElementsVisibility=(n,i,a)=>{n.filter(Boolean).forEach(s=>{i==="hidden"&&!s.isVisible()?this.hiddenShapes.push(s):i==="visible"&&this.hiddenShapes.includes(s)?this.hiddenShapes.splice(this.hiddenShapes.indexOf(s),1):Ba(s,i,a)})},this.filterShapes=(n,i)=>{if(at(i))return s=>!i(n,s);const a=i==null?void 0:i[n];return s=>s.className?!(a!=null&&a.includes(s.className)):!0},this.hideShapes=n=>{if(!this.validate(n)||!this.isVisible)return;const{element:i}=this.context,{shapes:a={}}=this.options;this.setElementsVisibility(i.getNodes(),"hidden",this.filterShapes("node",a)),this.setElementsVisibility(i.getEdges(),"hidden",this.filterShapes("edge",a)),this.setElementsVisibility(i.getCombos(),"hidden",this.filterShapes("combo",a)),this.isVisible=!1},this.showShapes=Vo(n=>{if(!this.validate(n)||this.isVisible)return;const{element:i}=this.context;this.setElementsVisibility(i.getNodes(),"visible"),this.setElementsVisibility(i.getEdges(),"visible"),this.setElementsVisibility(i.getCombos(),"visible"),this.isVisible=!0},this.options.debounce),this.bindEvents()}bindEvents(){const{graph:t}=this.context;t.on(X.BEFORE_TRANSFORM,this.hideShapes),t.on(X.AFTER_TRANSFORM,this.showShapes)}unbindEvents(){const{graph:t}=this.context;t.off(X.BEFORE_TRANSFORM,this.hideShapes),t.off(X.AFTER_TRANSFORM,this.showShapes)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return at(e)?e(t):!!e}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}sh.defaultOptions={enable:!0,debounce:200,shapes:r=>r==="node"};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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class oh extends xn{constructor(t,e){super(t,Object.assign({},oh.defaultOptions,e)),this.onWheel=n=>Qb(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 Rs(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){var t,e;const{trigger:n}=this.options;if(this.shortcut.unbindAll(),me(n)){(t=this.graphDom)===null||t===void 0||t.removeEventListener(z.WHEEL,this.onWheel);const{up:i=[],down:a=[],left:s=[],right:o=[]}=n;this.shortcut.bind(i,l=>this.scroll([0,-10],l)),this.shortcut.bind(a,l=>this.scroll([0,10],l)),this.shortcut.bind(s,l=>this.scroll([-10,0],l)),this.shortcut.bind(o,l=>this.scroll([10,0],l))}else(e=this.graphDom)===null||e===void 0||e.addEventListener(z.WHEEL,this.onWheel,{passive:!1})}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}formatDisplacement(t){const{sensitivity:e}=this.options;return t=Gr(t,e),t=this.clampByDirection(t),t=this.clampByRange(t),t}clampByDirection([t,e]){const{direction:n}=this.options;return n==="x"?e=0:n==="y"&&(t=0),[t,e]}clampByRange([t,e]){const{viewport:n,canvas:i}=this.context,[a,s]=i.getSize(),[o,l,c,u]=Pr(this.options.range),h=[s*o,a*l,s*c,a*u],d=ea(o1(n.getCanvasCenter()),h),f=$t(n.getViewportCenter(),[t,e,0]);if(!cr(f,d)){const{min:[g,v],max:[p,m]}=d;(f[0]0||f[0]>p&&t<0)&&(t=0),(f[1]0||f[1]>m&&e<0)&&(e=0)}return[t,e]}scroll(t,e){return Qb(this,void 0,void 0,function*(){if(!this.validate(e))return;const{onFinish:n}=this.options,i=this.context.graph,a=this.formatDisplacement(t);yield i.translateBy(a,!1),n==null||n()})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return at(e)?e(t):!!e}destroy(){var t;this.shortcut.destroy(),(t=this.graphDom)===null||t===void 0||t.removeEventListener(z.WHEEL,this.onWheel),super.destroy()}}oh.defaultOptions={enable:!0,sensitivity:1,preventDefault:!0,range:1/0};var tw=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class lh extends xn{constructor(t,e){super(t,Object.assign({},lh.defaultOptions,e)),this.zoom=(n,i,a)=>tw(this,void 0,void 0,function*(){if(!this.validate(i))return;const{graph:s}=this.context;let o;"viewport"in i&&(o=Ge(i.viewport));const{sensitivity:l,onFinish:c}=this.options,u=1+ce(n,-50,50)*l/100,h=s.getZoom();yield s.zoomTo(h*u,a,o),c==null||c()}),this.onReset=()=>tw(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 Rs(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{trigger:t}=this.options;if(this.shortcut.unbindAll(),Array.isArray(t))if(t.includes(z.PINCH))this.shortcut.bind([z.PINCH],e=>{this.zoom(e.scale,e,!1)});else{const e=this.context.canvas.getContainer();e==null||e.addEventListener(z.WHEEL,this.preventDefault),this.shortcut.bind([...t,z.WHEEL],n=>{const{deltaX:i,deltaY:a}=n;this.zoom(-(a??i),n,!1)})}if(typeof t=="object"){const{zoomIn:e=[],zoomOut:n=[],reset:i=[]}=t;this.shortcut.bind(e,a=>this.zoom(10,a,this.options.animation)),this.shortcut.bind(n,a=>this.zoom(-10,a,this.options.animation)),this.shortcut.bind(i,this.onReset)}}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return at(e)?e(t):!!e}destroy(){var t;this.shortcut.destroy(),(t=this.context.canvas.getContainer())===null||t===void 0||t.removeEventListener(z.WHEEL,this.preventDefault),super.destroy()}}lh.defaultOptions={animation:{duration:200},enable:!0,sensitivity:1,trigger:[],preventDefault:!0};function zF(r,t,e,n){return n===void 0&&(n="height"),e==="center"?(r[n]+t[n])/2:r.height}var ia={assign:Object.assign,getHeight:zF},GT=ia,S1=18,$F=S1*2,ew=S1,jF={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||ew},getVGap:function(t){return t.vgap||ew},getChildren:function(t){return t.children},getHeight:function(t){return t.height||$F},getWidth:function(t){var e=t.label||" ";return t.width||e.split("").length*S1}};function vu(r,t){var e=this;if(e.vgap=e.hgap=0,r instanceof vu)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}GT.assign(vu.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 qF(r,t,e){t===void 0&&(t={}),t=GT.assign({},jF,t);var n=new vu(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;lw.low&&(w=w.nxt);var C=S+x.prelim+x.w-(_+E.prelim);C>0&&(_+=C,s(y,b,w.index,C));var k=c(x),M=c(E);k<=M&&(x=l(x),x!==null&&(S+=x.mod)),k>=M&&(E=o(E),E!==null&&(_+=E.mod))}!x&&E?u(y,b,E,_):x&&!E&&h(y,b,x,S)}function s(y,b,w,x){y.c[b].mod+=x,y.c[b].msel+=x,y.c[b].mser+=x,g(y,b,w,x)}function o(y){return y.cs===0?y.tl:y.c[0]}function l(y){return y.cs===0?y.tr:y.c[y.cs-1]}function c(y){return y.y+y.h}function u(y,b,w,x){var S=y.c[0].el;S.tl=w;var E=x-w.mod-y.c[0].msel;S.mod+=E,S.prelim-=E,y.c[0].el=y.c[b].el,y.c[0].msel=y.c[b].msel}function h(y,b,w,x){var S=y.c[b].er;S.tr=w;var E=x-w.mod-y.c[b].mser;S.mod+=E,S.prelim-=E,y.c[b].er=y.c[b-1].er,y.c[b].mser=y.c[b-1].mser}function d(y){y.prelim=(y.c[0].prelim+y.c[0].mod+y.c[y.cs-1].mod+y.c[y.cs-1].prelim+y.c[y.cs-1].w)/2-y.w/2}function f(y,b){b+=y.mod,y.x=y.prelim+b,v(y);for(var w=0;w=w.low;)w=w.nxt;return{low:y,index:b,nxt:w}}YT(r,e);var m=ao.fromNode(r,e);return n(m),f(m,0),UT(m,r,e),VF(r,e),r},nw=WT,XT=function(r,t){for(var e=nw(r.data,t,!0),n=nw(r.data,t,!0),i=r.children.length,a=Math.round(i/2),s=t.getSide||function(u,h){return h-1},KF=Ei[0],_1=function(r,t,e){var n=t.direction||KF;if(t.isHorizontal=XF(n),Ei.indexOf(n)===-1)throw new TypeError("Invalid direction: "+n);if(n===Ei[0])e(r,t);else if(n===Ei[1])e(r,t),r.right2left();else if(n===Ei[2])e(r,t);else if(n===Ei[3])e(r,t),r.bottom2top();else if(n===Ei[4]||n===Ei[5]){var i=UF(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)),ZF(r,t),r};function ZF(r,t){if(t.radial){var e=t.isHorizontal?["x","y"]:["y","x"],n=e[0],i=e[1],a={x:1/0,y:1/0},s={x:-1/0,y:-1/0},o=0;r.DFTraverse(function(u){o++;var h=u.x,d=u.y;a.x=Math.min(a.x,h),a.y=Math.min(a.y,d),s.x=Math.max(s.x,h),s.y=Math.max(s.y,d)});var l=s[i]-a[i];if(l===0)return;var c=Math.PI*2/o;r.DFTraverse(function(u){var h=(u[i]-a[i])/l*(Math.PI*2-c)+c,d=u[n]-r[n];u.x=Math.cos(h)*d,u.y=Math.sin(h)*d})}}function JF(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,ay(r,t)}function ay(r,t){return ay=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},ay(r,t)}var QF=ch,tB=HF,eB=_1,nB=ia,rB=function(r){function t(){return r.apply(this,arguments)||this}JF(t,r);var e=t.prototype;return e.execute=function(){var i=this;return eB(i.rootNode,i.options,tB)},t}(QF),iB={};function aB(r,t){return t=nB.assign({},iB,t),new rB(r,t).execute()}var sB=aB,oB=ia;function lB(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 cB={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function KT(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){KT(n,t.children[i],e)})}var uB=function(r,t){t===void 0&&(t={}),t=oB.assign({},cB,t);var e=0;function n(l){if(!l)return null;l.width=0,l.depth&&l.depth>e&&(e=l.depth);var c=l.children,u=c.length,h=new lB(l.height,[]);return c.forEach(function(d,f){var g=n(d);h.children.push(g),f===0&&(h.leftChild=g),f===u-1&&(h.rightChild=g)}),h.originNode=l,h.isLeaf=l.isLeaf(),h}function i(l){if(l.isLeaf||l.children.length===0)l.drawingDepth=e;else{var c=l.children.map(function(h){return i(h)}),u=Math.min.apply(null,c);l.drawingDepth=u-1}return l.drawingDepth}var a;function s(l){l.x=l.drawingDepth*t.rankSep,l.isLeaf?(l.y=0,a&&(l.y=a.y+a.height+t.nodeSep,l.originNode.parent!==a.originNode.parent&&(l.y+=t.subTreeSep)),a=l):(l.children.forEach(function(c){s(c)}),l.y=(l.leftChild.y+l.rightChild.y)/2)}var o=n(r);return i(o),s(o),KT(o,r,t.isHorizontal),r};function hB(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,sy(r,t)}function sy(r,t){return sy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},sy(r,t)}var dB=ch,fB=uB,gB=_1,vB=ia,pB=function(r){function t(){return r.apply(this,arguments)||this}hB(t,r);var e=t.prototype;return e.execute=function(){var i=this;return i.rootNode.width=0,gB(i.rootNode,i.options,fB)},t}(dB),mB={};function yB(r,t){return t=vB.assign({},mB,t),new pB(r,t).execute()}var bB=yB,rw=ia;function wB(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+rw.getHeight(t,r,i),t.parent&&r.parent.id!==t.parent.id){var s=t.parent,o=s.y+rw.getHeight(s,r,i);r.y=o>r.y?o:r.y}}else r.y=0}var xB=function(r,t,e,n){var i=null;r.eachNode(function(a){wB(a,i,t,e,n),i=a})};function EB(r,t){r.prototype=Object.create(t.prototype),r.prototype.constructor=r,oy(r,t)}function oy(r,t){return oy=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},oy(r,t)}var SB=ch,sc=xB,_B=XT,kB=ia,so=["LR","RL","H"],MB=so[0],CB=function(r){function t(){return r.apply(this,arguments)||this}EB(t,r);var e=t.prototype;return e.execute=function(){var i=this,a=i.options,s=i.rootNode;a.isHorizontal=!0;var o=a.indent,l=o===void 0?20:o,c=a.dropCap,u=c===void 0?!0:c,h=a.direction,d=h===void 0?MB:h,f=a.align;if(d&&so.indexOf(d)===-1)throw new TypeError("Invalid direction: "+d);if(d===so[0])sc(s,l,u,f);else if(d===so[1])sc(s,l,u,f),s.right2left();else if(d===so[2]){var g=_B(s,a),v=g.left,p=g.right;sc(v,l,u,f),v.right2left(),sc(p,l,u,f);var m=v.getBoundingBox();p.translate(m.width,0),s.x=p.x-s.width/2}return s},t}(SB),TB={};function OB(r,t){return t=kB.assign({},TB,t),new CB(r,t).execute()}var AB=OB,PB=ia;function ZT(r,t){var e=0;return r.children.length?r.children.forEach(function(n){e+=ZT(n,t)}):e=r.height,r._subTreeSep=t.getSubTreeSep(r.data),r.totalHeight=Math.max(r.height,e)+2*r._subTreeSep,r.totalHeight}function JT(r){var t=r.children,e=t.length;if(e){t.forEach(function(l){JT(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 NB={getSubTreeSep:function(){return 0}},RB=function(r,t){t===void 0&&(t={}),t=PB.assign({},NB,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,ZT(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{if(r!=="next"&&r!=="prev")return t},iw=r=>{r.prev.next=r.next,r.next.prev=r.prev,delete r.next,delete r.prev};let VB=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 iw(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&iw(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,WB)),n=n==null?void 0:n.prev;return`[${t.join(", ")}]`}},HB=class extends VB{};const UB=()=>1,YB=(r,t)=>{var e;if(r.getAllNodes().length<=1)return[];const n=KB(r,t||UB);return(e=XB(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()},XB=(r,t,e)=>{let n=[];const i=t[t.length-1],a=t[0];let s;for(;r.getAllNodes().length;){for(;s=a.dequeue();)tf(r,t,e,s);for(;s=i.dequeue();)tf(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(tf(r,t,e,s,!0));break}}}return n},tf=(r,t,e,n,i)=>{var a,s;const o=[];return r.hasNode(n.v)&&((a=r.getRelatedEdges(n.v,"in"))===null||a===void 0||a.forEach(l=>{const c=l.data.weight,u=r.getNode(l.source);i&&o.push({v:l.source,w:l.target,in:0,out:0}),u.data.out===void 0&&(u.data.out=0),u.data.out-=c,cy(t,e,Object.assign({v:u.id},u.data))}),(s=r.getRelatedEdges(n.v,"out"))===null||s===void 0||s.forEach(l=>{const c=l.data.weight,u=l.target,h=r.getNode(u);h.data.in===void 0&&(h.data.in=0),h.data.in-=c,cy(t,e,Object.assign({v:h.id},h.data))}),r.removeNode(n.v)),i?o:void 0},KB=(r,t)=>{const e=new Ne;let n=0,i=0;r.getAllNodes().forEach(l=>{e.addNode({id:l.id,data:{v:l.id,in:0,out:0}})}),r.getAllEdges().forEach(l=>{const c=e.getRelatedEdges(l.source,"out").find(h=>h.target===l.target),u=(t==null?void 0:t(l))||1;c?e.updateEdgeData(c==null?void 0:c.id,Object.assign(Object.assign({},c.data),{weight:c.data.weight+u})):e.addEdge({id:l.id,source:l.source,target:l.target,data:{weight:u}}),i=Math.max(i,e.getNode(l.source).data.out+=u),n=Math.max(n,e.getNode(l.target).data.in+=u)});const a=[],s=i+n+3;for(let l=0;l{cy(a,o,Object.assign({v:l.id},e.getNode(l.id).data))}),{buckets:a,zeroIdx:o,graph:e}},cy=(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)},ZB=(r,t)=>{const n=YB(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)})})},JB=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})})}})},QB=(r,t)=>Number(r)-Number(t),Ds=(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},tz=r=>{const t=new Ne;return r.getAllNodes().forEach(e=>{t.addNode(Object.assign({},e))}),r.getAllEdges().forEach(e=>{const n=t.getRelatedEdges(e.source,"out").find(i=>i.target===e.target);n?t.updateEdgeData(n==null?void 0:n.id,Object.assign(Object.assign({},n.data),{weight:n.data.weight+e.data.weight||0,minlen:Math.max(n.data.minlen,e.data.minlen||1)})):t.addEdge({id:e.id,source:e.source,target:e.target,data:{weight:e.data.weight||0,minlen:e.data.minlen||1}})}),t},QT=r=>{const t=new Ne;return r.getAllNodes().forEach(e=>{r.getChildren(e.id).length||t.addNode(Object.assign({},e))}),r.getAllEdges().forEach(e=>{t.addEdge(e)}),t},ez=(r,t)=>r==null?void 0:r.reduce((e,n,i)=>(e[n]=t[i],e),{}),aw=(r,t)=>{const e=Number(r.x),n=Number(r.y),i=Number(t.x)-e,a=Number(t.y)-n;let s=Number(r.width)/2,o=Number(r.height)/2;if(!i&&!a)return{x:0,y:0};let l,c;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,c=o):(i<0&&(s=-s),l=s,c=s*a/i),{x:e+l,y:n+c}},Fo=r=>{const t=[],e=tO(r)+1;for(let n=0;n{const i=n.data.rank;i!==void 0&&t[i]&&t[i].push(n.id)});for(let n=0;nQB(r.getNode(i).data.order,r.getNode(a).data.order));return t},nz=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)})},rz=(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{const u=r.getNode(c);u&&(u.data.rank=u.data.rank||0,u.data.rank+=s)}))}},sw=(r,t,e,n)=>{const i={width:0,height:0};return nt(e)&&nt(n)&&(i.rank=e,i.order=n),Ds(r,"border",i,t)},tO=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},iz=(r,t)=>{const e={lhs:[],rhs:[]};return r==null||r.forEach(n=>{t(n)?e.lhs.push(n):e.rhs.push(n)}),e},k1=(r,t)=>r.reduce((e,n)=>{const i=t(e),a=t(n);return i>a?n:e}),eO=(r,t,e,n,i,a)=>{n.includes(t.id)||(n.push(t.id),e||a.push(t.id),i(t.id).forEach(s=>eO(r,s,e,n,i,a)),e&&a.push(t.id))},nO=(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))eO(r,l,e==="post",o,a,s);else throw new Error(`Graph does not have node: ${l}`)}),s},az=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;at(e.id))},ow=(r,t,e,n,i,a)=>{const s={rank:a,borderType:t,width:0,height:0},o=i.data[t][a-1],l=Ds(r,"border",s,e);i.data[t][a]=l,r.setParent(l,n),o&&r.addEdge({id:`e${Math.random()}`,source:o,target:l,data:{weight:1}})},sz=(r,t)=>{const e=t.toLowerCase();(e==="lr"||e==="rl")&&rO(r)},oz=(r,t)=>{const e=t.toLowerCase();(e==="bt"||e==="rl")&&lz(r),(e==="lr"||e==="rl")&&(cz(r),rO(r))},rO=r=>{r.getAllNodes().forEach(t=>{lw(t)}),r.getAllEdges().forEach(t=>{lw(t)})},lw=r=>{const t=r.data.width;r.data.width=r.data.height,r.data.height=t},lz=r=>{r.getAllNodes().forEach(t=>{ef(t.data)}),r.getAllEdges().forEach(t=>{var e;(e=t.data.points)===null||e===void 0||e.forEach(n=>ef(n)),t.data.hasOwnProperty("y")&&ef(t.data)})},ef=r=>{r!=null&&r.y&&(r.y=-r.y)},cz=r=>{r.getAllNodes().forEach(t=>{nf(t.data)}),r.getAllEdges().forEach(t=>{var e;(e=t.data.points)===null||e===void 0||e.forEach(n=>nf(n)),t.data.hasOwnProperty("x")&&nf(t.data)})},nf=r=>{const t=r.x;r.x=r.y,r.y=t},uz=r=>{const t=Ds(r,"root",{},"_root"),e=hz(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=dz(r)+1;return r.getRoots().forEach(o=>{iO(r,t,a,s,i,e,o.id)}),{nestingRoot:t,nodeRankFactor:a}},iO=(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=sw(r,"_bt"),c=sw(r,"_bb"),u=r.getNode(s);r.setParent(l,s),u.data.borderTop=l,r.setParent(c,s),u.data.borderBottom=c,o==null||o.forEach(h=>{iO(r,t,e,n,i,a,h.id);const d=h.data.borderTop?h.data.borderTop:h.id,f=h.data.borderBottom?h.data.borderBottom:h.id,g=h.data.borderTop?n:2*n,v=d!==f?1:i-a[s]+1;r.addEdge({id:`e${Math.random()}`,source:l,target:d,data:{minlen:v,weight:g,nestingEdge:!0}}),r.addEdge({id:`e${Math.random()}`,source:f,target:c,data:{minlen:v,weight:g,nestingEdge:!0}})}),r.getParent(s)||r.addEdge({id:`e${Math.random()}`,source:t,target:l,data:{weight:0,minlen:i+a[s]}})},hz=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},dz=r=>{let t=0;return r.getAllEdges().forEach(e=>{t+=e.data.weight}),t},fz=(r,t)=>{t&&r.removeNode(t),r.getAllEdges().forEach(e=>{e.data.nestingEdge&&r.removeEdge(e.id)})},gz="edge",aO="edge-label",vz=(r,t)=>{r.getAllEdges().forEach(e=>pz(r,e,t))},pz=(r,t,e)=>{let n=t.source,i=r.getNode(n).data.rank;const a=t.target,s=r.getNode(a).data.rank,o=t.data.labelRank;if(s===i+1)return;r.removeEdge(t.id);let l,c,u;for(u=0,++i;i{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===aO&&(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)})},yz=(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}})},bz=(r,t,e)=>{const n=wz(r),i=new Ne({tree:[{id:n,children:[],data:{}}]});return r.getAllNodes().forEach(a=>{const s=r.getParent(a.id);(a.data.rank===t||a.data.minRank<=t&&t<=a.data.maxRank)&&(i.hasNode(a.id)||i.addNode(Object.assign({},a)),s!=null&&s.id&&!i.hasNode(s==null?void 0:s.id)&&i.addNode(Object.assign({},s)),i.setParent(a.id,(s==null?void 0:s.id)||n),r.getRelatedEdges(a.id,e).forEach(o=>{const l=o.source===a.id?o.target:o.source;i.hasNode(l)||i.addNode(Object.assign({},r.getNode(l)));const c=i.getRelatedEdges(l,"out").find(({target:h})=>h===a.id),u=c!==void 0?c.data.weight:0;c?i.updateEdgeData(c.id,Object.assign(Object.assign({},c.data),{weight:o.data.weight+u})):i.addEdge({id:o.id,source:l,target:a.id,data:{weight:o.data.weight+u}})}),a.data.hasOwnProperty("minRank")&&i.updateNodeData(a.id,Object.assign(Object.assign({},a.data),{borderLeft:a.data.borderLeft[t],borderRight:a.data.borderRight[t]})))}),i},wz=r=>{let t;for(;r.hasNode(t=`_root${Math.random()}`););return t},xz=(r,t,e)=>{const n=ez(e,e.map((u,h)=>h)),a=t.map(u=>{const h=r.getRelatedEdges(u,"out").map(d=>({pos:n[d.target]||0,weight:d.data.weight}));return h==null?void 0:h.sort((d,f)=>d.pos-f.pos)}).flat().filter(u=>u!==void 0);let s=1;for(;s{if(u){let h=u.pos+s;l[h]+=u.weight;let d=0;for(;h>0;)h%2&&(d+=l[h+1]),h=h-1>>1,l[h]+=u.weight;c+=u.weight*d}}),c},cw=(r,t)=>{let e=0;for(let n=1;n<(t==null?void 0:t.length);n+=1)e+=xz(r,t[n-1],t[n]);return e},uw=r=>{const t={},e=r.getAllNodes(),n=e.map(c=>{var u;return(u=c.data.rank)!==null&&u!==void 0?u:-1/0}),i=Math.max(...n),a=[];for(let c=0;cr.getNode(c.id).data.rank-r.getNode(u.id).data.rank),l=s.filter(c=>r.getNode(c.id).data.fixorder!==void 0).sort((c,u)=>r.getNode(c.id).data.fixorder-r.getNode(u.id).data.fixorder);return l==null||l.forEach(c=>{isNaN(r.getNode(c.id).data.rank)||a[r.getNode(c.id).data.rank].push(c.id),t[c.id]=!0}),s==null||s.forEach(c=>r.dfsTree(c.id,u=>{if(t.hasOwnProperty(u.id))return!0;t[u.id]=!0,isNaN(u.data.rank)||a[u.data.rank].push(u.id)})),a},Ez=(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}}),Sz=(r,t)=>{var e,n,i;const a={};r==null||r.forEach((o,l)=>{a[o.v]={i:l,indegree:0,in:[],out:[],vs:[o.v]};const c=a[o.v];o.barycenter!==void 0&&(c.barycenter=o.barycenter,c.weight=o.weight)}),(e=t.getAllEdges())===null||e===void 0||e.forEach(o=>{const l=a[o.source],c=a[o.target];l!==void 0&&c!==void 0&&(c.indegree++,l.out.push(a[o.target]))});const s=(i=(n=Object.values(a)).filter)===null||i===void 0?void 0:i.call(n,o=>!o.indegree);return _z(s)},_z=r=>{var t,e;const n=[],i=l=>c=>{c.merged||(c.barycenter===void 0||l.barycenter===void 0||c.barycenter>=l.barycenter)&&kz(l,c)},a=l=>c=>{c.in.push(l),--c.indegree===0&&r.push(c)};for(;r!=null&&r.length;){const l=r.pop();n.push(l),(t=l.in.reverse())===null||t===void 0||t.forEach(c=>i(l)(c)),(e=l.out)===null||e===void 0||e.forEach(c=>a(l)(c))}const s=n.filter(l=>!l.merged),o=["vs","i","barycenter","weight"];return s.map(l=>{const c={};return o==null||o.forEach(u=>{l[u]!==void 0&&(c[u]=l[u])}),c})},kz=(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},Mz=(r,t,e,n)=>{const i=iz(r,d=>{const f=d.hasOwnProperty("fixorder")&&!isNaN(d.fixorder);return n?!f&&d.hasOwnProperty("barycenter"):f||d.hasOwnProperty("barycenter")}),a=i.lhs,s=i.rhs.sort((d,f)=>-d.i- -f.i),o=[];let l=0,c=0,u=0;a==null||a.sort(Cz(!!t,!!e)),u=hw(o,s,u),a==null||a.forEach(d=>{var f;u+=(f=d.vs)===null||f===void 0?void 0:f.length,o.push(d.vs),l+=d.barycenter*d.weight,c+=d.weight,u=hw(o,s,u)});const h={vs:o.flat()};return c&&(h.barycenter=l/c,h.weight=c),h},hw=(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},Cz=(r,t)=>(e,n)=>{if(e.fixorder!==void 0&&n.fixorder!==void 0)return e.fixorder-n.fixorder;if(e.barycentern.barycenter)return 1;if(t&&e.order!==void 0&&n.order!==void 0){if(e.ordern.order)return 1}return r?n.i-e.i:e.i-n.i},sO=(r,t,e,n,i,a)=>{var s,o,l,c;let u=r.getChildren(t).map(y=>y.id);const h=r.getNode(t),d=h?h.data.borderLeft:void 0,f=h?h.data.borderRight:void 0,g={};d&&(u=u==null?void 0:u.filter(y=>y!==d&&y!==f));const v=Ez(r,u||[]);v==null||v.forEach(y=>{var b;if(!((b=r.getChildren(y.v))===null||b===void 0)&&b.length){const w=sO(r,y.v,e,n,a);g[y.v]=w,w.hasOwnProperty("barycenter")&&Oz(y,w)}});const p=Sz(v,e);Tz(p,g),(s=p.filter(y=>y.vs.length>0))===null||s===void 0||s.forEach(y=>{const b=r.getNode(y.vs[0]);b&&(y.fixorder=b.data.fixorder,y.order=b.data.order)});const m=Mz(p,n,i,a);if(d&&(m.vs=[d,m.vs,f].flat(),!((o=r.getPredecessors(d))===null||o===void 0)&&o.length)){const y=r.getNode(((l=r.getPredecessors(d))===null||l===void 0?void 0:l[0].id)||""),b=r.getNode(((c=r.getPredecessors(f))===null||c===void 0?void 0:c[0].id)||"");m.hasOwnProperty("barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+y.data.order+b.data.order)/(m.weight+2),m.weight+=2}return m},Tz=(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()})},Oz=(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)},Az=(r,t)=>{const e=tO(r),n=[],i=[];for(let u=1;u-1;u--)i.push(u);const a=dw(r,n,"in"),s=dw(r,i,"out");let o=uw(r);rf(r,o);let l=Number.POSITIVE_INFINITY,c;for(let u=0,h=0;h<4;++u,++h){fw(u%2?a:s,u%4>=2,!1,t),o=Fo(r);const d=cw(r,o);d=2,!0,t),o=Fo(r);const d=cw(r,o);dt.map(n=>bz(r,n,e)),fw=(r,t,e,n)=>{const i=new Ne;r==null||r.forEach(a=>{var s;const o=a.getRoots()[0].id,l=sO(a,o,i,t,e,n);for(let c=0;c<((s=l.vs)===null||s===void 0?void 0:s.length);c++){const u=a.getNode(l.vs[c]);u&&(u.data.order=c)}yz(a,i,l.vs)})},rf=(r,t)=>{t==null||t.forEach(e=>{e==null||e.forEach((n,i)=>{r.getNode(n).data.order=i})})},Pz=(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{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))})},Nz=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},Rz=(r,t,e,n)=>{var i,a;const s=[],o=[],l=Math.min(t[e].low,t[n].low),c=Math.max(t[e].lim,t[n].lim);let u,h;u=e;do u=(i=r.getParent(u))===null||i===void 0?void 0:i.id,s.push(u);while(u&&(t[u].low>l||c>t[u].lim));for(h=u,u=n;u&&u!==h;)o.push(u),u=(a=r.getParent(u))===null||a===void 0?void 0:a.id;return{lca:h,path:s.concat(o.reverse())}},Lz=(r,t)=>{const e=Nz(r);t.forEach(n=>{var i,a;let s=n,o=r.getNode(s);const l=o.data.originalEdge;if(!l)return;const c=Rz(r,e,l.source,l.target),u=c.path,h=c.lca;let d=0,f=u[d],g=!0;for(;s!==l.target;){if(o=r.getNode(s),g){for(;f!==h&&((i=r.getNode(f))===null||i===void 0?void 0:i.data.maxRank){const e={},n=(i,a)=>{let s=0,o=0;const l=i.length,c=a==null?void 0:a[(a==null?void 0:a.length)-1];return a==null||a.forEach((u,h)=>{var d;const f=Fz(r,u),g=f?r.getNode(f.id).data.order:l;(f||u===c)&&((d=a.slice(o,h+1))===null||d===void 0||d.forEach(v=>{var p;(p=r.getPredecessors(v))===null||p===void 0||p.forEach(m=>{var y;const b=r.getNode(m.id),w=b.data.order;(w{const e={};function n(o,l,c,u,h){var d,f;let g;for(let v=l;v{const m=r.getNode(p.id);m.data.dummy&&(m.data.orderh)&&oO(e,p.id,g)}))}function i(o){return JSON.stringify(o.slice(1))}function a(o,l){const c=i(o);l.get(c)||(n(...o),l.set(c,!0))}const s=(o,l)=>{let c=-1,u,h=0;const d=new Map;return l==null||l.forEach((f,g)=>{var v;if(((v=r.getNode(f))===null||v===void 0?void 0:v.data.dummy)==="border"){const p=r.getPredecessors(f)||[];p.length&&(u=r.getNode(p[0].id).data.order,a([l,h,g,c,u],d),h=g,c=u)}a([l,h,l.length,u,o.length],d)}),l};return t!=null&&t.length&&t.reduce(s),e},Fz=(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)},oO=(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},Bz=(r,t,e)=>{let n=t,i=e;if(n>i){const a=t;n=i,i=a}return!!r[n]},zz=(r,t,e,n)=>{const i={},a={},s={};return t==null||t.forEach(o=>{o==null||o.forEach((l,c)=>{i[l]=l,a[l]=l,s[l]=c})}),t==null||t.forEach(o=>{let l=-1;o==null||o.forEach(c=>{let u=n(c).map(h=>h.id);if(u.length){u=u.sort((d,f)=>s[d]-s[f]);const h=(u.length-1)/2;for(let d=Math.floor(h),f=Math.ceil(h);d<=f;++d){const g=u[d];a[c]===c&&l{var o;const l={},c=jz(r,t,e,i,a,s),u=s?"borderLeft":"borderRight",h=(g,v)=>{let p=c.getAllNodes(),m=p.pop();const y={};for(;m;)y[m.id]?g(m.id):(y[m.id]=!0,p.push(m),p=p.concat(v(m.id))),m=p.pop()},d=g=>{l[g]=(c.getRelatedEdges(g,"in")||[]).reduce((v,p)=>Math.max(v,(l[p.source]||0)+p.data.weight),0)},f=g=>{const v=(c.getRelatedEdges(g,"out")||[]).reduce((m,y)=>Math.min(m,(l[y.target]||0)-y.data.weight),Number.POSITIVE_INFINITY),p=r.getNode(g);v!==Number.POSITIVE_INFINITY&&p.data.borderType!==u&&(l[g]=Math.max(l[g],v))};return h(d,c.getPredecessors.bind(c)),h(f,c.getSuccessors.bind(c)),(o=Object.values(n))===null||o===void 0||o.forEach(g=>{l[g]=l[e[g]]}),l},jz=(r,t,e,n,i,a)=>{const s=new Ne,o=Vz(n,i,a);return t==null||t.forEach(l=>{let c;l==null||l.forEach(u=>{const h=e[u];if(s.hasNode(h)||s.addNode({id:h,data:{}}),c){const d=e[c],f=s.getRelatedEdges(d,"out").find(g=>g.target===h);f?s.updateEdgeData(f.id,Object.assign(Object.assign({},f.data),{weight:Math.max(o(r,u,c),f.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:d,target:h,data:{weight:Math.max(o(r,u,c),0)}})}c=u})}),s},qz=(r,t)=>k1(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=Hz(r,s)/2;i=Math.max(o+l,i),a=Math.min(o-l,a)}),i-a});function Gz(r,t){const e=Object.values(t),n=Math.min(...e),i=Math.max(...e);["u","d"].forEach(a=>{["l","r"].forEach(s=>{const o=a+s,l=r[o];let c;if(l===t)return;const u=Object.values(l);c=s==="l"?n-Math.min(...u):i-Math.max(...u),c&&(r[o]={},Object.keys(l).forEach(h=>{r[o][h]=l[h]+c}))})})}const Wz=(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},Vz=(r,t,e)=>(n,i,a)=>{const s=n.getNode(i),o=n.getNode(a);let l=0,c=0;if(l+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":c=-s.data.width/2;break;case"r":c=s.data.width/2;break}if(c&&(l+=e?c:-c),c=0,l+=(s.data.dummy?t:r)/2,l+=(o.data.dummy?t:r)/2,l+=o.data.width/2,o.data.labelpos)switch((o.data.labelpos||"").toLowerCase()){case"l":c=o.data.width/2;break;case"r":c=-o.data.width/2;break}return c&&(l+=e?c:-c),c=0,l},Hz=(r,t)=>r.getNode(t).data.width||0,Uz=(r,t)=>{const{ranksep:e=0}=t||{},n=Fo(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})},Yz=(r,t)=>{const{align:e,nodesep:n=0,edgesep:i=0}=t||{},a=Fo(r),s=Object.assign(Dz(r,a),Iz(r,a)),o={};let l=[];["u","d"].forEach(u=>{l=u==="u"?a:Object.values(a).reverse(),["l","r"].forEach(h=>{h==="r"&&(l=l.map(v=>Object.values(v).reverse()));const d=(u==="u"?r.getPredecessors:r.getSuccessors).bind(r),f=zz(r,l,s,d),g=$z(r,l,f.root,f.align,n,i,h==="r");h==="r"&&Object.keys(g).forEach(v=>g[v]=-g[v]),o[u+h]=g})});const c=qz(r,o);return c&&Gz(o,c),Wz(o,e)},Xz=(r,t)=>{var e;const n=QT(r);Uz(n,t);const i=Yz(n,t);(e=Object.keys(i))===null||e===void 0||e.forEach(a=>{n.getNode(a).data.x=i[a]})},lO=r=>{const t={},e=n=>{var i;const a=r.getNode(n);if(!a)return 0;if(t[n])return a.data.rank;t[n]=!0;let s;return(i=r.getRelatedEdges(n,"out"))===null||i===void 0||i.forEach(o=>{const l=e(o.target),c=o.data.minlen,u=l-c;u&&(s===void 0||ur.getRelatedEdges(n.id,"in").length===0).forEach(n=>e(n.id))},Kz=r=>{const t={};let e;const n=s=>{var o;const l=r.getNode(s);if(!l)return 0;if(t[s])return l.data.rank;t[s]=!0;let c;return(o=r.getRelatedEdges(s,"out"))===null||o===void 0||o.forEach(u=>{const h=n(u.target),d=u.data.minlen,f=h-d;f&&(c===void 0||fr.getRelatedEdges(s.id,"in").length===0).forEach(s=>{s&&n(s.id)}),e===void 0&&(e=0);const i={},a=(s,o)=>{var l;const c=r.getNode(s),u=isNaN(c.data.layer)?o:c.data.layer;(c.data.rank===void 0||c.data.rank{a(h.target,u+h.data.minlen)}))};r.getAllNodes().forEach(s=>{const o=s.data;o&&(isNaN(o.layer)?o.rank-=e:a(s.id,o.layer))})},Ui=(r,t)=>r.getNode(t.target).data.rank-r.getNode(t.source).data.rank-t.data.minlen,Zz=r=>{const t=new Ne({tree:[]}),e=r.getAllNodes()[0],n=r.getAllNodes().length;t.addNode(e);let i,a;for(;Jz(t,r){const e=n=>{t.getRelatedEdges(n,"both").forEach(i=>{const a=i.source,s=n===a?i.target:a;!r.hasNode(s)&&!Ui(t,i)&&(r.addNode({id:s,data:{}}),r.addEdge({id:i.id,source:n,target:s,data:{}}),e(s))})};return r.getAllNodes().forEach(n=>e(n.id)),r.getAllNodes().length},Qz=r=>{const t=new Ne({tree:[]}),e=r.getAllNodes()[0],n=r.getAllNodes().length;t.addNode(e);let i,a;for(;t$(t,r){const e=n=>{var i;(i=t.getRelatedEdges(n,"both"))===null||i===void 0||i.forEach(a=>{const s=a.source,o=n===s?a.target:s;!r.hasNode(o)&&(t.getNode(o).data.layer!==void 0||!Ui(t,a))&&(r.addNode({id:o,data:{}}),r.addEdge({id:a.id,source:n,target:o,data:{}}),e(o))})};return r.getAllNodes().forEach(n=>e(n.id)),r.getAllNodes().length},cO=(r,t)=>k1(t.getAllEdges(),e=>r.hasNode(e.source)!==r.hasNode(e.target)?Ui(t,e):1/0),uO=(r,t,e)=>{r.getAllNodes().forEach(n=>{const i=t.getNode(n.id);i.data.rank||(i.data.rank=0),i.data.rank+=e})},e$=r=>{const t=tz(r);lO(t);const e=Zz(t);dO(e),hO(e,t);let n,i;for(;n=i$(e);)i=a$(e,t,n),s$(e,t,n,i)},hO=(r,t)=>{let e=nO(r,r.getAllNodes(),"post");e=e.slice(0,(e==null?void 0:e.length)-1),e.forEach(n=>{n$(r,t,n)})},n$=(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=r$(r,t,e)},r$=(r,t,e)=>{const i=r.getNode(e).data.parent;let a=!0,s=t.getRelatedEdges(e,"out").find(l=>l.target===i),o=0;return s||(a=!1,s=t.getRelatedEdges(i,"out").find(l=>l.target===e)),o=s.data.weight,t.getRelatedEdges(e,"both").forEach(l=>{const c=l.source===e,u=c?l.target:l.source;if(u!==i){const h=c===a,d=l.data.weight;if(o+=h?d:-d,l$(r,e,u)){const f=r.getRelatedEdges(e,"both").find(g=>g.source===u||g.target===u).data.cutvalue;o+=h?-f:f}}}),o},dO=(r,t=r.getAllNodes()[0].id)=>{fO(r,{},1,t)},fO=(r,t,e,n,i)=>{var a;const s=e;let o=e;const l=r.getNode(n);return t[n]=!0,(a=r.getNeighbors(n))===null||a===void 0||a.forEach(c=>{t[c.id]||(o=fO(r,t,o,c.id,n))}),l.data.low=s,l.data.lim=o++,i?l.data.parent=i:delete l.data.parent,o},i$=r=>r.getAllEdges().find(t=>t.data.cutvalue<0),a$=(r,t,e)=>{let n=e.source,i=e.target;t.getRelatedEdges(n,"out").find(u=>u.target===i)||(n=e.target,i=e.source);const a=r.getNode(n),s=r.getNode(i);let o=a,l=!1;a.data.lim>s.data.lim&&(o=s,l=!0);const c=t.getAllEdges().filter(u=>l===gw(r.getNode(u.source),o)&&l!==gw(r.getNode(u.target),o));return k1(c,u=>Ui(t,u))},s$=(r,t,e,n)=>{const i=r.getRelatedEdges(e.source,"both").find(a=>a.source===e.target||a.target===e.target);i&&r.removeEdge(i.id),r.addEdge({id:`e${Math.random()}`,source:n.source,target:n.target,data:{}}),dO(r),hO(r,t),o$(r,t)},o$=(r,t)=>{const e=r.getAllNodes().find(i=>!i.data.parent);let n=nO(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))})},l$=(r,t,e)=>r.getRelatedEdges(t,"both").find(n=>n.source===e||n.target===e),gw=(r,t)=>t.data.low<=r.data.lim&&r.data.lim<=t.data.lim,c$=(r,t)=>{switch(t){case"network-simplex":h$(r);break;case"tight-tree":vw(r);break;case"longest-path":u$(r);break;default:vw(r)}},u$=lO,vw=r=>{Kz(r),Qz(r)},h$=r=>{e$(r)},d$=(r,t)=>{const{edgeLabelSpace:e,keepNodeOrder:n,prevGraph:i,rankdir:a,ranksep:s}=t;!n&&i&&g$(r,i);const o=w$(r);e&&(t.ranksep=x$(o,{rankdir:a,ranksep:s}));let l;try{l=f$(o,t)}catch(c){if(c.message==="Not possible to find intersection inside of the rectangle"){console.error(`The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure: `,c);return}throw c}return v$(r,o),l},f$=(r,t)=>{const{ranker:e,rankdir:n="tb",nodeOrder:i,keepNodeOrder:a,align:s,nodesep:o=50,edgesep:l=20,ranksep:c=50}=t;A$(r),ZB(r);const{nestingRoot:u,nodeRankFactor:h}=uz(r);c$(QT(r),e),E$(r),rz(r,h),fz(r,u),nz(r),S$(r),_$(r);const d=[];vz(r,d),Lz(r,d),az(r),a&&Pz(r,i),Az(r,a),P$(r),sz(r,n),Xz(r,{align:s,nodesep:o,edgesep:l,ranksep:c}),N$(r),O$(r),mz(r,d),C$(r),oz(r,n);const{width:f,height:g}=k$(r);return M$(r),T$(r),JB(r),{width:f,height:g}},g$=(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})},v$=(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)})},p$=["width","height","layer","fixorder"],m$={width:0,height:0},y$=["minlen","weight","width","height","labeloffset"],b$={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},af=["labelpos"],w$=r=>{const t=new Ne({tree:[]});return r.getAllNodes().forEach(e=>{const n=mw(r.getNode(e.id).data),i=Object.assign(Object.assign({},m$),n),a=pw(i,p$);t.hasNode(e.id)||t.addNode({id:e.id,data:Object.assign({},a)});const s=r.hasTreeStructure("combo")?r.getParent(e.id,"combo"):r.getParent(e.id);ot(s)||(t.hasNode(s.id)||t.addNode(Object.assign({},s)),t.setParent(e.id,s.id))}),r.getAllEdges().forEach(e=>{const n=mw(r.getEdge(e.id).data),i={};af==null||af.forEach(a=>{n[a]!==void 0&&(i[a]=n[a])}),t.addEdge({id:e.id,source:e.source,target:e.target,data:Object.assign({},b$,pw(n,y$),i)})}),t},x$=(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},E$=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};Ds(r,"edge-proxy",i,"_ep")}})},S$=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},_$=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))})},k$=(r,t)=>{let e,n=0,i,a=0;const{marginx:s=0,marginy:o=0}={},l=c=>{if(!c.data)return;const u=c.data.x,h=c.data.y,d=c.data.width,f=c.data.height;!isNaN(u)&&!isNaN(d)&&(e===void 0&&(e=u-d/2),e=Math.min(e,u-d/2),n=Math.max(n,u+d/2)),!isNaN(h)&&!isNaN(f)&&(i===void 0&&(i=h-f/2),i=Math.min(i,h-f/2),a=Math.max(a,h+f/2))};return r.getAllNodes().forEach(c=>{l(c)}),r.getAllEdges().forEach(c=>{c!=null&&c.data.hasOwnProperty("x")&&l(c)}),e-=s,i-=o,r.getAllNodes().forEach(c=>{c.data.x-=e,c.data.y-=i}),r.getAllEdges().forEach(c=>{var u;(u=c.data.points)===null||u===void 0||u.forEach(h=>{h.x-=e,h.y-=i}),c.data.hasOwnProperty("x")&&(c.data.x-=e),c.data.hasOwnProperty("y")&&(c.data.y-=i)}),{width:n-e+s,height:a-i+o}},M$=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(aw(e.data,i)),t.data.points.push(aw(n.data,a))})},C$=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}})},T$=r=>{r.getAllEdges().forEach(t=>{var e;t.data.reversed&&((e=t.data.points)===null||e===void 0||e.reverse())})},O$=r=>{r.getAllNodes().forEach(t=>{var e,n,i;if(!((e=r.getChildren(t.id))===null||e===void 0)&&e.length){const a=r.getNode(t.id),s=r.getNode(a.data.borderTop),o=r.getNode(a.data.borderBottom),l=r.getNode(a.data.borderLeft[((n=a.data.borderLeft)===null||n===void 0?void 0:n.length)-1]),c=r.getNode(a.data.borderRight[((i=a.data.borderRight)===null||i===void 0?void 0:i.length)-1]);a.data.width=Math.abs((c==null?void 0:c.data.x)-(l==null?void 0:l.data.x))||10,a.data.height=Math.abs((o==null?void 0:o.data.y)-(s==null?void 0:s.data.y))||10,a.data.x=((l==null?void 0:l.data.x)||0)+a.data.width/2,a.data.y=((s==null?void 0:s.data.y)||0)+a.data.height/2}}),r.getAllNodes().forEach(t=>{t.data.dummy==="border"&&r.removeNode(t.id)})},A$=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)}})},P$=r=>{const t=Fo(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=>{Ds(r,"selfedge",{width:l.data.width,height:l.data.height,rank:o.data.rank,order:a+ ++n,e:l},"_se")}),delete o.data.selfEdges})})},N$=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}})},pw=(r,t)=>{const e={};return t==null||t.forEach(n=>{r[n]!==void 0&&(e[n]=+r[n])}),e},mw=(r={})=>{const t={};return Object.keys(r).forEach(e=>{t[e.toLowerCase()]=r[e]}),t},Vr=Array.isArray,gO=r=>{const t=[],e=r.length;for(let n=0;nt[i][n]+t[n][a]&&(t[i][a]=t[i][n]+t[n][a]);return t},vO=(r,t)=>{const{nodes:e,edges:n}=r,i=[],a={};if(!e)throw new Error("invalid nodes data!");return e&&e.forEach((s,o)=>{a[s.id]=o;const l=[];i.push(l)}),n==null||n.forEach(s=>{const{source:o,target:l}=s,c=a[o],u=a[l];c===void 0||u===void 0||(i[c][u]=1,i[u][c]=1)}),i},R$=(r,t)=>{const e=[];return r.forEach(n=>{const i=[];n.forEach(a=>{i.push(a*t)}),e.push(i)}),e},L$=r=>{let t=1/0,e=1/0,n=-1/0,i=-1/0;return r.forEach(a=>{let s=a.data.size;Vr(s)?s.length===1&&(s=[s[0],s[0]]):nt(s)?s=[s,s]:(s===void 0||isNaN(s))&&(s=[30,30]);const o=[s[0]/2,s[1]/2],l=a.data.x-o[0],c=a.data.x+o[0],u=a.data.y-o[1],h=a.data.y+o[1];t>l&&(t=l),e>u&&(e=u),nMath.sqrt((r.x-t.x)*(r.x-t.x)+(r.y-t.y)*(r.y-t.y)),uy=(r,t,e,n="TB",i,a={})=>{if(!(t!=null&&t.length))return;const{stopBranchFn:s,stopAllFn:o}=a;for(let l=0;l{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=>hy(e))}if(typeof r=="object"){const t={};return Object.keys(r).forEach(e=>{t[e]=hy(r[e])}),t}return r},On=(r,t)=>{const e=hy(r);return e.data=e.data||{},t&&(nt(e.data.x)||(e.data.x=Math.random()*t[0]),nt(e.data.y)||(e.data.y=Math.random()*t[1])),e};function sl(r){if(!r)return[0,0,0];if(nt(r))return[r,r,r];if(r.length===0)return[0,0,0];const[t,e=t,n=t]=r;return[t,e,n]}function Aa(r,t){let e;return at(t)?e=t:nt(t)?e=()=>t:e=()=>r,e}function M1(r,t,e=!0){return!t&&t!==0?n=>{const{size:i}=n.data||{};return i?Array.isArray(i)?e?Math.max(...i)||r:i:me(i)&&i.width&&i.height?e?Math.max(i.width,i.height)||r:[i.width,i.height]:i:r}:at(t)?t:nt(t)?()=>t:Array.isArray(t)?()=>e?Math.max(...t)||r:t:me(t)&&t.width&&t.height?()=>e?Math.max(t.width,t.height)||r:[t.width,t.height]:()=>r}const C1=(r,t,e=10)=>{let n;const i=typeof t=="function"?t:()=>t||0;return r?Array.isArray(r)?n=s=>r:at(r)?n=r:n=s=>r:n=s=>{var o,l,c;if(!((o=s.data)===null||o===void 0)&&o.bboxSize)return(l=s.data)===null||l===void 0?void 0:l.bboxSize;if(!((c=s.data)===null||c===void 0)&&c.size){const u=s.data.size;return Array.isArray(u)?u:me(u)?[u.width,u.height]:u}return e},s=>{const o=n(s),l=i(s);return Math.max(...sl(o))+l}},D$={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};class I${constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},D$),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,e)})}genericDagreLayout(t,e,n){return bt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{nodeSize:a,align:s,rankdir:o="TB",ranksep:l,nodesep:c,ranksepFunc:u,nodesepFunc:h,edgeLabelSpace:d,ranker:f,nodeOrder:g,begin:v,controlPoints:p,radial:m,sortByCombo:y,preset:b}=i,w=new Ne({tree:[]}),x=Aa(l||50,u),S=Aa(c||50,h);let E=S,_=x;(o==="LR"||o==="RL")&&(E=x,_=S);const C=M1(10,a,!1),k=e.getAllNodes(),M=e.getAllEdges();k.forEach(A=>{const I=sl(C(A)),B=_(A),j=E(A),G=I[0]+2*j,H=I[1]+2*B,Y=A.data.layer;nt(Y)?w.addNode({id:A.id,data:{width:G,height:H,layer:Y}}):w.addNode({id:A.id,data:{width:G,height:H}})}),y&&(w.attachTreeStructure("combo"),k.forEach(A=>{const{parentId:I}=A.data;I!==void 0&&w.hasNode(I)&&w.setParent(A.id,I,"combo")})),M.forEach(A=>{w.addEdge({id:A.id,source:A.source,target:A.target,data:{weight:A.data.weight||1}})});let T;b!=null&&b.length&&(T=new Ne({nodes:b})),d$(w,{prevGraph:T,edgeLabelSpace:d,keepNodeOrder:!!g,nodeOrder:g||[],acyclicer:"greedy",ranker:f,rankdir:o,nodesep:c,align:s});const O=[0,0];if(v){let A=1/0,I=1/0;w.getAllNodes().forEach(B=>{A>B.data.x&&(A=B.data.x),I>B.data.y&&(I=B.data.y)}),w.getAllEdges().forEach(B=>{var j;(j=B.data.points)===null||j===void 0||j.forEach(G=>{A>G.x&&(A=G.x),I>G.y&&(I=G.y)})}),O[0]=v[0]-A,O[1]=v[1]-I}const R=o==="LR"||o==="RL";if(!m){const A=new Set,B=o==="BT"||o==="RL"?(Y,K)=>K-Y:(Y,K)=>Y-K;w.getAllNodes().forEach(Y=>{Y.data.x=Y.data.x+O[0],Y.data.y=Y.data.y+O[1],A.add(R?Y.data.x:Y.data.y)});const j=Array.from(A).sort(B),G=R?(Y,K)=>Y.x!==K.x:(Y,K)=>Y.y!==K.y,H=R?(Y,K,tt)=>{const it=Math.max(K.y,tt.y),_t=Math.min(K.y,tt.y);return Y.filter(Mt=>Mt.y<=it&&Mt.y>=_t)}:(Y,K,tt)=>{const it=Math.max(K.x,tt.x),_t=Math.min(K.x,tt.x);return Y.filter(Mt=>Mt.x<=it&&Mt.x>=_t)};w.getAllEdges().forEach((Y,K)=>{var tt;d&&p&&Y.data.type!=="loop"&&(Y.data.controlPoints=F$((tt=Y.data.points)===null||tt===void 0?void 0:tt.map(({x:it,y:_t})=>({x:it+O[0],y:_t+O[1]})),w.getNode(Y.source),w.getNode(Y.target),j,R,G,H))})}let L=[];L=w.getAllNodes().map(A=>On(A));const D=w.getAllEdges();return t&&(L.forEach(A=>{e.mergeNodeData(A.id,{x:A.data.x,y:A.data.y})}),D.forEach(A=>{e.mergeEdgeData(A.id,{controlPoints:A.data.controlPoints})})),{nodes:L,edges:D}})}}const F$=(r,t,e,n,i,a,s)=>{let o=(r==null?void 0:r.slice(1,r.length-1))||[];if(t&&e){let{x:l,y:c}=t.data,{x:u,y:h}=e.data;if(i&&(l=t.data.y,c=t.data.x,u=e.data.y,h=e.data.x),h!==c&&l!==u){const d=n.indexOf(c),f=n[d+1];if(f){const p=o[0],m=i?{x:(c+f)/2,y:(p==null?void 0:p.y)||u}:{x:(p==null?void 0:p.x)||u,y:(c+f)/2};(!p||a(p,m))&&o.unshift(m)}const g=n.indexOf(h),v=Math.abs(g-d);if(v===1)o=s(o,t.data,e.data),o.length||o.push(i?{x:(c+h)/2,y:l}:{x:l,y:(c+h)/2});else if(v>1){const p=n[g-1];if(p){const m=o[o.length-1],y=i?{x:(h+p)/2,y:(m==null?void 0:m.y)||u}:{x:(m==null?void 0:m.x)||l,y:(h+p)/2};(!m||a(m,y))&&o.push(y)}}}}return o},Ha=(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}},B$={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};class z${constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},B$),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericCircularLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericCircularLayout(!0,t,e)})}genericCircularLayout(t,e,n){return bt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,divisions:l,startAngle:c=0,endAngle:u=2*Math.PI,angleRatio:h,ordering:d,clockwise:f,nodeSpacing:g,nodeSize:v}=i,p=e.getAllNodes(),m=e.getAllEdges(),[y,b,w]=j$(a,s,o),x=p==null?void 0:p.length;if(!x||x===1)return Ha(e,t,w);const S=(u-c)/x;let{radius:E,startRadius:_,endRadius:C}=i;if(g){const R=Aa(10,g),L=M1(10,v);let D=-1/0;p.forEach(A=>{const I=L(A);D{I===0?P+=D||10:P+=(R(A)||0)+(D||10)}),E=P/(2*Math.PI)}else!E&&!_&&!C?E=Math.min(b,y)/2:!_&&C?_=C:_&&!C&&(C=_);const k=S*h;let M=[];d==="topology"?M=bw(e,p):d==="topology-directed"?M=bw(e,p,!0):d==="degree"?M=$$(e,p):M=p.map(R=>On(R));const T=Math.ceil(x/l);for(let R=0;R{e.mergeNodeData(R.id,{x:R.data.x,y:R.data.y})}),{nodes:M,edges:m}})}}const bw=(r,t,e=!1)=>{const n=[On(t[0])],i={},a=t.length;i[t[0].id]=!0;let s=0;return t.forEach((o,l)=>{if(l!==0)if((l===a-1||r.getDegree(o.id,"both")!==r.getDegree(t[l+1].id,"both")||r.areNeighbors(n[s].id,o.id))&&!i[o.id])n.push(On(o)),i[o.id]=!0,s++;else{const c=e?r.getSuccessors(n[s].id):r.getNeighbors(n[s].id);let u=!1;for(let d=0;d{e.push(On(n))}),e.sort((n,i)=>r.getDegree(n.id,"both")-r.getDegree(i.id,"both")),e}const j$=(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]},q$={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:3/2*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class dy{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},q$),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericConcentricLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericConcentricLayout(!0,t,e)})}genericConcentricLayout(t,e,n){return bt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o,sortBy:l,maxLevelDiff:c,sweep:u,clockwise:h,equidistant:d,preventOverlap:f,startAngle:g=3/2*Math.PI,nodeSize:v,nodeSpacing:p}=i,m=e.getAllNodes(),y=e.getAllEdges(),b=!s&&typeof window<"u"?window.innerWidth:s,w=!o&&typeof window<"u"?window.innerHeight:o,x=a||[b/2,w/2];if(!(m!=null&&m.length)||m.length===1)return Ha(e,t,x);const S=[];let E,_=0;Vr(v)?E=Math.max(v[0],v[1]):at(v)?(E=-1/0,m.forEach(A=>{const I=Math.max(...sl(v(A)));I>E&&(E=I)})):E=v,Vr(p)?_=Math.max(p[0],p[1]):nt(p)&&(_=p),m.forEach(A=>{const I=On(A);S.push(I);let B=E;const{data:j}=I;Vr(j.size)?B=Math.max(j.size[0],j.size[1]):nt(j.size)?B=j.size:me(j.size)&&(B=Math.max(j.size.width,j.size.height)),E=Math.max(E,B),at(p)&&(_=Math.max(p(A),_))});const C={};S.forEach((A,I)=>{C[A.id]=I});let k=l;(!Tt(k)||S[0].data[k]===void 0)&&(k="degree"),k==="degree"?S.sort((A,I)=>e.getDegree(I.id,"both")-e.getDegree(A.id,"both")):S.sort((A,I)=>I.data[k]-A.data[k]);const M=S[0],T=(c||(k==="degree"?e.getDegree(M.id,"both"):M.data[k]))/4,O=[{nodes:[]}];let R=O[0];S.forEach(A=>{if(R.nodes.length>0){const I=Math.abs(k==="degree"?e.getDegree(R.nodes[0].id,"both")-e.getDegree(A.id,"both"):R.nodes[0].data[k]-A.data[k]);T&&I>=T&&(R={nodes:[]},O.push(R))}R.nodes.push(A)});let L=E+_;if(!f){const A=O.length>0&&O[0].nodes.length>1,B=(Math.min(b,w)/2-L)/(O.length+(A?1:0));L=Math.min(L,B)}let D=0;if(O.forEach(A=>{const I=u===void 0?2*Math.PI-2*Math.PI/A.nodes.length:u;if(A.dTheta=I/Math.max(1,A.nodes.length-1),A.nodes.length>1&&f){const B=Math.cos(A.dTheta)-Math.cos(0),j=Math.sin(A.dTheta)-Math.sin(0),G=Math.sqrt(L*L/(B*B+j*j));D=Math.max(G,D)}A.r=D,D+=L}),d){let A=0,I=0;for(let B=0;B{j===0&&(I=B.r||0),B.r=I,I+=A})}return O.forEach(A=>{const I=A.dTheta||0,B=A.r||0;A.nodes.forEach((j,G)=>{const H=g+(h?1:-1)*I*G;j.data.x=x[0]+B*Math.cos(H),j.data.y=x[1]+B*Math.sin(H)})}),t&&S.forEach(A=>e.mergeNodeData(A.id,{x:A.data.x,y:A.data.y})),{nodes:S,edges:y}})}}function G$(r){const t=+this._x.call(null,r),e=+this._y.call(null,r);return pO(this.cover(t,e),t,e,r)}function pO(r,t,e,n){if(isNaN(t)||isNaN(e))return r;var i,a=r._root,s={data:n},o=r._x0,l=r._y0,c=r._x1,u=r._y1,h,d,f,g,v,p,m,y;if(!a)return r._root=s,r;for(;a.length;)if((v=t>=(h=(o+c)/2))?o=h:c=h,(p=e>=(d=(l+u)/2))?l=d:u=d,i=a,!(a=a[m=p<<1|v]))return i[m]=s,r;if(f=+r._x.call(null,a.data),g=+r._y.call(null,a.data),t===f&&e===g)return s.next=a,i?i[m]=s:r._root=s,r;do i=i?i[m]=new Array(4):r._root=new Array(4),(v=t>=(h=(o+c)/2))?o=h:c=h,(p=e>=(d=(l+u)/2))?l=d:u=d;while((m=p<<1|v)===(y=(g>=d)<<1|f>=h));return i[y]=a,i[m]=s,r}function W$(r){var t,e,n=r.length,i,a,s=new Array(n),o=new Array(n),l=1/0,c=1/0,u=-1/0,h=-1/0;for(e=0;eu&&(u=i),ah&&(h=a));if(l>u||c>h)return this;for(this.cover(l,c).cover(u,h),e=0;er||r>=i||n>t||t>=a;)switch(c=(tu||(o=g.y0)>h||(l=g.x1)=m)<<1|r>=p)&&(g=d[d.length-1],d[d.length-1]=d[d.length-1-v],d[d.length-1-v]=g)}else{var y=r-+this._x.call(null,f.data),b=t-+this._y.call(null,f.data),w=y*y+b*b;if(w=(d=(s+l)/2))?s=d:l=d,(v=h>=(f=(o+c)/2))?o=f:c=f,t=e,!(e=e[p=v<<1|g]))return this;if(!e.length)break;(t[p+1&3]||t[p+2&3]||t[p+3&3])&&(n=t,m=p)}for(;e.data!==r;)if(i=e,!(e=e.next))return this;return(a=e.next)&&delete e.next,i?(a?i.next=a:delete i.next,this):t?(a?t[p]=a:delete t[p],(e=t[0]||t[1]||t[2]||t[3])&&e===(t[3]||t[2]||t[1]||t[0])&&!e.length&&(n?n[m]=e:this._root=e),this):(this._root=a,this)}function K$(r){for(var t=0,e=r.length;t=(g=(l+h)/2))?l=g:h=g,(x=e>=(v=(c+d)/2))?c=v:d=v,(S=n>=(p=(u+f)/2))?u=p:f=p,a=s,!(s=s[E=S<<2|x<<1|w]))return a[E]=o,r;if(m=+r._x.call(null,s.data),y=+r._y.call(null,s.data),b=+r._z.call(null,s.data),t===m&&e===y&&n===b)return o.next=s,a?a[E]=o:r._root=o,r;do a=a?a[E]=new Array(8):r._root=new Array(8),(w=t>=(g=(l+h)/2))?l=g:h=g,(x=e>=(v=(c+d)/2))?c=v:d=v,(S=n>=(p=(u+f)/2))?u=p:f=p;while((E=S<<2|x<<1|w)===(_=(b>=p)<<2|(y>=v)<<1|m>=g));return a[_]=s,a[E]=o,r}function sj(r){Array.isArray(r)||(r=Array.from(r));const t=r.length,e=new Float64Array(t),n=new Float64Array(t),i=new Float64Array(t);let a=1/0,s=1/0,o=1/0,l=-1/0,c=-1/0,u=-1/0;for(let h=0,d,f,g,v;hl&&(l=f),gc&&(c=g),vu&&(u=v));if(a>l||s>c||o>u)return this;this.cover(a,s,o).cover(l,c,u);for(let h=0;hr||r>=s||i>t||t>=o||a>e||e>=l;)switch(d=(eg||(c=b.y0)>v||(u=b.z0)>p||(h=b.x1)=E)<<2|(t>=S)<<1|r>=x)&&(b=m[m.length-1],m[m.length-1]=m[m.length-1-w],m[m.length-1-w]=b)}else{var _=r-+this._x.call(null,y.data),C=t-+this._y.call(null,y.data),k=e-+this._z.call(null,y.data),M=_*_+C*C+k*k;if(MMath.sqrt((r-n)**2+(t-i)**2+(e-a)**2);function dj(r,t,e,n){const i=[],a=r-n,s=t-n,o=e-n,l=r+n,c=t+n,u=e+n;return this.visit((h,d,f,g,v,p,m)=>{if(!h.length)do{const y=h.data;hj(r,t,e,this._x(y),this._y(y),this._z(y))<=n&&i.push(y)}while(h=h.next);return d>l||f>c||g>u||v=(v=(s+c)/2))?s=v:c=v,(b=f>=(p=(o+u)/2))?o=p:u=p,(w=g>=(m=(l+h)/2))?l=m:h=m,t=e,!(e=e[x=w<<2|b<<1|y]))return this;if(!e.length)break;(t[x+1&7]||t[x+2&7]||t[x+3&7]||t[x+4&7]||t[x+5&7]||t[x+6&7]||t[x+7&7])&&(n=t,S=x)}for(;e.data!==r;)if(i=e,!(e=e.next))return this;return(a=e.next)&&delete e.next,i?(a?i.next=a:delete i.next,this):t?(a?t[x]=a:delete t[x],(e=t[0]||t[1]||t[2]||t[3]||t[4]||t[5]||t[6]||t[7])&&e===(t[7]||t[6]||t[5]||t[4]||t[3]||t[2]||t[1]||t[0])&&!e.length&&(n?n[S]=e:this._root=e),this):(this._root=a,this)}function gj(r){for(var t=0,e=r.length;t{const{nodeStrength:d,x:f,y:g,z:v,size:p}=u.data;return{x:f,y:g,z:v,size:p,index:h,id:u.id,vx:0,vy:0,vz:0,weight:a*d}}),l=(i===2?uh(o,u=>u.x,u=>u.y):yO(o,u=>u.x,u=>u.y,u=>u.z)).visitAfter(Cj),c=new Map;return o.forEach(u=>{c.set(u.id,u),Oj(u,l,i)}),o.map((u,h)=>{const{id:d,data:f}=s[h],{mass:g=1}=f;n[d]={x:u.vx/g,y:u.vy/g,z:u.vz/g}}),n}function Cj(r){let t=0,e=0,n=0,i=0,a=0;const s=r.length;if(s){for(let o=0;o{var o;if(((o=r.data)===null||o===void 0?void 0:o.id)===a.id)return;const l=[e,n,i][s-1],c=a.x-r.x||sf,u=a.y-r.y||sf,h=a.z-r.z||sf,d=[c,u,h],f=l-t;let g=0;for(let m=0;mTj(n,i,a,s,o,r,e))}const Aj={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 bO{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},Aj),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericForceLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericForceLayout(!0,t,e)})}stop(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let n=0;(this.judgingDistance>this.lastOptions.minMovement||n<1)&&nthis.lastGraph.mergeNodeData(n.id,{x:n.data.x,y:n.data.y,z:this.options.dimensions===3?n.data.z:void 0})),e}genericForceLayout(t,e,n){return bt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),a=e.getAllNodes(),s=e.getAllEdges(),o=this.formatOptions(i,e),{dimensions:l,width:c,height:u,nodeSize:h,getMass:d,nodeStrength:f,edgeStrength:g,linkDistance:v}=o,p=a.map((_,C)=>Object.assign(Object.assign({},_),{data:Object.assign(Object.assign({},_.data),{x:nt(_.data.x)?_.data.x:Math.random()*c,y:nt(_.data.y)?_.data.y:Math.random()*u,z:nt(_.data.z)?_.data.z:Math.random()*Math.sqrt(c*u),size:h(_)||30,mass:d(_),nodeStrength:f(_)})})),m=s.map(_=>Object.assign(Object.assign({},_),{data:Object.assign(Object.assign({},_.data),{edgeStrength:g(_),linkDistance:v(_,e.getNode(_.source),e.getNode(_.target))})}));if(!(a!=null&&a.length))return this.lastResult={nodes:[],edges:s},{nodes:[],edges:s};const y={};a.forEach((_,C)=>{y[_.id]={x:0,y:0,z:0}});const b=new Ne({nodes:p,edges:m});this.formatCentripetal(o,b);const{maxIteration:w,minMovement:x,onTick:S}=o;if(this.lastLayoutNodes=p,this.lastLayoutEdges=m,this.lastAssign=t,this.lastGraph=e,this.lastCalcGraph=b,this.lastOptions=o,this.lastVelMap=y,typeof window>"u")return;let E=0;return new Promise(_=>{this.timeInterval=window.setInterval(()=>{(!a||!this.running)&&_({nodes:of(e,p),edges:s}),this.runOneStep(b,e,E,y,o),this.updatePosition(e,b,y,o),t&&p.forEach(C=>e.mergeNodeData(C.id,{x:C.data.x,y:C.data.y,z:l===3?C.data.z:void 0})),S==null||S({nodes:of(e,p),edges:s}),E++,(E>=w||this.judgingDistance{let c=1;nt(l==null?void 0:l.data.mass)&&(c=l==null?void 0:l.data.mass);const u=e.getDegree(l.id,"both");return!u||u<5?c:u*5*c}),n.nodeSize=C1(t.nodeSize,t.nodeSpacing);const o=t.linkDistance?Aa(1,t.linkDistance):l=>1+n.nodeSize(e.getNode(l.source))+n.nodeSize(e.getNode(l.target));return n.linkDistance=o,n.nodeStrength=Aa(1,t.nodeStrength),n.edgeStrength=Aa(1,t.edgeStrength),n}formatCentripetal(t,e){const{dimensions:n,centripetalOptions:i,center:a,clusterNodeStrength:s,leafCluster:o,clustering:l,nodeClusterBy:c}=t,u=e.getAllNodes(),h=i||{leaf:2,single:2,others:1,center:m=>({x:a[0],y:a[1],z:n===3?a[2]:void 0})};typeof s!="function"&&(t.clusterNodeStrength=m=>s);let d,f;if(o&&c&&(d=Ew(e,c),f=Array.from(new Set(u==null?void 0:u.map(m=>m.data[c])))||[],t.centripetalOptions=Object.assign(h,{single:100,leaf:m=>{const{siblingLeaves:y,sameTypeLeaves:b}=d[m.id]||{};return(b==null?void 0:b.length)===(y==null?void 0:y.length)||(f==null?void 0:f.length)===1?1:t.clusterNodeStrength(m)},others:1,center:m=>{const y=e.getDegree(m.id,"both");if(!y)return{x:100,y:100,z:0};let b;if(y===1){const{sameTypeLeaves:w=[]}=d[m.id]||{};w.length===1?b=void 0:w.length>1&&(b=Sw(w))}else b=void 0;return{x:b==null?void 0:b.x,y:b==null?void 0:b.y,z:b==null?void 0:b.z}}})),l&&c){d||(d=Ew(e,c)),f||(f=Array.from(new Set(u.map(y=>y.data[c])))),f=f.filter(y=>y!==void 0);const m={};f.forEach(y=>{const b=u.filter(w=>w.data[c]===y).map(w=>e.getNode(w.id));m[y]=Sw(b)}),t.centripetalOptions=Object.assign(h,{single:y=>t.clusterNodeStrength(y),leaf:y=>t.clusterNodeStrength(y),others:y=>t.clusterNodeStrength(y),center:y=>{const b=m[y.data[c]];return{x:b==null?void 0:b.x,y:b==null?void 0:b.y,z:b==null?void 0:b.z}}})}const{leaf:g,single:v,others:p}=t.centripetalOptions||{};g&&typeof g!="function"&&(t.centripetalOptions.leaf=()=>g),v&&typeof v!="function"&&(t.centripetalOptions.single=()=>v),p&&typeof p!="function"&&(t.centripetalOptions.others=()=>p)}runOneStep(t,e,n,i,a){const s={},o=t.getAllNodes(),l=t.getAllEdges();if(!(o!=null&&o.length))return;const{monitor:c}=a;if(this.calRepulsive(t,s,a),l&&this.calAttractive(t,s,a),this.calGravity(t,e,s,a),this.updateVelocity(t,s,i,a),c){const u=this.calTotalEnergy(s,o);c({energy:u,nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:n})}}calTotalEnergy(t,e){if(!(e!=null&&e.length))return 0;let n=0;return e.forEach((i,a)=>{const s=t[i.id].x,o=t[i.id].y,l=this.options.dimensions===3?t[i.id].z:0,c=s*s+o*o+l*l,{mass:u=1}=i.data;n+=u*c*.5}),n}calRepulsive(t,e,n){const{dimensions:i,factor:a,coulombDisScale:s}=n;Mj(t,a,s*s,e,i)}calAttractive(t,e,n){const{dimensions:i,nodeSize:a}=n;t.getAllEdges().forEach((s,o)=>{const{source:l,target:c}=s,u=t.getNode(l),h=t.getNode(c);if(!u||!h)return;let d=h.data.x-u.data.x,f=h.data.y-u.data.y,g=i===3?h.data.z-u.data.z:0;!d&&!f&&(d=Math.random()*.01,f=Math.random()*.01,i===3&&!g&&(g=Math.random()*.01));const v=Math.sqrt(d*d+f*f+g*g);if(v{const{id:v,data:p}=g,{mass:m,x:y,y:b,z:w}=p,x=e.getNode(v);let S=0,E=0,_=0,C=d;const k=t.getDegree(v,"in"),M=t.getDegree(v,"out"),T=t.getDegree(v,"both"),O=a==null?void 0:a(x,T);if(O){const[R,L,D]=O;S=y-R,E=b-L,C=D}else S=y-h[0],E=b-h[1],_=w-h[2];if(C&&(n[v].x-=C*S/m,n[v].y-=C*E/m,n[v].z-=C*_/m),f){const{leaf:R,single:L,others:D,center:P}=f,{x:A,y:I,z:B,centerStrength:j}=(P==null?void 0:P(x,o,l,c,u))||{x:0,y:0,z:0,centerStrength:0};if(!nt(A)||!nt(I))return;const G=(y-A)/m,H=(b-I)/m,Y=(w-B)/m;if(j&&(n[v].x-=j*G,n[v].y-=j*H,n[v].z-=j*Y),T===0){const tt=L(x);if(!tt)return;n[v].x-=tt*G,n[v].y-=tt*H,n[v].z-=tt*Y;return}if(k===0||M===0){const tt=R(x,o,l);if(!tt)return;n[v].x-=tt*G,n[v].y-=tt*H,n[v].z-=tt*Y;return}const K=D(x);if(!K)return;n[v].x-=K*G,n[v].y-=K*H,n[v].z-=K*Y}})}updateVelocity(t,e,n,i){const{damping:a,maxSpeed:s,interval:o,dimensions:l}=i,c=t.getAllNodes();c!=null&&c.length&&c.forEach(u=>{const{id:h}=u;let d=(n[h].x+e[h].x*o)*a||.01,f=(n[h].y+e[h].y*o)*a||.01,g=l===3?(n[h].z+e[h].z*o)*a||.01:0;const v=Math.sqrt(d*d+f*f+g*g);if(v>s){const p=s/v;d=p*d,f=p*f,g=p*g}n[h]={x:d,y:f,z:g}})}updatePosition(t,e,n,i){const{distanceThresholdMode:a,interval:s,dimensions:o}=i,l=e.getAllNodes();if(!(l!=null&&l.length)){this.judgingDistance=0;return}let c=0;a==="max"?this.judgingDistance=-1/0:a==="min"&&(this.judgingDistance=1/0),l.forEach(u=>{const{id:h}=u,d=t.getNode(h);if(nt(d.data.fx)&&nt(d.data.fy)){e.mergeNodeData(h,{x:d.data.fx,y:d.data.fy,z:o===3?d.data.fz:void 0});return}const f=n[h].x*s,g=n[h].y*s,v=o===3?n[h].z*s:0;e.mergeNodeData(h,{x:u.data.x+f,y:u.data.y+g,z:u.data.z+v});const p=Math.sqrt(f*f+g*g+v*v);switch(a){case"max":this.judgingDistancep&&(this.judgingDistance=p);break;default:c=c+p;break}}),(!a||a==="mean")&&(this.judgingDistance=c/l.length)}}const Ew=(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]=Pj(r,"leaf",i,t))}),n},Pj=(r,t,e,n)=>{const i=r.getDegree(e.id,"in"),a=r.getDegree(e.id,"out");let s=e,o=[];i===0?(s=r.getSuccessors(e.id)[0],o=r.getNeighbors(s.id)):a===0&&(s=r.getPredecessors(e.id)[0],o=r.getNeighbors(s.id)),o=o.filter(c=>r.getDegree(c.id,"in")===0||r.getDegree(c.id,"out")===0);const l=Nj(r,t,n,e,o);return{coreNode:s,siblingLeaves:o,sameTypeLeaves:l}},Nj=(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},Sw=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}},of=(r,t)=>t.map(e=>{const{id:n,data:i}=e,a=r.getNode(n);return Object.assign(Object.assign({},a),{data:Object.assign(Object.assign({},a.data),{x:i.x,y:i.y,z:i.z})})});var kt={};const Rj=Object.prototype.toString;function Bo(r){const t=Rj.call(r);return t.endsWith("Array]")&&!t.includes("Big")}const Lj=Object.freeze(Object.defineProperty({__proto__:null,isAnyArray:Bo},Symbol.toStringTag,{value:"Module"})),Dj=hM(Lj);function Ij(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Bo(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;os&&(s=r[o]);return s}function Fj(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Bo(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;o1&&arguments[1]!==void 0?arguments[1]:{};if(Bo(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(!Bo(t.output))throw new TypeError("output option must be an array if specified");e=t.output}else e=new Array(r.length);var n=Fj(r),i=Ij(r);if(n===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var a=t.min,s=a===void 0?t.autoMinMax?n:0:a,o=t.max,l=o===void 0?t.autoMinMax?i:1:o;if(s>=l)throw new RangeError("min option must be smaller than max option");for(var c=(l-s)/(i-n),u=0;u=0&&e?` ${kw(r,t-1)}`:kw(r,t)).padEnd(t)}function kw(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 Wj(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>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>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>>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>>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;nn)throw new RangeError("Row index out of range")}function Wn(r,t,e){let n=e?r.columns:r.columns-1;if(t<0||t>n)throw new RangeError("Column index out of range")}function hs(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 ds(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 A1(r,t){if(!pn.isAnyArray(t))throw new TypeError("row indices must be an array");for(let e=0;e=r.rows)throw new RangeError("row indices are out of range")}function P1(r,t){if(!pn.isAnyArray(t))throw new TypeError("column indices must be an array");for(let e=0;e=r.columns)throw new RangeError("column indices are out of range")}function fy(r,t,e,n,i){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(cc("startRow",t),cc("endRow",e),cc("startColumn",n),cc("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 hh(r,t=0){let e=[];for(let n=0;n=a)throw new RangeError("min must be smaller than max");let o=a-i,l=new et(t,e);for(let c=0;cn?(a=!0,n=e):(i=!1,a=!0);t++}return i}isReducedEchelonForm(){let t=0,e=0,n=-1,i=!0,a=!1;for(;tn?(a=!0,n=e):(i=!1,a=!0);for(let s=e+1;st.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=0;)if(t.maxRow(i)===0)i--;else{let a=0,s=!1;for(;ae[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;ne[i]&&(e[i]=this.get(n,i));return e}case void 0:{let e=this.get(0,0);for(let n=0;ne&&(e=this.get(n,i));return e}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){rs(this);let t=this.get(0,0),e=[0,0];for(let n=0;nt&&(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;ne&&(e=this.get(t,n));return e}maxRowIndex(t){Gn(this,t),rs(this);let e=this.get(t,0),n=[t,0];for(let i=1;ie&&(e=this.get(t,i),n[1]=i);return n}minRow(t){if(Gn(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;ne&&(e=this.get(n,t));return e}maxColumnIndex(t){Wn(this,t),rs(this);let e=this.get(0,t),n=[0,t];for(let i=1;ie&&(e=this.get(i,t),n[0]=i);return n}minColumn(t){if(Wn(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n1;i/=2)i&1&&(e=e.mmul(n)),n=n.mmul(n);return e}strassen2x2(t){t=et.checkMatrix(t);let e=new et(2,2);const n=this.get(0,0),i=t.get(0,0),a=this.get(0,1),s=t.get(0,1),o=this.get(1,0),l=t.get(1,0),c=this.get(1,1),u=t.get(1,1),h=(n+c)*(i+u),d=(o+c)*i,f=n*(s-u),g=c*(l-i),v=(n+a)*u,p=(o-n)*(i+s),m=(a-c)*(l+u),y=h+g-v+m,b=f+v,w=d+g,x=h-d+f+p;return e.set(0,0,y),e.set(0,1,b),e.set(1,0,w),e.set(1,1,x),e}strassen3x3(t){t=et.checkMatrix(t);let e=new et(3,3);const n=this.get(0,0),i=this.get(0,1),a=this.get(0,2),s=this.get(1,0),o=this.get(1,1),l=this.get(1,2),c=this.get(2,0),u=this.get(2,1),h=this.get(2,2),d=t.get(0,0),f=t.get(0,1),g=t.get(0,2),v=t.get(1,0),p=t.get(1,1),m=t.get(1,2),y=t.get(2,0),b=t.get(2,1),w=t.get(2,2),x=(n+i+a-s-o-u-h)*p,S=(n-s)*(-f+p),E=o*(-d+f+v-p-m-y+w),_=(-n+s+o)*(d-f+p),C=(s+o)*(-d+f),k=n*d,M=(-n+c+u)*(d-g+m),T=(-n+c)*(g-m),O=(c+u)*(-d+g),R=(n+i+a-o-l-c-u)*m,L=u*(-d+g+v-p-m-y+b),D=(-a+u+h)*(p+y-b),P=(a-h)*(p-b),A=a*y,I=(u+h)*(-y+b),B=(-a+o+l)*(m+y-w),j=(a-l)*(m-w),G=(o+l)*(-y+w),H=i*v,Y=l*b,K=s*g,tt=c*f,it=h*w,_t=k+A+H,Mt=x+_+C+k+D+A+I,re=k+M+O+R+A+B+G,Re=S+E+_+k+A+B+j,Le=S+_+C+k+Y,cn=A+B+j+G+K,sa=k+M+T+L+D+P+A,Pt=D+P+A+I+tt,Dr=k+M+T+O+it;return e.set(0,0,_t),e.set(0,1,Mt),e.set(0,2,re),e.set(1,0,Re),e.set(1,1,Le),e.set(1,2,cn),e.set(2,0,sa),e.set(2,1,Pt),e.set(2,2,Dr),e}mmulStrassen(t){t=et.checkMatrix(t);let e=this.clone(),n=e.rows,i=e.columns,a=t.rows,s=t.columns;i!==a&&console.warn(`Multiplying ${n} x ${i} and ${a} x ${s} matrix: dimensions do not match.`);function o(h,d,f){let g=h.rows,v=h.columns;if(g===d&&v===f)return h;{let p=yt.zeros(d,f);return p=p.setSubMatrix(h,0,0),p}}let l=Math.max(n,a),c=Math.max(i,s);e=o(e,l,c),t=o(t,l,c);function u(h,d,f,g){if(f<=512||g<=512)return h.mmul(d);f%2===1&&g%2===1?(h=o(h,f+1,g+1),d=o(d,f+1,g+1)):f%2===1?(h=o(h,f+1,g),d=o(d,f+1,g)):g%2===1&&(h=o(h,f,g+1),d=o(d,f,g+1));let v=parseInt(h.rows/2,10),p=parseInt(h.columns/2,10),m=h.subMatrix(0,v-1,0,p-1),y=d.subMatrix(0,v-1,0,p-1),b=h.subMatrix(0,v-1,p,h.columns-1),w=d.subMatrix(0,v-1,p,d.columns-1),x=h.subMatrix(v,h.rows-1,0,p-1),S=d.subMatrix(v,d.rows-1,0,p-1),E=h.subMatrix(v,h.rows-1,p,h.columns-1),_=d.subMatrix(v,d.rows-1,p,d.columns-1),C=u(yt.add(m,E),yt.add(y,_),v,p),k=u(yt.add(x,E),y,v,p),M=u(m,yt.sub(w,_),v,p),T=u(E,yt.sub(S,y),v,p),O=u(yt.add(m,b),_,v,p),R=u(yt.sub(x,m),yt.add(y,w),v,p),L=u(yt.sub(b,E),yt.add(S,_),v,p),D=yt.add(C,T);D.sub(O),D.add(L);let P=yt.add(M,O),A=yt.add(k,T),I=yt.sub(C,k);I.add(M),I.add(R);let B=yt.zeros(2*D.rows,2*D.columns);return B=B.setSubMatrix(D,0,0),B=B.setSubMatrix(P,D.rows,0),B=B.setSubMatrix(A,0,D.columns),B=B.setSubMatrix(I,D.rows,D.columns),B.subMatrix(0,f-1,0,g-1)}return u(e,t,l,c)}scaleRows(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let i=new et(this.rows,this.columns);for(let a=0;a0&&_w(s,{min:e,max:n,output:s}),i.setRow(a,s)}return i}scaleColumns(t={}){if(typeof t!="object")throw new TypeError("options must be an object");const{min:e=0,max:n=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(n))throw new TypeError("max must be a number");if(e>=n)throw new RangeError("min must be smaller than max");let i=new et(this.rows,this.columns);for(let a=0;an||e<0||e>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let i=new et(t.length,n-e+1);for(let a=0;a=this.rows)throw new RangeError(`Row index out of range: ${t[a]}`);i.set(a,s-e,this.get(t[a],s))}return i}subMatrixColumn(t,e,n){if(e===void 0&&(e=0),n===void 0&&(n=this.rows-1),e>n||e<0||e>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let i=new et(n-e+1,t.length);for(let a=0;a=this.columns)throw new RangeError(`Column index out of range: ${t[a]}`);i.set(s-e,a,this.get(s,t[a]))}return i}setSubMatrix(t,e,n){if(t=et.checkMatrix(t),t.isEmpty())return this;let i=e+t.rows-1,a=n+t.columns-1;fy(this,e,i,n,a);for(let s=0;stypeof t=="number")}yt.random=yt.rand;yt.randomInt=yt.randInt;yt.diagonal=yt.diag;yt.prototype.diagonal=yt.prototype.diag;yt.identity=yt.eye;yt.prototype.negate=yt.prototype.neg;yt.prototype.tensorProduct=yt.prototype.kroneckerProduct;var Go,gy,Ra;let et=(Ra=class extends yt{constructor(e,n){super();dd(this,Go);Ot(this,"data");if(Ra.isMatrix(e))fd(this,Go,gy).call(this,e.rows,e.columns),Ra.copy(e,this);else if(Number.isInteger(e)&&e>=0)fd(this,Go,gy).call(this,e,n);else if(pn.isAnyArray(e)){const i=e;if(e=i.length,n=e?i[0].length:0,typeof n!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let a=0;a"u"&&(n=e,e=this.columns),Wn(this,e,!0),n=ds(this,n);for(let i=0;i=0)for(let i=0;i=0)bl(this,Xe,new et(e,e));else if(bl(this,Xe,new et(e)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return tr(this,Xe).size}get rows(){return tr(this,Xe).rows}get columns(){return tr(this,Xe).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(e){return et.isMatrix(e)&&e.klassType==="SymmetricMatrix"}static zeros(e){return new this(e)}static ones(e){return new this(e).fill(1)}clone(){const e=new Cu(this.diagonalSize);for(const[n,i,a]of this.upperRightEntries())e.set(n,i,a);return e}toMatrix(){return new et(this)}get(e,n){return tr(this,Xe).get(e,n)}set(e,n,i){return tr(this,Xe).set(e,n,i),tr(this,Xe).set(n,e,i),this}removeCross(e){return tr(this,Xe).removeRow(e),tr(this,Xe).removeColumn(e),this}addCross(e,n){n===void 0&&(n=e,e=this.diagonalSize);const i=n.slice();return i.splice(e,1),tr(this,Xe).addRow(e,i),tr(this,Xe).addColumn(e,n),this}applyMask(e){if(e.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const n=[];for(const[i,a]of e.entries())a||n.push(i);n.reverse();for(const i of n)this.removeCross(i);return this}toCompact(){const{diagonalSize:e}=this,n=new Array(e*(e+1)/2);for(let i=0,a=0,s=0;s=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 Cu(i);for(let s=0,o=0,l=0;l=i&&(s=++o);return a}*upperRightEntries(){for(let e=0,n=0;e=this.diagonalSize&&(n=++e)}}*upperRightValues(){for(let e=0,n=0;e=this.diagonalSize&&(n=++e)}};Xe=new WeakMap;let Pa=Cu;Pa.prototype.klassType="SymmetricMatrix";class dh extends Pa{static isDistanceMatrix(t){return Pa.isSymmetricMatrix(t)&&t.klassSubType==="DistanceMatrix"}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,n){return t===e&&(n=0),super.set(t,e,n)}addCross(t,e){return e===void 0&&(e=t,t=this.diagonalSize),e=e.slice(),e[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new Pa(this)}clone(){const t=new dh(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=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=n&&(a=++s+1);return i}}dh.prototype.klassSubType="DistanceMatrix";class ci extends yt{constructor(t,e,n){super(),this.matrix=t,this.rows=e,this.columns=n}}class uq extends ci{constructor(t,e){Wn(t,e),super(t,t.rows,1),this.column=e}set(t,e,n){return this.matrix.set(t,this.column,n),this}get(t){return this.matrix.get(t,this.column)}}class hq extends ci{constructor(t,e){P1(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 dq extends ci{constructor(t){super(t,t.rows,t.columns)}set(t,e,n){return this.matrix.set(t,this.columns-e-1,n),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}}class fq extends ci{constructor(t){super(t,t.rows,t.columns)}set(t,e,n){return this.matrix.set(this.rows-t-1,e,n),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}}class gq extends ci{constructor(t,e){Gn(t,e),super(t,1,t.columns),this.row=e}set(t,e,n){return this.matrix.set(this.row,e,n),this}get(t,e){return this.matrix.get(this.row,e)}}class vq extends ci{constructor(t,e){A1(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 Lc extends ci{constructor(t,e,n){A1(t,e),P1(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 pq extends ci{constructor(t,e,n,i,a){fy(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 mq extends ci{constructor(t){super(t,t.columns,t.rows)}set(t,e,n){return this.matrix.set(e,t,n),this}get(t,e){return this.matrix.get(e,t)}}class EO extends yt{constructor(t,e={}){const{rows:n=1}=e;if(t.length%n!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=n,this.columns=t.length/n,this.data=t}set(t,e,n){let i=this._calculateIndex(t,e);return this.data[i]=n,this}get(t,e){let n=this._calculateIndex(t,e);return this.data[n]}_calculateIndex(t,e){return t*this.columns+e}}class Ln extends yt{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}}function yq(r,t){if(pn.isAnyArray(r))return r[0]&&pn.isAnyArray(r[0])?new Ln(r):new EO(r,t);throw new Error("the argument is not an array")}class fh{constructor(t){t=Ln.checkMatrix(t);let e=t.clone(),n=e.rows,i=e.columns,a=new Float64Array(n),s=1,o,l,c,u,h,d,f,g,v;for(o=0;oMath.abs(g[u])&&(u=o);if(u!==l){for(c=0;c=0;c--){for(l=0;ls?i.set(a,s,t.get(a,s)):a===s?i.set(a,s,1):i.set(a,s,0);return i}get upperTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,i=new et(e,n);for(let a=0;aMath.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 N1{constructor(t){t=Ln.checkMatrix(t);let e=t.clone(),n=t.rows,i=t.columns,a=new Float64Array(i),s,o,l,c;for(l=0;l=0;c--){for(l=0;l=0;o--){for(a=0;a=0;k--)if(g[k]!==0){for(let M=k+1;M=0;k--){if(k0;){let k,M;for(k=E-2;k>=-1&&k!==-1;k--){const T=Number.MIN_VALUE+C*Math.abs(g[k]+Math.abs(g[k+1]));if(Math.abs(m[k])<=T||Number.isNaN(m[k])){m[k]=0;break}}if(k===E-2)M=4;else{let T;for(T=E-1;T>=k&&T!==k;T--){let O=(T!==E?Math.abs(m[T]):0)+(T!==k+1?Math.abs(m[T-1]):0);if(Math.abs(g[T])<=C*O){g[T]=0;break}}T===k?M=3:T===E-1?M=1:(M=2,k=T)}switch(k++,M){case 1:{let T=m[E-2];m[E-2]=0;for(let O=E-2;O>=k;O--){let R=jr(g[O],T),L=g[O]/R,D=T/R;if(g[O]=R,O!==k&&(T=-D*m[O-1],m[O-1]=L*m[O-1]),c)for(let P=0;P=g[k+1]);){let T=g[k];if(g[k]=g[k+1],g[k+1]=T,c&&ke&&a.set(u,h,t.get(u,h)/this.s[h]);let s=this.U,o=s.rows,l=s.columns,c=new et(n,o);for(let u=0;ut&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return et.diag(this.s)}};function bq(r,t=!1){return r=Ln.checkMatrix(r),t?new Is(r).inverse():SO(r,et.eye(r.rows))}function SO(r,t,e=!1){return r=Ln.checkMatrix(r),t=Ln.checkMatrix(t),e?new Is(r).solve(t):r.isSquare()?new fh(r).solve(t):new N1(r).solve(t)}function Dc(r){if(r=et.checkMatrix(r),r.isSquare()){if(r.columns===0)return 1;let t,e,n,i;if(r.columns===2)return t=r.get(0,0),e=r.get(0,1),n=r.get(1,0),i=r.get(1,1),t*i-e*n;if(r.columns===3){let a,s,o;return a=new Lc(r,[1,2],[1,2]),s=new Lc(r,[1,2],[0,2]),o=new Lc(r,[1,2],[0,1]),t=r.get(0,0),e=r.get(0,1),n=r.get(0,2),t*Dc(a)-e*Dc(s)+n*Dc(o)}else return new fh(r).determinant}else throw Error("determinant can only be calculated for a square matrix")}function wq(r,t){let e=[];for(let n=0;ni)return new Array(t.rows+1).fill(0);{let a=t.addRow(e,[0]);for(let s=0;st?a[s]=1/a[s]:a[s]=0;return i.mmul(et.diag(a).mmul(n.transpose()))}function _q(r,t=r,e={}){r=new et(r);let n=!1;if(typeof t=="object"&&!et.isMatrix(t)&&!pn.isAnyArray(t)?(e=t,t=r,n=!0):t=new et(t),r.rows!==t.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:i=!0}=e;i&&(r=r.center("column"),n||(t=t.center("column")));const a=r.transpose().mmul(t);for(let s=0;s0?i.set(a,a+1,e[a]):e[a]<0&&i.set(a,a-1,e[a])}return i}}function Mq(r,t,e,n){let i,a,s,o,l,c,u,h;for(l=0;l0;o--){for(h=0,s=0,c=0;c0&&(a=-a),t[o]=h*a,s=s-i*a,e[o-1]=i-a,l=0;lc)do{for(i=e[c],h=(e[c+1]-i)/(2*t[c]),d=jr(h,1),h<0&&(d=-d),e[c]=t[c]/(h+d),e[c+1]=t[c]*(h+d),f=e[c+1],a=i-e[c],s=c+2;s=c;s--)for(p=v,v=g,b=y,i=g*t[s],a=g*h,d=jr(h,t[s]),t[s+1]=y*d,y=t[s]/d,g=h/d,h=g*e[s]-y*i,e[s+1]=a+y*(g*i+y*e[s]),l=0;lS*x);e[c]=e[c]+w,t[c]=0}for(s=0;s=h;c--)e[c]=t.get(c,h-1)/d,l+=e[c]*e[c];for(o=Math.sqrt(l),e[h]>0&&(o=-o),l=l-e[h]*o,e[h]=e[h]-o,u=h;u=h;c--)s+=e[c]*t.get(c,u);for(s=s/l,c=h;c<=a;c++)t.set(c,u,t.get(c,u)-s*e[c])}for(c=0;c<=a;c++){for(s=0,u=a;u>=h;u--)s+=e[u]*t.get(c,u);for(s=s/l,u=h;u<=a;u++)t.set(c,u,t.get(c,u)-s*e[u])}e[h]=d*e[h],t.set(h,h-1,d*o)}}for(c=0;c=i+1;h--)if(t.get(h,h-1)!==0){for(c=h+1;c<=a;c++)e[c]=t.get(c,h-1);for(u=h;u<=a;u++){for(o=0,c=h;c<=a;c++)o+=e[c]*n.get(c,u);for(o=o/e[h]/t.get(h,h-1),c=h;c<=a;c++)n.set(c,u,n.get(c,u)+o*e[c])}}}function Oq(r,t,e,n,i){let a=r-1,s=0,o=r-1,l=Number.EPSILON,c=0,u=0,h=0,d=0,f=0,g=0,v=0,p=0,m,y,b,w,x,S,E,_,C,k,M,T,O,R,L;for(m=0;mo)&&(e[m]=i.get(m,m),t[m]=0),y=Math.max(m-1,0);y=s;){for(w=a;w>s&&(g=Math.abs(i.get(w-1,w-1))+Math.abs(i.get(w,w)),g===0&&(g=u),!(Math.abs(i.get(w,w-1))=0){for(v=h>=0?h+v:h-v,e[a-1]=_+v,e[a]=e[a-1],v!==0&&(e[a]=_-E/v),t[a-1]=0,t[a]=0,_=i.get(a,a-1),g=Math.abs(_)+Math.abs(v),h=_/g,d=v/g,f=Math.sqrt(h*h+d*d),h=h/f,d=d/f,y=a-1;y0)){for(g=Math.sqrt(g),C<_&&(g=-g),g=_-E/((C-_)/2+g),m=s;m<=a;m++)i.set(m,m,i.get(m,m)-g);c+=g,_=C=E=.964}for(p=p+1,x=a-2;x>=w&&(v=i.get(x,x),f=_-v,g=C-v,h=(f*g-E)/i.get(x+1,x)+i.get(x,x+1),d=i.get(x+1,x+1)-v-f-g,f=i.get(x+2,x+1),g=Math.abs(h)+Math.abs(d)+Math.abs(f),h=h/g,d=d/g,f=f/g,!(x===w||Math.abs(i.get(x,x-1))*(Math.abs(d)+Math.abs(f))x+2&&i.set(m,m-3,0);for(b=x;b<=a-1&&(R=b!==a-1,b!==x&&(h=i.get(b,b-1),d=i.get(b+1,b-1),f=R?i.get(b+2,b-1):0,_=Math.abs(h)+Math.abs(d)+Math.abs(f),_!==0&&(h=h/_,d=d/_,f=f/_)),_!==0);b++)if(g=Math.sqrt(h*h+d*d+f*f),h<0&&(g=-g),g!==0){for(b!==x?i.set(b,b-1,-g*_):w!==x&&i.set(b,b-1,-i.get(b,b-1)),h=h+g,_=h/g,C=d/g,v=f/g,d=d/h,f=f/h,y=b;y=0;a--)if(h=e[a],d=t[a],d===0)for(w=a,i.set(a,a,1),m=a-1;m>=0;m--){for(E=i.get(m,m)-h,f=0,y=w;y<=a;y++)f=f+i.get(m,y)*i.get(y,a);if(t[m]<0)v=E,g=f;else if(w=m,t[m]===0?i.set(m,a,E!==0?-f/E:-f/(l*u)):(_=i.get(m,m+1),C=i.get(m+1,m),d=(e[m]-h)*(e[m]-h)+t[m]*t[m],S=(_*g-v*f)/d,i.set(m,a,S),i.set(m+1,a,Math.abs(_)>Math.abs(v)?(-f-E*S)/_:(-g-C*S)/v)),S=Math.abs(i.get(m,a)),l*S*S>1)for(y=m;y<=a;y++)i.set(y,a,i.get(y,a)/S)}else if(d<0)for(w=a-1,Math.abs(i.get(a,a-1))>Math.abs(i.get(a-1,a))?(i.set(a-1,a-1,d/i.get(a,a-1)),i.set(a-1,a,-(i.get(a,a)-h)/i.get(a,a-1))):(L=uc(0,-i.get(a-1,a),i.get(a-1,a-1)-h,d),i.set(a-1,a-1,L[0]),i.set(a-1,a,L[1])),i.set(a,a-1,0),i.set(a,a,1),m=a-2;m>=0;m--){for(k=0,M=0,y=w;y<=a;y++)k=k+i.get(m,y)*i.get(y,a-1),M=M+i.get(m,y)*i.get(y,a);if(E=i.get(m,m)-h,t[m]<0)v=E,f=k,g=M;else if(w=m,t[m]===0?(L=uc(-k,-M,E,d),i.set(m,a-1,L[0]),i.set(m,a,L[1])):(_=i.get(m,m+1),C=i.get(m+1,m),T=(e[m]-h)*(e[m]-h)+t[m]*t[m]-d*d,O=(e[m]-h)*2*d,T===0&&O===0&&(T=l*u*(Math.abs(E)+Math.abs(d)+Math.abs(_)+Math.abs(C)+Math.abs(v))),L=uc(_*f-v*k+d*M,_*g-v*M-d*k,T,O),i.set(m,a-1,L[0]),i.set(m,a,L[1]),Math.abs(_)>Math.abs(v)+Math.abs(d)?(i.set(m+1,a-1,(-k-E*i.get(m,a-1)+d*i.get(m,a))/_),i.set(m+1,a,(-M-E*i.get(m,a)-d*i.get(m,a-1))/_)):(L=uc(-f-C*i.get(m,a-1),-g-C*i.get(m,a),v,d),i.set(m+1,a-1,L[0]),i.set(m+1,a,L[1]))),S=Math.max(Math.abs(i.get(m,a-1)),Math.abs(i.get(m,a))),l*S*S>1)for(y=m;y<=a;y++)i.set(y,a-1,i.get(y,a-1)/S),i.set(y,a,i.get(y,a)/S)}for(m=0;mo)for(y=m;y=s;y--)for(m=s;m<=o;m++){for(v=0,b=s;b<=Math.min(y,o);b++)v=v+n.get(m,b)*i.get(b,y);n.set(m,y,v)}}}function uc(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 kO{constructor(t){if(t=Ln.checkMatrix(t),!t.isSymmetric())throw new Error("Matrix is not symmetric");let e=t,n=e.rows,i=new et(n,n),a=!0,s,o,l;for(o=0;o0),i.set(o,o,Math.sqrt(Math.max(c,0))),l=o+1;l=0;l--)for(o=0;os;f++)h=t.transpose().mmul(o).div(o.transpose().mmul(o).get(0,0)),h=h.div(h.norm()),c=t.mmul(h).div(h.transpose().mmul(h).get(0,0)),f>0&&(l=c.clone().sub(d).pow(2).sum()),d=c.clone(),n?(u=n.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0)),u=u.div(u.norm()),o=n.mmul(u).div(u.transpose().mmul(u).get(0,0))):o=c;if(n){let f=t.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0));f=f.div(f.norm());let g=t.clone().sub(c.clone().mmul(f.transpose())),v=o.transpose().mmul(c).div(c.transpose().mmul(c).get(0,0)),p=n.clone().sub(c.clone().mulS(v.get(0,0)).mmul(u.transpose()));this.t=c,this.p=f.transpose(),this.w=h.transpose(),this.q=u,this.u=o,this.s=c.transpose().mmul(c),this.xResidual=g,this.yResidual=p,this.betas=v}else this.w=h.transpose(),this.s=c.transpose().mmul(c).sqrt(),i?this.t=c.clone().div(this.s.get(0,0)):this.t=c,this.xResidual=t.sub(c.mmul(h.transpose()))}}kt.AbstractMatrix=yt;kt.CHO=kO;kt.CholeskyDecomposition=kO;kt.DistanceMatrix=dh;kt.EVD=_O;kt.EigenvalueDecomposition=_O;kt.LU=fh;kt.LuDecomposition=fh;var CO=kt.Matrix=et;kt.MatrixColumnSelectionView=hq;kt.MatrixColumnView=uq;kt.MatrixFlipColumnView=dq;kt.MatrixFlipRowView=fq;kt.MatrixRowSelectionView=vq;kt.MatrixRowView=gq;kt.MatrixSelectionView=Lc;kt.MatrixSubView=pq;kt.MatrixTransposeView=mq;kt.NIPALS=MO;kt.Nipals=MO;kt.QR=N1;kt.QrDecomposition=N1;kt.SVD=Is;var Aq=kt.SingularValueDecomposition=Is;kt.SymmetricMatrix=Pa;kt.WrapperMatrix1D=EO;kt.WrapperMatrix2D=Ln;kt.correlation=kq;kt.covariance=_q;var Cw=kt.default=et;kt.determinant=Dc;kt.inverse=bq;kt.linearDependencies=Eq;kt.pseudoInverse=Sq;kt.solve=SO;kt.wrap=yq;const Ri=CO,TO=Aq;Cw.Matrix&&Cw.Matrix;const Pq={center:[0,0],linkDistance:50};class OO{constructor(t={}){this.options=t,this.id="mds",this.options=Object.assign(Object.assign({},Pq),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericMDSLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericMDSLayout(!0,t,e)})}genericMDSLayout(t,e,n){return bt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a=[0,0],linkDistance:s=50}=i,o=e.getAllNodes(),l=e.getAllEdges();if(!(o!=null&&o.length)||o.length===1)return Ha(e,t,a);const c=vO({nodes:o,edges:l}),u=gO(c);Nq(u);const h=R$(u,s),d=Rq(h),f=[];return d.forEach((v,p)=>{const m=On(o[p]);m.data.x=v[0]+a[0],m.data.y=v[1]+a[1],f.push(m)}),t&&f.forEach(v=>e.mergeNodeData(v.id,{x:v.data.x,y:v.data.y})),{nodes:f,edges:l}})}}const Nq=r=>{let t=-999999;r.forEach(e=>{e.forEach(n=>{n!==1/0&&t{e.forEach((i,a)=>{i===1/0&&(r[n][a]=t)})})},Rq=r=>{const e=Ri.mul(Ri.pow(r,2),-.5),n=e.mean("row"),i=e.mean("column"),a=e.mean();e.add(a).subRowVector(n).subColumnVector(i);const s=new TO(e),o=Ri.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map(l=>Ri.mul([l],[o]).toJSON()[0].splice(0,2))};function vy(r){return!!r.tick&&!!r.stop}const Lq={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},Dq={center:[0,0],comboPadding:10,treeKey:"combo"};class Iq{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},Dq),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericComboCombinedLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericComboCombinedLayout(!0,t,e)})}genericComboCombinedLayout(t,e,n){return bt(this,void 0,void 0,function*(){const i=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:a,treeKey:s,outerLayout:o}=i,l=e.getAllNodes().filter(_=>!_.data._isCombo),c=e.getAllNodes().filter(_=>_.data._isCombo),u=e.getAllEdges(),h=l==null?void 0:l.length;if(!h||h===1)return Ha(e,t,a);const d=[],f=new Map;l.forEach(_=>{f.set(_.id,_)});const g=new Map;c.forEach(_=>{g.set(_.id,_)});const v=new Map,p=this.getInnerGraphs(e,s,f,g,u,i,v);yield Promise.all(p);const m=new Map,y=[],b=new Map;let w=!0;e.getRoots(s).forEach(_=>{const C=v.get(_.id),k=g.get(_.id)||f.get(_.id),M={id:_.id,data:Object.assign(Object.assign({},_.data),{x:C.data.x||k.data.x,y:C.data.y||k.data.y,fx:C.data.fx||k.data.fx,fy:C.data.fy||k.data.fy,mass:C.data.mass||k.data.mass,size:C.data.size})};y.push(M),m.set(_.id,!0),!isNaN(M.data.x)&&M.data.x!==0&&!isNaN(M.data.y)&&M.data.y!==0?w=!1:(M.data.x=Math.random()*100,M.data.y=Math.random()*100),uy(e,[_],T=>{T.id!==_.id&&b.set(T.id,_.id)},"TB",s)});const x=[];u.forEach(_=>{const C=b.get(_.source)||_.source,k=b.get(_.target)||_.target;C!==k&&m.has(C)&&m.has(k)&&x.push({id:_.id,source:C,target:k,data:{}})});let S;if(y!=null&&y.length){if(y.length===1)y[0].data.x=a[0],y[0].data.y=a[1];else{const _=new Ne({nodes:y,edges:x}),C=o||new bO;w&&Lq[C.id]&&(yield(y.length<100?new OO:new dy).assign(_));const k=Object.assign({center:a,kg:5,preventOverlap:!0,animate:!1},C.id==="force"?{gravity:1,factor:4,linkDistance:(M,T,O)=>{const R=Math.max(...T.data.size)||32,L=Math.max(...O.data.size)||32;return R/2+L/2+200}}:{});S=yield Tw(C,_,k)}v.forEach(_=>{var C;const k=S.nodes.find(O=>O.id===_.id);if(k){const{x:O,y:R}=k.data;_.data.visited=!0,_.data.x=O,_.data.y=R,d.push({id:_.id,data:{x:O,y:R}})}const{x:M,y:T}=_.data;(C=_.data.nodes)===null||C===void 0||C.forEach(O=>{d.push({id:O.id,data:{x:O.data.x+M,y:O.data.y+T}})})}),v.forEach(({data:_})=>{const{x:C,y:k,visited:M,nodes:T}=_;T==null||T.forEach(O=>{if(!M){const R=d.find(L=>L.id===O.id);R.data.x+=C||0,R.data.y+=k||0}})})}return t&&d.forEach(_=>{e.mergeNodeData(_.id,{x:_.data.x,y:_.data.y})}),{nodes:d,edges:u}})}initVals(t){const e=Object.assign({},t),{nodeSize:n,spacing:i,comboPadding:a}=t;let s,o;if(nt(i)?o=()=>i:at(i)?o=i:o=()=>0,e.spacing=o,!n)s=c=>{const u=o(c);return c.size?Vr(c.size)?((c.size[0]>c.size[1]?c.size[0]:c.size[1])+u)/2:me(c.size)?((c.size.width>c.size.height?c.size.width:c.size.height)+u)/2:(c.size+u)/2:32+u/2};else if(at(n))s=c=>{const u=n(c),h=o(c);return Vr(c.size)?((c.size[0]>c.size[1]?c.size[0]:c.size[1])+h)/2:((u||32)+h)/2};else if(Vr(n)){const u=(n[0]>n[1]?n[0]:n[1])/2;s=h=>u+o(h)/2}else{const c=n/2;s=u=>c+o(u)/2}e.nodeSize=s;let l;return nt(a)?l=()=>a:Vr(a)?l=()=>Math.max.apply(null,a):at(a)?l=a:l=()=>0,e.comboPadding=l,e}getInnerGraphs(t,e,n,i,a,s,o){const{nodeSize:l,comboPadding:c,spacing:u,innerLayout:h}=s,d=h||new dy({}),f={center:[0,0],preventOverlap:!0,nodeSpacing:u},g=[],v=p=>{let m=(c==null?void 0:c(p))||10;return Vr(m)&&(m=Math.max(...m)),{size:m?[m*2,m*2]:[30,30],padding:m}};return t.getRoots(e).forEach(p=>{o.set(p.id,{id:p.id,data:{nodes:[],size:v(p).size}});let m=Promise.resolve();uy(t,[p],y=>{var b;if(!y.data._isCombo)return;const{size:w,padding:x}=v(y);if(!(!((b=t.getChildren(y.id,e))===null||b===void 0)&&b.length))o.set(y.id,{id:y.id,data:Object.assign(Object.assign({},y.data),{size:w})});else{const S=o.get(y.id);o.set(y.id,{id:y.id,data:Object.assign({nodes:[]},S==null?void 0:S.data)});const E=new Map,_=t.getChildren(y.id,e).map(M=>{if(M.data._isCombo)return o.has(M.id)||o.set(M.id,{id:M.id,data:Object.assign({},M.data)}),E.set(M.id,!0),o.get(M.id);const T=n.get(M.id)||i.get(M.id);return E.set(M.id,!0),{id:M.id,data:Object.assign(Object.assign({},T.data),M.data)}}),C={nodes:_,edges:a.filter(M=>E.has(M.source)&&E.has(M.target))};let k=1/0;_.forEach(M=>{var T;let{size:O}=M.data;O||(O=((T=o.get(M.id))===null||T===void 0?void 0:T.data.size)||(l==null?void 0:l(M))||[30,30]),nt(O)&&(O=[O,O]);const[R,L]=O;k>R&&(k=R),k>L&&(k=L),M.data.size=O}),m=m.then(()=>bt(this,void 0,void 0,function*(){const M=new Ne(C);yield Tw(d,M,f,!0);const{minX:T,minY:O,maxX:R,maxY:L}=L$(_),D={x:(R+T)/2,y:(L+O)/2};C.nodes.forEach(A=>{A.data.x-=D.x,A.data.y-=D.y});const P=[Math.max(R-T,k)+x*2,Math.max(L-O,k)+x*2];o.get(y.id).data.size=P,o.get(y.id).data.nodes=_}))}return!0},"BT",e),g.push(m)}),g}}function Tw(r,t,e,n){var i;return bt(this,void 0,void 0,function*(){return vy(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 Fq(r,t){var e,n=1;r==null&&(r=0),t==null&&(t=0);function i(){var a,s=e.length,o,l=0,c=0;for(a=0;ad.index){var M=f-_.x-_.vx,T=g-_.y-_.vy,O=M*M+T*T;Of+k||Sg+k||Ec.r&&(c.r=c[u].r)}function l(){if(t){var c,u=t.length,h;for(e=new Array(u),c=0;c[t(x,S,s),x])),w;for(p=0,o=new Array(m);p(r=(Gq*r+Wq)%Aw)/Aw}function Hq(r){return r.x}function Uq(r){return r.y}var Yq=10,Xq=Math.PI*(3-Math.sqrt(5));function Kq(r){var t,e=1,n=.001,i=1-Math.pow(n,1/300),a=0,s=.6,o=new Map,l=mN(h),c=yN("tick","end"),u=Vq();r==null&&(r=[]);function h(){d(),c.call("tick",t),e1?(p==null?o.delete(v):o.set(v,g(p)),t):o.get(v)},find:function(v,p,m){var y=0,b=r.length,w,x,S,E,_;for(m==null?m=1/0:m*=m,y=0;y1?(c.on(v,p),t):c.on(v)}}}function Zq(){var r,t,e,n,i=Ae(-30),a,s=1,o=1/0,l=.81;function c(f){var g,v=r.length,p=uh(r,Hq,Uq).visitAfter(h);for(n=f,g=0;g=o)return;(f.data!==t||f.next)&&(m===0&&(m=Li(e),w+=m*m),y===0&&(y=Li(e),w+=y*y),we.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},on(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericLayout(!0,t,e)})}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(t,e){const n=this.context.nodes.find(i=>i.id===t);n&&e.forEach((i,a)=>{if(typeof i=="number"||i===null){const s=["fx","fy","fz"][a];n[s]=i}})}getOptions(t){var e,n;const i=on({},this.options,t);return i.collide&&((e=i.collide)===null||e===void 0?void 0:e.radius)===void 0&&(i.collide=i.collide||{},i.collide.radius=(n=i.nodeSize)!==null&&n!==void 0?n:10),i.iterations===void 0&&(i.link&&i.link.iterations===void 0&&(i.iterations=i.link.iterations),i.collide&&i.collide.iterations===void 0&&(i.iterations=i.collide.iterations)),this.context.options=i,i}genericLayout(t,e,n){var i;return bt(this,void 0,void 0,function*(){const a=this.getOptions(n),s=e.getAllNodes().map(({id:u,data:h})=>Object.assign(Object.assign({id:u},h),La(h.data,this.config.inputNodeAttrs))),o=e.getAllEdges().map(u=>Object.assign({},u));Object.assign(this.context,{assign:t,nodes:s,edges:o,graph:e});const l=new Promise(u=>{this.resolver=u}),c=this.setSimulation(a);return c.nodes(s),(i=c.force("link"))===null||i===void 0||i.links(o),l})}getResult(){const{assign:t,nodes:e,edges:n,graph:i}=this.context,a=e.map(o=>({id:o.id,data:Object.assign(Object.assign({},o.data),La(o,this.config.outputNodeAttrs))})),s=n.map(({id:o,source:l,target:c,data:u})=>({id:o,source:typeof l=="object"?l.id:l,target:typeof c=="object"?c.id:c,data:u}));return t&&a.forEach(o=>i.mergeNodeData(o.id,o.data)),{nodes:a,edges:s}}initSimulation(){return Kq()}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())})),Pw(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)),Pw(s,Object.entries(t[a]))}else e.force(a,null)}),e}}const Pw=(r,t)=>t.reduce((e,[n,i])=>!e[n]||i===void 0?e:e[n].call(r,i),r);var lf,Nw;function nG(){if(Nw)return lf;Nw=1;function r(){this.__data__=[],this.size=0}return lf=r,lf}var cf,Rw;function Fs(){if(Rw)return cf;Rw=1;function r(t,e){return t===e||t!==t&&e!==e}return cf=r,cf}var uf,Lw;function gh(){if(Lw)return uf;Lw=1;var r=Fs();function t(e,n){for(var i=e.length;i--;)if(r(e[i][0],n))return i;return-1}return uf=t,uf}var hf,Dw;function rG(){if(Dw)return hf;Dw=1;var r=gh(),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 hf=n,hf}var df,Iw;function iG(){if(Iw)return df;Iw=1;var r=gh();function t(e){var n=this.__data__,i=r(n,e);return i<0?void 0:n[i][1]}return df=t,df}var ff,Fw;function aG(){if(Fw)return ff;Fw=1;var r=gh();function t(e){return r(this.__data__,e)>-1}return ff=t,ff}var gf,Bw;function sG(){if(Bw)return gf;Bw=1;var r=gh();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 gf=t,gf}var vf,zw;function vh(){if(zw)return vf;zw=1;var r=nG(),t=rG(),e=iG(),n=aG(),i=sG();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o-1&&n%1==0&&n-1&&e%1==0&&e<=r}return u0=t,u0}var h0,Ix;function RG(){if(Ix)return h0;Ix=1;var r=Ua(),t=I1(),e=Lr(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",s="[object Date]",o="[object Error]",l="[object Function]",c="[object Map]",u="[object Number]",h="[object Object]",d="[object RegExp]",f="[object Set]",g="[object String]",v="[object WeakMap]",p="[object ArrayBuffer]",m="[object DataView]",y="[object Float32Array]",b="[object Float64Array]",w="[object Int8Array]",x="[object Int16Array]",S="[object Int32Array]",E="[object Uint8Array]",_="[object Uint8ClampedArray]",C="[object Uint16Array]",k="[object Uint32Array]",M={};M[y]=M[b]=M[w]=M[x]=M[S]=M[E]=M[_]=M[C]=M[k]=!0,M[n]=M[i]=M[p]=M[a]=M[m]=M[s]=M[o]=M[l]=M[c]=M[u]=M[h]=M[d]=M[f]=M[g]=M[v]=!1;function T(O){return e(O)&&t(O.length)&&!!M[r(O)]}return h0=T,h0}var d0,Fx;function Eh(){if(Fx)return d0;Fx=1;function r(t){return function(e){return t(e)}}return d0=r,d0}var lo={exports:{}};lo.exports;var Bx;function F1(){return Bx||(Bx=1,function(r,t){var e=AO(),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}(lo,lo.exports)),lo.exports}var f0,zx;function ul(){if(zx)return f0;zx=1;var r=RG(),t=Eh(),e=F1(),n=e&&e.isTypedArray,i=n?t(n):r;return f0=i,f0}var g0,$x;function RO(){if($x)return g0;$x=1;var r=AG(),t=cl(),e=Me(),n=zs(),i=xh(),a=ul(),s=Object.prototype,o=s.hasOwnProperty;function l(c,u){var h=e(c),d=!h&&t(c),f=!h&&!d&&n(c),g=!h&&!d&&!f&&a(c),v=h||d||f||g,p=v?r(c.length,String):[],m=p.length;for(var y in c)(u||o.call(c,y))&&!(v&&(y=="length"||f&&(y=="offset"||y=="parent")||g&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||i(y,m)))&&p.push(y);return p}return g0=l,g0}var v0,jx;function Sh(){if(jx)return v0;jx=1;var r=Object.prototype;function t(e){var n=e&&e.constructor,i=typeof n=="function"&&n.prototype||r;return e===i}return v0=t,v0}var p0,qx;function LO(){if(qx)return p0;qx=1;function r(t,e){return function(n){return t(e(n))}}return p0=r,p0}var m0,Gx;function LG(){if(Gx)return m0;Gx=1;var r=LO(),t=r(Object.keys,Object);return m0=t,m0}var y0,Wx;function B1(){if(Wx)return y0;Wx=1;var r=Sh(),t=LG(),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 y0=i,y0}var b0,Vx;function ui(){if(Vx)return b0;Vx=1;var r=ol(),t=I1();function e(n){return n!=null&&t(n.length)&&!r(n)}return b0=e,b0}var w0,Hx;function aa(){if(Hx)return w0;Hx=1;var r=RO(),t=B1(),e=ui();function n(i){return e(i)?r(i):t(i)}return w0=n,w0}var x0,Ux;function DG(){if(Ux)return x0;Ux=1;var r=ll(),t=aa();function e(n,i){return n&&r(i,t(i),n)}return x0=e,x0}var E0,Yx;function IG(){if(Yx)return E0;Yx=1;function r(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}return E0=r,E0}var S0,Xx;function FG(){if(Xx)return S0;Xx=1;var r=Kn(),t=Sh(),e=IG(),n=Object.prototype,i=n.hasOwnProperty;function a(s){if(!r(s))return e(s);var o=t(s),l=[];for(var c in s)c=="constructor"&&(o||!i.call(s,c))||l.push(c);return l}return S0=a,S0}var _0,Kx;function Xa(){if(Kx)return _0;Kx=1;var r=RO(),t=FG(),e=ui();function n(i){return e(i)?r(i,!0):t(i)}return _0=n,_0}var k0,Zx;function BG(){if(Zx)return k0;Zx=1;var r=ll(),t=Xa();function e(n,i){return n&&r(i,t(i),n)}return k0=e,k0}var co={exports:{}};co.exports;var Jx;function DO(){return Jx||(Jx=1,function(r,t){var e=hr(),n=t&&!t.nodeType&&t,i=n&&!0&&r&&!r.nodeType&&r,a=i&&i.exports===n,s=a?e.Buffer:void 0,o=s?s.allocUnsafe:void 0;function l(c,u){if(u)return c.slice();var h=c.length,d=o?o(h):new c.constructor(h);return c.copy(d),d}r.exports=l}(co,co.exports)),co.exports}var M0,Qx;function IO(){if(Qx)return M0;Qx=1;function r(t,e){var n=-1,i=t.length;for(e||(e=Array(i));++nf))return!1;var v=h.get(s),p=h.get(o);if(v&&p)return v==o&&p==s;var m=-1,y=!0,b=l&i?new r:void 0;for(h.set(s,o),h.set(o,s);++m0&&a(u)?i>1?e(u,i-1,a,s,o):r(o,u):s||(o[o.length]=u)}return o}return mv=e,mv}var yv,VS;function DW(){if(VS)return yv;VS=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 yv=r,yv}var bv,HS;function fA(){if(HS)return bv;HS=1;var r=DW(),t=Math.max;function e(n,i,a){return i=t(i===void 0?n.length-1:i,0),function(){for(var s=arguments,o=-1,l=t(s.length-i,0),c=Array(l);++o0){if(++a>=r)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return xv=n,xv}var Ev,XS;function gA(){if(XS)return Ev;XS=1;var r=IW(),t=FW(),e=t(r);return Ev=e,Ev}var Sv,KS;function Oh(){if(KS)return Sv;KS=1;var r=Ka(),t=fA(),e=gA();function n(i,a){return e(t(i,a,r),i+"")}return Sv=n,Sv}var _v,ZS;function vA(){if(ZS)return _v;ZS=1;function r(t,e,n,i){for(var a=t.length,s=n+(i?1:-1);i?s--:++s-1}return Tv=t,Tv}var Ov,n_;function qW(){if(n_)return Ov;n_=1;function r(t,e,n){for(var i=-1,a=t==null?0:t.length;++i=s){var m=c?null:i(l);if(m)return a(m);g=!1,d=n,p=new r}else p=c?[]:v;t:for(;++h1?f.setNode(g,h):f.setNode(g)}),this},i.prototype.setNode=function(u,h){return r.has(this._nodes,u)?(arguments.length>1&&(this._nodes[u]=h),this):(this._nodes[u]=arguments.length>1?h:this._defaultNodeLabelFn(u),this._isCompound&&(this._parent[u]=e,this._children[u]={},this._children[e][u]=!0),this._in[u]={},this._preds[u]={},this._out[u]={},this._sucs[u]={},++this._nodeCount,this)},i.prototype.node=function(u){return this._nodes[u]},i.prototype.hasNode=function(u){return r.has(this._nodes,u)},i.prototype.removeNode=function(u){var h=this;if(r.has(this._nodes,u)){var d=function(f){h.removeEdge(h._edgeObjs[f])};delete this._nodes[u],this._isCompound&&(this._removeFromParentsChildList(u),delete this._parent[u],r.each(this.children(u),function(f){h.setParent(f)}),delete this._children[u]),r.each(r.keys(this._in[u]),d),delete this._in[u],delete this._preds[u],r.each(r.keys(this._out[u]),d),delete this._out[u],delete this._sucs[u],--this._nodeCount}return this},i.prototype.setParent=function(u,h){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(r.isUndefined(h))h=e;else{h+="";for(var d=h;!r.isUndefined(d);d=this.parent(d))if(d===u)throw new Error("Setting "+h+" as parent of "+u+" would create a cycle");this.setNode(h)}return this.setNode(u),this._removeFromParentsChildList(u),this._parent[u]=h,this._children[h][u]=!0,this},i.prototype._removeFromParentsChildList=function(u){delete this._children[this._parent[u]][u]},i.prototype.parent=function(u){if(this._isCompound){var h=this._parent[u];if(h!==e)return h}},i.prototype.children=function(u){if(r.isUndefined(u)&&(u=e),this._isCompound){var h=this._children[u];if(h)return r.keys(h)}else{if(u===e)return this.nodes();if(this.hasNode(u))return[]}},i.prototype.predecessors=function(u){var h=this._preds[u];if(h)return r.keys(h)},i.prototype.successors=function(u){var h=this._sucs[u];if(h)return r.keys(h)},i.prototype.neighbors=function(u){var h=this.predecessors(u);if(h)return r.union(h,this.successors(u))},i.prototype.isLeaf=function(u){var h;return this.isDirected()?h=this.successors(u):h=this.neighbors(u),h.length===0},i.prototype.filterNodes=function(u){var h=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});h.setGraph(this.graph());var d=this;r.each(this._nodes,function(v,p){u(p)&&h.setNode(p,v)}),r.each(this._edgeObjs,function(v){h.hasNode(v.v)&&h.hasNode(v.w)&&h.setEdge(v,d.edge(v))});var f={};function g(v){var p=d.parent(v);return p===void 0||h.hasNode(p)?(f[v]=p,p):p in f?f[p]:g(p)}return this._isCompound&&r.each(h.nodes(),function(v){h.setParent(v,g(v))}),h},i.prototype.setDefaultEdgeLabel=function(u){return r.isFunction(u)||(u=r.constant(u)),this._defaultEdgeLabelFn=u,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return r.values(this._edgeObjs)},i.prototype.setPath=function(u,h){var d=this,f=arguments;return r.reduce(u,function(g,v){return f.length>1?d.setEdge(g,v,h):d.setEdge(g,v),v}),this},i.prototype.setEdge=function(){var u,h,d,f,g=!1,v=arguments[0];typeof v=="object"&&v!==null&&"v"in v?(u=v.v,h=v.w,d=v.name,arguments.length===2&&(f=arguments[1],g=!0)):(u=v,h=arguments[1],d=arguments[3],arguments.length>2&&(f=arguments[2],g=!0)),u=""+u,h=""+h,r.isUndefined(d)||(d=""+d);var p=o(this._isDirected,u,h,d);if(r.has(this._edgeLabels,p))return g&&(this._edgeLabels[p]=f),this;if(!r.isUndefined(d)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(u),this.setNode(h),this._edgeLabels[p]=g?f:this._defaultEdgeLabelFn(u,h,d);var m=l(this._isDirected,u,h,d);return u=m.v,h=m.w,Object.freeze(m),this._edgeObjs[p]=m,a(this._preds[h],u),a(this._sucs[u],h),this._in[h][p]=m,this._out[u][p]=m,this._edgeCount++,this},i.prototype.edge=function(u,h,d){var f=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,u,h,d);return this._edgeLabels[f]},i.prototype.hasEdge=function(u,h,d){var f=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,u,h,d);return r.has(this._edgeLabels,f)},i.prototype.removeEdge=function(u,h,d){var f=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,u,h,d),g=this._edgeObjs[f];return g&&(u=g.v,h=g.w,delete this._edgeLabels[f],delete this._edgeObjs[f],s(this._preds[h],u),s(this._sucs[u],h),delete this._in[h][f],delete this._out[u][f],this._edgeCount--),this},i.prototype.inEdges=function(u,h){var d=this._in[u];if(d){var f=r.values(d);return h?r.filter(f,function(g){return g.v===h}):f}},i.prototype.outEdges=function(u,h){var d=this._out[u];if(d){var f=r.values(d);return h?r.filter(f,function(g){return g.w===h}):f}},i.prototype.nodeEdges=function(u,h){var d=this.inEdges(u,h);if(d)return d.concat(this.outEdges(u,h))};function a(u,h){u[h]?u[h]++:u[h]=1}function s(u,h){--u[h]||delete u[h]}function o(u,h,d,f){var g=""+h,v=""+d;if(!u&&g>v){var p=g;g=v,v=p}return g+n+v+n+(r.isUndefined(f)?t:f)}function l(u,h,d,f){var g=""+h,v=""+d;if(!u&&g>v){var p=g;g=v,v=p}var m={v:g,w:v};return f&&(m.name=f),m}function c(u,h){return o(u,h.v,h.w,h.name)}return Bv}var zv,d_;function YW(){return d_||(d_=1,zv="2.1.8"),zv}var $v,f_;function XW(){return f_||(f_=1,$v={Graph:Y1(),version:YW()}),$v}var jv,g_;function KW(){if(g_)return jv;g_=1;var r=Zn(),t=Y1();jv={write:e,read:a};function e(s){var o={options:{directed:s.isDirected(),multigraph:s.isMultigraph(),compound:s.isCompound()},nodes:n(s),edges:i(s)};return r.isUndefined(s.graph())||(o.value=r.clone(s.graph())),o}function n(s){return r.map(s.nodes(),function(o){var l=s.node(o),c=s.parent(o),u={v:o};return r.isUndefined(l)||(u.value=l),r.isUndefined(c)||(u.parent=c),u})}function i(s){return r.map(s.edges(),function(o){var l=s.edge(o),c={v:o.v,w:o.w};return r.isUndefined(o.name)||(c.name=o.name),r.isUndefined(l)||(c.value=l),c})}function a(s){var o=new t(s.options).setGraph(s.value);return r.each(s.nodes,function(l){o.setNode(l.v,l.value),l.parent&&o.setParent(l.v,l.parent)}),r.each(s.edges,function(l){o.setEdge({v:l.v,w:l.w,name:l.name},l.value)}),o}return jv}var qv,v_;function ZW(){if(v_)return qv;v_=1;var r=Zn();qv=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 qv}var Gv,p_;function yA(){if(p_)return Gv;p_=1;var r=Zn();Gv=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>1,!(n[a].priority0&&(h=u.removeMin(),d=c[h],d.distance!==Number.POSITIVE_INFINITY);)l(h).forEach(f);return c}return Wv}var Vv,y_;function JW(){if(y_)return Vv;y_=1;var r=bA(),t=Zn();Vv=e;function e(n,i,a){return t.transform(n.nodes(),function(s,o){s[o]=r(n,o,i,a)},{})}return Vv}var Hv,b_;function wA(){if(b_)return Hv;b_=1;var r=Zn();Hv=t;function t(e){var n=0,i=[],a={},s=[];function o(l){var c=a[l]={onStack:!0,lowlink:n,index:n++};if(i.push(l),e.successors(l).forEach(function(d){r.has(a,d)?a[d].onStack&&(c.lowlink=Math.min(c.lowlink,a[d].index)):(o(d),c.lowlink=Math.min(c.lowlink,a[d].lowlink))}),c.lowlink===c.index){var u=[],h;do h=i.pop(),a[h].onStack=!1,u.push(h);while(l!==h);s.push(u)}}return e.nodes().forEach(function(l){r.has(a,l)||o(l)}),s}return Hv}var Uv,w_;function QW(){if(w_)return Uv;w_=1;var r=Zn(),t=wA();Uv=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 Uv}var Yv,x_;function tV(){if(x_)return Yv;x_=1;var r=Zn();Yv=e;var t=r.constant(1);function e(i,a,s){return n(i,a||t,s||function(o){return i.outEdges(o)})}function n(i,a,s){var o={},l=i.nodes();return l.forEach(function(c){o[c]={},o[c][c]={distance:0},l.forEach(function(u){c!==u&&(o[c][u]={distance:Number.POSITIVE_INFINITY})}),s(c).forEach(function(u){var h=u.v===c?u.w:u.v,d=a(u);o[c][h]={distance:d,predecessor:c}})}),l.forEach(function(c){var u=o[c];l.forEach(function(h){var d=o[h];l.forEach(function(f){var g=d[c],v=u[f],p=d[f],m=g.distance+v.distance;m0;){if(c=l.removeMin(),r.has(o,c))s.setEdge(c,o[c]);else{if(h)throw new Error("Input graph is not connected: "+i);h=!0}i.nodeEdges(c).forEach(u)}return s}return tp}var ep,T_;function aV(){return T_||(T_=1,ep={components:ZW(),dijkstra:bA(),dijkstraAll:JW(),findCycles:QW(),floydWarshall:tV(),isAcyclic:eV(),postorder:nV(),preorder:rV(),prim:iV(),tarjan:wA(),topsort:xA()}),ep}var np,O_;function sV(){if(O_)return np;O_=1;var r=XW();return np={Graph:r.Graph,json:KW(),alg:aV(),version:r.version},np}var pu;if(typeof Fy=="function")try{pu=sV()}catch{}pu||(pu=window.graphlib);var dr=pu,rp,A_;function oV(){if(A_)return rp;A_=1;var r=UO(),t=1,e=4;function n(i){return r(i,t|e)}return rp=n,rp}var ip,P_;function Ah(){if(P_)return ip;P_=1;var r=Fs(),t=ui(),e=xh(),n=Kn();function i(a,s,o){if(!n(o))return!1;var l=typeof s;return(l=="number"?t(o)&&e(s,o.length):l=="string"&&s in o)?r(o[s],a):!1}return ip=i,ip}var ap,N_;function lV(){if(N_)return ap;N_=1;var r=Oh(),t=Fs(),e=Ah(),n=Xa(),i=Object.prototype,a=i.hasOwnProperty,s=r(function(o,l){o=Object(o);var c=-1,u=l.length,h=u>2?l[2]:void 0;for(h&&e(l[0],l[1],h)&&(u=1);++c-1?l[c?a[u]:u]:void 0}}return sp=n,sp}var op,L_;function uV(){if(L_)return op;L_=1;var r=/\s/;function t(e){for(var n=e.length;n--&&r.test(e.charAt(n)););return n}return op=t,op}var lp,D_;function hV(){if(D_)return lp;D_=1;var r=uV(),t=/^\s+/;function e(n){return n&&n.slice(0,r(n)+1).replace(t,"")}return lp=e,lp}var cp,I_;function dV(){if(I_)return cp;I_=1;var r=hV(),t=Kn(),e=js(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;function l(c){if(typeof c=="number")return c;if(e(c))return n;if(t(c)){var u=typeof c.valueOf=="function"?c.valueOf():c;c=t(u)?u+"":u}if(typeof c!="string")return c===0?c:+c;c=r(c);var h=a.test(c);return h||s.test(c)?o(c.slice(2),h?2:8):i.test(c)?n:+c}return cp=l,cp}var up,F_;function SA(){if(F_)return up;F_=1;var r=dV(),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 up=n,up}var hp,B_;function fV(){if(B_)return hp;B_=1;var r=SA();function t(e){var n=r(e),i=n%1;return n===n?i?n-i:n:0}return hp=t,hp}var dp,z_;function gV(){if(z_)return dp;z_=1;var r=vA(),t=hi(),e=fV(),n=Math.max;function i(a,s,o){var l=a==null?0:a.length;if(!l)return-1;var c=o==null?0:e(o);return c<0&&(c=n(l+c,0)),r(a,t(s,3),c)}return dp=i,dp}var fp,$_;function vV(){if($_)return fp;$_=1;var r=cV(),t=gV(),e=r(t);return fp=e,fp}var gp,j_;function _A(){if(j_)return gp;j_=1;var r=U1();function t(e){var n=e==null?0:e.length;return n?r(e,1):[]}return gp=t,gp}var vp,q_;function pV(){if(q_)return vp;q_=1;var r=G1(),t=YO(),e=Xa();function n(i,a){return i==null?i:r(i,t(a),e)}return vp=n,vp}var pp,G_;function mV(){if(G_)return pp;G_=1;function r(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}return pp=r,pp}var mp,W_;function yV(){if(W_)return mp;W_=1;var r=bh(),t=W1(),e=hi();function n(i,a){var s={};return a=e(a,3),t(i,function(o,l,c){r(s,l,a(o,l,c))}),s}return mp=n,mp}var yp,V_;function X1(){if(V_)return yp;V_=1;var r=js();function t(e,n,i){for(var a=-1,s=e.length;++ae}return bp=r,bp}var wp,U_;function wV(){if(U_)return wp;U_=1;var r=X1(),t=bV(),e=Ka();function n(i){return i&&i.length?r(i,e,t):void 0}return wp=n,wp}var xp,Y_;function kA(){if(Y_)return xp;Y_=1;var r=bh(),t=Fs();function e(n,i,a){(a!==void 0&&!t(n[i],a)||a===void 0&&!(i in n))&&r(n,i,a)}return xp=e,xp}var Ep,X_;function xV(){if(X_)return Ep;X_=1;var r=Ua(),t=_h(),e=Lr(),n="[object Object]",i=Function.prototype,a=Object.prototype,s=i.toString,o=a.hasOwnProperty,l=s.call(Object);function c(u){if(!e(u)||r(u)!=n)return!1;var h=t(u);if(h===null)return!0;var d=o.call(h,"constructor")&&h.constructor;return typeof d=="function"&&d instanceof d&&s.call(d)==l}return Ep=c,Ep}var Sp,K_;function MA(){if(K_)return Sp;K_=1;function r(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}return Sp=r,Sp}var _p,Z_;function EV(){if(Z_)return _p;Z_=1;var r=ll(),t=Xa();function e(n){return r(n,t(n))}return _p=e,_p}var kp,J_;function SV(){if(J_)return kp;J_=1;var r=kA(),t=DO(),e=WO(),n=IO(),i=HO(),a=cl(),s=Me(),o=pA(),l=zs(),c=ol(),u=Kn(),h=xV(),d=ul(),f=MA(),g=EV();function v(p,m,y,b,w,x,S){var E=f(p,y),_=f(m,y),C=S.get(_);if(C){r(p,y,C);return}var k=x?x(E,_,y+"",p,m,S):void 0,M=k===void 0;if(M){var T=s(_),O=!T&&l(_),R=!T&&!O&&d(_);k=_,T||O||R?s(E)?k=E:o(E)?k=n(E):O?(M=!1,k=t(_,!0)):R?(M=!1,k=e(_,!0)):k=[]:h(_)||a(_)?(k=E,a(E)?k=g(E):(!u(E)||c(E))&&(k=i(_))):M=!1}M&&(S.set(_,k),w(k,_,b,x,S),S.delete(_)),r(p,y,k)}return kp=v,kp}var Mp,Q_;function _V(){if(Q_)return Mp;Q_=1;var r=yh(),t=kA(),e=G1(),n=SV(),i=Kn(),a=Xa(),s=MA();function o(l,c,u,h,d){l!==c&&e(c,function(f,g){if(d||(d=new r),i(f))n(l,c,g,u,o,h,d);else{var v=h?h(s(l,g),f,g+"",l,c,d):void 0;v===void 0&&(v=f),t(l,g,v)}},a)}return Mp=o,Mp}var Cp,t3;function kV(){if(t3)return Cp;t3=1;var r=Oh(),t=Ah();function e(n){return r(function(i,a){var s=-1,o=a.length,l=o>1?a[o-1]:void 0,c=o>2?a[2]:void 0;for(l=n.length>3&&typeof l=="function"?(o--,l):void 0,c&&t(a[0],a[1],c)&&(l=o<3?void 0:l,o=1),i=Object(i);++sn||o&&l&&u&&!c&&!h||a&&l&&u||!i&&u||!s)return 1;if(!a&&!o&&!h&&e=c)return u;var h=i[a];return u*(h=="desc"?-1:1)}}return e.index-n.index}return Gp=t,Gp}var Wp,m3;function jV(){if(m3)return Wp;m3=1;var r=Mh(),t=Th(),e=hi(),n=uA(),i=BV(),a=Eh(),s=$V(),o=Ka(),l=Me();function c(u,h,d){h.length?h=r(h,function(v){return l(v)?function(p){return t(p,v.length===1?v[0]:v)}:v}):h=[o];var f=-1;h=r(h,a(e));var g=n(u,function(v,p,m){var y=r(h,function(b){return b(v)});return{criteria:y,index:++f,value:v}});return i(g,function(v,p){return s(v,p,d)})}return Wp=c,Wp}var Vp,y3;function qV(){if(y3)return Vp;y3=1;var r=U1(),t=jV(),e=Oh(),n=Ah(),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 Vp=i,Vp}var Hp,b3;function GV(){if(b3)return Hp;b3=1;var r=rA(),t=0;function e(n){var i=++t;return r(n)+i}return Hp=e,Hp}var Up,w3;function WV(){if(w3)return Up;w3=1;function r(t,e,n){for(var i=-1,a=t.length,s=e.length,o={};++i0;--o)if(s=t[o].dequeue(),s){n=n.concat(Xp(r,t,e,s,!0));break}}}return n}function Xp(r,t,e,n,i){var a=i?[]:void 0;return Kr.forEach(r.inEdges(n.v),function(s){var o=r.edge(s),l=r.node(s.v);i&&a.push({v:s.v,w:s.w}),l.out-=o,py(t,e,l)}),Kr.forEach(r.outEdges(n.v),function(s){var o=r.edge(s),l=s.w,c=r.node(l);c.in-=o,py(t,e,c)}),r.removeNode(n.v),a}function tH(r,t){var e=new YV,n=0,i=0;Kr.forEach(r.nodes(),function(o){e.setNode(o,{v:o,in:0,out:0})}),Kr.forEach(r.edges(),function(o){var l=e.edge(o.v,o.w)||0,c=t(o),u=l+c;e.setEdge(o.v,o.w,u),i=Math.max(i,e.node(o.v).out+=c),n=Math.max(n,e.node(o.w).in+=c)});var a=Kr.range(i+n+3).map(function(){return new XV}),s=n+1;return Kr.forEach(e.nodes(),function(o){py(a,s,e.node(o))}),{graph:e,buckets:a,zeroIdx:s}}function py(r,t,e){e.out?e.in?r[e.out-e.in+t].enqueue(e):r[r.length-1].enqueue(e):r[0].enqueue(e)}var Sa=ae,eH=KV,nH={run:rH,undo:aH};function rH(r){var t=r.graph().acyclicer==="greedy"?eH(r,e(r)):iH(r);Sa.forEach(t,function(n){var i=r.edge(n);r.removeEdge(n),i.forwardName=n.name,i.reversed=!0,r.setEdge(n.w,n.v,i,Sa.uniqueId("rev"))});function e(n){return function(i){return n.edge(i).weight}}}function iH(r){var t=[],e={},n={};function i(a){Sa.has(n,a)||(n[a]=!0,e[a]=!0,Sa.forEach(r.outEdges(a),function(s){Sa.has(e,s.w)?t.push(s):i(s.w)}),delete e[a])}return Sa.forEach(r.nodes(),i),t}function aH(r){Sa.forEach(r.edges(),function(t){var e=r.edge(t);if(e.reversed){r.removeEdge(t);var n=e.forwardName;delete e.reversed,delete e.forwardName,r.setEdge(t.w,t.v,e,n)}})}var Dt=ae,OA=dr.Graph,wn={addDummyNode:AA,simplify:sH,asNonCompoundGraph:oH,successorWeights:lH,predecessorWeights:cH,intersectRect:uH,buildLayerMatrix:hH,normalizeRanks:dH,removeEmptyRanks:fH,addBorderNode:gH,maxRank:PA,partition:vH,time:pH,notime:mH};function AA(r,t,e,n){var i;do i=Dt.uniqueId(n);while(r.hasNode(i));return e.dummy=t,r.setNode(i,e),i}function sH(r){var t=new OA().setGraph(r.graph());return Dt.forEach(r.nodes(),function(e){t.setNode(e,r.node(e))}),Dt.forEach(r.edges(),function(e){var n=t.edge(e.v,e.w)||{weight:0,minlen:1},i=r.edge(e);t.setEdge(e.v,e.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),t}function oH(r){var t=new OA({multigraph:r.isMultigraph()}).setGraph(r.graph());return Dt.forEach(r.nodes(),function(e){r.children(e).length||t.setNode(e,r.node(e))}),Dt.forEach(r.edges(),function(e){t.setEdge(e,r.edge(e))}),t}function lH(r){var t=Dt.map(r.nodes(),function(e){var n={};return Dt.forEach(r.outEdges(e),function(i){n[i.w]=(n[i.w]||0)+r.edge(i).weight}),n});return Dt.zipObject(r.nodes(),t)}function cH(r){var t=Dt.map(r.nodes(),function(e){var n={};return Dt.forEach(r.inEdges(e),function(i){n[i.v]=(n[i.v]||0)+r.edge(i).weight}),n});return Dt.zipObject(r.nodes(),t)}function uH(r,t){var e=r.x,n=r.y,i=t.x-e,a=t.y-n,s=r.width/2,o=r.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");var l,c;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,c=o):(i<0&&(s=-s),l=s,c=s*a/i),{x:e+l,y:n+c}}function hH(r){var t=Dt.map(Dt.range(PA(r)+1),function(){return[]});return Dt.forEach(r.nodes(),function(e){var n=r.node(e),i=n.rank;Dt.isUndefined(i)||(t[i][n.order]=e)}),t}function dH(r){var t=Dt.min(Dt.map(r.nodes(),function(e){return r.node(e).rank}));Dt.forEach(r.nodes(),function(e){var n=r.node(e);Dt.has(n,"rank")&&(n.rank-=t)})}function fH(r){var t=Dt.min(Dt.map(r.nodes(),function(a){return r.node(a).rank})),e=[];Dt.forEach(r.nodes(),function(a){var s=r.node(a).rank-t;e[s]||(e[s]=[]),e[s].push(a)});var n=0,i=r.graph().nodeRankFactor;Dt.forEach(e,function(a,s){Dt.isUndefined(a)&&s%i!==0?--n:n&&Dt.forEach(a,function(o){r.node(o).rank+=n})})}function gH(r,t,e,n){var i={width:0,height:0};return arguments.length>=4&&(i.rank=e,i.order=n),AA(r,"border",i,t)}function PA(r){return Dt.max(Dt.map(r.nodes(),function(t){var e=r.node(t).rank;if(!Dt.isUndefined(e))return e}))}function vH(r,t){var e={lhs:[],rhs:[]};return Dt.forEach(r,function(n){t(n)?e.lhs.push(n):e.rhs.push(n)}),e}function pH(r,t){var e=Dt.now();try{return t()}finally{console.log(r+" time: "+(Dt.now()-e)+"ms")}}function mH(r,t){return t()}var NA=ae,yH=wn,bH={run:wH,undo:EH};function wH(r){r.graph().dummyChains=[],NA.forEach(r.edges(),function(t){xH(r,t)})}function xH(r,t){var e=t.v,n=r.node(e).rank,i=t.w,a=r.node(i).rank,s=t.name,o=r.edge(t),l=o.labelRank;if(a!==n+1){r.removeEdge(t);var c,u,h;for(h=0,++n;ns.lim&&(o=s,l=!0);var c=ai.filter(t.edges(),function(u){return l===E3(r,r.node(u.v),o)&&l!==E3(r,r.node(u.w),o)});return ai.minBy(c,function(u){return PH(t,u)})}function BA(r,t,e,n){var i=e.v,a=e.w;r.removeEdge(i,a),r.setEdge(n.v,n.w,{}),Z1(r),K1(r,t),BH(r,t)}function BH(r,t){var e=ai.find(r.nodes(),function(i){return!t.node(i).parent}),n=RH(r,e);n=n.slice(1),ai.forEach(n,function(i){var a=r.node(i).parent,s=t.edge(i,a),o=!1;s||(s=t.edge(a,i),o=!0),t.node(i).rank=t.node(a).rank+(o?s.minlen:-s.minlen)})}function zH(r,t,e){return r.hasEdge(t,e)}function E3(r,t,e){return e.low<=t.lim&&t.lim<=e.lim}var $H=Nh,zA=$H.longestPath,jH=RA,qH=IH,GH=WH;function WH(r){switch(r.graph().ranker){case"network-simplex":S3(r);break;case"tight-tree":HH(r);break;case"longest-path":VH(r);break;default:S3(r)}}var VH=zA;function HH(r){zA(r),jH(r)}function S3(r){qH(r)}var my=ae,UH=YH;function YH(r){var t=KH(r);my.forEach(r.graph().dummyChains,function(e){for(var n=r.node(e),i=n.edgeObj,a=XH(r,t,i.v,i.w),s=a.path,o=a.lca,l=0,c=s[l],u=!0;e!==i.w;){if(n=r.node(e),u){for(;(c=s[l])!==o&&r.node(c).maxRanks||o>t[l].lim));for(c=l,l=n;(l=r.parent(l))!==c;)a.push(l);return{path:i.concat(a.reverse()),lca:c}}function KH(r){var t={},e=0;function n(i){var a=e;my.forEach(r.children(i),n),t[i]={low:a,lim:e++}}return my.forEach(r.children(),n),t}var Zr=ae,yy=wn,ZH={run:JH,cleanup:eU};function JH(r){var t=yy.addDummyNode(r,"root",{},"_root"),e=QH(r),n=Zr.max(Zr.values(e))-1,i=2*n+1;r.graph().nestingRoot=t,Zr.forEach(r.edges(),function(s){r.edge(s).minlen*=i});var a=tU(r)+1;Zr.forEach(r.children(),function(s){$A(r,t,i,a,n,e,s)}),r.graph().nodeRankFactor=i}function $A(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=yy.addBorderNode(r,"_bt"),c=yy.addBorderNode(r,"_bb"),u=r.node(s);r.setParent(l,s),u.borderTop=l,r.setParent(c,s),u.borderBottom=c,Zr.forEach(o,function(h){$A(r,t,e,n,i,a,h);var d=r.node(h),f=d.borderTop?d.borderTop:h,g=d.borderBottom?d.borderBottom:h,v=d.borderTop?n:2*n,p=f!==g?1:i-a[s]+1;r.setEdge(l,f,{weight:v,minlen:p,nestingEdge:!0}),r.setEdge(g,c,{weight:v,minlen:p,nestingEdge:!0})}),r.parent(s)||r.setEdge(t,l,{weight:0,minlen:i+a[s]})}function QH(r){var t={};function e(n,i){var a=r.children(n);a&&a.length&&Zr.forEach(a,function(s){e(s,i+1)}),t[n]=i}return Zr.forEach(r.children(),function(n){e(n,1)}),t}function tU(r){return Zr.reduce(r.edges(),function(t,e){return t+r.edge(e).weight},0)}function eU(r){var t=r.graph();r.removeNode(t.nestingRoot),delete t.nestingRoot,Zr.forEach(r.edges(),function(e){var n=r.edge(e);n.nestingEdge&&r.removeEdge(e)})}var Kp=ae,nU=wn,rU=iU;function iU(r){function t(e){var n=r.children(e),i=r.node(e);if(n.length&&Kp.forEach(n,t),Kp.has(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,s=i.maxRank+1;a0;)u%2&&(h+=o[u+1]),u=u-1>>1,o[u]+=c.weight;l+=c.weight*h})),l}var M3=ae,vU=pU;function pU(r,t){return M3.map(t,function(e){var n=r.inEdges(e);if(n.length){var i=M3.reduce(n,function(a,s){var o=r.edge(s),l=r.node(s.v);return{sum:a.sum+o.weight*l.order,weight:a.weight+o.weight}},{sum:0,weight:0});return{v:e,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:e}})}var kn=ae,mU=yU;function yU(r,t){var e={};kn.forEach(r,function(i,a){var s=e[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};kn.isUndefined(i.barycenter)||(s.barycenter=i.barycenter,s.weight=i.weight)}),kn.forEach(t.edges(),function(i){var a=e[i.v],s=e[i.w];!kn.isUndefined(a)&&!kn.isUndefined(s)&&(s.indegree++,a.out.push(e[i.w]))});var n=kn.filter(e,function(i){return!i.indegree});return bU(n)}function bU(r){var t=[];function e(a){return function(s){s.merged||(kn.isUndefined(s.barycenter)||kn.isUndefined(a.barycenter)||s.barycenter>=a.barycenter)&&wU(a,s)}}function n(a){return function(s){s.in.push(a),--s.indegree===0&&r.push(s)}}for(;r.length;){var i=r.pop();t.push(i),kn.forEach(i.in.reverse(),e(i)),kn.forEach(i.out,n(i))}return kn.map(kn.filter(t,function(a){return!a.merged}),function(a){return kn.pick(a,["vs","i","barycenter","weight"])})}function wU(r,t){var e=0,n=0;r.weight&&(e+=r.barycenter*r.weight,n+=r.weight),t.weight&&(e+=t.barycenter*t.weight,n+=t.weight),r.vs=t.vs.concat(r.vs),r.barycenter=e/n,r.weight=n,r.i=Math.min(t.i,r.i),t.merged=!0}var uo=ae,xU=wn,EU=SU;function SU(r,t){var e=xU.partition(r,function(u){return uo.has(u,"barycenter")}),n=e.lhs,i=uo.sortBy(e.rhs,function(u){return-u.i}),a=[],s=0,o=0,l=0;n.sort(_U(!!t)),l=C3(a,i,l),uo.forEach(n,function(u){l+=u.vs.length,a.push(u.vs),s+=u.barycenter*u.weight,o+=u.weight,l=C3(a,i,l)});var c={vs:uo.flatten(a,!0)};return o&&(c.barycenter=s/o,c.weight=o),c}function C3(r,t,e){for(var n;t.length&&(n=uo.last(t)).i<=e;)t.pop(),r.push(n.vs),e++;return e}function _U(r){return function(t,e){return t.barycentere.barycenter?1:r?e.i-t.i:t.i-e.i}}var Mi=ae,kU=vU,MU=mU,CU=EU,TU=qA;function qA(r,t,e,n){var i=r.children(t),a=r.node(t),s=a?a.borderLeft:void 0,o=a?a.borderRight:void 0,l={};s&&(i=Mi.filter(i,function(g){return g!==s&&g!==o}));var c=kU(r,i);Mi.forEach(c,function(g){if(r.children(g.v).length){var v=qA(r,g.v,e,n);l[g.v]=v,Mi.has(v,"barycenter")&&AU(g,v)}});var u=MU(c,e);OU(u,l);var h=CU(u,n);if(s&&(h.vs=Mi.flatten([s,h.vs,o],!0),r.predecessors(s).length)){var d=r.node(r.predecessors(s)[0]),f=r.node(r.predecessors(o)[0]);Mi.has(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+d.order+f.order)/(h.weight+2),h.weight+=2}return h}function OU(r,t){Mi.forEach(r,function(e){e.vs=Mi.flatten(e.vs.map(function(n){return t[n]?t[n].vs:n}),!0)})}function AU(r,t){Mi.isUndefined(r.barycenter)?(r.barycenter=t.barycenter,r.weight=t.weight):(r.barycenter=(r.barycenter*r.weight+t.barycenter*t.weight)/(r.weight+t.weight),r.weight+=t.weight)}var ho=ae,PU=dr.Graph,NU=RU;function RU(r,t,e){var n=LU(r),i=new PU({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(function(a){return r.node(a)});return ho.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),ho.forEach(r[e](a),function(l){var c=l.v===a?l.w:l.v,u=i.edge(c,a),h=ho.isUndefined(u)?0:u.weight;i.setEdge(c,a,{weight:r.edge(l).weight+h})}),ho.has(s,"minRank")&&i.setNode(a,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))}),i}function LU(r){for(var t;r.hasNode(t=ho.uniqueId("_root")););return t}var DU=ae,IU=FU;function FU(r,t,e){var n={},i;DU.forEach(e,function(a){for(var s=r.parent(a),o,l;s;){if(o=r.parent(s),o?(l=n[o],n[o]=s):(l=i,i=s),l&&l!==s){t.setEdge(l,s);return}s=o}})}var ji=ae,BU=uU,zU=dU,$U=TU,jU=NU,qU=IU,GU=dr.Graph,T3=wn,WU=VU;function VU(r){var t=T3.maxRank(r),e=O3(r,ji.range(1,t+1),"inEdges"),n=O3(r,ji.range(t-1,-1,-1),"outEdges"),i=BU(r);A3(r,i);for(var a=Number.POSITIVE_INFINITY,s,o=0,l=0;l<4;++o,++l){HU(o%2?e:n,o%4>=2),i=T3.buildLayerMatrix(r);var c=zU(r,i);cc)&&GA(e,d,u)})})}function i(a,s){var o=-1,l,c=0;return gt.forEach(s,function(u,h){if(r.node(u).dummy==="border"){var d=r.predecessors(u);d.length&&(l=r.node(d[0]).order,n(s,c,h,o,l),c=h,o=l)}n(s,c,s.length,l,a.length)}),s}return gt.reduce(t,i),e}function JU(r,t){if(r.node(t).dummy)return gt.find(r.predecessors(t),function(e){return r.node(e).dummy})}function GA(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 QU(r,t,e){if(t>e){var n=t;t=e,e=n}return gt.has(r[t],e)}function tY(r,t,e,n){var i={},a={},s={};return gt.forEach(t,function(o){gt.forEach(o,function(l,c){i[l]=l,a[l]=l,s[l]=c})}),gt.forEach(t,function(o){var l=-1;gt.forEach(o,function(c){var u=n(c);if(u.length){u=gt.sortBy(u,function(v){return s[v]});for(var h=(u.length-1)/2,d=Math.floor(h),f=Math.ceil(h);d<=f;++d){var g=u[d];a[c]===c&&l({}));const s=e.getAllNodes(),o=e.getAllEdges();[...s,...o].some(({id:c})=>nt(c))&&console.error("Dagre layout only support string id, it will convert number to string."),e.getAllNodes().forEach(c=>{const{id:u}=c,h=Object.assign({},c.data);if(i!==void 0){const[d,f]=sl(at(i)?i(c):i);Object.assign(h,{width:d,height:f})}a.setNode(u.toString(),h)}),e.getAllEdges().forEach(({id:c,source:u,target:h})=>{a.setEdge(u.toString(),h.toString(),{id:c})}),ZY.layout(a);const l={nodes:[],edges:[]};return a.nodes().forEach(c=>{const u=a.node(c);l.nodes.push({id:c,data:u}),t&&e.mergeNodeData(c,u)}),a.edges().forEach(c=>{const u=a.edge(c),{id:h}=u,d=fe(u,["id"]),{v:f,w:g}=c;l.edges.push({id:h,source:f,target:g,data:d}),t&&e.mergeEdgeData(h,d)}),l})}}Rh.defaultOptions={};class J1{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 J1(s)}}class ps{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 ps(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 ps(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 ps(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 ps(i)}}class ms{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 ms(this.quad.NW()),this.NE=new ms(this.quad.NE()),this.SW=new ms(this.quad.SW()),this.SE=new ms(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/nOn(m,[o,l])),g=i.filter(m=>{const{source:y,target:b}=m;return y!==b}),v=new Ne({nodes:f,edges:g}),p=this.getSizes(v,h);if(this.run(v,e,u,p,t,s),c){for(let y=0;y250&&(n.barnesHut=!0),l===void 0&&e>100&&(n.prune=!0),c===0&&!l?(n.maxIteration=250,e<=200&&e>100?n.maxIteration=1e3:e>200&&(n.maxIteration=1200)):c===0&&l&&(n.maxIteration=100,e<=200&&e>100?n.maxIteration=500:e>200&&(n.maxIteration=950)),u||(n.kr=50,e>100&&e<=500?n.kr=20:e>500&&(n.kr=1)),h||(n.kg=20,e>100&&e<=500?n.kg=10:e>500&&(n.kg=1)),n}run(t,e,n,i,a,s){const{kr:o,barnesHut:l,onTick:c}=s,u=t.getAllNodes();let h=0,d=n;const f={},g={},v={};for(let p=0;p0;)h=this.oneStep(t,{iter:d,preventOverlapIters:50,krPrime:100,sg:h,forces:f,preForces:g,bodies:v,sizes:i},s),d--,c==null||c({nodes:u,edges:e.getAllEdges()});return t}oneStep(t,e,n){const{iter:i,preventOverlapIters:a,krPrime:s,sg:o,preForces:l,bodies:c,sizes:u}=e;let{forces:h}=e;const{preventOverlap:d,barnesHut:f}=n,g=t.getAllNodes();for(let v=0;va||!d)?h=this.getOptRepGraForces(t,h,c,n):h=this.getRepGraForces(t,i,a,h,s,u,n),this.updatePos(t,h,l,o,n)}getAttrForces(t,e,n,i,a,s){const{preventOverlap:o,dissuadeHubs:l,mode:c,prune:u}=s,h=t.getAllEdges();for(let d=0;d0&&(x=w,S=w),a[f][0]+=x*b[0],a[g][0]-=S*b[0],a[f][1]+=x*b[1],a[g][1]-=S*b[1]}return a}getOptRepGraForces(t,e,n,i){const{kg:a,center:s,prune:o}=i,l=t.getAllNodes(),c=l.length;let u=9e10,h=-9e10,d=9e10,f=-9e10;for(let y=0;y=h&&(h=w.x),w.x<=u&&(u=w.x),w.y>=f&&(f=w.y),w.y<=d&&(d=w.y))}const g=Math.max(h-u,f-d),v={xmid:(h+u)/2,ymid:(f+d)/2,length:g,massCenter:s,mass:c},p=new ps(v),m=new ms(p);for(let y=0;y0&&(k=c*(m+1)*(E+1)/C),i[p.id][0]-=k*_[0],i[S.id][0]+=k*_[0],i[p.id][1]-=k*_[1],i[S.id][1]+=k*_[1]}const y=[p.data.x-h[0],p.data.y-h[1]],b=Math.hypot(y[0],y[1]);y[0]=y[0]/b,y[1]=y[1]/b;const w=u*(m+1);i[p.id][0]-=w*y[0],i[p.id][1]-=w*y[1]}return i}updatePos(t,e,n,i,a){const{ks:s,tao:o,prune:l,ksmax:c}=a,u=t.getAllNodes(),h=u.length,d=[],f=[];let g=0,v=0,p=i;for(let y=0;y1.5*m?1.5*m:p);for(let y=0;y_?_:S;const C=S*e[b][0],k=S*e[b][1];t.mergeNodeData(b,{x:w.x+C,y:w.y+k})}return p}}const tX={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},eX=800;class nX{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},tX),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericFruchtermanLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericFruchtermanLayout(!0,t,e)})}stop(){this.timeInterval&&typeof window<"u"&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let n=0;nthis.lastGraph.mergeNodeData(n.id,{x:n.data.x,y:n.data.y,z:this.options.dimensions===3?n.data.z:void 0})),e}genericFruchtermanLayout(t,e,n){return bt(this,void 0,void 0,function*(){if(this.running)return;const i=this.formatOptions(n),{dimensions:a,width:s,height:o,center:l,clustering:c,nodeClusterBy:u,maxIteration:h,onTick:d}=i,f=e.getAllNodes(),g=e.getAllEdges();if(!(f!=null&&f.length)){const b={nodes:[],edges:g};return this.lastResult=b,b}if(f.length===1){t&&e.mergeNodeData(f[0].id,{x:l[0],y:l[1],z:a===3?l[2]:void 0});const b={nodes:[Object.assign(Object.assign({},f[0]),{data:Object.assign(Object.assign({},f[0].data),{x:l[0],y:l[1],z:a===3?l[2]:void 0})})],edges:g};return this.lastResult=b,b}const v=f.map(b=>On(b,[s,o])),p=new Ne({nodes:v,edges:g}),m={};if(c&&v.forEach(b=>{const w=b.data[u];m[w]||(m[w]={name:w,cx:0,cy:0,count:0})}),this.lastLayoutNodes=v,this.lastLayoutEdges=g,this.lastAssign=t,this.lastGraph=p,this.lastOptions=i,this.lastClusterMap=m,typeof window>"u")return;let y=0;return new Promise(b=>{this.timeInterval=window.setInterval(()=>{if(!this.running){b({nodes:v,edges:g});return}this.runOneStep(p,m,i),t&&v.forEach(({id:w,data:x})=>e.mergeNodeData(w,{x:x.x,y:x.y,z:a===3?x.z:void 0})),d==null||d({nodes:v,edges:g}),y++,y>=h&&(window.clearInterval(this.timeInterval),b({nodes:v,edges:g}))},0),this.running=!0})})}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:n,nodeClusterBy:i}=e,{center:a,width:s,height:o}=e;return e.width=!s&&typeof window<"u"?window.innerWidth:s,e.height=!o&&typeof window<"u"?window.innerHeight:o,e.center=a||[e.width/2,e.height/2],e.clustering=n&&!!i,e}runOneStep(t,e,n){const{dimensions:i,height:a,width:s,gravity:o,center:l,speed:c,clustering:u,nodeClusterBy:h,clusterGravity:d}=n,f=a*s,g=Math.sqrt(f)/10,v=t.getAllNodes(),p=f/(v.length+1),m=Math.sqrt(p),y={};if(this.applyCalculate(t,y,m,p),u){for(const w in e)e[w].cx=0,e[w].cy=0,e[w].count=0;v.forEach(w=>{const{data:x}=w,S=e[x[h]];nt(x.x)&&(S.cx+=x.x),nt(x.y)&&(S.cy+=x.y),S.count++});for(const w in e)e[w].cx/=e[w].count,e[w].cy/=e[w].count;const b=d||o;v.forEach((w,x)=>{const{id:S,data:E}=w;if(!nt(E.x)||!nt(E.y))return;const _=e[E[h]],C=Math.sqrt((E.x-_.cx)*(E.x-_.cx)+(E.y-_.cy)*(E.y-_.cy)),k=m*b;y[S].x-=k*(E.x-_.cx)/C,y[S].y-=k*(E.y-_.cy)/C})}v.forEach((b,w)=>{const{id:x,data:S}=b;if(!nt(S.x)||!nt(S.y))return;const E=.01*m*o;y[x].x-=E*(S.x-l[0]),y[x].y-=E*(S.y-l[1]),i===3&&(y[x].z-=E*(S.z-l[2]))}),v.forEach((b,w)=>{const{id:x,data:S}=b;if(nt(S.fx)&&nt(S.fy)){S.x=S.fx,S.y=S.fy,i===3&&(S.z=S.fz);return}if(!nt(S.x)||!nt(S.y))return;const E=Math.sqrt(y[x].x*y[x].x+y[x].y*y[x].y+(i===3?y[x].z*y[x].z:0));if(E>0){const _=Math.min(g*(c/eX),E);t.mergeNodeData(x,{x:S.x+y[x].x/E*_,y:S.y+y[x].y/E*_,z:i===3?S.z+y[x].z/E*_:void 0})}})}applyCalculate(t,e,n,i){this.calRepulsive(t,e,i),this.calAttractive(t,e,n)}calRepulsive(t,e,n){const i=t.getAllNodes();i.forEach(({data:a,id:s},o)=>{e[s]={x:0,y:0,z:0},i.forEach(({data:l,id:c},u)=>{if(o<=u||!nt(a.x)||!nt(l.x)||!nt(a.y)||!nt(l.y))return;let h=a.x-l.x,d=a.y-l.y,f=this.options.dimensions===3?a.z-l.z:0,g=h*h+d*d+f*f;g===0&&(g=1,h=.01,d=.01,f=.01);const v=n/g,p=h*v,m=d*v,y=f*v;e[s].x+=p,e[s].y+=m,e[c].x-=p,e[c].y-=m,this.options.dimensions===3&&(e[s].z+=y,e[c].z-=y)})})}calAttractive(t,e,n){t.getAllEdges().forEach(a=>{const{source:s,target:o}=a;if(!s||!o||s===o)return;const{data:l}=t.getNode(s),{data:c}=t.getNode(o);if(!nt(c.x)||!nt(l.x)||!nt(c.y)||!nt(l.y))return;const u=c.x-l.x,h=c.y-l.y,d=this.options.dimensions===3?c.z-l.z:0,f=Math.sqrt(u*u+h*h+d*d)/n,g=u*f,v=h*f,p=d*f;e[s].x+=g,e[s].y+=v,e[o].x-=g,e[o].y-=v,this.options.dimensions===3&&(e[s].z+=p,e[o].z-=p)})}}const rX={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 iX{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},rX),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericGridLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericGridLayout(!0,t,e)})}genericGridLayout(t,e,n){return bt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{begin:a=[0,0],condense:s,preventOverlapPadding:o,preventOverlap:l,rows:c,cols:u,nodeSpacing:h,nodeSize:d,width:f,height:g,position:v}=i;let{sortBy:p}=i;const m=e.getAllNodes(),y=e.getAllEdges(),b=m==null?void 0:m.length;if(!b||b===1)return Ha(e,t,a);const w=m.map(L=>On(L));p!=="id"&&(!Tt(p)||w[0].data[p]===void 0)&&(p="degree"),p==="degree"?w.sort((L,D)=>e.getDegree(D.id,"both")-e.getDegree(L.id,"both")):p==="id"?w.sort((L,D)=>nt(D.id)&&nt(L.id)?D.id-L.id:`${L.id}`.localeCompare(`${D.id}`)):w.sort((L,D)=>D.data[p]-L.data[p]);const x=!f&&typeof window<"u"?window.innerWidth:f,S=!g&&typeof window<"u"?window.innerHeight:g,E=b,_={rows:c,cols:u};if(c!=null&&u!=null)_.rows=c,_.cols=u;else if(c!=null&&u==null)_.rows=c,_.cols=Math.ceil(E/_.rows);else if(c==null&&u!=null)_.cols=u,_.rows=Math.ceil(E/_.cols);else{const L=Math.sqrt(E*S/x);_.rows=Math.round(L),_.cols=Math.round(x/S*L)}if(_.rows=Math.max(_.rows,1),_.cols=Math.max(_.cols,1),_.cols*_.rows>E){const L=fc(_),D=gc(_);(L-1)*D>=E?fc(_,L-1):(D-1)*L>=E&&gc(_,D-1)}else for(;_.cols*_.rows=E?gc(_,D+1):fc(_,L+1)}let C=s?0:x/_.cols,k=s?0:S/_.rows;if(l||h){const L=Aa(10,h),D=M1(30,d,!1);w.forEach(P=>{(!P.data.x||!P.data.y)&&(P.data.x=0,P.data.y=0);const A=e.getNode(P.id),[I,B]=sl(D(A)||30),j=L!==void 0?L(P):o,G=I+j,H=B+j;C=Math.max(C,G),k=Math.max(k,H)})}const M={},T={row:0,col:0},O={};for(let L=0;L{e.mergeNodeData(L.id,{x:L.data.x,y:L.data.y})}),R})}}const fc=(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},gc=(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},by=(r,t)=>r[`c-${t.row}-${t.col}`]||!1,HA=(r,t)=>r[`c-${t.row}-${t.col}`]=!0,D3=(r,t)=>{const e=r.cols||5;t.col++,t.col>=e&&(t.col=0,t.row++)},aX=(r,t,e,n,i,a,s,o)=>{let l,c;const u=i[r.id];if(u)l=u.col*e+e/2+t[0],c=u.row*n+n/2+t[1];else{for(;by(o,s);)D3(a,s);l=s.col*e+e/2+t[0],c=s.row*n+n/2+t[1],HA(o,s),D3(a,s)}r.data.x=l,r.data.y=c},sX=(r,t,e)=>{try{const n=Ri.mul(Ri.pow(t,2),-.5),i=n.mean("row"),a=n.mean("column"),s=n.mean();n.add(s).subRowVector(i).subColumnVector(a);const o=new TO(n),l=Ri.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map(c=>Ri.mul([c],[l]).toJSON()[0].splice(0,r))}catch{const i=[];for(let a=0;a{const e=Object.assign(Object.assign({},lX),t),{positions:n,iterations:i,width:a,k:s,speed:o=100,strictRadial:l,focusIdx:c,radii:u=[],nodeSizeFunc:h}=e,d=r.getAllNodes(),f=[],g=a/10;for(let v=0;v{f[m]={x:0,y:0}}),uX(d,n,f,s,u,h),hX(n,f,o,l,c,g,a,u);return n},uX=(r,t,e,n,i,a)=>{t.forEach((s,o)=>{e[o]={x:0,y:0},t.forEach((l,c)=>{if(o===c||i[o]!==i[c])return;let u=s.x-l.x,h=s.y-l.y,d=Math.sqrt(u*u+h*h);if(d===0){d=1;const f=o>c?1:-1;u=.01*f,h=.01*f}if(d{const l=a||s/10;return n&&t.forEach((c,u)=>{const h=r[u].x-r[i].x,d=r[u].y-r[i].y,f=Math.sqrt(h*h+d*d);let g=d/f,v=-h/f;const p=Math.sqrt(c.x*c.x+c.y*c.y);let m=Math.acos((g*c.x+v*c.y)/p);m>Math.PI/2&&(m-=Math.PI/2,g*=-1,v*=-1);const y=Math.cos(m)*p;c.x=g*y,c.y=v*y}),r.forEach((c,u)=>{if(u===i)return;const h=Math.sqrt(t[u].x*t[u].x+t[u].y*t[u].y);if(h>0&&u!==i){const d=Math.min(l*(e/oX),h);if(c.x+=t[u].x/h*d,c.y+=t[u].y/h*d,n){let f=c.x-r[i].x,g=c.y-r[i].y;const v=Math.sqrt(f*f+g*g);f=f/v*o[u],g=g/v*o[u],c.x=r[i].x+f,c.y=r[i].y+g}}}),r},dX={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class fX{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},dX),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericRadialLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericRadialLayout(!0,t,e)})}genericRadialLayout(t,e,n){return bt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,focusNode:l,unitRadius:c,nodeSize:u,nodeSpacing:h,strictRadial:d,preventOverlap:f,maxPreventOverlapIteration:g,sortBy:v,linkDistance:p=50,sortStrength:m=10,maxIteration:y=1e3}=i,b=e.getAllNodes(),w=e.getAllEdges(),x=!a&&typeof window<"u"?window.innerWidth:a,S=!s&&typeof window<"u"?window.innerHeight:s,E=o||[x/2,S/2];if(!(b!=null&&b.length)||b.length===1)return Ha(e,t,E);let _=b[0];if(Tt(l)){for(let it=0;itE[0]?E[0]:x-E[0],L=S-E[1]>E[1]?E[1]:S-E[1];R===0&&(R=x/2),L===0&&(L=S/2);const D=Math.min(R,L),P=Math.max(...O),A=[],I=c||D/P;O.forEach((it,_t)=>{A[_t]=it*I});const B=gX(b,M,p,A,I,v,m),j=vX(B),G=sX(p,B,p);let H=G.map(([it,_t])=>({x:(isNaN(it)?Math.random()*p:it)-G[C][0],y:(isNaN(_t)?Math.random()*p:_t)-G[C][1]}));this.run(y,H,j,B,A,C);let Y;if(f){Y=C1(u,h);const it={nodes:b,nodeSizeFunc:Y,positions:H,radii:A,height:S,width:x,strictRadial:!!d,focusIdx:C,iterations:g||200,k:H.length/4.5};H=cX(e,it)}const K=[];return H.forEach((it,_t)=>{const Mt=On(b[_t]);Mt.data.x=it.x+E[0],Mt.data.y=it.y+E[1],K.push(Mt)}),t&&K.forEach(it=>e.mergeNodeData(it.id,{x:it.data.x,y:it.data.y})),{nodes:K,edges:w}})}run(t,e,n,i,a,s){for(let o=0;o<=t;o++){const l=o/t;this.oneIteration(l,e,a,i,n,s)}}oneIteration(t,e,n,i,a,s){const o=1-t;e.forEach((l,c)=>{const u=yw(l,{x:0,y:0}),h=u===0?0:1/u;if(c===s)return;let d=0,f=0,g=0;e.forEach((p,m)=>{if(c===m)return;const y=yw(l,p),b=y===0?0:1/y,w=i[m][c];g+=a[c][m],d+=a[c][m]*(p.x+w*(l.x-p.x)*b),f+=a[c][m]*(p.y+w*(l.y-p.y)*b)});const v=n[c]===0?0:1/n[c];g*=o,g+=t*v*v,d*=o,d+=t*v*l.x*h,l.x=d/g,f*=o,f+=t*v*l.y*h,l.y=f/g})}}const gX=(r,t,e,n,i,a,s)=>{if(!r)return[];const o=[];if(t){const l={};t.forEach((c,u)=>{const h=[];c.forEach((d,f)=>{var g,v;if(u===f)h.push(0);else if(n[u]===n[f])if(a==="data")h.push(d*(Math.abs(u-f)*s)/(n[u]/i));else if(a){let p,m;if(l[r[u].id])p=l[r[u].id];else{const y=(a==="id"?r[u].id:(g=r[u].data)===null||g===void 0?void 0:g[a])||0;Tt(y)?p=y.charCodeAt(0):p=y,l[r[u].id]=p}if(l[r[f].id])m=l[r[f].id];else{const y=(a==="id"?r[f].id:(v=r[f].data)===null||v===void 0?void 0:v[a])||0;Tt(y)?m=y.charCodeAt(0):m=y,l[r[f].id]=m}h.push(d*(Math.abs(p-m)*s)/(n[u]/i))}else h.push(d*e/(n[u]/i));else{const p=(e+i)/2;h.push(d*p)}}),o.push(h)})}return o},vX=r=>{const t=r.length,e=r[0].length,n=[];for(let i=0;i{let e=-1;return r.forEach((n,i)=>{n.id===t&&(e=i)}),Math.max(e,0)},mX=(r,t,e)=>{const n=r.length;for(let i=0;i{let e=0;for(let n=0;ne?r[t][n]:e);return e},bX={center:[0,0],width:300,height:300};class wX{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},bX),t)}execute(t,e){return bt(this,void 0,void 0,function*(){return this.genericRandomLayout(!1,t,e)})}assign(t,e){return bt(this,void 0,void 0,function*(){yield this.genericRandomLayout(!0,t,e)})}genericRandomLayout(t,e,n){return bt(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o}=i,l=e.getAllNodes(),c=.9,u=!s&&typeof window<"u"?window.innerWidth:s,h=!o&&typeof window<"u"?window.innerHeight:o,d=a||[u/2,h/2],f=[];return l&&l.forEach(v=>{f.push({id:v.id,data:{x:(Math.random()-.5)*c*u+d[0],y:(Math.random()-.5)*c*h+d[1]}})}),t&&f.forEach(v=>e.mergeNodeData(v.id,{x:v.data.x,y:v.data.y})),{nodes:f,edges:e.getAllEdges()}})}}/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 */const UA=Symbol("Comlink.proxy"),xX=Symbol("Comlink.endpoint"),YA=Symbol("Comlink.releaseProxy"),em=Symbol("Comlink.finalizer"),Ic=Symbol("Comlink.thrown"),XA=r=>typeof r=="object"&&r!==null||typeof r=="function",EX={canHandle:r=>XA(r)&&r[UA],serialize(r){const{port1:t,port2:e}=new MessageChannel;return ZA(r,t),[e,[e]]},deserialize(r){return r.start(),QA(r)}},SX={canHandle:r=>XA(r)&&Ic 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}},KA=new Map([["proxy",EX],["throw",SX]]);function _X(r,t){for(const e of r)if(t===e||e==="*"||e instanceof RegExp&&e.test(t))return!0;return!1}function ZA(r,t=globalThis,e=["*"]){t.addEventListener("message",function n(i){if(!i||!i.data)return;if(!_X(e,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:s,path:o}=Object.assign({path:[]},i.data),l=(i.data.argumentList||[]).map(ya);let c;try{const u=o.slice(0,-1).reduce((d,f)=>d[f],r),h=o.reduce((d,f)=>d[f],r);switch(s){case"GET":c=h;break;case"SET":u[o.slice(-1)[0]]=ya(i.data.value),c=!0;break;case"APPLY":c=h.apply(u,l);break;case"CONSTRUCT":{const d=new h(...l);c=AX(d)}break;case"ENDPOINT":{const{port1:d,port2:f}=new MessageChannel;ZA(r,f),c=OX(d,[d])}break;case"RELEASE":c=void 0;break;default:return}}catch(u){c={value:u,[Ic]:0}}Promise.resolve(c).catch(u=>({value:u,[Ic]:0})).then(u=>{const[h,d]=Eu(u);t.postMessage(Object.assign(Object.assign({},h),{id:a}),d),s==="RELEASE"&&(t.removeEventListener("message",n),JA(t),em in r&&typeof r[em]=="function"&&r[em]())}).catch(u=>{const[h,d]=Eu({value:new TypeError("Unserializable return value"),[Ic]:0});t.postMessage(Object.assign(Object.assign({},h),{id:a}),d)})}),t.start&&t.start()}function kX(r){return r.constructor.name==="MessagePort"}function JA(r){kX(r)&&r.close()}function QA(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)}}),wy(r,e,[],t)}function vc(r){if(r)throw new Error("Proxy has been released and is not useable")}function tP(r){return fs(r,new Map,{type:"RELEASE"}).then(()=>{JA(r)})}const wu=new WeakMap,xu="FinalizationRegistry"in globalThis&&new FinalizationRegistry(r=>{const t=(wu.get(r)||0)-1;wu.set(r,t),t===0&&tP(r)});function MX(r,t){const e=(wu.get(t)||0)+1;wu.set(t,e),xu&&xu.register(r,t,r)}function CX(r){xu&&xu.unregister(r)}function wy(r,t,e=[],n=function(){}){let i=!1;const a=new Proxy(n,{get(s,o){if(vc(i),o===YA)return()=>{CX(a),tP(r),t.clear(),i=!0};if(o==="then"){if(e.length===0)return{then:()=>a};const l=fs(r,t,{type:"GET",path:e.map(c=>c.toString())}).then(ya);return l.then.bind(l)}return wy(r,t,[...e,o])},set(s,o,l){vc(i);const[c,u]=Eu(l);return fs(r,t,{type:"SET",path:[...e,o].map(h=>h.toString()),value:c},u).then(ya)},apply(s,o,l){vc(i);const c=e[e.length-1];if(c===xX)return fs(r,t,{type:"ENDPOINT"}).then(ya);if(c==="bind")return wy(r,t,e.slice(0,-1));const[u,h]=I3(l);return fs(r,t,{type:"APPLY",path:e.map(d=>d.toString()),argumentList:u},h).then(ya)},construct(s,o){vc(i);const[l,c]=I3(o);return fs(r,t,{type:"CONSTRUCT",path:e.map(u=>u.toString()),argumentList:l},c).then(ya)}});return MX(a,r),a}function TX(r){return Array.prototype.concat.apply([],r)}function I3(r){const t=r.map(Eu);return[t.map(e=>e[0]),TX(t.map(e=>e[1]))]}const eP=new WeakMap;function OX(r,t){return eP.set(r,t),r}function AX(r){return Object.assign(r,{[UA]:!0})}function Eu(r){for(const[t,e]of KA)if(e.canHandle(r)){const[n,i]=e.serialize(r);return[{type:"HANDLER",name:t,value:n},i]}return[{type:"RAW",value:r},eP.get(r)||[]]}function ya(r){switch(r.type){case"HANDLER":return KA.get(r.name).deserialize(r.value);case"RAW":return r.value}}function fs(r,t,e,n){return new Promise(i=>{const a=PX();t.set(a,i),r.start&&r.start(),r.postMessage(Object.assign({id:a},e),n)})}function PX(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class NX extends eh{constructor(t,e,n){super(),this.graph=t,this.layout=e,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=QA(new Worker(new URL("/assets/worker-oDIEKZfz.js",import.meta.url),{type:"module"})),this.running&&(this.running=!1,this.execute())}execute(){var t;return bt(this,void 0,void 0,function*(){if(this.running)return this;this.running=!0;const e=this.layout.options,{onTick:n}=e,i=fe(e,["onTick"]),a={};Object.keys(i).forEach(c=>{at(i[c])||(a[c]=i[c])});const s={layout:{id:this.layout.id,options:a,iterations:(t=this.options)===null||t===void 0?void 0:t.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},o=new Float32Array([0]),[l]=yield this.proxy.calculateLayout(s,[o]);return l})}stop(){return this.running=!1,this.proxy.stopLayout(),this}kill(){this.proxy[YA]()}isRunning(){return this.running}}var RX=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class Lh extends nh{constructor(){super(...arguments),this.id="fishbone"}getRoot(){const t=this.context.model.getRootsData();if(!(wr(t)||t.length>2))return t[0]}formatSize(t){const e=typeof t=="function"?t:()=>t;return n=>Nn(e(n))}doLayout(t,e){const{hGap:n,getRibSep:i,vGap:a,nodeSize:s,height:o}=e,{model:l}=this.context,c=this.formatSize(s);let u=c(t)[0]+i(t);const h=(b,w=0)=>{var x;return w+=n*((b.children||[]).length+1),(x=b.children)===null||x===void 0||x.forEach(S=>{var E;(E=l.getNodeLikeDatum(S).children)===null||E===void 0||E.forEach(C=>{const k=l.getNodeLikeDatum(C);w=h(k,w)})}),w},d=b=>{if(b.depth===1)return u;const w=l.getParentData(b.id,"tree");if(is(b)){const x=l.getParentData(w.id,"tree"),S=v(b)-v(x);return d(w)+S*n/a}else{const x=(w.children||[]).indexOf(b.id),S=l.getNodeData((w.children||[]).slice(x));return f(w)-S.reduce((E,_)=>E+h(_),0)-c(w)[0]/2}},f=km(b=>{if(nm(b))return c(b)[0]/2;const w=l.getParentData(b.id,"tree");if(is(b))return d(b)+h(b)+c(b)[0]/2;{const x=v(b)-v(w),S=n/a;return d(b)+x*S}},b=>b.id),g=b=>v(l.getParentData(b,"tree")),v=km(b=>{if(nm(b))return o/2;if(is(b)){const w=l.getParentData(b.id,"tree"),x=w.children.indexOf(b.id);if(x===0)return g(w.id)+a;const S=l.getNodeLikeDatum(w.children[x-1]);if(wr(S.children))return v(S)+a;const E=l.getDescendantsData(S.id);return Math.max(...E.map(_=>is(_)?g(_.id):v(_)))+a}else{if(wr(b.children))return g(b.id)+a;const w=l.getNodeLikeDatum(b.children.slice(-1)[0]);if(wr(w.children))return v(w)+a;const x=l.getDescendantsData(b.id).slice(-1)[0];return(is(x)?g(x.id):v(x))+a}},b=>b.id);let p=0;const m={nodes:[],edges:[]},y=b=>{var w;(w=b.children)===null||w===void 0||w.forEach(C=>y(l.getNodeLikeDatum(C)));const x=v(b),S=f(b);if(m.nodes.push({id:b.id,x:S,y:x}),nm(b))return;const E=l.getRelatedEdgesData(b.id,"in")[0],_=[d(b),is(b)?x:g(b.id)];m.edges.push({id:F(E),controlPoints:[_],relatedNodeId:b.id}),p=Math.max(p,S+i(b)),b.depth===1&&(u=p)};return y(t),m}placeAlterative(t,e){const n=(e.children||[]).filter((o,l)=>l%2!==0);if(n.length===0)return t;const{model:i}=this.context,a=t.nodes.find(o=>o.id===e.id).y,s=o=>{const l=i.getAncestorsData(o,"tree");if(wr(l))return!1;const c=l.length===1?o:l[l.length-2].id;return n.includes(c)};t.nodes.forEach(o=>{s(o.id)&&(o.y=2*a-o.y)}),t.edges.forEach(o=>{s(o.relatedNodeId)&&(o.controlPoints=o.controlPoints.map(l=>[l[0],2*a-l[1]]))})}rightToLeft(t,e){return t.nodes.forEach(n=>n.x=e.width-n.x),t.edges.forEach(n=>{n.controlPoints=n.controlPoints.map(i=>[e.width-i[0],i[1]])}),t}execute(t,e){return RX(this,void 0,void 0,function*(){const n=Object.assign(Object.assign(Object.assign({},Lh.defaultOptions),this.options),e),{direction:i,nodeSize:a}=n,s=this.getRoot();if(!s)return t;const o=this.formatSize(a);n.vGap||(n.vGap=Math.max(...(t.nodes||[]).map(d=>o(d)[1]))),n.hGap||(n.hGap=Math.max(...(t.nodes||[]).map(d=>o(d)[0])));let l=this.doLayout(s,n);this.placeAlterative(l,s),i==="RL"&&(l=this.rightToLeft(l,n));const{model:c}=this.context,u=[],h=[];return l.nodes.forEach(d=>{const{id:f,x:g,y:v}=d,p=c.getNodeLikeDatum(f);u.push(F3(p,{x:g,y:v}))}),l.edges.forEach(d=>{const{id:f,controlPoints:g}=d,v=c.getEdgeDatum(f);h.push(F3(v,{controlPoints:g}))}),{nodes:u,edges:h}})}}Lh.defaultOptions={direction:"RL",getRibSep:()=>60};const F3=(r,t)=>Object.assign(Object.assign({},r),{style:Object.assign(Object.assign({},r.style||{}),t)}),nm=r=>r.depth===0,is=r=>(r.depth||(r.depth=0))%2===0;var LX=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class Dh extends nh{constructor(){super(...arguments),this.id="snake"}formatSize(t,e){const n=typeof e=="function"?e:()=>e;return t.reduce((i,a)=>{const[s,o]=Nn(n(a))||[0,0];return[Math.max(i[0],s),Math.max(i[1],o)]},[0,0])}validate(t){const{nodes:e=[],edges:n=[]}=t,i={},a={},s={};e.forEach(d=>{i[d.id]=0,a[d.id]=0,s[d.id]=[]}),n.forEach(d=>{i[d.target]++,a[d.source]++,s[d.source].push(d.target)});const o=new Set,l=d=>{o.has(d)||(o.add(d),s[d].forEach(l))};if(l(e[0].id),o.size!==e.length)return!1;const c=e.filter(d=>i[d.id]===0),u=e.filter(d=>a[d.id]===0);return!(c.length!==1||u.length!==1||e.filter(d=>i[d.id]===1&&a[d.id]===1).length!==e.length-2)}execute(t,e){return LX(this,void 0,void 0,function*(){var n;if(!this.validate(t))return t;const{nodeSize:i,padding:a,sortBy:s,cols:o,colGap:l,rowGap:c,clockwise:u,width:h,height:d}=Object.assign({},Dh.defaultOptions,this.options,e),[f,g,v,p]=Pr(a),m=this.formatSize(t.nodes||[],i),y=Math.ceil((t.nodes||[]).length/o);let b=l||(h-p-g-o*m[0])/(o-1),w=c||(d-f-v-y*m[1])/(y-1);return(w===1/0||w<0)&&(w=0),(b===1/0||b<0)&&(b=0),{nodes:((s?(n=t.nodes)===null||n===void 0?void 0:n.sort(s):DX(t))||[]).map((E,_)=>{const C=Math.floor(_/o),k=_%o,M=u?C%2===0?k:o-1-k:C%2===0?o-1-k:k,T=p+M*(m[0]+b)+m[0]/2,O=f+C*(m[1]+w)+m[1]/2;return{id:E.id,style:{x:T,y:O}}})}})}}Dh.defaultOptions={padding:0,cols:5,clockwise:!0};function DX(r){const{nodes:t=[],edges:e=[]}=r,n={},i={};t.forEach(o=>{n[o.id]=0,i[o.id]=[]}),e.forEach(o=>{n[o.target]++,i[o.source].push(o.target)});const a=[],s=[];for(t.forEach(o=>{n[o.id]===0&&a.push(o.id)});a.length>0;){const o=a.shift(),l=t.find(c=>c.id===o);s.push(l),i[o].forEach(c=>{n[c]--,n[c]===0&&a.push(c)})}return s}const IX=["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)"],FX=["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)"],BX=["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)"],zX=["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)"],$X=["rgb(247, 251, 255)","rgb(222, 235, 247)","rgb(198, 219, 239)","rgb(158, 202, 225)","rgb(107, 174, 214)","rgb(66, 146, 198)","rgb(33, 113, 181)","rgb(8, 81, 156)","rgb(8, 48, 107)"];class Ue extends u1{}function qs(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 xy(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 jX=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class Ih extends Ue{constructor(t,e){super(t,Object.assign({},Ih.defaultOptions,e)),this.$element=qs("background"),this.context.canvas.getContainer().prepend(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return jX(this,void 0,void 0,function*(){e.update.call(this,t),Object.assign(this.$element.style,Hy(this.options,["key","type"]))})}destroy(){super.destroy(),this.$element.remove()}}Ih.defaultOptions={transition:"background 0.5s",backgroundSize:"cover",zIndex:"-1"};function Q1(r,t,e,n,i,a){const s=r,o=t,l=e-s,c=n-o;let u=i-s,h=a-o,d=u*l+h*c,f=0;d<=0?f=0:(u=l-u,h=c-h,d=u*l+h*c,d<=0?f=0:f=d*d/(l*l+c*c));const g=u*u+h*h-f;return g<0?0:g}function Di(r,t,e,n){return(r-e)*(r-e)+(t-n)*(t-n)}function B3(r,t,e,n,i){return Di(r,t,e,n)e;if(r===0)return Math.round;const t=Math.pow(10,r);return e=>Math.round(e*t)/t}function nP(r){const t=Math.min(r.x1,r.x2),e=Math.max(r.x1,r.x2),n=Math.min(r.y1,r.y2),i=Math.max(r.y1,r.y2);return{x:t,y:n,x2:e,y2:i,width:e-t,height:i-n}}class Fe{constructor(t,e,n,i){this.x1=t,this.y1=e,this.x2=n,this.y2=i}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}draw(t){t.moveTo(this.x1,this.y1),t.lineTo(this.x2,this.y2)}toString(){return`Line(from=(${this.x1},${this.y1}),to=(${this.x2},${this.y2}))`}static from(t){return new Fe(t.x1,t.y1,t.x2,t.y2)}cuts(t,e){if(this.y1===this.y2||ethis.y1&&e>=this.y2||t>this.x1&&t>=this.x2)return!1;if(tthis.x2+n)return!1}else if(tthis.x1+n)return!1;if(this.y1this.y2+n)return!1}else if(ethis.y1+n)return!1;return!0}}var he;(function(r){r[r.POINT=1]="POINT",r[r.PARALLEL=2]="PARALLEL",r[r.COINCIDENT=3]="COINCIDENT",r[r.NONE=4]="NONE"})(he||(he={}));class rm{constructor(t,e=0,n=0){this.state=t,this.x=e,this.y=n}}function pc(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 rm(he.POINT,r.x1+a*(r.x2-r.x1),r.y1+a*(r.y2-r.y1)):new rm(he.NONE)}return new rm(e===0||n===0?he.COINCIDENT:he.PARALLEL)}function rP(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 GX(r,t){function e(i,a,s,o){let l=rP(t,new Fe(i,a,s,o));return l=Math.abs(l-.5),l>=0&&l<=1?1:0}let n=e(r.x,r.y,r.x2,r.y);return n+=e(r.x,r.y,r.x,r.y2),n>1||(n+=e(r.x,r.y2,r.x2,r.y2),n>1)?!0:(n+=e(r.x2,r.y,r.x2,r.y2),n>0)}var de;(function(r){r[r.LEFT=0]="LEFT",r[r.TOP=1]="TOP",r[r.RIGHT=2]="RIGHT",r[r.BOTTOM=3]="BOTTOM"})(de||(de={}));function Fc(r,t,e){const n=new Set;return r.width<=0?(n.add(de.LEFT),n.add(de.RIGHT)):tr.x+r.width&&n.add(de.RIGHT),r.height<=0?(n.add(de.TOP),n.add(de.BOTTOM)):er.y+r.height&&n.add(de.BOTTOM),n}function iP(r,t){let e=t.x1,n=t.y1;const i=t.x2,a=t.y2,s=Array.from(Fc(r,i,a));if(s.length===0)return!0;let o=Fc(r,e,n);for(;o.size!==0;){for(const l of s)if(o.has(l))return!1;if(o.has(de.RIGHT)||o.has(de.LEFT)){let l=r.x;o.has(de.RIGHT)&&(l+=r.width),n=n+(l-e)*(a-n)/(i-e),e=l}else{let l=r.y;o.has(de.BOTTOM)&&(l+=r.height),e=e+(l-n)*(i-e)/(a-n),n=l}o=Fc(r,e,n)}return!0}function WX(r,t){let e=Number.POSITIVE_INFINITY,n=0;function i(a,s,o,l){let c=rP(t,new Fe(a,s,o,l));c=Math.abs(c-.5),c>=0&&c<=1&&(n++,c1||(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 VX(r,t){let e=0;const n=pc(r,new Fe(t.x,t.y,t.x2,t.y));e+=n.state===he.POINT?1:0;const i=pc(r,new Fe(t.x,t.y,t.x,t.y2));e+=i.state===he.POINT?1:0;const a=pc(r,new Fe(t.x,t.y2,t.x2,t.y2));e+=a.state===he.POINT?1:0;const s=pc(r,new Fe(t.x2,t.y,t.x2,t.y2));return e+=s.state===he.POINT?1:0,{top:n,left:i,bottom:a,right:s,count:e}}class Ke{constructor(t,e,n,i){this.x=t,this.y=e,this.width=n,this.height=i}get x2(){return this.x+this.width}get y2(){return this.y+this.height}get cx(){return this.x+this.width/2}get cy(){return this.y+this.height/2}get radius(){return Math.max(this.width,this.height)/2}static from(t){return new Ke(t.x,t.y,t.width,t.height)}equals(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}clone(){return new Ke(this.x,this.y,this.width,this.height)}add(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x2,t.x+t.width),a=Math.max(this.y2,t.y+t.height);this.x=e,this.y=n,this.width=i-e,this.height=a-n}addPoint(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x2,t.x),a=Math.max(this.y2,t.y);this.x=e,this.y=n,this.width=i-e,this.height=a-n}toString(){return`Rectangle[x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height}]`}draw(t){t.rect(this.x,this.y,this.width,this.height)}containsPt(t,e){return t>=this.x&&t<=this.x2&&e>=this.y&&e<=this.y2}get area(){return this.width*this.height}intersects(t){return this.area<=0||t.width<=0||t.height<=0?!1:t.x+t.width>this.x&&t.y+t.height>this.y&&t.x=this.width?this.width-1:t}boundY(t){return t=this.height?this.height-1:t}scaleX(t){return this.boundX(Math.floor((t-this.pixelX)/this.pixelGroup))}scaleY(t){return this.boundY(Math.floor((t-this.pixelY)/this.pixelGroup))}scale(t){const e=this.scaleX(t.x),n=this.scaleY(t.y),i=this.boundX(Math.ceil((t.x+t.width-this.pixelX)/this.pixelGroup)),a=this.boundY(Math.ceil((t.y+t.height-this.pixelY)/this.pixelGroup)),s=i-e,o=a-n;return new Ke(e,n,s,o)}invertScaleX(t){return Math.round(t*this.pixelGroup+this.pixelX)}invertScaleY(t){return Math.round(t*this.pixelGroup+this.pixelY)}addPadding(t,e){const n=Math.ceil(e/this.pixelGroup),i=this.boundX(t.x-n),a=this.boundY(t.y-n),s=this.boundX(t.x2+n),o=this.boundY(t.y2+n),l=s-i,c=o-a;return new Ke(i,a,l,c)}get(t,e){return t<0||e<0||t>=this.width||e>=this.height?Number.NaN:this.area[t+e*this.width]}inc(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]+=n)}set(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]=n)}incArea(t,e){if(t.width<=0||t.height<=0||e===0)return;const n=this.width,i=t.width,a=Math.max(0,t.i),s=Math.max(0,t.j),o=Math.min(t.i+t.width,n),l=Math.min(t.j+t.height,this.height);if(!(l<=0||o<=0||a>=n||l>=this.height))for(let c=s;cMath.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;se?"black":"white",t.fillRect(i,a,1,1)}t.restore()}}}function aP(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 z3(r,t,e){return sP(Object.assign(nP(r),{distSquare:(n,i)=>Q1(r.x1,r.y1,r.x2,r.y2,n,i)}),t,e)}function sP(r,t,e){const n=aP(r,e),i=t.scale(n),a=t.createSub(i,n);return UX(a,t,e,(s,o)=>r.distSquare(s,o)),a}function UX(r,t,e,n){const i=e*e;for(let a=0;a{const o=i.slice(0,s);return KX(t,a,o,e,n)}).flat()}function KX(r,t,e,n,i){const a=Jt(t.cx,t.cy),s=QX(a,e,r);if(s==null)return[];const o=new Fe(a.x,a.y,s.cx,s.cy),l=ZX(o,r,n,i);return JX(l,r)}function ZX(r,t,e,n){const i=[],a=[];a.push(r);let s=!0;for(let o=0;o0;){const l=a.pop(),c=oP(t,l),u=c?VX(l,c):null;if(!c||!u||u.count!==2){s||i.push(l);continue}let h=n,d=yc(c,h,u,!0),f=yi(d,a)||yi(d,i),g=mc(d,t);for(;!f&&g&&h>=1;)h/=1.5,d=yc(c,h,u,!0),f=yi(d,a)||yi(d,i),g=mc(d,t);if(d&&!f&&!g&&(a.push(new Fe(l.x1,l.y1,d.x,d.y)),a.push(new Fe(d.x,d.y,l.x2,l.y2)),s=!0),s)continue;h=n,d=yc(c,h,u,!1);let v=yi(d,a)||yi(d,i);for(g=mc(d,t);!v&&g&&h>=1;)h/=1.5,d=yc(c,h,u,!1),v=yi(d,a)||yi(d,i),g=mc(d,t);d&&!v&&(a.push(new Fe(l.x1,l.y1,d.x,d.y)),a.push(new Fe(d.x,d.y,l.x2,l.y2)),s=!0),s||i.push(l)}for(;a.length>0;)i.push(a.pop());return i}function JX(r,t){const e=[];for(;r.length>0;){const n=r.pop();if(r.length===0){e.push(n);break}const i=r.pop(),a=new Fe(n.x1,n.y1,i.x2,i.y2);oP(t,a)?(e.push(n),r.push(i)):r.push(a)}return e}function QX(r,t,e){let n=Number.POSITIVE_INFINITY;return t.reduce((i,a)=>{const s=Di(r.x,r.y,a.cx,a.cy);if(s>n)return i;const o=new Fe(r.x,r.y,a.cx,a.cy),l=eK(e,o);return s*(l+1)*(l+1){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 mc(r,t){return t.some(e=>e.containsPt(r.x,r.y))}function yi(r,t){return t.some(e=>!!(B3(e.x1,e.y1,r.x,r.y,.001)||B3(e.x2,e.y2,r.x,r.y,.001)))}function oP(r,t){let e=Number.POSITIVE_INFINITY,n=null;for(const i of r){if(!iP(i,t))continue;const a=WX(i,t);a>=0&&aiP(n,t)&&GX(n,t)?e+1:e,0)}function yc(r,t,e,n){const i=e.top,a=e.left,s=e.bottom,o=e.right;if(n){if(a.state===he.POINT){if(i.state===he.POINT)return Jt(r.x-t,r.y-t);if(s.state===he.POINT)return Jt(r.x-t,r.y2+t);const d=r.width*r.height;return r.width*((a.y-r.y+(o.y-r.y))*.5)o.y?Jt(r.x-t,r.y-t):Jt(r.x2+t,r.y-t):a.ys.x?Jt(r.x-t,r.y-t):Jt(r.x-t,r.y2+t):i.xo.y?Jt(r.x2+t,r.y2+t):Jt(r.x-t,r.y2+t):a.ys.x?Jt(r.x2+t,r.y2+t):Jt(r.x2+t,r.y-t):i.xn)return!1}return!0}function rK(r=0){return t=>{if(r<0||t.length<3)return t;const e=[];let n=0;const i=r*r;for(;n{if(s.length<3)return s;const o=[],l=s.closed,c=s.length+3-1+(l?0:2);o.push(a(s,2-(l?0:2),0));for(let u=2-(l?0:2);u{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?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:qX(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 sK(t)(this)}simplify(t){return rK(t)(this)}bSplines(t){return aK(t)(this)}apply(t){return t(this)}containsElements(t){const e=HX(this.points);return e?t.every(n=>e.containsPt(n.cx,n.cy)&&this.withinArea(n.cx,n.cy)):!1}withinArea(t,e){if(this.length===0)return!1;let n=0;const i=this.points[0],a=new Fe(i.x,i.y,i.x,i.y);for(let s=1;st?u+h:u}function a(l,c){let u=Zs;return u=i(l,c,u,1),u=i(l+1,c,u,2),u=i(l,c+1,u,4),u=i(l+1,c+1,u,8),Number.isNaN(u)?-1:u}let s=bc;function o(l,c){let u=l,h=c,d=r.invertScaleX(u),f=r.invertScaleY(h);for(let g=0;g$3(n.raw,t));return e<0?!1:(this.members.splice(e,1),this.dirty.add(rr.MEMBERS),!0)}removeNonMember(t){const e=this.nonMembers.findIndex(n=>$3(n.raw,t));return e<0?!1:(this.nonMembers.splice(e,1),this.dirty.add(rr.NON_MEMBERS),!0)}removeEdge(t){const e=this.edges.findIndex(n=>n.obj.equals(t));return e<0?!1:(this.edges.splice(e,1),this.dirty.add(rr.NON_MEMBERS),!0)}pushNonMember(...t){if(t.length!==0){this.dirty.add(rr.NON_MEMBERS);for(const e of t)this.nonMembers.push({raw:e,obj:So(e)?Su.from(e):Ke.from(e),area:null})}}pushEdge(...t){if(t.length!==0){this.dirty.add(rr.EDGES);for(const e of t)this.edges.push({raw:e,obj:Fe.from(e),area:null})}}update(){const t=this.dirty.has(rr.MEMBERS),e=this.dirty.has(rr.NON_MEMBERS);let n=this.dirty.has(rr.EDGES);this.dirty.clear();const i=this.members.map(c=>c.obj);if(this.o.virtualEdges&&(t||e)){const c=this.nonMembers.map(d=>d.obj),u=XX(i,c,this.o.maxRoutingIterations,this.o.morphBuffer),h=new Map(this.virtualEdges.map(d=>[d.obj.toString(),d.area]));this.virtualEdges=u.map(d=>{var f;return{raw:d,obj:d,area:(f=h.get(d.toString()))!==null&&f!==void 0?f:null}}),n=!0}let a=!1;if(t||n){const c=this.virtualEdges.concat(this.edges).map(f=>f.obj),u=uK(i,c),h=Math.max(this.o.edgeR1,this.o.nodeR1)+this.o.morphBuffer,d=Ke.from(aP(u,h));d.equals(this.activeRegion)||(a=!0,this.activeRegion=d)}if(a){const c=Math.ceil(this.activeRegion.width/this.o.pixelGroup),u=Math.ceil(this.activeRegion.height/this.o.pixelGroup);this.activeRegion.x!==this.potentialArea.pixelX||this.activeRegion.y!==this.potentialArea.pixelY?(this.potentialArea=Na.fromPixelRegion(this.activeRegion,this.o.pixelGroup),this.members.forEach(h=>h.area=null),this.nonMembers.forEach(h=>h.area=null),this.edges.forEach(h=>h.area=null),this.virtualEdges.forEach(h=>h.area=null)):(c!==this.potentialArea.width||u!==this.potentialArea.height)&&(this.potentialArea=Na.fromPixelRegion(this.activeRegion,this.o.pixelGroup))}const s=new Map,o=c=>{if(c.area){const u=`${c.obj.width}x${c.obj.height}x${c.obj instanceof Ke?"R":"C"}`;s.set(u,c.area)}},l=c=>{if(c.area)return;const u=`${c.obj.width}x${c.obj.height}x${c.obj instanceof Ke?"R":"C"}`;if(s.has(u)){const d=s.get(u);c.area=this.potentialArea.copy(d,{x:c.obj.x-this.o.nodeR1,y:c.obj.y-this.o.nodeR1});return}const h=c.obj instanceof Ke?YX(c.obj,this.potentialArea,this.o.nodeR1):sP(c.obj,this.potentialArea,this.o.nodeR1);c.area=h,s.set(u,h)};this.members.forEach(o),this.nonMembers.forEach(o),this.members.forEach(l),this.nonMembers.forEach(c=>{this.activeRegion.intersects(c.obj)?l(c):c.area=null}),this.edges.forEach(c=>{c.area||(c.area=z3(c.obj,this.potentialArea,this.o.edgeR1))}),this.virtualEdges.forEach(c=>{c.area||(c.area=z3(c.obj,this.potentialArea,this.o.edgeR1))})}drawMembers(t){for(const e of this.members)e.obj.draw(t)}drawNonMembers(t){for(const e of this.nonMembers)e.obj.draw(t)}drawEdges(t){for(const e of this.edges)e.obj.draw(t)}drawPotentialArea(t,e=!0){this.potentialArea.draw(t,e)}compute(){if(this.members.length===0)return new Gs([]);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 cK(e,n,i,a,o=>o.containsElements(s),t)}};function cK(r,t,e,n,i,a={}){const s=Object.assign({},Fh,a);let o=s.threshold,l=s.memberInfluenceFactor,c=s.edgeInfluenceFactor,u=s.nonMemberInfluenceFactor;const h=(s.nodeR0-s.nodeR1)*(s.nodeR0-s.nodeR1),d=(s.edgeR0-s.edgeR1)*(s.edgeR0-s.edgeR1);for(let f=0;f0)u*=.8;else break}return new Gs([])}function uK(r,t){if(r.length===0)return new Ke(0,0,0,0);const e=Ke.from(r[0]);for(const n of r)e.add(n);for(const n of t)e.add(nP(n));return e}var hK=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{const{style:n,bubbleSetOptions:i}=this.parseOptions();ue(this.bubbleSetOptions,i)||this.init(),this.bubbleSetOptions=Object.assign({},i);const a=Object.assign(Object.assign({},n),{d:this.getPath()});this.shape?this.shape.update(a):(this.shape=new el({style:a}),this.context.canvas.appendChild(this.shape))},this.updateBubbleSetsPath=n=>{if(!this.shape)return;const i=F(n.data);[...this.options.members,...this.options.avoidMembers].includes(i)&&this.shape.update(Object.assign(Object.assign({},this.parseOptions().style),{d:this.getPath(i)}))},this.getPath=n=>{const{graph:i}=this.context,a=this.options.members,s=[...this.members.keys()],o=this.options.avoidMembers,l=[...this.avoidMembers.keys()];if(!n&&ue(a,s)&&ue(o,l))return this.path;const{enter:c=[],exit:u=[]}=zi(s,a,p=>p),{enter:h=[],exit:d=[]}=zi(l,o,p=>p);n&&(u.push(n),c.push(n));const f=(p,m,y)=>{p.forEach(b=>{const w=y?this.members:this.avoidMembers,x=y?"pushMember":"pushNonMember",S=y?"removeMember":"removeNonMember";if(m){let E;i.getElementType(b)==="edge"?([E]=fK(i,b),this.bubbleSets.pushEdge(E)):([E]=dK(i,b),this.bubbleSets[x](E)),w.set(b,E)}else{const E=w.get(b);E&&(i.getElementType(b)==="edge"?this.bubbleSets.removeEdge(E):this.bubbleSets[S](E),w.delete(b))}})};f(u,!1,!0),f(c,!0,!0),f(d,!1,!1),f(h,!0,!1);const v=this.bubbleSets.compute().sample(8).simplify(0).bSplines().simplify(0);return this.path=yT(v.points.map(Ge)),this.path},this.bindEvents(),this.bubbleSets=new j3(this.options)}bindEvents(){this.context.graph.on(X.AFTER_RENDER,this.drawBubbleSets),this.context.graph.on(X.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath)}init(){this.bubbleSets=new j3(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=hK(t,["type","key","members","avoidMembers"]),o=Object.keys(s).reduce((l,c)=>(c in Fh?l.bubbleSetOptions[c]=s[c]:l.style[c]=s[c],l),{style:{},bubbleSetOptions:{}});return Object.assign({type:e,key:n,members:i,avoidMembers:a},o)}addMember(t){const e=Array.isArray(t)?t:[t];e.some(n=>this.options.avoidMembers.includes(n))&&(this.options.avoidMembers=this.options.avoidMembers.filter(n=>!e.includes(n))),this.options.members=[...new Set([...this.options.members,...e])],this.drawBubbleSets()}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter(n=>!e.includes(n)),this.drawBubbleSets()}updateMember(t){this.options.members=at(t)?t(this.options.members):t,this.drawBubbleSets()}getMember(){return this.options.members}addAvoidMember(t){const e=Array.isArray(t)?t:[t];e.some(n=>this.options.members.includes(n))&&(this.options.members=this.options.members.filter(n=>!e.includes(n))),this.options.avoidMembers=[...new Set([...this.options.avoidMembers,...e])],this.drawBubbleSets()}removeAvoidMember(t){const e=Array.isArray(t)?t:[t];this.options.avoidMembers.some(n=>e.includes(n))&&(this.options.avoidMembers=this.options.avoidMembers.filter(n=>!e.includes(n)),this.drawBubbleSets())}updateAvoidMember(t){this.options.avoidMembers=Array.isArray(t)?t:[t],this.drawBubbleSets()}getAvoidMember(){return this.options.avoidMembers}destroy(){this.context.graph.off(X.AFTER_RENDER,this.drawBubbleSets),this.context.graph.off(X.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath),this.shape.destroy(),super.destroy()}}Bh.defaultOptions=Object.assign({members:[],avoidMembers:[],fill:"lightblue",fillOpacity:.2,stroke:"blue",strokeOpacity:.2},Fh);const dK=(r,t)=>(Array.isArray(t)?t:[t]).map(n=>{const i=r.getElementRenderBounds(n);return new Ke(i.min[0],i.min[1],Nr(i),Rr(i))}),fK=(r,t)=>(Array.isArray(t)?t:[t]).map(n=>{const i=r.getEdgeData(n),a=r.getElementPosition(i.source),s=r.getElementPosition(i.target);return Fe.from({x1:a[0],y1:a[1],x2:s[0],y2:s[1]})});function gK(r){return`
    ${r.map(t=>`
  • ${t.name}
  • `).join("")}
`}const vK=` .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 q3=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class zh extends Ue{constructor(t,e){super(t,Object.assign({},zh.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=qs("contextmenu",!1,{zIndex:"99"});const{className:t}=this.options;t&&this.$element.classList.add(t),this.context.canvas.getContainer().appendChild(this.$element),xy("g6-contextmenu-css","style",{},vK,document.head)}show(t){return q3(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 q3(this,void 0,void 0,function*(){const{getContent:e,getItems:n}=this.options;return n?gK(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)}}zh.defaultOptions={trigger:"contextmenu",offset:[4,4],loadingContent:'
Loading...
',getContent:()=>"It is a empty context menu.",enable:()=>!0};class $h extends Ue{constructor(t,e){super(t,Object.assign({},$h.defaultOptions,e)),this.edgeBundles={},this.edgePoints={},this.onBundle=()=>{const{model:n,element:i}=this.context,a=n.getEdgeData();this.divideEdges(this.options.divisions);const{cycles:s,iterRate:o,divRate:l}=this.options;let{lambda:c,divisions:u,iterations:h}=this.options;for(let d=0;d{var p;if(v.source===v.target)return;const m=F(v);g[m]=this.getEdgeForces(v,u,c);for(let y=0;y{const f=F(d),g=i.getElement(f);g==null||g.update({d:b1(this.edgePoints[f])})})},this.bindEvents()}get nodeMap(){const t=this.context.model.getNodeData();return Object.fromEntries(t.map(e=>[F(e),za(ye(e))]))}divideEdges(t){this.context.model.getEdgeData().forEach(n=>{var i;const a=F(n);(i=this.edgePoints)[a]||(i[a]=[]);const s=this.nodeMap[n.source],o=this.nodeMap[n.target];if(t===1)this.edgePoints[a].push(s),this.edgePoints[a].push(ur(ft(s,o),2)),this.edgePoints[a].push(o);else{const c=(this.edgePoints[a].length===0?Kt(s,o):wK(this.edgePoints[a]))/(t+1);let u=c;const h=[s];for(let d=1;du;){const p=u/v,m=ft(f,Gr($t(g,f),p));h.push(m),v-=u,u=c}u-=v}h.push(o),this.edgePoints[a]=h}})}getVectorPosition(t){const e=this.nodeMap[t.source],n=this.nodeMap[t.target],[i,a]=$t(n,e),s=Kt(e,n);return{source:e,target:n,vx:i,vy:a,length:s}}measureEdgeCompatibility(t,e){const n=this.getVectorPosition(t),i=this.getVectorPosition(e),a=pK(n,i),s=mK(n,i),o=yK(n,i),l=bK(n,i);return a*s*o*l}getEdgeBundles(){const t={},e=this.options.bundleThreshold,n=this.context.model.getEdgeData();return n.forEach((i,a)=>{n.forEach((s,o)=>{var l,c;if(o<=a)return;this.measureEdgeCompatibility(i,s)>=e&&(t[l=F(i)]||(t[l]=[]),t[F(i)].push(s),t[c=F(s)]||(t[c]=[]),t[F(s)].push(i))})}),t}getSpringForce(t,e){const{pre:n,cur:i,next:a}=t;return Gr($t(ft(n,a),Gr(i,2)),e)}getElectrostaticForce(t,e){wr(this.edgeBundles)&&(this.edgeBundles=this.getEdgeBundles());const n=this.edgeBundles[F(e)];let i=[0,0];return n==null||n.forEach(a=>{const s=this.edgePoints[F(a)][t],o=this.edgePoints[F(e)][t],l=$t(s,o),c=Kt(s,o);i=ft(i,Gr(l,1/c))}),i}getEdgeForces(t,e,n){const i=this.nodeMap[t.source],a=this.nodeMap[t.target],s=this.options.K/(Kt(i,a)*(e+1)),o=[[0,0]],l=F(t);for(let c=1;cMath.abs(o9([r.vx,r.vy],[t.vx,t.vy])/(r.length*t.length)),mK=(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)},yK=(r,t)=>{const e=(r.length+t.length)/2,n=ur(ft(r.source,r.target),2),i=ur(ft(t.source,t.target),2);return e/(e+Kt(n,i))},G3=(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]},W3=(r,t)=>{const e=G3(t.source,r),n=G3(t.target,r),i=ur(ft(e,n),2),a=ur(ft(r.source,r.target),2);return Kt(e,n)===0?0:Math.max(0,1-2*Kt(a,i)/Kt(e,n))},bK=(r,t)=>Math.min(W3(r,t),W3(t,r)),wK=r=>{let t=0;for(let e=1;e{if(this.options.trigger==="drag"&&this.isLensOn)return;const i=Ge(n.canvas);this.renderLens(i),this.renderFocusElements()},this.renderLens=n=>{const i=Object.assign({},xK,this.options.style);this.isLensOn||(this.lens=new nl({style:i}),this.canvas.appendChild(this.lens)),Object.assign(i,sr(n),{size:this.r*2}),this.lens.update(i)},this.getFilterData=()=>{const{filter:n}=this.options,{model:i}=this.context,a=i.getData();if(!n)return a;const{nodes:s,edges:o,combos:l}=a;return{nodes:s.filter(c=>n(F(c),"node")),edges:o.filter(c=>n(F(c),"edge")),combos:l.filter(c=>n(F(c),"combo"))}},this.getFocusElements=n=>{const{nodes:i,edges:a}=this.getFilterData(),s=i.filter(c=>Kt(ye(c),n)F(c)),l=a.filter(c=>{const{source:u,target:h}=c,d=o.includes(u),f=o.includes(h);switch(this.options.nodeType){case"both":return d&&f;case"either":return d!==f;case"source":return d&&!f;case"target":return!d&&f;default:return!1}});return{nodes:s,edges:l}},this.renderFocusElements=()=>{const{element:n,graph:i}=this.context;if(!this.isLensOn)return;const a=this.lens.getCenter(),{nodes:s,edges:o}=this.getFocusElements(a),l=new Set,c=u=>{const h=F(u);l.add(h);const d=n.getElement(h);if(!d)return;const f=this.shapes.get(h)||d.cloneNode();f.setPosition(d.getPosition()),f.id=d.id,this.shapes.has(h)?Object.entries(d.attributes).forEach(([p,m])=>{f.style[p]!==m&&(f.style[p]=m)}):(this.canvas.appendChild(f),this.shapes.set(h,f));const g=i.getElementType(h),v=this.getElementStyle(g,u);f.update(v)};s.forEach(c),o.forEach(c),this.shapes.forEach((u,h)=>{l.has(h)||(u.destroy(),this.shapes.delete(h))})},this.scaleRByWheel=n=>{var i;this.options.preventDefault&&n.preventDefault();const{clientX:a,clientY:s,deltaX:o,deltaY:l}=n,{graph:c,canvas:u}=this.context,h=c.getCanvasByClient([a,s]),d=(i=this.lens)===null||i===void 0?void 0:i.getCenter();if(!this.isLensOn||Kt(h,d)>this.r)return;const{maxR:f,minR:g}=this.options,v=o+l>0?1/(1-V3):1-V3,p=Math.min(...u.getSize())/2;this.r=Math.max(g||0,Math.min(f||p,this.r*v)),this.renderLens(d),this.renderFocusElements()},this.isLensDragging=!1,this.onDragStart=n=>{var i;const a=Ge(n.canvas),s=(i=this.lens)===null||i===void 0?void 0:i.getCenter();!this.isLensOn||Kt(a,s)>this.r||(this.isLensDragging=!0)},this.onDrag=n=>{if(!this.isLensDragging)return;const i=Ge(n.canvas);this.renderLens(i),this.renderFocusElements()},this.onDragEnd=()=>{this.isLensDragging=!1},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}getElementStyle(t,e){const n=t==="node"?this.options.nodeStyle:this.options.edgeStyle;return typeof n=="function"?n(e):n}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i}=this.options,a=e.getCanvas().getLayer();["click","drag"].includes(n)&&a.addEventListener(z.CLICK,this.onEdgeFilter),n==="pointermove"?a.addEventListener(z.POINTER_MOVE,this.onEdgeFilter):n==="drag"&&(a.addEventListener(z.DRAG_START,this.onDragStart),a.addEventListener(z.DRAG,this.onDrag),a.addEventListener(z.DRAG_END,this.onDragEnd)),i==="wheel"&&((t=this.graphDom)===null||t===void 0||t.addEventListener(z.WHEEL,this.scaleRByWheel,{passive:!1}))}unbindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i}=this.options,a=e.getCanvas().getLayer();["click","drag"].includes(n)&&a.removeEventListener(z.CLICK,this.onEdgeFilter),n==="pointermove"?a.removeEventListener(z.POINTER_MOVE,this.onEdgeFilter):n==="drag"&&(a.removeEventListener(z.DRAG_START,this.onDragStart),a.removeEventListener(z.DRAG,this.onDrag),a.removeEventListener(z.DRAG_END,this.onDragEnd)),i==="wheel"&&((t=this.graphDom)===null||t===void 0||t.removeEventListener(z.WHEEL,this.scaleRByWheel))}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),this.isLensOn&&this.lens.destroy(),this.shapes.forEach((t,e)=>{t.destroy(),this.shapes.delete(e)}),super.destroy()}}jh.defaultOptions={trigger:"pointermove",r:60,nodeType:"both",filter:()=>!0,style:{lineWidth:2},nodeStyle:{label:!1},edgeStyle:{label:!0},scaleRBy:"wheel",preventDefault:!0};const EK={fill:"#ccc",fillOpacity:.1,lineWidth:2,stroke:"#000",strokeOpacity:.8,labelFontSize:12},H3=.05,U3=.1;class qh extends Ue{constructor(t,e){super(t,Object.assign({},qh.defaultOptions,e)),this.r=this.options.r,this.d=this.options.d,this.onCreateFisheye=n=>{if(this.options.trigger==="drag"&&this.isLensOn)return;const i=Ge(n.canvas);this.onMagnify(i)},this.onMagnify=n=>{n.some(isNaN)||(this.renderLens(n),this.renderFocusElements())},this.renderLens=n=>{const i=Object.assign({},EK,this.options.style);this.isLensOn||(this.lens=new nl({style:i}),this.canvas.appendChild(this.lens)),Object.assign(i,sr(n),{size:this.r*2,label:this.options.showDPercent,labelText:this.getDPercent()}),this.lens.update(i)},this.getDPercent=()=>{const{minD:n,maxD:i}=this.options;return`${Math.round((this.d-n)/(i-n)*100)}%`},this.prevMagnifiedStyleMap=new Map,this.prevOriginStyleMap=new Map,this.renderFocusElements=()=>{if(!this.isLensOn)return;const{graph:n}=this.context,i=this.lens.getCenter(),a=(this.d+1)*this.r,s=new Map,o=new Map;n.getNodeData().forEach(c=>{const u=ye(c),h=Kt(u,i);if(h>this.r)return;const d=a*h/(this.d*h+this.r),[f,g]=u,[v,p]=i,m=(f-v)/h,y=(g-p)/h,b=[v+d*m,p+d*y],w=F(c),x=this.getNodeStyle(c),S=La(n.getElementRenderStyle(w),Object.keys(x));s.set(w,Object.assign(Object.assign({},sr(b)),x)),o.set(w,Object.assign(Object.assign({},sr(u)),S))}),this.updateStyle(s,o)},this.getNodeStyle=n=>{const{nodeStyle:i}=this.options;return typeof i=="function"?i(n):i},this.updateStyle=(n,i)=>{const{graph:a,element:s}=this.context,{enter:o,exit:l,keep:c}=zi(Array.from(this.prevMagnifiedStyleMap.keys()),Array.from(n.keys()),d=>d),u=new Set,h=(d,f)=>{const g=s.getElement(d);g==null||g.update(f),a.getRelatedEdgesData(d).forEach(v=>{u.add(F(v))})};[...o,...c].forEach(d=>{h(d,n.get(d))}),l.forEach(d=>{h(d,this.prevOriginStyleMap.get(d)),this.prevOriginStyleMap.delete(d)}),u.forEach(d=>{const f=s.getElement(d);f==null||f.update({})}),this.prevMagnifiedStyleMap=n,i.forEach((d,f)=>{this.prevOriginStyleMap.has(f)||this.prevOriginStyleMap.set(f,d)})},this.isWheelValid=n=>{if(this.options.preventDefault&&n.preventDefault(),!this.isLensOn)return!1;const{clientX:i,clientY:a}=n,s=this.context.graph.getCanvasByClient([i,a]),o=this.lens.getCenter();return!(Kt(s,o)>this.r)},this.scaleR=n=>{const{maxR:i,minR:a}=this.options,s=n?1/(1-H3):1-H3,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+U3:this.d-U3;this.d=Math.max(a,Math.min(i,s))},this.scaleRByWheel=n=>{if(!this.isWheelValid(n))return;const{deltaX:i,deltaY:a}=n;this.scaleR(i+a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.scaleDByWheel=n=>{if(!this.isWheelValid(n))return;const{deltaX:i,deltaY:a}=n;this.scaleD(i+a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.isDragValid=n=>{if(this.options.preventDefault&&n.preventDefault(),!this.isLensOn)return!1;const i=Ge(n.canvas),a=this.lens.getCenter();return!(Kt(i,a)>this.r)},this.isLensDragging=!1,this.onDragStart=n=>{this.isDragValid(n)&&(this.isLensDragging=!0)},this.onDrag=n=>{if(!this.isLensDragging)return;const i=Ge(n.canvas);this.onMagnify(i)},this.onDragEnd=()=>{this.isLensDragging=!1},this.scaleRByDrag=n=>{if(!this.isLensDragging)return;const{dx:i,dy:a}=n;this.scaleR(i-a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.scaleDByDrag=n=>{if(!this.isLensDragging)return;const{dx:i,dy:a}=n;this.scaleD(i-a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i,scaleDBy:a}=this.options,s=e.getCanvas().getLayer();if(["click","drag"].includes(n)&&s.addEventListener(z.CLICK,this.onCreateFisheye),n==="pointermove"&&s.addEventListener(z.POINTER_MOVE,this.onCreateFisheye),n==="drag"||i==="drag"||a==="drag"){s.addEventListener(z.DRAG_START,this.onDragStart),s.addEventListener(z.DRAG_END,this.onDragEnd);const o=n==="drag"?this.onDrag:i==="drag"?this.scaleRByDrag:this.scaleDByDrag;s.addEventListener(z.DRAG,o)}if(i==="wheel"||a==="wheel"){const o=i==="wheel"?this.scaleRByWheel:this.scaleDByWheel;(t=this.graphDom)===null||t===void 0||t.addEventListener(z.WHEEL,o,{passive:!1})}}unbindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i,scaleDBy:a}=this.options,s=e.getCanvas().getLayer();if(["click","drag"].includes(n)&&s.removeEventListener(z.CLICK,this.onCreateFisheye),n==="pointermove"&&s.removeEventListener(z.POINTER_MOVE,this.onCreateFisheye),n==="drag"||i==="drag"||a==="drag"){s.removeEventListener(z.DRAG_START,this.onDragStart),s.removeEventListener(z.DRAG_END,this.onDragEnd);const o=n==="drag"?this.onDrag:i==="drag"?this.scaleRByDrag:this.scaleDByDrag;s.removeEventListener(z.DRAG,o)}if(i==="wheel"||a==="wheel"){const o=i==="wheel"?this.scaleRByWheel:this.scaleDByWheel;(t=this.graphDom)===null||t===void 0||t.removeEventListener(z.WHEEL,o)}}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){var t;this.unbindEvents(),this.isLensOn&&((t=this.lens)===null||t===void 0||t.destroy()),this.prevMagnifiedStyleMap.clear(),this.prevOriginStyleMap.clear(),super.destroy()}}qh.defaultOptions={trigger:"pointermove",r:120,d:1.5,maxD:5,minD:0,showDPercent:!0,style:{},nodeStyle:{label:!0},preventDefault:!0};class Gh extends Ue{constructor(t,e){super(t,Object.assign({},Gh.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 Rs(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||!SK()||this.$el.requestFullscreen().catch(t=>{Ar.warn(`Error attempting to enable full-screen: ${t.message} (${t.name})`)})}exit(){document.fullscreenElement&&document.exitFullscreen()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.exit(),this.style.remove(),super.destroy()}}Gh.defaultOptions={trigger:{},autoFit:!0};function SK(){return document.fullscreenEnabled||Reflect.get(document,"webkitFullscreenEnabled")||Reflect.get(document,"mozFullscreenEnabled")||Reflect.get(document,"msFullscreenEnabled")}class Wh extends Ue{constructor(t,e){super(t,Object.assign({},Wh.defaultOptions,e)),this.$element=qs("grid-line",!0),this.offset=[0,0],this.onTransform=i=>{if(!this.options.follow)return;const{data:{translate:a}}=i;a&&this.updateOffset(a)},this.context.canvas.getContainer().prepend(this.$element),this.updateStyle(),this.bindEvents()}update(t){super.update(t),this.updateStyle()}bindEvents(){const{graph:t}=this.context;t.on(X.AFTER_TRANSFORM,this.onTransform)}updateStyle(){const{size:t,stroke:e,lineWidth:n,border:i,borderLineWidth:a,borderStroke:s,borderStyle:o}=this.options;Object.assign(this.$element.style,{border:i?`${a}px ${o} ${s}`:"none",backgroundImage:`linear-gradient(${e} ${n}px, transparent ${n}px), linear-gradient(90deg, ${e} ${n}px, transparent ${n}px)`,backgroundSize:`${t}px ${t}px`,backgroundRepeat:"repeat"})}updateOffset(t){this.offset=c9(ft(this.offset,t),this.options.size),this.$element.style.backgroundPosition=`${this.offset[0]}px ${this.offset[1]}px`}destroy(){this.context.graph.off(X.AFTER_TRANSFORM,this.onTransform),this.$element.remove(),super.destroy()}}Wh.defaultOptions={border:!0,borderLineWidth:1,borderStroke:"#eee",borderStyle:"solid",lineWidth:1,size:20,stroke:"#eee"};function t2(r){const t={Added:new Map,Updated:new Map,Removed:new Map};return r.forEach(e=>{const{type:n,value:i}=e,a=F(i);if(n==="NodeAdded"||n==="EdgeAdded"||n==="ComboAdded")t.Added.set(a,e);else if(n==="NodeUpdated"||n==="EdgeUpdated"||n==="ComboUpdated")if(t.Added.has(a))t.Added.set(a,{type:n.replace("Updated","Added"),value:i});else if(t.Updated.has(a)){const{original:s}=t.Updated.get(a);t.Updated.set(a,{type:n,value:i,original:s})}else t.Removed.has(a)||t.Updated.set(a,e);else(n==="NodeRemoved"||n==="EdgeRemoved"||n==="ComboRemoved")&&(t.Added.has(a)?t.Added.delete(a):(t.Updated.has(a)&&t.Updated.delete(a),t.Removed.set(a,e)))}),[...Array.from(t.Added.values()),...Array.from(t.Updated.values()),...Array.from(t.Removed.values())]}function lP(r){const{NodeAdded:t=[],NodeUpdated:e=[],NodeRemoved:n=[],EdgeAdded:i=[],EdgeUpdated:a=[],EdgeRemoved:s=[],ComboAdded:o=[],ComboUpdated:l=[],ComboRemoved:c=[]}=Nu(r,u=>u.type);return{add:{nodes:t,edges:i,combos:o},update:{nodes:e,edges:a,combos:l},remove:{nodes:n,edges:s,combos:c}}}function cP(r,t){for(const e in r)me(r[e])&&!Array.isArray(r[e])&&r[e]!==null?(t[e]||(t[e]={}),cP(r[e],t[e])):t[e]===void 0&&(t[e]=No(e))}function _K(r,t=!1,e){const n={animation:t,current:{add:{},update:{},remove:{}},original:{add:{},update:{},remove:{}}},{add:i,update:a,remove:s}=lP(t2(r));return["nodes","edges","combos"].forEach(o=>{a[o]&&a[o].forEach(l=>{var c,u;const h=Object.assign({},l.value);let d=Object.assign({},l.original);if(e){const f=e.graph.getElementType(F(l.original)),g=f==="edge"?"stroke":"fill",v=e.element.getElementComputedStyle(f,l.original);d=Object.assign(Object.assign({},l.original),{style:Object.assign({[g]:v[g]},l.original.style)})}cP(h,d),(c=n.current.update)[o]||(c[o]=[]),n.current.update[o].push(h),(u=n.original.update)[o]||(u[o]=[]),n.original.update[o].push(d)}),i[o]&&i[o].forEach(l=>{var c,u;const h=Object.assign({},l.value);(c=n.current.add)[o]||(c[o]=[]),n.current.add[o].push(h),(u=n.original.remove)[o]||(u[o]=[]),n.original.remove[o].push(h)}),s[o]&&s[o].forEach(l=>{var c,u;const h=Object.assign({},l.value);(c=n.current.remove)[o]||(c[o]=[]),n.current.remove[o].push(h),(u=n.original.add)[o]||(u[o]=[]),n.original.add[o].push(h)})}),n}class Vh extends Ue{constructor(t,e){super(t,Object.assign({},Vh.defaultOptions,e)),this.batchChanges=null,this.batchAnimation=!1,this.undoStack=[],this.redoStack=[],this.freezed=!1,this.executeCommand=(i,a=!0)=>{var s,o,l;this.freezed=!0,(o=(s=this.options).executeCommand)===null||o===void 0||o.call(s,i);const c=a?i.original:i.current;this.context.graph.addData(c.add),this.context.graph.updateData(c.update),this.context.graph.removeData(nT(c.remove,!1)),(l=this.context.element)===null||l===void 0||l.draw({silence:!0,animation:i.animation}),this.freezed=!1},this.addCommand=i=>{var a;if(!this.freezed){if(i.type===X.AFTER_DRAW){const{dataChanges:s=[],animation:o=!0}=i.data;if(!((a=this.context.batch)===null||a===void 0)&&a.isBatching){if(!this.batchChanges)return;this.batchChanges.push(s),this.batchAnimation&&(this.batchAnimation=o);return}this.batchChanges=[s],this.batchAnimation=o}this.undoStackPush(_K(this.batchChanges.flat(),this.batchAnimation,this.context)),this.notify(_i.ADD,this.undoStack[this.undoStack.length-1])}},this.initBatchCommand=i=>{const{initiate:a}=i.data;this.batchAnimation=!1,a?this.batchChanges=[]:this.undoStack.pop()||(this.batchChanges=null)},this.emitter=new eh;const{graph:n}=this.context;n.on(X.AFTER_DRAW,this.addCommand),n.on(X.BATCH_START,this.initBatchCommand),n.on(X.BATCH_END,this.addCommand)}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}undo(){var t,e,n,i;const a=this.undoStack.pop();if(a){if(this.executeCommand(a),((e=(t=this.options).beforeAddCommand)===null||e===void 0?void 0:e.call(t,a,!1))===!1)return;this.redoStack.push(a),(i=(n=this.options).afterAddCommand)===null||i===void 0||i.call(n,a,!1),this.notify(_i.UNDO,a)}return this}redo(){const t=this.redoStack.pop();return t&&(this.executeCommand(t,!1),this.undoStackPush(t),this.notify(_i.REDO,t)),this}undoAndCancel(){const t=this.undoStack.pop();return t&&(this.executeCommand(t,!1),this.redoStack=[],this.notify(_i.CANCEL,t)),this}undoStackPush(t){var e,n,i,a;const{stackSize:s}=this.options;s!==0&&this.undoStack.length>=s&&this.undoStack.shift(),((n=(e=this.options).beforeAddCommand)===null||n===void 0?void 0:n.call(e,t,!0))!==!1&&(this.undoStack.push(t),(a=(i=this.options).afterAddCommand)===null||a===void 0||a.call(i,t,!0))}clear(){this.undoStack=[],this.redoStack=[],this.batchChanges=null,this.batchAnimation=!1,this.notify(_i.CLEAR,null)}notify(t,e){this.emitter.emit(t,{cmd:e}),this.emitter.emit(_i.CHANGE,{cmd:e})}on(t,e){this.emitter.on(t,e)}destroy(){const{graph:t}=this.context;t.off(X.AFTER_DRAW,this.addCommand),t.off(X.BATCH_START,this.initBatchCommand),t.off(X.BATCH_END,this.addCommand),this.emitter.off(),super.destroy(),this.undoStack=[],this.redoStack=[]}}Vh.defaultOptions={stackSize:0};function xc(r,t,e,n,i,a){const s=(a-t)*(e-r)-(n-t)*(i-r);return s>0?!0:!(s<0)}function kK(r,t){const e=r[0][0],n=r[0][1],i=r[1][0],a=r[1][1],s=t[0][0],o=t[0][1],l=t[1][0],c=t[1][1];return xc(e,n,s,o,l,c)!==xc(i,a,s,o,l,c)&&xc(e,n,i,a,s,o)!==xc(e,n,i,a,l,c)}var MK=kK;function uP(r,t){this._cells=[],this._cellSize=t,this._reverseCellSize=1/t;for(let e=0;e=2&&hP(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}return t.pop(),t}function PK(r){const t=r.reverse(),e=[];for(let n=0;n=2&&hP(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}return e.pop(),e}function NK(r){const t=AK(r),n=PK(r).concat(t);return n.push(r[0]),n}var RK=NK;const LK=MK,DK=TK,am=OK,IK=RK;function FK(r){const t=[r[0]];let e=r[0];for(let n=1;n=0;a--)r[a][0]n&&(n=r[a][0]),r[a][1]>i&&(i=r[a][1]);return[n-t,i-e]}function $K(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 jK(r,t,e){let n=null,i=K3,a=K3,s,o;for(let l=0;li&&o>a&&!X3([r[0],t[l]],e)&&!X3([r[1],t[l]],e)&&(i=s,a=o,n=t[l]);return n}function dP(r,t,e,n,i){let a=!1;for(let s=0;sh||e[1]>d));h>=e[0]&&d>=e[1]&&i.add(l),f!==null&&(r.splice(s+1,0,f),n.removePoint(f),a=!0)}return a?dP(r,t,e,n,i):r}function qK(r,t,e){let n=t||20;const i=FK(BK(am.toXy(r,e)));if(i.length<4){const h=i.concat([i[0]]);return e?am.fromXy(h,e):h}const a=zK(i),s=[a[0]*Z3,a[1]*Z3],o=IK(i),l=i.filter(function(h){return o.indexOf(h)<0}),c=Math.ceil(1/(i.length/(a[0]*a[1]))),u=dP(o,Math.pow(n,2),s,DK(l,c),new Set);return e?am.fromXy(u,e):u}const K3=Math.cos(90/(180/Math.PI)),Z3=.6;var GK=qK;const WK=Au(GK);function VK(r,t,e){if(r.length===1)return HK(r[0],t,e);if(r.length===2)return J3(r,t,e);if(r.length===3){const[n,i,a]=f1(r);if(cT(n,i,a))return J3([n,a],t,e)}switch(e){case"smooth":return YK(r,t);case"sharp":return XK(r,t);case"rounded":default:return UK(r,t)}}const HK=(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]]},J3=(r,t,e)=>{const n=[t,t,0,0,0],i=e==="sharp"?ft(r[0],Pi(ti($t(r[0],r[1])),t)):r[0],a=e==="sharp"?ft(r[1],Pi(ti($t(r[1],r[0])),t)):r[1],s=Pi(ti(zu($t(i,a),!1)),t),o=Pi(s,-1),l=ft(i,s),c=ft(a,s),u=ft(a,o),h=ft(i,o);return e==="sharp"?[["M",l[0],l[1]],["L",c[0],c[1]],["L",u[0],u[1]],["L",h[0],h[1]],["Z"]]:[["M",l[0],l[1]],["L",c[0],c[1]],["A",...n,u[0],u[1]],["L",h[0],h[1]],["A",...n,l[0],l[1]]]},UK=(r,t)=>{const e=f1(r).map((o,l)=>{const c=(l-2+r.length)%r.length,u=(l-1+r.length)%r.length,h=(l+1)%r.length,d=r[c],f=r[u],g=r[h],v=$t(d,f),p=$t(f,o),m=$t(o,g),y=(E,_)=>h1(E,_,!0)Pi(ti(zu(E,!1)),t),S=x(p);return[{p:za(b?ft(f,x(v)):ft(f,S)),concave:b&&f},{p:za(w?ft(o,x(m)):ft(o,S)),concave:w&&o}]}),n=[t,t,0,0,0],i=e.findIndex((o,l)=>!e[(l-1+e.length)%e.length][0].concave&&!e[(l-1+e.length)%e.length][1].concave&&!o[0].concave&&!o[0].concave&&!o[1].concave),a=e.slice(i).concat(e.slice(0,i));let s=[];return a.flatMap((o,l)=>{const c=[],u=a[e.length-1];return l===0&&c.push(["M",...u[1].p]),o[0].concave?s.push(o[0].p,o[1].p):c.push(["A",...n,...o[0].p]),o[1].concave?s.unshift(o[1].p):c.push(["L",...o[1].p]),s.length===3&&(c.pop(),c.push(["C",...s.flat()]),s=[]),c})},YK=(r,t)=>{const e=f1(r).map((n,i)=>{const a=r[(i+1)%r.length];return{p:n,v:ti($t(a,n))}});return e.forEach((n,i)=>{const a=i>0?i-1:r.length-1,s=e[a].v,o=ti(ft(s,Pi(n.v,h1(s,n.v,!0)n.p))},XK=(r,t)=>{const n=r.map((a,s)=>{const o=r[s===0?r.length-1:s-1],l=Ro(Pi(ti(zu($t(o,a),!1)),t));return[ft(o,l),ft(a,l)]}).flat();return n.map((a,s)=>{if(s%2===0)return null;const o=[n[(s-1)%n.length],n[s%n.length]],l=[n[(s+1)%n.length],n[(s+2)%n.length]];return d1(o,l,!0)}).filter(Boolean).map((a,s)=>[s===0?"M":"L",a[0],a[1]]).concat([["Z"]])};var KK=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{if(!this.shape)this.shape=new el({style:this.getHullStyle()}),this.context.canvas.appendChild(this.shape);else{const n=!ue(this.optionsCache,this.options);this.shape.update(this.getHullStyle(n))}this.optionsCache=Object.assign({},this.options)},this.updateHullPath=n=>{this.shape&&this.options.members.includes(F(n.data))&&this.shape.update({d:this.getHullPath(!0)})},this.getHullPath=(n=!1)=>{const{graph:i}=this.context,a=this.getMember();if(a.length===0)return"";const s=a.map(c=>i.getNodeData(c)),o=WK(s.map(ye),this.options.concavity).slice(1).reverse(),l=o.flatMap(c=>s.filter(u=>ue(ye(u),c)).map(F));return ue(l,this.hullMemberIds)&&!n?this.path:(this.hullMemberIds=l,this.path=VK(o,this.getPadding(),this.options.corner),this.path)},this.bindEvents()}bindEvents(){this.context.graph.on(X.AFTER_RENDER,this.drawHull),this.context.graph.on(X.AFTER_ELEMENT_UPDATE,this.updateHullPath)}getHullStyle(t){const e=this.options,{members:n,padding:i,corner:a}=e,s=KK(e,["members","padding","corner"]);return Object.assign(Object.assign({},s),{d:this.getHullPath(t)})}getPadding(){const{graph:t}=this.context;return this.hullMemberIds.reduce((n,i)=>{const{halfExtents:a}=t.getElementRenderBounds(i),s=Math.max(a[0],a[1]);return Math.max(n,s)},0)+this.options.padding}addMember(t){const e=Array.isArray(t)?t:[t];this.options.members=[...new Set([...this.options.members,...e])],this.shape.update({d:this.getHullPath()})}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter(n=>!e.includes(n)),e.some(n=>this.hullMemberIds.includes(n))&&this.shape.update({d:this.getHullPath()})}updateMember(t){this.options.members=at(t)?t(this.options.members):t,this.shape.update(this.getHullStyle(!0))}getMember(){return this.options.members}destroy(){this.context.graph.off(X.AFTER_DRAW,this.drawHull),this.shape.destroy(),this.hullMemberIds=[],super.destroy()}}Hh.defaultOptions={members:[],padding:10,corner:"rounded",concavity:1/0,fill:"lightblue",fillOpacity:.2,labelOpacity:1,stroke:"blue",strokeOpacity:.2};function fP(r,t){t(r),r.children&&r.children.forEach(function(e){e&&fP(e,t)})}function dl(r){Uh(r,!0)}function or(r){Uh(r,!1)}function Uh(r,t){var e=t?"visible":"hidden";fP(r,function(n){n.attr("visibility",e)})}var ZK=function(r){wt(t,r);function t(){for(var e=[],n=0;n=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom},r}();function Un(r,t){return at(r)?r.apply(void 0,Q([],N(t),!1)):r}var fr=function(r,t){var e=function(i){return"".concat(t,"-").concat(i)},n=Object.fromEntries(Object.entries(r).map(function(i){var a=N(i,2),s=a[0],o=a[1],l=e(o);return[s,{name:l,class:".".concat(l),id:"#".concat(l),toString:function(){return l}}]}));return Object.assign(n,{prefix:e}),n},QK=5,pP=function(r,t,e,n){e===void 0&&(e=0),n===void 0&&(n=QK),Object.entries(t).forEach(function(i){var a=N(i,2),s=a[0],o=a[1],l=r;Object.prototype.hasOwnProperty.call(t,s)&&(o?Cs(o)?(Cs(r[s])||(l[s]={}),et&&r="A"&&e<="Z"};function ht(r,t,e){e===void 0&&(e=!1);var n={};return Object.entries(r).forEach(function(i){var a=N(i,2),s=a[0],o=a[1];if(!(s==="className"||s==="class")){if(Sc(s,"show")&&Sc(ik(s,"show"),t)!==e)s===wZ(t,"show")?n[s]=o:n[s.replace(new RegExp(i2(t)),"")]=o;else if(!Sc(s,"show")&&Sc(s,t)!==e){var l=ik(s,t);l==="filter"&&typeof o=="function"||(n[l]=o)}}}),n}function gs(r,t){return Object.entries(r).reduce(function(e,n){var i=N(n,2),a=i[0],s=i[1];return a.startsWith("show")?e["show".concat(t).concat(a.slice(4))]=s:e["".concat(t).concat(i2(a))]=s,e},{})}function oi(r,t){t===void 0&&(t=["x","y","class","className"]);var e=["transform","transformOrigin","anchor","visibility","pointerEvents","zIndex","cursor","clipPath","clipPathTargets","offsetPath","offsetPathTargets","offsetDistance","draggable","droppable"],n={},i={};return Object.entries(r).forEach(function(a){var s=N(a,2),o=s[0],l=s[1];t.includes(o)||(e.indexOf(o)!==-1?i[o]=l:n[o]=l)}),[n,i]}function hn(r,t){var e={YYYY:r.getFullYear(),MM:r.getMonth()+1,DD:r.getDate(),HH:r.getHours(),mm:r.getMinutes(),ss:r.getSeconds()},n=t;return Object.keys(e).forEach(function(i){var a=e[i];n=n.replace(i,i==="YYYY"?"".concat(a):"".concat(a).padStart(2,"0"))}),n}function EZ(r,t,e){var n=r.getBBox(),i=n.width,a=n.height,s=N([t,e].map(function(c,u){var h;return c.includes("%")?parseFloat(((h=c.match(/[+-]?([0-9]*[.])?[0-9]+/))===null||h===void 0?void 0:h[0])||"0")/100*(u===0?i:a):c}),2),o=s[0],l=s[1];return[o,l]}function EP(r,t){if(t)try{var e=/translate\(([+-]*[\d]+[%]*),[ ]*([+-]*[\d]+[%]*)\)/g,n=t.replace(e,function(i,a,s){return"translate(".concat(EZ(r,a,s),")")});r.attr("transform",n)}catch{}}function SZ(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 ak=function(r,t){if(t==null){r.innerHTML="";return}r.replaceChildren?Array.isArray(t)?r.replaceChildren.apply(r,Q([],N(t),!1)):r.replaceChildren(t):(r.innerHTML="",Array.isArray(t)?t.forEach(function(e){return r.appendChild(e)}):r.appendChild(t))};function _Z(){Uh(this,this.attributes.visibility!=="hidden")}var ge=function(r){wt(t,r);function t(e,n){n===void 0&&(n={});var i=r.call(this,ze({},{style:n},e))||this;return i.initialized=!1,i._defaultOptions=n,i}return Object.defineProperty(t.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=gP(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"&&_Z.call(this)},t.prototype.update=function(e,n){var i;return this.attr(ze({},this.attributes,e||{})),(i=this.render)===null||i===void 0?void 0:i.call(this,this.attributes,this,n)},t.prototype.clear=function(){this.removeChildren()},t.prototype.bindEvents=function(e,n){},t.prototype.getSubShapeStyle=function(e){e.x,e.y,e.transform,e.transformOrigin,e.class,e.className,e.zIndex;var n=fe(e,["x","y","transform","transformOrigin","class","className","zIndex"]);return n},t}(n1),SP=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"]]},kZ=SP,MZ=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"]]},CZ=function(r,t,e){return[["M",r-e,t],["L",r,t-e],["L",r+e,t],["L",r,t+e],["Z"]]},TZ=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"]]},OZ=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"]]},AZ=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"]]},PZ=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"]]},_P=function(r,t,e){return[["M",r,t+e],["L",r,t-e]]},NZ=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]]},RZ=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]]},LZ=function(r,t,e){return[["M",r-e,t],["L",r+e,t],["M",r,t-e],["L",r,t+e]]},DZ=function(r,t,e){return[["M",r-e,t],["L",r+e,t]]},kP=function(r,t,e){return[["M",r-e,t],["L",r+e,t]]},IZ=kP,FZ=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]]},BZ=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]]},zZ=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]]},$Z=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 jZ(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 qZ=function(r,t,e){return[["M",r-e,t-e],["L",r+e,t],["L",r-e,t+e],["Z"]]};function GZ(r){var t="default";if(me(r)&&r instanceof Image)t="image";else if(at(r))t="symbol";else if(Tt(r)){var e=new RegExp("data:(image|text)");r.match(e)?t="base64":/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(r)?t="url":t="symbol"}return t}function WZ(r){var t=GZ(r);return["base64","url","image"].includes(t)?"image":r&&t==="symbol"?"path":null}var qt=function(r){wt(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s,l=this.getSubShapeStyle(e),c=l.symbol,u=l.size,h=u===void 0?16:u,d=fe(l,["symbol","size"]),f=WZ(c);Rn(!!f,st(n),function(g){g.maybeAppendByClassName("marker",f).attr("className","marker ".concat(f,"-marker")).call(function(v){if(f==="image"){var p=h*2;v.styles({img:c,width:p,height:p,x:a-h,y:o-h})}else{var p=h/2,m=at(c)?c:t.getSymbol(c);v.styles(q({d:m==null?void 0:m(a,o,p)},d))}})})},t.MARKER_SYMBOL_MAP=new Map,t.registerSymbol=function(e,n){t.MARKER_SYMBOL_MAP.set(e,n)},t.getSymbol=function(e){return t.MARKER_SYMBOL_MAP.get(e)},t.getSymbols=function(){return Array.from(t.MARKER_SYMBOL_MAP.keys())},t}(ge);qt.registerSymbol("cross",NZ);qt.registerSymbol("hyphen",DZ);qt.registerSymbol("line",_P);qt.registerSymbol("plus",LZ);qt.registerSymbol("tick",RZ);qt.registerSymbol("circle",SP);qt.registerSymbol("point",kZ);qt.registerSymbol("bowtie",PZ);qt.registerSymbol("hexagon",AZ);qt.registerSymbol("square",MZ);qt.registerSymbol("diamond",CZ);qt.registerSymbol("triangle",TZ);qt.registerSymbol("triangle-down",OZ);qt.registerSymbol("line",_P);qt.registerSymbol("dot",kP);qt.registerSymbol("dash",IZ);qt.registerSymbol("smooth",FZ);qt.registerSymbol("hv",BZ);qt.registerSymbol("vh",zZ);qt.registerSymbol("hvh",$Z);qt.registerSymbol("vhv",jZ);function _u(r,...t){return t.reduce((e,n)=>i=>e(n(i)),r)}function _y(r,t){return t-r?e=>(e-r)/(t-r):e=>.5}function VZ(r,t){const e=tt?r:t;return i=>Math.min(Math.max(e,i),n)}function HZ(r,t,e,n,i){let a=e,s=n||r.length;const o=l=>l;for(;at?s=l:a=l+1}return a}const sk=Math.sqrt(50),ok=Math.sqrt(10),lk=Math.sqrt(2);function Bc(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>=sk?10:a>=ok?5:a>=lk?2:1)*10**i:-(10**-i)/(a>=sk?10:a>=ok?5:a>=lk?2:1)}const UZ=(r,t,e=5)=>{const n=[r,t];let i=0,a=n.length-1,s=n[i],o=n[a],l;return o0?(s=Math.floor(s/l)*l,o=Math.ceil(o/l)*l,l=Bc(s,o,e)):l<0&&(s=Math.ceil(s*l)/l,o=Math.floor(o*l)/l,l=Bc(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 ck(r){return!ut(r)&&!n6(r)&&!Number.isNaN(r)}var MP={exports:{}},YZ={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]},CP={exports:{}},XZ=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")},KZ=XZ,ZZ=Array.prototype.concat,JZ=Array.prototype.slice,uk=CP.exports=function(t){for(var e=[],n=0,i=t.length;n=4&&r[3]!==1&&(t=", "+r[3]),"hwb("+r[0]+", "+r[1]+"%, "+r[2]+"%"+t+")"};An.to.keyword=function(r){return OP[r.slice(0,3)]};function qi(r,t,e){return Math.min(Math.max(t,r),e)}function _c(r){var t=Math.round(r).toString(16).toUpperCase();return t.length<2?"0"+t:t}var tJ=MP.exports;const eJ=Au(tJ);function lm(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 nJ(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=lm(s,a,t+1/3),l=lm(s,a,t),c=lm(s,a,t-1/3);return[o*255,l*255,c*255,i]}function hk(r){const t=eJ.get(r);if(!t)return null;const{model:e,value:n}=t;return e==="rgb"?n:e==="hsl"?nJ(n):null}const ku=(r,t)=>e=>r*(1-e)+t*e,rJ=(r,t)=>{const e=hk(r),n=hk(t);return e===null||n===null?e?()=>r:()=>t:i=>{const a=new Array(4);for(let u=0;u<4;u+=1){const h=e[u],d=n[u];a[u]=h*(1-i)+d*i}const[s,o,l,c]=a;return`rgba(${Math.round(s)}, ${Math.round(o)}, ${Math.round(l)}, ${c})`}},iJ=(r,t)=>typeof r=="number"&&typeof t=="number"?ku(r,t):typeof r=="string"&&typeof t=="string"?rJ(r,t):()=>r,aJ=(r,t)=>{const e=ku(r,t);return n=>Math.round(e(n))};function dk({map:r,initKey:t},e){const n=t(e);return r.has(n)?r.get(n):e}function sJ({map:r,initKey:t},e){const n=t(e);return r.has(n)?r.get(n):(r.set(n,e),e)}function oJ({map:r,initKey:t},e){const n=t(e);return r.has(n)&&(e=r.get(n),r.delete(n)),e}function lJ(r){return typeof r=="object"?r.valueOf():r}class fk extends Map{constructor(t){if(super(),this.map=new Map,this.initKey=lJ,t!==null)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(dk({map:this.map,initKey:this.initKey},t))}has(t){return super.has(dk({map:this.map,initKey:this.initKey},t))}set(t,e){return super.set(sJ({map:this.map,initKey:this.initKey},t),e)}delete(t){return super.delete(oJ({map:this.map,initKey:this.initKey},t))}}class AP{constructor(t){this.options=on({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=on({},this.options,t),this.rescale(t)}rescale(t){}}const a2=Symbol("defaultUnknown");function gk(r,t,e){for(let n=0;n`${t}`:typeof r=="object"?t=>JSON.stringify(t):t=>t}class s2 extends AP{getDefaultOptions(){return{domain:[],range:[],unknown:a2}}constructor(t){super(t)}map(t){return this.domainIndexMap.size===0&&gk(this.domainIndexMap,this.getDomain(),this.domainKey),vk({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return this.rangeIndexMap.size===0&&gk(this.rangeIndexMap,this.getRange(),this.rangeKey),vk({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=pk(e),this.rangeKey=pk(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 s2(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 cJ(r){const t=Math.min(...r);return r.map(e=>e/t)}function uJ(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 hJ(r){return Math.round(r*1e12)/1e12}function dJ(r){const{domain:t,range:e,paddingOuter:n,paddingInner:i,flex:a,round:s,align:o}=r,l=t.length,c=uJ(a,l),[u,h]=e,d=h-u,f=2/l*n+1-1/l*i,g=d/f,v=g*i/l,p=g-l*v,m=cJ(c),y=m.reduce((T,O)=>T+O),b=p/y,w=new fk(t.map((T,O)=>{const R=m[O]*b;return[T,s?Math.floor(R):R]})),x=new fk(t.map((T,O)=>{const L=m[O]*b+v;return[T,s?Math.floor(L):L]})),S=Array.from(x.values()).reduce((T,O)=>T+O),_=(d-(S-S/l*i))*o,C=u+_;let k=s?Math.round(C):C;const M=new Array(l);for(let T=0;Td+b*u);return{valueStep:u,valueBandWidth:h,adjustedRange:m}}class o2 extends s2{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:a2,flex:[]}}constructor(t){super(t)}clone(){return new o2(this.options)}getStep(t){return this.valueStep===void 0?1:typeof this.valueStep=="number"?this.valueStep:t===void 0?Array.from(this.valueStep.values())[0]:this.valueStep.get(t)}getBandWidth(t){return this.valueBandWidth===void 0?1:typeof this.valueBandWidth=="number"?this.valueBandWidth:t===void 0?Array.from(this.valueBandWidth.values())[0]:this.valueBandWidth.get(t)}getRange(){return this.adjustedRange}getPaddingInner(){const{padding:t,paddingInner:e}=this.options;return t>0?t:e}getPaddingOuter(){const{padding:t,paddingOuter:e}=this.options;return t>0?t:e}rescale(){super.rescale();const{align:t,domain:e,range:n,round:i,flex:a}=this.options,{adjustedRange:s,valueBandWidth:o,valueStep:l}=fJ({align:t,range:n,round:i,flex:a,paddingInner:this.getPaddingInner(),paddingOuter:this.getPaddingOuter(),domain:e});this.valueStep=l,this.valueBandWidth=o,this.adjustedRange=s}}const gJ=(r,t,e)=>{let n,i,a=r,s=t;if(a===s&&e>0)return[a];let o=Bc(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{const[n,i]=r,[a,s]=t;let o,l;return n{const n=Math.min(r.length,t.length)-1,i=new Array(n),a=new Array(n),s=r[0]>r[n],o=s?[...r].reverse():r,l=s?[...t].reverse():t;for(let c=0;c{const u=HZ(r,c,1,n)-1,h=i[u],d=a[u];return _u(d,h)(c)}},mk=(r,t,e,n)=>(Math.min(r.length,t.length)>2?pJ:vJ)(r,t,n?aJ:e);class mJ extends AP{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:ku,tickCount:5}}map(t){return ck(t)?this.output(t):this.options.unknown}invert(t){return ck(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 UZ}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?VZ(i[0],i[a-1]):Mm}composeOutput(t,e){const{domain:n,range:i,round:a,interpolate:s}=this.options,o=mk(n.map(t),i,s,a);this.output=_u(o,e,t)}composeInput(t,e,n){const{domain:i,range:a}=this.options,s=mk(a,i.map(t),ku);this.input=_u(e,n,s)}}class ko extends mJ{getDefaultOptions(){return{domain:[0,1],range:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolate:iJ,tickMethod:gJ,tickCount:5}}chooseTransforms(){return[Mm,Mm]}clone(){return new ko(this.options)}}var yJ=function(r){wt(t,r);function t(e){var n=this,i=e.style,a=fe(e,["style"]);return n=r.call(this,on({},{type:"column"},q({style:i},a)))||this,n.columnsGroup=new Pe({name:"columns"}),n.appendChild(n.columnsGroup),n.render(),n}return t.prototype.render=function(){var e=this.attributes,n=e.columns,i=e.x,a=e.y;this.columnsGroup.style.transform="translate(".concat(i,", ").concat(a,")"),st(this.columnsGroup).selectAll(".column").data(n.flat()).join(function(s){return s.append("rect").attr("className","column").each(function(o){this.attr(o)})},function(s){return s.each(function(o){this.attr(o)})},function(s){return s.remove()})},t.prototype.update=function(e){this.attr(ze({},this.attributes,e)),this.render()},t.prototype.clear=function(){this.removeChildren()},t}(Zt),bJ=function(r){wt(t,r);function t(e){var n=this,i=e.style,a=fe(e,["style"]);return n=r.call(this,on({},{type:"lines"},q({style:i},a)))||this,n.linesGroup=n.appendChild(new Pe),n.areasGroup=n.appendChild(new Pe),n.render(),n}return t.prototype.render=function(){var e=this.attributes,n=e.lines,i=e.areas,a=e.x,s=e.y;this.style.transform="translate(".concat(a,", ").concat(s,")"),n&&this.renderLines(n),i&&this.renderAreas(i)},t.prototype.clear=function(){this.linesGroup.removeChildren(),this.areasGroup.removeChildren()},t.prototype.update=function(e){this.attr(ze({},this.attributes,e)),this.render()},t.prototype.renderLines=function(e){st(this.linesGroup).selectAll(".line").data(e).join(function(n){return n.append("path").attr("className","line").each(function(i){this.attr(i)})},function(n){return n.each(function(i){this.attr(i)})},function(n){return n.remove()})},t.prototype.renderAreas=function(e){st(this.linesGroup).selectAll(".area").data(e).join(function(n){return n.append("path").attr("className","area").each(function(i){this.attr(i)})},function(n){return n.each(function(i){this.style(i)})},function(n){return n.remove()})},t}(Zt);function wJ(r,t){var e,n=t.x,i=t.y,a=N(i.getOptions().range||[0,0],2),s=a[0],o=a[1];return o>s&&(e=N([s,o],2),o=e[0],s=e[1]),r.map(function(l){var c=l.map(function(u,h){return[n.map(h),ce(i.map(u),o,s)]});return c})}function $o(r,t){t===void 0&&(t=!1);var e=t?r.length-1:0,n=r.map(function(i,a){return Q([a===e?"M":"L"],N(i),!1)});return t?n.reverse():n}function Mu(r,t){if(t===void 0&&(t=!1),r.length<=2)return $o(r);for(var e=[],n=r.length,i=0;i=0;i-=1){var a=r[i],s=$o(a),o=void 0;if(i===0)o=l2(s,t,e);else{var l=r[i-1],c=$o(l,!0);c[0][0]="L",o=Q(Q(Q([],N(s),!1),N(c),!1),[["Z"]],!1)}n.push(o)}return n}function SJ(r,t,e){for(var n=[],i=r.length-1;i>=0;i-=1){var a=r[i],s=Mu(a),o=void 0;if(i===0)o=l2(s,t,e);else{var l=r[i-1],c=Mu(l,!0),u=a[0];c[0][0]="L",o=Q(Q(Q([],N(s),!1),N(c),!1),[Q(["M"],N(u),!1),["Z"]],!1)}n.push(o)}return n}function yk(r){return r.length===0?[0,0]:[Uc(KL(r,function(t){return Uc(t)||0})),Hc(XL(r,function(t){return Hc(t)||0}))]}function bk(r){for(var t=Vi(r),e=t[0].length,n=N([Array(e).fill(0),Array(e).fill(0)],2),i=n[0],a=n[1],s=0;s=0?(o[l]+=i[l],i[l]=o[l]):(o[l]+=a[l],a[l]=o[l]);return t}var _J=function(r){wt(t,r);function t(e){return r.call(this,e,{type:"line",x:0,y:0,width:200,height:20,isStack:!1,color:["#83daad","#edbf45","#d2cef9","#e290b3","#6f63f4"],smooth:!0,lineLineWidth:1,areaOpacity:0,isGroup:!1,columnLineWidth:1,columnStroke:"#fff",scale:1,spacing:0})||this}return Object.defineProperty(t.prototype,"rawData",{get:function(){var e=this.attributes.data;if(!e||(e==null?void 0:e.length)===0)return[[]];var n=Vi(e);return nt(n[0])?[n]:n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this.attributes.isStack?bk(this.rawData):this.rawData},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scales",{get:function(){return this.createScales(this.data)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"baseline",{get:function(){var e=this.scales.y,n=N(e.getOptions().domain||[0,0],2),i=n[0],a=n[1];return a<0?e.map(a):e.map(i<0?0:i)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"containerShape",{get:function(){var e=this.attributes,n=e.width,i=e.height;return{width:n,height:i}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linesStyle",{get:function(){var e=this,n=this.attributes,i=n.type,a=n.isStack,s=n.smooth;if(i!=="line")throw new Error("linesStyle can only be used in line type");var o=ht(this.attributes,"area"),l=ht(this.attributes,"line"),c=this.containerShape.width,u=this.data;if(u[0].length===0)return{lines:[],areas:[]};var h=this.scales,d=h.x,f=h.y,g=wJ(u,{x:d,y:f}),v=[];if(o){var p=this.baseline;a?v=s?SJ(g,c,p):EJ(g,c,p):v=xJ(g,s,c,p)}return{lines:g.map(function(m,y){return q({stroke:e.getColor(y),d:s?Mu(m):$o(m)},l)}),areas:v.map(function(m,y){return q({d:m,fill:e.getColor(y)},o)})}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"columnsStyle",{get:function(){var e=this,n=ht(this.attributes,"column"),i=this.attributes,a=i.isStack,s=i.type,o=i.scale;if(s!=="column")throw new Error("columnsStyle can only be used in column type");var l=this.containerShape.height,c=this.rawData;if(!c)return{columns:[]};a&&(c=bk(c));var u=this.createScales(c),h=u.x,d=u.y,f=N(yk(c),2),g=f[0],v=f[1],p=new ko({domain:[0,v-(g>0?0:g)],range:[0,l*o]}),m=h.getBandWidth(),y=this.rawData;return{columns:c.map(function(b,w){return b.map(function(x,S){var E=m/c.length,_=function(){return{x:h.map(S)+E*w,y:x>=0?d.map(x):d.map(0),width:E,height:p.map(Math.abs(x))}},C=function(){return{x:h.map(S),y:d.map(x),width:m,height:p.map(y[w][S])}};return q(q({fill:e.getColor(w)},n),a?C():_())})})}},enumerable:!1,configurable:!0}),t.prototype.render=function(e,n){pZ(n,".container","rect").attr("className","container").node();var i=e.type,a=e.x,s=e.y,o="spark".concat(i),l=q({x:a,y:s},i==="line"?this.linesStyle:this.columnsStyle);st(n).selectAll(".spark").data([i]).join(function(c){return c.append(function(u){return u==="line"?new bJ({className:o,style:l}):new yJ({className:o,style:l})}).attr("className","spark ".concat(o))},function(c){return c.update(l)},function(c){return c.remove()})},t.prototype.getColor=function(e){var n=this.attributes.color;return Dn(n)?n[e%n.length]:at(n)?n.call(null,e):n},t.prototype.createScales=function(e){var n,i,a=this.attributes,s=a.type,o=a.scale,l=a.range,c=l===void 0?[]:l,u=a.spacing,h=this.containerShape,d=h.width,f=h.height,g=N(yk(e),2),v=g[0],p=g[1],m=new ko({domain:[(n=c[0])!==null&&n!==void 0?n:v,(i=c[1])!==null&&i!==void 0?i:p],range:[f,f*(1-o)]});return s==="line"?{type:s,x:new ko({domain:[0,e[0].length-1],range:[0,d]}),y:m}:{type:s,x:new o2({domain:e[0].map(function(y,b){return b}),range:[0,d],paddingInner:u,paddingOuter:u/2,align:.5}),y:m}},t.tag="sparkline",t}(ge);function kJ(r){return typeof r=="boolean"?!1:"enter"in r&&"update"in r&&"exit"in r}function wk(r){if(!r)return{enter:!1,update:!1,exit:!1};var t=["enter","update","exit"],e=Object.fromEntries(Object.entries(r).filter(function(n){var i=N(n,1),a=i[0];return!t.includes(a)}));return Object.fromEntries(t.map(function(n){return kJ(r)?r[n]===!1?[n,!1]:[n,q(q({},r[n]),e)]:[n,e]}))}function Ws(r,t){r?r.finished.then(t):t()}function MJ(r,t){r.length===0?t():Promise.all(r.map(function(e){return e==null?void 0:e.finished})).then(t)}function PP(r,t){"update"in r?r.update(t):r.attr(t)}function NP(r,t,e){if(t.length===0)return null;if(!e){var n=t.slice(-1)[0];return PP(r,{style:n}),null}return r.animate(t,e)}function CJ(r,t){return!(r.nodeName!=="text"||t.nodeName!=="text"||r.attributes.text!==t.attributes.text)}function TJ(r,t,e,n){if(n===void 0&&(n="destroy"),CJ(r,t))return r.remove(),[null];var i=function(){n==="destroy"?r.destroy():n==="hide"&&or(r),t.isVisible()&&dl(t)};if(!e)return i(),[null];var a=e.duration,s=a===void 0?0:a,o=e.delay,l=o===void 0?0:o,c=Math.ceil(+s/2),u=+s/4,h=N(r.getGeometryBounds().center,2),d=h[0],f=h[1],g=N(t.getGeometryBounds().center,2),v=g[0],p=g[1],m=N([(d+v)/2-d,(f+p)/2-f],2),y=m[0],b=m[1],w=r.style.opacity,x=w===void 0?1:w,S=t.style.opacity,E=S===void 0?1:S,_=r.style.transform||"",C=t.style.transform||"",k=r.animate([{opacity:x,transform:"translate(0, 0) ".concat(_)},{opacity:0,transform:"translate(".concat(y,", ").concat(b,") ").concat(_)}],q(q({fill:"both"},e),{duration:l+c+u})),M=t.animate([{opacity:0,transform:"translate(".concat(-y,", ").concat(-b,") ").concat(C),offset:.01},{opacity:E,transform:"translate(0, 0) ".concat(C)}],q(q({fill:"both"},e),{duration:c+u,delay:l+c-u}));return Ws(M,i),[k,M]}function lr(r,t,e){var n={},i={};return Object.entries(t).forEach(function(a){var s=N(a,2),o=s[0],l=s[1];if(!ot(l)){var c=r.style[o]||r.parsedStyle[o]||0;c!==l&&(n[o]=c,i[o]=l)}}),e?NP(r,[n,i],q({fill:"both"},e)):(PP(r,i),null)}function Yh(r,t){return r.style.opacity||(r.style.opacity=1),lr(r,{opacity:0},t)}var RP={fill:"#fff",lineWidth:1,radius:2,size:10,stroke:"#bfbfbf",strokeOpacity:1,zIndex:0},LP={fill:"#000",fillOpacity:.45,fontSize:12,textAlign:"center",textBaseline:"middle",zIndex:1},DP={x:0,y:0,orientation:"horizontal",showLabel:!0,type:"start"},mr=fr({foreground:"foreground",handle:"handle",selection:"selection",sparkline:"sparkline",sparklineGroup:"sparkline-group",track:"track",brushArea:"brush-area"},"slider"),Ci=fr({labelGroup:"label-group",label:"label",iconGroup:"icon-group",icon:"icon",iconRect:"icon-rect",iconLine:"icon-line"},"handle"),OJ=function(r){wt(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(e,n){var i=e.x,a=e.y,s=e.size,o=s===void 0?10:s,l=e.radius,c=l===void 0?o/4:l,u=e.orientation,h=fe(e,["x","y","size","radius","orientation"]),d=o,f=d*2.4,g=st(n).maybeAppendByClassName(Ci.iconRect,"rect").styles(q(q({},h),{width:d,height:f,radius:c,x:i-d/2,y:a-f/2,transformOrigin:"center"})),v=i+1/3*d-d/2,p=i+2/3*d-d/2,m=a+1/4*f-f/2,y=a+3/4*f-f/2;g.maybeAppendByClassName("".concat(Ci.iconLine,"-1"),"line").styles(q({x1:v,x2:v,y1:m,y2:y},h)),g.maybeAppendByClassName("".concat(Ci.iconLine,"-2"),"line").styles(q({x1:p,x2:p,y1:m,y2:y},h)),u==="vertical"&&(g.node().style.transform="rotate(90)")},t}(ge),AJ=function(r){wt(t,r);function t(e){return r.call(this,e,DP)||this}return t.prototype.renderLabel=function(e){var n=this,i=this.attributes,a=i.x,s=i.y,o=i.showLabel,l=ht(this.attributes,"label"),c=l.x,u=c===void 0?0:c,h=l.y,d=h===void 0?0:h,f=l.transform,g=l.transformOrigin,v=fe(l,["x","y","transform","transformOrigin"]),p=N(oi(v,[]),2),m=p[0],y=p[1],b=st(e).maybeAppendByClassName(Ci.labelGroup,"g").styles(y),w=q(q({},LP),m),x=w.text,S=fe(w,["text"]);Rn(!!o,b,function(E){n.label=E.maybeAppendByClassName(Ci.label,"text").styles(q(q({},S),{x:a+u,y:s+d,transform:f,transformOrigin:g,text:"".concat(x)})),n.label.on("mousedown",function(_){_.stopPropagation()}),n.label.on("touchstart",function(_){_.stopPropagation()})})},t.prototype.renderIcon=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.orientation,o=n.type,l=q(q({x:i,y:a,orientation:s},RP),ht(this.attributes,"icon")),c=this.attributes.iconShape,u=c===void 0?function(){return new OJ({style:l})}:c,h=st(e).maybeAppendByClassName(Ci.iconGroup,"g");h.selectAll(Ci.icon.class).data([u]).join(function(d){return d.append(typeof u=="string"?u:function(){return u(o)}).attr("className",Ci.icon.name)},function(d){return d.update(l)},function(d){return d.remove()})},t.prototype.render=function(e,n){this.renderIcon(n),this.renderLabel(n)},t}(ge),PJ=function(r){wt(t,r);function t(e){var n=r.call(this,e,q(q(q({x:0,y:0,animate:{duration:100,fill:"both"},brushable:!0,formatter:function(i){return i.toString()},handleSpacing:2,orientation:"horizontal",padding:0,autoFitLabel:!0,scrollable:!0,selectionFill:"#5B8FF9",selectionFillOpacity:.45,selectionZIndex:2,showHandle:!0,showLabel:!0,slidable:!0,trackFill:"#416180",trackLength:200,trackOpacity:.05,trackSize:20,trackZIndex:-1,values:[0,1],type:"range",selectionType:"select",handleIconOffset:0},gs(DP,"handle")),gs(RP,"handleIcon")),gs(LP,"handleLabel")))||this;return n.range=[0,1],n.onDragStart=function(i){return function(a){a.stopPropagation(),n.target=i,n.prevPos=n.getOrientVal(Q3(a));var s=n.availableSpace,o=s.x,l=s.y,c=n.getBBox(),u=c.x,h=c.y;n.selectionStartPos=n.getRatio(n.prevPos-n.getOrientVal([o,l])-n.getOrientVal([+u,+h])),n.selectionWidth=0,document.addEventListener("pointermove",n.onDragging),document.addEventListener("pointerup",n.onDragEnd)}},n.onDragging=function(i){var a=n.attributes,s=a.slidable,o=a.brushable,l=a.type;i.stopPropagation();var c=n.getOrientVal(Q3(i)),u=c-n.prevPos;if(u){var h=n.getRatio(u);switch(n.target){case"start":s&&n.setValuesOffset(h);break;case"end":s&&n.setValuesOffset(0,h);break;case"selection":s&&n.setValuesOffset(h,h);break;case"track":if(!o)return;n.selectionWidth+=h,l==="range"?n.innerSetValues([n.selectionStartPos,n.selectionStartPos+n.selectionWidth].sort(),!0):n.innerSetValues([0,n.selectionStartPos+n.selectionWidth],!0);break}n.prevPos=c}},n.onDragEnd=function(){document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointerup",n.onDragEnd),n.target="",n.updateHandlesPosition(!1)},n.onValueChange=function(i){var a=n.attributes,s=a.onChange,o=a.type,l=o==="range"?i:i[1],c=o==="range"?n.getValues():n.getValues()[1],u=new we("valuechange",{detail:{oldValue:l,value:c}});n.dispatchEvent(u),s==null||s(c)},n.selectionStartPos=0,n.selectionWidth=0,n.prevPos=0,n.target="",n}return Object.defineProperty(t.prototype,"values",{get:function(){return this.attributes.values},set:function(e){this.attributes.values=this.clampValues(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sparklineStyle",{get:function(){var e=this.attributes.orientation;if(e!=="horizontal")return null;var n=ht(this.attributes,"sparkline");return q(q({zIndex:0},this.availableSpace),n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shape",{get:function(){var e=this.attributes,n=e.trackLength,i=e.trackSize,a=N(this.getOrientVal([[n,i],[i,n]]),2),s=a[0],o=a[1];return{width:s,height:o}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"availableSpace",{get:function(){var e=this.attributes;e.x,e.y;var n=e.padding,i=N(Ve(n),4),a=i[0],s=i[1],o=i[2],l=i[3],c=this.shape,u=c.width,h=c.height;return{x:l,y:a,width:u-(l+s),height:h-(a+o)}},enumerable:!1,configurable:!0}),t.prototype.getValues=function(){return this.values},t.prototype.setValues=function(e,n){e===void 0&&(e=[0,0]),n===void 0&&(n=!1),this.attributes.values=e;var i=n===!1?!1:this.attributes.animate;this.updateSelectionArea(i),this.updateHandlesPosition(i)},t.prototype.updateSelectionArea=function(e){var n=this.calcSelectionArea();this.foregroundGroup.selectAll(mr.selection.class).each(function(i,a){lr(this,n[a],e)})},t.prototype.updateHandlesPosition=function(e){this.attributes.showHandle&&(this.startHandle&&lr(this.startHandle,this.getHandleStyle("start"),e),this.endHandle&&lr(this.endHandle,this.getHandleStyle("end"),e))},t.prototype.innerSetValues=function(e,n){e===void 0&&(e=[0,0]),n===void 0&&(n=!1);var i=this.values,a=this.clampValues(e);this.attributes.values=a,this.setValues(a),n&&this.onValueChange(i)},t.prototype.renderTrack=function(e){var n=this.attributes,i=n.x,a=n.y,s=ht(this.attributes,"track");this.trackShape=st(e).maybeAppendByClassName(mr.track,"rect").styles(q(q({x:i,y:a},this.shape),s))},t.prototype.renderBrushArea=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.brushable;this.brushArea=st(e).maybeAppendByClassName(mr.brushArea,"rect").styles(q({x:i,y:a,fill:"transparent",cursor:s?"crosshair":"default"},this.shape))},t.prototype.renderSparkline=function(e){var n=this,i=this.attributes,a=i.x,s=i.y,o=i.orientation,l=st(e).maybeAppendByClassName(mr.sparklineGroup,"g");Rn(o==="horizontal",l,function(c){var u=q(q({},n.sparklineStyle),{x:a,y:s});c.maybeAppendByClassName(mr.sparkline,function(){return new _J({style:u})}).update(u)})},t.prototype.renderHandles=function(){var e=this,n,i=this.attributes,a=i.showHandle,s=i.type,o=s==="range"?["start","end"]:["end"],l=a?o:[],c=this;(n=this.foregroundGroup)===null||n===void 0||n.selectAll(mr.handle.class).data(l.map(function(u){return{type:u}}),function(u){return u.type}).join(function(u){return u.append(function(h){var d=h.type;return new AJ({style:e.getHandleStyle(d)})}).each(function(h){var d=h.type;this.attr("class","".concat(mr.handle.name," ").concat(d,"-handle"));var f="".concat(d,"Handle");c[f]=this,this.addEventListener("pointerdown",c.onDragStart(d))})},function(u){return u.each(function(h){var d=h.type;this.update(c.getHandleStyle(d))})},function(u){return u.each(function(h){var d=h.type,f="".concat(d,"Handle");c[f]=void 0}).remove()})},t.prototype.renderSelection=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.type,o=n.selectionType;this.foregroundGroup=st(e).maybeAppendByClassName(mr.foreground,"g");var l=ht(this.attributes,"selection"),c=function(h){return h.style("visibility",function(d){return d.show?"visible":"hidden"}).style("cursor",function(d){return o==="select"?"grab":o==="invert"?"crosshair":"default"}).styles(q(q({},l),{transform:"translate(".concat(i,", ").concat(a,")")}))},u=this;this.foregroundGroup.selectAll(mr.selection.class).data(s==="value"?[]:this.calcSelectionArea().map(function(h,d){return{style:q({},h),index:d,show:o==="select"?d===1:d!==1}}),function(h){return h.index}).join(function(h){return h.append("rect").attr("className",mr.selection.name).call(c).each(function(d,f){var g=this;f===1?(u.selectionShape=st(this),this.on("pointerdown",function(v){g.attr("cursor","grabbing"),u.onDragStart("selection")(v)}),u.dispatchCustomEvent(this,"pointerenter","selectionMouseenter"),u.dispatchCustomEvent(this,"pointerleave","selectionMouseleave"),u.dispatchCustomEvent(this,"click","selectionClick"),this.addEventListener("pointerdown",function(){g.attr("cursor","grabbing")}),this.addEventListener("pointerup",function(){g.attr("cursor","pointer")}),this.addEventListener("pointerover",function(){g.attr("cursor","pointer")})):this.on("pointerdown",u.onDragStart("track"))})},function(h){return h.call(c)},function(h){return h.remove()}),this.updateSelectionArea(!1),this.renderHandles()},t.prototype.render=function(e,n){this.renderTrack(n),this.renderSparkline(n),this.renderBrushArea(n),this.renderSelection(n)},t.prototype.clampValues=function(e,n){var i;n===void 0&&(n=4);var a=N(this.range,2),s=a[0],o=a[1],l=N(this.getValues().map(function(p){return tk(p,n)}),2),c=l[0],u=l[1],h=Array.isArray(e)?e:[c,e??u],d=N((h||[c,u]).map(function(p){return tk(p,n)}),2),f=d[0],g=d[1];if(this.attributes.type==="value")return[0,ce(g,s,o)];f>g&&(i=N([g,f],2),f=i[0],g=i[1]);var v=g-f;return v>o-s?[s,o]:fo?u===o&&c===f?[f,o]:[o-v,o]:[f,g]},t.prototype.calcSelectionArea=function(e){var n=N(this.clampValues(e),2),i=n[0],a=n[1],s=this.availableSpace,o=s.x,l=s.y,c=s.width,u=s.height;return this.getOrientVal([[{y:l,height:u,x:o,width:i*c},{y:l,height:u,x:i*c+o,width:(a-i)*c},{y:l,height:u,x:a*c,width:(1-a)*c}],[{x:o,width:c,y:l,height:i*u},{x:o,width:c,y:i*u+l,height:(a-i)*u},{x:o,width:c,y:a*u,height:(1-a)*u}]])},t.prototype.calcHandlePosition=function(e){var n=this.attributes.handleIconOffset,i=this.availableSpace,a=i.x,s=i.y,o=i.width,l=i.height,c=N(this.clampValues(),2),u=c[0],h=c[1],d=e==="start"?-n:n,f=(e==="start"?u:h)*this.getOrientVal([o,l])+d;return{x:a+this.getOrientVal([f,o/2]),y:s+this.getOrientVal([l/2,f])}},t.prototype.inferTextStyle=function(e){var n=this.attributes.orientation;return n==="horizontal"?{}:e==="start"?{transformOrigin:"left center",transform:"rotate(90)",textAlign:"start"}:e==="end"?{transformOrigin:"right center",transform:"rotate(90)",textAlign:"end"}:{}},t.prototype.calcHandleText=function(e){var n,i=this.attributes,a=i.type,s=i.orientation,o=i.formatter,l=i.autoFitLabel,c=ht(this.attributes,"handle"),u=ht(c,"label"),h=c.spacing,d=this.getHandleSize(),f=this.clampValues(),g=e==="start"?f[0]:f[1],v=o(g),p=new e2({style:q(q(q({},u),this.inferTextStyle(e)),{text:v})}),m=p.getBBox(),y=m.width,b=m.height;if(p.destroy(),!l){if(a==="value")return{text:v,x:0,y:-b-h};var w=h+d+(s==="horizontal"?y/2:0);return n={text:v},n[s==="horizontal"?"x":"y"]=e==="start"?-w:w,n}var x=0,S=0,E=this.availableSpace,_=E.width,C=E.height,k=this.calcSelectionArea()[1],M=k.x,T=k.y,O=k.width,R=k.height,L=h+d;if(s==="horizontal"){var D=L+y/2;if(e==="start"){var P=M-L-y;x=P>0?-D:D}else{var A=_-M-O-L>y;x=A?D:-D}}else{var I=L,B=b+L;e==="start"?S=T-d>b?-B:I:S=C-(T+R)-d>b?B:-I}return{x,y:S,text:v}},t.prototype.getHandleLabelStyle=function(e){var n=ht(this.attributes,"handleLabel");return q(q(q({},n),this.calcHandleText(e)),this.inferTextStyle(e))},t.prototype.getHandleIconStyle=function(){var e=this.attributes.handleIconShape,n=ht(this.attributes,"handleIcon"),i=this.getOrientVal(["ew-resize","ns-resize"]),a=this.getHandleSize();return q({cursor:i,shape:e,size:a},n)},t.prototype.getHandleStyle=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.showLabel,o=n.showLabelOnInteraction,l=n.orientation,c=this.calcHandlePosition(e),u=c.x,h=c.y,d=this.calcHandleText(e),f=s;return!s&&o&&(this.target?f=!0:f=!1),q(q(q({},gs(this.getHandleIconStyle(),"icon")),gs(q(q({},this.getHandleLabelStyle(e)),d),"label")),{transform:"translate(".concat(u+i,", ").concat(h+a,")"),orientation:l,showLabel:f,type:e,zIndex:3})},t.prototype.getHandleSize=function(){var e=this.attributes,n=e.handleIconSize,i=e.width,a=e.height;return n||Math.floor((this.getOrientVal([+a,+i])+4)/2.4)},t.prototype.getOrientVal=function(e){var n=N(e,2),i=n[0],a=n[1],s=this.attributes.orientation;return s==="horizontal"?i:a},t.prototype.setValuesOffset=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var a=this.attributes.type,s=N(this.getValues(),2),o=s[0],l=s[1],c=a==="range"?e:0,u=[o+c,l+n].sort();i?this.setValues(u):this.innerSetValues(u,!0)},t.prototype.getRatio=function(e){var n=this.availableSpace,i=n.width,a=n.height;return e/this.getOrientVal([i,a])},t.prototype.dispatchCustomEvent=function(e,n,i){var a=this;e.on(n,function(s){s.stopPropagation(),a.dispatchEvent(new we(i,{detail:s}))})},t.prototype.bindEvents=function(){this.addEventListener("wheel",this.onScroll);var e=this.brushArea;this.dispatchCustomEvent(e,"click","trackClick"),this.dispatchCustomEvent(e,"pointerenter","trackMouseenter"),this.dispatchCustomEvent(e,"pointerleave","trackMouseleave"),e.on("pointerdown",this.onDragStart("track"))},t.prototype.onScroll=function(e){var n=this.attributes.scrollable;if(n){var i=e.deltaX,a=e.deltaY,s=a||i,o=this.getRatio(s);this.setValuesOffset(o,o,!0)}},t.tag="slider",t}(ge),c2={data:[],animate:{enter:!1,update:{duration:100,easing:"ease-in-out-sine",fill:"both"},exit:{duration:100,fill:"both"}},showArrow:!0,showGrid:!0,showLabel:!0,showLine:!0,showTick:!0,showTitle:!0,showTrunc:!1,dataThreshold:100,lineLineWidth:1,lineStroke:"black",crossPadding:10,titleFill:"black",titleFontSize:12,titlePosition:"lb",titleSpacing:0,titleTextAlign:"center",titleTextBaseline:"middle",lineArrow:function(){return new Tn({style:{d:[["M",10,10],["L",-10,0],["L",10,-10],["L",0,0],["L",10,10],["Z"]],fill:"black",transformOrigin:"center"}})},labelAlign:"parallel",labelDirection:"positive",labelFontSize:12,labelSpacing:0,gridConnect:"line",gridControlAngles:[],gridDirection:"positive",gridLength:0,gridType:"segment",lineArrowOffset:15,lineArrowSize:10,tickDirection:"positive",tickLength:5,tickLineWidth:1,tickStroke:"black",labelOverlap:[]};on({},c2,{style:{type:"arc"}});on({},c2,{style:{}});var zt=fr({mainGroup:"main-group",gridGroup:"grid-group",grid:"grid",lineGroup:"line-group",line:"line",tickGroup:"tick-group",tick:"tick",tickItem:"tick-item",labelGroup:"label-group",label:"label",labelItem:"label-item",titleGroup:"title-group",title:"title",lineFirst:"line-first",lineSecond:"line-second"},"axis"),Ns=fr({lineGroup:"line-group",line:"line",regionGroup:"region-group",region:"region"},"grid");function IP(r){return r.reduce(function(t,e,n){return t.push(Q([n===0?"M":"L"],N(e),!1)),t},[])}function NJ(r,t,e){var n=t.connect,i=n===void 0?"line":n,a=t.center;if(i==="line")return IP(r);if(!a)return[];var s=zo(r[0],a),o=e?0:1;return r.reduce(function(l,c,u){return u===0?l.push(Q(["M"],N(c),!1)):l.push(Q(["A",s,s,0,0,o],N(c),!1)),l},[])}function ky(r,t,e){return t.type==="surround"?NJ(r,t,e):IP(r)}function RJ(r,t,e){var n=e.type,i=e.connect,a=e.center,s=e.closed,o=s?[["Z"]]:[],l=N([ky(r,e),ky(t.slice().reverse(),e,!0)],2),c=l[0],u=l[1],h=N([r[0],t.slice(-1)[0]],2),d=h[0],f=h[1],g=function(y,b){return[c,y,u,b,o].flat()};if(i==="line"||n==="surround")return g([Q(["L"],N(f),!1)],[Q(["L"],N(d),!1)]);if(!a)throw new Error("Arc grid need to specified center");var v=N([zo(f,a),zo(d,a)],2),p=v[0],m=v[1];return g([Q(["A",p,p,0,0,1],N(f),!1),Q(["L"],N(f),!1)],[Q(["A",m,m,0,0,0],N(d),!1),Q(["L"],N(d),!1)])}function LJ(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:ky(o.points,e)}});return r.selectAll(Ns.line.class).data(s,function(o){return o.id}).join(function(o){return o.append("path").each(function(l,c){var u=Un(nk(q({d:l.d},n)),[l,c,s]);this.attr(q({class:Ns.line.name,stroke:"#D9D9D9",lineWidth:1,lineDash:[4,4],isBillboard:a},u))})},function(o){return o.transition(function(l,c){var u=Un(nk(q({d:l.d},n)),[l,c,s]);return lr(this,u,i.update)})},function(o){return o.transition(function(){var l=this,c=Yh(this,i.exit);return Ws(c,function(){return l.remove()}),c})}).transitions()}function DJ(r,t,e){var n=e.animate,i=e.connect,a=e.areaFill;if(t.length<2||!a||!i)return[];for(var s=Array.isArray(a)?a:[a,"transparent"],o=function(g){return s[g%s.length]},l=[],c=0;c180?1:0,_=r>t?0:1;return"M".concat(g,",").concat(v,",A").concat(o,",").concat(l,",0,").concat(E,",").concat(_,",").concat(m,",").concat(y)}function $J(r){var t=r.attributes,e=t.startAngle,n=t.endAngle,i=t.center,a=t.radius;return Q(Q([e,n],N(i),!1),[a],!1)}function jJ(r,t,e,n){var i=t.startAngle,a=t.endAngle,s=t.center,o=t.radius;return r.selectAll(zt.line.class).data([{d:xk.apply(void 0,Q(Q([i,a],N(s),!1),[o],!1))}],function(l,c){return c}).join(function(l){return l.append("path").attr("className",zt.line.name).styles(t).styles({d:function(c){return c.d}})},function(l){return l.transition(function(){var c=this,u=sZ(this,$J(this),Q(Q([i,a],N(s),!1),[o],!1),n.update);if(u){var h=function(){var d=nn(c.attributes,"__keyframe_data__");c.style.d=xk.apply(void 0,Q([],N(d),!1))};u.onframe=h,u.onfinish=h}return u}).styles(t)},function(l){return l.remove()}).styles(e).transitions()}function qJ(r,t){t.truncRange,t.truncShape,t.lineExtension}function GJ(r,t,e){e===void 0&&(e=[0,0]);var n=N([r,t,e],3),i=N(n[0],2),a=i[0],s=i[1],o=N(n[1],2),l=o[0],c=o[1],u=N(n[2],2),h=u[0],d=u[1],f=N([l-a,c-s],2),g=f[0],v=f[1],p=Math.sqrt(Math.pow(g,2)+Math.pow(v,2)),m=N([-h/p,d/p],2),y=m[0],b=m[1];return[y*g,y*v,b*g,b*v]}function Ek(r){var t=N(r,2),e=N(t[0],2),n=e[0],i=e[1],a=N(t[1],2),s=a[0],o=a[1];return{x1:n,y1:i,x2:s,y2:o}}function WJ(r,t,e,n){var i=t.showTrunc,a=t.startPos,s=t.endPos,o=t.truncRange,l=t.lineExtension,c=N([a,s],2),u=N(c[0],2),h=u[0],d=u[1],f=N(c[1],2),g=f[0],v=f[1],p=N(l?GJ(a,s,l):new Array(4).fill(0),4),m=p[0],y=p[1],b=p[2],w=p[3],x=function(A){return r.selectAll(zt.line.class).data(A,function(I,B){return B}).join(function(I){return I.append("line").attr("className",function(B){return"".concat(zt.line.name," ").concat(B.className)}).styles(e).transition(function(B){return lr(this,Ek(B.line),!1)})},function(I){return I.styles(e).transition(function(B){var j=B.line;return lr(this,Ek(j),n.update)})},function(I){return I.remove()}).transitions()};if(!i||!o)return x([{line:[[h+m,d+y],[g+b,v+w]],className:zt.line.name}]);var S=N(o,2),E=S[0],_=S[1],C=g-h,k=v-d,M=N([h+C*E,d+k*E],2),T=M[0],O=M[1],R=N([h+C*_,d+k*_],2),L=R[0],D=R[1],P=x([{line:[[h+m,d+y],[T,O]],className:zt.lineFirst.name},{line:[[L,D],[g+b,v+w]],className:zt.lineSecond.name}]);return qJ(r,t),P}function VJ(r,t,e,n){var i=e.showArrow,a=e.showTrunc,s=e.lineArrow,o=e.lineArrowOffset,l=e.lineArrowSize,c;if(t==="arc"?c=r.select(zt.line.class):a?c=r.select(zt.lineSecond.class):c=r.select(zt.line.class),!i||!s||e.type==="arc"&&jP(e.startAngle,e.endAngle)){var u=c.node();u&&(u.style.markerEnd=void 0);return}var h=si(s);h.attr(n),r2(h,l),c.style("markerEnd",h).style("markerEndOffset",-o)}function HJ(r,t,e){var n=t.type,i,a=ht(t,"line");return n==="linear"?i=WJ(r,t,ek(a,"arrow"),e):i=jJ(r,t,ek(a,"arrow"),e),VJ(r,n,t,a),i}function UJ(r,t){return h2(r,t.gridDirection,t)}function qP(r){var t=r.type,e=r.gridCenter;return t==="linear"?e:e||r.center}function YJ(r,t){var e=t.gridLength;return r.map(function(n,i){var a=n.value,s=N(Kh(a,t),2),o=s[0],l=s[1],c=N(Hr(UJ(a,t),e),2),u=c[0],h=c[1];return{id:i,points:[[o,l],[o+u,l+h]]}})}function XJ(r,t){var e=t.gridControlAngles,n=qP(t);if(!n)throw new Error("grid center is not provide");if(r.length<2)throw new Error("Invalid grid data");if(!e||e.length===0)throw new Error("Invalid gridControlAngles");var i=N(n,2),a=i[0],s=i[1];return r.map(function(o,l){var c=o.value,u=N(Kh(c,t),2),h=u[0],d=u[1],f=N([h-a,d-s],2),g=f[0],v=f[1],p=[];return e.forEach(function(m){var y=Ps(m),b=N([Math.cos(y),Math.sin(y)],2),w=b[0],x=b[1],S=g*w-v*x+a,E=g*x+v*w+s;p.push([S,E])}),{points:p,id:l}})}function KJ(r,t,e,n){var i=ht(e,"grid"),a=i.type,s=i.areaFill,o=qP(e),l=u2(t,e.gridFilter),c=a==="segment"?YJ(l,e):XJ(l,e),u=q(q({},i),{center:o,areaFill:at(s)?l.map(function(h,d){return Un(s,[h,d,l])}):s,animate:n,data:c});return r.selectAll(zt.grid.class).data([1]).join(function(h){return h.append(function(){return new FJ({style:u})}).attr("className",zt.grid.name)},function(h){return h.transition(function(){return this.update(u)})},function(h){return h.remove()}).transitions()}var My=function(){function r(t,e,n,i){this.set(t,e,n,i)}return Object.defineProperty(r.prototype,"left",{get:function(){return this.x1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"top",{get:function(){return this.y1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"right",{get:function(){return this.x2},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"bottom",{get:function(){return this.y2},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"width",{get:function(){return this.defined("x2")&&this.defined("x1")?this.x2-this.x1:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.defined("y2")&&this.defined("y1")?this.y2-this.y1:void 0},enumerable:!1,configurable:!0}),r.prototype.rotatedPoints=function(t,e,n){var i=this,a=i.x1,s=i.y1,o=i.x2,l=i.y2,c=Math.cos(t),u=Math.sin(t),h=e-e*c+n*u,d=n-e*u-n*c,f=[[c*a-u*l+h,u*a+c*l+d],[c*o-u*l+h,u*o+c*l+d],[c*a-u*s+h,u*a+c*s+d],[c*o-u*s+h,u*o+c*s+d]];return f},r.prototype.set=function(t,e,n,i){return n0,y=n-l,b=i-c,w=d*b-f*y;if(w<0===m)return!1;var x=g*b-v*y;return!(x<0===m||w>p===m||x>p===m)}function nQ(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 eQ(t,n)})}function rQ(r,t,e){var n,i,a=Cy(r,e).flat(1),s=Cy(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=Ho(o),c=l.next();!c.done;c=l.next()){var u=c.value;if(nQ(s,u))return!0}}catch(h){n={error:h}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}return!1}function iQ(r,t){var e=r.type,n=r.labelDirection,i=r.crossSize;if(!i)return!1;if(e==="arc"){var a=r.center,s=r.radius,o=N(a,2),l=o[0],c=o[1],u=n==="negative"?0:i,h=-s-u,d=s+u,f=N(Ve(t),4),g=f[0],v=f[1],p=f[2],m=f[3];return new My(l+h-m,c+h-g,l+d+v,c+d+p)}var y=N(r.startPos,2),b=y[0],w=y[1],x=N(r.endPos,2),S=x[0],E=x[1],_=N($P(r)?[-t,0,t,0]:[0,t,0,-t],4),C=_[0],k=_[1],M=_[2],T=_[3],O=gl(0,r),R=Hr(O,i),L=new My(b,w,S,E);return L.x1+=T,L.y1+=C,L.x2+=k+R[0],L.y2+=M+R[1],L}function Zh(r,t,e){var n,i,a=t.crossPadding,s=new Set,o=null,l=iQ(t,a),c=function(g){return l?tQ(l,g):!0},u=function(g,v){return!g||!g.firstChild?!0:!rQ(g.firstChild,v.firstChild,Ve(e))};try{for(var h=Ho(r),d=h.next();!d.done;d=h.next()){var f=d.value;c(f)?!o||u(o,f)?o=f:(s.add(o),s.add(f)):s.add(f)}}catch(g){n={error:g}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return Array.from(s)}function cm(r,t){return t===void 0&&(t={}),ot(r)?0:typeof r=="number"?r:Math.floor(tZ(r,t))}function aQ(r,t,e,n){if(!(r.length<=1)){var i=t.suffix,a=i===void 0?"...":i,s=t.minLength,o=t.maxLength,l=o===void 0?1/0:o,c=t.step,u=c===void 0?" ":c,h=t.margin,d=h===void 0?[0,0,0,0]:h,f=yP(n.getTextShape(r[0])),g=cm(u,f),v=s?cm(s,f):g,p=cm(l,f);(ot(p)||p===1/0)&&(p=Math.max.apply(null,r.map(function(S){return S.getBBox().width})));var m=r.slice(),y=N(d,4);y[0],y[1],y[2],y[3];for(var b=function(S){if(m.forEach(function(E){n.ellipsis(n.getTextShape(E),S,a)}),m=Zh(r,e,d),m.length<1)return{value:void 0}},w=p;w>v+g;w-=g){var x=b(w);if(typeof x=="object")return x.value}}}var sQ={parity:function(r,t){var e=t.seq,n=e===void 0?2:e;return r.filter(function(i,a){return a%n?(or(i),!1):!0})}},oQ=function(r){return r.filter(mP)};function lQ(r,t,e,n){var i=r.length,a=t.keepHeader,s=t.keepTail;if(!(i<=1||i===2&&a&&s)){var o=sQ.parity,l=function(b){return b.forEach(n.show),b},c=2,u=r.slice(),h=r.slice(),d=Math.min.apply(Math,Q([1],N(r.map(function(b){return b.getBBox().width})),!1));if(e.type==="linear"&&(zP(e)||$P(e))){var f=rk(r[0]).left,g=rk(r[i-1]).right,v=Math.abs(g-f)||1;c=Math.max(Math.floor(i*d/v),c)}var p,m;for(a&&(p=u.splice(0,1)[0]),s&&(m=u.splice(-1,1)[0],u.reverse()),l(u);co)){for(var m=f;m<=o;m++)if(p(m),g())return;c&&p(d)}}var dQ=new Map([["hide",lQ],["rotate",cQ],["ellipsis",aQ],["wrap",hQ]]);function fQ(r,t,e){return t.labelOverlap.length<1?!1:e==="hide"?!JK(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 gQ(r,t,e){var n=t.labelOverlap,i=n===void 0?[]:n;i.length&&i.forEach(function(a){var s=a.type,o=dQ.get(s);fQ(r,t,s)&&(o==null||o(r,a,t,e))})}function vQ(){for(var r=[],t=0;t2?[r[0]]:r.split("")}function MQ(r,t){var e=r.attributes,n=e.position,i=e.spacing,a=e.inset,s=e.text,o=r.getBBox(),l=t.getBBox(),c=Jh(n),u=N(Ve(s?i:0),4),h=u[0],d=u[1],f=u[2],g=u[3],v=N(Ve(a),4),p=v[0],m=v[1],y=v[2],b=v[3],w=N([g+d,h+f],2),x=w[0],S=w[1],E=N([b+m,p+y],2),_=E[0],C=E[1];if(c[0]==="l")return new sn(o.x,o.y,l.width+o.width+x+_,Math.max(l.height+C,o.height));if(c[0]==="t")return new sn(o.x,o.y,Math.max(l.width+_,o.width),l.height+o.height+S+C);var k=N([t.attributes.width||l.width,t.attributes.height||l.height],2),M=k[0],T=k[1];return new sn(l.x,l.y,M+o.width+x+_,T+o.height+S+C)}function CQ(r,t){var e=Object.entries(t).reduce(function(n,i){var a=N(i,2),s=a[0],o=a[1],l=r.node().attr(s);return l||(n[s]=o),n},{});r.styles(e)}function TQ(r){var t,e,n,i,a=r,s=a.width,o=a.height,l=a.position,c=N([+s/2,+o/2],2),u=c[0],h=c[1],d=N([+u,+h,"center","middle"],4),f=d[0],g=d[1],v=d[2],p=d[3],m=Jh(l);return m.includes("l")&&(t=N([0,"start"],2),f=t[0],v=t[1]),m.includes("r")&&(e=N([+s,"end"],2),f=e[0],v=e[1]),m.includes("t")&&(n=N([0,"top"],2),g=n[0],p=n[1]),m.includes("b")&&(i=N([+o,"bottom"],2),g=i[0],p=i[1]),{x:f,y:g,textAlign:v,textBaseline:p}}var OQ=function(r){wt(t,r);function t(e){return r.call(this,e,{text:"",width:0,height:0,fill:"#4a505a",fontWeight:"bold",fontSize:12,fontFamily:"sans-serif",inset:0,spacing:0,position:"top-left"})||this}return t.prototype.getAvailableSpace=function(){var e=this,n=this.attributes,i=n.width,a=n.height,s=n.position,o=n.spacing,l=n.inset,c=e.querySelector(Tk.text.class);if(!c)return new sn(0,0,+i,+a);var u=c.getBBox(),h=u.width,d=u.height,f=N(Ve(o),4),g=f[0],v=f[1],p=f[2],m=f[3],y=N([0,0,+i,+a],4),b=y[0],w=y[1],x=y[2],S=y[3],E=Jh(s);if(E.includes("i"))return new sn(b,w,x,S);E.forEach(function(D,P){var A,I,B,j;D==="t"&&(A=N(P===0?[d+p,+a-d-p]:[0,+a],2),w=A[0],S=A[1]),D==="r"&&(I=N([+i-h-m],1),x=I[0]),D==="b"&&(B=N([+a-d-g],1),S=B[0]),D==="l"&&(j=N(P===0?[h+v,+i-h-v]:[0,+i],2),b=j[0],x=j[1])});var _=N(Ve(l),4),C=_[0],k=_[1],M=_[2],T=_[3],O=N([T+k,C+M],2),R=O[0],L=O[1];return new sn(b+T,w+C,x-R,S-L)},t.prototype.getBBox=function(){return this.title?this.title.getBBox():new sn(0,0,0,0)},t.prototype.render=function(e,n){var i=this;e.width,e.height,e.position,e.spacing;var a=fe(e,["width","height","position","spacing"]),s=N(oi(a),1),o=s[0],l=TQ(e),c=l.x,u=l.y,h=l.textAlign,d=l.textBaseline;Rn(!!a.text,st(n),function(f){i.title=f.maybeAppendByClassName(Tk.text,"text").styles(o).call(CQ,{x:c,y:u,textAlign:h,textBaseline:d}).node()})},t}(ge);function AQ(r,t,e){var n=e.titlePosition,i=n===void 0?"lb":n,a=e.titleSpacing,s=Jh(i),o=r.node().getLocalBounds(),l=N(o.min,2),c=l[0],u=l[1],h=N(o.halfExtents,2),d=h[0],f=h[1],g=N(t.node().getLocalBounds().halfExtents,2),v=g[0],p=g[1],m=N([c+d,u+f],2),y=m[0],b=m[1],w=N(Ve(a),4),x=w[0],S=w[1],E=w[2],_=w[3];if(["start","end"].includes(i)&&e.type==="linear"){var C=e.startPos,k=e.endPos,M=N(i==="start"?[C,k]:[k,C],2),T=M[0],O=M[1],R=xP([-O[0]+T[0],-O[1]+T[1]]),L=N(Hr(R,x),2),D=L[0],P=L[1];return{x:T[0]+D,y:T[1]+P}}return s.includes("t")&&(b-=f+p+x),s.includes("r")&&(y+=d+v+S),s.includes("l")&&(y-=d+v+_),s.includes("b")&&(b+=f+p+E),{x:y,y:b}}function PQ(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 Ok(r,t,e,n,i){var a=ht(n,"title"),s=N(oi(a),2),o=s[0],l=s[1],c=l.transform,u=l.transformOrigin,h=fe(l,["transform","transformOrigin"]);t.styles(h);var d=c||PQ(r.node(),o.direction,o.position);r.styles(q(q({},o),{transformOrigin:u})),EP(r.node(),d);var f=AQ(st(e._offscreen||e.querySelector(zt.mainGroup.class)),t,n),g=f.x,v=f.y,p=lr(t.node(),{transform:"translate(".concat(g,", ").concat(v,")")},i);return p}function NQ(r,t,e,n){var i=e.titleText;return r.selectAll(zt.title.class).data([{title:i}].filter(function(a){return!!a.title}),function(a,s){return a.title}).join(function(a){return a.append(function(){return si(i)}).attr("className",zt.title.name).transition(function(){return Ok(st(this),r,t,e,n.enter)})},function(a){return a.transition(function(){return Ok(st(this),r,t,e,n.update)})},function(a){return a.remove()}).transitions()}function Ak(r,t,e,n){var i=r.showLine,a=r.showTick,s=r.showLabel,o=t.maybeAppendByClassName(zt.lineGroup,"g"),l=Rn(i,o,function(f){return HJ(f,r,n)})||[],c=t.maybeAppendByClassName(zt.tickGroup,"g"),u=Rn(a,c,function(f){return kQ(f,e,r,n)})||[],h=t.maybeAppendByClassName(zt.labelGroup,"g"),d=Rn(s,h,function(f){return wQ(f,e,r,n)})||[];return Q(Q(Q([],N(l),!1),N(u),!1),N(d),!1).filter(function(f){return!!f})}var RQ=function(r){wt(t,r);function t(e){return r.call(this,e,c2)||this}return t.prototype.render=function(e,n,i){var a=this,s=e.titleText,o=e.data,l=e.animate,c=e.showTitle,u=e.showGrid,h=e.dataThreshold,d=e.truncRange,f=dZ(o,h).filter(function(x){var S=x.value;return!(d&&S>d[0]&&S1?{width:55,height:0}:{width:0,height:0}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageShape",{get:function(){var e=this.pageViews,n=N(SZ(e.map(function(h){var d=h.getBBox(),f=d.width,g=d.height;return[f,g]})).map(function(h){return Math.max.apply(Math,Q([],N(h),!1))}),2),i=n[0],a=n[1],s=this.attributes,o=s.pageWidth,l=o===void 0?i:o,c=s.pageHeight,u=c===void 0?a:c;return{pageWidth:l,pageHeight:u}},enumerable:!1,configurable:!0}),t.prototype.getContainer=function(){return this.playWindow},Object.defineProperty(t.prototype,"totalPages",{get:function(){return this.pageViews.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currPage",{get:function(){return this.innerCurrPage},enumerable:!1,configurable:!0}),t.prototype.getBBox=function(){var e=r.prototype.getBBox.call(this),n=e.x,i=e.y,a=this.controllerShape,s=this.pageShape,o=s.pageWidth,l=s.pageHeight;return new sn(n,i,o+a.width,l)},t.prototype.goTo=function(e){var n=this,i=this.attributes.animate,a=this,s=a.currPage,o=a.playState,l=a.playWindow,c=a.pageViews;if(o!=="idle"||e<0||c.length<=0||e>=c.length)return null;c[s].setLocalPosition(0,0),this.prepareFollowingPage(e);var u=N(this.getFollowingPageDiff(e),2),h=u[0],d=u[1];this.playState="running";var f=NP(l,[{transform:"translate(0, 0)"},{transform:"translate(".concat(-h,", ").concat(-d,")")}],i);return Ws(f,function(){n.innerCurrPage=e,n.playState="idle",n.setVisiblePages([e]),n.updatePageInfo()}),f},t.prototype.prev=function(){var e=this.attributes.loop,n=this.pageViews.length,i=this.currPage;if(!e&&i<=0)return null;var a=e?(i-1+n)%n:ce(i-1,0,n);return this.goTo(a)},t.prototype.next=function(){var e=this.attributes.loop,n=this.pageViews.length,i=this.currPage;if(!e&&i>=n-1)return null;var a=e?(i+1)%n:ce(i+1,0,n);return this.goTo(a)},t.prototype.renderClipPath=function(e){var n=this.pageShape,i=n.pageWidth,a=n.pageHeight;if(!i||!a){this.contentGroup.style.clipPath=void 0;return}this.clipPath=e.maybeAppendByClassName($n.clipPath,"rect").styles({width:i,height:a}),this.contentGroup.attr("clipPath",this.clipPath.node())},t.prototype.setVisiblePages=function(e){this.playWindow.children.forEach(function(n,i){e.includes(i)?dl(n):or(n)})},t.prototype.adjustControllerLayout=function(){var e=this,n=e.prevBtnGroup,i=e.nextBtnGroup,a=e.pageInfoGroup,s=this.attributes,o=s.orientation,l=s.controllerPadding,c=a.getBBox(),u=c.width;c.height;var h=N(o==="horizontal"?[-180,0]:[-90,90],2),d=h[0],f=h[1];n.setLocalEulerAngles(d),i.setLocalEulerAngles(f);var g=n.getBBox(),v=g.width,p=g.height,m=i.getBBox(),y=m.width,b=m.height,w=Math.max(v,u,y),x=o==="horizontal"?{offset:[[0,0],[v/2+l,0],[v+u+l*2,0]],textAlign:"start"}:{offset:[[w/2,-p-l],[w/2,0],[w/2,b+l]],textAlign:"center"},S=N(x.offset,3),E=N(S[0],2),_=E[0],C=E[1],k=N(S[1],2),M=k[0],T=k[1],O=N(S[2],2),R=O[0],L=O[1],D=x.textAlign,P=a.querySelector("text");P&&(P.style.textAlign=D),n.setLocalPosition(_,C),a.setLocalPosition(M,T),i.setLocalPosition(R,L)},t.prototype.updatePageInfo=function(){var e,n=this,i=n.currPage,a=n.pageViews,s=n.attributes.formatter;a.length<2||((e=this.pageInfoGroup.querySelector($n.pageInfo.class))===null||e===void 0||e.attr("text",s(i+1,a.length)),this.adjustControllerLayout())},t.prototype.getFollowingPageDiff=function(e){var n=this.currPage;if(n===e)return[0,0];var i=this.attributes.orientation,a=this.pageShape,s=a.pageWidth,o=a.pageHeight,l=e=2,c=e.maybeAppendByClassName($n.controller,"g");if(Uh(c.node(),l),!!l){var u=ht(this.attributes,"button"),h=ht(this.attributes,"pageNum"),d=N(oi(u),2),f=d[0],g=d[1],v=f.size,p=fe(f,["size"]),m=!c.select($n.prevBtnGroup.class).node(),y=c.maybeAppendByClassName($n.prevBtnGroup,"g").styles(g);this.prevBtnGroup=y.node();var b=y.maybeAppendByClassName($n.prevBtn,"path"),w=c.maybeAppendByClassName($n.nextBtnGroup,"g").styles(g);this.nextBtnGroup=w.node();var x=w.maybeAppendByClassName($n.nextBtn,"path");[b,x].forEach(function(E){E.styles(q(q({},p),{transformOrigin:"center"})),r2(E.node(),v)});var S=c.maybeAppendByClassName($n.pageInfoGroup,"g");this.pageInfoGroup=S.node(),S.maybeAppendByClassName($n.pageInfo,"text").styles(h),this.updatePageInfo(),c.node().setLocalPosition(s+i,o/2),m&&(this.prevBtnGroup.addEventListener("click",function(){n.prev()}),this.nextBtnGroup.addEventListener("click",function(){n.next()}))}},t.prototype.render=function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s;this.attr("transform","translate(".concat(a,", ").concat(o,")"));var l=st(n);this.renderClipPath(l),this.renderController(l),this.setVisiblePages([this.defaultPage]),this.goTo(this.defaultPage)},t.prototype.bindEvents=function(){var e=this,n=Vo(function(){return e.render(e.attributes,e)},50);this.playWindow.addEventListener(xt.INSERTED,n),this.playWindow.addEventListener(xt.REMOVED,n)},t}(ge);function DQ(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 HP=1.4,UP=.4;function IQ(r,t,e){var n=e,i=n*HP,a=n/2,s=n/6,o=r+i*UP;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 FQ(r,t,e){var n=e,i=n*HP,a=n/2,s=n/6,o=t+i*UP;return[["M",r,t],["L",r-a,o],["L",r-a,t+i],["L",r+a,t+i],["L",r+a,o],["Z"],["M",r-s,o],["L",r-s,t+i-2],["M",r+s,o],["L",r+s,t+i-2]]}qt.registerSymbol("hiddenHandle",DQ);qt.registerSymbol("verticalHandle",IQ);qt.registerSymbol("horizontalHandle",FQ);function Oy(r,t,e){return r===void 0&&(r="horizontal"),r==="horizontal"?t:e}var Sn=fr({layout:"flex",markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label",valueGroup:"value-group",value:"value",backgroundGroup:"background-group",background:"background"},"legend-category-item");function BQ(r){var t=r.querySelector(Sn.marker.class);return t?t.style:{}}var zQ=function(r){wt(t,r);function t(e){return r.call(this,e,{span:[1,1],marker:function(){return new li({style:{r:6}})},markerSize:10,labelFill:"#646464",valueFill:"#646464",labelFontSize:12,valueFontSize:12,labelTextBaseline:"middle",valueTextBaseline:"middle"})||this}return Object.defineProperty(t.prototype,"showValue",{get:function(){var e=this.attributes.valueText;return e?typeof e=="string"||typeof e=="number"?e!=="":typeof e=="function"?!0:e.attr("text")!=="":!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"actualSpace",{get:function(){var e=this.labelGroup,n=this.valueGroup,i=this.attributes.markerSize,a=e.node().getBBox(),s=a.width,o=a.height,l=n.node().getBBox(),c=l.width,u=l.height;return{markerWidth:i,labelWidth:s,valueWidth:c,height:Math.max(i,o,u)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"span",{get:function(){var e=this.attributes.span;if(!e)return[1,1];var n=N(Ve(e),2),i=n[0],a=n[1],s=this.showValue?a:0,o=i+s;return[i/o,s/o]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shape",{get:function(){var e,n=this.attributes,i=n.markerSize,a=n.width,s=this.actualSpace,o=s.markerWidth,l=s.height,c=this.actualSpace,u=c.labelWidth,h=c.valueWidth,d=N(this.spacing,2),f=d[0],g=d[1];if(a){var v=a-i-f-g,p=N(this.span,2),m=p[0],y=p[1];e=N([m*v,y*v],2),u=e[0],h=e[1]}var b=o+u+h+f+g;return{width:b,height:l,markerWidth:o,labelWidth:u,valueWidth:h}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"spacing",{get:function(){var e=this.attributes.spacing;if(!e)return[0,0];var n=N(Ve(e),2),i=n[0],a=n[1];return this.showValue?[i,a]:[i,0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layout",{get:function(){var e=this.shape,n=e.markerWidth,i=e.labelWidth,a=e.valueWidth,s=e.width,o=e.height,l=N(this.spacing,2),c=l[0],u=l[1];return{height:o,width:s,markerWidth:n,labelWidth:i,valueWidth:a,position:[n/2,n+c,n+i+c+u]}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleSize",{get:function(){var e=BQ(this.markerGroup.node()),n=this.attributes,i=n.markerSize,a=n.markerStrokeWidth,s=a===void 0?e.strokeWidth:a,o=n.markerLineWidth,l=o===void 0?e.lineWidth:o,c=n.markerStroke,u=c===void 0?e.stroke:c,h=+(s||l||(u?1:0))*Math.sqrt(2),d=this.markerGroup.node().getBBox(),f=d.width,g=d.height;return(1-h/Math.max(f,g))*i},enumerable:!1,configurable:!0}),t.prototype.renderMarker=function(e){var n=this,i=this.attributes.marker,a=ht(this.attributes,"marker");this.markerGroup=e.maybeAppendByClassName(Sn.markerGroup,"g").style("zIndex",0),Rn(!!i,this.markerGroup,function(){var s,o=n.markerGroup.node(),l=(s=o.childNodes)===null||s===void 0?void 0:s[0],c=typeof i=="string"?new qt({style:{symbol:i},className:Sn.marker.name}):i();l?c.nodeName===l.nodeName?l instanceof qt?l.update(q(q({},a),{symbol:i})):(yZ(l,c),st(l).styles(a)):(l.remove(),st(c).attr("className",Sn.marker.name).styles(a),o.appendChild(c)):(c instanceof qt||st(c).attr("className",Sn.marker.name).styles(a),o.appendChild(c)),n.markerGroup.node().scale(1/n.markerGroup.node().getScale()[0]);var u=r2(n.markerGroup.node(),n.scaleSize);n.markerGroup.node().style._transform="scale(".concat(u,")")})},t.prototype.renderLabel=function(e){var n=ht(this.attributes,"label"),i=n.text,a=fe(n,["text"]);this.labelGroup=e.maybeAppendByClassName(Sn.labelGroup,"g").style("zIndex",0),this.labelGroup.maybeAppendByClassName(Sn.label,function(){return si(i)}).styles(a)},t.prototype.renderValue=function(e){var n=this,i=ht(this.attributes,"value"),a=i.text,s=fe(i,["text"]);this.valueGroup=e.maybeAppendByClassName(Sn.valueGroup,"g").style("zIndex",0),Rn(this.showValue,this.valueGroup,function(){n.valueGroup.maybeAppendByClassName(Sn.value,function(){return si(a)}).styles(s)})},t.prototype.renderBackground=function(e){var n=this.shape,i=n.width,a=n.height,s=ht(this.attributes,"background");this.background=e.maybeAppendByClassName(Sn.backgroundGroup,"g").style("zIndex",-1),this.background.maybeAppendByClassName(Sn.background,"rect").styles(q({width:i,height:a},s))},t.prototype.adjustLayout=function(){var e=this.layout,n=e.labelWidth,i=e.valueWidth,a=e.height,s=N(e.position,3),o=s[0],l=s[1],c=s[2],u=a/2;this.markerGroup.styles({transform:"translate(".concat(o,", ").concat(u,")").concat(this.markerGroup.node().style._transform)}),this.labelGroup.styles({transform:"translate(".concat(l,", ").concat(u,")")}),Sy(this.labelGroup.select(Sn.label.class).node(),Math.ceil(n)),this.showValue&&(this.valueGroup.styles({transform:"translate(".concat(c,", ").concat(u,")")}),Sy(this.valueGroup.select(Sn.value.class).node(),Math.ceil(i)))},t.prototype.render=function(e,n){var i=st(n),a=e.x,s=a===void 0?0:a,o=e.y,l=o===void 0?0:o;i.styles({transform:"translate(".concat(s,", ").concat(l,")")}),this.renderMarker(i),this.renderLabel(i),this.renderValue(i),this.renderBackground(i),this.adjustLayout()},t}(ge),va=fr({page:"item-page",navigator:"navigator",item:"item"},"items"),Pk=function(r,t,e){return e===void 0&&(e=!0),r?t(r):e},$Q=function(r){wt(t,r);function t(e){var n=r.call(this,e,{data:[],gridRow:1/0,gridCol:void 0,padding:0,width:1e3,height:100,rowPadding:0,colPadding:0,layout:"flex",orientation:"horizontal",click:Md,mouseenter:Md,mouseleave:Md})||this;return n.navigatorShape=[0,0],n}return Object.defineProperty(t.prototype,"pageViews",{get:function(){return this.navigator.getContainer()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"grid",{get:function(){var e=this.attributes,n=e.gridRow,i=e.gridCol,a=e.data;if(!n&&!i)throw new Error("gridRow and gridCol can not be set null at the same time");return n&&i?[n,i]:n?[n,a.length]:[a.length,i]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderData",{get:function(){var e=this.attributes,n=e.data,i=e.layout,a=ht(this.attributes,"item"),s=n.map(function(o,l){var c=o.id,u=c===void 0?l:c,h=o.label,d=o.value;return{id:"".concat(u),index:l,style:q({layout:i,labelText:h,valueText:d},Object.fromEntries(Object.entries(a).map(function(f){var g=N(f,2),v=g[0],p=g[1];return[v,Un(p,[o,l,n])]})))}});return s},enumerable:!1,configurable:!0}),t.prototype.getGridLayout=function(){var e=this,n=this.attributes,i=n.orientation,a=n.width,s=n.rowPadding,o=n.colPadding,l=N(this.navigatorShape,1),c=l[0],u=N(this.grid,2),h=u[0],d=u[1],f=d*h,g=0;return this.pageViews.children.map(function(v,p){var m,y,b=Math.floor(p/f),w=p%f,x=e.ifHorizontal(d,h),S=[Math.floor(w/x),w%x];i==="vertical"&&S.reverse();var E=N(S,2),_=E[0],C=E[1],k=(a-c-(d-1)*o)/d,M=v.getBBox().height,T=N([0,0],2),O=T[0],R=T[1];return i==="horizontal"?(m=N([g,_*(M+s)],2),O=m[0],R=m[1],g=C===d-1?0:g+k+o):(y=N([C*(k+o),g],2),O=y[0],R=y[1],g=_===h-1?0:g+M+s),{page:b,index:p,row:_,col:C,pageIndex:w,width:k,height:M,x:O,y:R}})},t.prototype.getFlexLayout=function(){var e=this.attributes,n=e.width,i=e.height,a=e.rowPadding,s=e.colPadding,o=N(this.navigatorShape,1),l=o[0],c=N(this.grid,2),u=c[0],h=c[1],d=N([n-l,i],2),f=d[0],g=d[1],v=N([0,0,0,0,0,0,0,0],8),p=v[0],m=v[1],y=v[2],b=v[3],w=v[4],x=v[5],S=v[6],E=v[7];return this.pageViews.children.map(function(_,C){var k,M,T,O,R=_.getBBox(),L=R.width,D=R.height,P=S===0?0:s,A=S+P+L;if(A<=f&&Pk(w,function(B){return B0?(this.navigatorShape=[55,0],e.call(this)):n},enumerable:!1,configurable:!0}),t.prototype.ifHorizontal=function(e,n){var i=this.attributes.orientation;return Oy(i,e,n)},t.prototype.flattenPage=function(e){e.querySelectorAll(va.item.class).forEach(function(n){e.appendChild(n)}),e.querySelectorAll(va.page.class).forEach(function(n){var i=e.removeChild(n);i.destroy()})},t.prototype.renderItems=function(e){var n=this.attributes,i=n.click,a=n.mouseenter,s=n.mouseleave;this.flattenPage(e);var o=this.dispatchCustomEvent.bind(this);st(e).selectAll(va.item.class).data(this.renderData,function(l){return l.id}).join(function(l){return l.append(function(c){var u=c.style;return new zQ({style:u})}).attr("className",va.item.name).on("click",function(){i==null||i(this),o("itemClick",{item:this})}).on("pointerenter",function(){a==null||a(this),o("itemMouseenter",{item:this})}).on("pointerleave",function(){s==null||s(this),o("itemMouseleave",{item:this})})},function(l){return l.each(function(c){var u=c.style;this.update(u)})},function(l){return l.remove()})},t.prototype.relayoutNavigator=function(){var e,n=this.attributes,i=n.layout,a=n.width,s=((e=this.pageViews.children[0])===null||e===void 0?void 0:e.getBBox().height)||0,o=N(this.navigatorShape,2),l=o[0],c=o[1];this.navigator.update(i==="grid"?{pageWidth:a-l,pageHeight:s-c}:{})},t.prototype.adjustLayout=function(){var e=this,n=Object.entries(nZ(this.itemsLayout,"page")).map(function(a){var s=N(a,2),o=s[0],l=s[1];return{page:o,layouts:l}}),i=Q([],N(this.navigator.getContainer().children),!1);n.forEach(function(a){var s=a.layouts,o=e.pageViews.appendChild(new Pe({className:va.page.name}));s.forEach(function(l){var c=l.x,u=l.y,h=l.index,d=l.width,f=l.height,g=i[h];o.appendChild(g),To(g,"__layout__",l),g.update({x:c,y:u,width:d,height:f})})}),this.relayoutNavigator()},t.prototype.renderNavigator=function(e){var n=this.attributes.orientation,i=ht(this.attributes,"nav"),a=ze({orientation:n},i),s=this;return e.selectAll(va.navigator.class).data(["nav"]).join(function(o){return o.append(function(){return new LQ({style:a})}).attr("className",va.navigator.name).each(function(){s.navigator=this})},function(o){return o.each(function(){this.update(a)})},function(o){return o.remove()}),this.navigator},t.prototype.getBBox=function(){return this.navigator.getBBox()},t.prototype.render=function(e,n){var i=this.attributes.data;if(!(!i||i.length===0)){var a=this.renderNavigator(st(n));this.renderItems(a.getContainer()),this.adjustLayout()}},t.prototype.dispatchCustomEvent=function(e,n){var i=new we(e,{detail:n});this.dispatchEvent(i)},t}(ge),Js=fr({markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label"},"handle"),YP={showLabel:!0,formatter:function(r){return r.toString()},markerSize:25,markerStroke:"#c5c5c5",markerFill:"#fff",markerLineWidth:1,labelFontSize:12,labelFill:"#c5c5c5",labelText:"",orientation:"vertical",spacing:0};(function(r){wt(t,r);function t(e){return r.call(this,e,YP)||this}return t.prototype.render=function(e,n){var i=st(n).maybeAppendByClassName(Js.markerGroup,"g");this.renderMarker(i);var a=st(n).maybeAppendByClassName(Js.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?Oy(a,"horizontalHandle","verticalHandle"):s;Rn(!!o,e,function(l){var c=ht(n.attributes,"marker"),u=q({symbol:o},c);n.marker=l.maybeAppendByClassName(Js.marker,function(){return new qt({style:u})}).update(u)})},t.prototype.renderLabel=function(e){var n=this,i=this.attributes,a=i.showLabel,s=i.orientation,o=i.spacing,l=o===void 0?0:o,c=i.formatter;Rn(a,e,function(u){var h,d=ht(n.attributes,"label"),f=d.text,g=fe(d,["text"]),v=((h=u.select(Js.marker.class))===null||h===void 0?void 0:h.node().getBBox())||{},p=v.width,m=p===void 0?0:p,y=v.height,b=y===void 0?0:y,w=N(Oy(s,[0,b+l,"center","top"],[m+l,0,"start","middle"]),4),x=w[0],S=w[1],E=w[2],_=w[3];u.maybeAppendByClassName(Js.label,"text").styles(q(q({},g),{x,y:S,text:c(f).toString(),textAlign:E,textBaseline:_}))})},t})(ge);var XP={showTitle:!0,padding:0,orientation:"horizontal",backgroundFill:"transparent",titleText:"",titleSpacing:4,titlePosition:"top-left",titleFill:"#2C3542",titleFontWeight:"bold",titleFontFamily:"sans-serif",titleFontSize:12},jQ=ze({},XP,{});ze({},XP,gs(YP,"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 Qs=fr({title:"title",titleGroup:"title-group",items:"items",itemsGroup:"items-group",contentGroup:"content-group",ribbonGroup:"ribbon-group",ribbon:"ribbon",handlesGroup:"handles-group",handle:"handle",startHandle:"start-handle",endHandle:"end-handle",labelGroup:"label-group",label:"label",indicator:"indicator"},"legend"),qQ=function(r){wt(t,r);function t(e){return r.call(this,e,jQ)||this}return t.prototype.renderTitle=function(e,n,i){var a=this.attributes,s=a.showTitle,o=a.titleText,l=ht(this.attributes,"title"),c=N(oi(l),2),u=c[0],h=c[1];this.titleGroup=e.maybeAppendByClassName(Qs.titleGroup,"g").styles(h);var d=q(q({width:n,height:i},u),{text:s?o:""});this.title=this.titleGroup.maybeAppendByClassName(Qs.title,function(){return new OQ({style:d})}).update(d)},t.prototype.renderItems=function(e,n){var i=n.x,a=n.y,s=n.width,o=n.height,l=ht(this.attributes,"title",!0),c=N(oi(l),2),u=c[0],h=c[1],d=q(q({},u),{width:s,height:o,x:0,y:0});this.itemsGroup=e.maybeAppendByClassName(Qs.itemsGroup,"g").styles(q(q({},h),{transform:"translate(".concat(i,", ").concat(a,")")}));var f=this;this.itemsGroup.selectAll(Qs.items.class).data(["items"]).join(function(g){return g.append(function(){return new $Q({style:d})}).attr("className",Qs.items.name).each(function(){f.items=st(this)})},function(g){return g.update(d)},function(g){return g.remove()})},t.prototype.adjustLayout=function(){var e=this.attributes.showTitle;if(e){var n=this.title.node().getAvailableSpace(),i=n.x,a=n.y;this.itemsGroup.node().style.transform="translate(".concat(i,", ").concat(a,")")}},Object.defineProperty(t.prototype,"availableSpace",{get:function(){var e=this.attributes,n=e.showTitle,i=e.width,a=e.height;return n?this.title.node().getAvailableSpace():new sn(0,0,i,a)},enumerable:!1,configurable:!0}),t.prototype.getBBox=function(){var e,n,i=(e=this.title)===null||e===void 0?void 0:e.node(),a=(n=this.items)===null||n===void 0?void 0:n.node();return!i||!a?r.prototype.getBBox.call(this):MQ(i,a)},t.prototype.render=function(e,n){var i=this.attributes,a=i.width,s=i.height,o=i.x,l=o===void 0?0:o,c=i.y,u=c===void 0?0:c,h=st(n);n.style.transform="translate(".concat(l,", ").concat(u,")"),this.renderTitle(h,a,s),this.renderItems(h,this.availableSpace),this.adjustLayout()},t}(ge),GQ={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},um=fr({background:"background",labelGroup:"label-group",label:"label"},"indicator"),WQ=function(r){wt(t,r);function t(e){var n=r.call(this,e,GQ)||this;return n.point=[0,0],n.group=n.appendChild(new Pe({})),n.isMutationObserved=!0,n}return t.prototype.renderBackground=function(){if(this.label){var e=this.attributes,n=e.position,i=e.padding,a=N(Ve(i),4),s=a[0],o=a[1],l=a[2],c=a[3],u=this.label.node().getLocalBounds(),h=u.min,d=u.max,f=new sn(h[0]-c,h[1]-s,d[0]+o-h[0]+c,d[1]+l-h[1]+s),g=this.getPath(n,f),v=ht(this.attributes,"background");this.background=st(this.group).maybeAppendByClassName(um.background,"path").styles(q(q({},v),{d:g})),this.group.appendChild(this.label.node())}},t.prototype.renderLabel=function(){var e=this.attributes,n=e.formatter,i=e.labelText,a=ht(this.attributes,"label"),s=N(oi(a),2),o=s[0],l=s[1];o.text;var c=fe(o,["text"]);if(this.label=st(this.group).maybeAppendByClassName(um.labelGroup,"g").styles(l),!!i){var u=this.label.maybeAppendByClassName(um.label,function(){return si(n(i))}).style("text",n(i).toString());u.selectAll("text").styles(c)}},t.prototype.adjustLayout=function(){var e=N(this.point,2),n=e[0],i=e[1],a=this.attributes,s=a.x,o=a.y;this.group.attr("transform","translate(".concat(s-n,", ").concat(o-i,")"))},t.prototype.getPath=function(e,n){var i=this.attributes.radius,a=n.x,s=n.y,o=n.width,l=n.height,c=[["M",a+i,s],["L",a+o-i,s],["A",i,i,0,0,1,a+o,s+i],["L",a+o,s+l-i],["A",i,i,0,0,1,a+o-i,s+l],["L",a+i,s+l],["A",i,i,0,0,1,a,s+l-i],["L",a,s+i],["A",i,i,0,0,1,a+i,s],["Z"]],u={top:4,right:6,bottom:0,left:2},h=u[e],d=this.createCorner([c[h].slice(-2),c[h+1].slice(-2)]);return c.splice.apply(c,Q([h+1,1],N(d),!1)),c[0][0]="M",c},t.prototype.createCorner=function(e,n){n===void 0&&(n=10);var i=.8,a=mZ.apply(void 0,Q([],N(e),!1)),s=N(e,2),o=N(s[0],2),l=o[0],c=o[1],u=N(s[1],2),h=u[0],d=u[1],f=N(a?[h-l,[l,h]]:[d-c,[c,d]],2),g=f[0],v=N(f[1],2),p=v[0],m=v[1],y=g/2,b=g/Math.abs(g),w=n*b,x=w/2,S=w*Math.sqrt(3)/2*i,E=N([p,p+y-x,p+y,p+y+x,m],5),_=E[0],C=E[1],k=E[2],M=E[3],T=E[4];return a?(this.point=[k,c-S],[["L",_,c],["L",C,c],["L",k,c-S],["L",M,c],["L",T,c]]):(this.point=[l+S,k],[["L",l,_],["L",l,C],["L",l+S,k],["L",l,M],["L",l,T]])},t.prototype.applyVisibility=function(){var e=this.attributes.visibility;e==="hidden"?or(this):dl(this)},t.prototype.bindEvents=function(){this.label.on(xt.BOUNDS_CHANGED,this.renderBackground)},t.prototype.render=function(){this.renderLabel(),this.renderBackground(),this.adjustLayout(),this.applyVisibility()},t}(ge);function Ay(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 Nk={overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"};function VQ(r){var t;r===void 0&&(r="");var e=Ay(r);return t={},t[".".concat(e.CONTAINER)]={position:"absolute",visibility:"visible","z-index":8,transition:"visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)","background-color":"rgba(255, 255, 255, 0.96)","box-shadow":"0 6px 12px 0 rgba(0, 0, 0, 0.12)","border-radius":"4px",color:"rgba(0, 0, 0, 0.65)","font-size":"12px","line-height":"20px",padding:"12px","min-width":"120px","max-width":"360px","font-family":"Roboto-Regular"},t[".".concat(e.TITLE)]={color:"rgba(0, 0, 0, 0.45)"},t[".".concat(e.LIST)]={margin:"0px","list-style-type":"none",padding:"0px"},t[".".concat(e.LIST_ITEM)]={"list-style-type":"none",display:"flex","line-height":"2em","align-items":"center","justify-content":"space-between","white-space":"nowrap"},t[".".concat(e.MARKER)]={width:"8px",height:"8px","border-radius":"50%",display:"inline-block","margin-right":"4px"},t[".".concat(e.NAME)]={display:"flex","align-items":"center","max-width":"216px"},t[".".concat(e.NAME_LABEL)]=q({flex:1},Nk),t[".".concat(e.VALUE)]=q({display:"inline-block",float:"right",flex:1,"text-align":"right","min-width":"28px","margin-left":"30px",color:"rgba(0, 0, 0, 0.85)"},Nk),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 HQ=function(r){wt(t,r);function t(e){var n=this,i,a,s=(a=(i=e.style)===null||i===void 0?void 0:i.template)===null||a===void 0?void 0:a.prefixCls,o=Ay(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:'
'),title:'
'),item:'
  • {name} {value}
  • `)},style:VQ(s)})||this,n.timestamp=-1,n.prevCustomContentKey=n.attributes.contentKey,n.initShape(),n.render(n.attributes,n),n}return Object.defineProperty(t.prototype,"HTMLTooltipElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),t.prototype.getContainer=function(){return this.element},Object.defineProperty(t.prototype,"elementSize",{get:function(){var e=this.element.offsetWidth,n=this.element.offsetHeight;return{width:e,height:n}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HTMLTooltipItemsElements",{get:function(){var e=this.attributes,n=e.data,i=e.template;return n.map(function(a,s){var o=a.name,l=o===void 0?"":o,c=a.color,u=c===void 0?"black":c,h=a.index,d=fe(a,["name","color","index"]),f=q({name:l,color:u,index:h??s},d);return Am(JL(i.item,f))})},enumerable:!1,configurable:!0}),t.prototype.render=function(e,n){this.renderHTMLTooltipElement(),this.updatePosition()},t.prototype.destroy=function(){var e;(e=this.element)===null||e===void 0||e.remove(),r.prototype.destroy.call(this)},t.prototype.show=function(e,n){var i=this;if(e!==void 0&&n!==void 0){var a=this.element.style.visibility==="hidden",s=function(){i.attributes.x=e??i.attributes.x,i.attributes.y=n??i.attributes.y,i.updatePosition()};a?this.closeTransition(s):s()}this.element.style.visibility="visible"},t.prototype.hide=function(e,n){e===void 0&&(e=0),n===void 0&&(n=0);var i=this.attributes.enterable;i&&this.isCursorEntered(e,n)||(this.element.style.visibility="hidden")},t.prototype.initShape=function(){var e=this.attributes.template;this.element=Am(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:ak(this.element,e))}},t.prototype.renderHTMLTooltipElement=function(){var e,n,i=this.attributes,a=i.template,s=i.title,o=i.enterable,l=i.style,c=i.content,u=Ay(a.prefixCls),h=this.element;if(this.element.style.pointerEvents=o?"auto":"none",c)this.renderCustomContent();else{s?(h.innerHTML=a.title,h.getElementsByClassName(u.TITLE)[0].innerHTML=s):(n=(e=h.getElementsByClassName(u.TITLE))===null||e===void 0?void 0:e[0])===null||n===void 0||n.remove();var d=this.HTMLTooltipItemsElements,f=document.createElement("ul");f.className=u.LIST,ak(f,d);var g=this.element.querySelector(".".concat(u.LIST));g?g.replaceWith(f):h.appendChild(f)}xZ(h,l)},t.prototype.getRelativeOffsetFromCursor=function(e){var n=this.attributes,i=n.position,a=n.offset,s=e||i,o=s.split("-"),l={left:[-1,0],right:[1,0],top:[0,-1],bottom:[0,1]},c=this.elementSize,u=c.width,h=c.height,d=[-u/2,-h/2];return o.forEach(function(f){var g=N(d,2),v=g[0],p=g[1],m=N(l[f],2),y=m[0],b=m[1];d=[v+(u/2+a[0])*y,p+(h/2+a[1])*b]}),d},t.prototype.setOffsetPosition=function(e){var n=N(e,2),i=n[0],a=n[1],s=this.attributes,o=s.x,l=o===void 0?0:o,c=s.y,u=c===void 0?0:c,h=s.container,d=h.x,f=h.y;this.element.style.left="".concat(+l+d+i,"px"),this.element.style.top="".concat(+u+f+a,"px")},t.prototype.updatePosition=function(){var e=this.attributes.showDelay,n=e===void 0?60:e,i=Date.now();this.timestamp>0&&i-this.timestampy+w,top:pb+x},E=[];u.split("-").forEach(function(C){S[C]?E.push(m[C]):E.push(C)});var _=E.join("-");return this.getRelativeOffsetFromCursor(_)},t.prototype.isCursorEntered=function(e,n){if(this.element){var i=this.element.getBoundingClientRect(),a=i.x,s=i.y,o=i.width,l=i.height;return new sn(a,s,o,l).isPointIn(e,n)}return!1},t.prototype.closeTransition=function(e){var n=this,i=this.element.style.transition;this.element.style.transition="none",e(),setTimeout(function(){n.element.style.transition=i},10)},t.tag="tooltip",t}(ge),UQ=function(r){wt(t,r);function t(e){var n=r.call(this,ze({},t.defaultOptions,e))||this;return n.hoverColor="#f5f5f5",n.selectedColor="#e6f7ff",n.background=n.appendChild(new Be({})),n.label=n.background.appendChild(new Pe({})),n}return Object.defineProperty(t.prototype,"padding",{get:function(){return Ve(this.style.padding)},enumerable:!1,configurable:!0}),t.prototype.renderLabel=function(){var e=this.style,n=e.label,i=e.value,a=ht(this.attributes,"label");st(this.label).maybeAppend(".label",function(){return si(n)}).attr("className","label").styles(a),this.label.attr("__data__",i)},t.prototype.renderBackground=function(){var e=this.label.getBBox(),n=N(this.padding,4),i=n[0],a=n[1],s=n[2],o=n[3],l=e.width,c=e.height,u=l+o+a,h=c+i+s,d=ht(this.attributes,"background"),f=this.style,g=f.width,v=g===void 0?0:g,p=f.height,m=p===void 0?0:p,y=f.selected;this.background.attr(q(q({},d),{width:Math.max(u,v),height:Math.max(h,m),fill:y?this.selectedColor:"#fff"})),this.label.attr({transform:"translate(".concat(o,", ").concat((h-c)/2,")")})},t.prototype.render=function(){this.renderLabel(),this.renderBackground()},t.prototype.bindEvents=function(){var e=this;this.addEventListener("pointerenter",function(){e.style.selected||e.background.attr("fill",e.hoverColor)}),this.addEventListener("pointerleave",function(){e.style.selected||e.background.attr("fill",e.style.backgroundFill)});var n=this;this.addEventListener("click",function(){var i=e.style,a=i.label,s=i.value,o=i.onClick;o==null||o(s,{label:a,value:s},n)})},t.defaultOptions={style:{value:"",label:"",cursor:"pointer"}},t}(ge),YQ=function(r){wt(t,r);function t(e){var n,i,a=r.call(this,ze({},t.defaultOptions,e))||this;a.currentValue=(n=t.defaultOptions.style)===null||n===void 0?void 0:n.defaultValue,a.isPointerInSelect=!1,a.select=a.appendChild(new Be({className:"select",style:{cursor:"pointer",width:0,height:0}})),a.dropdown=a.appendChild(new Be({className:"dropdown"}));var s=a.style.defaultValue;return s&&(!((i=a.style.options)===null||i===void 0)&&i.some(function(o){return o.value===s}))&&(a.currentValue=s),a}return t.prototype.setValue=function(e){this.currentValue=e,this.render()},t.prototype.getValue=function(){return this.currentValue},Object.defineProperty(t.prototype,"dropdownPadding",{get:function(){return Ve(this.style.dropdownPadding)},enumerable:!1,configurable:!0}),t.prototype.renderSelect=function(){var e=this,n,i=this.style,a=i.x,s=i.y,o=i.width,l=i.height,c=i.bordered,u=i.showDropdownIcon,h=ht(this.attributes,"select"),d=ht(this.attributes,"placeholder");this.select.attr(q(q({x:a,y:s,width:o,height:l},h),{fill:"#fff",strokeWidth:c?1:0}));var f=this.dropdownPadding,g=10;u&&st(this.select).maybeAppend(".dropdown-icon","path").style("d","M-5,-3.5 L0,3.5 L5,-3.5").style("transform","translate(".concat(a+o-g-f[1]-f[3],", ").concat(s+l/2,")")).style("lineWidth",1).style("stroke",this.select.style.stroke);var v=(n=this.style.options)===null||n===void 0?void 0:n.find(function(b){return b.value===e.currentValue}),p=q({x:a+f[3]},d);st(this.select).selectAll(".placeholder").data(v?[]:[1]).join(function(b){return b.append("text").attr("className","placeholder").styles(p).style("y",function(){var w=this.getBBox();return s+(l-w.height)/2})},function(b){return b.styles(p)},function(b){return b.remove()});var m=ht(this.attributes,"optionLabel"),y=q({x:a+f[3]},m);st(this.select).selectAll(".value").data(v?[v]:[]).join(function(b){return b.append(function(w){return si(w.label)}).attr("className","value").styles(y).style("y",function(){var w=this.getBBox();return s+(l-w.height)/2})},function(b){return b.styles(y)},function(b){return b.remove()})},t.prototype.renderDropdown=function(){var e=this,n,i,a=this.style,s=a.x,o=a.y,l=a.width,c=a.height,u=a.options,h=a.onSelect,d=a.open,f=ht(this.attributes,"dropdown"),g=ht(this.attributes,"option"),v=this.dropdownPadding;st(this.dropdown).maybeAppend(".dropdown-container","g").attr("className","dropdown-container").selectAll(".dropdown-item").data(u,function(y){return y.value}).join(function(y){return y.append(function(b){return new UQ({className:"dropdown-item",style:q(q(q({},b),g),{width:l-v[1]-v[3],selected:b.value===e.currentValue,onClick:function(w,x,S){e.setValue(w),h==null||h(w,x,S),e.dispatchEvent(new we("change",{detail:{value:w,option:x,item:S}})),or(e.dropdown)}})})}).each(function(b,w){var x,S=(x=this.parentNode)===null||x===void 0?void 0:x.children,E=S.reduce(function(_,C,k){return ka.time?1:0};return e.sort(n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"space",{get:function(){var e=this.attributes,n=e.x,i=e.y,a=e.width,s=e.height,o=e.type,l=e.controllerHeight,c=ce(+s-l,0,+s),u=new sn(n,i+ +s-l,+a,l),h,d=0;o==="chart"?(d=35,h=new sn(n,i+c-d,+a,d)):h=new sn;var f=o==="time"?10:c,g=new sn(n,i+(o==="time"?c:c-f),+a,f-d);return{axisBBox:h,controllerBBox:u,timelineBBox:g}},enumerable:!1,configurable:!0}),t.prototype.setBySliderValues=function(e){var n,i,a=this.data,s=N(Array.isArray(e)?e:[0,e],2),o=s[0],l=s[1],c=a.length,u=a[Math.floor(o*c)],h=a[Math.ceil(l*c)-(Array.isArray(e)?0:1)];this.states.values=[(n=u==null?void 0:u.time)!==null&&n!==void 0?n:a[0].time,(i=h==null?void 0:h.time)!==null&&i!==void 0?i:1/0]},t.prototype.setByTimebarValues=function(e){var n,i,a,s=this.data,o=N(Array.isArray(e)?e:[void 0,e],2),l=o[0],c=o[1],u=s.find(function(d){var f=d.time;return f===l}),h=s.find(function(d){var f=d.time;return f===c});this.states.values=[(n=u==null?void 0:u.time)!==null&&n!==void 0?n:(i=s[0])===null||i===void 0?void 0:i.time,(a=h==null?void 0:h.time)!==null&&a!==void 0?a:1/0]},t.prototype.setByIndex=function(e){var n,i,a,s,o=this.data,l=N(e,2),c=l[0],u=l[1];this.states.values=[(i=(n=o[c])===null||n===void 0?void 0:n.time)!==null&&i!==void 0?i:o[0].time,(s=(a=this.data[u])===null||a===void 0?void 0:a.time)!==null&&s!==void 0?s:1/0]},Object.defineProperty(t.prototype,"sliderValues",{get:function(){var e=this.states,n=e.values,i=e.selectionType,a=N(Array.isArray(n)?n:[void 0,n],2),s=a[0],o=a[1],l=this.data,c=l.length,u=i==="value",h=function(){var f=l.findIndex(function(g){var v=g.time;return v===s});return u?0:f>-1?f/c:0},d=function(){if(o===1/0)return 1;var f=l.findIndex(function(g){var v=g.time;return v===o});return f>-1?f/c:u?.5:1};return[h(),d()]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"values",{get:function(){var e=this.states,n=e.values,i=e.selectionType,a=N(Array.isArray(n)?n:[this.data[0].time,n],2),s=a[0],o=a[1];return i==="value"?o:[s,o]},enumerable:!1,configurable:!0}),t.prototype.getDatumByRatio=function(e){var n=this.data,i=n.length,a=Math.floor(e*(i-1));return n[a]},Object.defineProperty(t.prototype,"chartHandleIconShape",{get:function(){var e=this.states.selectionType,n=this.space.timelineBBox.height;return e==="range"?function(i){return new ltt({style:{type:i,height:n,iconSize:n/6}})}:function(){return new Fa({style:{x1:0,y1:-n/2,x2:0,y2:n/2,lineWidth:2,stroke:"#c8c8c8"}})}},enumerable:!1,configurable:!0}),t.prototype.getChartStyle=function(e){var n=this,i=e.x,a=e.y,s=e.width,o=e.height,l=this.states,c=l.selectionType,u=l.chartType,h=this.data,d=this.attributes,f=d.type,g=d.labelFormatter,v=ht(this.attributes,"chart");v.type;var p=fe(v,["type"]),m=c==="range";if(f==="time")return q({handleIconShape:function(){return new ott({})},selectionFill:"#2e7ff8",selectionFillOpacity:1,showLabelOnInteraction:!0,handleLabelDy:m?-15:0,autoFitLabel:m,handleSpacing:m?-15:0,trackFill:"#edeeef",trackLength:s,trackOpacity:.5,trackRadius:o/2,trackSize:o/2,type:c,values:this.sliderValues,formatter:function(w){if(g)return g(w);var x=n.getDatumByRatio(w).time;return typeof x=="number"?ZP(x):hn(x,"YYYY-MM-DD HH:mm:ss")},transform:"translate(".concat(i,", ").concat(a,")"),zIndex:1},p);var y=c==="range"?5:0,b=h.map(function(w){var x=w.value;return x});return q({handleIconOffset:y,handleIconShape:this.chartHandleIconShape,selectionFill:"#fff",selectionFillOpacity:.5,selectionType:"invert",sparklineSpacing:.1,sparklineColumnLineWidth:0,sparklineColor:"#d4e5fd",sparklineAreaOpacity:1,sparklineAreaLineWidth:0,sparklineData:b,sparklineType:u,sparklineScale:.8,trackLength:s,trackSize:o,type:c,values:this.sliderValues,transform:"translate(".concat(i,", ").concat(a,")"),zIndex:1},p)},t.prototype.renderChart=function(e){e===void 0&&(e=this.space.timelineBBox),this.timeline.update(this.getChartStyle(e))},t.prototype.updateSelection=function(){this.timeline.setValues(this.sliderValues,!0),this.handleSliderChange(this.sliderValues)},t.prototype.getAxisStyle=function(e){var n=this.data,i=this.attributes,a=i.interval,s=i.labelFormatter,o=ht(this.attributes,"axis"),l=e.x,c=e.y,u=e.width,h=Q(Q([],N(n),!1),[{time:0}],!1).map(function(f,g,v){var p=f.time;return{label:"".concat(p),value:g/(v.length-1),time:p}}),d=q({startPos:[l,c],endPos:[l+u,c],data:h,labelFilter:function(f,g){return ga?l==="value"?[0,0]:c==="acc"?[E(x),E(x)]:[0,E(S-x)]:x<0?c==="acc"?[0,E(S)]:[E(x+a-S),a]:[E(x),E(S)]},y=m(p);return this.setByIndex(y),this.updateSelection(),y},t.prototype.internalBackward=function(e){var n,i,a=this.moveSelection("backward",e);return e||((i=(n=this.attributes)===null||n===void 0?void 0:n.onBackward)===null||i===void 0||i.call(n),this.dispatchOnChange()),a},t.prototype.backward=function(){this.internalBackward()},t.prototype.internalPlay=function(e){var n=this,i,a,s=this.data,o=this.attributes.loop,l=this.states.speed,c=l===void 0?1:l;this.playInterval=window.setInterval(function(){var u=n.internalForward();u[1]===s.length&&!o&&(n.internalPause(),n.renderController())},1e3/c),this.states.state="play",!e&&((a=(i=this.attributes)===null||i===void 0?void 0:i.onPlay)===null||a===void 0||a.call(i))},t.prototype.play=function(){this.internalPlay()},t.prototype.internalPause=function(e){var n,i;clearInterval(this.playInterval),this.states.state="pause",!e&&((i=(n=this.attributes)===null||n===void 0?void 0:n.onPause)===null||i===void 0||i.call(n))},t.prototype.pause=function(){this.internalPause()},t.prototype.internalForward=function(e){var n,i,a=this.moveSelection("forward",e);return e||((i=(n=this.attributes)===null||n===void 0?void 0:n.onForward)===null||i===void 0||i.call(n),this.dispatchOnChange()),a},t.prototype.forward=function(){this.internalForward()},t.prototype.handleSpeedChange=function(e){var n,i;this.states.speed=e;var a=this.states.state;a==="play"&&(this.internalPause(!0),this.internalPlay(!0)),(i=(n=this.attributes)===null||n===void 0?void 0:n.onSpeedChange)===null||i===void 0||i.call(n,e)},t.prototype.handleSelectionTypeChange=function(e){var n,i;this.states.selectionType=e,this.renderChart(),(i=(n=this.attributes)===null||n===void 0?void 0:n.onSelectionTypeChange)===null||i===void 0||i.call(n,e)},t.prototype.handleChartTypeChange=function(e){var n,i;this.states.chartType=e,this.renderChart(),(i=(n=this.attributes)===null||n===void 0?void 0:n.onChartTypeChange)===null||i===void 0||i.call(n,e)},t.prototype.render=function(){var e=this.space,n=e.axisBBox,i=e.controllerBBox,a=e.timelineBBox;this.renderController(i),this.renderAxis(n),this.renderChart(a),this.states.state==="play"&&this.internalPlay()},t.prototype.destroy=function(){r.prototype.destroy.call(this),this.internalPause(!0)},t.defaultOptions={style:{x:0,y:0,axisLabelFill:"#6e6e6e",axisLabelTextAlign:"left",axisLabelTextBaseline:"top",axisLabelTransform:"translate(5, -12)",axisLineLineWidth:1,axisLineStroke:"#cacdd1",axisTickLength:15,axisTickLineWidth:1,axisTickStroke:"#cacdd1",chartShowLabel:!1,chartType:"line",controllerAlign:"center",controllerHeight:40,data:[],interval:"day",loop:!1,playMode:"acc",selectionType:"range",type:"time"}},t}(ge);function f2(r){const{width:t,height:e,renderer:n}=r,i=dtt(r),a=new Hm({width:t,height:e,container:i,renderer:n||new Lo});return[i,a]}function dtt(r){var t;const{container:e,className:n,graphCanvas:i}=r;if(e)return typeof e=="string"?document.getElementById(e):e;const a=qs(n,!1),{width:s,height:o,containerStyle:l}=r,[c,u]=ftt(r);return Object.assign(a.style,Object.assign({position:"absolute",left:c+"px",top:u+"px",width:s+"px",height:o+"px"},l)),(t=i.getContainer())===null||t===void 0||t.appendChild(a),a}function ftt(r){const{width:t,height:e,placement:n,graphCanvas:i}=r,[a,s]=i.getSize(),[o,l]=oT(n);return[o*(a-t),l*(s-e)]}var gtt=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{const{graph:n}=this.context;n.on(X.AFTER_DRAW,this.createElement)},this.changeState=(n,i)=>{const{graph:a}=this.context,{typePrefix:s}=this,o=nn(n,[s,"id"]),l=nn(n,[s,"style","labelText"]),[c]=o.split("__"),u=this.fieldMap[c].get(l)||[];a.setElementState(Object.fromEntries(u==null?void 0:u.map(h=>[h,i])))},this.click=n=>{if(this.options.trigger==="hover")return;const i=nn(n,[this.typePrefix,"id"]);this.selectedItems.includes(i)?(this.selectedItems=this.selectedItems.filter(a=>a!==i),this.changeState(n,[])):(this.selectedItems.push(i),this.changeState(n,"selected"))},this.mouseleave=n=>{this.options.trigger!=="click"&&(this.selectedItems=[],this.changeState(n,[]))},this.mouseenter=n=>{if(this.options.trigger==="click")return;const i=nn(n,[this.typePrefix,"id"]);this.selectedItems.includes(i)?this.selectedItems=this.selectedItems.filter(a=>a!==i):(this.selectedItems.push(i),this.changeState(n,"active"))},this.setFieldMap=(n,i,a)=>{if(!n)return;const s=this.fieldMap[a];if(s)if(!s.has(n))s.set(n,[i]);else{const o=s.get(n);o&&(o.push(i),s.set(n,o))}},this.getEvents=()=>({mouseenter:this.mouseenter,mouseleave:this.mouseleave,click:this.click}),this.getMarkerData=(n,i)=>{if(!n)return[];const{model:a,element:s}=this.context,{nodes:o,edges:l,combos:c}=a.getData(),u={},h=p=>at(n)?n(p):n,d={node:"circle",edge:"line",combo:"rect"},f={circle:"circle",ellipse:"circle",image:"bowtie",rect:"square",star:"cross",triangle:"triangle",diamond:"diamond",cubic:"dot",line:"hyphen",polyline:"hyphen",quadratic:"hv","cubic-horizontal":"hyphen","cubic-vertical":"line"},g=(p,m)=>s==null?void 0:s.getElementComputedStyle(p,m),v=(p,m)=>{p.forEach(y=>{const{id:b}=y,w=nn(y,["data",h(y)]),x=(s==null?void 0:s.getElementType(m,y))||"circle",S=g(m,y),E=(m==="edge"?S==null?void 0:S.stroke:S==null?void 0:S.fill)||"#1783ff";b&&w&&w.replace(/\s+/g,"")&&(this.setFieldMap(w,b,m),u[w]||(u[w]={id:`${m}__${b}`,label:w,marker:f[x]||d[m],elementType:m,lineWidth:1,stroke:E,fill:E}))})};switch(i){case"node":v(o,"node");break;case"edge":v(l,"edge");break;case"combo":v(c,"combo");break;default:return[]}return Object.values(u)},this.createElement=()=>{if(this.draw){this.updateElement();return}const n=this.options,{width:i,height:a,nodeField:s,edgeField:o,comboField:l,trigger:c,position:u,container:h,containerStyle:d,className:f}=n,g=gtt(n,["width","height","nodeField","edgeField","comboField","trigger","position","container","containerStyle","className"]),v=this.getMarkerData(s,"node"),p=this.getMarkerData(o,"edge"),m=this.getMarkerData(l,"combo"),y=[...v,...m,...p],b=Object.assign({width:i,height:a,data:y,itemMarkerLineWidth:({lineWidth:S})=>S,itemMarker:({marker:S})=>S,itemMarkerStroke:({stroke:S})=>S,itemMarkerFill:({fill:S})=>S,gridCol:v.length},g,this.getEvents()),w=new qQ({className:"legend",style:b});this.category=w,this.upsertCanvas().appendChild(w),this.draw=!0},this.bindEvents()}update(t){super.update(t),this.clear(),this.createElement()}clear(){var t,e;(t=this.canvas)===null||t===void 0||t.destroy(),(e=this.container)===null||e===void 0||e.remove(),this.canvas=void 0,this.container=void 0,this.draw=!1}updateElement(){this.category&&this.category.update({itemMarkerOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5,itemLabelOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5})}upsertCanvas(){if(this.canvas)return this.canvas;const t=this.context.canvas,[e,n]=t.getSize(),{width:i=e,height:a=n,position:s,container:o,containerStyle:l,className:c}=this.options,[u,h]=f2({width:i,height:a,graphCanvas:t,container:o,containerStyle:l,placement:s,className:"legend"});return this.container=u,c&&u.classList.add(c),this.canvas=h,this.canvas}destroy(){this.clear(),this.context.graph.off(X.AFTER_DRAW,this.createElement),super.destroy()}}Qh.defaultOptions={position:"bottom",trigger:"hover",orientation:"horizontal",layout:"flex",itemSpacing:4,rowPadding:10,colPadding:10,itemMarkerSize:16,itemLabelFontSize:16,width:240,height:160};class td extends Ue{constructor(t,e){super(t,Object.assign({},td.defaultOptions,e)),this.onDraw=n=>{var i;!((i=n==null?void 0:n.data)===null||i===void 0)&&i.render||this.onRender()},this.shapes=new Map,this.landmarkMap=new Map,this.mask=null,this.isMaskDragging=!1,this.onMaskDragStart=n=>{this.mask&&(this.isMaskDragging=!0,this.mask.setPointerCapture(n.pointerId),this.mask.addEventListener("pointermove",this.onMaskDrag),this.mask.addEventListener("pointerup",this.onMaskDragEnd),this.mask.addEventListener("pointercancel",this.onMaskDragEnd))},this.onMaskDrag=n=>{if(!this.mask||!this.isMaskDragging)return;const{size:[i,a]}=this.options,{movementX:s,movementY:o}=n,{left:l,top:c,width:u,height:h}=this.mask.style,[,,d,f]=this.maskBBox;let g=parseInt(l)+s,v=parseInt(c)+o,p=parseInt(u),m=parseInt(h);g<0&&(g=0),v<0&&(v=0),g+p>i&&(g=wi(i-p,0)),v+m>a&&(v=wi(a-m,0)),p0?(g=wi(g-s,0),p=bi(p+s,i)):s<0&&(p=bi(p-s,i))),m0?(v=wi(v-o,0),m=bi(m+o,a)):o<0&&(m=bi(m-o,a))),Object.assign(this.mask.style,{left:g+"px",top:v+"px",width:p+"px",height:m+"px"});const y=parseInt(l)-g,b=parseInt(c)-v;if(y===0&&b===0)return;const w=this.context.canvas.getCamera().getZoom(),x=this.canvas.getCamera().getZoom(),S=w/x;this.context.graph.translateBy([y*S,b*S],!1)},this.onMaskDragEnd=n=>{this.mask&&(this.isMaskDragging=!1,this.mask.releasePointerCapture(n.pointerId),this.mask.removeEventListener("pointermove",this.onMaskDrag),this.mask.removeEventListener("pointerup",this.onMaskDragEnd),this.mask.removeEventListener("pointercancel",this.onMaskDragEnd))},this.onTransform=WM(()=>{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=Vo(()=>{this.renderMinimap(),this.renderMask()},this.options.delay,!0)}bindEvents(){const{graph:t}=this.context;t.on(X.AFTER_DRAW,this.onDraw),t.on(X.AFTER_RENDER,this.onRender),t.on(X.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:t}=this.context;t.off(X.AFTER_DRAW,this.onDraw),t.off(X.AFTER_RENDER,this.onRender),t.off(X.AFTER_TRANSFORM,this.onTransform)}renderMinimap(){const t=this.getElements(),e=this.initCanvas();this.setShapes(e,t)}getElements(){const{filter:t}=this.options,{model:e}=this.context,n=e.getData();if(!t)return n;const{nodes:i,edges:a,combos:s}=n;return{nodes:i.filter(o=>t(F(o),"node")),edges:a.filter(o=>t(F(o),"edge")),combos:s.filter(o=>t(F(o),"combo"))}}setShapes(t,e){const{nodes:n,edges:i,combos:a}=e,{shape:s}=this.options,{element:o}=this.context;if(s==="key"){const c=new Set,u=h=>{const d=F(h);c.add(d);const f=o.getElement(d);if(!f)return;const g=f.getShape("key"),v=this.shapes.get(d)||g.cloneNode();v.setPosition(g.getPosition()),f.style.zIndex&&(v.style.zIndex=f.style.zIndex),v.id=f.id,this.shapes.has(d)?Object.entries(g.attributes).forEach(([p,m])=>{v.style[p]!==m&&(v.style[p]=m)}):(t.appendChild(v),this.shapes.set(d,v))};i.forEach(u),a.forEach(u),n.forEach(u),this.shapes.forEach((h,d)=>{c.has(d)||(t.removeChild(h),this.shapes.delete(d))});return}const l=(c,u)=>{const d=o.getElement(c).getPosition();return u.setPosition(d),u};t.removeChildren(),i.forEach(c=>t.appendChild(s(F(c),"edge"))),a.forEach(c=>{t.appendChild(l(F(c),s(F(c),"combo")))}),n.forEach(c=>{t.appendChild(l(F(c),s(F(c),"node")))})}initCanvas(){const{renderer:t,size:[e,n]}=this.options;if(this.canvas){const{width:i,height:a}=this.canvas.getConfig();(e!==i||n!==a)&&this.canvas.resize(e,n),t&&this.canvas.setRenderer(t)}else{const{className:i,position:a,container:s,containerStyle:o}=this.options,[l,c]=f2({renderer:t,width:e,height:n,placement:a,className:"minimap",container:s,containerStyle:o,graphCanvas:this.context.canvas});i&&l.classList.add(i),this.container=l,this.canvas=c}return this.setCamera(),this.canvas}createLandmark(t,e,n){const i=`${t.join(",")}-${e.join(",")}-${n}`;if(this.landmarkMap.has(i))return this.landmarkMap.get(i);const s=this.canvas.getCamera().createLandmark(i,{position:t,focalPoint:e,zoom:n});return this.landmarkMap.set(i,s),s}setCamera(){var t;const{canvas:e}=this.context,n=(t=this.canvas)===null||t===void 0?void 0:t.getCamera();if(!n)return;const{size:[i,a],padding:s}=this.options,[o,l,c,u]=Pr(s),{min:h,max:d,center:f}=e.getBounds("elements"),g=d[0]-h[0],v=d[1]-h[1],p=i-u-l,m=a-o-c,y=p/g,b=m/v,w=Math.min(y,b),x=this.createLandmark(f,f,w);n.gotoLandmark(x,0)}get maskBBox(){const{canvas:t}=this.context,e=t.getSize(),n=t.getCanvasByViewport([0,0]),i=t.getCanvasByViewport(e),a=this.canvas.canvas2Viewport(sr(n)),s=this.canvas.canvas2Viewport(sr(i)),o=s.x-a.x,l=s.y-a.y;return[a.x,a.y,o,l]}calculateMaskBBox(){const{size:[t,e]}=this.options;let[n,i,a,s]=this.maskBBox;return n<0&&(a=bi(a+n,t),n=0),i<0&&(s=bi(s+i,e),i=0),n+a>t&&(a=wi(t-n,0)),i+s>e&&(s=wi(e-i,0)),[bi(n,t),bi(i,e),wi(a,0),wi(s,0)]}renderMask(){const{maskStyle:t}=this.options;this.mask||(this.mask=document.createElement("div"),this.mask.addEventListener("pointerdown",this.onMaskDragStart)),this.container.appendChild(this.mask),Object.assign(this.mask.style,Object.assign(Object.assign({},t),{cursor:"move",position:"absolute",pointerEvents:"auto"})),this.updateMask()}updateMask(){if(!this.mask)return;const[t,e,n,i]=this.calculateMaskBBox();Object.assign(this.mask.style,{top:e+"px",left:t+"px",width:n+"px",height:i+"px"})}destroy(){var t;this.unbindEvents(),this.canvas.destroy(),(t=this.mask)===null||t===void 0||t.remove(),super.destroy()}}td.defaultOptions={size:[240,160],shape:"key",padding:10,position:"right-bottom",maskStyle:{border:"1px solid #ddd",background:"rgba(0, 0, 0, 0.1)"},containerStyle:{border:"1px solid #ddd",background:"#fff"},delay:128};const bi=(r,t)=>Math.min(r,t),wi=(r,t)=>Math.max(r,t);var hm=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};const dm={x1:0,y1:0,x2:0,y2:0,visibility:"hidden"};class ed extends Ue{constructor(t,e){super(t,Object.assign({},ed.defaultOptions,e)),this.initSnapline=()=>{const n=this.context.canvas.getLayer("transient");this.horizontalLine||(this.horizontalLine=n.appendChild(new Fa({style:Object.assign(Object.assign({},dm),this.options.horizontalLineStyle)}))),this.verticalLine||(this.verticalLine=n.appendChild(new Fa({style:Object.assign(Object.assign({},dm),this.options.verticalLineStyle)})))},this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!0,this.autoSnapToLine=(n,i,a)=>hm(this,void 0,void 0,function*(){const{verticalX:s,horizontalY:o}=a,{tolerance:l}=this.options,{min:[c,u],max:[h,d],center:[f,g]}=i;let v=0,p=0;s!==null&&(Ye(h,s){const{target:i}=n,a=.5;if(this.isHorizontalSticking||this.isVerticalSticking){const[s,o]=this.getDelta(n);if(this.isHorizontalSticking&&this.isVerticalSticking&&Math.abs(s)<=a&&Math.abs(o)<=a)return this.context.graph.translateElementBy({[i.id]:[-s,-o]},!1),!1;if(this.isHorizontalSticking&&Math.abs(o)<=a)return this.context.graph.translateElementBy({[i.id]:[0,-o]},!1),!1;if(this.isVerticalSticking&&Math.abs(s)<=a)return this.context.graph.translateElementBy({[i.id]:[-s,0]},!1),!1;this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!1,setTimeout(()=>{this.enableStick=!0},200)}return this.enableStick},this.calcSnaplineMetadata=(n,i)=>{const{tolerance:a,shape:s}=this.options,{min:[o,l],max:[c,u],center:[h,d]}=i;let f=null,g=null,v=null,p=null,m=null,y=null;return this.getNodes().some(b=>{if(ue(n.id,b.id))return!1;const w=Rk(b,s).getRenderBounds(),{min:[x,S],max:[E,_],center:[C,k]}=w;return f===null&&(Ye(C,h){this.initSnapline()},this.onDrag=n=>hm(this,void 0,void 0,function*(){const{target:i}=n;if(this.options.autoSnap&&!this.enableSnap(n))return;const a=Rk(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 EF(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||dm.lineWidth||1)/this.context.graph.getZoom()}updateSnapline(t){const{verticalX:e,verticalMinY:n,verticalMaxY:i,horizontalY:a,horizontalMinX:s,horizontalMaxX:o}=t,[l,c]=this.context.canvas.getSize(),{offset:u}=this.options;a!==null?Object.assign(this.horizontalLine.style,{x1:u===1/0?0:s-u,y1:a,x2:u===1/0?l:o+u,y2:a,visibility:"visible",lineWidth:this.getLineWidth("horizontal")}):this.horizontalLine.style.visibility="hidden",e!==null?Object.assign(this.verticalLine.style,{x1:e,y1:u===1/0?0:n-u,x2:e,y2:u===1/0?c:i+u,visibility:"visible",lineWidth:this.getLineWidth("vertical")}):this.verticalLine.style.visibility="hidden"}getDelta(t){const e=this.context.graph.getZoom();return ur([t.dx,t.dy],e)}bindEvents(){return hm(this,void 0,void 0,function*(){const{graph:t}=this.context;t.on(Vn.DRAG_START,this.onDragStart),t.on(Vn.DRAG,this.onDrag),t.on(Vn.DRAG_END,this.onDragEnd)})}unbindEvents(){const{graph:t}=this.context;t.off(Vn.DRAG_START,this.onDragStart),t.off(Vn.DRAG,this.onDrag),t.off(Vn.DRAG_END,this.onDragEnd)}destroyElements(){var t,e;(t=this.horizontalLine)===null||t===void 0||t.destroy(),(e=this.verticalLine)===null||e===void 0||e.destroy()}destroy(){this.destroyElements(),this.unbindEvents(),super.destroy()}}ed.defaultOptions={tolerance:5,offset:20,autoSnap:!0,shape:"key",verticalLineStyle:{stroke:"#1783FF"},horizontalLineStyle:{stroke:"#1783FF"},filter:()=>!0};const Ye=(r,t)=>Math.abs(r-t),Rk=(r,t)=>typeof t=="function"?t(r):r.getShape(t);var vtt=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})},ptt=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{var g;const v=Object.assign(Object.assign({x:d[0]/2-l/2,y:f,onChange:p=>{const m=(Dn(p)?p:[p,p]).map(y=>e6(y)?y.getTime():y);this.options.mode==="modify"?this.filterElements(m):this.hiddenElements(m),n==null||n(m)}},h),{data:a.map(p=>nt(p)?{time:p,value:0}:p),width:l,height:c,type:i});this.timebar?this.timebar.update(v):(this.timebar=new htt({style:v}),(g=this.canvas)===null||g===void 0||g.appendChild(this.timebar))})}upsertCanvas(){if(this.canvas)return this.canvas;const{className:t,height:e,position:n}=this.options,i=this.context.canvas,[a]=i.getSize(),[s,,o]=this.padding,[l,c]=f2({width:a,height:e+s+o,graphCanvas:i,className:"timebar",placement:n});return this.container=l,t&&l.classList.add(t),this.canvas=c,this.canvas}filterElements(t){return vtt(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=Lk(this.originalData);n.forEach(c=>{const u=`${c}s`;o[u]=(this.originalData[u]||[]).filter(h=>{const d=i(h);return!!Dk(d,t)})});const l=[...o.nodes,...o.combos].map(c=>F(c));o.edges=o.edges.filter(c=>{const u=c.source,h=c.target;return l.includes(u)&&l.includes(h)}),a.setData(o),yield(e=s.draw({animation:!1,silence:!0}))===null||e===void 0?void 0:e.finished})}hiddenElements(t){const{graph:e}=this.context,{elementTypes:n,getTime:i}=this.options,a=[],s=[];n.forEach(o=>{var l;const c=`${o}s`;(((l=this.originalData)===null||l===void 0?void 0:l[c])||[]).forEach(h=>{const d=F(h),f=i(h);Dk(f,t)?s.push(d):a.push(d)})}),e.hideElement(a,!1),e.showElement(s,!1)}destroy(){var t,e,n;const{graph:i}=this.context;this.originalData&&i.setData(Object.assign({},this.originalData)),(t=this.timebar)===null||t===void 0||t.destroy(),(e=this.canvas)===null||e===void 0||e.destroy(),(n=this.container)===null||n===void 0||n.remove(),this.originalData=void 0,this.container=void 0,this.timebar=void 0,this.canvas=void 0,super.destroy()}}nd.defaultOptions={position:"bottom",enable:!0,timebarType:"time",className:"g6-timebar",width:450,height:60,zIndex:3,elementTypes:["node"],padding:10,mode:"modify",getTime:r=>ytt(r,mtt,void 0),loop:!1};const Lk=r=>{const{nodes:t=[],edges:e=[],combos:n=[]}=r;return{nodes:[...t],edges:[...e],combos:[...n]}},Dk=(r,t)=>{if(nt(t))return r===t;const[e,n]=t;return r>=e&&r<=n},ytt=(r,t,e)=>{var n;for(let i=0;i{t[n]="8px"}),t.flexDirection=r.startsWith("top")||r.startsWith("bottom")?"row":"column",t}const wtt=` .g6-toolbar { position: absolute; z-index: 100; display: flex; flex-direction: row; align-items: center; justify-content: center; border-radius: 4px; box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1); opacity: 0.65; } .g6-toolbar .g6-toolbar-item { display: inline-block; width: 16px; height: 16px; padding: 4px; cursor: pointer; box-sizing: content-box; } .g6-toolbar .g6-toolbar-item:hover { background-color: #f0f0f0; } .g6-toolbar .g6-toolbar-item svg { display: inline-block; width: 100%; height: 100%; pointer-events: none; } `,xtt=` `;var Ik=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class rd extends Ue{constructor(t,e){super(t,Object.assign({},rd.defaultOptions,e)),this.$element=qs("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),xy("g6-toolbar-css","style",{},wtt,document.head),xy("g6-toolbar-svgicon","div",{display:"none"},xtt),this.$element.addEventListener("click",this.onToolbarItemClick),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return Ik(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,btt(i)),this.$element.innerHTML=yield this.getDOMContent()})}destroy(){this.$element.removeEventListener("click",this.onToolbarItemClick),this.$element.remove(),super.destroy()}getDOMContent(){return Ik(this,void 0,void 0,function*(){return(yield this.options.getItems()).map(e=>`
    `).join("")})}}rd.defaultOptions={position:"top-left"};var Fk=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class id extends Ue{constructor(t,e){super(t,Object.assign({},id.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=>Fk(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=>Fk(this,void 0,void 0,function*(){var i,a;const{client:s,target:{id:o}}=n;if(Zu(n.target))return;const l=this.context.graph.getElementType(o),{getContent:c,title:u}=this.options,h=this.getElementData(o,l);if(!this.tooltipElement||!this.isEnable(n,h))return;let d={};if(c){if(d.content=yield c(n,h),!d.content)return}else{const v=this.context.graph.getElementRenderStyle(o),p=l==="node"?v.fill:v.stroke;d={title:u||l,data:h.map(m=>({name:"ID",value:m.id||`${m.source} -> ${m.target}`,color:p}))}}this.currentTarget=o;let f,g;if(s)f=s.x,g=s.y;else{const v=nn(h,"0.style",{x:0,y:0});f=v.x,g=v.y}(a=(i=this.options).onOpenChange)===null||a===void 0||a.call(i,!0),this.tooltipElement.update(Object.assign(Object.assign(Object.assign({},this.tooltipStyleProps),{x:f,y:g,style:{".tooltip":{visibility:"visible"}}}),d))}),this.hide=n=>{var i,a,s,o,l;if(!n){(a=(i=this.options).onOpenChange)===null||a===void 0||a.call(i,!1),(s=this.tooltipElement)===null||s===void 0||s.hide(),this.currentTarget=null;return}if(!this.tooltipElement||!this.currentTarget)return;const{client:{x:c,y:u}}=n;(l=(o=this.options).onOpenChange)===null||l===void 0||l.call(o,!1),this.tooltipElement.hide(c,u),this.currentTarget=null},this.initTooltip=()=>{var n;const i=new HQ({className:"tooltip",style:this.tooltipStyleProps});return(n=this.container)===null||n===void 0||n.appendChild(i.HTMLTooltipElement),i},this.render(),this.bindEvents()}getEvents(){return this.options.trigger==="click"?{"node:click":this.onClick,"edge:click":this.onClick,"combo:click":this.onClick,"canvas:click":this.onPointerLeave,contextmenu:this.onPointerLeave,drag:this.onPointerLeave}:{"node:pointerenter":this.onPointerEnter,"node:pointermove":this.onPointerMove,"canvas:pointermove":this.onCanvasMove,"edge:pointerenter":this.onPointerEnter,"edge:pointermove":this.onPointerMove,"combo:pointerenter":this.onPointerEnter,"combo:pointermove":this.onPointerMove,contextmenu:this.onPointerLeave,"node:drag":this.onPointerLeave}}update(t){var e;this.unbindEvents(),super.update(t),this.tooltipElement&&((e=this.container)===null||e===void 0||e.removeChild(this.tooltipElement.HTMLTooltipElement)),this.tooltipElement=this.initTooltip(),this.bindEvents()}render(){const{canvas:t}=this.context,e=t.getContainer();e&&(this.container=e,this.tooltipElement=this.initTooltip())}unbindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach(n=>{t.off(n,e[n])})}bindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach(n=>{t.on(n,e[n])})}get tooltipStyleProps(){const{canvas:t}=this.context,{center:e}=t.getBounds(),n=t.getContainer(),{top:i,left:a}=n.getBoundingClientRect(),{style:s,position:o,enterable:l,container:c={x:-a,y:-i},title:u,offset:h}=this.options,[d,f]=e,[g,v]=t.getSize();return{x:d,y:f,container:c,title:u,bounding:{x:0,y:0,width:g,height:v},position:o,enterable:l,offset:h,style:s}}destroy(){var t;this.unbindEvents(),this.tooltipElement&&((t=this.container)===null||t===void 0||t.removeChild(this.tooltipElement.HTMLTooltipElement)),super.destroy()}}id.defaultOptions={trigger:"hover",position:"top-right",enterable:!1,enable:!0,offset:[10,10],style:{".tooltip":{visibility:"hidden"}}};var JP=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};let as;function QP(r,t){return as||(as=document.createElement("canvas")),as.width=r,as.height=t,as.getContext("2d").clearRect(0,0,r,t),as}function Ett(r,t,e,n){return JP(this,void 0,void 0,function*(){const i=QP(r,t),a=i.getContext("2d"),{rotate:s,opacity:o,textFill:l,textFontSize:c,textFontFamily:u,textFontVariant:h,textFontWeight:d,textAlign:f,textBaseline:g}=n;return a.textAlign=f,a.textBaseline=g,a.translate(r/2,t/2),a.font=`${c}px ${u} ${h} ${d}`,s&&a.rotate(s),o&&(a.globalAlpha=o),l&&(a.fillStyle=l,a.fillText(`${e}`,0,0)),i.toDataURL()})}function Stt(r,t,e,n){return JP(this,void 0,void 0,function*(){const i=QP(r,t),a=i.getContext("2d"),{rotate:s,opacity:o}=n;s&&a.rotate(s),o&&(a.globalAlpha=o);const l=new Image;return l.crossOrigin="anonymous",l.src=e,new Promise(c=>{l.onload=function(){const u=r>l.width?(r-l.width)/2:0,h=t>l.height?(t-l.height)/2:0;a.drawImage(l,0,0,l.width,l.height,u,h,r-u*2,t-h*2),c(i.toDataURL())}})})}var _tt=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})},ktt=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);isuper.update}});return _tt(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=ktt(n,["width","height","text","imageURL"]);Object.keys(l).forEach(u=>{u.startsWith("background")&&(this.$element.style[u]=t[u])});const c=o?yield Stt(i,a,o,l):yield Ett(i,a,s,l);this.$element.style.backgroundImage=`url(${c})`})}destroy(){super.destroy(),this.$element.remove()}}ad.defaultOptions={width:200,height:100,opacity:.2,rotate:Math.PI/12,text:"",textFill:"#000",textFontSize:16,textAlign:"center",textBaseline:"middle",backgroundRepeat:"repeat"};const Mtt=["#7E92B5","#F4664A","#FFBE3A"],Ctt={type:"group",color:["#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]},Ttt={type:"group",color:["#99ADD1","#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]};function tN(r){const{bgColor:t,textColor:e,nodeColor:n,nodeColorDisabled:i,nodeStroke:a,nodeHaloStrokeOpacityActive:s=.15,nodeHaloStrokeOpacitySelected:o=.25,nodeOpacityDisabled:l=.06,nodeIconOpacityInactive:c=.85,nodeOpacityInactive:u=.25,nodeBadgePalette:h=Mtt,nodePaletteOptions:d=Ctt,edgeColor:f,edgeColorDisabled:g,edgePaletteOptions:v=Ttt,comboColor:p,comboColorDisabled:m,comboStroke:y,comboStrokeDisabled:b,edgeColorInactive:w}=r;return{background:t,node:{palette:d,style:{donutOpacity:1,badgeBackgroundOpacity:1,badgeFill:"#fff",badgeFontSize:8,badgePadding:[0,4],badgePalette:h,fill:n,fillOpacity:1,halo:!1,iconFill:"#fff",iconOpacity:1,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelFill:e,labelFillOpacity:.85,labelLineHeight:16,labelPadding:[0,2],labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelOffsetY:2,lineWidth:0,portFill:n,portLineWidth:1,portStroke:a,portStrokeOpacity:.65,size:32,stroke:a,strokeOpacity:1,zIndex:2},state:{selected:{halo:!0,haloLineWidth:24,haloStrokeOpacity:o,labelFontSize:12,labelFontWeight:"bold",lineWidth:4,stroke:a},active:{halo:!0,haloLineWidth:12,haloStrokeOpacity:s},highlight:{labelFontWeight:"bold",lineWidth:4,stroke:a,strokeOpacity:.85},inactive:{badgeBackgroundOpacity:u,donutOpacity:u,fillOpacity:u,iconOpacity:c,labelFill:e,labelFillOpacity:u,strokeOpacity:u},disabled:{badgeBackgroundOpacity:.25,donutOpacity:l,fill:i,fillOpacity:l,iconFill:i,iconOpacity:.25,labelFill:e,labelFillOpacity:.25,strokeOpacity:l}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"node-expand",collapse:"node-collapse",update:[{fields:["x","y","fill","stroke"]}],translate:[{fields:["x","y"]}]}},edge:{palette:v,style:{badgeBackgroundFill:f,badgeFill:"#fff",badgeFontSize:8,badgeOffsetX:10,fillOpacity:1,halo:!1,haloLineWidth:12,haloStrokeOpacity:1,increasedLineWidthForHitTesting:2,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[4,4,4,4],labelFill:e,labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelPlacement:"center",labelTextBaseline:"middle",lineWidth:1,stroke:f,strokeOpacity:1,zIndex:1},state:{selected:{halo:!0,haloStrokeOpacity:.25,labelFontSize:14,labelFontWeight:"bold",lineWidth:3},active:{halo:!0,haloStrokeOpacity:.15},highlight:{labelFontWeight:"bold",lineWidth:3},inactive:{stroke:w,fillOpacity:.08,labelOpacity:.25,strokeOpacity:.08,badgeBackgroundOpacity:.25},disabled:{stroke:g,fillOpacity:.45,strokeOpacity:.45,labelOpacity:.25,badgeBackgroundOpacity:.45}},animation:{enter:"fade",exit:"fade",expand:"path-in",collapse:"path-out",show:"fade",hide:"fade",update:[{fields:["sourceNode","targetNode"]},{fields:["stroke"],shape:"key"}],translate:[{fields:["sourceNode","targetNode"]}]}},combo:{style:{collapsedMarkerFill:t,collapsedMarkerFontSize:12,collapsedMarkerFillOpacity:1,collapsedSize:32,collapsedFillOpacity:1,fill:p,halo:!1,haloLineWidth:12,haloStroke:y,haloStrokeOpacity:.25,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[2,4,2,4],labelFill:e,labelFontSize:12,labelFontWeight:400,labelOpacity:1,lineDash:0,lineWidth:1,fillOpacity:.04,strokeOpacity:1,padding:10,stroke:y},state:{selected:{halo:!0,labelFontSize:14,labelFontWeight:700,lineWidth:4},active:{halo:!0},highlight:{labelFontWeight:700,lineWidth:4},inactive:{fillOpacity:.65,labelOpacity:.25,strokeOpacity:.65},disabled:{fill:m,fillOpacity:.25,labelOpacity:.25,stroke:b,strokeOpacity:.25}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"combo-expand",collapse:"combo-collapse",update:[{fields:["x","y"]},{fields:["fill","stroke","lineWidth"],shape:"key"}],translate:[{fields:["x","y"]}]}}}}const Ott={type:"group",color:["#637088","#0F55A6","#008383","#9C5D38","#8B53A6","#4E40A6","#8F6608","#3E801D","#A65383","#175E75","#0F8248"]},Att={bgColor:"#000000",comboColor:"#fdfdfd",comboColorDisabled:"#d0e4ff",comboStroke:"#99add1",comboStrokeDisabled:"#969696",edgeColor:"#637088",edgeColorDisabled:"#637088",edgeColorInactive:"#D0E4FF",edgePaletteOptions:Ott,nodeColor:"#1783ff",nodeColorDisabled:"#D0E4FF",nodeHaloStrokeOpacityActive:.25,nodeHaloStrokeOpacitySelected:.45,nodeIconOpacityInactive:.45,nodeOpacityDisabled:.25,nodeOpacityInactive:.45,nodeStroke:"#d0e4ff",textColor:"#ffffff"},Ptt=tN(Att),Ntt={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"},Rtt=tN(Ntt);class di extends u1{beforeDraw(t,e){return t}afterLayout(t,e){}}class Ltt extends di{beforeDraw(t){const{model:e}=this.context,n=t.add.combos,i=a=>{const s=[];return a.forEach((o,l)=>{const u=e.getAncestorsData(l,"combo").map(h=>F(h)).reverse();s.push([l,o,u.length])}),new Map(s.sort(([,,o],[,,l])=>l-o).map(([o,l])=>[o,l]))};return t.add.combos=i(n),t.update.combos=i(t.update.combos),t}}function Pn(r,t,e,n,i){const a=F(n),s=`${e}s`,o=i?n:r.add[s].get(a)||r.update[s].get(a)||r.remove[s].get(a)||n;Object.entries(r).forEach(([l,c])=>{t===l?c[s].set(a,o):c[s].delete(a)})}function zc(r,t){return Object.keys(r).every(e=>r[e]===t[e])}class Dtt extends di{beforeDraw(t,e){if(e.stage==="visibility"||!this.context.model.model.hasTreeStructure(jt))return t;const{model:n}=this.context,{add:i,update:a}=t,s=[...t.update.combos.entries(),...t.add.combos.entries()];for(;s.length;){const[o,l]=s.pop();if(mn(l)){const c=n.getDescendantsData(o),u=c.map(F),{internal:h,external:d}=ey(u,f=>n.getRelatedEdgesData(f));c.forEach(f=>{const g=F(f),v=s.findIndex(([m])=>m===g);v!==-1&&s.splice(v,1);const p=n.getElementType(g);Pn(t,"remove",p,f)}),h.forEach(f=>Pn(t,"remove","edge",f)),d.forEach(f=>{var g;const v=F(f);((g=this.context.element)===null||g===void 0?void 0:g.getElement(v))?a.edges.set(v,f):i.edges.set(v,f)})}else{const c=n.getChildrenData(o),u=c.map(F),{edges:h}=ey(u,d=>n.getRelatedEdgesData(d));[...c,...h].forEach(d=>{var f;const g=F(d),v=n.getElementType(g);((f=this.context.element)===null||f===void 0?void 0:f.getElement(g))?Pn(t,"update",v,d):Pn(t,"add",v,d),v==="combo"&&s.push([g,d])})}}return t}}const Bk=(r,t,e,n)=>{const i=`${e}s`,a=F(n);!r.add[i].has(a)&&!r.update[i].has(a)&&r[t][i].set(F(n),n)};class Itt extends di{getElement(t){return this.context.element.getElement(t)}handleExpand(t,e){if(Bk(e,"add","node",t),mn(t))return;const n=F(t);Bk(e,"add","node",t),this.context.model.getRelatedEdgesData(n,"out").forEach(s=>{Pn(e,"add","edge",s)}),this.context.model.getChildrenData(n).forEach(s=>{this.handleExpand(s,e)})}beforeDraw(t){const{graph:e,model:n}=this.context;if(!n.model.hasTreeStructure(Cn))return t;const{add:{nodes:i,edges:a},update:{nodes:s}}=t,o=new Map,l=new Map;i.forEach((u,h)=>{mn(u)&&o.set(h,u)}),a.forEach(u=>{if(e.getElementType(u.source)!=="node")return;const h=e.getNodeData(u.source);mn(h)&&o.set(u.source,h)}),s.forEach((u,h)=>{const d=this.getElement(h);if(!d)return;const f=d.attributes.collapsed;mn(u)?f||o.set(h,u):f&&l.set(h,u)});const c=new Set;return o.forEach((u,h)=>{n.getDescendantsData(h).forEach(f=>{const g=F(f);if(c.has(g))return;Pn(t,"remove","node",f),n.getRelatedEdgesData(g).forEach(p=>{Pn(t,"remove","edge",p)}),c.add(g)})}),l.forEach((u,h)=>{if(n.getAncestorsData(h,Cn).some(mn)){Pn(t,"remove","node",u);return}this.handleExpand(u,t)}),t}}function mo(r,t,e,n=!1){const i=Um[r][t];!n&&i?i!==e&&Ar.warn(`The extension ${t} of ${r} has been registered before.`):Object.assign(Um[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 eN=function(){function r(t){V(this,r),this.dragndropPluginOptions=t}return W(r,[{key:"apply",value:function(e){var n=this,i=e.renderingService,a=e.renderingContext,s=a.root.ownerDocument,o=s.defaultView,l=function(u){var h=u.target,d=h===s,f=d&&n.dragndropPluginOptions.isDocumentDraggable?s:h.closest&&h.closest("[draggable=true]");if(f){var g=!1,v=u.timeStamp,p=[u.clientX,u.clientY],m=null,y=[u.clientX,u.clientY],b=function(){var x=Gi(We().mark(function S(E){var _,C,k,M,T,O;return We().wrap(function(L){for(;;)switch(L.prev=L.next){case 0:if(g){L.next=8;break}if(_=E.timeStamp-v,C=fn([E.clientX,E.clientY],p),!(_<=n.dragndropPluginOptions.dragstartTimeThreshold||C<=n.dragndropPluginOptions.dragstartDistanceThreshold)){L.next=5;break}return L.abrupt("return");case 5:E.type="dragstart",f.dispatchEvent(E),g=!0;case 8:if(E.type="drag",E.dx=E.clientX-y[0],E.dy=E.clientY-y[1],f.dispatchEvent(E),y=[E.clientX,E.clientY],d){L.next=21;break}return k=n.dragndropPluginOptions.overlap==="pointer"?[E.canvasX,E.canvasY]:h.getBounds().center,L.next=17,s.elementsFromPoint(k[0],k[1]);case 17:M=L.sent,T=M[M.indexOf(h)+1],O=(T==null?void 0:T.closest("[droppable=true]"))||(n.dragndropPluginOptions.isDocumentDroppable?s:null),m!==O&&(m&&(E.type="dragleave",E.target=m,m.dispatchEvent(E)),O&&(E.type="dragenter",E.target=O,O.dispatchEvent(E)),m=O,m&&(E.type="dragover",E.target=m,m.dispatchEvent(E)));case 21:case"end":return L.stop()}},S)}));return function(E){return x.apply(this,arguments)}}();o.addEventListener("pointermove",b);var w=function(S){if(g){S.detail={preventClick:!0};var E=S.clone();m&&(E.type="drop",E.target=m,m.dispatchEvent(E)),E.type="dragend",f.dispatchEvent(E),g=!1}o.removeEventListener("pointermove",b)};h.addEventListener("pointerup",w,{once:!0}),h.addEventListener("pointerupoutside",w,{once:!0})}};i.hooks.init.tap(r.tag,function(){o.addEventListener("pointerdown",l)}),i.hooks.destroy.tap(r.tag,function(){o.removeEventListener("pointerdown",l)})}}])}();eN.tag="Dragndrop";var Ftt=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return V(this,t),e=mt(this,t),e.name="dragndrop",e.options=n,e}return pt(t,r),W(t,[{key:"init",value:function(){this.addRenderingPlugin(new eN(vt({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}},{key:"setOptions",value:function(n){Object.assign(this.plugins[0].dragndropPluginOptions,n)}}])}(Ji),zk=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})},$k=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{const d=new Hm(Object.assign(Object.assign({},o),{supportsMutipleCanvasesInOneContainer:s,renderer:c[h],background:s?h==="background"?i:void 0:i}));return[h,d]}));Vk(u),this.extends={config:this.config,renderer:n,renderers:c,layers:u}}get ready(){return Promise.all(Object.entries(this.getLayers()).map(([,t])=>t.ready))}resize(t,e){Object.assign(this.extends.config,{width:t,height:e}),Object.values(this.getLayers()).forEach(n=>{const i=n.getCamera(),a=i.getPosition(),s=i.getFocalPoint();n.resize(t,e),i.setPosition(a),i.setFocalPoint(s)})}getBounds(t){return Jo(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=Wk(t,this.config.enableMultiLayer?qk:jk);this.extends.renderers=e,Object.entries(e).forEach(([n,i])=>this.getLayer(n).setRenderer(i)),Vk(this.getLayers())}getCanvasByViewport(t){return Ge(this.getLayer().viewport2Canvas(sr(t)))}getViewportByCanvas(t){return Ge(this.getLayer().canvas2Viewport(sr(t)))}getViewportByClient(t){return Ge(this.getLayer().client2Viewport(sr(t)))}getClientByViewport(t){return Ge(this.getLayer().viewport2Client(sr(t)))}getClientByCanvas(t){return this.getClientByViewport(this.getViewportByCanvas(t))}getCanvasByClient(t){const e=this.getLayer(),n=e.client2Viewport(sr(t));return Ge(e.viewport2Canvas(n))}toDataURL(){return zk(this,arguments,void 0,function*(t={}){const e=globalThis.devicePixelRatio||1,{mode:n="viewport"}=t,i=$k(t,["mode"]);let[a,s,o,l]=[0,0,0,0];if(n==="viewport")[o,l]=this.getSize();else if(n==="overall"){const m=this.getBounds(),y=ta(m);[a,s]=m.min,[o,l]=y}const c=Am('
    '),u=new Hm({width:o,height:l,renderer:new Lo,devicePixelRatio:e,container:c,background:this.extends.config.background});yield u.ready,u.appendChild(this.getLayer("background").getRoot().cloneNode(!0)),u.appendChild(this.getRoot().cloneNode(!0));const h=this.getLayer("label").getRoot().cloneNode(!0),d=u.viewport2Canvas({x:0,y:0}),f=this.getCanvasByViewport([0,0]);h.translate([f[0]-d.x,f[1]-d.y]),h.scale(1/this.getCamera().getZoom()),u.appendChild(h),u.appendChild(this.getLayer("transient").getRoot().cloneNode(!0));const g=this.getCamera(),v=u.getCamera();if(n==="viewport")v.setZoom(g.getZoom()),v.setPosition(g.getPosition()),v.setFocalPoint(g.getFocalPoint());else if(n==="overall"){const[m,y,b]=v.getPosition(),[w,x,S]=v.getFocalPoint();v.setPosition([m+a,y+s,b]),v.setFocalPoint([w+a,x+s,S])}const p=u.getContextService();return new Promise(m=>{u.addEventListener(Mn.RERENDER,()=>zk(this,void 0,void 0,function*(){yield new Promise(b=>setTimeout(b,300));const y=yield p.toDataURL(i);m(y)}))})})}destroy(){Object.values(this.getLayers()).forEach(t=>{t.getCamera().cancelLandmarkAnimation(),t.destroy()})}}function Wk(r,t){return Object.fromEntries(t.map(e=>{const n=(r==null?void 0:r(e))||new Lo;return n instanceof Lo&&n.setConfig({enableDirtyRectangleRendering:!1}),e==="main"?n.registerPlugin(new Ftt({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):n.unregisterPlugin(n.getPlugin("dom-interaction")),[e,n]}))}function Vk(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 ss=r=>r?parseInt(r):0;function ztt(r){const t=getComputedStyle(r),e=r.clientWidth||ss(t.width),n=r.clientHeight||ss(t.height),i=ss(t.paddingLeft)+ss(t.paddingRight),a=ss(t.paddingTop)+ss(t.paddingBottom);return[e-i,n-a]}function Hk(r){if(!r)return[0,0];let t=640,e=480;const[n,i]=ztt(r);t=n||t,e=i||e;const a=1,s=1;return[Math.max(nt(t)?t:a,a),Math.max(nt(e)?e:s,s)]}class sd{constructor(t){this.type=t}}class xe extends sd{constructor(t,e){super(t),this.data=e}}class qn extends sd{constructor(t,e,n,i){super(t),this.animationType=e,this.animation=n,this.data=i}}class os extends sd{constructor(t,e,n){super(t),this.elementType=e,this.data=n}}class kc extends sd{constructor(t,e){super(t),this.data=e}}function Oe(r,t){r.emit(t.type,t)}function $tt(r){if(!r)return null;if(r instanceof RC)return{type:"canvas",element:r};let t=r;for(;t;){if(il(t))return{type:"node",element:t};if($T(t))return{type:"edge",element:t};if(w1(t))return{type:"combo",element:t};t=t.parentElement}return null}function Uk(r){var t;return((t=r==null?void 0:r.style)===null||t===void 0?void 0:t.zIndex)||0}const Mo="cachedStyle",g2=r=>`__${r}__`;function jtt(r,t){const e=Array.isArray(t)?t:[t];nn(r,Mo)||To(r,Mo,{}),e.forEach(n=>{To(nn(r,Mo),g2(n),r.attributes[n])})}function Yk(r,t){return nn(r,[Mo,g2(t)])}function qtt(r,t){return g2(t)in(nn(r,Mo)||{})}class Gtt{constructor(t){this.tasks=[],this.animations=new Set,this.context=t}getTasks(){const t=[...this.tasks];return this.tasks=[],t}add(t,e){this.tasks.push([t,e])}animate(t,e,n){var i,a,s;(i=e==null?void 0:e.before)===null||i===void 0||i.call(e);const o=this.getTasks().map(([c,u])=>{var h,d,f;const{element:g,elementType:v,stage:p}=c,m=S8(this.context.options,v,p,t);(h=u==null?void 0:u.before)===null||h===void 0||h.call(u);const y=m.length?k8(g,this.inferStyle(c,n),m):null;return y?((d=u==null?void 0:u.beforeAnimate)===null||d===void 0||d.call(u,y),y.finished.then(()=>{var b,w;(b=u==null?void 0:u.afterAnimate)===null||b===void 0||b.call(u,y),(w=u==null?void 0:u.after)===null||w===void 0||w.call(u),this.animations.delete(y)})):(f=u==null?void 0:u.after)===null||f===void 0||f.call(u),y}).filter(Boolean);o.forEach(c=>this.animations.add(c));const l=s1(o);return l?((a=e==null?void 0:e.beforeAnimate)===null||a===void 0||a.call(e,l),l.finished.then(()=>{var c,u;(c=e==null?void 0:e.afterAnimate)===null||c===void 0||c.call(e,l),(u=e==null?void 0:e.after)===null||u===void 0||u.call(e),this.release()})):(s=e==null?void 0:e.after)===null||s===void 0||s.call(e),l}inferStyle(t,e){var n,i;const{element:a,elementType:s,stage:o,originalStyle:l,updatedStyle:c={}}=t;t.modifiedStyle||(t.modifiedStyle=Object.assign(Object.assign({},l),c));const{modifiedStyle:u}=t,h={},d={};if(o==="enter")Object.assign(h,{opacity:0});else if(o==="exit")Object.assign(d,{opacity:0});else if(o==="show")Object.assign(h,{opacity:0}),Object.assign(d,{opacity:(n=Yk(a,"opacity"))!==null&&n!==void 0?n:No("opacity")});else if(o==="hide")Object.assign(h,{opacity:(i=Yk(a,"opacity"))!==null&&i!==void 0?i:No("opacity")}),Object.assign(d,{opacity:0});else if(o==="collapse"){const{collapse:f}=e||{},{target:g,descendants:v,position:p}=f;if(s==="node"){if(v.includes(a.id)){const[m,y,b]=p;Object.assign(d,{x:m,y,z:b})}}else if(s==="combo"){if(a.id===g||v.includes(a.id)){const[m,y]=p;Object.assign(d,{x:m,y,childrenNode:l.childrenNode})}}else s==="edge"&&Object.assign(d,{sourceNode:u.sourceNode,targetNode:u.targetNode})}else if(o==="expand"){const{expand:f}=e||{},{target:g,descendants:v,position:p}=f;if(s==="node"){if(a.id===g||v.includes(a.id)){const[m,y,b]=p;Object.assign(h,{x:m,y,z:b})}}else if(s==="combo"){if(a.id===g||v.includes(a.id)){const[m,y,b]=p;Object.assign(h,{x:m,y,z:b,childrenNode:u.childrenNode})}}else s==="edge"&&Object.assign(h,{sourceNode:u.sourceNode,targetNode:u.targetNode})}return[Object.keys(h).length>0?Object.assign({},l,h):l,Object.keys(d).length>0?Object.assign({},u,d):u]}stop(){this.animations.forEach(t=>t.cancel())}clear(){this.tasks=[]}release(){var t,e;const{canvas:n}=this.context,i=(e=(t=n.document)===null||t===void 0?void 0:t.timeline)===null||e===void 0?void 0:e.animationsWithPromises;i&&(n.document.timeline.animationsWithPromises=i.filter(a=>a.playState!=="finished"))}destroy(){this.stop(),this.animations.clear(),this.tasks=[]}}class Wtt{constructor(t){this.batchCount=0,this.context=t}emit(t){const{graph:e}=this.context;e.emit(t.type,t)}startBatch(t=!0){this.batchCount++,this.batchCount===1&&this.emit(new xe(X.BATCH_START,{initiate:t}))}endBatch(){this.batchCount--,this.batchCount===0&&this.emit(new xe(X.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class Vtt extends c1{constructor(t){super(t),this.currentTarget=null,this.currentTargetType=null,this.category="behavior",this.forwardCanvasEvents=e=>{const{target:n}=e,i=$tt(n);if(!i)return;const{graph:a,canvas:s}=this.context,{type:o,element:l}=i;if("destroyed"in l&&(Zu(l)||l.destroyed))return;const{type:c,detail:u,button:h}=e,d=Object.assign(Object.assign({},e),{target:l,targetType:o,originalTarget:n});c===z.POINTER_MOVE&&(this.currentTarget!==l&&(this.currentTarget&&a.emit(`${this.currentTargetType}:${z.POINTER_LEAVE}`,Object.assign(Object.assign({},d),{type:z.POINTER_LEAVE,target:this.currentTarget,targetType:this.currentTargetType})),l&&(Object.assign(d,{type:z.POINTER_ENTER}),a.emit(`${o}:${z.POINTER_ENTER}`,d))),this.currentTarget=l,this.currentTargetType=o),c===z.CLICK&&h===2||(a.emit(`${o}:${c}`,d),a.emit(c,d)),c===z.CLICK&&u===2&&(Object.assign(d,{type:z.DBLCLICK}),a.emit(`${o}:${z.DBLCLICK}`,d),a.emit(z.DBLCLICK,d)),c===z.POINTER_DOWN&&h===2&&(Object.assign(d,{type:z.CONTEXT_MENU,preventDefault:()=>{var f;(f=s.getContainer())===null||f===void 0||f.addEventListener(z.CONTEXT_MENU,g=>g.preventDefault(),{once:!0})}}),a.emit(`${o}:${z.CONTEXT_MENU}`,d),a.emit(z.CONTEXT_MENU,d))},this.forwardContainerEvents=e=>{this.context.graph.emit(e.type,e)},this.forwardEvents(),this.setBehaviors(this.context.options.behaviors||[])}setBehaviors(t){this.setExtensions(t)}forwardEvents(){const t=this.context.canvas.getContainer();t&&[vs.KEY_DOWN,vs.KEY_UP].forEach(n=>{t.addEventListener(n,this.forwardContainerEvents)});const e=this.context.canvas.document;e&&[z.CLICK,z.DBLCLICK,z.POINTER_OVER,z.POINTER_LEAVE,z.POINTER_ENTER,z.POINTER_MOVE,z.POINTER_OUT,z.POINTER_DOWN,z.POINTER_UP,z.CONTEXT_MENU,z.DRAG_START,z.DRAG,z.DRAG_END,z.DRAG_ENTER,z.DRAG_OVER,z.DRAG_LEAVE,z.DROP,z.WHEEL].forEach(n=>{e.addEventListener(n,this.forwardCanvasEvents)})}destroy(){const t=this.context.canvas.getContainer();t&&[vs.KEY_DOWN,vs.KEY_UP].forEach(e=>{t.removeEventListener(e,this.forwardContainerEvents)}),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}var qo=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);ig.length!==v.length?!1:g.every((p,m)=>p===v[m]),f=(g,v)=>{const p=Object.keys(g),m=Object.keys(v);return p.length!==m.length?!1:p.every(y=>g[y]===v[y])};return!(!f(s,h)||!d(a,u)||!d(e,o)||!f(n,l)||!f(i,c))}var Htt=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);i0}silence(t){this.isTraceless=!0,t(),this.isTraceless=!1}isCombo(t){return this.comboIds.has(t)||this.latestRemovedComboIds.has(t)}getData(){return{nodes:this.getNodeData(),edges:this.getEdgeData(),combos:this.getComboData()}}getNodeData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=De(n);return this.isCombo(F(i))||(t===void 0||t.includes(F(i)))&&e.push(i),e},[])}getEdgeDatum(t){return De(this.model.getEdge(t))}getEdgeData(t){return this.model.getAllEdges().reduce((e,n)=>{const i=De(n);return(t===void 0||t.includes(F(i)))&&e.push(i),e},[])}getComboData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=De(n);return this.isCombo(F(i))&&(t===void 0||t.includes(F(i)))&&e.push(i),e},[])}getRootsData(t=Cn){return this.model.getRoots(t).map(De)}getAncestorsData(t,e){const{model:n}=this;return!n.hasNode(t)||!n.hasTreeStructure(e)?[]:n.getAncestors(t,e).map(De)}getDescendantsData(t){const e=this.getElementDataById(t),n=[];return Oa(e,i=>{i!==e&&n.push(i)},i=>this.getChildrenData(F(i)),"TB"),n}getParentData(t,e){const{model:n}=this;if(!e){Ar.warn("The hierarchy structure key is not specified");return}if(!n.hasNode(t)||!n.hasTreeStructure(e))return;const i=n.getParent(t,e);return i?De(i):void 0}getChildrenData(t){const e=this.getElementType(t)==="node"?Cn:jt,{model:n}=this;return!n.hasNode(t)||!n.hasTreeStructure(e)?[]:n.getChildren(t,e).map(De)}getElementsDataByType(t){return t==="node"?this.getNodeData():t==="edge"?this.getEdgeData():t==="combo"?this.getComboData():[]}getElementDataById(t){return this.getElementType(t)==="edge"?this.getEdgeDatum(t):this.getNodeLikeDatum(t)}getNodeLikeDatum(t){const e=this.model.getNode(t);return De(e)}getNodeLikeData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=De(n);return t?t.includes(F(i))&&e.push(i):e.push(i),e},[])}getElementDataByState(t,e){return this.getElementsDataByType(t).filter(i=>{var a;return(a=i.states)===null||a===void 0?void 0:a.includes(e)})}getElementState(t){var e;return((e=this.getElementDataById(t))===null||e===void 0?void 0:e.states)||[]}hasNode(t){return this.model.hasNode(t)&&!this.isCombo(t)}hasEdge(t){return this.model.hasEdge(t)}hasCombo(t){return this.model.hasNode(t)&&this.isCombo(t)}getRelatedEdgesData(t,e="both"){return this.model.getRelatedEdges(t,e).map(De)}getNeighborNodesData(t){return this.model.getNeighbors(t).map(De)}setData(t){const{nodes:e=[],edges:n=[],combos:i=[]}=t,{nodes:a,edges:s,combos:o}=this.getData(),l=zi(a,e,h=>F(h),ls),c=zi(s,n,h=>F(h),ls),u=zi(o,i,h=>F(h),ls);this.batch(()=>{const h={nodes:l.enter,edges:c.enter,combos:u.enter};this.addData(h),this.computeZIndex(h,"add",!0);const d={nodes:l.update,edges:c.update,combos:u.update};this.updateData(d),this.computeZIndex(d,"update",!0);const f={nodes:l.exit.map(F),edges:c.exit.map(F),combos:u.exit.map(F)};this.removeData(f)})}addData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.addComboData(i),this.addNodeData(e),this.addEdgeData(n)}),this.computeZIndex(t,"add")}addNodeData(t=[]){t.length&&(this.model.addNodes(t.map(e=>(this.pushChange({value:e,type:Qt.NodeAdded}),gm(e)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({nodes:t},"add"))}addEdgeData(t=[]){t.length&&(this.model.addEdges(t.map(e=>(this.pushChange({value:e,type:Qt.EdgeAdded}),gm(e)))),this.computeZIndex({edges:t},"add"))}addComboData(t=[]){if(!t.length)return;const{model:e}=this;e.hasTreeStructure(jt)||e.attachTreeStructure(jt),e.addNodes(t.map(n=>(this.comboIds.add(F(n)),this.pushChange({value:n,type:Qt.ComboAdded}),gm(n)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({combos:t},"add")}addChildrenData(t,e){const n=this.getNodeLikeDatum(t),i=e.map(F);this.addNodeData(e),this.updateNodeData([{id:t,children:[...n.children||[],...i]}]),this.addEdgeData(i.map(a=>({source:t,target:a})))}computeZIndex(t,e,n=!1){!n&&this.isBatching()||this.batch(()=>{const{nodes:i=[],edges:a=[],combos:s=[]}=t;s.forEach(o=>{var l,c,u;const h=F(o);if(e==="add"&&nt((l=o.style)===null||l===void 0?void 0:l.zIndex)||e==="update"&&!("combo"in o))return;const d=this.getParentData(h,jt),f=d?((u=(c=d.style)===null||c===void 0?void 0:c.zIndex)!==null&&u!==void 0?u:0)+1:0;this.preventUpdateNodeLikeHierarchy(()=>{this.updateComboData([{id:h,style:{zIndex:f}}])})}),i.forEach(o=>{var l,c,u;const h=F(o);if(e==="add"&&nt((l=o.style)===null||l===void 0?void 0:l.zIndex)||e==="update"&&!("combo"in o)&&!("children"in o))return;let d=0;const f=this.getParentData(h,jt);if(f)d=(((c=f.style)===null||c===void 0?void 0:c.zIndex)||0)+1;else{const g=this.getParentData(h,Cn);g&&(d=((u=g==null?void 0:g.style)===null||u===void 0?void 0:u.zIndex)||0)}this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:h,style:{zIndex:d}}])})}),a.forEach(o=>{var l,c,u,h,d;if(nt((l=o.style)===null||l===void 0?void 0:l.zIndex))return;let{id:f,source:g,target:v}=o;if(!f)f=F(o);else{const y=this.getEdgeDatum(f);g=y.source,v=y.target}if(!g||!v)return;const p=((u=(c=this.getNodeLikeDatum(g))===null||c===void 0?void 0:c.style)===null||u===void 0?void 0:u.zIndex)||0,m=((d=(h=this.getNodeLikeDatum(v))===null||h===void 0?void 0:h.style)===null||d===void 0?void 0:d.zIndex)||0;this.updateEdgeData([{id:F(o),style:{zIndex:Math.max(p,m)-1}}])})})}getFrontZIndex(t){var e;const n=this.getElementType(t),i=this.getElementDataById(t),a=this.getData();if(Object.assign(a,{[`${n}s`]:a[`${n}s`].filter(s=>F(s)!==t)}),n==="combo"&&!mn(i)){const s=new Set(this.getAncestorsData(t,jt).map(F));a.nodes=a.nodes.filter(o=>!s.has(F(o))),a.combos=a.combos.filter(o=>!s.has(F(o))),a.edges=a.edges.filter(({source:o,target:l})=>!s.has(o)&&!s.has(l))}return Math.max(((e=i.style)===null||e===void 0?void 0:e.zIndex)||0,0,...Object.values(a).flat().map(s=>{var o;return(((o=s==null?void 0:s.style)===null||o===void 0?void 0:o.zIndex)||0)+1}))}updateNodeLikeHierarchy(t){if(!this.enableUpdateNodeLikeHierarchy)return;const{model:e}=this;t.forEach(n=>{const i=F(n),a=Xl(n);a!==void 0&&(e.hasTreeStructure(jt)||e.attachTreeStructure(jt),a===null&&this.refreshComboData(i),this.setParent(i,Xl(n),jt));const s=n.children||[];if(s.length){e.hasTreeStructure(Cn)||e.attachTreeStructure(Cn);const o=s.filter(l=>e.hasNode(l));o.forEach(l=>this.setParent(l,i,Cn)),o.length!==s.length&&this.updateNodeData([{id:i,children:o}])}})}preventUpdateNodeLikeHierarchy(t){this.enableUpdateNodeLikeHierarchy=!1,t(),this.enableUpdateNodeLikeHierarchy=!0}updateData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.updateNodeData(e),this.updateComboData(i),this.updateEdgeData(n)}),this.computeZIndex(t,"update")}updateNodeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{const n=[];t.forEach(i=>{const a=F(i),s=De(e.getNode(a));if(ls(s,i))return;const o=xi(s,i);this.pushChange({value:o,original:s,type:Qt.NodeUpdated}),e.mergeNodeData(a,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({nodes:t},"update")}refreshData(){const{nodes:t,edges:e,combos:n}=this.getData();t.forEach(i=>{this.pushChange({value:i,original:i,type:Qt.NodeUpdated})}),e.forEach(i=>{this.pushChange({value:i,original:i,type:Qt.EdgeUpdated})}),n.forEach(i=>{this.pushChange({value:i,original:i,type:Qt.ComboUpdated})})}syncNodeLikeDatum(t){const{model:e}=this,n=F(t);if(!e.hasNode(n))return;const i=De(e.getNode(n)),a=xi(i,t);e.mergeNodeData(n,a)}syncEdgeDatum(t){const{model:e}=this,n=F(t);if(!e.hasEdge(n))return;const i=De(e.getEdge(n)),a=xi(i,t);e.mergeEdgeData(n,a)}updateEdgeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{t.forEach(n=>{const i=F(n),a=De(e.getEdge(i));if(ls(a,n))return;n.source&&a.source!==n.source&&e.updateEdgeSource(i,n.source),n.target&&a.target!==n.target&&e.updateEdgeTarget(i,n.target);const s=xi(a,n);this.pushChange({value:s,original:a,type:Qt.EdgeUpdated}),e.mergeEdgeData(i,s)})}),this.computeZIndex({edges:t},"update")}updateComboData(t=[]){if(!t.length)return;const{model:e}=this;e.batch(()=>{const n=[];t.forEach(i=>{const a=F(i),s=De(e.getNode(a));if(ls(s,i))return;const o=xi(s,i);this.pushChange({value:o,original:s,type:Qt.ComboUpdated}),e.mergeNodeData(a,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({combos:t},"update")}setParent(t,e,n,i=!0){if(t===e)return;const a=this.getNodeLikeDatum(t),s=Xl(a);if(s!==e&&n===jt){const o={id:t,combo:e};this.isCombo(t)?this.syncNodeLikeDatum(o):this.syncNodeLikeDatum(o)}this.model.setParent(t,e,n),i&&n===jt&&HL([s,e]).forEach(o=>{o!==void 0&&this.refreshComboData(o)})}refreshComboData(t){const e=this.getComboData([t])[0],n=this.getAncestorsData(t,jt);e&&this.pushChange({value:e,original:e,type:Qt.ComboUpdated}),n.forEach(i=>{this.pushChange({value:i,original:i,type:Qt.ComboUpdated})})}getElementPosition(t){const e=this.getElementDataById(t);return ye(e)}translateNodeLikeBy(t,e){this.isCombo(t)?this.translateComboBy(t,e):this.translateNodeBy(t,e)}translateNodeLikeTo(t,e){this.isCombo(t)?this.translateComboTo(t,e):this.translateNodeTo(t,e)}translateNodeBy(t,e){const n=this.getElementPosition(t),i=ft(n,[...e,0].slice(0,3));this.translateNodeTo(t,i)}translateNodeTo(t,e){const[n=0,i=0,a=0]=e;this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:t,style:{x:n,y:i,z:a}}])})}translateComboBy(t,e){const[n=0,i=0,a=0]=e;if([n,i,a].some(isNaN)||[n,i,a].every(l=>l===0))return;const s=this.getComboData([t])[0];if(!s)return;const o=new Set;Oa(s,l=>{const c=F(l);if(o.has(c))return;o.add(c);const[u,h,d]=ye(l),f=xi(l,{style:{x:u+n,y:h+i,z:d+a}});this.pushChange({value:f,original:l,type:this.isCombo(c)?Qt.ComboUpdated:Qt.NodeUpdated}),this.model.mergeNodeData(c,f)},l=>this.getChildrenData(F(l)),"BT")}translateComboTo(t,e){var n;if(e.some(isNaN))return;const[i=0,a=0,s=0]=e,o=(n=this.getComboData([t]))===null||n===void 0?void 0:n[0];if(!o)return;const[l,c,u]=ye(o),h=i-l,d=a-c,f=s-u;Oa(o,g=>{const v=F(g),[p,m,y]=ye(g),b=xi(g,{style:{x:p+h,y:m+d,z:y+f}});this.pushChange({value:b,original:g,type:this.isCombo(v)?Qt.ComboUpdated:Qt.NodeUpdated}),this.model.mergeNodeData(v,b)},g=>this.getChildrenData(F(g)),"BT")}removeData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.removeEdgeData(n),this.removeNodeData(e),this.removeComboData(i),this.latestRemovedComboIds=new Set(i)})}removeNodeData(t=[]){t.length&&this.batch(()=>{t.forEach(e=>{this.removeEdgeData(this.getRelatedEdgesData(e).map(F)),this.pushChange({value:this.getNodeData([e])[0],type:Qt.NodeRemoved}),this.removeNodeLikeHierarchy(e)}),this.model.removeNodes(t)})}removeEdgeData(t=[]){t.length&&(t.forEach(e=>this.pushChange({value:this.getEdgeData([e])[0],type:Qt.EdgeRemoved})),this.model.removeEdges(t))}removeComboData(t=[]){t.length&&this.batch(()=>{t.forEach(e=>{this.pushChange({value:this.getComboData([e])[0],type:Qt.ComboRemoved}),this.removeNodeLikeHierarchy(e),this.comboIds.delete(e)}),this.model.removeNodes(t)})}removeNodeLikeHierarchy(t){if(this.model.hasTreeStructure(jt)){const e=Xl(this.getNodeLikeDatum(t));this.setParent(t,void 0,jt,!1),this.model.getChildren(t,jt).forEach(n=>{const i=De(n),a=F(i);this.setParent(F(i),e,jt,!1);const s=xi(i,{id:F(i),combo:e});this.pushChange({value:s,original:i,type:this.isCombo(a)?Qt.ComboUpdated:Qt.NodeUpdated}),this.model.mergeNodeData(F(i),s)}),ot(e)||this.refreshComboData(e)}}getElementType(t){if(this.model.hasNode(t))return this.isCombo(t)?"combo":"node";if(this.model.hasEdge(t))return"edge";throw new Error(Xr(`Unknown element type of id: ${t}`))}destroy(){const{model:t}=this,e=t.getAllNodes(),n=t.getAllEdges();t.removeEdges(n.map(i=>i.id)),t.removeNodes(e.map(i=>i.id)),this.context={}}}var to=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class Xtt{constructor(t){this.elementMap={},this.shapeTypeMap={},this.paletteStyle={},this.defaultStyle={},this.stateStyle={},this.visibilityCache=new WeakMap,this.context=t}init(){this.initContainer()}initContainer(){if(!this.container||this.container.destroyed){const{canvas:t}=this.context;this.container=t.appendChild(new Pe({className:"elements"}))}}emit(t,e){e.silence||Oe(this.context.graph,t)}forEachElementData(t){$a.forEach(e=>{const n=this.context.model.getElementsDataByType(e);t(e,n)})}getElementType(t,e){var n;const{options:i,graph:a}=this.context,s=((n=i[t])===null||n===void 0?void 0:n.type)||e.type;return s?typeof s=="string"?s:s.call(a,e):t==="edge"?"line":"circle"}getTheme(t){return VC(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({},Ob((i=this.getTheme(e))===null||i===void 0?void 0:i.palette),Ob((a=t[e])===null||a===void 0?void 0:a.palette));s!=null&&s.field&&Object.assign(this.paletteStyle,C9(n,s))})}getPaletteStyle(t,e){const n=this.paletteStyle[e];return n?t==="edge"?{stroke:n}:{fill:n}:{}}computeElementDefaultStyle(t,e){var n;const{options:i}=this.context,a=((n=i[t])===null||n===void 0?void 0:n.style)||{};"transform"in a&&Array.isArray(a.transform)&&(a.transform=[...a.transform]),this.defaultStyle[F(e.datum)]=Tb(a,e)}computeElementsDefaultStyle(t){const{graph:e}=this.context;this.forEachElementData((n,i)=>{const a=i.length;for(let s=0;sthis.getElementStateStyle(t,i,n)))}computeElementsStatesStyle(t){const{graph:e}=this.context;this.forEachElementData((n,i)=>{const a=i.length;for(let s=0;sthis.elementMap[t])}getEdges(){return this.context.model.getEdgeData().map(t=>this.elementMap[F(t)])}getCombos(){return this.context.model.getComboData().map(({id:t})=>this.elementMap[t])}getElementComputedStyle(t,e){const n=F(e),i=this.getThemeStyle(t),a=this.getPaletteStyle(t,n),s=e.style||{},o=this.getDefaultStyle(n),l=this.getThemeStateStyle(t,this.getElementState(n)),c=this.getStateStyle(n),u=Object.assign({},i,a,s,o,l,c);if(t==="combo"){const h=this.context.model.getChildrenData(n),f=!!u.collapsed?[]:h.map(F).filter(g=>this.getElement(g));Object.assign(u,{childrenNode:f,childrenData:h})}return u}getDrawData(t){this.init();const e=this.computeChangesAndDrawData(t);if(!e)return null;const{type:n="draw",stage:i=n}=t;return this.markDestroyElement(e.drawData),this.computeStyle(i),{type:n,stage:i,data:e}}draw(t={animation:!0}){const e=this.getDrawData(t);if(!e)return;const{data:{drawData:{add:n,update:i,remove:a}}}=e;return this.destroyElements(a,t),this.createElements(n,t),this.updateElements(i,t),this.setAnimationTask(t,e)}preLayoutDraw(){return to(this,arguments,void 0,function*(t={animation:!0}){var e,n;const i=this.getDrawData(t);if(!i)return;const{data:{drawData:a}}=i;yield(n=(e=this.context.layout)===null||e===void 0?void 0:e.preLayout)===null||n===void 0?void 0:n.call(e,a);const{add:s,update:o,remove:l}=a;return this.destroyElements(l,t),this.createElements(s,t),this.updateElements(o,t),this.setAnimationTask(t,i)})}setAnimationTask(t,e){const{animation:n,silence:i}=t,{data:{dataChanges:a,drawData:s},stage:o,type:l}=e;return this.context.animation.animate(n,i?{}:{before:()=>this.emit(new xe(X.BEFORE_DRAW,{dataChanges:a,animation:n,stage:o,render:l==="render"}),t),beforeAnimate:c=>this.emit(new qn(X.BEFORE_ANIMATE,dn.DRAW,c,s),t),afterAnimate:c=>this.emit(new qn(X.AFTER_ANIMATE,dn.DRAW,c,s),t),after:()=>this.emit(new xe(X.AFTER_DRAW,{dataChanges:a,animation:n,stage:o,render:l==="render",firstRender:this.context.graph.rendered===!1}),t)})}computeChangesAndDrawData(t){const{model:e}=this.context,n=e.getChanges(),i=t2(n);if(i.length===0)return null;const{NodeAdded:a=[],NodeUpdated:s=[],NodeRemoved:o=[],EdgeAdded:l=[],EdgeUpdated:c=[],EdgeRemoved:u=[],ComboAdded:h=[],ComboUpdated:d=[],ComboRemoved:f=[]}=Nu(i,m=>m.type),g=m=>new Map(m.map(y=>{const b=y.value;return[F(b),b]})),v={add:{nodes:g(a),edges:g(l),combos:g(h)},update:{nodes:g(s),edges:g(c),combos:g(d)},remove:{nodes:g(o),edges:g(u),combos:g(f)}},p=this.transformData(v,t);return e.clearChanges(),{dataChanges:n,drawData:p}}transformData(t,e){const n=this.context.transform.getTransformInstance();return Object.values(n).reduce((i,a)=>a.beforeDraw(i,e),t)}createElement(t,e,n){var i;const a=F(e);if(this.getElement(a))return;const o=this.getElementType(t,e),l=this.getElementComputedStyle(t,e),c=ri(t,o);if(!c)return Ar.warn(`The element ${o} of ${t} is not registered.`);this.emit(new os(X.BEFORE_ELEMENT_CREATE,t,e),n);const u=this.container.appendChild(new c({id:a,context:this.context,style:l}));this.shapeTypeMap[a]=o,this.elementMap[a]=u;const{stage:h="enter"}=n;(i=this.context.animation)===null||i===void 0||i.add({element:u,elementType:t,stage:h,originalStyle:Object.assign({},u.attributes),updatedStyle:l},{after:()=>{var d;this.emit(new os(X.AFTER_ELEMENT_CREATE,t,e),n),(d=u.onCreate)===null||d===void 0||d.call(u)}})}createElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["node",n],["combo",a],["edge",i]].forEach(([o,l])=>{l.forEach(c=>this.createElement(o,c,e))})}getUpdateStageStyle(t,e,n){const{stage:i="update"}=n;if(i==="translate")if(t==="node"||t==="combo"){const{style:{x:a=0,y:s=0,z:o=0}={}}=e;return{x:a,y:s,z:o}}else return{};return this.getElementComputedStyle(t,e)}updateElement(t,e,n){var i;const a=F(e),{stage:s="update"}=n,o=this.getElement(a);if(!o)return()=>null;this.emit(new os(X.BEFORE_ELEMENT_UPDATE,t,e),n);const l=this.getElementType(t,e),c=this.getUpdateStageStyle(t,e,n);this.shapeTypeMap[a]!==l&&(o.destroy(),delete this.shapeTypeMap[a],delete this.elementMap[a],this.createElement(t,e,{animation:!1,silence:!0}));const u=s!=="visibility"?s:c.visibility==="hidden"?"hide":"show";u==="hide"&&delete c.visibility,(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:t,stage:u,originalStyle:Object.assign({},o.attributes),updatedStyle:c},{before:()=>{const h=this.elementMap[a];s!=="collapse"&&ry(h,c),s==="visibility"&&(qtt(h,"opacity")||jtt(h,"opacity"),this.visibilityCache.set(h,u==="show"?"visible":"hidden"),u==="show"&&Ba(h,"visible"))},after:()=>{var h;const d=this.elementMap[a];s==="collapse"&&ry(d,c),u==="hide"&&Ba(d,this.visibilityCache.get(d)),this.emit(new os(X.AFTER_ELEMENT_UPDATE,t,e),n),(h=d.onUpdate)===null||h===void 0||h.call(d)}})}updateElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["node",n],["combo",a],["edge",i]].forEach(([o,l])=>{l.forEach(c=>this.updateElement(o,c,e))})}markDestroyElement(t){Object.values(t.remove).forEach(e=>{e.forEach(n=>{const i=F(n),a=this.getElement(i);a&&kF(a)})})}destroyElement(t,e,n){var i;const{stage:a="exit"}=n,s=F(e),o=this.elementMap[s];if(!o)return()=>null;this.emit(new os(X.BEFORE_ELEMENT_DESTROY,t,e),n),(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:t,stage:a,originalStyle:Object.assign({},o.attributes),updatedStyle:{}},{after:()=>{var l;this.clearElement(s),o.destroy(),(l=o.onDestroy)===null||l===void 0||l.call(o),this.emit(new os(X.AFTER_ELEMENT_DESTROY,t,e),n)}})}destroyElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["combo",a],["edge",i],["node",n]].forEach(([o,l])=>{l.forEach(c=>this.destroyElement(o,c,e))})}clearElement(t){delete this.paletteStyle[t],delete this.defaultStyle[t],delete this.stateStyle[t],delete this.elementMap[t],delete this.shapeTypeMap[t]}alignLayoutResultToElement(t,e){var n,i;const a=(n=t.nodes)===null||n===void 0?void 0:n.find(s=>F(s)===e);if(a){const s=ye(this.context.model.getNodeLikeDatum(e)),o=ye(a),l=$t(s,o);(i=t.nodes)===null||i===void 0||i.forEach(c=>{var u,h,d;!((u=c.style)===null||u===void 0)&&u.x&&(c.style.x+=l[0]),!((h=c.style)===null||h===void 0)&&h.y&&(c.style.y+=l[1]),!((d=c.style)===null||d===void 0)&&d.z&&(c.style.z+=l[2]||0)})}}collapseNode(t,e){return to(this,void 0,void 0,function*(){var n;const{animation:i,align:a}=e,{model:s,layout:o}=this.context,l=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!l)return;this.markDestroyElement(l.drawData);const c=yield o.simulate();a&&this.alignLayoutResultToElement(c,t),s.updateData(c);const u=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!u)return;const{drawData:h}=u,{add:d,remove:f,update:g}=h;this.markDestroyElement(h);const v={animation:i,stage:"collapse",data:h};this.destroyElements(f,v),this.createElements(d,v),this.updateElements(g,v),yield(n=this.context.animation.animate(i,{beforeAnimate:p=>this.emit(new qn(X.BEFORE_ANIMATE,dn.COLLAPSE,p,h),v),afterAnimate:p=>this.emit(new qn(X.AFTER_ANIMATE,dn.COLLAPSE,p,h),v)},{collapse:{target:t,descendants:Array.from(f.nodes).map(([,p])=>F(p)),position:ye(g.nodes.get(t))}}))===null||n===void 0?void 0:n.finished})}expandNode(t,e){return to(this,void 0,void 0,function*(){var n;const{model:i,layout:a}=this.context,{animation:s,align:o}=e,l=ye(i.getNodeData([t])[0]),c=this.computeChangesAndDrawData({stage:"expand",animation:s});if(!c)return;const{drawData:{add:u}}=c;this.createElements(u,{animation:!1,stage:"expand",target:t}),this.context.animation.clear();const h=yield a.simulate();o&&this.alignLayoutResultToElement(h,t),i.updateData(h),this.computeStyle("expand");const d=this.computeChangesAndDrawData({stage:"collapse",animation:s});if(!d)return;const{drawData:f}=d,{update:g}=f,v={animation:s,stage:"expand",data:f};u.edges.forEach(p=>g.edges.set(F(p),p)),u.nodes.forEach(p=>g.nodes.set(F(p),p)),this.updateElements(g,v),yield(n=this.context.animation.animate(s,{beforeAnimate:p=>this.emit(new qn(X.BEFORE_ANIMATE,dn.EXPAND,p,f),v),afterAnimate:p=>this.emit(new qn(X.AFTER_ANIMATE,dn.EXPAND,p,f),v)},{expand:{target:t,descendants:Array.from(u.nodes).map(([,p])=>F(p)),position:l}}))===null||n===void 0?void 0:n.finished})}collapseCombo(t,e){return to(this,void 0,void 0,function*(){var n;const{model:i,element:a}=this.context;if(i.getAncestorsData(t,jt).some(v=>mn(v)))return;const s=a.getElement(t),o=s.getComboPosition(Object.assign(Object.assign({},s.attributes),{collapsed:!0})),l=this.computeChangesAndDrawData({stage:"collapse",animation:e});if(!l)return;const{dataChanges:c,drawData:u}=l;this.markDestroyElement(u);const{update:h,remove:d}=u,f={animation:e,stage:"collapse",data:u};this.destroyElements(d,f),this.updateElements(h,f);const g=v=>Array.from(v).map(([,p])=>F(p));yield(n=this.context.animation.animate(e,{before:()=>this.emit(new xe(X.BEFORE_DRAW,{dataChanges:c,animation:e}),f),beforeAnimate:v=>this.emit(new qn(X.BEFORE_ANIMATE,dn.COLLAPSE,v,u),f),afterAnimate:v=>this.emit(new qn(X.AFTER_ANIMATE,dn.COLLAPSE,v,u),f),after:()=>this.emit(new xe(X.AFTER_DRAW,{dataChanges:c,animation:e}),f)},{collapse:{target:t,descendants:[...g(d.nodes),...g(d.combos)],position:o}}))===null||n===void 0?void 0:n.finished})}expandCombo(t,e){return to(this,void 0,void 0,function*(){var n;const{model:i}=this.context,a=ye(i.getComboData([t])[0]);this.computeStyle("expand");const s=this.computeChangesAndDrawData({stage:"expand",animation:e});if(!s)return;const{dataChanges:o,drawData:l}=s,{add:c,update:u}=l,h={animation:e,stage:"expand",data:l,target:t};this.createElements(c,h),this.updateElements(u,h);const d=f=>Array.from(f).map(([,g])=>F(g));yield(n=this.context.animation.animate(e,{before:()=>this.emit(new xe(X.BEFORE_DRAW,{dataChanges:o,animation:e}),h),beforeAnimate:f=>this.emit(new qn(X.BEFORE_ANIMATE,dn.EXPAND,f,l),h),afterAnimate:f=>this.emit(new qn(X.AFTER_ANIMATE,dn.EXPAND,f,l),h),after:()=>this.emit(new xe(X.AFTER_DRAW,{dataChanges:o,animation:e}),h)},{expand:{target:t,descendants:[...d(c.nodes),...d(c.combos)],position:a}}))===null||n===void 0?void 0:n.finished})}clear(){this.container.destroy(),this.initContainer(),this.elementMap={},this.shapeTypeMap={},this.defaultStyle={},this.stateStyle={},this.paletteStyle={}}destroy(){this.clear(),this.container.destroy(),this.context={}}}var cs=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})},Ktt=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{const h=F(u),d=l.nodes.get(h);o.syncNodeLikeDatum(u),d&&Object.assign(d.style,u.style)}),(i=c==null?void 0:c.edges)===null||i===void 0||i.forEach(u=>{const h=F(u),d=l.edges.get(h);o.syncEdgeDatum(u),d&&Object.assign(d.style,u.style)}),(a=c==null?void 0:c.combos)===null||a===void 0||a.forEach(u=>{const h=F(u),d=l.combos.get(h);o.syncNodeLikeDatum(u),d&&Object.assign(d.style,u.style)}),Oe(s,new xe(X.AFTER_LAYOUT,{type:"pre"})),this.transformDataAfterLayout("pre",t)})}postLayout(){return cs(this,arguments,void 0,function*(t=this.options){if(!t)return;const e=Array.isArray(t)?t:[t],{graph:n}=this.context;Oe(n,new xe(X.BEFORE_LAYOUT,{type:"post"}));for(const i of e){const a=e.indexOf(i),s=this.getLayoutData(i),o=Object.assign(Object.assign({},this.presetOptions),i);Oe(n,new xe(X.BEFORE_STAGE_LAYOUT,{options:o,index:a}));const l=yield this.stepLayout(s,o,a);Oe(n,new xe(X.AFTER_STAGE_LAYOUT,{options:o,index:a})),i.animation||this.updateElementPosition(l,!1)}Oe(n,new xe(X.AFTER_LAYOUT,{type:"post"})),this.transformDataAfterLayout("post")})}transformDataAfterLayout(t,e){const n=this.context.transform.getTransformInstance();Object.values(n).forEach(i=>i.afterLayout(t,e))}simulate(){return cs(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 cs(this,void 0,void 0,function*(){return NF(e)?yield this.treeLayout(t,e,n):yield this.graphLayout(t,e,n)})}graphLayout(t,e,n){return cs(this,void 0,void 0,function*(){const{animation:i,enableWorker:a,iterations:s=300}=e,o=this.initGraphLayout(e);if(!o)return{};if(this.instances[n]=o,this.instance=o,a){const c=o;return this.supervisor=new NX(c.graphData2LayoutModel(t),c.instance,{iterations:s}),Rc(yield this.supervisor.execute())}if(vy(o))return i?yield o.execute(t,{onTick:c=>{this.updateElementPosition(c,!1)}}):(o.execute(t),o.stop(),o.tick(s));const l=yield o.execute(t);if(i){const c=this.updateElementPosition(l,i);yield c==null?void 0:c.finished}return l})}treeLayout(t,e,n){return cs(this,void 0,void 0,function*(){const{type:i,animation:a}=e,s=ri("layout",i);if(!s)return{};const{nodes:o=[],edges:l=[]}=t,c=new Ne({nodes:o.map(g=>({id:F(g),data:g.data||{}})),edges:l.map(g=>({id:F(g),source:g.source,target:g.target,data:g.data||{}}))});Utt(c);const u={nodes:[],edges:[]},h={nodes:[],edges:[]};c.getRoots(Cn).forEach(g=>{Oa(g,b=>{b.children=c.getSuccessors(b.id)},b=>c.getSuccessors(b.id),"TB");const v=s(g,e),{x:p,y:m,z:y=0}=v;Oa(v,b=>{const{id:w,x,y:S,z:E=0}=b;u.nodes.push({id:w,style:{x:p,y:m,z:y}}),h.nodes.push({id:w,style:{x,y:S,z:E}})},b=>b.children,"TB")});const f=this.inferTreeLayoutOffset(h);if(Xk(h,f),a){Xk(u,f),this.updateElementPosition(u,!1);const g=this.updateElementPosition(h,a);yield g==null?void 0:g.finished}return h})}inferTreeLayoutOffset(t){var e;let[n,i]=[1/0,-1/0],[a,s]=[1/0,-1/0];(e=t.nodes)===null||e===void 0||e.forEach(v=>{const{x:p=0,y:m=0}=v.style||{};n=Math.min(n,p),i=Math.max(i,p),a=Math.min(a,m),s=Math.max(s,m)});const{canvas:o}=this.context,l=o.getSize(),[c,u]=o.getCanvasByViewport([0,0]),[h,d]=o.getCanvasByViewport(l);if(n>=c&&i<=h&&a>=u&&s<=d)return[0,0];const f=(c+h)/2,g=(u+d)/2;return[f-(n+i)/2,g-(a+s)/2]}stopLayout(){this.instance&&vy(this.instance)&&(this.instance.stop(),this.instance=void 0),this.supervisor&&(this.supervisor.stop(),this.supervisor=void 0),this.animationResult&&(this.animationResult.finish(),this.animationResult=void 0)}getLayoutData(t){const{nodeFilter:e=()=>!0,preLayout:n=!1,isLayoutInvisibleNodes:i=!1}=t,{nodes:a,edges:s,combos:o}=this.context.model.getData(),{element:l,model:c}=this.context,u=v=>l.getElement(v),h=n?v=>{var p;return!i&&(((p=v.style)===null||p===void 0?void 0:p.visibility)==="hidden"||c.getAncestorsData(v.id,Cn).some(mn)||c.getAncestorsData(v.id,jt).some(mn))?!1:e(v)}:v=>{const p=F(v),m=u(p);return!m||Zu(m)?!1:e(v)},d=a.filter(h),f=new Map(d.map(v=>[F(v),v]));o.forEach(v=>f.set(F(v),v));const g=s.filter(({source:v,target:p})=>f.has(v)&&f.has(p));return{nodes:d,edges:g,combos:o}}initGraphLayout(t){var e;const{element:n,viewport:i}=this.context,{type:a,enableWorker:s,animation:o,iterations:l}=t,c=Ktt(t,["type","enableWorker","animation","iterations"]),[u,h]=i.getCanvasSize(),d=[u/2,h/2],f=(e=t==null?void 0:t.nodeSize)!==null&&e!==void 0?e:y=>{const b=n==null?void 0:n.getElement(y.id);return b?b.attributes.size:n==null?void 0:n.getElementComputedStyle("node",y).size},g=ri("layout",a);if(!g)return Ar.warn(`The layout of ${a} is not registered.`);const v=Object.getPrototypeOf(g.prototype)===nh.prototype?g:LF(g,this.context),p=new v(this.context),m={nodeSize:f,width:u,height:h,center:d};switch(p.id){case"d3-force":case"d3-force-3d":Object.assign(m,{center:{x:u/2,y:h/2,z:0}});break}return on(p.options,m,c),p}updateElementPosition(t,e){const{model:n,element:i}=this.context;return i?(n.updateData(t),i.draw({animation:e,silence:!0})):null}destroy(){var t;this.stopLayout(),this.context={},(t=this.supervisor)===null||t===void 0||t.kill(),this.supervisor=void 0,this.instance=void 0,this.instances=[],this.animationResult=void 0}}const Xk=(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 Jtt(r){return[Qtt].reduce((e,n)=>n(e),r)}function Qtt(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 tet extends c1{constructor(t){super(t),this.category="plugin",this.setPlugins(this.context.options.plugins||[])}setPlugins(t){this.setExtensions(t)}getPluginInstance(t){const e=this.extensionMap[t];if(e)return e;Ar.warn(`Cannot find the plugin ${t}, will try to find it by type.`);const n=this.extensions.find(i=>i.type===t);if(n)return this.extensionMap[n.key]}}const Mc=["update-related-edges","collapse-expand-node","collapse-expand-combo","get-edge-actual-ends","arrange-draw-order"];class eet extends c1{constructor(t){super(t),this.category="transform",this.setTransforms(this.context.options.transforms||[])}getTransforms(){}setTransforms(t){this.setExtensions([...Mc.slice(0,Mc.length-1),...t,Mc[Mc.length-1]])}getTransformInstance(t){return t?this.extensionMap[t]:this.extensionMap}}var eo=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class net{get padding(){return Pr(this.context.options.padding)}get paddingOffset(){const[t,e,n,i]=this.padding,[a,s,o]=[(i-e)/2,(t-n)/2,0];return[a,s,o]}constructor(t){this.landmarkCounter=0,this.context=t;const[e,n]=this.paddingOffset,{zoom:i,rotation:a,x:s=e,y:o=n}=t.options;this.transform({mode:"absolute",scale:i,translate:[s,o],rotate:a},!1)}get camera(){const{canvas:t}=this.context;return new Proxy(t.getCamera(),{get:(e,n)=>{const a=Object.entries(t.getLayers()).filter(([o])=>!["main"].includes(o)).map(([,o])=>o.getCamera()),s=e[n];if(typeof s=="function")return(...o)=>{const l=s.apply(e,o);return a.forEach(c=>{c[n].apply(c,o)}),l}}})}createLandmark(t){return this.camera.createLandmark(`landmark-${this.landmarkCounter++}`,t)}getAnimation(t){const e=HC(this.context.options,t);return e?La(Object.assign({},e),["easing","duration"]):!1}getCanvasSize(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e,n]}getCanvasCenter(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e/2,n/2,0]}getViewportCenter(){const[t,e]=this.camera.getPosition();return[t,e,0]}getGraphCenter(){return this.context.graph.getViewportByCanvas(this.getCanvasCenter())}getZoom(){return this.camera.getZoom()}getRotation(){return this.camera.getRoll()}getTranslateOptions(t){const{camera:e}=this,{mode:n,translate:i=[]}=t,a=this.getZoom(),s=e.getPosition(),o=e.getFocalPoint(),[l,c]=this.getCanvasCenter(),[u=0,h=0,d=0]=i,f=ur([-u,-h,-d],a);return n==="relative"?{position:ft(s,f),focalPoint:ft(o,f)}:{position:ft([l,c,s[2]],f),focalPoint:ft([l,c,o[2]],f)}}getRotateOptions(t){const{mode:e,rotate:n=0}=t;return{roll:e==="relative"?this.camera.getRoll()+n:n}}getZoomOptions(t){const{zoomRange:e}=this.context.options,n=this.camera.getZoom(),{mode:i,scale:a=1}=t;return ce(i==="relative"?n*a:a,...e)}transform(t,e){return eo(this,void 0,void 0,function*(){const{graph:n}=this.context,{translate:i,rotate:a,scale:s,origin:o}=t;this.cancelAnimation();const l=this.getAnimation(e);if(Oe(n,new kc(X.BEFORE_TRANSFORM,t)),!a&&s&&!i&&o&&!l){this.camera.setZoomByViewportPoint(this.getZoomOptions(t),o),Oe(n,new kc(X.AFTER_TRANSFORM,t));return}const c={};if(i&&Object.assign(c,this.getTranslateOptions(t)),nt(a)&&Object.assign(c,this.getRotateOptions(t)),nt(s)&&Object.assign(c,{zoom:this.getZoomOptions(t)}),l)return Oe(n,new qn(X.BEFORE_ANIMATE,dn.TRANSFORM,null,t)),new Promise(u=>{this.transformResolver=u,this.camera.gotoLandmark(this.createLandmark(c),Object.assign(Object.assign({},l),{onfinish:()=>{Oe(n,new qn(X.AFTER_ANIMATE,dn.TRANSFORM,null,t)),Oe(n,new kc(X.AFTER_TRANSFORM,t)),this.transformResolver=void 0,u()}}))});this.camera.gotoLandmark(this.createLandmark(c),{duration:0}),Oe(n,new kc(X.AFTER_TRANSFORM,t))})}fitView(t,e){return eo(this,void 0,void 0,function*(){const[n,i,a,s]=this.padding,{when:o="always",direction:l="both"}=t||{},[c,u]=this.context.canvas.getSize(),h=c-s-i,d=u-n-a,f=this.context.canvas.getBounds(),g=this.getBBoxInViewport(f),[v,p]=ta(g),m=l==="x"&&v>=h||l==="y"&&p>=d||l==="both"&&v>=h&&p>=d;if(o==="overflow"&&!m)return yield this.fitCenter({animation:e});const y=h/v,b=d/p,w=l==="x"?y:l==="y"?b:Math.min(y,b),x=this.getAnimation(e);yield this.transform({mode:"relative",scale:w,translate:ft($t(this.getCanvasCenter(),this.getBBoxInViewport(f).center),ur(this.paddingOffset,w))},x)})}fitCenter(t){return eo(this,void 0,void 0,function*(){const e=this.context.canvas.getBounds();yield this.focus(e,t)})}focusElements(t){return eo(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=Jo(e.map(o=>a(i.getElement(o))));yield this.focus(s,n)})}focus(t,e){return eo(this,void 0,void 0,function*(){const n=this.context.graph.getViewportByCanvas(t.center),i=e.position||this.getCanvasCenter(),a=$t(i,n);yield this.transform({mode:"relative",translate:ft(a,this.paddingOffset)},e.animation)})}getBBoxInViewport(t){const{min:e,max:n}=t,{graph:i}=this.context,[a,s]=i.getViewportByCanvas(e),[o,l]=i.getViewportByCanvas(n),c=new Vt;return c.setMinMax([a,s,0],[o,l,0]),c}isInViewport(t,e=!1,n=0){const{graph:i}=this.context,a=this.getCanvasSize(),[s,o]=i.getCanvasByViewport([0,0]),[l,c]=i.getCanvasByViewport(a);let u=new Vt;return u.setMinMax([s,o,0],[l,c,0]),n&&(u=ea(u,n)),As(t)?cr(t,u):e?L8(t,u):u.intersects(t)}cancelAnimation(){var t,e;!((t=this.camera.landmarks)===null||t===void 0)&&t.length&&this.camera.cancelLandmarkAnimation(),(e=this.transformResolver)===null||e===void 0||e.call(this)}}var Gt=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class od extends eh{constructor(t){var e;super(),this.options={},this.rendered=!1,this.destroyed=!1,this.context={model:new Ytt},this.isCollapsingExpanding=!1,this.onResize=Vo(()=>{this.resize()},300),this._setOptions(Object.assign({},od.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,Jtt(t)),e){const{data:d}=t;d&&this.addData(d);return}const{behaviors:n,combo:i,data:a,edge:s,layout:o,node:l,plugins:c,theme:u,transforms:h}=t;n&&this.setBehaviors(n),a&&this.setData(a),l&&this.setNode(l),s&&this.setEdge(s),i&&this.setCombo(i),o&&this.setLayout(o),u&&this.setTheme(u),c&&this.setPlugins(c),h&&this.setTransforms(h)}getSize(){return this.context.canvas?this.context.canvas.getSize():[this.options.width||0,this.options.height||0]}setSize(t,e){t&&(this.options.width=t),e&&(this.options.height=e),this.resize(t,e)}setZoomRange(t){this.options.zoomRange=t}getZoomRange(){return this.options.zoomRange}setNode(t){this.options.node=t,this.context.model.refreshData()}setEdge(t){this.options.edge=t,this.context.model.refreshData()}setCombo(t){this.options.combo=t,this.context.model.refreshData()}getTheme(){return this.options.theme}setTheme(t){this.options.theme=at(t)?t(this.getTheme()):t}setLayout(t){this.options.layout=at(t)?t(this.getLayout()):t}getLayout(){return this.options.layout}setBehaviors(t){var e;this.options.behaviors=at(t)?t(this.getBehaviors()):t,(e=this.context.behavior)===null||e===void 0||e.setBehaviors(this.options.behaviors)}updateBehavior(t){this.setBehaviors(e=>e.map(n=>typeof n=="object"&&n.key===t.key?Object.assign(Object.assign({},n),t):n))}getBehaviors(){return this.options.behaviors||[]}setPlugins(t){var e;this.options.plugins=at(t)?t(this.getPlugins()):t,(e=this.context.plugin)===null||e===void 0||e.setPlugins(this.options.plugins)}updatePlugin(t){this.setPlugins(e=>e.map(n=>typeof n=="object"&&n.key===t.key?Object.assign(Object.assign({},n),t):n))}getPlugins(){return this.options.plugins||[]}getPluginInstance(t){return this.context.plugin.getPluginInstance(t)}setTransforms(t){var e;this.options.transforms=at(t)?t(this.getTransforms()):t,(e=this.context.transform)===null||e===void 0||e.setTransforms(this.options.transforms)}updateTransform(t){this.setTransforms(e=>e.map(n=>typeof n=="object"&&n.key===t.key?Object.assign(Object.assign({},n),t):n)),this.context.model.refreshData()}getTransforms(){return this.options.transforms||[]}getData(){return this.context.model.getData()}getElementData(t){return Array.isArray(t)?t.map(e=>this.context.model.getElementDataById(e)):this.context.model.getElementDataById(t)}getNodeData(t){var e;return t===void 0?this.context.model.getNodeData():Array.isArray(t)?this.context.model.getNodeData(t):(e=this.context.model.getNodeData([t]))===null||e===void 0?void 0:e[0]}getEdgeData(t){var e;return t===void 0?this.context.model.getEdgeData():Array.isArray(t)?this.context.model.getEdgeData(t):(e=this.context.model.getEdgeData([t]))===null||e===void 0?void 0:e[0]}getComboData(t){var e;return t===void 0?this.context.model.getComboData():Array.isArray(t)?this.context.model.getComboData(t):(e=this.context.model.getComboData([t]))===null||e===void 0?void 0:e[0]}setData(t){this.context.model.setData(at(t)?t(this.getData()):t)}addData(t){this.context.model.addData(at(t)?t(this.getData()):t)}addNodeData(t){this.context.model.addNodeData(at(t)?t(this.getNodeData()):t)}addEdgeData(t){this.context.model.addEdgeData(at(t)?t(this.getEdgeData()):t)}addComboData(t){this.context.model.addComboData(at(t)?t(this.getComboData()):t)}addChildrenData(t,e){this.context.model.addChildrenData(t,e)}updateData(t){this.context.model.updateData(at(t)?t(this.getData()):t)}updateNodeData(t){this.context.model.updateNodeData(at(t)?t(this.getNodeData()):t)}updateEdgeData(t){this.context.model.updateEdgeData(at(t)?t(this.getEdgeData()):t)}updateComboData(t){this.context.model.updateComboData(at(t)?t(this.getComboData()):t)}removeData(t){this.context.model.removeData(at(t)?t(this.getData()):t)}removeNodeData(t){this.context.model.removeNodeData(at(t)?t(this.getNodeData()):t)}removeEdgeData(t){this.context.model.removeEdgeData(at(t)?t(this.getEdgeData()):t)}removeComboData(t){this.context.model.removeComboData(at(t)?t(this.getComboData()):t)}getElementType(t){return this.context.model.getElementType(t)}getRelatedEdgesData(t,e="both"){return this.context.model.getRelatedEdgesData(t,e)}getNeighborNodesData(t){return this.context.model.getNeighborNodesData(t)}getAncestorsData(t,e){return this.context.model.getAncestorsData(t,e)}getParentData(t,e){return this.context.model.getParentData(t,e)}getChildrenData(t){return this.context.model.getChildrenData(t)}getDescendantsData(t){return this.context.model.getDescendantsData(t)}getElementDataByState(t,e){return this.context.model.getElementDataByState(t,e)}initCanvas(){return Gt(this,void 0,void 0,function*(){var t;if(this.context.canvas)return yield this.context.canvas.ready;const{container:e="container",width:n,height:i,renderer:a,cursor:s,background:o,canvas:l,devicePixelRatio:c=(t=globalThis.devicePixelRatio)!==null&&t!==void 0?t:1}=this.options;if(e instanceof Gk)this.context.canvas=e,s&&e.setCursor(s),a&&e.setRenderer(a),yield e.ready;else{const u=Tt(e)?document.getElementById(e):e,h=Hk(u);this.emit(X.BEFORE_CANVAS_INIT,{container:u,width:n,height:i});const d=Object.assign(Object.assign({},l),{container:u,width:n||h[0],height:i||h[1],background:o,renderer:a,cursor:s,devicePixelRatio:c}),f=new Gk(d);this.context.canvas=f,yield f.ready,this.emit(X.AFTER_CANVAS_INIT,{canvas:f})}})}updateCanvas(t){var e,n;const{renderer:i,cursor:a,height:s,width:o}=t,l=this.context.canvas;l&&(i&&(this.emit(X.BEFORE_RENDERER_CHANGE,{renderer:this.options.renderer}),l.setRenderer(i),this.emit(X.AFTER_RENDERER_CHANGE,{renderer:i})),a&&l.setCursor(a),(nt(o)||nt(s))&&this.setSize((e=o??this.options.width)!==null&&e!==void 0?e:0,(n=s??this.options.height)!==null&&n!==void 0?n:0))}initRuntime(){this.context.options=this.options,this.context.batch||(this.context.batch=new Wtt(this.context)),this.context.plugin||(this.context.plugin=new tet(this.context)),this.context.viewport||(this.context.viewport=new net(this.context)),this.context.transform||(this.context.transform=new eet(this.context)),this.context.element||(this.context.element=new Xtt(this.context)),this.context.animation||(this.context.animation=new Gtt(this.context)),this.context.layout||(this.context.layout=new Ztt(this.context)),this.context.behavior||(this.context.behavior=new Vtt(this.context))}prepare(){return Gt(this,void 0,void 0,function*(){if(yield Promise.resolve(),this.destroyed)throw new Error(Xr("The graph instance has been destroyed"));yield this.initCanvas(),this.initRuntime()})}render(){return Gt(this,void 0,void 0,function*(){if(yield this.prepare(),Oe(this,new xe(X.BEFORE_RENDER)),this.options.layout)if(!this.rendered&&RF(this.options.layout)){const t=yield this.context.element.preLayoutDraw({type:"render"});yield Promise.all([t==null?void 0:t.finished,this.autoFit()])}else{const t=this.context.element.draw({type:"render"});yield Promise.all([t==null?void 0:t.finished,this.context.layout.postLayout()]),yield this.autoFit()}else{const t=this.context.element.draw({type:"render"});yield Promise.all([t==null?void 0:t.finished,this.autoFit()])}this.rendered=!0,Oe(this,new xe(X.AFTER_RENDER))})}draw(){return Gt(this,void 0,void 0,function*(){var t;yield this.prepare(),yield(t=this.context.element.draw())===null||t===void 0?void 0:t.finished})}layout(t){return Gt(this,void 0,void 0,function*(){yield this.context.layout.postLayout(t)})}stopLayout(){this.context.layout.stopLayout()}clear(){return Gt(this,void 0,void 0,function*(){const{model:t,element:e}=this.context;t.setData({}),t.clearChanges(),e==null||e.clear()})}destroy(){var t;Oe(this,new xe(X.BEFORE_DESTROY));const{layout:e,animation:n,element:i,model:a,canvas:s,behavior:o,plugin:l}=this.context;l==null||l.destroy(),o==null||o.destroy(),e==null||e.destroy(),n==null||n.destroy(),i==null||i.destroy(),a.destroy(),s==null||s.destroy(),this.options={},this.context={},this.off(),(t=globalThis.removeEventListener)===null||t===void 0||t.call(globalThis,"resize",this.onResize),this.destroyed=!0,Oe(this,new xe(X.AFTER_DESTROY))}getCanvas(){return this.context.canvas}resize(t,e){var n;const i=Hk((n=this.context.canvas)===null||n===void 0?void 0:n.getContainer()),a=[t||i[0],e||i[1]];if(!this.context.canvas)return;const s=this.context.canvas.getSize();ue(a,s)||(Oe(this,new xe(X.BEFORE_SIZE_CHANGE,{size:a})),this.context.canvas.resize(...a),Oe(this,new xe(X.AFTER_SIZE_CHANGE,{size:a})))}fitView(t,e){return Gt(this,void 0,void 0,function*(){var n;yield(n=this.context.viewport)===null||n===void 0?void 0:n.fitView(t,e)})}fitCenter(t){return Gt(this,void 0,void 0,function*(){var e;yield(e=this.context.viewport)===null||e===void 0?void 0:e.fitCenter({animation:t})})}autoFit(){return Gt(this,void 0,void 0,function*(){const{autoFit:t}=this.context.options;if(t)if(Tt(t))t==="view"?yield this.fitView():t==="center"&&(yield this.fitCenter());else{const{type:e,animation:n}=t;e==="view"?yield this.fitView(t.options,n):e==="center"&&(yield this.fitCenter(n))}})}focusElement(t,e){return Gt(this,void 0,void 0,function*(){var n;yield(n=this.context.viewport)===null||n===void 0?void 0:n.focusElements(Array.isArray(t)?t:[t],{animation:e})})}zoomBy(t,e,n){return Gt(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",scale:t,origin:n},e)})}zoomTo(t,e,n){return Gt(this,void 0,void 0,function*(){this.context.viewport.transform({mode:"absolute",scale:t,origin:n},e)})}getZoom(){return this.context.viewport.getZoom()}rotateBy(t,e,n){return Gt(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",rotate:t,origin:n},e)})}rotateTo(t,e,n){return Gt(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",rotate:t,origin:n},e)})}getRotation(){return this.context.viewport.getRotation()}translateBy(t,e){return Gt(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",translate:t},e)})}translateTo(t,e){return Gt(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",translate:t},e)})}getPosition(){return $t([0,0],this.getCanvasByViewport([0,0]))}translateElementBy(t,e){return Gt(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=me(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(l).forEach(([u,h])=>this.context.model.translateNodeLikeBy(u,h)),yield(o=this.context.element.draw({animation:c,stage:"translate"}))===null||o===void 0?void 0:o.finished})}translateElementTo(t,e){return Gt(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=me(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(l).forEach(([u,h])=>this.context.model.translateNodeLikeTo(u,h)),yield(o=this.context.element.draw({animation:c,stage:"translate"}))===null||o===void 0?void 0:o.finished})}getElementPosition(t){return this.context.model.getElementPosition(t)}getElementRenderStyle(t){return Hy(this.context.element.getElement(t).attributes,["context"])}setElementVisibility(t,e){return Gt(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=me(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],u={nodes:[],edges:[],combos:[]};Object.entries(l).forEach(([f,g])=>{const v=this.getElementType(f);u[`${v}s`].push({id:f,style:{visibility:g}})});const{model:h,element:d}=this.context;h.preventUpdateNodeLikeHierarchy(()=>{h.updateData(u)}),yield(o=d.draw({animation:c,stage:"visibility"}))===null||o===void 0?void 0:o.finished})}showElement(t,e){return Gt(this,void 0,void 0,function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map(i=>[i,"visible"])),e)})}hideElement(t,e){return Gt(this,void 0,void 0,function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map(i=>[i,"hidden"])),e)})}getElementVisibility(t){var e,n;const i=this.context.element.getElement(t);return(n=(e=i==null?void 0:i.style)===null||e===void 0?void 0:e.visibility)!==null&&n!==void 0?n:"visible"}setElementZIndex(t,e){return Gt(this,void 0,void 0,function*(){var n;const i={nodes:[],edges:[],combos:[]},a=me(t)?t:{[t]:e};Object.entries(a).forEach(([l,c])=>{const u=this.getElementType(l);i[`${u}s`].push({id:l,style:{zIndex:c}})});const{model:s,element:o}=this.context;s.preventUpdateNodeLikeHierarchy(()=>s.updateData(i)),yield(n=o.draw({animation:!1,stage:"zIndex"}))===null||n===void 0?void 0:n.finished})}frontElement(t){return Gt(this,void 0,void 0,function*(){const e=Array.isArray(t)?t:[t],{model:n}=this.context,i={};e.map(a=>{const s=n.getFrontZIndex(a);if(n.getElementType(a)==="combo"){const l=n.getAncestorsData(a,jt).at(-1)||this.getComboData(a),c=[l,...n.getDescendantsData(F(l))],u=s-Uk(l);c.forEach(d=>{i[F(d)]=this.getElementZIndex(F(d))+u});const{internal:h}=ey(c.map(F),d=>n.getRelatedEdgesData(d));h.forEach(d=>{const f=F(d);i[f]=this.getElementZIndex(f)+u})}else i[a]=s}),yield this.setElementZIndex(i)})}getElementZIndex(t){return Uk(this.context.model.getElementDataById(t))}setElementState(t,e){return Gt(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=me(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],u=d=>d?Array.isArray(d)?d:[d]:[],h={nodes:[],edges:[],combos:[]};Object.entries(l).forEach(([d,f])=>{const g=this.getElementType(d);h[`${g}s`].push({id:d,states:u(f)})}),this.updateData(h),yield(o=this.context.element.draw({animation:c,stage:"state"}))===null||o===void 0?void 0:o.finished})}getElementState(t){return this.context.model.getElementState(t)}getElementRenderBounds(t){return this.context.element.getElement(t).getRenderBounds()}collapseElement(t){return Gt(this,arguments,void 0,function*(e,n=!0){const{model:i,element:a}=this.context;if(mn(i.getNodeLikeData([e])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!0});const s=i.getElementType(e);yield this.frontElement(e),this.isCollapsingExpanding=!0,this.setElementCollapsibility(e,!0),s==="node"?yield a.collapseNode(e,n):s==="combo"&&(yield a.collapseCombo(e,!!n.animation)),this.isCollapsingExpanding=!1})}expandElement(t){return Gt(this,arguments,void 0,function*(e,n=!0){const{model:i,element:a}=this.context;if(!mn(i.getNodeLikeData([e])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!0});const s=i.getElementType(e);this.isCollapsingExpanding=!0,this.setElementCollapsibility(e,!1),s==="node"?yield a.expandNode(e,n):s==="combo"&&(yield a.expandCombo(e,!!n.animation)),this.isCollapsingExpanding=!1})}setElementCollapsibility(t,e){const n=this.getElementType(t);n==="node"?this.updateNodeData([{id:t,style:{collapsed:e}}]):n==="combo"&&this.updateComboData([{id:t,style:{collapsed:e}}])}toDataURL(){return Gt(this,arguments,void 0,function*(t={}){return this.context.canvas.toDataURL(t)})}getCanvasByViewport(t){return this.context.canvas.getCanvasByViewport(t)}getViewportByCanvas(t){return this.context.canvas.getViewportByCanvas(t)}getClientByCanvas(t){return this.context.canvas.getClientByCanvas(t)}getCanvasByClient(t){return this.context.canvas.getCanvasByClient(t)}getViewportCenter(){return this.context.viewport.getViewportCenter()}getCanvasCenter(){return this.context.viewport.getCanvasCenter()}on(t,e,n){return super.on(t,e,n)}once(t,e){return super.once(t,e)}off(t,e){return super.off(t,e)}}od.defaultOptions={autoResize:!1,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};var ret=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{if(o.depth=l,!o.children)return o;const{children:c}=o,u=ret(o,["children"]);return Object.assign(Object.assign({},u),{children:c.map(h=>h.id)})},getEdgeData:n=(o,l)=>({source:o.id,target:l.id}),getChildren:i=o=>o.children||[]}={},a=[],s=[];return Oa(r,(o,l)=>{a.push(e(o,l));const c=i(o);for(const u of c)s.push(n(o,u))},o=>i(o),"TB"),{nodes:a,edges:s}}class aet extends di{beforeDraw(t){const{add:e,update:n}=t,{model:i}=this.context;return[...e.edges.entries(),...n.edges.entries()].forEach(([,a])=>{nN(i,a)}),t}}const nN=(r,t)=>{const{source:e,target:n}=t,i=r.getElementDataById(e),a=r.getElementDataById(n),s=jb(i,h=>r.getParentData(h,jt)),o=jb(a,h=>r.getParentData(h,jt)),l=F(s),c=F(o),u={sourceNode:l,targetNode:c};return t.style?Object.assign(t.style,u):t.style=u,t},set=(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)},oet=(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)},cet=(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)},uet=(r,t,e)=>{const[n,i]=t,[a,s]=e,o=Math.sqrt((r-n)/(i-n));return a+o*(s-a)};class ld extends di{constructor(t,e){super(t,on({},ld.defaultOptions,e)),this.assignSizeByCentrality=(n,i,a,s,o,l)=>{const c=[i,a],u=[s[0],o[0]],h=[s[1],o[1]],d=[s[2],o[2]],f=(g,v)=>{if(typeof l=="function")return l(g,c,v);switch(l){case"linear":return set(g,c,v);case"log":return oet(g,c,v);case"pow":return cet(g,c,v,2);case"sqrt":return uet(g,c,v);default:return v[0]}};return[f(n,u),f(n,h),f(n,d)]}}beforeDraw(t){const{model:e}=this.context,n=e.getNodeData(),i=Nn(this.options.maxSize),a=Nn(this.options.minSize),s=this.getCentralities(this.options.centrality),o=s.size>0?Math.max(...s.values()):0,l=s.size>0?Math.min(...s.values()):0;return n.forEach(c=>{var u;const h=this.assignSizeByCentrality(s.get(F(c))||0,l,o,a,i,this.options.scale),d=(u=this.context.element)===null||u===void 0?void 0:u.getElement(F(c)),f={size:h};this.assignLabelStyle(f,h,c,d),(!d||!zc(f,d.attributes))&&Pn(t,d?"update":"add","node",on(c,{style:f}),!0)}),t}assignLabelStyle(t,e,n,i){var a;const s=i?i.config.style:(a=this.context.element)===null||a===void 0?void 0:a.getElementComputedStyle("node",n);if(Object.assign(t,La(s,["labelFontSize","labelLineHeight"])),this.options.mapLabelSize){const o=this.getLabelSizeByNodeSize(e,1/0,Number(t.labelFontSize));Object.assign(t,{labelFontSize:o,labelLineHeight:o+R8(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 rT(n,i,t)}}ld.defaultOptions={centrality:{type:"degree"},maxSize:80,minSize:20,scale:"linear",mapLabelSize:!1};class cd extends di{constructor(t,e){super(t,Object.assign({},cd.defaultOptions,e))}get ref(){return this.context.model.getRootsData()[0]}afterLayout(){var t;const e=ye(this.ref),{graph:n,model:i}=this.context;(t=i.getData().nodes)===null||t===void 0||t.forEach(s=>{var o;if(F(s)===F(this.ref))return;const l=aT($t(ye(s),e)),c=Math.abs(l)>Math.PI/2,u=!s.children||s.children.length===0,h=F(s),d=(o=this.context.element)===null||o===void 0?void 0:o.getElement(h);if(!d||!d.isVisible())return;const f=Nn(n.getElementRenderStyle(h).size)[0]/2,g=(u?1:-1)*(f+this.options.offset),v=[["translate",g*Math.cos(l),g*Math.sin(l)],["rotate",c?gn(l)+180:gn(l)]];i.updateNodeData([{id:F(s),style:{labelTextAlign:c===u?"right":"left",labelTextBaseline:"middle",labelTransform:v}}])}),n.draw()}}cd.defaultOptions={offset:5};const het="quadratic",Kk=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class ud extends di{constructor(t,e){super(t,Object.assign({},ud.defaultOptions,e)),this.cacheMergeStyle=new Map,this.getAffectedParallelEdges=n=>{const{add:{edges:i},update:{nodes:a,edges:s,combos:o},remove:{edges:l}}=n,{model:c}=this.context,u=new Map,h=(g,v)=>{c.getRelatedEdgesData(v).forEach(m=>!u.has(F(m))&&u.set(F(m),m))};a.forEach(h),o.forEach(h);const d=g=>{const v=c.getEdgeData().map(m=>nN(c,m));det(g,v).forEach(m=>!u.has(F(m))&&u.set(F(m),m))};if(l.size&&l.forEach(d),i.size&&i.forEach(d),s.size){const g=lP(t2(c.getChanges())).update.edges;s.forEach(v=>{var p;d(v);const m=(p=g.find(y=>F(y.value)===F(v)))===null||p===void 0?void 0:p.original;m&&!v2(v,m)&&d(m)})}wr(this.options.edges)||u.forEach((g,v)=>!this.options.edges.includes(v)&&u.delete(v));const f=c.getEdgeData().map(F);return new Map([...u].sort((g,v)=>f.indexOf(g[0])-f.indexOf(v[0])))},this.applyBundlingStyle=(n,i,a)=>{const{edgeMap:s,reverses:o}=Zk(i);s.forEach(l=>{l.forEach((c,u,h)=>{var d;const f=h.length,g=c.style||{};if(c.source===c.target){const m=Kk.length;g.loopPlacement=Kk[u%m],g.loopDist=Math.floor(u/m)*a+50}else if(f===1)g.curveOffset=0;else{const m=(u%2===0?1:-1)*(o[`${c.source}|${c.target}|${u}`]?-1:1);g.curveOffset=f%2===1?m*Math.ceil(u/2)*a*2:m*(Math.floor(u/2)*a*2+a)}const v=Object.assign(c,{type:het,style:g}),p=(d=this.context.element)===null||d===void 0?void 0:d.getElement(F(c));(!p||!zc(v.style,p.attributes))&&Pn(n,p?"update":"add","edge",v,!0)})})},this.resetEdgeStyle=n=>{const i=n.style||{},a=this.cacheMergeStyle.get(F(n))||{};return Object.keys(a).forEach(s=>{ue(i[s],a[s])&&(n[s]?i[s]=n[s]:delete i[s])}),Object.assign(n,{style:i})},this.applyMergingStyle=(n,i)=>{const{edgeMap:a,reverses:s}=Zk(i);a.forEach(o=>{var l;if(o.length===1){const u=o[0],h=(l=this.context.element)===null||l===void 0?void 0:l.getElement(F(u)),d=this.resetEdgeStyle(u);(!h||!zc(d,h.attributes))&&Pn(n,h?"update":"add","edge",d);return}const c=o.map(({source:u,target:h,style:d={}},f)=>{const{startArrow:g,endArrow:v}=d,p={},[m,y]=s[`${u}|${h}|${f}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return Xc(g)&&(p[m]=g),Xc(v)&&(p[y]=v),p}).reduce((u,h)=>Object.assign(Object.assign({},u),h),{});o.forEach((u,h,d)=>{var f;if(h!==0){Pn(n,"remove","edge",u);return}const g=Object.assign({},at(this.options.style)?this.options.style(d):this.options.style,{childrenData:d});this.cacheMergeStyle.set(F(u),g);const v=Object.assign(Object.assign({},u),{type:"line",style:Object.assign(Object.assign(Object.assign({},u.style),c),g)}),p=(f=this.context.element)===null||f===void 0?void 0:f.getElement(F(u));(!p||!zc(v.style,p.attributes))&&Pn(n,p?"update":"add","edge",v,!0)})})}}beforeDraw(t){const e=this.getAffectedParallelEdges(t);return e.size===0||(this.options.mode==="bundle"?this.applyBundlingStyle(t,e,this.options.distance):this.applyMergingStyle(t,e)),t}}ud.defaultOptions={mode:"bundle",distance:15};const Zk=r=>{const t=new Map,e=new Set,n={};for(const[i,a]of r){if(e.has(i))continue;const{source:s,target:o}=a,l=`${s}-${o}`;t.has(l)||t.set(l,[]),t.get(l).push(a),e.add(i);for(const[c,u]of r)e.has(c)||v2(a,u)&&(t.get(l).push(u),e.add(c),s===u.target&&o===u.source&&(n[`${u.source}|${u.target}|${t.get(l).length-1}`]=!0))}return{edgeMap:t,reverses:n}},det=(r,t,e)=>t.filter(n=>v2(n,r)),v2=(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 fet extends di{beforeDraw(t,e){const{stage:n}=e;if(n==="visibility")return t;const{model:i}=this.context,{update:{nodes:a,edges:s,combos:o}}=t,l=(c,u)=>{i.getRelatedEdgesData(u).forEach(d=>!s.has(F(d))&&s.set(F(d),d))};return a.forEach(l),o.forEach(l),t}}const get={animation:{"combo-collapse":KC,"combo-expand":A8,"node-collapse":YC,"node-expand":T8,"path-in":XC,"path-out":O8,fade:M8,translate:C8},behavior:{"brush-select":Qo,"click-select":ju,"collapse-expand":Ju,"create-edge":Qu,"drag-canvas":th,"drag-element-force":IF,"drag-element":al,"fix-element-size":rh,"focus-element":ih,"hover-activate":ah,"lasso-select":BF,"auto-adapt-label":Bu,"optimize-viewport-transform":sh,"scroll-canvas":oh,"zoom-canvas":lh},combo:{circle:D7,rect:I7},edge:{cubic:Va,line:FT,polyline:Xu,quadratic:Ku,"cubic-horizontal":rl,"cubic-radial":Uu,"cubic-vertical":Yu},layout:{"antv-dagre":I$,"combo-combined":Iq,"compact-box":oc.compactBox,"d3-force":eG,"force-atlas2":QY,circular:z$,concentric:dy,dagre:Rh,dendrogram:oc.dendrogram,fishbone:Lh,force:bO,fruchterman:nX,grid:iX,indented:oc.indented,mds:OO,mindmap:oc.mindmap,radial:fX,random:wX,snake:Dh},node:{circle:nl,diamond:B9,ellipse:Wu,hexagon:G9,html:Vu,image:AT,rect:R7,star:L7,donut:Gu,triangle:Hu},palette:{spectral:IX,tableau:FX,oranges:BX,greens:zX,blues:$X},theme:{dark:Ptt,light:Rtt},plugin:{"bubble-sets":Bh,"edge-bundling":$h,"edge-filter-lens":jh,"grid-line":Wh,background:Ih,contextmenu:zh,fisheye:qh,fullscreen:Gh,history:Vh,hull:Hh,legend:Qh,minimap:td,snapline:ed,timebar:nd,toolbar:rd,tooltip:id,watermark:ad},transform:{"arrange-draw-order":Ltt,"collapse-expand-combo":Dtt,"collapse-expand-node":Itt,"get-edge-actual-ends":aet,"map-node-size":ld,"place-radial-labels":cd,"process-parallel-edges":ud,"update-related-edges":fet},shape:{circle:li,ellipse:Xo,group:Pe,html:Ko,image:g1,line:Fa,path:Tn,polygon:Wa,polyline:Iu,rect:Be,text:Qi,label:na,badge:ei}};function vet(){Object.entries(get).forEach(([r,t])=>{Object.entries(t).forEach(([e,n])=>{mo(r,e,n)})})}vet();const pet={class:"progress"},met={__name:"MindMapping",props:{data:Object,loading:Boolean},setup(r){const t=r,e=Rt(null),n=Rt(0),i=Rt(null),a=()=>{i.value=setInterval(()=>{n.value+=Math.random()>.5?3:2,n.value>98&&(n.value=98,clearInterval(i.value))},1e3)};zy(()=>{t.loading&&!t.data&&a()}),$y(()=>{clearInterval(i.value)}),$c(()=>t.loading,S=>{S&&!t.data?a():clearInterval(i.value)}),$c(()=>t.data,S=>{S&&b(S)});const s={fill:"#EFF0F0",labelFill:"#262626",labelFontSize:24,labelFontWeight:600,labelOffsetY:8,labelPlacement:"center",ports:[{placement:"right"},{placement:"left"}],radius:8},o={fill:"transparent",labelPlacement:"center",labelFontSize:16,ports:[{placement:"right-bottom"},{placement:"left-bottom"}]},l={COLLAPSE_EXPAND:"collapse-expand",ADD_CHILD:"add-child"};let c;const u=S=>(c||(c=new Qi({style:S})),c.attr(S),c.getBBox().width),h=(S,E)=>{const _=E?40:30;return u({text:S,fontSize:(E?s:o).labelFontSize,fontFamily:"Gill Sans"})+_},d=(S,E)=>[h(S,E),E?48:32],w=class w extends Xn{constructor(E){Object.assign(E.style,w.defaultStyleProps),super(E)}get childrenData(){return this.context.model.getChildrenData(this.id)}get rootId(){return F(this.context.model.getRootsData()[0])}isShowCollapse(E){const{collapsed:_,showIcon:C}=E;return!_&&C&&this.childrenData.length>0}getCollapseStyle(E){const{color:_,direction:C}=E;if(!this.isShowCollapse(E))return!1;const[k,M]=this.getSize(E);return{backgroundFill:_,backgroundHeight:12,backgroundWidth:12,cursor:"pointer",stroke:_,lineWidth:4,fontSize:0,text:"",textAlign:"center",transform:[],visibility:"visible",x:C==="left"?-6:k+6,y:M}}drawCollapseShape(E,_){const C=this.getCollapseStyle(E),k=this.upsert("collapse-expand",ei,C,_);this.forwardEvent(k,z.CLICK,M=>{M.stopPropagation(),this.context.graph.emit(l.COLLAPSE_EXPAND,{id:this.id,collapsed:!E.collapsed})})}getCountStyle(E){const{collapsed:_,color:C,direction:k}=E,M=this.context.model.getDescendantsData(this.id).length;if(!_||M===0)return!1;const[T,O]=this.getSize(E);return{backgroundFill:C,backgroundHeight:12,backgroundWidth:12,cursor:"pointer",fill:"#fff",fontSize:8,text:M.toString(),textAlign:"center",x:k==="left"?-4:T+4,y:O}}drawCountShape(E,_){const C=this.getCountStyle(E),k=this.upsert("count",ei,C,_);this.forwardEvent(k,z.CLICK,M=>{M.stopPropagation(),this.context.graph.emit(l.COLLAPSE_EXPAND,{id:this.id,collapsed:!1})})}getAddStyle(E){const{collapsed:_,showIcon:C,direction:k}=E,M=this.childrenData.length===0;if(_||!C||!M)return!1;const[T,O]=this.getSize(E),R=this.isShowCollapse(E)?24:12,L=this.id===this.rootId;return{backgroundFill:"#1783FF",backgroundHeight:14,backgroundLineWidth:1,backgroundStroke:"#1783FF",backgroundWidth:14,cursor:"pointer",fill:"#fff",fontSize:14,text:"+",textAlign:"center",x:L?T+12:k==="left"?-R:T+R,y:L?O/2:O}}drawAddShape(E,_){const C=this.getAddStyle(E),k=this.upsert("add",ei,C,_);this.forwardEvent(k,z.CLICK,M=>{M.stopPropagation(),this.context.graph.emit(l.ADD_CHILD,{id:this.id,direction:E.direction})})}forwardEvent(E,_,C){E&&!Reflect.has(E,"__bind__")&&(Reflect.set(E,"__bind__",!0),E.addEventListener(_,C))}getKeyStyle(E){const[_,C]=this.getSize(E),k=super.getKeyStyle(E);return{width:_,height:C,...k}}drawKeyShape(E,_){const C=this.getKeyStyle(E);return this.upsert("key",Be,C,_)}render(E=this.parsedAttributes,_=this){super.render(E,_),this.drawCollapseShape(E,_),this.drawAddShape(E,_),this.drawCountShape(E,_)}};Ot(w,"defaultStyleProps",{showIcon:!0});let f=w;class g extends rl{get rootId(){return F(this.context.model.getRootsData()[0])}getKeyPath(E){const _=super.getKeyPath(E),C=this.targetNode.id===this.rootId,k=h(this.targetNode.id,C),[,M]=this.getEndpoints(E),T=this.sourceNode.getCenter()[0]{this.setIcon(_,!0)});Ot(this,"hideIcon",_=>{this.setIcon(_,!1)});Ot(this,"setIcon",(_,C)=>{if(this.status!=="idle")return;const{target:k}=_,M=k.id,{graph:T,element:O}=this.context;T.updateNodeData([{id:M,style:{showIcon:C}}]),O.draw({animation:!1,silence:!0})});Ot(this,"onCollapseExpand",async _=>{this.status="busy";const{id:C,collapsed:k}=_,{graph:M}=this.context;await M.frontElement(C),k?await M.collapseElement(C):await M.expandElement(C),this.status="idle"});Ot(this,"addChild",async _=>{this.status="busy";const{onCreateChild:C=()=>({id:`新节点 in ${new Date(Date.now()).toLocaleString()}`})}=this.options,{graph:k}=this.context,M=C(_.id),T=k.getNodeData(_.id);k.addNodeData([M]),k.addEdgeData([{source:_.id,target:M.id}]),k.updateNodeData([{id:_.id,children:[...T.children||[],M.id],style:{collapsed:!1,showIcon:!1}}]),await k.render(),await k.focusElement(M.id),this.status="idle"});this.bindEvents()}update(_){this.unbindEvents(),super.update(_),this.bindEvents()}bindEvents(){const{graph:_}=this.context;_.on(l.COLLAPSE_EXPAND,this.onCollapseExpand),_.on(l.ADD_CHILD,this.addChild)}unbindEvents(){const{graph:_}=this.context;_.off(l.COLLAPSE_EXPAND,this.onCollapseExpand),_.off(l.ADD_CHILD,this.addChild)}}const x=class x extends di{constructor(E,_){super(E,Object.assign({},x.defaultOptions,_))}beforeDraw(E){const _=this.context.model.getNodeData(),C=this.context.model.getEdgeData();if(_.length===0)return E;let k=0;return _.forEach(M=>{M.style||(M.style={}),M.style.color=this.options.colors[k++%this.options.colors.length]}),C.forEach(M=>{const T=_.find(O=>O.id===M.target);T&&(M.style||(M.style={}),M.style.stroke=T.style.color)}),E}};Ot(x,"defaultOptions",{colors:["#80B4FF","#FFC8A2","#E6C8FF","#A2E6E6","#C8B4FF","#FFD878","#A2E680","#FFA2D8","#80C8D8","#80E6A2","#FFD878","#D880D8","#80C880","#FFA280","#80E6E6","#FFA2D8","#C8C8D8","#FFC8C8","#FFD878","#C8FF80"]});let p=x;mo(Yr.NODE,"mindmap",f),mo(Yr.EDGE,"mindmap",g),mo(Yr.BEHAVIOR,"collapse-expand-tree",v),mo(Yr.TRANSFORM,"assign-color-by-branch",p);const m=(S,E)=>{if(!E)return"center";const _=ye(S)[0];return ye(E)[0]>_?"left":"right"};let y=null;const b=S=>{var _,C;y&&y.destroy();const E=S.id;y=new od({container:e.value,width:((_=e.value)==null?void 0:_.clientWidth)||1e3,height:((C=e.value)==null?void 0:C.clientHeight)||800,fitView:!0,fitCenter:!0,data:iet(S),node:{type:"mindmap",style:function(k){const M=m(k,this.getParentData(F(k),"tree")),T=F(k)===E;return{direction:M,labelText:F(k),size:d(F(k),T),labelFontFamily:"Gill Sans",labelBackground:!0,labelBackgroundFill:"transparent",labelPadding:M==="left"?[2,0,10,40]:[2,40,10,0],color:k.style.color,...T?s:o}}},edge:{type:"mindmap",style:{lineWidth:3,stroke:function(k){return this.getNodeData(k.target).style.color||"#99ADD1"}}},layout:{type:"mindmap",direction:"H",getHeight:()=>80,getWidth:k=>h(k.id,k.id===E),getVGap:()=>6,getHGap:()=>60,animation:!1,getSide:()=>"right"},behaviors:["drag-canvas","zoom-canvas","collapse-expand-tree"],transforms:["assign-color-by-branch"],animation:{duration:200}}),y.once(X.AFTER_RENDER,()=>{y.fitView()}),y.render()};return(S,E)=>{const _=aR;return ct(),le(Ss,null,[CN(Xt("div",pet,[At(_,{type:"circle",width:"250","stroke-width":"10",percent:n.value/100,"show-text":!1},null,8,["percent"]),Xt("h1",null,ka(`${n.value}%`),1)],512),[[TN,!r.data&&r.loading]]),Xt("div",{ref_key:"container",ref:e,class:"mindmap-container"},null,512)],64)}}},yet=Zi(met,[["__scopeId","data-v-e430cb65"]]),bet="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",wet="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.75%204C7.75%202.20508%209.20508%200.75%2011%200.75H27C27.1212%200.75%2027.2375%200.798159%2027.3232%200.883885L38.1161%2011.6768C38.2018%2011.7625%2038.25%2011.8788%2038.25%2012V36C38.25%2037.7949%2036.7949%2039.25%2035%2039.25H11C9.20507%2039.25%207.75%2037.7949%207.75%2036V4Z'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3cpath%20d='M27%200.5V8C27%2010.2091%2028.7909%2012%2031%2012H38.5'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3crect%20x='1'%20y='18'%20width='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",xet="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M7.75%204C7.75%202.20508%209.20508%200.75%2011%200.75H27C27.1212%200.75%2027.2375%200.798159%2027.3232%200.883885L38.1161%2011.6768C38.2018%2011.7625%2038.25%2011.8788%2038.25%2012V36C38.25%2037.7949%2036.7949%2039.25%2035%2039.25H11C9.20507%2039.25%207.75%2037.7949%207.75%2036V4Z'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3cpath%20d='M27%200.5V8C27%2010.2091%2028.7909%2012%2031%2012H38.5'%20stroke='%23D0D5DD'%20stroke-width='1.5'%20/%3e%3crect%20x='1'%20y='18'%20width='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",Eet="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",_et="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",ket="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",Met=["src","alt"],Cet={__name:"FileIcon",props:{name:String},setup(r){const t=r,e=i=>(i==null?void 0:i.slice(i.lastIndexOf(".")+1).toLowerCase())??"",n=Ee(()=>new URL(Object.assign({"../../assets/ai-search/doc.svg":bet,"../../assets/ai-search/docx.svg":wet,"../../assets/ai-search/pdf.svg":xet,"../../assets/ai-search/selected-files-collapse.svg":Eet,"../../assets/ai-search/xls.svg":_et,"../../assets/ai-search/xlsx.svg":ket})[`../../assets/ai-search/${e(t.name)}.svg`],import.meta.url).href);return(i,a)=>(ct(),le("img",{src:n.value,alt:i.file_type,class:"file-icon"},null,8,Met))}},Tet=Zi(Cet,[["__scopeId","data-v-9524518b"]]),Oet={class:"image-aside-btn-container"},Aet=["src"],Pet=["src"],Net={__name:"PopoverImage",props:{src:String},setup(r){return(t,e)=>{const n=gM;return ct(),ee(n,null,{content:Lt(()=>[Xt("img",{src:r.src,class:"image-large-view"},null,8,Pet)]),default:Lt(()=>[Xt("div",Oet,[Xt("img",{src:r.src,class:"image-aside-btn"},null,8,Aet)])]),_:1})}}},Ret=Zi(Net,[["__scopeId","data-v-aa6f0a43"]]),Let={class:"chunk-list"},Det={key:1},Iet={class:"card"},Fet={class:"document-reference"},Bet={class:"popup-markdown"},zet=["innerHTML"],$et=["innerHTML"],jet=["onClick"],qet={key:0},Get={__name:"ChunkList",props:{chunks:Array,total:{type:Number,required:!0},highlight_word:String,page_size:{type:Number,default:10},loading:Boolean},emits:["clickDocumentButton","pageChange","pageSizeChange"],setup(r,{emit:t}){const e=r,n=t,i=u=>{n("clickDocumentButton",u)},a=u=>{if(!e.highlight_word)return u;const h=new RegExp(`(${e.highlight_word})`,"gi");return u.replace(h,'$1')},s=Rt(1),o=Rt(10),l=u=>{s.value=u,n("pageChange",u)},c=u=>{u.value=u,n("pageSizeChange",u)};return(u,h)=>{const d=nM,f=gM,g=Tu,v=rM,p=rR;return ct(),le("div",Let,[r.loading?(ct(),ee(d,{key:0,dot:"",loading:r.loading},null,8,["loading"])):(ct(),le("div",Det,[(ct(!0),le(Ss,null,Ou(r.chunks,(m,y)=>(ct(),le("div",{key:y},[Xt("div",Iet,[m.image_url?(ct(),ee(Ret,{key:0,src:m.image_url},null,8,["src"])):Hn("",!0),Xt("div",Fet,[At(f,{trigger:"hover"},{content:Lt(()=>[Xt("div",Bet,[Xt("div",{innerHTML:a(m.content_with_weight)},null,8,zet)])]),default:Lt(()=>[Xt("div",{innerHTML:a(m.highlight),class:"highlight-content"},null,8,$et)]),_:2},1024),Xt("div",{class:"file-btn",onClick:b=>i(m)},[At(g,null,{default:Lt(()=>[At(Tet,{name:m.docnm_kwd},null,8,["name"]),Xt("div",null,ka(m.docnm_kwd),1)]),_:2},1024)],8,jet)])]),y1?(ct(),le("div",qet,[At(v),At(p,{current:s.value,total:r.total,"page-size":o.value,"show-total":"","show-page-size":"",onChange:l,onPageSizeChange:c},null,8,["current","total","page-size"])])):Hn("",!0)]))])}}},Wet=Zi(Get,[["__scopeId","data-v-35d78ef4"]]);var Vet=Object.defineProperty,Het=(r,t,e)=>t in r?Vet(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Cc=(r,t,e)=>Het(r,typeof t!="symbol"?t+"":t,e);class Jk extends Error{constructor(t,e){super(t),Cc(this,"type"),Cc(this,"field"),Cc(this,"value"),Cc(this,"line"),this.name="ParseError",this.type=e.type,this.field=e.field,this.value=e.value,this.line=e.line}}function vm(r){}function Uet(r){const{onEvent:t=vm,onError:e=vm,onRetry:n=vm,onComment:i}=r;let a="",s=!0,o,l="",c="";function u(v){const p=s?v.replace(/^\xEF\xBB\xBF/,""):v,[m,y]=Yet(`${a}${p}`);for(const b of m)h(b);a=y,s=!1}function h(v){if(v===""){f();return}if(v.startsWith(":")){i&&i(v.slice(v.startsWith(": ")?2:1));return}const p=v.indexOf(":");if(p!==-1){const m=v.slice(0,p),y=v[p+1]===" "?2:1,b=v.slice(p+y);d(m,b,v);return}d(v,"",v)}function d(v,p,m){switch(v){case"event":c=p;break;case"data":l=`${l}${p} `;break;case"id":o=p.includes("\0")?void 0:p;break;case"retry":/^\d+$/.test(p)?n(parseInt(p,10)):e(new Jk(`Invalid \`retry\` value: "${p}"`,{type:"invalid-retry",value:p,line:m}));break;default:e(new Jk(`Unknown field "${v.length>20?`${v.slice(0,20)}…`:v}"`,{type:"unknown-field",field:v,value:p,line:m}));break}}function f(){l.length>0&&t({id:o,event:c||void 0,data:l.endsWith(` `)?l.slice(0,-1):l}),o=void 0,l="",c=""}function g(v={}){a&&v.consume&&h(a),o=void 0,l="",c="",a=""}return{feed:u,reset:g}}function Yet(r){const t=[];let e="";const n=r.length;for(let i=0;i{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 Ket(r){return jy({url:"/rgflow/v1/chunk/retrieval_test",method:"post",data:r})}function Zet(r){return jy({url:"/rgflow/v1/conversation/related_questions",method:"post",data:r})}function Jet(r){return jy({url:"/rgflow/v1/conversation/mindmap",method:"post",data:r})}function Qet(){var s;const r=Rt({chunks:[],documents:[],total:0}),t=Rt(!1),e=ON(),n=((s=e==null?void 0:e.query)==null?void 0:s.id)||"",{getFileUrl:i}=rN(),a=async o=>{t.value=!0;try{const{data:l,code:c}=await Ket({...o,kb_id:o.kb_id??n});c===0?r.value={chunks:l.chunks.map(u=>({...u,image_url:i(u.image_id,"image")})),documents:l.doc_aggs,total:l.total}:r.value={chunks:[],documents:[],total:0}}catch{r.value={chunks:[],documents:[],total:0},Pu.error("检索失败")}finally{t.value=!1}};return{chunks_data:Ee(()=>r.value),loading:Ee(()=>t.value),testChunk:a}}function tnt(){const r=Rt([]),t=Rt(!1);return{data:r,loading:t,fetchRelatedQuestions:async n=>{t.value=!0;try{const{data:i}=await Zet({question:n});r.value=(i==null?void 0:i.slice(0,5))??[]}catch(i){Pu.error(i.message)}finally{t.value=!1}}}}function ent(){const r=Rt({}),t=Rt(!0),e=Rt(null),n=()=>{e.value&&clearTimeout(e.value),e.value=setTimeout(()=>{r.value={},clearTimeout(e.value)},1e3)},i=async(a,s)=>{var o;try{t.value=!1;const l=FN.get(),u=`${dM("RGFLOW_BASE_URL")}/v1/conversation/ask`,h=await fetch(u,{method:"POST",headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"},body:JSON.stringify(a),signal:s==null?void 0:s.signal}),d=h.clone().json(),f=(o=h==null?void 0:h.body)==null?void 0:o.pipeThrough(new TextDecoderStream).pipeThrough(new Xet).getReader();for(;;){const g=await(f==null?void 0:f.read());if(g){const{done:v,value:p}=g;if(v){console.info("done"),n();break}try{const m=JSON.parse((p==null?void 0:p.data)||""),y=m==null?void 0:m.data;typeof y!="boolean"&&(r.value={...y,conversation_id:a==null?void 0:a.conversation_id})}catch(m){console.warn(m)}}}return console.info("done?"),t.value=!0,n(),{data:await d,response:h}}catch(l){t.value=!0,n(),console.warn(l)}};return $y(()=>{e.value&&clearTimeout(e.value)}),{send:i,answer:r,done:t,resetAnswer:n}}function nnt(){const r=Rt(null),t=Rt(!1);return{data:r,loading:t,fetchMindmap:async n=>{t.value=!0;try{const{data:i}=await Jet(n);r.value=i}catch{Pu.error("获取思维导图失败")}finally{t.value=!1}}}}function rN(){return{getFileUrl:(t,e)=>{if(!t||!e)return"";const n=dM("RGFLOW_BASE_URL");let i="";switch(e){case"doc":case"docx":i=`${n}/document/${t}?ext=docx&prefix=document`;break;case"pdf":i=`${n}/v1/document/get/${t}`;break;case"image":i=`${n}/v1/document/image/${t}`;break;default:i=""}return i}}}var rnt="[object Symbol]";function int(r){return typeof r=="symbol"||HN(r)&&UN(r)==rnt}function ant(r,t){for(var e=-1,n=r==null?0:r.length,i=Array(n);++ei?0:i+t),e=e>i?i:e,e<0&&(e+=i),i=t>e?0:e-t>>>0,t>>>=0;for(var a=Array(i);++n=n?r:gnt(r,t,e)}var pnt="\\ud800-\\udfff",mnt="\\u0300-\\u036f",ynt="\\ufe20-\\ufe2f",bnt="\\u20d0-\\u20ff",wnt=mnt+ynt+bnt,xnt="\\ufe0e\\ufe0f",Ent="\\u200d",Snt=RegExp("["+Ent+pnt+wnt+xnt+"]");function _nt(r){return Snt.test(r)}function knt(r){return r.split("")}var aN="\\ud800-\\udfff",Mnt="\\u0300-\\u036f",Cnt="\\ufe20-\\ufe2f",Tnt="\\u20d0-\\u20ff",Ont=Mnt+Cnt+Tnt,Ant="\\ufe0e\\ufe0f",Pnt="["+aN+"]",Dy="["+Ont+"]",Iy="\\ud83c[\\udffb-\\udfff]",Nnt="(?:"+Dy+"|"+Iy+")",sN="[^"+aN+"]",oN="(?:\\ud83c[\\udde6-\\uddff]){2}",lN="[\\ud800-\\udbff][\\udc00-\\udfff]",Rnt="\\u200d",cN=Nnt+"?",uN="["+Ant+"]?",Lnt="(?:"+Rnt+"(?:"+[sN,oN,lN].join("|")+")"+uN+cN+")*",Dnt=uN+cN+Lnt,Int="(?:"+[sN+Dy+"?",Dy,oN,lN,Pnt].join("|")+")",Fnt=RegExp(Iy+"(?="+Iy+")|"+Int+Dnt,"g");function Bnt(r){return r.match(Fnt)||[]}function eM(r){return _nt(r)?Bnt(r):knt(r)}var znt="[object Map]",$nt="[object Set]",jnt=Object.prototype,qnt=jnt.hasOwnProperty;function pm(r){if(r==null)return!0;if(YN(r)&&(fM(r)||typeof r=="string"||typeof r.splice=="function"||XN(r)||KN(r)||ZN(r)))return!r.length;var t=JN(r);if(t==znt||t==$nt)return!r.size;if(QN(r))return!tR(r).length;for(var e in r)if(qnt.call(r,e))return!1;return!0}function Gnt(r,t){for(var e=r.length;e--&&iN(t,r[e],0)>-1;);return e}function Wnt(r,t){for(var e=-1,n=r.length;++e-1;);return e}function mm(r,t,e){if(r=fnt(r),r&&t===void 0)return cnt(r);if(!r||!(t=p2(t)))return r;var n=eM(r),i=eM(t),a=Wnt(n,i),s=Gnt(n,i)+1;return vnt(n,a,s).join("")}const Vnt={class:"ai-search-container"},Hnt={key:0,class:"search-results"},Unt={__name:"index",setup(r){const{t}=cM(),e=Rt(""),n=Rt(!1),i=Rt(!1),a=Rt(1e3),s=Rt(t("ai_search.mindmap_title")),o=Rt(!1),l=Rt(!0),c=Rt([]),u=Ii({page:1,page_size:10}),h=Rt(!1),d=Rt([]),f=Rt([]),g=Rt(""),v=Ii({doc_id:"",doc_name:"",drawer_url:"",image_url:"",positions:[]});zy(async()=>{try{const{data:{rows:G}}=await sR();d.value=G,f.value=G.map(H=>H.id)}catch(G){console.error(G)}});const{send:m,answer:y,done:b}=ent(),{chunks_data:w,testChunk:x}=Qet(),{fetchRelatedQuestions:S,data:E}=tnt(),{data:_,loading:C,fetchMindmap:k}=nnt(),{getFileUrl:M}=rN(),T=async G=>{const H=mm(G);pm(H)||(w.value={documents:[],chunks:[]},c.value=[],E.value=[],l.value=!1,o.value=!0,m({kb_ids:f.value,question:H}),x({kb_id:f.value,highlight:!0,question:H,page:1,size:u.page_size}),await S(H))},O=G=>{o.value||(e.value=G,T(G))},R=async(G,H=1,Y=10)=>{const K=mm(e.value);o.value||pm(K)||(h.value=!0,await x({kb_id:f.value,highlight:!0,question:K,doc_ids:G??c.value,page:H,size:Y}),h.value=!1)};$c(b,G=>{G&&(o.value=!1)});const L=G=>{const{doc_id:H,docnm_kwd:Y,image_id:K,positions:tt}=G;s.value=Y,i.value=!0;const it=Y.split(".").pop().toLowerCase();switch(v.doc_id=H,v.doc_name=Y,v.drawer_url=M(H,it),v.image_url=M(K,"image"),v.positions=tt,it){case"pdf":g.value="pdf";break;case"doc":case"docx":g.value="doc";break}},D=()=>{s.value=t("ai_search.mindmap_title"),g.value="mindmap",i.value=!0,k({question:e.value,kb_ids:f.value})},P=G=>{f.value=G},A=G=>{const H=mm(G);if(pm(H)){Pu.warning(t("ai_search.enter_search_content"));return}T(H),n.value=!0},I=G=>{A(G.target.value)},B=G=>{u.page=G,R(c.value,G,u.page_size)},j=G=>{u.page_size=G,R(c.value,u.page,G)};return(G,H)=>{const Y=oR,K=rM,tt=SN,it=Tu,_t=EN,Mt=uM,re=xN;return ct(),le(Ss,null,[Xt("div",Vnt,[At(HR,{model_list:d.value,onUpdateCheckedList:P},null,8,["model_list"]),Xt("div",{class:yn(["content-box",{"search-active":n.value}])},[At(Y,{class:"input-search",modelValue:e.value,"onUpdate:modelValue":H[0]||(H[0]=Re=>e.value=Re),placeholder:G.$t("ai_search.placeholder"),"search-button":"",loading:o.value,onPressEnter:I,onSearch:A},null,8,["modelValue","placeholder","loading"]),At(AN,{name:"fade"},{default:Lt(()=>{var Re,Le;return[n.value?(ct(),le("div",Hnt,[At(nL,{content:(Re=yr(y))==null?void 0:Re.answer},null,8,["content"]),At(K),At(KR,{documents:yr(w).documents,selected_document_ids:c.value,onOnFilesSelected:R},null,8,["documents","selected_document_ids"]),At(K),At(Wet,{chunks:yr(w).chunks,total:yr(w).total,highlight_word:e.value,loading:h.value,onClickDocumentButton:L,onPageChange:B,onPageSizeChange:j},null,8,["chunks","total","highlight_word","loading"]),At(K),((Le=yr(E))==null?void 0:Le.length)>0?(ct(),ee(_t,{key:0,title:G.$t("ai_search.related_questions")},{default:Lt(()=>[At(it,{wrap:""},{default:Lt(()=>[(ct(!0),le(Ss,null,Ou(yr(E),(cn,sa)=>(ct(),ee(tt,{key:sa,onClick:Pt=>O(cn),class:"related-question-tag"},{default:Lt(()=>[sM(ka(cn),1)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1},8,["title"])):Hn("",!0),At(K),At(Mt,{class:"floating-btn",shape:"circle",onClick:D},{default:Lt(()=>[At(yr(fR),{size:"32"})]),_:1})])):Hn("",!0)]}),_:1})],2)]),At(re,{visible:i.value,"onUpdate:visible":H[1]||(H[1]=Re=>i.value=Re),title:s.value,width:a.value,footer:!1},{default:Lt(()=>[g.value==="mindmap"?(ct(),ee(yet,{key:0,loading:yr(C),data:yr(_)},null,8,["loading","data"])):Hn("",!0),g.value==="pdf"?(ct(),ee(bN,{key:1,url:v.drawer_url,doc_width:a.value-20,positions:v.positions,'"':""},null,8,["url","doc_width","positions"])):Hn("",!0),g.value==="doc"?(ct(),ee(wN,{key:2,url:v.drawer_url,doc_width:a.value-20},null,8,["url","doc_width"])):Hn("",!0)]),_:1},8,["visible","title","width"])],64)}}},Ynt=Zi(Unt,[["__scopeId","data-v-ee51915e"]]),Wrt={__name:"AISearch",setup(r){return(t,e)=>(ct(),ee(gN,null,{default:Lt(()=>[At(vN,null,{default:Lt(()=>[At(Ynt)]),_:1})]),_:1}))}};export{Wrt as default};