@gkd-kit/inspect 0.0.1741169152740 → 0.0.1741336605276

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/assets/{ActionCard.vue_vue_type_script_setup_true_lang-Cho9_1nr.js → ActionCard.vue_vue_type_script_setup_true_lang-CSbe4rFG.js} +2 -2
  2. package/dist/assets/{ActionCard.vue_vue_type_script_setup_true_lang-Cho9_1nr.js.map → ActionCard.vue_vue_type_script_setup_true_lang-CSbe4rFG.js.map} +1 -1
  3. package/dist/assets/{DevicePage-D_5Xh7j8.js → DevicePage-ChR5vVED.js} +2 -2
  4. package/dist/assets/{DevicePage-D_5Xh7j8.js.map → DevicePage-ChR5vVED.js.map} +1 -1
  5. package/dist/assets/{HomePage-B4Fa0toa.js → HomePage-Dv254WBe.js} +2 -2
  6. package/dist/assets/{HomePage-B4Fa0toa.js.map → HomePage-Dv254WBe.js.map} +1 -1
  7. package/dist/assets/{ImportPage-DQ3Q-Lvm.js → ImportPage-D2GVWNdN.js} +2 -2
  8. package/dist/assets/{ImportPage-DQ3Q-Lvm.js.map → ImportPage-D2GVWNdN.js.map} +1 -1
  9. package/dist/assets/{Input-E7EHIMVH.js → Input-C_46Ura7.js} +2 -2
  10. package/dist/assets/{Input-E7EHIMVH.js.map → Input-C_46Ura7.js.map} +1 -1
  11. package/dist/assets/{SelectorPage-DE3_5ql8.js → SelectorPage-Dbxdn8EX.js} +2 -2
  12. package/dist/assets/{SelectorPage-DE3_5ql8.js.map → SelectorPage-Dbxdn8EX.js.map} +1 -1
  13. package/dist/assets/{SnapshotPage-BaHDcwT7.js → SnapshotPage-DFxOp0gE.js} +6 -6
  14. package/dist/assets/{SnapshotPage-BaHDcwT7.js.map → SnapshotPage-DFxOp0gE.js.map} +1 -1
  15. package/dist/assets/{SvgPage-9IYPSp4L.js → SvgPage-B7yfgMj4.js} +2 -2
  16. package/dist/assets/{SvgPage-9IYPSp4L.js.map → SvgPage-B7yfgMj4.js.map} +1 -1
  17. package/dist/assets/{_404Page-DxN-b8JR.js → _404Page-DL4WgIEL.js} +2 -2
  18. package/dist/assets/{_404Page-DxN-b8JR.js.map → _404Page-DL4WgIEL.js.map} +1 -1
  19. package/dist/assets/chunk-Dn9F2GRw.js +3 -0
  20. package/dist/assets/{chunk-DEEGUgwa.js.map → chunk-Dn9F2GRw.js.map} +1 -1
  21. package/dist/assets/{dayjs.min-BF4lfA8v.js → dayjs.min-yMXo2MBr.js} +2 -2
  22. package/dist/assets/{dayjs.min-BF4lfA8v.js.map → dayjs.min-yMXo2MBr.js.map} +1 -1
  23. package/dist/assets/{error-CrT8ojhU.js → error-Cv3W5C5p.js} +2 -2
  24. package/dist/assets/{error-CrT8ojhU.js.map → error-Cv3W5C5p.js.map} +1 -1
  25. package/dist/assets/{import-Ybrs0J5e.js → import-9IF22_MP.js} +2 -2
  26. package/dist/assets/{import-Ybrs0J5e.js.map → import-9IF22_MP.js.map} +1 -1
  27. package/dist/assets/{index-B6Srfmbb.js → index-CBFX9_Eh.js} +3 -3
  28. package/dist/assets/{index-B6Srfmbb.js.map → index-CBFX9_Eh.js.map} +1 -1
  29. package/dist/assets/index-D-r1D-BB.css +1 -0
  30. package/dist/assets/{index-BXr_m6qo.js → index-QfsuJ0d-.js} +6 -6
  31. package/dist/assets/{index-BXr_m6qo.js.map → index-QfsuJ0d-.js.map} +1 -1
  32. package/dist/assets/{jszip.min-DxKp9EYt.js → jszip.min-D45drtT5.js} +2 -2
  33. package/dist/assets/{jszip.min-DxKp9EYt.js.map → jszip.min-D45drtT5.js.map} +1 -1
  34. package/dist/assets/{node-BAwjROHH.js → node-9wEUjnPP.js} +2 -2
  35. package/dist/assets/{node-BAwjROHH.js.map → node-9wEUjnPP.js.map} +1 -1
  36. package/dist/assets/{snapshot-DFpAGZTt.js → snapshot-DgPLUO22.js} +2 -2
  37. package/dist/assets/{snapshot-DFpAGZTt.js.map → snapshot-DgPLUO22.js.map} +1 -1
  38. package/dist/assets/{table-BkaaxLZl.js → table-DYz1cshh.js} +2 -2
  39. package/dist/assets/{table-BkaaxLZl.js.map → table-DYz1cshh.js.map} +1 -1
  40. package/dist/index.html +3 -3
  41. package/package.json +1 -1
  42. package/dist/assets/chunk-DEEGUgwa.js +0 -3
  43. package/dist/assets/index-DXqiQ3kf.css +0 -1
@@ -1,4 +1,4 @@
1
- var e3=Object.defineProperty;var Bx=r=>{throw TypeError(r)};var t3=(r,e,t)=>e in r?e3(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Nt=(r,e,t)=>t3(r,typeof e!="symbol"?e+"":e,t),Qh=(r,e,t)=>e.has(r)||Bx("Cannot "+t);var Qr=(r,e,t)=>(Qh(r,e,"read from private field"),t?t.call(r):e.get(r)),ef=(r,e,t)=>e.has(r)?Bx("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),kc=(r,e,t,n)=>(Qh(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),tf=(r,e,t)=>(Qh(r,e,"access private method"),t);import{t as n3,_ as ku,U as zx,p as Mu,w as r3,d as jx,F as nf,G as i3}from"./index-B6Srfmbb.js";import{S as rf,s as fC,a as a3,c as s3,b as o3,d as l3,e as c3,g as Ei,l as u3,f as d3,h as h3,i as ob,N as lb,j as Pl,k as po,m as $x,n as qx}from"./node-BAwjROHH.js";import{h as pt,k as ze,a as at,g as Si,f as ot,e as Qe,b as Ft,u as Jl,Z as f3,$ as Ql,a0 as cb,a1 as g3,d as ub,a2 as Yy,o as Xt,q as $e,p as dl,m as Os,x as db,a3 as hb,y as In,a4 as gC,a5 as vC,a6 as pC,a7 as v3,t as yt,a8 as Gx,a9 as p3,aa as m3,ab as er,ac as Cs,ad as y3,ae as mC,af as Gi,ag as b3,ah as x3,ai as w3,c as E3,aj as S3,ak as _3,al as k3,s as af,V as M3,am as sf,N as T3,l as O3,an as C3,B as xd,ao as N3,v as yC,i as A3,ap as of,aq as Wx,ar as Vx,w as Zo,D as ii,G as Mi,as as co,at as ec,au as bC,av as Mc,aw as fb,ax as uo,A as Tt,ay as Rl,I as jt,J as We,az as So,H as bs,K as Le,F as Ee,Q as Io,L as xe,aA as rn,M as Nn,O as se,R as oi,aB as ds,aC as Ri,aD as Ky,aE as P3,aF as Ll,aG as R3,C as gb,aH as xC,aI as L3,aJ as I3,aK as wC,aL as EC,z as D3,aM as SC,aN as F3,aO as Ns,aP as _i,T as vt,S as zt,aQ as B3,aR as z3,aS as j3,U as mo,aT as $3,aU as q3,P as G3,aV as lf,aW as xa,aX as Ux,W as W3,aY as Hx,aZ as cf,a_ as Yx}from"./index-BXr_m6qo.js";import{_ as V3}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{e as U3,f as H3,g as Y3,_ as K3}from"./ActionCard.vue_vue_type_script_setup_true_lang-Cho9_1nr.js";import{a as X3,b as Z3,g as J3}from"./snapshot-DFpAGZTt.js";import{h as ho,C as Q3,e as eI,V as tI,c as Kx,f as Xx,b as nI,N as Zx,u as rI,d as iI,a as _C,g as kC,i as aI,j as sI,_ as oI}from"./dayjs.min-BF4lfA8v.js";import{l as MC,e as Jx,a as lI}from"./error-CrT8ojhU.js";import{_ as TC}from"./Input-E7EHIMVH.js";import"./chunk-DEEGUgwa.js";function OC(r){return typeof r=="string"?`s-${r}`:`n-${r}`}function cI(){}function uI(r,e,t,n){for(var i=r.length,a=t+-1;++a<i;)if(e(r[a],a,r))return a;return-1}function dI(r){return r!==r}function hI(r,e,t){for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}function fI(r,e,t){return e===e?hI(r,e,t):uI(r,dI,t)}function gI(r,e){var t=r==null?0:r.length;return!!t&&fI(r,e,0)>-1}var vI=1/0,pI=rf&&1/fC(new rf([,-0]))[1]==vI?function(r){return new rf(r)}:cI,mI=200;function yI(r,e,t){var n=-1,i=gI,a=r.length,s=!0,o=[],l=o;if(a>=mI){var c=e?null:pI(r);if(c)return fC(c);s=!1,i=s3,l=new a3}else l=e?[]:o;e:for(;++n<a;){var u=r[n],d=e?e(u):u;if(u=u!==0?u:0,s&&d===d){for(var h=l.length;h--;)if(l[h]===d)continue e;e&&l.push(d),o.push(u)}else i(l,d,t)||(l!==o&&l.push(d),o.push(u))}return o}function bI(r,e){return r&&r.length?yI(r,o3(e)):[]}const xI=pt({name:"ChevronLeft",render(){return ze("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ze("path",{d:"M10.3536 3.14645C10.5488 3.34171 10.5488 3.65829 10.3536 3.85355L6.20711 8L10.3536 12.1464C10.5488 12.3417 10.5488 12.6583 10.3536 12.8536C10.1583 13.0488 9.84171 13.0488 9.64645 12.8536L5.14645 8.35355C4.95118 8.15829 4.95118 7.84171 5.14645 7.64645L9.64645 3.14645C9.84171 2.95118 10.1583 2.95118 10.3536 3.14645Z",fill:"currentColor"}))}}),wI=pt({name:"Switcher",render(){return ze("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ze("path",{d:"M12 8l10 8l-10 8z"}))}}),nn="0!important",CC="-1px!important";function Hs(r){return ot(`${r}-type`,[Qe("& +",[at("button",{},[ot(`${r}-type`,[Ft("border",{borderLeftWidth:nn}),Ft("state-border",{left:CC})])])])])}function Ys(r){return ot(`${r}-type`,[Qe("& +",[at("button",[ot(`${r}-type`,[Ft("border",{borderTopWidth:nn}),Ft("state-border",{top:CC})])])])])}const EI=at("button-group",`
1
+ var e3=Object.defineProperty;var Bx=r=>{throw TypeError(r)};var t3=(r,e,t)=>e in r?e3(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Nt=(r,e,t)=>t3(r,typeof e!="symbol"?e+"":e,t),Qh=(r,e,t)=>e.has(r)||Bx("Cannot "+t);var Qr=(r,e,t)=>(Qh(r,e,"read from private field"),t?t.call(r):e.get(r)),ef=(r,e,t)=>e.has(r)?Bx("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),kc=(r,e,t,n)=>(Qh(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),tf=(r,e,t)=>(Qh(r,e,"access private method"),t);import{t as n3,_ as ku,U as zx,p as Mu,w as r3,d as jx,F as nf,G as i3}from"./index-CBFX9_Eh.js";import{S as rf,s as fC,a as a3,c as s3,b as o3,d as l3,e as c3,g as Ei,l as u3,f as d3,h as h3,i as ob,N as lb,j as Pl,k as po,m as $x,n as qx}from"./node-9wEUjnPP.js";import{h as pt,k as ze,a as at,g as Si,f as ot,e as Qe,b as Ft,u as Jl,Z as f3,$ as Ql,a0 as cb,a1 as g3,d as ub,a2 as Yy,o as Xt,q as $e,p as dl,m as Os,x as db,a3 as hb,y as In,a4 as gC,a5 as vC,a6 as pC,a7 as v3,t as yt,a8 as Gx,a9 as p3,aa as m3,ab as er,ac as Cs,ad as y3,ae as mC,af as Gi,ag as b3,ah as x3,ai as w3,c as E3,aj as S3,ak as _3,al as k3,s as af,V as M3,am as sf,N as T3,l as O3,an as C3,B as xd,ao as N3,v as yC,i as A3,ap as of,aq as Wx,ar as Vx,w as Zo,D as ii,G as Mi,as as co,at as ec,au as bC,av as Mc,aw as fb,ax as uo,A as Tt,ay as Rl,I as jt,J as We,az as So,H as bs,K as Le,F as Ee,Q as Io,L as xe,aA as rn,M as Nn,O as se,R as oi,aB as ds,aC as Ri,aD as Ky,aE as P3,aF as Ll,aG as R3,C as gb,aH as xC,aI as L3,aJ as I3,aK as wC,aL as EC,z as D3,aM as SC,aN as F3,aO as Ns,aP as _i,T as vt,S as zt,aQ as B3,aR as z3,aS as j3,U as mo,aT as $3,aU as q3,P as G3,aV as lf,aW as xa,aX as Ux,W as W3,aY as Hx,aZ as cf,a_ as Yx}from"./index-QfsuJ0d-.js";import{_ as V3}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{e as U3,f as H3,g as Y3,_ as K3}from"./ActionCard.vue_vue_type_script_setup_true_lang-CSbe4rFG.js";import{a as X3,b as Z3,g as J3}from"./snapshot-DgPLUO22.js";import{h as ho,C as Q3,e as eI,V as tI,c as Kx,f as Xx,b as nI,N as Zx,u as rI,d as iI,a as _C,g as kC,i as aI,j as sI,_ as oI}from"./dayjs.min-yMXo2MBr.js";import{l as MC,e as Jx,a as lI}from"./error-Cv3W5C5p.js";import{_ as TC}from"./Input-C_46Ura7.js";import"./chunk-Dn9F2GRw.js";function OC(r){return typeof r=="string"?`s-${r}`:`n-${r}`}function cI(){}function uI(r,e,t,n){for(var i=r.length,a=t+-1;++a<i;)if(e(r[a],a,r))return a;return-1}function dI(r){return r!==r}function hI(r,e,t){for(var n=t-1,i=r.length;++n<i;)if(r[n]===e)return n;return-1}function fI(r,e,t){return e===e?hI(r,e,t):uI(r,dI,t)}function gI(r,e){var t=r==null?0:r.length;return!!t&&fI(r,e,0)>-1}var vI=1/0,pI=rf&&1/fC(new rf([,-0]))[1]==vI?function(r){return new rf(r)}:cI,mI=200;function yI(r,e,t){var n=-1,i=gI,a=r.length,s=!0,o=[],l=o;if(a>=mI){var c=e?null:pI(r);if(c)return fC(c);s=!1,i=s3,l=new a3}else l=e?[]:o;e:for(;++n<a;){var u=r[n],d=e?e(u):u;if(u=u!==0?u:0,s&&d===d){for(var h=l.length;h--;)if(l[h]===d)continue e;e&&l.push(d),o.push(u)}else i(l,d,t)||(l!==o&&l.push(d),o.push(u))}return o}function bI(r,e){return r&&r.length?yI(r,o3(e)):[]}const xI=pt({name:"ChevronLeft",render(){return ze("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ze("path",{d:"M10.3536 3.14645C10.5488 3.34171 10.5488 3.65829 10.3536 3.85355L6.20711 8L10.3536 12.1464C10.5488 12.3417 10.5488 12.6583 10.3536 12.8536C10.1583 13.0488 9.84171 13.0488 9.64645 12.8536L5.14645 8.35355C4.95118 8.15829 4.95118 7.84171 5.14645 7.64645L9.64645 3.14645C9.84171 2.95118 10.1583 2.95118 10.3536 3.14645Z",fill:"currentColor"}))}}),wI=pt({name:"Switcher",render(){return ze("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},ze("path",{d:"M12 8l10 8l-10 8z"}))}}),nn="0!important",CC="-1px!important";function Hs(r){return ot(`${r}-type`,[Qe("& +",[at("button",{},[ot(`${r}-type`,[Ft("border",{borderLeftWidth:nn}),Ft("state-border",{left:CC})])])])])}function Ys(r){return ot(`${r}-type`,[Qe("& +",[at("button",[ot(`${r}-type`,[Ft("border",{borderTopWidth:nn}),Ft("state-border",{top:CC})])])])])}const EI=at("button-group",`
2
2
  flex-wrap: nowrap;
3
3
  display: inline-flex;
4
4
  position: relative;
@@ -339,7 +339,7 @@ ${n}`)}function o(R,T,S){return(R>=0&&S?` ${l(R,T-1)}`:l(R,T)).padEnd(T)}functio
339
339
  * @license
340
340
  * Copyright 2019 Google LLC
341
341
  * SPDX-License-Identifier: Apache-2.0
342
- */const BR=Symbol("Comlink.proxy"),wH=Symbol("Comlink.endpoint"),zR=Symbol("Comlink.releaseProxy"),Ty=Symbol("Comlink.finalizer"),Ru=Symbol("Comlink.thrown"),jR=r=>typeof r=="object"&&r!==null||typeof r=="function",EH={canHandle:r=>jR(r)&&r[BR],serialize(r){const{port1:e,port2:t}=new MessageChannel;return qR(r,e),[t,[t]]},deserialize(r){return r.start(),WR(r)}},SH={canHandle:r=>jR(r)&&Ru in r,serialize({value:r}){let e;return r instanceof Error?e={isError:!0,value:{message:r.message,name:r.name,stack:r.stack}}:e={isError:!1,value:r},[e,[]]},deserialize(r){throw r.isError?Object.assign(new Error(r.value.message),r.value):r.value}},$R=new Map([["proxy",EH],["throw",SH]]);function _H(r,e){for(const t of r)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function qR(r,e=globalThis,t=["*"]){e.addEventListener("message",function n(i){if(!i||!i.data)return;if(!_H(t,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(ss);let c;try{const u=o.slice(0,-1).reduce((h,f)=>h[f],r),d=o.reduce((h,f)=>h[f],r);switch(s){case"GET":c=d;break;case"SET":u[o.slice(-1)[0]]=ss(i.data.value),c=!0;break;case"APPLY":c=d.apply(u,l);break;case"CONSTRUCT":{const h=new d(...l);c=NH(h)}break;case"ENDPOINT":{const{port1:h,port2:f}=new MessageChannel;qR(r,f),c=CH(h,[h])}break;case"RELEASE":c=void 0;break;default:return}}catch(u){c={value:u,[Ru]:0}}Promise.resolve(c).catch(u=>({value:u,[Ru]:0})).then(u=>{const[d,h]=vd(u);e.postMessage(Object.assign(Object.assign({},d),{id:a}),h),s==="RELEASE"&&(e.removeEventListener("message",n),GR(e),Ty in r&&typeof r[Ty]=="function"&&r[Ty]())}).catch(u=>{const[d,h]=vd({value:new TypeError("Unserializable return value"),[Ru]:0});e.postMessage(Object.assign(Object.assign({},d),{id:a}),h)})}),e.start&&e.start()}function kH(r){return r.constructor.name==="MessagePort"}function GR(r){kH(r)&&r.close()}function WR(r,e){const t=new Map;return r.addEventListener("message",function(i){const{data:a}=i;if(!a||!a.id)return;const s=t.get(a.id);if(s)try{s(a)}finally{t.delete(a.id)}}),H1(r,t,[],e)}function vu(r){if(r)throw new Error("Proxy has been released and is not useable")}function VR(r){return oo(r,new Map,{type:"RELEASE"}).then(()=>{GR(r)})}const fd=new WeakMap,gd="FinalizationRegistry"in globalThis&&new FinalizationRegistry(r=>{const e=(fd.get(r)||0)-1;fd.set(r,e),e===0&&VR(r)});function MH(r,e){const t=(fd.get(e)||0)+1;fd.set(e,t),gd&&gd.register(r,e,r)}function TH(r){gd&&gd.unregister(r)}function H1(r,e,t=[],n=function(){}){let i=!1;const a=new Proxy(n,{get(s,o){if(vu(i),o===zR)return()=>{TH(a),VR(r),e.clear(),i=!0};if(o==="then"){if(t.length===0)return{then:()=>a};const l=oo(r,e,{type:"GET",path:t.map(c=>c.toString())}).then(ss);return l.then.bind(l)}return H1(r,e,[...t,o])},set(s,o,l){vu(i);const[c,u]=vd(l);return oo(r,e,{type:"SET",path:[...t,o].map(d=>d.toString()),value:c},u).then(ss)},apply(s,o,l){vu(i);const c=t[t.length-1];if(c===wH)return oo(r,e,{type:"ENDPOINT"}).then(ss);if(c==="bind")return H1(r,e,t.slice(0,-1));const[u,d]=WT(l);return oo(r,e,{type:"APPLY",path:t.map(h=>h.toString()),argumentList:u},d).then(ss)},construct(s,o){vu(i);const[l,c]=WT(o);return oo(r,e,{type:"CONSTRUCT",path:t.map(u=>u.toString()),argumentList:l},c).then(ss)}});return MH(a,r),a}function OH(r){return Array.prototype.concat.apply([],r)}function WT(r){const e=r.map(vd);return[e.map(t=>t[0]),OH(e.map(t=>t[1]))]}const UR=new WeakMap;function CH(r,e){return UR.set(r,e),r}function NH(r){return Object.assign(r,{[BR]:!0})}function vd(r){for(const[e,t]of $R)if(t.canHandle(r)){const[n,i]=t.serialize(r);return[{type:"HANDLER",name:e,value:n},i]}return[{type:"RAW",value:r},UR.get(r)||[]]}function ss(r){switch(r.type){case"HANDLER":return $R.get(r.name).deserialize(r.value);case"RAW":return r.value}}function oo(r,e,t,n){return new Promise(i=>{const a=AH();e.set(a,i),r.start&&r.start(),r.postMessage(Object.assign({id:a},t),n)})}function AH(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class PH extends Wd{constructor(e,t,n){super(),this.graph=e,this.layout=t,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=WR(new Worker(new URL("https://registry.npmmirror.com/@gkd-kit/inspect/0.0.1741169152740/files/dist/assets/worker-BZwDflls.js",import.meta.url),{type:"module"})),this.running&&(this.running=!1,this.execute())}execute(){var e;return rt(this,void 0,void 0,function*(){if(this.running)return this;this.running=!0;const t=this.layout.options,{onTick:n}=t,i=un(t,["onTick"]),a={};Object.keys(i).forEach(c=>{Ie(i[c])||(a[c]=i[c])});const s={layout:{id:this.layout.id,options:a,iterations:(e=this.options)===null||e===void 0?void 0:e.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[zR]()}isRunning(){return this.running}}var RH=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(d){s(d)}}function l(u){try{c(n.throw(u))}catch(d){s(d)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,e||[])).next())})};class xh extends Vd{constructor(){super(...arguments),this.id="fishbone"}getRoot(){const e=this.context.model.getRootsData();if(!(ki(e)||e.length>2))return e[0]}formatSize(e){const t=typeof e=="function"?e:()=>e;return n=>Ir(t(n))}doLayout(e,t){const{hGap:n,getRibSep:i,vGap:a,nodeSize:s,height:o}=t,{model:l}=this.context,c=this.formatSize(s);let u=c(e)[0]+i(e);const d=(b,w=0)=>{var E;return w+=n*((b.children||[]).length+1),(E=b.children)===null||E===void 0||E.forEach(_=>{var O;(O=l.getNodeLikeDatum(_).children)===null||O===void 0||O.forEach(N=>{const A=l.getNodeLikeDatum(N);w=d(A,w)})}),w},h=b=>{if(b.depth===1)return u;const w=l.getParentData(b.id,"tree");if(eo(b)){const E=l.getParentData(w.id,"tree"),_=p(b)-p(E);return h(w)+_*n/a}else{const E=(w.children||[]).indexOf(b.id),_=l.getNodeData((w.children||[]).slice(E));return f(w)-_.reduce((O,M)=>O+d(M),0)-c(w)[0]/2}},f=i1(b=>{if(Oy(b))return c(b)[0]/2;const w=l.getParentData(b.id,"tree");if(eo(b))return h(b)+d(b)+c(b)[0]/2;{const E=p(b)-p(w),_=n/a;return h(b)+E*_}},b=>b.id),g=b=>p(l.getParentData(b,"tree")),p=i1(b=>{if(Oy(b))return o/2;if(eo(b)){const w=l.getParentData(b.id,"tree"),E=w.children.indexOf(b.id);if(E===0)return g(w.id)+a;const _=l.getNodeLikeDatum(w.children[E-1]);if(ki(_.children))return p(_)+a;const O=l.getDescendantsData(_.id);return Math.max(...O.map(M=>eo(M)?g(M.id):p(M)))+a}else{if(ki(b.children))return g(b.id)+a;const w=l.getNodeLikeDatum(b.children.slice(-1)[0]);if(ki(w.children))return p(w)+a;const E=l.getDescendantsData(b.id).slice(-1)[0];return(eo(E)?g(E.id):p(E))+a}},b=>b.id);let v=0;const m={nodes:[],edges:[]},y=b=>{var w;(w=b.children)===null||w===void 0||w.forEach(N=>y(l.getNodeLikeDatum(N)));const E=p(b),_=f(b);if(m.nodes.push({id:b.id,x:_,y:E}),Oy(b))return;const O=l.getRelatedEdgesData(b.id,"in")[0],M=[h(b),eo(b)?E:g(b.id)];m.edges.push({id:te(O),controlPoints:[M],relatedNodeId:b.id}),v=Math.max(v,_+i(b)),b.depth===1&&(u=v)};return y(e),m}placeAlterative(e,t){const n=(t.children||[]).filter((o,l)=>l%2!==0);if(n.length===0)return e;const{model:i}=this.context,a=e.nodes.find(o=>o.id===t.id).y,s=o=>{const l=i.getAncestorsData(o,"tree");if(ki(l))return!1;const c=l.length===1?o:l[l.length-2].id;return n.includes(c)};e.nodes.forEach(o=>{s(o.id)&&(o.y=2*a-o.y)}),e.edges.forEach(o=>{s(o.relatedNodeId)&&(o.controlPoints=o.controlPoints.map(l=>[l[0],2*a-l[1]]))})}rightToLeft(e,t){return e.nodes.forEach(n=>n.x=t.width-n.x),e.edges.forEach(n=>{n.controlPoints=n.controlPoints.map(i=>[t.width-i[0],i[1]])}),e}execute(e,t){return RH(this,void 0,void 0,function*(){const n=Object.assign(Object.assign(Object.assign({},xh.defaultOptions),this.options),t),{direction:i,nodeSize:a}=n,s=this.getRoot();if(!s)return e;const o=this.formatSize(a);n.vGap||(n.vGap=Math.max(...(e.nodes||[]).map(h=>o(h)[1]))),n.hGap||(n.hGap=Math.max(...(e.nodes||[]).map(h=>o(h)[0])));let l=this.doLayout(s,n);this.placeAlterative(l,s),i==="RL"&&(l=this.rightToLeft(l,n));const{model:c}=this.context,u=[],d=[];return l.nodes.forEach(h=>{const{id:f,x:g,y:p}=h,v=c.getNodeLikeDatum(f);u.push(VT(v,{x:g,y:p}))}),l.edges.forEach(h=>{const{id:f,controlPoints:g}=h,p=c.getEdgeDatum(f);d.push(VT(p,{controlPoints:g}))}),{nodes:u,edges:d}})}}xh.defaultOptions={direction:"RL",getRibSep:()=>60};const VT=(r,e)=>Object.assign(Object.assign({},r),{style:Object.assign(Object.assign({},r.style||{}),e)}),Oy=r=>r.depth===0,eo=r=>(r.depth||(r.depth=0))%2===0;var LH=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(d){s(d)}}function l(u){try{c(n.throw(u))}catch(d){s(d)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,e||[])).next())})};class wh extends Vd{constructor(){super(...arguments),this.id="snake"}formatSize(e,t){const n=typeof t=="function"?t:()=>t;return e.reduce((i,a)=>{const[s,o]=Ir(n(a))||[0,0];return[Math.max(i[0],s),Math.max(i[1],o)]},[0,0])}validate(e){const{nodes:t=[],edges:n=[]}=e,i={},a={},s={};t.forEach(h=>{i[h.id]=0,a[h.id]=0,s[h.id]=[]}),n.forEach(h=>{i[h.target]++,a[h.source]++,s[h.source].push(h.target)});const o=new Set,l=h=>{o.has(h)||(o.add(h),s[h].forEach(l))};if(l(t[0].id),o.size!==t.length)return!1;const c=t.filter(h=>i[h.id]===0),u=t.filter(h=>a[h.id]===0);return!(c.length!==1||u.length!==1||t.filter(h=>i[h.id]===1&&a[h.id]===1).length!==t.length-2)}execute(e,t){return LH(this,void 0,void 0,function*(){var n;if(!this.validate(e))return e;const{nodeSize:i,padding:a,sortBy:s,cols:o,colGap:l,rowGap:c,clockwise:u,width:d,height:h}=Object.assign({},wh.defaultOptions,this.options,t),[f,g,p,v]=Fi(a),m=this.formatSize(e.nodes||[],i),y=Math.ceil((e.nodes||[]).length/o);let b=l||(d-v-g-o*m[0])/(o-1),w=c||(h-f-p-y*m[1])/(y-1);return(w===1/0||w<0)&&(w=0),(b===1/0||b<0)&&(b=0),{nodes:((s?(n=e.nodes)===null||n===void 0?void 0:n.sort(s):IH(e))||[]).map((O,M)=>{const N=Math.floor(M/o),A=M%o,P=u?N%2===0?A:o-1-A:N%2===0?o-1-A:A,L=v+P*(m[0]+b)+m[0]/2,I=f+N*(m[1]+w)+m[1]/2;return{id:O.id,style:{x:L,y:I}}})}})}}wh.defaultOptions={padding:0,cols:5,clockwise:!0};function IH(r){const{nodes:e=[],edges:t=[]}=r,n={},i={};e.forEach(o=>{n[o.id]=0,i[o.id]=[]}),t.forEach(o=>{n[o.target]++,i[o.source].push(o.target)});const a=[],s=[];for(e.forEach(o=>{n[o.id]===0&&a.push(o.id)});a.length>0;){const o=a.shift(),l=e.find(c=>c.id===o);s.push(l),i[o].forEach(c=>{n[c]--,n[c]===0&&a.push(c)})}return s}const DH=["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)"],FH=["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)"],BH=["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)"],zH=["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)"],jH=["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 Zn extends Fb{}function Vo(r,e=!0,t){const n=document.createElement("div");return n.setAttribute("class",`g6-${r}`),Object.assign(n.style,{position:"absolute",display:"block"}),e&&Object.assign(n.style,{position:"unset",gridArea:"1 / 1 / 2 / 2",inset:"0px",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none"}),t&&Object.assign(n.style,t),n}function Y1(r,e="div",t={},n="",i=document.body){const a=document.getElementById(r);a&&a.remove();const s=document.createElement(e);return s.innerHTML=n,s.id=r,Object.assign(s.style,t),i.appendChild(s),s}var $H=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(d){s(d)}}function l(u){try{c(n.throw(u))}catch(d){s(d)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,e||[])).next())})};class Eh extends Zn{constructor(e,t){super(e,Object.assign({},Eh.defaultOptions,t)),this.$element=Vo("background"),this.context.canvas.getContainer().prepend(this.$element),this.update(t)}update(e){const t=Object.create(null,{update:{get:()=>super.update}});return $H(this,void 0,void 0,function*(){t.update.call(this,e),Object.assign(this.$element.style,bb(this.options,["key","type"]))})}destroy(){super.destroy(),this.$element.remove()}}Eh.defaultOptions={transition:"background 0.5s",backgroundSize:"cover",zIndex:"-1"};function xx(r,e,t,n,i,a){const s=r,o=e,l=t-s,c=n-o;let u=i-s,d=a-o,h=u*l+d*c,f=0;h<=0?f=0:(u=l-u,d=c-d,h=u*l+d*c,h<=0?f=0:f=h*h/(l*l+c*c));const g=u*u+d*d-f;return g<0?0:g}function Pa(r,e,t,n){return(r-t)*(r-t)+(e-n)*(e-n)}function UT(r,e,t,n,i){return Pa(r,e,t,n)<i*i}function qH(r){if(!Number.isFinite(r))return t=>t;if(r===0)return Math.round;const e=Math.pow(10,r);return t=>Math.round(t*e)/e}function HR(r){const e=Math.min(r.x1,r.x2),t=Math.max(r.x1,r.x2),n=Math.min(r.y1,r.y2),i=Math.max(r.y1,r.y2);return{x:e,y:n,x2:t,y2:i,width:t-e,height:i-n}}class Fn{constructor(e,t,n,i){this.x1=e,this.y1=t,this.x2=n,this.y2=i}equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2}draw(e){e.moveTo(this.x1,this.y1),e.lineTo(this.x2,this.y2)}toString(){return`Line(from=(${this.x1},${this.y1}),to=(${this.x2},${this.y2}))`}static from(e){return new Fn(e.x1,e.y1,e.x2,e.y2)}cuts(e,t){if(this.y1===this.y2||t<this.y1&&t<=this.y2||t>this.y1&&t>=this.y2||e>this.x1&&e>=this.x2)return!1;if(e<this.x1&&e<=this.x2)return!0;const n=this.x1+(t-this.y1)*(this.x2-this.x1)/(this.y2-this.y1);return e<=n}distSquare(e,t){return xx(this.x1,this.y1,this.x2,this.y2,e,t)}ptClose(e,t,n){if(this.x1<this.x2){if(e<this.x1-n||e>this.x2+n)return!1}else if(e<this.x2-n||e>this.x1+n)return!1;if(this.y1<this.y2){if(t<this.y1-n||t>this.y2+n)return!1}else if(t<this.y2-n||t>this.y1+n)return!1;return!0}}var ln;(function(r){r[r.POINT=1]="POINT",r[r.PARALLEL=2]="PARALLEL",r[r.COINCIDENT=3]="COINCIDENT",r[r.NONE=4]="NONE"})(ln||(ln={}));class Cy{constructor(e,t=0,n=0){this.state=e,this.x=t,this.y=n}}function pu(r,e){const t=(e.x2-e.x1)*(r.y1-e.y1)-(e.y2-e.y1)*(r.x1-e.x1),n=(r.x2-r.x1)*(r.y1-e.y1)-(r.y2-r.y1)*(r.x1-e.x1),i=(e.y2-e.y1)*(r.x2-r.x1)-(e.x2-e.x1)*(r.y2-r.y1);if(i){const a=t/i,s=n/i;return 0<=a&&a<=1&&0<=s&&s<=1?new Cy(ln.POINT,r.x1+a*(r.x2-r.x1),r.y1+a*(r.y2-r.y1)):new Cy(ln.NONE)}return new Cy(t===0||n===0?ln.COINCIDENT:ln.PARALLEL)}function YR(r,e){const t=(e.x2-e.x1)*(r.y1-e.y1)-(e.y2-e.y1)*(r.x1-e.x1),n=(r.x2-r.x1)*(r.y1-e.y1)-(r.y2-r.y1)*(r.x1-e.x1),i=(e.y2-e.y1)*(r.x2-r.x1)-(e.x2-e.x1)*(r.y2-r.y1);if(i){const a=t/i,s=n/i;if(0<=a&&a<=1&&0<=s&&s<=1)return a}return Number.POSITIVE_INFINITY}function GH(r,e){function t(i,a,s,o){let l=YR(e,new Fn(i,a,s,o));return l=Math.abs(l-.5),l>=0&&l<=1?1:0}let n=t(r.x,r.y,r.x2,r.y);return n+=t(r.x,r.y,r.x,r.y2),n>1||(n+=t(r.x,r.y2,r.x2,r.y2),n>1)?!0:(n+=t(r.x2,r.y,r.x2,r.y2),n>0)}var cn;(function(r){r[r.LEFT=0]="LEFT",r[r.TOP=1]="TOP",r[r.RIGHT=2]="RIGHT",r[r.BOTTOM=3]="BOTTOM"})(cn||(cn={}));function Lu(r,e,t){const n=new Set;return r.width<=0?(n.add(cn.LEFT),n.add(cn.RIGHT)):e<r.x?n.add(cn.LEFT):e>r.x+r.width&&n.add(cn.RIGHT),r.height<=0?(n.add(cn.TOP),n.add(cn.BOTTOM)):t<r.y?n.add(cn.TOP):t>r.y+r.height&&n.add(cn.BOTTOM),n}function KR(r,e){let t=e.x1,n=e.y1;const i=e.x2,a=e.y2,s=Array.from(Lu(r,i,a));if(s.length===0)return!0;let o=Lu(r,t,n);for(;o.size!==0;){for(const l of s)if(o.has(l))return!1;if(o.has(cn.RIGHT)||o.has(cn.LEFT)){let l=r.x;o.has(cn.RIGHT)&&(l+=r.width),n=n+(l-t)*(a-n)/(i-t),t=l}else{let l=r.y;o.has(cn.BOTTOM)&&(l+=r.height),t=t+(l-n)*(i-t)/(a-n),n=l}o=Lu(r,t,n)}return!0}function WH(r,e){let t=Number.POSITIVE_INFINITY,n=0;function i(a,s,o,l){let c=YR(e,new Fn(a,s,o,l));c=Math.abs(c-.5),c>=0&&c<=1&&(n++,c<t&&(t=c))}return i(r.x,r.y,r.x2,r.y),i(r.x,r.y,r.x,r.y2),n>1||(i(r.x,r.y2,r.x2,r.y2),n>1)?t:(i(r.x2,r.y,r.x2,r.y2),n===0?-1:t)}function VH(r,e){let t=0;const n=pu(r,new Fn(e.x,e.y,e.x2,e.y));t+=n.state===ln.POINT?1:0;const i=pu(r,new Fn(e.x,e.y,e.x,e.y2));t+=i.state===ln.POINT?1:0;const a=pu(r,new Fn(e.x,e.y2,e.x2,e.y2));t+=a.state===ln.POINT?1:0;const s=pu(r,new Fn(e.x2,e.y,e.x2,e.y2));return t+=s.state===ln.POINT?1:0,{top:n,left:i,bottom:a,right:s,count:t}}class tr{constructor(e,t,n,i){this.x=e,this.y=t,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(e){return new tr(e.x,e.y,e.width,e.height)}equals(e){return this.x===e.x&&this.y===e.y&&this.width===e.width&&this.height===e.height}clone(){return new tr(this.x,this.y,this.width,this.height)}add(e){const t=Math.min(this.x,e.x),n=Math.min(this.y,e.y),i=Math.max(this.x2,e.x+e.width),a=Math.max(this.y2,e.y+e.height);this.x=t,this.y=n,this.width=i-t,this.height=a-n}addPoint(e){const t=Math.min(this.x,e.x),n=Math.min(this.y,e.y),i=Math.max(this.x2,e.x),a=Math.max(this.y2,e.y);this.x=t,this.y=n,this.width=i-t,this.height=a-n}toString(){return`Rectangle[x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height}]`}draw(e){e.rect(this.x,this.y,this.width,this.height)}containsPt(e,t){return e>=this.x&&e<=this.x2&&t>=this.y&&t<=this.y2}get area(){return this.width*this.height}intersects(e){return this.area<=0||e.width<=0||e.height<=0?!1:e.x+e.width>this.x&&e.y+e.height>this.y&&e.x<this.x2&&e.y<this.y2}distSquare(e,t){if(this.containsPt(e,t))return 0;const n=Lu(this,e,t);return n.has(cn.TOP)?n.has(cn.LEFT)?Pa(e,t,this.x,this.y):n.has(cn.RIGHT)?Pa(e,t,this.x2,this.y):(this.y-t)*(this.y-t):n.has(cn.BOTTOM)?n.has(cn.LEFT)?Pa(e,t,this.x,this.y2):n.has(cn.RIGHT)?Pa(e,t,this.x2,this.y2):(t-this.y2)*(t-this.y2):n.has(cn.LEFT)?(this.x-e)*(this.x-e):n.has(cn.RIGHT)?(e-this.x2)*(e-this.x2):0}}function UH(r){if(r.length===0)return null;const e=r[0],t=new tr(e.x,e.y,0,0);for(const n of r)t.addPoint(n);return t}class pd{constructor(e,t,n){this.cx=e,this.cy=t,this.radius=n}get x(){return this.cx-this.radius}get x2(){return this.cx+this.radius}get width(){return this.radius*2}get y(){return this.cy-this.radius}get y2(){return this.cy+this.radius}get height(){return this.radius*2}static from(e){return new pd(e.cx,e.cy,e.radius)}containsPt(e,t){return Pa(this.cx,this.cy,e,t)<this.radius*this.radius}distSquare(e,t){const n=Pa(this.cx,this.cy,e,t);if(n<this.radius*this.radius)return 0;const i=Math.sqrt(n)-this.radius;return i*i}draw(e){e.ellipse(this.cx,this.cy,this.radius,this.radius,0,0,Math.PI*2)}}class ms{constructor(e,t=0,n=0,i=0,a=0,s=10,o=10,l=new Float32Array(Math.max(0,s*o)).fill(0)){this.pixelGroup=e,this.i=t,this.j=n,this.pixelX=i,this.pixelY=a,this.width=s,this.height=o,this.area=l}createSub(e,t){return new ms(this.pixelGroup,e.x,e.y,t.x,t.y,e.width,e.height)}static fromPixelRegion(e,t){return new ms(t,0,0,e.x,e.y,Math.ceil(e.width/t),Math.ceil(e.height/t))}copy(e,t){return new ms(this.pixelGroup,this.scaleX(t.x),this.scaleY(t.y),t.x,t.y,e.width,e.height,e.area)}boundX(e){return e<this.i?this.i:e>=this.width?this.width-1:e}boundY(e){return e<this.j?this.j:e>=this.height?this.height-1:e}scaleX(e){return this.boundX(Math.floor((e-this.pixelX)/this.pixelGroup))}scaleY(e){return this.boundY(Math.floor((e-this.pixelY)/this.pixelGroup))}scale(e){const t=this.scaleX(e.x),n=this.scaleY(e.y),i=this.boundX(Math.ceil((e.x+e.width-this.pixelX)/this.pixelGroup)),a=this.boundY(Math.ceil((e.y+e.height-this.pixelY)/this.pixelGroup)),s=i-t,o=a-n;return new tr(t,n,s,o)}invertScaleX(e){return Math.round(e*this.pixelGroup+this.pixelX)}invertScaleY(e){return Math.round(e*this.pixelGroup+this.pixelY)}addPadding(e,t){const n=Math.ceil(t/this.pixelGroup),i=this.boundX(e.x-n),a=this.boundY(e.y-n),s=this.boundX(e.x2+n),o=this.boundY(e.y2+n),l=s-i,c=o-a;return new tr(i,a,l,c)}get(e,t){return e<0||t<0||e>=this.width||t>=this.height?Number.NaN:this.area[e+t*this.width]}inc(e,t,n){e<0||t<0||e>=this.width||t>=this.height||(this.area[e+t*this.width]+=n)}set(e,t,n){e<0||t<0||e>=this.width||t>=this.height||(this.area[e+t*this.width]=n)}incArea(e,t){if(e.width<=0||e.height<=0||t===0)return;const n=this.width,i=e.width,a=Math.max(0,e.i),s=Math.max(0,e.j),o=Math.min(e.i+e.width,n),l=Math.min(e.j+e.height,this.height);if(!(l<=0||o<=0||a>=n||l>=this.height))for(let c=s;c<l;c++){const u=(c-e.j)*i,d=c*n;for(let h=a;h<o;h++){const f=e.area[h-e.i+u];f!==0&&(this.area[h+d]+=t*f)}}}fill(e){this.area.fill(e)}fillArea(e,t){const n=e.x+e.y*this.width;for(let i=0;i<e.height;i++){const a=n+i*this.width;this.area.fill(t,a,a+e.width)}}fillHorizontalLine(e,t,n,i){const a=e+t*this.width;this.area.fill(i,a,a+n)}fillVerticalLine(e,t,n,i){const a=e+t*this.width;for(let s=0;s<n;s++)this.area[a+s*this.width]=i}clear(){this.area.fill(0)}toString(){let e="";for(let t=0;t<this.height;t++){const n=t*this.width;for(let i=0;i<this.width;i++){const a=this.area[n+i];e+=a.toFixed(1).padStart(6),e+=" "}e+=`
342
+ */const BR=Symbol("Comlink.proxy"),wH=Symbol("Comlink.endpoint"),zR=Symbol("Comlink.releaseProxy"),Ty=Symbol("Comlink.finalizer"),Ru=Symbol("Comlink.thrown"),jR=r=>typeof r=="object"&&r!==null||typeof r=="function",EH={canHandle:r=>jR(r)&&r[BR],serialize(r){const{port1:e,port2:t}=new MessageChannel;return qR(r,e),[t,[t]]},deserialize(r){return r.start(),WR(r)}},SH={canHandle:r=>jR(r)&&Ru in r,serialize({value:r}){let e;return r instanceof Error?e={isError:!0,value:{message:r.message,name:r.name,stack:r.stack}}:e={isError:!1,value:r},[e,[]]},deserialize(r){throw r.isError?Object.assign(new Error(r.value.message),r.value):r.value}},$R=new Map([["proxy",EH],["throw",SH]]);function _H(r,e){for(const t of r)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function qR(r,e=globalThis,t=["*"]){e.addEventListener("message",function n(i){if(!i||!i.data)return;if(!_H(t,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(ss);let c;try{const u=o.slice(0,-1).reduce((h,f)=>h[f],r),d=o.reduce((h,f)=>h[f],r);switch(s){case"GET":c=d;break;case"SET":u[o.slice(-1)[0]]=ss(i.data.value),c=!0;break;case"APPLY":c=d.apply(u,l);break;case"CONSTRUCT":{const h=new d(...l);c=NH(h)}break;case"ENDPOINT":{const{port1:h,port2:f}=new MessageChannel;qR(r,f),c=CH(h,[h])}break;case"RELEASE":c=void 0;break;default:return}}catch(u){c={value:u,[Ru]:0}}Promise.resolve(c).catch(u=>({value:u,[Ru]:0})).then(u=>{const[d,h]=vd(u);e.postMessage(Object.assign(Object.assign({},d),{id:a}),h),s==="RELEASE"&&(e.removeEventListener("message",n),GR(e),Ty in r&&typeof r[Ty]=="function"&&r[Ty]())}).catch(u=>{const[d,h]=vd({value:new TypeError("Unserializable return value"),[Ru]:0});e.postMessage(Object.assign(Object.assign({},d),{id:a}),h)})}),e.start&&e.start()}function kH(r){return r.constructor.name==="MessagePort"}function GR(r){kH(r)&&r.close()}function WR(r,e){const t=new Map;return r.addEventListener("message",function(i){const{data:a}=i;if(!a||!a.id)return;const s=t.get(a.id);if(s)try{s(a)}finally{t.delete(a.id)}}),H1(r,t,[],e)}function vu(r){if(r)throw new Error("Proxy has been released and is not useable")}function VR(r){return oo(r,new Map,{type:"RELEASE"}).then(()=>{GR(r)})}const fd=new WeakMap,gd="FinalizationRegistry"in globalThis&&new FinalizationRegistry(r=>{const e=(fd.get(r)||0)-1;fd.set(r,e),e===0&&VR(r)});function MH(r,e){const t=(fd.get(e)||0)+1;fd.set(e,t),gd&&gd.register(r,e,r)}function TH(r){gd&&gd.unregister(r)}function H1(r,e,t=[],n=function(){}){let i=!1;const a=new Proxy(n,{get(s,o){if(vu(i),o===zR)return()=>{TH(a),VR(r),e.clear(),i=!0};if(o==="then"){if(t.length===0)return{then:()=>a};const l=oo(r,e,{type:"GET",path:t.map(c=>c.toString())}).then(ss);return l.then.bind(l)}return H1(r,e,[...t,o])},set(s,o,l){vu(i);const[c,u]=vd(l);return oo(r,e,{type:"SET",path:[...t,o].map(d=>d.toString()),value:c},u).then(ss)},apply(s,o,l){vu(i);const c=t[t.length-1];if(c===wH)return oo(r,e,{type:"ENDPOINT"}).then(ss);if(c==="bind")return H1(r,e,t.slice(0,-1));const[u,d]=WT(l);return oo(r,e,{type:"APPLY",path:t.map(h=>h.toString()),argumentList:u},d).then(ss)},construct(s,o){vu(i);const[l,c]=WT(o);return oo(r,e,{type:"CONSTRUCT",path:t.map(u=>u.toString()),argumentList:l},c).then(ss)}});return MH(a,r),a}function OH(r){return Array.prototype.concat.apply([],r)}function WT(r){const e=r.map(vd);return[e.map(t=>t[0]),OH(e.map(t=>t[1]))]}const UR=new WeakMap;function CH(r,e){return UR.set(r,e),r}function NH(r){return Object.assign(r,{[BR]:!0})}function vd(r){for(const[e,t]of $R)if(t.canHandle(r)){const[n,i]=t.serialize(r);return[{type:"HANDLER",name:e,value:n},i]}return[{type:"RAW",value:r},UR.get(r)||[]]}function ss(r){switch(r.type){case"HANDLER":return $R.get(r.name).deserialize(r.value);case"RAW":return r.value}}function oo(r,e,t,n){return new Promise(i=>{const a=AH();e.set(a,i),r.start&&r.start(),r.postMessage(Object.assign({id:a},t),n)})}function AH(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class PH extends Wd{constructor(e,t,n){super(),this.graph=e,this.layout=t,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=WR(new Worker(new URL("https://registry.npmmirror.com/@gkd-kit/inspect/0.0.1741336605276/files/dist/assets/worker-BZwDflls.js",import.meta.url),{type:"module"})),this.running&&(this.running=!1,this.execute())}execute(){var e;return rt(this,void 0,void 0,function*(){if(this.running)return this;this.running=!0;const t=this.layout.options,{onTick:n}=t,i=un(t,["onTick"]),a={};Object.keys(i).forEach(c=>{Ie(i[c])||(a[c]=i[c])});const s={layout:{id:this.layout.id,options:a,iterations:(e=this.options)===null||e===void 0?void 0:e.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[zR]()}isRunning(){return this.running}}var RH=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(d){s(d)}}function l(u){try{c(n.throw(u))}catch(d){s(d)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,e||[])).next())})};class xh extends Vd{constructor(){super(...arguments),this.id="fishbone"}getRoot(){const e=this.context.model.getRootsData();if(!(ki(e)||e.length>2))return e[0]}formatSize(e){const t=typeof e=="function"?e:()=>e;return n=>Ir(t(n))}doLayout(e,t){const{hGap:n,getRibSep:i,vGap:a,nodeSize:s,height:o}=t,{model:l}=this.context,c=this.formatSize(s);let u=c(e)[0]+i(e);const d=(b,w=0)=>{var E;return w+=n*((b.children||[]).length+1),(E=b.children)===null||E===void 0||E.forEach(_=>{var O;(O=l.getNodeLikeDatum(_).children)===null||O===void 0||O.forEach(N=>{const A=l.getNodeLikeDatum(N);w=d(A,w)})}),w},h=b=>{if(b.depth===1)return u;const w=l.getParentData(b.id,"tree");if(eo(b)){const E=l.getParentData(w.id,"tree"),_=p(b)-p(E);return h(w)+_*n/a}else{const E=(w.children||[]).indexOf(b.id),_=l.getNodeData((w.children||[]).slice(E));return f(w)-_.reduce((O,M)=>O+d(M),0)-c(w)[0]/2}},f=i1(b=>{if(Oy(b))return c(b)[0]/2;const w=l.getParentData(b.id,"tree");if(eo(b))return h(b)+d(b)+c(b)[0]/2;{const E=p(b)-p(w),_=n/a;return h(b)+E*_}},b=>b.id),g=b=>p(l.getParentData(b,"tree")),p=i1(b=>{if(Oy(b))return o/2;if(eo(b)){const w=l.getParentData(b.id,"tree"),E=w.children.indexOf(b.id);if(E===0)return g(w.id)+a;const _=l.getNodeLikeDatum(w.children[E-1]);if(ki(_.children))return p(_)+a;const O=l.getDescendantsData(_.id);return Math.max(...O.map(M=>eo(M)?g(M.id):p(M)))+a}else{if(ki(b.children))return g(b.id)+a;const w=l.getNodeLikeDatum(b.children.slice(-1)[0]);if(ki(w.children))return p(w)+a;const E=l.getDescendantsData(b.id).slice(-1)[0];return(eo(E)?g(E.id):p(E))+a}},b=>b.id);let v=0;const m={nodes:[],edges:[]},y=b=>{var w;(w=b.children)===null||w===void 0||w.forEach(N=>y(l.getNodeLikeDatum(N)));const E=p(b),_=f(b);if(m.nodes.push({id:b.id,x:_,y:E}),Oy(b))return;const O=l.getRelatedEdgesData(b.id,"in")[0],M=[h(b),eo(b)?E:g(b.id)];m.edges.push({id:te(O),controlPoints:[M],relatedNodeId:b.id}),v=Math.max(v,_+i(b)),b.depth===1&&(u=v)};return y(e),m}placeAlterative(e,t){const n=(t.children||[]).filter((o,l)=>l%2!==0);if(n.length===0)return e;const{model:i}=this.context,a=e.nodes.find(o=>o.id===t.id).y,s=o=>{const l=i.getAncestorsData(o,"tree");if(ki(l))return!1;const c=l.length===1?o:l[l.length-2].id;return n.includes(c)};e.nodes.forEach(o=>{s(o.id)&&(o.y=2*a-o.y)}),e.edges.forEach(o=>{s(o.relatedNodeId)&&(o.controlPoints=o.controlPoints.map(l=>[l[0],2*a-l[1]]))})}rightToLeft(e,t){return e.nodes.forEach(n=>n.x=t.width-n.x),e.edges.forEach(n=>{n.controlPoints=n.controlPoints.map(i=>[t.width-i[0],i[1]])}),e}execute(e,t){return RH(this,void 0,void 0,function*(){const n=Object.assign(Object.assign(Object.assign({},xh.defaultOptions),this.options),t),{direction:i,nodeSize:a}=n,s=this.getRoot();if(!s)return e;const o=this.formatSize(a);n.vGap||(n.vGap=Math.max(...(e.nodes||[]).map(h=>o(h)[1]))),n.hGap||(n.hGap=Math.max(...(e.nodes||[]).map(h=>o(h)[0])));let l=this.doLayout(s,n);this.placeAlterative(l,s),i==="RL"&&(l=this.rightToLeft(l,n));const{model:c}=this.context,u=[],d=[];return l.nodes.forEach(h=>{const{id:f,x:g,y:p}=h,v=c.getNodeLikeDatum(f);u.push(VT(v,{x:g,y:p}))}),l.edges.forEach(h=>{const{id:f,controlPoints:g}=h,p=c.getEdgeDatum(f);d.push(VT(p,{controlPoints:g}))}),{nodes:u,edges:d}})}}xh.defaultOptions={direction:"RL",getRibSep:()=>60};const VT=(r,e)=>Object.assign(Object.assign({},r),{style:Object.assign(Object.assign({},r.style||{}),e)}),Oy=r=>r.depth===0,eo=r=>(r.depth||(r.depth=0))%2===0;var LH=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(d){s(d)}}function l(u){try{c(n.throw(u))}catch(d){s(d)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,e||[])).next())})};class wh extends Vd{constructor(){super(...arguments),this.id="snake"}formatSize(e,t){const n=typeof t=="function"?t:()=>t;return e.reduce((i,a)=>{const[s,o]=Ir(n(a))||[0,0];return[Math.max(i[0],s),Math.max(i[1],o)]},[0,0])}validate(e){const{nodes:t=[],edges:n=[]}=e,i={},a={},s={};t.forEach(h=>{i[h.id]=0,a[h.id]=0,s[h.id]=[]}),n.forEach(h=>{i[h.target]++,a[h.source]++,s[h.source].push(h.target)});const o=new Set,l=h=>{o.has(h)||(o.add(h),s[h].forEach(l))};if(l(t[0].id),o.size!==t.length)return!1;const c=t.filter(h=>i[h.id]===0),u=t.filter(h=>a[h.id]===0);return!(c.length!==1||u.length!==1||t.filter(h=>i[h.id]===1&&a[h.id]===1).length!==t.length-2)}execute(e,t){return LH(this,void 0,void 0,function*(){var n;if(!this.validate(e))return e;const{nodeSize:i,padding:a,sortBy:s,cols:o,colGap:l,rowGap:c,clockwise:u,width:d,height:h}=Object.assign({},wh.defaultOptions,this.options,t),[f,g,p,v]=Fi(a),m=this.formatSize(e.nodes||[],i),y=Math.ceil((e.nodes||[]).length/o);let b=l||(d-v-g-o*m[0])/(o-1),w=c||(h-f-p-y*m[1])/(y-1);return(w===1/0||w<0)&&(w=0),(b===1/0||b<0)&&(b=0),{nodes:((s?(n=e.nodes)===null||n===void 0?void 0:n.sort(s):IH(e))||[]).map((O,M)=>{const N=Math.floor(M/o),A=M%o,P=u?N%2===0?A:o-1-A:N%2===0?o-1-A:A,L=v+P*(m[0]+b)+m[0]/2,I=f+N*(m[1]+w)+m[1]/2;return{id:O.id,style:{x:L,y:I}}})}})}}wh.defaultOptions={padding:0,cols:5,clockwise:!0};function IH(r){const{nodes:e=[],edges:t=[]}=r,n={},i={};e.forEach(o=>{n[o.id]=0,i[o.id]=[]}),t.forEach(o=>{n[o.target]++,i[o.source].push(o.target)});const a=[],s=[];for(e.forEach(o=>{n[o.id]===0&&a.push(o.id)});a.length>0;){const o=a.shift(),l=e.find(c=>c.id===o);s.push(l),i[o].forEach(c=>{n[c]--,n[c]===0&&a.push(c)})}return s}const DH=["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)"],FH=["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)"],BH=["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)"],zH=["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)"],jH=["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 Zn extends Fb{}function Vo(r,e=!0,t){const n=document.createElement("div");return n.setAttribute("class",`g6-${r}`),Object.assign(n.style,{position:"absolute",display:"block"}),e&&Object.assign(n.style,{position:"unset",gridArea:"1 / 1 / 2 / 2",inset:"0px",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none"}),t&&Object.assign(n.style,t),n}function Y1(r,e="div",t={},n="",i=document.body){const a=document.getElementById(r);a&&a.remove();const s=document.createElement(e);return s.innerHTML=n,s.id=r,Object.assign(s.style,t),i.appendChild(s),s}var $H=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(d){s(d)}}function l(u){try{c(n.throw(u))}catch(d){s(d)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,e||[])).next())})};class Eh extends Zn{constructor(e,t){super(e,Object.assign({},Eh.defaultOptions,t)),this.$element=Vo("background"),this.context.canvas.getContainer().prepend(this.$element),this.update(t)}update(e){const t=Object.create(null,{update:{get:()=>super.update}});return $H(this,void 0,void 0,function*(){t.update.call(this,e),Object.assign(this.$element.style,bb(this.options,["key","type"]))})}destroy(){super.destroy(),this.$element.remove()}}Eh.defaultOptions={transition:"background 0.5s",backgroundSize:"cover",zIndex:"-1"};function xx(r,e,t,n,i,a){const s=r,o=e,l=t-s,c=n-o;let u=i-s,d=a-o,h=u*l+d*c,f=0;h<=0?f=0:(u=l-u,d=c-d,h=u*l+d*c,h<=0?f=0:f=h*h/(l*l+c*c));const g=u*u+d*d-f;return g<0?0:g}function Pa(r,e,t,n){return(r-t)*(r-t)+(e-n)*(e-n)}function UT(r,e,t,n,i){return Pa(r,e,t,n)<i*i}function qH(r){if(!Number.isFinite(r))return t=>t;if(r===0)return Math.round;const e=Math.pow(10,r);return t=>Math.round(t*e)/e}function HR(r){const e=Math.min(r.x1,r.x2),t=Math.max(r.x1,r.x2),n=Math.min(r.y1,r.y2),i=Math.max(r.y1,r.y2);return{x:e,y:n,x2:t,y2:i,width:t-e,height:i-n}}class Fn{constructor(e,t,n,i){this.x1=e,this.y1=t,this.x2=n,this.y2=i}equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2}draw(e){e.moveTo(this.x1,this.y1),e.lineTo(this.x2,this.y2)}toString(){return`Line(from=(${this.x1},${this.y1}),to=(${this.x2},${this.y2}))`}static from(e){return new Fn(e.x1,e.y1,e.x2,e.y2)}cuts(e,t){if(this.y1===this.y2||t<this.y1&&t<=this.y2||t>this.y1&&t>=this.y2||e>this.x1&&e>=this.x2)return!1;if(e<this.x1&&e<=this.x2)return!0;const n=this.x1+(t-this.y1)*(this.x2-this.x1)/(this.y2-this.y1);return e<=n}distSquare(e,t){return xx(this.x1,this.y1,this.x2,this.y2,e,t)}ptClose(e,t,n){if(this.x1<this.x2){if(e<this.x1-n||e>this.x2+n)return!1}else if(e<this.x2-n||e>this.x1+n)return!1;if(this.y1<this.y2){if(t<this.y1-n||t>this.y2+n)return!1}else if(t<this.y2-n||t>this.y1+n)return!1;return!0}}var ln;(function(r){r[r.POINT=1]="POINT",r[r.PARALLEL=2]="PARALLEL",r[r.COINCIDENT=3]="COINCIDENT",r[r.NONE=4]="NONE"})(ln||(ln={}));class Cy{constructor(e,t=0,n=0){this.state=e,this.x=t,this.y=n}}function pu(r,e){const t=(e.x2-e.x1)*(r.y1-e.y1)-(e.y2-e.y1)*(r.x1-e.x1),n=(r.x2-r.x1)*(r.y1-e.y1)-(r.y2-r.y1)*(r.x1-e.x1),i=(e.y2-e.y1)*(r.x2-r.x1)-(e.x2-e.x1)*(r.y2-r.y1);if(i){const a=t/i,s=n/i;return 0<=a&&a<=1&&0<=s&&s<=1?new Cy(ln.POINT,r.x1+a*(r.x2-r.x1),r.y1+a*(r.y2-r.y1)):new Cy(ln.NONE)}return new Cy(t===0||n===0?ln.COINCIDENT:ln.PARALLEL)}function YR(r,e){const t=(e.x2-e.x1)*(r.y1-e.y1)-(e.y2-e.y1)*(r.x1-e.x1),n=(r.x2-r.x1)*(r.y1-e.y1)-(r.y2-r.y1)*(r.x1-e.x1),i=(e.y2-e.y1)*(r.x2-r.x1)-(e.x2-e.x1)*(r.y2-r.y1);if(i){const a=t/i,s=n/i;if(0<=a&&a<=1&&0<=s&&s<=1)return a}return Number.POSITIVE_INFINITY}function GH(r,e){function t(i,a,s,o){let l=YR(e,new Fn(i,a,s,o));return l=Math.abs(l-.5),l>=0&&l<=1?1:0}let n=t(r.x,r.y,r.x2,r.y);return n+=t(r.x,r.y,r.x,r.y2),n>1||(n+=t(r.x,r.y2,r.x2,r.y2),n>1)?!0:(n+=t(r.x2,r.y,r.x2,r.y2),n>0)}var cn;(function(r){r[r.LEFT=0]="LEFT",r[r.TOP=1]="TOP",r[r.RIGHT=2]="RIGHT",r[r.BOTTOM=3]="BOTTOM"})(cn||(cn={}));function Lu(r,e,t){const n=new Set;return r.width<=0?(n.add(cn.LEFT),n.add(cn.RIGHT)):e<r.x?n.add(cn.LEFT):e>r.x+r.width&&n.add(cn.RIGHT),r.height<=0?(n.add(cn.TOP),n.add(cn.BOTTOM)):t<r.y?n.add(cn.TOP):t>r.y+r.height&&n.add(cn.BOTTOM),n}function KR(r,e){let t=e.x1,n=e.y1;const i=e.x2,a=e.y2,s=Array.from(Lu(r,i,a));if(s.length===0)return!0;let o=Lu(r,t,n);for(;o.size!==0;){for(const l of s)if(o.has(l))return!1;if(o.has(cn.RIGHT)||o.has(cn.LEFT)){let l=r.x;o.has(cn.RIGHT)&&(l+=r.width),n=n+(l-t)*(a-n)/(i-t),t=l}else{let l=r.y;o.has(cn.BOTTOM)&&(l+=r.height),t=t+(l-n)*(i-t)/(a-n),n=l}o=Lu(r,t,n)}return!0}function WH(r,e){let t=Number.POSITIVE_INFINITY,n=0;function i(a,s,o,l){let c=YR(e,new Fn(a,s,o,l));c=Math.abs(c-.5),c>=0&&c<=1&&(n++,c<t&&(t=c))}return i(r.x,r.y,r.x2,r.y),i(r.x,r.y,r.x,r.y2),n>1||(i(r.x,r.y2,r.x2,r.y2),n>1)?t:(i(r.x2,r.y,r.x2,r.y2),n===0?-1:t)}function VH(r,e){let t=0;const n=pu(r,new Fn(e.x,e.y,e.x2,e.y));t+=n.state===ln.POINT?1:0;const i=pu(r,new Fn(e.x,e.y,e.x,e.y2));t+=i.state===ln.POINT?1:0;const a=pu(r,new Fn(e.x,e.y2,e.x2,e.y2));t+=a.state===ln.POINT?1:0;const s=pu(r,new Fn(e.x2,e.y,e.x2,e.y2));return t+=s.state===ln.POINT?1:0,{top:n,left:i,bottom:a,right:s,count:t}}class tr{constructor(e,t,n,i){this.x=e,this.y=t,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(e){return new tr(e.x,e.y,e.width,e.height)}equals(e){return this.x===e.x&&this.y===e.y&&this.width===e.width&&this.height===e.height}clone(){return new tr(this.x,this.y,this.width,this.height)}add(e){const t=Math.min(this.x,e.x),n=Math.min(this.y,e.y),i=Math.max(this.x2,e.x+e.width),a=Math.max(this.y2,e.y+e.height);this.x=t,this.y=n,this.width=i-t,this.height=a-n}addPoint(e){const t=Math.min(this.x,e.x),n=Math.min(this.y,e.y),i=Math.max(this.x2,e.x),a=Math.max(this.y2,e.y);this.x=t,this.y=n,this.width=i-t,this.height=a-n}toString(){return`Rectangle[x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height}]`}draw(e){e.rect(this.x,this.y,this.width,this.height)}containsPt(e,t){return e>=this.x&&e<=this.x2&&t>=this.y&&t<=this.y2}get area(){return this.width*this.height}intersects(e){return this.area<=0||e.width<=0||e.height<=0?!1:e.x+e.width>this.x&&e.y+e.height>this.y&&e.x<this.x2&&e.y<this.y2}distSquare(e,t){if(this.containsPt(e,t))return 0;const n=Lu(this,e,t);return n.has(cn.TOP)?n.has(cn.LEFT)?Pa(e,t,this.x,this.y):n.has(cn.RIGHT)?Pa(e,t,this.x2,this.y):(this.y-t)*(this.y-t):n.has(cn.BOTTOM)?n.has(cn.LEFT)?Pa(e,t,this.x,this.y2):n.has(cn.RIGHT)?Pa(e,t,this.x2,this.y2):(t-this.y2)*(t-this.y2):n.has(cn.LEFT)?(this.x-e)*(this.x-e):n.has(cn.RIGHT)?(e-this.x2)*(e-this.x2):0}}function UH(r){if(r.length===0)return null;const e=r[0],t=new tr(e.x,e.y,0,0);for(const n of r)t.addPoint(n);return t}class pd{constructor(e,t,n){this.cx=e,this.cy=t,this.radius=n}get x(){return this.cx-this.radius}get x2(){return this.cx+this.radius}get width(){return this.radius*2}get y(){return this.cy-this.radius}get y2(){return this.cy+this.radius}get height(){return this.radius*2}static from(e){return new pd(e.cx,e.cy,e.radius)}containsPt(e,t){return Pa(this.cx,this.cy,e,t)<this.radius*this.radius}distSquare(e,t){const n=Pa(this.cx,this.cy,e,t);if(n<this.radius*this.radius)return 0;const i=Math.sqrt(n)-this.radius;return i*i}draw(e){e.ellipse(this.cx,this.cy,this.radius,this.radius,0,0,Math.PI*2)}}class ms{constructor(e,t=0,n=0,i=0,a=0,s=10,o=10,l=new Float32Array(Math.max(0,s*o)).fill(0)){this.pixelGroup=e,this.i=t,this.j=n,this.pixelX=i,this.pixelY=a,this.width=s,this.height=o,this.area=l}createSub(e,t){return new ms(this.pixelGroup,e.x,e.y,t.x,t.y,e.width,e.height)}static fromPixelRegion(e,t){return new ms(t,0,0,e.x,e.y,Math.ceil(e.width/t),Math.ceil(e.height/t))}copy(e,t){return new ms(this.pixelGroup,this.scaleX(t.x),this.scaleY(t.y),t.x,t.y,e.width,e.height,e.area)}boundX(e){return e<this.i?this.i:e>=this.width?this.width-1:e}boundY(e){return e<this.j?this.j:e>=this.height?this.height-1:e}scaleX(e){return this.boundX(Math.floor((e-this.pixelX)/this.pixelGroup))}scaleY(e){return this.boundY(Math.floor((e-this.pixelY)/this.pixelGroup))}scale(e){const t=this.scaleX(e.x),n=this.scaleY(e.y),i=this.boundX(Math.ceil((e.x+e.width-this.pixelX)/this.pixelGroup)),a=this.boundY(Math.ceil((e.y+e.height-this.pixelY)/this.pixelGroup)),s=i-t,o=a-n;return new tr(t,n,s,o)}invertScaleX(e){return Math.round(e*this.pixelGroup+this.pixelX)}invertScaleY(e){return Math.round(e*this.pixelGroup+this.pixelY)}addPadding(e,t){const n=Math.ceil(t/this.pixelGroup),i=this.boundX(e.x-n),a=this.boundY(e.y-n),s=this.boundX(e.x2+n),o=this.boundY(e.y2+n),l=s-i,c=o-a;return new tr(i,a,l,c)}get(e,t){return e<0||t<0||e>=this.width||t>=this.height?Number.NaN:this.area[e+t*this.width]}inc(e,t,n){e<0||t<0||e>=this.width||t>=this.height||(this.area[e+t*this.width]+=n)}set(e,t,n){e<0||t<0||e>=this.width||t>=this.height||(this.area[e+t*this.width]=n)}incArea(e,t){if(e.width<=0||e.height<=0||t===0)return;const n=this.width,i=e.width,a=Math.max(0,e.i),s=Math.max(0,e.j),o=Math.min(e.i+e.width,n),l=Math.min(e.j+e.height,this.height);if(!(l<=0||o<=0||a>=n||l>=this.height))for(let c=s;c<l;c++){const u=(c-e.j)*i,d=c*n;for(let h=a;h<o;h++){const f=e.area[h-e.i+u];f!==0&&(this.area[h+d]+=t*f)}}}fill(e){this.area.fill(e)}fillArea(e,t){const n=e.x+e.y*this.width;for(let i=0;i<e.height;i++){const a=n+i*this.width;this.area.fill(t,a,a+e.width)}}fillHorizontalLine(e,t,n,i){const a=e+t*this.width;this.area.fill(i,a,a+n)}fillVerticalLine(e,t,n,i){const a=e+t*this.width;for(let s=0;s<n;s++)this.area[a+s*this.width]=i}clear(){this.area.fill(0)}toString(){let e="";for(let t=0;t<this.height;t++){const n=t*this.width;for(let i=0;i<this.width;i++){const a=this.area[n+i];e+=a.toFixed(1).padStart(6),e+=" "}e+=`
343
343
  `}return e}draw(e,t=!0){if(this.width<=0||this.height<=0)return;e.save(),t&&e.translate(this.pixelX,this.pixelY);const n=this.area.reduce((s,o)=>Math.min(s,o),Number.POSITIVE_INFINITY),i=this.area.reduce((s,o)=>Math.max(s,o),Number.NEGATIVE_INFINITY),a=s=>(s-n)/(i-n);e.scale(this.pixelGroup,this.pixelGroup);for(let s=0;s<this.width;s++)for(let o=0;o<this.height;o++){const l=this.area[s+o*this.width];e.fillStyle=`rgba(0, 0, 0, ${a(l)})`,e.fillRect(s,o,1,1)}e.restore()}drawThreshold(e,t,n=!0){if(!(this.width<=0||this.height<=0)){e.save(),n&&e.translate(this.pixelX,this.pixelY),e.scale(this.pixelGroup,this.pixelGroup);for(let i=0;i<this.width;i++)for(let a=0;a<this.height;a++){const s=this.area[i+a*this.width];e.fillStyle=s>t?"black":"white",e.fillRect(i,a,1,1)}e.restore()}}}function XR(r,e){const t=n=>({x:n.x-e,y:n.y-e,width:n.width+2*e,height:n.height+2*e});return Array.isArray(r)?r.map(t):t(r)}function HT(r,e,t){return ZR(Object.assign(HR(r),{distSquare:(n,i)=>xx(r.x1,r.y1,r.x2,r.y2,n,i)}),e,t)}function ZR(r,e,t){const n=XR(r,t),i=e.scale(n),a=e.createSub(i,n);return HH(a,e,t,(s,o)=>r.distSquare(s,o)),a}function HH(r,e,t,n){const i=t*t;for(let a=0;a<r.height;a++)for(let s=0;s<r.width;s++){const o=e.invertScaleX(r.i+s),l=e.invertScaleY(r.j+a),c=n(o,l);if(c===0){r.set(s,a,i);continue}if(c<i){const u=t-Math.sqrt(c);r.set(s,a,u*u)}}return r}function YH(r,e,t){const n=e.scale(r),i=e.addPadding(n,t),a=e.createSub(i,{x:r.x-t,y:r.y-t}),s=n.x-i.x,o=n.y-i.y,l=i.x2-n.x2,c=i.y2-n.y2,u=i.width-s-l,d=i.height-o-c,h=t*t;a.fillArea({x:s,y:o,width:u+1,height:d+1},h);const f=[0],g=Math.max(o,s,l,c);{const y=e.invertScaleX(n.x+n.width/2);for(let b=1;b<g;b++){const w=e.invertScaleY(n.y-b),E=r.distSquare(y,w);if(E<h){const _=t-Math.sqrt(E);f.push(_*_)}else break}}const p=[],v=Math.max(s,l),m=Math.max(o,l);for(let y=1;y<v;y++){const b=e.invertScaleX(n.x-y),w=[];for(let E=1;E<m;E++){const _=e.invertScaleY(n.y-E),O=r.distSquare(b,_);if(O<h){const M=t-Math.sqrt(O);w.push(M*M)}else w.push(0)}p.push(w)}for(let y=1;y<Math.min(o,f.length);y++){const b=f[y];a.fillHorizontalLine(s,o-y,u+1,b)}for(let y=1;y<Math.min(c,f.length);y++){const b=f[y];a.fillHorizontalLine(s,o+d+y,u+1,b)}for(let y=1;y<Math.min(s,f.length);y++){const b=f[y];a.fillVerticalLine(s-y,o,d+1,b)}for(let y=1;y<Math.min(c,f.length);y++){const b=f[y];a.fillVerticalLine(s+u+y,o,d+1,b)}for(let y=1;y<s;y++){const b=p[y-1],w=s-y;for(let E=1;E<o;E++)a.set(w,o-E,b[E-1]);for(let E=1;E<c;E++)a.set(w,o+d+E,b[E-1])}for(let y=1;y<l;y++){const b=p[y-1],w=s+u+y;for(let E=1;E<o;E++)a.set(w,o-E,b[E-1]);for(let E=1;E<c;E++)a.set(w,o+d+E,b[E-1])}return a}function Wt(r,e){return{x:r,y:e}}function KH(r,e,t,n){if(r.length===0)return[];const i=eY(r);return i.map((a,s)=>{const o=i.slice(0,s);return XH(e,a,o,t,n)}).flat()}function XH(r,e,t,n,i){const a=Wt(e.cx,e.cy),s=QH(a,t,r);if(s==null)return[];const o=new Fn(a.x,a.y,s.cx,s.cy),l=ZH(o,r,n,i);return JH(l,r)}function ZH(r,e,t,n){const i=[],a=[];a.push(r);let s=!0;for(let o=0;o<t&&s;o++)for(s=!1;!s&&a.length>0;){const l=a.pop(),c=JR(e,l),u=c?VH(l,c):null;if(!c||!u||u.count!==2){s||i.push(l);continue}let d=n,h=yu(c,d,u,!0),f=va(h,a)||va(h,i),g=mu(h,e);for(;!f&&g&&d>=1;)d/=1.5,h=yu(c,d,u,!0),f=va(h,a)||va(h,i),g=mu(h,e);if(h&&!f&&!g&&(a.push(new Fn(l.x1,l.y1,h.x,h.y)),a.push(new Fn(h.x,h.y,l.x2,l.y2)),s=!0),s)continue;d=n,h=yu(c,d,u,!1);let p=va(h,a)||va(h,i);for(g=mu(h,e);!p&&g&&d>=1;)d/=1.5,h=yu(c,d,u,!1),p=va(h,a)||va(h,i),g=mu(h,e);h&&!p&&(a.push(new Fn(l.x1,l.y1,h.x,h.y)),a.push(new Fn(h.x,h.y,l.x2,l.y2)),s=!0),s||i.push(l)}for(;a.length>0;)i.push(a.pop());return i}function JH(r,e){const t=[];for(;r.length>0;){const n=r.pop();if(r.length===0){t.push(n);break}const i=r.pop(),a=new Fn(n.x1,n.y1,i.x2,i.y2);JR(e,a)?(t.push(n),r.push(i)):r.push(a)}return t}function QH(r,e,t){let n=Number.POSITIVE_INFINITY;return e.reduce((i,a)=>{const s=Pa(r.x,r.y,a.cx,a.cy);if(s>n)return i;const o=new Fn(r.x,r.y,a.cx,a.cy),l=tY(t,o);return s*(l+1)*(l+1)<n&&(i=a,n=s*(l+1)*(l+1)),i},null)}function eY(r){if(r.length<2)return r;let e=0,t=0;return r.forEach(n=>{e+=n.cx,t+=n.cy}),e/=r.length,t/=r.length,r.map(n=>{const i=e-n.cx,a=t-n.cy,s=i*i+a*a;return[n,s]}).sort((n,i)=>n[1]-i[1]).map(n=>n[0])}function mu(r,e){return e.some(t=>t.containsPt(r.x,r.y))}function va(r,e){return e.some(t=>!!(UT(t.x1,t.y1,r.x,r.y,.001)||UT(t.x2,t.y2,r.x,r.y,.001)))}function JR(r,e){let t=Number.POSITIVE_INFINITY,n=null;for(const i of r){if(!KR(i,e))continue;const a=WH(i,e);a>=0&&a<t&&(n=i,t=a)}return n}function tY(r,e){return r.reduce((t,n)=>KR(n,e)&&GH(n,e)?t+1:t,0)}function yu(r,e,t,n){const i=t.top,a=t.left,s=t.bottom,o=t.right;if(n){if(a.state===ln.POINT){if(i.state===ln.POINT)return Wt(r.x-e,r.y-e);if(s.state===ln.POINT)return Wt(r.x-e,r.y2+e);const h=r.width*r.height;return r.width*((a.y-r.y+(o.y-r.y))*.5)<h*.5?a.y>o.y?Wt(r.x-e,r.y-e):Wt(r.x2+e,r.y-e):a.y<o.y?Wt(r.x-e,r.y2+e):Wt(r.x2+e,r.y2+e)}if(o.state===ln.POINT){if(i.state===ln.POINT)return Wt(r.x2+e,r.y-e);if(s.state===ln.POINT)return Wt(r.x2+e,r.y2+e)}const u=r.height*r.width;return r.height*((i.x-r.x+(o.x-r.x))*.5)<u*.5?i.x>s.x?Wt(r.x-e,r.y-e):Wt(r.x-e,r.y2+e):i.x<s.x?Wt(r.x2+e,r.y-e):Wt(r.x2+e,r.y2+e)}if(a.state===ln.POINT){if(i.state===ln.POINT)return Wt(r.x2+e,r.y2+e);if(s.state===ln.POINT)return Wt(r.x2+e,r.y-e);const u=r.height*r.width;return r.width*((a.y-r.y+(o.y-r.y))*.5)<u*.5?a.y>o.y?Wt(r.x2+e,r.y2+e):Wt(r.x-e,r.y2+e):a.y<o.y?Wt(r.x2+e,r.y-e):Wt(r.x-e,r.y-e)}if(o.state===ln.POINT){if(i.state===ln.POINT)return Wt(r.x-e,r.y2+e);if(s.state===ln.POINT)return Wt(r.x-e,r.y-e)}const l=r.height*r.width;return r.height*((i.x-r.x+(o.x-r.x))*.5)<l*.5?i.x>s.x?Wt(r.x2+e,r.y2+e):Wt(r.x2+e,r.y-e):i.x<s.x?Wt(r.x-e,r.y2+e):Wt(r.x-e,r.y-e)}function nY(r,e,t,n){if(!(r.closed?t<r.length:t<r.length-1))return!1;const a=r.get(e),s=r.get(t+1);for(let o=e+1;o<=t;o++){const l=r.get(o);if(xx(a.x,a.y,s.x,s.y,l.x,l.y)>n)return!1}return!0}function rY(r=0){return e=>{if(r<0||e.length<3)return e;const t=[];let n=0;const i=r*r;for(;n<e.length;){let a=n+1;for(;nY(e,n,a,i);)a++;t.push(e.get(n)),n=a}return new Uo(t)}}function iY(r,e){switch(r){case-2:return(((-e+3)*e-3)*e+1)/6;case-1:return((3*e-6)*e*e+4)/6;case 0:return(((-3*e+3)*e+3)*e+1)/6;case 1:return e*e*e/6;default:throw new Error("unknown error")}}function aY(r=6){function a(s,o,l){let c=0,u=0;for(let d=-2;d<=1;d++){const h=s.get(o+d),f=iY(d,l);c+=f*h.x,u+=f*h.y}return{x:c,y:u}}return s=>{if(s.length<3)return s;const o=[],l=s.closed,c=s.length+3-1+(l?0:2);o.push(a(s,2-(l?0:2),0));for(let u=2-(l?0:2);u<c;u++)for(let d=1;d<=r;d++)o.push(a(s,u,d/r));return new Uo(o)}}function sY(r=8){return e=>{let t=r,n=e.length;if(t>1)for(n=Math.floor(e.length/t);n<3&&t>1;)t-=1,n=Math.floor(e.length/t);const i=[];for(let a=0,s=0;s<n;s++,a+=t)i.push(e.get(a));return new Uo(i)}}class Uo{constructor(e=[],t=!0){this.points=e,this.closed=t}get(e){const t=e,n=this.points.length;return e<0?this.closed?this.get(e+n):this.points[0]:e>=n?this.closed?this.get(e-n):this.points[n-1]:this.points[t]}get length(){return this.points.length}toString(e=1/0){const t=this.points;if(t.length===0)return"";const n=typeof e=="function"?e:qH(e);let i="M";for(const a of t)i+=`${n(a.x)},${n(a.y)} L`;return i=i.slice(0,-1),this.closed&&(i+=" Z"),i}draw(e){const t=this.points;if(t.length!==0){e.beginPath(),e.moveTo(t[0].x,t[0].y);for(const n of t)e.lineTo(n.x,n.y);this.closed&&e.closePath()}}sample(e){return sY(e)(this)}simplify(e){return rY(e)(this)}bSplines(e){return aY(e)(this)}apply(e){return e(this)}containsElements(e){const t=UH(this.points);return t?e.every(n=>t.containsPt(n.cx,n.cy)&&this.withinArea(n.cx,n.cy)):!1}withinArea(e,t){if(this.length===0)return!1;let n=0;const i=this.points[0],a=new Fn(i.x,i.y,i.x,i.y);for(let s=1;s<this.points.length;s++){const o=this.points[s];a.x1=a.x2,a.y1=a.y2,a.x2=o.x,a.y2=o.y,a.cuts(e,t)&&n++}return a.x1=a.x2,a.y1=a.y2,a.x2=i.x,a.y2=i.y,a.cuts(e,t)&&n++,n%2===1}}class oY{constructor(e=0){this.count=0,this.arr=[],this.set=new Set,this.arr.length=e}add(e){this.set.add(`${e.x}x${e.y}`),this.arr[this.count++]=e}contains(e){return this.set.has(`${e.x}x${e.y}`)}isFirst(e){if(this.count===0)return!1;const t=this.arr[0];return t!=null&&t.x===e.x&&t.y===e.y}path(){return new Uo(this.arr.slice(0,this.count))}clear(){this.set.clear(),this.count=0}get(e){return this.arr[e]}get length(){return this.count}}const al=0,bu=1,xu=2,Ny=3;function lY(r,e){const t=(Math.floor(r.width)+Math.floor(r.height))*2,n=new oY(t);function i(l,c,u,d){const h=r.get(l,c);return Number.isNaN(h)?Number.NaN:h>e?u+d:u}function a(l,c){let u=al;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=bu;function o(l,c){let u=l,d=c,h=r.invertScaleX(u),f=r.invertScaleY(d);for(let g=0;g<r.width*r.height;g++){const p={x:h,y:f};if(n.contains(p)){if(n.isFirst(p))return!0}else n.add(p);const v=a(u,d);switch(v){case-1:return!0;case 0:case 3:case 2:case 7:s=xu;break;case 12:case 14:case 4:s=Ny;break;case 6:s=s===al?Ny:xu;break;case 1:case 13:case 5:s=al;break;case 9:s=s===xu?al:bu;break;case 10:case 8:case 11:s=bu;break;default:return console.warn("Marching squares invalid state: "+v),!0}switch(s){case al:d--,f-=r.pixelGroup;break;case bu:d++,f+=r.pixelGroup;break;case Ny:u--,h-=r.pixelGroup;break;case xu:u++,h+=r.pixelGroup;break;default:return console.warn("Marching squares invalid state: "+v),!0}}return!0}for(let l=0;l<r.width;l++)for(let c=0;c<r.height;c++){if(r.get(l,c)<=e)continue;const u=a(l,c);if(!(u<0||u===15)&&o(l,c))return n.path()}return null}const Sh={maxRoutingIterations:100,maxMarchingIterations:20,pixelGroup:4,edgeR0:10,edgeR1:20,nodeR0:15,nodeR1:50,morphBuffer:10,threshold:1,memberInfluenceFactor:1,edgeInfluenceFactor:1,nonMemberInfluenceFactor:-.8,virtualEdges:!0};function Ol(r){return r!=null&&typeof r.radius=="number"}function YT(r,e){if(Ol(r)!==Ol(e))return!1;if(Ol(r)){const n=e;return r.cx===n.cx&&r.cy===n.cy&&r.radius===n.radius}const t=e;return r.x===t.x&&r.y===t.y&&r.width===t.width&&r.height===t.height}var ni;(function(r){r[r.MEMBERS=0]="MEMBERS",r[r.NON_MEMBERS=1]="NON_MEMBERS",r[r.EDGES=2]="EDGES"})(ni||(ni={}));let KT=class{constructor(e={}){this.dirty=new Set,this.members=[],this.nonMembers=[],this.virtualEdges=[],this.edges=[],this.activeRegion=new tr(0,0,0,0),this.potentialArea=new ms(1,0,0,0,0,0,0),this.o=Object.assign({},Sh,e)}pushMember(...e){if(e.length!==0){this.dirty.add(ni.MEMBERS);for(const t of e)this.members.push({raw:t,obj:Ol(t)?pd.from(t):tr.from(t),area:null})}}removeMember(e){const t=this.members.findIndex(n=>YT(n.raw,e));return t<0?!1:(this.members.splice(t,1),this.dirty.add(ni.MEMBERS),!0)}removeNonMember(e){const t=this.nonMembers.findIndex(n=>YT(n.raw,e));return t<0?!1:(this.nonMembers.splice(t,1),this.dirty.add(ni.NON_MEMBERS),!0)}removeEdge(e){const t=this.edges.findIndex(n=>n.obj.equals(e));return t<0?!1:(this.edges.splice(t,1),this.dirty.add(ni.NON_MEMBERS),!0)}pushNonMember(...e){if(e.length!==0){this.dirty.add(ni.NON_MEMBERS);for(const t of e)this.nonMembers.push({raw:t,obj:Ol(t)?pd.from(t):tr.from(t),area:null})}}pushEdge(...e){if(e.length!==0){this.dirty.add(ni.EDGES);for(const t of e)this.edges.push({raw:t,obj:Fn.from(t),area:null})}}update(){const e=this.dirty.has(ni.MEMBERS),t=this.dirty.has(ni.NON_MEMBERS);let n=this.dirty.has(ni.EDGES);this.dirty.clear();const i=this.members.map(c=>c.obj);if(this.o.virtualEdges&&(e||t)){const c=this.nonMembers.map(h=>h.obj),u=KH(i,c,this.o.maxRoutingIterations,this.o.morphBuffer),d=new Map(this.virtualEdges.map(h=>[h.obj.toString(),h.area]));this.virtualEdges=u.map(h=>{var f;return{raw:h,obj:h,area:(f=d.get(h.toString()))!==null&&f!==void 0?f:null}}),n=!0}let a=!1;if(e||n){const c=this.virtualEdges.concat(this.edges).map(f=>f.obj),u=uY(i,c),d=Math.max(this.o.edgeR1,this.o.nodeR1)+this.o.morphBuffer,h=tr.from(XR(u,d));h.equals(this.activeRegion)||(a=!0,this.activeRegion=h)}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=ms.fromPixelRegion(this.activeRegion,this.o.pixelGroup),this.members.forEach(d=>d.area=null),this.nonMembers.forEach(d=>d.area=null),this.edges.forEach(d=>d.area=null),this.virtualEdges.forEach(d=>d.area=null)):(c!==this.potentialArea.width||u!==this.potentialArea.height)&&(this.potentialArea=ms.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 tr?"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 tr?"R":"C"}`;if(s.has(u)){const h=s.get(u);c.area=this.potentialArea.copy(h,{x:c.obj.x-this.o.nodeR1,y:c.obj.y-this.o.nodeR1});return}const d=c.obj instanceof tr?YH(c.obj,this.potentialArea,this.o.nodeR1):ZR(c.obj,this.potentialArea,this.o.nodeR1);c.area=d,s.set(u,d)};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=HT(c.obj,this.potentialArea,this.o.edgeR1))}),this.virtualEdges.forEach(c=>{c.area||(c.area=HT(c.obj,this.potentialArea,this.o.edgeR1))})}drawMembers(e){for(const t of this.members)t.obj.draw(e)}drawNonMembers(e){for(const t of this.nonMembers)t.obj.draw(e)}drawEdges(e){for(const t of this.edges)t.obj.draw(e)}drawPotentialArea(e,t=!0){this.potentialArea.draw(e,t)}compute(){if(this.members.length===0)return new Uo([]);this.dirty.size>0&&this.update();const{o:e,potentialArea:t}=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 cY(t,n,i,a,o=>o.containsElements(s),e)}};function cY(r,e,t,n,i,a={}){const s=Object.assign({},Sh,a);let o=s.threshold,l=s.memberInfluenceFactor,c=s.edgeInfluenceFactor,u=s.nonMemberInfluenceFactor;const d=(s.nodeR0-s.nodeR1)*(s.nodeR0-s.nodeR1),h=(s.edgeR0-s.edgeR1)*(s.edgeR0-s.edgeR1);for(let f=0;f<s.maxMarchingIterations;f++){if(r.clear(),l!==0){const p=l/d;for(const v of e)r.incArea(v,p)}if(c!==0){const p=c/h;for(const v of t)r.incArea(v,p)}if(u!==0){const p=u/d;for(const v of n)r.incArea(v,p)}const g=lY(r,o);if(g&&i(g))return g;if(o*=.95,f<=s.maxMarchingIterations*.5)l*=1.2,c*=1.2;else if(u!==0&&n.length>0)u*=.8;else break}return new Uo([])}function uY(r,e){if(r.length===0)return new tr(0,0,0,0);const t=tr.from(r[0]);for(const n of r)t.add(n);for(const n of e)t.add(HR(n));return t}var dY=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};class _h extends Zn{constructor(e,t){super(e,hr({},_h.defaultOptions,t)),this.members=new Map,this.avoidMembers=new Map,this.bubbleSetOptions={},this.drawBubbleSets=()=>{const{style:n,bubbleSetOptions:i}=this.parseOptions();sn(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 hc({style:a}),this.context.canvas.appendChild(this.shape))},this.updateBubbleSetsPath=n=>{if(!this.shape)return;const i=te(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&&sn(a,s)&&sn(o,l))return this.path;const{enter:c=[],exit:u=[]}=Ia(s,a,v=>v),{enter:d=[],exit:h=[]}=Ia(l,o,v=>v);n&&(u.push(n),c.push(n));const f=(v,m,y)=>{v.forEach(b=>{const w=y?this.members:this.avoidMembers,E=y?"pushMember":"pushNonMember",_=y?"removeMember":"removeNonMember";if(m){let O;i.getElementType(b)==="edge"?([O]=fY(i,b),this.bubbleSets.pushEdge(O)):([O]=hY(i,b),this.bubbleSets[E](O)),w.set(b,O)}else{const O=w.get(b);O&&(i.getElementType(b)==="edge"?this.bubbleSets.removeEdge(O):this.bubbleSets[_](O),w.delete(b))}})};f(u,!1,!0),f(c,!0,!0),f(h,!1,!1),f(d,!0,!1);const p=this.bubbleSets.compute().sample(8).simplify(0).bSplines().simplify(0);return this.path=DA(p.points.map(Un)),this.path},this.bindEvents(),this.bubbleSets=new KT(this.options)}bindEvents(){this.context.graph.on(we.AFTER_RENDER,this.drawBubbleSets),this.context.graph.on(we.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath)}init(){this.bubbleSets=new KT(this.options),this.members=new Map,this.avoidMembers=new Map}parseOptions(){const e=this.options,{type:t,key:n,members:i,avoidMembers:a}=e,s=dY(e,["type","key","members","avoidMembers"]),o=Object.keys(s).reduce((l,c)=>(c in Sh?l.bubbleSetOptions[c]=s[c]:l.style[c]=s[c],l),{style:{},bubbleSetOptions:{}});return Object.assign({type:t,key:n,members:i,avoidMembers:a},o)}addMember(e){const t=Array.isArray(e)?e:[e];t.some(n=>this.options.avoidMembers.includes(n))&&(this.options.avoidMembers=this.options.avoidMembers.filter(n=>!t.includes(n))),this.options.members=[...new Set([...this.options.members,...t])],this.drawBubbleSets()}removeMember(e){const t=Array.isArray(e)?e:[e];this.options.members=this.options.members.filter(n=>!t.includes(n)),this.drawBubbleSets()}updateMember(e){this.options.members=Ie(e)?e(this.options.members):e,this.drawBubbleSets()}getMember(){return this.options.members}addAvoidMember(e){const t=Array.isArray(e)?e:[e];t.some(n=>this.options.members.includes(n))&&(this.options.members=this.options.members.filter(n=>!t.includes(n))),this.options.avoidMembers=[...new Set([...this.options.avoidMembers,...t])],this.drawBubbleSets()}removeAvoidMember(e){const t=Array.isArray(e)?e:[e];this.options.avoidMembers.some(n=>t.includes(n))&&(this.options.avoidMembers=this.options.avoidMembers.filter(n=>!t.includes(n)),this.drawBubbleSets())}updateAvoidMember(e){this.options.avoidMembers=Array.isArray(e)?e:[e],this.drawBubbleSets()}getAvoidMember(){return this.options.avoidMembers}destroy(){this.context.graph.off(we.AFTER_RENDER,this.drawBubbleSets),this.context.graph.off(we.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath),this.shape.destroy(),super.destroy()}}_h.defaultOptions=Object.assign({members:[],avoidMembers:[],fill:"lightblue",fillOpacity:.2,stroke:"blue",strokeOpacity:.2},Sh);const hY=(r,e)=>(Array.isArray(e)?e:[e]).map(n=>{const i=r.getElementRenderBounds(n);return new tr(i.min[0],i.min[1],Bi(i),zi(i))}),fY=(r,e)=>(Array.isArray(e)?e:[e]).map(n=>{const i=r.getEdgeData(n),a=r.getElementPosition(i.source),s=r.getElementPosition(i.target);return Fn.from({x1:a[0],y1:a[1],x2:s[0],y2:s[1]})});function gY(r){return`
344
344
  <ul class="g6-contextmenu-ul">
345
345
  ${r.map(e=>`<li class="g6-contextmenu-li" value="${e.value}">${e.name}</li>`).join("")}
@@ -466,10 +466,10 @@ YYYY`):pr(t,"MM月");case"year":return pr(t,"YYYY");default:return pr(t,"YYYY-MM
466
466
  * @date 1/23/2025, 8:33:12 AM
467
467
  * @author AntVis
468
468
  * @docs https://g.antv.antgroup.com/
469
- */var jL=function(){function r(e){ge(this,r),this.dragndropPluginOptions=e}return ve(r,[{key:"apply",value:function(t){var n=this,i=t.renderingService,a=t.renderingContext,s=a.root.ownerDocument,o=s.defaultView,l=function(u){var d=u.target,h=d===s,f=h&&n.dragndropPluginOptions.isDocumentDraggable?s:d.closest&&d.closest("[draggable=true]");if(f){var g=!1,p=u.timeStamp,v=[u.clientX,u.clientY],m=null,y=[u.clientX,u.clientY],b=function(){var E=ja(Hn().mark(function _(O){var M,N,A,P,L,I;return Hn().wrap(function(H){for(;;)switch(H.prev=H.next){case 0:if(g){H.next=8;break}if(M=O.timeStamp-p,N=yr([O.clientX,O.clientY],v),!(M<=n.dragndropPluginOptions.dragstartTimeThreshold||N<=n.dragndropPluginOptions.dragstartDistanceThreshold)){H.next=5;break}return H.abrupt("return");case 5:O.type="dragstart",f.dispatchEvent(O),g=!0;case 8:if(O.type="drag",O.dx=O.clientX-y[0],O.dy=O.clientY-y[1],f.dispatchEvent(O),y=[O.clientX,O.clientY],h){H.next=21;break}return A=n.dragndropPluginOptions.overlap==="pointer"?[O.canvasX,O.canvasY]:d.getBounds().center,H.next=17,s.elementsFromPoint(A[0],A[1]);case 17:P=H.sent,L=P[P.indexOf(d)+1],I=(L==null?void 0:L.closest("[droppable=true]"))||(n.dragndropPluginOptions.isDocumentDroppable?s:null),m!==I&&(m&&(O.type="dragleave",O.target=m,m.dispatchEvent(O)),I&&(O.type="dragenter",O.target=I,I.dispatchEvent(O)),m=I,m&&(O.type="dragover",O.target=m,m.dispatchEvent(O)));case 21:case"end":return H.stop()}},_)}));return function(O){return E.apply(this,arguments)}}();o.addEventListener("pointermove",b);var w=function(_){if(g){_.detail={preventClick:!0};var O=_.clone();m&&(O.type="drop",O.target=m,m.dispatchEvent(O)),O.type="dragend",f.dispatchEvent(O),g=!1}o.removeEventListener("pointermove",b)};d.addEventListener("pointerup",w,{once:!0}),d.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)})}}])}();jL.tag="Dragndrop";var EJ=function(r){function e(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ge(this,e),t=tt(this,e),t.name="dragndrop",t.options=n,t}return nt(e,r),ve(e,[{key:"init",value:function(){this.addRenderingPlugin(new jL(et({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)}}])}(Ga),ZO=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(d){s(d)}}function l(u){try{c(n.throw(u))}catch(d){s(d)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,e||[])).next())})},JO=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};const QO=["main"],eC=["background","main","label","transient"];function SJ(r){return r.main}class tC{getConfig(){return this.config}getLayer(e="main"){return this.extends.layers[e]||SJ(this.getLayers())}getLayers(){return this.extends.layers}getRenderer(e){return this.extends.renderers[e]}getCamera(e="main"){return this.getLayer(e).getCamera()}getRoot(e="main"){return this.getLayer(e).getRoot()}getContextService(e="main"){return this.getLayer(e).getContextService()}setCursor(e){this.config.cursor=e,this.getLayer().setCursor(e)}get document(){return this.getLayer().document}get context(){return this.getLayer().context}constructor(e){this.config={enableMultiLayer:!0},Object.assign(this.config,e);const t=this.config,{renderer:n,background:i,cursor:a,enableMultiLayer:s}=t,o=JO(t,["renderer","background","cursor","enableMultiLayer"]),l=s?eC:QO,c=nC(n,l),u=Object.fromEntries(l.map(d=>{const h=new k1(Object.assign(Object.assign({},o),{supportsMutipleCanvasesInOneContainer:s,renderer:c[d],background:s?d==="background"?i:void 0:i}));return[d,h]}));rC(u),this.extends={config:this.config,renderer:n,renderers:c,layers:u}}get ready(){return Promise.all(Object.entries(this.getLayers()).map(([,e])=>e.ready))}resize(e,t){Object.assign(this.extends.config,{width:e,height:t}),Object.values(this.getLayers()).forEach(n=>{const i=n.getCamera(),a=i.getPosition(),s=i.getFocalPoint();n.resize(e,t),i.setPosition(a),i.setFocalPoint(s)})}getBounds(e){return cc(Object.values(this.getLayers()).map(t=>e?t.getRoot().childNodes.find(i=>i.classList.includes(e)):t.getRoot()).filter(t=>(t==null?void 0:t.childNodes.length)>0).map(t=>t.getBounds()))}getContainer(){const e=this.extends.config.container;return typeof e=="string"?document.getElementById(e):e}getSize(){return[this.extends.config.width||0,this.extends.config.height||0]}appendChild(e,t){var n;const i=((n=e.style)===null||n===void 0?void 0:n.$layer)||"main";return this.getLayer(i).appendChild(e,t)}setRenderer(e){if(e===this.extends.renderer)return;const t=nC(e,this.config.enableMultiLayer?eC:QO);this.extends.renderers=t,Object.entries(t).forEach(([n,i])=>this.getLayer(n).setRenderer(i)),rC(this.getLayers())}getCanvasByViewport(e){return Un(this.getLayer().viewport2Canvas(si(e)))}getViewportByCanvas(e){return Un(this.getLayer().canvas2Viewport(si(e)))}getViewportByClient(e){return Un(this.getLayer().client2Viewport(si(e)))}getClientByViewport(e){return Un(this.getLayer().viewport2Client(si(e)))}getClientByCanvas(e){return this.getClientByViewport(this.getViewportByCanvas(e))}getCanvasByClient(e){const t=this.getLayer(),n=t.client2Viewport(si(e));return Un(t.viewport2Canvas(n))}toDataURL(){return ZO(this,arguments,void 0,function*(e={}){const t=globalThis.devicePixelRatio||1,{mode:n="viewport"}=e,i=JO(e,["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=Wa(m);[a,s]=m.min,[o,l]=y}const c=c1('<div id="virtual-image"></div>'),u=new k1({width:o,height:l,renderer:new ql,devicePixelRatio:t,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 d=this.getLayer("label").getRoot().cloneNode(!0),h=u.viewport2Canvas({x:0,y:0}),f=this.getCanvasByViewport([0,0]);d.translate([f[0]-h.x,f[1]-h.y]),d.scale(1/this.getCamera().getZoom()),u.appendChild(d),u.appendChild(this.getLayer("transient").getRoot().cloneNode(!0));const g=this.getCamera(),p=u.getCamera();if(n==="viewport")p.setZoom(g.getZoom()),p.setPosition(g.getPosition()),p.setFocalPoint(g.getFocalPoint());else if(n==="overall"){const[m,y,b]=p.getPosition(),[w,E,_]=p.getFocalPoint();p.setPosition([m+a,y+s,b]),p.setFocalPoint([w+a,E+s,_])}const v=u.getContextService();return new Promise(m=>{u.addEventListener(Nr.RERENDER,()=>ZO(this,void 0,void 0,function*(){yield new Promise(b=>setTimeout(b,300));const y=yield v.toDataURL(i);m(y)}))})})}destroy(){Object.values(this.getLayers()).forEach(e=>{e.getCamera().cancelLandmarkAnimation(),e.destroy()})}}function nC(r,e){return Object.fromEntries(e.map(t=>{const n=(r==null?void 0:r(t))||new ql;return n instanceof ql&&n.setConfig({enableDirtyRectangleRendering:!1}),t==="main"?n.registerPlugin(new EJ({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):n.unregisterPlugin(n.getPlugin("dom-interaction")),[t,n]}))}function rC(r){Object.entries(r).forEach(([e,t])=>{const n=t.getContextService().getDomElement();n!=null&&n.style&&(n.style.gridArea="1 / 1 / 2 / 2",n.style.outline="none",n.tabIndex=1,e!=="main"&&(n.style.pointerEvents="none")),n!=null&&n.parentElement&&(n.parentElement.style.display="grid")})}const no=r=>r?parseInt(r):0;function _J(r){const e=getComputedStyle(r),t=r.clientWidth||no(e.width),n=r.clientHeight||no(e.height),i=no(e.paddingLeft)+no(e.paddingRight),a=no(e.paddingTop)+no(e.paddingBottom);return[t-i,n-a]}function iC(r){if(!r)return[0,0];let e=640,t=480;const[n,i]=_J(r);e=n||e,t=i||t;const a=1,s=1;return[Math.max(Ce(e)?e:a,a),Math.max(Ce(t)?t:s,s)]}class Uh{constructor(e){this.type=e}}class bn extends Uh{constructor(e,t){super(e),this.data=t}}class Ur extends Uh{constructor(e,t,n,i){super(e),this.animationType=t,this.animation=n,this.data=i}}class ro extends Uh{constructor(e,t,n){super(e),this.elementType=t,this.data=n}}class Su extends Uh{constructor(e,t){super(e),this.data=t}}function Tn(r,e){r.emit(e.type,e)}function kJ(r){if(!r)return null;if(r instanceof ZN)return{type:"canvas",element:r};let e=r;for(;e;){if(vc(e))return{type:"node",element:e};if(iP(e))return{type:"edge",element:e};if(Hb(e))return{type:"combo",element:e};e=e.parentElement}return null}function aC(r){var e;return((e=r==null?void 0:r.style)===null||e===void 0?void 0:e.zIndex)||0}const Nl="cachedStyle",Ix=r=>`__${r}__`;function MJ(r,e){const t=Array.isArray(e)?e:[e];lr(r,Nl)||Dl(r,Nl,{}),t.forEach(n=>{Dl(lr(r,Nl),Ix(n),r.attributes[n])})}function sC(r,e){return lr(r,[Nl,Ix(e)])}function TJ(r,e){return Ix(e)in(lr(r,Nl)||{})}class OJ{constructor(e){this.tasks=[],this.animations=new Set,this.context=e}getTasks(){const e=[...this.tasks];return this.tasks=[],e}add(e,t){this.tasks.push([e,t])}animate(e,t,n){var i,a,s;(i=t==null?void 0:t.before)===null||i===void 0||i.call(t);const o=this.getTasks().map(([c,u])=>{var d,h,f;const{element:g,elementType:p,stage:v}=c,m=Iz(this.context.options,p,v,e);(d=u==null?void 0:u.before)===null||d===void 0||d.call(u);const y=m.length?Fz(g,this.inferStyle(c,n),m):null;return y?((h=u==null?void 0:u.beforeAnimate)===null||h===void 0||h.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=Rb(o);return l?((a=t==null?void 0:t.beforeAnimate)===null||a===void 0||a.call(t,l),l.finished.then(()=>{var c,u;(c=t==null?void 0:t.afterAnimate)===null||c===void 0||c.call(t,l),(u=t==null?void 0:t.after)===null||u===void 0||u.call(t),this.release()})):(s=t==null?void 0:t.after)===null||s===void 0||s.call(t),l}inferStyle(e,t){var n,i;const{element:a,elementType:s,stage:o,originalStyle:l,updatedStyle:c={}}=e;e.modifiedStyle||(e.modifiedStyle=Object.assign(Object.assign({},l),c));const{modifiedStyle:u}=e,d={},h={};if(o==="enter")Object.assign(d,{opacity:0});else if(o==="exit")Object.assign(h,{opacity:0});else if(o==="show")Object.assign(d,{opacity:0}),Object.assign(h,{opacity:(n=sC(a,"opacity"))!==null&&n!==void 0?n:jl("opacity")});else if(o==="hide")Object.assign(d,{opacity:(i=sC(a,"opacity"))!==null&&i!==void 0?i:jl("opacity")}),Object.assign(h,{opacity:0});else if(o==="collapse"){const{collapse:f}=t||{},{target:g,descendants:p,position:v}=f;if(s==="node"){if(p.includes(a.id)){const[m,y,b]=v;Object.assign(h,{x:m,y,z:b})}}else if(s==="combo"){if(a.id===g||p.includes(a.id)){const[m,y]=v;Object.assign(h,{x:m,y,childrenNode:l.childrenNode})}}else s==="edge"&&Object.assign(h,{sourceNode:u.sourceNode,targetNode:u.targetNode})}else if(o==="expand"){const{expand:f}=t||{},{target:g,descendants:p,position:v}=f;if(s==="node"){if(a.id===g||p.includes(a.id)){const[m,y,b]=v;Object.assign(d,{x:m,y,z:b})}}else if(s==="combo"){if(a.id===g||p.includes(a.id)){const[m,y,b]=v;Object.assign(d,{x:m,y,z:b,childrenNode:u.childrenNode})}}else s==="edge"&&Object.assign(d,{sourceNode:u.sourceNode,targetNode:u.targetNode})}return[Object.keys(d).length>0?Object.assign({},l,d):l,Object.keys(h).length>0?Object.assign({},u,h):u]}stop(){this.animations.forEach(e=>e.cancel())}clear(){this.tasks=[]}release(){var e,t;const{canvas:n}=this.context,i=(t=(e=n.document)===null||e===void 0?void 0:e.timeline)===null||t===void 0?void 0:t.animationsWithPromises;i&&(n.document.timeline.animationsWithPromises=i.filter(a=>a.playState!=="finished"))}destroy(){this.stop(),this.animations.clear(),this.tasks=[]}}class CJ{constructor(e){this.batchCount=0,this.context=e}emit(e){const{graph:t}=this.context;t.emit(e.type,e)}startBatch(e=!0){this.batchCount++,this.batchCount===1&&this.emit(new bn(we.BATCH_START,{initiate:e}))}endBatch(){this.batchCount--,this.batchCount===0&&this.emit(new bn(we.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class NJ extends Db{constructor(e){super(e),this.currentTarget=null,this.currentTargetType=null,this.category="behavior",this.forwardCanvasEvents=t=>{const{target:n}=t,i=kJ(n);if(!i)return;const{graph:a,canvas:s}=this.context,{type:o,element:l}=i;if("destroyed"in l&&(jd(l)||l.destroyed))return;const{type:c,detail:u,button:d}=t,h=Object.assign(Object.assign({},t),{target:l,targetType:o,originalTarget:n});c===ce.POINTER_MOVE&&(this.currentTarget!==l&&(this.currentTarget&&a.emit(`${this.currentTargetType}:${ce.POINTER_LEAVE}`,Object.assign(Object.assign({},h),{type:ce.POINTER_LEAVE,target:this.currentTarget,targetType:this.currentTargetType})),l&&(Object.assign(h,{type:ce.POINTER_ENTER}),a.emit(`${o}:${ce.POINTER_ENTER}`,h))),this.currentTarget=l,this.currentTargetType=o),c===ce.CLICK&&d===2||(a.emit(`${o}:${c}`,h),a.emit(c,h)),c===ce.CLICK&&u===2&&(Object.assign(h,{type:ce.DBLCLICK}),a.emit(`${o}:${ce.DBLCLICK}`,h),a.emit(ce.DBLCLICK,h)),c===ce.POINTER_DOWN&&d===2&&(Object.assign(h,{type:ce.CONTEXT_MENU,preventDefault:()=>{var f;(f=s.getContainer())===null||f===void 0||f.addEventListener(ce.CONTEXT_MENU,g=>g.preventDefault(),{once:!0})}}),a.emit(`${o}:${ce.CONTEXT_MENU}`,h),a.emit(ce.CONTEXT_MENU,h))},this.forwardContainerEvents=t=>{this.context.graph.emit(t.type,t)},this.forwardEvents(),this.setBehaviors(this.context.options.behaviors||[])}setBehaviors(e){this.setExtensions(e)}forwardEvents(){const e=this.context.canvas.getContainer();e&&[fo.KEY_DOWN,fo.KEY_UP].forEach(n=>{e.addEventListener(n,this.forwardContainerEvents)});const t=this.context.canvas.document;t&&[ce.CLICK,ce.DBLCLICK,ce.POINTER_OVER,ce.POINTER_LEAVE,ce.POINTER_ENTER,ce.POINTER_MOVE,ce.POINTER_OUT,ce.POINTER_DOWN,ce.POINTER_UP,ce.CONTEXT_MENU,ce.DRAG_START,ce.DRAG,ce.DRAG_END,ce.DRAG_ENTER,ce.DRAG_OVER,ce.DRAG_LEAVE,ce.DROP,ce.WHEEL].forEach(n=>{t.addEventListener(n,this.forwardCanvasEvents)})}destroy(){const e=this.context.canvas.getContainer();e&&[fo.KEY_DOWN,fo.KEY_UP].forEach(t=>{e.removeEventListener(t,this.forwardContainerEvents)}),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}var Zl=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};function ya(r,e){const{data:t,style:n}=r,i=Zl(r,["data","style"]),{data:a,style:s}=e,o=Zl(e,["data","style"]),l=Object.assign(Object.assign({},i),o);return(t||a)&&Object.assign(l,{data:Object.assign(Object.assign({},t),a)}),(n||s)&&Object.assign(l,{style:Object.assign(Object.assign({},n),s)}),l}function Uy(r){const{data:e,style:t}=r,i=Zl(r,["data","style"]);return e&&(i.data=Object.assign({},e)),t&&(i.style=Object.assign({},t)),i}function io(r={},e={}){const{states:t=[],data:n={},style:i={},children:a=[]}=r,s=Zl(r,["states","data","style","children"]),{states:o=[],data:l={},style:c={},children:u=[]}=e,d=Zl(e,["states","data","style","children"]),h=(g,p)=>g.length!==p.length?!1:g.every((v,m)=>v===p[m]),f=(g,p)=>{const v=Object.keys(g),m=Object.keys(p);return v.length!==m.length?!1:v.every(y=>g[y]===p[y])};return!(!f(s,d)||!h(a,u)||!h(t,o)||!f(n,l)||!f(i,c))}var AJ=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};function Hy(r){const{id:e=te(r),style:t,data:n}=r,i=AJ(r,["id","style","data"]),a=Object.assign(Object.assign({},r),{style:Object.assign({},t),data:Object.assign({},n)});return Gz(r)?Object.assign({id:e,data:a},i):{id:e,data:a}}function Ln(r){return r.data}function PJ(r){if(r.hasTreeStructure(Ar))return;r.attachTreeStructure(Ar);const e=r.getAllEdges();for(const t of e){const{source:n,target:i}=t;r.setParent(i,n,Ar)}}class RJ{constructor(){this.latestRemovedComboIds=new Set,this.comboIds=new Set,this.changes=[],this.batchCount=0,this.isTraceless=!1,this.enableUpdateNodeLikeHierarchy=!0,this.model=new Pn}pushChange(e){if(this.isTraceless)return;const{type:t}=e;if(t===Vt.NodeUpdated||t===Vt.EdgeUpdated||t===Vt.ComboUpdated){const{value:n,original:i}=e;this.changes.push({value:Uy(n),original:Uy(i),type:t})}else this.changes.push({value:Uy(e.value),type:t})}getChanges(){return this.changes}clearChanges(){this.changes=[]}batch(e){this.batchCount++,this.model.batch(e),this.batchCount--}isBatching(){return this.batchCount>0}silence(e){this.isTraceless=!0,e(),this.isTraceless=!1}isCombo(e){return this.comboIds.has(e)||this.latestRemovedComboIds.has(e)}getData(){return{nodes:this.getNodeData(),edges:this.getEdgeData(),combos:this.getComboData()}}getNodeData(e){return this.model.getAllNodes().reduce((t,n)=>{const i=Ln(n);return this.isCombo(te(i))||(e===void 0||e.includes(te(i)))&&t.push(i),t},[])}getEdgeDatum(e){return Ln(this.model.getEdge(e))}getEdgeData(e){return this.model.getAllEdges().reduce((t,n)=>{const i=Ln(n);return(e===void 0||e.includes(te(i)))&&t.push(i),t},[])}getComboData(e){return this.model.getAllNodes().reduce((t,n)=>{const i=Ln(n);return this.isCombo(te(i))&&(e===void 0||e.includes(te(i)))&&t.push(i),t},[])}getRootsData(e=Ar){return this.model.getRoots(e).map(Ln)}getAncestorsData(e,t){const{model:n}=this;return!n.hasNode(e)||!n.hasTreeStructure(t)?[]:n.getAncestors(e,t).map(Ln)}getDescendantsData(e){const t=this.getElementDataById(e),n=[];return vs(t,i=>{i!==t&&n.push(i)},i=>this.getChildrenData(te(i)),"TB"),n}getParentData(e,t){const{model:n}=this;if(!t){Di.warn("The hierarchy structure key is not specified");return}if(!n.hasNode(e)||!n.hasTreeStructure(t))return;const i=n.getParent(e,t);return i?Ln(i):void 0}getChildrenData(e){const t=this.getElementType(e)==="node"?Ar:Mt,{model:n}=this;return!n.hasNode(e)||!n.hasTreeStructure(t)?[]:n.getChildren(e,t).map(Ln)}getElementsDataByType(e){return e==="node"?this.getNodeData():e==="edge"?this.getEdgeData():e==="combo"?this.getComboData():[]}getElementDataById(e){return this.getElementType(e)==="edge"?this.getEdgeDatum(e):this.getNodeLikeDatum(e)}getNodeLikeDatum(e){const t=this.model.getNode(e);return Ln(t)}getNodeLikeData(e){return this.model.getAllNodes().reduce((t,n)=>{const i=Ln(n);return e?e.includes(te(i))&&t.push(i):t.push(i),t},[])}getElementDataByState(e,t){return this.getElementsDataByType(e).filter(i=>{var a;return(a=i.states)===null||a===void 0?void 0:a.includes(t)})}getElementState(e){var t;return((t=this.getElementDataById(e))===null||t===void 0?void 0:t.states)||[]}hasNode(e){return this.model.hasNode(e)&&!this.isCombo(e)}hasEdge(e){return this.model.hasEdge(e)}hasCombo(e){return this.model.hasNode(e)&&this.isCombo(e)}getRelatedEdgesData(e,t="both"){return this.model.getRelatedEdges(e,t).map(Ln)}getNeighborNodesData(e){return this.model.getNeighbors(e).map(Ln)}setData(e){const{nodes:t=[],edges:n=[],combos:i=[]}=e,{nodes:a,edges:s,combos:o}=this.getData(),l=Ia(a,t,d=>te(d),io),c=Ia(s,n,d=>te(d),io),u=Ia(o,i,d=>te(d),io);this.batch(()=>{const d={nodes:l.enter,edges:c.enter,combos:u.enter};this.addData(d),this.computeZIndex(d,"add",!0);const h={nodes:l.update,edges:c.update,combos:u.update};this.updateData(h),this.computeZIndex(h,"update",!0);const f={nodes:l.exit.map(te),edges:c.exit.map(te),combos:u.exit.map(te)};this.removeData(f)})}addData(e){const{nodes:t,edges:n,combos:i}=e;this.batch(()=>{this.addComboData(i),this.addNodeData(t),this.addEdgeData(n)}),this.computeZIndex(e,"add")}addNodeData(e=[]){e.length&&(this.model.addNodes(e.map(t=>(this.pushChange({value:t,type:Vt.NodeAdded}),Hy(t)))),this.updateNodeLikeHierarchy(e),this.computeZIndex({nodes:e},"add"))}addEdgeData(e=[]){e.length&&(this.model.addEdges(e.map(t=>(this.pushChange({value:t,type:Vt.EdgeAdded}),Hy(t)))),this.computeZIndex({edges:e},"add"))}addComboData(e=[]){if(!e.length)return;const{model:t}=this;t.hasTreeStructure(Mt)||t.attachTreeStructure(Mt),t.addNodes(e.map(n=>(this.comboIds.add(te(n)),this.pushChange({value:n,type:Vt.ComboAdded}),Hy(n)))),this.updateNodeLikeHierarchy(e),this.computeZIndex({combos:e},"add")}addChildrenData(e,t){const n=this.getNodeLikeDatum(e),i=t.map(te);this.addNodeData(t),this.updateNodeData([{id:e,children:[...n.children||[],...i]}]),this.addEdgeData(i.map(a=>({source:e,target:a})))}computeZIndex(e,t,n=!1){!n&&this.isBatching()||this.batch(()=>{const{nodes:i=[],edges:a=[],combos:s=[]}=e;s.forEach(o=>{var l,c,u;const d=te(o);if(t==="add"&&Ce((l=o.style)===null||l===void 0?void 0:l.zIndex)||t==="update"&&!("combo"in o))return;const h=this.getParentData(d,Mt),f=h?((u=(c=h.style)===null||c===void 0?void 0:c.zIndex)!==null&&u!==void 0?u:0)+1:0;this.preventUpdateNodeLikeHierarchy(()=>{this.updateComboData([{id:d,style:{zIndex:f}}])})}),i.forEach(o=>{var l,c,u;const d=te(o);if(t==="add"&&Ce((l=o.style)===null||l===void 0?void 0:l.zIndex)||t==="update"&&!("combo"in o)&&!("children"in o))return;let h=0;const f=this.getParentData(d,Mt);if(f)h=(((c=f.style)===null||c===void 0?void 0:c.zIndex)||0)+1;else{const g=this.getParentData(d,Ar);g&&(h=((u=g==null?void 0:g.style)===null||u===void 0?void 0:u.zIndex)||0)}this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:d,style:{zIndex:h}}])})}),a.forEach(o=>{var l,c,u,d,h;if(Ce((l=o.style)===null||l===void 0?void 0:l.zIndex))return;let{id:f,source:g,target:p}=o;if(!f)f=te(o);else{const y=this.getEdgeDatum(f);g=y.source,p=y.target}if(!g||!p)return;const v=((u=(c=this.getNodeLikeDatum(g))===null||c===void 0?void 0:c.style)===null||u===void 0?void 0:u.zIndex)||0,m=((h=(d=this.getNodeLikeDatum(p))===null||d===void 0?void 0:d.style)===null||h===void 0?void 0:h.zIndex)||0;this.updateEdgeData([{id:te(o),style:{zIndex:Math.max(v,m)-1}}])})})}getFrontZIndex(e){var t;const n=this.getElementType(e),i=this.getElementDataById(e),a=this.getData();if(Object.assign(a,{[`${n}s`]:a[`${n}s`].filter(s=>te(s)!==e)}),n==="combo"&&!wr(i)){const s=new Set(this.getAncestorsData(e,Mt).map(te));a.nodes=a.nodes.filter(o=>!s.has(te(o))),a.combos=a.combos.filter(o=>!s.has(te(o))),a.edges=a.edges.filter(({source:o,target:l})=>!s.has(o)&&!s.has(l))}return Math.max(((t=i.style)===null||t===void 0?void 0:t.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(e){if(!this.enableUpdateNodeLikeHierarchy)return;const{model:t}=this;e.forEach(n=>{const i=te(n),a=tu(n);a!==void 0&&(t.hasTreeStructure(Mt)||t.attachTreeStructure(Mt),a===null&&this.refreshComboData(i),this.setParent(i,tu(n),Mt));const s=n.children||[];if(s.length){t.hasTreeStructure(Ar)||t.attachTreeStructure(Ar);const o=s.filter(l=>t.hasNode(l));o.forEach(l=>this.setParent(l,i,Ar)),o.length!==s.length&&this.updateNodeData([{id:i,children:o}])}})}preventUpdateNodeLikeHierarchy(e){this.enableUpdateNodeLikeHierarchy=!1,e(),this.enableUpdateNodeLikeHierarchy=!0}updateData(e){const{nodes:t,edges:n,combos:i}=e;this.batch(()=>{this.updateNodeData(t),this.updateComboData(i),this.updateEdgeData(n)}),this.computeZIndex(e,"update")}updateNodeData(e=[]){if(!e.length)return;const{model:t}=this;this.batch(()=>{const n=[];e.forEach(i=>{const a=te(i),s=Ln(t.getNode(a));if(io(s,i))return;const o=ya(s,i);this.pushChange({value:o,original:s,type:Vt.NodeUpdated}),t.mergeNodeData(a,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({nodes:e},"update")}refreshData(){const{nodes:e,edges:t,combos:n}=this.getData();e.forEach(i=>{this.pushChange({value:i,original:i,type:Vt.NodeUpdated})}),t.forEach(i=>{this.pushChange({value:i,original:i,type:Vt.EdgeUpdated})}),n.forEach(i=>{this.pushChange({value:i,original:i,type:Vt.ComboUpdated})})}syncNodeLikeDatum(e){const{model:t}=this,n=te(e);if(!t.hasNode(n))return;const i=Ln(t.getNode(n)),a=ya(i,e);t.mergeNodeData(n,a)}syncEdgeDatum(e){const{model:t}=this,n=te(e);if(!t.hasEdge(n))return;const i=Ln(t.getEdge(n)),a=ya(i,e);t.mergeEdgeData(n,a)}updateEdgeData(e=[]){if(!e.length)return;const{model:t}=this;this.batch(()=>{e.forEach(n=>{const i=te(n),a=Ln(t.getEdge(i));if(io(a,n))return;n.source&&a.source!==n.source&&t.updateEdgeSource(i,n.source),n.target&&a.target!==n.target&&t.updateEdgeTarget(i,n.target);const s=ya(a,n);this.pushChange({value:s,original:a,type:Vt.EdgeUpdated}),t.mergeEdgeData(i,s)})}),this.computeZIndex({edges:e},"update")}updateComboData(e=[]){if(!e.length)return;const{model:t}=this;t.batch(()=>{const n=[];e.forEach(i=>{const a=te(i),s=Ln(t.getNode(a));if(io(s,i))return;const o=ya(s,i);this.pushChange({value:o,original:s,type:Vt.ComboUpdated}),t.mergeNodeData(a,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({combos:e},"update")}setParent(e,t,n,i=!0){if(e===t)return;const a=this.getNodeLikeDatum(e),s=tu(a);if(s!==t&&n===Mt){const o={id:e,combo:t};this.isCombo(e)?this.syncNodeLikeDatum(o):this.syncNodeLikeDatum(o)}this.model.setParent(e,t,n),i&&n===Mt&&i6([s,t]).forEach(o=>{o!==void 0&&this.refreshComboData(o)})}refreshComboData(e){const t=this.getComboData([e])[0],n=this.getAncestorsData(e,Mt);t&&this.pushChange({value:t,original:t,type:Vt.ComboUpdated}),n.forEach(i=>{this.pushChange({value:i,original:i,type:Vt.ComboUpdated})})}getElementPosition(e){const t=this.getElementDataById(e);return On(t)}translateNodeLikeBy(e,t){this.isCombo(e)?this.translateComboBy(e,t):this.translateNodeBy(e,t)}translateNodeLikeTo(e,t){this.isCombo(e)?this.translateComboTo(e,t):this.translateNodeTo(e,t)}translateNodeBy(e,t){const n=this.getElementPosition(e),i=Ze(n,[...t,0].slice(0,3));this.translateNodeTo(e,i)}translateNodeTo(e,t){const[n=0,i=0,a=0]=t;this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:e,style:{x:n,y:i,z:a}}])})}translateComboBy(e,t){const[n=0,i=0,a=0]=t;if([n,i,a].some(isNaN)||[n,i,a].every(l=>l===0))return;const s=this.getComboData([e])[0];if(!s)return;const o=new Set;vs(s,l=>{const c=te(l);if(o.has(c))return;o.add(c);const[u,d,h]=On(l),f=ya(l,{style:{x:u+n,y:d+i,z:h+a}});this.pushChange({value:f,original:l,type:this.isCombo(c)?Vt.ComboUpdated:Vt.NodeUpdated}),this.model.mergeNodeData(c,f)},l=>this.getChildrenData(te(l)),"BT")}translateComboTo(e,t){var n;if(t.some(isNaN))return;const[i=0,a=0,s=0]=t,o=(n=this.getComboData([e]))===null||n===void 0?void 0:n[0];if(!o)return;const[l,c,u]=On(o),d=i-l,h=a-c,f=s-u;vs(o,g=>{const p=te(g),[v,m,y]=On(g),b=ya(g,{style:{x:v+d,y:m+h,z:y+f}});this.pushChange({value:b,original:g,type:this.isCombo(p)?Vt.ComboUpdated:Vt.NodeUpdated}),this.model.mergeNodeData(p,b)},g=>this.getChildrenData(te(g)),"BT")}removeData(e){const{nodes:t,edges:n,combos:i}=e;this.batch(()=>{this.removeEdgeData(n),this.removeNodeData(t),this.removeComboData(i),this.latestRemovedComboIds=new Set(i)})}removeNodeData(e=[]){e.length&&this.batch(()=>{e.forEach(t=>{this.removeEdgeData(this.getRelatedEdgesData(t).map(te)),this.pushChange({value:this.getNodeData([t])[0],type:Vt.NodeRemoved}),this.removeNodeLikeHierarchy(t)}),this.model.removeNodes(e)})}removeEdgeData(e=[]){e.length&&(e.forEach(t=>this.pushChange({value:this.getEdgeData([t])[0],type:Vt.EdgeRemoved})),this.model.removeEdges(e))}removeComboData(e=[]){e.length&&this.batch(()=>{e.forEach(t=>{this.pushChange({value:this.getComboData([t])[0],type:Vt.ComboRemoved}),this.removeNodeLikeHierarchy(t),this.comboIds.delete(t)}),this.model.removeNodes(e)})}removeNodeLikeHierarchy(e){if(this.model.hasTreeStructure(Mt)){const t=tu(this.getNodeLikeDatum(e));this.setParent(e,void 0,Mt,!1),this.model.getChildren(e,Mt).forEach(n=>{const i=Ln(n),a=te(i);this.setParent(te(i),t,Mt,!1);const s=ya(i,{id:te(i),combo:t});this.pushChange({value:s,original:i,type:this.isCombo(a)?Vt.ComboUpdated:Vt.NodeUpdated}),this.model.mergeNodeData(te(i),s)}),qe(t)||this.refreshComboData(t)}}getElementType(e){if(this.model.hasNode(e))return this.isCombo(e)?"combo":"node";if(this.model.hasEdge(e))return"edge";throw new Error(Ji(`Unknown element type of id: ${e}`))}destroy(){const{model:e}=this,t=e.getAllNodes(),n=e.getAllEdges();e.removeEdges(n.map(i=>i.id)),e.removeNodes(t.map(i=>i.id)),this.context={}}}var ll=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(d){s(d)}}function l(u){try{c(n.throw(u))}catch(d){s(d)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,e||[])).next())})};class LJ{constructor(e){this.elementMap={},this.shapeTypeMap={},this.paletteStyle={},this.defaultStyle={},this.stateStyle={},this.visibilityCache=new WeakMap,this.context=e}init(){this.initContainer()}initContainer(){if(!this.container||this.container.destroyed){const{canvas:e}=this.context;this.container=e.appendChild(new An({className:"elements"}))}}emit(e,t){t.silence||Tn(this.context.graph,e)}forEachElementData(e){Ms.forEach(t=>{const n=this.context.model.getElementsDataByType(t);e(t,n)})}getElementType(e,t){var n;const{options:i,graph:a}=this.context,s=((n=i[e])===null||n===void 0?void 0:n.type)||t.type;return s?typeof s=="string"?s:s.call(a,t):e==="edge"?"line":"circle"}getTheme(e){return cA(this.context.options)[e]||{}}getThemeStyle(e){return this.getTheme(e).style||{}}getThemeStateStyle(e,t){const{state:n={}}=this.getTheme(e);return Object.assign({},...t.map(i=>n[i]||{}))}computePaletteStyle(){const{options:e}=this.context;this.paletteStyle={},this.forEachElementData((t,n)=>{var i,a;const s=Object.assign({},cE((i=this.getTheme(t))===null||i===void 0?void 0:i.palette),cE((a=e[t])===null||a===void 0?void 0:a.palette));s!=null&&s.field&&Object.assign(this.paletteStyle,zj(n,s))})}getPaletteStyle(e,t){const n=this.paletteStyle[t];return n?e==="edge"?{stroke:n}:{fill:n}:{}}computeElementDefaultStyle(e,t){var n;const{options:i}=this.context,a=((n=i[e])===null||n===void 0?void 0:n.style)||{};"transform"in a&&Array.isArray(a.transform)&&(a.transform=[...a.transform]),this.defaultStyle[te(t.datum)]=lE(a,t)}computeElementsDefaultStyle(e){const{graph:t}=this.context;this.forEachElementData((n,i)=>{const a=i.length;for(let s=0;s<a;s++){const o=i[s];(e===void 0||e.includes(te(o)))&&this.computeElementDefaultStyle(n,{datum:o,graph:t})}})}getDefaultStyle(e){return this.defaultStyle[e]||{}}getElementState(e){try{const{model:t}=this.context;return t.getElementState(e)}catch{return[]}}getElementStateStyle(e,t,n){var i,a;const{options:s}=this.context,o=((a=(i=s[e])===null||i===void 0?void 0:i.state)===null||a===void 0?void 0:a[t])||{};return lE(o,n)}computeElementStatesStyle(e,t,n){this.stateStyle[te(n.datum)]=Object.assign({},...t.map(i=>this.getElementStateStyle(e,i,n)))}computeElementsStatesStyle(e){const{graph:t}=this.context;this.forEachElementData((n,i)=>{const a=i.length;for(let s=0;s<a;s++){const o=i[s];if(e===void 0||e.includes(te(o))){const l=this.getElementState(te(o));this.computeElementStatesStyle(n,l,{datum:o,graph:t})}}})}getStateStyle(e){return this.stateStyle[e]||{}}computeStyle(e,t){e&&["translate","zIndex"].includes(e)||(this.computePaletteStyle(),this.computeElementsDefaultStyle(t),this.computeElementsStatesStyle(t))}getElement(e){return this.elementMap[e]}getNodes(){return this.context.model.getNodeData().map(({id:e})=>this.elementMap[e])}getEdges(){return this.context.model.getEdgeData().map(e=>this.elementMap[te(e)])}getCombos(){return this.context.model.getComboData().map(({id:e})=>this.elementMap[e])}getElementComputedStyle(e,t){const n=te(t),i=this.getThemeStyle(e),a=this.getPaletteStyle(e,n),s=t.style||{},o=this.getDefaultStyle(n),l=this.getThemeStateStyle(e,this.getElementState(n)),c=this.getStateStyle(n),u=Object.assign({},i,a,s,o,l,c);if(e==="combo"){const d=this.context.model.getChildrenData(n),f=!!u.collapsed?[]:d.map(te).filter(g=>this.getElement(g));Object.assign(u,{childrenNode:f,childrenData:d})}return u}getDrawData(e){this.init();const t=this.computeChangesAndDrawData(e);if(!t)return null;const{type:n="draw",stage:i=n}=e;return this.markDestroyElement(t.drawData),this.computeStyle(i),{type:n,stage:i,data:t}}draw(e={animation:!0}){const t=this.getDrawData(e);if(!t)return;const{data:{drawData:{add:n,update:i,remove:a}}}=t;return this.destroyElements(a,e),this.createElements(n,e),this.updateElements(i,e),this.setAnimationTask(e,t)}preLayoutDraw(){return ll(this,arguments,void 0,function*(e={animation:!0}){var t,n;const i=this.getDrawData(e);if(!i)return;const{data:{drawData:a}}=i;yield(n=(t=this.context.layout)===null||t===void 0?void 0:t.preLayout)===null||n===void 0?void 0:n.call(t,a);const{add:s,update:o,remove:l}=a;return this.destroyElements(l,e),this.createElements(s,e),this.updateElements(o,e),this.setAnimationTask(e,i)})}setAnimationTask(e,t){const{animation:n,silence:i}=e,{data:{dataChanges:a,drawData:s},stage:o,type:l}=t;return this.context.animation.animate(n,i?{}:{before:()=>this.emit(new bn(we.BEFORE_DRAW,{dataChanges:a,animation:n,stage:o,render:l==="render"}),e),beforeAnimate:c=>this.emit(new Ur(we.BEFORE_ANIMATE,mr.DRAW,c,s),e),afterAnimate:c=>this.emit(new Ur(we.AFTER_ANIMATE,mr.DRAW,c,s),e),after:()=>this.emit(new bn(we.AFTER_DRAW,{dataChanges:a,animation:n,stage:o,render:l==="render",firstRender:this.context.graph.rendered===!1}),e)})}computeChangesAndDrawData(e){const{model:t}=this.context,n=t.getChanges(),i=wx(n);if(i.length===0)return null;const{NodeAdded:a=[],NodeUpdated:s=[],NodeRemoved:o=[],EdgeAdded:l=[],EdgeUpdated:c=[],EdgeRemoved:u=[],ComboAdded:d=[],ComboUpdated:h=[],ComboRemoved:f=[]}=wd(i,m=>m.type),g=m=>new Map(m.map(y=>{const b=y.value;return[te(b),b]})),p={add:{nodes:g(a),edges:g(l),combos:g(d)},update:{nodes:g(s),edges:g(c),combos:g(h)},remove:{nodes:g(o),edges:g(u),combos:g(f)}},v=this.transformData(p,e);return t.clearChanges(),{dataChanges:n,drawData:v}}transformData(e,t){const n=this.context.transform.getTransformInstance();return Object.values(n).reduce((i,a)=>a.beforeDraw(i,t),e)}createElement(e,t,n){var i;const a=te(t);if(this.getElement(a))return;const o=this.getElementType(e,t),l=this.getElementComputedStyle(e,t),c=na(e,o);if(!c)return Di.warn(`The element ${o} of ${e} is not registered.`);this.emit(new ro(we.BEFORE_ELEMENT_CREATE,e,t),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:d="enter"}=n;(i=this.context.animation)===null||i===void 0||i.add({element:u,elementType:e,stage:d,originalStyle:Object.assign({},u.attributes),updatedStyle:l},{after:()=>{var h;this.emit(new ro(we.AFTER_ELEMENT_CREATE,e,t),n),(h=u.onCreate)===null||h===void 0||h.call(u)}})}createElements(e,t){const{nodes:n,edges:i,combos:a}=e;[["node",n],["combo",a],["edge",i]].forEach(([o,l])=>{l.forEach(c=>this.createElement(o,c,t))})}getUpdateStageStyle(e,t,n){const{stage:i="update"}=n;if(i==="translate")if(e==="node"||e==="combo"){const{style:{x:a=0,y:s=0,z:o=0}={}}=t;return{x:a,y:s,z:o}}else return{};return this.getElementComputedStyle(e,t)}updateElement(e,t,n){var i;const a=te(t),{stage:s="update"}=n,o=this.getElement(a);if(!o)return()=>null;this.emit(new ro(we.BEFORE_ELEMENT_UPDATE,e,t),n);const l=this.getElementType(e,t),c=this.getUpdateStageStyle(e,t,n);this.shapeTypeMap[a]!==l&&(o.destroy(),delete this.shapeTypeMap[a],delete this.elementMap[a],this.createElement(e,t,{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:e,stage:u,originalStyle:Object.assign({},o.attributes),updatedStyle:c},{before:()=>{const d=this.elementMap[a];s!=="collapse"&&D1(d,c),s==="visibility"&&(TJ(d,"opacity")||MJ(d,"opacity"),this.visibilityCache.set(d,u==="show"?"visible":"hidden"),u==="show"&&_s(d,"visible"))},after:()=>{var d;const h=this.elementMap[a];s==="collapse"&&D1(h,c),u==="hide"&&_s(h,this.visibilityCache.get(h)),this.emit(new ro(we.AFTER_ELEMENT_UPDATE,e,t),n),(d=h.onUpdate)===null||d===void 0||d.call(h)}})}updateElements(e,t){const{nodes:n,edges:i,combos:a}=e;[["node",n],["combo",a],["edge",i]].forEach(([o,l])=>{l.forEach(c=>this.updateElement(o,c,t))})}markDestroyElement(e){Object.values(e.remove).forEach(t=>{t.forEach(n=>{const i=te(n),a=this.getElement(i);a&&F$(a)})})}destroyElement(e,t,n){var i;const{stage:a="exit"}=n,s=te(t),o=this.elementMap[s];if(!o)return()=>null;this.emit(new ro(we.BEFORE_ELEMENT_DESTROY,e,t),n),(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:e,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 ro(we.AFTER_ELEMENT_DESTROY,e,t),n)}})}destroyElements(e,t){const{nodes:n,edges:i,combos:a}=e;[["combo",a],["edge",i],["node",n]].forEach(([o,l])=>{l.forEach(c=>this.destroyElement(o,c,t))})}clearElement(e){delete this.paletteStyle[e],delete this.defaultStyle[e],delete this.stateStyle[e],delete this.elementMap[e],delete this.shapeTypeMap[e]}alignLayoutResultToElement(e,t){var n,i;const a=(n=e.nodes)===null||n===void 0?void 0:n.find(s=>te(s)===t);if(a){const s=On(this.context.model.getNodeLikeDatum(t)),o=On(a),l=St(s,o);(i=e.nodes)===null||i===void 0||i.forEach(c=>{var u,d,h;!((u=c.style)===null||u===void 0)&&u.x&&(c.style.x+=l[0]),!((d=c.style)===null||d===void 0)&&d.y&&(c.style.y+=l[1]),!((h=c.style)===null||h===void 0)&&h.z&&(c.style.z+=l[2]||0)})}}collapseNode(e,t){return ll(this,void 0,void 0,function*(){var n;const{animation:i,align:a}=t,{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,e),s.updateData(c);const u=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!u)return;const{drawData:d}=u,{add:h,remove:f,update:g}=d;this.markDestroyElement(d);const p={animation:i,stage:"collapse",data:d};this.destroyElements(f,p),this.createElements(h,p),this.updateElements(g,p),yield(n=this.context.animation.animate(i,{beforeAnimate:v=>this.emit(new Ur(we.BEFORE_ANIMATE,mr.COLLAPSE,v,d),p),afterAnimate:v=>this.emit(new Ur(we.AFTER_ANIMATE,mr.COLLAPSE,v,d),p)},{collapse:{target:e,descendants:Array.from(f.nodes).map(([,v])=>te(v)),position:On(g.nodes.get(e))}}))===null||n===void 0?void 0:n.finished})}expandNode(e,t){return ll(this,void 0,void 0,function*(){var n;const{model:i,layout:a}=this.context,{animation:s,align:o}=t,l=On(i.getNodeData([e])[0]),c=this.computeChangesAndDrawData({stage:"expand",animation:s});if(!c)return;const{drawData:{add:u}}=c;this.createElements(u,{animation:!1,stage:"expand",target:e}),this.context.animation.clear();const d=yield a.simulate();o&&this.alignLayoutResultToElement(d,e),i.updateData(d),this.computeStyle("expand");const h=this.computeChangesAndDrawData({stage:"collapse",animation:s});if(!h)return;const{drawData:f}=h,{update:g}=f,p={animation:s,stage:"expand",data:f};u.edges.forEach(v=>g.edges.set(te(v),v)),u.nodes.forEach(v=>g.nodes.set(te(v),v)),this.updateElements(g,p),yield(n=this.context.animation.animate(s,{beforeAnimate:v=>this.emit(new Ur(we.BEFORE_ANIMATE,mr.EXPAND,v,f),p),afterAnimate:v=>this.emit(new Ur(we.AFTER_ANIMATE,mr.EXPAND,v,f),p)},{expand:{target:e,descendants:Array.from(u.nodes).map(([,v])=>te(v)),position:l}}))===null||n===void 0?void 0:n.finished})}collapseCombo(e,t){return ll(this,void 0,void 0,function*(){var n;const{model:i,element:a}=this.context;if(i.getAncestorsData(e,Mt).some(p=>wr(p)))return;const s=a.getElement(e),o=s.getComboPosition(Object.assign(Object.assign({},s.attributes),{collapsed:!0})),l=this.computeChangesAndDrawData({stage:"collapse",animation:t});if(!l)return;const{dataChanges:c,drawData:u}=l;this.markDestroyElement(u);const{update:d,remove:h}=u,f={animation:t,stage:"collapse",data:u};this.destroyElements(h,f),this.updateElements(d,f);const g=p=>Array.from(p).map(([,v])=>te(v));yield(n=this.context.animation.animate(t,{before:()=>this.emit(new bn(we.BEFORE_DRAW,{dataChanges:c,animation:t}),f),beforeAnimate:p=>this.emit(new Ur(we.BEFORE_ANIMATE,mr.COLLAPSE,p,u),f),afterAnimate:p=>this.emit(new Ur(we.AFTER_ANIMATE,mr.COLLAPSE,p,u),f),after:()=>this.emit(new bn(we.AFTER_DRAW,{dataChanges:c,animation:t}),f)},{collapse:{target:e,descendants:[...g(h.nodes),...g(h.combos)],position:o}}))===null||n===void 0?void 0:n.finished})}expandCombo(e,t){return ll(this,void 0,void 0,function*(){var n;const{model:i}=this.context,a=On(i.getComboData([e])[0]);this.computeStyle("expand");const s=this.computeChangesAndDrawData({stage:"expand",animation:t});if(!s)return;const{dataChanges:o,drawData:l}=s,{add:c,update:u}=l,d={animation:t,stage:"expand",data:l,target:e};this.createElements(c,d),this.updateElements(u,d);const h=f=>Array.from(f).map(([,g])=>te(g));yield(n=this.context.animation.animate(t,{before:()=>this.emit(new bn(we.BEFORE_DRAW,{dataChanges:o,animation:t}),d),beforeAnimate:f=>this.emit(new Ur(we.BEFORE_ANIMATE,mr.EXPAND,f,l),d),afterAnimate:f=>this.emit(new Ur(we.AFTER_ANIMATE,mr.EXPAND,f,l),d),after:()=>this.emit(new bn(we.AFTER_DRAW,{dataChanges:o,animation:t}),d)},{expand:{target:e,descendants:[...h(c.nodes),...h(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 ao=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(d){s(d)}}function l(u){try{c(n.throw(u))}catch(d){s(d)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,e||[])).next())})},IJ=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};class DJ{get presetOptions(){return{animation:!!uA(this.context.options,!0)}}get options(){const{options:e}=this.context;return e.layout}constructor(e){this.instances=[],this.context=e}getLayoutInstance(){return this.instances}preLayout(e){return ao(this,void 0,void 0,function*(){var t,n,i,a;const{graph:s,model:o}=this.context,{add:l}=e;Tn(s,new bn(we.BEFORE_LAYOUT,{type:"pre"}));const c=yield(t=this.context.layout)===null||t===void 0?void 0:t.simulate();(n=c==null?void 0:c.nodes)===null||n===void 0||n.forEach(u=>{const d=te(u),h=l.nodes.get(d);o.syncNodeLikeDatum(u),h&&Object.assign(h.style,u.style)}),(i=c==null?void 0:c.edges)===null||i===void 0||i.forEach(u=>{const d=te(u),h=l.edges.get(d);o.syncEdgeDatum(u),h&&Object.assign(h.style,u.style)}),(a=c==null?void 0:c.combos)===null||a===void 0||a.forEach(u=>{const d=te(u),h=l.combos.get(d);o.syncNodeLikeDatum(u),h&&Object.assign(h.style,u.style)}),Tn(s,new bn(we.AFTER_LAYOUT,{type:"pre"})),this.transformDataAfterLayout("pre",e)})}postLayout(){return ao(this,arguments,void 0,function*(e=this.options){if(!e)return;const t=Array.isArray(e)?e:[e],{graph:n}=this.context;Tn(n,new bn(we.BEFORE_LAYOUT,{type:"post"}));for(const i of t){const a=t.indexOf(i),s=this.getLayoutData(i),o=Object.assign(Object.assign({},this.presetOptions),i);Tn(n,new bn(we.BEFORE_STAGE_LAYOUT,{options:o,index:a}));const l=yield this.stepLayout(s,o,a);Tn(n,new bn(we.AFTER_STAGE_LAYOUT,{options:o,index:a})),i.animation||this.updateElementPosition(l,!1)}Tn(n,new bn(we.AFTER_LAYOUT,{type:"post"})),this.transformDataAfterLayout("post")})}transformDataAfterLayout(e,t){const n=this.context.transform.getTransformInstance();Object.values(n).forEach(i=>i.afterLayout(e,t))}simulate(){return ao(this,void 0,void 0,function*(){if(!this.options)return{};const e=Array.isArray(this.options)?this.options:[this.options];let t={};for(const n of e){const i=e.indexOf(n),a=this.getLayoutData(n);t=yield this.stepLayout(a,Object.assign(Object.assign(Object.assign({},this.presetOptions),n),{animation:!1}),i)}return t})}stepLayout(e,t,n){return ao(this,void 0,void 0,function*(){return W$(t)?yield this.treeLayout(e,t,n):yield this.graphLayout(e,t,n)})}graphLayout(e,t,n){return ao(this,void 0,void 0,function*(){const{animation:i,enableWorker:a,iterations:s=300}=t,o=this.initGraphLayout(t);if(!o)return{};if(this.instances[n]=o,this.instance=o,a){const c=o;return this.supervisor=new PH(c.graphData2LayoutModel(e),c.instance,{iterations:s}),Au(yield this.supervisor.execute())}if(G1(o))return i?yield o.execute(e,{onTick:c=>{this.updateElementPosition(c,!1)}}):(o.execute(e),o.stop(),o.tick(s));const l=yield o.execute(e);if(i){const c=this.updateElementPosition(l,i);yield c==null?void 0:c.finished}return l})}treeLayout(e,t,n){return ao(this,void 0,void 0,function*(){const{type:i,animation:a}=t,s=na("layout",i);if(!s)return{};const{nodes:o=[],edges:l=[]}=e,c=new Pn({nodes:o.map(g=>({id:te(g),data:g.data||{}})),edges:l.map(g=>({id:te(g),source:g.source,target:g.target,data:g.data||{}}))});PJ(c);const u={nodes:[],edges:[]},d={nodes:[],edges:[]};c.getRoots(Ar).forEach(g=>{vs(g,b=>{b.children=c.getSuccessors(b.id)},b=>c.getSuccessors(b.id),"TB");const p=s(g,t),{x:v,y:m,z:y=0}=p;vs(p,b=>{const{id:w,x:E,y:_,z:O=0}=b;u.nodes.push({id:w,style:{x:v,y:m,z:y}}),d.nodes.push({id:w,style:{x:E,y:_,z:O}})},b=>b.children,"TB")});const f=this.inferTreeLayoutOffset(d);if(oC(d,f),a){oC(u,f),this.updateElementPosition(u,!1);const g=this.updateElementPosition(d,a);yield g==null?void 0:g.finished}return d})}inferTreeLayoutOffset(e){var t;let[n,i]=[1/0,-1/0],[a,s]=[1/0,-1/0];(t=e.nodes)===null||t===void 0||t.forEach(p=>{const{x:v=0,y:m=0}=p.style||{};n=Math.min(n,v),i=Math.max(i,v),a=Math.min(a,m),s=Math.max(s,m)});const{canvas:o}=this.context,l=o.getSize(),[c,u]=o.getCanvasByViewport([0,0]),[d,h]=o.getCanvasByViewport(l);if(n>=c&&i<=d&&a>=u&&s<=h)return[0,0];const f=(c+d)/2,g=(u+h)/2;return[f-(n+i)/2,g-(a+s)/2]}stopLayout(){this.instance&&G1(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(e){const{nodeFilter:t=()=>!0,preLayout:n=!1,isLayoutInvisibleNodes:i=!1}=e,{nodes:a,edges:s,combos:o}=this.context.model.getData(),{element:l,model:c}=this.context,u=p=>l.getElement(p),d=n?p=>{var v;return!i&&(((v=p.style)===null||v===void 0?void 0:v.visibility)==="hidden"||c.getAncestorsData(p.id,Ar).some(wr)||c.getAncestorsData(p.id,Mt).some(wr))?!1:t(p)}:p=>{const v=te(p),m=u(v);return!m||jd(m)?!1:t(p)},h=a.filter(d),f=new Map(h.map(p=>[te(p),p]));o.forEach(p=>f.set(te(p),p));const g=s.filter(({source:p,target:v})=>f.has(p)&&f.has(v));return{nodes:h,edges:g,combos:o}}initGraphLayout(e){var t;const{element:n,viewport:i}=this.context,{type:a,enableWorker:s,animation:o,iterations:l}=e,c=IJ(e,["type","enableWorker","animation","iterations"]),[u,d]=i.getCanvasSize(),h=[u/2,d/2],f=(t=e==null?void 0:e.nodeSize)!==null&&t!==void 0?t: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=na("layout",a);if(!g)return Di.warn(`The layout of ${a} is not registered.`);const p=Object.getPrototypeOf(g.prototype)===Vd.prototype?g:U$(g,this.context),v=new p(this.context),m={nodeSize:f,width:u,height:d,center:h};switch(v.id){case"d3-force":case"d3-force-3d":Object.assign(m,{center:{x:u/2,y:d/2,z:0}});break}return hr(v.options,m,c),v}updateElementPosition(e,t){const{model:n,element:i}=this.context;return i?(n.updateData(e),i.draw({animation:t,silence:!0})):null}destroy(){var e;this.stopLayout(),this.context={},(e=this.supervisor)===null||e===void 0||e.kill(),this.supervisor=void 0,this.instance=void 0,this.instances=[],this.animationResult=void 0}}const oC=(r,e)=>{var t;const[n,i]=e;(t=r.nodes)===null||t===void 0||t.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 FJ(r){return[BJ].reduce((t,n)=>n(t),r)}function BJ(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 zJ extends Db{constructor(e){super(e),this.category="plugin",this.setPlugins(this.context.options.plugins||[])}setPlugins(e){this.setExtensions(e)}getPluginInstance(e){const t=this.extensionMap[e];if(t)return t;Di.warn(`Cannot find the plugin ${e}, will try to find it by type.`);const n=this.extensions.find(i=>i.type===e);if(n)return this.extensionMap[n.key]}}const _u=["update-related-edges","collapse-expand-node","collapse-expand-combo","get-edge-actual-ends","arrange-draw-order"];class jJ extends Db{constructor(e){super(e),this.category="transform",this.setTransforms(this.context.options.transforms||[])}getTransforms(){}setTransforms(e){this.setExtensions([..._u.slice(0,_u.length-1),...e,_u[_u.length-1]])}getTransformInstance(e){return e?this.extensionMap[e]:this.extensionMap}}var cl=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(d){s(d)}}function l(u){try{c(n.throw(u))}catch(d){s(d)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,e||[])).next())})};class $J{get padding(){return Fi(this.context.options.padding)}get paddingOffset(){const[e,t,n,i]=this.padding,[a,s,o]=[(i-t)/2,(e-n)/2,0];return[a,s,o]}constructor(e){this.landmarkCounter=0,this.context=e;const[t,n]=this.paddingOffset,{zoom:i,rotation:a,x:s=t,y:o=n}=e.options;this.transform({mode:"absolute",scale:i,translate:[s,o],rotate:a},!1)}get camera(){const{canvas:e}=this.context;return new Proxy(e.getCamera(),{get:(t,n)=>{const a=Object.entries(e.getLayers()).filter(([o])=>!["main"].includes(o)).map(([,o])=>o.getCamera()),s=t[n];if(typeof s=="function")return(...o)=>{const l=s.apply(t,o);return a.forEach(c=>{c[n].apply(c,o)}),l}}})}createLandmark(e){return this.camera.createLandmark(`landmark-${this.landmarkCounter++}`,e)}getAnimation(e){const t=uA(this.context.options,e);return t?xs(Object.assign({},t),["easing","duration"]):!1}getCanvasSize(){const{canvas:e}=this.context,{width:t=0,height:n=0}=e.getConfig();return[t,n]}getCanvasCenter(){const{canvas:e}=this.context,{width:t=0,height:n=0}=e.getConfig();return[t/2,n/2,0]}getViewportCenter(){const[e,t]=this.camera.getPosition();return[e,t,0]}getGraphCenter(){return this.context.graph.getViewportByCanvas(this.getCanvasCenter())}getZoom(){return this.camera.getZoom()}getRotation(){return this.camera.getRoll()}getTranslateOptions(e){const{camera:t}=this,{mode:n,translate:i=[]}=e,a=this.getZoom(),s=t.getPosition(),o=t.getFocalPoint(),[l,c]=this.getCanvasCenter(),[u=0,d=0,h=0]=i,f=di([-u,-d,-h],a);return n==="relative"?{position:Ze(s,f),focalPoint:Ze(o,f)}:{position:Ze([l,c,s[2]],f),focalPoint:Ze([l,c,o[2]],f)}}getRotateOptions(e){const{mode:t,rotate:n=0}=e;return{roll:t==="relative"?this.camera.getRoll()+n:n}}getZoomOptions(e){const{zoomRange:t}=this.context.options,n=this.camera.getZoom(),{mode:i,scale:a=1}=e;return an(i==="relative"?n*a:a,...t)}transform(e,t){return cl(this,void 0,void 0,function*(){const{graph:n}=this.context,{translate:i,rotate:a,scale:s,origin:o}=e;this.cancelAnimation();const l=this.getAnimation(t);if(Tn(n,new Su(we.BEFORE_TRANSFORM,e)),!a&&s&&!i&&o&&!l){this.camera.setZoomByViewportPoint(this.getZoomOptions(e),o),Tn(n,new Su(we.AFTER_TRANSFORM,e));return}const c={};if(i&&Object.assign(c,this.getTranslateOptions(e)),Ce(a)&&Object.assign(c,this.getRotateOptions(e)),Ce(s)&&Object.assign(c,{zoom:this.getZoomOptions(e)}),l)return Tn(n,new Ur(we.BEFORE_ANIMATE,mr.TRANSFORM,null,e)),new Promise(u=>{this.transformResolver=u,this.camera.gotoLandmark(this.createLandmark(c),Object.assign(Object.assign({},l),{onfinish:()=>{Tn(n,new Ur(we.AFTER_ANIMATE,mr.TRANSFORM,null,e)),Tn(n,new Su(we.AFTER_TRANSFORM,e)),this.transformResolver=void 0,u()}}))});this.camera.gotoLandmark(this.createLandmark(c),{duration:0}),Tn(n,new Su(we.AFTER_TRANSFORM,e))})}fitView(e,t){return cl(this,void 0,void 0,function*(){const[n,i,a,s]=this.padding,{when:o="always",direction:l="both"}=e||{},[c,u]=this.context.canvas.getSize(),d=c-s-i,h=u-n-a,f=this.context.canvas.getBounds(),g=this.getBBoxInViewport(f),[p,v]=Wa(g),m=l==="x"&&p>=d||l==="y"&&v>=h||l==="both"&&p>=d&&v>=h;if(o==="overflow"&&!m)return yield this.fitCenter({animation:t});const y=d/p,b=h/v,w=l==="x"?y:l==="y"?b:Math.min(y,b),E=this.getAnimation(t);yield this.transform({mode:"relative",scale:w,translate:Ze(St(this.getCanvasCenter(),this.getBBoxInViewport(f).center),di(this.paddingOffset,w))},E)})}fitCenter(e){return cl(this,void 0,void 0,function*(){const t=this.context.canvas.getBounds();yield this.focus(t,e)})}focusElements(e){return cl(this,arguments,void 0,function*(t,n={}){const{element:i}=this.context;if(!i)return;const a=o=>n.shapes?o.getShape(n.shapes).getRenderBounds():o.getRenderBounds(),s=cc(t.map(o=>a(i.getElement(o))));yield this.focus(s,n)})}focus(e,t){return cl(this,void 0,void 0,function*(){const n=this.context.graph.getViewportByCanvas(e.center),i=t.position||this.getCanvasCenter(),a=St(i,n);yield this.transform({mode:"relative",translate:Ze(a,this.paddingOffset)},t.animation)})}getBBoxInViewport(e){const{min:t,max:n}=e,{graph:i}=this.context,[a,s]=i.getViewportByCanvas(t),[o,l]=i.getViewportByCanvas(n),c=new Rt;return c.setMinMax([a,s,0],[o,l,0]),c}isInViewport(e,t=!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 Rt;return u.setMinMax([s,o,0],[l,c,0]),n&&(u=Va(u,n)),Ao(e)?ui(e,u):t?Uz(e,u):u.intersects(e)}cancelAnimation(){var e,t;!((e=this.camera.landmarks)===null||e===void 0)&&e.length&&this.camera.cancelLandmarkAnimation(),(t=this.transformResolver)===null||t===void 0||t.call(this)}}var At=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(d){s(d)}}function l(u){try{c(n.throw(u))}catch(d){s(d)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,e||[])).next())})};class Hh extends Wd{constructor(e){var t;super(),this.options={},this.rendered=!1,this.destroyed=!1,this.context={model:new RJ},this.isCollapsingExpanding=!1,this.onResize=nc(()=>{this.resize()},300),this._setOptions(Object.assign({},Hh.defaultOptions,e),!0),this.context.graph=this,this.options.autoResize&&((t=globalThis.addEventListener)===null||t===void 0||t.call(globalThis,"resize",this.onResize))}getOptions(){return this.options}setOptions(e){this._setOptions(e,!1)}_setOptions(e,t){if(this.updateCanvas(e),Object.assign(this.options,FJ(e)),t){const{data:h}=e;h&&this.addData(h);return}const{behaviors:n,combo:i,data:a,edge:s,layout:o,node:l,plugins:c,theme:u,transforms:d}=e;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),d&&this.setTransforms(d)}getSize(){return this.context.canvas?this.context.canvas.getSize():[this.options.width||0,this.options.height||0]}setSize(e,t){e&&(this.options.width=e),t&&(this.options.height=t),this.resize(e,t)}setZoomRange(e){this.options.zoomRange=e}getZoomRange(){return this.options.zoomRange}setNode(e){this.options.node=e,this.context.model.refreshData()}setEdge(e){this.options.edge=e,this.context.model.refreshData()}setCombo(e){this.options.combo=e,this.context.model.refreshData()}getTheme(){return this.options.theme}setTheme(e){this.options.theme=Ie(e)?e(this.getTheme()):e}setLayout(e){this.options.layout=Ie(e)?e(this.getLayout()):e}getLayout(){return this.options.layout}setBehaviors(e){var t;this.options.behaviors=Ie(e)?e(this.getBehaviors()):e,(t=this.context.behavior)===null||t===void 0||t.setBehaviors(this.options.behaviors)}updateBehavior(e){this.setBehaviors(t=>t.map(n=>typeof n=="object"&&n.key===e.key?Object.assign(Object.assign({},n),e):n))}getBehaviors(){return this.options.behaviors||[]}setPlugins(e){var t;this.options.plugins=Ie(e)?e(this.getPlugins()):e,(t=this.context.plugin)===null||t===void 0||t.setPlugins(this.options.plugins)}updatePlugin(e){this.setPlugins(t=>t.map(n=>typeof n=="object"&&n.key===e.key?Object.assign(Object.assign({},n),e):n))}getPlugins(){return this.options.plugins||[]}getPluginInstance(e){return this.context.plugin.getPluginInstance(e)}setTransforms(e){var t;this.options.transforms=Ie(e)?e(this.getTransforms()):e,(t=this.context.transform)===null||t===void 0||t.setTransforms(this.options.transforms)}updateTransform(e){this.setTransforms(t=>t.map(n=>typeof n=="object"&&n.key===e.key?Object.assign(Object.assign({},n),e):n)),this.context.model.refreshData()}getTransforms(){return this.options.transforms||[]}getData(){return this.context.model.getData()}getElementData(e){return Array.isArray(e)?e.map(t=>this.context.model.getElementDataById(t)):this.context.model.getElementDataById(e)}getNodeData(e){var t;return e===void 0?this.context.model.getNodeData():Array.isArray(e)?this.context.model.getNodeData(e):(t=this.context.model.getNodeData([e]))===null||t===void 0?void 0:t[0]}getEdgeData(e){var t;return e===void 0?this.context.model.getEdgeData():Array.isArray(e)?this.context.model.getEdgeData(e):(t=this.context.model.getEdgeData([e]))===null||t===void 0?void 0:t[0]}getComboData(e){var t;return e===void 0?this.context.model.getComboData():Array.isArray(e)?this.context.model.getComboData(e):(t=this.context.model.getComboData([e]))===null||t===void 0?void 0:t[0]}setData(e){this.context.model.setData(Ie(e)?e(this.getData()):e)}addData(e){this.context.model.addData(Ie(e)?e(this.getData()):e)}addNodeData(e){this.context.model.addNodeData(Ie(e)?e(this.getNodeData()):e)}addEdgeData(e){this.context.model.addEdgeData(Ie(e)?e(this.getEdgeData()):e)}addComboData(e){this.context.model.addComboData(Ie(e)?e(this.getComboData()):e)}addChildrenData(e,t){this.context.model.addChildrenData(e,t)}updateData(e){this.context.model.updateData(Ie(e)?e(this.getData()):e)}updateNodeData(e){this.context.model.updateNodeData(Ie(e)?e(this.getNodeData()):e)}updateEdgeData(e){this.context.model.updateEdgeData(Ie(e)?e(this.getEdgeData()):e)}updateComboData(e){this.context.model.updateComboData(Ie(e)?e(this.getComboData()):e)}removeData(e){this.context.model.removeData(Ie(e)?e(this.getData()):e)}removeNodeData(e){this.context.model.removeNodeData(Ie(e)?e(this.getNodeData()):e)}removeEdgeData(e){this.context.model.removeEdgeData(Ie(e)?e(this.getEdgeData()):e)}removeComboData(e){this.context.model.removeComboData(Ie(e)?e(this.getComboData()):e)}getElementType(e){return this.context.model.getElementType(e)}getRelatedEdgesData(e,t="both"){return this.context.model.getRelatedEdgesData(e,t)}getNeighborNodesData(e){return this.context.model.getNeighborNodesData(e)}getAncestorsData(e,t){return this.context.model.getAncestorsData(e,t)}getParentData(e,t){return this.context.model.getParentData(e,t)}getChildrenData(e){return this.context.model.getChildrenData(e)}getDescendantsData(e){return this.context.model.getDescendantsData(e)}getElementDataByState(e,t){return this.context.model.getElementDataByState(e,t)}initCanvas(){return At(this,void 0,void 0,function*(){var e;if(this.context.canvas)return yield this.context.canvas.ready;const{container:t="container",width:n,height:i,renderer:a,cursor:s,background:o,canvas:l,devicePixelRatio:c=(e=globalThis.devicePixelRatio)!==null&&e!==void 0?e:1}=this.options;if(t instanceof tC)this.context.canvas=t,s&&t.setCursor(s),a&&t.setRenderer(a),yield t.ready;else{const u=gt(t)?document.getElementById(t):t,d=iC(u);this.emit(we.BEFORE_CANVAS_INIT,{container:u,width:n,height:i});const h=Object.assign(Object.assign({},l),{container:u,width:n||d[0],height:i||d[1],background:o,renderer:a,cursor:s,devicePixelRatio:c}),f=new tC(h);this.context.canvas=f,yield f.ready,this.emit(we.AFTER_CANVAS_INIT,{canvas:f})}})}updateCanvas(e){var t,n;const{renderer:i,cursor:a,height:s,width:o}=e,l=this.context.canvas;l&&(i&&(this.emit(we.BEFORE_RENDERER_CHANGE,{renderer:this.options.renderer}),l.setRenderer(i),this.emit(we.AFTER_RENDERER_CHANGE,{renderer:i})),a&&l.setCursor(a),(Ce(o)||Ce(s))&&this.setSize((t=o!=null?o:this.options.width)!==null&&t!==void 0?t:0,(n=s!=null?s:this.options.height)!==null&&n!==void 0?n:0))}initRuntime(){this.context.options=this.options,this.context.batch||(this.context.batch=new CJ(this.context)),this.context.plugin||(this.context.plugin=new zJ(this.context)),this.context.viewport||(this.context.viewport=new $J(this.context)),this.context.transform||(this.context.transform=new jJ(this.context)),this.context.element||(this.context.element=new LJ(this.context)),this.context.animation||(this.context.animation=new OJ(this.context)),this.context.layout||(this.context.layout=new DJ(this.context)),this.context.behavior||(this.context.behavior=new NJ(this.context))}prepare(){return At(this,void 0,void 0,function*(){if(yield Promise.resolve(),this.destroyed)throw new Error(Ji("The graph instance has been destroyed"));yield this.initCanvas(),this.initRuntime()})}render(){return At(this,void 0,void 0,function*(){if(yield this.prepare(),Tn(this,new bn(we.BEFORE_RENDER)),this.options.layout)if(!this.rendered&&V$(this.options.layout)){const e=yield this.context.element.preLayoutDraw({type:"render"});yield Promise.all([e==null?void 0:e.finished,this.autoFit()])}else{const e=this.context.element.draw({type:"render"});yield Promise.all([e==null?void 0:e.finished,this.context.layout.postLayout()]),yield this.autoFit()}else{const e=this.context.element.draw({type:"render"});yield Promise.all([e==null?void 0:e.finished,this.autoFit()])}this.rendered=!0,Tn(this,new bn(we.AFTER_RENDER))})}draw(){return At(this,void 0,void 0,function*(){var e;yield this.prepare(),yield(e=this.context.element.draw())===null||e===void 0?void 0:e.finished})}layout(e){return At(this,void 0,void 0,function*(){yield this.context.layout.postLayout(e)})}stopLayout(){this.context.layout.stopLayout()}clear(){return At(this,void 0,void 0,function*(){const{model:e,element:t}=this.context;e.setData({}),e.clearChanges(),t==null||t.clear()})}destroy(){var e;Tn(this,new bn(we.BEFORE_DESTROY));const{layout:t,animation:n,element:i,model:a,canvas:s,behavior:o,plugin:l}=this.context;l==null||l.destroy(),o==null||o.destroy(),t==null||t.destroy(),n==null||n.destroy(),i==null||i.destroy(),a.destroy(),s==null||s.destroy(),this.options={},this.context={},this.off(),(e=globalThis.removeEventListener)===null||e===void 0||e.call(globalThis,"resize",this.onResize),this.destroyed=!0,Tn(this,new bn(we.AFTER_DESTROY))}getCanvas(){return this.context.canvas}resize(e,t){var n;const i=iC((n=this.context.canvas)===null||n===void 0?void 0:n.getContainer()),a=[e||i[0],t||i[1]];if(!this.context.canvas)return;const s=this.context.canvas.getSize();sn(a,s)||(Tn(this,new bn(we.BEFORE_SIZE_CHANGE,{size:a})),this.context.canvas.resize(...a),Tn(this,new bn(we.AFTER_SIZE_CHANGE,{size:a})))}fitView(e,t){return At(this,void 0,void 0,function*(){var n;yield(n=this.context.viewport)===null||n===void 0?void 0:n.fitView(e,t)})}fitCenter(e){return At(this,void 0,void 0,function*(){var t;yield(t=this.context.viewport)===null||t===void 0?void 0:t.fitCenter({animation:e})})}autoFit(){return At(this,void 0,void 0,function*(){const{autoFit:e}=this.context.options;if(e)if(gt(e))e==="view"?yield this.fitView():e==="center"&&(yield this.fitCenter());else{const{type:t,animation:n}=e;t==="view"?yield this.fitView(e.options,n):t==="center"&&(yield this.fitCenter(n))}})}focusElement(e,t){return At(this,void 0,void 0,function*(){var n;yield(n=this.context.viewport)===null||n===void 0?void 0:n.focusElements(Array.isArray(e)?e:[e],{animation:t})})}zoomBy(e,t,n){return At(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",scale:e,origin:n},t)})}zoomTo(e,t,n){return At(this,void 0,void 0,function*(){this.context.viewport.transform({mode:"absolute",scale:e,origin:n},t)})}getZoom(){return this.context.viewport.getZoom()}rotateBy(e,t,n){return At(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",rotate:e,origin:n},t)})}rotateTo(e,t,n){return At(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",rotate:e,origin:n},t)})}getRotation(){return this.context.viewport.getRotation()}translateBy(e,t){return At(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",translate:e},t)})}translateTo(e,t){return At(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",translate:e},t)})}getPosition(){return St([0,0],this.getCanvasByViewport([0,0]))}translateElementBy(e,t){return At(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=pn(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(l).forEach(([u,d])=>this.context.model.translateNodeLikeBy(u,d)),yield(o=this.context.element.draw({animation:c,stage:"translate"}))===null||o===void 0?void 0:o.finished})}translateElementTo(e,t){return At(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=pn(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(l).forEach(([u,d])=>this.context.model.translateNodeLikeTo(u,d)),yield(o=this.context.element.draw({animation:c,stage:"translate"}))===null||o===void 0?void 0:o.finished})}getElementPosition(e){return this.context.model.getElementPosition(e)}getElementRenderStyle(e){return bb(this.context.element.getElement(e).attributes,["context"])}setElementVisibility(e,t){return At(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=pn(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],u={nodes:[],edges:[],combos:[]};Object.entries(l).forEach(([f,g])=>{const p=this.getElementType(f);u[`${p}s`].push({id:f,style:{visibility:g}})});const{model:d,element:h}=this.context;d.preventUpdateNodeLikeHierarchy(()=>{d.updateData(u)}),yield(o=h.draw({animation:c,stage:"visibility"}))===null||o===void 0?void 0:o.finished})}showElement(e,t){return At(this,void 0,void 0,function*(){const n=Array.isArray(e)?e:[e];yield this.setElementVisibility(Object.fromEntries(n.map(i=>[i,"visible"])),t)})}hideElement(e,t){return At(this,void 0,void 0,function*(){const n=Array.isArray(e)?e:[e];yield this.setElementVisibility(Object.fromEntries(n.map(i=>[i,"hidden"])),t)})}getElementVisibility(e){var t,n;const i=this.context.element.getElement(e);return(n=(t=i==null?void 0:i.style)===null||t===void 0?void 0:t.visibility)!==null&&n!==void 0?n:"visible"}setElementZIndex(e,t){return At(this,void 0,void 0,function*(){var n;const i={nodes:[],edges:[],combos:[]},a=pn(e)?e:{[e]:t};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(e){return At(this,void 0,void 0,function*(){const t=Array.isArray(e)?e:[e],{model:n}=this.context,i={};t.map(a=>{const s=n.getFrontZIndex(a);if(n.getElementType(a)==="combo"){const l=n.getAncestorsData(a,Mt).at(-1)||this.getComboData(a),c=[l,...n.getDescendantsData(te(l))],u=s-aC(l);c.forEach(h=>{i[te(h)]=this.getElementZIndex(te(h))+u});const{internal:d}=L1(c.map(te),h=>n.getRelatedEdgesData(h));d.forEach(h=>{const f=te(h);i[f]=this.getElementZIndex(f)+u})}else i[a]=s}),yield this.setElementZIndex(i)})}getElementZIndex(e){return aC(this.context.model.getElementDataById(e))}setElementState(e,t){return At(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=pn(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],u=h=>h?Array.isArray(h)?h:[h]:[],d={nodes:[],edges:[],combos:[]};Object.entries(l).forEach(([h,f])=>{const g=this.getElementType(h);d[`${g}s`].push({id:h,states:u(f)})}),this.updateData(d),yield(o=this.context.element.draw({animation:c,stage:"state"}))===null||o===void 0?void 0:o.finished})}getElementState(e){return this.context.model.getElementState(e)}getElementRenderBounds(e){return this.context.element.getElement(e).getRenderBounds()}collapseElement(e){return At(this,arguments,void 0,function*(t,n=!0){const{model:i,element:a}=this.context;if(wr(i.getNodeLikeData([t])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!0});const s=i.getElementType(t);yield this.frontElement(t),this.isCollapsingExpanding=!0,this.setElementCollapsibility(t,!0),s==="node"?yield a.collapseNode(t,n):s==="combo"&&(yield a.collapseCombo(t,!!n.animation)),this.isCollapsingExpanding=!1})}expandElement(e){return At(this,arguments,void 0,function*(t,n=!0){const{model:i,element:a}=this.context;if(!wr(i.getNodeLikeData([t])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!0});const s=i.getElementType(t);this.isCollapsingExpanding=!0,this.setElementCollapsibility(t,!1),s==="node"?yield a.expandNode(t,n):s==="combo"&&(yield a.expandCombo(t,!!n.animation)),this.isCollapsingExpanding=!1})}setElementCollapsibility(e,t){const n=this.getElementType(e);n==="node"?this.updateNodeData([{id:e,style:{collapsed:t}}]):n==="combo"&&this.updateComboData([{id:e,style:{collapsed:t}}])}toDataURL(){return At(this,arguments,void 0,function*(e={}){return this.context.canvas.toDataURL(e)})}getCanvasByViewport(e){return this.context.canvas.getCanvasByViewport(e)}getViewportByCanvas(e){return this.context.canvas.getViewportByCanvas(e)}getClientByCanvas(e){return this.context.canvas.getClientByCanvas(e)}getCanvasByClient(e){return this.context.canvas.getCanvasByClient(e)}getViewportCenter(){return this.context.viewport.getViewportCenter()}getCanvasCenter(){return this.context.viewport.getCanvasCenter()}on(e,t,n){return super.on(e,t,n)}once(e,t){return super.once(e,t)}off(e,t){return super.off(e,t)}}Hh.defaultOptions={autoResize:!1,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};var qJ=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};function GJ(r,e){const{getNodeData:t=(o,l)=>{if(o.depth=l,!o.children)return o;const{children:c}=o,u=qJ(o,["children"]);return Object.assign(Object.assign({},u),{children:c.map(d=>d.id)})},getEdgeData:n=(o,l)=>({source:o.id,target:l.id}),getChildren:i=o=>o.children||[]}={},a=[],s=[];return vs(r,(o,l)=>{a.push(t(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 WJ extends Xa{beforeDraw(e){const{add:t,update:n}=e,{model:i}=this.context;return[...t.edges.entries(),...n.edges.entries()].forEach(([,a])=>{$L(i,a)}),e}}const $L=(r,e)=>{const{source:t,target:n}=e,i=r.getElementDataById(t),a=r.getElementDataById(n),s=wE(i,d=>r.getParentData(d,Mt)),o=wE(a,d=>r.getParentData(d,Mt)),l=te(s),c=te(o),u={sourceNode:l,targetNode:c};return e.style?Object.assign(e.style,u):e.style=u,e},VJ=(r,e,t)=>{const[n,i]=e,[a,s]=t;if(i===n)return a;const o=(r-n)/(i-n);return a+o*(s-a)},UJ=(r,e,t)=>{const[n,i]=e,[a,s]=t,o=Math.log(r-n+1)/Math.log(i-n+1);return a+o*(s-a)},HJ=(r,e,t,n=2)=>{const[i,a]=e,[s,o]=t,l=Math.pow((r-i)/(a-i),n);return s+l*(o-s)},YJ=(r,e,t)=>{const[n,i]=e,[a,s]=t,o=Math.sqrt((r-n)/(i-n));return a+o*(s-a)};class Yh extends Xa{constructor(e,t){super(e,hr({},Yh.defaultOptions,t)),this.assignSizeByCentrality=(n,i,a,s,o,l)=>{const c=[i,a],u=[s[0],o[0]],d=[s[1],o[1]],h=[s[2],o[2]],f=(g,p)=>{if(typeof l=="function")return l(g,c,p);switch(l){case"linear":return VJ(g,c,p);case"log":return UJ(g,c,p);case"pow":return HJ(g,c,p,2);case"sqrt":return YJ(g,c,p);default:return p[0]}};return[f(n,u),f(n,d),f(n,h)]}}beforeDraw(e){const{model:t}=this.context,n=t.getNodeData(),i=Ir(this.options.maxSize),a=Ir(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 d=this.assignSizeByCentrality(s.get(te(c))||0,l,o,a,i,this.options.scale),h=(u=this.context.element)===null||u===void 0?void 0:u.getElement(te(c)),f={size:d};this.assignLabelStyle(f,d,c,h),(!h||!Du(f,h.attributes))&&Lr(e,h?"update":"add","node",hr(c,{style:f}),!0)}),e}assignLabelStyle(e,t,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(e,xs(s,["labelFontSize","labelLineHeight"])),this.options.mapLabelSize){const o=this.getLabelSizeByNodeSize(t,1/0,Number(e.labelFontSize));Object.assign(e,{labelFontSize:o,labelLineHeight:o+Vz(e.labelPadding)})}return e}getLabelSizeByNodeSize(e,t,n){const i=Math.min(...e)/2,[a,s]=Array.isArray(this.options.mapLabelSize)?this.options.mapLabelSize:[n,t];return Math.min(s,Math.max(i,a))}getCentralities(e){const{model:t}=this.context,n=t.getData();if(typeof e=="function")return e(n);const i=t.getRelatedEdgesData.bind(t);return wA(n,i,e)}}Yh.defaultOptions={centrality:{type:"degree"},maxSize:80,minSize:20,scale:"linear",mapLabelSize:!1};class Kh extends Xa{constructor(e,t){super(e,Object.assign({},Kh.defaultOptions,t))}get ref(){return this.context.model.getRootsData()[0]}afterLayout(){var e;const t=On(this.ref),{graph:n,model:i}=this.context;(e=i.getData().nodes)===null||e===void 0||e.forEach(s=>{var o;if(te(s)===te(this.ref))return;const l=SA(St(On(s),t)),c=Math.abs(l)>Math.PI/2,u=!s.children||s.children.length===0,d=te(s),h=(o=this.context.element)===null||o===void 0?void 0:o.getElement(d);if(!h||!h.isVisible())return;const f=Ir(n.getElementRenderStyle(d).size)[0]/2,g=(u?1:-1)*(f+this.options.offset),p=[["translate",g*Math.cos(l),g*Math.sin(l)],["rotate",c?br(l)+180:br(l)]];i.updateNodeData([{id:te(s),style:{labelTextAlign:c===u?"right":"left",labelTextBaseline:"middle",labelTransform:p}}])}),n.draw()}}Kh.defaultOptions={offset:5};const KJ="quadratic",lC=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class Xh extends Xa{constructor(e,t){super(e,Object.assign({},Xh.defaultOptions,t)),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,d=(g,p)=>{c.getRelatedEdgesData(p).forEach(m=>!u.has(te(m))&&u.set(te(m),m))};a.forEach(d),o.forEach(d);const h=g=>{const p=c.getEdgeData().map(m=>$L(c,m));XJ(g,p).forEach(m=>!u.has(te(m))&&u.set(te(m),m))};if(l.size&&l.forEach(h),i.size&&i.forEach(h),s.size){const g=QR(wx(c.getChanges())).update.edges;s.forEach(p=>{var v;h(p);const m=(v=g.find(y=>te(y.value)===te(p)))===null||v===void 0?void 0:v.original;m&&!Dx(p,m)&&h(m)})}ki(this.options.edges)||u.forEach((g,p)=>!this.options.edges.includes(p)&&u.delete(p));const f=c.getEdgeData().map(te);return new Map([...u].sort((g,p)=>f.indexOf(g[0])-f.indexOf(p[0])))},this.applyBundlingStyle=(n,i,a)=>{const{edgeMap:s,reverses:o}=cC(i);s.forEach(l=>{l.forEach((c,u,d)=>{var h;const f=d.length,g=c.style||{};if(c.source===c.target){const m=lC.length;g.loopPlacement=lC[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 p=Object.assign(c,{type:KJ,style:g}),v=(h=this.context.element)===null||h===void 0?void 0:h.getElement(te(c));(!v||!Du(p.style,v.attributes))&&Lr(n,v?"update":"add","edge",p,!0)})})},this.resetEdgeStyle=n=>{const i=n.style||{},a=this.cacheMergeStyle.get(te(n))||{};return Object.keys(a).forEach(s=>{sn(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}=cC(i);a.forEach(o=>{var l;if(o.length===1){const u=o[0],d=(l=this.context.element)===null||l===void 0?void 0:l.getElement(te(u)),h=this.resetEdgeStyle(u);(!d||!Du(h,d.attributes))&&Lr(n,d?"update":"add","edge",h);return}const c=o.map(({source:u,target:d,style:h={}},f)=>{const{startArrow:g,endArrow:p}=h,v={},[m,y]=s[`${u}|${d}|${f}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return Wu(g)&&(v[m]=g),Wu(p)&&(v[y]=p),v}).reduce((u,d)=>Object.assign(Object.assign({},u),d),{});o.forEach((u,d,h)=>{var f;if(d!==0){Lr(n,"remove","edge",u);return}const g=Object.assign({},Ie(this.options.style)?this.options.style(h):this.options.style,{childrenData:h});this.cacheMergeStyle.set(te(u),g);const p=Object.assign(Object.assign({},u),{type:"line",style:Object.assign(Object.assign(Object.assign({},u.style),c),g)}),v=(f=this.context.element)===null||f===void 0?void 0:f.getElement(te(u));(!v||!Du(p.style,v.attributes))&&Lr(n,v?"update":"add","edge",p,!0)})})}}beforeDraw(e){const t=this.getAffectedParallelEdges(e);return t.size===0||(this.options.mode==="bundle"?this.applyBundlingStyle(e,t,this.options.distance):this.applyMergingStyle(e,t)),e}}Xh.defaultOptions={mode:"bundle",distance:15};const cC=r=>{const e=new Map,t=new Set,n={};for(const[i,a]of r){if(t.has(i))continue;const{source:s,target:o}=a,l=`${s}-${o}`;e.has(l)||e.set(l,[]),e.get(l).push(a),t.add(i);for(const[c,u]of r)t.has(c)||Dx(a,u)&&(e.get(l).push(u),t.add(c),s===u.target&&o===u.source&&(n[`${u.source}|${u.target}|${e.get(l).length-1}`]=!0))}return{edgeMap:e,reverses:n}},XJ=(r,e,t)=>e.filter(n=>Dx(n,r)),Dx=(r,e)=>{const{sourceNode:t,targetNode:n}=r.style||{},{sourceNode:i,targetNode:a}=e.style||{};return t===i&&n===a||t===a&&n===i};class ZJ extends Xa{beforeDraw(e,t){const{stage:n}=t;if(n==="visibility")return e;const{model:i}=this.context,{update:{nodes:a,edges:s,combos:o}}=e,l=(c,u)=>{i.getRelatedEdgesData(u).forEach(h=>!s.has(te(h))&&s.set(te(h),h))};return a.forEach(l),o.forEach(l),e}}const JJ={animation:{"combo-collapse":gA,"combo-expand":qz,"node-collapse":hA,"node-expand":jz,"path-in":fA,"path-out":$z,fade:Bz,translate:zz},behavior:{"brush-select":uc,"click-select":Nd,"collapse-expand":$d,"create-edge":qd,"drag-canvas":Gd,"drag-element-force":Y$,"drag-element":pc,"fix-element-size":Ud,"focus-element":Hd,"hover-activate":Yd,"lasso-select":X$,"auto-adapt-label":Td,"optimize-viewport-transform":Kd,"scroll-canvas":Xd,"zoom-canvas":Zd},combo:{circle:H8,rect:Y8},edge:{cubic:Is,line:tP,polyline:zd,quadratic:gc,"cubic-horizontal":Dd,"cubic-radial":Fd,"cubic-vertical":Bd},layout:{"antv-dagre":Jq,"combo-combined":cW,"compact-box":hu.compactBox,"d3-force":IW,"force-atlas2":QU,circular:tG,concentric:$1,dagre:bh,dendrogram:hu.dendrogram,fishbone:xh,force:CP,fruchterman:nH,grid:iH,indented:hu.indented,mds:AP,mindmap:hu.mindmap,radial:fH,random:xH,snake:wh},node:{circle:fc,diamond:Xj,ellipse:Rd,hexagon:t8,html:Ld,image:YA,rect:V8,star:U8,donut:Pd,triangle:Id},palette:{spectral:DH,tableau:FH,oranges:BH,greens:zH,blues:jH},theme:{dark:pJ,light:yJ},plugin:{"bubble-sets":_h,"edge-bundling":Mh,"edge-filter-lens":Th,"grid-line":Nh,background:Eh,contextmenu:kh,fisheye:Oh,fullscreen:Ch,history:Ah,hull:Ph,legend:zh,minimap:jh,snapline:$h,timebar:qh,toolbar:Gh,tooltip:Wh,watermark:Vh},transform:{"arrange-draw-order":bJ,"collapse-expand-combo":xJ,"collapse-expand-node":wJ,"get-edge-actual-ends":WJ,"map-node-size":Yh,"place-radial-labels":Kh,"process-parallel-edges":Xh,"update-related-edges":ZJ},shape:{circle:sa,ellipse:sc,group:An,html:oc,image:$b,line:Ss,path:Pr,polygon:Rs,polyline:kd,rect:Yn,text:Ls,label:Ua,badge:Fo}};function QJ(){Object.entries(JJ).forEach(([r,e])=>{Object.entries(e).forEach(([t,n])=>{zL(r,t,n)})})}QJ();const Al=class Al extends gc{onCreate(){this.shapeMap.key.animate([{lineDashOffset:Al.lineDashGap*2},{lineDashOffset:0}],{duration:500,iterations:1/0,delay:0})}};Nt(Al,"tyoe","ant-quadratic"),Nt(Al,"lineDashGap",5);let ys=Al;zL(No.EDGE,ys.tyoe,ys,!0);const eQ=pt({__name:"TrackGraph",props:{nodes:{},queryResult:{},showUnitResults:{},filterUnitResults:{}},setup(r){const e=r,t=Xt(),n=v=>e.nodes[v],i=$e(()=>bI(e.queryResult.unitResults.asJsReadonlyArrayView().flatMap(v=>v.context.toArray()),v=>v.id)),a=$e(()=>l3(e.nodes,i.value)),s=v=>({id:v.id.toString(),children:a.value.getChildren(v).map(s)}),o=$e(()=>GJ(s(a.value.topNode))),l=v=>a.value.getChildren(v).length>0,c=$e(()=>{const v={},m={},y=N=>{const A=`#${N.source.id}-${N.target.id}`,P=v[A]||0;v[A]=P+1;const L=A+(P>0?`-${P}`:"");return m[L]=N,{id:L,source:String(N.source.id),target:String(N.target.id)}},w=e.showUnitResults.map(N=>({result:N,pathList:N.getNodeConnectPath(n3).asJsReadonlyArrayView().concat()})).map(({result:N,pathList:A})=>{const P=A.map(L=>y(L));return{result:N,edgeGroup:P}}),E=w.flatMap(N=>N.edgeGroup),_=N=>m[N.id].formatConnectOffset,O=N=>w.findIndex(A=>A.edgeGroup.some(P=>P.id===N.id));return{groupList:w,edgeList:E,getLabel:_,getColor:N=>{const A=e.showUnitResults.indexOf(w[O(N)].result);return uo[A%uo.length]},getGroupIndex:O}}),u=v=>{var m;return((m=v.id)==null?void 0:m[0])==="#"},d=(v,m,y,b)=>Math.sqrt(Math.pow(Math.abs(v-y),2)+Math.pow(Math.abs(m-b),2)),h=(v,m)=>{var w,E,_,O;const y=v.getNodeData(m.source),b=v.getNodeData(m.target);return d(((w=y.style)==null?void 0:w.x)||0,((E=y.style)==null?void 0:E.y)||0,((_=b.style)==null?void 0:_.x)||0,((O=b.style)==null?void 0:O.y)||0)},f=/\d+/,g=Tt();Rl(()=>{g.value&&g.value.destroy()}),Mi(t,async()=>{if(!t.value)return;const v=new Hh({container:t.value,data:o.value,autoFit:"view",padding:[24,48],animation:!1,node:{type(m){const y=n(m.id);return l(y)?"triangle":"rect"},style(m){const y=n(m.id),b=e.queryResult.target.id===y.id,w=a.value.isPlaceholder(y),E=c3(y);return{size:l(y)?4:1,direction:l(y)?"down":void 0,fill:l(y)?"#767C82":"#E3E3E3",pointerEvents:"none",labelPlacement:"right",labelText:a.value.getLabel(y),labelOffsetX:2,labelFontWeight:E&&!w?"bold":void 0,labelOpacity:w?.5:void 0,labelPointerEvents:"none",labelStroke:b?"#0FF":void 0}}},edge:{type(m){return u(m)?ys.tyoe:"polyline"},style(m){if(u(m)){const y=h(v,m),b=c.value.getLabel(m),w=b.match(f);return{curveOffset:30*(Number(m.source)>Number(m.target)?1:-1),stroke:c.value.getColor(m)||"#FF7FFF",zIndex:1+c.value.getGroupIndex(m),pointerEvents:"none",endArrow:!0,endArrowOpacity:.5,endArrowPointerEvents:"none",labelText:b,labelFill:"#F00",labelFontSize:w&&y<50?8:12,labelBackground:!0,labelBackgroundStroke:"#FF00FF",labelPadding:w?[0,1,-2,0]:[0,0,-1,0],labelBackgroundLineWidth:1,labelBackgroundRadius:2,labelBackgroundPointerEvents:"none",labelOffsetX:y<50?-5:0,labelPointerEvents:"none",lineDash:[ys.lineDashGap,ys.lineDashGap]}}return{router:{type:"orth"},stroke:"#E3E3E3",pointerEvents:"none"}}},layout:{type:"indented",direction:"LR",indent:20,getHeight:()=>0},behaviors:["drag-canvas","zoom-canvas"]});await v.render(),g.value=v});const p=$e(()=>{const v=e.filterUnitResults;return v!=null&&v.length?c.value.groupList.filter(m=>v.includes(m.result)).flatMap(m=>m.edgeGroup):[]});return Mi([g,p],async([v,m],[y,b])=>{if(v){if(m!==b){const w=b.filter(_=>!m.some(O=>O.id===_.id)),E=m.filter(_=>!b.some(O=>O.id===_.id));if(!w.length&&!E.length)return;v.removeEdgeData(w.map(_=>_.id)),await v.draw(),v.addEdgeData(E)}else v.addEdgeData(m);await v.draw()}}),(v,m)=>(We(),jt("div",{class:"TrackGraph",ref_key:"el",ref:t},null,512))}}),tQ={class:"TrackCard",flex:"","flex-col":"","h-full":"","p-12px":"","box-border":"","gap-8px":"","overflow-hidden":""},nQ={flex:"","justify-between":"","items-center":""},rQ={"flex-1":"",flex:"","gap-12px":"","overflow-hidden":""},iQ={"self-stretch":"",flex:"[2]"},aQ={"mb-24px":"","break-all":"","px-4px":"","py-2px":"","leading-20px":"",bg:"#eee",gkd_code:""},sQ={flex:"","flex-col":"","gap-12px":""},oQ={key:0,flex:"","gap-8px":""},lQ=["onClick"],cQ=pt({__name:"TrackCard",props:{nodes:{},queryResult:{},selector:{},onClose:{type:Function,default:So}},setup(r){const e=r,t=$e(()=>e.queryResult?e.queryResult.unitResults.asJsReadonlyArrayView().concat():[]),n=$e(()=>t.value.filter(l=>!l.context.prev)),i=$e(()=>t.value.filter(l=>l.context.prev)),a=Tt([]);ii(()=>{a.value=i.value});const s=l=>{a.value.includes(l)?a.value=a.value.filter(c=>c!==l):a.value=a.value.concat(l)},o=l=>{const c=l.value;return c instanceof zx&&t.value.some(u=>u.expression===c)&&!l.outChildren.some(u=>u.value instanceof zx)?{outline:"1px solid #00F"}:""};return(l,c)=>{const u=bs("SvgIcon"),d=Io,h=vb;return We(),jt("div",tQ,[Le("div",nQ,[c[0]||(c[0]=Le("div",{text:"20px/28px","font-bold":""},"选择器路径视图",-1)),Ee(d,{text:"",onClick:l.onClose},{default:xe(()=>[Ee(u,{name:"close",h:"20px"})]),_:1},8,["onClick"])]),Le("div",rQ,[Le("div",iQ,[l.nodes.length&&l.queryResult?(We(),rn(eQ,{key:0,nodes:l.nodes,queryResult:l.queryResult,showUnitResults:se(i),filterUnitResults:se(a),class:"h-[calc(100%-2px)] b-1px b-solid"},null,8,["nodes","queryResult","showUnitResults","filterUnitResults"])):Nn("",!0),c[1]||(c[1]=Le("div",{relative:"","pointer-events-none":"","z-1":""},[Le("div",{absolute:"","left-8px":"","bottom-8px":"",text:"12px/14px #6C6E71"}," *为简化视图已隐藏无关节点 ")],-1))]),Ee(h,{class:"self-stretch flex-1"},{default:xe(()=>[Le("div",aQ,[Ee(ku,{class:"gkd_code",source:l.selector.source,node:l.selector.ast,getNodeStyle:o},null,8,["source","node"])]),Le("div",sQ,[se(n).length?(We(),jt("div",oQ,[(We(!0),jt(oi,null,ds(se(n),(f,g)=>(We(),jt("div",{key:g,"break-all":"","px-4px":"","py-2px":"",gkd_code:"","b-1px":"","b-solid":"",b:"#ccc"},[Ee(ku,{class:"gkd_code",source:l.selector.source,node:l.selector.findAst(f.expression)},null,8,["source","node"])]))),128))])):Nn("",!0),(We(!0),jt(oi,null,ds(se(i),(f,g)=>(We(),jt("div",{key:g,"cursor-pointer":"","break-all":"","px-4px":"","py-2px":"",gkd_code:"","b-1px":"","b-solid":"","transition-colors":"",onClick:p=>s(f),style:Ri({borderColor:se(uo)[g%se(uo).length],backgroundColor:se(a).includes(f)?"#eee":void 0})},[Le("div",{"inline-block":"","align-middle":"","size-16px":"",style:Ri({backgroundColor:se(uo)[g%se(uo).length]})},null,4),c[2]||(c[2]=Le("span",{"pl-4px":""},null,-1)),Ee(ku,{class:"gkd_code",source:l.selector.source,node:l.selector.findAst(f.expression)},null,8,["source","node"])],12,lQ))),128))])]),_:1})])])}}}),uQ=pt({__name:"TrackModal",props:{data:{},show:{type:Boolean},onUpdateShow:{type:Function,default:So},onUpdateData:{type:Function,default:So}},setup(r){const e=r,t=Xt(!1),n=Xt(0);return Ky(()=>e.show,async()=>{e.show?(t.value=!0,n.value=-1,await new Promise(i=>setTimeout(i,300)),n.value=0):(n.value=1,await new Promise(i=>setTimeout(i,300)),t.value=!1,n.value=0,e.onUpdateData())}),P3("keyup",i=>{i.key==="Escape"&&e.onUpdateShow(!1)}),(i,a)=>se(t)?(We(),jt("div",{key:0,class:Ll(["TrackModal",{"track-model-enter":se(n)===-1,"track-model-exit":se(n)===1}]),absolute:"","left-0":"","top-0":"","bg-white":"","z-3000":"",w:"[--gkd-w]",h:"[--gkd-h]"},[i.data?(We(),rn(cQ,R3({key:0},i.data,{onClose:a[0]||(a[0]=s=>i.onUpdateShow(!1))}),null,16)):Nn("",!0)],2)):Nn("",!0)}}),dQ=V3(uQ,[["__scopeId","data-v-66dad45d"]]),uC=r=>{const e=Tt(),t={x:0,y:0},n=gb({...t});let i;const a=u=>{i&&u.preventDefault()},s=u=>{i=u,t.x=n.x,t.y=n.y},o=u=>{if(!i||!e.value)return;const d=u.clientX-i.clientX,h=u.clientY-i.clientY;r(d)&&(n.x=t.x+d),n.y=t.y+h},l=()=>{i=void 0},c=()=>{if(!e.value||!i)return;l();const{top:u,bottom:d,left:h,right:f}=e.value.getBoundingClientRect();(f<0||h>window.innerWidth||d<0||u>window.innerHeight)&&(n.x=t.x,n.y=t.y)};return xd(()=>{window.addEventListener("pointermove",o),window.addEventListener("pointerup",c),document.addEventListener("selectstart",a)}),Rl(()=>{window.removeEventListener("pointermove",o),window.removeEventListener("pointerup",c),document.removeEventListener("selectstart",a),l()}),Mi(e,(u,d)=>{u&&(u.addEventListener("pointerdown",s),u.addEventListener("pointerup",l)),d&&(d.removeEventListener("pointerdown",s),d.removeEventListener("pointerup",l))}),Rl(()=>{e.value&&(e.value.removeEventListener("pointerdown",s),e.value.removeEventListener("pointerup",l))}),{target:e,offset:n}};let ul=1e3;const hQ=()=>{ul++;const r=Tt(ul);return{zIndex:r,setTop:()=>{r.value!==ul&&(ul++,r.value=ul)}}},dC="transition-top,bottom,left,right-500",Zh=pt({__name:"DraggableCard",props:{initialValue:{default:()=>({})},minWidth:{},sizeDraggable:{type:Boolean},show:{type:Boolean,default:!0},class:{}},setup(r){var E,_;const e=r,t=e.initialValue.left!==void 0,n=e.initialValue.top!==void 0,i={x:(E=t?e.initialValue.left:e.initialValue.right)!=null?E:0,y:(_=n?e.initialValue.top:e.initialValue.bottom)!=null?_:0},a=uC(O=>{const M=(e.initialValue.width||0)+s.offset.x+-a.offset.x-O;return(e.minWidth||0)<M}),s=uC(O=>{const M=(e.initialValue.width||0)+s.offset.x+O-a.offset.x;return(e.minWidth||0)<M}),o=gb({...i}),l=$e(()=>{const O=(e.initialValue.width||0)+s.offset.x-a.offset.x,M=e.initialValue.width?`width:${O}px;`:"",N=n?`top:${o.y}px;`:`bottom:${o.y}px;`;return t?`left:${o.x-a.offset.x}px;`+N+M:`right:${o.x-s.offset.x}px;`+N+M});let c;const u=Tt(!1),d=O=>{c=O,i.x=o.x,i.y=o.y,u.value=!1},h=O=>{if(!p.value||!c)return;const M=O.clientX-c.clientX,N=O.clientY-c.clientY;o.x=i.x+(t?M:-M),o.y=i.y+(n?N:-N),u.value=!0},f=()=>{c=void 0},g=Tt(),p=Tt(),v=O=>{c&&O.preventDefault()},m=()=>{if(!p.value||!c)return;f();const{top:O,bottom:M,left:N,right:A}=p.value.getBoundingClientRect();if(A<0||N>window.innerWidth||M<0||O>window.innerHeight){o.x=i.x,o.y=i.y;const P=g.value;P&&(P.classList.add(dC),setTimeout(()=>{P.classList.remove(dC)},550))}};xd(()=>{window.addEventListener("pointermove",h),window.addEventListener("pointerup",m),document.addEventListener("selectstart",v)}),Rl(()=>{window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",m),document.removeEventListener("selectstart",v),f()}),Mi(p,(O,M)=>{O&&(O.addEventListener("pointerdown",d),O.addEventListener("pointerup",f)),M&&(M.removeEventListener("pointerdown",d),M.removeEventListener("pointerup",f))}),Rl(()=>{p.value&&(p.value.removeEventListener("pointerdown",d),p.value.removeEventListener("pointerup",f))});const y=O=>{O instanceof HTMLElement?p.value=O:p.value=void 0},{setTop:b,zIndex:w}=hQ();return Mi(()=>e.show,()=>{e.show&&b()}),(O,M)=>(We(),rn(xC,{to:"body"},[O.show?(We(),jt("div",{key:0,fixed:"",ref_key:"box",ref:g,class:Ll(["DraggableCard",e.class]),style:Ri([se(l),{zIndex:se(w)}]),onMousedown:M[0]||(M[0]=(...N)=>se(b)&&se(b)(...N))},[L3(O.$slots,"default",{onRef:y,moved:se(u)}),O.sizeDraggable?(We(),jt(oi,{key:0},[Le("div",{ref:se(a).target,absolute:"","right-full":"","top-0":"","bottom-0":"","w-5px":"","cursor-ew-resize":""},null,512),Le("div",{ref:se(s).target,absolute:"","left-full":"","top-0":"","bottom-0":"","w-5px":"","cursor-ew-resize":""},null,512)],64)):Nn("",!0)],38)):Nn("",!0)]))}}),fQ=async r=>fetch("https://detect.gkd.li/api/getImportId?id="+r).then(e=>e.json()).catch(()=>0),$s=I3("snapshot",()=>{const r=wC(),e=EC(),t=D3(),n=SC(),{snapshotImportId:i,snapshotImageId:a,importSnapshotId:s}=n,o=Tt();Ky(()=>r.params.snapshotId,I=>{o.value=F3(I)});const l=$e(()=>{if(o.value)return i[o.value]}),c=$e(()=>{if(o.value)return a[o.value]}),u=Tt();ii(()=>{u.value&&(document.title="快照-"+(Ei(u.value).name||u.value.appId))});const d=Tt(),h=$e(()=>{if(d.value)return URL.createObjectURL(new Blob([d.value],{type:"image/png"}))}),f=Tt(!1),g=rI(async I=>{if(f.value=!1,!I){u.value=void 0,d.value=void 0;return}if(await Promise.all([X3.getItem(I).then(G=>{u.value=G||void 0}),Z3.getItem(I).then(G=>{d.value=G||void 0})]),!u.value){const G=i[I]||await fQ(I);if(G&&Number.isSafeInteger(G)){f.value=!0,e.replace({path:"/i/"+G,query:r.query});return}}}),p=$e(()=>g.loading);Ky(()=>o.value,g.invoke),ii(()=>{l.value&&n.inited&&!s[l.value]&&o.value&&(s[l.value]=o.value,fetch("https://detect.gkd.li/api/detectSnapshot?importId="+l.value))});const v=$e(()=>J3()&&t.inited&&t.autoUploadImport&&n.inited);ii(()=>{v.value&&u.value&&!c.value&&U3(u.value),v.value&&u.value&&!l.value&&H3(u.value),v.value&&u.value&&l.value&&Y3(u.value.id,l.value)});const m=$e(()=>u.value&&t.inited?u.value.nodes.length<=t.maxShowNodeSize?structuredClone(u.value.nodes):structuredClone(u.value.nodes.slice(0,t.maxShowNodeSize)):[]),y=$e(()=>{if(m.value.length)return u3(m.value)}),b=$e(()=>u.value?u.value.nodes.length-t.maxShowNodeSize:0),w=Tt(),E=Tt(0),_=Tt(),O=Tt(),M=async I=>{w.value=I,E.value=Date.now(),await co(),O.value&&!O.value.includes(I)&&(_.value=void 0,O.value=void 0)};ii(()=>{y.value&&M(y.value)});const N=I=>{_.value=I;const G=d3(m.value,_.value);G.length&&M(G[0]),G.length>1&&(O.value=G)},A=Xt(!1),P=Tt();return{snapshotId:o,snapshot:u,rootNode:y,screenshotUrl:h,loading:p,redirected:f,importId:l,imageId:c,focusNode:w,updateFocusNode:M,focusTime:E,overlapNodes:O,missNodeSize:b,focusPosition:_,updatePosition:N,trackData:P,trackShow:A,showTrack:(I,G)=>{A.value=!0,P.value={selector:I,nodes:m.value,queryResult:G}}}}),gQ={absolute:"","top-0":"","right-0":"","pt-4px":"","pr-8px":""},vQ={key:0,flex:"","justify-between":"","items-center":""},pQ={flex:"","items-center":"","h-24px":"","px-2px":""},mQ={"max-w-500px":""},yQ=pt({__name:"AttrCard",props:{show:{type:Boolean},onUpdateShow:{type:Function,default:So}},setup(r){const{focusNode:e}=Ns($s()),t=$e(()=>{const s=e.value;return s?{_id:{desc:"虚拟属性(真机不可用):生成快照访问节点顺序",type:"info",show:!0},_pid:{desc:"虚拟属性(真机不可用):父节点的 _id",type:"info",show:!0},_selector:{desc:"自动生成的选择器, 点击“_selector”可直接复制内容, 用于定位",type:"info",show:!0},depth:{desc:"使用此属性在某些应用上可能造成无限节点错误",type:"info",show:!0},id:{desc:"可快速查找",type:"quickFind",show:!!((s.quickFind||s.idQf)&&s.attr.id)},vid:{desc:"可快速查找",type:"quickFind",show:!!((s.quickFind||s.idQf)&&s.attr.vid)},text:{desc:"可快速查找",type:"quickFind",show:!!((s.quickFind||s.textQf)&&s.attr.text)}}:{}}),n=["text","desc"],i=$e(()=>e.value?Object.entries(e.value.attr).map(([s,o])=>{var c,u,d;const l={name:s,value:o,desc:JSON.stringify(o),tip:(c=t.value[s])!=null&&c.show?t.value[s]:void 0};return n.includes(s)?[l,{name:s+".length",value:(u=o==null?void 0:o.length)!=null?u:null,desc:JSON.stringify((d=o==null?void 0:o.length)!=null?d:null),tip:void 0}]:l}).flat():[]),a=$e(()=>e.value?h3(e.value):"");return(s,o)=>{const l=bs("SvgIcon"),c=Io,u=lb,d=ob,h=GI,f=iI,g=WI,p=qI,v=$I;return We(),rn(Zh,{initialValue:{top:40,right:10},class:"box-shadow-dim",show:s.show&&!!se(e)},{default:xe(({onRef:m})=>[Le("div",gQ,[Ee(c,{onClick:o[0]||(o[0]=y=>s.onUpdateShow(!s.show)),text:"",title:"最小化"},{icon:xe(()=>[Ee(l,{name:"minus"})]),_:1})]),se(e)?(We(),rn(v,{key:0,size:"small",striped:"",singleLine:!1,class:"gkd_code",themeOverrides:{thPaddingSmall:"1px 3px",tdPaddingSmall:"0px 3px"}},{default:xe(()=>[Le("thead",null,[Le("tr",{ref:m,"cursor-move":""},o[2]||(o[2]=[Le("th",null,"Name",-1),Le("th",null,"Value",-1)]),512)]),Ee(p,null,{default:xe(()=>[(We(!0),jt(oi,null,ds(se(i),y=>(We(),rn(g,{key:y.name},{default:xe(()=>[Ee(h,{onClick:b=>se(_i)(`${y.name}=${y.desc}`)},{default:xe(()=>[y.tip?(We(),jt("div",vQ,[Le("div",null,vt(y.name),1),Ee(d,null,{trigger:xe(()=>[Ee(u,{size:"16"},{default:xe(()=>[y.tip.type=="info"?(We(),rn(l,{key:0,name:"info"})):y.tip.type=="quickFind"?(We(),rn(l,{key:1,name:"ok"})):Nn("",!0)]),_:2},1024)]),default:xe(()=>[zt(" "+vt(y.tip.desc),1)]),_:2},1024)])):(We(),jt(oi,{key:1},[zt(vt(y.name),1)],64))]),_:2},1032,["onClick"]),Ee(h,null,{default:xe(()=>[Ee(f,{class:Ll(["w-[calc(var(--gkd-w)*0.12)]",{"text-left direction-rtl":y.name=="id","opacity-50":y.value===null}])},{default:xe(()=>[zt(vt(y.desc),1)]),_:2},1032,["class"])]),_:2},1024)]),_:2},1024))),128)),Ee(g,null,{default:xe(()=>[Ee(h,{colspan:"2"},{default:xe(()=>[Le("div",pQ,[Ee(d,null,{trigger:xe(()=>[Ee(c,{text:"",onClick:o[1]||(o[1]=y=>se(_i)(se(a)))},{icon:xe(()=>[Ee(u,{size:"20"},{default:xe(()=>[Ee(l,{name:"path"})]),_:1})]),_:1})]),default:xe(()=>[Le("div",mQ,vt(se(a)),1)]),_:1})])]),_:1})]),_:1})]),_:1})]),_:2},1024)):Nn("",!0)]),_:1},8,["show"])}}}),bQ={bg:"#eee","px-2px":""},xQ=pt({__name:"OverlapCard",setup(r){const e=$s(),{focusNode:t,overlapNodes:n,focusPosition:i}=Ns(e),s=document.documentElement.scrollWidth/100*25.5;return(o,l)=>{const c=Io,u=_C,d=B3;return We(),rn(Zh,{initialValue:{top:215,left:s},class:"box-shadow-dim w-420px",show:!!(se(n)&&se(i))},{default:xe(({onRef:h})=>[se(n)&&se(i)?(We(),rn(d,{key:0,size:"small",closable:"",onClose:l[0]||(l[0]=f=>n.value=void 0)},{header:xe(()=>[Le("div",{ref:h,"cursor-move":""},[l[1]||(l[1]=zt(" 位置 ")),Le("span",bQ,vt(`${se(i).x.toFixed(0)},${se(i).y.toFixed()}`),1),zt(" 存在 "+vt(se(n).length)+" 个层叠节点 ",1)],512)]),default:xe(()=>[Ee(u,{style:{"max-height":"400px","overflow-y":"scroll","padding-bottom":"10px"},class:"scrollbar-hidden"},{default:xe(()=>[(We(!0),jt(oi,null,ds(se(n),f=>(We(),rn(c,{key:f.id,onClick:g=>se(e).updateFocusNode(f),size:"small",style:Ri(se(Pl)(f,se(t)))},{default:xe(()=>[zt(vt(se(po)(f)),1)]),_:2},1032,["onClick","style"]))),128))]),_:1})]),_:2},1024)):Nn("",!0)]),_:1},8,["initialValue","show"])}}}),Fx=z3(),qL=$e(()=>Fx.width.value/100),GL=$e(()=>Math.max(1200,Fx.width.value));$e(()=>Math.max(700,Fx.height.value));const wQ={"bg-white":"","b-1px":"","b-solid":"","b-gray-200":"","rounded-4px":"","p-8px":""},EQ={flex:"","m-b-4px":"","pr-4px":""},SQ={"min-h-24px":""},_Q={key:0,"color-red":"","whitespace-pre":""},kQ=pt({__name:"RuleCard",props:{show:{type:Boolean},onUpdateShow:{type:Function,default:So}},setup(r){const e=$s(),t=Ns(e),{rootNode:n,focusNode:i}=t,a=t.snapshot,s=Tt(""),o=j3(s,500),l=g=>{if(g==null)return[];if(typeof g=="string")return[g];if(Array.isArray(g)&&g.every(p=>typeof p=="string"))return g},c=g=>{const p=l(g.matches);if(!p)return"非法格式: matches";const v=l(g.anyMatches);if(!v)return"非法格式: anyMatches";const m=l(g.excludeMatches);if(!m)return"非法格式: excludeMatches";const y=[];for(let M=0;M<p.length;M++){const N=p[M];try{y.push(Mu(N))}catch(A){const P=A instanceof Error?A.message:String(A);return`非法选择器: matches[${M}]
469
+ */var jL=function(){function r(e){ge(this,r),this.dragndropPluginOptions=e}return ve(r,[{key:"apply",value:function(t){var n=this,i=t.renderingService,a=t.renderingContext,s=a.root.ownerDocument,o=s.defaultView,l=function(u){var d=u.target,h=d===s,f=h&&n.dragndropPluginOptions.isDocumentDraggable?s:d.closest&&d.closest("[draggable=true]");if(f){var g=!1,p=u.timeStamp,v=[u.clientX,u.clientY],m=null,y=[u.clientX,u.clientY],b=function(){var E=ja(Hn().mark(function _(O){var M,N,A,P,L,I;return Hn().wrap(function(H){for(;;)switch(H.prev=H.next){case 0:if(g){H.next=8;break}if(M=O.timeStamp-p,N=yr([O.clientX,O.clientY],v),!(M<=n.dragndropPluginOptions.dragstartTimeThreshold||N<=n.dragndropPluginOptions.dragstartDistanceThreshold)){H.next=5;break}return H.abrupt("return");case 5:O.type="dragstart",f.dispatchEvent(O),g=!0;case 8:if(O.type="drag",O.dx=O.clientX-y[0],O.dy=O.clientY-y[1],f.dispatchEvent(O),y=[O.clientX,O.clientY],h){H.next=21;break}return A=n.dragndropPluginOptions.overlap==="pointer"?[O.canvasX,O.canvasY]:d.getBounds().center,H.next=17,s.elementsFromPoint(A[0],A[1]);case 17:P=H.sent,L=P[P.indexOf(d)+1],I=(L==null?void 0:L.closest("[droppable=true]"))||(n.dragndropPluginOptions.isDocumentDroppable?s:null),m!==I&&(m&&(O.type="dragleave",O.target=m,m.dispatchEvent(O)),I&&(O.type="dragenter",O.target=I,I.dispatchEvent(O)),m=I,m&&(O.type="dragover",O.target=m,m.dispatchEvent(O)));case 21:case"end":return H.stop()}},_)}));return function(O){return E.apply(this,arguments)}}();o.addEventListener("pointermove",b);var w=function(_){if(g){_.detail={preventClick:!0};var O=_.clone();m&&(O.type="drop",O.target=m,m.dispatchEvent(O)),O.type="dragend",f.dispatchEvent(O),g=!1}o.removeEventListener("pointermove",b)};d.addEventListener("pointerup",w,{once:!0}),d.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)})}}])}();jL.tag="Dragndrop";var EJ=function(r){function e(){var t,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ge(this,e),t=tt(this,e),t.name="dragndrop",t.options=n,t}return nt(e,r),ve(e,[{key:"init",value:function(){this.addRenderingPlugin(new jL(et({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)}}])}(Ga),ZO=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(d){s(d)}}function l(u){try{c(n.throw(u))}catch(d){s(d)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,e||[])).next())})},JO=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};const QO=["main"],eC=["background","main","label","transient"];function SJ(r){return r.main}class tC{getConfig(){return this.config}getLayer(e="main"){return this.extends.layers[e]||SJ(this.getLayers())}getLayers(){return this.extends.layers}getRenderer(e){return this.extends.renderers[e]}getCamera(e="main"){return this.getLayer(e).getCamera()}getRoot(e="main"){return this.getLayer(e).getRoot()}getContextService(e="main"){return this.getLayer(e).getContextService()}setCursor(e){this.config.cursor=e,this.getLayer().setCursor(e)}get document(){return this.getLayer().document}get context(){return this.getLayer().context}constructor(e){this.config={enableMultiLayer:!0},Object.assign(this.config,e);const t=this.config,{renderer:n,background:i,cursor:a,enableMultiLayer:s}=t,o=JO(t,["renderer","background","cursor","enableMultiLayer"]),l=s?eC:QO,c=nC(n,l),u=Object.fromEntries(l.map(d=>{const h=new k1(Object.assign(Object.assign({},o),{supportsMutipleCanvasesInOneContainer:s,renderer:c[d],background:s?d==="background"?i:void 0:i}));return[d,h]}));rC(u),this.extends={config:this.config,renderer:n,renderers:c,layers:u}}get ready(){return Promise.all(Object.entries(this.getLayers()).map(([,e])=>e.ready))}resize(e,t){Object.assign(this.extends.config,{width:e,height:t}),Object.values(this.getLayers()).forEach(n=>{const i=n.getCamera(),a=i.getPosition(),s=i.getFocalPoint();n.resize(e,t),i.setPosition(a),i.setFocalPoint(s)})}getBounds(e){return cc(Object.values(this.getLayers()).map(t=>e?t.getRoot().childNodes.find(i=>i.classList.includes(e)):t.getRoot()).filter(t=>(t==null?void 0:t.childNodes.length)>0).map(t=>t.getBounds()))}getContainer(){const e=this.extends.config.container;return typeof e=="string"?document.getElementById(e):e}getSize(){return[this.extends.config.width||0,this.extends.config.height||0]}appendChild(e,t){var n;const i=((n=e.style)===null||n===void 0?void 0:n.$layer)||"main";return this.getLayer(i).appendChild(e,t)}setRenderer(e){if(e===this.extends.renderer)return;const t=nC(e,this.config.enableMultiLayer?eC:QO);this.extends.renderers=t,Object.entries(t).forEach(([n,i])=>this.getLayer(n).setRenderer(i)),rC(this.getLayers())}getCanvasByViewport(e){return Un(this.getLayer().viewport2Canvas(si(e)))}getViewportByCanvas(e){return Un(this.getLayer().canvas2Viewport(si(e)))}getViewportByClient(e){return Un(this.getLayer().client2Viewport(si(e)))}getClientByViewport(e){return Un(this.getLayer().viewport2Client(si(e)))}getClientByCanvas(e){return this.getClientByViewport(this.getViewportByCanvas(e))}getCanvasByClient(e){const t=this.getLayer(),n=t.client2Viewport(si(e));return Un(t.viewport2Canvas(n))}toDataURL(){return ZO(this,arguments,void 0,function*(e={}){const t=globalThis.devicePixelRatio||1,{mode:n="viewport"}=e,i=JO(e,["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=Wa(m);[a,s]=m.min,[o,l]=y}const c=c1('<div id="virtual-image"></div>'),u=new k1({width:o,height:l,renderer:new ql,devicePixelRatio:t,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 d=this.getLayer("label").getRoot().cloneNode(!0),h=u.viewport2Canvas({x:0,y:0}),f=this.getCanvasByViewport([0,0]);d.translate([f[0]-h.x,f[1]-h.y]),d.scale(1/this.getCamera().getZoom()),u.appendChild(d),u.appendChild(this.getLayer("transient").getRoot().cloneNode(!0));const g=this.getCamera(),p=u.getCamera();if(n==="viewport")p.setZoom(g.getZoom()),p.setPosition(g.getPosition()),p.setFocalPoint(g.getFocalPoint());else if(n==="overall"){const[m,y,b]=p.getPosition(),[w,E,_]=p.getFocalPoint();p.setPosition([m+a,y+s,b]),p.setFocalPoint([w+a,E+s,_])}const v=u.getContextService();return new Promise(m=>{u.addEventListener(Nr.RERENDER,()=>ZO(this,void 0,void 0,function*(){yield new Promise(b=>setTimeout(b,300));const y=yield v.toDataURL(i);m(y)}))})})}destroy(){Object.values(this.getLayers()).forEach(e=>{e.getCamera().cancelLandmarkAnimation(),e.destroy()})}}function nC(r,e){return Object.fromEntries(e.map(t=>{const n=(r==null?void 0:r(t))||new ql;return n instanceof ql&&n.setConfig({enableDirtyRectangleRendering:!1}),t==="main"?n.registerPlugin(new EJ({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):n.unregisterPlugin(n.getPlugin("dom-interaction")),[t,n]}))}function rC(r){Object.entries(r).forEach(([e,t])=>{const n=t.getContextService().getDomElement();n!=null&&n.style&&(n.style.gridArea="1 / 1 / 2 / 2",n.style.outline="none",n.tabIndex=1,e!=="main"&&(n.style.pointerEvents="none")),n!=null&&n.parentElement&&(n.parentElement.style.display="grid")})}const no=r=>r?parseInt(r):0;function _J(r){const e=getComputedStyle(r),t=r.clientWidth||no(e.width),n=r.clientHeight||no(e.height),i=no(e.paddingLeft)+no(e.paddingRight),a=no(e.paddingTop)+no(e.paddingBottom);return[t-i,n-a]}function iC(r){if(!r)return[0,0];let e=640,t=480;const[n,i]=_J(r);e=n||e,t=i||t;const a=1,s=1;return[Math.max(Ce(e)?e:a,a),Math.max(Ce(t)?t:s,s)]}class Uh{constructor(e){this.type=e}}class bn extends Uh{constructor(e,t){super(e),this.data=t}}class Ur extends Uh{constructor(e,t,n,i){super(e),this.animationType=t,this.animation=n,this.data=i}}class ro extends Uh{constructor(e,t,n){super(e),this.elementType=t,this.data=n}}class Su extends Uh{constructor(e,t){super(e),this.data=t}}function Tn(r,e){r.emit(e.type,e)}function kJ(r){if(!r)return null;if(r instanceof ZN)return{type:"canvas",element:r};let e=r;for(;e;){if(vc(e))return{type:"node",element:e};if(iP(e))return{type:"edge",element:e};if(Hb(e))return{type:"combo",element:e};e=e.parentElement}return null}function aC(r){var e;return((e=r==null?void 0:r.style)===null||e===void 0?void 0:e.zIndex)||0}const Nl="cachedStyle",Ix=r=>`__${r}__`;function MJ(r,e){const t=Array.isArray(e)?e:[e];lr(r,Nl)||Dl(r,Nl,{}),t.forEach(n=>{Dl(lr(r,Nl),Ix(n),r.attributes[n])})}function sC(r,e){return lr(r,[Nl,Ix(e)])}function TJ(r,e){return Ix(e)in(lr(r,Nl)||{})}class OJ{constructor(e){this.tasks=[],this.animations=new Set,this.context=e}getTasks(){const e=[...this.tasks];return this.tasks=[],e}add(e,t){this.tasks.push([e,t])}animate(e,t,n){var i,a,s;(i=t==null?void 0:t.before)===null||i===void 0||i.call(t);const o=this.getTasks().map(([c,u])=>{var d,h,f;const{element:g,elementType:p,stage:v}=c,m=Iz(this.context.options,p,v,e);(d=u==null?void 0:u.before)===null||d===void 0||d.call(u);const y=m.length?Fz(g,this.inferStyle(c,n),m):null;return y?((h=u==null?void 0:u.beforeAnimate)===null||h===void 0||h.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=Rb(o);return l?((a=t==null?void 0:t.beforeAnimate)===null||a===void 0||a.call(t,l),l.finished.then(()=>{var c,u;(c=t==null?void 0:t.afterAnimate)===null||c===void 0||c.call(t,l),(u=t==null?void 0:t.after)===null||u===void 0||u.call(t),this.release()})):(s=t==null?void 0:t.after)===null||s===void 0||s.call(t),l}inferStyle(e,t){var n,i;const{element:a,elementType:s,stage:o,originalStyle:l,updatedStyle:c={}}=e;e.modifiedStyle||(e.modifiedStyle=Object.assign(Object.assign({},l),c));const{modifiedStyle:u}=e,d={},h={};if(o==="enter")Object.assign(d,{opacity:0});else if(o==="exit")Object.assign(h,{opacity:0});else if(o==="show")Object.assign(d,{opacity:0}),Object.assign(h,{opacity:(n=sC(a,"opacity"))!==null&&n!==void 0?n:jl("opacity")});else if(o==="hide")Object.assign(d,{opacity:(i=sC(a,"opacity"))!==null&&i!==void 0?i:jl("opacity")}),Object.assign(h,{opacity:0});else if(o==="collapse"){const{collapse:f}=t||{},{target:g,descendants:p,position:v}=f;if(s==="node"){if(p.includes(a.id)){const[m,y,b]=v;Object.assign(h,{x:m,y,z:b})}}else if(s==="combo"){if(a.id===g||p.includes(a.id)){const[m,y]=v;Object.assign(h,{x:m,y,childrenNode:l.childrenNode})}}else s==="edge"&&Object.assign(h,{sourceNode:u.sourceNode,targetNode:u.targetNode})}else if(o==="expand"){const{expand:f}=t||{},{target:g,descendants:p,position:v}=f;if(s==="node"){if(a.id===g||p.includes(a.id)){const[m,y,b]=v;Object.assign(d,{x:m,y,z:b})}}else if(s==="combo"){if(a.id===g||p.includes(a.id)){const[m,y,b]=v;Object.assign(d,{x:m,y,z:b,childrenNode:u.childrenNode})}}else s==="edge"&&Object.assign(d,{sourceNode:u.sourceNode,targetNode:u.targetNode})}return[Object.keys(d).length>0?Object.assign({},l,d):l,Object.keys(h).length>0?Object.assign({},u,h):u]}stop(){this.animations.forEach(e=>e.cancel())}clear(){this.tasks=[]}release(){var e,t;const{canvas:n}=this.context,i=(t=(e=n.document)===null||e===void 0?void 0:e.timeline)===null||t===void 0?void 0:t.animationsWithPromises;i&&(n.document.timeline.animationsWithPromises=i.filter(a=>a.playState!=="finished"))}destroy(){this.stop(),this.animations.clear(),this.tasks=[]}}class CJ{constructor(e){this.batchCount=0,this.context=e}emit(e){const{graph:t}=this.context;t.emit(e.type,e)}startBatch(e=!0){this.batchCount++,this.batchCount===1&&this.emit(new bn(we.BATCH_START,{initiate:e}))}endBatch(){this.batchCount--,this.batchCount===0&&this.emit(new bn(we.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class NJ extends Db{constructor(e){super(e),this.currentTarget=null,this.currentTargetType=null,this.category="behavior",this.forwardCanvasEvents=t=>{const{target:n}=t,i=kJ(n);if(!i)return;const{graph:a,canvas:s}=this.context,{type:o,element:l}=i;if("destroyed"in l&&(jd(l)||l.destroyed))return;const{type:c,detail:u,button:d}=t,h=Object.assign(Object.assign({},t),{target:l,targetType:o,originalTarget:n});c===ce.POINTER_MOVE&&(this.currentTarget!==l&&(this.currentTarget&&a.emit(`${this.currentTargetType}:${ce.POINTER_LEAVE}`,Object.assign(Object.assign({},h),{type:ce.POINTER_LEAVE,target:this.currentTarget,targetType:this.currentTargetType})),l&&(Object.assign(h,{type:ce.POINTER_ENTER}),a.emit(`${o}:${ce.POINTER_ENTER}`,h))),this.currentTarget=l,this.currentTargetType=o),c===ce.CLICK&&d===2||(a.emit(`${o}:${c}`,h),a.emit(c,h)),c===ce.CLICK&&u===2&&(Object.assign(h,{type:ce.DBLCLICK}),a.emit(`${o}:${ce.DBLCLICK}`,h),a.emit(ce.DBLCLICK,h)),c===ce.POINTER_DOWN&&d===2&&(Object.assign(h,{type:ce.CONTEXT_MENU,preventDefault:()=>{var f;(f=s.getContainer())===null||f===void 0||f.addEventListener(ce.CONTEXT_MENU,g=>g.preventDefault(),{once:!0})}}),a.emit(`${o}:${ce.CONTEXT_MENU}`,h),a.emit(ce.CONTEXT_MENU,h))},this.forwardContainerEvents=t=>{this.context.graph.emit(t.type,t)},this.forwardEvents(),this.setBehaviors(this.context.options.behaviors||[])}setBehaviors(e){this.setExtensions(e)}forwardEvents(){const e=this.context.canvas.getContainer();e&&[fo.KEY_DOWN,fo.KEY_UP].forEach(n=>{e.addEventListener(n,this.forwardContainerEvents)});const t=this.context.canvas.document;t&&[ce.CLICK,ce.DBLCLICK,ce.POINTER_OVER,ce.POINTER_LEAVE,ce.POINTER_ENTER,ce.POINTER_MOVE,ce.POINTER_OUT,ce.POINTER_DOWN,ce.POINTER_UP,ce.CONTEXT_MENU,ce.DRAG_START,ce.DRAG,ce.DRAG_END,ce.DRAG_ENTER,ce.DRAG_OVER,ce.DRAG_LEAVE,ce.DROP,ce.WHEEL].forEach(n=>{t.addEventListener(n,this.forwardCanvasEvents)})}destroy(){const e=this.context.canvas.getContainer();e&&[fo.KEY_DOWN,fo.KEY_UP].forEach(t=>{e.removeEventListener(t,this.forwardContainerEvents)}),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}var Zl=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};function ya(r,e){const{data:t,style:n}=r,i=Zl(r,["data","style"]),{data:a,style:s}=e,o=Zl(e,["data","style"]),l=Object.assign(Object.assign({},i),o);return(t||a)&&Object.assign(l,{data:Object.assign(Object.assign({},t),a)}),(n||s)&&Object.assign(l,{style:Object.assign(Object.assign({},n),s)}),l}function Uy(r){const{data:e,style:t}=r,i=Zl(r,["data","style"]);return e&&(i.data=Object.assign({},e)),t&&(i.style=Object.assign({},t)),i}function io(r={},e={}){const{states:t=[],data:n={},style:i={},children:a=[]}=r,s=Zl(r,["states","data","style","children"]),{states:o=[],data:l={},style:c={},children:u=[]}=e,d=Zl(e,["states","data","style","children"]),h=(g,p)=>g.length!==p.length?!1:g.every((v,m)=>v===p[m]),f=(g,p)=>{const v=Object.keys(g),m=Object.keys(p);return v.length!==m.length?!1:v.every(y=>g[y]===p[y])};return!(!f(s,d)||!h(a,u)||!h(t,o)||!f(n,l)||!f(i,c))}var AJ=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};function Hy(r){const{id:e=te(r),style:t,data:n}=r,i=AJ(r,["id","style","data"]),a=Object.assign(Object.assign({},r),{style:Object.assign({},t),data:Object.assign({},n)});return Gz(r)?Object.assign({id:e,data:a},i):{id:e,data:a}}function Ln(r){return r.data}function PJ(r){if(r.hasTreeStructure(Ar))return;r.attachTreeStructure(Ar);const e=r.getAllEdges();for(const t of e){const{source:n,target:i}=t;r.setParent(i,n,Ar)}}class RJ{constructor(){this.latestRemovedComboIds=new Set,this.comboIds=new Set,this.changes=[],this.batchCount=0,this.isTraceless=!1,this.enableUpdateNodeLikeHierarchy=!0,this.model=new Pn}pushChange(e){if(this.isTraceless)return;const{type:t}=e;if(t===Vt.NodeUpdated||t===Vt.EdgeUpdated||t===Vt.ComboUpdated){const{value:n,original:i}=e;this.changes.push({value:Uy(n),original:Uy(i),type:t})}else this.changes.push({value:Uy(e.value),type:t})}getChanges(){return this.changes}clearChanges(){this.changes=[]}batch(e){this.batchCount++,this.model.batch(e),this.batchCount--}isBatching(){return this.batchCount>0}silence(e){this.isTraceless=!0,e(),this.isTraceless=!1}isCombo(e){return this.comboIds.has(e)||this.latestRemovedComboIds.has(e)}getData(){return{nodes:this.getNodeData(),edges:this.getEdgeData(),combos:this.getComboData()}}getNodeData(e){return this.model.getAllNodes().reduce((t,n)=>{const i=Ln(n);return this.isCombo(te(i))||(e===void 0||e.includes(te(i)))&&t.push(i),t},[])}getEdgeDatum(e){return Ln(this.model.getEdge(e))}getEdgeData(e){return this.model.getAllEdges().reduce((t,n)=>{const i=Ln(n);return(e===void 0||e.includes(te(i)))&&t.push(i),t},[])}getComboData(e){return this.model.getAllNodes().reduce((t,n)=>{const i=Ln(n);return this.isCombo(te(i))&&(e===void 0||e.includes(te(i)))&&t.push(i),t},[])}getRootsData(e=Ar){return this.model.getRoots(e).map(Ln)}getAncestorsData(e,t){const{model:n}=this;return!n.hasNode(e)||!n.hasTreeStructure(t)?[]:n.getAncestors(e,t).map(Ln)}getDescendantsData(e){const t=this.getElementDataById(e),n=[];return vs(t,i=>{i!==t&&n.push(i)},i=>this.getChildrenData(te(i)),"TB"),n}getParentData(e,t){const{model:n}=this;if(!t){Di.warn("The hierarchy structure key is not specified");return}if(!n.hasNode(e)||!n.hasTreeStructure(t))return;const i=n.getParent(e,t);return i?Ln(i):void 0}getChildrenData(e){const t=this.getElementType(e)==="node"?Ar:Mt,{model:n}=this;return!n.hasNode(e)||!n.hasTreeStructure(t)?[]:n.getChildren(e,t).map(Ln)}getElementsDataByType(e){return e==="node"?this.getNodeData():e==="edge"?this.getEdgeData():e==="combo"?this.getComboData():[]}getElementDataById(e){return this.getElementType(e)==="edge"?this.getEdgeDatum(e):this.getNodeLikeDatum(e)}getNodeLikeDatum(e){const t=this.model.getNode(e);return Ln(t)}getNodeLikeData(e){return this.model.getAllNodes().reduce((t,n)=>{const i=Ln(n);return e?e.includes(te(i))&&t.push(i):t.push(i),t},[])}getElementDataByState(e,t){return this.getElementsDataByType(e).filter(i=>{var a;return(a=i.states)===null||a===void 0?void 0:a.includes(t)})}getElementState(e){var t;return((t=this.getElementDataById(e))===null||t===void 0?void 0:t.states)||[]}hasNode(e){return this.model.hasNode(e)&&!this.isCombo(e)}hasEdge(e){return this.model.hasEdge(e)}hasCombo(e){return this.model.hasNode(e)&&this.isCombo(e)}getRelatedEdgesData(e,t="both"){return this.model.getRelatedEdges(e,t).map(Ln)}getNeighborNodesData(e){return this.model.getNeighbors(e).map(Ln)}setData(e){const{nodes:t=[],edges:n=[],combos:i=[]}=e,{nodes:a,edges:s,combos:o}=this.getData(),l=Ia(a,t,d=>te(d),io),c=Ia(s,n,d=>te(d),io),u=Ia(o,i,d=>te(d),io);this.batch(()=>{const d={nodes:l.enter,edges:c.enter,combos:u.enter};this.addData(d),this.computeZIndex(d,"add",!0);const h={nodes:l.update,edges:c.update,combos:u.update};this.updateData(h),this.computeZIndex(h,"update",!0);const f={nodes:l.exit.map(te),edges:c.exit.map(te),combos:u.exit.map(te)};this.removeData(f)})}addData(e){const{nodes:t,edges:n,combos:i}=e;this.batch(()=>{this.addComboData(i),this.addNodeData(t),this.addEdgeData(n)}),this.computeZIndex(e,"add")}addNodeData(e=[]){e.length&&(this.model.addNodes(e.map(t=>(this.pushChange({value:t,type:Vt.NodeAdded}),Hy(t)))),this.updateNodeLikeHierarchy(e),this.computeZIndex({nodes:e},"add"))}addEdgeData(e=[]){e.length&&(this.model.addEdges(e.map(t=>(this.pushChange({value:t,type:Vt.EdgeAdded}),Hy(t)))),this.computeZIndex({edges:e},"add"))}addComboData(e=[]){if(!e.length)return;const{model:t}=this;t.hasTreeStructure(Mt)||t.attachTreeStructure(Mt),t.addNodes(e.map(n=>(this.comboIds.add(te(n)),this.pushChange({value:n,type:Vt.ComboAdded}),Hy(n)))),this.updateNodeLikeHierarchy(e),this.computeZIndex({combos:e},"add")}addChildrenData(e,t){const n=this.getNodeLikeDatum(e),i=t.map(te);this.addNodeData(t),this.updateNodeData([{id:e,children:[...n.children||[],...i]}]),this.addEdgeData(i.map(a=>({source:e,target:a})))}computeZIndex(e,t,n=!1){!n&&this.isBatching()||this.batch(()=>{const{nodes:i=[],edges:a=[],combos:s=[]}=e;s.forEach(o=>{var l,c,u;const d=te(o);if(t==="add"&&Ce((l=o.style)===null||l===void 0?void 0:l.zIndex)||t==="update"&&!("combo"in o))return;const h=this.getParentData(d,Mt),f=h?((u=(c=h.style)===null||c===void 0?void 0:c.zIndex)!==null&&u!==void 0?u:0)+1:0;this.preventUpdateNodeLikeHierarchy(()=>{this.updateComboData([{id:d,style:{zIndex:f}}])})}),i.forEach(o=>{var l,c,u;const d=te(o);if(t==="add"&&Ce((l=o.style)===null||l===void 0?void 0:l.zIndex)||t==="update"&&!("combo"in o)&&!("children"in o))return;let h=0;const f=this.getParentData(d,Mt);if(f)h=(((c=f.style)===null||c===void 0?void 0:c.zIndex)||0)+1;else{const g=this.getParentData(d,Ar);g&&(h=((u=g==null?void 0:g.style)===null||u===void 0?void 0:u.zIndex)||0)}this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:d,style:{zIndex:h}}])})}),a.forEach(o=>{var l,c,u,d,h;if(Ce((l=o.style)===null||l===void 0?void 0:l.zIndex))return;let{id:f,source:g,target:p}=o;if(!f)f=te(o);else{const y=this.getEdgeDatum(f);g=y.source,p=y.target}if(!g||!p)return;const v=((u=(c=this.getNodeLikeDatum(g))===null||c===void 0?void 0:c.style)===null||u===void 0?void 0:u.zIndex)||0,m=((h=(d=this.getNodeLikeDatum(p))===null||d===void 0?void 0:d.style)===null||h===void 0?void 0:h.zIndex)||0;this.updateEdgeData([{id:te(o),style:{zIndex:Math.max(v,m)-1}}])})})}getFrontZIndex(e){var t;const n=this.getElementType(e),i=this.getElementDataById(e),a=this.getData();if(Object.assign(a,{[`${n}s`]:a[`${n}s`].filter(s=>te(s)!==e)}),n==="combo"&&!wr(i)){const s=new Set(this.getAncestorsData(e,Mt).map(te));a.nodes=a.nodes.filter(o=>!s.has(te(o))),a.combos=a.combos.filter(o=>!s.has(te(o))),a.edges=a.edges.filter(({source:o,target:l})=>!s.has(o)&&!s.has(l))}return Math.max(((t=i.style)===null||t===void 0?void 0:t.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(e){if(!this.enableUpdateNodeLikeHierarchy)return;const{model:t}=this;e.forEach(n=>{const i=te(n),a=tu(n);a!==void 0&&(t.hasTreeStructure(Mt)||t.attachTreeStructure(Mt),a===null&&this.refreshComboData(i),this.setParent(i,tu(n),Mt));const s=n.children||[];if(s.length){t.hasTreeStructure(Ar)||t.attachTreeStructure(Ar);const o=s.filter(l=>t.hasNode(l));o.forEach(l=>this.setParent(l,i,Ar)),o.length!==s.length&&this.updateNodeData([{id:i,children:o}])}})}preventUpdateNodeLikeHierarchy(e){this.enableUpdateNodeLikeHierarchy=!1,e(),this.enableUpdateNodeLikeHierarchy=!0}updateData(e){const{nodes:t,edges:n,combos:i}=e;this.batch(()=>{this.updateNodeData(t),this.updateComboData(i),this.updateEdgeData(n)}),this.computeZIndex(e,"update")}updateNodeData(e=[]){if(!e.length)return;const{model:t}=this;this.batch(()=>{const n=[];e.forEach(i=>{const a=te(i),s=Ln(t.getNode(a));if(io(s,i))return;const o=ya(s,i);this.pushChange({value:o,original:s,type:Vt.NodeUpdated}),t.mergeNodeData(a,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({nodes:e},"update")}refreshData(){const{nodes:e,edges:t,combos:n}=this.getData();e.forEach(i=>{this.pushChange({value:i,original:i,type:Vt.NodeUpdated})}),t.forEach(i=>{this.pushChange({value:i,original:i,type:Vt.EdgeUpdated})}),n.forEach(i=>{this.pushChange({value:i,original:i,type:Vt.ComboUpdated})})}syncNodeLikeDatum(e){const{model:t}=this,n=te(e);if(!t.hasNode(n))return;const i=Ln(t.getNode(n)),a=ya(i,e);t.mergeNodeData(n,a)}syncEdgeDatum(e){const{model:t}=this,n=te(e);if(!t.hasEdge(n))return;const i=Ln(t.getEdge(n)),a=ya(i,e);t.mergeEdgeData(n,a)}updateEdgeData(e=[]){if(!e.length)return;const{model:t}=this;this.batch(()=>{e.forEach(n=>{const i=te(n),a=Ln(t.getEdge(i));if(io(a,n))return;n.source&&a.source!==n.source&&t.updateEdgeSource(i,n.source),n.target&&a.target!==n.target&&t.updateEdgeTarget(i,n.target);const s=ya(a,n);this.pushChange({value:s,original:a,type:Vt.EdgeUpdated}),t.mergeEdgeData(i,s)})}),this.computeZIndex({edges:e},"update")}updateComboData(e=[]){if(!e.length)return;const{model:t}=this;t.batch(()=>{const n=[];e.forEach(i=>{const a=te(i),s=Ln(t.getNode(a));if(io(s,i))return;const o=ya(s,i);this.pushChange({value:o,original:s,type:Vt.ComboUpdated}),t.mergeNodeData(a,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({combos:e},"update")}setParent(e,t,n,i=!0){if(e===t)return;const a=this.getNodeLikeDatum(e),s=tu(a);if(s!==t&&n===Mt){const o={id:e,combo:t};this.isCombo(e)?this.syncNodeLikeDatum(o):this.syncNodeLikeDatum(o)}this.model.setParent(e,t,n),i&&n===Mt&&i6([s,t]).forEach(o=>{o!==void 0&&this.refreshComboData(o)})}refreshComboData(e){const t=this.getComboData([e])[0],n=this.getAncestorsData(e,Mt);t&&this.pushChange({value:t,original:t,type:Vt.ComboUpdated}),n.forEach(i=>{this.pushChange({value:i,original:i,type:Vt.ComboUpdated})})}getElementPosition(e){const t=this.getElementDataById(e);return On(t)}translateNodeLikeBy(e,t){this.isCombo(e)?this.translateComboBy(e,t):this.translateNodeBy(e,t)}translateNodeLikeTo(e,t){this.isCombo(e)?this.translateComboTo(e,t):this.translateNodeTo(e,t)}translateNodeBy(e,t){const n=this.getElementPosition(e),i=Ze(n,[...t,0].slice(0,3));this.translateNodeTo(e,i)}translateNodeTo(e,t){const[n=0,i=0,a=0]=t;this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:e,style:{x:n,y:i,z:a}}])})}translateComboBy(e,t){const[n=0,i=0,a=0]=t;if([n,i,a].some(isNaN)||[n,i,a].every(l=>l===0))return;const s=this.getComboData([e])[0];if(!s)return;const o=new Set;vs(s,l=>{const c=te(l);if(o.has(c))return;o.add(c);const[u,d,h]=On(l),f=ya(l,{style:{x:u+n,y:d+i,z:h+a}});this.pushChange({value:f,original:l,type:this.isCombo(c)?Vt.ComboUpdated:Vt.NodeUpdated}),this.model.mergeNodeData(c,f)},l=>this.getChildrenData(te(l)),"BT")}translateComboTo(e,t){var n;if(t.some(isNaN))return;const[i=0,a=0,s=0]=t,o=(n=this.getComboData([e]))===null||n===void 0?void 0:n[0];if(!o)return;const[l,c,u]=On(o),d=i-l,h=a-c,f=s-u;vs(o,g=>{const p=te(g),[v,m,y]=On(g),b=ya(g,{style:{x:v+d,y:m+h,z:y+f}});this.pushChange({value:b,original:g,type:this.isCombo(p)?Vt.ComboUpdated:Vt.NodeUpdated}),this.model.mergeNodeData(p,b)},g=>this.getChildrenData(te(g)),"BT")}removeData(e){const{nodes:t,edges:n,combos:i}=e;this.batch(()=>{this.removeEdgeData(n),this.removeNodeData(t),this.removeComboData(i),this.latestRemovedComboIds=new Set(i)})}removeNodeData(e=[]){e.length&&this.batch(()=>{e.forEach(t=>{this.removeEdgeData(this.getRelatedEdgesData(t).map(te)),this.pushChange({value:this.getNodeData([t])[0],type:Vt.NodeRemoved}),this.removeNodeLikeHierarchy(t)}),this.model.removeNodes(e)})}removeEdgeData(e=[]){e.length&&(e.forEach(t=>this.pushChange({value:this.getEdgeData([t])[0],type:Vt.EdgeRemoved})),this.model.removeEdges(e))}removeComboData(e=[]){e.length&&this.batch(()=>{e.forEach(t=>{this.pushChange({value:this.getComboData([t])[0],type:Vt.ComboRemoved}),this.removeNodeLikeHierarchy(t),this.comboIds.delete(t)}),this.model.removeNodes(e)})}removeNodeLikeHierarchy(e){if(this.model.hasTreeStructure(Mt)){const t=tu(this.getNodeLikeDatum(e));this.setParent(e,void 0,Mt,!1),this.model.getChildren(e,Mt).forEach(n=>{const i=Ln(n),a=te(i);this.setParent(te(i),t,Mt,!1);const s=ya(i,{id:te(i),combo:t});this.pushChange({value:s,original:i,type:this.isCombo(a)?Vt.ComboUpdated:Vt.NodeUpdated}),this.model.mergeNodeData(te(i),s)}),qe(t)||this.refreshComboData(t)}}getElementType(e){if(this.model.hasNode(e))return this.isCombo(e)?"combo":"node";if(this.model.hasEdge(e))return"edge";throw new Error(Ji(`Unknown element type of id: ${e}`))}destroy(){const{model:e}=this,t=e.getAllNodes(),n=e.getAllEdges();e.removeEdges(n.map(i=>i.id)),e.removeNodes(t.map(i=>i.id)),this.context={}}}var ll=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(d){s(d)}}function l(u){try{c(n.throw(u))}catch(d){s(d)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,e||[])).next())})};class LJ{constructor(e){this.elementMap={},this.shapeTypeMap={},this.paletteStyle={},this.defaultStyle={},this.stateStyle={},this.visibilityCache=new WeakMap,this.context=e}init(){this.initContainer()}initContainer(){if(!this.container||this.container.destroyed){const{canvas:e}=this.context;this.container=e.appendChild(new An({className:"elements"}))}}emit(e,t){t.silence||Tn(this.context.graph,e)}forEachElementData(e){Ms.forEach(t=>{const n=this.context.model.getElementsDataByType(t);e(t,n)})}getElementType(e,t){var n;const{options:i,graph:a}=this.context,s=((n=i[e])===null||n===void 0?void 0:n.type)||t.type;return s?typeof s=="string"?s:s.call(a,t):e==="edge"?"line":"circle"}getTheme(e){return cA(this.context.options)[e]||{}}getThemeStyle(e){return this.getTheme(e).style||{}}getThemeStateStyle(e,t){const{state:n={}}=this.getTheme(e);return Object.assign({},...t.map(i=>n[i]||{}))}computePaletteStyle(){const{options:e}=this.context;this.paletteStyle={},this.forEachElementData((t,n)=>{var i,a;const s=Object.assign({},cE((i=this.getTheme(t))===null||i===void 0?void 0:i.palette),cE((a=e[t])===null||a===void 0?void 0:a.palette));s!=null&&s.field&&Object.assign(this.paletteStyle,zj(n,s))})}getPaletteStyle(e,t){const n=this.paletteStyle[t];return n?e==="edge"?{stroke:n}:{fill:n}:{}}computeElementDefaultStyle(e,t){var n;const{options:i}=this.context,a=((n=i[e])===null||n===void 0?void 0:n.style)||{};"transform"in a&&Array.isArray(a.transform)&&(a.transform=[...a.transform]),this.defaultStyle[te(t.datum)]=lE(a,t)}computeElementsDefaultStyle(e){const{graph:t}=this.context;this.forEachElementData((n,i)=>{const a=i.length;for(let s=0;s<a;s++){const o=i[s];(e===void 0||e.includes(te(o)))&&this.computeElementDefaultStyle(n,{datum:o,graph:t})}})}getDefaultStyle(e){return this.defaultStyle[e]||{}}getElementState(e){try{const{model:t}=this.context;return t.getElementState(e)}catch{return[]}}getElementStateStyle(e,t,n){var i,a;const{options:s}=this.context,o=((a=(i=s[e])===null||i===void 0?void 0:i.state)===null||a===void 0?void 0:a[t])||{};return lE(o,n)}computeElementStatesStyle(e,t,n){this.stateStyle[te(n.datum)]=Object.assign({},...t.map(i=>this.getElementStateStyle(e,i,n)))}computeElementsStatesStyle(e){const{graph:t}=this.context;this.forEachElementData((n,i)=>{const a=i.length;for(let s=0;s<a;s++){const o=i[s];if(e===void 0||e.includes(te(o))){const l=this.getElementState(te(o));this.computeElementStatesStyle(n,l,{datum:o,graph:t})}}})}getStateStyle(e){return this.stateStyle[e]||{}}computeStyle(e,t){e&&["translate","zIndex"].includes(e)||(this.computePaletteStyle(),this.computeElementsDefaultStyle(t),this.computeElementsStatesStyle(t))}getElement(e){return this.elementMap[e]}getNodes(){return this.context.model.getNodeData().map(({id:e})=>this.elementMap[e])}getEdges(){return this.context.model.getEdgeData().map(e=>this.elementMap[te(e)])}getCombos(){return this.context.model.getComboData().map(({id:e})=>this.elementMap[e])}getElementComputedStyle(e,t){const n=te(t),i=this.getThemeStyle(e),a=this.getPaletteStyle(e,n),s=t.style||{},o=this.getDefaultStyle(n),l=this.getThemeStateStyle(e,this.getElementState(n)),c=this.getStateStyle(n),u=Object.assign({},i,a,s,o,l,c);if(e==="combo"){const d=this.context.model.getChildrenData(n),f=!!u.collapsed?[]:d.map(te).filter(g=>this.getElement(g));Object.assign(u,{childrenNode:f,childrenData:d})}return u}getDrawData(e){this.init();const t=this.computeChangesAndDrawData(e);if(!t)return null;const{type:n="draw",stage:i=n}=e;return this.markDestroyElement(t.drawData),this.computeStyle(i),{type:n,stage:i,data:t}}draw(e={animation:!0}){const t=this.getDrawData(e);if(!t)return;const{data:{drawData:{add:n,update:i,remove:a}}}=t;return this.destroyElements(a,e),this.createElements(n,e),this.updateElements(i,e),this.setAnimationTask(e,t)}preLayoutDraw(){return ll(this,arguments,void 0,function*(e={animation:!0}){var t,n;const i=this.getDrawData(e);if(!i)return;const{data:{drawData:a}}=i;yield(n=(t=this.context.layout)===null||t===void 0?void 0:t.preLayout)===null||n===void 0?void 0:n.call(t,a);const{add:s,update:o,remove:l}=a;return this.destroyElements(l,e),this.createElements(s,e),this.updateElements(o,e),this.setAnimationTask(e,i)})}setAnimationTask(e,t){const{animation:n,silence:i}=e,{data:{dataChanges:a,drawData:s},stage:o,type:l}=t;return this.context.animation.animate(n,i?{}:{before:()=>this.emit(new bn(we.BEFORE_DRAW,{dataChanges:a,animation:n,stage:o,render:l==="render"}),e),beforeAnimate:c=>this.emit(new Ur(we.BEFORE_ANIMATE,mr.DRAW,c,s),e),afterAnimate:c=>this.emit(new Ur(we.AFTER_ANIMATE,mr.DRAW,c,s),e),after:()=>this.emit(new bn(we.AFTER_DRAW,{dataChanges:a,animation:n,stage:o,render:l==="render",firstRender:this.context.graph.rendered===!1}),e)})}computeChangesAndDrawData(e){const{model:t}=this.context,n=t.getChanges(),i=wx(n);if(i.length===0)return null;const{NodeAdded:a=[],NodeUpdated:s=[],NodeRemoved:o=[],EdgeAdded:l=[],EdgeUpdated:c=[],EdgeRemoved:u=[],ComboAdded:d=[],ComboUpdated:h=[],ComboRemoved:f=[]}=wd(i,m=>m.type),g=m=>new Map(m.map(y=>{const b=y.value;return[te(b),b]})),p={add:{nodes:g(a),edges:g(l),combos:g(d)},update:{nodes:g(s),edges:g(c),combos:g(h)},remove:{nodes:g(o),edges:g(u),combos:g(f)}},v=this.transformData(p,e);return t.clearChanges(),{dataChanges:n,drawData:v}}transformData(e,t){const n=this.context.transform.getTransformInstance();return Object.values(n).reduce((i,a)=>a.beforeDraw(i,t),e)}createElement(e,t,n){var i;const a=te(t);if(this.getElement(a))return;const o=this.getElementType(e,t),l=this.getElementComputedStyle(e,t),c=na(e,o);if(!c)return Di.warn(`The element ${o} of ${e} is not registered.`);this.emit(new ro(we.BEFORE_ELEMENT_CREATE,e,t),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:d="enter"}=n;(i=this.context.animation)===null||i===void 0||i.add({element:u,elementType:e,stage:d,originalStyle:Object.assign({},u.attributes),updatedStyle:l},{after:()=>{var h;this.emit(new ro(we.AFTER_ELEMENT_CREATE,e,t),n),(h=u.onCreate)===null||h===void 0||h.call(u)}})}createElements(e,t){const{nodes:n,edges:i,combos:a}=e;[["node",n],["combo",a],["edge",i]].forEach(([o,l])=>{l.forEach(c=>this.createElement(o,c,t))})}getUpdateStageStyle(e,t,n){const{stage:i="update"}=n;if(i==="translate")if(e==="node"||e==="combo"){const{style:{x:a=0,y:s=0,z:o=0}={}}=t;return{x:a,y:s,z:o}}else return{};return this.getElementComputedStyle(e,t)}updateElement(e,t,n){var i;const a=te(t),{stage:s="update"}=n,o=this.getElement(a);if(!o)return()=>null;this.emit(new ro(we.BEFORE_ELEMENT_UPDATE,e,t),n);const l=this.getElementType(e,t),c=this.getUpdateStageStyle(e,t,n);this.shapeTypeMap[a]!==l&&(o.destroy(),delete this.shapeTypeMap[a],delete this.elementMap[a],this.createElement(e,t,{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:e,stage:u,originalStyle:Object.assign({},o.attributes),updatedStyle:c},{before:()=>{const d=this.elementMap[a];s!=="collapse"&&D1(d,c),s==="visibility"&&(TJ(d,"opacity")||MJ(d,"opacity"),this.visibilityCache.set(d,u==="show"?"visible":"hidden"),u==="show"&&_s(d,"visible"))},after:()=>{var d;const h=this.elementMap[a];s==="collapse"&&D1(h,c),u==="hide"&&_s(h,this.visibilityCache.get(h)),this.emit(new ro(we.AFTER_ELEMENT_UPDATE,e,t),n),(d=h.onUpdate)===null||d===void 0||d.call(h)}})}updateElements(e,t){const{nodes:n,edges:i,combos:a}=e;[["node",n],["combo",a],["edge",i]].forEach(([o,l])=>{l.forEach(c=>this.updateElement(o,c,t))})}markDestroyElement(e){Object.values(e.remove).forEach(t=>{t.forEach(n=>{const i=te(n),a=this.getElement(i);a&&F$(a)})})}destroyElement(e,t,n){var i;const{stage:a="exit"}=n,s=te(t),o=this.elementMap[s];if(!o)return()=>null;this.emit(new ro(we.BEFORE_ELEMENT_DESTROY,e,t),n),(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:e,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 ro(we.AFTER_ELEMENT_DESTROY,e,t),n)}})}destroyElements(e,t){const{nodes:n,edges:i,combos:a}=e;[["combo",a],["edge",i],["node",n]].forEach(([o,l])=>{l.forEach(c=>this.destroyElement(o,c,t))})}clearElement(e){delete this.paletteStyle[e],delete this.defaultStyle[e],delete this.stateStyle[e],delete this.elementMap[e],delete this.shapeTypeMap[e]}alignLayoutResultToElement(e,t){var n,i;const a=(n=e.nodes)===null||n===void 0?void 0:n.find(s=>te(s)===t);if(a){const s=On(this.context.model.getNodeLikeDatum(t)),o=On(a),l=St(s,o);(i=e.nodes)===null||i===void 0||i.forEach(c=>{var u,d,h;!((u=c.style)===null||u===void 0)&&u.x&&(c.style.x+=l[0]),!((d=c.style)===null||d===void 0)&&d.y&&(c.style.y+=l[1]),!((h=c.style)===null||h===void 0)&&h.z&&(c.style.z+=l[2]||0)})}}collapseNode(e,t){return ll(this,void 0,void 0,function*(){var n;const{animation:i,align:a}=t,{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,e),s.updateData(c);const u=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!u)return;const{drawData:d}=u,{add:h,remove:f,update:g}=d;this.markDestroyElement(d);const p={animation:i,stage:"collapse",data:d};this.destroyElements(f,p),this.createElements(h,p),this.updateElements(g,p),yield(n=this.context.animation.animate(i,{beforeAnimate:v=>this.emit(new Ur(we.BEFORE_ANIMATE,mr.COLLAPSE,v,d),p),afterAnimate:v=>this.emit(new Ur(we.AFTER_ANIMATE,mr.COLLAPSE,v,d),p)},{collapse:{target:e,descendants:Array.from(f.nodes).map(([,v])=>te(v)),position:On(g.nodes.get(e))}}))===null||n===void 0?void 0:n.finished})}expandNode(e,t){return ll(this,void 0,void 0,function*(){var n;const{model:i,layout:a}=this.context,{animation:s,align:o}=t,l=On(i.getNodeData([e])[0]),c=this.computeChangesAndDrawData({stage:"expand",animation:s});if(!c)return;const{drawData:{add:u}}=c;this.createElements(u,{animation:!1,stage:"expand",target:e}),this.context.animation.clear();const d=yield a.simulate();o&&this.alignLayoutResultToElement(d,e),i.updateData(d),this.computeStyle("expand");const h=this.computeChangesAndDrawData({stage:"collapse",animation:s});if(!h)return;const{drawData:f}=h,{update:g}=f,p={animation:s,stage:"expand",data:f};u.edges.forEach(v=>g.edges.set(te(v),v)),u.nodes.forEach(v=>g.nodes.set(te(v),v)),this.updateElements(g,p),yield(n=this.context.animation.animate(s,{beforeAnimate:v=>this.emit(new Ur(we.BEFORE_ANIMATE,mr.EXPAND,v,f),p),afterAnimate:v=>this.emit(new Ur(we.AFTER_ANIMATE,mr.EXPAND,v,f),p)},{expand:{target:e,descendants:Array.from(u.nodes).map(([,v])=>te(v)),position:l}}))===null||n===void 0?void 0:n.finished})}collapseCombo(e,t){return ll(this,void 0,void 0,function*(){var n;const{model:i,element:a}=this.context;if(i.getAncestorsData(e,Mt).some(p=>wr(p)))return;const s=a.getElement(e),o=s.getComboPosition(Object.assign(Object.assign({},s.attributes),{collapsed:!0})),l=this.computeChangesAndDrawData({stage:"collapse",animation:t});if(!l)return;const{dataChanges:c,drawData:u}=l;this.markDestroyElement(u);const{update:d,remove:h}=u,f={animation:t,stage:"collapse",data:u};this.destroyElements(h,f),this.updateElements(d,f);const g=p=>Array.from(p).map(([,v])=>te(v));yield(n=this.context.animation.animate(t,{before:()=>this.emit(new bn(we.BEFORE_DRAW,{dataChanges:c,animation:t}),f),beforeAnimate:p=>this.emit(new Ur(we.BEFORE_ANIMATE,mr.COLLAPSE,p,u),f),afterAnimate:p=>this.emit(new Ur(we.AFTER_ANIMATE,mr.COLLAPSE,p,u),f),after:()=>this.emit(new bn(we.AFTER_DRAW,{dataChanges:c,animation:t}),f)},{collapse:{target:e,descendants:[...g(h.nodes),...g(h.combos)],position:o}}))===null||n===void 0?void 0:n.finished})}expandCombo(e,t){return ll(this,void 0,void 0,function*(){var n;const{model:i}=this.context,a=On(i.getComboData([e])[0]);this.computeStyle("expand");const s=this.computeChangesAndDrawData({stage:"expand",animation:t});if(!s)return;const{dataChanges:o,drawData:l}=s,{add:c,update:u}=l,d={animation:t,stage:"expand",data:l,target:e};this.createElements(c,d),this.updateElements(u,d);const h=f=>Array.from(f).map(([,g])=>te(g));yield(n=this.context.animation.animate(t,{before:()=>this.emit(new bn(we.BEFORE_DRAW,{dataChanges:o,animation:t}),d),beforeAnimate:f=>this.emit(new Ur(we.BEFORE_ANIMATE,mr.EXPAND,f,l),d),afterAnimate:f=>this.emit(new Ur(we.AFTER_ANIMATE,mr.EXPAND,f,l),d),after:()=>this.emit(new bn(we.AFTER_DRAW,{dataChanges:o,animation:t}),d)},{expand:{target:e,descendants:[...h(c.nodes),...h(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 ao=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(d){s(d)}}function l(u){try{c(n.throw(u))}catch(d){s(d)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,e||[])).next())})},IJ=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};class DJ{get presetOptions(){return{animation:!!uA(this.context.options,!0)}}get options(){const{options:e}=this.context;return e.layout}constructor(e){this.instances=[],this.context=e}getLayoutInstance(){return this.instances}preLayout(e){return ao(this,void 0,void 0,function*(){var t,n,i,a;const{graph:s,model:o}=this.context,{add:l}=e;Tn(s,new bn(we.BEFORE_LAYOUT,{type:"pre"}));const c=yield(t=this.context.layout)===null||t===void 0?void 0:t.simulate();(n=c==null?void 0:c.nodes)===null||n===void 0||n.forEach(u=>{const d=te(u),h=l.nodes.get(d);o.syncNodeLikeDatum(u),h&&Object.assign(h.style,u.style)}),(i=c==null?void 0:c.edges)===null||i===void 0||i.forEach(u=>{const d=te(u),h=l.edges.get(d);o.syncEdgeDatum(u),h&&Object.assign(h.style,u.style)}),(a=c==null?void 0:c.combos)===null||a===void 0||a.forEach(u=>{const d=te(u),h=l.combos.get(d);o.syncNodeLikeDatum(u),h&&Object.assign(h.style,u.style)}),Tn(s,new bn(we.AFTER_LAYOUT,{type:"pre"})),this.transformDataAfterLayout("pre",e)})}postLayout(){return ao(this,arguments,void 0,function*(e=this.options){if(!e)return;const t=Array.isArray(e)?e:[e],{graph:n}=this.context;Tn(n,new bn(we.BEFORE_LAYOUT,{type:"post"}));for(const i of t){const a=t.indexOf(i),s=this.getLayoutData(i),o=Object.assign(Object.assign({},this.presetOptions),i);Tn(n,new bn(we.BEFORE_STAGE_LAYOUT,{options:o,index:a}));const l=yield this.stepLayout(s,o,a);Tn(n,new bn(we.AFTER_STAGE_LAYOUT,{options:o,index:a})),i.animation||this.updateElementPosition(l,!1)}Tn(n,new bn(we.AFTER_LAYOUT,{type:"post"})),this.transformDataAfterLayout("post")})}transformDataAfterLayout(e,t){const n=this.context.transform.getTransformInstance();Object.values(n).forEach(i=>i.afterLayout(e,t))}simulate(){return ao(this,void 0,void 0,function*(){if(!this.options)return{};const e=Array.isArray(this.options)?this.options:[this.options];let t={};for(const n of e){const i=e.indexOf(n),a=this.getLayoutData(n);t=yield this.stepLayout(a,Object.assign(Object.assign(Object.assign({},this.presetOptions),n),{animation:!1}),i)}return t})}stepLayout(e,t,n){return ao(this,void 0,void 0,function*(){return W$(t)?yield this.treeLayout(e,t,n):yield this.graphLayout(e,t,n)})}graphLayout(e,t,n){return ao(this,void 0,void 0,function*(){const{animation:i,enableWorker:a,iterations:s=300}=t,o=this.initGraphLayout(t);if(!o)return{};if(this.instances[n]=o,this.instance=o,a){const c=o;return this.supervisor=new PH(c.graphData2LayoutModel(e),c.instance,{iterations:s}),Au(yield this.supervisor.execute())}if(G1(o))return i?yield o.execute(e,{onTick:c=>{this.updateElementPosition(c,!1)}}):(o.execute(e),o.stop(),o.tick(s));const l=yield o.execute(e);if(i){const c=this.updateElementPosition(l,i);yield c==null?void 0:c.finished}return l})}treeLayout(e,t,n){return ao(this,void 0,void 0,function*(){const{type:i,animation:a}=t,s=na("layout",i);if(!s)return{};const{nodes:o=[],edges:l=[]}=e,c=new Pn({nodes:o.map(g=>({id:te(g),data:g.data||{}})),edges:l.map(g=>({id:te(g),source:g.source,target:g.target,data:g.data||{}}))});PJ(c);const u={nodes:[],edges:[]},d={nodes:[],edges:[]};c.getRoots(Ar).forEach(g=>{vs(g,b=>{b.children=c.getSuccessors(b.id)},b=>c.getSuccessors(b.id),"TB");const p=s(g,t),{x:v,y:m,z:y=0}=p;vs(p,b=>{const{id:w,x:E,y:_,z:O=0}=b;u.nodes.push({id:w,style:{x:v,y:m,z:y}}),d.nodes.push({id:w,style:{x:E,y:_,z:O}})},b=>b.children,"TB")});const f=this.inferTreeLayoutOffset(d);if(oC(d,f),a){oC(u,f),this.updateElementPosition(u,!1);const g=this.updateElementPosition(d,a);yield g==null?void 0:g.finished}return d})}inferTreeLayoutOffset(e){var t;let[n,i]=[1/0,-1/0],[a,s]=[1/0,-1/0];(t=e.nodes)===null||t===void 0||t.forEach(p=>{const{x:v=0,y:m=0}=p.style||{};n=Math.min(n,v),i=Math.max(i,v),a=Math.min(a,m),s=Math.max(s,m)});const{canvas:o}=this.context,l=o.getSize(),[c,u]=o.getCanvasByViewport([0,0]),[d,h]=o.getCanvasByViewport(l);if(n>=c&&i<=d&&a>=u&&s<=h)return[0,0];const f=(c+d)/2,g=(u+h)/2;return[f-(n+i)/2,g-(a+s)/2]}stopLayout(){this.instance&&G1(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(e){const{nodeFilter:t=()=>!0,preLayout:n=!1,isLayoutInvisibleNodes:i=!1}=e,{nodes:a,edges:s,combos:o}=this.context.model.getData(),{element:l,model:c}=this.context,u=p=>l.getElement(p),d=n?p=>{var v;return!i&&(((v=p.style)===null||v===void 0?void 0:v.visibility)==="hidden"||c.getAncestorsData(p.id,Ar).some(wr)||c.getAncestorsData(p.id,Mt).some(wr))?!1:t(p)}:p=>{const v=te(p),m=u(v);return!m||jd(m)?!1:t(p)},h=a.filter(d),f=new Map(h.map(p=>[te(p),p]));o.forEach(p=>f.set(te(p),p));const g=s.filter(({source:p,target:v})=>f.has(p)&&f.has(v));return{nodes:h,edges:g,combos:o}}initGraphLayout(e){var t;const{element:n,viewport:i}=this.context,{type:a,enableWorker:s,animation:o,iterations:l}=e,c=IJ(e,["type","enableWorker","animation","iterations"]),[u,d]=i.getCanvasSize(),h=[u/2,d/2],f=(t=e==null?void 0:e.nodeSize)!==null&&t!==void 0?t: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=na("layout",a);if(!g)return Di.warn(`The layout of ${a} is not registered.`);const p=Object.getPrototypeOf(g.prototype)===Vd.prototype?g:U$(g,this.context),v=new p(this.context),m={nodeSize:f,width:u,height:d,center:h};switch(v.id){case"d3-force":case"d3-force-3d":Object.assign(m,{center:{x:u/2,y:d/2,z:0}});break}return hr(v.options,m,c),v}updateElementPosition(e,t){const{model:n,element:i}=this.context;return i?(n.updateData(e),i.draw({animation:t,silence:!0})):null}destroy(){var e;this.stopLayout(),this.context={},(e=this.supervisor)===null||e===void 0||e.kill(),this.supervisor=void 0,this.instance=void 0,this.instances=[],this.animationResult=void 0}}const oC=(r,e)=>{var t;const[n,i]=e;(t=r.nodes)===null||t===void 0||t.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 FJ(r){return[BJ].reduce((t,n)=>n(t),r)}function BJ(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 zJ extends Db{constructor(e){super(e),this.category="plugin",this.setPlugins(this.context.options.plugins||[])}setPlugins(e){this.setExtensions(e)}getPluginInstance(e){const t=this.extensionMap[e];if(t)return t;Di.warn(`Cannot find the plugin ${e}, will try to find it by type.`);const n=this.extensions.find(i=>i.type===e);if(n)return this.extensionMap[n.key]}}const _u=["update-related-edges","collapse-expand-node","collapse-expand-combo","get-edge-actual-ends","arrange-draw-order"];class jJ extends Db{constructor(e){super(e),this.category="transform",this.setTransforms(this.context.options.transforms||[])}getTransforms(){}setTransforms(e){this.setExtensions([..._u.slice(0,_u.length-1),...e,_u[_u.length-1]])}getTransformInstance(e){return e?this.extensionMap[e]:this.extensionMap}}var cl=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(d){s(d)}}function l(u){try{c(n.throw(u))}catch(d){s(d)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,e||[])).next())})};class $J{get padding(){return Fi(this.context.options.padding)}get paddingOffset(){const[e,t,n,i]=this.padding,[a,s,o]=[(i-t)/2,(e-n)/2,0];return[a,s,o]}constructor(e){this.landmarkCounter=0,this.context=e;const[t,n]=this.paddingOffset,{zoom:i,rotation:a,x:s=t,y:o=n}=e.options;this.transform({mode:"absolute",scale:i,translate:[s,o],rotate:a},!1)}get camera(){const{canvas:e}=this.context;return new Proxy(e.getCamera(),{get:(t,n)=>{const a=Object.entries(e.getLayers()).filter(([o])=>!["main"].includes(o)).map(([,o])=>o.getCamera()),s=t[n];if(typeof s=="function")return(...o)=>{const l=s.apply(t,o);return a.forEach(c=>{c[n].apply(c,o)}),l}}})}createLandmark(e){return this.camera.createLandmark(`landmark-${this.landmarkCounter++}`,e)}getAnimation(e){const t=uA(this.context.options,e);return t?xs(Object.assign({},t),["easing","duration"]):!1}getCanvasSize(){const{canvas:e}=this.context,{width:t=0,height:n=0}=e.getConfig();return[t,n]}getCanvasCenter(){const{canvas:e}=this.context,{width:t=0,height:n=0}=e.getConfig();return[t/2,n/2,0]}getViewportCenter(){const[e,t]=this.camera.getPosition();return[e,t,0]}getGraphCenter(){return this.context.graph.getViewportByCanvas(this.getCanvasCenter())}getZoom(){return this.camera.getZoom()}getRotation(){return this.camera.getRoll()}getTranslateOptions(e){const{camera:t}=this,{mode:n,translate:i=[]}=e,a=this.getZoom(),s=t.getPosition(),o=t.getFocalPoint(),[l,c]=this.getCanvasCenter(),[u=0,d=0,h=0]=i,f=di([-u,-d,-h],a);return n==="relative"?{position:Ze(s,f),focalPoint:Ze(o,f)}:{position:Ze([l,c,s[2]],f),focalPoint:Ze([l,c,o[2]],f)}}getRotateOptions(e){const{mode:t,rotate:n=0}=e;return{roll:t==="relative"?this.camera.getRoll()+n:n}}getZoomOptions(e){const{zoomRange:t}=this.context.options,n=this.camera.getZoom(),{mode:i,scale:a=1}=e;return an(i==="relative"?n*a:a,...t)}transform(e,t){return cl(this,void 0,void 0,function*(){const{graph:n}=this.context,{translate:i,rotate:a,scale:s,origin:o}=e;this.cancelAnimation();const l=this.getAnimation(t);if(Tn(n,new Su(we.BEFORE_TRANSFORM,e)),!a&&s&&!i&&o&&!l){this.camera.setZoomByViewportPoint(this.getZoomOptions(e),o),Tn(n,new Su(we.AFTER_TRANSFORM,e));return}const c={};if(i&&Object.assign(c,this.getTranslateOptions(e)),Ce(a)&&Object.assign(c,this.getRotateOptions(e)),Ce(s)&&Object.assign(c,{zoom:this.getZoomOptions(e)}),l)return Tn(n,new Ur(we.BEFORE_ANIMATE,mr.TRANSFORM,null,e)),new Promise(u=>{this.transformResolver=u,this.camera.gotoLandmark(this.createLandmark(c),Object.assign(Object.assign({},l),{onfinish:()=>{Tn(n,new Ur(we.AFTER_ANIMATE,mr.TRANSFORM,null,e)),Tn(n,new Su(we.AFTER_TRANSFORM,e)),this.transformResolver=void 0,u()}}))});this.camera.gotoLandmark(this.createLandmark(c),{duration:0}),Tn(n,new Su(we.AFTER_TRANSFORM,e))})}fitView(e,t){return cl(this,void 0,void 0,function*(){const[n,i,a,s]=this.padding,{when:o="always",direction:l="both"}=e||{},[c,u]=this.context.canvas.getSize(),d=c-s-i,h=u-n-a,f=this.context.canvas.getBounds(),g=this.getBBoxInViewport(f),[p,v]=Wa(g),m=l==="x"&&p>=d||l==="y"&&v>=h||l==="both"&&p>=d&&v>=h;if(o==="overflow"&&!m)return yield this.fitCenter({animation:t});const y=d/p,b=h/v,w=l==="x"?y:l==="y"?b:Math.min(y,b),E=this.getAnimation(t);yield this.transform({mode:"relative",scale:w,translate:Ze(St(this.getCanvasCenter(),this.getBBoxInViewport(f).center),di(this.paddingOffset,w))},E)})}fitCenter(e){return cl(this,void 0,void 0,function*(){const t=this.context.canvas.getBounds();yield this.focus(t,e)})}focusElements(e){return cl(this,arguments,void 0,function*(t,n={}){const{element:i}=this.context;if(!i)return;const a=o=>n.shapes?o.getShape(n.shapes).getRenderBounds():o.getRenderBounds(),s=cc(t.map(o=>a(i.getElement(o))));yield this.focus(s,n)})}focus(e,t){return cl(this,void 0,void 0,function*(){const n=this.context.graph.getViewportByCanvas(e.center),i=t.position||this.getCanvasCenter(),a=St(i,n);yield this.transform({mode:"relative",translate:Ze(a,this.paddingOffset)},t.animation)})}getBBoxInViewport(e){const{min:t,max:n}=e,{graph:i}=this.context,[a,s]=i.getViewportByCanvas(t),[o,l]=i.getViewportByCanvas(n),c=new Rt;return c.setMinMax([a,s,0],[o,l,0]),c}isInViewport(e,t=!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 Rt;return u.setMinMax([s,o,0],[l,c,0]),n&&(u=Va(u,n)),Ao(e)?ui(e,u):t?Uz(e,u):u.intersects(e)}cancelAnimation(){var e,t;!((e=this.camera.landmarks)===null||e===void 0)&&e.length&&this.camera.cancelLandmarkAnimation(),(t=this.transformResolver)===null||t===void 0||t.call(this)}}var At=function(r,e,t,n){function i(a){return a instanceof t?a:new t(function(s){s(a)})}return new(t||(t=Promise))(function(a,s){function o(u){try{c(n.next(u))}catch(d){s(d)}}function l(u){try{c(n.throw(u))}catch(d){s(d)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,e||[])).next())})};class Hh extends Wd{constructor(e){var t;super(),this.options={},this.rendered=!1,this.destroyed=!1,this.context={model:new RJ},this.isCollapsingExpanding=!1,this.onResize=nc(()=>{this.resize()},300),this._setOptions(Object.assign({},Hh.defaultOptions,e),!0),this.context.graph=this,this.options.autoResize&&((t=globalThis.addEventListener)===null||t===void 0||t.call(globalThis,"resize",this.onResize))}getOptions(){return this.options}setOptions(e){this._setOptions(e,!1)}_setOptions(e,t){if(this.updateCanvas(e),Object.assign(this.options,FJ(e)),t){const{data:h}=e;h&&this.addData(h);return}const{behaviors:n,combo:i,data:a,edge:s,layout:o,node:l,plugins:c,theme:u,transforms:d}=e;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),d&&this.setTransforms(d)}getSize(){return this.context.canvas?this.context.canvas.getSize():[this.options.width||0,this.options.height||0]}setSize(e,t){e&&(this.options.width=e),t&&(this.options.height=t),this.resize(e,t)}setZoomRange(e){this.options.zoomRange=e}getZoomRange(){return this.options.zoomRange}setNode(e){this.options.node=e,this.context.model.refreshData()}setEdge(e){this.options.edge=e,this.context.model.refreshData()}setCombo(e){this.options.combo=e,this.context.model.refreshData()}getTheme(){return this.options.theme}setTheme(e){this.options.theme=Ie(e)?e(this.getTheme()):e}setLayout(e){this.options.layout=Ie(e)?e(this.getLayout()):e}getLayout(){return this.options.layout}setBehaviors(e){var t;this.options.behaviors=Ie(e)?e(this.getBehaviors()):e,(t=this.context.behavior)===null||t===void 0||t.setBehaviors(this.options.behaviors)}updateBehavior(e){this.setBehaviors(t=>t.map(n=>typeof n=="object"&&n.key===e.key?Object.assign(Object.assign({},n),e):n))}getBehaviors(){return this.options.behaviors||[]}setPlugins(e){var t;this.options.plugins=Ie(e)?e(this.getPlugins()):e,(t=this.context.plugin)===null||t===void 0||t.setPlugins(this.options.plugins)}updatePlugin(e){this.setPlugins(t=>t.map(n=>typeof n=="object"&&n.key===e.key?Object.assign(Object.assign({},n),e):n))}getPlugins(){return this.options.plugins||[]}getPluginInstance(e){return this.context.plugin.getPluginInstance(e)}setTransforms(e){var t;this.options.transforms=Ie(e)?e(this.getTransforms()):e,(t=this.context.transform)===null||t===void 0||t.setTransforms(this.options.transforms)}updateTransform(e){this.setTransforms(t=>t.map(n=>typeof n=="object"&&n.key===e.key?Object.assign(Object.assign({},n),e):n)),this.context.model.refreshData()}getTransforms(){return this.options.transforms||[]}getData(){return this.context.model.getData()}getElementData(e){return Array.isArray(e)?e.map(t=>this.context.model.getElementDataById(t)):this.context.model.getElementDataById(e)}getNodeData(e){var t;return e===void 0?this.context.model.getNodeData():Array.isArray(e)?this.context.model.getNodeData(e):(t=this.context.model.getNodeData([e]))===null||t===void 0?void 0:t[0]}getEdgeData(e){var t;return e===void 0?this.context.model.getEdgeData():Array.isArray(e)?this.context.model.getEdgeData(e):(t=this.context.model.getEdgeData([e]))===null||t===void 0?void 0:t[0]}getComboData(e){var t;return e===void 0?this.context.model.getComboData():Array.isArray(e)?this.context.model.getComboData(e):(t=this.context.model.getComboData([e]))===null||t===void 0?void 0:t[0]}setData(e){this.context.model.setData(Ie(e)?e(this.getData()):e)}addData(e){this.context.model.addData(Ie(e)?e(this.getData()):e)}addNodeData(e){this.context.model.addNodeData(Ie(e)?e(this.getNodeData()):e)}addEdgeData(e){this.context.model.addEdgeData(Ie(e)?e(this.getEdgeData()):e)}addComboData(e){this.context.model.addComboData(Ie(e)?e(this.getComboData()):e)}addChildrenData(e,t){this.context.model.addChildrenData(e,t)}updateData(e){this.context.model.updateData(Ie(e)?e(this.getData()):e)}updateNodeData(e){this.context.model.updateNodeData(Ie(e)?e(this.getNodeData()):e)}updateEdgeData(e){this.context.model.updateEdgeData(Ie(e)?e(this.getEdgeData()):e)}updateComboData(e){this.context.model.updateComboData(Ie(e)?e(this.getComboData()):e)}removeData(e){this.context.model.removeData(Ie(e)?e(this.getData()):e)}removeNodeData(e){this.context.model.removeNodeData(Ie(e)?e(this.getNodeData()):e)}removeEdgeData(e){this.context.model.removeEdgeData(Ie(e)?e(this.getEdgeData()):e)}removeComboData(e){this.context.model.removeComboData(Ie(e)?e(this.getComboData()):e)}getElementType(e){return this.context.model.getElementType(e)}getRelatedEdgesData(e,t="both"){return this.context.model.getRelatedEdgesData(e,t)}getNeighborNodesData(e){return this.context.model.getNeighborNodesData(e)}getAncestorsData(e,t){return this.context.model.getAncestorsData(e,t)}getParentData(e,t){return this.context.model.getParentData(e,t)}getChildrenData(e){return this.context.model.getChildrenData(e)}getDescendantsData(e){return this.context.model.getDescendantsData(e)}getElementDataByState(e,t){return this.context.model.getElementDataByState(e,t)}initCanvas(){return At(this,void 0,void 0,function*(){var e;if(this.context.canvas)return yield this.context.canvas.ready;const{container:t="container",width:n,height:i,renderer:a,cursor:s,background:o,canvas:l,devicePixelRatio:c=(e=globalThis.devicePixelRatio)!==null&&e!==void 0?e:1}=this.options;if(t instanceof tC)this.context.canvas=t,s&&t.setCursor(s),a&&t.setRenderer(a),yield t.ready;else{const u=gt(t)?document.getElementById(t):t,d=iC(u);this.emit(we.BEFORE_CANVAS_INIT,{container:u,width:n,height:i});const h=Object.assign(Object.assign({},l),{container:u,width:n||d[0],height:i||d[1],background:o,renderer:a,cursor:s,devicePixelRatio:c}),f=new tC(h);this.context.canvas=f,yield f.ready,this.emit(we.AFTER_CANVAS_INIT,{canvas:f})}})}updateCanvas(e){var t,n;const{renderer:i,cursor:a,height:s,width:o}=e,l=this.context.canvas;l&&(i&&(this.emit(we.BEFORE_RENDERER_CHANGE,{renderer:this.options.renderer}),l.setRenderer(i),this.emit(we.AFTER_RENDERER_CHANGE,{renderer:i})),a&&l.setCursor(a),(Ce(o)||Ce(s))&&this.setSize((t=o!=null?o:this.options.width)!==null&&t!==void 0?t:0,(n=s!=null?s:this.options.height)!==null&&n!==void 0?n:0))}initRuntime(){this.context.options=this.options,this.context.batch||(this.context.batch=new CJ(this.context)),this.context.plugin||(this.context.plugin=new zJ(this.context)),this.context.viewport||(this.context.viewport=new $J(this.context)),this.context.transform||(this.context.transform=new jJ(this.context)),this.context.element||(this.context.element=new LJ(this.context)),this.context.animation||(this.context.animation=new OJ(this.context)),this.context.layout||(this.context.layout=new DJ(this.context)),this.context.behavior||(this.context.behavior=new NJ(this.context))}prepare(){return At(this,void 0,void 0,function*(){if(yield Promise.resolve(),this.destroyed)throw new Error(Ji("The graph instance has been destroyed"));yield this.initCanvas(),this.initRuntime()})}render(){return At(this,void 0,void 0,function*(){if(yield this.prepare(),Tn(this,new bn(we.BEFORE_RENDER)),this.options.layout)if(!this.rendered&&V$(this.options.layout)){const e=yield this.context.element.preLayoutDraw({type:"render"});yield Promise.all([e==null?void 0:e.finished,this.autoFit()])}else{const e=this.context.element.draw({type:"render"});yield Promise.all([e==null?void 0:e.finished,this.context.layout.postLayout()]),yield this.autoFit()}else{const e=this.context.element.draw({type:"render"});yield Promise.all([e==null?void 0:e.finished,this.autoFit()])}this.rendered=!0,Tn(this,new bn(we.AFTER_RENDER))})}draw(){return At(this,void 0,void 0,function*(){var e;yield this.prepare(),yield(e=this.context.element.draw())===null||e===void 0?void 0:e.finished})}layout(e){return At(this,void 0,void 0,function*(){yield this.context.layout.postLayout(e)})}stopLayout(){this.context.layout.stopLayout()}clear(){return At(this,void 0,void 0,function*(){const{model:e,element:t}=this.context;e.setData({}),e.clearChanges(),t==null||t.clear()})}destroy(){var e;Tn(this,new bn(we.BEFORE_DESTROY));const{layout:t,animation:n,element:i,model:a,canvas:s,behavior:o,plugin:l}=this.context;l==null||l.destroy(),o==null||o.destroy(),t==null||t.destroy(),n==null||n.destroy(),i==null||i.destroy(),a.destroy(),s==null||s.destroy(),this.options={},this.context={},this.off(),(e=globalThis.removeEventListener)===null||e===void 0||e.call(globalThis,"resize",this.onResize),this.destroyed=!0,Tn(this,new bn(we.AFTER_DESTROY))}getCanvas(){return this.context.canvas}resize(e,t){var n;const i=iC((n=this.context.canvas)===null||n===void 0?void 0:n.getContainer()),a=[e||i[0],t||i[1]];if(!this.context.canvas)return;const s=this.context.canvas.getSize();sn(a,s)||(Tn(this,new bn(we.BEFORE_SIZE_CHANGE,{size:a})),this.context.canvas.resize(...a),Tn(this,new bn(we.AFTER_SIZE_CHANGE,{size:a})))}fitView(e,t){return At(this,void 0,void 0,function*(){var n;yield(n=this.context.viewport)===null||n===void 0?void 0:n.fitView(e,t)})}fitCenter(e){return At(this,void 0,void 0,function*(){var t;yield(t=this.context.viewport)===null||t===void 0?void 0:t.fitCenter({animation:e})})}autoFit(){return At(this,void 0,void 0,function*(){const{autoFit:e}=this.context.options;if(e)if(gt(e))e==="view"?yield this.fitView():e==="center"&&(yield this.fitCenter());else{const{type:t,animation:n}=e;t==="view"?yield this.fitView(e.options,n):t==="center"&&(yield this.fitCenter(n))}})}focusElement(e,t){return At(this,void 0,void 0,function*(){var n;yield(n=this.context.viewport)===null||n===void 0?void 0:n.focusElements(Array.isArray(e)?e:[e],{animation:t})})}zoomBy(e,t,n){return At(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",scale:e,origin:n},t)})}zoomTo(e,t,n){return At(this,void 0,void 0,function*(){this.context.viewport.transform({mode:"absolute",scale:e,origin:n},t)})}getZoom(){return this.context.viewport.getZoom()}rotateBy(e,t,n){return At(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",rotate:e,origin:n},t)})}rotateTo(e,t,n){return At(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",rotate:e,origin:n},t)})}getRotation(){return this.context.viewport.getRotation()}translateBy(e,t){return At(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",translate:e},t)})}translateTo(e,t){return At(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",translate:e},t)})}getPosition(){return St([0,0],this.getCanvasByViewport([0,0]))}translateElementBy(e,t){return At(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=pn(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(l).forEach(([u,d])=>this.context.model.translateNodeLikeBy(u,d)),yield(o=this.context.element.draw({animation:c,stage:"translate"}))===null||o===void 0?void 0:o.finished})}translateElementTo(e,t){return At(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=pn(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(l).forEach(([u,d])=>this.context.model.translateNodeLikeTo(u,d)),yield(o=this.context.element.draw({animation:c,stage:"translate"}))===null||o===void 0?void 0:o.finished})}getElementPosition(e){return this.context.model.getElementPosition(e)}getElementRenderStyle(e){return bb(this.context.element.getElement(e).attributes,["context"])}setElementVisibility(e,t){return At(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=pn(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],u={nodes:[],edges:[],combos:[]};Object.entries(l).forEach(([f,g])=>{const p=this.getElementType(f);u[`${p}s`].push({id:f,style:{visibility:g}})});const{model:d,element:h}=this.context;d.preventUpdateNodeLikeHierarchy(()=>{d.updateData(u)}),yield(o=h.draw({animation:c,stage:"visibility"}))===null||o===void 0?void 0:o.finished})}showElement(e,t){return At(this,void 0,void 0,function*(){const n=Array.isArray(e)?e:[e];yield this.setElementVisibility(Object.fromEntries(n.map(i=>[i,"visible"])),t)})}hideElement(e,t){return At(this,void 0,void 0,function*(){const n=Array.isArray(e)?e:[e];yield this.setElementVisibility(Object.fromEntries(n.map(i=>[i,"hidden"])),t)})}getElementVisibility(e){var t,n;const i=this.context.element.getElement(e);return(n=(t=i==null?void 0:i.style)===null||t===void 0?void 0:t.visibility)!==null&&n!==void 0?n:"visible"}setElementZIndex(e,t){return At(this,void 0,void 0,function*(){var n;const i={nodes:[],edges:[],combos:[]},a=pn(e)?e:{[e]:t};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(e){return At(this,void 0,void 0,function*(){const t=Array.isArray(e)?e:[e],{model:n}=this.context,i={};t.map(a=>{const s=n.getFrontZIndex(a);if(n.getElementType(a)==="combo"){const l=n.getAncestorsData(a,Mt).at(-1)||this.getComboData(a),c=[l,...n.getDescendantsData(te(l))],u=s-aC(l);c.forEach(h=>{i[te(h)]=this.getElementZIndex(te(h))+u});const{internal:d}=L1(c.map(te),h=>n.getRelatedEdgesData(h));d.forEach(h=>{const f=te(h);i[f]=this.getElementZIndex(f)+u})}else i[a]=s}),yield this.setElementZIndex(i)})}getElementZIndex(e){return aC(this.context.model.getElementDataById(e))}setElementState(e,t){return At(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=pn(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],u=h=>h?Array.isArray(h)?h:[h]:[],d={nodes:[],edges:[],combos:[]};Object.entries(l).forEach(([h,f])=>{const g=this.getElementType(h);d[`${g}s`].push({id:h,states:u(f)})}),this.updateData(d),yield(o=this.context.element.draw({animation:c,stage:"state"}))===null||o===void 0?void 0:o.finished})}getElementState(e){return this.context.model.getElementState(e)}getElementRenderBounds(e){return this.context.element.getElement(e).getRenderBounds()}collapseElement(e){return At(this,arguments,void 0,function*(t,n=!0){const{model:i,element:a}=this.context;if(wr(i.getNodeLikeData([t])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!0});const s=i.getElementType(t);yield this.frontElement(t),this.isCollapsingExpanding=!0,this.setElementCollapsibility(t,!0),s==="node"?yield a.collapseNode(t,n):s==="combo"&&(yield a.collapseCombo(t,!!n.animation)),this.isCollapsingExpanding=!1})}expandElement(e){return At(this,arguments,void 0,function*(t,n=!0){const{model:i,element:a}=this.context;if(!wr(i.getNodeLikeData([t])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!0});const s=i.getElementType(t);this.isCollapsingExpanding=!0,this.setElementCollapsibility(t,!1),s==="node"?yield a.expandNode(t,n):s==="combo"&&(yield a.expandCombo(t,!!n.animation)),this.isCollapsingExpanding=!1})}setElementCollapsibility(e,t){const n=this.getElementType(e);n==="node"?this.updateNodeData([{id:e,style:{collapsed:t}}]):n==="combo"&&this.updateComboData([{id:e,style:{collapsed:t}}])}toDataURL(){return At(this,arguments,void 0,function*(e={}){return this.context.canvas.toDataURL(e)})}getCanvasByViewport(e){return this.context.canvas.getCanvasByViewport(e)}getViewportByCanvas(e){return this.context.canvas.getViewportByCanvas(e)}getClientByCanvas(e){return this.context.canvas.getClientByCanvas(e)}getCanvasByClient(e){return this.context.canvas.getCanvasByClient(e)}getViewportCenter(){return this.context.viewport.getViewportCenter()}getCanvasCenter(){return this.context.viewport.getCanvasCenter()}on(e,t,n){return super.on(e,t,n)}once(e,t){return super.once(e,t)}off(e,t){return super.off(e,t)}}Hh.defaultOptions={autoResize:!1,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};var qJ=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t};function GJ(r,e){const{getNodeData:t=(o,l)=>{if(o.depth=l,!o.children)return o;const{children:c}=o,u=qJ(o,["children"]);return Object.assign(Object.assign({},u),{children:c.map(d=>d.id)})},getEdgeData:n=(o,l)=>({source:o.id,target:l.id}),getChildren:i=o=>o.children||[]}={},a=[],s=[];return vs(r,(o,l)=>{a.push(t(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 WJ extends Xa{beforeDraw(e){const{add:t,update:n}=e,{model:i}=this.context;return[...t.edges.entries(),...n.edges.entries()].forEach(([,a])=>{$L(i,a)}),e}}const $L=(r,e)=>{const{source:t,target:n}=e,i=r.getElementDataById(t),a=r.getElementDataById(n),s=wE(i,d=>r.getParentData(d,Mt)),o=wE(a,d=>r.getParentData(d,Mt)),l=te(s),c=te(o),u={sourceNode:l,targetNode:c};return e.style?Object.assign(e.style,u):e.style=u,e},VJ=(r,e,t)=>{const[n,i]=e,[a,s]=t;if(i===n)return a;const o=(r-n)/(i-n);return a+o*(s-a)},UJ=(r,e,t)=>{const[n,i]=e,[a,s]=t,o=Math.log(r-n+1)/Math.log(i-n+1);return a+o*(s-a)},HJ=(r,e,t,n=2)=>{const[i,a]=e,[s,o]=t,l=Math.pow((r-i)/(a-i),n);return s+l*(o-s)},YJ=(r,e,t)=>{const[n,i]=e,[a,s]=t,o=Math.sqrt((r-n)/(i-n));return a+o*(s-a)};class Yh extends Xa{constructor(e,t){super(e,hr({},Yh.defaultOptions,t)),this.assignSizeByCentrality=(n,i,a,s,o,l)=>{const c=[i,a],u=[s[0],o[0]],d=[s[1],o[1]],h=[s[2],o[2]],f=(g,p)=>{if(typeof l=="function")return l(g,c,p);switch(l){case"linear":return VJ(g,c,p);case"log":return UJ(g,c,p);case"pow":return HJ(g,c,p,2);case"sqrt":return YJ(g,c,p);default:return p[0]}};return[f(n,u),f(n,d),f(n,h)]}}beforeDraw(e){const{model:t}=this.context,n=t.getNodeData(),i=Ir(this.options.maxSize),a=Ir(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 d=this.assignSizeByCentrality(s.get(te(c))||0,l,o,a,i,this.options.scale),h=(u=this.context.element)===null||u===void 0?void 0:u.getElement(te(c)),f={size:d};this.assignLabelStyle(f,d,c,h),(!h||!Du(f,h.attributes))&&Lr(e,h?"update":"add","node",hr(c,{style:f}),!0)}),e}assignLabelStyle(e,t,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(e,xs(s,["labelFontSize","labelLineHeight"])),this.options.mapLabelSize){const o=this.getLabelSizeByNodeSize(t,1/0,Number(e.labelFontSize));Object.assign(e,{labelFontSize:o,labelLineHeight:o+Vz(e.labelPadding)})}return e}getLabelSizeByNodeSize(e,t,n){const i=Math.min(...e)/2,[a,s]=Array.isArray(this.options.mapLabelSize)?this.options.mapLabelSize:[n,t];return Math.min(s,Math.max(i,a))}getCentralities(e){const{model:t}=this.context,n=t.getData();if(typeof e=="function")return e(n);const i=t.getRelatedEdgesData.bind(t);return wA(n,i,e)}}Yh.defaultOptions={centrality:{type:"degree"},maxSize:80,minSize:20,scale:"linear",mapLabelSize:!1};class Kh extends Xa{constructor(e,t){super(e,Object.assign({},Kh.defaultOptions,t))}get ref(){return this.context.model.getRootsData()[0]}afterLayout(){var e;const t=On(this.ref),{graph:n,model:i}=this.context;(e=i.getData().nodes)===null||e===void 0||e.forEach(s=>{var o;if(te(s)===te(this.ref))return;const l=SA(St(On(s),t)),c=Math.abs(l)>Math.PI/2,u=!s.children||s.children.length===0,d=te(s),h=(o=this.context.element)===null||o===void 0?void 0:o.getElement(d);if(!h||!h.isVisible())return;const f=Ir(n.getElementRenderStyle(d).size)[0]/2,g=(u?1:-1)*(f+this.options.offset),p=[["translate",g*Math.cos(l),g*Math.sin(l)],["rotate",c?br(l)+180:br(l)]];i.updateNodeData([{id:te(s),style:{labelTextAlign:c===u?"right":"left",labelTextBaseline:"middle",labelTransform:p}}])}),n.draw()}}Kh.defaultOptions={offset:5};const KJ="quadratic",lC=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class Xh extends Xa{constructor(e,t){super(e,Object.assign({},Xh.defaultOptions,t)),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,d=(g,p)=>{c.getRelatedEdgesData(p).forEach(m=>!u.has(te(m))&&u.set(te(m),m))};a.forEach(d),o.forEach(d);const h=g=>{const p=c.getEdgeData().map(m=>$L(c,m));XJ(g,p).forEach(m=>!u.has(te(m))&&u.set(te(m),m))};if(l.size&&l.forEach(h),i.size&&i.forEach(h),s.size){const g=QR(wx(c.getChanges())).update.edges;s.forEach(p=>{var v;h(p);const m=(v=g.find(y=>te(y.value)===te(p)))===null||v===void 0?void 0:v.original;m&&!Dx(p,m)&&h(m)})}ki(this.options.edges)||u.forEach((g,p)=>!this.options.edges.includes(p)&&u.delete(p));const f=c.getEdgeData().map(te);return new Map([...u].sort((g,p)=>f.indexOf(g[0])-f.indexOf(p[0])))},this.applyBundlingStyle=(n,i,a)=>{const{edgeMap:s,reverses:o}=cC(i);s.forEach(l=>{l.forEach((c,u,d)=>{var h;const f=d.length,g=c.style||{};if(c.source===c.target){const m=lC.length;g.loopPlacement=lC[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 p=Object.assign(c,{type:KJ,style:g}),v=(h=this.context.element)===null||h===void 0?void 0:h.getElement(te(c));(!v||!Du(p.style,v.attributes))&&Lr(n,v?"update":"add","edge",p,!0)})})},this.resetEdgeStyle=n=>{const i=n.style||{},a=this.cacheMergeStyle.get(te(n))||{};return Object.keys(a).forEach(s=>{sn(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}=cC(i);a.forEach(o=>{var l;if(o.length===1){const u=o[0],d=(l=this.context.element)===null||l===void 0?void 0:l.getElement(te(u)),h=this.resetEdgeStyle(u);(!d||!Du(h,d.attributes))&&Lr(n,d?"update":"add","edge",h);return}const c=o.map(({source:u,target:d,style:h={}},f)=>{const{startArrow:g,endArrow:p}=h,v={},[m,y]=s[`${u}|${d}|${f}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return Wu(g)&&(v[m]=g),Wu(p)&&(v[y]=p),v}).reduce((u,d)=>Object.assign(Object.assign({},u),d),{});o.forEach((u,d,h)=>{var f;if(d!==0){Lr(n,"remove","edge",u);return}const g=Object.assign({},Ie(this.options.style)?this.options.style(h):this.options.style,{childrenData:h});this.cacheMergeStyle.set(te(u),g);const p=Object.assign(Object.assign({},u),{type:"line",style:Object.assign(Object.assign(Object.assign({},u.style),c),g)}),v=(f=this.context.element)===null||f===void 0?void 0:f.getElement(te(u));(!v||!Du(p.style,v.attributes))&&Lr(n,v?"update":"add","edge",p,!0)})})}}beforeDraw(e){const t=this.getAffectedParallelEdges(e);return t.size===0||(this.options.mode==="bundle"?this.applyBundlingStyle(e,t,this.options.distance):this.applyMergingStyle(e,t)),e}}Xh.defaultOptions={mode:"bundle",distance:15};const cC=r=>{const e=new Map,t=new Set,n={};for(const[i,a]of r){if(t.has(i))continue;const{source:s,target:o}=a,l=`${s}-${o}`;e.has(l)||e.set(l,[]),e.get(l).push(a),t.add(i);for(const[c,u]of r)t.has(c)||Dx(a,u)&&(e.get(l).push(u),t.add(c),s===u.target&&o===u.source&&(n[`${u.source}|${u.target}|${e.get(l).length-1}`]=!0))}return{edgeMap:e,reverses:n}},XJ=(r,e,t)=>e.filter(n=>Dx(n,r)),Dx=(r,e)=>{const{sourceNode:t,targetNode:n}=r.style||{},{sourceNode:i,targetNode:a}=e.style||{};return t===i&&n===a||t===a&&n===i};class ZJ extends Xa{beforeDraw(e,t){const{stage:n}=t;if(n==="visibility")return e;const{model:i}=this.context,{update:{nodes:a,edges:s,combos:o}}=e,l=(c,u)=>{i.getRelatedEdgesData(u).forEach(h=>!s.has(te(h))&&s.set(te(h),h))};return a.forEach(l),o.forEach(l),e}}const JJ={animation:{"combo-collapse":gA,"combo-expand":qz,"node-collapse":hA,"node-expand":jz,"path-in":fA,"path-out":$z,fade:Bz,translate:zz},behavior:{"brush-select":uc,"click-select":Nd,"collapse-expand":$d,"create-edge":qd,"drag-canvas":Gd,"drag-element-force":Y$,"drag-element":pc,"fix-element-size":Ud,"focus-element":Hd,"hover-activate":Yd,"lasso-select":X$,"auto-adapt-label":Td,"optimize-viewport-transform":Kd,"scroll-canvas":Xd,"zoom-canvas":Zd},combo:{circle:H8,rect:Y8},edge:{cubic:Is,line:tP,polyline:zd,quadratic:gc,"cubic-horizontal":Dd,"cubic-radial":Fd,"cubic-vertical":Bd},layout:{"antv-dagre":Jq,"combo-combined":cW,"compact-box":hu.compactBox,"d3-force":IW,"force-atlas2":QU,circular:tG,concentric:$1,dagre:bh,dendrogram:hu.dendrogram,fishbone:xh,force:CP,fruchterman:nH,grid:iH,indented:hu.indented,mds:AP,mindmap:hu.mindmap,radial:fH,random:xH,snake:wh},node:{circle:fc,diamond:Xj,ellipse:Rd,hexagon:t8,html:Ld,image:YA,rect:V8,star:U8,donut:Pd,triangle:Id},palette:{spectral:DH,tableau:FH,oranges:BH,greens:zH,blues:jH},theme:{dark:pJ,light:yJ},plugin:{"bubble-sets":_h,"edge-bundling":Mh,"edge-filter-lens":Th,"grid-line":Nh,background:Eh,contextmenu:kh,fisheye:Oh,fullscreen:Ch,history:Ah,hull:Ph,legend:zh,minimap:jh,snapline:$h,timebar:qh,toolbar:Gh,tooltip:Wh,watermark:Vh},transform:{"arrange-draw-order":bJ,"collapse-expand-combo":xJ,"collapse-expand-node":wJ,"get-edge-actual-ends":WJ,"map-node-size":Yh,"place-radial-labels":Kh,"process-parallel-edges":Xh,"update-related-edges":ZJ},shape:{circle:sa,ellipse:sc,group:An,html:oc,image:$b,line:Ss,path:Pr,polygon:Rs,polyline:kd,rect:Yn,text:Ls,label:Ua,badge:Fo}};function QJ(){Object.entries(JJ).forEach(([r,e])=>{Object.entries(e).forEach(([t,n])=>{zL(r,t,n)})})}QJ();const Al=class Al extends gc{onCreate(){this.shapeMap.key.animate([{lineDashOffset:Al.lineDashGap*2},{lineDashOffset:0}],{duration:500,iterations:1/0,delay:0})}};Nt(Al,"tyoe","ant-quadratic"),Nt(Al,"lineDashGap",5);let ys=Al;zL(No.EDGE,ys.tyoe,ys,!0);const eQ=pt({__name:"TrackGraph",props:{nodes:{},queryResult:{},showUnitResults:{},filterUnitResults:{}},setup(r){const e=r,t=Xt(),n=v=>e.nodes[v],i=$e(()=>bI(e.queryResult.unitResults.asJsReadonlyArrayView().flatMap(v=>v.context.toArray()),v=>v.id)),a=$e(()=>l3(e.nodes,i.value)),s=v=>({id:v.id.toString(),children:a.value.getChildren(v).map(s)}),o=$e(()=>GJ(s(a.value.topNode))),l=v=>a.value.getChildren(v).length>0,c=$e(()=>{const v={},m={},y=N=>{const A=`#${N.source.id}-${N.target.id}`,P=v[A]||0;v[A]=P+1;const L=A+(P>0?`-${P}`:"");return m[L]=N,{id:L,source:String(N.source.id),target:String(N.target.id)}},w=e.showUnitResults.map(N=>({result:N,pathList:N.getNodeConnectPath(n3).asJsReadonlyArrayView().concat()})).map(({result:N,pathList:A})=>{const P=A.map(L=>y(L));return{result:N,edgeGroup:P}}),E=w.flatMap(N=>N.edgeGroup),_=N=>m[N.id].formatConnectOffset,O=N=>w.findIndex(A=>A.edgeGroup.some(P=>P.id===N.id));return{groupList:w,edgeList:E,getLabel:_,getColor:N=>{const A=e.showUnitResults.indexOf(w[O(N)].result);return uo[A%uo.length]},getGroupIndex:O}}),u=v=>{var m;return((m=v.id)==null?void 0:m[0])==="#"},d=(v,m,y,b)=>Math.sqrt(Math.pow(Math.abs(v-y),2)+Math.pow(Math.abs(m-b),2)),h=(v,m)=>{var w,E,_,O;const y=v.getNodeData(m.source),b=v.getNodeData(m.target);return d(((w=y.style)==null?void 0:w.x)||0,((E=y.style)==null?void 0:E.y)||0,((_=b.style)==null?void 0:_.x)||0,((O=b.style)==null?void 0:O.y)||0)},f=/\d+/,g=Tt();Rl(()=>{g.value&&g.value.destroy()}),Mi(t,async()=>{if(!t.value)return;const v=new Hh({container:t.value,data:o.value,autoFit:"view",padding:[24,48],animation:!1,node:{type(m){const y=n(m.id);return l(y)?"triangle":"rect"},style(m){const y=n(m.id),b=e.queryResult.target.id===y.id,w=a.value.isPlaceholder(y),E=c3(y);return{size:l(y)?4:1,direction:l(y)?"down":void 0,fill:l(y)?"#767C82":"#E3E3E3",pointerEvents:"none",labelPlacement:"right",labelText:a.value.getLabel(y),labelOffsetX:2,labelFontWeight:E&&!w?"bold":void 0,labelOpacity:w?.5:void 0,labelPointerEvents:"none",labelStroke:b?"#0FF":void 0}}},edge:{type(m){return u(m)?ys.tyoe:"polyline"},style(m){if(u(m)){const y=h(v,m),b=c.value.getLabel(m),w=b.match(f);return{curveOffset:30*(Number(m.source)>Number(m.target)?1:-1),stroke:c.value.getColor(m)||"#FF7FFF",zIndex:1+c.value.getGroupIndex(m),pointerEvents:"none",endArrow:!0,endArrowOpacity:.5,endArrowPointerEvents:"none",labelText:b,labelFill:"#F00",labelFontSize:w&&y<50?8:12,labelBackground:!0,labelBackgroundStroke:"#FF00FF",labelPadding:w?[0,1,-2,0]:[0,0,-1,0],labelBackgroundLineWidth:1,labelBackgroundRadius:2,labelBackgroundPointerEvents:"none",labelOffsetX:y<50?-5:0,labelPointerEvents:"none",lineDash:[ys.lineDashGap,ys.lineDashGap]}}return{router:{type:"orth"},stroke:"#E3E3E3",pointerEvents:"none"}}},layout:{type:"indented",direction:"LR",indent:20,getHeight:()=>0},behaviors:["drag-canvas","zoom-canvas"]});await v.render(),g.value=v});const p=$e(()=>{const v=e.filterUnitResults;return v!=null&&v.length?c.value.groupList.filter(m=>v.includes(m.result)).flatMap(m=>m.edgeGroup):[]});return Mi([g,p],async([v,m],[y,b])=>{if(v){if(m!==b){const w=b.filter(_=>!m.some(O=>O.id===_.id)),E=m.filter(_=>!b.some(O=>O.id===_.id));if(!w.length&&!E.length)return;v.removeEdgeData(w.map(_=>_.id)),await v.draw(),v.addEdgeData(E)}else v.addEdgeData(m);await v.draw()}}),(v,m)=>(We(),jt("div",{class:"TrackGraph",ref_key:"el",ref:t},null,512))}}),tQ={class:"TrackCard",flex:"","flex-col":"","h-full":"","p-12px":"","box-border":"","gap-8px":"","overflow-hidden":""},nQ={flex:"","justify-between":"","items-center":""},rQ={flex:"","items-center":"","gap-4px":""},iQ={"flex-1":"",flex:"","gap-12px":"","overflow-hidden":""},aQ={"self-stretch":"",flex:"[2]"},sQ={"mb-24px":"","break-all":"","px-4px":"","py-2px":"","leading-20px":"",bg:"#eee",gkd_code:""},oQ={flex:"","flex-col":"","gap-12px":""},lQ={key:0,flex:"","gap-8px":""},cQ=["onClick"],uQ=pt({__name:"TrackCard",props:{nodes:{},queryResult:{},selector:{},onClose:{type:Function,default:So}},setup(r){const e=r,t=$e(()=>e.queryResult?e.queryResult.unitResults.asJsReadonlyArrayView().concat():[]),n=$e(()=>t.value.filter(l=>!l.context.prev)),i=$e(()=>t.value.filter(l=>l.context.prev)),a=Tt([]);ii(()=>{a.value=i.value});const s=l=>{a.value.includes(l)?a.value=a.value.filter(c=>c!==l):a.value=a.value.concat(l)},o=l=>{const c=l.value;return c instanceof zx&&t.value.some(u=>u.expression===c)&&!l.outChildren.some(u=>u.value instanceof zx)?{outline:"1px solid #00F"}:""};return(l,c)=>{const u=bs("SvgIcon"),d=Io,h=vb;return We(),jt("div",tQ,[Le("div",nQ,[Le("div",rQ,[Ee(u,{name:"path",h:"24px"}),c[0]||(c[0]=Le("div",{text:"20px/28px","font-bold":""},"选择器路径视图",-1))]),Ee(d,{text:"",onClick:l.onClose},{default:xe(()=>[Ee(u,{name:"close",h:"20px"})]),_:1},8,["onClick"])]),Le("div",iQ,[Le("div",aQ,[l.nodes.length&&l.queryResult?(We(),rn(eQ,{key:0,nodes:l.nodes,queryResult:l.queryResult,showUnitResults:se(i),filterUnitResults:se(a),class:"h-[calc(100%-2px)] b-1px b-solid"},null,8,["nodes","queryResult","showUnitResults","filterUnitResults"])):Nn("",!0),c[1]||(c[1]=Le("div",{relative:"","pointer-events-none":"","z-1":""},[Le("div",{absolute:"","left-8px":"","bottom-8px":"",text:"12px/14px #6C6E71"}," *为简化视图已隐藏无关节点 ")],-1))]),Ee(h,{class:"self-stretch flex-1"},{default:xe(()=>[Le("div",sQ,[Ee(ku,{class:"gkd_code",source:l.selector.source,node:l.selector.ast,getNodeStyle:o},null,8,["source","node"])]),Le("div",oQ,[se(n).length?(We(),jt("div",lQ,[(We(!0),jt(oi,null,ds(se(n),(f,g)=>(We(),jt("div",{key:g,"break-all":"","px-4px":"","py-2px":"",gkd_code:"","b-1px":"","b-solid":"",b:"#ccc"},[Ee(ku,{class:"gkd_code",source:l.selector.source,node:l.selector.findAst(f.expression)},null,8,["source","node"])]))),128))])):Nn("",!0),(We(!0),jt(oi,null,ds(se(i),(f,g)=>(We(),jt("div",{key:g,"cursor-pointer":"","break-all":"","px-4px":"","py-2px":"",gkd_code:"","b-1px":"","b-solid":"","transition-colors":"",onClick:p=>s(f),style:Ri({borderColor:se(uo)[g%se(uo).length],backgroundColor:se(a).includes(f)?"#eee":void 0})},[Le("div",{"inline-block":"","align-middle":"","size-16px":"",style:Ri({backgroundColor:se(uo)[g%se(uo).length]})},null,4),c[2]||(c[2]=Le("span",{"pl-4px":""},null,-1)),Ee(ku,{class:"gkd_code",source:l.selector.source,node:l.selector.findAst(f.expression)},null,8,["source","node"])],12,cQ))),128))])]),_:1})])])}}}),dQ=pt({__name:"TrackModal",props:{data:{},show:{type:Boolean},onUpdateShow:{type:Function,default:So},onUpdateData:{type:Function,default:So}},setup(r){const e=r,t=Xt(!1),n=Xt(0);return Ky(()=>e.show,async()=>{e.show?(t.value=!0,n.value=-1,await new Promise(i=>setTimeout(i,300)),n.value=0):(n.value=1,await new Promise(i=>setTimeout(i,300)),t.value=!1,n.value=0,e.onUpdateData())}),P3("keyup",i=>{i.key==="Escape"&&e.onUpdateShow(!1)}),(i,a)=>se(t)?(We(),jt("div",{key:0,class:Ll(["TrackModal",{"track-model-enter":se(n)===-1,"track-model-exit":se(n)===1}]),absolute:"","left-0":"","top-0":"","bg-white":"","z-3000":"",w:"[--gkd-w]",h:"[--gkd-h]"},[i.data?(We(),rn(uQ,R3({key:0},i.data,{onClose:a[0]||(a[0]=s=>i.onUpdateShow(!1))}),null,16)):Nn("",!0)],2)):Nn("",!0)}}),hQ=V3(dQ,[["__scopeId","data-v-66dad45d"]]),uC=r=>{const e=Tt(),t={x:0,y:0},n=gb({...t});let i;const a=u=>{i&&u.preventDefault()},s=u=>{i=u,t.x=n.x,t.y=n.y},o=u=>{if(!i||!e.value)return;const d=u.clientX-i.clientX,h=u.clientY-i.clientY;r(d)&&(n.x=t.x+d),n.y=t.y+h},l=()=>{i=void 0},c=()=>{if(!e.value||!i)return;l();const{top:u,bottom:d,left:h,right:f}=e.value.getBoundingClientRect();(f<0||h>window.innerWidth||d<0||u>window.innerHeight)&&(n.x=t.x,n.y=t.y)};return xd(()=>{window.addEventListener("pointermove",o),window.addEventListener("pointerup",c),document.addEventListener("selectstart",a)}),Rl(()=>{window.removeEventListener("pointermove",o),window.removeEventListener("pointerup",c),document.removeEventListener("selectstart",a),l()}),Mi(e,(u,d)=>{u&&(u.addEventListener("pointerdown",s),u.addEventListener("pointerup",l)),d&&(d.removeEventListener("pointerdown",s),d.removeEventListener("pointerup",l))}),Rl(()=>{e.value&&(e.value.removeEventListener("pointerdown",s),e.value.removeEventListener("pointerup",l))}),{target:e,offset:n}};let ul=1e3;const fQ=()=>{ul++;const r=Tt(ul);return{zIndex:r,setTop:()=>{r.value!==ul&&(ul++,r.value=ul)}}},dC="transition-top,bottom,left,right-500",Zh=pt({__name:"DraggableCard",props:{initialValue:{default:()=>({})},minWidth:{},sizeDraggable:{type:Boolean},show:{type:Boolean,default:!0},class:{}},setup(r){var E,_;const e=r,t=e.initialValue.left!==void 0,n=e.initialValue.top!==void 0,i={x:(E=t?e.initialValue.left:e.initialValue.right)!=null?E:0,y:(_=n?e.initialValue.top:e.initialValue.bottom)!=null?_:0},a=uC(O=>{const M=(e.initialValue.width||0)+s.offset.x+-a.offset.x-O;return(e.minWidth||0)<M}),s=uC(O=>{const M=(e.initialValue.width||0)+s.offset.x+O-a.offset.x;return(e.minWidth||0)<M}),o=gb({...i}),l=$e(()=>{const O=(e.initialValue.width||0)+s.offset.x-a.offset.x,M=e.initialValue.width?`width:${O}px;`:"",N=n?`top:${o.y}px;`:`bottom:${o.y}px;`;return t?`left:${o.x-a.offset.x}px;`+N+M:`right:${o.x-s.offset.x}px;`+N+M});let c;const u=Tt(!1),d=O=>{c=O,i.x=o.x,i.y=o.y,u.value=!1},h=O=>{if(!p.value||!c)return;const M=O.clientX-c.clientX,N=O.clientY-c.clientY;o.x=i.x+(t?M:-M),o.y=i.y+(n?N:-N),u.value=!0},f=()=>{c=void 0},g=Tt(),p=Tt(),v=O=>{c&&O.preventDefault()},m=()=>{if(!p.value||!c)return;f();const{top:O,bottom:M,left:N,right:A}=p.value.getBoundingClientRect();if(A<0||N>window.innerWidth||M<0||O>window.innerHeight){o.x=i.x,o.y=i.y;const P=g.value;P&&(P.classList.add(dC),setTimeout(()=>{P.classList.remove(dC)},550))}};xd(()=>{window.addEventListener("pointermove",h),window.addEventListener("pointerup",m),document.addEventListener("selectstart",v)}),Rl(()=>{window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",m),document.removeEventListener("selectstart",v),f()}),Mi(p,(O,M)=>{O&&(O.addEventListener("pointerdown",d),O.addEventListener("pointerup",f)),M&&(M.removeEventListener("pointerdown",d),M.removeEventListener("pointerup",f))}),Rl(()=>{p.value&&(p.value.removeEventListener("pointerdown",d),p.value.removeEventListener("pointerup",f))});const y=O=>{O instanceof HTMLElement?p.value=O:p.value=void 0},{setTop:b,zIndex:w}=fQ();return Mi(()=>e.show,()=>{e.show&&b()}),(O,M)=>(We(),rn(xC,{to:"body"},[O.show?(We(),jt("div",{key:0,fixed:"",ref_key:"box",ref:g,class:Ll(["DraggableCard",e.class]),style:Ri([se(l),{zIndex:se(w)}]),onMousedown:M[0]||(M[0]=(...N)=>se(b)&&se(b)(...N))},[L3(O.$slots,"default",{onRef:y,moved:se(u)}),O.sizeDraggable?(We(),jt(oi,{key:0},[Le("div",{ref:se(a).target,absolute:"","right-full":"","top-0":"","bottom-0":"","w-5px":"","cursor-ew-resize":""},null,512),Le("div",{ref:se(s).target,absolute:"","left-full":"","top-0":"","bottom-0":"","w-5px":"","cursor-ew-resize":""},null,512)],64)):Nn("",!0)],38)):Nn("",!0)]))}}),gQ=async r=>fetch("https://detect.gkd.li/api/getImportId?id="+r).then(e=>e.json()).catch(()=>0),$s=I3("snapshot",()=>{const r=wC(),e=EC(),t=D3(),n=SC(),{snapshotImportId:i,snapshotImageId:a,importSnapshotId:s}=n,o=Tt();Ky(()=>r.params.snapshotId,I=>{o.value=F3(I)});const l=$e(()=>{if(o.value)return i[o.value]}),c=$e(()=>{if(o.value)return a[o.value]}),u=Tt();ii(()=>{u.value&&(document.title="快照-"+(Ei(u.value).name||u.value.appId))});const d=Tt(),h=$e(()=>{if(d.value)return URL.createObjectURL(new Blob([d.value],{type:"image/png"}))}),f=Tt(!1),g=rI(async I=>{if(f.value=!1,!I){u.value=void 0,d.value=void 0;return}if(await Promise.all([X3.getItem(I).then(G=>{u.value=G||void 0}),Z3.getItem(I).then(G=>{d.value=G||void 0})]),!u.value){const G=i[I]||await gQ(I);if(G&&Number.isSafeInteger(G)){f.value=!0,e.replace({path:"/i/"+G,query:r.query});return}}}),p=$e(()=>g.loading);Ky(()=>o.value,g.invoke),ii(()=>{l.value&&n.inited&&!s[l.value]&&o.value&&(s[l.value]=o.value,fetch("https://detect.gkd.li/api/detectSnapshot?importId="+l.value))});const v=$e(()=>J3()&&t.inited&&t.autoUploadImport&&n.inited);ii(()=>{v.value&&u.value&&!c.value&&U3(u.value),v.value&&u.value&&!l.value&&H3(u.value),v.value&&u.value&&l.value&&Y3(u.value.id,l.value)});const m=$e(()=>u.value&&t.inited?u.value.nodes.length<=t.maxShowNodeSize?structuredClone(u.value.nodes):structuredClone(u.value.nodes.slice(0,t.maxShowNodeSize)):[]),y=$e(()=>{if(m.value.length)return u3(m.value)}),b=$e(()=>u.value?u.value.nodes.length-t.maxShowNodeSize:0),w=Tt(),E=Tt(0),_=Tt(),O=Tt(),M=async I=>{w.value=I,E.value=Date.now(),await co(),O.value&&!O.value.includes(I)&&(_.value=void 0,O.value=void 0)};ii(()=>{y.value&&M(y.value)});const N=I=>{_.value=I;const G=d3(m.value,_.value);G.length&&M(G[0]),G.length>1&&(O.value=G)},A=Xt(!1),P=Tt();return{snapshotId:o,snapshot:u,rootNode:y,screenshotUrl:h,loading:p,redirected:f,importId:l,imageId:c,focusNode:w,updateFocusNode:M,focusTime:E,overlapNodes:O,missNodeSize:b,focusPosition:_,updatePosition:N,trackData:P,trackShow:A,showTrack:(I,G)=>{A.value=!0,P.value={selector:I,nodes:m.value,queryResult:G}}}}),vQ={absolute:"","top-0":"","right-0":"","pt-4px":"","pr-8px":""},pQ={key:0,flex:"","justify-between":"","items-center":""},mQ={flex:"","items-center":"","h-24px":"","px-2px":""},yQ={"max-w-500px":""},bQ=pt({__name:"AttrCard",props:{show:{type:Boolean},onUpdateShow:{type:Function,default:So}},setup(r){const{focusNode:e}=Ns($s()),t=$e(()=>{const s=e.value;return s?{_id:{desc:"虚拟属性(真机不可用):生成快照访问节点顺序",type:"info",show:!0},_pid:{desc:"虚拟属性(真机不可用):父节点的 _id",type:"info",show:!0},_selector:{desc:"自动生成的选择器, 点击“_selector”可直接复制内容, 用于定位",type:"info",show:!0},depth:{desc:"使用此属性在某些应用上可能造成无限节点错误",type:"info",show:!0},id:{desc:"可快速查找",type:"quickFind",show:!!((s.quickFind||s.idQf)&&s.attr.id)},vid:{desc:"可快速查找",type:"quickFind",show:!!((s.quickFind||s.idQf)&&s.attr.vid)},text:{desc:"可快速查找",type:"quickFind",show:!!((s.quickFind||s.textQf)&&s.attr.text)}}:{}}),n=["text","desc"],i=$e(()=>e.value?Object.entries(e.value.attr).map(([s,o])=>{var c,u,d;const l={name:s,value:o,desc:JSON.stringify(o),tip:(c=t.value[s])!=null&&c.show?t.value[s]:void 0};return n.includes(s)?[l,{name:s+".length",value:(u=o==null?void 0:o.length)!=null?u:null,desc:JSON.stringify((d=o==null?void 0:o.length)!=null?d:null),tip:void 0}]:l}).flat():[]),a=$e(()=>e.value?h3(e.value):"");return(s,o)=>{const l=bs("SvgIcon"),c=Io,u=lb,d=ob,h=GI,f=iI,g=WI,p=qI,v=$I;return We(),rn(Zh,{initialValue:{top:40,right:10},class:"box-shadow-dim",show:s.show&&!!se(e)},{default:xe(({onRef:m})=>[Le("div",vQ,[Ee(c,{onClick:o[0]||(o[0]=y=>s.onUpdateShow(!s.show)),text:"",title:"最小化"},{icon:xe(()=>[Ee(l,{name:"minus"})]),_:1})]),se(e)?(We(),rn(v,{key:0,size:"small",striped:"",singleLine:!1,class:"gkd_code",themeOverrides:{thPaddingSmall:"1px 3px",tdPaddingSmall:"0px 3px"}},{default:xe(()=>[Le("thead",null,[Le("tr",{ref:m,"cursor-move":""},o[2]||(o[2]=[Le("th",null,"Name",-1),Le("th",null,"Value",-1)]),512)]),Ee(p,null,{default:xe(()=>[(We(!0),jt(oi,null,ds(se(i),y=>(We(),rn(g,{key:y.name},{default:xe(()=>[Ee(h,{onClick:b=>se(_i)(`${y.name}=${y.desc}`)},{default:xe(()=>[y.tip?(We(),jt("div",pQ,[Le("div",null,vt(y.name),1),Ee(d,null,{trigger:xe(()=>[Ee(u,{size:"16"},{default:xe(()=>[y.tip.type=="info"?(We(),rn(l,{key:0,name:"info"})):y.tip.type=="quickFind"?(We(),rn(l,{key:1,name:"ok"})):Nn("",!0)]),_:2},1024)]),default:xe(()=>[zt(" "+vt(y.tip.desc),1)]),_:2},1024)])):(We(),jt(oi,{key:1},[zt(vt(y.name),1)],64))]),_:2},1032,["onClick"]),Ee(h,null,{default:xe(()=>[Ee(f,{class:Ll(["w-[calc(var(--gkd-w)*0.12)]",{"text-left direction-rtl":y.name=="id","opacity-50":y.value===null}])},{default:xe(()=>[zt(vt(y.desc),1)]),_:2},1032,["class"])]),_:2},1024)]),_:2},1024))),128)),Ee(g,null,{default:xe(()=>[Ee(h,{colspan:"2"},{default:xe(()=>[Le("div",mQ,[Ee(d,null,{trigger:xe(()=>[Ee(c,{text:"",onClick:o[1]||(o[1]=y=>se(_i)(se(a)))},{icon:xe(()=>[Ee(u,{size:"20"},{default:xe(()=>[Ee(l,{name:"path"})]),_:1})]),_:1})]),default:xe(()=>[Le("div",yQ,vt(se(a)),1)]),_:1})])]),_:1})]),_:1})]),_:1})]),_:2},1024)):Nn("",!0)]),_:1},8,["show"])}}}),xQ={bg:"#eee","px-2px":""},wQ=pt({__name:"OverlapCard",setup(r){const e=$s(),{focusNode:t,overlapNodes:n,focusPosition:i}=Ns(e),s=document.documentElement.scrollWidth/100*25.5;return(o,l)=>{const c=Io,u=_C,d=B3;return We(),rn(Zh,{initialValue:{top:215,left:s},class:"box-shadow-dim w-420px",show:!!(se(n)&&se(i))},{default:xe(({onRef:h})=>[se(n)&&se(i)?(We(),rn(d,{key:0,size:"small",closable:"",onClose:l[0]||(l[0]=f=>n.value=void 0)},{header:xe(()=>[Le("div",{ref:h,"cursor-move":""},[l[1]||(l[1]=zt(" 位置 ")),Le("span",xQ,vt(`${se(i).x.toFixed(0)},${se(i).y.toFixed()}`),1),zt(" 存在 "+vt(se(n).length)+" 个层叠节点 ",1)],512)]),default:xe(()=>[Ee(u,{style:{"max-height":"400px","overflow-y":"scroll","padding-bottom":"10px"},class:"scrollbar-hidden"},{default:xe(()=>[(We(!0),jt(oi,null,ds(se(n),f=>(We(),rn(c,{key:f.id,onClick:g=>se(e).updateFocusNode(f),size:"small",style:Ri(se(Pl)(f,se(t)))},{default:xe(()=>[zt(vt(se(po)(f)),1)]),_:2},1032,["onClick","style"]))),128))]),_:1})]),_:2},1024)):Nn("",!0)]),_:1},8,["initialValue","show"])}}}),Fx=z3(),qL=$e(()=>Fx.width.value/100),GL=$e(()=>Math.max(1200,Fx.width.value));$e(()=>Math.max(700,Fx.height.value));const EQ={"bg-white":"","b-1px":"","b-solid":"","b-gray-200":"","rounded-4px":"","p-8px":""},SQ={flex:"","m-b-4px":"","pr-4px":""},_Q={"min-h-24px":""},kQ={key:0,"color-red":"","whitespace-pre":""},MQ=pt({__name:"RuleCard",props:{show:{type:Boolean},onUpdateShow:{type:Function,default:So}},setup(r){const e=$s(),t=Ns(e),{rootNode:n,focusNode:i}=t,a=t.snapshot,s=Tt(""),o=j3(s,500),l=g=>{if(g==null)return[];if(typeof g=="string")return[g];if(Array.isArray(g)&&g.every(p=>typeof p=="string"))return g},c=g=>{const p=l(g.matches);if(!p)return"非法格式: matches";const v=l(g.anyMatches);if(!v)return"非法格式: anyMatches";const m=l(g.excludeMatches);if(!m)return"非法格式: excludeMatches";const y=[];for(let M=0;M<p.length;M++){const N=p[M];try{y.push(Mu(N))}catch(A){const P=A instanceof Error?A.message:String(A);return`非法选择器: matches[${M}]
470
470
  错误: ${P}`}}const b=y.map(M=>M.querySelectorAll(n.value));if(y.length){const M=b.findIndex(N=>N.length===0);if(M>=0)return`无法匹配: matches[${M}] 查找结果为空`}const w=[];for(let M=0;M<v.length;M++){const N=v[M];try{w.push(Mu(N))}catch(A){const P=A instanceof Error?A.message:String(A);return`非法选择器: anyMatches[${M}]
471
471
  错误: ${P}`}}const E=w.map(M=>M.querySelectorAll(n.value));if(w.length&&E.every(M=>M.length===0))return"无法匹配: anyMatches 查找结果为空";if(!p.length&&!v.length)return"非法规则: matches 和 anyMatches 至少存在一个";const _=[];for(let M=0;M<m.length;M++){const N=m[M];try{_.push(Mu(N))}catch(A){const P=A instanceof Error?A.message:String(A);return`非法选择器: excludeMatches[${M}]
472
- 错误: ${P}`}}const O=_.map(M=>M.querySelectorAll(n.value));if(_.length){const M=O.findIndex(N=>N.length!==0);if(M>=0)return`无法匹配: excludeMatches[${M}] 查找结果不为空`}return b.length?b.at(-1)[0]:E[0][0]},u=g=>typeof g=="object"&&g!==null&&!Array.isArray(g),d=$e(()=>{if(!o.value)return"";const g=(()=>{try{return MC.parse(o.value)}catch(p){return p}})();if(g instanceof Error)return`非法格式: ${g.message}`;if(!u(g))return"非法格式: 请使用对象格式";if(typeof g.id=="string"){if(g.id!==a.value.appId)return"非法格式: id 不匹配 appId";if(!Array.isArray(g.groups))return"非法格式: groups 不是数组";if(g.groups.length!==1)return"非法格式: groups 长度不为 1";const p=g.groups[0];if(!(p!=null&&p.rules))return"非法格式: groups[0].rules 非法";const v=Array.isArray(p.rules)?p.rules:[p.rules];if(v.length!==1)return"非法格式: groups[0].rules 长度不为 1";const m=typeof v[0]=="string"?{matches:v[0]}:v[0];return u(m)?c(m):"非法格式: rules[0] 非法"}if(g.rules){const p=Array.isArray(g.rules)?g.rules:[g.rules];if(p.length!==1)return"非法格式: rules 长度不为 1";const v=typeof p[0]=="string"?{matches:p[0]}:p[0];return u(v)?c(v):"非法格式: rules[0] 非法"}return c(g)}),h=$e(()=>s.value&&o.value&&typeof d.value=="string"?d.value:""),f=$e(()=>typeof d.value=="string"?null:d.value);return(g,p)=>{const v=bs("SvgIcon"),m=Io,y=TC;return We(),rn(Zh,{initialValue:{top:40,right:Math.max(315,12*se(qL)+135),width:Math.max(480,se(GL)*.3)},minWidth:300,sizeDraggable:"",class:"box-shadow-dim",show:g.show},{default:xe(({onRef:b})=>[Le("div",wQ,[Le("div",EQ,[p[3]||(p[3]=Le("div",null,"测试规则",-1)),Le("div",{"flex-1":"","cursor-move":"",ref:b},null,512),Ee(m,{onClick:p[0]||(p[0]=w=>g.onUpdateShow(!g.show)),text:"",title:"最小化"},{icon:xe(()=>[Ee(v,{name:"minus"})]),_:1})]),Ee(y,{value:se(s),"onUpdate:value":p[1]||(p[1]=w=>mo(s)?s.value=w:null),type:"textarea",placeholder:"请输入单个规则测试",size:"small",class:"gkd_code m-b-4px",autosize:{minRows:10,maxRows:20}},null,8,["value"]),Le("div",SQ,[se(h)?(We(),jt("div",_Q,vt(se(h)),1)):se(f)?(We(),rn(m,{key:1,onClick:p[2]||(p[2]=w=>se(e).updateFocusNode(se(f))),size:"small",style:Ri(se(Pl)(se(f),se(i)))},{default:xe(()=>[zt(vt(se(po)(se(f))),1)]),_:1},8,["style"])):Nn("",!0)])])]),_:1},8,["initialValue","show"])}}}),MQ=["src"],TQ={absolute:"","left-2px":"","top-2px":"","p-1px":"","z-1":"","text-13px":"",class:"leading-[1] bg-[rgba(256,256,256,0.7)]"},OQ={key:0,absolute:"","left-2px":"","bottom-2px":"","p-1px":"","z-1":"","text-12px":"",class:"leading-[1] bg-[rgba(256,256,256,0.7)]",flex:"","flex-col":"","flex-items-center":""},CQ={key:1,absolute:"","right-2px":"","bottom-2px":"","p-1px":"","z-1":"","text-12px":"",class:"leading-[1] bg-[rgba(256,256,256,0.7)]",flex:"","flex-col":"","flex-items-center":""},NQ=pt({__name:"MiniHoverImg",props:{imgRef:{},imgHover:{type:Boolean},screenshotUrl:{},hoverPosition:{},hoverPositionStyle:{},boxHoverPosition:{},boxHoverPerPosition:{}},setup(r){const e=r,t=$3($e(()=>e.imgRef));return(n,i)=>(We(),rn(xC,{to:"body"},[vC(Le("div",{style:Ri({left:se(t).right.value+4+"px",top:se(t).top.value+"px"}),"pointer-events-none":"",fixed:"","overflow-hidden":"","z-2":"","bg-white":"","h-200px":"","w-200px":"","border-1px":"","border-indigo-600":"","border-dashed":""},[Le("img",{src:n.screenshotUrl,"object-contain":"",absolute:"","left-0":"","top-0":"",style:Ri(n.hoverPositionStyle),"w-1000px":""},null,12,MQ),Le("div",TQ,vt(`${n.hoverPosition.ox.toFixed(0)},${n.hoverPosition.oy.toFixed(0)}`),1),n.boxHoverPosition?(We(),jt("div",OQ,[Le("div",null,vt(n.boxHoverPosition.top.toFixed(0)),1),Le("div",null,vt(n.boxHoverPosition.left.toFixed(0)+","+n.boxHoverPosition.right.toFixed(0)),1),Le("div",null,vt(n.boxHoverPosition.bottom.toFixed(0)),1)])):Nn("",!0),n.boxHoverPerPosition?(We(),jt("div",CQ,[Le("div",null,vt(n.boxHoverPerPosition.top),1),Le("div",null,vt(n.boxHoverPerPosition.left+","+n.boxHoverPerPosition.right),1),Le("div",null,vt(n.boxHoverPerPosition.bottom),1)])):Nn("",!0),i[0]||(i[0]=Le("div",{class:"top-[calc(50%-1px)] bg-[length:10px_1px]",absolute:"","left-0":"","right-0":"","h-1px":"","bg-repeat-x":"","mix-blend-difference":"",style:{"background-image":`linear-gradient(
472
+ 错误: ${P}`}}const O=_.map(M=>M.querySelectorAll(n.value));if(_.length){const M=O.findIndex(N=>N.length!==0);if(M>=0)return`无法匹配: excludeMatches[${M}] 查找结果不为空`}return b.length?b.at(-1)[0]:E[0][0]},u=g=>typeof g=="object"&&g!==null&&!Array.isArray(g),d=$e(()=>{if(!o.value)return"";const g=(()=>{try{return MC.parse(o.value)}catch(p){return p}})();if(g instanceof Error)return`非法格式: ${g.message}`;if(!u(g))return"非法格式: 请使用对象格式";if(typeof g.id=="string"){if(g.id!==a.value.appId)return"非法格式: id 不匹配 appId";if(!Array.isArray(g.groups))return"非法格式: groups 不是数组";if(g.groups.length!==1)return"非法格式: groups 长度不为 1";const p=g.groups[0];if(!(p!=null&&p.rules))return"非法格式: groups[0].rules 非法";const v=Array.isArray(p.rules)?p.rules:[p.rules];if(v.length!==1)return"非法格式: groups[0].rules 长度不为 1";const m=typeof v[0]=="string"?{matches:v[0]}:v[0];return u(m)?c(m):"非法格式: rules[0] 非法"}if(g.rules){const p=Array.isArray(g.rules)?g.rules:[g.rules];if(p.length!==1)return"非法格式: rules 长度不为 1";const v=typeof p[0]=="string"?{matches:p[0]}:p[0];return u(v)?c(v):"非法格式: rules[0] 非法"}return c(g)}),h=$e(()=>s.value&&o.value&&typeof d.value=="string"?d.value:""),f=$e(()=>typeof d.value=="string"?null:d.value);return(g,p)=>{const v=bs("SvgIcon"),m=Io,y=TC;return We(),rn(Zh,{initialValue:{top:40,right:Math.max(315,12*se(qL)+135),width:Math.max(480,se(GL)*.3)},minWidth:300,sizeDraggable:"",class:"box-shadow-dim",show:g.show},{default:xe(({onRef:b})=>[Le("div",EQ,[Le("div",SQ,[p[3]||(p[3]=Le("div",null,"测试规则",-1)),Le("div",{"flex-1":"","cursor-move":"",ref:b},null,512),Ee(m,{onClick:p[0]||(p[0]=w=>g.onUpdateShow(!g.show)),text:"",title:"最小化"},{icon:xe(()=>[Ee(v,{name:"minus"})]),_:1})]),Ee(y,{value:se(s),"onUpdate:value":p[1]||(p[1]=w=>mo(s)?s.value=w:null),type:"textarea",placeholder:"请输入单个规则测试",size:"small",class:"gkd_code m-b-4px",autosize:{minRows:10,maxRows:20}},null,8,["value"]),Le("div",_Q,[se(h)?(We(),jt("div",kQ,vt(se(h)),1)):se(f)?(We(),rn(m,{key:1,onClick:p[2]||(p[2]=w=>se(e).updateFocusNode(se(f))),size:"small",style:Ri(se(Pl)(se(f),se(i)))},{default:xe(()=>[zt(vt(se(po)(se(f))),1)]),_:1},8,["style"])):Nn("",!0)])])]),_:1},8,["initialValue","show"])}}}),TQ=["src"],OQ={absolute:"","left-2px":"","top-2px":"","p-1px":"","z-1":"","text-13px":"",class:"leading-[1] bg-[rgba(256,256,256,0.7)]"},CQ={key:0,absolute:"","left-2px":"","bottom-2px":"","p-1px":"","z-1":"","text-12px":"",class:"leading-[1] bg-[rgba(256,256,256,0.7)]",flex:"","flex-col":"","flex-items-center":""},NQ={key:1,absolute:"","right-2px":"","bottom-2px":"","p-1px":"","z-1":"","text-12px":"",class:"leading-[1] bg-[rgba(256,256,256,0.7)]",flex:"","flex-col":"","flex-items-center":""},AQ=pt({__name:"MiniHoverImg",props:{imgRef:{},imgHover:{type:Boolean},screenshotUrl:{},hoverPosition:{},hoverPositionStyle:{},boxHoverPosition:{},boxHoverPerPosition:{}},setup(r){const e=r,t=$3($e(()=>e.imgRef));return(n,i)=>(We(),rn(xC,{to:"body"},[vC(Le("div",{style:Ri({left:se(t).right.value+4+"px",top:se(t).top.value+"px"}),"pointer-events-none":"",fixed:"","overflow-hidden":"","z-2":"","bg-white":"","h-200px":"","w-200px":"","border-1px":"","border-indigo-600":"","border-dashed":""},[Le("img",{src:n.screenshotUrl,"object-contain":"",absolute:"","left-0":"","top-0":"",style:Ri(n.hoverPositionStyle),"w-1000px":""},null,12,TQ),Le("div",OQ,vt(`${n.hoverPosition.ox.toFixed(0)},${n.hoverPosition.oy.toFixed(0)}`),1),n.boxHoverPosition?(We(),jt("div",CQ,[Le("div",null,vt(n.boxHoverPosition.top.toFixed(0)),1),Le("div",null,vt(n.boxHoverPosition.left.toFixed(0)+","+n.boxHoverPosition.right.toFixed(0)),1),Le("div",null,vt(n.boxHoverPosition.bottom.toFixed(0)),1)])):Nn("",!0),n.boxHoverPerPosition?(We(),jt("div",NQ,[Le("div",null,vt(n.boxHoverPerPosition.top),1),Le("div",null,vt(n.boxHoverPerPosition.left+","+n.boxHoverPerPosition.right),1),Le("div",null,vt(n.boxHoverPerPosition.bottom),1)])):Nn("",!0),i[0]||(i[0]=Le("div",{class:"top-[calc(50%-1px)] bg-[length:10px_1px]",absolute:"","left-0":"","right-0":"","h-1px":"","bg-repeat-x":"","mix-blend-difference":"",style:{"background-image":`linear-gradient(
473
473
  to left,
474
474
  transparent 0%,
475
475
  transparent 50%,
@@ -481,5 +481,5 @@ YYYY`):pr(t,"MM月");case"year":return pr(t,"YYYY");default:return pr(t,"YYYY-MM
481
481
  transparent 50%,
482
482
  #fff 50%,
483
483
  #fff 100%
484
- )`,"background-position-y":"1.5px"}},null,-1))],4),[[pC,n.imgHover]])]))}}),AQ={key:0,flex:"","flex-col":"",relative:"","h-full":"","p-2px":"","box-border":"","overflow-hidden":""},PQ=["src"],RQ={"pointer-events-none":"",absolute:"","left-2px":"","top-2px":"",size:"[calc(100%-4px)]"},LQ={absolute:"","z-4":"","pointer-events-none":"","left-0":"","top-0":"","text-12px":"",leading:"100%",flex:"","gap-4px":""},IQ={"p-1px":"",bg:"#ffffff70"},DQ={"p-1px":"",bg:"#ffffff70"},FQ=pt({__name:"ScreenshotCard",setup(r){const e=$s(),{updatePosition:t}=e,n=Ns(e),{focusNode:i,screenshotUrl:a}=n,s=$e(()=>e.snapshot),o=Tt(),l=Tt(!1),c=b=>{const w=o.value;if(!w)return;const E=w.getBoundingClientRect(),_=E.width/w.naturalWidth*w.naturalHeight,O=(E.height-_)/2,M=(b.clientX-E.left)/E.width*w.naturalWidth,N=(b.clientY-E.top-O)/_*w.naturalHeight;t({x:M,y:N})},u=b=>`${b*100}%`,d=q3(o),h=$e(()=>{var M;const b=o.value,w=(M=i.value)==null?void 0:M.attr;if(!i.value||!b||!w||!l.value)return"";const E=d.width.value,_=d.height.value,O=E/b.naturalWidth*b.naturalHeight;return{left:`calc(${u(w.left/b.naturalWidth)} - 2px)`,width:`calc(${u((w.right-w.left)/b.naturalWidth)} + 2px)`,top:`calc(${u((w.top/b.naturalHeight*O+(_-O)/2)/_)} - 2px)`,height:`calc(${u((w.bottom-w.top)/b.naturalHeight*O/_)} + 2px)`}}),f=Tt(!1),g=Tt({ox:0,oy:0}),p=$e(()=>{var _;const b=(_=i.value)==null?void 0:_.attr;if(!b)return;const{ox:w,oy:E}=g.value;return{left:w-b.left,right:b.right-w,top:E-b.top,bottom:b.bottom-E}}),v=$e(()=>{var M;if(!((M=i.value)==null?void 0:M.attr)||!p.value)return;const{bottom:w,left:E,right:_,top:O}=p.value;return{left:(E/(_+E)).toFixed(3),right:(_/(_+E)).toFixed(3),top:(O/(O+w)).toFixed(3),bottom:(w/(O+w)).toFixed(3)}}),m=Tt({left:"0",top:"0"}),y=b=>{const w=o.value;if(!w)return;const E=w.getBoundingClientRect(),_=E.width/w.naturalWidth*w.naturalHeight,O=(E.height-_)/2,M=(b.clientX-E.left)/E.width*w.naturalWidth,N=(b.clientY-E.top-O)/_*w.naturalHeight;g.value={ox:M,oy:N},m.value={left:-(M-.1*w.naturalWidth)/w.naturalWidth*1e3+"px",top:-(N-.1*w.naturalWidth)/w.naturalWidth*1e3+"px"}};return(b,w)=>se(a)?(We(),jt("div",AQ,[Le("img",{ref_key:"imgRef",ref:o,src:se(a),onClick:c,"cursor-crosshair":"","object-contain":"","h-full":"",class:"max-w-[calc(var(--gkd-w)*0.35)]",onMouseover:w[0]||(w[0]=E=>f.value=!0),onMouseleave:w[1]||(w[1]=E=>f.value=!1),onMousemove:y,onLoad:w[2]||(w[2]=E=>l.value=!0)},null,40,PQ),Le("div",RQ,[Le("div",{style:Ri(se(h)),absolute:"","transition-all-300":"","b-1px":"","b-blue":"","b-solid":""},w[3]||(w[3]=[Le("div",{absolute:"","left-0":"","top-0":"","bottom-0":"","right-0":"","b-solid":"","b-1px":"","b-red":""},null,-1)]),4)]),Le("div",LQ,[Le("div",IQ,vt(`${se(s).screenWidth}x${se(s).screenHeight}`),1),Le("div",DQ,vt(se(kC)(se(s).id).format("YYYY-MM-DD HH:mm:ss")),1)]),se(o)?(We(),rn(NQ,{key:0,imgHover:se(f),imgRef:se(o),boxHoverPerPosition:se(v),boxHoverPosition:se(p),hoverPositionStyle:se(m),hoverPosition:se(g),screenshotUrl:se(a)},null,8,["imgHover","imgRef","boxHoverPerPosition","boxHoverPosition","hoverPositionStyle","hoverPosition","screenshotUrl"])):Nn("",!0)])):Nn("",!0)}}),BQ={"bg-white":"","b-1px":"","b-solid":"","b-gray-200":"","rounded-4px":"","p-8px":""},zQ={flex:"","m-b-4px":"","pr-4px":""},jQ={key:0,underline:"","leading-20px":"","decoration-1":"","m-r-4px":"",gkd_code:"",title:"查询数量"},$Q=["title"],qQ={flex:"","gap-8px":"","flex-wrap":""},GQ=pt({__name:"SearchCard",props:{show:{type:Boolean},onUpdateShow:{type:Function,default:So}},setup(r){const e=wC(),{snapshotImportId:t,snapshotImageId:n}=SC(),i=$s(),{updateFocusNode:a}=i,s=Ns(i),o=s.snapshot,l=s.rootNode,{focusNode:c}=s,u=Tt(""),d=gb([]),h=Tt([]),f=E=>{const _=lI(()=>Mu(E),M=>typeof M=="string"?M:M instanceof i3?"非法选择器:"+M.outMessage:"非法选择器:"+(M instanceof Error?M.message:M));if(d.find(M=>typeof M.selector=="object"&&M.selector.toString()==_.toString())){xa.warning("不可重复选择");return}const O=_.querySelectorAllContext(l.value);if(O.length==0){xa.success("没有选择到节点");return}return xa.success(`选择到 ${O.length} 个节点`),d.unshift({selector:_,nodes:O.map(M=>M.target),results:O,key:Date.now(),gkd:!0}),O.length},g=E=>{if(d.find(M=>typeof M.selector=="string"&&M.selector.toString()==E)){xa.warning("不可重复搜索");return}const _=[],O=[l.value];for(;O.length>0;){const M=O.pop();po(M).includes(E)&&_.push(M),O.push(...[...M.children].reverse())}if(_.length==0){xa.success("没有搜索到节点");return}return xa.success(`搜索到 ${_.length} 个节点`),d.unshift({gkd:!1,selector:E,nodes:_,key:Date.now()}),_.length},p=()=>{const E=d[0],_=E.nodes[0];Array.isArray(_)?typeof E.selector=="object"&&a(_):a(_);const O=new Set(d.map(N=>N.key)),M=h.value.filter(N=>O.has(N));M.push(E.key),h.value=M},v=Jx(()=>{const E=u.value.trim();if(E){if(y.value){if(!f(E))return}else if(!g(E))return;p()}});xd(async()=>{await r3;let E=0;e.query.gkd&&(E+=f(jx.decode(e.query.gkd))||0),e.query.str&&(E+=g(e.query.str)||0),E>0&&p()});const m=Jx(async E=>{var G,H,Y;const _=n[o.value.id],O=t[o.value.id],M=O?Ux(O):void 0,N=_?W3(_):void 0,A=E.selector,P=E.nodes[0],L=[((G=P.quickFind)!=null?G:P.idQf)&&P.attr.id&&A.fastQueryList.some(W=>W instanceof nf.Id&&W.value===P.attr.id),((H=P.quickFind)!=null?H:P.idQf)&&P.attr.vid&&A.fastQueryList.some(W=>W instanceof nf.Vid&&W.value===P.attr.vid),((Y=P.quickFind)!=null?Y:P.textQf)&&P.attr.text&&A.fastQueryList.some(W=>W instanceof nf.Text&&W.value===P.attr.text)].some(Boolean),I={id:o.value.appId,name:Ei(o.value).name,groups:[{key:1,name:`[ChangeMe]规则名称-${kC().format("YYYY-MM-DD HH:mm:ss")}`,desc:"[ChangeMe]本规则由GKD网页端审查工具生成",rules:[{fastQuery:L||void 0,activityIds:o.value.activityId,matches:A.toString(),exampleUrls:N,snapshotUrls:M}]}]};_i(MC.stringify(I,void 0,2))}),y=Tt(!0),b=$e(()=>t[o.value.id]),w=E=>{if(!b.value)return;const _=new URL(Ux(t[o.value.id]));typeof E.selector=="object"?_.searchParams.set("gkd",jx.encode(E.selector.toString())):_.searchParams.set("str",E.selector.toString()),_i(_.toString())};return(E,_)=>{const O=sI,M=_C,N=aI,A=bs("SvgIcon"),P=Io,L=TC,I=oI,G=_I,H=lb,Y=vb,W=PI,q=CI;return We(),rn(Zh,{initialValue:{top:40,right:Math.max(315,12*se(qL)+135),width:Math.max(480,se(GL)*.3)},minWidth:300,sizeDraggable:"",class:"box-shadow-dim",show:E.show},{default:xe(({onRef:Q})=>[Le("div",BQ,[Le("div",zQ,[Ee(N,{value:se(y),"onUpdate:value":_[0]||(_[0]=re=>mo(y)?y.value=re:null)},{default:xe(()=>[Ee(M,null,{default:xe(()=>[Ee(O,{value:!1},{default:xe(()=>_[4]||(_[4]=[zt(" 字符搜索 ")])),_:1}),Ee(O,{value:!0},{default:xe(()=>_[5]||(_[5]=[zt(" 选择器查询 ")])),_:1})]),_:1})]),_:1},8,["value"]),Le("div",{"flex-1":"","cursor-move":"",ref:Q},null,512),Ee(P,{onClick:_[1]||(_[1]=re=>E.onUpdateShow(!E.show)),text:"",title:"最小化"},{icon:xe(()=>[Ee(A,{name:"minus"})]),_:1})]),Ee(I,null,{default:xe(()=>[Ee(L,{value:se(u),"onUpdate:value":_[2]||(_[2]=re=>mo(u)?u.value=re:null),placeholder:se(y)?"请输入选择器":"请输入字符",onKeyup:G3(se(v),["enter"]),inputProps:{class:"gkd_code"}},null,8,["value","placeholder","onKeyup"]),Ee(P,{onClick:se(v)},{icon:xe(()=>[Ee(A,{name:"search"})]),_:1},8,["onClick"])]),_:1}),_[8]||(_[8]=Le("div",{"p-5px":""},null,-1)),Ee(q,{expandedNames:se(h),"onUpdate:expandedNames":_[3]||(_[3]=re=>mo(h)?h.value=re:null)},{default:xe(()=>[(We(!0),jt(oi,null,ds(se(d),(re,de)=>(We(),rn(W,{key:re.key,name:re.key},{header:xe(()=>[re.nodes.length>1?(We(),jt("span",jQ,vt(re.nodes.length),1)):Nn("",!0),Le("span",{"break-all":"","px-4px":"","leading-20px":"",bg:"#eee",gkd_code:"",title:re.gkd?"选择器":"搜索字符"},[re.gkd?(We(),rn(ku,{key:0,node:re.selector.ast,source:re.selector.source},null,8,["node","source"])):(We(),jt(oi,{key:1},[zt(vt(re.selector),1)],64))],8,$Q),_[6]||(_[6]=Le("span",{"pl-4px":""},null,-1))]),"header-extra":xe(()=>[Ee(G,null,{default:xe(()=>[re.gkd&&re.selector.canCopy?(We(),rn(P,{key:0,size:"small",onClick:lf(oe=>se(m)(re),["stop"]),title:"复制规则"},{icon:xe(()=>[Ee(A,{name:"copy"})]),_:2},1032,["onClick"])):Nn("",!0),se(b)?(We(),rn(P,{key:1,size:"small",title:re.gkd?"复制查询链接":"复制搜索链接",onClick:lf(oe=>w(re),["stop"])},{icon:xe(()=>[Ee(A,{name:"share"})]),_:2},1032,["title","onClick"])):Nn("",!0),Ee(P,{size:"small",onClick:lf(oe=>se(d).splice(de,1),["stop"]),title:"删除记录"},{icon:xe(()=>[Ee(A,{name:"delete"})]),_:2},1032,["onClick"])]),_:2},1024)]),default:xe(()=>[Ee(Y,{xScrollable:"",style:{"max-height":"400px"}},{default:xe(()=>[Le("div",qQ,[!re.gkd||re.selector.connectKeys.length===0?(We(!0),jt(oi,{key:0},ds(re.nodes,oe=>(We(),rn(P,{key:oe.id,onClick:he=>se(a)(oe),size:"small",style:Ri(se(Pl)(oe,se(c)))},{default:xe(()=>[zt(vt(se(po)(oe)),1)]),_:2},1032,["onClick","style"]))),128)):(We(!0),jt(oi,{key:1},ds(re.nodes,(oe,he)=>(We(),rn(G,{key:he},{default:xe(()=>[Ee(P,{size:"small",onClick:X=>se(i).showTrack(re.selector,re.results[he])},{default:xe(()=>[Ee(H,null,{default:xe(()=>[Ee(A,{name:"path"})]),_:1})]),_:2},1032,["onClick"]),Ee(P,{onClick:X=>se(a)(oe),size:"small",style:Ri(se(Pl)(oe,se(c)))},{default:xe(()=>[zt(vt(se(po)(oe)),1)]),_:2},1032,["onClick","style"])]),_:2},1024))),128))]),_[7]||(_[7]=Le("div",{un:"h-10px"},null,-1))]),_:2},1024)]),_:2},1032,["name"]))),128))]),_:1},8,["expandedNames"])])]),_:1},8,["initialValue","show"])}}}),hC=[],WQ=pt((r,e)=>{const t=$e(()=>r.tag||"div");return()=>{var a,s,o,l;const n=(((s=(a=e.slots).default)==null?void 0:s.call(a))||hC).filter(c=>typeof c.type!="symbol"),i=[];if(n.length>0&&i.push(n[0]),n.length>1)for(let c=1;c<n.length;c++){const u=((l=(o=e.slots).gap)==null?void 0:l.call(o,{index:c-1}))||hC;i.push(...u),i.push(n[c])}return r.virtual?i:ze(t.value,r,i)}},{props:["tag","virtual"]}),VQ={flex:"","flex-col":"","overflow-hidden":""},UQ={flex:"","items-center":"","px-8px":""},HQ={flex:"","items-center":"","gap-2px":"","max-w-120px":""},YQ=pt({__name:"WindowCard",setup(r){const e=EC(),t=$s(),{updateFocusNode:n}=t,i=Ns(t),a=i.snapshot,s=i.rootNode,{focusNode:o,focusTime:l}=i;let c=Number.NaN;const u=Tt([]),d=Tt([]);Mi([()=>o.value,()=>l.value],async()=>{if(!o.value)return;const w=o.value.id;co().then(async()=>{var O;if(await Hx(300),w===((O=o.value)==null?void 0:O.id)){if(c===w){c=Number.NaN;return}const M=document.querySelector(`[data-node-id="${w}"]`);if(!M)return;d.value=[w],M.scrollIntoView({behavior:"smooth",block:"center"})}});let E=o.value.parent;if(!E)return;const _=new Set(u.value);for(;E;)_.add(E.id),E=E.parent;_.size==u.value.length&&u.value.every(O=>_.has(O))||(u.value=[..._])});const h=Tt(),f=(w,E)=>{var _;return E.id===((_=o.value)==null?void 0:_.id)},g=w=>{const E=Pl(w.option,o.value);return{onClick:()=>{c=w.option.id,n(w.option)},style:{"--n-node-text-color":E.color,...E},class:"whitespace-nowrap","data-node-id":String(w.option.id)}},p=w=>po(w.option),v=$e(()=>`${$x(a.value).manufacturer} Android ${$x(a.value).release||""}`),m=$e(()=>Ei(a.value).isSystem),y=$e(()=>{const w=a.value.activityId,E=a.value.appId;return!w||!E?"":w.startsWith(E)&&w[E.length]==="."?w.substring(E.length):w}),b=async()=>{xa.success("删除成功,即将回到首页"),await Hx(2e3),e.replace({path:"/"})};return(w,E)=>{const _=ob,O=bs("SvgIcon"),M=iD,N=vb;return We(),jt("div",VQ,[Le("div",UQ,[Ee(se(WQ),{flex:"","flex-wrap":"","items-center":"","gap-8px":"",gkd_code:""},{gap:xe(()=>E[8]||(E[8]=[Le("div",{"w-1px":"","bg-gray":"","h-12px":""},null,-1)])),default:xe(()=>[Ee(_,null,{trigger:xe(()=>[Le("div",{onClick:E[0]||(E[0]=A=>se(_i)(se(v)))},vt(se(v)),1)]),default:xe(()=>[E[9]||(E[9]=zt(" 设备名称 "))]),_:1}),Ee(_,null,{trigger:xe(()=>[Le("div",{class:Ll({"opacity-50":!se(qx)(se(a)).versionName})},vt(se(qx)(se(a)).versionName||"null"),3)]),default:xe(()=>[E[10]||(E[10]=zt(" GKD 版本 "))]),_:1}),Le("div",HQ,[se(m)?(We(),rn(_,{key:0},{trigger:xe(()=>[Ee(O,{name:"system"})]),default:xe(()=>[zt(" "+vt(`${se(Ei)(se(a)).name} 是一个系统应用`),1)]),_:1})):Nn("",!0),Ee(_,null,{trigger:xe(()=>[Le("div",{onClick:E[1]||(E[1]=A=>se(_i)(se(Ei)(se(a)).name))},vt(se(Ei)(se(a)).name),1)]),default:xe(()=>[E[11]||(E[11]=zt(" 应用名称 "))]),_:1})]),Ee(_,null,{trigger:xe(()=>[Le("div",{onClick:E[2]||(E[2]=A=>se(_i)(se(Ei)(se(a)).versionName))},vt(se(Ei)(se(a)).versionName),1)]),default:xe(()=>[E[12]||(E[12]=zt(" 版本名称 "))]),_:1}),Ee(_,null,{trigger:xe(()=>[Le("div",{onClick:E[3]||(E[3]=A=>se(_i)(se(Ei)(se(a)).versionCode.toString()))},vt(se(Ei)(se(a)).versionCode),1)]),default:xe(()=>[E[13]||(E[13]=zt(" 版本代码 "))]),_:1}),Ee(_,null,{trigger:xe(()=>[Le("div",{onClick:E[4]||(E[4]=A=>se(_i)(se(a).appId))},vt(se(a).appId),1)]),default:xe(()=>[E[14]||(E[14]=zt(" 应用ID "))]),_:1}),Ee(_,null,{trigger:xe(()=>[Le("div",{onClick:E[5]||(E[5]=A=>se(_i)(se(y))),class:Ll({"opacity-50":!se(y)})},vt(se(y)||"null"),3)]),default:xe(()=>[E[15]||(E[15]=zt(" 界面ID "))]),_:1})]),_:1}),E[16]||(E[16]=Le("div",{"flex-1":""},null,-1)),Ee(K3,{class:"ml-8px",snapshot:se(a),onDelete:b,showPreview:!1},null,8,["snapshot"])]),E[17]||(E[17]=Le("div",{"h-1px":"","mt-4px":"",bg:"#efeff5"},null,-1)),Ee(N,{xScrollable:"",class:"flex-1"},{default:xe(()=>[Ee(M,{class:"mb-24px mr-24px",ref_key:"treeRef",ref:h,virtualScroll:"",showLine:"",blockLine:"",keyField:"id",expandedKeys:se(u),"onUpdate:expandedKeys":E[6]||(E[6]=A=>mo(u)?u.value=A:null),selectedKeys:se(d),"onUpdate:selectedKeys":E[7]||(E[7]=A=>mo(d)?d.value=A:null),data:[se(s)],filter:f,nodeProps:g,renderLabel:p},null,8,["expandedKeys","selectedKeys","data","filter","nodeProps","renderLabel"])]),_:1})])}}}),KQ={"h-full":"",flex:"","gap-5px":""},XQ={"w-28px":"","py-8px":"",flex:"","flex-col":"","gap-16px":""},ZQ={flex:"","justify-center":"",href:"https://gkd.li/guide/snapshot#share-note",target:"_blank",rel:"noopener noreferrer"},JQ={key:1,flex:"","justify-center":"","pt-80px":""},fee=pt({__name:"SnapshotPage",setup(r){const e=$s(),t=Ns(e),{snapshot:n,rootNode:i,loading:a,redirected:s,trackData:o,trackShow:l}=t;ii(()=>{a.value?Yx.start():Yx.finish()});const c=cf("searchShow",!0,sessionStorage),u=cf("ruleShow",!1,sessionStorage),d=cf("attrShow",!0,sessionStorage),h=()=>{xa.info("暂未实现")};return(f,g)=>{const p=bs("SvgIcon"),v=lb,m=bs("RouterLink"),y=Io,b=ob;return se(n)&&se(i)?(We(),jt(oi,{key:0},[Le("div",KQ,[Le("div",XQ,[Ee(b,{placement:"right"},{trigger:xe(()=>[Ee(y,{text:""},{icon:xe(()=>[Ee(m,{to:"/",title:"",color:"inherit"},{default:xe(()=>[Ee(v,{size:"24"},{default:xe(()=>[Ee(p,{name:"home"})]),_:1})]),_:1})]),_:1})]),default:xe(()=>[g[8]||(g[8]=zt(" 回到首页 "))]),_:1}),Ee(b,{placement:"right"},{trigger:xe(()=>[Ee(y,{onClick:h,text:""},{icon:xe(()=>[Ee(v,{size:"24"},{default:xe(()=>[Ee(p,{name:"settings"})]),_:1})]),_:1})]),default:xe(()=>[g[9]||(g[9]=zt(" 设置 "))]),_:1}),g[14]||(g[14]=Le("div",null,null,-1)),Ee(b,{placement:"right"},{trigger:xe(()=>[Ee(y,{text:"",onClick:g[0]||(g[0]=w=>c.value=!se(c))},{icon:xe(()=>[Ee(v,{size:"24"},{default:xe(()=>[Ee(p,{name:"search-list"})]),_:1})]),_:1})]),default:xe(()=>[g[10]||(g[10]=zt(" 搜索面板 "))]),_:1}),Ee(b,{placement:"right"},{trigger:xe(()=>[Ee(y,{onClick:g[1]||(g[1]=w=>d.value=!se(d)),text:""},{icon:xe(()=>[Ee(v,{size:"24"},{default:xe(()=>[Ee(p,{name:"prop"})]),_:1})]),_:1})]),default:xe(()=>[g[11]||(g[11]=zt(" 属性面板 "))]),_:1}),Ee(b,{placement:"right"},{trigger:xe(()=>[Ee(y,{onClick:g[2]||(g[2]=w=>u.value=!se(u)),text:""},{icon:xe(()=>[Ee(v,{size:"24"},{default:xe(()=>[Ee(p,{name:"test"})]),_:1})]),_:1})]),default:xe(()=>[g[12]||(g[12]=zt(" 测试规则 "))]),_:1}),g[15]||(g[15]=Le("div",null,null,-1)),Ee(b,{placement:"right"},{trigger:xe(()=>[Le("a",ZQ,[Ee(y,{text:""},{icon:xe(()=>[Ee(v,{size:"24"},{default:xe(()=>[Ee(p,{name:"warn"})]),_:1})]),_:1})])]),default:xe(()=>[g[13]||(g[13]=zt(" 分享须知 "))]),_:1})]),Ee(FQ),Ee(YQ,{class:"flex-1"})]),Ee(GQ,{show:se(c),onUpdateShow:g[3]||(g[3]=w=>c.value=w)},null,8,["show"]),Ee(kQ,{show:se(u),onUpdateShow:g[4]||(g[4]=w=>u.value=w)},null,8,["show"]),Ee(yQ,{show:se(d),onUpdateShow:g[5]||(g[5]=w=>d.value=w)},null,8,["show"]),Ee(xQ),Ee(dQ,{show:se(l),onUpdateShow:g[6]||(g[6]=w=>l.value=w),data:se(o),onUpdateData:g[7]||(g[7]=w=>o.value=w)},null,8,["show","data"])],64)):!se(a)&&!se(s)?(We(),jt("div",JQ,g[16]||(g[16]=[Le("div",null,"快照数据缺失",-1)]))):Nn("",!0)}}});export{fee as default};
485
- //# sourceMappingURL=SnapshotPage-BaHDcwT7.js.map
484
+ )`,"background-position-y":"1.5px"}},null,-1))],4),[[pC,n.imgHover]])]))}}),PQ={key:0,flex:"","flex-col":"",relative:"","h-full":"","p-2px":"","box-border":"","overflow-hidden":""},RQ=["src"],LQ={"pointer-events-none":"",absolute:"","left-2px":"","top-2px":"",size:"[calc(100%-4px)]"},IQ={absolute:"","z-4":"","pointer-events-none":"","left-0":"","top-0":"","text-12px":"",leading:"100%",flex:"","gap-4px":""},DQ={"p-1px":"",bg:"#ffffff70"},FQ={"p-1px":"",bg:"#ffffff70"},BQ=pt({__name:"ScreenshotCard",setup(r){const e=$s(),{updatePosition:t}=e,n=Ns(e),{focusNode:i,screenshotUrl:a}=n,s=$e(()=>e.snapshot),o=Tt(),l=Tt(!1),c=b=>{const w=o.value;if(!w)return;const E=w.getBoundingClientRect(),_=E.width/w.naturalWidth*w.naturalHeight,O=(E.height-_)/2,M=(b.clientX-E.left)/E.width*w.naturalWidth,N=(b.clientY-E.top-O)/_*w.naturalHeight;t({x:M,y:N})},u=b=>`${b*100}%`,d=q3(o),h=$e(()=>{var M;const b=o.value,w=(M=i.value)==null?void 0:M.attr;if(!i.value||!b||!w||!l.value)return"";const E=d.width.value,_=d.height.value,O=E/b.naturalWidth*b.naturalHeight;return{left:`calc(${u(w.left/b.naturalWidth)} - 2px)`,width:`calc(${u((w.right-w.left)/b.naturalWidth)} + 2px)`,top:`calc(${u((w.top/b.naturalHeight*O+(_-O)/2)/_)} - 2px)`,height:`calc(${u((w.bottom-w.top)/b.naturalHeight*O/_)} + 2px)`}}),f=Tt(!1),g=Tt({ox:0,oy:0}),p=$e(()=>{var _;const b=(_=i.value)==null?void 0:_.attr;if(!b)return;const{ox:w,oy:E}=g.value;return{left:w-b.left,right:b.right-w,top:E-b.top,bottom:b.bottom-E}}),v=$e(()=>{var M;if(!((M=i.value)==null?void 0:M.attr)||!p.value)return;const{bottom:w,left:E,right:_,top:O}=p.value;return{left:(E/(_+E)).toFixed(3),right:(_/(_+E)).toFixed(3),top:(O/(O+w)).toFixed(3),bottom:(w/(O+w)).toFixed(3)}}),m=Tt({left:"0",top:"0"}),y=b=>{const w=o.value;if(!w)return;const E=w.getBoundingClientRect(),_=E.width/w.naturalWidth*w.naturalHeight,O=(E.height-_)/2,M=(b.clientX-E.left)/E.width*w.naturalWidth,N=(b.clientY-E.top-O)/_*w.naturalHeight;g.value={ox:M,oy:N},m.value={left:-(M-.1*w.naturalWidth)/w.naturalWidth*1e3+"px",top:-(N-.1*w.naturalWidth)/w.naturalWidth*1e3+"px"}};return(b,w)=>se(a)?(We(),jt("div",PQ,[Le("img",{ref_key:"imgRef",ref:o,src:se(a),onClick:c,"cursor-crosshair":"","object-contain":"","h-full":"",class:"max-w-[calc(var(--gkd-w)*0.35)]",onMouseover:w[0]||(w[0]=E=>f.value=!0),onMouseleave:w[1]||(w[1]=E=>f.value=!1),onMousemove:y,onLoad:w[2]||(w[2]=E=>l.value=!0)},null,40,RQ),Le("div",LQ,[Le("div",{style:Ri(se(h)),absolute:"","transition-all-300":"","b-1px":"","b-blue":"","b-solid":""},w[3]||(w[3]=[Le("div",{absolute:"","left-0":"","top-0":"","bottom-0":"","right-0":"","b-solid":"","b-1px":"","b-red":""},null,-1)]),4)]),Le("div",IQ,[Le("div",DQ,vt(`${se(s).screenWidth}x${se(s).screenHeight}`),1),Le("div",FQ,vt(se(kC)(se(s).id).format("YYYY-MM-DD HH:mm:ss")),1)]),se(o)?(We(),rn(AQ,{key:0,imgHover:se(f),imgRef:se(o),boxHoverPerPosition:se(v),boxHoverPosition:se(p),hoverPositionStyle:se(m),hoverPosition:se(g),screenshotUrl:se(a)},null,8,["imgHover","imgRef","boxHoverPerPosition","boxHoverPosition","hoverPositionStyle","hoverPosition","screenshotUrl"])):Nn("",!0)])):Nn("",!0)}}),zQ={"bg-white":"","b-1px":"","b-solid":"","b-gray-200":"","rounded-4px":"","p-8px":""},jQ={flex:"","m-b-4px":"","pr-4px":""},$Q={key:0,underline:"","leading-20px":"","decoration-1":"","m-r-4px":"",gkd_code:"",title:"查询数量"},qQ=["title"],GQ={flex:"","gap-8px":"","flex-wrap":""},WQ=pt({__name:"SearchCard",props:{show:{type:Boolean},onUpdateShow:{type:Function,default:So}},setup(r){const e=wC(),{snapshotImportId:t,snapshotImageId:n}=SC(),i=$s(),{updateFocusNode:a}=i,s=Ns(i),o=s.snapshot,l=s.rootNode,{focusNode:c}=s,u=Tt(""),d=gb([]),h=Tt([]),f=E=>{const _=lI(()=>Mu(E),M=>typeof M=="string"?M:M instanceof i3?"非法选择器:"+M.outMessage:"非法选择器:"+(M instanceof Error?M.message:M));if(d.find(M=>typeof M.selector=="object"&&M.selector.toString()==_.toString())){xa.warning("不可重复选择");return}const O=_.querySelectorAllContext(l.value);if(O.length==0){xa.success("没有选择到节点");return}return xa.success(`选择到 ${O.length} 个节点`),d.unshift({selector:_,nodes:O.map(M=>M.target),results:O,key:Date.now(),gkd:!0}),O.length},g=E=>{if(d.find(M=>typeof M.selector=="string"&&M.selector.toString()==E)){xa.warning("不可重复搜索");return}const _=[],O=[l.value];for(;O.length>0;){const M=O.pop();po(M).includes(E)&&_.push(M),O.push(...[...M.children].reverse())}if(_.length==0){xa.success("没有搜索到节点");return}return xa.success(`搜索到 ${_.length} 个节点`),d.unshift({gkd:!1,selector:E,nodes:_,key:Date.now()}),_.length},p=()=>{const E=d[0],_=E.nodes[0];Array.isArray(_)?typeof E.selector=="object"&&a(_):a(_);const O=new Set(d.map(N=>N.key)),M=h.value.filter(N=>O.has(N));M.push(E.key),h.value=M},v=Jx(()=>{const E=u.value.trim();if(E){if(y.value){if(!f(E))return}else if(!g(E))return;p()}});xd(async()=>{await r3;let E=0;e.query.gkd&&(E+=f(jx.decode(e.query.gkd))||0),e.query.str&&(E+=g(e.query.str)||0),E>0&&p()});const m=Jx(async E=>{var G,H,Y;const _=n[o.value.id],O=t[o.value.id],M=O?Ux(O):void 0,N=_?W3(_):void 0,A=E.selector,P=E.nodes[0],L=[((G=P.quickFind)!=null?G:P.idQf)&&P.attr.id&&A.fastQueryList.some(W=>W instanceof nf.Id&&W.value===P.attr.id),((H=P.quickFind)!=null?H:P.idQf)&&P.attr.vid&&A.fastQueryList.some(W=>W instanceof nf.Vid&&W.value===P.attr.vid),((Y=P.quickFind)!=null?Y:P.textQf)&&P.attr.text&&A.fastQueryList.some(W=>W instanceof nf.Text&&W.value===P.attr.text)].some(Boolean),I={id:o.value.appId,name:Ei(o.value).name,groups:[{key:1,name:`[ChangeMe]规则名称-${kC().format("YYYY-MM-DD HH:mm:ss")}`,desc:"[ChangeMe]本规则由GKD网页端审查工具生成",rules:[{fastQuery:L||void 0,activityIds:o.value.activityId,matches:A.toString(),exampleUrls:N,snapshotUrls:M}]}]};_i(MC.stringify(I,void 0,2))}),y=Tt(!0),b=$e(()=>t[o.value.id]),w=E=>{if(!b.value)return;const _=new URL(Ux(t[o.value.id]));typeof E.selector=="object"?_.searchParams.set("gkd",jx.encode(E.selector.toString())):_.searchParams.set("str",E.selector.toString()),_i(_.toString())};return(E,_)=>{const O=sI,M=_C,N=aI,A=bs("SvgIcon"),P=Io,L=TC,I=oI,G=_I,H=lb,Y=vb,W=PI,q=CI;return We(),rn(Zh,{initialValue:{top:40,right:Math.max(315,12*se(qL)+135),width:Math.max(480,se(GL)*.3)},minWidth:300,sizeDraggable:"",class:"box-shadow-dim",show:E.show},{default:xe(({onRef:Q})=>[Le("div",zQ,[Le("div",jQ,[Ee(N,{value:se(y),"onUpdate:value":_[0]||(_[0]=re=>mo(y)?y.value=re:null)},{default:xe(()=>[Ee(M,null,{default:xe(()=>[Ee(O,{value:!1},{default:xe(()=>_[4]||(_[4]=[zt(" 字符搜索 ")])),_:1}),Ee(O,{value:!0},{default:xe(()=>_[5]||(_[5]=[zt(" 选择器查询 ")])),_:1})]),_:1})]),_:1},8,["value"]),Le("div",{"flex-1":"","cursor-move":"",ref:Q},null,512),Ee(P,{onClick:_[1]||(_[1]=re=>E.onUpdateShow(!E.show)),text:"",title:"最小化"},{icon:xe(()=>[Ee(A,{name:"minus"})]),_:1})]),Ee(I,null,{default:xe(()=>[Ee(L,{value:se(u),"onUpdate:value":_[2]||(_[2]=re=>mo(u)?u.value=re:null),placeholder:se(y)?"请输入选择器":"请输入字符",onKeyup:G3(se(v),["enter"]),inputProps:{class:"gkd_code"}},null,8,["value","placeholder","onKeyup"]),Ee(P,{onClick:se(v)},{icon:xe(()=>[Ee(A,{name:"search"})]),_:1},8,["onClick"])]),_:1}),_[8]||(_[8]=Le("div",{"p-5px":""},null,-1)),Ee(q,{expandedNames:se(h),"onUpdate:expandedNames":_[3]||(_[3]=re=>mo(h)?h.value=re:null)},{default:xe(()=>[(We(!0),jt(oi,null,ds(se(d),(re,de)=>(We(),rn(W,{key:re.key,name:re.key},{header:xe(()=>[re.nodes.length>1?(We(),jt("span",$Q,vt(re.nodes.length),1)):Nn("",!0),Le("span",{"break-all":"","px-4px":"","leading-20px":"",bg:"#eee",gkd_code:"",title:re.gkd?"选择器":"搜索字符"},[re.gkd?(We(),rn(ku,{key:0,node:re.selector.ast,source:re.selector.source},null,8,["node","source"])):(We(),jt(oi,{key:1},[zt(vt(re.selector),1)],64))],8,qQ),_[6]||(_[6]=Le("span",{"pl-4px":""},null,-1))]),"header-extra":xe(()=>[Ee(G,null,{default:xe(()=>[re.gkd&&re.selector.canCopy?(We(),rn(P,{key:0,size:"small",onClick:lf(oe=>se(m)(re),["stop"]),title:"复制规则"},{icon:xe(()=>[Ee(A,{name:"copy"})]),_:2},1032,["onClick"])):Nn("",!0),se(b)?(We(),rn(P,{key:1,size:"small",title:re.gkd?"复制查询链接":"复制搜索链接",onClick:lf(oe=>w(re),["stop"])},{icon:xe(()=>[Ee(A,{name:"share"})]),_:2},1032,["title","onClick"])):Nn("",!0),Ee(P,{size:"small",onClick:lf(oe=>se(d).splice(de,1),["stop"]),title:"删除记录"},{icon:xe(()=>[Ee(A,{name:"delete"})]),_:2},1032,["onClick"])]),_:2},1024)]),default:xe(()=>[Ee(Y,{xScrollable:"",style:{"max-height":"400px"}},{default:xe(()=>[Le("div",GQ,[!re.gkd||re.selector.connectKeys.length===0?(We(!0),jt(oi,{key:0},ds(re.nodes,oe=>(We(),rn(P,{key:oe.id,onClick:he=>se(a)(oe),size:"small",style:Ri(se(Pl)(oe,se(c)))},{default:xe(()=>[zt(vt(se(po)(oe)),1)]),_:2},1032,["onClick","style"]))),128)):(We(!0),jt(oi,{key:1},ds(re.nodes,(oe,he)=>(We(),rn(G,{key:he},{default:xe(()=>[Ee(P,{size:"small",onClick:X=>se(i).showTrack(re.selector,re.results[he])},{default:xe(()=>[Ee(H,null,{default:xe(()=>[Ee(A,{name:"path"})]),_:1})]),_:2},1032,["onClick"]),Ee(P,{onClick:X=>se(a)(oe),size:"small",style:Ri(se(Pl)(oe,se(c)))},{default:xe(()=>[zt(vt(se(po)(oe)),1)]),_:2},1032,["onClick","style"])]),_:2},1024))),128))]),_[7]||(_[7]=Le("div",{un:"h-10px"},null,-1))]),_:2},1024)]),_:2},1032,["name"]))),128))]),_:1},8,["expandedNames"])])]),_:1},8,["initialValue","show"])}}}),hC=[],VQ=pt((r,e)=>{const t=$e(()=>r.tag||"div");return()=>{var a,s,o,l;const n=(((s=(a=e.slots).default)==null?void 0:s.call(a))||hC).filter(c=>typeof c.type!="symbol"),i=[];if(n.length>0&&i.push(n[0]),n.length>1)for(let c=1;c<n.length;c++){const u=((l=(o=e.slots).gap)==null?void 0:l.call(o,{index:c-1}))||hC;i.push(...u),i.push(n[c])}return r.virtual?i:ze(t.value,r,i)}},{props:["tag","virtual"]}),UQ={flex:"","flex-col":"","overflow-hidden":""},HQ={flex:"","items-center":"","px-8px":""},YQ={flex:"","items-center":"","gap-2px":"","max-w-120px":""},KQ=pt({__name:"WindowCard",setup(r){const e=EC(),t=$s(),{updateFocusNode:n}=t,i=Ns(t),a=i.snapshot,s=i.rootNode,{focusNode:o,focusTime:l}=i;let c=Number.NaN;const u=Tt([]),d=Tt([]);Mi([()=>o.value,()=>l.value],async()=>{if(!o.value)return;const w=o.value.id;co().then(async()=>{var O;if(await Hx(300),w===((O=o.value)==null?void 0:O.id)){if(c===w){c=Number.NaN;return}const M=document.querySelector(`[data-node-id="${w}"]`);if(!M)return;d.value=[w],M.scrollIntoView({behavior:"smooth",block:"center"})}});let E=o.value.parent;if(!E)return;const _=new Set(u.value);for(;E;)_.add(E.id),E=E.parent;_.size==u.value.length&&u.value.every(O=>_.has(O))||(u.value=[..._])});const h=Tt(),f=(w,E)=>{var _;return E.id===((_=o.value)==null?void 0:_.id)},g=w=>{const E=Pl(w.option,o.value);return{onClick:()=>{c=w.option.id,n(w.option)},style:{"--n-node-text-color":E.color,...E},class:"whitespace-nowrap","data-node-id":String(w.option.id)}},p=w=>po(w.option),v=$e(()=>`${$x(a.value).manufacturer} Android ${$x(a.value).release||""}`),m=$e(()=>Ei(a.value).isSystem),y=$e(()=>{const w=a.value.activityId,E=a.value.appId;return!w||!E?"":w.startsWith(E)&&w[E.length]==="."?w.substring(E.length):w}),b=async()=>{xa.success("删除成功,即将回到首页"),await Hx(2e3),e.replace({path:"/"})};return(w,E)=>{const _=ob,O=bs("SvgIcon"),M=iD,N=vb;return We(),jt("div",UQ,[Le("div",HQ,[Ee(se(VQ),{flex:"","flex-wrap":"","items-center":"","gap-8px":"",gkd_code:""},{gap:xe(()=>E[8]||(E[8]=[Le("div",{"w-1px":"","bg-gray":"","h-12px":""},null,-1)])),default:xe(()=>[Ee(_,null,{trigger:xe(()=>[Le("div",{onClick:E[0]||(E[0]=A=>se(_i)(se(v)))},vt(se(v)),1)]),default:xe(()=>[E[9]||(E[9]=zt(" 设备名称 "))]),_:1}),Ee(_,null,{trigger:xe(()=>[Le("div",{class:Ll({"opacity-50":!se(qx)(se(a)).versionName})},vt(se(qx)(se(a)).versionName||"null"),3)]),default:xe(()=>[E[10]||(E[10]=zt(" GKD 版本 "))]),_:1}),Le("div",YQ,[se(m)?(We(),rn(_,{key:0},{trigger:xe(()=>[Ee(O,{name:"system"})]),default:xe(()=>[zt(" "+vt(`${se(Ei)(se(a)).name} 是一个系统应用`),1)]),_:1})):Nn("",!0),Ee(_,null,{trigger:xe(()=>[Le("div",{onClick:E[1]||(E[1]=A=>se(_i)(se(Ei)(se(a)).name))},vt(se(Ei)(se(a)).name),1)]),default:xe(()=>[E[11]||(E[11]=zt(" 应用名称 "))]),_:1})]),Ee(_,null,{trigger:xe(()=>[Le("div",{onClick:E[2]||(E[2]=A=>se(_i)(se(Ei)(se(a)).versionName))},vt(se(Ei)(se(a)).versionName),1)]),default:xe(()=>[E[12]||(E[12]=zt(" 版本名称 "))]),_:1}),Ee(_,null,{trigger:xe(()=>[Le("div",{onClick:E[3]||(E[3]=A=>se(_i)(se(Ei)(se(a)).versionCode.toString()))},vt(se(Ei)(se(a)).versionCode),1)]),default:xe(()=>[E[13]||(E[13]=zt(" 版本代码 "))]),_:1}),Ee(_,null,{trigger:xe(()=>[Le("div",{onClick:E[4]||(E[4]=A=>se(_i)(se(a).appId))},vt(se(a).appId),1)]),default:xe(()=>[E[14]||(E[14]=zt(" 应用ID "))]),_:1}),Ee(_,null,{trigger:xe(()=>[Le("div",{onClick:E[5]||(E[5]=A=>se(_i)(se(y))),class:Ll({"opacity-50":!se(y)})},vt(se(y)||"null"),3)]),default:xe(()=>[E[15]||(E[15]=zt(" 界面ID "))]),_:1})]),_:1}),E[16]||(E[16]=Le("div",{"flex-1":""},null,-1)),Ee(K3,{class:"ml-8px",snapshot:se(a),onDelete:b,showPreview:!1},null,8,["snapshot"])]),E[17]||(E[17]=Le("div",{"h-1px":"","mt-4px":"",bg:"#efeff5"},null,-1)),Ee(N,{xScrollable:"",class:"flex-1"},{default:xe(()=>[Ee(M,{class:"mb-24px mr-24px",ref_key:"treeRef",ref:h,virtualScroll:"",showLine:"",blockLine:"",keyField:"id",expandedKeys:se(u),"onUpdate:expandedKeys":E[6]||(E[6]=A=>mo(u)?u.value=A:null),selectedKeys:se(d),"onUpdate:selectedKeys":E[7]||(E[7]=A=>mo(d)?d.value=A:null),data:[se(s)],filter:f,nodeProps:g,renderLabel:p},null,8,["expandedKeys","selectedKeys","data","filter","nodeProps","renderLabel"])]),_:1})])}}}),XQ={"h-full":"",flex:"","gap-5px":""},ZQ={"w-28px":"","py-8px":"",flex:"","flex-col":"","gap-16px":""},JQ={flex:"","justify-center":"",href:"https://gkd.li/guide/snapshot#share-note",target:"_blank",rel:"noopener noreferrer"},QQ={key:1,flex:"","justify-center":"","pt-80px":""},gee=pt({__name:"SnapshotPage",setup(r){const e=$s(),t=Ns(e),{snapshot:n,rootNode:i,loading:a,redirected:s,trackData:o,trackShow:l}=t;ii(()=>{a.value?Yx.start():Yx.finish()});const c=cf("searchShow",!0,sessionStorage),u=cf("ruleShow",!1,sessionStorage),d=cf("attrShow",!0,sessionStorage),h=()=>{xa.info("暂未实现")};return(f,g)=>{const p=bs("SvgIcon"),v=lb,m=bs("RouterLink"),y=Io,b=ob;return se(n)&&se(i)?(We(),jt(oi,{key:0},[Le("div",XQ,[Le("div",ZQ,[Ee(b,{placement:"right"},{trigger:xe(()=>[Ee(y,{text:""},{icon:xe(()=>[Ee(m,{to:"/",title:"",color:"inherit"},{default:xe(()=>[Ee(v,{size:"24"},{default:xe(()=>[Ee(p,{name:"home"})]),_:1})]),_:1})]),_:1})]),default:xe(()=>[g[8]||(g[8]=zt(" 回到首页 "))]),_:1}),Ee(b,{placement:"right"},{trigger:xe(()=>[Ee(y,{onClick:h,text:""},{icon:xe(()=>[Ee(v,{size:"24"},{default:xe(()=>[Ee(p,{name:"settings"})]),_:1})]),_:1})]),default:xe(()=>[g[9]||(g[9]=zt(" 设置 "))]),_:1}),g[14]||(g[14]=Le("div",null,null,-1)),Ee(b,{placement:"right"},{trigger:xe(()=>[Ee(y,{text:"",onClick:g[0]||(g[0]=w=>c.value=!se(c))},{icon:xe(()=>[Ee(v,{size:"24"},{default:xe(()=>[Ee(p,{name:"search-list"})]),_:1})]),_:1})]),default:xe(()=>[g[10]||(g[10]=zt(" 搜索面板 "))]),_:1}),Ee(b,{placement:"right"},{trigger:xe(()=>[Ee(y,{onClick:g[1]||(g[1]=w=>d.value=!se(d)),text:""},{icon:xe(()=>[Ee(v,{size:"24"},{default:xe(()=>[Ee(p,{name:"prop"})]),_:1})]),_:1})]),default:xe(()=>[g[11]||(g[11]=zt(" 属性面板 "))]),_:1}),Ee(b,{placement:"right"},{trigger:xe(()=>[Ee(y,{onClick:g[2]||(g[2]=w=>u.value=!se(u)),text:""},{icon:xe(()=>[Ee(v,{size:"24"},{default:xe(()=>[Ee(p,{name:"test"})]),_:1})]),_:1})]),default:xe(()=>[g[12]||(g[12]=zt(" 测试规则 "))]),_:1}),g[15]||(g[15]=Le("div",null,null,-1)),Ee(b,{placement:"right"},{trigger:xe(()=>[Le("a",JQ,[Ee(y,{text:""},{icon:xe(()=>[Ee(v,{size:"24"},{default:xe(()=>[Ee(p,{name:"warn"})]),_:1})]),_:1})])]),default:xe(()=>[g[13]||(g[13]=zt(" 分享须知 "))]),_:1})]),Ee(BQ),Ee(KQ,{class:"flex-1"})]),Ee(WQ,{show:se(c),onUpdateShow:g[3]||(g[3]=w=>c.value=w)},null,8,["show"]),Ee(MQ,{show:se(u),onUpdateShow:g[4]||(g[4]=w=>u.value=w)},null,8,["show"]),Ee(bQ,{show:se(d),onUpdateShow:g[5]||(g[5]=w=>d.value=w)},null,8,["show"]),Ee(wQ),Ee(hQ,{show:se(l),onUpdateShow:g[6]||(g[6]=w=>l.value=w),data:se(o),onUpdateData:g[7]||(g[7]=w=>o.value=w)},null,8,["show","data"])],64)):!se(a)&&!se(s)?(We(),jt("div",QQ,g[16]||(g[16]=[Le("div",null,"快照数据缺失",-1)]))):Nn("",!0)}}});export{gee as default};
485
+ //# sourceMappingURL=SnapshotPage-DFxOp0gE.js.map