@reddb-io/ui 0.3.0 → 0.3.1

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 (96) hide show
  1. package/build/_app/immutable/assets/0.DgbuWrJy.css +1 -0
  2. package/build/_app/immutable/assets/AnalyticsView.BLAJezw4.css +1 -0
  3. package/build/_app/immutable/assets/{Workspace.CvP5De7i.css → Workspace.DM2E1WiF.css} +1 -1
  4. package/build/_app/immutable/chunks/85-Fh5Zp.js +404 -0
  5. package/build/_app/immutable/chunks/{C9rXzYLu.js → 8zg2gJwV.js} +1 -1
  6. package/build/_app/immutable/chunks/B5euRbKa.js +1 -0
  7. package/build/_app/immutable/chunks/BRIMmWzq.js +1 -0
  8. package/build/_app/immutable/chunks/BgOTHNR5.js +1 -0
  9. package/build/_app/immutable/chunks/Bq4DTWK2.js +2 -0
  10. package/build/_app/immutable/chunks/Btd6PFkC.js +1 -0
  11. package/build/_app/immutable/chunks/CGFL56WJ.js +1 -0
  12. package/build/_app/immutable/chunks/CJFJ501n.js +18 -0
  13. package/build/_app/immutable/chunks/CLBx21Hz.js +2 -0
  14. package/build/_app/immutable/chunks/CnD4hwxC.js +1106 -0
  15. package/build/_app/immutable/chunks/DCJ0QyYH.js +1 -0
  16. package/build/_app/immutable/chunks/DQCYUNtS.js +1 -0
  17. package/build/_app/immutable/chunks/DRlh90Cv.js +1 -0
  18. package/build/_app/immutable/chunks/{C278awGv.js → DV9PDoM3.js} +1 -1
  19. package/build/_app/immutable/entry/app.BDog2y0J.js +2 -0
  20. package/build/_app/immutable/entry/start.D1J45dq5.js +1 -0
  21. package/build/_app/immutable/nodes/0.BTrC4th2.js +1 -0
  22. package/build/_app/immutable/nodes/1.Ds1Tbjsm.js +1 -0
  23. package/build/_app/immutable/nodes/10.D_FCLs0Z.js +96 -0
  24. package/build/_app/immutable/nodes/12.DPE6v6Zf.js +3 -0
  25. package/build/_app/immutable/nodes/14.CAG5_cGP.js +1 -0
  26. package/build/_app/immutable/nodes/15.CcJlZGxa.js +60 -0
  27. package/build/_app/immutable/nodes/8.CAG5_cGP.js +1 -0
  28. package/build/_app/version.json +1 -1
  29. package/build/index.html +18 -15
  30. package/dist/embed/AnalyticsView-D8z1Nsed.js +23337 -0
  31. package/dist/embed/AnalyticsView-D8z1Nsed.js.map +1 -0
  32. package/dist/embed/RedUiEmbedRoot-CtqTd_FG.js +31302 -0
  33. package/dist/embed/RedUiEmbedRoot-CtqTd_FG.js.map +1 -0
  34. package/dist/embed/index-0hA141D2.js +85 -0
  35. package/dist/embed/index-0hA141D2.js.map +1 -0
  36. package/dist/embed/index-client-BeiP-va5.js +3303 -0
  37. package/dist/embed/index-client-BeiP-va5.js.map +1 -0
  38. package/dist/embed/index-w1Qo_uW0.js +677 -0
  39. package/dist/embed/index-w1Qo_uW0.js.map +1 -0
  40. package/dist/embed/index.js +1 -1
  41. package/dist/embed/{sigma.esm-D5yoExsH.js → sigma.esm-qqKBpvin.js} +2 -2
  42. package/dist/embed/{sigma.esm-D5yoExsH.js.map → sigma.esm-qqKBpvin.js.map} +1 -1
  43. package/package.json +5 -3
  44. package/src/app.css +86 -20
  45. package/src/lib/AnalyticsView.svelte +209 -0
  46. package/src/lib/AskView.svelte +255 -0
  47. package/src/lib/ClusterView.svelte +415 -95
  48. package/src/lib/CommandPalette.svelte +2 -0
  49. package/src/lib/GlobalProgressBar.svelte +9 -0
  50. package/src/lib/MetricChart.svelte +85 -0
  51. package/src/lib/QueryEditor.svelte +48 -7
  52. package/src/lib/ResultsPane.svelte +76 -8
  53. package/src/lib/SchemaTree.svelte +25 -1
  54. package/src/lib/SecurityView.svelte +176 -65
  55. package/src/lib/SettingsView.svelte +1111 -254
  56. package/src/lib/Topbar.svelte +29 -1
  57. package/src/lib/Workspace.svelte +18 -3
  58. package/src/lib/activity.svelte.ts +44 -35
  59. package/src/lib/collection-preview.ts +14 -0
  60. package/src/lib/connections.svelte.ts +73 -4
  61. package/src/lib/index.ts +3 -0
  62. package/src/lib/permission-gate.ts +120 -0
  63. package/src/lib/policies.ts +136 -0
  64. package/src/lib/query-tabs.svelte.ts +132 -53
  65. package/src/lib/reddb/analytics.ts +208 -0
  66. package/src/lib/reddb/ask.ts +123 -0
  67. package/src/lib/reddb/client.ts +159 -58
  68. package/src/lib/reddb/cluster-status.ts +306 -0
  69. package/src/lib/reddb/index.ts +3 -0
  70. package/src/lib/reddb/local-url-provider.ts +32 -1
  71. package/src/lib/reddb/redwire-ws-spike.ts +590 -0
  72. package/src/lib/router.svelte.ts +12 -0
  73. package/src/lib/settings-authoring-client.ts +336 -0
  74. package/src/lib/settings-sections.ts +292 -196
  75. package/build/_app/immutable/assets/0.DQDLkSdR.css +0 -1
  76. package/build/_app/immutable/chunks/65XjEwaF.js +0 -367
  77. package/build/_app/immutable/chunks/BGcIe2ep.js +0 -2
  78. package/build/_app/immutable/chunks/BjFADNkA.js +0 -992
  79. package/build/_app/immutable/chunks/BrvvOVaJ.js +0 -1
  80. package/build/_app/immutable/chunks/D9CTkMjK.js +0 -1
  81. package/build/_app/immutable/chunks/oiO4RLqp.js +0 -1
  82. package/build/_app/immutable/chunks/pDJnDxXM.js +0 -1
  83. package/build/_app/immutable/entry/app.DdaMXHAv.js +0 -2
  84. package/build/_app/immutable/entry/start.-MLBtQXB.js +0 -1
  85. package/build/_app/immutable/nodes/0.Ysoz3Y3h.js +0 -1
  86. package/build/_app/immutable/nodes/1.C2jbGTOJ.js +0 -1
  87. package/build/_app/immutable/nodes/12.DQG5zpEx.js +0 -60
  88. package/build/_app/immutable/nodes/8.CrHI4F9p.js +0 -134
  89. package/dist/embed/RedUiEmbedRoot-BwFUA5X-.js +0 -28624
  90. package/dist/embed/RedUiEmbedRoot-BwFUA5X-.js.map +0 -1
  91. package/dist/embed/index-DGhgtnaK.js +0 -577
  92. package/dist/embed/index-DGhgtnaK.js.map +0 -1
  93. package/dist/embed/index-client-ItCEU64C.js +0 -3087
  94. package/dist/embed/index-client-ItCEU64C.js.map +0 -1
  95. /package/build/_app/immutable/assets/{12.Dblyk0Kr.css → 15.Dblyk0Kr.css} +0 -0
  96. /package/build/_app/immutable/nodes/{10.CAG5_cGP.js → 13.CAG5_cGP.js} +0 -0
@@ -0,0 +1,404 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./B5euRbKa.js","./DhEqZVGG.js","./DV9PDoM3.js","./DqvWKbSc.js","./CXNPJgv1.js","./CDKIdLnm.js"])))=>i.map(i=>d[i]);
2
+ var iu=Object.defineProperty;var to=n=>{throw TypeError(n)};var ou=(n,e,t)=>e in n?iu(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Me=(n,e,t)=>ou(n,typeof e!="symbol"?e+"":e,t),su=(n,e,t)=>e.has(n)||to("Cannot "+t);var Ge=(n,e,t)=>(su(n,e,"read from private field"),t?t.call(n):e.get(n)),ht=(n,e,t)=>e.has(n)?to("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t);import"./Bzak7iHL.js";import"./69_IOA4Y.js";import{ab as gn,a2 as vi,i as cs,aF as bt,br as mr,ay as ls,aD as bn,at as u,bb as au,s as uu,bx as ro,bs as zr,aE as ir,f as cu,p as lu,aK as no,ac as du,l as zt,a3 as hi,ak as fu,bv as hu,ai as pu,aO as gu,a0 as yi,k as vu,j as yu,b0 as mu,by as io,E as bu,D as wu,bh as ds,b5 as fs,I as Wn,ba as _u,d as xu,h as Eu,a7 as ku,a$ as Su,aj as $u,az as Au,n as hs,o as Cu,aa as Lu,x as Du,Y as Gu,bF as Iu,a8 as Tu,bP as Ru,bO as Pt,bK as er,bi as Ou,bj as oo,ad as yr,ag as Nu,bz as we,bm as z,bN as re,b8 as Kt,b9 as ps,b6 as gs,a6 as I,aq as Ce,bw as U,bg as L,bI as vn,b2 as Nt,bG as fe,be as Uu}from"./CGFL56WJ.js";import{b as Pu,n as zu,s as un,a as M,k as kt,d as He,g as Mu,j as le,t as ue,h as Ae,i as jn,v as Bn}from"./Bq4DTWK2.js";import{_ as or,l as Ze,p as pr,s as nt,b as Wu,c as ju}from"./BRIMmWzq.js";import{o as Bu,a as Fu}from"./Btd6PFkC.js";import{B as vs,i as ve}from"./DCJ0QyYH.js";import{a as so,e as Bt,g as F,j as Ut,r as Fn,i as Ku,s as Hu,d as cn,k as qu}from"./CLBx21Hz.js";function yn(n,e){return e}function Vu(n,e,t){for(var r=[],i=e.length,o,s=e.length,a=0;a<i;a++){let f=e[a];fs(f,()=>{if(o){if(o.pending.delete(f),o.done.add(f),o.pending.size===0){var h=n.outrogroups;pi(n,yi(o.done)),h.delete(o),h.size===0&&(n.outrogroups=null)}}else s-=1},!1)}if(s===0){var c=r.length===0&&t!==null;if(c){var l=t,d=l.parentNode;ku(d),d.append(l),n.items.clear()}pi(n,e,!c)}else o={pending:new Set(e),done:new Set},(n.outrogroups??(n.outrogroups=new Set)).add(o)}function pi(n,e,t=!0){var r;if(n.pending.size>0){r=new Set;for(const s of n.pending.values())for(const a of s)r.add(n.items.get(a).e)}for(var i=0;i<e.length;i++){var o=e[i];if(r!=null&&r.has(o)){o.f|=zt;const s=document.createDocumentFragment();Su(o,s)}else $u(e[i],t)}}var ao;function yt(n,e,t,r,i,o=null){var s=n,a=new Map,c=(e&cs)!==0;if(c){var l=n;s=bt?mr(ls(l)):l.appendChild(gn())}bt&&bn();var d=null,f=pu(()=>{var _=t();return gu(_)?_:_==null?[]:yi(_)}),h,g=new Map,y=!0;function E(_){(A.effect.f&wu)===0&&(A.pending.delete(_),A.fallback=d,Yu(A,h,s,e,r),d!==null&&(h.length===0?(d.f&zt)===0?ds(d):(d.f^=zt,Pr(d,null,s)):fs(d,()=>{d=null})))}function b(_){A.pending.delete(_)}var v=vi(()=>{h=u(f);var _=h.length;let p=!1;if(bt){var k=au(s)===uu;k!==(_===0)&&(s=ro(),mr(s),zr(!1),p=!0)}for(var $=new Set,S=du,G=hu(),C=0;C<_;C+=1){bt&&ir.nodeType===cu&&ir.data===lu&&(s=ir,p=!0,zr(!1));var T=h[C],q=r(T,C),N=y?null:a.get(q);N?(N.v&&no(N.v,T),N.i&&no(N.i,C),G&&S.unskip_effect(N.e)):(N=Xu(a,y?s:ao??(ao=gn()),T,q,C,i,e,t),y||(N.e.f|=zt),a.set(q,N)),$.add(q)}if(_===0&&o&&!d&&(y?d=hi(()=>o(s)):(d=hi(()=>o(ao??(ao=gn()))),d.f|=zt)),_>$.size&&fu(),bt&&_>0&&mr(ro()),!y)if(g.set(S,$),G){for(const[m,Le]of a)$.has(m)||S.skip_effect(Le.e);S.oncommit(E),S.ondiscard(b)}else E(S);p&&zr(!0),u(f)}),A={effect:v,items:a,pending:g,outrogroups:null,fallback:d};y=!1,bt&&(s=ir)}function Ir(n){for(;n!==null&&(n.f&xu)===0;)n=n.next;return n}function Yu(n,e,t,r,i){var T,q,N,m,Le,Te,O,x,K;var o=(r&Eu)!==0,s=e.length,a=n.items,c=Ir(n.effect.first),l,d=null,f,h=[],g=[],y,E,b,v;if(o)for(v=0;v<s;v+=1)y=e[v],E=i(y,v),b=a.get(E).e,(b.f&zt)===0&&((q=(T=b.nodes)==null?void 0:T.a)==null||q.measure(),(f??(f=new Set)).add(b));for(v=0;v<s;v+=1){if(y=e[v],E=i(y,v),b=a.get(E).e,n.outrogroups!==null)for(const ee of n.outrogroups)ee.pending.delete(b),ee.done.delete(b);if((b.f&Wn)!==0&&(ds(b),o&&((m=(N=b.nodes)==null?void 0:N.a)==null||m.unfix(),(f??(f=new Set)).delete(b))),(b.f&zt)!==0)if(b.f^=zt,b===c)Pr(b,null,t);else{var A=d?d.next:c;b===n.effect.last&&(n.effect.last=b.prev),b.prev&&(b.prev.next=b.next),b.next&&(b.next.prev=b.prev),Zt(n,d,b),Zt(n,b,A),Pr(b,A,t),d=b,h=[],g=[],c=Ir(d.next);continue}if(b!==c){if(l!==void 0&&l.has(b)){if(h.length<g.length){var _=g[0],p;d=_.prev;var k=h[0],$=h[h.length-1];for(p=0;p<h.length;p+=1)Pr(h[p],_,t);for(p=0;p<g.length;p+=1)l.delete(g[p]);Zt(n,k.prev,$.next),Zt(n,d,k),Zt(n,$,_),c=_,d=$,v-=1,h=[],g=[]}else l.delete(b),Pr(b,c,t),Zt(n,b.prev,b.next),Zt(n,b,d===null?n.effect.first:d.next),Zt(n,d,b),d=b;continue}for(h=[],g=[];c!==null&&c!==b;)(l??(l=new Set)).add(c),g.push(c),c=Ir(c.next);if(c===null)continue}(b.f&zt)===0&&h.push(b),d=b,c=Ir(b.next)}if(n.outrogroups!==null){for(const ee of n.outrogroups)ee.pending.size===0&&(pi(n,yi(ee.done)),(Le=n.outrogroups)==null||Le.delete(ee));n.outrogroups.size===0&&(n.outrogroups=null)}if(c!==null||l!==void 0){var S=[];if(l!==void 0)for(b of l)(b.f&Wn)===0&&S.push(b);for(;c!==null;)(c.f&Wn)===0&&c!==n.fallback&&S.push(c),c=Ir(c.next);var G=S.length;if(G>0){var C=(r&cs)!==0&&s===0?t:null;if(o){for(v=0;v<G;v+=1)(O=(Te=S[v].nodes)==null?void 0:Te.a)==null||O.measure();for(v=0;v<G;v+=1)(K=(x=S[v].nodes)==null?void 0:x.a)==null||K.fix()}Vu(n,S,C)}}o&&_u(()=>{var ee,ne;if(f!==void 0)for(b of f)(ne=(ee=b.nodes)==null?void 0:ee.a)==null||ne.apply()})}function Xu(n,e,t,r,i,o,s,a){var c=(s&vu)!==0?(s&yu)===0?mu(t,!1,!1):io(t):null,l=(s&bu)!==0?io(i):null;return{v:c,i:l,e:hi(()=>(o(e,c??t,l??i,a),()=>{n.delete(r)}))}}function Pr(n,e,t){if(n.nodes)for(var r=n.nodes.start,i=n.nodes.end,o=e&&(e.f&zt)===0?e.nodes.start:t;r!==null;){var s=Au(r);if(o.before(r),r===i)return;r=s}}function Zt(n,e,t){e===null?n.effect.first=t:e.next=t,t===null?n.effect.last=e:t.prev=e}function tt(n,e,t,r,i){var a;bt&&bn();var o=(a=e.$$slots)==null?void 0:a[t],s=!1;o===!0&&(o=e[t==="default"?"children":t],s=!0),o===void 0?i!==null&&i(n):o(n,s?()=>r:r)}function Xh(n){const e={};n.children&&(e.default=!0);for(const t in n.$$slots)e[t]=!0;return e}function Ju(n,e,...t){var r=new vs(n);vi(()=>{const i=e()??null;r.ensure(i,i&&(o=>i(o,...t)))},hs)}function Zu(n,e,t,r,i,o){let s=bt;bt&&bn();var a=null;bt&&ir.nodeType===Cu&&(a=ir,bn());var c=bt?ir:n,l=new vs(c,!1);vi(()=>{const d=e()||null;var f=Du;if(d===null){l.ensure(null,null),un(!0);return}return l.ensure(d,h=>{if(d){if(a=bt?a:Lu(d,f),Pu(a,a),r){bt&&zu(d)&&a.append(document.createComment(""));var g=bt?ls(a):a.appendChild(gn());bt&&(g===null?zr(!1):mr(g)),r(a,g)}Gu.nodes.end=a,h.before(a)}bt&&mr(h)}),un(!0),()=>{d&&un(!1)}},hs),Iu(()=>{un(!0)}),s&&(zr(!0),mr(c))}function Qu(n=!1){const e=Tu,t=e.l.u;if(!t)return;let r=()=>yr(e.s);if(n){let i=0,o={};const s=Nu(()=>{let a=!1;const c=e.s;for(const l in c)c[l]!==o[l]&&(o[l]=c[l],a=!0);return a&&i++,i});r=()=>u(s)}t.b.length&&Ru(()=>{uo(e,r),oo(t.b)}),Pt(()=>{const i=er(()=>t.m.map(Ou));return()=>{for(const o of i)typeof o=="function"&&o()}}),t.a.length&&Pt(()=>{uo(e,r),oo(t.a)})}function uo(n,e){if(n.l.s)for(const t of n.l.s)u(t);e()}const ec=20;var jr,Br,Fr;class tc{constructor(){ht(this,jr,we(0));ht(this,Br,re(()=>this.inflight>0));ht(this,Fr,we(Kt([])));Me(this,"nextId",1)}get inflight(){return u(Ge(this,jr))}set inflight(e){z(Ge(this,jr),e,!0)}get active(){return u(Ge(this,Br))}set active(e){z(Ge(this,Br),e)}get log(){return u(Ge(this,Fr))}set log(e){z(Ge(this,Fr),e,!0)}async track(e,t){const r=this.nextId++,i={id:r,label:e,startedAt:Date.now(),durationMs:null,status:"pending"};er(()=>{this.log=[i,...this.log].slice(0,ec),this.inflight+=1});try{const o=await t();return er(()=>this.update(r,{durationMs:Date.now()-i.startedAt,status:"ok"})),o}catch(o){throw er(()=>this.update(r,{durationMs:Date.now()-i.startedAt,status:"error",error:o.message})),o}finally{er(()=>{this.inflight=Math.max(0,this.inflight-1)})}}update(e,t){this.log=this.log.map(r=>r.id===e?{...r,...t}:r)}reset(){er(()=>{this.log=this.log.map(e=>e.status==="pending"?{...e,status:"error",error:"reset by user",durationMs:Date.now()-e.startedAt}:e),this.inflight=0})}}jr=new WeakMap,Br=new WeakMap,Fr=new WeakMap;const Qt=new tc,br=Object.freeze({vcs:!1,clusterStatus:!1,collectionMetadata:!1,cdcStream:!1}),co={vcs:"vcs",versioning:"vcs",version_control:"vcs",cluster:"clusterStatus",cluster_status:"clusterStatus",collection_metadata:"collectionMetadata",collections_metadata:"collectionMetadata",cdc:"cdcStream",changes_stream:"cdcStream",cdc_stream:"cdcStream"};function rc(n){var t;const e={...br};for(const r of n.features??[]){const i=co[((t=r==null?void 0:r.toLowerCase)==null?void 0:t.call(r))??""];i&&(e[i]=!0)}for(const[r,i]of Object.entries(n.capabilities??{})){const o=co[r.toLowerCase()];o&&(e[o]=i===!0)}return e}const lo=new Set,Kn=new Map;function nc(n){return(n instanceof Error?n.message:String(n)).includes("route not found: GET /collections/")}function ic(n){const e=n instanceof Error?n.message:String(n);return/ → 404\b/.test(e)||e.includes("route not found")}function fo(n){return new Error(`GET /collections/:name unsupported by this reddb server (${n})`)}function oc(n){if(!n||typeof n!="object")return!1;const e=n;return typeof e.kind=="string"&&e.kind.length>0&&typeof e.name=="string"&&e.name.length>0&&(e.tenant===void 0||typeof e.tenant=="string")}async function*sc(n){const e=n.getReader(),t=new TextDecoder;let r="";try{for(;;){const{done:o,value:s}=await e.read();if(o)break;r+=t.decode(s,{stream:!0});let a;for(;(a=r.indexOf(`
3
+ `))!==-1;){const c=r.slice(0,a).trim();r=r.slice(a+1),c&&(yield JSON.parse(c))}}const i=r.trim();i&&(yield JSON.parse(i))}finally{e.releaseLock()}}const ac=/^\s*select\b/i;function uc(n){if(n instanceof Error)return n.message||String(n);if(typeof n=="string")return n;if(n&&typeof n=="object"){const e=n.message;if(typeof e=="string"&&e)return e;try{const t=JSON.stringify(n);if(t&&t!=="{}")return t}catch{}}return String(n)}async function Jh(n,e,t={}){var i;const r=t.signal?{signal:t.signal}:void 0;if(!ac.test(e))return r?n.query(e,r):n.query(e);try{const o=await n.queryStreamCollect(e,t);return{ok:!0,query:e,record_count:o.rowCount,result:{columns:o.columns,records:o.rows.map(s=>({values:s}))},streamed:!0,truncated:o.truncated}}catch(o){if((i=t.signal)!=null&&i.aborted||o instanceof Error&&o.name==="AbortError")throw o;return r?n.query(e,r):n.query(e)}}class ys{constructor(e,t={}){Me(this,"baseUrl");Me(this,"headers");Me(this,"fetcher");this.baseUrl=e.replace(/\/$/,""),this.headers=t.headers,this.fetcher=t.fetch??fetch}async json(e,t){const r=`${this.baseUrl}${e}`,i={"Content-Type":"application/json"};Object.assign(i,this.headers),Object.assign(i,t==null?void 0:t.headers);const o=await this.fetcher(r,{...t,headers:i});if(!o.ok){const s=await o.text().catch(()=>"");throw new Error(`${(t==null?void 0:t.method)??"GET"} ${e} → ${o.status} ${s.slice(0,200)}`)}return o.json()}async stats(){return this.json("/stats")}async clusterStatus(){return this.json("/cluster/status")}async metricsCatalog(){return(await this.query("SELECT path, kind, role, unit, supports_prometheus_query, created_at_ms FROM red.metrics")).result.records.map(t=>{const r=t.values;return{path:String(r.path??""),kind:r.kind,role:String(r.role??"metric"),unit:r.unit??null,supports_prometheus_query:r.supports_prometheus_query!==!1,created_at_ms:typeof r.created_at_ms=="number"?r.created_at_ms:void 0}})}async promQuery(e,t){const r=new URLSearchParams({query:e});return t!==void 0&&r.set("time",String(t)),this.json(`/api/v1/query?${r}`)}async promQueryRange(e,t,r,i){const o=new URLSearchParams({query:e,start:String(t),end:String(r),step:String(i)});return this.json(`/api/v1/query_range?${o}`)}async ping(){const e=performance.now();try{return await this.json("/stats"),{ok:!0,rtt_ms:Math.round(performance.now()-e)}}catch(t){return{ok:!1,error:uc(t)}}}async capabilities(){try{const r=await this.json("/capabilities");return rc(r)}catch(r){if(!ic(r))return{...br}}const[e,t]=await Promise.all([this.probeGet("/repo/commits?limit=1"),this.probeGet("/cluster/status")]);return{...br,vcs:e,clusterStatus:t}}async probeGet(e){try{return await this.json(e),!0}catch{return!1}}async collections(){return(await this.json("/collections")).collections}async collection(e){if(lo.has(this.baseUrl))throw fo(this.baseUrl);const t=`/collections/${encodeURIComponent(e)}`,r=Kn.get(this.baseUrl);if(r){if(!await r)throw fo(this.baseUrl);return this.json(t)}let i;const o=new Promise(s=>{i=s});Kn.set(this.baseUrl,o);try{const s=await this.json(t);return i(!0),s}catch(s){throw nc(s)?(lo.add(this.baseUrl),i(!1)):i(!0),s}finally{Kn.delete(this.baseUrl)}}async createCollection(e){await this.json("/collections",{method:"POST",body:JSON.stringify({name:e})})}async insertDocument(e,t){return this.json(`/collections/${encodeURIComponent(e)}/documents`,{method:"POST",body:JSON.stringify(t)})}async query(e,t={}){return this.json("/query",{method:"POST",body:JSON.stringify({query:e}),signal:t.signal})}async queryStreamCollect(e,t={}){const r=t.maxRows??1e4,i={"Content-Type":"application/json",Accept:"application/x-ndjson"};Object.assign(i,this.headers);const o=await this.fetcher(`${this.baseUrl}/query/stream`,{method:"POST",headers:i,body:JSON.stringify({query:e}),signal:t.signal});if(!o.ok||!o.body){const a=o.body?await o.text().catch(()=>""):"";throw new Error(`POST /query/stream → ${o.status} ${a.slice(0,200)}`)}const s={columns:[],rows:[],rowCount:0,truncated:!1};for await(const a of sc(o.body))if("descriptor"in a)s.columns=a.descriptor.columns??[],s.schemaFingerprint=a.descriptor.schema_fingerprint;else if("cursor"in a)s.cursor=a.cursor.token;else if("row"in a){if(s.rows.length>=r){s.truncated=!0;break}s.rows.push(a.row),s.rowCount=s.rows.length}else if("end"in a||"cancelled"in a)break;return s.truncated&&s.cursor&&await this.cancelQueryStream(s.cursor).catch(()=>{}),s}async cancelQueryStream(e){await this.json("/query/stream/cancel",{method:"POST",body:JSON.stringify({cursor:e})}).catch(()=>{})}async collectionVcs(e){return(await this.json(`/collections/${encodeURIComponent(e)}/vcs`)).result}async setCollectionVcs(e,t){return(await this.json(`/collections/${encodeURIComponent(e)}/vcs`,{method:"PUT",body:JSON.stringify({versioned:t})})).result}async commits(e={}){const t=new URLSearchParams;e.from&&t.set("from",e.from),e.to&&t.set("to",e.to),e.branch&&t.set("branch",e.branch),e.limit!==void 0&&t.set("limit",String(e.limit)),e.skip!==void 0&&t.set("skip",String(e.skip)),e.noMerges!==void 0&&t.set("no_merges",String(e.noMerges));const r=t.toString()?`?${t}`:"";return(await this.json(`/repo/commits${r}`)).result}async commitDiff(e,t,r={}){const i=new URLSearchParams;r.collection&&i.set("collection",r.collection),r.summary!==void 0&&i.set("summary",String(r.summary));const o=i.toString()?`?${i}`:"";return(await this.json(`/repo/commits/${encodeURIComponent(e)}/diff/${encodeURIComponent(t)}${o}`)).result}async replication(){return this.json("/replication/status").catch(()=>({ok:!1,role:"standalone"}))}async whoami(){return this.json("/auth/whoami")}async ask(e,t={}){return this.json("/ai/ask",{method:"POST",body:JSON.stringify({question:e,...t})})}async users(){return(await this.json("/auth/users")).users}async tenants(){return(await this.json("/auth/tenants")).tenants??[]}async policies(){return(await this.json("/auth/policies")).policies??[]}async authCan(e){const t=await this.json("/auth/can",{method:"POST",body:JSON.stringify({checks:e})});if(!Array.isArray(t.results))throw new Error(t.error??"POST /auth/can returned no results");return e.map((r,i)=>{var a;const o=((a=t.results)==null?void 0:a[i])??{},s=oc(o.resource)?o.resource:r.resource;return{action:typeof o.action=="string"?o.action:r.action,resource:s,current_tenant:typeof o.current_tenant=="string"?o.current_tenant:r.current_tenant,allowed:o.allowed===!0,reason:typeof o.reason=="string"?o.reason:void 0}})}async changes(e,t={}){const r=new URLSearchParams;e!==void 0&&r.set("since_lsn",String(e)),t.limit!==void 0&&r.set("limit",String(t.limit));const i=r.toString()?`?${r}`:"",s=(await this.json("/changes"+i)).events??[];return t.collection?s.filter(a=>a.collection===t.collection):s}async rows(e){return(await this.query(e)).result.records.map(r=>r.values)}}class cc extends Error{constructor(e){super(`Unknown connection: ${e}`),this.id=e,this.name="UnknownConnectionError"}}class lc extends Error{constructor(){super("No active connection — call connect() first"),this.name="NotConnectedError"}}class ho extends Error{constructor(e,t){super(`Connection ${e} unreachable: ${t}`),this.id=e,this.reason=t,this.name="UnreachableConnectionError"}}const dc={http:"http",https:"https",red:"http","red+tcp":"http","red+wire":"http",reds:"https","red+tls":"https","red+http":"http","red+https":"https","red+unix":"unix",file:"unix",unix:"unix"};function fc(n){const e=n.trim();if(!e)return null;const t=e.match(/^([a-z+]+):\/\//i);return t?dc[t[1].toLowerCase()]??null:"http"}const mi=["http","https"],hc=["http","https","unix"];function pc(n,e){const t=fc(n);return t!==null&&e.includes(t)}const gc=["endpoint","connection","red_url","red"],vc="view",ms="cs",bs="to",yc="token",ws=/(token|secret|password|passwd|auth|credential|api[-_]?key|bearer)/i;class tr extends Error{constructor(e,t){super(t),this.code=e,this.name="OpenContractError"}}function mc(n,e=""){if(n instanceof URL)return{search:n.search,hash:n.hash};const t=n??"";if(/^[a-z][a-z0-9+.-]*:\/\//i.test(t)){const s=new URL(t);return{search:s.search,hash:s.hash}}const r=t.indexOf("#"),i=r>=0?t.slice(0,r):t,o=r>=0?t.slice(r):e;return{search:i,hash:o}}function bc(n){return/^file:/i.test(n)||/^~(?:\/|\\|$)/.test(n)||/^(?:\.{1,2})(?:\/|\\|$)/.test(n)||/^(?:\/|\\)/.test(n)||/^[a-z]:[\\/]/i.test(n)||n.includes("\\")}function _s(n){const e=n.trim().replace(/\/$/,"");if(!e)throw new tr("EMPTY_CS","Open Contract cs is empty");if(bc(e))throw new tr("FILESYSTEM_PATH","Open Contract cs must be a browser-reachable URL, not a filesystem path");let t;try{t=new URL(e)}catch{throw new tr("MALFORMED_URL","Open Contract cs is not a valid URL")}if(t.protocol!=="http:"&&t.protocol!=="https:")throw new tr("UNSUPPORTED_SCHEME","Open Contract cs must use http:// or https://");for(const r of t.searchParams.keys())if(ws.test(r))throw new tr("SECRET_IN_CS","Open Contract secrets must be carried in the app URL hash, not inside cs");return e}function xs(n){const e=n.trim();if(!e)throw new tr("MALFORMED_ROUTE","Open Contract to is empty");if(/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")||e.includes("\\"))throw new tr("MALFORMED_ROUTE","Open Contract to must be an app route");const t=e.startsWith("/")?e:`/${e}`;if(t==="/query"||t==="/collections"||t==="/cluster"||t==="/security"||t.startsWith("/c/"))return t;throw new tr("MALFORMED_ROUTE","Open Contract to must target a known red-ui route")}function Es(n,e=""){const{search:t,hash:r}=mc(n,e),i=new URLSearchParams(t),o=new URLSearchParams(r.startsWith("#")?r.slice(1):r),s={},a=i.get(ms);a!==null&&(s.cs=_s(a));const c=i.get(bs);c!==null&&(s.to=xs(c));const l=o.get(yc);return l&&(s.token=l),s}function wc(n,e=""){const t=new URLSearchParams(n??""),r={},i=t.get(ms);if(i!==null)try{r.endpoint=_s(i)}catch{}const o=t.get(bs);if(o!==null)try{r.to=xs(o)}catch{}for(const a of gc){if(r.endpoint)break;const c=t.get(a);if(c&&!ws.test(a)){r.endpoint=c;break}}const s=t.get(vc);s&&(r.view=s);try{Es(n,e).token}catch{}return r}function _c(n){return typeof n.endpoint=="string"&&n.endpoint.trim().length>0}function xc(n){return typeof n.to=="string"&&n.to.trim().length>0}const Ec=8;function kc(){let n=[];return{load:()=>n.slice(),save:e=>{n=e.slice()}}}class Sc{constructor(e={}){Me(this,"presets");Me(this,"history");Me(this,"clientFactory");Me(this,"historyMax");Me(this,"supportedTransports");Me(this,"boot");Me(this,"embeddedResolver");Me(this,"handoffTokens",new Map);Me(this,"active",null);var t,r;this.presets=((t=e.presets)==null?void 0:t.slice())??[],this.history=e.history??kc(),this.historyMax=e.historyMax??Ec,this.clientFactory=e.clientFactory??((i,o)=>new ys(i,o)),this.supportedTransports=((r=e.transports)==null?void 0:r.slice())??[...mi],this.boot=e.bootParams&&(_c(e.bootParams)||xc(e.bootParams))?{...e.bootParams}:null,this.embeddedResolver=e.embeddedResolver}transports(){return this.supportedTransports.slice()}bootParams(){return this.boot?{...this.boot}:null}useHandoffToken(e,t){const r=t.trim();r&&this.handoffTokens.set(this.handoffKey(e),r)}async list(){const e=new Set,t=[];for(const r of this.presets)e.has(r.url)||(e.add(r.url),t.push(r));for(const r of this.history.load())e.has(r.url)||(e.add(r.url),t.push({id:r.url,label:r.label,url:r.url,role:"primary"}));return t}async connect(e){const t=this.resolve(e);if(!t)throw new cc(e);let r=t.url;if(this.embeddedResolver&&/^file:\/\//i.test(t.url))try{r=await this.embeddedResolver(t.url)}catch(c){const l=c instanceof Error?c.message:typeof c=="string"?c:String(c);throw new ho(t.id,l)}const i=this.consumeHandoffToken(t.url),o=this.clientFactory(r,i?{headers:{Authorization:`Bearer ${i}`}}:void 0),s=await o.ping();if(!s.ok)throw new ho(t.id,s.error);const a={connection:t,client:o,rtt_ms:s.rtt_ms};return this.active=a,this.record(t,s.rtt_ms),a}async whoami(){if(!this.active)throw new lc;const e=await this.active.client.whoami();return{authenticated:e.authenticated,username:e.username,role:e.role}}forget(e){const t=this.history.load().filter(r=>r.url!==e);this.history.save(t)}resolve(e){const t=this.presets.find(i=>i.id===e);if(t)return t;const r=this.history.load().find(i=>i.url===e);if(r)return{id:r.url,label:r.label,url:r.url,role:"primary"};if(/^[a-z+]+:\/\//i.test(e)){let i=e;try{i=new URL(e).host||e}catch{}return{id:e,label:i,url:e,role:"primary",description:"Ad-hoc URL."}}return null}handoffKey(e){return e.replace(/\/$/,"")}consumeHandoffToken(e){const t=this.handoffKey(e),r=this.handoffTokens.get(t)??null;return this.handoffTokens.delete(t),r}record(e,t){const r=this.history.load().filter(o=>o.url!==e.url),i=[{url:e.url,label:e.label,last_used:Date.now(),rtt_ms:t},...r].slice(0,this.historyMax);this.history.save(i)}}const ks="red-ui:connection",$c=["__RED_BOOTSTRAP__","__RED_UI_CONNECTION_BOOTSTRAP__","__RED_UI_BOOTSTRAP__"];function mn(n){return typeof n=="string"&&n.trim()?n.trim():void 0}function Ac(n){if(!n||typeof n!="object")return null;const e=mn(n.target),t=mn(n.token),r=mn(n.route);return!e&&!t&&!r?null:{target:e??null,...t?{token:t}:{},...r?{route:r}:{}}}async function Cc(n){for(const e of n){let t;try{t=Ac(await e())}catch{t=null}if(t)return t}return null}async function Lc(){if(typeof window>"u"||!("__TAURI_INTERNALS__"in window||"__TAURI__"in window))return null;try{return(await or(()=>import("./DhEqZVGG.js"),[],import.meta.url)).invoke}catch{return null}}async function Dc(n){const e=n??await Lc();if(!e)return null;try{return await e("connection_bootstrap")}catch{return null}}async function Gc(n=globalThis){if(!n||typeof n!="object")return null;const e=n;for(const t of $c){const r=e[t];if(r)try{return typeof r=="function"?await r():r}finally{try{delete e[t]}catch{e[t]=void 0}}}return null}function Ic(){return{consume:!0,location:typeof location>"u"?void 0:{pathname:location.pathname,search:location.search,hash:location.hash},history:typeof history>"u"?void 0:{state:history.state,replaceState:(n,e,t)=>history.replaceState(n,e,t)}}}function Tc(n){if(!n.consume||!n.location||!n.history)return;const e=n.location.hash;if(!e)return;const t=new URLSearchParams(e.startsWith("#")?e.slice(1):e);if(!t.has("token"))return;t.delete("token");const r=t.toString(),i=`${n.location.pathname}${n.location.search}${r?`#${r}`:""}`;try{n.history.replaceState(n.history.state,"",i)}catch{}}function po(n=typeof location>"u"?"":location.search,e=typeof location>"u"?"":location.hash,t=Ic()){try{const r=Es(n,e);return r.token&&Tc(t),!r.cs&&!r.to&&!r.token?null:{target:r.cs,token:r.token,route:r.to}}catch{return null}}function Rc(){try{return typeof localStorage>"u"?void 0:localStorage}catch{return}}function Oc(n=Rc(),e=ks){if(!n)return null;try{const t=n.getItem(e);if(!t)return null;const r=JSON.parse(t),i=mn(r==null?void 0:r.url);return i?{target:i}:null}catch{return null}}async function Nc(n={}){const e=n.readUrl??(()=>po()),t=await Cc([n.readTauri??Dc,n.readInjectedGlobal??Gc,e,n.readPersisted??(()=>Oc())]);if(t&&!n.readUrl)try{po()}catch{}return t??{target:null}}class mt extends Error{constructor(t,r){super(r);Me(this,"code");this.name="SecureStoreError",this.code=t}}const Uc=2e5,Pc=16,zc=12;function ln(n){let e="";for(const t of n)e+=String.fromCharCode(t);return btoa(e)}function Hn(n){const e=atob(n),t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}function gr(n){const e=new ArrayBuffer(n.byteLength);return new Uint8Array(e).set(n),e}class Mc{constructor(e,t={}){Me(this,"storage");Me(this,"namespace");Me(this,"iterations");Me(this,"subtle");Me(this,"password");Me(this,"keyCache",new Map);var o;if(typeof e!="string"||e.length===0)throw new mt("LOCKED","master password required");const r=t.storage??(typeof globalThis<"u"?globalThis.localStorage:void 0);if(!r)throw new mt("BACKEND_FAILURE","no Storage backend available");const i=t.subtle??(typeof globalThis<"u"?(o=globalThis.crypto)==null?void 0:o.subtle:void 0);if(!i)throw new mt("BACKEND_FAILURE","Web Crypto SubtleCrypto unavailable");this.password=e,this.storage=r,this.namespace=t.namespace??"red-ui:secure",this.iterations=t.iterations??Uc,this.subtle=i}storageKey(e){return`${this.namespace}:${e}`}async deriveKey(e){const t=ln(e),r=this.keyCache.get(t);if(r)return r;const i=new TextEncoder().encode(this.password),o=await this.subtle.importKey("raw",gr(i),"PBKDF2",!1,["deriveKey"]),s=await this.subtle.deriveKey({name:"PBKDF2",salt:gr(e),iterations:this.iterations,hash:"SHA-256"},o,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"]);return this.keyCache.set(t,s),s}randomBytes(e){const t=new Uint8Array(e),r=globalThis.crypto;if(!r)throw new mt("BACKEND_FAILURE","crypto.getRandomValues unavailable");return r.getRandomValues(t),t}async put(e,t){const r=this.randomBytes(Pc),i=this.randomBytes(zc),o=await this.deriveKey(r),s=new TextEncoder().encode(t);let a;try{a=await this.subtle.encrypt({name:"AES-GCM",iv:gr(i)},o,gr(s))}catch(l){throw new mt("BACKEND_FAILURE",`encrypt failed: ${l.message}`)}const c={v:1,salt:ln(r),nonce:ln(i),ciphertext:ln(new Uint8Array(a))};try{this.storage.setItem(this.storageKey(e),JSON.stringify(c))}catch(l){throw new mt("BACKEND_FAILURE",`storage write failed: ${l.message}`)}}async get(e){const t=this.storage.getItem(this.storageKey(e));if(!t)return null;let r;try{r=JSON.parse(t)}catch{throw new mt("CORRUPT_ENVELOPE",`key ${e}: not valid JSON`)}if(!r||r.v!==1||typeof r.salt!="string"||typeof r.nonce!="string"||typeof r.ciphertext!="string")throw new mt("CORRUPT_ENVELOPE",`key ${e}: missing envelope fields`);let i,o,s;try{i=Hn(r.salt),o=Hn(r.nonce),s=Hn(r.ciphertext)}catch{throw new mt("CORRUPT_ENVELOPE",`key ${e}: base64 decode failed`)}const a=await this.deriveKey(i);let c;try{c=await this.subtle.decrypt({name:"AES-GCM",iv:gr(o)},a,gr(s))}catch{throw new mt("DECRYPT_FAILED",`key ${e}: decryption failed (wrong password or tampered payload)`)}return new TextDecoder().decode(c)}async delete(e){try{this.storage.removeItem(this.storageKey(e))}catch(t){throw new mt("BACKEND_FAILURE",`storage delete failed: ${t.message}`)}}}class Wc{constructor(e){Me(this,"invoke");Me(this,"service");if(!e.invoke)throw new mt("BACKEND_FAILURE","tauri invoke fn not provided");this.invoke=e.invoke,this.service=e.service??"io.reddb.red-ui"}async put(e,t){try{await this.invoke("keychain_set",{service:this.service,key:e,value:t})}catch(r){throw new mt("BACKEND_FAILURE",`keychain_set failed: ${qn(r)}`)}}async get(e){try{return await this.invoke("keychain_get",{service:this.service,key:e})??null}catch(t){throw new mt("BACKEND_FAILURE",`keychain_get failed: ${qn(t)}`)}}async delete(e){try{await this.invoke("keychain_delete",{service:this.service,key:e})}catch(t){throw new mt("BACKEND_FAILURE",`keychain_delete failed: ${qn(t)}`)}}}function qn(n){if(n instanceof Error)return n.message;if(typeof n=="string")return n;try{return JSON.stringify(n)}catch{return String(n)}}const jc="red-ui:history",Bc="history:";function Ss(n,e=!1){switch(n){case"embedded":return"none";case"standalone":return"vault";case"web":return e?"none":"labels-only"}}function Fc(n){if(n.url)try{const t=new URL(n.url).host;if(t)return t}catch{}const e=(n.label??n.url??"").trim();if(!e)return"";try{const t=new URL(e).host;if(t)return t}catch{}return e.includes("@")?e.slice(e.lastIndexOf("@")+1):e}function Kc(){return typeof localStorage>"u"?void 0:localStorage}function go(n){return`label:${encodeURIComponent(n)}`}function Hc(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():Math.random().toString(36).slice(2)+Date.now().toString(36)}function Tr(n,e){if(!n)return[];try{const t=n.getItem(e);if(!t)return[];const r=JSON.parse(t);return Array.isArray(r)?r.filter(i=>i&&typeof i.id=="string"&&typeof i.label=="string").map(i=>({id:i.id,label:i.label,last_used:i.last_used,rtt_ms:i.rtt_ms})):[]}catch{return[]}}function vo(n,e,t){if(n)try{n.setItem(e,JSON.stringify(t))}catch{}}class qc{constructor(e){Me(this,"surface");Me(this,"secureStore");Me(this,"managedWebTarget");Me(this,"storage");Me(this,"historyKey");Me(this,"urlPrefix");Me(this,"idByUrl",new Map);Me(this,"urlById",new Map);Me(this,"onChange");this.surface=e.surface,this.secureStore=e.secureStore,this.managedWebTarget=e.managedWebTarget??(()=>!1),this.storage=e.storage??Kc(),this.historyKey=e.historyKey??jc,this.urlPrefix=e.urlPrefix??Bc}setOnChange(e){this.onChange=e}persistence(){return Ss(this.surface(),this.managedWebTarget())}load(){return this.persistence()==="none"?[]:Tr(this.storage,this.historyKey).map(e=>({url:this.urlById.get(e.id)??"",label:e.label,last_used:e.last_used,rtt_ms:e.rtt_ms}))}save(e){var c,l,d;const t=this.persistence();if(t==="none"){(c=this.onChange)==null||c.call(this);return}const r=Tr(this.storage,this.historyKey),i=new Map(r.map(f=>[f.label,f])),o=[],s=new Set,a=new Set;for(const f of e){const h=Fc(f);if(!h)continue;let g;f.url?(g=t==="labels-only"?go(h):this.idByUrl.get(f.url)??Hc(),this.idByUrl.set(f.url,g),this.urlById.set(g,f.url)):g=((l=i.get(h))==null?void 0:l.id)??go(h),!(s.has(g)||!f.url&&a.has(h))&&(s.add(g),a.add(h),o.push({id:g,label:h,last_used:typeof f.last_used=="number"?f.last_used:Date.now(),rtt_ms:f.rtt_ms}))}if(vo(this.storage,this.historyKey,o),t==="vault"){const f=this.secureStore();if(f)for(const h of o){const g=this.urlById.get(h.id);g&&f.put(this.urlPrefix+h.id,g).catch(()=>{})}}(d=this.onChange)==null||d.call(this)}uiEntries(){return this.persistence()==="none"?[]:Tr(this.storage,this.historyKey).map(e=>({id:e.id,label:e.label,last_used:e.last_used,rtt_ms:e.rtt_ms,url:this.urlById.get(e.id)}))}async hydrate(){var i;if(this.persistence()!=="vault")return;const e=this.secureStore();if(!e)return;const t=Tr(this.storage,this.historyKey);let r=!1;for(const o of t)if(!this.urlById.has(o.id))try{const s=await e.get(this.urlPrefix+o.id);s&&(this.urlById.set(o.id,s),this.idByUrl.set(s,o.id),r=!0)}catch{}r&&((i=this.onChange)==null||i.call(this))}async forgetById(e){var o,s;if(this.persistence()==="none"){(o=this.onChange)==null||o.call(this);return}const t=Tr(this.storage,this.historyKey).filter(a=>a.id!==e);vo(this.storage,this.historyKey,t);const r=this.urlById.get(e);r&&(this.urlById.delete(e),this.idByUrl.delete(r));const i=this.persistence()==="vault"?this.secureStore():null;if(i)try{await i.delete(this.urlPrefix+e)}catch{}(s=this.onChange)==null||s.call(this)}async forgetByUrl(e){const t=this.idByUrl.get(e);t&&await this.forgetById(t)}}function Vc({tauri:n,inFrame:e,mcp:t,embedLib:r}){return n?"standalone":e||t||r?"embedded":"web"}function Yc(){if(typeof window>"u")return"web";const n="__TAURI_INTERNALS__"in window||"__TAURI__"in window;let e=!1;try{e=window.self!==window.top}catch{e=!0}const t=typeof location<"u"&&new URLSearchParams(location.search).has("mcp"),r=window.__RED_UI_EMBED_SURFACE__===!0;return Vc({tauri:n,inFrame:e,mcp:t,embedLib:r})}function Vn(n,e){switch(n){case"embedded":return!1;case"standalone":return!0;case"web":return!1}}const gi="red-ui:secure",yo="__probe__",mo="ok";function bo(){if(typeof localStorage>"u")return!1;for(let n=0;n<localStorage.length;n++){const e=localStorage.key(n);if(e&&e.startsWith(gi+":"))return!0}return!1}var Kr,Hr,qr,Vr,Yr,Xr;class Xc{constructor(){ht(this,Kr,we(null));ht(this,Hr,we(!0));ht(this,qr,we(!1));ht(this,Vr,we("unknown"));ht(this,Yr,we("web"));ht(this,Xr,we(null));if(typeof window>"u"){this.backend="unknown";return}if(this.surface=Yc(),this.surface==="standalone"){this.backend="tauri",this.bindTauri();return}this.backend="web",bo(),this.needsSetup=!1,this.locked=Vn(this.surface)}get store(){return u(Ge(this,Kr))}set store(e){z(Ge(this,Kr),e,!0)}get locked(){return u(Ge(this,Hr))}set locked(e){z(Ge(this,Hr),e,!0)}get needsSetup(){return u(Ge(this,qr))}set needsSetup(e){z(Ge(this,qr),e,!0)}get backend(){return u(Ge(this,Vr))}set backend(e){z(Ge(this,Vr),e,!0)}get surface(){return u(Ge(this,Yr))}set surface(e){z(Ge(this,Yr),e,!0)}get error(){return u(Ge(this,Xr))}set error(e){z(Ge(this,Xr),e,!0)}async bindTauri(){try{const e=await or(()=>import("./DhEqZVGG.js"),[],import.meta.url);this.store=new Wc({invoke:e.invoke}),this.locked=!1}catch(e){this.error=`Tauri keychain bridge unavailable: ${e.message}`}}async unlock(e){if(this.error=null,this.backend!=="web")return!0;let t;try{t=new Mc(e,{namespace:gi})}catch(r){return this.error=r.message,!1}try{const r=await t.get(yo);if(r===null)await t.put(yo,mo);else if(r!==mo)return this.error="Wrong password",!1}catch(r){return r instanceof mt&&r.code==="DECRYPT_FAILED"?(this.error="Wrong password",!1):(this.error=r.message,!1)}return this.store=t,this.locked=!1,this.needsSetup=!1,!0}lock(){this.store=null,this.backend==="web"&&(this.locked=Vn(this.surface,bo()))}wipe(){if(typeof localStorage>"u")return;const e=[];for(let t=0;t<localStorage.length;t++){const r=localStorage.key(t);r&&(r.startsWith(gi+":")||r.startsWith("red-ui:"))&&e.push(r)}for(const t of e)localStorage.removeItem(t);this.store=null,this.backend==="web"&&(this.locked=Vn(this.surface),this.needsSetup=!1),this.error=null}}Kr=new WeakMap,Hr=new WeakMap,qr=new WeakMap,Vr=new WeakMap,Yr=new WeakMap,Xr=new WeakMap;const Mr=new Xc,$s=[{id:"embedded",label:"Embedded",url:"http://localhost:5055",role:"embedded",description:"Local file via ./scripts/embedded.sh."},{id:"docker-primary",label:"Docker primary",url:"http://localhost:15055",role:"primary",description:"Docker compose primary (./docker/compose.yml)."},{id:"docker-replica",label:"Docker replica",url:"http://localhost:25055",role:"replica",description:"Read-only mirror of docker primary."}],wo=ks;function _o(n){if(typeof localStorage>"u")return;if(Qc()!=="vault"){try{localStorage.removeItem(wo)}catch{}return}try{localStorage.setItem(wo,JSON.stringify(n))}catch{}}const Jc=/(handoff|token|secret|password|passwd|auth|credential|api[-_]?key|bearer)/i;let bi=!1;function Zc(){Mr.surface==="web"&&(bi=!0)}function As(){if(bi)return!0;if(Mr.surface!=="web"||typeof location>"u")return!1;for(const n of[location.search,location.hash]){const e=new URLSearchParams(n.startsWith("#")?n.slice(1):n);for(const t of e.keys())if(Jc.test(t))return!0}return!1}function Qc(){return Ss(Mr.surface,As())}const nr=new qc({surface:()=>Mr.surface,secureStore:()=>Mr.store,managedWebTarget:As});function el(n){let e=n.trim().replace(/\/$/,"");if(!e)return e;/:\/\//.test(e)||(e="http://"+e);const t=e.match(/^([a-z+]+):\/\/(.+)$/i);if(!t)return e;const[,r,i]=t,o=r.toLowerCase();if(o==="red"||o==="red+tcp"||o==="red+wire"){const[s]=i.split("/")[0].split(":");return`http://${s}:5055${i.includes("/")?"/"+i.split("/").slice(1).join("/"):""}`}if(o==="reds"||o==="red+tls"){const[s]=i.split("/")[0].split(":");return`https://${s}:5055`}return e}function xo(n){const e=el(n);let t=e;try{t=new URL(e).host}catch{}return{id:e,label:t||e,url:e,role:"primary",description:"User-provided connection string."}}function wi(){return typeof window<"u"&&("__TAURI_INTERNALS__"in window||"__TAURI__"in window)}function tl(){return[...wi()?hc:mi]}async function rl(n){if(!wi())throw new Error("file:// databases can only be opened in the desktop app");const e=n.replace(/^file:\/\//i,""),{invoke:t}=await or(async()=>{const{invoke:r}=await import("./DhEqZVGG.js");return{invoke:r}},[],import.meta.url);return t("open_embedded",{path:e})}const nl=async(n,e)=>{const t=typeof n=="string"?n:n instanceof URL?n.href:n.url,r=/^https?:\/\/(127\.0\.0\.1|localhost|\[::1\])(:\d+)?(\/|$)/i.test(t);if(wi()&&r)try{const{fetch:i}=await or(async()=>{const{fetch:o}=await import("./B5euRbKa.js");return{fetch:o}},__vite__mapDeps([0,1]),import.meta.url);return await i(n,e)}catch(i){const o=i instanceof Error?i.message:typeof i=="string"?i:String(i);throw new Error(`rust-side fetch failed for ${t}: ${o}`)}return fetch(n,e)};function il(n){return typeof n.useHandoffToken=="function"}const ol=new Sc({presets:$s,history:nr,transports:tl(),embeddedResolver:rl,clientFactory:(n,e)=>new ys(n,{...e,fetch:nl}),bootParams:wc(typeof location<"u"?location.search:"",typeof location<"u"?location.hash:"")});let Cs=ol;function Rr(){return Cs}function Zh(n){Cs=n}var Jr,Zr,Qr,en,wr,_r,xr;class sl{constructor(){ht(this,Jr,we(!1));ht(this,Zr,we(Kt($s[1])));ht(this,Qr,we(Kt({reachable:!1})));ht(this,en,we(Kt([])));ht(this,wr,we(null));ht(this,_r,we(Kt({...br})));ht(this,xr,we(!1));this.history=nr.uiEntries(),nr.setOnChange(()=>{this.history=nr.uiEntries()})}get connected(){return u(Ge(this,Jr))}set connected(e){z(Ge(this,Jr),e,!0)}get active(){return u(Ge(this,Zr))}set active(e){z(Ge(this,Zr),e,!0)}get probe(){return u(Ge(this,Qr))}set probe(e){z(Ge(this,Qr),e,!0)}get history(){return u(Ge(this,en))}set history(e){z(Ge(this,en),e,!0)}get targetResolved(){return u(Ge(this,xr))}get client(){return u(Ge(this,wr))}get readOnly(){var e;return this.connected&&((e=this.probe.stats)==null?void 0:e.read_only)===!0}get readOnlyReason(){var e;return(e=this.probe.stats)==null?void 0:e.read_only_reason}get capabilities(){return u(Ge(this,_r))}get supportedTransports(){var e,t;return((t=(e=Rr()).transports)==null?void 0:t.call(e))??[...mi]}canReach(e){return pc(e,this.supportedTransports)}async forget(e){await nr.forgetByUrl(e)}async forgetById(e){await nr.forgetById(e)}async hydrateUrls(){await nr.hydrate()}async bootstrap(e=Nc){const t=await e(),r=t.route??null;if(!t.target)return r;const i=xo(t.target);if(t.token){Zc();const o=Rr();il(o)&&o.useHandoffToken(i.url,t.token)}return await this.tryConnect(i),r}async switch(e){this.active=e,_o(e),await this.tryConnect(e)}async tryConnect(e){z(Ge(this,xr),!0);try{const t=await Qt.track(`connect · ${e.label}`,()=>Rr().connect(e.id));z(Ge(this,wr),t.client,!0),this.active={...e,...t.connection,description:e.description},_o(this.active);const[r,i,o]=await Promise.all([Qt.track(`connect · ${e.label} stats`,()=>t.client.stats()).catch(()=>{}),Qt.track(`connect · ${e.label} replication`,()=>t.client.replication()).catch(()=>{}),Qt.track(`connect · ${e.label} capabilities`,()=>t.client.capabilities()).catch(()=>({...br}))]);return this.probe={reachable:!0,rtt_ms:t.rtt_ms,stats:r,replication:i},z(Ge(this,_r),o,!0),this.connected=!0,!0}catch(t){return this.probe={reachable:!1,error:t.message},!1}}async adoptInjected(){const[e]=await Rr().list();if(!e)return!1;const t={...e,description:e.description??"Injected by the embedding host."};return this.tryConnect(t)}async connectFromBootParams(){var r,i;const e=(i=(r=Rr()).bootParams)==null?void 0:i.call(r);if(!e)return null;const t=e.to??e.view??null;return e.endpoint&&await this.tryConnect(xo(e.endpoint)),t}async refresh(){const e=this.client;if(!e){await this.tryConnect(this.active);return}try{const t=await Qt.track(`heartbeat · ${this.active.label}`,()=>e.ping());if(!t.ok){this.probe={reachable:!1,error:t.error};return}const[r,i]=await Promise.all([Qt.track("heartbeat · stats",()=>e.stats()).catch(()=>{}),Qt.track("heartbeat · replication",()=>e.replication()).catch(()=>{})]);this.probe={reachable:!0,rtt_ms:t.rtt_ms,stats:r,replication:i},this.connected=!0}catch(t){this.probe={reachable:!1,error:t.message}}}disconnect(){this.connected=!1,this.probe={reachable:!1},z(Ge(this,wr),null),z(Ge(this,_r),{...br},!0),z(Ge(this,xr),!1),bi=!1}}Jr=new WeakMap,Zr=new WeakMap,Qr=new WeakMap,en=new WeakMap,wr=new WeakMap,_r=new WeakMap,xr=new WeakMap;const al=new sl;/**
4
+ * @license lucide-svelte v0.475.0 - ISC
5
+ *
6
+ * ISC License
7
+ *
8
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
9
+ *
10
+ * Permission to use, copy, modify, and/or distribute this software for any
11
+ * purpose with or without fee is hereby granted, provided that the above
12
+ * copyright notice and this permission notice appear in all copies.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21
+ *
22
+ */const ul={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};var cl=kt("<svg><!><!></svg>");function it(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]),r=Ze(t,["name","color","size","strokeWidth","absoluteStrokeWidth","iconNode"]);ps(e,!1);let i=pr(e,"name",8,void 0),o=pr(e,"color",8,"currentColor"),s=pr(e,"size",8,24),a=pr(e,"strokeWidth",8,2),c=pr(e,"absoluteStrokeWidth",8,!1),l=pr(e,"iconNode",24,()=>[]);const d=(...y)=>y.filter((E,b,v)=>!!E&&v.indexOf(E)===b).join(" ");Qu();var f=cl();so(f,(y,E)=>({...ul,...r,width:s(),height:s(),stroke:o(),"stroke-width":y,class:E}),[()=>(yr(c()),yr(a()),yr(s()),er(()=>c()?Number(a())*24/Number(s()):a())),()=>(yr(i()),yr(t),er(()=>d("lucide-icon","lucide",i()?`lucide-${i()}`:"",t.class)))]);var h=I(f);yt(h,1,l,yn,(y,E)=>{var b=re(()=>vn(u(E),2));let v=()=>u(b)[0],A=()=>u(b)[1];var _=He(),p=Ce(_);Zu(p,v,!0,(k,$)=>{so(k,()=>({...A()}))}),M(y,_)});var g=U(h);tt(g,e,"default",{},null),L(f),M(n,f),gs()}function Eo(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
23
+ * @license lucide-svelte v0.475.0 - ISC
24
+ *
25
+ * ISC License
26
+ *
27
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
28
+ *
29
+ * Permission to use, copy, modify, and/or distribute this software for any
30
+ * purpose with or without fee is hereby granted, provided that the above
31
+ * copyright notice and this permission notice appear in all copies.
32
+ *
33
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
34
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
35
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
36
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
37
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
38
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
39
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
40
+ *
41
+ */const r=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z"}],["path",{d:"m7 16.5-4.74-2.85"}],["path",{d:"m7 16.5 5-3"}],["path",{d:"M7 16.5v5.17"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z"}],["path",{d:"m17 16.5-5-3"}],["path",{d:"m17 16.5 4.74-2.85"}],["path",{d:"M17 16.5v5.17"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z"}],["path",{d:"M12 8 7.26 5.15"}],["path",{d:"m12 8 4.74-2.85"}],["path",{d:"M12 13.5V8"}]];it(n,nt({name:"boxes"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function ll(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
42
+ * @license lucide-svelte v0.475.0 - ISC
43
+ *
44
+ * ISC License
45
+ *
46
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
47
+ *
48
+ * Permission to use, copy, modify, and/or distribute this software for any
49
+ * purpose with or without fee is hereby granted, provided that the above
50
+ * copyright notice and this permission notice appear in all copies.
51
+ *
52
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
53
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
54
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
55
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
56
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
57
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
58
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
59
+ *
60
+ */const r=[["path",{d:"m18 16 4-4-4-4"}],["path",{d:"m6 8-4 4 4 4"}],["path",{d:"m14.5 4-5 16"}]];it(n,nt({name:"code-xml"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function Qh(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
61
+ * @license lucide-svelte v0.475.0 - ISC
62
+ *
63
+ * ISC License
64
+ *
65
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
66
+ *
67
+ * Permission to use, copy, modify, and/or distribute this software for any
68
+ * purpose with or without fee is hereby granted, provided that the above
69
+ * copyright notice and this permission notice appear in all copies.
70
+ *
71
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
72
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
73
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
74
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
75
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
76
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
77
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
78
+ *
79
+ */const r=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1"}]];it(n,nt({name:"file-json"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function ko(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
80
+ * @license lucide-svelte v0.475.0 - ISC
81
+ *
82
+ * ISC License
83
+ *
84
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
85
+ *
86
+ * Permission to use, copy, modify, and/or distribute this software for any
87
+ * purpose with or without fee is hereby granted, provided that the above
88
+ * copyright notice and this permission notice appear in all copies.
89
+ *
90
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
91
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
92
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
93
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
94
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
95
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
96
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
97
+ *
98
+ */const r=[["path",{d:"M3 7V5c0-1.1.9-2 2-2h2"}],["path",{d:"M17 3h2c1.1 0 2 .9 2 2v2"}],["path",{d:"M21 17v2c0 1.1-.9 2-2 2h-2"}],["path",{d:"M7 21H5c-1.1 0-2-.9-2-2v-2"}],["rect",{width:"7",height:"5",x:"7",y:"7",rx:"1"}],["rect",{width:"7",height:"5",x:"10",y:"12",rx:"1"}]];it(n,nt({name:"group"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function dl(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
99
+ * @license lucide-svelte v0.475.0 - ISC
100
+ *
101
+ * ISC License
102
+ *
103
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
104
+ *
105
+ * Permission to use, copy, modify, and/or distribute this software for any
106
+ * purpose with or without fee is hereby granted, provided that the above
107
+ * copyright notice and this permission notice appear in all copies.
108
+ *
109
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
110
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
111
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
112
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
113
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
114
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
115
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
116
+ *
117
+ */const r=[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 16v-4"}],["path",{d:"M12 8h.01"}]];it(n,nt({name:"info"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function ep(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
118
+ * @license lucide-svelte v0.475.0 - ISC
119
+ *
120
+ * ISC License
121
+ *
122
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
123
+ *
124
+ * Permission to use, copy, modify, and/or distribute this software for any
125
+ * purpose with or without fee is hereby granted, provided that the above
126
+ * copyright notice and this permission notice appear in all copies.
127
+ *
128
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
129
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
130
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
131
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
132
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
133
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
134
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
135
+ *
136
+ */const r=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"}]];it(n,nt({name:"layers"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function tp(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
137
+ * @license lucide-svelte v0.475.0 - ISC
138
+ *
139
+ * ISC License
140
+ *
141
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
142
+ *
143
+ * Permission to use, copy, modify, and/or distribute this software for any
144
+ * purpose with or without fee is hereby granted, provided that the above
145
+ * copyright notice and this permission notice appear in all copies.
146
+ *
147
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
148
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
149
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
150
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
151
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
152
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
153
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
154
+ *
155
+ */const r=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12"}]];it(n,nt({name:"link-2"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function fl(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
156
+ * @license lucide-svelte v0.475.0 - ISC
157
+ *
158
+ * ISC License
159
+ *
160
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
161
+ *
162
+ * Permission to use, copy, modify, and/or distribute this software for any
163
+ * purpose with or without fee is hereby granted, provided that the above
164
+ * copyright notice and this permission notice appear in all copies.
165
+ *
166
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
167
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
168
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
169
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
170
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
171
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
172
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
173
+ *
174
+ */const r=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56"}]];it(n,nt({name:"loader-circle"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function hl(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
175
+ * @license lucide-svelte v0.475.0 - ISC
176
+ *
177
+ * ISC License
178
+ *
179
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
180
+ *
181
+ * Permission to use, copy, modify, and/or distribute this software for any
182
+ * purpose with or without fee is hereby granted, provided that the above
183
+ * copyright notice and this permission notice appear in all copies.
184
+ *
185
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
186
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
187
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
188
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
189
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
190
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
191
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
192
+ *
193
+ */const r=[["polyline",{points:"15 3 21 3 21 9"}],["polyline",{points:"9 21 3 21 3 15"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14"}]];it(n,nt({name:"maximize-2"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function So(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
194
+ * @license lucide-svelte v0.475.0 - ISC
195
+ *
196
+ * ISC License
197
+ *
198
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
199
+ *
200
+ * Permission to use, copy, modify, and/or distribute this software for any
201
+ * purpose with or without fee is hereby granted, provided that the above
202
+ * copyright notice and this permission notice appear in all copies.
203
+ *
204
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
205
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
206
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
207
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
208
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
209
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
210
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
211
+ *
212
+ */const r=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"}],["path",{d:"M12 12V8"}]];it(n,nt({name:"network"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function pl(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
213
+ * @license lucide-svelte v0.475.0 - ISC
214
+ *
215
+ * ISC License
216
+ *
217
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
218
+ *
219
+ * Permission to use, copy, modify, and/or distribute this software for any
220
+ * purpose with or without fee is hereby granted, provided that the above
221
+ * copyright notice and this permission notice appear in all copies.
222
+ *
223
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
224
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
225
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
226
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
227
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
228
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
229
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
230
+ *
231
+ */const r=[["polygon",{points:"6 3 20 12 6 21 6 3"}]];it(n,nt({name:"play"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function gl(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
232
+ * @license lucide-svelte v0.475.0 - ISC
233
+ *
234
+ * ISC License
235
+ *
236
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
237
+ *
238
+ * Permission to use, copy, modify, and/or distribute this software for any
239
+ * purpose with or without fee is hereby granted, provided that the above
240
+ * copyright notice and this permission notice appear in all copies.
241
+ *
242
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
243
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
244
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
245
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
246
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
247
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
248
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
249
+ *
250
+ */const r=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}]];it(n,nt({name:"rotate-cw"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function vl(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
251
+ * @license lucide-svelte v0.475.0 - ISC
252
+ *
253
+ * ISC License
254
+ *
255
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
256
+ *
257
+ * Permission to use, copy, modify, and/or distribute this software for any
258
+ * purpose with or without fee is hereby granted, provided that the above
259
+ * copyright notice and this permission notice appear in all copies.
260
+ *
261
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
262
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
263
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
264
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
265
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
266
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
267
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
268
+ *
269
+ */const r=[["circle",{cx:"6",cy:"19",r:"3"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15"}],["circle",{cx:"18",cy:"5",r:"3"}]];it(n,nt({name:"route"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function yl(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
270
+ * @license lucide-svelte v0.475.0 - ISC
271
+ *
272
+ * ISC License
273
+ *
274
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
275
+ *
276
+ * Permission to use, copy, modify, and/or distribute this software for any
277
+ * purpose with or without fee is hereby granted, provided that the above
278
+ * copyright notice and this permission notice appear in all copies.
279
+ *
280
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
281
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
282
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
283
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
284
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
285
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
286
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
287
+ *
288
+ */const r=[["circle",{cx:"11",cy:"11",r:"8"}],["path",{d:"m21 21-4.3-4.3"}]];it(n,nt({name:"search"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function ml(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
289
+ * @license lucide-svelte v0.475.0 - ISC
290
+ *
291
+ * ISC License
292
+ *
293
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
294
+ *
295
+ * Permission to use, copy, modify, and/or distribute this software for any
296
+ * purpose with or without fee is hereby granted, provided that the above
297
+ * copyright notice and this permission notice appear in all copies.
298
+ *
299
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
300
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
301
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
302
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
303
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
304
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
305
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
306
+ *
307
+ */const r=[["circle",{cx:"19",cy:"5",r:"2"}],["circle",{cx:"5",cy:"19",r:"2"}],["path",{d:"M5 17A12 12 0 0 1 17 5"}]];it(n,nt({name:"spline"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function bl(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
308
+ * @license lucide-svelte v0.475.0 - ISC
309
+ *
310
+ * ISC License
311
+ *
312
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
313
+ *
314
+ * Permission to use, copy, modify, and/or distribute this software for any
315
+ * purpose with or without fee is hereby granted, provided that the above
316
+ * copyright notice and this permission notice appear in all copies.
317
+ *
318
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
319
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
320
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
321
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
322
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
323
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
324
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
325
+ *
326
+ */const r=[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18"}]];it(n,nt({name:"table-2"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function $o(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
327
+ * @license lucide-svelte v0.475.0 - ISC
328
+ *
329
+ * ISC License
330
+ *
331
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
332
+ *
333
+ * Permission to use, copy, modify, and/or distribute this software for any
334
+ * purpose with or without fee is hereby granted, provided that the above
335
+ * copyright notice and this permission notice appear in all copies.
336
+ *
337
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
338
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
339
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
340
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
341
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
342
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
343
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
344
+ *
345
+ */const r=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"}],["path",{d:"M12 9v4"}],["path",{d:"M12 17h.01"}]];it(n,nt({name:"triangle-alert"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function Ao(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
346
+ * @license lucide-svelte v0.475.0 - ISC
347
+ *
348
+ * ISC License
349
+ *
350
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
351
+ *
352
+ * Permission to use, copy, modify, and/or distribute this software for any
353
+ * purpose with or without fee is hereby granted, provided that the above
354
+ * copyright notice and this permission notice appear in all copies.
355
+ *
356
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
357
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
358
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
359
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
360
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
361
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
362
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
363
+ *
364
+ */const r=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];it(n,nt({name:"x"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function wl(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
365
+ * @license lucide-svelte v0.475.0 - ISC
366
+ *
367
+ * ISC License
368
+ *
369
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
370
+ *
371
+ * Permission to use, copy, modify, and/or distribute this software for any
372
+ * purpose with or without fee is hereby granted, provided that the above
373
+ * copyright notice and this permission notice appear in all copies.
374
+ *
375
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
376
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
377
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
378
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
379
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
380
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
381
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
382
+ *
383
+ */const r=[["circle",{cx:"11",cy:"11",r:"8"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11"}]];it(n,nt({name:"zoom-in"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function _l(n,e){const t=Ze(e,["children","$$slots","$$events","$$legacy"]);/**
384
+ * @license lucide-svelte v0.475.0 - ISC
385
+ *
386
+ * ISC License
387
+ *
388
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
389
+ *
390
+ * Permission to use, copy, modify, and/or distribute this software for any
391
+ * purpose with or without fee is hereby granted, provided that the above
392
+ * copyright notice and this permission notice appear in all copies.
393
+ *
394
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
395
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
396
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
397
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
398
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
399
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
400
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
401
+ *
402
+ */const r=[["circle",{cx:"11",cy:"11",r:"8"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11"}]];it(n,nt({name:"zoom-out"},()=>t,{get iconNode(){return r},children:(i,o)=>{var s=He(),a=Ce(s);tt(a,e,"default",{},null),M(i,s)},$$slots:{default:!0}}))}function rp(n){return n?n==="graph"?"graph":n:"table"}function np(n,e){switch(n){case"graph":case"svg":return"graph";case"table":return"table";case"json":return"json";case"hypertable":case"kv":case"vector":case"queue":case"stats":case"diff":case"document":return n;default:return e}}function Yn(n,e){return`/c/${encodeURIComponent(n)}/p/${encodeURIComponent(e)}`}function _i(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var dn={exports:{}},Co;function xl(){if(Co)return dn.exports;Co=1;var n=typeof Reflect=="object"?Reflect:null,e=n&&typeof n.apply=="function"?n.apply:function(k,$,S){return Function.prototype.apply.call(k,$,S)},t;n&&typeof n.ownKeys=="function"?t=n.ownKeys:Object.getOwnPropertySymbols?t=function(k){return Object.getOwnPropertyNames(k).concat(Object.getOwnPropertySymbols(k))}:t=function(k){return Object.getOwnPropertyNames(k)};function r(p){console&&console.warn&&console.warn(p)}var i=Number.isNaN||function(k){return k!==k};function o(){o.init.call(this)}dn.exports=o,dn.exports.once=v,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(p){if(typeof p!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof p)}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(p){if(typeof p!="number"||p<0||i(p))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+p+".");s=p}}),o.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(k){if(typeof k!="number"||k<0||i(k))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+k+".");return this._maxListeners=k,this};function c(p){return p._maxListeners===void 0?o.defaultMaxListeners:p._maxListeners}o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(k){for(var $=[],S=1;S<arguments.length;S++)$.push(arguments[S]);var G=k==="error",C=this._events;if(C!==void 0)G=G&&C.error===void 0;else if(!G)return!1;if(G){var T;if($.length>0&&(T=$[0]),T instanceof Error)throw T;var q=new Error("Unhandled error."+(T?" ("+T.message+")":""));throw q.context=T,q}var N=C[k];if(N===void 0)return!1;if(typeof N=="function")e(N,this,$);else for(var m=N.length,Le=y(N,m),S=0;S<m;++S)e(Le[S],this,$);return!0};function l(p,k,$,S){var G,C,T;if(a($),C=p._events,C===void 0?(C=p._events=Object.create(null),p._eventsCount=0):(C.newListener!==void 0&&(p.emit("newListener",k,$.listener?$.listener:$),C=p._events),T=C[k]),T===void 0)T=C[k]=$,++p._eventsCount;else if(typeof T=="function"?T=C[k]=S?[$,T]:[T,$]:S?T.unshift($):T.push($),G=c(p),G>0&&T.length>G&&!T.warned){T.warned=!0;var q=new Error("Possible EventEmitter memory leak detected. "+T.length+" "+String(k)+" listeners added. Use emitter.setMaxListeners() to increase limit");q.name="MaxListenersExceededWarning",q.emitter=p,q.type=k,q.count=T.length,r(q)}return p}o.prototype.addListener=function(k,$){return l(this,k,$,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(k,$){return l(this,k,$,!0)};function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(p,k,$){var S={fired:!1,wrapFn:void 0,target:p,type:k,listener:$},G=d.bind(S);return G.listener=$,S.wrapFn=G,G}o.prototype.once=function(k,$){return a($),this.on(k,f(this,k,$)),this},o.prototype.prependOnceListener=function(k,$){return a($),this.prependListener(k,f(this,k,$)),this},o.prototype.removeListener=function(k,$){var S,G,C,T,q;if(a($),G=this._events,G===void 0)return this;if(S=G[k],S===void 0)return this;if(S===$||S.listener===$)--this._eventsCount===0?this._events=Object.create(null):(delete G[k],G.removeListener&&this.emit("removeListener",k,S.listener||$));else if(typeof S!="function"){for(C=-1,T=S.length-1;T>=0;T--)if(S[T]===$||S[T].listener===$){q=S[T].listener,C=T;break}if(C<0)return this;C===0?S.shift():E(S,C),S.length===1&&(G[k]=S[0]),G.removeListener!==void 0&&this.emit("removeListener",k,q||$)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(k){var $,S,G;if(S=this._events,S===void 0)return this;if(S.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):S[k]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete S[k]),this;if(arguments.length===0){var C=Object.keys(S),T;for(G=0;G<C.length;++G)T=C[G],T!=="removeListener"&&this.removeAllListeners(T);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if($=S[k],typeof $=="function")this.removeListener(k,$);else if($!==void 0)for(G=$.length-1;G>=0;G--)this.removeListener(k,$[G]);return this};function h(p,k,$){var S=p._events;if(S===void 0)return[];var G=S[k];return G===void 0?[]:typeof G=="function"?$?[G.listener||G]:[G]:$?b(G):y(G,G.length)}o.prototype.listeners=function(k){return h(this,k,!0)},o.prototype.rawListeners=function(k){return h(this,k,!1)},o.listenerCount=function(p,k){return typeof p.listenerCount=="function"?p.listenerCount(k):g.call(p,k)},o.prototype.listenerCount=g;function g(p){var k=this._events;if(k!==void 0){var $=k[p];if(typeof $=="function")return 1;if($!==void 0)return $.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function y(p,k){for(var $=new Array(k),S=0;S<k;++S)$[S]=p[S];return $}function E(p,k){for(;k+1<p.length;k++)p[k]=p[k+1];p.pop()}function b(p){for(var k=new Array(p.length),$=0;$<k.length;++$)k[$]=p[$].listener||p[$];return k}function v(p,k){return new Promise(function($,S){function G(T){p.removeListener(k,C),S(T)}function C(){typeof p.removeListener=="function"&&p.removeListener("error",G),$([].slice.call(arguments))}_(p,k,C,{once:!0}),k!=="error"&&A(p,G,{once:!0})})}function A(p,k,$){typeof p.on=="function"&&_(p,"error",k,$)}function _(p,k,$,S){if(typeof p.on=="function")S.once?p.once(k,$):p.on(k,$);else if(typeof p.addEventListener=="function")p.addEventListener(k,function G(C){S.once&&p.removeEventListener(k,G),$(C)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof p)}return dn.exports}var El=xl();function kl(){const n=arguments[0];for(let e=1,t=arguments.length;e<t;e++)if(arguments[e])for(const r in arguments[e])n[r]=arguments[e][r];return n}let ot=kl;typeof Object.assign=="function"&&(ot=Object.assign);function Gt(n,e,t,r){const i=n._nodes.get(e);let o=null;return i&&(r==="mixed"?o=i.out&&i.out[t]||i.undirected&&i.undirected[t]:r==="directed"?o=i.out&&i.out[t]:o=i.undirected&&i.undirected[t]),o}function pt(n){return typeof n=="object"&&n!==null}function Ls(n){let e;for(e in n)return!1;return!0}function Dt(n,e,t){Object.defineProperty(n,e,{enumerable:!1,configurable:!1,writable:!0,value:t})}function Rt(n,e,t){const r={enumerable:!0,configurable:!0};typeof t=="function"?r.get=t:(r.value=t,r.writable=!1),Object.defineProperty(n,e,r)}function Lo(n){return!(!pt(n)||n.attributes&&!Array.isArray(n.attributes))}function Sl(){let n=Math.floor(Math.random()*256)&255;return()=>n++}function Ht(){const n=arguments;let e=null,t=-1;return{[Symbol.iterator](){return this},next(){let r=null;do{if(e===null){if(t++,t>=n.length)return{done:!0};e=n[t][Symbol.iterator]()}if(r=e.next(),r.done){e=null;continue}break}while(!0);return r}}}function Sr(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class xi extends Error{constructor(e){super(),this.name="GraphError",this.message=e}}class H extends xi{constructor(e){super(e),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,H.prototype.constructor)}}class j extends xi{constructor(e){super(e),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,j.prototype.constructor)}}class se extends xi{constructor(e){super(e),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,se.prototype.constructor)}}function Ds(n,e){this.key=n,this.attributes=e,this.clear()}Ds.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function Gs(n,e){this.key=n,this.attributes=e,this.clear()}Gs.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Is(n,e){this.key=n,this.attributes=e,this.clear()}Is.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function $r(n,e,t,r,i){this.key=e,this.attributes=i,this.undirected=n,this.source=t,this.target=r}$r.prototype.attach=function(){let n="out",e="in";this.undirected&&(n=e="undirected");const t=this.source.key,r=this.target.key;this.source[n][r]=this,!(this.undirected&&t===r)&&(this.target[e][t]=this)};$r.prototype.attachMulti=function(){let n="out",e="in";const t=this.source.key,r=this.target.key;this.undirected&&(n=e="undirected");const i=this.source[n],o=i[r];if(typeof o>"u"){i[r]=this,this.undirected&&t===r||(this.target[e][t]=this);return}o.previous=this,this.next=o,i[r]=this,this.target[e][t]=this};$r.prototype.detach=function(){const n=this.source.key,e=this.target.key;let t="out",r="in";this.undirected&&(t=r="undirected"),delete this.source[t][e],delete this.target[r][n]};$r.prototype.detachMulti=function(){const n=this.source.key,e=this.target.key;let t="out",r="in";this.undirected&&(t=r="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][e],delete this.target[r][n]):(this.next.previous=void 0,this.source[t][e]=this.next,this.target[r][n]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const Ts=0,Rs=1,$l=2,Os=3;function qt(n,e,t,r,i,o,s){let a,c,l,d;if(r=""+r,t===Ts){if(a=n._nodes.get(r),!a)throw new j(`Graph.${e}: could not find the "${r}" node in the graph.`);l=i,d=o}else if(t===Os){if(i=""+i,c=n._edges.get(i),!c)throw new j(`Graph.${e}: could not find the "${i}" edge in the graph.`);const f=c.source.key,h=c.target.key;if(r===f)a=c.target;else if(r===h)a=c.source;else throw new j(`Graph.${e}: the "${r}" node is not attached to the "${i}" edge (${f}, ${h}).`);l=o,d=s}else{if(c=n._edges.get(r),!c)throw new j(`Graph.${e}: could not find the "${r}" edge in the graph.`);t===Rs?a=c.source:a=c.target,l=i,d=o}return[a,l,d]}function Al(n,e,t){n.prototype[e]=function(r,i,o){const[s,a]=qt(this,e,t,r,i,o);return s.attributes[a]}}function Cl(n,e,t){n.prototype[e]=function(r,i){const[o]=qt(this,e,t,r,i);return o.attributes}}function Ll(n,e,t){n.prototype[e]=function(r,i,o){const[s,a]=qt(this,e,t,r,i,o);return s.attributes.hasOwnProperty(a)}}function Dl(n,e,t){n.prototype[e]=function(r,i,o,s){const[a,c,l]=qt(this,e,t,r,i,o,s);return a.attributes[c]=l,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:c}),this}}function Gl(n,e,t){n.prototype[e]=function(r,i,o,s){const[a,c,l]=qt(this,e,t,r,i,o,s);if(typeof l!="function")throw new H(`Graph.${e}: updater should be a function.`);const d=a.attributes,f=l(d[c]);return d[c]=f,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:c}),this}}function Il(n,e,t){n.prototype[e]=function(r,i,o){const[s,a]=qt(this,e,t,r,i,o);return delete s.attributes[a],this.emit("nodeAttributesUpdated",{key:s.key,type:"remove",attributes:s.attributes,name:a}),this}}function Tl(n,e,t){n.prototype[e]=function(r,i,o){const[s,a]=qt(this,e,t,r,i,o);if(!pt(a))throw new H(`Graph.${e}: provided attributes are not a plain object.`);return s.attributes=a,this.emit("nodeAttributesUpdated",{key:s.key,type:"replace",attributes:s.attributes}),this}}function Rl(n,e,t){n.prototype[e]=function(r,i,o){const[s,a]=qt(this,e,t,r,i,o);if(!pt(a))throw new H(`Graph.${e}: provided attributes are not a plain object.`);return ot(s.attributes,a),this.emit("nodeAttributesUpdated",{key:s.key,type:"merge",attributes:s.attributes,data:a}),this}}function Ol(n,e,t){n.prototype[e]=function(r,i,o){const[s,a]=qt(this,e,t,r,i,o);if(typeof a!="function")throw new H(`Graph.${e}: provided updater is not a function.`);return s.attributes=a(s.attributes),this.emit("nodeAttributesUpdated",{key:s.key,type:"update",attributes:s.attributes}),this}}const Nl=[{name:n=>`get${n}Attribute`,attacher:Al},{name:n=>`get${n}Attributes`,attacher:Cl},{name:n=>`has${n}Attribute`,attacher:Ll},{name:n=>`set${n}Attribute`,attacher:Dl},{name:n=>`update${n}Attribute`,attacher:Gl},{name:n=>`remove${n}Attribute`,attacher:Il},{name:n=>`replace${n}Attributes`,attacher:Tl},{name:n=>`merge${n}Attributes`,attacher:Rl},{name:n=>`update${n}Attributes`,attacher:Ol}];function Ul(n){Nl.forEach(function({name:e,attacher:t}){t(n,e("Node"),Ts),t(n,e("Source"),Rs),t(n,e("Target"),$l),t(n,e("Opposite"),Os)})}function Pl(n,e,t){n.prototype[e]=function(r,i){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new se(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new se(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+r,a=""+i;if(i=arguments[2],o=Gt(this,s,a,t),!o)throw new j(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(t!=="mixed")throw new se(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,o=this._edges.get(r),!o)throw new j(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return o.attributes[i]}}function zl(n,e,t){n.prototype[e]=function(r){let i;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new se(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new se(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+r,s=""+arguments[1];if(i=Gt(this,o,s,t),!i)throw new j(`Graph.${e}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(t!=="mixed")throw new se(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,i=this._edges.get(r),!i)throw new j(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return i.attributes}}function Ml(n,e,t){n.prototype[e]=function(r,i){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new se(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new se(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+r,a=""+i;if(i=arguments[2],o=Gt(this,s,a,t),!o)throw new j(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(t!=="mixed")throw new se(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,o=this._edges.get(r),!o)throw new j(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return o.attributes.hasOwnProperty(i)}}function Wl(n,e,t){n.prototype[e]=function(r,i,o){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new se(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new se(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+r,c=""+i;if(i=arguments[2],o=arguments[3],s=Gt(this,a,c,t),!s)throw new j(`Graph.${e}: could not find an edge for the given path ("${a}" - "${c}").`)}else{if(t!=="mixed")throw new se(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,s=this._edges.get(r),!s)throw new j(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return s.attributes[i]=o,this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:i}),this}}function jl(n,e,t){n.prototype[e]=function(r,i,o){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new se(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new se(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+r,c=""+i;if(i=arguments[2],o=arguments[3],s=Gt(this,a,c,t),!s)throw new j(`Graph.${e}: could not find an edge for the given path ("${a}" - "${c}").`)}else{if(t!=="mixed")throw new se(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,s=this._edges.get(r),!s)throw new j(`Graph.${e}: could not find the "${r}" edge in the graph.`)}if(typeof o!="function")throw new H(`Graph.${e}: updater should be a function.`);return s.attributes[i]=o(s.attributes[i]),this.emit("edgeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:i}),this}}function Bl(n,e,t){n.prototype[e]=function(r,i){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new se(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new se(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+r,a=""+i;if(i=arguments[2],o=Gt(this,s,a,t),!o)throw new j(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(t!=="mixed")throw new se(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,o=this._edges.get(r),!o)throw new j(`Graph.${e}: could not find the "${r}" edge in the graph.`)}return delete o.attributes[i],this.emit("edgeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:i}),this}}function Fl(n,e,t){n.prototype[e]=function(r,i){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new se(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new se(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+r,a=""+i;if(i=arguments[2],o=Gt(this,s,a,t),!o)throw new j(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(t!=="mixed")throw new se(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,o=this._edges.get(r),!o)throw new j(`Graph.${e}: could not find the "${r}" edge in the graph.`)}if(!pt(i))throw new H(`Graph.${e}: provided attributes are not a plain object.`);return o.attributes=i,this.emit("edgeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function Kl(n,e,t){n.prototype[e]=function(r,i){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new se(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new se(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+r,a=""+i;if(i=arguments[2],o=Gt(this,s,a,t),!o)throw new j(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(t!=="mixed")throw new se(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,o=this._edges.get(r),!o)throw new j(`Graph.${e}: could not find the "${r}" edge in the graph.`)}if(!pt(i))throw new H(`Graph.${e}: provided attributes are not a plain object.`);return ot(o.attributes,i),this.emit("edgeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:i}),this}}function Hl(n,e,t){n.prototype[e]=function(r,i){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new se(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new se(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+r,a=""+i;if(i=arguments[2],o=Gt(this,s,a,t),!o)throw new j(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(t!=="mixed")throw new se(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(r=""+r,o=this._edges.get(r),!o)throw new j(`Graph.${e}: could not find the "${r}" edge in the graph.`)}if(typeof i!="function")throw new H(`Graph.${e}: provided updater is not a function.`);return o.attributes=i(o.attributes),this.emit("edgeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const ql=[{name:n=>`get${n}Attribute`,attacher:Pl},{name:n=>`get${n}Attributes`,attacher:zl},{name:n=>`has${n}Attribute`,attacher:Ml},{name:n=>`set${n}Attribute`,attacher:Wl},{name:n=>`update${n}Attribute`,attacher:jl},{name:n=>`remove${n}Attribute`,attacher:Bl},{name:n=>`replace${n}Attributes`,attacher:Fl},{name:n=>`merge${n}Attributes`,attacher:Kl},{name:n=>`update${n}Attributes`,attacher:Hl}];function Vl(n){ql.forEach(function({name:e,attacher:t}){t(n,e("Edge"),"mixed"),t(n,e("DirectedEdge"),"directed"),t(n,e("UndirectedEdge"),"undirected")})}const Yl=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function Xl(n,e,t,r){let i=!1;for(const o in e){if(o===r)continue;const s=e[o];if(i=t(s.key,s.attributes,s.source.key,s.target.key,s.source.attributes,s.target.attributes,s.undirected),n&&i)return s.key}}function Jl(n,e,t,r){let i,o,s,a=!1;for(const c in e)if(c!==r){i=e[c];do{if(o=i.source,s=i.target,a=t(i.key,i.attributes,o.key,s.key,o.attributes,s.attributes,i.undirected),n&&a)return i.key;i=i.next}while(i!==void 0)}}function Xn(n,e){const t=Object.keys(n),r=t.length;let i,o=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(o>=r)return{done:!0};const s=t[o++];if(s===e){i=void 0;continue}i=n[s]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function Zl(n,e,t,r){const i=e[t];if(!i)return;const o=i.source,s=i.target;if(r(i.key,i.attributes,o.key,s.key,o.attributes,s.attributes,i.undirected)&&n)return i.key}function Ql(n,e,t,r){let i=e[t];if(!i)return;let o=!1;do{if(o=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),n&&o)return i.key;i=i.next}while(i!==void 0)}function Jn(n,e){let t=n[e];if(t.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!t)return{done:!0};const i={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:i}}};let r=!1;return{[Symbol.iterator](){return this},next(){return r===!0?{done:!0}:(r=!0,{done:!1,value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected}})}}}function ed(n,e){if(n.size===0)return[];if(e==="mixed"||e===n.type)return Array.from(n._edges.keys());const t=e==="undirected"?n.undirectedSize:n.directedSize,r=new Array(t),i=e==="undirected",o=n._edges.values();let s=0,a,c;for(;a=o.next(),a.done!==!0;)c=a.value,c.undirected===i&&(r[s++]=c.key);return r}function Ns(n,e,t,r){if(e.size===0)return;const i=t!=="mixed"&&t!==e.type,o=t==="undirected";let s,a,c=!1;const l=e._edges.values();for(;s=l.next(),s.done!==!0;){if(a=s.value,i&&a.undirected!==o)continue;const{key:d,attributes:f,source:h,target:g}=a;if(c=r(d,f,h.key,g.key,h.attributes,g.attributes,a.undirected),n&&c)return d}}function td(n,e){if(n.size===0)return Sr();const t=e!=="mixed"&&e!==n.type,r=e==="undirected",i=n._edges.values();return{[Symbol.iterator](){return this},next(){let o,s;for(;;){if(o=i.next(),o.done)return o;if(s=o.value,!(t&&s.undirected!==r))break}return{value:{edge:s.key,attributes:s.attributes,source:s.source.key,target:s.target.key,sourceAttributes:s.source.attributes,targetAttributes:s.target.attributes,undirected:s.undirected},done:!1}}}}function Ei(n,e,t,r,i,o){const s=e?Jl:Xl;let a;if(t!=="undirected"&&(r!=="out"&&(a=s(n,i.in,o),n&&a)||r!=="in"&&(a=s(n,i.out,o,r?void 0:i.key),n&&a))||t!=="directed"&&(a=s(n,i.undirected,o),n&&a))return a}function rd(n,e,t,r){const i=[];return Ei(!1,n,e,t,r,function(o){i.push(o)}),i}function nd(n,e,t){let r=Sr();return n!=="undirected"&&(e!=="out"&&typeof t.in<"u"&&(r=Ht(r,Xn(t.in))),e!=="in"&&typeof t.out<"u"&&(r=Ht(r,Xn(t.out,e?void 0:t.key)))),n!=="directed"&&typeof t.undirected<"u"&&(r=Ht(r,Xn(t.undirected))),r}function ki(n,e,t,r,i,o,s){const a=t?Ql:Zl;let c;if(e!=="undirected"&&(typeof i.in<"u"&&r!=="out"&&(c=a(n,i.in,o,s),n&&c)||typeof i.out<"u"&&r!=="in"&&(r||i.key!==o)&&(c=a(n,i.out,o,s),n&&c))||e!=="directed"&&typeof i.undirected<"u"&&(c=a(n,i.undirected,o,s),n&&c))return c}function id(n,e,t,r,i){const o=[];return ki(!1,n,e,t,r,i,function(s){o.push(s)}),o}function od(n,e,t,r){let i=Sr();return n!=="undirected"&&(typeof t.in<"u"&&e!=="out"&&r in t.in&&(i=Ht(i,Jn(t.in,r))),typeof t.out<"u"&&e!=="in"&&r in t.out&&(e||t.key!==r)&&(i=Ht(i,Jn(t.out,r)))),n!=="directed"&&typeof t.undirected<"u"&&r in t.undirected&&(i=Ht(i,Jn(t.undirected,r))),i}function sd(n,e){const{name:t,type:r,direction:i}=e;n.prototype[t]=function(o,s){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return[];if(!arguments.length)return ed(this,r);if(arguments.length===1){o=""+o;const a=this._nodes.get(o);if(typeof a>"u")throw new j(`Graph.${t}: could not find the "${o}" node in the graph.`);return rd(this.multi,r==="mixed"?this.type:r,i,a)}if(arguments.length===2){o=""+o,s=""+s;const a=this._nodes.get(o);if(!a)throw new j(`Graph.${t}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(s))throw new j(`Graph.${t}: could not find the "${s}" target node in the graph.`);return id(r,this.multi,i,a,s)}throw new H(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function ad(n,e){const{name:t,type:r,direction:i}=e,o="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(l,d,f){if(!(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)){if(arguments.length===1)return f=l,Ns(!1,this,r,f);if(arguments.length===2){l=""+l,f=d;const h=this._nodes.get(l);if(typeof h>"u")throw new j(`Graph.${o}: could not find the "${l}" node in the graph.`);return Ei(!1,this.multi,r==="mixed"?this.type:r,i,h,f)}if(arguments.length===3){l=""+l,d=""+d;const h=this._nodes.get(l);if(!h)throw new j(`Graph.${o}: could not find the "${l}" source node in the graph.`);if(!this._nodes.has(d))throw new j(`Graph.${o}: could not find the "${d}" target node in the graph.`);return ki(!1,r,this.multi,i,h,d,f)}throw new H(`Graph.${o}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const s="map"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(){const l=Array.prototype.slice.call(arguments),d=l.pop();let f;if(l.length===0){let h=0;r!=="directed"&&(h+=this.undirectedSize),r!=="undirected"&&(h+=this.directedSize),f=new Array(h);let g=0;l.push((y,E,b,v,A,_,p)=>{f[g++]=d(y,E,b,v,A,_,p)})}else f=[],l.push((h,g,y,E,b,v,A)=>{f.push(d(h,g,y,E,b,v,A))});return this[o].apply(this,l),f};const a="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[a]=function(){const l=Array.prototype.slice.call(arguments),d=l.pop(),f=[];return l.push((h,g,y,E,b,v,A)=>{d(h,g,y,E,b,v,A)&&f.push(h)}),this[o].apply(this,l),f};const c="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[c]=function(){let l=Array.prototype.slice.call(arguments);if(l.length<2||l.length>4)throw new H(`Graph.${c}: invalid number of arguments (expecting 2, 3 or 4 and got ${l.length}).`);if(typeof l[l.length-1]=="function"&&typeof l[l.length-2]!="function")throw new H(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let d,f;l.length===2?(d=l[0],f=l[1],l=[]):l.length===3?(d=l[1],f=l[2],l=[l[0]]):l.length===4&&(d=l[2],f=l[3],l=[l[0],l[1]]);let h=f;return l.push((g,y,E,b,v,A,_)=>{h=d(h,g,y,E,b,v,A,_)}),this[o].apply(this,l),h}}function ud(n,e){const{name:t,type:r,direction:i}=e,o="find"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(c,l,d){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return!1;if(arguments.length===1)return d=c,Ns(!0,this,r,d);if(arguments.length===2){c=""+c,d=l;const f=this._nodes.get(c);if(typeof f>"u")throw new j(`Graph.${o}: could not find the "${c}" node in the graph.`);return Ei(!0,this.multi,r==="mixed"?this.type:r,i,f,d)}if(arguments.length===3){c=""+c,l=""+l;const f=this._nodes.get(c);if(!f)throw new j(`Graph.${o}: could not find the "${c}" source node in the graph.`);if(!this._nodes.has(l))throw new j(`Graph.${o}: could not find the "${l}" target node in the graph.`);return ki(!0,r,this.multi,i,f,l,d)}throw new H(`Graph.${o}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const s="some"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(){const c=Array.prototype.slice.call(arguments),l=c.pop();return c.push((f,h,g,y,E,b,v)=>l(f,h,g,y,E,b,v)),!!this[o].apply(this,c)};const a="every"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(){const c=Array.prototype.slice.call(arguments),l=c.pop();return c.push((f,h,g,y,E,b,v)=>!l(f,h,g,y,E,b,v)),!this[o].apply(this,c)}}function cd(n,e){const{name:t,type:r,direction:i}=e,o=t.slice(0,-1)+"Entries";n.prototype[o]=function(s,a){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return Sr();if(!arguments.length)return td(this,r);if(arguments.length===1){s=""+s;const c=this._nodes.get(s);if(!c)throw new j(`Graph.${o}: could not find the "${s}" node in the graph.`);return nd(r,i,c)}if(arguments.length===2){s=""+s,a=""+a;const c=this._nodes.get(s);if(!c)throw new j(`Graph.${o}: could not find the "${s}" source node in the graph.`);if(!this._nodes.has(a))throw new j(`Graph.${o}: could not find the "${a}" target node in the graph.`);return od(r,i,c,a)}throw new H(`Graph.${o}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function ld(n){Yl.forEach(e=>{sd(n,e),ad(n,e),ud(n,e),cd(n,e)})}const dd=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function xn(){this.A=null,this.B=null}xn.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};xn.prototype.has=function(n){return this.A!==null&&n in this.A||this.B!==null&&n in this.B};function Or(n,e,t,r,i){for(const o in r){const s=r[o],a=s.source,c=s.target,l=a===t?c:a;if(e&&e.has(l.key))continue;const d=i(l.key,l.attributes);if(n&&d)return l.key}}function Si(n,e,t,r,i){if(e!=="mixed"){if(e==="undirected")return Or(n,null,r,r.undirected,i);if(typeof t=="string")return Or(n,null,r,r[t],i)}const o=new xn;let s;if(e!=="undirected"){if(t!=="out"){if(s=Or(n,null,r,r.in,i),n&&s)return s;o.wrap(r.in)}if(t!=="in"){if(s=Or(n,o,r,r.out,i),n&&s)return s;o.wrap(r.out)}}if(e!=="directed"&&(s=Or(n,o,r,r.undirected,i),n&&s))return s}function fd(n,e,t){if(n!=="mixed"){if(n==="undirected")return Object.keys(t.undirected);if(typeof e=="string")return Object.keys(t[e])}const r=[];return Si(!1,n,e,t,function(i){r.push(i)}),r}function Nr(n,e,t){const r=Object.keys(t),i=r.length;let o=0;return{[Symbol.iterator](){return this},next(){let s=null;do{if(o>=i)return n&&n.wrap(t),{done:!0};const a=t[r[o++]],c=a.source,l=a.target;if(s=c===e?l:c,n&&n.has(s.key)){s=null;continue}}while(s===null);return{done:!1,value:{neighbor:s.key,attributes:s.attributes}}}}}function hd(n,e,t){if(n!=="mixed"){if(n==="undirected")return Nr(null,t,t.undirected);if(typeof e=="string")return Nr(null,t,t[e])}let r=Sr();const i=new xn;return n!=="undirected"&&(e!=="out"&&(r=Ht(r,Nr(i,t,t.in))),e!=="in"&&(r=Ht(r,Nr(i,t,t.out)))),n!=="directed"&&(r=Ht(r,Nr(i,t,t.undirected))),r}function pd(n,e){const{name:t,type:r,direction:i}=e;n.prototype[t]=function(o){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return[];o=""+o;const s=this._nodes.get(o);if(typeof s>"u")throw new j(`Graph.${t}: could not find the "${o}" node in the graph.`);return fd(r==="mixed"?this.type:r,i,s)}}function gd(n,e){const{name:t,type:r,direction:i}=e,o="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(l,d){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return;l=""+l;const f=this._nodes.get(l);if(typeof f>"u")throw new j(`Graph.${o}: could not find the "${l}" node in the graph.`);Si(!1,r==="mixed"?this.type:r,i,f,d)};const s="map"+t[0].toUpperCase()+t.slice(1);n.prototype[s]=function(l,d){const f=[];return this[o](l,(h,g)=>{f.push(d(h,g))}),f};const a="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[a]=function(l,d){const f=[];return this[o](l,(h,g)=>{d(h,g)&&f.push(h)}),f};const c="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[c]=function(l,d,f){if(arguments.length<3)throw new H(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let h=f;return this[o](l,(g,y)=>{h=d(h,g,y)}),h}}function vd(n,e){const{name:t,type:r,direction:i}=e,o=t[0].toUpperCase()+t.slice(1,-1),s="find"+o;n.prototype[s]=function(l,d){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return;l=""+l;const f=this._nodes.get(l);if(typeof f>"u")throw new j(`Graph.${s}: could not find the "${l}" node in the graph.`);return Si(!0,r==="mixed"?this.type:r,i,f,d)};const a="some"+o;n.prototype[a]=function(l,d){return!!this[s](l,d)};const c="every"+o;n.prototype[c]=function(l,d){return!this[s](l,(h,g)=>!d(h,g))}}function yd(n,e){const{name:t,type:r,direction:i}=e,o=t.slice(0,-1)+"Entries";n.prototype[o]=function(s){if(r!=="mixed"&&this.type!=="mixed"&&r!==this.type)return Sr();s=""+s;const a=this._nodes.get(s);if(typeof a>"u")throw new j(`Graph.${o}: could not find the "${s}" node in the graph.`);return hd(r==="mixed"?this.type:r,i,a)}}function md(n){dd.forEach(e=>{pd(n,e),gd(n,e),vd(n,e),yd(n,e)})}function fn(n,e,t,r,i){const o=r._nodes.values(),s=r.type;let a,c,l,d,f,h;for(;a=o.next(),a.done!==!0;){let g=!1;if(c=a.value,s!=="undirected"){d=c.out;for(l in d){f=d[l];do h=f.target,g=!0,i(c.key,h.key,c.attributes,h.attributes,f.key,f.attributes,f.undirected),f=f.next;while(f)}}if(s!=="directed"){d=c.undirected;for(l in d)if(!(e&&c.key>l)){f=d[l];do h=f.target,h.key!==l&&(h=f.source),g=!0,i(c.key,h.key,c.attributes,h.attributes,f.key,f.attributes,f.undirected),f=f.next;while(f)}}t&&!g&&i(c.key,null,c.attributes,null,null,null,null)}}function bd(n,e){const t={key:n};return Ls(e.attributes)||(t.attributes=ot({},e.attributes)),t}function wd(n,e,t){const r={key:e,source:t.source.key,target:t.target.key};return Ls(t.attributes)||(r.attributes=ot({},t.attributes)),n==="mixed"&&t.undirected&&(r.undirected=!0),r}function _d(n){if(!pt(n))throw new H('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in n))throw new H("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!pt(n.attributes)||n.attributes===null))throw new H("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function xd(n){if(!pt(n))throw new H('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in n))throw new H("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new H("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!pt(n.attributes)||n.attributes===null))throw new H("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new H("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const Ed=Sl(),kd=new Set(["directed","undirected","mixed"]),Do=new Set(["domain","_events","_eventsCount","_maxListeners"]),Sd=[{name:n=>`${n}Edge`,generateKey:!0},{name:n=>`${n}DirectedEdge`,generateKey:!0,type:"directed"},{name:n=>`${n}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:n=>`${n}EdgeWithKey`},{name:n=>`${n}DirectedEdgeWithKey`,type:"directed"},{name:n=>`${n}UndirectedEdgeWithKey`,type:"undirected"}],$d={allowSelfLoops:!0,multi:!1,type:"mixed"};function Ad(n,e,t){if(t&&!pt(t))throw new H(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(e=""+e,t=t||{},n._nodes.has(e))throw new se(`Graph.addNode: the "${e}" node already exist in the graph.`);const r=new n.NodeDataClass(e,t);return n._nodes.set(e,r),n.emit("nodeAdded",{key:e,attributes:t}),r}function Go(n,e,t){const r=new n.NodeDataClass(e,t);return n._nodes.set(e,r),n.emit("nodeAdded",{key:e,attributes:t}),r}function Us(n,e,t,r,i,o,s,a){if(!r&&n.type==="undirected")throw new se(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&n.type==="directed")throw new se(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(a&&!pt(a))throw new H(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`);if(o=""+o,s=""+s,a=a||{},!n.allowSelfLoops&&o===s)throw new se(`Graph.${e}: source & target are the same ("${o}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const c=n._nodes.get(o),l=n._nodes.get(s);if(!c)throw new j(`Graph.${e}: source node "${o}" not found.`);if(!l)throw new j(`Graph.${e}: target node "${s}" not found.`);const d={key:null,undirected:r,source:o,target:s,attributes:a};if(t)i=n._edgeKeyGenerator();else if(i=""+i,n._edges.has(i))throw new se(`Graph.${e}: the "${i}" edge already exists in the graph.`);if(!n.multi&&(r?typeof c.undirected[s]<"u":typeof c.out[s]<"u"))throw new se(`Graph.${e}: an edge linking "${o}" to "${s}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const f=new $r(r,i,c,l,a);n._edges.set(i,f);const h=o===s;return r?(c.undirectedDegree++,l.undirectedDegree++,h&&(c.undirectedLoops++,n._undirectedSelfLoopCount++)):(c.outDegree++,l.inDegree++,h&&(c.directedLoops++,n._directedSelfLoopCount++)),n.multi?f.attachMulti():f.attach(),r?n._undirectedSize++:n._directedSize++,d.key=i,n.emit("edgeAdded",d),i}function Cd(n,e,t,r,i,o,s,a,c){if(!r&&n.type==="undirected")throw new se(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&n.type==="directed")throw new se(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(a){if(c){if(typeof a!="function")throw new H(`Graph.${e}: invalid updater function. Expecting a function but got "${a}"`)}else if(!pt(a))throw new H(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`)}o=""+o,s=""+s;let l;if(c&&(l=a,a=void 0),!n.allowSelfLoops&&o===s)throw new se(`Graph.${e}: source & target are the same ("${o}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let d=n._nodes.get(o),f=n._nodes.get(s),h,g;if(!t&&(h=n._edges.get(i),h)){if((h.source.key!==o||h.target.key!==s)&&(!r||h.source.key!==s||h.target.key!==o))throw new se(`Graph.${e}: inconsistency detected when attempting to merge the "${i}" edge with "${o}" source & "${s}" target vs. ("${h.source.key}", "${h.target.key}").`);g=h}if(!g&&!n.multi&&d&&(g=r?d.undirected[s]:d.out[s]),g){const A=[g.key,!1,!1,!1];if(c?!l:!a)return A;if(c){const _=g.attributes;g.attributes=l(_),n.emit("edgeAttributesUpdated",{type:"replace",key:g.key,attributes:g.attributes})}else ot(g.attributes,a),n.emit("edgeAttributesUpdated",{type:"merge",key:g.key,attributes:g.attributes,data:a});return A}a=a||{},c&&l&&(a=l(a));const y={key:null,undirected:r,source:o,target:s,attributes:a};if(t)i=n._edgeKeyGenerator();else if(i=""+i,n._edges.has(i))throw new se(`Graph.${e}: the "${i}" edge already exists in the graph.`);let E=!1,b=!1;d||(d=Go(n,o,{}),E=!0,o===s&&(f=d,b=!0)),f||(f=Go(n,s,{}),b=!0),h=new $r(r,i,d,f,a),n._edges.set(i,h);const v=o===s;return r?(d.undirectedDegree++,f.undirectedDegree++,v&&(d.undirectedLoops++,n._undirectedSelfLoopCount++)):(d.outDegree++,f.inDegree++,v&&(d.directedLoops++,n._directedSelfLoopCount++)),n.multi?h.attachMulti():h.attach(),r?n._undirectedSize++:n._directedSize++,y.key=i,n.emit("edgeAdded",y),[i,!0,E,b]}function vr(n,e){n._edges.delete(e.key);const{source:t,target:r,attributes:i}=e,o=e.undirected,s=t===r;o?(t.undirectedDegree--,r.undirectedDegree--,s&&(t.undirectedLoops--,n._undirectedSelfLoopCount--)):(t.outDegree--,r.inDegree--,s&&(t.directedLoops--,n._directedSelfLoopCount--)),n.multi?e.detachMulti():e.detach(),o?n._undirectedSize--:n._directedSize--,n.emit("edgeDropped",{key:e.key,attributes:i,source:t.key,target:r.key,undirected:o})}class Fe extends El.EventEmitter{constructor(e){if(super(),e=ot({},$d,e),typeof e.multi!="boolean")throw new H(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!kd.has(e.type))throw new H(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!="boolean")throw new H(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);const t=e.type==="mixed"?Ds:e.type==="directed"?Gs:Is;Dt(this,"NodeDataClass",t);const r="geid_"+Ed()+"_";let i=0;const o=()=>{let s;do s=r+i++;while(this._edges.has(s));return s};Dt(this,"_attributes",{}),Dt(this,"_nodes",new Map),Dt(this,"_edges",new Map),Dt(this,"_directedSize",0),Dt(this,"_undirectedSize",0),Dt(this,"_directedSelfLoopCount",0),Dt(this,"_undirectedSelfLoopCount",0),Dt(this,"_edgeKeyGenerator",o),Dt(this,"_options",e),Do.forEach(s=>Dt(this,s,this[s])),Rt(this,"order",()=>this._nodes.size),Rt(this,"size",()=>this._edges.size),Rt(this,"directedSize",()=>this._directedSize),Rt(this,"undirectedSize",()=>this._undirectedSize),Rt(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),Rt(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),Rt(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),Rt(this,"multi",this._options.multi),Rt(this,"type",this._options.type),Rt(this,"allowSelfLoops",this._options.allowSelfLoops),Rt(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(""+e)}hasDirectedEdge(e,t){if(this.type==="undirected")return!1;if(arguments.length===1){const r=""+e,i=this._edges.get(r);return!!i&&!i.undirected}else if(arguments.length===2){e=""+e,t=""+t;const r=this._nodes.get(e);return r?r.out.hasOwnProperty(t):!1}throw new H(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type==="directed")return!1;if(arguments.length===1){const r=""+e,i=this._edges.get(r);return!!i&&i.undirected}else if(arguments.length===2){e=""+e,t=""+t;const r=this._nodes.get(e);return r?r.undirected.hasOwnProperty(t):!1}throw new H(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){const r=""+e;return this._edges.has(r)}else if(arguments.length===2){e=""+e,t=""+t;const r=this._nodes.get(e);return r?typeof r.out<"u"&&r.out.hasOwnProperty(t)||typeof r.undirected<"u"&&r.undirected.hasOwnProperty(t):!1}throw new H(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type==="undirected")return;if(e=""+e,t=""+t,this.multi)throw new se("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const r=this._nodes.get(e);if(!r)throw new j(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new j(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const i=r.out&&r.out[t]||void 0;if(i)return i.key}undirectedEdge(e,t){if(this.type==="directed")return;if(e=""+e,t=""+t,this.multi)throw new se("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const r=this._nodes.get(e);if(!r)throw new j(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new j(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const i=r.undirected&&r.undirected[t]||void 0;if(i)return i.key}edge(e,t){if(this.multi)throw new se("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;const r=this._nodes.get(e);if(!r)throw new j(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new j(`Graph.edge: could not find the "${t}" target node in the graph.`);const i=r.out&&r.out[t]||r.undirected&&r.undirected[t]||void 0;if(i)return i.key}areDirectedNeighbors(e,t){e=""+e,t=""+t;const r=this._nodes.get(e);if(!r)throw new j(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in r.in||t in r.out}areOutNeighbors(e,t){e=""+e,t=""+t;const r=this._nodes.get(e);if(!r)throw new j(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in r.out}areInNeighbors(e,t){e=""+e,t=""+t;const r=this._nodes.get(e);if(!r)throw new j(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in r.in}areUndirectedNeighbors(e,t){e=""+e,t=""+t;const r=this._nodes.get(e);if(!r)throw new j(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="directed"?!1:t in r.undirected}areNeighbors(e,t){e=""+e,t=""+t;const r=this._nodes.get(e);if(!r)throw new j(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&(t in r.in||t in r.out)||this.type!=="directed"&&t in r.undirected}areInboundNeighbors(e,t){e=""+e,t=""+t;const r=this._nodes.get(e);if(!r)throw new j(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in r.in||this.type!=="directed"&&t in r.undirected}areOutboundNeighbors(e,t){e=""+e,t=""+t;const r=this._nodes.get(e);if(!r)throw new j(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in r.out||this.type!=="directed"&&t in r.undirected}inDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new j(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new j(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new j(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new j(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new j(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let r=0;return this.type!=="directed"&&(r+=t.undirectedDegree),this.type!=="undirected"&&(r+=t.inDegree),r}outboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new j(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let r=0;return this.type!=="directed"&&(r+=t.undirectedDegree),this.type!=="undirected"&&(r+=t.outDegree),r}degree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new j(`Graph.degree: could not find the "${e}" node in the graph.`);let r=0;return this.type!=="directed"&&(r+=t.undirectedDegree),this.type!=="undirected"&&(r+=t.inDegree+t.outDegree),r}inDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new j(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new j(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new j(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new j(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new j(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let r=0,i=0;return this.type!=="directed"&&(r+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(r+=t.inDegree,i+=t.directedLoops),r-i}outboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new j(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let r=0,i=0;return this.type!=="directed"&&(r+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(r+=t.outDegree,i+=t.directedLoops),r-i}degreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new j(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let r=0,i=0;return this.type!=="directed"&&(r+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(r+=t.inDegree+t.outDegree,i+=t.directedLoops*2),r-i}source(e){e=""+e;const t=this._edges.get(e);if(!t)throw new j(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=""+e;const t=this._edges.get(e);if(!t)throw new j(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=""+e;const t=this._edges.get(e);if(!t)throw new j(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=""+e,t=""+t;const r=this._edges.get(t);if(!r)throw new j(`Graph.opposite: could not find the "${t}" edge in the graph.`);const i=r.source.key,o=r.target.key;if(e===i)return o;if(e===o)return i;throw new j(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${i}, ${o}).`)}hasExtremity(e,t){e=""+e,t=""+t;const r=this._edges.get(e);if(!r)throw new j(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return r.source.key===t||r.target.key===t}isUndirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new j(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new j(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=""+e;const t=this._edges.get(e);if(!t)throw new j(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return Ad(this,e,t).key}mergeNode(e,t){if(t&&!pt(t))throw new H(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=""+e,t=t||{};let r=this._nodes.get(e);return r?(t&&(ot(r.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:r.attributes,data:t})),[e,!1]):(r=new this.NodeDataClass(e,t),this._nodes.set(e,r),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!="function")throw new H(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=""+e;let r=this._nodes.get(e);if(r){if(t){const o=r.attributes;r.attributes=t(o),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:r.attributes})}return[e,!1]}const i=t?t({}):{};return r=new this.NodeDataClass(e,i),this._nodes.set(e,r),this.emit("nodeAdded",{key:e,attributes:i}),[e,!0]}dropNode(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new j(`Graph.dropNode: could not find the "${e}" node in the graph.`);let r;if(this.type!=="undirected"){for(const i in t.out){r=t.out[i];do vr(this,r),r=r.next;while(r)}for(const i in t.in){r=t.in[i];do vr(this,r),r=r.next;while(r)}}if(this.type!=="directed")for(const i in t.undirected){r=t.undirected[i];do vr(this,r),r=r.next;while(r)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){const r=""+arguments[0],i=""+arguments[1];if(t=Gt(this,r,i,this.type),!t)throw new j(`Graph.dropEdge: could not find the "${r}" -> "${i}" edge in the graph.`)}else if(e=""+e,t=this._edges.get(e),!t)throw new j(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return vr(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new se("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new se("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");e=""+e,t=""+t;const r=Gt(this,e,t,"directed");if(!r)throw new j(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return vr(this,r),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new se("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new se("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const r=Gt(this,e,t,"undirected");if(!r)throw new j(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return vr(this,r),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const e=this._nodes.values();let t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!="function")throw new H("Graph.updateAttribute: updater should be a function.");const r=this._attributes[e];return this._attributes[e]=t(r),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!pt(e))throw new H("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(e){if(!pt(e))throw new H("Graph.mergeAttributes: provided attributes are not a plain object.");return ot(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!="function")throw new H("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!="function")throw new H("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!Lo(t))throw new H("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const r=this._nodes.values();let i,o;for(;i=r.next(),i.done!==!0;)o=i.value,o.attributes=e(o.key,o.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!="function")throw new H("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!Lo(t))throw new H("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const r=this._edges.values();let i,o,s,a;for(;i=r.next(),i.done!==!0;)o=i.value,s=o.source,a=o.target,o.attributes=e(o.key,o.attributes,s.key,a.key,s.attributes,a.attributes,o.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!="function")throw new H("Graph.forEachAdjacencyEntry: expecting a callback.");fn(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new H("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");fn(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!="function")throw new H("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");fn(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new H("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");fn(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!="function")throw new H("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let r,i;for(;r=t.next(),r.done!==!0;)i=r.value,e(i.key,i.attributes)}findNode(e){if(typeof e!="function")throw new H("Graph.findNode: expecting a callback.");const t=this._nodes.values();let r,i;for(;r=t.next(),r.done!==!0;)if(i=r.value,e(i.key,i.attributes))return i.key}mapNodes(e){if(typeof e!="function")throw new H("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let r,i;const o=new Array(this.order);let s=0;for(;r=t.next(),r.done!==!0;)i=r.value,o[s++]=e(i.key,i.attributes);return o}someNode(e){if(typeof e!="function")throw new H("Graph.someNode: expecting a callback.");const t=this._nodes.values();let r,i;for(;r=t.next(),r.done!==!0;)if(i=r.value,e(i.key,i.attributes))return!0;return!1}everyNode(e){if(typeof e!="function")throw new H("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let r,i;for(;r=t.next(),r.done!==!0;)if(i=r.value,!e(i.key,i.attributes))return!1;return!0}filterNodes(e){if(typeof e!="function")throw new H("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let r,i;const o=[];for(;r=t.next(),r.done!==!0;)i=r.value,e(i.key,i.attributes)&&o.push(i.key);return o}reduceNodes(e,t){if(typeof e!="function")throw new H("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new H("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let r=t;const i=this._nodes.values();let o,s;for(;o=i.next(),o.done!==!0;)s=o.value,r=e(r,s.key,s.attributes);return r}nodeEntries(){const e=this._nodes.values();return{[Symbol.iterator](){return this},next(){const t=e.next();if(t.done)return t;const r=t.value;return{value:{node:r.key,attributes:r.attributes},done:!1}}}}export(){const e=new Array(this._nodes.size);let t=0;this._nodes.forEach((i,o)=>{e[t++]=bd(o,i)});const r=new Array(this._edges.size);return t=0,this._edges.forEach((i,o)=>{r[t++]=wd(this.type,o,i)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:r}}import(e,t=!1){if(e instanceof Fe)return e.forEachNode((c,l)=>{t?this.mergeNode(c,l):this.addNode(c,l)}),e.forEachEdge((c,l,d,f,h,g,y)=>{t?y?this.mergeUndirectedEdgeWithKey(c,d,f,l):this.mergeDirectedEdgeWithKey(c,d,f,l):y?this.addUndirectedEdgeWithKey(c,d,f,l):this.addDirectedEdgeWithKey(c,d,f,l)}),this;if(!pt(e))throw new H("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!pt(e.attributes))throw new H("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let r,i,o,s,a;if(e.nodes){if(o=e.nodes,!Array.isArray(o))throw new H("Graph.import: invalid nodes. Expecting an array.");for(r=0,i=o.length;r<i;r++){s=o[r],_d(s);const{key:c,attributes:l}=s;t?this.mergeNode(c,l):this.addNode(c,l)}}if(e.edges){let c=!1;if(this.type==="undirected"&&(c=!0),o=e.edges,!Array.isArray(o))throw new H("Graph.import: invalid edges. Expecting an array.");for(r=0,i=o.length;r<i;r++){a=o[r],xd(a);const{source:l,target:d,attributes:f,undirected:h=c}=a;let g;"key"in a?(g=t?h?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:h?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,g.call(this,a.key,l,d,f)):(g=t?h?this.mergeUndirectedEdge:this.mergeDirectedEdge:h?this.addUndirectedEdge:this.addDirectedEdge,g.call(this,l,d,f))}}return this}nullCopy(e){const t=new Fe(ot({},this._options,e));return t.replaceAttributes(ot({},this.getAttributes())),t}emptyCopy(e){const t=this.nullCopy(e);return this._nodes.forEach((r,i)=>{const o=ot({},r.attributes);r=new t.NodeDataClass(i,o),t._nodes.set(i,r)}),t}copy(e){if(e=e||{},typeof e.type=="string"&&e.type!==this.type&&e.type!=="mixed")throw new se(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi=="boolean"&&e.multi!==this.multi&&e.multi!==!0)throw new se("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof e.allowSelfLoops=="boolean"&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new se("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(e),r=this._edges.values();let i,o;for(;i=r.next(),i.done!==!0;)o=i.value,Us(t,"copy",!1,o.undirected,o.key,o.source.key,o.target.key,ot({},o.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const e={};this._nodes.forEach((o,s)=>{e[s]=o.attributes});const t={},r={};this._edges.forEach((o,s)=>{const a=o.undirected?"--":"->";let c="",l=o.source.key,d=o.target.key,f;o.undirected&&l>d&&(f=l,l=d,d=f);const h=`(${l})${a}(${d})`;s.startsWith("geid_")?this.multi&&(typeof r[h]>"u"?r[h]=0:r[h]++,c+=`${r[h]}. `):c+=`[${s}]: `,c+=h,t[c]=o.attributes});const i={};for(const o in this)this.hasOwnProperty(o)&&!Do.has(o)&&typeof this[o]!="function"&&typeof o!="symbol"&&(i[o]=this[o]);return i.attributes=this._attributes,i.nodes=e,i.edges=t,Dt(i,"constructor",this.constructor),i}}typeof Symbol<"u"&&(Fe.prototype[Symbol.for("nodejs.util.inspect.custom")]=Fe.prototype.inspect);Sd.forEach(n=>{["add","merge","update"].forEach(e=>{const t=n.name(e),r=e==="add"?Us:Cd;n.generateKey?Fe.prototype[t]=function(i,o,s){return r(this,t,!0,(n.type||this.type)==="undirected",null,i,o,s,e==="update")}:Fe.prototype[t]=function(i,o,s,a){return r(this,t,!1,(n.type||this.type)==="undirected",i,o,s,a,e==="update")}})});Ul(Fe);Vl(Fe);ld(Fe);md(Fe);class Ps extends Fe{constructor(e){const t=ot({type:"directed"},e);if("multi"in t&&t.multi!==!1)throw new H("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new H('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class zs extends Fe{constructor(e){const t=ot({type:"undirected"},e);if("multi"in t&&t.multi!==!1)throw new H("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new H('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Ms extends Fe{constructor(e){const t=ot({multi:!0},e);if("multi"in t&&t.multi!==!0)throw new H("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class Ws extends Fe{constructor(e){const t=ot({type:"directed",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new H("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new H('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class js extends Fe{constructor(e){const t=ot({type:"undirected",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new H("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new H('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Ar(n){n.from=function(e,t){const r=ot({},e.options,t),i=new n(r);return i.import(e),i}}Ar(Fe);Ar(Ps);Ar(zs);Ar(Ms);Ar(Ws);Ar(js);Fe.Graph=Fe;Fe.DirectedGraph=Ps;Fe.UndirectedGraph=zs;Fe.MultiGraph=Ms;Fe.MultiDirectedGraph=Ws;Fe.MultiUndirectedGraph=js;Fe.InvalidArgumentsGraphError=H;Fe.NotFoundGraphError=j;Fe.UsageGraphError=se;var Zn,Io;function $i(){if(Io)return Zn;Io=1;function n(t){return!t||typeof t!="object"||typeof t=="function"||Array.isArray(t)||t instanceof Set||t instanceof Map||t instanceof RegExp||t instanceof Date}function e(t,r){t=t||{};var i={};for(var o in r){var s=t[o],a=r[o];if(!n(a)){i[o]=e(s,a);continue}s===void 0?i[o]=a:i[o]=s}return i}return Zn=e,Zn}var Qn,To;function En(){return To||(To=1,Qn=function(e){return e!==null&&typeof e=="object"&&typeof e.addUndirectedEdgeWithKey=="function"&&typeof e.dropNode=="function"&&typeof e.multi=="boolean"}),Qn}var ei,Ro;function Bs(){if(Ro)return ei;Ro=1;var n=En();return ei=function(t){if(!n(t))throw new Error("graphology-utils/infer-type: expecting a valid graphology instance.");var r=t.type;return r!=="mixed"?r:t.directedSize===0&&t.undirectedSize===0||t.directedSize>0&&t.undirectedSize>0?"mixed":t.directedSize>0?"directed":"undirected"},ei}var ti,Oo;function Fs(){if(Oo)return ti;Oo=1;function n(e){if(typeof e!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=e}return typeof Symbol<"u"&&(n.prototype[Symbol.iterator]=function(){return this}),n.of=function(){var e=arguments,t=e.length,r=0;return new n(function(){return r>=t?{done:!0}:{done:!1,value:e[r++]}})},n.empty=function(){var e=new n(function(){return{done:!0}});return e},n.fromSequence=function(e){var t=0,r=e.length;return new n(function(){return t>=r?{done:!0}:{done:!1,value:e[t++]}})},n.is=function(e){return e instanceof n?!0:typeof e=="object"&&e!==null&&typeof e.next=="function"},ti=n,ti}var ri={},No;function Ai(){return No||(No=1,(function(n){var e=Math.pow(2,8)-1,t=Math.pow(2,16)-1,r=Math.pow(2,32)-1,i=Math.pow(2,7)-1,o=Math.pow(2,15)-1,s=Math.pow(2,31)-1;n.getPointerArray=function(c){var l=c-1;if(l<=e)return Uint8Array;if(l<=t)return Uint16Array;if(l<=r)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")},n.getSignedPointerArray=function(c){var l=c-1;return l<=i?Int8Array:l<=o?Int16Array:l<=s?Int32Array:Float64Array},n.getNumberType=function(c){return c===(c|0)?Math.sign(c)===-1?c<=127&&c>=-128?Int8Array:c<=32767&&c>=-32768?Int16Array:Int32Array:c<=255?Uint8Array:c<=65535?Uint16Array:Uint32Array:Float64Array};var a={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};n.getMinimalRepresentation=function(c,l){var d=null,f=0,h,g,y,E,b;for(E=0,b=c.length;E<b;E++)y=l?l(c[E]):c[E],g=n.getNumberType(y),h=a[g.name],h>f&&(f=h,d=g);return d},n.isTypedArray=function(c){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(c)},n.concat=function(){var c=0,l,d,f;for(l=0,f=arguments.length;l<f;l++)c+=arguments[l].length;var h=new arguments[0].constructor(c);for(l=0,d=0;l<f;l++)h.set(arguments[l],d),d+=arguments[l].length;return h},n.indices=function(c){for(var l=n.getPointerArray(c),d=new l(c),f=0;f<c;f++)d[f]=f;return d}})(ri)),ri}var ni,Uo;function Ci(){if(Uo)return ni;Uo=1;var n=Fs(),e=Ai().getPointerArray;function t(r,i){arguments.length<2&&(i=r,r=Array);var o=e(i);this.size=0,this.length=i,this.dense=new o(i),this.sparse=new o(i),this.vals=new r(i)}return t.prototype.clear=function(){this.size=0},t.prototype.has=function(r){var i=this.sparse[r];return i<this.size&&this.dense[i]===r},t.prototype.get=function(r){var i=this.sparse[r];if(i<this.size&&this.dense[i]===r)return this.vals[i]},t.prototype.set=function(r,i){var o=this.sparse[r];return o<this.size&&this.dense[o]===r?(this.vals[o]=i,this):(this.dense[this.size]=r,this.sparse[r]=this.size,this.vals[this.size]=i,this.size++,this)},t.prototype.delete=function(r){var i=this.sparse[r];return i>=this.size||this.dense[i]!==r?!1:(i=this.dense[this.size-1],this.dense[this.sparse[r]]=i,this.sparse[i]=this.sparse[r],this.size--,!0)},t.prototype.forEach=function(r,i){i=arguments.length>1?i:this;for(var o=0;o<this.size;o++)r.call(i,this.vals[o],this.dense[o])},t.prototype.keys=function(){var r=this.size,i=this.dense,o=0;return new n(function(){if(o<r){var s=i[o];return o++,{value:s}}return{done:!0}})},t.prototype.values=function(){var r=this.size,i=this.vals,o=0;return new n(function(){if(o<r){var s=i[o];return o++,{value:s}}return{done:!0}})},t.prototype.entries=function(){var r=this.size,i=this.dense,o=this.vals,s=0;return new n(function(){if(s<r){var a=[i[s],o[s]];return s++,{value:a}}return{done:!0}})},typeof Symbol<"u"&&(t.prototype[Symbol.iterator]=t.prototype.entries),t.prototype.inspect=function(){for(var r=new Map,i=0;i<this.size;i++)r.set(this.dense[i],this.vals[i]);return Object.defineProperty(r,"constructor",{value:t,enumerable:!1}),r.length=this.length,this.vals.constructor!==Array&&(r.type=this.vals.constructor.name),r},typeof Symbol<"u"&&(t.prototype[Symbol.for("nodejs.util.inspect.custom")]=t.prototype.inspect),ni=t,ni}var ii,Po;function Ks(){if(Po)return ii;Po=1;var n=Fs(),e=Ai().getPointerArray;function t(r){var i=e(r);this.start=0,this.size=0,this.capacity=r,this.dense=new i(r),this.sparse=new i(r)}return t.prototype.clear=function(){this.start=0,this.size=0},t.prototype.has=function(r){if(this.size===0)return!1;var i=this.sparse[r],o=i<this.capacity&&i>=this.start&&i<this.start+this.size||i<(this.start+this.size)%this.capacity;return o&&this.dense[i]===r},t.prototype.enqueue=function(r){var i=this.sparse[r];if(this.size!==0){var o=i<this.capacity&&i>=this.start&&i<this.start+this.size||i<(this.start+this.size)%this.capacity;if(o&&this.dense[i]===r)return this}return i=(this.start+this.size)%this.capacity,this.dense[i]=r,this.sparse[r]=i,this.size++,this},t.prototype.dequeue=function(){if(this.size!==0){var r=this.start;this.size--,this.start++,this.start===this.capacity&&(this.start=0);var i=this.dense[r];return this.sparse[i]=this.capacity,i}},t.prototype.forEach=function(r,i){i=arguments.length>1?i:this;for(var o=this.capacity,s=this.size,a=this.start,c=0;c<s;)r.call(i,this.dense[a],c,this),a++,c++,a===o&&(a=0)},t.prototype.values=function(){var r=this.dense,i=this.capacity,o=this.size,s=this.start,a=0;return new n(function(){if(a>=o)return{done:!0};var c=r[s];return s++,a++,s===i&&(s=0),{value:c,done:!1}})},typeof Symbol<"u"&&(t.prototype[Symbol.iterator]=t.prototype.values),t.prototype.inspect=function(){var r=[];return this.forEach(function(i){r.push(i)}),Object.defineProperty(r,"constructor",{value:t,enumerable:!1}),r.capacity=this.capacity,r},typeof Symbol<"u"&&(t.prototype[Symbol.for("nodejs.util.inspect.custom")]=t.prototype.inspect),ii=t,ii}var oi,zo;function Hs(){if(zo)return oi;zo=1;function n(t){return function(r){return typeof r!="number"&&(r=r.length),Math.floor(t()*r)}}var e=n(Math.random);return e.createRandomIndex=n,oi=e,oi}var hn={},si,Mo;function Ld(){if(Mo)return si;Mo=1;function n(t){return function(r,i){return r+Math.floor(t()*(i-r+1))}}var e=n(Math.random);return e.createRandom=n,si=e,si}var Wo;function Dd(){if(Wo)return hn;Wo=1;var n=Ci(),e=Ld().createRandom;function t(i,o,s){var a=i.get(o);typeof a>"u"&&(a=0),a+=s,i.set(o,a)}function r(i,o){o=o||{};var s=o.rng||Math.random,a="randomness"in o?o.randomness:.01;this.index=i,this.random=e(s),this.randomness=a,this.rng=s;var c=i.counts.constructor,l=i.weights.constructor,d=i.C;this.resolution=i.resolution,this.B=i.C,this.C=0,this.communitiesOffsets=new c(d),this.nodesSortedByCommunities=new c(d),this.communitiesBounds=new c(d+1),this.communityWeights=new l(d),this.degrees=new l(d),this.nonSingleton=new Uint8Array(d),this.externalEdgeWeightPerCommunity=new l(d),this.belongings=new c(d),this.neighboringCommunities=new n(l,d),this.cumulativeIncrement=new Float64Array(d),this.macroCommunities=null}return r.prototype.groupByCommunities=function(){var i=this.index,o,s,a,c,l;for(o=0,l=0,s=0;s<i.C;s++)a=i.counts[s],a!==0&&(this.communitiesBounds[l++]=o,o+=a,this.communitiesOffsets[s]=o);for(this.communitiesBounds[l]=o,l=0,s=0;s<i.C;s++)c=i.belongings[s],l=--this.communitiesOffsets[c],this.nodesSortedByCommunities[l]=s;this.B=i.C-i.U,this.C=i.C},r.prototype.communities=function(){var i=new Array(this.B),o,s,a,c,l;for(o=0;o<this.B;o++){for(c=this.communitiesBounds[o],l=this.communitiesBounds[o+1],a=[],s=c;s<l;s++)a.push(s);i[o]=a}return i},r.prototype.mergeNodesSubset=function(i,o){var s=this.index,a=s.belongings[this.nodesSortedByCommunities[i]],c=this.neighboringCommunities,l=0,d,f,h,g,y,E;for(f=i;f<o;f++)for(d=this.nodesSortedByCommunities[f],this.belongings[d]=d,this.nonSingleton[d]=0,this.degrees[d]=0,l+=s.loops[d]/2,this.communityWeights[d]=s.loops[d],this.externalEdgeWeightPerCommunity[d]=0,g=s.starts[d],y=s.starts[d+1];g<y;g++)E=s.neighborhood[g],h=s.weights[g],this.degrees[d]+=h,s.belongings[E]===a&&(l+=h,this.externalEdgeWeightPerCommunity[d]+=h,this.communityWeights[d]+=h);var b=this.externalEdgeWeightPerCommunity.slice(),v,A,_,p=o-i,k,$,S,G,C,T,q,N,m,Le,Te,O,x;for(A=this.random(i,o-1),v=i;v<o;v++,A++)if(f=i+A%p,d=this.nodesSortedByCommunities[f],this.nonSingleton[d]!==1&&!(this.externalEdgeWeightPerCommunity[d]<this.communityWeights[d]*(l/2-this.communityWeights[d])*this.resolution)){for(this.communityWeights[d]=0,this.externalEdgeWeightPerCommunity[d]=0,c.clear(),c.set(d,0),k=0,g=s.starts[d],y=s.starts[d+1];g<y;g++)E=s.neighborhood[g],s.belongings[E]===a&&(h=s.weights[g],k+=h,t(c,this.belongings[E],h));for($=d,G=0,C=0,_=0;_<c.size;_++)T=c.dense[_],q=c.vals[_],N=this.communityWeights[T],this.externalEdgeWeightPerCommunity[T]>=N*(l/2-N)*this.resolution&&(S=q-(k+s.loops[d])*N*this.resolution/l,S>G&&($=T,G=S),S>=0&&(C+=Math.exp(S/this.randomness))),this.cumulativeIncrement[_]=C;if(C<Number.MAX_VALUE&&C<1/0){for(m=C*this.rng(),Le=-1,Te=c.size+1;Le<Te-1;)O=Le+Te>>>1,this.cumulativeIncrement[O]>=m?Te=O:Le=O;x=c.dense[Te]}else x=$;for(this.communityWeights[x]+=k+s.loops[d],g=s.starts[d],y=s.starts[d+1];g<y;g++)E=s.neighborhood[g],s.belongings[E]===a&&(T=this.belongings[E],T===x?this.externalEdgeWeightPerCommunity[x]-=b[E]:this.externalEdgeWeightPerCommunity[x]+=b[E]);x!==d&&(this.belongings[d]=x,this.nonSingleton[x]=1,this.C--)}var K=this.neighboringCommunities;for(K.clear(),f=i;f<o;f++)d=this.nodesSortedByCommunities[f],K.set(this.belongings[d],1);return K.dense.slice(0,K.size)},r.prototype.refinePartition=function(){this.groupByCommunities(),this.macroCommunities=new Array(this.B);var i,o,s,a,c=this.communitiesBounds;for(i=0;i<this.B;i++)o=c[i],s=c[i+1],a=this.mergeNodesSubset(o,s),this.macroCommunities[i]=a},r.prototype.split=function(){var i=this.index,o=this.neighboringCommunities;o.clear();var s,a,c;for(s=0;s<i.C;s++)a=this.belongings[s],s===a&&(c=i.isolate(s,this.degrees[s]),o.set(a,c));for(s=0;s<i.C;s++)a=this.belongings[s],s!==a&&(c=o.get(a),i.move(s,this.degrees[s],c));var l,d;for(s=0;s<this.macroCommunities.length;s++)for(d=this.macroCommunities[s],l=0;l<d.length;l++)d[l]=o.get(d[l])},r.prototype.zoomOut=function(){var i=this.index;this.refinePartition(),this.split();var o=i.zoomOut(),s,a,c,l,d;for(l=0;l<this.macroCommunities.length;l++)for(s=this.macroCommunities[l],a=o[s[0]],d=1;d<s.length;d++)c=o[s[d]],i.expensiveMove(c,a)},r.prototype.onlySingletons=function(){var i=this.index,o;for(o=0;o<i.C;o++)if(i.counts[o]>1)return!1;return!0},hn.addWeightToCommunity=t,hn.UndirectedLeidenAddenda=r,hn}var pn={},Ur={},jo;function qs(){if(jo)return Ur;jo=1;function n(r){return typeof r!="number"||isNaN(r)?1:r}function e(r,i){var o={},s=function(l){return typeof l>"u"?i:l};typeof i=="function"&&(s=i);var a=function(l){return s(l[r])},c=function(){return s(void 0)};return typeof r=="string"?(o.fromAttributes=a,o.fromGraph=function(l,d){return a(l.getNodeAttributes(d))},o.fromEntry=function(l,d){return a(d)}):typeof r=="function"?(o.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},o.fromGraph=function(l,d){return s(r(d,l.getNodeAttributes(d)))},o.fromEntry=function(l,d){return s(r(l,d))}):(o.fromAttributes=c,o.fromGraph=c,o.fromEntry=c),o}function t(r,i){var o={},s=function(l){return typeof l>"u"?i:l};typeof i=="function"&&(s=i);var a=function(l){return s(l[r])},c=function(){return s(void 0)};return typeof r=="string"?(o.fromAttributes=a,o.fromGraph=function(l,d){return a(l.getEdgeAttributes(d))},o.fromEntry=function(l,d){return a(d)},o.fromPartialEntry=o.fromEntry,o.fromMinimalEntry=o.fromEntry):typeof r=="function"?(o.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},o.fromGraph=function(l,d){var f=l.extremities(d);return s(r(d,l.getEdgeAttributes(d),f[0],f[1],l.getNodeAttributes(f[0]),l.getNodeAttributes(f[1]),l.isUndirected(d)))},o.fromEntry=function(l,d,f,h,g,y,E){return s(r(l,d,f,h,g,y,E))},o.fromPartialEntry=function(l,d,f,h){return s(r(l,d,f,h))},o.fromMinimalEntry=function(l,d){return s(r(l,d))}):(o.fromAttributes=c,o.fromGraph=c,o.fromEntry=c,o.fromMinimalEntry=c),o}return Ur.createNodeValueGetter=e,Ur.createEdgeValueGetter=t,Ur.createEdgeWeightGetter=function(r){return t(r,n)},Ur}var Bo;function Vs(){if(Bo)return pn;Bo=1;var n=Ai(),e=$i(),t=qs().createEdgeWeightGetter,r=Symbol.for("nodejs.util.inspect.custom"),i={getEdgeWeight:"weight",keepDendrogram:!1,resolution:1};function o(a,c){c=e(c,i);var l=c.resolution,d=t(c.getEdgeWeight).fromEntry,f=(a.size-a.selfLoopCount)*2,h=n.getPointerArray(f),g=n.getPointerArray(a.order+1),y=c.getEdgeWeight?Float64Array:n.getPointerArray(a.size*2);this.C=a.order,this.M=0,this.E=f,this.U=0,this.resolution=l,this.level=0,this.graph=a,this.nodes=new Array(a.order),this.keepDendrogram=c.keepDendrogram,this.neighborhood=new g(f),this.weights=new y(f),this.loops=new y(a.order),this.starts=new h(a.order+1),this.belongings=new g(a.order),this.dendrogram=[],this.mapping=null,this.counts=new g(a.order),this.unused=new g(a.order),this.totalWeights=new y(a.order);var E={},b,v=0,A=0,_=this;a.forEachNode(function(p){_.nodes[v]=p,E[p]=v,A+=a.undirectedDegreeWithoutSelfLoops(p),_.starts[v]=A,_.belongings[v]=v,_.counts[v]=1,v++}),a.forEachEdge(function(p,k,$,S,G,C,T){if(b=d(p,k,$,S,G,C,T),$=E[$],S=E[S],_.M+=b,$===S)_.totalWeights[$]+=b*2,_.loops[$]=b*2;else{_.totalWeights[$]+=b,_.totalWeights[S]+=b;var q=--_.starts[$],N=--_.starts[S];_.neighborhood[q]=S,_.neighborhood[N]=$,_.weights[q]=b,_.weights[N]=b}}),this.starts[v]=this.E,this.keepDendrogram?this.dendrogram.push(this.belongings.slice()):this.mapping=this.belongings.slice()}o.prototype.isolate=function(a,c){var l=this.belongings[a];if(this.counts[l]===1)return l;var d=this.unused[--this.U],f=this.loops[a];return this.totalWeights[l]-=c+f,this.totalWeights[d]+=c+f,this.belongings[a]=d,this.counts[l]--,this.counts[d]++,d},o.prototype.move=function(a,c,l){var d=this.belongings[a],f=this.loops[a];this.totalWeights[d]-=c+f,this.totalWeights[l]+=c+f,this.belongings[a]=l;var h=this.counts[d]--===1;this.counts[l]++,h&&(this.unused[this.U++]=d)},o.prototype.computeNodeDegree=function(a){var c,l,d,f=0;for(c=this.starts[a],l=this.starts[a+1];c<l;c++)d=this.weights[c],f+=d;return f},o.prototype.expensiveIsolate=function(a){var c=this.computeNodeDegree(a);return this.isolate(a,c)},o.prototype.expensiveMove=function(a,c){var l=this.computeNodeDegree(a);this.move(a,l,c)},o.prototype.zoomOut=function(){var a=new Array(this.C-this.U),c={},l=this.nodes.length,d=0,f=0,h,g,y,E,b,v,A,_,p;for(h=0,y=this.C;h<y;h++)v=this.belongings[h],v in c||(c[v]=d,a[d]={adj:{},totalWeights:this.totalWeights[v],internalWeights:0},d++),this.belongings[h]=c[v];var k,$;if(this.keepDendrogram){for(k=this.dendrogram[this.level],$=new(n.getPointerArray(d))(l),h=0;h<l;h++)$[h]=this.belongings[k[h]];this.dendrogram.push($)}else for(h=0;h<l;h++)this.mapping[h]=this.belongings[this.mapping[h]];for(h=0,y=this.C;h<y;h++)for(v=this.belongings[h],_=a[v],p=_.adj,_.internalWeights+=this.loops[h],g=this.starts[h],E=this.starts[h+1];g<E;g++){if(b=this.neighborhood[g],A=this.belongings[b],v===A){_.internalWeights+=this.weights[g];continue}A in p||(p[A]=0),p[A]+=this.weights[g]}for(this.C=d,b=0,v=0;v<d;v++){_=a[v],p=_.adj,v=+v,this.totalWeights[v]=_.totalWeights,this.loops[v]=_.internalWeights,this.counts[v]=1,this.starts[v]=b,this.belongings[v]=v;for(A in p)this.neighborhood[b]=+A,this.weights[b]=p[A],f++,b++}return this.starts[d]=f,this.E=f,this.U=0,this.level++,c},o.prototype.modularity=function(){var a,c,l,d,f,h=0,g=this.M*2,y=new Float64Array(this.C);for(l=0;l<this.C;l++)for(a=this.belongings[l],y[a]+=this.loops[l],d=this.starts[l],f=this.starts[l+1];d<f;d++)c=this.belongings[this.neighborhood[d]],a===c&&(y[a]+=this.weights[d]);for(l=0;l<this.C;l++)h+=y[l]/g-Math.pow(this.totalWeights[l]/g,2)*this.resolution;return h},o.prototype.delta=function(a,c,l,d){var f=this.M,h=this.totalWeights[d];return c+=this.loops[a],l/f-h*c*this.resolution/(2*f*f)},o.prototype.deltaWithOwnCommunity=function(a,c,l,d){var f=this.M,h=this.totalWeights[d];return c+=this.loops[a],l/f-(h-c)*c*this.resolution/(2*f*f)},o.prototype.fastDelta=function(a,c,l,d){var f=this.M,h=this.totalWeights[d];return c+=this.loops[a],l-c*h*this.resolution/(2*f)},o.prototype.fastDeltaWithOwnCommunity=function(a,c,l,d){var f=this.M,h=this.totalWeights[d];return c+=this.loops[a],l-c*(h-c)*this.resolution/(2*f)},o.prototype.bounds=function(a){return[this.starts[a],this.starts[a+1]]},o.prototype.project=function(){var a=this,c={};return a.nodes.slice(0,this.C).forEach(function(l,d){c[l]=Array.from(a.neighborhood.slice(a.starts[d],a.starts[d+1])).map(function(f){return a.nodes[f]})}),c},o.prototype.collect=function(a){arguments.length<1&&(a=this.level);var c={},l=this.keepDendrogram?this.dendrogram[a]:this.mapping,d,f;for(d=0,f=l.length;d<f;d++)c[this.nodes[d]]=l[d];return c},o.prototype.assign=function(a,c){arguments.length<2&&(c=this.level);var l=this.keepDendrogram?this.dendrogram[c]:this.mapping,d,f;for(d=0,f=l.length;d<f;d++)this.graph.setNodeAttribute(this.nodes[d],a,l[d])},o.prototype[r]=function(){var a={};Object.defineProperty(a,"constructor",{value:o,enumerable:!1}),a.C=this.C,a.M=this.M,a.E=this.E,a.U=this.U,a.resolution=this.resolution,a.level=this.level,a.nodes=this.nodes,a.starts=this.starts.slice(0,a.C+1);var c=["neighborhood","weights"],l=["counts","loops","belongings","totalWeights"],d=this;return c.forEach(function(f){a[f]=d[f].slice(0,a.E)}),l.forEach(function(f){a[f]=d[f].slice(0,a.C)}),a.unused=this.unused.slice(0,this.U),this.keepDendrogram?a.dendrogram=this.dendrogram:a.mapping=this.mapping,a};function s(a,c){c=e(c,i);var l=c.resolution,d=t(c.getEdgeWeight).fromEntry,f=(a.size-a.selfLoopCount)*2,h=n.getPointerArray(f),g=n.getPointerArray(a.order+1),y=c.getEdgeWeight?Float64Array:n.getPointerArray(a.size*2);this.C=a.order,this.M=0,this.E=f,this.U=0,this.resolution=l,this.level=0,this.graph=a,this.nodes=new Array(a.order),this.keepDendrogram=c.keepDendrogram,this.neighborhood=new g(f),this.weights=new y(f),this.loops=new y(a.order),this.starts=new h(a.order+1),this.offsets=new h(a.order),this.belongings=new g(a.order),this.dendrogram=[],this.counts=new g(a.order),this.unused=new g(a.order),this.totalInWeights=new y(a.order),this.totalOutWeights=new y(a.order);var E={},b,v=0,A=0,_=this;a.forEachNode(function(p){_.nodes[v]=p,E[p]=v,A+=a.outDegreeWithoutSelfLoops(p),_.starts[v]=A,A+=a.inDegreeWithoutSelfLoops(p),_.offsets[v]=A,_.belongings[v]=v,_.counts[v]=1,v++}),a.forEachEdge(function(p,k,$,S,G,C,T){if(b=d(p,k,$,S,G,C,T),$=E[$],S=E[S],_.M+=b,$===S)_.loops[$]+=b,_.totalInWeights[$]+=b,_.totalOutWeights[$]+=b;else{_.totalOutWeights[$]+=b,_.totalInWeights[S]+=b;var q=--_.starts[$],N=--_.offsets[S];_.neighborhood[q]=S,_.neighborhood[N]=$,_.weights[q]=b,_.weights[N]=b}}),this.starts[v]=this.E,this.keepDendrogram?this.dendrogram.push(this.belongings.slice()):this.mapping=this.belongings.slice()}return s.prototype.bounds=o.prototype.bounds,s.prototype.inBounds=function(a){return[this.offsets[a],this.starts[a+1]]},s.prototype.outBounds=function(a){return[this.starts[a],this.offsets[a]]},s.prototype.project=o.prototype.project,s.prototype.projectIn=function(){var a=this,c={};return a.nodes.slice(0,this.C).forEach(function(l,d){c[l]=Array.from(a.neighborhood.slice(a.offsets[d],a.starts[d+1])).map(function(f){return a.nodes[f]})}),c},s.prototype.projectOut=function(){var a=this,c={};return a.nodes.slice(0,this.C).forEach(function(l,d){c[l]=Array.from(a.neighborhood.slice(a.starts[d],a.offsets[d])).map(function(f){return a.nodes[f]})}),c},s.prototype.isolate=function(a,c,l){var d=this.belongings[a];if(this.counts[d]===1)return d;var f=this.unused[--this.U],h=this.loops[a];return this.totalInWeights[d]-=c+h,this.totalInWeights[f]+=c+h,this.totalOutWeights[d]-=l+h,this.totalOutWeights[f]+=l+h,this.belongings[a]=f,this.counts[d]--,this.counts[f]++,f},s.prototype.move=function(a,c,l,d){var f=this.belongings[a],h=this.loops[a];this.totalInWeights[f]-=c+h,this.totalInWeights[d]+=c+h,this.totalOutWeights[f]-=l+h,this.totalOutWeights[d]+=l+h,this.belongings[a]=d;var g=this.counts[f]--===1;this.counts[d]++,g&&(this.unused[this.U++]=f)},s.prototype.computeNodeInDegree=function(a){var c,l,d,f=0;for(c=this.offsets[a],l=this.starts[a+1];c<l;c++)d=this.weights[c],f+=d;return f},s.prototype.computeNodeOutDegree=function(a){var c,l,d,f=0;for(c=this.starts[a],l=this.offsets[a];c<l;c++)d=this.weights[c],f+=d;return f},s.prototype.expensiveMove=function(a,c){var l=this.computeNodeInDegree(a),d=this.computeNodeOutDegree(a);this.move(a,l,d,c)},s.prototype.zoomOut=function(){var a=new Array(this.C-this.U),c={},l=this.nodes.length,d=0,f=0,h,g,y,E,b,v,A,_,p,k,$,S,G;for(h=0,y=this.C;h<y;h++)v=this.belongings[h],v in c||(c[v]=d,a[d]={inAdj:{},outAdj:{},totalInWeights:this.totalInWeights[v],totalOutWeights:this.totalOutWeights[v],internalWeights:0},d++),this.belongings[h]=c[v];var C,T;if(this.keepDendrogram){for(C=this.dendrogram[this.level],T=new(n.getPointerArray(d))(l),h=0;h<l;h++)T[h]=this.belongings[C[h]];this.dendrogram.push(T)}else for(h=0;h<l;h++)this.mapping[h]=this.belongings[this.mapping[h]];for(h=0,y=this.C;h<y;h++)for(v=this.belongings[h],p=this.offsets[h],_=a[v],S=_.inAdj,G=_.outAdj,_.internalWeights+=this.loops[h],g=this.starts[h],E=this.starts[h+1];g<E;g++){if(b=this.neighborhood[g],A=this.belongings[b],k=g<p,$=k?G:S,v===A){k&&(_.internalWeights+=this.weights[g]);continue}A in $||($[A]=0),$[A]+=this.weights[g]}for(this.C=d,b=0,v=0;v<d;v++){_=a[v],S=_.inAdj,G=_.outAdj,v=+v,this.totalInWeights[v]=_.totalInWeights,this.totalOutWeights[v]=_.totalOutWeights,this.loops[v]=_.internalWeights,this.counts[v]=1,this.starts[v]=b,this.belongings[v]=v;for(A in G)this.neighborhood[b]=+A,this.weights[b]=G[A],f++,b++;this.offsets[v]=b;for(A in S)this.neighborhood[b]=+A,this.weights[b]=S[A],f++,b++}return this.starts[d]=f,this.E=f,this.U=0,this.level++,c},s.prototype.modularity=function(){var a,c,l,d,f,h=0,g=this.M,y=new Float64Array(this.C);for(l=0;l<this.C;l++)for(a=this.belongings[l],y[a]+=this.loops[l],d=this.starts[l],f=this.offsets[l];d<f;d++)c=this.belongings[this.neighborhood[d]],a===c&&(y[a]+=this.weights[d]);for(l=0;l<this.C;l++)h+=y[l]/g-this.totalInWeights[l]*this.totalOutWeights[l]/Math.pow(g,2)*this.resolution;return h},s.prototype.delta=function(a,c,l,d,f){var h=this.M,g=this.totalInWeights[f],y=this.totalOutWeights[f],E=this.loops[a];return c+=E,l+=E,d/h-(l*g+c*y)*this.resolution/(h*h)},s.prototype.deltaWithOwnCommunity=function(a,c,l,d,f){var h=this.M,g=this.totalInWeights[f],y=this.totalOutWeights[f],E=this.loops[a];return c+=E,l+=E,d/h-(l*(g-c)+c*(y-l))*this.resolution/(h*h)},s.prototype.collect=o.prototype.collect,s.prototype.assign=o.prototype.assign,s.prototype[r]=function(){var a={};Object.defineProperty(a,"constructor",{value:s,enumerable:!1}),a.C=this.C,a.M=this.M,a.E=this.E,a.U=this.U,a.resolution=this.resolution,a.level=this.level,a.nodes=this.nodes,a.starts=this.starts.slice(0,a.C+1);var c=["neighborhood","weights"],l=["counts","offsets","loops","belongings","totalInWeights","totalOutWeights"],d=this;return c.forEach(function(f){a[f]=d[f].slice(0,a.E)}),l.forEach(function(f){a[f]=d[f].slice(0,a.C)}),a.unused=this.unused.slice(0,this.U),this.keepDendrogram?a.dendrogram=this.dendrogram:a.mapping=this.mapping,a},pn.UndirectedLouvainIndex=o,pn.DirectedLouvainIndex=s,pn}var ai,Fo;function Gd(){if(Fo)return ai;Fo=1;var n=$i(),e=En(),t=Bs(),r=Ci(),i=Ks(),o=Hs().createRandomIndex,s=Dd(),a=Vs(),c=s.addWeightToCommunity,l=a.UndirectedLouvainIndex,d=s.UndirectedLeidenAddenda,f={attributes:{community:"community",weight:"weight"},randomness:.01,randomWalk:!0,resolution:1,rng:Math.random,weighted:!1,maxIterations:0},h=1e-10;function g(v,A,_,p,k){return Math.abs(p-k)<h?v===A?!1:_>v:p>k}function y(v,A,_){for(var p=new l(A,{attributes:{weight:_.attributes.weight},keepDendrogram:v,resolution:_.resolution,weighted:_.weighted}),k=new d(p,{randomness:_.randomness,rng:_.rng}),$=o(_.rng),S,G,C=new r(Float64Array,p.C),T=new i(p.C),q,N,m,Le,Te,O,x,K,ee,ne,Ie,ce,W,_e,Ke,Be=0,Ye=0,ut=[],Xe,ge=0;!(_.maxIterations>0&&ge>=_.maxIterations);){for(ge++,ee=p.C,Xe=0,Te=_.randomWalk?$(ee):0,O=0;O<ee;O++,Te++)x=Te%ee,T.enqueue(x);for(;T.size!==0;){for(x=T.dequeue(),Ye++,ne=0,C.clear(),S=p.belongings[x],q=p.starts[x],N=p.starts[x+1];q<N;q++)K=p.neighborhood[q],m=p.weights[q],G=p.belongings[K],ne+=m,c(C,G,m);W=p.fastDeltaWithOwnCommunity(x,ne,C.get(S)||0,S),ce=S;var V=[[S,W,"own",p.counts[S]===1]];for(Le=0;Le<C.size;Le++)G=C.dense[Le],G!==S&&(Ie=C.vals[Le],Be++,Ke=p.fastDelta(x,ne,Ie,G),V.push([G,Ke,"other"]),_e=g(ce,S,G,Ke,W),_e&&(W=Ke,ce=G));if(W<0){if(ce=p.isolate(x,ne),ce===S)continue}else{if(ce===S)continue;p.move(x,ne,ce)}for(Xe++,q=p.starts[x],N=p.starts[x+1];q<N;q++)K=p.neighborhood[q],G=p.belongings[K],G!==ce&&T.enqueue(K)}if(ut.push(Xe),Xe===0){p.zoomOut();break}if(!k.onlySingletons()){k.zoomOut();continue}break}var ye={index:p,deltaComputations:Be,nodesVisited:Ye,moves:ut};return ye}function E(v,A,_,p){if(!e(_))throw new Error("graphology-communities-leiden: the given graph is not a valid graphology instance.");var k=t(_);if(k==="mixed")throw new Error("graphology-communities-leiden: cannot run the algorithm on a true mixed graph.");if(k==="directed")throw new Error("graphology-communities-leiden: not yet implemented for directed graphs.");p=n(p,f);var $=0;if(_.size===0){if(v){_.forEachNode(function(N){_.setNodeAttribute(N,p.attributes.communities,$++)});return}var S={};return _.forEachNode(function(N){S[N]=$++}),A?{communities:S,count:_.order,deltaComputations:0,dendrogram:null,level:0,modularity:NaN,moves:null,nodesVisited:0,resolution:p.resolution}:S}var G=y,C=G(A,_,p),T=C.index;if(!A){if(v){T.assign(p.attributes.community);return}return T.collect()}var q={count:T.C,deltaComputations:C.deltaComputations,dendrogram:T.dendrogram,level:T.level,modularity:T.modularity(),moves:C.moves,nodesVisited:C.nodesVisited,resolution:p.resolution};return v?(T.assign(p.attributes.community),q):(q.communities=T.collect(),q)}var b=E.bind(null,!1,!1);return b.assign=E.bind(null,!0,!1),b.detailed=E.bind(null,!1,!0),b.defaults=f,ai=b,ai}var Id=Gd();const Td=_i(Id);var ui,Ko;function Rd(){if(Ko)return ui;Ko=1;var n=$i(),e=En(),t=Bs(),r=Ci(),i=Ks(),o=Hs().createRandomIndex,s=Vs(),a=s.UndirectedLouvainIndex,c=s.DirectedLouvainIndex,l={nodeCommunityAttribute:"community",getEdgeWeight:"weight",fastLocalMoves:!0,randomWalk:!0,resolution:1,rng:Math.random};function d(v,A,_){var p=v.get(A);typeof p>"u"&&(p=0),p+=_,v.set(A,p)}var f=1e-10;function h(v,A,_,p,k){return Math.abs(p-k)<f?v===A?!1:_>v:p>k}function g(v,A,_){var p=new a(A,{getEdgeWeight:_.getEdgeWeight,keepDendrogram:v,resolution:_.resolution}),k=o(_.rng),$=!0,S=!0,G,C,T=new r(Float64Array,p.C),q,N,m,Le,Te,O,x,K,ee,ne,Ie,ce,W,_e,Ke,Be,Ye=0,ut=0,Xe=[],ge,V;for(_.fastLocalMoves&&(q=new i(p.C));$;){if(ne=p.C,$=!1,S=!0,_.fastLocalMoves){for(V=0,O=_.randomWalk?k(ne):0,x=0;x<ne;x++,O++)K=O%ne,q.enqueue(K);for(;q.size!==0;){for(K=q.dequeue(),ut++,Ie=0,T.clear(),G=p.belongings[K],N=p.starts[K],m=p.starts[K+1];N<m;N++)ee=p.neighborhood[N],Le=p.weights[N],C=p.belongings[ee],Ie+=Le,d(T,C,Le);for(_e=p.fastDeltaWithOwnCommunity(K,Ie,T.get(G)||0,G),W=G,Te=0;Te<T.size;Te++)C=T.dense[Te],C!==G&&(ce=T.vals[Te],Ye++,Be=p.fastDelta(K,Ie,ce,C),Ke=h(W,G,C,Be,_e),Ke&&(_e=Be,W=C));if(_e<0){if(W=p.isolate(K,Ie),W===G)continue}else{if(W===G)continue;p.move(K,Ie,W)}for($=!0,V++,N=p.starts[K],m=p.starts[K+1];N<m;N++)ee=p.neighborhood[N],C=p.belongings[ee],C!==W&&q.enqueue(ee)}Xe.push(V)}else for(ge=[],Xe.push(ge);S;){for(S=!1,V=0,O=_.randomWalk?k(ne):0,x=0;x<ne;x++,O++){for(K=O%ne,ut++,Ie=0,T.clear(),G=p.belongings[K],N=p.starts[K],m=p.starts[K+1];N<m;N++)ee=p.neighborhood[N],Le=p.weights[N],C=p.belongings[ee],Ie+=Le,d(T,C,Le);for(_e=p.fastDeltaWithOwnCommunity(K,Ie,T.get(G)||0,G),W=G,Te=0;Te<T.size;Te++)C=T.dense[Te],C!==G&&(ce=T.vals[Te],Ye++,Be=p.fastDelta(K,Ie,ce,C),Ke=h(W,G,C,Be,_e),Ke&&(_e=Be,W=C));if(_e<0){if(W=p.isolate(K,Ie),W===G)continue}else{if(W===G)continue;p.move(K,Ie,W)}S=!0,V++}ge.push(V),$=S||$}$&&p.zoomOut()}var ye={index:p,deltaComputations:Ye,nodesVisited:ut,moves:Xe};return ye}function y(v,A,_){var p=new c(A,{getEdgeWeight:_.getEdgeWeight,keepDendrogram:v,resolution:_.resolution}),k=o(_.rng),$=!0,S=!0,G,C,T=new r(Float64Array,p.C),q,N,m,Le,Te,O,x,K,ee,ne,Ie,ce,W,_e,Ke,Be,Ye,ut,Xe,ge=0,V=0,ye=[],ct,Y;for(_.fastLocalMoves&&(q=new i(p.C));$;){if(ce=p.C,$=!1,S=!0,_.fastLocalMoves){for(Y=0,K=_.randomWalk?k(ce):0,ee=0;ee<ce;ee++,K++)ne=K%ce,q.enqueue(ne);for(;q.size!==0;){for(ne=q.dequeue(),V++,W=0,_e=0,T.clear(),G=p.belongings[ne],N=p.starts[ne],m=p.starts[ne+1],Le=p.offsets[ne];N<m;N++)Te=N<Le,Ie=p.neighborhood[N],O=p.weights[N],C=p.belongings[Ie],Te?_e+=O:W+=O,d(T,C,O);for(Ye=p.deltaWithOwnCommunity(ne,W,_e,T.get(G)||0,G),Be=G,x=0;x<T.size;x++)C=T.dense[x],C!==G&&(Ke=T.vals[x],ge++,Xe=p.delta(ne,W,_e,Ke,C),ut=h(Be,G,C,Xe,Ye),ut&&(Ye=Xe,Be=C));if(Ye<0){if(Be=p.isolate(ne,W,_e),Be===G)continue}else{if(Be===G)continue;p.move(ne,W,_e,Be)}for($=!0,Y++,N=p.starts[ne],m=p.starts[ne+1];N<m;N++)Ie=p.neighborhood[N],C=p.belongings[Ie],C!==Be&&q.enqueue(Ie)}ye.push(Y)}else for(ct=[],ye.push(ct);S;){for(S=!1,Y=0,K=_.randomWalk?k(ce):0,ee=0;ee<ce;ee++,K++){for(ne=K%ce,V++,W=0,_e=0,T.clear(),G=p.belongings[ne],N=p.starts[ne],m=p.starts[ne+1],Le=p.offsets[ne];N<m;N++)Te=N<Le,Ie=p.neighborhood[N],O=p.weights[N],C=p.belongings[Ie],Te?_e+=O:W+=O,d(T,C,O);for(Ye=p.deltaWithOwnCommunity(ne,W,_e,T.get(G)||0,G),Be=G,x=0;x<T.size;x++)C=T.dense[x],C!==G&&(Ke=T.vals[x],ge++,Xe=p.delta(ne,W,_e,Ke,C),ut=h(Be,G,C,Xe,Ye),ut&&(Ye=Xe,Be=C));if(Ye<0){if(Be=p.isolate(ne,W,_e),Be===G)continue}else{if(Be===G)continue;p.move(ne,W,_e,Be)}S=!0,Y++}ct.push(Y),$=S||$}$&&p.zoomOut()}var Z={index:p,deltaComputations:ge,nodesVisited:V,moves:ye};return Z}function E(v,A,_,p){if(!e(_))throw new Error("graphology-communities-louvain: the given graph is not a valid graphology instance.");var k=t(_);if(k==="mixed")throw new Error("graphology-communities-louvain: cannot run the algorithm on a true mixed graph.");p=n(p,l);var $=0;if(_.size===0){if(v){_.forEachNode(function(N){_.setNodeAttribute(N,p.nodeCommunityAttribute,$++)});return}var S={};return _.forEachNode(function(N){S[N]=$++}),A?{communities:S,count:_.order,deltaComputations:0,dendrogram:null,level:0,modularity:NaN,moves:null,nodesVisited:0,resolution:p.resolution}:S}var G=k==="undirected"?g:y,C=G(A,_,p),T=C.index;if(!A){if(v){T.assign(p.nodeCommunityAttribute);return}return T.collect()}var q={count:T.C,deltaComputations:C.deltaComputations,dendrogram:T.dendrogram,level:T.level,modularity:T.modularity(),moves:C.moves,nodesVisited:C.nodesVisited,resolution:p.resolution};return v?(T.assign(p.nodeCommunityAttribute),q):(q.communities=T.collect(),q)}var b=E.bind(null,!1,!1);return b.assign=E.bind(null,!0,!1),b.detailed=E.bind(null,!1,!0),b.defaults=l,ui=b,ui}var Od=Rd();const Nd=_i(Od);var ci,Ho;function Ud(){if(Ho)return ci;Ho=1;var n=0,e=1,t=2,r=3,i=4,o=5,s=6,a=7,c=8,l=9,d=0,f=1,h=2,g=0,y=1,E=2,b=3,v=4,A=5,_=6,p=7,k=8,$=3,S=10,G=3,C=9,T=10;return ci=function(N,m,Le){var Te,O,x,K,ee,ne,Ie,ce,W,_e,Ke=m.length,Be=Le.length,Ye=N.adjustSizes,ut=N.barnesHutTheta*N.barnesHutTheta,Xe,ge,V,ye,ct,Y,Z,D=[];for(x=0;x<Ke;x+=S)m[x+i]=m[x+t],m[x+o]=m[x+r],m[x+t]=0,m[x+r]=0;if(N.outboundAttractionDistribution){for(Xe=0,x=0;x<Ke;x+=S)Xe+=m[x+s];Xe/=Ke/S}if(N.barnesHutOptimize){var St=1/0,Ct=-1/0,Lt=1/0,Mt=-1/0,Et,wt,Qe;for(x=0;x<Ke;x+=S)St=Math.min(St,m[x+n]),Ct=Math.max(Ct,m[x+n]),Lt=Math.min(Lt,m[x+e]),Mt=Math.max(Mt,m[x+e]);var It=Ct-St,Vt=Mt-Lt;for(It>Vt?(Lt-=(It-Vt)/2,Mt=Lt+It):(St-=(Vt-It)/2,Ct=St+Vt),D[0+g]=-1,D[0+y]=(St+Ct)/2,D[0+E]=(Lt+Mt)/2,D[0+b]=Math.max(Ct-St,Mt-Lt),D[0+v]=-1,D[0+A]=-1,D[0+_]=0,D[0+p]=0,D[0+k]=0,Te=1,x=0;x<Ke;x+=S)for(O=0,Qe=$;;)if(D[O+A]>=0){m[x+n]<D[O+y]?m[x+e]<D[O+E]?Et=D[O+A]:Et=D[O+A]+C:m[x+e]<D[O+E]?Et=D[O+A]+C*2:Et=D[O+A]+C*3,D[O+p]=(D[O+p]*D[O+_]+m[x+n]*m[x+s])/(D[O+_]+m[x+s]),D[O+k]=(D[O+k]*D[O+_]+m[x+e]*m[x+s])/(D[O+_]+m[x+s]),D[O+_]+=m[x+s],O=Et;continue}else if(D[O+g]<0){D[O+g]=x;break}else{if(D[O+A]=Te*C,ce=D[O+b]/2,W=D[O+A],D[W+g]=-1,D[W+y]=D[O+y]-ce,D[W+E]=D[O+E]-ce,D[W+b]=ce,D[W+v]=W+C,D[W+A]=-1,D[W+_]=0,D[W+p]=0,D[W+k]=0,W+=C,D[W+g]=-1,D[W+y]=D[O+y]-ce,D[W+E]=D[O+E]+ce,D[W+b]=ce,D[W+v]=W+C,D[W+A]=-1,D[W+_]=0,D[W+p]=0,D[W+k]=0,W+=C,D[W+g]=-1,D[W+y]=D[O+y]+ce,D[W+E]=D[O+E]-ce,D[W+b]=ce,D[W+v]=W+C,D[W+A]=-1,D[W+_]=0,D[W+p]=0,D[W+k]=0,W+=C,D[W+g]=-1,D[W+y]=D[O+y]+ce,D[W+E]=D[O+E]+ce,D[W+b]=ce,D[W+v]=D[O+v],D[W+A]=-1,D[W+_]=0,D[W+p]=0,D[W+k]=0,Te+=4,m[D[O+g]+n]<D[O+y]?m[D[O+g]+e]<D[O+E]?Et=D[O+A]:Et=D[O+A]+C:m[D[O+g]+e]<D[O+E]?Et=D[O+A]+C*2:Et=D[O+A]+C*3,D[O+_]=m[D[O+g]+s],D[O+p]=m[D[O+g]+n],D[O+k]=m[D[O+g]+e],D[Et+g]=D[O+g],D[O+g]=-1,m[x+n]<D[O+y]?m[x+e]<D[O+E]?wt=D[O+A]:wt=D[O+A]+C:m[x+e]<D[O+E]?wt=D[O+A]+C*2:wt=D[O+A]+C*3,Et===wt)if(Qe--){O=Et;continue}else{Qe=$;break}D[wt+g]=x;break}}if(N.barnesHutOptimize)for(ge=N.scalingRatio,x=0;x<Ke;x+=S)for(O=0;;)if(D[O+A]>=0)if(Y=Math.pow(m[x+n]-D[O+p],2)+Math.pow(m[x+e]-D[O+k],2),_e=D[O+b],4*_e*_e/Y<ut){if(V=m[x+n]-D[O+p],ye=m[x+e]-D[O+k],Ye===!0?Y>0?(Z=ge*m[x+s]*D[O+_]/Y,m[x+t]+=V*Z,m[x+r]+=ye*Z):Y<0&&(Z=-ge*m[x+s]*D[O+_]/Math.sqrt(Y),m[x+t]+=V*Z,m[x+r]+=ye*Z):Y>0&&(Z=ge*m[x+s]*D[O+_]/Y,m[x+t]+=V*Z,m[x+r]+=ye*Z),O=D[O+v],O<0)break;continue}else{O=D[O+A];continue}else{if(ne=D[O+g],ne>=0&&ne!==x&&(V=m[x+n]-m[ne+n],ye=m[x+e]-m[ne+e],Y=V*V+ye*ye,Ye===!0?Y>0?(Z=ge*m[x+s]*m[ne+s]/Y,m[x+t]+=V*Z,m[x+r]+=ye*Z):Y<0&&(Z=-ge*m[x+s]*m[ne+s]/Math.sqrt(Y),m[x+t]+=V*Z,m[x+r]+=ye*Z):Y>0&&(Z=ge*m[x+s]*m[ne+s]/Y,m[x+t]+=V*Z,m[x+r]+=ye*Z)),O=D[O+v],O<0)break;continue}else for(ge=N.scalingRatio,K=0;K<Ke;K+=S)for(ee=0;ee<K;ee+=S)V=m[K+n]-m[ee+n],ye=m[K+e]-m[ee+e],Ye===!0?(Y=Math.sqrt(V*V+ye*ye)-m[K+c]-m[ee+c],Y>0?(Z=ge*m[K+s]*m[ee+s]/Y/Y,m[K+t]+=V*Z,m[K+r]+=ye*Z,m[ee+t]-=V*Z,m[ee+r]-=ye*Z):Y<0&&(Z=100*ge*m[K+s]*m[ee+s],m[K+t]+=V*Z,m[K+r]+=ye*Z,m[ee+t]-=V*Z,m[ee+r]-=ye*Z)):(Y=Math.sqrt(V*V+ye*ye),Y>0&&(Z=ge*m[K+s]*m[ee+s]/Y/Y,m[K+t]+=V*Z,m[K+r]+=ye*Z,m[ee+t]-=V*Z,m[ee+r]-=ye*Z));for(W=N.gravity/N.scalingRatio,ge=N.scalingRatio,x=0;x<Ke;x+=S)Z=0,V=m[x+n],ye=m[x+e],Y=Math.sqrt(Math.pow(V,2)+Math.pow(ye,2)),N.strongGravityMode?Y>0&&(Z=ge*m[x+s]*W):Y>0&&(Z=ge*m[x+s]*W/Y),m[x+t]-=V*Z,m[x+r]-=ye*Z;for(ge=1*(N.outboundAttractionDistribution?Xe:1),Ie=0;Ie<Be;Ie+=G)K=Le[Ie+d],ee=Le[Ie+f],ce=Le[Ie+h],ct=Math.pow(ce,N.edgeWeightInfluence),V=m[K+n]-m[ee+n],ye=m[K+e]-m[ee+e],Ye===!0?(Y=Math.sqrt(V*V+ye*ye)-m[K+c]-m[ee+c],N.linLogMode?N.outboundAttractionDistribution?Y>0&&(Z=-ge*ct*Math.log(1+Y)/Y/m[K+s]):Y>0&&(Z=-ge*ct*Math.log(1+Y)/Y):N.outboundAttractionDistribution?Y>0&&(Z=-ge*ct/m[K+s]):Y>0&&(Z=-ge*ct)):(Y=Math.sqrt(Math.pow(V,2)+Math.pow(ye,2)),N.linLogMode?N.outboundAttractionDistribution?Y>0&&(Z=-ge*ct*Math.log(1+Y)/Y/m[K+s]):Y>0&&(Z=-ge*ct*Math.log(1+Y)/Y):N.outboundAttractionDistribution?(Y=1,Z=-ge*ct/m[K+s]):(Y=1,Z=-ge*ct)),Y>0&&(m[K+t]+=V*Z,m[K+r]+=ye*Z,m[ee+t]-=V*Z,m[ee+r]-=ye*Z);var rr,Yt,sr,$t,ar,Xt;if(Ye===!0)for(x=0;x<Ke;x+=S)m[x+l]!==1&&(rr=Math.sqrt(Math.pow(m[x+t],2)+Math.pow(m[x+r],2)),rr>T&&(m[x+t]=m[x+t]*T/rr,m[x+r]=m[x+r]*T/rr),Yt=m[x+s]*Math.sqrt((m[x+i]-m[x+t])*(m[x+i]-m[x+t])+(m[x+o]-m[x+r])*(m[x+o]-m[x+r])),sr=Math.sqrt((m[x+i]+m[x+t])*(m[x+i]+m[x+t])+(m[x+o]+m[x+r])*(m[x+o]+m[x+r]))/2,$t=.1*Math.log(1+sr)/(1+Math.sqrt(Yt)),ar=m[x+n]+m[x+t]*($t/N.slowDown),m[x+n]=ar,Xt=m[x+e]+m[x+r]*($t/N.slowDown),m[x+e]=Xt);else for(x=0;x<Ke;x+=S)m[x+l]!==1&&(Yt=m[x+s]*Math.sqrt((m[x+i]-m[x+t])*(m[x+i]-m[x+t])+(m[x+o]-m[x+r])*(m[x+o]-m[x+r])),sr=Math.sqrt((m[x+i]+m[x+t])*(m[x+i]+m[x+t])+(m[x+o]+m[x+r])*(m[x+o]+m[x+r]))/2,$t=m[x+a]*Math.log(1+sr)/(1+Math.sqrt(Yt)),m[x+a]=Math.min(1,Math.sqrt($t*(Math.pow(m[x+t],2)+Math.pow(m[x+r],2))/(1+Math.sqrt(Yt)))),ar=m[x+n]+m[x+t]*($t/N.slowDown),m[x+n]=ar,Xt=m[x+e]+m[x+r]*($t/N.slowDown),m[x+e]=Xt);return{}},ci}var Ft={},qo;function Pd(){if(qo)return Ft;qo=1;var n=10,e=3;return Ft.assign=function(t){t=t||{};var r=Array.prototype.slice.call(arguments).slice(1),i,o,s;for(i=0,s=r.length;i<s;i++)if(r[i])for(o in r[i])t[o]=r[i][o];return t},Ft.validateSettings=function(t){return"linLogMode"in t&&typeof t.linLogMode!="boolean"?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in t&&typeof t.outboundAttractionDistribution!="boolean"?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in t&&typeof t.adjustSizes!="boolean"?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in t&&typeof t.edgeWeightInfluence!="number"?{message:"the `edgeWeightInfluence` setting should be a number."}:"scalingRatio"in t&&!(typeof t.scalingRatio=="number"&&t.scalingRatio>=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in t&&typeof t.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in t&&!(typeof t.gravity=="number"&&t.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in t&&!(typeof t.slowDown=="number"||t.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in t&&typeof t.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in t&&!(typeof t.barnesHutTheta=="number"&&t.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},Ft.graphToByteArrays=function(t,r){var i=t.order,o=t.size,s={},a,c=new Float32Array(i*n),l=new Float32Array(o*e);return a=0,t.forEachNode(function(d,f){s[d]=a,c[a]=f.x,c[a+1]=f.y,c[a+2]=0,c[a+3]=0,c[a+4]=0,c[a+5]=0,c[a+6]=1,c[a+7]=1,c[a+8]=f.size||1,c[a+9]=f.fixed?1:0,a+=n}),a=0,t.forEachEdge(function(d,f,h,g,y,E,b){var v=s[h],A=s[g],_=r(d,f,h,g,y,E,b);c[v+6]+=_,c[A+6]+=_,l[a]=v,l[a+1]=A,l[a+2]=_,a+=e}),{nodes:c,edges:l}},Ft.assignLayoutChanges=function(t,r,i){var o=0;t.updateEachNodeAttributes(function(s,a){return a.x=r[o],a.y=r[o+1],o+=n,i?i(s,a):a})},Ft.readGraphPositions=function(t,r){var i=0;t.forEachNode(function(o,s){r[i]=s.x,r[i+1]=s.y,i+=n})},Ft.collectLayoutChanges=function(t,r,i){for(var o=t.nodes(),s={},a=0,c=0,l=r.length;a<l;a+=n){if(i){var d=Object.assign({},t.getNodeAttributes(o[c]));d.x=r[a],d.y=r[a+1],d=i(o[c],d),s[o[c]]={x:d.x,y:d.y}}else s[o[c]]={x:r[a],y:r[a+1]};c++}return s},Ft.createWorker=function(r){var i=window.URL||window.webkitURL,o=r.toString(),s=i.createObjectURL(new Blob(["("+o+").call(this);"],{type:"text/javascript"})),a=new Worker(s);return i.revokeObjectURL(s),a},Ft}var li,Vo;function zd(){return Vo||(Vo=1,li={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}),li}var di,Yo;function Md(){if(Yo)return di;Yo=1;var n=En(),e=qs().createEdgeWeightGetter,t=Ud(),r=Pd(),i=zd();function o(c,l,d){if(!n(l))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");typeof d=="number"&&(d={iterations:d});var f=d.iterations;if(typeof f!="number")throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(f<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var h=e("getEdgeWeight"in d?d.getEdgeWeight:"weight").fromEntry,g=typeof d.outputReducer=="function"?d.outputReducer:null,y=r.assign({},i,d.settings),E=r.validateSettings(y);if(E)throw new Error("graphology-layout-forceatlas2: "+E.message);var b=r.graphToByteArrays(l,h),v;for(v=0;v<f;v++)t(y,b.nodes,b.edges);if(c){r.assignLayoutChanges(l,b.nodes,g);return}return r.collectLayoutChanges(l,b.nodes)}function s(c){var l=typeof c=="number"?c:c.order;return{barnesHutOptimize:l>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(l)}}var a=o.bind(null,!1);return a.assign=o.bind(null,!0),a.inferSettings=s,di=a,di}var Wd=Md();const Xo=_i(Wd),jd=["centrality_score","centrality","pagerank","page_rank","betweenness","closeness","eigenvector","degree","score"];function Bd(n){return n==null?"":String(n)}function Fd(n){const e=typeof n=="number"?n:typeof n=="string"&&n.trim()?Number(n):NaN;return Number.isFinite(e)?e:null}function Jo(n){for(const e of jd){const t=Fd(n.data[e]);if(t!==null)return t}return null}function Zo(n,e){for(const t of e){const r=n[t];if(typeof r=="string"&&r.trim())return r}return null}function Li(n,e){const t=n[e];return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function Qo(n){return Array.isArray(n)?n.filter(e=>typeof e=="string"||typeof e=="number").map(e=>String(e).trim()).filter(Boolean):[]}function Kd(n){const e=Li(n.data,"metadata");return Zo(n.data,["description","summary","content"])??(e?Zo(e,["description","summary","content"]):null)}function Hd(n){const e=Qo(n.data.exports);if(e.length>0)return e;const t=Li(n.data,"metadata");return t?Qo(t.exports):[]}function es(n,e){for(const t of e){const r=n[t];if(typeof r=="boolean")return r;if(typeof r=="string"){const i=r.trim().toLowerCase();if(["true","yes","1"].includes(i))return!0;if(["false","no","0"].includes(i))return!1}}return null}function Ys(n,e){var i;const t=Li(n.data,"metadata"),r=es(n.data,["orphan","is_orphan","isOrphan","dead_code","deadCode"])??(t?es(t,["orphan","is_orphan","isOrphan","dead_code","deadCode"]):null);return r!==null?r:(((i=e==null?void 0:e.get(n.id))==null?void 0:i.inDegree)??1)===0}function qd(n){var r,i;const e=((r=n.data)==null?void 0:r.kind)??((i=n.data)==null?void 0:i.type)??n.label,t=typeof e=="string"?e.toLowerCase():"";return t==="imports"||t==="import"||t==="imports_from"?"imports":t==="defines"||t==="defined_in"||t==="contains"?"defines":"references"}function Vd(n,e){return n==="imports"?e==="incoming"?"imported by":"imports":n==="defines"?e==="incoming"?"defined by":"defines":e==="incoming"?"referenced by":"references"}function Yd(n,e,t,r){const i=new Map(e.map(l=>[l.id,l])),o=[];for(const l of t){const d=l.source===n.id?"outgoing":l.target===n.id?"incoming":null;if(!d)continue;const f=d==="outgoing"?l.target:l.source,h=i.get(f),g=qd(l);o.push({id:l.id,kind:g,direction:d,label:Vd(g,d),edgeLabel:l.label,nodeId:f,nodeLabel:(h==null?void 0:h.label)??f})}const s=(l,d)=>l.kind.localeCompare(d.kind)||l.nodeLabel.localeCompare(d.nodeLabel)||l.nodeId.localeCompare(d.nodeId),a=o.filter(l=>l.direction==="incoming").sort(s),c=o.filter(l=>l.direction==="outgoing").sort(s);return{description:Kd(n),exports:Hd(n),orphan:Ys(n,r),incoming:a,outgoing:c,whereUsed:a}}function Xd(n,e){const t=new Map;for(const r of n)t.set(r.id,{degree:0,inDegree:0,outDegree:0,score:Jo(r)??0});for(const r of e){const i=t.get(r.source),o=t.get(r.target);i&&(i.outDegree+=1,i.degree+=1),o&&(o.inDegree+=1,o.degree+=1)}for(const r of n){const i=t.get(r.id);i&&(i.score=Jo(r)??i.degree)}return t}function Jd(n,e,t){const r=t.get(n.id),i=t.get(e.id),o=((i==null?void 0:i.score)??0)-((r==null?void 0:r.score)??0);if(o!==0)return o;const s=((i==null?void 0:i.degree)??0)-((r==null?void 0:r.degree)??0);if(s!==0)return s;const a=n.label.localeCompare(e.label);return a!==0?a:n.id.localeCompare(e.id)}function Zd(n,e){const t=n.map(o=>{var s;return((s=e.get(o.id))==null?void 0:s.inDegree)??0});return Math.max(0,...t)<=0?new Map(n.map(o=>[o.id,1])):[...new Set(t)].sort((o,s)=>o-s).length===1?new Map(n.map(o=>[o.id,1])):new Map(n.map(o=>{var c;const s=((c=e.get(o.id))==null?void 0:c.inDegree)??0;if(s<=0)return[o.id,1];const a=t.filter(l=>l<=s).length/t.length;return a>.95?[o.id,2]:a>.8?[o.id,1.5]:a>.5?[o.id,1.25]:[o.id,1]}))}function ts(n){const e=n.id??n.rid??n._id??n.uid;return e==null?null:String(e)}function rs(n,e){const t=n.label??n.name??n.title;return t!=null?String(t):e}function Qd(n){const e=n.source??n.from??n.src??n.start,t=n.target??n.to??n.dst??n.end;return e==null||t===null||t===void 0?null:{source:String(e),target:String(t)}}function ef(n){const e=new Map,t=new Map;for(const r of n.result.records){if(r.nodes)for(const o of Object.values(r.nodes)){if(!o||typeof o!="object")continue;const s=o,a=ts(s);a&&(e.has(a)||e.set(a,{id:a,label:rs(s,a),data:s}))}if(r.edges)for(const o of Object.values(r.edges)){if(!o||typeof o!="object")continue;const s=o,a=Qd(s);if(!a)continue;const c=s.label??s.type??s.rel,l=`${a.source}->${a.target}:${Bd(c)}`;t.has(l)||t.set(l,{id:l,source:a.source,target:a.target,label:c!==void 0?String(c):void 0,data:s})}const i=r.values;if(i&&typeof i=="object"){const o=i.kind;if(o==="node"){const s=ts(i);s&&!e.has(s)&&e.set(s,{id:s,label:rs(i,s),data:i})}else if(o==="edge"){const s=i.from_rid??i.from,a=i.to_rid??i.to;if(s!=null&&a!==void 0&&a!==null){const c=String(s),l=String(a),d=i.label??i.type??i.rel,h=`e:${i.rid??i.id??`${c}->${l}`}`;t.has(h)||t.set(h,{id:h,source:c,target:l,label:d!==void 0?String(d):void 0,data:i})}}}}return{nodes:[...e.values()],edges:[...t.values()]}}function ip(n){var t;const e=(t=n.result)==null?void 0:t.records;return!e||e.length===0?!1:e.some(r=>{if(r.nodes&&Object.keys(r.nodes).length>0||r.edges&&Object.keys(r.edges).length>0)return!0;const i=r.values;return!!(i&&(i.kind==="node"||i.kind==="edge"))})}function tf(n){let e=n>>>0;return()=>{e=e+1831565813>>>0;let t=e;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function rf(n,e,t=Td){try{if(!t||typeof t.assign!="function")throw new Error("Leiden community detection unavailable");return t.assign(n,{attributes:{community:"community"},rng:e}),"leiden"}catch{return Nd.assign(n,{nodeCommunityAttribute:"community",rng:e}),"louvain"}}function nf(n,e){const t=new Map;if(n.length===0)return t;if(n.length===1)return t.set(n[0].id,{x:50,y:50,community:0}),t;const r=new Fe({type:"undirected",multi:!1,allowSelfLoops:!0}),i=tf(n.length*131+e.length),o=Math.PI*2;n.forEach((E,b)=>{const v=b/n.length*o+i()*.1;r.addNode(E.id,{x:Math.cos(v),y:Math.sin(v)})});for(const E of e)!r.hasNode(E.source)||!r.hasNode(E.target)||E.source!==E.target&&(r.hasEdge(E.source,E.target)||r.addEdge(E.source,E.target));if(r.size===0){const E=Math.ceil(Math.sqrt(n.length));return n.forEach((b,v)=>{const A=Math.floor(v/E),_=v%E;t.set(b.id,{x:10+_/Math.max(1,E-1)*80,y:10+A/Math.max(1,E-1)*80,community:v})}),t}rf(r,i);const s=Xo.inferSettings(r);Xo.assign(r,{iterations:n.length>200?120:200,settings:{...s,strongGravityMode:!0,gravity:1.2,scalingRatio:10,barnesHutOptimize:n.length>500}});let a=1/0,c=-1/0,l=1/0,d=-1/0;r.forEachNode((E,b)=>{b.x<a&&(a=b.x),b.x>c&&(c=b.x),b.y<l&&(l=b.y),b.y>d&&(d=b.y)});const f=c-a||1,h=d-l||1,g=5,y=100-g*2;return r.forEachNode((E,b)=>{t.set(E,{x:g+(b.x-a)/f*y,y:g+(b.y-l)/h*y,community:b.community??0})}),t}function Di(n,e=!0){const t=[200,25,145,290,50,175,320,95,0,260,220,130],r=n<t.length?t[n]:(t[0]+n*137.508)%360,i=e?62:58,o=e?60:48;return`hsl(${r.toFixed(0)} ${i}% ${o}%)`}function wn(n){switch(n){case"tale":return"#ff2056";case"character":return"#7dd3fc";case"location":return"#a3e635";case"object":return"#fbbf24";case"archetype":return"#a78bfa";default:return"#94a3b8"}}function of(n){return n==="tale"?8:n==="character"?5:n==="location"||n==="object"?4:3}function Xs(n,e){const t=Math.max(.35,Math.min(1.25,of(n)*.14));return Math.max(.35,Math.min(2.5,t*e))}const Js=3.4;function sf(n,e){return Xs(n,e)*Js}const af="#e2e8f0";function Zs(n){return Math.min(7,2.2+Math.sqrt(Math.max(1,n))*.7)}function uf(n){return Zs(n)*Js}function cf(n,e,t){const r=e/100,i=t/100,o=(1-Math.abs(2*i-1))*r,s=(n%360+360)%360/60,a=o*(1-Math.abs(s%2-1));let c=0,l=0,d=0;s>=0&&s<1?[c,l,d]=[o,a,0]:s<2?[c,l,d]=[a,o,0]:s<3?[c,l,d]=[0,o,a]:s<4?[c,l,d]=[0,a,o]:s<5?[c,l,d]=[a,0,o]:[c,l,d]=[o,0,a];const f=i-o/2;return{r:Math.round((c+f)*255),g:Math.round((l+f)*255),b:Math.round((d+f)*255)}}function Qs(n){const e=n.match(/hsl\(\s*([\d.]+)\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%/i);return e?cf(Number(e[1]),Number(e[2]),Number(e[3])):null}function lf({r:n,g:e,b:t}){return`rgb(${n}, ${e}, ${t})`}function df(n,e=!0){const t=Di(n,e),r=Qs(t);return r?lf(r):t}function Er(n,e){const t=Math.max(0,Math.min(1,e)),r=n.startsWith("hsl")?Qs(n):null;if(r)return`rgba(${r.r}, ${r.g}, ${r.b}, ${t})`;const i=n.match(/rgb\(\s*([\d.]+)[, ]+([\d.]+)[, ]+([\d.]+)/i);if(i)return`rgba(${i[1]}, ${i[2]}, ${i[3]}, ${t})`;const o=n.replace("#","");if(/^[0-9a-f]{6}$/i.test(o)){const s=parseInt(o.slice(0,2),16),a=parseInt(o.slice(2,4),16),c=parseInt(o.slice(4,6),16);return`rgba(${s}, ${a}, ${c}, ${t})`}return n}const ff="#d6a72c",hf="#f4c84a";function pf(n){var d,f,h,g;const{nodes:e,edges:t,layout:r,sizeScales:i,orphanIds:o,dark:s=!0,edgeColor:a="#3a424d",bundledCurvatures:c}=n,l=new Fe({type:"directed",multi:!0,allowSelfLoops:!0});for(const y of e){if(l.hasNode(y.id))continue;const E=String(y.data.node_type??"node"),b=i.get(y.id)??1,v=r.get(y.id),A=y.data.__supernode===!0,_=typeof y.data.__memberCount=="number"?y.data.__memberCount:0,p=A?uf(_):sf(E,b),k=v?df(v.community,s):wn(E);l.addNode(y.id,{x:(v==null?void 0:v.x)??50,y:-((v==null?void 0:v.y)??50),size:p,baseSize:p,color:k,mutedColor:Er(k,.14),borderColor:A?af:wn(E),label:y.label,nodeType:E,community:(v==null?void 0:v.community)??-1,orphan:o.has(y.id),isSupernode:A,memberCount:_,type:"border"})}for(const y of t){if(!l.hasNode(y.source)||!l.hasNode(y.target)||l.hasEdge(y.id))continue;const E=((d=r.get(y.source))==null?void 0:d.community)??-1,b=((f=r.get(y.target))==null?void 0:f.community)??-1,v=((h=y.data)==null?void 0:h.__aggregated)===!0,A=typeof((g=y.data)==null?void 0:g.weight)=="number"?y.data.weight:1;l.addEdgeWithKey(y.id,y.source,y.target,{size:v?Math.min(6,1+Math.log2(A+1)):1,color:Er(a,.34),edgeLabel:y.label??"",label:"",crossCommunity:E!==b,curvature:(c==null?void 0:c.get(y.id))??0,type:"line"})}return l}function gf(n,e,t={}){const{padding:r=2.5,dark:i=!0}=t,o=new Map;for(const s of n){const a=e.get(s.id);if(!a)continue;const c=o.get(a.community);c?(c.minX=Math.min(c.minX,a.x),c.minY=Math.min(c.minY,a.y),c.maxX=Math.max(c.maxX,a.x),c.maxY=Math.max(c.maxY,a.y),c.count+=1):o.set(a.community,{minX:a.x,minY:a.y,maxX:a.x,maxY:a.y,count:1})}return[...o.entries()].sort((s,a)=>s[0]-a[0]).map(([s,a])=>{const c=Di(s,i);return{community:s,count:a.count,tint:c,fill:Er(c,.08),stroke:Er(c,.5),minX:a.minX-r,minY:a.minY-r,maxX:a.maxX+r,maxY:a.maxY+r,cx:(a.minX+a.maxX)/2,cy:(a.minY+a.maxY)/2}})}function ns(n,e,t,r,i){const o=t-n,s=r-e;let a=1;return o>0?a=Math.min(a,(i.maxX-n)/o):o<0&&(a=Math.min(a,(i.minX-n)/o)),s>0?a=Math.min(a,(i.maxY-e)/s):s<0&&(a=Math.min(a,(i.minY-e)/s)),a=Math.max(0,Math.min(1,a)),{x:n+o*a,y:e+s*a}}function vf(n,e,t){const r=new Map(t.map(o=>[o.community,o])),i=[];for(const o of n){const s=e.get(o.source),a=e.get(o.target);if(!s||!a||s.community===a.community)continue;const c=r.get(s.community),l=r.get(a.community);if(!c||!l)continue;const d=ns(s.x,s.y,a.x,a.y,c),f=ns(a.x,a.y,s.x,s.y,l);i.push({id:o.id,source:o.source,target:o.target,label:o.label,sourceCommunity:s.community,targetCommunity:a.community,x1:d.x,y1:d.y,x2:f.x,y2:f.y})}return i}const yf=36,mf=28,bf=36;function wf(n,e,t){const{focus:r,focusId:i,selectedNodeId:o,pulse:s,colors:a}=t,c=i!==null,l=i===n,d=r.nodes.has(n),f=!c||d,h=c?l?2.2+s*.38:d?1.58:.9:1,g=l?a.focusNodeStroke:e.orphan?a.warn:o===n?a.selectedNodeStroke:e.borderColor,y=e.isSupernode||c&&(l||r.nodes.size<=bf&&d);return{size:e.baseSize*h,color:f?e.color:e.mutedColor,borderColor:g,label:y?e.label.slice(0,yf):"",forceLabel:y,zIndex:l?3:e.isSupernode||d?2:1,hidden:!1}}function _f(n,e,t){const{focus:r,focusId:i,colors:o,groupInBox:s,bundle:a}=t,c=i!==null,l=r.edges.has(n),d=e.curvature,f=a&&Math.abs(d)>1e-4?"curved":"line";return s&&e.crossCommunity&&!l?{size:e.size,color:e.color,label:"",forceLabel:!1,zIndex:0,hidden:!0,type:f,curvature:d}:c?l?{size:2.2,color:o.focusEdge,label:e.edgeLabel?e.edgeLabel.slice(0,mf):"",forceLabel:!!e.edgeLabel,zIndex:2,hidden:!1,type:f,curvature:d}:{size:e.size,color:Er(o.edge,.055),label:"",forceLabel:!1,zIndex:0,hidden:!1,type:f,curvature:d}:{size:e.size,color:Er(o.edge,.34),label:"",forceLabel:!1,zIndex:0,hidden:!1,type:f,curvature:d}}const xf={stiffness:.1,stepSize:.1,cycles:6,iterations:60,iterationRate:2/3,subdivisionRate:2,compatibilityThreshold:.6},fi=1500,kr=1e-6;function Wr(n,e){return Math.hypot(n.x-e.x,n.y-e.y)}function _n(n,e){return{x:(n.x+e.x)/2,y:(n.y+e.y)/2}}function is(n,e){const t=e+2,r=[0];for(let a=1;a<n.length;a++)r.push(r[a-1]+Wr(n[a],n[a-1]));const i=r[r.length-1];if(i<kr)return Array.from({length:t},()=>({...n[0]}));const o=[];let s=1;for(let a=0;a<t;a++){const c=i*a/(t-1);for(;s<n.length-1&&r[s]<c;)s++;const l=r[s-1],d=r[s]-l||1,f=Math.max(0,Math.min(1,(c-l)/d));o.push({x:n[s-1].x+f*(n[s].x-n[s-1].x),y:n[s-1].y+f*(n[s].y-n[s-1].y)})}return o}function Ef(n,e){const t=(n.t.x-n.s.x)*(e.t.x-e.s.x)+(n.t.y-n.s.y)*(e.t.y-e.s.y);return Math.abs(t/(n.len*e.len))}function kf(n,e){const t=(n.len+e.len)/2;return 2/(t/Math.min(n.len,e.len)+Math.max(n.len,e.len)/t)}function Sf(n,e){const t=(n.len+e.len)/2;return t/(t+Wr(_n(n.s,n.t),_n(e.s,e.t)))}function os(n,e){const t=e.len*e.len,r=((e.s.y-n.y)*(e.s.y-e.t.y)-(e.s.x-n.x)*(e.t.x-e.s.x))/t;return{x:e.s.x+r*(e.t.x-e.s.x),y:e.s.y+r*(e.t.y-e.s.y)}}function ss(n,e){const t=os(e.s,n),r=os(e.t,n),i=_n(t,r),o=Wr(t,r);return o<kr?0:Math.max(0,1-2*Wr(i,_n(e.s,e.t))/o)}function $f(n,e){return Math.min(ss(n,e),ss(e,n))}function Af(n,e){return Ef(n,e)*kf(n,e)*Sf(n,e)*$f(n,e)}function Cf(n,e){const t=n.map(()=>[]);for(let r=0;r<n.length;r++)for(let i=r+1;i<n.length;i++)Af(n[r],n[i])>=e&&(t[r].push(i),t[i].push(r));return t}function Lf(n,e,t={}){const r={...xf,...t},i=new Map(n.map(h=>[h.id,{x:h.x,y:h.y}])),o=new Map,s=[];for(const h of e){const g=i.get(h.source),y=i.get(h.target);if(!g||!y||(o.set(h.id,[{...g},{...y}]),h.source===h.target))continue;const E=Wr(g,y);E<kr||s.push({id:h.id,s:{...g},t:{...y},len:E})}if(s.length<2)return o;const a=s.map(h=>[{...h.s},{...h.t}]),c=Cf(s,r.compatibilityThreshold);let l=1,d=r.stepSize,f=r.iterations;for(let h=0;h<a.length;h++)a[h]=is(a[h],l);for(let h=0;h<r.cycles;h++){const g=Math.max(1,Math.round(f));for(let y=0;y<g;y++){const E=s.map((b,v)=>Df(v,a,c,s[v].len,l,d,r.stiffness));for(let b=0;b<s.length;b++)for(let v=1;v<=l;v++)a[b][v].x+=E[b][v].x,a[b][v].y+=E[b][v].y}d*=.5,l*=r.subdivisionRate,f*=r.iterationRate;for(let y=0;y<a.length;y++)a[y]=is(a[y],l)}for(let h=0;h<s.length;h++)o.set(s[h].id,a[h].map(g=>({x:g.x,y:g.y})));return o}function Df(n,e,t,r,i,o,s){const a=s/(r*(i+1)),c=e[n],l=[{x:0,y:0}];for(let d=1;d<=i;d++){const f=c[d-1],h=c[d],g=c[d+1];let y=a*(f.x-2*h.x+g.x),E=a*(f.y-2*h.y+g.y);for(const b of t[n]){const v=e[b][d],A=v.x-h.x,_=v.y-h.y;if(Math.abs(A)>kr||Math.abs(_)>kr){const p=Math.hypot(A,_);y+=A/p,E+=_/p}}l.push({x:o*y,y:o*E})}return l.push({x:0,y:0}),l}function Gf(n){if(n.length<3)return 0;const e=n[0],t=n[n.length-1],r=t.x-e.x,i=t.y-e.y,o=Math.hypot(r,i);if(o<kr)return 0;let s=0;for(let c=1;c<n.length-1;c++){const l=n[c].x-e.x,d=n[c].y-e.y,f=(l*-i+d*r)/o;Math.abs(f)>Math.abs(s)&&(s=f)}const a=2*s/o;return Math.max(-1,Math.min(1,a))}const Gi="__cluster__:";function as(n){return`${Gi}${n}`}function ea(n){return n.startsWith(Gi)}function If(n){if(!ea(n))return null;const e=Number(n.slice(Gi.length));return Number.isFinite(e)?e:null}function ta(n,e){const t=new Map;for(const r of n){const i=e.get(r.id);if(!i)continue;const o=t.get(i.community);o?o.push(r.id):t.set(i.community,[r.id])}return t}const us=(n,e,t)=>({nodes:n,edges:e,layout:t,supernodes:new Map,collapsedMembers:new Map});function Tf(n,e,t,r){if(r.size===0)return us(n,e,t);const i=ta(n,t),o=new Set;for(const g of r){const y=i.get(g);y&&y.length>0&&o.add(g)}if(o.size===0)return us(n,e,t);const s=new Map,a=new Map,c=[],l=new Map;for(const g of n){const y=t.get(g.id);if(y&&o.has(y.community)){s.set(g.id,as(y.community));continue}c.push(g),y&&l.set(g.id,y)}for(const g of o){const y=i.get(g),E=as(g);let b=0,v=0,A=0;for(const _ of y){const p=t.get(_);p&&(b+=p.x,v+=p.y,A+=1)}a.set(E,{community:g,memberIds:y,size:y.length}),c.push({id:E,label:`cluster ${g} · ${y.length}`,data:{node_type:"cluster",__supernode:!0,__community:g,__memberCount:y.length}}),l.set(E,{x:A?b/A:50,y:A?v/A:50,community:g})}const d=g=>s.get(g)??g,f=[],h=new Map;for(const g of e){const y=d(g.source),E=d(g.target);if(!(y!==g.source||E!==g.target)){f.push(g);continue}if(y===E)continue;const v=`${y} ${E}`,A=h.get(v);A?(A.weight+=1,A.members.push(g.id)):h.set(v,{source:y,target:E,weight:1,members:[g.id]})}for(const[g,y]of h)f.push({id:`__agg__:${g}`,source:y.source,target:y.target,label:y.weight>1?`×${y.weight}`:void 0,data:{__aggregated:!0,weight:y.weight,members:y.members}});return{nodes:c,edges:f,layout:l,supernodes:a,collapsedMembers:s}}var Rf=le('<div class="flex-1 grid place-items-center text-fg-3 text-[12px] font-mono p-6 svelte-gt9p7f">No graph shape in this result.</div>'),Of=le('<button type="button" class="text-fg-3 hover:text-fg-1 cursor-pointer svelte-gt9p7f" aria-label="Clear filter"><!></button>'),Nf=le('<div class="inline-flex items-center gap-1.5 border border-line-1 rounded px-2 py-1 bg-bg-0 svelte-gt9p7f"><!> <input type="text" placeholder="filter by label…" class="bg-transparent text-fg-1 text-[11px] outline-none w-[160px] placeholder:text-fg-3 svelte-gt9p7f"/> <!></div> <label class="inline-flex items-center gap-1.5 text-fg-3 svelte-gt9p7f"><!> <span class="svelte-gt9p7f">limit:</span> <select class="bg-bg-1 text-fg-1 border border-line-1 rounded px-1 py-0.5 svelte-gt9p7f"><option class="svelte-gt9p7f">500</option><option class="svelte-gt9p7f">1k</option><option class="svelte-gt9p7f">2k</option><option class="svelte-gt9p7f">5k</option><option class="svelte-gt9p7f">10k</option><option class="svelte-gt9p7f">25k</option><option class="svelte-gt9p7f">50k</option></select></label>',1),Uf=le('<div class="inline-flex items-center overflow-hidden rounded border border-line-1 bg-bg-0 svelte-gt9p7f"><button type="button" class="inline-flex h-6 w-7 items-center justify-center text-fg-3 hover:bg-bg-1 hover:text-fg-0 disabled:opacity-40 svelte-gt9p7f" title="Zoom out" aria-label="Zoom out"><!></button> <button type="button" class="inline-flex h-6 min-w-12 items-center justify-center border-x border-line-1 px-2 text-[10px] text-fg-3 hover:bg-bg-1 hover:text-fg-0 svelte-gt9p7f" title="Fit graph" aria-label="Fit graph"> </button> <button type="button" class="inline-flex h-6 w-7 items-center justify-center text-fg-3 hover:bg-bg-1 hover:text-fg-0 disabled:opacity-40 svelte-gt9p7f" title="Zoom in" aria-label="Zoom in"><!></button></div>'),Pf=le('<span class="text-warn svelte-gt9p7f"> </span>'),zf=le('<button type="button"><!> </button>'),Mf=le('<button type="button" title="Group in a box — draw one tinted box per community and route inter-community edges at the borders"><!> groups</button> <button type="button" title="Force-directed edge bundling — collapse parallel edges onto shared trunks to untangle dense subgraphs"><!> bundle</button> <!> <!>',1),Wf=le('<button type="button" class="inline-flex items-center gap-1 h-6 px-2 rounded border border-line-1 text-fg-3 hover:text-fg-1 cursor-pointer svelte-gt9p7f" title="Discard graph query and show the original collection result"><!> reset</button>'),jf=le('<span class="text-accent svelte-gt9p7f"> </span>'),Bf=le('<span class="text-warn svelte-gt9p7f" title="More nodes match — raise the limit or narrow the filter to see them"> </span>'),Ff=le('<span class="text-fg-2 svelte-gt9p7f"> </span>'),Kf=le('<div class="mt-1.5 text-warn svelte-gt9p7f"> </div>'),Hf=le('<div class="border-b border-line-1 px-3 py-2 bg-bg-1/20 text-[11px] font-mono svelte-gt9p7f"><div class="flex items-center gap-2 mb-1.5 text-fg-3 svelte-gt9p7f"><span class="svelte-gt9p7f">quick:</span> <button type="button" class="px-1.5 py-0.5 rounded border border-line-1 hover:border-line-2 hover:text-fg-1 cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed svelte-gt9p7f">neighborhood of selected</button> <button type="button" class="px-1.5 py-0.5 rounded border border-line-1 hover:border-line-2 hover:text-fg-1 cursor-pointer svelte-gt9p7f">top centrality</button> <button type="button" class="inline-flex items-center gap-1 px-1.5 py-0.5 rounded border border-line-1 hover:border-line-2 hover:text-fg-1 cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed svelte-gt9p7f" title="Run shortest path in reddb"><!> shortest path</button></div> <div class="mb-1.5 grid grid-cols-[1fr_1fr_auto_auto] gap-2 svelte-gt9p7f"><input type="text" placeholder="from label…" class="h-6 rounded border border-line-1 bg-bg-0 px-2 text-[11px] text-fg-1 outline-none placeholder:text-fg-3 focus:border-accent svelte-gt9p7f"/> <input type="text" placeholder="to label…" class="h-6 rounded border border-line-1 bg-bg-0 px-2 text-[11px] text-fg-1 outline-none placeholder:text-fg-3 focus:border-accent svelte-gt9p7f"/> <button type="button" class="rounded border border-line-1 px-1.5 text-fg-3 hover:border-line-2 hover:text-fg-1 disabled:opacity-40 disabled:cursor-not-allowed svelte-gt9p7f">use as from</button> <button type="button" class="rounded border border-line-1 px-1.5 text-fg-3 hover:border-line-2 hover:text-fg-1 disabled:opacity-40 disabled:cursor-not-allowed svelte-gt9p7f">use as to</button></div> <div class="flex items-stretch gap-2 svelte-gt9p7f"><textarea spellcheck="false" rows="3" class="flex-1 bg-bg-0 text-fg-1 border border-line-1 rounded px-2 py-1 text-[12px] font-mono outline-none focus:border-accent placeholder:text-fg-3 resize-none svelte-gt9p7f"></textarea> <div class="flex flex-col gap-1.5 svelte-gt9p7f"><button type="button" class="inline-flex items-center gap-1.5 h-7 px-3 rounded bg-accent text-white cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed hover:bg-[#ff3868] svelte-gt9p7f"><!> run <span class="text-[9px] opacity-70 svelte-gt9p7f">⌘↵</span></button></div></div> <!></div>'),qf=le('<div class="border-b border-line-1 bg-warn/10 px-3 py-2 text-[11px] font-mono text-warn flex items-start gap-2 svelte-gt9p7f"><!> <div class="svelte-gt9p7f"><div class="svelte-gt9p7f">WebGL renderer unavailable. Switch to SVG or Table.</div> <div class="mt-0.5 break-words text-fg-3 svelte-gt9p7f"> </div></div></div>'),Vf=kt('<rect rx="6" stroke-width="1.5" class="svelte-gt9p7f"></rect>'),Yf=kt('<line stroke="var(--color-line-3)" stroke-width="1" stroke-dasharray="4 3" opacity="0.7" class="svelte-gt9p7f"></line>'),Xf=kt('<svg class="pointer-events-none absolute inset-0 h-full w-full svelte-gt9p7f" aria-hidden="true"><!><!></svg>'),Jf=le('<div class="sigma-canvas absolute inset-0 h-full w-full bg-bg-0 svelte-gt9p7f" role="application" tabindex="0"></div> <!>',1),Zf=kt('<rect rx="1.5" stroke-width="0.18" vector-effect="non-scaling-stroke" class="svelte-gt9p7f"></rect>'),Qf=kt('<line stroke="currentColor" stroke-width="0.12" stroke-dasharray="0.8 0.6" opacity="0.6" class="text-line-3 svelte-gt9p7f" vector-effect="non-scaling-stroke"></line>'),eh=kt('<g class="pointer-events-none svelte-gt9p7f"><!><!></g>'),th=kt('<polyline fill="none" stroke-linejoin="round" class="text-line-3 cursor-pointer hover:text-accent svelte-gt9p7f" vector-effect="non-scaling-stroke" role="button" tabindex="0"><title class="svelte-gt9p7f"> </title></polyline>'),rh=kt('<line class="text-line-3 cursor-pointer hover:text-accent svelte-gt9p7f" vector-effect="non-scaling-stroke" role="button" tabindex="0"><title class="svelte-gt9p7f"> </title></line>'),nh=kt('<text fill="#f6d36b" opacity="0.96" font-size="1" font-weight="700" font-family="JetBrains Mono Variable, monospace" paint-order="stroke" stroke="#020617" stroke-width="0.38" class="pointer-events-none select-none svelte-gt9p7f"> </text>'),ih=kt("<!><!>",1),oh=kt('<circle fill="none" stroke="var(--color-warn)" vector-effect="non-scaling-stroke" class="pointer-events-none svelte-gt9p7f"></circle>'),sh=kt('<text font-family="JetBrains Mono Variable, monospace" paint-order="stroke" stroke="#020617" class="pointer-events-none select-none svelte-gt9p7f"> </text>'),ah=kt('<!><circle vector-effect="non-scaling-stroke" role="button" tabindex="0"><title class="svelte-gt9p7f"> </title></circle><!>',1),uh=le('<div class="absolute inset-0 overflow-hidden bg-bg-0 svelte-gt9p7f"><svg class="h-full w-full svelte-gt9p7f" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid meet" role="button" tabindex="0"><rect x="0" y="0" width="100" height="100" fill="transparent" class="svelte-gt9p7f"></rect><g class="svelte-gt9p7f"><!><g class="svelte-gt9p7f"></g><g class="svelte-gt9p7f"></g></g></svg></div>'),ch=le('<span class="ml-2 text-warn svelte-gt9p7f">orphan</span>'),lh=le('<tr><td class="px-2 py-1 text-fg-3 svelte-gt9p7f">node</td><td class="px-2 py-1 text-accent font-semibold svelte-gt9p7f"> </td><td class="px-2 py-1 text-fg-0 svelte-gt9p7f"> </td><td class="px-2 py-1 text-fg-2 svelte-gt9p7f"> <!></td></tr>'),dh=le('<tr class="border-b border-line-1/60 hover:bg-bg-1/40 cursor-pointer svelte-gt9p7f"><td class="px-2 py-1 text-fg-3 svelte-gt9p7f">edge</td><td class="px-2 py-1 text-fg-2 svelte-gt9p7f"> </td><td class="px-2 py-1 text-fg-0 svelte-gt9p7f"> </td><td class="px-2 py-1 text-fg-2 svelte-gt9p7f"> </td></tr>'),fh=le('<div class="absolute inset-0 overflow-auto svelte-gt9p7f"><table class="w-full border-collapse text-[12px] font-mono svelte-gt9p7f"><thead class="sticky top-0 bg-bg-1 z-10 svelte-gt9p7f"><tr class="border-b border-line-1 text-fg-3 svelte-gt9p7f"><th class="px-2 py-1.5 text-left font-normal whitespace-nowrap svelte-gt9p7f">type</th><th class="px-2 py-1.5 text-left font-normal whitespace-nowrap svelte-gt9p7f">id / rid</th><th class="px-2 py-1.5 text-left font-normal whitespace-nowrap svelte-gt9p7f">label</th><th class="px-2 py-1.5 text-left font-normal whitespace-nowrap svelte-gt9p7f">node_type / endpoints</th></tr></thead><tbody class="svelte-gt9p7f"><!><!></tbody></table></div>'),hh=le('<span class="inline-flex shrink-0 items-center gap-1 rounded border border-warn/40 bg-warn/10 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-warn svelte-gt9p7f"><!> orphan</span>'),ph=le(`<button type="button" class="mt-2 inline-flex items-center gap-1.5 rounded border border-line-2 bg-bg-0 px-2 py-1 text-[11px] text-fg-2 hover:border-accent hover:text-fg-0 cursor-pointer svelte-gt9p7f" title="Fold this node's community into a single supernode"><!> </button>`),gh=le('<span class="max-w-full truncate rounded border border-line-1 bg-bg-0 px-1.5 py-0.5 text-[11px] text-fg-1 svelte-gt9p7f"> </span>'),vh=le('<div class="flex flex-wrap gap-1 svelte-gt9p7f"></div>'),yh=le('<div class="text-fg-3 svelte-gt9p7f">No exports recorded.</div>'),mh=le('<button type="button" class="grid w-full grid-cols-[82px_1fr] gap-2 rounded border border-line-1 bg-bg-0 px-2 py-1.5 text-left hover:border-line-2 hover:bg-bg-2 svelte-gt9p7f"><span class="text-[10px] uppercase tracking-wider text-fg-3 svelte-gt9p7f"> </span> <span class="min-w-0 svelte-gt9p7f"><span class="block truncate text-fg-0 svelte-gt9p7f"> </span> <span class="block truncate text-[10px] text-fg-3 svelte-gt9p7f"> </span></span></button>'),bh=le('<div class="space-y-1 svelte-gt9p7f"></div>'),wh=le('<div class="text-fg-3 svelte-gt9p7f">No inbound uses.</div>'),_h=le('<button type="button" class="w-full rounded border border-line-1 bg-bg-0 px-2 py-1 text-left hover:border-line-2 hover:bg-bg-2 svelte-gt9p7f"><span class="block truncate text-[10px] text-fg-3 svelte-gt9p7f"> </span> <span class="block truncate text-fg-1 svelte-gt9p7f"> </span></button>'),xh=le('<div class="rounded border border-line-1 px-2 py-1 text-fg-3 svelte-gt9p7f">none</div>'),Eh=le('<button type="button" class="w-full rounded border border-line-1 bg-bg-0 px-2 py-1 text-left hover:border-line-2 hover:bg-bg-2 svelte-gt9p7f"><span class="block truncate text-[10px] text-fg-3 svelte-gt9p7f"> </span> <span class="block truncate text-fg-1 svelte-gt9p7f"> </span></button>'),kh=le('<div class="rounded border border-line-1 px-2 py-1 text-fg-3 svelte-gt9p7f">none</div>'),Sh=le('<div class="mb-3 svelte-gt9p7f"><div class="flex items-start gap-2 svelte-gt9p7f"><div class="min-w-0 flex-1 svelte-gt9p7f"><div class="text-fg-3 text-[10px] uppercase tracking-wider svelte-gt9p7f">label</div> <div class="break-words text-[13px] font-semibold text-fg-0 svelte-gt9p7f"> </div></div> <!></div> <div class="mt-1 break-all text-accent svelte-gt9p7f"> </div> <!></div> <div class="mb-3 border-t border-line-1 pt-3 svelte-gt9p7f"><div class="mb-1 text-fg-3 text-[10px] uppercase tracking-wider svelte-gt9p7f">description</div> <div class="whitespace-pre-wrap break-words text-fg-1 svelte-gt9p7f"> </div></div> <div class="mb-3 border-t border-line-1 pt-3 svelte-gt9p7f"><div class="mb-1.5 flex items-center justify-between gap-2 svelte-gt9p7f"><div class="text-fg-3 text-[10px] uppercase tracking-wider svelte-gt9p7f">exports</div> <span class="text-[10px] text-fg-3 svelte-gt9p7f"> </span></div> <!></div> <div class="mb-3 border-t border-line-1 pt-3 svelte-gt9p7f"><div class="mb-1.5 flex items-center justify-between gap-2 svelte-gt9p7f"><div class="text-fg-3 text-[10px] uppercase tracking-wider svelte-gt9p7f">where used</div> <span class="text-[10px] text-fg-3 svelte-gt9p7f"> </span></div> <!></div> <div class="mb-3 border-t border-line-1 pt-3 svelte-gt9p7f"><div class="mb-1.5 grid grid-cols-2 gap-2 svelte-gt9p7f"><div class="svelte-gt9p7f"><div class="text-fg-3 text-[10px] uppercase tracking-wider svelte-gt9p7f">parents</div> <div class="text-[10px] text-fg-3 svelte-gt9p7f">incoming direction</div></div> <div class="svelte-gt9p7f"><div class="text-fg-3 text-[10px] uppercase tracking-wider svelte-gt9p7f">children</div> <div class="text-[10px] text-fg-3 svelte-gt9p7f">outgoing direction</div></div></div> <div class="grid grid-cols-2 gap-2 svelte-gt9p7f"><div class="space-y-1 svelte-gt9p7f"><!></div> <div class="space-y-1 svelte-gt9p7f"><!></div></div></div>',1),$h=le('<code class="svelte-gt9p7f"> </code>'),Ah=le('<code class="svelte-gt9p7f"> </code>'),Ch=le('<div class="mb-2 svelte-gt9p7f"><div class="text-fg-3 text-[10px] uppercase tracking-wider svelte-gt9p7f">label</div> <div class="text-fg-0 font-semibold svelte-gt9p7f"> </div></div> <div class="mb-2 grid grid-cols-[60px_1fr] gap-x-2 gap-y-1 svelte-gt9p7f"><div class="text-fg-3 text-[10px] uppercase tracking-wider svelte-gt9p7f">from</div> <div class="text-fg-1 svelte-gt9p7f"><!></div> <div class="text-fg-3 text-[10px] uppercase tracking-wider svelte-gt9p7f">to</div> <div class="text-fg-1 svelte-gt9p7f"><!></div></div>',1),Lh=le('<pre class="whitespace-pre-wrap text-[11px] svelte-gt9p7f"> </pre>'),Dh=le('<dt class="text-fg-3 truncate svelte-gt9p7f"> </dt> <dd class="text-fg-1 break-words svelte-gt9p7f"><!></dd>',1),Gh=le('<aside class="absolute top-0 right-0 bottom-0 w-[340px] bg-bg-1 border-l border-line-2 shadow-2xl flex flex-col z-20 svelte-gt9p7f"><header class="flex items-center gap-2 px-3 py-2 border-b border-line-1 text-[11px] font-mono svelte-gt9p7f"><!> <span class="type-label svelte-gt9p7f"> </span> <span class="ml-auto svelte-gt9p7f"></span> <button type="button" aria-label="Close panel" class="text-fg-3 hover:text-fg-1 cursor-pointer svelte-gt9p7f"><!></button></header> <div class="flex-1 overflow-auto p-3 text-[12px] font-mono svelte-gt9p7f"><!> <div class="mt-3 mb-1 text-fg-3 text-[10px] uppercase tracking-wider svelte-gt9p7f">properties</div> <dl class="grid grid-cols-[110px_1fr] gap-x-2 gap-y-1 svelte-gt9p7f"></dl></div></aside>'),Ih=le('<button type="button"><span class="svelte-gt9p7f">●</span> <span class="svelte-gt9p7f"> </span> <span class="text-fg-3 svelte-gt9p7f"> </span></button>'),Th=le('<span class="text-fg-3 svelte-gt9p7f">types:</span> <!>',1),Rh=le('<span class="svelte-gt9p7f"><span class="text-fg-2 svelte-gt9p7f"> </span> <span class="text-fg-3 svelte-gt9p7f">·</span> </span>'),Oh=le('<div class="border-b border-line-1 px-3 py-1.5 flex items-center gap-2 text-[11px] font-mono bg-bg-1/40 svelte-gt9p7f"><div class="inline-flex border border-line-2 rounded overflow-hidden svelte-gt9p7f"><a><!> Canvas</a> <a><!> SVG</a> <a><!> Table</a></div> <!> <!> <!> <button type="button" title="Run a graph query (GRAPH NEIGHBORHOOD / SHORTEST_PATH / MATCH …)"><!> query</button> <!> <div class="ml-auto flex items-center gap-3 text-fg-3 svelte-gt9p7f"><span class="svelte-gt9p7f"> </span> <!> <!> <!></div></div> <!> <!> <div class="flex-1 min-h-0 relative svelte-gt9p7f"><!> <!></div> <div class="border-t border-line-1 px-3 py-1.5 text-[10px] font-mono text-fg-3 flex items-center gap-2 flex-wrap svelte-gt9p7f"><!> <span class="ml-auto svelte-gt9p7f"></span> <!></div>',1),Nh=le('<div class="flex h-full flex-col text-fg-1 svelte-gt9p7f"><!></div>');function op(n,e){ps(e,!0);let t=we(null);const r=re(()=>u(t)??e.result),i=re(()=>ef(u(r))),o=re(()=>Xd(u(i).nodes,u(i).edges)),s=re(()=>Zd(u(i).nodes,u(o))),a=re(()=>new Set(u(i).nodes.filter(w=>Ys(w,u(o))).map(w=>w.id)));let c=we("canvas"),l=we(25e3),d=we(""),f=we(null),h=we(null),g=we(null),y=we(350),E=we(1),b=we(!1),v=we(!1),A=we(Kt(new Set));const _=re(()=>u(f)?Yd(u(f),u(i).nodes,u(i).edges,u(o)):null);Pt(()=>{e.subpage==="svg"&&u(c)!=="svg"?z(c,"svg"):e.subpage==="graph"&&u(c)!=="canvas"&&z(c,"canvas")});let p=we(null),k=we(null),$=we(!1),S=we(""),G=we(!1),C=we(null),T=we(""),q=we("");async function N(w){const P=al.client;if(!(!P||!w.trim())){z(G,!0),z(C,null);try{const B=await Qt.track(`${e.collection??"graph"} · query (${w.slice(0,40).replace(/\s+/g," ")}…)`,()=>P.query(w));if(!B.ok){z(C,B.error??"query failed",!0);return}z(t,B,!0),z(f,null),z(h,null),Qe()}catch(B){z(C,B.message,!0)}finally{z(G,!1)}}}function m(){z(t,null),z(S,""),z(C,null),z(f,null),z(h,null),Qe()}function Le(){u(f)&&(z(S,`GRAPH NEIGHBORHOOD '${u(f).label}' DEPTH 1`),z($,!0),N(u(S)))}function Te(){z(S,"GRAPH CENTRALITY LIMIT 50"),z($,!0),N(u(S))}function O(w){u(f)&&(w==="from"?z(T,u(f).label,!0):z(q,u(f).label,!0),z($,!0))}function x(){!u(T).trim()||!u(q).trim()||(z(S,`GRAPH SHORTEST_PATH '${u(T).trim()}' TO '${u(q).trim()}'`),z($,!0),N(u(S)))}const K=re(()=>{const w=new Map;for(const P of u(i).nodes){const B=String(P.data.node_type??"node");w.set(B,(w.get(B)??0)+1)}return[...w.entries()].sort((P,B)=>B[1]-P[1])});let ee=we(Kt(new Set));const ne=re(()=>{const w=u(d).trim().toLowerCase();return u(i).nodes.filter(P=>{const B=String(P.data.node_type??"node");return u(ee).has(B)?!1:w?P.label.toLowerCase().includes(w)||P.id.toLowerCase().includes(w):!0}).sort((P,B)=>Jd(P,B,u(o)))}),Ie=re(()=>Math.min(u(ne).length,u(l))),ce=re(()=>u(ne).slice(0,Math.min(u(Ie),u(y)))),W=re(()=>new Set(u(ce).map(w=>w.id))),_e=re(()=>u(i).edges.filter(w=>u(W).has(w.source)&&u(W).has(w.target))),Ke=re(()=>u(ce).length<u(Ie)),Be=re(()=>u(ne).length>u(l));Pt(()=>{const w=u(Ie),P=u(c)==="canvas"?1e3:350,B=Math.min(w,P);if(z(y,B,!0),B>=w)return;let ke=!1,We=0,gt=B;const et=()=>{ke||(gt=Math.min(w,gt+P),z(y,gt,!0),gt<w&&(We=requestAnimationFrame(et)))};return We=requestAnimationFrame(et),()=>{ke=!0,cancelAnimationFrame(We)}});function Ye(w){const P=new Set(u(ee));P.has(w)?P.delete(w):P.add(w),z(ee,P,!0)}const ut=ff,Xe=hf;let ge=we(void 0),V=null,ye=null,ct=we(1),Y=we(0),Z=0,D=we(0),St=we(Kt([])),Ct=we(Kt([]));function Lt(w,P){const B=V;return B?B.graphToViewport({x:w,y:-P}):null}function Mt(){if(!u(b)||!V||u(c)!=="canvas"){u(St).length&&z(St,[],!0),u(Ct).length&&z(Ct,[],!0);return}const w=[];for(const B of u(tn)){const ke=Lt(B.minX,B.minY),We=Lt(B.maxX,B.maxY);!ke||!We||w.push({...B,vx:Math.min(ke.x,We.x),vy:Math.min(ke.y,We.y),vw:Math.abs(We.x-ke.x),vh:Math.abs(We.y-ke.y)})}const P=[];for(const B of u(rn)){const ke=Lt(B.x1,B.y1),We=Lt(B.x2,B.y2);!ke||!We||P.push({id:B.id,vx1:ke.x,vy1:ke.y,vx2:We.x,vy2:We.y})}z(St,w,!0),z(Ct,P,!0)}function Et(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}Bu(()=>{cancelAnimationFrame(Z),V&&(V.kill(),V=null)}),Fu(()=>{const w=new MutationObserver(()=>{z(D,u(D)+1)});return w.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>w.disconnect()});function wt(){z(f,null),z(h,null)}function Qe(){z(p,null),z(k,null)}function It(w){return u(i).nodes.find(P=>P.id===w)??null}function Vt(w){const P=It(w.nodeId);P&&(Yt(P),rr(P))}function rr(w){z(h,null),z(f,w,!0)}function Yt(w){z(k,w.id,!0),z(p,w.id,!0)}function sr(w){if(u(k)){Qe(),wt();return}Yt(w),rr(w)}function $t(w){z(f,null),z(h,w,!0)}function ar(w){return["id","rid","label","name","title","description","summary","content","exports","orphan","is_orphan","isOrphan","dead_code","deadCode"].includes(w)}function Xt(w,P){w.key!=="Enter"&&w.key!==" "||(w.preventDefault(),P())}function Ii(w){return Math.max(.5,Math.min(8,w))}const ra=re(()=>u(c)==="canvas"?Math.round(100/(u(ct)||1)):Math.round(u(E)*100));function Ti(w){if(u(c)==="canvas"){const B=V==null?void 0:V.getCamera();if(!B)return;w==="in"?B.animatedZoom(1.4):B.animatedUnzoom(1.4);return}const P=w==="in"?1.25:.8;z(E,Ii(u(E)*P),!0)}function na(){if(u(c)==="canvas"){V==null||V.getCamera().animatedReset();return}z(E,1)}function ia(w){w.preventDefault();const P=w.deltaY<0?1.25:.8;z(E,Ii(u(E)*P),!0)}const Ri=re(()=>{const w=new Map;for(const P of u(i).edges)P.label&&w.set(P.label,(w.get(P.label)??0)+1);return[...w.entries()].sort((P,B)=>B[1]-P[1]).slice(0,4)}),ur=re(()=>nf(u(ce),u(_e))),oa=re(()=>(u(D),typeof document>"u"?!0:document.documentElement.dataset.theme!=="light")),tn=re(()=>u(b)?gf(u(ce),u(ur),{dark:u(oa)}):[]),rn=re(()=>u(b)?vf(u(_e),u(ur),u(tn)):[]),sa=re(()=>new Set(u(rn).map(w=>w.id))),aa=re(()=>u(v)&&u(_e).length>fi);function ua(w){return w>800?{cycles:4,iterations:45}:w>300?{cycles:5,iterations:55}:{}}const kn=re(()=>{if(!u(v)||u(c)==="table"||u(_e).length===0||u(_e).length>fi)return null;const w=u(ce).map(P=>{const B=u(ur).get(P.id);return{id:P.id,x:(B==null?void 0:B.x)??50,y:(B==null?void 0:B.y)??50}});return Lf(w,u(_e).map(P=>({id:P.id,source:P.source,target:P.target})),ua(u(_e).length))}),Sn=re(()=>{if(!u(kn))return null;const w=new Map;for(const[P,B]of u(kn))w.set(P,-Gf(B));return w}),nn=re(()=>Tf(u(ce),u(_e),u(ur),u(A))),$n=re(()=>u(nn).nodes),on=re(()=>u(nn).edges),An=re(()=>u(nn).layout),Cn=re(()=>{const w=ta(u(ce),u(ur));return new Map([...w].map(([P,B])=>[P,B.length]))}),Ln=re(()=>[...u(Cn)].filter(([,w])=>w>=2).map(([w])=>w)),cr=re(()=>u(A).size>0);function ca(w){const P=new Set(u(A));P.add(w),z(A,P,!0),Qe()}function la(w){const P=new Set(u(A));P.delete(w),z(A,P,!0),Qe()}function da(){z(A,u(cr)?new Set:new Set(u(Ln)),!0),Qe(),wt()}const Cr=re(()=>{var w;return u(f)?((w=u(ur).get(u(f).id))==null?void 0:w.community)??null:null});Pt(()=>{u(f)&&u(nn).collapsedMembers.has(u(f).id)&&wt()});const Oi=re(()=>u($n).map(w=>{const P=String(w.data.node_type??"node"),B=u(s).get(w.id)??1,ke=u(An).get(w.id),We=w.data.__supernode===!0,gt=typeof w.data.__memberCount=="number"?w.data.__memberCount:0,et=ke?Di(ke.community):wn(P);return{...w,x:(ke==null?void 0:ke.x)??50,y:(ke==null?void 0:ke.y)??50,r:We?Zs(gt):Xs(P,B),color:et}})),Dn=re(()=>new Map(u(Oi).map(w=>[w.id,w]))),Gn=re(()=>{var P;const w=[];for(const B of u(on)){const ke=u(Dn).get(B.source),We=u(Dn).get(B.target);if(!ke||!We)continue;const gt=(P=u(kn))==null?void 0:P.get(B.id);let et,Ot=(ke.x+We.x)/2,Tt=(ke.y+We.y)/2;if(gt&&gt.length>2){et=gt.map(Dr=>`${Dr.x},${Dr.y}`).join(" ");const an=gt[Math.floor(gt.length/2)];Ot=an.x,Tt=an.y}w.push({...B,x1:ke.x,y1:ke.y,x2:We.x,y2:We.y,points:et,mx:Ot,my:Tt})}return w}),Pe=re(()=>u(k)??u(p)),sn=re(()=>{const w=new Set;if(!u(Pe))return w;for(const P of u(Gn))(P.source===u(Pe)||P.target===u(Pe))&&w.add(P.id);return w}),Jt=re(()=>{const w=new Set;if(!u(Pe))return w;w.add(u(Pe));for(const P of u(Gn))P.source===u(Pe)&&w.add(P.target),P.target===u(Pe)&&w.add(P.source);return w});Pt(()=>{const w=u(Pe);if(!w){z(Y,0);return}if(!u(Dn).has(w)){Qe();return}fa()});function fa(){if(cancelAnimationFrame(Z),Et()){z(Y,0);return}const w=performance.now();z(Y,1);const P=()=>{const B=Math.max(0,1-(performance.now()-w)/170);z(Y,B,!0),B>0&&(Z=requestAnimationFrame(P))};Z=requestAnimationFrame(P)}const ha=re(()=>`translate(50 50) scale(${u(E)}) translate(-50 -50)`);function Lr(w,P){return getComputedStyle(document.documentElement).getPropertyValue(w).trim()||P}function Ni(){const w=document.documentElement.dataset.theme!=="light";return{background:Lr("--color-bg-0",w?"#050607":"#ffffff"),edge:Lr("--color-line-3",w?"#3a424d":"#c9cbd1"),focusEdge:ut,focusNodeStroke:Xe,selectedNodeStroke:w?"#0a0a0b":"#18181b",nodeStroke:w?"#ffffff":"#27272a",warn:Lr("--color-warn",w?"#fbbf24":"#b45309")}}function Ui(){var w;return{focusId:u(Pe),focus:{nodes:u(Jt),edges:u(sn)},selectedNodeId:((w=u(f))==null?void 0:w.id)??null,pulse:u(Y),colors:Ni(),groupInBox:u(b),bundle:u(v)&&u(Sn)!==null}}function Pi(){return pf({nodes:u($n),edges:u(on),layout:u(An),sizeScales:u(s),orphanIds:u(a),dark:document.documentElement.dataset.theme!=="light",edgeColor:Ni().edge,bundledCurvatures:u(Sn)??void 0})}function pa(w){return u(on).find(P=>P.id===w)??null}function In(w){if(ea(w)){const B=If(w);B!==null&&la(B);return}const P=It(w);P&&sr(P)}function ga(w){w.on("clickNode",({node:B})=>{In(B)}),w.on("enterNode",({node:B})=>{u(k)||z(p,B,!0),u(ge)&&(u(ge).style.cursor="pointer")}),w.on("leaveNode",()=>{u(k)||z(p,null),u(ge)&&(u(ge).style.cursor="")}),w.on("clickEdge",({edge:B})=>{const ke=pa(B);ke&&(Qe(),$t(ke))}),w.on("clickStage",()=>{Qe(),wt()});const P=w.getCamera();P.on("updated",()=>{z(ct,P.ratio,!0)}),w.on("afterRender",()=>Mt())}Pt(()=>{if(u(c)!=="canvas")return;const w=u(ge);if(!w)return;let P=!1,B=null;return(async()=>{try{if(!ye){const[et,Ot,Tt]=await Promise.all([or(()=>import("./DV9PDoM3.js"),__vite__mapDeps([2,3]),import.meta.url),or(()=>import("./CXNPJgv1.js"),__vite__mapDeps([4,3]),import.meta.url),or(()=>import("./CDKIdLnm.js"),__vite__mapDeps([5,3]),import.meta.url)]);ye={Sigma:et.default,NodeBorderProgram:Ot.NodeBorderProgram,EdgeCurveProgram:Tt.default}}if(P||!u(ge))return;const{Sigma:ke,NodeBorderProgram:We,EdgeCurveProgram:gt}=ye;B=new ke(Pi(),w,{allowInvalidContainer:!0,defaultNodeType:"border",nodeProgramClasses:{border:We},edgeProgramClasses:{curved:gt},defaultEdgeType:"line",renderEdgeLabels:!0,labelFont:'"JetBrains Mono Variable", monospace',edgeLabelFont:'"JetBrains Mono Variable", monospace',labelSize:12,edgeLabelSize:10,labelWeight:"700",labelColor:{color:Lr("--color-fg-0","#ffffff")},edgeLabelColor:{color:"#f6d36b"},labelRenderedSizeThreshold:1/0,zIndex:!0,nodeReducer:(et,Ot)=>wf(et,Ot,Ui()),edgeReducer:(et,Ot)=>_f(et,Ot,Ui())}),ga(B),V=B,z(ct,B.getCamera().ratio,!0),z(g,null)}catch(ke){z(g,ke.message,!0)}})(),()=>{P=!0,B&&B.kill(),V===B&&(V=null)}}),Pt(()=>{u($n),u(on),u(An),u(s),u(a),u(D),u(Sn),u(v);const w=V;!w||u(c)!=="canvas"||(w.setSetting("labelColor",{color:Lr("--color-fg-0","#ffffff")}),w.setGraph(Pi()),w.refresh())}),Pt(()=>{u(Pe),u(Jt),u(sn),u(f),u(Y);const w=V;!w||u(c)!=="canvas"||w.refresh({skipIndexation:!0})}),Pt(()=>{u(b),u(tn),u(rn);const w=V;!w||u(c)!=="canvas"||(w.refresh({skipIndexation:!0}),Mt())});function va(w){u(k)||z(p,w.id,!0)}function ya(w){!u(k)&&u(p)===w.id&&z(p,null)}function Tn(w){return u(Pe)?u(Pe)===w.id?w.r*2.24:u(Jt).has(w.id)?w.r*1.6:w.r*.92:w.r*1.14}function ma(w){return u(Pe)?u(Jt).has(w.id)?1:.12:1}function ba(w){return w.data.__supernode===!0?!0:u(Pe)?u(Pe)===w.id?!0:u(Jt).size<=36&&u(Jt).has(w.id):!1}function wa(w){return!!(u(Pe)&&u(sn).has(w.id)&&w.label)}var Rn=Nh(),_a=I(Rn);{var xa=w=>{var P=Rf();M(w,P)},Ea=w=>{var P=Oh(),B=Ce(P),ke=I(B),We=I(ke),gt=I(We);So(gt,{class:"size-3"}),Nt(),L(We);var et=U(We,2),Ot=I(et);So(Ot,{class:"size-3"}),Nt(),L(et);var Tt=U(et,2),an=I(Tt);bl(an,{class:"size-3"}),Nt(),L(Tt),L(ke);var Dr=U(ke,2);{var ka=X=>{var Q=Nf(),te=Ce(Q),Se=I(te);yl(Se,{class:"size-3 text-fg-3"});var me=U(Se,2);Fn(me);var Re=U(me,2);{var be=je=>{var Je=Of(),At=I(Je);Ao(At,{class:"size-3"}),L(Je),Ae("click",Je,()=>z(d,"")),M(je,Je)};ve(Re,je=>{u(d)&&je(be)})}L(te);var De=U(te,2),he=I(De);hl(he,{class:"size-3"});var R=U(he,4),ie=I(R);ie.value=ie.__value=500;var J=U(ie);J.value=J.__value=1e3;var xe=U(J);xe.value=xe.__value=2e3;var oe=U(xe);oe.value=oe.__value=5e3;var de=U(oe);de.value=de.__value=1e4;var ae=U(de);ae.value=ae.__value=25e3;var Oe=U(ae);Oe.value=Oe.__value=5e4,L(R);var qe;Ku(R),L(De),fe(()=>{qe!==(qe=u(l))&&(R.value=(R.__value=u(l))??"",Hu(R,u(l)))}),cn(me,()=>u(d),je=>z(d,je)),Ae("change",R,je=>z(l,Number(je.currentTarget.value),!0)),M(X,Q)};ve(Dr,X=>{u(c)!=="table"&&X(ka)})}var zi=U(Dr,2);{var Sa=X=>{var Q=Uf(),te=I(Q),Se=I(te);_l(Se,{class:"size-3.5"}),L(te);var me=U(te,2),Re=I(me);L(me);var be=U(me,2),De=I(be);wl(De,{class:"size-3.5"}),L(be),L(Q),fe(()=>{te.disabled=u(c)==="svg"&&u(E)<=.5,ue(Re,`${u(ra)??""}%`),be.disabled=u(c)==="svg"&&u(E)>=8}),Ae("click",te,()=>Ti("out")),Ae("click",me,na),Ae("click",be,()=>Ti("in")),M(X,Q)};ve(zi,X=>{u(c)!=="table"&&X(Sa)})}var Mi=U(zi,2);{var $a=X=>{var Q=Mf(),te=Ce(Q),Se=I(te);ko(Se,{class:"size-3"}),Nt(),L(te);var me=U(te,2),Re=I(me);ml(Re,{class:"size-3"}),Nt(),L(me);var be=U(me,2);{var De=ie=>{var J=Pf(),xe=I(J);L(J),fe((oe,de)=>{F(J,"title",oe),ue(xe,`bundling skipped (${de??""} edges)`)},[()=>`Bundling is skipped above ${fi.toLocaleString()} drawn edges — narrow the filter or lower the limit`,()=>u(_e).length.toLocaleString()]),M(ie,J)};ve(be,ie=>{u(aa)&&ie(De)})}var he=U(be,2);{var R=ie=>{var J=zf(),xe=I(J);{var oe=Oe=>{ko(Oe,{class:"size-3"})},de=Oe=>{Eo(Oe,{class:"size-3"})};ve(xe,Oe=>{u(cr)?Oe(oe):Oe(de,-1)})}var ae=U(xe);L(J),fe(Oe=>{Ut(J,1,Oe,"svelte-gt9p7f"),F(J,"aria-pressed",u(cr)),F(J,"title",u(cr)?"Expand all collapsed clusters back to their members":"Collapse each community into a single supernode"),ue(ae,` ${u(cr)?`expand (${u(A).size})`:`collapse ${u(Ln).length} clusters`}`)},[()=>Bt(["inline-flex items-center gap-1 h-6 px-2 rounded border cursor-pointer transition-colors",u(cr)?"border-accent/40 bg-accent/10 text-accent":"border-line-1 text-fg-3 hover:text-fg-1 hover:border-line-2"].join(" "))]),Ae("click",J,da),M(ie,J)};ve(he,ie=>{u(Ln).length>0&&ie(R)})}fe((ie,J)=>{Ut(te,1,ie,"svelte-gt9p7f"),F(te,"aria-pressed",u(b)),Ut(me,1,J,"svelte-gt9p7f"),F(me,"aria-pressed",u(v))},[()=>Bt(["inline-flex items-center gap-1 h-6 px-2 rounded border cursor-pointer transition-colors",u(b)?"border-accent/40 bg-accent/10 text-accent":"border-line-1 text-fg-3 hover:text-fg-1 hover:border-line-2"].join(" ")),()=>Bt(["inline-flex items-center gap-1 h-6 px-2 rounded border cursor-pointer transition-colors",u(v)?"border-accent/40 bg-accent/10 text-accent":"border-line-1 text-fg-3 hover:text-fg-1 hover:border-line-2"].join(" "))]),Ae("click",te,()=>z(b,!u(b))),Ae("click",me,()=>z(v,!u(v))),M(X,Q)};ve(Mi,X=>{u(c)!=="table"&&X($a)})}var lr=U(Mi,2),Aa=I(lr);ll(Aa,{class:"size-3"}),Nt(),L(lr);var Wi=U(lr,2);{var Ca=X=>{var Q=Wf(),te=I(Q);gl(te,{class:"size-3"}),Nt(),L(Q),Ae("click",Q,m),M(X,Q)};ve(Wi,X=>{u(t)&&X(Ca)})}var ji=U(Wi,2),On=I(ji),La=I(On);L(On);var Bi=U(On,2);{var Da=X=>{var Q=jf(),te=I(Q);L(Q),fe((Se,me)=>ue(te,`rendering ${Se??""} / ${me??""}`),[()=>u(ce).length.toLocaleString(),()=>u(Ie).toLocaleString()]),M(X,Q)};ve(Bi,X=>{u(c)!=="table"&&u(Ke)&&X(Da)})}var Fi=U(Bi,2);{var Ga=X=>{var Q=Bf(),te=I(Q);L(Q),fe(Se=>ue(te,`drawing ${Se??""}`),[()=>u(ce).length.toLocaleString()]),M(X,Q)};ve(Fi,X=>{u(c)!=="table"&&u(Be)&&X(Ga)})}var Ia=U(Fi,2);{var Ta=X=>{var Q=Ff(),te=I(Q,!0);L(Q),fe(()=>ue(te,e.collection)),M(X,Q)};ve(Ia,X=>{e.collection&&X(Ta)})}L(ji),L(B);var Ki=U(B,2);{var Ra=X=>{var Q=Hf(),te=I(Q),Se=U(I(te),2),me=U(Se,2),Re=U(me,2),be=I(Re);vl(be,{class:"size-3"}),Nt(),L(Re),L(te);var De=U(te,2),he=I(De);Fn(he);var R=U(he,2);Fn(R);var ie=U(R,2),J=U(ie,2);L(De);var xe=U(De,2),oe=I(xe);Uu(oe);var de=U(oe,2),ae=I(de),Oe=I(ae);{var qe=Ue=>{fl(Ue,{class:"size-3 animate-spin"})},je=Ue=>{pl(Ue,{class:"size-3"})};ve(Oe,Ue=>{u(G)?Ue(qe):Ue(je,-1)})}Nt(2),L(ae),L(de),L(xe);var Je=U(xe,2);{var At=Ue=>{var Ne=Kf(),Ee=I(Ne,!0);L(Ne),fe(()=>ue(Ee,u(C))),M(Ue,Ne)};ve(Je,Ue=>{u(C)&&Ue(At)})}L(Q),fe((Ue,Ne)=>{Se.disabled=!u(f),F(Se,"title",u(f)?`neighborhood of ${u(f).label}`:"select a node first"),Re.disabled=Ue,ie.disabled=!u(f),F(ie,"title",u(f)?`Use ${u(f).label} as source`:"select a node first"),J.disabled=!u(f),F(J,"title",u(f)?`Use ${u(f).label} as target`:"select a node first"),F(oe,"placeholder",e.collection?`GRAPH NEIGHBORHOOD '<label>' DEPTH 2
403
+ GRAPH SHORTEST_PATH '<from>' TO '<to>'
404
+ MATCH (n)-[r]->(m) RETURN n, r, m LIMIT 100`:"GRAPH NEIGHBORHOOD … / GRAPH SHORTEST_PATH … / MATCH …"),ae.disabled=Ne},[()=>!u(T).trim()||!u(q).trim(),()=>u(G)||!u(S).trim()]),Ae("click",Se,Le),Ae("click",me,Te),Ae("click",Re,x),cn(he,()=>u(T),Ue=>z(T,Ue)),cn(R,()=>u(q),Ue=>z(q,Ue)),Ae("click",ie,()=>O("from")),Ae("click",J,()=>O("to")),Ae("keydown",oe,Ue=>{Ue.key==="Enter"&&(Ue.metaKey||Ue.ctrlKey)&&(Ue.preventDefault(),N(u(S)))}),cn(oe,()=>u(S),Ue=>z(S,Ue)),Ae("click",ae,()=>N(u(S))),M(X,Q)};ve(Ki,X=>{u($)&&X(Ra)})}var Hi=U(Ki,2);{var Oa=X=>{var Q=qf(),te=I(Q);$o(te,{class:"mt-0.5 size-3.5 shrink-0"});var Se=U(te,2),me=U(I(Se),2),Re=I(me,!0);L(me),L(Se),L(Q),fe(()=>ue(Re,u(g))),M(X,Q)};ve(Hi,X=>{u(g)&&X(Oa)})}var Nn=U(Hi,2),qi=I(Nn);{var Na=X=>{var Q=Jf(),te=Ce(Q);Wu(te,Re=>z(ge,Re),()=>u(ge));var Se=U(te,2);{var me=Re=>{var be=Xf(),De=I(be);yt(De,17,()=>u(St),R=>R.community,(R,ie)=>{var J=Vf();fe(()=>{F(J,"x",u(ie).vx),F(J,"y",u(ie).vy),F(J,"width",u(ie).vw),F(J,"height",u(ie).vh),F(J,"fill",u(ie).fill),F(J,"stroke",u(ie).stroke)}),M(R,J)});var he=U(De);yt(he,17,()=>u(Ct),R=>R.id,(R,ie)=>{var J=Yf();fe(()=>{F(J,"x1",u(ie).vx1),F(J,"y1",u(ie).vy1),F(J,"x2",u(ie).vx2),F(J,"y2",u(ie).vy2)}),M(R,J)}),L(be),M(Re,be)};ve(Se,Re=>{u(b)&&(u(St).length>0||u(Ct).length>0)&&Re(me)})}fe(()=>F(te,"aria-label",`${u(ce).length} graph nodes and ${u(_e).length} graph edges`)),Ae("keydown",te,Re=>{Re.key==="Escape"&&(Qe(),wt())}),M(X,Q)},Ua=X=>{var Q=uh(),te=I(Q),Se=U(I(te)),me=I(Se);{var Re=he=>{var R=eh(),ie=I(R);yt(ie,17,()=>u(tn),xe=>xe.community,(xe,oe)=>{var de=Zf();fe(()=>{F(de,"x",u(oe).minX),F(de,"y",u(oe).minY),F(de,"width",u(oe).maxX-u(oe).minX),F(de,"height",u(oe).maxY-u(oe).minY),F(de,"fill",u(oe).fill),F(de,"stroke",u(oe).stroke)}),M(xe,de)});var J=U(ie);yt(J,17,()=>u(rn),xe=>xe.id,(xe,oe)=>{var de=Qf();fe(()=>{F(de,"x1",u(oe).x1),F(de,"y1",u(oe).y1),F(de,"x2",u(oe).x2),F(de,"y2",u(oe).y2)}),M(xe,de)}),L(R),M(he,R)};ve(me,he=>{u(b)&&he(Re)})}var be=U(me);yt(be,21,()=>u(Gn),he=>he.id,(he,R)=>{var ie=He(),J=Ce(ie);{var xe=de=>{const ae=re(()=>u(sn).has(u(R).id));var Oe=ih(),qe=Ce(Oe);{var je=Ee=>{var pe=th(),rt=I(pe),lt=I(rt);L(rt),L(pe),fe(()=>{F(pe,"points",u(R).points),F(pe,"stroke",u(Pe)&&u(ae)?ut:"currentColor"),F(pe,"stroke-width",u(Pe)?u(ae)?"0.27":"0.055":"0.105"),F(pe,"opacity",u(Pe)?u(ae)?"0.98":"0.07":"0.4"),F(pe,"aria-label",`${u(R).label??"edge"} from ${u(R).source} to ${u(R).target}`),ue(lt,`${u(R).label??"edge"??""}: ${u(R).source??""} -> ${u(R).target??""}`)}),Ae("click",pe,_t=>{_t.stopPropagation(),Qe(),$t(u(R))}),Ae("keydown",pe,_t=>Xt(_t,()=>{Qe(),$t(u(R))})),M(Ee,pe)},Je=Ee=>{var pe=rh(),rt=I(pe),lt=I(rt);L(rt),L(pe),fe(()=>{F(pe,"x1",u(R).x1),F(pe,"y1",u(R).y1),F(pe,"x2",u(R).x2),F(pe,"y2",u(R).y2),F(pe,"stroke",u(Pe)&&u(ae)?ut:"currentColor"),F(pe,"stroke-width",u(Pe)?u(ae)?"0.27":"0.055":"0.105"),F(pe,"opacity",u(Pe)?u(ae)?"0.98":"0.055":"0.36"),F(pe,"aria-label",`${u(R).label??"edge"} from ${u(R).source} to ${u(R).target}`),ue(lt,`${u(R).label??"edge"??""}: ${u(R).source??""} -> ${u(R).target??""}`)}),Ae("click",pe,_t=>{_t.stopPropagation(),Qe(),$t(u(R))}),Ae("keydown",pe,_t=>Xt(_t,()=>{Qe(),$t(u(R))})),M(Ee,pe)};ve(qe,Ee=>{u(R).points?Ee(je):Ee(Je,-1)})}var At=U(qe);{var Ue=Ee=>{var pe=nh(),rt=I(pe,!0);L(pe),fe(lt=>{F(pe,"x",u(R).mx+.45),F(pe,"y",u(R).my-.45),ue(rt,lt)},[()=>{var lt;return(lt=u(R).label)==null?void 0:lt.slice(0,28)}]),M(Ee,pe)},Ne=re(()=>wa(u(R)));ve(At,Ee=>{u(Ne)&&Ee(Ue)})}M(de,Oe)},oe=re(()=>!(u(b)&&u(sa).has(u(R).id)));ve(J,de=>{u(oe)&&de(xe)})}M(he,ie)}),L(be);var De=U(be);yt(De,21,()=>u(Oi),he=>he.id,(he,R)=>{const ie=re(()=>u(a).has(u(R).id)),J=re(()=>u(R).data.__supernode===!0);var xe=ah(),oe=Ce(xe);{var de=Ne=>{var Ee=oh();fe((pe,rt)=>{F(Ee,"cx",u(R).x),F(Ee,"cy",u(R).y),F(Ee,"r",pe),F(Ee,"stroke-width",u(Pe)===u(R).id?"0.38":"0.24"),F(Ee,"opacity",rt)},[()=>Tn(u(R))+.65,()=>u(Pe)&&!u(Jt).has(u(R).id)?"0.16":"0.72"]),M(Ne,Ee)};ve(oe,Ne=>{u(ie)&&Ne(de)})}var ae=U(oe);let Oe;var qe=I(ae),je=I(qe,!0);L(qe),L(ae);var Je=U(ae);{var At=Ne=>{var Ee=sh(),pe=I(Ee,!0);L(Ee),fe((rt,lt)=>{F(Ee,"x",rt),F(Ee,"y",u(R).y+.15),F(Ee,"fill",u(Pe)===u(R).id?"#f8fafc":"#cbd5e1"),F(Ee,"opacity",u(Pe)===u(R).id?"1":"0.9"),F(Ee,"font-size",u(Pe)===u(R).id?"1.35":"1.15"),F(Ee,"font-weight",u(Pe)===u(R).id?"700":"600"),F(Ee,"stroke-width",u(Pe)===u(R).id?"0.48":"0.38"),ue(pe,lt)},[()=>u(R).x+Tn(u(R))+.85,()=>u(R).label.slice(0,36)]),M(Ne,Ee)},Ue=re(()=>ba(u(R)));ve(Je,Ne=>{u(Ue)&&Ne(At)})}fe((Ne,Ee,pe)=>{var rt;F(ae,"cx",u(R).x),F(ae,"cy",u(R).y),F(ae,"r",Ne),F(ae,"fill",u(R).color),F(ae,"opacity",Ee),F(ae,"stroke",u(Pe)===u(R).id?Xe:u(J)?"#e2e8f0":((rt=u(f))==null?void 0:rt.id)===u(R).id?"#0a0a0b":u(ie)?"var(--color-warn)":"#ffffff"),F(ae,"stroke-width",pe),Oe=Ut(ae,0,"cursor-pointer graph-node svelte-gt9p7f",null,Oe,{"focus-primary":u(Pe)===u(R).id}),F(ae,"aria-label",u(J)?`${u(R).label} — click to expand`:u(R).label),ue(je,u(J)?`${u(R).label} — click to expand`:u(R).label)},[()=>Tn(u(R)),()=>ma(u(R)),()=>{var Ne;return u(Pe)===u(R).id?"0.55":u(J)?"0.5":u(Jt).has(u(R).id)?"0.22":((Ne=u(f))==null?void 0:Ne.id)===u(R).id||u(ie)?"0.4":"0.14"}]),jn("pointerenter",ae,()=>va(u(R))),jn("pointerleave",ae,()=>ya(u(R))),Ae("click",ae,Ne=>{Ne.stopPropagation(),In(u(R).id)}),Ae("keydown",ae,Ne=>Xt(Ne,()=>In(u(R).id))),M(he,xe)}),L(De),L(Se),L(te),L(Q),fe(()=>{F(te,"aria-label",`${u(ce).length} graph nodes and ${u(_e).length} graph edges`),F(Se,"transform",u(ha))}),jn("wheel",te,ia),Ae("click",te,()=>{Qe(),wt()}),Ae("keydown",te,he=>{he.key==="Escape"&&(Qe(),wt())}),M(X,Q)},Pa=X=>{var Q=fh(),te=I(Q),Se=U(I(te)),me=I(Se);yt(me,17,()=>u(i).nodes,be=>be.id,(be,De)=>{const he=re(()=>u(a).has(u(De).id));var R=lh(),ie=U(I(R)),J=I(ie,!0);L(ie);var xe=U(ie),oe=I(xe,!0);L(xe);var de=U(xe),ae=I(de),Oe=U(ae);{var qe=je=>{var Je=ch();M(je,Je)};ve(Oe,je=>{u(he)&&je(qe)})}L(de),L(R),fe((je,Je)=>{Ut(R,1,je,"svelte-gt9p7f"),ue(J,u(De).id),ue(oe,u(De).label),ue(ae,`${Je??""} `)},[()=>Bt(["border-b border-line-1/60 hover:bg-bg-1/40 cursor-pointer",u(he)?"bg-warn/10":""].join(" ")),()=>String(u(De).data.node_type??"")]),Ae("click",R,()=>{z(h,null),z(f,u(De),!0)}),M(be,R)});var Re=U(me);yt(Re,17,()=>u(i).edges,be=>be.id,(be,De)=>{var he=dh(),R=U(I(he)),ie=I(R,!0);L(R);var J=U(R),xe=I(J,!0);L(J);var oe=U(J),de=I(oe);L(oe),L(he),fe(()=>{ue(ie,u(De).id),ue(xe,u(De).label??""),ue(de,`${u(De).source??""} → ${u(De).target??""}`)}),Ae("click",he,()=>{z(f,null),z(h,u(De),!0)}),M(be,he)}),L(Se),L(te),L(Q),M(X,Q)};ve(qi,X=>{u(c)==="canvas"?X(Na):u(c)==="svg"?X(Ua,1):X(Pa,-1)})}var za=U(qi,2);{var Ma=X=>{var Q=Gh(),te=I(Q),Se=I(te);dl(Se,{class:"size-3.5 text-accent"});var me=U(Se,2),Re=I(me,!0);L(me);var be=U(me,4),De=I(be);Ao(De,{class:"size-3.5"}),L(be),L(te);var he=U(te,2),R=I(he);{var ie=oe=>{var de=Sh(),ae=Ce(de),Oe=I(ae),qe=I(Oe),je=U(I(qe),2),Je=I(je,!0);L(je),L(qe);var At=U(qe,2);{var Ue=$e=>{var ze=hh(),vt=I(ze);$o(vt,{class:"size-3"}),Nt(),L(ze),M($e,ze)};ve(At,$e=>{u(_).orphan&&$e(Ue)})}L(Oe);var Ne=U(Oe,2),Ee=I(Ne,!0);L(Ne);var pe=U(Ne,2);{var rt=$e=>{var ze=ph(),vt=I(ze);Eo(vt,{class:"size-3"});var ft=U(vt);L(ze),fe(at=>ue(ft,` collapse cluster ${u(Cr)??""} · ${at??""} nodes`),[()=>u(Cn).get(u(Cr))]),Ae("click",ze,()=>ca(u(Cr))),M($e,ze)},lt=re(()=>u(Cr)!==null&&(u(Cn).get(u(Cr))??0)>=2);ve(pe,$e=>{u(lt)&&$e(rt)})}L(ae);var _t=U(ae,2),dr=U(I(_t),2),dt=I(dr,!0);L(dr),L(_t);var Ve=U(_t,2),st=I(Ve),fr=U(I(st),2),Un=I(fr,!0);L(fr),L(st);var Fa=U(st,2);{var Ka=$e=>{var ze=vh();yt(ze,21,()=>u(_).exports,yn,(vt,ft)=>{var at=gh(),xt=I(at,!0);L(at),fe(()=>ue(xt,u(ft))),M(vt,at)}),L(ze),M($e,ze)},Ha=$e=>{var ze=yh();M($e,ze)};ve(Fa,$e=>{u(_).exports.length>0?$e(Ka):$e(Ha,-1)})}L(Ve);var Pn=U(Ve,2),zn=I(Pn),Xi=U(I(zn),2),qa=I(Xi);L(Xi),L(zn);var Va=U(zn,2);{var Ya=$e=>{var ze=bh();yt(ze,21,()=>u(_).whereUsed,vt=>vt.id,(vt,ft)=>{var at=mh(),xt=I(at),Wt=I(xt,!0);L(xt);var hr=U(xt,2),jt=I(hr),Gr=I(jt,!0);L(jt);var eo=U(jt,2),nu=I(eo,!0);L(eo),L(hr),L(at),fe(()=>{ue(Wt,u(ft).label),ue(Gr,u(ft).nodeLabel),ue(nu,u(ft).edgeLabel??u(ft).kind)}),Ae("click",at,()=>Vt(u(ft))),M(vt,at)}),L(ze),M($e,ze)},Xa=$e=>{var ze=wh();M($e,ze)};ve(Va,$e=>{u(_).whereUsed.length>0?$e(Ya):$e(Xa,-1)})}L(Pn);var Ji=U(Pn,2),Zi=U(I(Ji),2),Mn=I(Zi),Ja=I(Mn);{var Za=$e=>{var ze=He(),vt=Ce(ze);yt(vt,17,()=>u(_).incoming,ft=>ft.id,(ft,at)=>{var xt=_h(),Wt=I(xt),hr=I(Wt,!0);L(Wt);var jt=U(Wt,2),Gr=I(jt,!0);L(jt),L(xt),fe(()=>{ue(hr,u(at).label),ue(Gr,u(at).nodeLabel)}),Ae("click",xt,()=>Vt(u(at))),M(ft,xt)}),M($e,ze)},Qa=$e=>{var ze=xh();M($e,ze)};ve(Ja,$e=>{u(_).incoming.length>0?$e(Za):$e(Qa,-1)})}L(Mn);var Qi=U(Mn,2),eu=I(Qi);{var tu=$e=>{var ze=He(),vt=Ce(ze);yt(vt,17,()=>u(_).outgoing,ft=>ft.id,(ft,at)=>{var xt=Eh(),Wt=I(xt),hr=I(Wt,!0);L(Wt);var jt=U(Wt,2),Gr=I(jt,!0);L(jt),L(xt),fe(()=>{ue(hr,u(at).label),ue(Gr,u(at).nodeLabel)}),Ae("click",xt,()=>Vt(u(at))),M(ft,xt)}),M($e,ze)},ru=$e=>{var ze=kh();M($e,ze)};ve(eu,$e=>{u(_).outgoing.length>0?$e(tu):$e(ru,-1)})}L(Qi),L(Zi),L(Ji),fe(($e,ze,vt)=>{ue(Je,u(f).label),ue(Ee,$e),ue(dt,u(_).description??"No description in graph contract."),ue(Un,ze),ue(qa,`${vt??""} inbound`)},[()=>String(u(f).data.rid??u(f).id),()=>u(_).exports.length.toLocaleString(),()=>u(_).whereUsed.length.toLocaleString()]),M(oe,de)},J=oe=>{var de=Ch(),ae=Ce(de),Oe=U(I(ae),2),qe=I(Oe,!0);L(Oe),L(ae);var je=U(ae,2),Je=U(I(je),2),At=I(Je);{var Ue=dt=>{var Ve=Bn();fe(st=>ue(Ve,st),[()=>It(u(h).source).label]),M(dt,Ve)},Ne=re(()=>It(u(h).source)),Ee=dt=>{var Ve=$h(),st=I(Ve,!0);L(Ve),fe(()=>ue(st,u(h).source)),M(dt,Ve)};ve(At,dt=>{u(Ne)?dt(Ue):dt(Ee,-1)})}L(Je);var pe=U(Je,4),rt=I(pe);{var lt=dt=>{var Ve=Bn();fe(st=>ue(Ve,st),[()=>It(u(h).target).label]),M(dt,Ve)},_t=re(()=>It(u(h).target)),dr=dt=>{var Ve=Ah(),st=I(Ve,!0);L(Ve),fe(()=>ue(st,u(h).target)),M(dt,Ve)};ve(rt,dt=>{u(_t)?dt(lt):dt(dr,-1)})}L(pe),L(je),fe(()=>ue(qe,u(h).label??"(unlabelled)")),M(oe,de)};ve(R,oe=>{u(f)&&u(_)?oe(ie):u(h)&&oe(J,1)})}var xe=U(R,4);yt(xe,21,()=>{var oe;return Object.entries((u(f)?u(f).data:(oe=u(h))==null?void 0:oe.data)??{})},yn,(oe,de)=>{var ae=re(()=>vn(u(de),2));let Oe=()=>u(ae)[0],qe=()=>u(ae)[1];var je=He(),Je=Ce(je);{var At=Ne=>{var Ee=Dh(),pe=Ce(Ee),rt=I(pe,!0);L(pe);var lt=U(pe,2),_t=I(lt);{var dr=Ve=>{var st=Lh(),fr=I(st,!0);L(st),fe(Un=>ue(fr,Un),[()=>JSON.stringify(qe(),null,2)]),M(Ve,st)},dt=Ve=>{var st=Bn();fe(fr=>ue(st,fr),[()=>String(qe())]),M(Ve,st)};ve(_t,Ve=>{typeof qe()=="object"?Ve(dr):Ve(dt,-1)})}L(lt),fe(()=>ue(rt,Oe())),M(Ne,Ee)},Ue=re(()=>qe()!==null&&qe()!==void 0&&!(u(f)&&ar(Oe()))&&!(u(h)&&Oe()==="label"));ve(Je,Ne=>{u(Ue)&&Ne(At)})}M(oe,je)}),L(xe),L(he),L(Q),fe(()=>ue(Re,u(f)?"Node":"Edge")),Ae("click",be,()=>{Qe(),wt()}),M(X,Q)};ve(za,X=>{(u(f)||u(h))&&X(Ma)})}L(Nn);var Vi=U(Nn,2),Yi=I(Vi);{var Wa=X=>{var Q=Th(),te=U(Ce(Q),2);yt(te,17,()=>u(K),([Se,me])=>Se,(Se,me)=>{var Re=re(()=>vn(u(me),2));let be=()=>u(Re)[0],De=()=>u(Re)[1];const he=re(()=>u(ee).has(be()));var R=Ih(),ie=I(R);let J;var xe=U(ie,2),oe=I(xe,!0);L(xe);var de=U(xe,2),ae=I(de,!0);L(de),L(R),fe((Oe,qe,je)=>{F(R,"title",u(he)?`Show ${be()}`:`Hide ${be()}`),Ut(R,1,Oe,"svelte-gt9p7f"),J=qu(ie,"",J,qe),ue(oe,be()),ue(ae,je)},[()=>Bt(["inline-flex items-center gap-1 px-1.5 py-0.5 rounded border transition-colors cursor-pointer",u(he)?"border-line-1 text-fg-3 line-through opacity-60":"border-line-2 text-fg-1 hover:border-accent"].join(" ")),()=>({color:u(he)?void 0:wn(be())}),()=>De().toLocaleString()]),Ae("click",R,()=>Ye(be())),M(Se,R)}),M(X,Q)};ve(Yi,X=>{u(K).length>1&&X(Wa)})}var ja=U(Yi,4);{var Ba=X=>{var Q=He(),te=Ce(Q);yt(te,17,()=>u(Ri),yn,(Se,me)=>{var Re=re(()=>vn(u(me),2));let be=()=>u(Re)[0],De=()=>u(Re)[1];var he=Rh(),R=I(he),ie=I(R,!0);L(R);var J=U(R,3);L(he),fe(xe=>{ue(ie,be()),ue(J,` ${xe??""}`)},[()=>De().toLocaleString()]),M(Se,he)}),M(X,Q)};ve(ja,X=>{u(Ri).length>0&&X(Ba)})}L(Vi),fe((X,Q,te,Se,me,Re,be,De,he)=>{F(We,"href",X),Ut(We,1,Q,"svelte-gt9p7f"),F(We,"aria-current",u(c)==="canvas"?"page":void 0),F(et,"href",te),Ut(et,1,Se,"svelte-gt9p7f"),F(et,"aria-current",u(c)==="svg"?"page":void 0),F(Tt,"href",me),Ut(Tt,1,Re,"svelte-gt9p7f"),F(Tt,"aria-current",u(c)==="table"?"page":void 0),Ut(lr,1,be,"svelte-gt9p7f"),F(lr,"aria-pressed",u($)),ue(La,`${De??""} nodes · ${he??""} edges`)},[()=>e.collection?Yn(e.collection,"graph"):void 0,()=>Bt(["inline-flex items-center gap-1 px-2 py-1 text-[11px] cursor-pointer transition-colors",u(c)==="canvas"?"bg-accent text-white":"bg-bg-1 text-fg-2 hover:text-fg-0"].join(" ")),()=>e.collection?Yn(e.collection,"svg"):void 0,()=>Bt(["inline-flex items-center gap-1 px-2 py-1 text-[11px] cursor-pointer transition-colors border-l border-line-2",u(c)==="svg"?"bg-accent text-white":"bg-bg-1 text-fg-2 hover:text-fg-0"].join(" ")),()=>e.collection?Yn(e.collection,"table"):void 0,()=>Bt(["inline-flex items-center gap-1 px-2 py-1 text-[11px] cursor-pointer transition-colors border-l border-line-2",u(c)==="table"?"bg-accent text-white":"bg-bg-1 text-fg-2 hover:text-fg-0"].join(" ")),()=>Bt(["inline-flex items-center gap-1 h-6 px-2 rounded border cursor-pointer transition-colors",u($)?"border-accent/40 bg-accent/10 text-accent":"border-line-1 text-fg-3 hover:text-fg-1 hover:border-line-2"].join(" ")),()=>u(i).nodes.length.toLocaleString(),()=>u(i).edges.length.toLocaleString()]),Ae("click",We,()=>{e.collection||z(c,"canvas")}),Ae("click",et,()=>{e.collection||z(c,"svg")}),Ae("click",Tt,()=>{e.collection||z(c,"table")}),Ae("click",lr,()=>z($,!u($))),M(w,P)};ve(_a,w=>{u(i).nodes.length===0&&u(i).edges.length===0?w(xa):w(Ea,-1)})}L(Rn),M(n,Rn),gs()}Mu(["click","change","keydown"]);var Uh=le('<p class="text-fg-2 text-[13px] m-0 max-w-md leading-relaxed"> </p>'),Ph=le('<code class="font-mono text-[11px] text-fg-3 mt-3 px-2 py-1 bg-bg-2 border border-line-1 rounded"> </code>'),zh=le('<div class="flex items-center gap-2 mt-5"><!></div>'),Mh=le('<div class="flex flex-col items-center justify-center text-center py-16 px-6 min-h-[280px] bg-bg-1 border border-line-1 border-dashed rounded-lg"><!> <h2 class="type-h2 m-0 mb-2"> </h2> <!> <!> <!></div>');function sp(n,e){var t=Mh(),r=I(t);{var i=g=>{var y=He(),E=Ce(y);ju(E,()=>e.icon,(b,v)=>{v(b,{class:"size-9 text-fg-3 mb-4",strokeWidth:1.4})}),M(g,y)};ve(r,g=>{e.icon&&g(i)})}var o=U(r,2),s=I(o,!0);L(o);var a=U(o,2);{var c=g=>{var y=Uh(),E=I(y,!0);L(y),fe(()=>ue(E,e.message)),M(g,y)};ve(a,g=>{e.message&&g(c)})}var l=U(a,2);{var d=g=>{var y=Ph(),E=I(y,!0);L(y),fe(()=>ue(E,e.hint)),M(g,y)};ve(l,g=>{e.hint&&g(d)})}var f=U(l,2);{var h=g=>{var y=zh(),E=I(y);Ju(E,()=>e.actions),L(y),M(g,y)};ve(f,g=>{e.actions&&g(h)})}L(t),fe(()=>ue(s,e.title)),M(n,t)}export{sp as E,Qh as F,op as G,it as I,ep as L,So as N,$s as P,ys as R,yl as S,bl as T,Ao as X,dl as a,tp as b,fl as c,pl as d,gl as e,$o as f,Qt as g,Yn as h,Di as i,al as j,rp as k,yt as l,El as m,_i as n,ip as o,yn as p,Qu as q,xo as r,En as s,Jh as t,Xh as u,Mr as v,Zh as w,tt as x,Ju as y,np as z};