@reddb-io/ui 0.3.6 → 0.4.0
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.
- package/build/_app/immutable/chunks/Bf0kgHHV.js +1 -0
- package/build/_app/immutable/chunks/{CgeUbXx3.js → CQUazLlV.js} +1 -1
- package/build/_app/immutable/chunks/{DXJnbMgi.js → DEXJoNrJ.js} +5 -5
- package/build/_app/immutable/chunks/{Cznn1SM_.js → DkihsTT_.js} +1 -1
- package/build/_app/immutable/chunks/DxlrWGyf.js +35 -0
- package/build/_app/immutable/chunks/{bWMB_8ZZ.js → kA3Jql_0.js} +1 -1
- package/build/_app/immutable/entry/{app.CnZytEwL.js → app.DsWyVHHY.js} +2 -2
- package/build/_app/immutable/entry/start.JTS2dMkh.js +1 -0
- package/build/_app/immutable/nodes/{0.IUeUbFYR.js → 0.B3B9dr1W.js} +1 -1
- package/build/_app/immutable/nodes/{1.ppCNgQoG.js → 1.BRHK3-aW.js} +1 -1
- package/build/_app/immutable/nodes/{10.PFTL9me3.js → 10.DO83djGy.js} +1 -1
- package/build/_app/immutable/nodes/{15.CveXa_3e.js → 15.BMQezBh7.js} +1 -1
- package/build/_app/version.json +1 -1
- package/build/index.html +11 -10
- package/dist/embed/{AnalyticsView-Bwa627Xe.js → AnalyticsView-C_h8ScpB.js} +4 -4
- package/dist/embed/{AnalyticsView-Bwa627Xe.js.map → AnalyticsView-C_h8ScpB.js.map} +1 -1
- package/dist/embed/{RedUiEmbedRoot-DWA6FS7Q.js → RedUiEmbedRoot-BlduSCNM.js} +7385 -7284
- package/dist/embed/RedUiEmbedRoot-BlduSCNM.js.map +1 -0
- package/dist/embed/{index-W_9pCMZk.js → index-BSBRHtH4.js} +4 -4
- package/dist/embed/{index-W_9pCMZk.js.map → index-BSBRHtH4.js.map} +1 -1
- package/dist/embed/{index-client-CXG6tBhB.js → index-client-DelkELqi.js} +2 -2
- package/dist/embed/{index-client-CXG6tBhB.js.map → index-client-DelkELqi.js.map} +1 -1
- package/dist/embed/index.js +1 -1
- package/dist/embed/{sigma.esm-BtRwWMN5.js → sigma.esm-D9VpQHRm.js} +2 -2
- package/dist/embed/{sigma.esm-BtRwWMN5.js.map → sigma.esm-D9VpQHRm.js.map} +1 -1
- package/package.json +3 -3
- package/src/lib/ConnectDropdown.svelte +4 -4
- package/src/lib/Workspace.svelte +2 -2
- package/src/lib/connections.svelte.ts +72 -38
- package/src/lib/reddb/boot-params.ts +30 -27
- package/src/lib/reddb/connection-bootstrap.ts +62 -19
- package/src/lib/reddb/connection-string.ts +108 -0
- package/src/lib/reddb/index.ts +2 -0
- package/build/_app/immutable/chunks/1hmJRUuc.js +0 -35
- package/build/_app/immutable/chunks/B1QR04ZE.js +0 -1
- package/build/_app/immutable/entry/start.Br592ucD.js +0 -1
- package/dist/embed/RedUiEmbedRoot-DWA6FS7Q.js.map +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./B5euRbKa.js","./DhEqZVGG.js","./C-kqMbRi.js","./kA3Jql_0.js","./DqvWKbSc.js","./CXNPJgv1.js","./CDKIdLnm.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var du=Object.defineProperty;var cs=r=>{throw TypeError(r)};var fu=(r,e,t)=>e in r?du(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Te=(r,e,t)=>fu(r,typeof e!="symbol"?e+"":e,t),ls=(r,e,t)=>e.has(r)||cs("Cannot "+t);var xe=(r,e,t)=>(ls(r,e,"read from private field"),t?t.call(r):e.get(r)),nt=(r,e,t)=>e.has(r)?cs("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t);var us=(r,e,t)=>(ls(r,e,"access private method"),t);import{_ as fr,p as Gt,r as Ze,s as it,c as hu,b as pu}from"./CN4cKZHK.js";import"./Bzak7iHL.js";import{o as gu,a as mu}from"./Btd6PFkC.js";import{a2 as vo,aF as St,aD as no,at as u,bb as vu,s as yu,bx as ds,br as Mr,bs as sn,aE as br,f as bu,p as wu,aK as fs,ac as _u,ab as Fn,l as Vt,a3 as io,ak as xu,bv as ku,ai as Eu,aO as Su,a0 as yo,k as Cu,j as Au,b0 as $u,by as hs,E as Du,D as Iu,bh as Sa,b5 as Ca,I as Si,d as Lu,a7 as Tu,a$ as Gu,aj as Ru,ay as Aa,ba as Ou,az as zu,i as $a,h as Mu,n as Da,o as Nu,aa as Pu,x as Uu,Y as Wu,bF as ju,bz as Ee,bm as N,b8 as Kt,bK as Qt,av as Bu,b9 as ri,b6 as ni,a6 as R,aq as lt,bw as P,b3 as Fu,bg as T,bN as Q,ap as Vu,bI as an,bO as Zt,bG as pe,b2 as Bt,be as Ku}from"./CGFL56WJ.js";import{b as Hu,o as qu,u as Tn,a as V,l as At,e as er,v as fe,k as he,h as Yu,i as Ne,j as Ci,x as Ai}from"./nuKvOE41.js";import{B as Ia,i as ke}from"./DCJ0QyYH.js";import{a as qn,e as Dt,j as Et,g as H,r as $i,i as Xu,s as Ju,d as Gn,k as Zu}from"./BRBZjpE2.js";function Vn(r,e){return e}function Qu(r,e,t){for(var n=[],i=e.length,o,a=e.length,s=0;s<i;s++){let f=e[s];Ca(f,()=>{if(o){if(o.pending.delete(f),o.done.add(f),o.pending.size===0){var h=r.outrogroups;oo(r,yo(o.done)),h.delete(o),h.size===0&&(r.outrogroups=null)}}else a-=1},!1)}if(a===0){var c=n.length===0&&t!==null;if(c){var l=t,d=l.parentNode;Tu(d),d.append(l),r.items.clear()}oo(r,e,!c)}else o={pending:new Set(e),done:new Set},(r.outrogroups??(r.outrogroups=new Set)).add(o)}function oo(r,e,t=!0){var n;if(r.pending.size>0){n=new Set;for(const a of r.pending.values())for(const s of a)n.add(r.items.get(s).e)}for(var i=0;i<e.length;i++){var o=e[i];if(n!=null&&n.has(o)){o.f|=Vt;const a=document.createDocumentFragment();Gu(o,a)}else Ru(e[i],t)}}var ps;function bt(r,e,t,n,i,o=null){var a=r,s=new Map,c=(e&$a)!==0;if(c){var l=r;a=St?Mr(Aa(l)):l.appendChild(Fn())}St&&no();var d=null,f=Eu(()=>{var v=t();return Su(v)?v:v==null?[]:yo(v)}),h,g=new Map,y=!0;function C(v){(A.effect.f&Iu)===0&&(A.pending.delete(v),A.fallback=d,ed(A,h,a,e,n),d!==null&&(h.length===0?(d.f&Vt)===0?Sa(d):(d.f^=Vt,rn(d,null,a)):Ca(d,()=>{d=null})))}function b(v){A.pending.delete(v)}var m=vo(()=>{h=u(f);var v=h.length;let p=!1;if(St){var E=vu(a)===yu;E!==(v===0)&&(a=ds(),Mr(a),sn(!1),p=!0)}for(var S=new Set,$=_u,x=ku(),D=0;D<v;D+=1){St&&br.nodeType===bu&&br.data===wu&&(a=br,p=!0,sn(!1));var I=h[D],j=n(I,D),O=y?null:s.get(j);O?(O.v&&fs(O.v,I),O.i&&fs(O.i,D),x&&$.unskip_effect(O.e)):(O=td(s,y?a:ps??(ps=Fn()),I,j,D,i,e,t),y||(O.e.f|=Vt),s.set(j,O)),S.add(j)}if(v===0&&o&&!d&&(y?d=io(()=>o(a)):(d=io(()=>o(ps??(ps=Fn()))),d.f|=Vt)),v>S.size&&xu(),St&&v>0&&Mr(ds()),!y)if(g.set($,S),x){for(const[w,ge]of s)S.has(w)||$.skip_effect(ge.e);$.oncommit(C),$.ondiscard(b)}else C($);p&&sn(!0),u(f)}),A={effect:m,items:s,pending:g,outrogroups:null,fallback:d};y=!1,St&&(a=br)}function Yr(r){for(;r!==null&&(r.f&Lu)===0;)r=r.next;return r}function ed(r,e,t,n,i){var I,j,O,w,ge,ce,L,_,K;var o=(n&Mu)!==0,a=e.length,s=r.items,c=Yr(r.effect.first),l,d=null,f,h=[],g=[],y,C,b,m;if(o)for(m=0;m<a;m+=1)y=e[m],C=i(y,m),b=s.get(C).e,(b.f&Vt)===0&&((j=(I=b.nodes)==null?void 0:I.a)==null||j.measure(),(f??(f=new Set)).add(b));for(m=0;m<a;m+=1){if(y=e[m],C=i(y,m),b=s.get(C).e,r.outrogroups!==null)for(const ee of r.outrogroups)ee.pending.delete(b),ee.done.delete(b);if((b.f&Si)!==0&&(Sa(b),o&&((w=(O=b.nodes)==null?void 0:O.a)==null||w.unfix(),(f??(f=new Set)).delete(b))),(b.f&Vt)!==0)if(b.f^=Vt,b===c)rn(b,null,t);else{var A=d?d.next:c;b===r.effect.last&&(r.effect.last=b.prev),b.prev&&(b.prev.next=b.next),b.next&&(b.next.prev=b.prev),ar(r,d,b),ar(r,b,A),rn(b,A,t),d=b,h=[],g=[],c=Yr(d.next);continue}if(b!==c){if(l!==void 0&&l.has(b)){if(h.length<g.length){var v=g[0],p;d=v.prev;var E=h[0],S=h[h.length-1];for(p=0;p<h.length;p+=1)rn(h[p],v,t);for(p=0;p<g.length;p+=1)l.delete(g[p]);ar(r,E.prev,S.next),ar(r,d,E),ar(r,S,v),c=v,d=S,m-=1,h=[],g=[]}else l.delete(b),rn(b,c,t),ar(r,b.prev,b.next),ar(r,b,d===null?r.effect.first:d.next),ar(r,d,b),d=b;continue}for(h=[],g=[];c!==null&&c!==b;)(l??(l=new Set)).add(c),g.push(c),c=Yr(c.next);if(c===null)continue}(b.f&Vt)===0&&h.push(b),d=b,c=Yr(b.next)}if(r.outrogroups!==null){for(const ee of r.outrogroups)ee.pending.size===0&&(oo(r,yo(ee.done)),(ge=r.outrogroups)==null||ge.delete(ee));r.outrogroups.size===0&&(r.outrogroups=null)}if(c!==null||l!==void 0){var $=[];if(l!==void 0)for(b of l)(b.f&Si)===0&&$.push(b);for(;c!==null;)(c.f&Si)===0&&c!==r.fallback&&$.push(c),c=Yr(c.next);var x=$.length;if(x>0){var D=(n&$a)!==0&&a===0?t:null;if(o){for(m=0;m<x;m+=1)(L=(ce=$[m].nodes)==null?void 0:ce.a)==null||L.measure();for(m=0;m<x;m+=1)(K=(_=$[m].nodes)==null?void 0:_.a)==null||K.fix()}Qu(r,$,D)}}o&&Ou(()=>{var ee,M;if(f!==void 0)for(b of f)(M=(ee=b.nodes)==null?void 0:ee.a)==null||M.apply()})}function td(r,e,t,n,i,o,a,s){var c=(a&Cu)!==0?(a&Au)===0?$u(t,!1,!1):hs(t):null,l=(a&Du)!==0?hs(i):null;return{v:c,i:l,e:io(()=>(o(e,c??t,l??i,s),()=>{r.delete(n)}))}}function rn(r,e,t){if(r.nodes)for(var n=r.nodes.start,i=r.nodes.end,o=e&&(e.f&Vt)===0?e.nodes.start:t;n!==null;){var a=zu(n);if(o.before(n),n===i)return;n=a}}function ar(r,e,t){e===null?r.effect.first=t:e.next=t,t===null?r.effect.last=e:t.prev=e}function so(r,e,...t){var n=new Ia(r);vo(()=>{const i=e()??null;n.ensure(i,i&&(o=>i(o,...t)))},Da)}function rd(r,e,t,n,i,o){let a=St;St&&no();var s=null;St&&br.nodeType===Nu&&(s=br,no());var c=St?br:r,l=new Ia(c,!1);vo(()=>{const d=e()||null;var f=t||d==="svg"?Uu:void 0;if(d===null){l.ensure(null,null),Tn(!0);return}return l.ensure(d,h=>{if(d){if(s=St?s:Pu(d,f),Hu(s,s),n){St&&qu(d)&&s.append(document.createComment(""));var g=St?Aa(s):s.appendChild(Fn());St&&(g===null?sn(!1):Mr(g)),n(s,g)}Wu.nodes.end=s,h.before(s)}St&&Mr(h)}),Tn(!0),()=>{d&&Tn(!1)}},Da),ju(()=>{Tn(!0)}),a&&(sn(!0),Mr(c))}function Qv(r){return`${(Math.max(0,r)/1e3).toFixed(1)}s`}var un,dn,fn,ti,La;class nd{constructor(){nt(this,ti);nt(this,un,Ee(null));nt(this,dn,Ee(null));nt(this,fn,Ee(Kt([])));Te(this,"nextId",1)}get startedAt(){return u(xe(this,un))}set startedAt(e){N(xe(this,un),e,!0)}get label(){return u(xe(this,dn))}set label(e){N(xe(this,dn),e,!0)}get steps(){return u(xe(this,fn))}set steps(e){N(xe(this,fn),e,!0)}get active(){return this.startedAt!==null}get current(){return this.steps.length?this.steps[this.steps.length-1]:null}elapsedMs(e=Date.now()){return this.startedAt===null?0:Math.max(0,e-this.startedAt)}begin(e,t=Date.now()){Qt(()=>{this.startedAt=t,this.label=e,this.steps=[],this.nextId=1})}step(e,t,n=Date.now()){Qt(()=>{if(this.startedAt===null)return;const i=this.steps.map(o=>o.status==="active"?{...o,status:"done",durationMs:n-o.startedAt}:o);this.steps=[...i,{id:this.nextId++,label:e,...t?{detail:t}:{},startedAt:n,durationMs:null,status:"active"}]})}succeed(e=Date.now()){Qt(()=>{us(this,ti,La).call(this,e),this.startedAt=null})}fail(e,t=Date.now()){Qt(()=>{this.steps=this.steps.map(n=>n.status==="active"?{...n,status:"error",durationMs:t-n.startedAt,...e?{error:e}:{}}:n),this.startedAt=null})}}un=new WeakMap,dn=new WeakMap,fn=new WeakMap,ti=new WeakSet,La=function(e){this.steps=this.steps.map(t=>t.status==="active"?{...t,status:"done",durationMs:e-t.startedAt}:t)};const Xr=new nd,wr=Object.freeze({vcs:!1,clusterStatus:!1,collectionMetadata:!1,cdcStream:!1}),gs={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 id(r){var t;const e={...wr};for(const n of r.features??[]){const i=gs[((t=n==null?void 0:n.toLowerCase)==null?void 0:t.call(n))??""];i&&(e[i]=!0)}for(const[n,i]of Object.entries(r.capabilities??{})){const o=gs[n.toLowerCase()];o&&(e[o]=i===!0)}return e}const od=/pass(word)?|secret|token|api[-_]?key|authorization|auth|credential|cookie|session|bearer|private[-_]?key|mfa/i,sd="«redacted»";function ao(r,e=0){if(e>6)return"«…»";if(Array.isArray(r))return r.slice(0,100).map(t=>ao(t,e+1));if(r&&typeof r=="object"){const t={};for(const[n,i]of Object.entries(r))t[n]=od.test(n)?sd:ao(i,e+1);return t}return r}function ms(r){if(r==null)return;let e=r;if(typeof r=="string"){if(r.length===0)return;try{e=JSON.parse(r)}catch{return r.length>2e3?`${r.slice(0,2e3)}…`:r}}try{const t=JSON.stringify(ao(e),null,2);return t.length>4e3?`${t.slice(0,4e3)}…`:t}catch{return}}class ad{constructor(e=500){Te(this,"entries",[]);Te(this,"listeners",new Set);Te(this,"sinks",new Set);Te(this,"nextId",1);this.capacity=e}record(e){const t={...e,id:this.nextId++};this.entries.push(t),this.entries.length>this.capacity&&this.entries.splice(0,this.entries.length-this.capacity),this.emit();for(const n of this.sinks)try{n(t)}catch{}return t}addSink(e){return this.sinks.add(e),()=>{this.sinks.delete(e)}}snapshot(){return this.entries.slice()}get size(){return this.entries.length}clear(){this.entries.length!==0&&(this.entries=[],this.emit())}subscribe(e){return this.listeners.add(e),e(this.snapshot()),()=>{this.listeners.delete(e)}}emit(){const e=this.snapshot();for(const t of this.listeners)t(e)}}const Tr=new ad,vs=new Set,Di=new Map;function cd(r){return(r instanceof Error?r.message:String(r)).includes("route not found: GET /collections/")}function ld(r){const e=r instanceof Error?r.message:String(r);return/ → 404\b/.test(e)||e.includes("route not found")}function ys(r){return new Error(`GET /collections/:name unsupported by this reddb server (${r})`)}function ud(r){if(!r||typeof r!="object")return!1;const e=r;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*dd(r){const e=r.getReader(),t=new TextDecoder;let n="";try{for(;;){const{done:o,value:a}=await e.read();if(o)break;n+=t.decode(a,{stream:!0});let s;for(;(s=n.indexOf(`
|
|
3
|
+
`))!==-1;){const c=n.slice(0,s).trim();n=n.slice(s+1),c&&(yield JSON.parse(c))}}const i=n.trim();i&&(yield JSON.parse(i))}finally{e.releaseLock()}}const fd=/^\s*select\b/i;function hd(r){var e;if(Array.isArray(r))return r.length;if(r&&typeof r=="object"){const t=r;if(typeof t.record_count=="number")return t.record_count;if(Array.isArray((e=t.result)==null?void 0:e.records))return t.result.records.length}}function Ii(r){if(r instanceof Error)return r.message||String(r);if(typeof r=="string")return r;if(r&&typeof r=="object"){const e=r.message;if(typeof e=="string"&&e)return e;try{const t=JSON.stringify(r);if(t&&t!=="{}")return t}catch{}}return String(r)}async function ey(r,e,t={}){var i;const n=t.signal?{signal:t.signal}:void 0;if(!fd.test(e))return n?r.query(e,n):r.query(e);try{const o=await r.queryStreamCollect(e,t);return{ok:!0,query:e,record_count:o.rowCount,result:{columns:o.columns,records:o.rows.map(a=>a.values&&typeof a.values=="object"&&("nodes"in a||"edges"in a||"paths"in a||"vector_results"in a)?a:{values:a})},streamed:!0,truncated:o.truncated}}catch(o){if((i=t.signal)!=null&&i.aborted||o instanceof Error&&o.name==="AbortError")throw o;return n?r.query(e,n):r.query(e)}}class bo{constructor(e,t={}){Te(this,"baseUrl");Te(this,"headers");Te(this,"fetcher");this.baseUrl=e.replace(/\/$/,""),this.headers=t.headers,this.fetcher=t.fetch??globalThis.fetch.bind(globalThis)}async json(e,t){const n=`${this.baseUrl}${e}`,i={"Content-Type":"application/json"};Object.assign(i,this.headers),Object.assign(i,t==null?void 0:t.headers);const o=(t==null?void 0:t.method)??"GET",a=Date.now(),s=performance.now(),c=ms(t==null?void 0:t.body),l=()=>Math.round(performance.now()-s);let d;try{d=await this.fetcher(n,{...t,headers:i})}catch(g){throw Tr.record({kind:"http",verb:o,target:e,startedAt:a,durationMs:l(),ok:!1,payload:c,error:Ii(g)}),g}if(!d.ok){const g=await d.text().catch(()=>""),y=`${o} ${e} → ${d.status} ${g.slice(0,200)}`;throw Tr.record({kind:"http",verb:o,target:e,startedAt:a,durationMs:l(),ok:!1,status:d.status,payload:c,error:y}),new Error(y)}const f=await d.json(),h=hd(f);return Tr.record({kind:h===void 0?"http":"query",verb:o,target:e,startedAt:a,durationMs:l(),ok:!0,status:d.status,...h===void 0?{}:{rowCount:h},payload:c}),f}async login(e,t){const n=new URL(this.baseUrl);if(n.username||n.password||n.search||n.hash||n.protocol!=="https:"&&!(n.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(n.hostname)))throw new Error("Use HTTPS to sign in to a remote database.");const i=await this.fetcher(`${this.baseUrl}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",redirect:"error",body:JSON.stringify({username:e,password:t})});if(!i.ok)throw new Error("Database sign-in failed. Check your credentials and try again.");const o=await i.json();if(o.ok!==!0||typeof o.token!="string"||!o.token)throw new Error("The database did not return a session token.");return o.token}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 n=t.values;return{path:String(n.path??""),kind:n.kind,role:String(n.role??"metric"),unit:n.unit??null,supports_prometheus_query:n.supports_prometheus_query!==!1,created_at_ms:typeof n.created_at_ms=="number"?n.created_at_ms:void 0}})}async promQuery(e,t){const n=new URLSearchParams({query:e});return t!==void 0&&n.set("time",String(t)),this.json(`/api/v1/query?${n}`)}async promQueryRange(e,t,n,i){const o=new URLSearchParams({query:e,start:String(t),end:String(n),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:Ii(t)}}}async capabilities(){try{const n=await this.json("/capabilities");return id(n)}catch(n){if(!ld(n))return{...wr}}const[e,t]=await Promise.all([this.probeGet("/repo/commits?limit=1"),this.probeGet("/cluster/status")]);return{...wr,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(vs.has(this.baseUrl))throw ys(this.baseUrl);const t=`/collections/${encodeURIComponent(e)}`,n=Di.get(this.baseUrl);if(n){if(!await n)throw ys(this.baseUrl);return this.json(t)}let i;const o=new Promise(a=>{i=a});Di.set(this.baseUrl,o);try{const a=await this.json(t);return i(!0),a}catch(a){throw cd(a)?(vs.add(this.baseUrl),i(!1)):i(!0),a}finally{Di.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 n=t.maxRows??1e4,i={"Content-Type":"application/json",Accept:"application/x-ndjson"};Object.assign(i,this.headers);const o=Date.now(),a=performance.now(),s=JSON.stringify({query:e}),c=ms(s),l=()=>Math.round(performance.now()-a);let d;try{d=await this.fetcher(`${this.baseUrl}/query/stream`,{method:"POST",headers:i,body:s,signal:t.signal})}catch(h){throw Tr.record({kind:"query",verb:"POST",target:"/query/stream",startedAt:o,durationMs:l(),ok:!1,payload:c,error:Ii(h)}),h}if(!d.ok||!d.body){const h=d.body?await d.text().catch(()=>""):"",g=`POST /query/stream → ${d.status} ${h.slice(0,200)}`;throw Tr.record({kind:"query",verb:"POST",target:"/query/stream",startedAt:o,durationMs:l(),ok:!1,status:d.status,payload:c,error:g}),new Error(g)}const f={columns:[],rows:[],rowCount:0,truncated:!1};for await(const h of dd(d.body))if("descriptor"in h)f.columns=(h.descriptor.columns??[]).map(g=>typeof g=="string"?g:g.name),f.schemaFingerprint=h.descriptor.schema_fingerprint;else if("cursor"in h)f.cursor=h.cursor.token;else if("row"in h){if(f.rows.length>=n){f.truncated=!0;break}f.rows.push(h.row),f.rowCount=f.rows.length}else if("end"in h||"cancelled"in h)break;return Tr.record({kind:"query",verb:"POST",target:"/query/stream",startedAt:o,durationMs:l(),ok:!0,status:d.status,rowCount:f.rowCount,payload:c}),f.truncated&&f.cursor&&await this.cancelQueryStream(f.cursor).catch(()=>{}),f}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 n=t.toString()?`?${t}`:"";return(await this.json(`/repo/commits${n}`)).result}async commitDiff(e,t,n={}){const i=new URLSearchParams;n.collection&&i.set("collection",n.collection),n.summary!==void 0&&i.set("summary",String(n.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((n,i)=>{var s;const o=((s=t.results)==null?void 0:s[i])??{},a=ud(o.resource)?o.resource:n.resource;return{action:typeof o.action=="string"?o.action:n.action,resource:a,current_tenant:typeof o.current_tenant=="string"?o.current_tenant:n.current_tenant,allowed:o.allowed===!0,reason:typeof o.reason=="string"?o.reason:void 0}})}async changes(e,t={}){const n=new URLSearchParams;e!==void 0&&n.set("since_lsn",String(e)),t.limit!==void 0&&n.set("limit",String(t.limit));const i=n.toString()?`?${n}`:"",a=(await this.json("/changes"+i)).events??[];return t.collection?a.filter(s=>s.collection===t.collection):a}async rows(e){return(await this.query(e)).result.records.map(n=>n.values)}}class pd extends Error{constructor(e){super(`Unknown connection: ${e}`),this.id=e,this.name="UnknownConnectionError"}}class gd extends Error{constructor(){super("No active connection — call connect() first"),this.name="NotConnectedError"}}class bs extends Error{constructor(e,t){super(`Connection ${e} unreachable: ${t}`),this.id=e,this.reason=t,this.name="UnreachableConnectionError"}}const md={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 Ta(r){const e=r.trim();if(!e)return null;const t=e.match(/^([a-z+]+):\/\//i);return t?md[t[1].toLowerCase()]??null:"http"}const wo=["http","https"],vd=["http","https","unix"];function yd(r,e){const t=Ta(r);return t!==null&&e.includes(t)}class ur extends Error{constructor(e="Enter a valid connection URL or its Base64 encoding."){super(e),this.name="ConnectionStringError"}}const bd=16384,wd=/token|secret|password|passwd|auth|credential|api[-_]?key|bearer/i;function Ga(r){const e=r.trim();if(!e||e.length>bd)throw new ur;if(/^[a-z][a-z0-9+.-]*:\/\//i.test(e))return e;const t=/^base64(?:url)?:/i.test(e),n=t?e.replace(/^base64(?:url)?:/i,""):e;if(!t&&!/^[\w+/=-]+$/.test(n))return e;let i=!1;try{if(!/^[A-Za-z0-9+/_-]+={0,2}$/.test(n))throw new Error;const o=n.replace(/-/g,"+").replace(/_/g,"/"),a=o.replace(/=+$/,"");if(a.length%4===1||o.includes("=")&&o.length%4!==0)throw new Error;const s=atob(a+"=".repeat((4-a.length%4)%4));if(btoa(s).replace(/=+$/,"")!==a)throw new Error;const c=new TextDecoder("utf-8",{fatal:!0}).decode(Uint8Array.from(s,l=>l.charCodeAt(0)));if(i=!0,!/^[a-z][a-z0-9+.-]*:\/\//i.test(c))throw new Error;return c}catch{if(!t&&!i&&/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i.test(e))return e;throw new ur}}function hr(r){let e=Ga(r);if(/^(file|unix|red\+unix):\/\//i.test(e))return{url:e};e.includes("://")||(e="http://"+e);const t=/^([a-z][a-z0-9+.-]*):\/\/(.+)$/i.exec(e);if(!t)throw new ur;const n=t[1].toLowerCase(),i=["red","red+tcp","red+wire","reds","red+tls"].includes(n),o=["https","reds","red+tls","red+https"].includes(n);if(!i&&!["http","https","red+http","red+https"].includes(n))throw new ur("This connection requires an HTTP or HTTPS endpoint.");try{const a=new URL(`${o?"https":"http"}://${t[2]}`);if(!a.hostname||/\s/.test(a.hostname)||a.hash)throw new Error;for(const l of a.searchParams.keys())if(wd.test(l))throw new ur("Use URI credentials or the sign-in fields, not secrets in query parameters.");let s;if(a.username||a.password){if(!a.username||!a.password)throw new ur("A connection string needs both a username and a password.");s={username:decodeURIComponent(a.username),password:decodeURIComponent(a.password)},a.username="",a.password=""}return i&&(a.port="5055"),{url:a.href.replace(/\/$/,""),...s?{credentials:s}:{}}}catch(a){throw a instanceof ur?a:new ur}}const _d=["endpoint","connection","red_url","red"],xd="view",Yn="cs",Ra="to",kd="token",Ed=/(token|secret|password|passwd|auth|credential|api[-_]?key|bearer)/i;class Nr extends Error{constructor(e,t){super(t),this.code=e,this.name="OpenContractError"}}function Sd(r,e=""){if(r instanceof URL)return{search:r.search,hash:r.hash};const t=r??"";if(/^[a-z][a-z0-9+.-]*:\/\//i.test(t)){const a=new URL(t);return{search:a.search,hash:a.hash}}const n=t.indexOf("#"),i=n>=0?t.slice(0,n):t,o=n>=0?t.slice(n):e;return{search:i,hash:o}}function ws(r){return/^file:/i.test(r)||/^~(?:\/|\\|$)/.test(r)||/^(?:\.{1,2})(?:\/|\\|$)/.test(r)||/^(?:\/|\\)/.test(r)||/^[a-z]:[\\/]/i.test(r)||r.includes("\\")}function Oa(r){const e=r.trim();if(!e)throw new Nr("EMPTY_CS","Open Contract cs is empty");if(ws(e))throw new Nr("FILESYSTEM_PATH","Open Contract cs must be a browser-reachable URL, not a filesystem path");try{const t=Ga(e);if(!/^[a-z][a-z0-9+.-]*:\/\//i.test(t))throw new Error;if(ws(t))throw new Error;const n=hr(t);if(!/^https?:\/\//.test(n.url))throw new Error}catch{throw new Nr("MALFORMED_URL","Enter a valid HTTP connection string or its Base64 encoding.")}return e}function za(r){const e=r.trim();if(!e)throw new Nr("MALFORMED_ROUTE","Open Contract to is empty");if(/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")||e.includes("\\"))throw new Nr("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 Nr("MALFORMED_ROUTE","Open Contract to must target a known red-ui route")}function _o(r,e=""){const{search:t,hash:n}=Sd(r,e),i=new URLSearchParams(t),o=new URLSearchParams(n.startsWith("#")?n.slice(1):n),a={},s=o.get(Yn)??i.get(Yn);s!==null&&(a.cs=Oa(s));const c=i.get(Ra);c!==null&&(a.to=za(c));const l=o.get(kd);return l&&(a.token=l),a}function Cd(r,e=""){const t=new URLSearchParams(r??""),n={},i=new URLSearchParams(e.replace(/^#/,"")).get(Yn)??t.get(Yn);if(i!==null)try{n.endpoint=hr(Oa(i)).url}catch{}const o=t.get(Ra);if(o!==null)try{n.to=za(o)}catch{}for(const s of _d){if(n.endpoint)break;const c=t.get(s);if(c&&!Ed.test(s)){try{const l=hr(c);n.endpoint=l.credentials?l.url:c}catch{}break}}const a=t.get(xd);a&&(n.view=a);try{_o(r,e).token}catch{}return n}function Ad(r){return typeof r.endpoint=="string"&&r.endpoint.trim().length>0}function $d(r){return typeof r.to=="string"&&r.to.trim().length>0}const Dd=8;function Id(){let r=[];return{load:()=>r.slice(),save:e=>{r=e.slice()}}}class Ld{constructor(e={}){Te(this,"presets");Te(this,"history");Te(this,"clientFactory");Te(this,"historyMax");Te(this,"supportedTransports");Te(this,"boot");Te(this,"embeddedResolver");Te(this,"handoffTokens",new Map);Te(this,"active",null);var t,n;this.presets=((t=e.presets)==null?void 0:t.slice())??[],this.history=e.history??Id(),this.historyMax=e.historyMax??Dd,this.clientFactory=e.clientFactory??((i,o)=>new bo(i,o)),this.supportedTransports=((n=e.transports)==null?void 0:n.slice())??[...wo],this.boot=e.bootParams&&(Ad(e.bootParams)||$d(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 n=t.trim();n&&this.handoffTokens.set(this.handoffKey(e),n)}async list(){const e=new Set,t=[];for(const n of this.presets)e.has(n.url)||(e.add(n.url),t.push(n));for(const n of this.history.load())e.has(n.url)||(e.add(n.url),t.push({id:n.url,label:n.label,url:n.url,role:"primary"}));return t}async connect(e){const t=this.resolve(e);if(!t)throw new pd(e);let n=t.url;if(this.embeddedResolver&&/^file:\/\//i.test(t.url))try{n=await this.embeddedResolver(t.url)}catch(c){const l=c instanceof Error?c.message:String(c);throw new bs(t.id,l)}const i=this.consumeHandoffToken(t.url),o=this.clientFactory(n,i?{headers:{Authorization:`Bearer ${i}`}}:void 0),a=await o.ping();if(!a.ok)throw new bs(t.id,a.error);const s={connection:t,client:o,rtt_ms:a.rtt_ms};return this.active=s,this.record(t,a.rtt_ms),s}async whoami(){if(!this.active)throw new gd;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(n=>n.url!==e);this.history.save(t)}resolve(e){const t=this.presets.find(i=>i.id===e);if(t)return t;const n=this.history.load().find(i=>i.url===e);if(n)return{id:n.url,label:n.label,url:n.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),n=this.handoffTokens.get(t)??null;return this.handoffTokens.delete(t),n}record(e,t){const n=this.history.load().filter(o=>o.url!==e.url),i=[{url:e.url,label:e.label,last_used:Date.now(),rtt_ms:t},...n].slice(0,this.historyMax);this.history.save(i)}}const Ma="red-ui:connection",Td=["__RED_BOOTSTRAP__","__RED_UI_CONNECTION_BOOTSTRAP__","__RED_UI_BOOTSTRAP__"];function nn(r){return typeof r=="string"&&r.trim()?r.trim():void 0}function Gd(r){if(!r||typeof r!="object")return null;const e=nn(r.target),t=nn(r.token),n=nn(r.route),i=nn(r.error);return!e&&!t&&!n&&!i?null:{target:e??null,...i?{error:i}:{},...t?{token:t}:{},...n?{route:n}:{}}}async function Rd(r){for(const e of r){let t;try{t=Gd(await e())}catch{t=null}if(t)return t}return null}async function Od(){if(typeof window>"u"||!("__TAURI_INTERNALS__"in window||"__TAURI__"in window))return null;try{return(await fr(()=>import("./DhEqZVGG.js"),[],import.meta.url)).invoke}catch{return null}}async function zd(r){const e=r??await Od();if(!e)return null;try{return await e("connection_bootstrap")}catch{return null}}async function Md(r=globalThis){if(!r||typeof r!="object")return null;const e=r;for(const t of Td){const n=e[t];if(n)try{return typeof n=="function"?await n():n}finally{try{delete e[t]}catch{e[t]=void 0}}}return null}function Nd(){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:(r,e,t)=>history.replaceState(r,e,t)}}}function Pd(r){if(!r.consume||!r.location||!r.history)return;const{pathname:e,search:t,hash:n}=r.location,i=new URLSearchParams(t),o=new URLSearchParams(n.replace(/^#/,""));let a=!1,s=!1;for(const[d,f]of[[i,!1],[o,!0]]){for(const h of[...d.keys()])/token|secret|password|passwd|auth|credential|api[-_]?key|bearer/i.test(h)&&(d.delete(h),f?s=!0:a=!0);for(const h of["cs","endpoint","connection","red_url","red"]){const g=d.get(h);if(g===null)continue;let y;try{h==="cs"&&_o(`?cs=${encodeURIComponent(g)}`),y=hr(g).url}catch{}(f||y!==g)&&(d.delete(h),!f&&y&&d.set(h,y),f?s=!0:a=!0)}}if(!a&&!s)return;const c=a?i.size?`?${i}`:"":t,l=s?o.size?`#${o}`:"":n;try{r.history.replaceState(r.history.state,"",`${e}${c}${l}`)}catch{}}function _s(r=typeof location>"u"?"":location.search,e=typeof location>"u"?"":location.hash,t=Nd()){try{const n=_o(r,e);return!n.cs&&!n.to&&!n.token?null:{target:n.cs,token:n.token,route:n.to}}catch{return{error:"Enter a valid HTTP connection string or its Base64 encoding."}}finally{Pd(t)}}function Ud(){try{return typeof localStorage>"u"?void 0:localStorage}catch{return}}function Wd(r=Ud(),e=Ma){if(!r)return null;try{const t=r.getItem(e);if(!t)return null;const n=JSON.parse(t),i=nn(n==null?void 0:n.url);return i?{target:i}:null}catch{return null}}async function jd(r={}){const e=r.readUrl??(()=>_s()),t=await Rd([r.readTauri??zd,r.readInjectedGlobal??Md,e,r.readPersisted??(()=>Wd())]);if(t&&!r.readUrl)try{_s()}catch{}return t??{target:null}}class wt extends Error{constructor(t,n){super(n);Te(this,"code");this.name="SecureStoreError",this.code=t}}const Bd=2e5,Fd=16,Vd=12;function Rn(r){let e="";for(const t of r)e+=String.fromCharCode(t);return btoa(e)}function Li(r){const e=atob(r),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function Gr(r){const e=new ArrayBuffer(r.byteLength);return new Uint8Array(e).set(r),e}class Kd{constructor(e,t={}){Te(this,"storage");Te(this,"namespace");Te(this,"iterations");Te(this,"subtle");Te(this,"password");Te(this,"keyCache",new Map);var o;if(typeof e!="string"||e.length===0)throw new wt("LOCKED","master password required");const n=t.storage??(typeof globalThis<"u"?globalThis.localStorage:void 0);if(!n)throw new wt("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 wt("BACKEND_FAILURE","Web Crypto SubtleCrypto unavailable");this.password=e,this.storage=n,this.namespace=t.namespace??"red-ui:secure",this.iterations=t.iterations??Bd,this.subtle=i}storageKey(e){return`${this.namespace}:${e}`}async deriveKey(e){const t=Rn(e),n=this.keyCache.get(t);if(n)return n;const i=new TextEncoder().encode(this.password),o=await this.subtle.importKey("raw",Gr(i),"PBKDF2",!1,["deriveKey"]),a=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,a),a}randomBytes(e){const t=new Uint8Array(e),n=globalThis.crypto;if(!n)throw new wt("BACKEND_FAILURE","crypto.getRandomValues unavailable");return n.getRandomValues(t),t}async put(e,t){const n=this.randomBytes(Fd),i=this.randomBytes(Vd),o=await this.deriveKey(n),a=new TextEncoder().encode(t);let s;try{s=await this.subtle.encrypt({name:"AES-GCM",iv:Gr(i)},o,Gr(a))}catch(l){throw new wt("BACKEND_FAILURE",`encrypt failed: ${l.message}`)}const c={v:1,salt:Rn(n),nonce:Rn(i),ciphertext:Rn(new Uint8Array(s))};try{this.storage.setItem(this.storageKey(e),JSON.stringify(c))}catch(l){throw new wt("BACKEND_FAILURE",`storage write failed: ${l.message}`)}}async get(e){const t=this.storage.getItem(this.storageKey(e));if(!t)return null;let n;try{n=JSON.parse(t)}catch{throw new wt("CORRUPT_ENVELOPE",`key ${e}: not valid JSON`)}if(!n||n.v!==1||typeof n.salt!="string"||typeof n.nonce!="string"||typeof n.ciphertext!="string")throw new wt("CORRUPT_ENVELOPE",`key ${e}: missing envelope fields`);let i,o,a;try{i=Li(n.salt),o=Li(n.nonce),a=Li(n.ciphertext)}catch{throw new wt("CORRUPT_ENVELOPE",`key ${e}: base64 decode failed`)}const s=await this.deriveKey(i);let c;try{c=await this.subtle.decrypt({name:"AES-GCM",iv:Gr(o)},s,Gr(a))}catch{throw new wt("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 wt("BACKEND_FAILURE",`storage delete failed: ${t.message}`)}}}const Ti="UNKNOWN";function Hd(r){return typeof r=="object"&&r!==null&&typeof r.code=="string"&&typeof r.message=="string"}function Na(r){if(Hd(r)){const e=r.detail;return{code:r.code,message:r.message,...typeof e=="string"&&e.length>0?{detail:e}:{}}}return typeof r=="string"?{code:Ti,message:r}:r instanceof Error?{code:Ti,message:r.message||String(r)}:{code:Ti,message:String(r)}}function Gi(r){const e=Na(r);return e.detail?`${e.message}: ${e.detail}`:e.message}class Xn extends Error{constructor(t){super(t.detail?`${t.message}: ${t.detail}`:t.message);Te(this,"code");Te(this,"detail");this.name="DesktopError",this.code=t.code,this.detail=t.detail}static from(t){return t instanceof Xn?t:new Xn(Na(t))}}class qd{constructor(e){Te(this,"invoke");Te(this,"service");if(!e.invoke)throw new wt("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(n){throw new wt("BACKEND_FAILURE",`keychain_set failed: ${Gi(n)}`)}}async get(e){try{return await this.invoke("keychain_get",{service:this.service,key:e})??null}catch(t){throw new wt("BACKEND_FAILURE",`keychain_get failed: ${Gi(t)}`)}}async delete(e){try{await this.invoke("keychain_delete",{service:this.service,key:e})}catch(t){throw new wt("BACKEND_FAILURE",`keychain_delete failed: ${Gi(t)}`)}}}/**
|
|
4
|
+
* @file
|
|
5
|
+
* @license @lucide/svelte v1.61.0 - ISC
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the ISC license.
|
|
8
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/const mr={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"};/**
|
|
10
|
+
* @file
|
|
11
|
+
* @license @lucide/svelte v1.61.0 - ISC
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the ISC license.
|
|
14
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/const co=(...r)=>r.filter((e,t,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===t).join(" ").trim();/**
|
|
16
|
+
* @file
|
|
17
|
+
* @license @lucide/svelte v1.61.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/function Ri(r){return r!=null}function Yd(r,e={}){var h,g;const t=e.attributeNames??{},n=y=>t[y]??y,i=r.size??r.width??mr.width,o=r.size??r.height??mr.height,a=((h=r.aliases)==null?void 0:h.filter(y=>typeof y=="string"&&y.trim()!=="").map(y=>`lucide-${y}`))??[],s=[...r.name?[`lucide-${r.name}`]:[],...a],c=((g=e.className)==null?void 0:g.split(" ").filter(Boolean))??[],l=e.includeDefaultClasses===!1?co(...c):co("lucide",...s,...c),d=e.absoluteStrokeWidth?Number(e.strokeWidth??mr["stroke-width"])*Number(r.size??r.width??mr.width)/Number(e.size??e.width??mr.width):e.strokeWidth??mr["stroke-width"];return["svg",{...Object.entries(mr).reduce((y,[C,b])=>(y[n(C)]=b,y),{}),..."color"in e&&e.color&&{[n("stroke")]:e.color},..."size"in e&&Ri(e.size)&&{[n("width")]:e.size,[n("height")]:e.size},..."width"in e&&Ri(e.width)&&{[n("width")]:e.width},..."height"in e&&Ri(e.height)&&{[n("height")]:e.height},[n("stroke-width")]:d,...l&&{[n("class")]:l},[n("viewBox")]:`0 0 ${i} ${o}`,...e.hasA11yProp===!1?{[n("aria-hidden")]:"true"}:{},..."attributes"in e&&e.attributes},r.node.map(y=>{const[C,b,m]=y,A=e.nonScalingStroke?{[n("vector-effect")]:"non-scaling-stroke",...b}:b;return m?[C,A,m]:[C,A]})]}/**
|
|
22
|
+
* @file
|
|
23
|
+
* @license @lucide/svelte v1.61.0 - ISC
|
|
24
|
+
*
|
|
25
|
+
* This source code is licensed under the ISC license.
|
|
26
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
+
*/const Xd=r=>{for(const e in r)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};/**
|
|
28
|
+
* @file
|
|
29
|
+
* @license @lucide/svelte v1.61.0 - ISC
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the ISC license.
|
|
32
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/const Jd=Symbol("lucide-context"),Zd=()=>Bu(Jd);var Qd=At("<svg><!><!></svg>");function at(r,e){ri(e,!0);const t=Zd()??{},n=Gt(e,"color",19,()=>t.color??"currentColor"),i=Gt(e,"size",19,()=>t.size??24),o=Gt(e,"width",19,i),a=Gt(e,"height",19,i),s=Gt(e,"strokeWidth",19,()=>t.strokeWidth??2),c=Gt(e,"absoluteStrokeWidth",19,()=>t.absoluteStrokeWidth??!1),l=Gt(e,"nonScalingStroke",19,()=>t.nonScalingStroke??!1),d=Gt(e,"iconNode",19,()=>[]),f=Gt(e,"icon",19,()=>({node:d(),aliases:[],size:24})),h=Ze(e,["$$slots","$$events","$$legacy","color","size","width","height","strokeWidth","absoluteStrokeWidth","nonScalingStroke","iconNode","icon","class","children"]),g=Q(()=>!!e.children||Xd(h)),y=Q(()=>Yd(f(),{color:n(),width:o(),height:a(),strokeWidth:s(),absoluteStrokeWidth:c(),nonScalingStroke:l(),className:co("lucide-icon",t.class),hasA11yProp:u(g),attributes:h})),C=Q(()=>an(u(y),3)),b=Q(()=>u(C)[1]),m=Q(()=>Vu(u(C)[2],()=>[],!0)),A=Q(()=>({...u(b),class:[...u(b).class.split(" "),e.class]}));var v=Qd();qn(v,()=>({...u(A)}));var p=R(v);bt(p,17,()=>u(m),Vn,(S,$)=>{var x=Q(()=>an(u($),2));let D=()=>u(x)[0],I=()=>u(x)[1];var j=er(),O=lt(j);rd(O,D,!0,(w,ge)=>{qn(w,()=>({...I()}))}),V(S,j)});var E=P(p);so(E,()=>e.children??Fu),T(v),V(r,v),ni()}const Pa={name:"x",size:24,node:[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]]};Pa.node;function xs(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return Pa}}))}const ef=20;var hn,pn,gn;class tf{constructor(){nt(this,hn,Ee(0));nt(this,pn,Q(()=>this.inflight>0));nt(this,gn,Ee(Kt([])));Te(this,"nextId",1)}get inflight(){return u(xe(this,hn))}set inflight(e){N(xe(this,hn),e,!0)}get active(){return u(xe(this,pn))}set active(e){N(xe(this,pn),e)}get log(){return u(xe(this,gn))}set log(e){N(xe(this,gn),e,!0)}async track(e,t){const n=this.nextId++,i={id:n,label:e,startedAt:Date.now(),durationMs:null,status:"pending"};Qt(()=>{this.log=[i,...this.log].slice(0,ef),this.inflight+=1});try{const o=await t();return Qt(()=>this.update(n,{durationMs:Date.now()-i.startedAt,status:"ok"})),o}catch(o){throw Qt(()=>this.update(n,{durationMs:Date.now()-i.startedAt,status:"error",error:o.message})),o}finally{Qt(()=>{this.inflight=Math.max(0,this.inflight-1)})}}update(e,t){this.log=this.log.map(n=>n.id===e?{...n,...t}:n)}reset(){Qt(()=>{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})}}hn=new WeakMap,pn=new WeakMap,gn=new WeakMap;const lr=new tf;var rf=Array.isArray,ii=r=>{if(!r&&r!==0&&r!==0n)return"";if(typeof r=="string")return r;if(typeof r=="number")return r!==r?"":""+r;if(typeof r=="bigint")return""+r;let e="";if(rf(r)){const t=r.length;for(let n=0;n<t;n++){const i=r[n];if(!i&&i!==0&&i!==0n)continue;const o=typeof i=="string"?i:ii(i);o&&(e&&(e+=" "),e+=o)}return e}if(typeof r=="object")for(const t in r)r[t]&&(e&&(e+=" "),e+=t);return e},nf=/\s+/g,lo=Array.isArray,of=r=>typeof r!="string"||!r?r:r.replace(nf," ").trim(),sf=r=>{const e=r.length;if(e===0)return!1;const t=r.charCodeAt(0),n=r.charCodeAt(e-1);if(t===32||n===32||t>=9&&t<=13||t===160||n>=9&&n<=13||n===160)return!0;for(let i=0;i<e;i++){const o=r.charCodeAt(i);if(o>=9&&o<=13||o===160||o===32&&i+1<e&&r.charCodeAt(i+1)===32)return!0}return!1},Kn=(...r)=>{const e=ii(r);if(e)return sf(e)?of(e):e},uo=r=>r===!1?"false":r===!0?"true":r===0?"0":r,Mt=r=>{if(!r||typeof r!="object")return!0;for(const e in r)return!1;return!0},Ua=(r,e)=>{if(r===e)return!0;if(!r||!e)return!1;const t=r,n=e,i=Object.keys(t),o=Object.keys(n);if(i.length!==o.length)return!1;for(let a=0;a<i.length;a++){const s=i[a];if(!o.includes(s)||t[s]!==n[s])return!1}return!0},af=(r,e)=>{const t=r;for(const n in e)if(Object.hasOwn(e,n)){const i=e[n];n in t?t[n]=Kn(t[n],i):t[n]=i}return r},Wa=(r,e)=>{for(let t=0;t<r.length;t++){const n=r[t];lo(n)?Wa(n,e):n&&e.push(n)}},fo=(...r)=>{const e=[];Wa(r,e);const t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t},xo=(r,e)=>{const t=r,n=e,i={};for(const o in t){const a=t[o];if(o in n){const s=n[o];lo(a)||lo(s)?i[o]=fo(s,a):typeof a=="object"&&typeof s=="object"&&a&&s?i[o]=xo(a,s):i[o]=s+" "+a}else i[o]=a}for(const o in n)o in t||(i[o]=n[o]);return i},cf={twMerge:!0,twMergeConfig:{}},ja=256,lf=128,xr=Symbol("tv-cache-miss"),uf=r=>(r==null?void 0:r.class)!=null&&r.class!==""||(r==null?void 0:r.className)!=null&&r.className!=="",ks=r=>{if(r===void 0)return"";if(r===null)return"null";if(typeof r=="string")return r;if(typeof r=="boolean")return r?"true":"false";if(typeof r=="number")return r===0?"0":String(r);if(typeof r=="bigint")return String(r);const e=uo(r),t=typeof e;if(t==="string"||t==="number"||t==="boolean"||t==="bigint")return String(e);if(t==="object")try{return JSON.stringify(e)}catch{return null}return null},Rr=(r,e)=>{if(e===void 0)return r;if(e===null)return r+"null";const t=typeof e;if(t==="string"||t==="number"||t==="boolean"||t==="bigint")return r+String(e);if(Array.isArray(e))return r+e.join("\0");try{return r+JSON.stringify(e)}catch{return r+"?"}},Ba=(r,e,t,n)=>{let i="";const o=Object.create(null);for(let s=0;s<r.length;s++){const c=r[s];o[c]=1;let l=e[c];t&&t[c]!==void 0&&(l=t[c]);const d=ks(l);if(d===null)return null;i+=c+":"+d+";"}const a=[];for(const s in e)s==="class"||s==="className"||o[s]||(o[s]=1,a.push(s));if(t)for(const s in t)s==="class"||s==="className"||o[s]||t[s]===void 0||(o[s]=1,a.push(s));a.length>1&&a.sort();for(let s=0;s<a.length;s++){const c=a[s];let l=e[c];t&&t[c]!==void 0&&(l=t[c]);const d=ks(l);if(d===null)return null;i+=c+":"+d+";"}return i},Fa=(r,e)=>{let t="";for(let n=0;n<r.length;n++){const{conditionKeys:i,source:o}=r[n];for(let a=0;a<i.length;a++){const s=i[a];t+=s+"=",t=Rr(t,o[s]),t+=","}t+="c=",t=Rr(t,o.class),t+="|cn=",t=Rr(t,o.className),t+=";"}for(let n=0;n<e.length;n++){const{conditionKeys:i,source:o}=e[n];for(let a=0;a<i.length;a++){const s=i[a];t+=s+"=",t=Rr(t,o[s]),t+=","}Array.isArray(o.slots)&&(t+="slots="+o.slots.join(",")+","),t+="c=",t=Rr(t,o.class),t+="|cn=",t=Rr(t,o.className),t+=";"}return t},Va=(r=ja)=>{let e=new Map,t=null;return{get(n){if(e.has(n))return e.get(n);if(t!=null&&t.has(n)){const i=t.get(n);return e.set(n,i),i}return xr},set(n,i){e.size>=r&&(t=e,e=new Map),e.set(n,i)}}},df=(r=ja)=>{const e=Va(r);return{get(t){return e.get(t)},set(t,n){e.set(t,n)}}},ff=(r=lf)=>{let e=new Map,t=null,n=0;return{get(i,o){const a=e.get(i);if(a){const s=a.get(o);if(s!==void 0||a.has(o))return s}if(t){const s=t.get(i);if(s){const c=s.get(o);if(c!==void 0||s.has(o)){let l=e.get(i);return l||(l=new Map,e.set(i,l)),l.has(o)||n++,l.set(o,c),c}}}return xr},set(i,o,a){n>=r&&(t=e,e=new Map,n=0);let s=e.get(i);s||(s=new Map,e.set(i,s)),s.has(o)||n++,s.set(o,a)}}},ko=(r,e)=>{let t=null;return(n,i)=>{if(!uf(i))return n;const o=i.class,a=i.className;if(o!=null&&o!==""&&typeof o!="string"||a!=null&&a!==""&&typeof a!="string")return r(e,n,o,a);t??(t=ff());const s=n??"",c=(typeof o=="string"?o:"")+"\0"+(typeof a=="string"?a:""),l=t.get(s,c);if(l!==xr)return l;const d=r(e,n,o,a);return t.set(s,c,d),d}};function hf(){let r=null,e={},t=!1;return{get cachedTwMerge(){return r},set cachedTwMerge(n){r=n},get cachedTwMergeConfig(){return e},set cachedTwMergeConfig(n){e=n},get didTwMergeConfigChange(){return t},set didTwMergeConfigChange(n){t=n},reset(){r=null,e={},t=!1}}}var Ct=hf(),pf=r=>{!Mt(r.twMergeConfig)&&!Ua(r.twMergeConfig,Ct.cachedTwMergeConfig)&&(Ct.didTwMergeConfigChange=!0,Ct.cachedTwMergeConfig=r.twMergeConfig)},gf=(r,e)=>{const t=[];for(let n=0;n<e.length;n++){const i=e[n],o=r[i];t.push({key:i,values:o,isEmpty:Mt(o)})}return t},mf=r=>{if(!Array.isArray(r)||r.length===0)return[];const e=[];for(let t=0;t<r.length;t++){const n=r[t],i=[];for(const o in n)o!=="class"&&o!=="className"&&i.push(o);e.push({conditionKeys:i,source:n})}return e},vf=r=>{if(!Array.isArray(r)||r.length===0)return[];const e=[];for(let t=0;t<r.length;t++){const n=r[t],i=[];for(const o in n)o!=="slots"&&o!=="class"&&o!=="className"&&i.push(o);e.push({conditionKeys:i,source:n})}return e},yf=r=>{const e={};for(let t=0;t<r.length;t++){const n=r[t],i=n.source.slots;if(Array.isArray(i))for(let o=0;o<i.length;o++){const a=i[o];e[a]||(e[a]=[]),e[a].push(n)}}return e},bf=(r,e)=>{const{extend:t=null,slots:n={},variants:i={},compoundVariants:o=[],compoundSlots:a=[],defaultVariants:s={}}=r,c={...cf,...e},l=r.slots!==void 0,d=t!=null&&t.base?Kn(t.base,r==null?void 0:r.base):r==null?void 0:r.base,f=t!=null&&t.variants&&!Mt(t.variants)?xo(i,t.variants):i,h=t!=null&&t.defaultVariants&&!Mt(t.defaultVariants)?{...t.defaultVariants,...s}:s;pf(c);const g=!(t!=null&&t.slots)||Mt(t.slots),y=l?g&&(t!=null&&t.base)?Kn(r==null?void 0:r.base,t.base):typeof(r==null?void 0:r.base)=="string"||(r==null?void 0:r.base)==null?r.base:Kn(r.base):void 0,C=l?{base:y,...n}:{},b=g?C:af({...t==null?void 0:t.slots},Mt(C)?{base:r==null?void 0:r.base}:C),m=!(t!=null&&t.compoundVariants)||Mt(t.compoundVariants)?o:fo(t==null?void 0:t.compoundVariants,o),A=!(t!=null&&t.compoundSlots)||Mt(t.compoundSlots)?a:fo(t==null?void 0:t.compoundSlots,a),v=Object.keys(f),p=m&&!Array.isArray(m)?new TypeError(`The "compoundVariants" prop must be an array. Received: ${typeof m}`):A&&!Array.isArray(A)?new TypeError(`The "compoundSlots" prop must be an array. Received: ${typeof A}`):null,E=l||!g?"slots":v.length===0?"plain":"variants";return{config:c,extend:t,base:d,variants:f,defaultVariants:h,slots:b,compoundVariants:m,compoundSlots:A,compiledVariants:null,compiledCompoundVariants:null,compiledCompoundSlots:null,compiledCompoundSlotsBySlot:null,deferredError:p,mode:E,slotKeys:null,variantKeys:v}},Ka=r=>(r.compiledVariants!==null||(r.compiledVariants=gf(r.variants,r.variantKeys),r.compiledCompoundVariants=mf(r.compoundVariants),r.compiledCompoundSlots=vf(r.compoundSlots),r.compiledCompoundSlotsBySlot=yf(r.compiledCompoundSlots),r.slotKeys=r.slots&&typeof r.slots=="object"?Object.keys(r.slots):[]),r),ho=[],Ha=[],wf=[],_f=[],xf=[],qa=(r,e,t)=>{const n={};for(const i in r)n[i]=r[i];if(e)for(const i in e)e[i]!==void 0&&(n[i]=e[i]);if(t)for(const i in t)t[i]!==void 0&&(n[i]=t[i]);return n},On=r=>r==null||r===!1,kf=(r,e)=>{if(!Array.isArray(r))return r===e||On(r)&&On(e);for(let t=0;t<r.length;t++){const n=r[t];if(n===e||On(n)&&On(e))return!0}return!1},Ya=(r,e,t,n)=>{if(r.isEmpty)return null;const i=(n==null?void 0:n[r.key])??(t==null?void 0:t[r.key]);if(i===null)return null;const o=uo(i);if(typeof o=="object")return null;const a=e==null?void 0:e[r.key],s=o??uo(a);return r.values[s||"false"]},Eo=(r,e)=>{const{conditionKeys:t,source:n}=r;for(let i=0;i<t.length;i++){const o=t[i];if(!kf(n[o],e[o]))return!1}return!0},Es=(r,e,t)=>{typeof t=="string"?e==="base"&&r.push(t):t&&typeof t=="object"&&t[e]&&r.push(t[e])},Ef=(r,e,t)=>{const n=Ha;n.length=0;for(let i=0;i<r.length;i++){const o=Ya(r[i],e,t);o&&n.push(o)}return n},Sf=(r,e,t,n,i)=>{const o=Ha;o.length=0;for(let a=0;a<e.length;a++){const s=Ya(e[a],t,n,i),c=r==="base"&&typeof s=="string"?s:s&&s[r];c&&o.push(c)}return o},Cf=(r,e)=>{const t=wf;t.length=0;for(let n=0;n<r.length;n++){const i=r[n];Eo(i,e)&&(i.source.class&&t.push(i.source.class),i.source.className&&t.push(i.source.className))}return t},Af=(r,e,t)=>{const n=_f;n.length=0;for(let i=0;i<e.length;i++){const o=e[i];Eo(o,t)&&(Es(n,r,o.source.class),Es(n,r,o.source.className))}return n},$f=(r,e)=>{const t=xf;t.length=0;for(let n=0;n<r.length;n++){const i=r[n];Eo(i,e)&&(i.source.class&&t.push(i.source.class),i.source.className&&t.push(i.source.className))}return t},Df=(r,e)=>{const{base:t,config:n}=r;let i=xr;const o=ko(e,n);return(a=>(i===xr&&(i=e(n,t)),o(i,a)))},If=(r,e)=>{const{base:t,config:n,defaultVariants:i,deferredError:o,variantKeys:a}=r;let s=r.compiledCompoundVariants,c=r.compiledVariants,l=ho,d=null;const f=ko(e,n);let h=1;const g=y=>{const C=s.length>0?Cf(s,qa(i,y)):void 0;return e(n,t,Ef(c,i,y),C)};return(y=>{if(o)throw o;(c===null||s===null)&&(Ka(r),c=r.compiledVariants,s=r.compiledCompoundVariants,l=r.compiledCompoundSlots??ho);let C;if(h>0)h--,C=g(y);else{d??(d=df());const b=Ba(a,i,y);if(b!==null){const m=s.length>0||l.length>0?Fa(s,l):"",A=b+"#"+m,v=d.get(A);v!==xr?C=v:(C=g(y),d.set(A,C))}else C=g(y)}return f(C,y)})},Lf=(r,e)=>{const{config:t,defaultVariants:n,deferredError:i,slots:o,variantKeys:a}=r;let s=null,c=null,l=null,d=null,f=!1,h=null,g=null,y=1;const C=()=>{if(l!==null)return;(r.compiledVariants===null||r.compiledCompoundVariants===null||r.compiledCompoundSlots===null||r.compiledCompoundSlotsBySlot===null||r.slotKeys===null)&&Ka(r);const m=r.compiledVariants;s=r.compiledCompoundVariants,c=r.compiledCompoundSlots;const A=r.compiledCompoundSlotsBySlot;l=r.slotKeys,f=s.length>0||c.length>0,h=ko(e,t);const v=new Array(l.length);for(let p=0;p<l.length;p++){const E=l[p],S=A[E]??ho;v[p]=($,x)=>{const D=f?qa(n,$,x):void 0,I=D?Af(E,s,D):void 0,j=D?$f(S,D):void 0;return e(t,o[E],Sf(E,m,n,$,x),I,j)}}d=v},b=m=>{const A=l,v=d,p=h,E={};for(let S=0;S<A.length;S++){const $=v[S],x=$(m);E[A[S]]=D=>{if(D==null)return x;let I=!1;for(const j in D)if(!(j==="class"||j==="className")&&D[j]!==void 0){I=!0;break}return p(I?$(m,D):x,D)}}return E};return(m=>{if(i)throw i;if(C(),y>0)return y--,b(m);const A=Ba(a,n,m);if(A===null)return b(m);const v=f?Fa(s,c):"",p=A+"#"+v;g??(g=Va());const E=g.get(p);if(E!==xr)return E;const S=b(m);return g.set(p,S),S})},Tf=(r,e)=>{if(r.mode==="plain")return Df(r,e);let t;return(n=>(t??(t=r.mode==="slots"?Lf(r,e):If(r,e)),t(n)))},Gf=(r,e)=>{r.variantKeys=e.variantKeys,r.extend=e.extend,r.base=e.base,r.slots=e.slots,r.variants=e.variants,r.defaultVariants=e.defaultVariants,r.compoundSlots=e.compoundSlots,r.compoundVariants=e.compoundVariants},Rf=r=>{const e=(n,i)=>{const o=bf(n,i),a=Tf(o,r);return Gf(a,o),a};return{tv:e,createTV:n=>(i,o)=>e(i,o?xo(n,o):n)}},Of=(r,e)=>{const t=r.length,n=e.length,i=new Array(t+n);for(let o=0;o<t;o++)i[o]=r[o];for(let o=0;o<n;o++)i[t+o]=e[o];return i},zf=(r,e)=>({classGroupId:r,validator:e}),Xa=(r=new Map,e=null,t)=>({nextPart:r,validators:e,classGroupId:t}),Jn="-",Ss=[],Mf="arbitrary..",Nf=r=>{const e=Uf(r),{conflictingClassGroups:t,conflictingClassGroupModifiers:n}=r;return{getClassGroupId:a=>{if(a[0]==="["&&a[a.length-1]==="]")return Pf(a);const s=a.split(Jn),c=s[0]===""&&s.length>1?1:0;return Ja(s,c,e)},getConflictingClassGroupIds:(a,s)=>{if(s){const c=n[a],l=t[a];return c?l?Of(l,c):c:l||Ss}return t[a]||Ss}}},Ja=(r,e,t)=>{if(r.length-e===0)return t.classGroupId;const i=r[e],o=t.nextPart.get(i);if(o){const l=Ja(r,e+1,o);if(l)return l}const a=t.validators;if(a===null)return;const s=e===0?r.join(Jn):r.slice(e).join(Jn),c=a.length;for(let l=0;l<c;l++){const d=a[l];if(d.validator(s))return d.classGroupId}},Pf=r=>{const e=r.slice(1,-1),t=e.indexOf(":");if(t===-1)return;const n=e.slice(0,t);return n?Mf+n:void 0},Uf=r=>{const{theme:e,classGroups:t}=r;return Wf(t,e)},Wf=(r,e)=>{const t=Xa();for(const n in r){const i=r[n];So(i,t,n,e)}return t},So=(r,e,t,n)=>{const i=r.length;for(let o=0;o<i;o++){const a=r[o];jf(a,e,t,n)}},jf=(r,e,t,n)=>{if(typeof r=="string"){Bf(r,e,t);return}if(typeof r=="function"){Ff(r,e,t,n);return}Vf(r,e,t,n)},Bf=(r,e,t)=>{const n=r===""?e:Za(e,r);n.classGroupId=t},Ff=(r,e,t,n)=>{if(Kf(r)){So(r(n),e,t,n);return}e.validators===null&&(e.validators=[]),e.validators.push(zf(t,r))},Vf=(r,e,t,n)=>{const i=Object.entries(r),o=i.length;for(let a=0;a<o;a++){const[s,c]=i[a];So(c,Za(e,s),t,n)}},Za=(r,e)=>{let t=r;const n=e.split(Jn),i=n.length;for(let o=0;o<i;o++){const a=n[o];let s=t.nextPart.get(a);s||(s=Xa(),t.nextPart.set(a,s)),t=s}return t},Kf=r=>"isThemeGetter"in r&&r.isThemeGetter===!0,Hf="!",qf=58,Yf=47,Xf=91,Jf=93,Zf=40,Qf=41,Cs=33,eh=(r,e,t,n)=>({modifiers:r,hasImportantModifier:e,baseClassName:t,maybePostfixModifierPosition:n,isExternal:void 0}),As=r=>{const e=[];let t=0,n=0,i=0,o;const a=r.length;for(let h=0;h<a;h++){const g=r.charCodeAt(h);if(t===0&&n===0){if(g===qf){e.push(r.slice(i,h)),i=h+1;continue}if(g===Yf){o=h;continue}}g===Xf?t++:g===Jf?t--:g===Zf?n++:g===Qf&&n--}const s=e.length===0?r:r.slice(i);let c=s,l=!1;const d=s.length-1;s.charCodeAt(d)===Cs?(c=s.slice(0,-1),l=!0):s.charCodeAt(0)===Cs&&(c=s.slice(1),l=!0);const f=o&&o>i?o-i:void 0;return eh(e,l,c,f)},th=r=>{const e=new Set(r.orderSensitiveModifiers);return t=>{const n=[];let i=[];for(let o=0;o<t.length;o++){const a=t[o],s=a[0]==="[",c=e.has(a);if(s||c){if(i.length>0){i.sort();for(let l=0;l<i.length;l++)n.push(i[l]);i=[]}n.push(a)}else i.push(a)}if(i.length>0){i.sort();for(let o=0;o<i.length;o++)n.push(i[o])}return n}},Oi={isExternal:!0,classId:-1,conflictIds:[]},rh=4096,nh=16384,ih=r=>{const e=th(r),t=oh(r),{getClassGroupId:n,getConflictingClassGroupIds:i}=Nf(r);let o=Object.create(null),a=Object.create(null),s=0,c=new Int32Array(256),l=0,d=new Uint8Array(64),f=!1;const h=v=>{const p=[],E=v.length;let S=-1;f=!1;for(let $=0;$<E;$++){const x=v.charCodeAt($);x===32?S!==-1&&(p.push(v.slice(S,$)),S=-1):x>=9&&x<=13?(f=!0,S!==-1&&(p.push(v.slice(S,$)),S=-1)):S===-1&&(S=$)}return S!==-1&&p.push(v.slice(S)),p},g=new Map;let y=0;const C=v=>{let p=g.get(v);if(p===void 0&&(p=y++,g.set(v,p),p>=c.length)){const E=new Int32Array(c.length*2);E.set(c),c=E}return p},b=v=>{const{isExternal:p,modifiers:E,hasImportantModifier:S,baseClassName:$,maybePostfixModifierPosition:x}=As(v);if(p)return Oi;let D=!!x,I;if(D){const ce=$.substring(0,x);I=n(ce);const L=I&&t[I]?n($):void 0;L&&L!==I&&(I=L,D=!1)}else I=n($);if(!I){if(!D||(I=n($),!I))return Oi;D=!1}const j=E.length===0?"":E.length===1?E[0]:e(E).join(":"),O=S?j+Hf:j,w=i(I,D),ge=[];for(let ce=0;ce<w.length;ce++)ge.push(C(O+w[ce]));return{isExternal:!1,classId:C(O+I),conflictIds:ge}},m=v=>{let p=o[v];return p!==void 0||(p=a[v],p===void 0&&(p=b(v)),o[v]=p,++s>rh&&(s=0,a=o,o=Object.create(null))),p};return{parseClassName:As,sortModifiers:e,postfixLookupClassGroupIds:t,getClassGroupId:n,getConflictingClassGroupIds:i,getClassDescriptor:m,mergeClassList:v=>{const p=h(v),E=p.length;if(E===1)return p[0];y>nh&&(g.clear(),y=0,o=Object.create(null),a=Object.create(null),s=0),l=l+1|0,l===0&&(l=1);const S=l;if(E>d.length){let I=d.length;for(;I<E;)I*=2;d=new Uint8Array(I)}let $=!1,x=0;for(let I=E-1;I>=0;I-=1){const j=p[I];x+=j.length;const O=m(j);if(O.isExternal){d[I]=1;continue}const w=O.classId;if(c[w]===S){d[I]=0,$=!0;continue}c[w]=S;const ge=O.conflictIds;for(let ce=0;ce<ge.length;ce++)c[ge[ce]]=S;d[I]=1}if(!$&&!f&&v.length===x+E-1)return v;let D="";for(let I=0;I<E;I++)d[I]===1&&(D&&(D+=" "),D+=p[I]);return D}}},oh=r=>{const e=Object.create(null),t=r.postfixLookupClassGroups;if(t)for(let n=0;n<t.length;n++)e[t[n]]=!0;return e},sh=500,$s=r=>{let e,t,n=Object.create(null),i=Object.create(null),o=0;const a=l=>(e=ih(r()),t=e.mergeClassList,c.mergeString=s,s(l)),s=l=>{let d=n[l];return d!==void 0||(d=i[l],d===void 0&&(d=t(l)),n[l]=d,++o>sh&&(o=0,i=n,n=Object.create(null))),d},c=(...l)=>c.mergeString(ii(l));return c.mergeString=a,c},ah=[],ct=r=>{const e=t=>t[r]||ah;return e.isThemeGetter=!0,e},Qa=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ec=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ch=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,lh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,uh=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,dh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,fh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,tc=Number,ph=Number.isNaN,gh=Number.isInteger,cr=r=>ch.test(r),Ge=r=>!!r&&!ph(tc(r)),Ft=r=>!!r&&gh(tc(r)),zi=r=>r.endsWith("%")&&Ge(r.slice(0,-1)),Xt=r=>lh.test(r),rc=()=>!0,mh=r=>uh.test(r)&&!dh.test(r),Co=()=>!1,vh=r=>fh.test(r),yh=r=>hh.test(r),bh=r=>!Y(r)&&!Z(r),wh=r=>r.startsWith("@container")&&(r[10]==="/"&&r[11]!==void 0||r[11]==="s"&&r[16]!==void 0&&r.startsWith("-size/",10)||r[11]==="n"&&r[18]!==void 0&&r.startsWith("-normal/",10)),_h=r=>pr(r,oc,Co),Y=r=>Qa.test(r),vr=r=>pr(r,sc,mh),Ds=r=>pr(r,Dh,Ge),xh=r=>pr(r,cc,rc),kh=r=>pr(r,ac,Co),Is=r=>pr(r,nc,Co),Eh=r=>pr(r,ic,yh),zn=r=>pr(r,lc,vh),Z=r=>ec.test(r),Jr=r=>kr(r,sc),Sh=r=>kr(r,ac),Ls=r=>kr(r,nc),Ch=r=>kr(r,oc),Ah=r=>kr(r,ic),Mn=r=>kr(r,lc,!0),$h=r=>kr(r,cc,!0),pr=(r,e,t)=>{const n=Qa.exec(r);return n?n[1]?e(n[1]):t(n[2]):!1},kr=(r,e,t=!1)=>{const n=ec.exec(r);return n?n[1]?e(n[1]):t:!1},nc=r=>r==="position"||r==="percentage",ic=r=>r==="image"||r==="url",oc=r=>r==="length"||r==="size"||r==="bg-size",sc=r=>r==="length",Dh=r=>r==="number",ac=r=>r==="family-name",cc=r=>r==="number"||r==="weight",lc=r=>r==="shadow",Mi=()=>{const r=ct("color"),e=ct("font"),t=ct("text"),n=ct("font-weight"),i=ct("tracking"),o=ct("leading"),a=ct("breakpoint"),s=ct("container"),c=ct("spacing"),l=ct("radius"),d=ct("shadow"),f=ct("inset-shadow"),h=ct("text-shadow"),g=ct("drop-shadow"),y=ct("blur"),C=ct("perspective"),b=ct("aspect"),m=ct("ease"),A=ct("animate"),v=()=>["auto","avoid","all","avoid-page","page","left","right","column"],p=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...p(),Z,Y],S=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],x=()=>[Z,Y,c],D=()=>[cr,"full","auto",...x()],I=()=>[Ft,"none","subgrid",Z,Y],j=()=>["auto",{span:["full",Ft,Z,Y]},Ft,Z,Y],O=()=>[Ft,"auto",Z,Y],w=()=>["auto","min","max","fr",Z,Y],ge=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ce=()=>["start","end","center","stretch","center-safe","end-safe"],L=()=>["auto",...x()],_=()=>[cr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...x()],K=()=>[cr,"screen","full","dvw","lvw","svw","min","max","fit",...x()],ee=()=>[cr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...x()],M=()=>[r,Z,Y],Re=()=>[...p(),Ls,Is,{position:[Z,Y]}],ae=()=>["no-repeat",{repeat:["","x","y","space","round"]}],W=()=>["auto","cover","contain",Ch,_h,{size:[Z,Y]}],Se=()=>[zi,Jr,vr],Ce=()=>["","none","full",l,Z,Y],be=()=>["",Ge,Jr,vr],Ye=()=>["solid","dashed","dotted","double"],ot=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ae=()=>[Ge,zi,Ls,Is],ve=()=>["","none",y,Z,Y],X=()=>["none",Ge,Z,Y],me=()=>["none",Ge,Z,Y],et=()=>[Ge,Z,Y],J=()=>[cr,"full",...x()];return{theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xt],breakpoint:[Xt],color:[rc],container:[Xt],"drop-shadow":[Xt],ease:["in","out","in-out"],font:[bh],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xt],shadow:[Xt],spacing:["px",Ge],text:[Xt],"text-shadow":[Xt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",cr,Y,Z,b]}],container:["container"],"container-type":[{"@container":["","normal","size",Z,Y]}],"container-named":[wh],columns:[{columns:[Ge,Y,Z,s]}],"break-after":[{"break-after":v()}],"break-before":[{"break-before":v()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:D()}],"inset-x":[{"inset-x":D()}],"inset-y":[{"inset-y":D()}],start:[{"inset-s":D(),start:D()}],end:[{"inset-e":D(),end:D()}],"inset-bs":[{"inset-bs":D()}],"inset-be":[{"inset-be":D()}],top:[{top:D()}],right:[{right:D()}],bottom:[{bottom:D()}],left:[{left:D()}],visibility:["visible","invisible","collapse"],z:[{z:[Ft,"auto",Z,Y]}],basis:[{basis:[cr,"full","auto",s,...x()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ge,cr,"auto","initial","none",Y]}],grow:[{grow:["",Ge,Z,Y]}],shrink:[{shrink:["",Ge,Z,Y]}],order:[{order:[Ft,"first","last","none",Z,Y]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:j()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:j()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":w()}],"auto-rows":[{"auto-rows":w()}],gap:[{gap:x()}],"gap-x":[{"gap-x":x()}],"gap-y":[{"gap-y":x()}],"justify-content":[{justify:[...ge(),"normal"]}],"justify-items":[{"justify-items":[...ce(),"normal"]}],"justify-self":[{"justify-self":["auto",...ce()]}],"align-content":[{content:["normal",...ge()]}],"align-items":[{items:[...ce(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ce(),{baseline:["","last"]}]}],"place-content":[{"place-content":ge()}],"place-items":[{"place-items":[...ce(),"baseline"]}],"place-self":[{"place-self":["auto",...ce()]}],p:[{p:x()}],px:[{px:x()}],py:[{py:x()}],ps:[{ps:x()}],pe:[{pe:x()}],pbs:[{pbs:x()}],pbe:[{pbe:x()}],pt:[{pt:x()}],pr:[{pr:x()}],pb:[{pb:x()}],pl:[{pl:x()}],m:[{m:L()}],mx:[{mx:L()}],my:[{my:L()}],ms:[{ms:L()}],me:[{me:L()}],mbs:[{mbs:L()}],mbe:[{mbe:L()}],mt:[{mt:L()}],mr:[{mr:L()}],mb:[{mb:L()}],ml:[{ml:L()}],"space-x":[{"space-x":x()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":x()}],"space-y-reverse":["space-y-reverse"],size:[{size:_()}],"inline-size":[{inline:["auto",...K()]}],"min-inline-size":[{"min-inline":["auto",...K()]}],"max-inline-size":[{"max-inline":["none",...K()]}],"block-size":[{block:["auto",...ee()]}],"min-block-size":[{"min-block":["auto",...ee()]}],"max-block-size":[{"max-block":["none",...ee()]}],w:[{w:[s,"screen",..._()]}],"min-w":[{"min-w":[s,"screen","none",..._()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[a]},..._()]}],h:[{h:["screen","lh",..._()]}],"min-h":[{"min-h":["screen","lh","none",..._()]}],"max-h":[{"max-h":["screen","lh",..._()]}],"font-size":[{text:["base",t,Jr,vr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,$h,xh]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",zi,Y]}],"font-family":[{font:[Sh,kh,e]}],"font-features":[{"font-features":[Y]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,Z,Y]}],"line-clamp":[{"line-clamp":[Ge,"none",Z,Ds]}],leading:[{leading:[o,...x()]}],"list-image":[{"list-image":["none",Z,Y]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Z,Y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ye(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ge,"from-font","auto",Z,vr]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Ge,"auto",Z,Y]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:x()}],"tab-size":[{tab:[Ft,Z,Y]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Z,Y]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Z,Y]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Re()}],"bg-repeat":[{bg:ae()}],"bg-size":[{bg:W()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ft,Z,Y],radial:["",Z,Y],conic:[Ft,Z,Y]},Ah,Eh]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:Se()}],"gradient-via-pos":[{via:Se()}],"gradient-to-pos":[{to:Se()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:Ce()}],"rounded-s":[{"rounded-s":Ce()}],"rounded-e":[{"rounded-e":Ce()}],"rounded-t":[{"rounded-t":Ce()}],"rounded-r":[{"rounded-r":Ce()}],"rounded-b":[{"rounded-b":Ce()}],"rounded-l":[{"rounded-l":Ce()}],"rounded-ss":[{"rounded-ss":Ce()}],"rounded-se":[{"rounded-se":Ce()}],"rounded-ee":[{"rounded-ee":Ce()}],"rounded-es":[{"rounded-es":Ce()}],"rounded-tl":[{"rounded-tl":Ce()}],"rounded-tr":[{"rounded-tr":Ce()}],"rounded-br":[{"rounded-br":Ce()}],"rounded-bl":[{"rounded-bl":Ce()}],"border-w":[{border:be()}],"border-w-x":[{"border-x":be()}],"border-w-y":[{"border-y":be()}],"border-w-s":[{"border-s":be()}],"border-w-e":[{"border-e":be()}],"border-w-bs":[{"border-bs":be()}],"border-w-be":[{"border-be":be()}],"border-w-t":[{"border-t":be()}],"border-w-r":[{"border-r":be()}],"border-w-b":[{"border-b":be()}],"border-w-l":[{"border-l":be()}],"divide-x":[{"divide-x":be()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":be()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ye(),"hidden","none"]}],"divide-style":[{divide:[...Ye(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...Ye(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ge,Z,Y]}],"outline-w":[{outline:["",Ge,Jr,vr]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",d,Mn,zn]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",f,Mn,zn]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:be()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Ge,vr]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":be()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",h,Mn,zn]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Ge,Z,Y]}],"mix-blend":[{"mix-blend":[...ot(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ot()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ge]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ae()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":Ae()}],"mask-image-t-to-pos":[{"mask-t-to":Ae()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":Ae()}],"mask-image-r-to-pos":[{"mask-r-to":Ae()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":Ae()}],"mask-image-b-to-pos":[{"mask-b-to":Ae()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":Ae()}],"mask-image-l-to-pos":[{"mask-l-to":Ae()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":Ae()}],"mask-image-x-to-pos":[{"mask-x-to":Ae()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":Ae()}],"mask-image-y-to-pos":[{"mask-y-to":Ae()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Z,Y]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ae()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":p()}],"mask-image-conic-pos":[{"mask-conic":[Ge]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ae()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Re()}],"mask-repeat":[{mask:ae()}],"mask-size":[{mask:W()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Z,Y]}],filter:[{filter:["","none",Z,Y]}],blur:[{blur:ve()}],brightness:[{brightness:[Ge,Z,Y]}],contrast:[{contrast:[Ge,Z,Y]}],"drop-shadow":[{"drop-shadow":["","none",g,Mn,zn]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",Ge,Z,Y]}],"hue-rotate":[{"hue-rotate":[Ge,Z,Y]}],invert:[{invert:["",Ge,Z,Y]}],saturate:[{saturate:[Ge,Z,Y]}],sepia:[{sepia:["",Ge,Z,Y]}],"backdrop-filter":[{"backdrop-filter":["","none",Z,Y]}],"backdrop-blur":[{"backdrop-blur":ve()}],"backdrop-brightness":[{"backdrop-brightness":[Ge,Z,Y]}],"backdrop-contrast":[{"backdrop-contrast":[Ge,Z,Y]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ge,Z,Y]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ge,Z,Y]}],"backdrop-invert":[{"backdrop-invert":["",Ge,Z,Y]}],"backdrop-opacity":[{"backdrop-opacity":[Ge,Z,Y]}],"backdrop-saturate":[{"backdrop-saturate":[Ge,Z,Y]}],"backdrop-sepia":[{"backdrop-sepia":["",Ge,Z,Y]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":x()}],"border-spacing-x":[{"border-spacing-x":x()}],"border-spacing-y":[{"border-spacing-y":x()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Z,Y]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ge,"initial",Z,Y]}],ease:[{ease:["linear","initial",m,Z,Y]}],delay:[{delay:[Ge,Z,Y]}],animate:[{animate:["none",A,Z,Y]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[C,Z,Y]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:X()}],"rotate-x":[{"rotate-x":X()}],"rotate-y":[{"rotate-y":X()}],"rotate-z":[{"rotate-z":X()}],scale:[{scale:me()}],"scale-x":[{"scale-x":me()}],"scale-y":[{"scale-y":me()}],"scale-z":[{"scale-z":me()}],"scale-3d":["scale-3d"],skew:[{skew:et()}],"skew-x":[{"skew-x":et()}],"skew-y":[{"skew-y":et()}],transform:[{transform:[Z,Y,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:J()}],"translate-x":[{"translate-x":J()}],"translate-y":[{"translate-y":J()}],"translate-z":[{"translate-z":J()}],"translate-none":["translate-none"],zoom:[{zoom:[Ft,Z,Y]}],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Z,Y]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":M()}],"scrollbar-track-color":[{"scrollbar-track":M()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":x()}],"scroll-mx":[{"scroll-mx":x()}],"scroll-my":[{"scroll-my":x()}],"scroll-ms":[{"scroll-ms":x()}],"scroll-me":[{"scroll-me":x()}],"scroll-mbs":[{"scroll-mbs":x()}],"scroll-mbe":[{"scroll-mbe":x()}],"scroll-mt":[{"scroll-mt":x()}],"scroll-mr":[{"scroll-mr":x()}],"scroll-mb":[{"scroll-mb":x()}],"scroll-ml":[{"scroll-ml":x()}],"scroll-p":[{"scroll-p":x()}],"scroll-px":[{"scroll-px":x()}],"scroll-py":[{"scroll-py":x()}],"scroll-ps":[{"scroll-ps":x()}],"scroll-pe":[{"scroll-pe":x()}],"scroll-pbs":[{"scroll-pbs":x()}],"scroll-pbe":[{"scroll-pbe":x()}],"scroll-pt":[{"scroll-pt":x()}],"scroll-pr":[{"scroll-pr":x()}],"scroll-pb":[{"scroll-pb":x()}],"scroll-pl":[{"scroll-pl":x()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Z,Y]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[Ge,Jr,vr,Ds]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Ih=(r,{extend:e={},override:t={}})=>(Nn(r.theme,t.theme),Nn(r.classGroups,t.classGroups),Nn(r.conflictingClassGroups,t.conflictingClassGroups),Nn(r.conflictingClassGroupModifiers,t.conflictingClassGroupModifiers),po(r,"postfixLookupClassGroups",t.postfixLookupClassGroups),po(r,"orderSensitiveModifiers",t.orderSensitiveModifiers),Pn(r.theme,e.theme),Pn(r.classGroups,e.classGroups),Pn(r.conflictingClassGroups,e.conflictingClassGroups),Pn(r.conflictingClassGroupModifiers,e.conflictingClassGroupModifiers),go(r,e,"postfixLookupClassGroups"),go(r,e,"orderSensitiveModifiers"),r),po=(r,e,t)=>{t!==void 0&&(r[e]=t)},Nn=(r,e)=>{if(e)for(const t in e)po(r,t,e[t])},Pn=(r,e)=>{if(e)for(const t in e)go(r,e,t)},go=(r,e,t)=>{const n=e[t];n!==void 0&&(r[t]=r[t]?r[t].concat(n):n)},uc=r=>$s(r?typeof r=="function"?()=>r(Mi()):()=>Ih(Mi(),r):Mi),Lh=r=>{if(Mt(r))return;const e=r,t={...e.extend??{}};for(const i of["theme","classGroups","conflictingClassGroups","conflictingClassGroupModifiers","postfixLookupClassGroups","orderSensitiveModifiers","cacheSize","prefix","separator","experimentalParseClassName"])e[i]!==void 0&&t[i]===void 0&&(t[i]=e[i]);const n={};if(Object.keys(t).length>0&&(n.extend=t),e.override!=null&&!Mt(e.override)&&(n.override=e.override),!(!n.extend&&!n.override))return n},Th=r=>{const e=Lh(r),t=uc(e);return n=>t.mergeString(n)},Hn,Gh=()=>(Hn||(Hn=uc()),Hn),Rh=()=>((!Ct.cachedTwMerge||Ct.didTwMergeConfigChange)&&(Ct.didTwMergeConfigChange=!1,Ct.cachedTwMerge=Th(Ct.cachedTwMergeConfig)),Ct.cachedTwMerge),Oh=r=>{const e=r==null?void 0:r.twMergeConfig;!e||Mt(e)||Ua(e,Ct.cachedTwMergeConfig)||(Ct.cachedTwMergeConfig=e,Ct.didTwMergeConfigChange=!0)},zh=r=>ii(r),Mh=Ct.reset.bind(Ct);Ct.reset=()=>{Hn=void 0,Mh()};var Nh=(r,e)=>{const t=zh(r);return!t||!((e==null?void 0:e.twMerge)??!0)?t||void 0:t.indexOf(" ")===-1?t:(Oh(e),(!!(e!=null&&e.twMergeConfig&&!Mt(e.twMergeConfig))?Rh():Gh().mergeString)(t)||void 0)},Ph=(r,...e)=>Nh(e,r),Uh=Rf(Ph),Wh=Uh.tv;function jh(r){const e=r==="muted"?"ink-muted":r;return e==="current"?"currentColor":`var(--reddb-color-${e})`}function Bh(r){return`var(--reddb-spatial-icon-size-${r})`}var Fh=At('<svg><path d="M4 5h16"></path><path d="M4 12h16"></path><path d="M4 19h16"></path></svg>');function Vh(r,e){ri(e,!0);let t=Gt(e,"size",3,"md"),n=Gt(e,"color",3,"foreground"),i=Ze(e,["$$slots","$$events","$$legacy","icon","size","color","class"]);const o=Q(()=>Bh(t())),a=Q(()=>jh(n())),s=Q(()=>e.icon);Zt(()=>{n()});var c=er(),l=lt(c);{var d=h=>{var g=Fh();qn(g,()=>({...i,"data-icon":!0,width:u(o),height:u(o),viewBox:"0 0 24 24",fill:"none",stroke:u(a),"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:e.class})),V(h,g)},f=h=>{var g=er(),y=lt(g);hu(y,()=>u(s),(C,b)=>{b(C,it(()=>i,{"data-icon":!0,get size(){return u(o)},get color(){return u(a)},strokeWidth:2,get class(){return e.class}}))}),V(h,g)};ke(l,h=>{e.icon==="menu"?h(d):h(f,-1)})}V(r,c),ni()}const Kh={sm:{root:"gap-[var(--reddb-spatial-gap-md)] px-[var(--reddb-spatial-inset-md)] py-[var(--reddb-spatial-inset-lg)]",title:"text-sm",description:"text-xs",hint:"text-xs"},md:{root:"gap-[var(--reddb-spatial-gap-lg)] px-[var(--reddb-spatial-inset-lg)] py-10",title:"text-base",description:"text-sm",hint:"text-xs"}},Hh={true:{root:"border-dashed border-muted"},false:{root:"border-transparent"}},qh=Wh({slots:{root:"flex flex-col items-center justify-center rounded-lg border text-center",media:"text-ink-muted",title:"font-medium leading-tight text-foreground",description:"max-w-prose text-ink-muted",hint:"max-w-full rounded-md border border-muted px-2 py-1 font-mono text-ink-muted",actions:"flex flex-wrap items-center justify-center gap-[var(--reddb-spatial-gap-md)] pt-1"},variants:{size:Kh,bordered:Hh},defaultVariants:{size:"md",bordered:!0}});var Yh=he('<div aria-hidden="true"><!></div>'),Xh=he("<p> </p>"),Jh=he("<code> </code>"),Zh=he("<div><!></div>"),Qh=he("<div><!> <p> </p> <!> <!> <!></div>");function ep(r,e){ri(e,!0);const t=Gt(e,"size",3,"md"),n=Gt(e,"bordered",3,!0),i=Ze(e,["$$slots","$$events","$$legacy","title","description","hint","size","bordered","media","actions","class"]),o=Q(()=>qh({size:t(),bordered:n()}));var a=Qh();qn(a,m=>({...i,class:m}),[()=>u(o).root({class:e.class})]);var s=R(a);{var c=m=>{var A=Yh(),v=R(A);so(v,()=>e.media),T(A),pe(p=>Et(A,1,p),[()=>Dt(u(o).media())]),V(m,A)};ke(s,m=>{e.media&&m(c)})}var l=P(s,2),d=R(l,!0);T(l);var f=P(l,2);{var h=m=>{var A=Xh(),v=R(A,!0);T(A),pe(p=>{Et(A,1,p),fe(v,e.description)},[()=>Dt(u(o).description())]),V(m,A)};ke(f,m=>{e.description&&m(h)})}var g=P(f,2);{var y=m=>{var A=Jh(),v=R(A,!0);T(A),pe(p=>{Et(A,1,p),fe(v,e.hint)},[()=>Dt(u(o).hint())]),V(m,A)};ke(g,m=>{e.hint&&m(y)})}var C=P(g,2);{var b=m=>{var A=Zh(),v=R(A);so(v,()=>e.actions),T(A),pe(p=>Et(A,1,p),[()=>Dt(u(o).actions())]),V(m,A)};ke(C,m=>{e.actions&&m(b)})}T(a),pe(m=>{Et(l,1,m),fe(d,e.title)},[()=>Dt(u(o).title())]),V(r,a),ni()}const tp="red-ui:history",rp="history:";function dc(r,e=!1){switch(r){case"embedded":return"none";case"standalone":return"vault";case"web":return e?"none":"labels-only"}}function np(r){if(r.url)try{const t=new URL(r.url).host;if(t)return t}catch{}const e=(r.label??r.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 ip(){return typeof localStorage>"u"?void 0:localStorage}function Ts(r){return`label:${encodeURIComponent(r)}`}function op(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():Math.random().toString(36).slice(2)+Date.now().toString(36)}function Zr(r,e){if(!r)return[];try{const t=r.getItem(e);if(!t)return[];const n=JSON.parse(t);return Array.isArray(n)?n.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 Gs(r,e,t){if(r)try{r.setItem(e,JSON.stringify(t))}catch{}}class sp{constructor(e){Te(this,"surface");Te(this,"secureStore");Te(this,"managedWebTarget");Te(this,"storage");Te(this,"historyKey");Te(this,"urlPrefix");Te(this,"idByUrl",new Map);Te(this,"urlById",new Map);Te(this,"onChange");this.surface=e.surface,this.secureStore=e.secureStore,this.managedWebTarget=e.managedWebTarget??(()=>!1),this.storage=e.storage??ip(),this.historyKey=e.historyKey??tp,this.urlPrefix=e.urlPrefix??rp}setOnChange(e){this.onChange=e}persistence(){return dc(this.surface(),this.managedWebTarget())}load(){return this.persistence()==="none"?[]:Zr(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 n=Zr(this.storage,this.historyKey),i=new Map(n.map(f=>[f.label,f])),o=[],a=new Set,s=new Set;for(const f of e){const h=np(f);if(!h)continue;let g;f.url?(g=t==="labels-only"?Ts(h):this.idByUrl.get(f.url)??op(),this.idByUrl.set(f.url,g),this.urlById.set(g,f.url)):g=((l=i.get(h))==null?void 0:l.id)??Ts(h),!(a.has(g)||!f.url&&s.has(h))&&(a.add(g),s.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(Gs(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"?[]:Zr(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=Zr(this.storage,this.historyKey);let n=!1;for(const o of t)if(!this.urlById.has(o.id))try{const a=await e.get(this.urlPrefix+o.id);a&&(this.urlById.set(o.id,a),this.idByUrl.set(a,o.id),n=!0)}catch{}n&&((i=this.onChange)==null||i.call(this))}async forgetById(e){var o,a;if(this.persistence()==="none"){(o=this.onChange)==null||o.call(this);return}const t=Zr(this.storage,this.historyKey).filter(s=>s.id!==e);Gs(this.storage,this.historyKey,t);const n=this.urlById.get(e);n&&(this.urlById.delete(e),this.idByUrl.delete(n));const i=this.persistence()==="vault"?this.secureStore():null;if(i)try{await i.delete(this.urlPrefix+e)}catch{}(a=this.onChange)==null||a.call(this)}async forgetByUrl(e){const t=this.idByUrl.get(e);t&&await this.forgetById(t)}}function ap({tauri:r,inFrame:e,mcp:t,embedLib:n}){return r?"standalone":e||t||n?"embedded":"web"}function cp(){if(typeof window>"u")return"web";const r="__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"),n=window.__RED_UI_EMBED_SURFACE__===!0;return ap({tauri:r,inFrame:e,mcp:t,embedLib:n})}function Ni(r,e){switch(r){case"embedded":return!1;case"standalone":return!0;case"web":return!1}}const mo="red-ui:secure",Rs="__probe__",Os="ok";function zs(){if(typeof localStorage>"u")return!1;for(let r=0;r<localStorage.length;r++){const e=localStorage.key(r);if(e&&e.startsWith(mo+":"))return!0}return!1}var mn,vn,yn,bn,wn,_n;class lp{constructor(){nt(this,mn,Ee(null));nt(this,vn,Ee(!0));nt(this,yn,Ee(!1));nt(this,bn,Ee("unknown"));nt(this,wn,Ee("web"));nt(this,_n,Ee(null));if(typeof window>"u"){this.backend="unknown";return}if(this.surface=cp(),this.surface==="standalone"){this.backend="tauri",this.bindTauri();return}this.backend="web",zs(),this.needsSetup=!1,this.locked=Ni(this.surface)}get store(){return u(xe(this,mn))}set store(e){N(xe(this,mn),e,!0)}get locked(){return u(xe(this,vn))}set locked(e){N(xe(this,vn),e,!0)}get needsSetup(){return u(xe(this,yn))}set needsSetup(e){N(xe(this,yn),e,!0)}get backend(){return u(xe(this,bn))}set backend(e){N(xe(this,bn),e,!0)}get surface(){return u(xe(this,wn))}set surface(e){N(xe(this,wn),e,!0)}get error(){return u(xe(this,_n))}set error(e){N(xe(this,_n),e,!0)}async bindTauri(){try{const e=await fr(()=>import("./DhEqZVGG.js"),[],import.meta.url);this.store=new qd({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 Kd(e,{namespace:mo})}catch(n){return this.error=n.message,!1}try{const n=await t.get(Rs);if(n===null)await t.put(Rs,Os);else if(n!==Os)return this.error="Wrong password",!1}catch(n){return n instanceof wt&&n.code==="DECRYPT_FAILED"?(this.error="Wrong password",!1):(this.error=n.message,!1)}return this.store=t,this.locked=!1,this.needsSetup=!1,!0}lock(){this.store=null,this.backend==="web"&&(this.locked=Ni(this.surface,zs()))}wipe(){if(typeof localStorage>"u")return;const e=[];for(let t=0;t<localStorage.length;t++){const n=localStorage.key(t);n&&(n.startsWith(mo+":")||n.startsWith("red-ui:"))&&e.push(n)}for(const t of e)localStorage.removeItem(t);this.store=null,this.backend==="web"&&(this.locked=Ni(this.surface),this.needsSetup=!1),this.error=null}}mn=new WeakMap,vn=new WeakMap,yn=new WeakMap,bn=new WeakMap,wn=new WeakMap,_n=new WeakMap;const cn=new lp,fc=[{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."}],Ms=Ma;function Ns(r){if(typeof localStorage>"u")return;if(fp()!=="vault"){try{localStorage.removeItem(Ms)}catch{}return}try{localStorage.setItem(Ms,JSON.stringify(r))}catch{}}const up=/(handoff|token|secret|password|passwd|auth|credential|api[-_]?key|bearer)/i;let Ao=!1;function dp(){cn.surface==="web"&&(Ao=!0)}function hc(){if(Ao)return!0;if(cn.surface!=="web"||typeof location>"u")return!1;for(const r of[location.search,location.hash]){const e=new URLSearchParams(r.startsWith("#")?r.slice(1):r);for(const t of e.keys())if(up.test(t))return!0}return!1}function fp(){return dc(cn.surface,hc())}const yr=new sp({surface:()=>cn.surface,secureStore:()=>cn.store,managedWebTarget:hc});function hp(r){return r.trim()?hr(r).url:""}function ty(r){if(!r.trim())return{url:""};try{return hr(r)}catch{throw new Error("Invalid connection string. Check the address and provide both username and password.")}}function on(r){const e=hp(r);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 oi(){return typeof window<"u"&&("__TAURI_INTERNALS__"in window||"__TAURI__"in window)}function pp(){return[...oi()?vd:wo]}async function gp(r){if(!oi())throw new Error("file:// databases can only be opened in the desktop app");const e=r.replace(/^file:\/\//i,""),{invoke:t}=await fr(async()=>{const{invoke:n}=await import("./DhEqZVGG.js");return{invoke:n}},[],import.meta.url);try{return await t("open_embedded",{path:e})}catch(n){throw Xn.from(n)}}const pc=async(r,e)=>{const t=typeof r=="string"?r:r instanceof URL?r.href:r.url,n=/^https?:\/\/(127\.0\.0\.1|localhost|\[::1\])(:\d+)?(\/|$)/i.test(t);if(oi()&&n)try{const{fetch:i}=await fr(async()=>{const{fetch:o}=await import("./B5euRbKa.js");return{fetch:o}},__vite__mapDeps([0,1]),import.meta.url);return await i(r,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(r,e)};function Ps(r){return typeof r.useHandoffToken=="function"}const mp=new Ld({presets:fc,history:yr,transports:pp(),embeddedResolver:gp,clientFactory:(r,e)=>new bo(r,{...e,fetch:pc}),bootParams:Cd(typeof location<"u"?location.search:"",typeof location<"u"?location.hash:"")});let gc=mp;function Or(){return gc}function ry(r){gc=r}var xn,kn,En,Sn,dr,_r,Pr;class vp{constructor(){nt(this,xn,Ee(!1));nt(this,kn,Ee(Kt(fc[1])));nt(this,En,Ee(Kt({reachable:!1})));nt(this,Sn,Ee(Kt([])));nt(this,dr,Ee(null));nt(this,_r,Ee(Kt({...wr})));nt(this,Pr,Ee(!1));this.history=yr.uiEntries(),yr.setOnChange(()=>{this.history=yr.uiEntries()})}get connected(){return u(xe(this,xn))}set connected(e){N(xe(this,xn),e,!0)}get active(){return u(xe(this,kn))}set active(e){N(xe(this,kn),e,!0)}get probe(){return u(xe(this,En))}set probe(e){N(xe(this,En),e,!0)}get history(){return u(xe(this,Sn))}set history(e){N(xe(this,Sn),e,!0)}get targetResolved(){return u(xe(this,Pr))}get client(){return u(xe(this,dr))}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(xe(this,_r))}get supportedTransports(){var e,t;return((t=(e=Or()).transports)==null?void 0:t.call(e))??[...wo]}canReach(e){return yd(e,this.supportedTransports)}async forget(e){await yr.forgetByUrl(e)}async forgetById(e){await yr.forgetById(e)}async hydrateUrls(){await yr.hydrate()}async bootstrap(e=jd){const t=await e(),n=t.route??null;if(t.error)return this.disconnect(),this.probe={reachable:!1,error:t.error},n;if(!t.target)return n;if(!t.token)return await this.connectString(t.target),n;let i;try{const o=hr(t.target);if(o.credentials)throw new Error("Choose either connection credentials or a session token.");i=on(o.url)}catch(o){return this.disconnect(),this.active=on(""),this.probe={reachable:!1,error:o instanceof Error?o.message:"Invalid connection string."},n}if(t.token){dp();const o=Or();Ps(o)&&o.useHandoffToken(i.url,t.token)}return await this.tryConnect(i),n}async switch(e){this.active=e,Ns(e),await this.tryConnect(e)}async connectString(e,t){try{const n=hr(e);if(n.credentials&&t)throw new Error("Use credentials in either the connection string or the sign-in fields.");const i=t??n.credentials,o=on(n.url);if(!this.canReach(n.url))throw new Error(yp(n.url)??"This connection transport is not available here.");return i?await this.login(o,i.username,i.password):await this.tryConnect(o)}catch(n){return this.disconnect(),this.active=on(""),this.probe={reachable:!1,error:n instanceof Error?n.message:"Invalid connection string."},!1}}async login(e,t,n){this.active=e,N(xe(this,dr),null),this.connected=!1,N(xe(this,_r),{...wr},!0),this.probe={reachable:!1};try{const i=Or();if(!Ps(i))throw new Error("This connection is managed by its host.");const o=await new bo(e.url,{fetch:pc}).login(t,n);return i.useHandoffToken(e.url,o),await this.tryConnect(e)}catch(i){return this.probe={reachable:!1,error:i instanceof Error?i.message:"Database sign-in failed."},!1}}async tryConnect(e){this.active=e,N(xe(this,dr),null),this.connected=!1,N(xe(this,Pr),!0),Xr.begin(`Opening ${e.label}`);try{Xr.step("Reaching server",e.url);const t=await lr.track(`connect · ${e.label}`,()=>Or().connect(e.id));N(xe(this,dr),t.client,!0),this.active={...e,...t.connection,description:e.description},Ns(this.active),Xr.step("Fetching stats & capabilities");const[n,i,o]=await Promise.all([lr.track(`connect · ${e.label} stats`,()=>t.client.stats()).catch(()=>{}),lr.track(`connect · ${e.label} replication`,()=>t.client.replication()).catch(()=>{}),lr.track(`connect · ${e.label} capabilities`,()=>t.client.capabilities()).catch(()=>({...wr}))]);return this.probe={reachable:!0,rtt_ms:t.rtt_ms,stats:n,replication:i},N(xe(this,_r),o,!0),this.connected=!0,Xr.succeed(),!0}catch(t){return this.probe={reachable:!1,error:t.message},Xr.fail(t.message),!1}}async adoptInjected(){const[e]=await Or().list();if(!e)return!1;const t={...e,description:e.description??"Injected by the embedding host."};return this.tryConnect(t)}async connectFromBootParams(){var n,i;const e=(i=(n=Or()).bootParams)==null?void 0:i.call(n);if(!e)return null;const t=e.to??e.view??null;return e.endpoint&&await this.connectString(e.endpoint),t}async refresh(){const e=this.client;if(!e){await this.tryConnect(this.active);return}try{const t=await lr.track(`heartbeat · ${this.active.label}`,()=>e.ping());if(!t.ok){this.probe={reachable:!1,error:t.error};return}const[n,i]=await Promise.all([lr.track("heartbeat · stats",()=>e.stats()).catch(()=>{}),lr.track("heartbeat · replication",()=>e.replication()).catch(()=>{})]);this.probe={reachable:!0,rtt_ms:t.rtt_ms,stats:n,replication:i},this.connected=!0}catch(t){this.probe={reachable:!1,error:t.message}}}disconnect(){this.connected=!1,this.probe={reachable:!1},N(xe(this,dr),null),N(xe(this,_r),{...wr},!0),N(xe(this,Pr),!1),Ao=!1}}xn=new WeakMap,kn=new WeakMap,En=new WeakMap,Sn=new WeakMap,dr=new WeakMap,_r=new WeakMap,Pr=new WeakMap;const Zn=new vp,mc="Local database files (file://) can only be opened in the desktop app — the web version can't reach files on your machine.";function yp(r){return Zn.canReach(r)?null:Ta(r)==="unix"?mc:null}async function ny(r){if(!oi())return{ok:!1,reason:mc};const e=(await fr(async()=>{const{open:i}=await import("./C-kqMbRi.js");return{open:i}},__vite__mapDeps([2,1]),import.meta.url)).open,t=await e({multiple:!1,directory:!1,title:"Open database file",filters:[{name:"reddb database",extensions:["rdb"]}]});return t?await Zn.tryConnect(on(`file://${t}`))?{ok:!0}:{ok:!1,reason:Zn.probe.error??"unreachable"}:{ok:!1,cancelled:!0}}const vc={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56"}]],aliases:["loader-2"]};vc.node;function bp(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return vc}}))}const yc={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34"}],["circle",{cx:"11",cy:"11",r:"8"}]]};yc.node;function wp(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return yc}}))}const bc={name:"network",size:24,node:[["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"}]]};bc.node;function Us(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return bc}}))}function iy(r){return r?r==="graph"?"graph":r:"table"}function oy(r,e){switch(r){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 r;default:return e}}function Pi(r,e){return`/c/${encodeURIComponent(r)}/p/${encodeURIComponent(e)}`}const wc={name:"triangle-alert",size:24,node:[["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"}]],aliases:["alert-triangle"]};wc.node;function Ws(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return wc}}))}const _c={name:"play",size:24,node:[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"}]]};_c.node;function _p(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return _c}}))}const xc={name:"rotate-cw",size:24,node:[["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"}]]};xc.node;function xp(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return xc}}))}function $o(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Un={exports:{}},js;function kp(){if(js)return Un.exports;js=1;var r=typeof Reflect=="object"?Reflect:null,e=r&&typeof r.apply=="function"?r.apply:function(E,S,$){return Function.prototype.apply.call(E,S,$)},t;r&&typeof r.ownKeys=="function"?t=r.ownKeys:Object.getOwnPropertySymbols?t=function(E){return Object.getOwnPropertyNames(E).concat(Object.getOwnPropertySymbols(E))}:t=function(E){return Object.getOwnPropertyNames(E)};function n(p){console&&console.warn&&console.warn(p)}var i=Number.isNaN||function(E){return E!==E};function o(){o.init.call(this)}Un.exports=o,Un.exports.once=m,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var a=10;function s(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 a},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+".");a=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(E){if(typeof E!="number"||E<0||i(E))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+E+".");return this._maxListeners=E,this};function c(p){return p._maxListeners===void 0?o.defaultMaxListeners:p._maxListeners}o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(E){for(var S=[],$=1;$<arguments.length;$++)S.push(arguments[$]);var x=E==="error",D=this._events;if(D!==void 0)x=x&&D.error===void 0;else if(!x)return!1;if(x){var I;if(S.length>0&&(I=S[0]),I instanceof Error)throw I;var j=new Error("Unhandled error."+(I?" ("+I.message+")":""));throw j.context=I,j}var O=D[E];if(O===void 0)return!1;if(typeof O=="function")e(O,this,S);else for(var w=O.length,ge=y(O,w),$=0;$<w;++$)e(ge[$],this,S);return!0};function l(p,E,S,$){var x,D,I;if(s(S),D=p._events,D===void 0?(D=p._events=Object.create(null),p._eventsCount=0):(D.newListener!==void 0&&(p.emit("newListener",E,S.listener?S.listener:S),D=p._events),I=D[E]),I===void 0)I=D[E]=S,++p._eventsCount;else if(typeof I=="function"?I=D[E]=$?[S,I]:[I,S]:$?I.unshift(S):I.push(S),x=c(p),x>0&&I.length>x&&!I.warned){I.warned=!0;var j=new Error("Possible EventEmitter memory leak detected. "+I.length+" "+String(E)+" listeners added. Use emitter.setMaxListeners() to increase limit");j.name="MaxListenersExceededWarning",j.emitter=p,j.type=E,j.count=I.length,n(j)}return p}o.prototype.addListener=function(E,S){return l(this,E,S,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(E,S){return l(this,E,S,!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,E,S){var $={fired:!1,wrapFn:void 0,target:p,type:E,listener:S},x=d.bind($);return x.listener=S,$.wrapFn=x,x}o.prototype.once=function(E,S){return s(S),this.on(E,f(this,E,S)),this},o.prototype.prependOnceListener=function(E,S){return s(S),this.prependListener(E,f(this,E,S)),this},o.prototype.removeListener=function(E,S){var $,x,D,I,j;if(s(S),x=this._events,x===void 0)return this;if($=x[E],$===void 0)return this;if($===S||$.listener===S)--this._eventsCount===0?this._events=Object.create(null):(delete x[E],x.removeListener&&this.emit("removeListener",E,$.listener||S));else if(typeof $!="function"){for(D=-1,I=$.length-1;I>=0;I--)if($[I]===S||$[I].listener===S){j=$[I].listener,D=I;break}if(D<0)return this;D===0?$.shift():C($,D),$.length===1&&(x[E]=$[0]),x.removeListener!==void 0&&this.emit("removeListener",E,j||S)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(E){var S,$,x;if($=this._events,$===void 0)return this;if($.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):$[E]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete $[E]),this;if(arguments.length===0){var D=Object.keys($),I;for(x=0;x<D.length;++x)I=D[x],I!=="removeListener"&&this.removeAllListeners(I);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(S=$[E],typeof S=="function")this.removeListener(E,S);else if(S!==void 0)for(x=S.length-1;x>=0;x--)this.removeListener(E,S[x]);return this};function h(p,E,S){var $=p._events;if($===void 0)return[];var x=$[E];return x===void 0?[]:typeof x=="function"?S?[x.listener||x]:[x]:S?b(x):y(x,x.length)}o.prototype.listeners=function(E){return h(this,E,!0)},o.prototype.rawListeners=function(E){return h(this,E,!1)},o.listenerCount=function(p,E){return typeof p.listenerCount=="function"?p.listenerCount(E):g.call(p,E)},o.prototype.listenerCount=g;function g(p){var E=this._events;if(E!==void 0){var S=E[p];if(typeof S=="function")return 1;if(S!==void 0)return S.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function y(p,E){for(var S=new Array(E),$=0;$<E;++$)S[$]=p[$];return S}function C(p,E){for(;E+1<p.length;E++)p[E]=p[E+1];p.pop()}function b(p){for(var E=new Array(p.length),S=0;S<E.length;++S)E[S]=p[S].listener||p[S];return E}function m(p,E){return new Promise(function(S,$){function x(I){p.removeListener(E,D),$(I)}function D(){typeof p.removeListener=="function"&&p.removeListener("error",x),S([].slice.call(arguments))}v(p,E,D,{once:!0}),E!=="error"&&A(p,x,{once:!0})})}function A(p,E,S){typeof p.on=="function"&&v(p,"error",E,S)}function v(p,E,S,$){if(typeof p.on=="function")$.once?p.once(E,S):p.on(E,S);else if(typeof p.addEventListener=="function")p.addEventListener(E,function x(D){$.once&&p.removeEventListener(E,x),S(D)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof p)}return Un.exports}var Ep=kp();function Sp(){const r=arguments[0];for(let e=1,t=arguments.length;e<t;e++)if(arguments[e])for(const n in arguments[e])r[n]=arguments[e][n];return r}let ut=Sp;typeof Object.assign=="function"&&(ut=Object.assign);function Nt(r,e,t,n){const i=r._nodes.get(e);let o=null;return i&&(n==="mixed"?o=i.out&&i.out[t]||i.undirected&&i.undirected[t]:n==="directed"?o=i.out&&i.out[t]:o=i.undirected&&i.undirected[t]),o}function mt(r){return typeof r=="object"&&r!==null}function kc(r){let e;for(e in r)return!1;return!0}function zt(r,e,t){Object.defineProperty(r,e,{enumerable:!1,configurable:!1,writable:!0,value:t})}function Wt(r,e,t){const n={enumerable:!0,configurable:!0};typeof t=="function"?n.get=t:(n.value=t,n.writable=!1),Object.defineProperty(r,e,n)}function Bs(r){return!(!mt(r)||r.attributes&&!Array.isArray(r.attributes))}function Cp(){let r=Math.floor(Math.random()*256)&255;return()=>r++}function tr(){const r=arguments;let e=null,t=-1;return{[Symbol.iterator](){return this},next(){let n=null;do{if(e===null){if(t++,t>=r.length)return{done:!0};e=r[t][Symbol.iterator]()}if(n=e.next(),n.done){e=null;continue}break}while(!0);return n}}}function jr(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}class Do extends Error{constructor(e){super(),this.name="GraphError",this.message=e}}class q extends Do{constructor(e){super(e),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,q.prototype.constructor)}}class B extends Do{constructor(e){super(e),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,B.prototype.constructor)}}class ue extends Do{constructor(e){super(e),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ue.prototype.constructor)}}function Ec(r,e){this.key=r,this.attributes=e,this.clear()}Ec.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 Sc(r,e){this.key=r,this.attributes=e,this.clear()}Sc.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function Cc(r,e){this.key=r,this.attributes=e,this.clear()}Cc.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function Br(r,e,t,n,i){this.key=e,this.attributes=i,this.undirected=r,this.source=t,this.target=n}Br.prototype.attach=function(){let r="out",e="in";this.undirected&&(r=e="undirected");const t=this.source.key,n=this.target.key;this.source[r][n]=this,!(this.undirected&&t===n)&&(this.target[e][t]=this)};Br.prototype.attachMulti=function(){let r="out",e="in";const t=this.source.key,n=this.target.key;this.undirected&&(r=e="undirected");const i=this.source[r],o=i[n];if(typeof o>"u"){i[n]=this,this.undirected&&t===n||(this.target[e][t]=this);return}o.previous=this,this.next=o,i[n]=this,this.target[e][t]=this};Br.prototype.detach=function(){const r=this.source.key,e=this.target.key;let t="out",n="in";this.undirected&&(t=n="undirected"),delete this.source[t][e],delete this.target[n][r]};Br.prototype.detachMulti=function(){const r=this.source.key,e=this.target.key;let t="out",n="in";this.undirected&&(t=n="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][e],delete this.target[n][r]):(this.next.previous=void 0,this.source[t][e]=this.next,this.target[n][r]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const Ac=0,$c=1,Ap=2,Dc=3;function rr(r,e,t,n,i,o,a){let s,c,l,d;if(n=""+n,t===Ac){if(s=r._nodes.get(n),!s)throw new B(`Graph.${e}: could not find the "${n}" node in the graph.`);l=i,d=o}else if(t===Dc){if(i=""+i,c=r._edges.get(i),!c)throw new B(`Graph.${e}: could not find the "${i}" edge in the graph.`);const f=c.source.key,h=c.target.key;if(n===f)s=c.target;else if(n===h)s=c.source;else throw new B(`Graph.${e}: the "${n}" node is not attached to the "${i}" edge (${f}, ${h}).`);l=o,d=a}else{if(c=r._edges.get(n),!c)throw new B(`Graph.${e}: could not find the "${n}" edge in the graph.`);t===$c?s=c.source:s=c.target,l=i,d=o}return[s,l,d]}function $p(r,e,t){r.prototype[e]=function(n,i,o){const[a,s]=rr(this,e,t,n,i,o);return a.attributes[s]}}function Dp(r,e,t){r.prototype[e]=function(n,i){const[o]=rr(this,e,t,n,i);return o.attributes}}function Ip(r,e,t){r.prototype[e]=function(n,i,o){const[a,s]=rr(this,e,t,n,i,o);return a.attributes.hasOwnProperty(s)}}function Lp(r,e,t){r.prototype[e]=function(n,i,o,a){const[s,c,l]=rr(this,e,t,n,i,o,a);return s.attributes[c]=l,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:c}),this}}function Tp(r,e,t){r.prototype[e]=function(n,i,o,a){const[s,c,l]=rr(this,e,t,n,i,o,a);if(typeof l!="function")throw new q(`Graph.${e}: updater should be a function.`);const d=s.attributes,f=l(d[c]);return d[c]=f,this.emit("nodeAttributesUpdated",{key:s.key,type:"set",attributes:s.attributes,name:c}),this}}function Gp(r,e,t){r.prototype[e]=function(n,i,o){const[a,s]=rr(this,e,t,n,i,o);return delete a.attributes[s],this.emit("nodeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:s}),this}}function Rp(r,e,t){r.prototype[e]=function(n,i,o){const[a,s]=rr(this,e,t,n,i,o);if(!mt(s))throw new q(`Graph.${e}: provided attributes are not a plain object.`);return a.attributes=s,this.emit("nodeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}function Op(r,e,t){r.prototype[e]=function(n,i,o){const[a,s]=rr(this,e,t,n,i,o);if(!mt(s))throw new q(`Graph.${e}: provided attributes are not a plain object.`);return ut(a.attributes,s),this.emit("nodeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:s}),this}}function zp(r,e,t){r.prototype[e]=function(n,i,o){const[a,s]=rr(this,e,t,n,i,o);if(typeof s!="function")throw new q(`Graph.${e}: provided updater is not a function.`);return a.attributes=s(a.attributes),this.emit("nodeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}const Mp=[{name:r=>`get${r}Attribute`,attacher:$p},{name:r=>`get${r}Attributes`,attacher:Dp},{name:r=>`has${r}Attribute`,attacher:Ip},{name:r=>`set${r}Attribute`,attacher:Lp},{name:r=>`update${r}Attribute`,attacher:Tp},{name:r=>`remove${r}Attribute`,attacher:Gp},{name:r=>`replace${r}Attributes`,attacher:Rp},{name:r=>`merge${r}Attributes`,attacher:Op},{name:r=>`update${r}Attributes`,attacher:zp}];function Np(r){Mp.forEach(function({name:e,attacher:t}){t(r,e("Node"),Ac),t(r,e("Source"),$c),t(r,e("Target"),Ap),t(r,e("Opposite"),Dc)})}function Pp(r,e,t){r.prototype[e]=function(n,i){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new ue(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ue(`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=""+n,s=""+i;if(i=arguments[2],o=Nt(this,a,s,t),!o)throw new B(`Graph.${e}: could not find an edge for the given path ("${a}" - "${s}").`)}else{if(t!=="mixed")throw new ue(`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(n=""+n,o=this._edges.get(n),!o)throw new B(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return o.attributes[i]}}function Up(r,e,t){r.prototype[e]=function(n){let i;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new ue(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new ue(`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=""+n,a=""+arguments[1];if(i=Nt(this,o,a,t),!i)throw new B(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new ue(`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(n=""+n,i=this._edges.get(n),!i)throw new B(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return i.attributes}}function Wp(r,e,t){r.prototype[e]=function(n,i){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new ue(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ue(`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=""+n,s=""+i;if(i=arguments[2],o=Nt(this,a,s,t),!o)throw new B(`Graph.${e}: could not find an edge for the given path ("${a}" - "${s}").`)}else{if(t!=="mixed")throw new ue(`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(n=""+n,o=this._edges.get(n),!o)throw new B(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return o.attributes.hasOwnProperty(i)}}function jp(r,e,t){r.prototype[e]=function(n,i,o){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new ue(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new ue(`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=""+n,c=""+i;if(i=arguments[2],o=arguments[3],a=Nt(this,s,c,t),!a)throw new B(`Graph.${e}: could not find an edge for the given path ("${s}" - "${c}").`)}else{if(t!=="mixed")throw new ue(`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(n=""+n,a=this._edges.get(n),!a)throw new B(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return a.attributes[i]=o,this.emit("edgeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:i}),this}}function Bp(r,e,t){r.prototype[e]=function(n,i,o){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new ue(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new ue(`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=""+n,c=""+i;if(i=arguments[2],o=arguments[3],a=Nt(this,s,c,t),!a)throw new B(`Graph.${e}: could not find an edge for the given path ("${s}" - "${c}").`)}else{if(t!=="mixed")throw new ue(`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(n=""+n,a=this._edges.get(n),!a)throw new B(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(typeof o!="function")throw new q(`Graph.${e}: updater should be a function.`);return a.attributes[i]=o(a.attributes[i]),this.emit("edgeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:i}),this}}function Fp(r,e,t){r.prototype[e]=function(n,i){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new ue(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ue(`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=""+n,s=""+i;if(i=arguments[2],o=Nt(this,a,s,t),!o)throw new B(`Graph.${e}: could not find an edge for the given path ("${a}" - "${s}").`)}else{if(t!=="mixed")throw new ue(`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(n=""+n,o=this._edges.get(n),!o)throw new B(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return delete o.attributes[i],this.emit("edgeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:i}),this}}function Vp(r,e,t){r.prototype[e]=function(n,i){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new ue(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ue(`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=""+n,s=""+i;if(i=arguments[2],o=Nt(this,a,s,t),!o)throw new B(`Graph.${e}: could not find an edge for the given path ("${a}" - "${s}").`)}else{if(t!=="mixed")throw new ue(`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(n=""+n,o=this._edges.get(n),!o)throw new B(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(!mt(i))throw new q(`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 Kp(r,e,t){r.prototype[e]=function(n,i){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new ue(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ue(`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=""+n,s=""+i;if(i=arguments[2],o=Nt(this,a,s,t),!o)throw new B(`Graph.${e}: could not find an edge for the given path ("${a}" - "${s}").`)}else{if(t!=="mixed")throw new ue(`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(n=""+n,o=this._edges.get(n),!o)throw new B(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(!mt(i))throw new q(`Graph.${e}: provided attributes are not a plain object.`);return ut(o.attributes,i),this.emit("edgeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:i}),this}}function Hp(r,e,t){r.prototype[e]=function(n,i){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new ue(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ue(`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=""+n,s=""+i;if(i=arguments[2],o=Nt(this,a,s,t),!o)throw new B(`Graph.${e}: could not find an edge for the given path ("${a}" - "${s}").`)}else{if(t!=="mixed")throw new ue(`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(n=""+n,o=this._edges.get(n),!o)throw new B(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(typeof i!="function")throw new q(`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 qp=[{name:r=>`get${r}Attribute`,attacher:Pp},{name:r=>`get${r}Attributes`,attacher:Up},{name:r=>`has${r}Attribute`,attacher:Wp},{name:r=>`set${r}Attribute`,attacher:jp},{name:r=>`update${r}Attribute`,attacher:Bp},{name:r=>`remove${r}Attribute`,attacher:Fp},{name:r=>`replace${r}Attributes`,attacher:Vp},{name:r=>`merge${r}Attributes`,attacher:Kp},{name:r=>`update${r}Attributes`,attacher:Hp}];function Yp(r){qp.forEach(function({name:e,attacher:t}){t(r,e("Edge"),"mixed"),t(r,e("DirectedEdge"),"directed"),t(r,e("UndirectedEdge"),"undirected")})}const Xp=[{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 Jp(r,e,t,n){let i=!1;for(const o in e){if(o===n)continue;const a=e[o];if(i=t(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),r&&i)return a.key}}function Zp(r,e,t,n){let i,o,a,s=!1;for(const c in e)if(c!==n){i=e[c];do{if(o=i.source,a=i.target,s=t(i.key,i.attributes,o.key,a.key,o.attributes,a.attributes,i.undirected),r&&s)return i.key;i=i.next}while(i!==void 0)}}function Ui(r,e){const t=Object.keys(r),n=t.length;let i,o=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(o>=n)return{done:!0};const a=t[o++];if(a===e){i=void 0;continue}i=r[a]}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 Qp(r,e,t,n){const i=e[t];if(!i)return;const o=i.source,a=i.target;if(n(i.key,i.attributes,o.key,a.key,o.attributes,a.attributes,i.undirected)&&r)return i.key}function eg(r,e,t,n){let i=e[t];if(!i)return;let o=!1;do{if(o=n(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),r&&o)return i.key;i=i.next}while(i!==void 0)}function Wi(r,e){let t=r[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 n=!1;return{[Symbol.iterator](){return this},next(){return n===!0?{done:!0}:(n=!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 tg(r,e){if(r.size===0)return[];if(e==="mixed"||e===r.type)return Array.from(r._edges.keys());const t=e==="undirected"?r.undirectedSize:r.directedSize,n=new Array(t),i=e==="undirected",o=r._edges.values();let a=0,s,c;for(;s=o.next(),s.done!==!0;)c=s.value,c.undirected===i&&(n[a++]=c.key);return n}function Ic(r,e,t,n){if(e.size===0)return;const i=t!=="mixed"&&t!==e.type,o=t==="undirected";let a,s,c=!1;const l=e._edges.values();for(;a=l.next(),a.done!==!0;){if(s=a.value,i&&s.undirected!==o)continue;const{key:d,attributes:f,source:h,target:g}=s;if(c=n(d,f,h.key,g.key,h.attributes,g.attributes,s.undirected),r&&c)return d}}function rg(r,e){if(r.size===0)return jr();const t=e!=="mixed"&&e!==r.type,n=e==="undirected",i=r._edges.values();return{[Symbol.iterator](){return this},next(){let o,a;for(;;){if(o=i.next(),o.done)return o;if(a=o.value,!(t&&a.undirected!==n))break}return{value:{edge:a.key,attributes:a.attributes,source:a.source.key,target:a.target.key,sourceAttributes:a.source.attributes,targetAttributes:a.target.attributes,undirected:a.undirected},done:!1}}}}function Io(r,e,t,n,i,o){const a=e?Zp:Jp;let s;if(t!=="undirected"&&(n!=="out"&&(s=a(r,i.in,o),r&&s)||n!=="in"&&(s=a(r,i.out,o,n?void 0:i.key),r&&s))||t!=="directed"&&(s=a(r,i.undirected,o),r&&s))return s}function ng(r,e,t,n){const i=[];return Io(!1,r,e,t,n,function(o){i.push(o)}),i}function ig(r,e,t){let n=jr();return r!=="undirected"&&(e!=="out"&&typeof t.in<"u"&&(n=tr(n,Ui(t.in))),e!=="in"&&typeof t.out<"u"&&(n=tr(n,Ui(t.out,e?void 0:t.key)))),r!=="directed"&&typeof t.undirected<"u"&&(n=tr(n,Ui(t.undirected))),n}function Lo(r,e,t,n,i,o,a){const s=t?eg:Qp;let c;if(e!=="undirected"&&(typeof i.in<"u"&&n!=="out"&&(c=s(r,i.in,o,a),r&&c)||typeof i.out<"u"&&n!=="in"&&(n||i.key!==o)&&(c=s(r,i.out,o,a),r&&c))||e!=="directed"&&typeof i.undirected<"u"&&(c=s(r,i.undirected,o,a),r&&c))return c}function og(r,e,t,n,i){const o=[];return Lo(!1,r,e,t,n,i,function(a){o.push(a)}),o}function sg(r,e,t,n){let i=jr();return r!=="undirected"&&(typeof t.in<"u"&&e!=="out"&&n in t.in&&(i=tr(i,Wi(t.in,n))),typeof t.out<"u"&&e!=="in"&&n in t.out&&(e||t.key!==n)&&(i=tr(i,Wi(t.out,n)))),r!=="directed"&&typeof t.undirected<"u"&&n in t.undirected&&(i=tr(i,Wi(t.undirected,n))),i}function ag(r,e){const{name:t,type:n,direction:i}=e;r.prototype[t]=function(o,a){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return[];if(!arguments.length)return tg(this,n);if(arguments.length===1){o=""+o;const s=this._nodes.get(o);if(typeof s>"u")throw new B(`Graph.${t}: could not find the "${o}" node in the graph.`);return ng(this.multi,n==="mixed"?this.type:n,i,s)}if(arguments.length===2){o=""+o,a=""+a;const s=this._nodes.get(o);if(!s)throw new B(`Graph.${t}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(a))throw new B(`Graph.${t}: could not find the "${a}" target node in the graph.`);return og(n,this.multi,i,s,a)}throw new q(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function cg(r,e){const{name:t,type:n,direction:i}=e,o="forEach"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[o]=function(l,d,f){if(!(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)){if(arguments.length===1)return f=l,Ic(!1,this,n,f);if(arguments.length===2){l=""+l,f=d;const h=this._nodes.get(l);if(typeof h>"u")throw new B(`Graph.${o}: could not find the "${l}" node in the graph.`);return Io(!1,this.multi,n==="mixed"?this.type:n,i,h,f)}if(arguments.length===3){l=""+l,d=""+d;const h=this._nodes.get(l);if(!h)throw new B(`Graph.${o}: could not find the "${l}" source node in the graph.`);if(!this._nodes.has(d))throw new B(`Graph.${o}: could not find the "${d}" target node in the graph.`);return Lo(!1,n,this.multi,i,h,d,f)}throw new q(`Graph.${o}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const a="map"+t[0].toUpperCase()+t.slice(1);r.prototype[a]=function(){const l=Array.prototype.slice.call(arguments),d=l.pop();let f;if(l.length===0){let h=0;n!=="directed"&&(h+=this.undirectedSize),n!=="undirected"&&(h+=this.directedSize),f=new Array(h);let g=0;l.push((y,C,b,m,A,v,p)=>{f[g++]=d(y,C,b,m,A,v,p)})}else f=[],l.push((h,g,y,C,b,m,A)=>{f.push(d(h,g,y,C,b,m,A))});return this[o].apply(this,l),f};const s="filter"+t[0].toUpperCase()+t.slice(1);r.prototype[s]=function(){const l=Array.prototype.slice.call(arguments),d=l.pop(),f=[];return l.push((h,g,y,C,b,m,A)=>{d(h,g,y,C,b,m,A)&&f.push(h)}),this[o].apply(this,l),f};const c="reduce"+t[0].toUpperCase()+t.slice(1);r.prototype[c]=function(){let l=Array.prototype.slice.call(arguments);if(l.length<2||l.length>4)throw new q(`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 q(`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,C,b,m,A,v)=>{h=d(h,g,y,C,b,m,A,v)}),this[o].apply(this,l),h}}function lg(r,e){const{name:t,type:n,direction:i}=e,o="find"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[o]=function(c,l,d){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return!1;if(arguments.length===1)return d=c,Ic(!0,this,n,d);if(arguments.length===2){c=""+c,d=l;const f=this._nodes.get(c);if(typeof f>"u")throw new B(`Graph.${o}: could not find the "${c}" node in the graph.`);return Io(!0,this.multi,n==="mixed"?this.type:n,i,f,d)}if(arguments.length===3){c=""+c,l=""+l;const f=this._nodes.get(c);if(!f)throw new B(`Graph.${o}: could not find the "${c}" source node in the graph.`);if(!this._nodes.has(l))throw new B(`Graph.${o}: could not find the "${l}" target node in the graph.`);return Lo(!0,n,this.multi,i,f,l,d)}throw new q(`Graph.${o}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const a="some"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[a]=function(){const c=Array.prototype.slice.call(arguments),l=c.pop();return c.push((f,h,g,y,C,b,m)=>l(f,h,g,y,C,b,m)),!!this[o].apply(this,c)};const s="every"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[s]=function(){const c=Array.prototype.slice.call(arguments),l=c.pop();return c.push((f,h,g,y,C,b,m)=>!l(f,h,g,y,C,b,m)),!this[o].apply(this,c)}}function ug(r,e){const{name:t,type:n,direction:i}=e,o=t.slice(0,-1)+"Entries";r.prototype[o]=function(a,s){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return jr();if(!arguments.length)return rg(this,n);if(arguments.length===1){a=""+a;const c=this._nodes.get(a);if(!c)throw new B(`Graph.${o}: could not find the "${a}" node in the graph.`);return ig(n,i,c)}if(arguments.length===2){a=""+a,s=""+s;const c=this._nodes.get(a);if(!c)throw new B(`Graph.${o}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(s))throw new B(`Graph.${o}: could not find the "${s}" target node in the graph.`);return sg(n,i,c,s)}throw new q(`Graph.${o}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function dg(r){Xp.forEach(e=>{ag(r,e),cg(r,e),lg(r,e),ug(r,e)})}const fg=[{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 si(){this.A=null,this.B=null}si.prototype.wrap=function(r){this.A===null?this.A=r:this.B===null&&(this.B=r)};si.prototype.has=function(r){return this.A!==null&&r in this.A||this.B!==null&&r in this.B};function Qr(r,e,t,n,i){for(const o in n){const a=n[o],s=a.source,c=a.target,l=s===t?c:s;if(e&&e.has(l.key))continue;const d=i(l.key,l.attributes);if(r&&d)return l.key}}function To(r,e,t,n,i){if(e!=="mixed"){if(e==="undirected")return Qr(r,null,n,n.undirected,i);if(typeof t=="string")return Qr(r,null,n,n[t],i)}const o=new si;let a;if(e!=="undirected"){if(t!=="out"){if(a=Qr(r,null,n,n.in,i),r&&a)return a;o.wrap(n.in)}if(t!=="in"){if(a=Qr(r,o,n,n.out,i),r&&a)return a;o.wrap(n.out)}}if(e!=="directed"&&(a=Qr(r,o,n,n.undirected,i),r&&a))return a}function hg(r,e,t){if(r!=="mixed"){if(r==="undirected")return Object.keys(t.undirected);if(typeof e=="string")return Object.keys(t[e])}const n=[];return To(!1,r,e,t,function(i){n.push(i)}),n}function en(r,e,t){const n=Object.keys(t),i=n.length;let o=0;return{[Symbol.iterator](){return this},next(){let a=null;do{if(o>=i)return r&&r.wrap(t),{done:!0};const s=t[n[o++]],c=s.source,l=s.target;if(a=c===e?l:c,r&&r.has(a.key)){a=null;continue}}while(a===null);return{done:!1,value:{neighbor:a.key,attributes:a.attributes}}}}}function pg(r,e,t){if(r!=="mixed"){if(r==="undirected")return en(null,t,t.undirected);if(typeof e=="string")return en(null,t,t[e])}let n=jr();const i=new si;return r!=="undirected"&&(e!=="out"&&(n=tr(n,en(i,t,t.in))),e!=="in"&&(n=tr(n,en(i,t,t.out)))),r!=="directed"&&(n=tr(n,en(i,t,t.undirected))),n}function gg(r,e){const{name:t,type:n,direction:i}=e;r.prototype[t]=function(o){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return[];o=""+o;const a=this._nodes.get(o);if(typeof a>"u")throw new B(`Graph.${t}: could not find the "${o}" node in the graph.`);return hg(n==="mixed"?this.type:n,i,a)}}function mg(r,e){const{name:t,type:n,direction:i}=e,o="forEach"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[o]=function(l,d){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return;l=""+l;const f=this._nodes.get(l);if(typeof f>"u")throw new B(`Graph.${o}: could not find the "${l}" node in the graph.`);To(!1,n==="mixed"?this.type:n,i,f,d)};const a="map"+t[0].toUpperCase()+t.slice(1);r.prototype[a]=function(l,d){const f=[];return this[o](l,(h,g)=>{f.push(d(h,g))}),f};const s="filter"+t[0].toUpperCase()+t.slice(1);r.prototype[s]=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);r.prototype[c]=function(l,d,f){if(arguments.length<3)throw new q(`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 vg(r,e){const{name:t,type:n,direction:i}=e,o=t[0].toUpperCase()+t.slice(1,-1),a="find"+o;r.prototype[a]=function(l,d){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return;l=""+l;const f=this._nodes.get(l);if(typeof f>"u")throw new B(`Graph.${a}: could not find the "${l}" node in the graph.`);return To(!0,n==="mixed"?this.type:n,i,f,d)};const s="some"+o;r.prototype[s]=function(l,d){return!!this[a](l,d)};const c="every"+o;r.prototype[c]=function(l,d){return!this[a](l,(h,g)=>!d(h,g))}}function yg(r,e){const{name:t,type:n,direction:i}=e,o=t.slice(0,-1)+"Entries";r.prototype[o]=function(a){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return jr();a=""+a;const s=this._nodes.get(a);if(typeof s>"u")throw new B(`Graph.${o}: could not find the "${a}" node in the graph.`);return pg(n==="mixed"?this.type:n,i,s)}}function bg(r){fg.forEach(e=>{gg(r,e),mg(r,e),vg(r,e),yg(r,e)})}function Wn(r,e,t,n,i){const o=n._nodes.values(),a=n.type;let s,c,l,d,f,h;for(;s=o.next(),s.done!==!0;){let g=!1;if(c=s.value,a!=="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(a!=="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 wg(r,e){const t={key:r};return kc(e.attributes)||(t.attributes=ut({},e.attributes)),t}function _g(r,e,t){const n={key:e,source:t.source.key,target:t.target.key};return kc(t.attributes)||(n.attributes=ut({},t.attributes)),r==="mixed"&&t.undirected&&(n.undirected=!0),n}function xg(r){if(!mt(r))throw new q('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in r))throw new q("Graph.import: serialized node is missing its key.");if("attributes"in r&&(!mt(r.attributes)||r.attributes===null))throw new q("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function kg(r){if(!mt(r))throw new q('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in r))throw new q("Graph.import: serialized edge is missing its source.");if(!("target"in r))throw new q("Graph.import: serialized edge is missing its target.");if("attributes"in r&&(!mt(r.attributes)||r.attributes===null))throw new q("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in r&&typeof r.undirected!="boolean")throw new q("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const Eg=Cp(),Sg=new Set(["directed","undirected","mixed"]),Fs=new Set(["domain","_events","_eventsCount","_maxListeners"]),Cg=[{name:r=>`${r}Edge`,generateKey:!0},{name:r=>`${r}DirectedEdge`,generateKey:!0,type:"directed"},{name:r=>`${r}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:r=>`${r}EdgeWithKey`},{name:r=>`${r}DirectedEdgeWithKey`,type:"directed"},{name:r=>`${r}UndirectedEdgeWithKey`,type:"undirected"}],Ag={allowSelfLoops:!0,multi:!1,type:"mixed"};function $g(r,e,t){if(t&&!mt(t))throw new q(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(e=""+e,t=t||{},r._nodes.has(e))throw new ue(`Graph.addNode: the "${e}" node already exist in the graph.`);const n=new r.NodeDataClass(e,t);return r._nodes.set(e,n),r.emit("nodeAdded",{key:e,attributes:t}),n}function Vs(r,e,t){const n=new r.NodeDataClass(e,t);return r._nodes.set(e,n),r.emit("nodeAdded",{key:e,attributes:t}),n}function Lc(r,e,t,n,i,o,a,s){if(!n&&r.type==="undirected")throw new ue(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(n&&r.type==="directed")throw new ue(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!mt(s))throw new q(`Graph.${e}: invalid attributes. Expecting an object but got "${s}"`);if(o=""+o,a=""+a,s=s||{},!r.allowSelfLoops&&o===a)throw new ue(`Graph.${e}: source & target are the same ("${o}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const c=r._nodes.get(o),l=r._nodes.get(a);if(!c)throw new B(`Graph.${e}: source node "${o}" not found.`);if(!l)throw new B(`Graph.${e}: target node "${a}" not found.`);const d={key:null,undirected:n,source:o,target:a,attributes:s};if(t)i=r._edgeKeyGenerator();else if(i=""+i,r._edges.has(i))throw new ue(`Graph.${e}: the "${i}" edge already exists in the graph.`);if(!r.multi&&(n?typeof c.undirected[a]<"u":typeof c.out[a]<"u"))throw new ue(`Graph.${e}: an edge linking "${o}" to "${a}" 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 Br(n,i,c,l,s);r._edges.set(i,f);const h=o===a;return n?(c.undirectedDegree++,l.undirectedDegree++,h&&(c.undirectedLoops++,r._undirectedSelfLoopCount++)):(c.outDegree++,l.inDegree++,h&&(c.directedLoops++,r._directedSelfLoopCount++)),r.multi?f.attachMulti():f.attach(),n?r._undirectedSize++:r._directedSize++,d.key=i,r.emit("edgeAdded",d),i}function Dg(r,e,t,n,i,o,a,s,c){if(!n&&r.type==="undirected")throw new ue(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(n&&r.type==="directed")throw new ue(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(c){if(typeof s!="function")throw new q(`Graph.${e}: invalid updater function. Expecting a function but got "${s}"`)}else if(!mt(s))throw new q(`Graph.${e}: invalid attributes. Expecting an object but got "${s}"`)}o=""+o,a=""+a;let l;if(c&&(l=s,s=void 0),!r.allowSelfLoops&&o===a)throw new ue(`Graph.${e}: source & target are the same ("${o}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let d=r._nodes.get(o),f=r._nodes.get(a),h,g;if(!t&&(h=r._edges.get(i),h)){if((h.source.key!==o||h.target.key!==a)&&(!n||h.source.key!==a||h.target.key!==o))throw new ue(`Graph.${e}: inconsistency detected when attempting to merge the "${i}" edge with "${o}" source & "${a}" target vs. ("${h.source.key}", "${h.target.key}").`);g=h}if(!g&&!r.multi&&d&&(g=n?d.undirected[a]:d.out[a]),g){const A=[g.key,!1,!1,!1];if(c?!l:!s)return A;if(c){const v=g.attributes;g.attributes=l(v),r.emit("edgeAttributesUpdated",{type:"replace",key:g.key,attributes:g.attributes})}else ut(g.attributes,s),r.emit("edgeAttributesUpdated",{type:"merge",key:g.key,attributes:g.attributes,data:s});return A}s=s||{},c&&l&&(s=l(s));const y={key:null,undirected:n,source:o,target:a,attributes:s};if(t)i=r._edgeKeyGenerator();else if(i=""+i,r._edges.has(i))throw new ue(`Graph.${e}: the "${i}" edge already exists in the graph.`);let C=!1,b=!1;d||(d=Vs(r,o,{}),C=!0,o===a&&(f=d,b=!0)),f||(f=Vs(r,a,{}),b=!0),h=new Br(n,i,d,f,s),r._edges.set(i,h);const m=o===a;return n?(d.undirectedDegree++,f.undirectedDegree++,m&&(d.undirectedLoops++,r._undirectedSelfLoopCount++)):(d.outDegree++,f.inDegree++,m&&(d.directedLoops++,r._directedSelfLoopCount++)),r.multi?h.attachMulti():h.attach(),n?r._undirectedSize++:r._directedSize++,y.key=i,r.emit("edgeAdded",y),[i,!0,C,b]}function zr(r,e){r._edges.delete(e.key);const{source:t,target:n,attributes:i}=e,o=e.undirected,a=t===n;o?(t.undirectedDegree--,n.undirectedDegree--,a&&(t.undirectedLoops--,r._undirectedSelfLoopCount--)):(t.outDegree--,n.inDegree--,a&&(t.directedLoops--,r._directedSelfLoopCount--)),r.multi?e.detachMulti():e.detach(),o?r._undirectedSize--:r._directedSize--,r.emit("edgeDropped",{key:e.key,attributes:i,source:t.key,target:n.key,undirected:o})}class qe extends Ep.EventEmitter{constructor(e){if(super(),e=ut({},Ag,e),typeof e.multi!="boolean")throw new q(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!Sg.has(e.type))throw new q(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!="boolean")throw new q(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);const t=e.type==="mixed"?Ec:e.type==="directed"?Sc:Cc;zt(this,"NodeDataClass",t);const n="geid_"+Eg()+"_";let i=0;const o=()=>{let a;do a=n+i++;while(this._edges.has(a));return a};zt(this,"_attributes",{}),zt(this,"_nodes",new Map),zt(this,"_edges",new Map),zt(this,"_directedSize",0),zt(this,"_undirectedSize",0),zt(this,"_directedSelfLoopCount",0),zt(this,"_undirectedSelfLoopCount",0),zt(this,"_edgeKeyGenerator",o),zt(this,"_options",e),Fs.forEach(a=>zt(this,a,this[a])),Wt(this,"order",()=>this._nodes.size),Wt(this,"size",()=>this._edges.size),Wt(this,"directedSize",()=>this._directedSize),Wt(this,"undirectedSize",()=>this._undirectedSize),Wt(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),Wt(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),Wt(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),Wt(this,"multi",this._options.multi),Wt(this,"type",this._options.type),Wt(this,"allowSelfLoops",this._options.allowSelfLoops),Wt(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 n=""+e,i=this._edges.get(n);return!!i&&!i.undirected}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?n.out.hasOwnProperty(t):!1}throw new q(`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 n=""+e,i=this._edges.get(n);return!!i&&i.undirected}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?n.undirected.hasOwnProperty(t):!1}throw new q(`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 n=""+e;return this._edges.has(n)}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?typeof n.out<"u"&&n.out.hasOwnProperty(t)||typeof n.undirected<"u"&&n.undirected.hasOwnProperty(t):!1}throw new q(`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 ue("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const n=this._nodes.get(e);if(!n)throw new B(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new B(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const i=n.out&&n.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 ue("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const n=this._nodes.get(e);if(!n)throw new B(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new B(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const i=n.undirected&&n.undirected[t]||void 0;if(i)return i.key}edge(e,t){if(this.multi)throw new ue("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 n=this._nodes.get(e);if(!n)throw new B(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new B(`Graph.edge: could not find the "${t}" target node in the graph.`);const i=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(i)return i.key}areDirectedNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new B(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.in||t in n.out}areOutNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new B(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.out}areInNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new B(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.in}areUndirectedNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new B(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="directed"?!1:t in n.undirected}areNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new B(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&(t in n.in||t in n.out)||this.type!=="directed"&&t in n.undirected}areInboundNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new B(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in n.in||this.type!=="directed"&&t in n.undirected}areOutboundNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new B(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in n.out||this.type!=="directed"&&t in n.undirected}inDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new B(`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 B(`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 B(`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 B(`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 B(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.inDegree),n}outboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new B(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.outDegree),n}degree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new B(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new B(`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 B(`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 B(`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 B(`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 B(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,i=0;return this.type!=="directed"&&(n+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.inDegree,i+=t.directedLoops),n-i}outboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new B(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,i=0;return this.type!=="directed"&&(n+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.outDegree,i+=t.directedLoops),n-i}degreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new B(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,i=0;return this.type!=="directed"&&(n+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.inDegree+t.outDegree,i+=t.directedLoops*2),n-i}source(e){e=""+e;const t=this._edges.get(e);if(!t)throw new B(`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 B(`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 B(`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 n=this._edges.get(t);if(!n)throw new B(`Graph.opposite: could not find the "${t}" edge in the graph.`);const i=n.source.key,o=n.target.key;if(e===i)return o;if(e===o)return i;throw new B(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${i}, ${o}).`)}hasExtremity(e,t){e=""+e,t=""+t;const n=this._edges.get(e);if(!n)throw new B(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new B(`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 B(`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 B(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return $g(this,e,t).key}mergeNode(e,t){if(t&&!mt(t))throw new q(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=""+e,t=t||{};let n=this._nodes.get(e);return n?(t&&(ut(n.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!="function")throw new q(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=""+e;let n=this._nodes.get(e);if(n){if(t){const o=n.attributes;n.attributes=t(o),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:n.attributes})}return[e,!1]}const i=t?t({}):{};return n=new this.NodeDataClass(e,i),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:i}),[e,!0]}dropNode(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new B(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!=="undirected"){for(const i in t.out){n=t.out[i];do zr(this,n),n=n.next;while(n)}for(const i in t.in){n=t.in[i];do zr(this,n),n=n.next;while(n)}}if(this.type!=="directed")for(const i in t.undirected){n=t.undirected[i];do zr(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){const n=""+arguments[0],i=""+arguments[1];if(t=Nt(this,n,i,this.type),!t)throw new B(`Graph.dropEdge: could not find the "${n}" -> "${i}" edge in the graph.`)}else if(e=""+e,t=this._edges.get(e),!t)throw new B(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return zr(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new ue("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 ue("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 n=Nt(this,e,t,"directed");if(!n)throw new B(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return zr(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new ue("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 ue("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 n=Nt(this,e,t,"undirected");if(!n)throw new B(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return zr(this,n),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 q("Graph.updateAttribute: updater should be a function.");const n=this._attributes[e];return this._attributes[e]=t(n),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(!mt(e))throw new q("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(!mt(e))throw new q("Graph.mergeAttributes: provided attributes are not a plain object.");return ut(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!="function")throw new q("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 q("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!Bs(t))throw new q("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._nodes.values();let i,o;for(;i=n.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 q("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!Bs(t))throw new q("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._edges.values();let i,o,a,s;for(;i=n.next(),i.done!==!0;)o=i.value,a=o.source,s=o.target,o.attributes=e(o.key,o.attributes,a.key,s.key,a.attributes,s.attributes,o.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!="function")throw new q("Graph.forEachAdjacencyEntry: expecting a callback.");Wn(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new q("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");Wn(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!="function")throw new q("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");Wn(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new q("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");Wn(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!="function")throw new q("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let n,i;for(;n=t.next(),n.done!==!0;)i=n.value,e(i.key,i.attributes)}findNode(e){if(typeof e!="function")throw new q("Graph.findNode: expecting a callback.");const t=this._nodes.values();let n,i;for(;n=t.next(),n.done!==!0;)if(i=n.value,e(i.key,i.attributes))return i.key}mapNodes(e){if(typeof e!="function")throw new q("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let n,i;const o=new Array(this.order);let a=0;for(;n=t.next(),n.done!==!0;)i=n.value,o[a++]=e(i.key,i.attributes);return o}someNode(e){if(typeof e!="function")throw new q("Graph.someNode: expecting a callback.");const t=this._nodes.values();let n,i;for(;n=t.next(),n.done!==!0;)if(i=n.value,e(i.key,i.attributes))return!0;return!1}everyNode(e){if(typeof e!="function")throw new q("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let n,i;for(;n=t.next(),n.done!==!0;)if(i=n.value,!e(i.key,i.attributes))return!1;return!0}filterNodes(e){if(typeof e!="function")throw new q("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let n,i;const o=[];for(;n=t.next(),n.done!==!0;)i=n.value,e(i.key,i.attributes)&&o.push(i.key);return o}reduceNodes(e,t){if(typeof e!="function")throw new q("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new q("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 n=t;const i=this._nodes.values();let o,a;for(;o=i.next(),o.done!==!0;)a=o.value,n=e(n,a.key,a.attributes);return n}nodeEntries(){const e=this._nodes.values();return{[Symbol.iterator](){return this},next(){const t=e.next();if(t.done)return t;const n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){const e=new Array(this._nodes.size);let t=0;this._nodes.forEach((i,o)=>{e[t++]=wg(o,i)});const n=new Array(this._edges.size);return t=0,this._edges.forEach((i,o)=>{n[t++]=_g(this.type,o,i)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(e,t=!1){if(e instanceof qe)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(!mt(e))throw new q("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!mt(e.attributes))throw new q("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let n,i,o,a,s;if(e.nodes){if(o=e.nodes,!Array.isArray(o))throw new q("Graph.import: invalid nodes. Expecting an array.");for(n=0,i=o.length;n<i;n++){a=o[n],xg(a);const{key:c,attributes:l}=a;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 q("Graph.import: invalid edges. Expecting an array.");for(n=0,i=o.length;n<i;n++){s=o[n],kg(s);const{source:l,target:d,attributes:f,undirected:h=c}=s;let g;"key"in s?(g=t?h?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:h?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,g.call(this,s.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 qe(ut({},this._options,e));return t.replaceAttributes(ut({},this.getAttributes())),t}emptyCopy(e){const t=this.nullCopy(e);return this._nodes.forEach((n,i)=>{const o=ut({},n.attributes);n=new t.NodeDataClass(i,o),t._nodes.set(i,n)}),t}copy(e){if(e=e||{},typeof e.type=="string"&&e.type!==this.type&&e.type!=="mixed")throw new ue(`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 ue("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 ue("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),n=this._edges.values();let i,o;for(;i=n.next(),i.done!==!0;)o=i.value,Lc(t,"copy",!1,o.undirected,o.key,o.source.key,o.target.key,ut({},o.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const e={};this._nodes.forEach((o,a)=>{e[a]=o.attributes});const t={},n={};this._edges.forEach((o,a)=>{const s=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})${s}(${d})`;a.startsWith("geid_")?this.multi&&(typeof n[h]>"u"?n[h]=0:n[h]++,c+=`${n[h]}. `):c+=`[${a}]: `,c+=h,t[c]=o.attributes});const i={};for(const o in this)this.hasOwnProperty(o)&&!Fs.has(o)&&typeof this[o]!="function"&&typeof o!="symbol"&&(i[o]=this[o]);return i.attributes=this._attributes,i.nodes=e,i.edges=t,zt(i,"constructor",this.constructor),i}}typeof Symbol<"u"&&(qe.prototype[Symbol.for("nodejs.util.inspect.custom")]=qe.prototype.inspect);Cg.forEach(r=>{["add","merge","update"].forEach(e=>{const t=r.name(e),n=e==="add"?Lc:Dg;r.generateKey?qe.prototype[t]=function(i,o,a){return n(this,t,!0,(r.type||this.type)==="undirected",null,i,o,a,e==="update")}:qe.prototype[t]=function(i,o,a,s){return n(this,t,!1,(r.type||this.type)==="undirected",i,o,a,s,e==="update")}})});Np(qe);Yp(qe);dg(qe);bg(qe);class Tc extends qe{constructor(e){const t=ut({type:"directed"},e);if("multi"in t&&t.multi!==!1)throw new q("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new q('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Gc extends qe{constructor(e){const t=ut({type:"undirected"},e);if("multi"in t&&t.multi!==!1)throw new q("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new q('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class Rc extends qe{constructor(e){const t=ut({multi:!0},e);if("multi"in t&&t.multi!==!0)throw new q("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class Oc extends qe{constructor(e){const t=ut({type:"directed",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new q("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new q('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class zc extends qe{constructor(e){const t=ut({type:"undirected",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new q("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new q('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Fr(r){r.from=function(e,t){const n=ut({},e.options,t),i=new r(n);return i.import(e),i}}Fr(qe);Fr(Tc);Fr(Gc);Fr(Rc);Fr(Oc);Fr(zc);qe.Graph=qe;qe.DirectedGraph=Tc;qe.UndirectedGraph=Gc;qe.MultiGraph=Rc;qe.MultiDirectedGraph=Oc;qe.MultiUndirectedGraph=zc;qe.InvalidArgumentsGraphError=q;qe.NotFoundGraphError=B;qe.UsageGraphError=ue;var ji,Ks;function Go(){if(Ks)return ji;Ks=1;function r(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,n){t=t||{};var i={};for(var o in n){var a=t[o],s=n[o];if(!r(s)){i[o]=e(a,s);continue}a===void 0?i[o]=s:i[o]=a}return i}return ji=e,ji}var Bi,Hs;function ai(){return Hs||(Hs=1,Bi=function(e){return e!==null&&typeof e=="object"&&typeof e.addUndirectedEdgeWithKey=="function"&&typeof e.dropNode=="function"&&typeof e.multi=="boolean"}),Bi}var Fi,qs;function Mc(){if(qs)return Fi;qs=1;var r=ai();return Fi=function(t){if(!r(t))throw new Error("graphology-utils/infer-type: expecting a valid graphology instance.");var n=t.type;return n!=="mixed"?n:t.directedSize===0&&t.undirectedSize===0||t.directedSize>0&&t.undirectedSize>0?"mixed":t.directedSize>0?"directed":"undirected"},Fi}var Vi,Ys;function Nc(){if(Ys)return Vi;Ys=1;function r(e){if(typeof e!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=e}return typeof Symbol<"u"&&(r.prototype[Symbol.iterator]=function(){return this}),r.of=function(){var e=arguments,t=e.length,n=0;return new r(function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}})},r.empty=function(){var e=new r(function(){return{done:!0}});return e},r.fromSequence=function(e){var t=0,n=e.length;return new r(function(){return t>=n?{done:!0}:{done:!1,value:e[t++]}})},r.is=function(e){return e instanceof r?!0:typeof e=="object"&&e!==null&&typeof e.next=="function"},Vi=r,Vi}var Ki={},Xs;function Ro(){return Xs||(Xs=1,(function(r){var e=Math.pow(2,8)-1,t=Math.pow(2,16)-1,n=Math.pow(2,32)-1,i=Math.pow(2,7)-1,o=Math.pow(2,15)-1,a=Math.pow(2,31)-1;r.getPointerArray=function(c){var l=c-1;if(l<=e)return Uint8Array;if(l<=t)return Uint16Array;if(l<=n)return Uint32Array;throw new Error("mnemonist: Pointer Array of size > 4294967295 is not supported.")},r.getSignedPointerArray=function(c){var l=c-1;return l<=i?Int8Array:l<=o?Int16Array:l<=a?Int32Array:Float64Array},r.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 s={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};r.getMinimalRepresentation=function(c,l){var d=null,f=0,h,g,y,C,b;for(C=0,b=c.length;C<b;C++)y=l?l(c[C]):c[C],g=r.getNumberType(y),h=s[g.name],h>f&&(f=h,d=g);return d},r.isTypedArray=function(c){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(c)},r.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},r.indices=function(c){for(var l=r.getPointerArray(c),d=new l(c),f=0;f<c;f++)d[f]=f;return d}})(Ki)),Ki}var Hi,Js;function Oo(){if(Js)return Hi;Js=1;var r=Nc(),e=Ro().getPointerArray;function t(n,i){arguments.length<2&&(i=n,n=Array);var o=e(i);this.size=0,this.length=i,this.dense=new o(i),this.sparse=new o(i),this.vals=new n(i)}return t.prototype.clear=function(){this.size=0},t.prototype.has=function(n){var i=this.sparse[n];return i<this.size&&this.dense[i]===n},t.prototype.get=function(n){var i=this.sparse[n];if(i<this.size&&this.dense[i]===n)return this.vals[i]},t.prototype.set=function(n,i){var o=this.sparse[n];return o<this.size&&this.dense[o]===n?(this.vals[o]=i,this):(this.dense[this.size]=n,this.sparse[n]=this.size,this.vals[this.size]=i,this.size++,this)},t.prototype.delete=function(n){var i=this.sparse[n];return i>=this.size||this.dense[i]!==n?!1:(i=this.dense[this.size-1],this.dense[this.sparse[n]]=i,this.sparse[i]=this.sparse[n],this.size--,!0)},t.prototype.forEach=function(n,i){i=arguments.length>1?i:this;for(var o=0;o<this.size;o++)n.call(i,this.vals[o],this.dense[o])},t.prototype.keys=function(){var n=this.size,i=this.dense,o=0;return new r(function(){if(o<n){var a=i[o];return o++,{value:a}}return{done:!0}})},t.prototype.values=function(){var n=this.size,i=this.vals,o=0;return new r(function(){if(o<n){var a=i[o];return o++,{value:a}}return{done:!0}})},t.prototype.entries=function(){var n=this.size,i=this.dense,o=this.vals,a=0;return new r(function(){if(a<n){var s=[i[a],o[a]];return a++,{value:s}}return{done:!0}})},typeof Symbol<"u"&&(t.prototype[Symbol.iterator]=t.prototype.entries),t.prototype.inspect=function(){for(var n=new Map,i=0;i<this.size;i++)n.set(this.dense[i],this.vals[i]);return Object.defineProperty(n,"constructor",{value:t,enumerable:!1}),n.length=this.length,this.vals.constructor!==Array&&(n.type=this.vals.constructor.name),n},typeof Symbol<"u"&&(t.prototype[Symbol.for("nodejs.util.inspect.custom")]=t.prototype.inspect),Hi=t,Hi}var qi,Zs;function Pc(){if(Zs)return qi;Zs=1;var r=Nc(),e=Ro().getPointerArray;function t(n){var i=e(n);this.start=0,this.size=0,this.capacity=n,this.dense=new i(n),this.sparse=new i(n)}return t.prototype.clear=function(){this.start=0,this.size=0},t.prototype.has=function(n){if(this.size===0)return!1;var i=this.sparse[n],o=i<this.capacity&&i>=this.start&&i<this.start+this.size||i<(this.start+this.size)%this.capacity;return o&&this.dense[i]===n},t.prototype.enqueue=function(n){var i=this.sparse[n];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]===n)return this}return i=(this.start+this.size)%this.capacity,this.dense[i]=n,this.sparse[n]=i,this.size++,this},t.prototype.dequeue=function(){if(this.size!==0){var n=this.start;this.size--,this.start++,this.start===this.capacity&&(this.start=0);var i=this.dense[n];return this.sparse[i]=this.capacity,i}},t.prototype.forEach=function(n,i){i=arguments.length>1?i:this;for(var o=this.capacity,a=this.size,s=this.start,c=0;c<a;)n.call(i,this.dense[s],c,this),s++,c++,s===o&&(s=0)},t.prototype.values=function(){var n=this.dense,i=this.capacity,o=this.size,a=this.start,s=0;return new r(function(){if(s>=o)return{done:!0};var c=n[a];return a++,s++,a===i&&(a=0),{value:c,done:!1}})},typeof Symbol<"u"&&(t.prototype[Symbol.iterator]=t.prototype.values),t.prototype.inspect=function(){var n=[];return this.forEach(function(i){n.push(i)}),Object.defineProperty(n,"constructor",{value:t,enumerable:!1}),n.capacity=this.capacity,n},typeof Symbol<"u"&&(t.prototype[Symbol.for("nodejs.util.inspect.custom")]=t.prototype.inspect),qi=t,qi}var Yi,Qs;function Uc(){if(Qs)return Yi;Qs=1;function r(t){return function(n){return typeof n!="number"&&(n=n.length),Math.floor(t()*n)}}var e=r(Math.random);return e.createRandomIndex=r,Yi=e,Yi}var jn={},Xi,ea;function Ig(){if(ea)return Xi;ea=1;function r(t){return function(n,i){return n+Math.floor(t()*(i-n+1))}}var e=r(Math.random);return e.createRandom=r,Xi=e,Xi}var ta;function Lg(){if(ta)return jn;ta=1;var r=Oo(),e=Ig().createRandom;function t(i,o,a){var s=i.get(o);typeof s>"u"&&(s=0),s+=a,i.set(o,s)}function n(i,o){o=o||{};var a=o.rng||Math.random,s="randomness"in o?o.randomness:.01;this.index=i,this.random=e(a),this.randomness=s,this.rng=a;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 r(l,d),this.cumulativeIncrement=new Float64Array(d),this.macroCommunities=null}return n.prototype.groupByCommunities=function(){var i=this.index,o,a,s,c,l;for(o=0,l=0,a=0;a<i.C;a++)s=i.counts[a],s!==0&&(this.communitiesBounds[l++]=o,o+=s,this.communitiesOffsets[a]=o);for(this.communitiesBounds[l]=o,l=0,a=0;a<i.C;a++)c=i.belongings[a],l=--this.communitiesOffsets[c],this.nodesSortedByCommunities[l]=a;this.B=i.C-i.U,this.C=i.C},n.prototype.communities=function(){var i=new Array(this.B),o,a,s,c,l;for(o=0;o<this.B;o++){for(c=this.communitiesBounds[o],l=this.communitiesBounds[o+1],s=[],a=c;a<l;a++)s.push(a);i[o]=s}return i},n.prototype.mergeNodesSubset=function(i,o){var a=this.index,s=a.belongings[this.nodesSortedByCommunities[i]],c=this.neighboringCommunities,l=0,d,f,h,g,y,C;for(f=i;f<o;f++)for(d=this.nodesSortedByCommunities[f],this.belongings[d]=d,this.nonSingleton[d]=0,this.degrees[d]=0,l+=a.loops[d]/2,this.communityWeights[d]=a.loops[d],this.externalEdgeWeightPerCommunity[d]=0,g=a.starts[d],y=a.starts[d+1];g<y;g++)C=a.neighborhood[g],h=a.weights[g],this.degrees[d]+=h,a.belongings[C]===s&&(l+=h,this.externalEdgeWeightPerCommunity[d]+=h,this.communityWeights[d]+=h);var b=this.externalEdgeWeightPerCommunity.slice(),m,A,v,p=o-i,E,S,$,x,D,I,j,O,w,ge,ce,L,_;for(A=this.random(i,o-1),m=i;m<o;m++,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),E=0,g=a.starts[d],y=a.starts[d+1];g<y;g++)C=a.neighborhood[g],a.belongings[C]===s&&(h=a.weights[g],E+=h,t(c,this.belongings[C],h));for(S=d,x=0,D=0,v=0;v<c.size;v++)I=c.dense[v],j=c.vals[v],O=this.communityWeights[I],this.externalEdgeWeightPerCommunity[I]>=O*(l/2-O)*this.resolution&&($=j-(E+a.loops[d])*O*this.resolution/l,$>x&&(S=I,x=$),$>=0&&(D+=Math.exp($/this.randomness))),this.cumulativeIncrement[v]=D;if(D<Number.MAX_VALUE&&D<1/0){for(w=D*this.rng(),ge=-1,ce=c.size+1;ge<ce-1;)L=ge+ce>>>1,this.cumulativeIncrement[L]>=w?ce=L:ge=L;_=c.dense[ce]}else _=S;for(this.communityWeights[_]+=E+a.loops[d],g=a.starts[d],y=a.starts[d+1];g<y;g++)C=a.neighborhood[g],a.belongings[C]===s&&(I=this.belongings[C],I===_?this.externalEdgeWeightPerCommunity[_]-=b[C]:this.externalEdgeWeightPerCommunity[_]+=b[C]);_!==d&&(this.belongings[d]=_,this.nonSingleton[_]=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)},n.prototype.refinePartition=function(){this.groupByCommunities(),this.macroCommunities=new Array(this.B);var i,o,a,s,c=this.communitiesBounds;for(i=0;i<this.B;i++)o=c[i],a=c[i+1],s=this.mergeNodesSubset(o,a),this.macroCommunities[i]=s},n.prototype.split=function(){var i=this.index,o=this.neighboringCommunities;o.clear();var a,s,c;for(a=0;a<i.C;a++)s=this.belongings[a],a===s&&(c=i.isolate(a,this.degrees[a]),o.set(s,c));for(a=0;a<i.C;a++)s=this.belongings[a],a!==s&&(c=o.get(s),i.move(a,this.degrees[a],c));var l,d;for(a=0;a<this.macroCommunities.length;a++)for(d=this.macroCommunities[a],l=0;l<d.length;l++)d[l]=o.get(d[l])},n.prototype.zoomOut=function(){var i=this.index;this.refinePartition(),this.split();var o=i.zoomOut(),a,s,c,l,d;for(l=0;l<this.macroCommunities.length;l++)for(a=this.macroCommunities[l],s=o[a[0]],d=1;d<a.length;d++)c=o[a[d]],i.expensiveMove(c,s)},n.prototype.onlySingletons=function(){var i=this.index,o;for(o=0;o<i.C;o++)if(i.counts[o]>1)return!1;return!0},jn.addWeightToCommunity=t,jn.UndirectedLeidenAddenda=n,jn}var Bn={},tn={},ra;function Wc(){if(ra)return tn;ra=1;function r(n){return typeof n!="number"||isNaN(n)?1:n}function e(n,i){var o={},a=function(l){return typeof l>"u"?i:l};typeof i=="function"&&(a=i);var s=function(l){return a(l[n])},c=function(){return a(void 0)};return typeof n=="string"?(o.fromAttributes=s,o.fromGraph=function(l,d){return s(l.getNodeAttributes(d))},o.fromEntry=function(l,d){return s(d)}):typeof n=="function"?(o.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},o.fromGraph=function(l,d){return a(n(d,l.getNodeAttributes(d)))},o.fromEntry=function(l,d){return a(n(l,d))}):(o.fromAttributes=c,o.fromGraph=c,o.fromEntry=c),o}function t(n,i){var o={},a=function(l){return typeof l>"u"?i:l};typeof i=="function"&&(a=i);var s=function(l){return a(l[n])},c=function(){return a(void 0)};return typeof n=="string"?(o.fromAttributes=s,o.fromGraph=function(l,d){return s(l.getEdgeAttributes(d))},o.fromEntry=function(l,d){return s(d)},o.fromPartialEntry=o.fromEntry,o.fromMinimalEntry=o.fromEntry):typeof n=="function"?(o.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},o.fromGraph=function(l,d){var f=l.extremities(d);return a(n(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,C){return a(n(l,d,f,h,g,y,C))},o.fromPartialEntry=function(l,d,f,h){return a(n(l,d,f,h))},o.fromMinimalEntry=function(l,d){return a(n(l,d))}):(o.fromAttributes=c,o.fromGraph=c,o.fromEntry=c,o.fromMinimalEntry=c),o}return tn.createNodeValueGetter=e,tn.createEdgeValueGetter=t,tn.createEdgeWeightGetter=function(n){return t(n,r)},tn}var na;function jc(){if(na)return Bn;na=1;var r=Ro(),e=Go(),t=Wc().createEdgeWeightGetter,n=Symbol.for("nodejs.util.inspect.custom"),i={getEdgeWeight:"weight",keepDendrogram:!1,resolution:1};function o(s,c){c=e(c,i);var l=c.resolution,d=t(c.getEdgeWeight).fromEntry,f=(s.size-s.selfLoopCount)*2,h=r.getPointerArray(f),g=r.getPointerArray(s.order+1),y=c.getEdgeWeight?Float64Array:r.getPointerArray(s.size*2);this.C=s.order,this.M=0,this.E=f,this.U=0,this.resolution=l,this.level=0,this.graph=s,this.nodes=new Array(s.order),this.keepDendrogram=c.keepDendrogram,this.neighborhood=new g(f),this.weights=new y(f),this.loops=new y(s.order),this.starts=new h(s.order+1),this.belongings=new g(s.order),this.dendrogram=[],this.mapping=null,this.counts=new g(s.order),this.unused=new g(s.order),this.totalWeights=new y(s.order);var C={},b,m=0,A=0,v=this;s.forEachNode(function(p){v.nodes[m]=p,C[p]=m,A+=s.undirectedDegreeWithoutSelfLoops(p),v.starts[m]=A,v.belongings[m]=m,v.counts[m]=1,m++}),s.forEachEdge(function(p,E,S,$,x,D,I){if(b=d(p,E,S,$,x,D,I),S=C[S],$=C[$],v.M+=b,S===$)v.totalWeights[S]+=b*2,v.loops[S]=b*2;else{v.totalWeights[S]+=b,v.totalWeights[$]+=b;var j=--v.starts[S],O=--v.starts[$];v.neighborhood[j]=$,v.neighborhood[O]=S,v.weights[j]=b,v.weights[O]=b}}),this.starts[m]=this.E,this.keepDendrogram?this.dendrogram.push(this.belongings.slice()):this.mapping=this.belongings.slice()}o.prototype.isolate=function(s,c){var l=this.belongings[s];if(this.counts[l]===1)return l;var d=this.unused[--this.U],f=this.loops[s];return this.totalWeights[l]-=c+f,this.totalWeights[d]+=c+f,this.belongings[s]=d,this.counts[l]--,this.counts[d]++,d},o.prototype.move=function(s,c,l){var d=this.belongings[s],f=this.loops[s];this.totalWeights[d]-=c+f,this.totalWeights[l]+=c+f,this.belongings[s]=l;var h=this.counts[d]--===1;this.counts[l]++,h&&(this.unused[this.U++]=d)},o.prototype.computeNodeDegree=function(s){var c,l,d,f=0;for(c=this.starts[s],l=this.starts[s+1];c<l;c++)d=this.weights[c],f+=d;return f},o.prototype.expensiveIsolate=function(s){var c=this.computeNodeDegree(s);return this.isolate(s,c)},o.prototype.expensiveMove=function(s,c){var l=this.computeNodeDegree(s);this.move(s,l,c)},o.prototype.zoomOut=function(){var s=new Array(this.C-this.U),c={},l=this.nodes.length,d=0,f=0,h,g,y,C,b,m,A,v,p;for(h=0,y=this.C;h<y;h++)m=this.belongings[h],m in c||(c[m]=d,s[d]={adj:{},totalWeights:this.totalWeights[m],internalWeights:0},d++),this.belongings[h]=c[m];var E,S;if(this.keepDendrogram){for(E=this.dendrogram[this.level],S=new(r.getPointerArray(d))(l),h=0;h<l;h++)S[h]=this.belongings[E[h]];this.dendrogram.push(S)}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(m=this.belongings[h],v=s[m],p=v.adj,v.internalWeights+=this.loops[h],g=this.starts[h],C=this.starts[h+1];g<C;g++){if(b=this.neighborhood[g],A=this.belongings[b],m===A){v.internalWeights+=this.weights[g];continue}A in p||(p[A]=0),p[A]+=this.weights[g]}for(this.C=d,b=0,m=0;m<d;m++){v=s[m],p=v.adj,m=+m,this.totalWeights[m]=v.totalWeights,this.loops[m]=v.internalWeights,this.counts[m]=1,this.starts[m]=b,this.belongings[m]=m;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 s,c,l,d,f,h=0,g=this.M*2,y=new Float64Array(this.C);for(l=0;l<this.C;l++)for(s=this.belongings[l],y[s]+=this.loops[l],d=this.starts[l],f=this.starts[l+1];d<f;d++)c=this.belongings[this.neighborhood[d]],s===c&&(y[s]+=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(s,c,l,d){var f=this.M,h=this.totalWeights[d];return c+=this.loops[s],l/f-h*c*this.resolution/(2*f*f)},o.prototype.deltaWithOwnCommunity=function(s,c,l,d){var f=this.M,h=this.totalWeights[d];return c+=this.loops[s],l/f-(h-c)*c*this.resolution/(2*f*f)},o.prototype.fastDelta=function(s,c,l,d){var f=this.M,h=this.totalWeights[d];return c+=this.loops[s],l-c*h*this.resolution/(2*f)},o.prototype.fastDeltaWithOwnCommunity=function(s,c,l,d){var f=this.M,h=this.totalWeights[d];return c+=this.loops[s],l-c*(h-c)*this.resolution/(2*f)},o.prototype.bounds=function(s){return[this.starts[s],this.starts[s+1]]},o.prototype.project=function(){var s=this,c={};return s.nodes.slice(0,this.C).forEach(function(l,d){c[l]=Array.from(s.neighborhood.slice(s.starts[d],s.starts[d+1])).map(function(f){return s.nodes[f]})}),c},o.prototype.collect=function(s){arguments.length<1&&(s=this.level);var c={},l=this.keepDendrogram?this.dendrogram[s]: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(s,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],s,l[d])},o.prototype[n]=function(){var s={};Object.defineProperty(s,"constructor",{value:o,enumerable:!1}),s.C=this.C,s.M=this.M,s.E=this.E,s.U=this.U,s.resolution=this.resolution,s.level=this.level,s.nodes=this.nodes,s.starts=this.starts.slice(0,s.C+1);var c=["neighborhood","weights"],l=["counts","loops","belongings","totalWeights"],d=this;return c.forEach(function(f){s[f]=d[f].slice(0,s.E)}),l.forEach(function(f){s[f]=d[f].slice(0,s.C)}),s.unused=this.unused.slice(0,this.U),this.keepDendrogram?s.dendrogram=this.dendrogram:s.mapping=this.mapping,s};function a(s,c){c=e(c,i);var l=c.resolution,d=t(c.getEdgeWeight).fromEntry,f=(s.size-s.selfLoopCount)*2,h=r.getPointerArray(f),g=r.getPointerArray(s.order+1),y=c.getEdgeWeight?Float64Array:r.getPointerArray(s.size*2);this.C=s.order,this.M=0,this.E=f,this.U=0,this.resolution=l,this.level=0,this.graph=s,this.nodes=new Array(s.order),this.keepDendrogram=c.keepDendrogram,this.neighborhood=new g(f),this.weights=new y(f),this.loops=new y(s.order),this.starts=new h(s.order+1),this.offsets=new h(s.order),this.belongings=new g(s.order),this.dendrogram=[],this.counts=new g(s.order),this.unused=new g(s.order),this.totalInWeights=new y(s.order),this.totalOutWeights=new y(s.order);var C={},b,m=0,A=0,v=this;s.forEachNode(function(p){v.nodes[m]=p,C[p]=m,A+=s.outDegreeWithoutSelfLoops(p),v.starts[m]=A,A+=s.inDegreeWithoutSelfLoops(p),v.offsets[m]=A,v.belongings[m]=m,v.counts[m]=1,m++}),s.forEachEdge(function(p,E,S,$,x,D,I){if(b=d(p,E,S,$,x,D,I),S=C[S],$=C[$],v.M+=b,S===$)v.loops[S]+=b,v.totalInWeights[S]+=b,v.totalOutWeights[S]+=b;else{v.totalOutWeights[S]+=b,v.totalInWeights[$]+=b;var j=--v.starts[S],O=--v.offsets[$];v.neighborhood[j]=$,v.neighborhood[O]=S,v.weights[j]=b,v.weights[O]=b}}),this.starts[m]=this.E,this.keepDendrogram?this.dendrogram.push(this.belongings.slice()):this.mapping=this.belongings.slice()}return a.prototype.bounds=o.prototype.bounds,a.prototype.inBounds=function(s){return[this.offsets[s],this.starts[s+1]]},a.prototype.outBounds=function(s){return[this.starts[s],this.offsets[s]]},a.prototype.project=o.prototype.project,a.prototype.projectIn=function(){var s=this,c={};return s.nodes.slice(0,this.C).forEach(function(l,d){c[l]=Array.from(s.neighborhood.slice(s.offsets[d],s.starts[d+1])).map(function(f){return s.nodes[f]})}),c},a.prototype.projectOut=function(){var s=this,c={};return s.nodes.slice(0,this.C).forEach(function(l,d){c[l]=Array.from(s.neighborhood.slice(s.starts[d],s.offsets[d])).map(function(f){return s.nodes[f]})}),c},a.prototype.isolate=function(s,c,l){var d=this.belongings[s];if(this.counts[d]===1)return d;var f=this.unused[--this.U],h=this.loops[s];return this.totalInWeights[d]-=c+h,this.totalInWeights[f]+=c+h,this.totalOutWeights[d]-=l+h,this.totalOutWeights[f]+=l+h,this.belongings[s]=f,this.counts[d]--,this.counts[f]++,f},a.prototype.move=function(s,c,l,d){var f=this.belongings[s],h=this.loops[s];this.totalInWeights[f]-=c+h,this.totalInWeights[d]+=c+h,this.totalOutWeights[f]-=l+h,this.totalOutWeights[d]+=l+h,this.belongings[s]=d;var g=this.counts[f]--===1;this.counts[d]++,g&&(this.unused[this.U++]=f)},a.prototype.computeNodeInDegree=function(s){var c,l,d,f=0;for(c=this.offsets[s],l=this.starts[s+1];c<l;c++)d=this.weights[c],f+=d;return f},a.prototype.computeNodeOutDegree=function(s){var c,l,d,f=0;for(c=this.starts[s],l=this.offsets[s];c<l;c++)d=this.weights[c],f+=d;return f},a.prototype.expensiveMove=function(s,c){var l=this.computeNodeInDegree(s),d=this.computeNodeOutDegree(s);this.move(s,l,d,c)},a.prototype.zoomOut=function(){var s=new Array(this.C-this.U),c={},l=this.nodes.length,d=0,f=0,h,g,y,C,b,m,A,v,p,E,S,$,x;for(h=0,y=this.C;h<y;h++)m=this.belongings[h],m in c||(c[m]=d,s[d]={inAdj:{},outAdj:{},totalInWeights:this.totalInWeights[m],totalOutWeights:this.totalOutWeights[m],internalWeights:0},d++),this.belongings[h]=c[m];var D,I;if(this.keepDendrogram){for(D=this.dendrogram[this.level],I=new(r.getPointerArray(d))(l),h=0;h<l;h++)I[h]=this.belongings[D[h]];this.dendrogram.push(I)}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(m=this.belongings[h],p=this.offsets[h],v=s[m],$=v.inAdj,x=v.outAdj,v.internalWeights+=this.loops[h],g=this.starts[h],C=this.starts[h+1];g<C;g++){if(b=this.neighborhood[g],A=this.belongings[b],E=g<p,S=E?x:$,m===A){E&&(v.internalWeights+=this.weights[g]);continue}A in S||(S[A]=0),S[A]+=this.weights[g]}for(this.C=d,b=0,m=0;m<d;m++){v=s[m],$=v.inAdj,x=v.outAdj,m=+m,this.totalInWeights[m]=v.totalInWeights,this.totalOutWeights[m]=v.totalOutWeights,this.loops[m]=v.internalWeights,this.counts[m]=1,this.starts[m]=b,this.belongings[m]=m;for(A in x)this.neighborhood[b]=+A,this.weights[b]=x[A],f++,b++;this.offsets[m]=b;for(A in $)this.neighborhood[b]=+A,this.weights[b]=$[A],f++,b++}return this.starts[d]=f,this.E=f,this.U=0,this.level++,c},a.prototype.modularity=function(){var s,c,l,d,f,h=0,g=this.M,y=new Float64Array(this.C);for(l=0;l<this.C;l++)for(s=this.belongings[l],y[s]+=this.loops[l],d=this.starts[l],f=this.offsets[l];d<f;d++)c=this.belongings[this.neighborhood[d]],s===c&&(y[s]+=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},a.prototype.delta=function(s,c,l,d,f){var h=this.M,g=this.totalInWeights[f],y=this.totalOutWeights[f],C=this.loops[s];return c+=C,l+=C,d/h-(l*g+c*y)*this.resolution/(h*h)},a.prototype.deltaWithOwnCommunity=function(s,c,l,d,f){var h=this.M,g=this.totalInWeights[f],y=this.totalOutWeights[f],C=this.loops[s];return c+=C,l+=C,d/h-(l*(g-c)+c*(y-l))*this.resolution/(h*h)},a.prototype.collect=o.prototype.collect,a.prototype.assign=o.prototype.assign,a.prototype[n]=function(){var s={};Object.defineProperty(s,"constructor",{value:a,enumerable:!1}),s.C=this.C,s.M=this.M,s.E=this.E,s.U=this.U,s.resolution=this.resolution,s.level=this.level,s.nodes=this.nodes,s.starts=this.starts.slice(0,s.C+1);var c=["neighborhood","weights"],l=["counts","offsets","loops","belongings","totalInWeights","totalOutWeights"],d=this;return c.forEach(function(f){s[f]=d[f].slice(0,s.E)}),l.forEach(function(f){s[f]=d[f].slice(0,s.C)}),s.unused=this.unused.slice(0,this.U),this.keepDendrogram?s.dendrogram=this.dendrogram:s.mapping=this.mapping,s},Bn.UndirectedLouvainIndex=o,Bn.DirectedLouvainIndex=a,Bn}var Ji,ia;function Tg(){if(ia)return Ji;ia=1;var r=Go(),e=ai(),t=Mc(),n=Oo(),i=Pc(),o=Uc().createRandomIndex,a=Lg(),s=jc(),c=a.addWeightToCommunity,l=s.UndirectedLouvainIndex,d=a.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(m,A,v,p,E){return Math.abs(p-E)<h?m===A?!1:v>m:p>E}function y(m,A,v){for(var p=new l(A,{attributes:{weight:v.attributes.weight},keepDendrogram:m,resolution:v.resolution,weighted:v.weighted}),E=new d(p,{randomness:v.randomness,rng:v.rng}),S=o(v.rng),$,x,D=new n(Float64Array,p.C),I=new i(p.C),j,O,w,ge,ce,L,_,K,ee,M,Re,ae,W,Se,Ce,be=0,Ye=0,ot=[],Ae,ve=0;!(v.maxIterations>0&&ve>=v.maxIterations);){for(ve++,ee=p.C,Ae=0,ce=v.randomWalk?S(ee):0,L=0;L<ee;L++,ce++)_=ce%ee,I.enqueue(_);for(;I.size!==0;){for(_=I.dequeue(),Ye++,M=0,D.clear(),$=p.belongings[_],j=p.starts[_],O=p.starts[_+1];j<O;j++)K=p.neighborhood[j],w=p.weights[j],x=p.belongings[K],M+=w,c(D,x,w);W=p.fastDeltaWithOwnCommunity(_,M,D.get($)||0,$),ae=$;var X=[[$,W,"own",p.counts[$]===1]];for(ge=0;ge<D.size;ge++)x=D.dense[ge],x!==$&&(Re=D.vals[ge],be++,Ce=p.fastDelta(_,M,Re,x),X.push([x,Ce,"other"]),Se=g(ae,$,x,Ce,W),Se&&(W=Ce,ae=x));if(W<0){if(ae=p.isolate(_,M),ae===$)continue}else{if(ae===$)continue;p.move(_,M,ae)}for(Ae++,j=p.starts[_],O=p.starts[_+1];j<O;j++)K=p.neighborhood[j],x=p.belongings[K],x!==ae&&I.enqueue(K)}if(ot.push(Ae),Ae===0){p.zoomOut();break}if(!E.onlySingletons()){E.zoomOut();continue}break}var me={index:p,deltaComputations:be,nodesVisited:Ye,moves:ot};return me}function C(m,A,v,p){if(!e(v))throw new Error("graphology-communities-leiden: the given graph is not a valid graphology instance.");var E=t(v);if(E==="mixed")throw new Error("graphology-communities-leiden: cannot run the algorithm on a true mixed graph.");if(E==="directed")throw new Error("graphology-communities-leiden: not yet implemented for directed graphs.");p=r(p,f);var S=0;if(v.size===0){if(m){v.forEachNode(function(O){v.setNodeAttribute(O,p.attributes.communities,S++)});return}var $={};return v.forEachNode(function(O){$[O]=S++}),A?{communities:$,count:v.order,deltaComputations:0,dendrogram:null,level:0,modularity:NaN,moves:null,nodesVisited:0,resolution:p.resolution}:$}var x=y,D=x(A,v,p),I=D.index;if(!A){if(m){I.assign(p.attributes.community);return}return I.collect()}var j={count:I.C,deltaComputations:D.deltaComputations,dendrogram:I.dendrogram,level:I.level,modularity:I.modularity(),moves:D.moves,nodesVisited:D.nodesVisited,resolution:p.resolution};return m?(I.assign(p.attributes.community),j):(j.communities=I.collect(),j)}var b=C.bind(null,!1,!1);return b.assign=C.bind(null,!0,!1),b.detailed=C.bind(null,!1,!0),b.defaults=f,Ji=b,Ji}var Gg=Tg();const Rg=$o(Gg);var Zi,oa;function Og(){if(oa)return Zi;oa=1;var r=Go(),e=ai(),t=Mc(),n=Oo(),i=Pc(),o=Uc().createRandomIndex,a=jc(),s=a.UndirectedLouvainIndex,c=a.DirectedLouvainIndex,l={nodeCommunityAttribute:"community",getEdgeWeight:"weight",fastLocalMoves:!0,randomWalk:!0,resolution:1,rng:Math.random};function d(m,A,v){var p=m.get(A);typeof p>"u"&&(p=0),p+=v,m.set(A,p)}var f=1e-10;function h(m,A,v,p,E){return Math.abs(p-E)<f?m===A?!1:v>m:p>E}function g(m,A,v){var p=new s(A,{getEdgeWeight:v.getEdgeWeight,keepDendrogram:m,resolution:v.resolution}),E=o(v.rng),S=!0,$=!0,x,D,I=new n(Float64Array,p.C),j,O,w,ge,ce,L,_,K,ee,M,Re,ae,W,Se,Ce,be,Ye=0,ot=0,Ae=[],ve,X;for(v.fastLocalMoves&&(j=new i(p.C));S;){if(M=p.C,S=!1,$=!0,v.fastLocalMoves){for(X=0,L=v.randomWalk?E(M):0,_=0;_<M;_++,L++)K=L%M,j.enqueue(K);for(;j.size!==0;){for(K=j.dequeue(),ot++,Re=0,I.clear(),x=p.belongings[K],O=p.starts[K],w=p.starts[K+1];O<w;O++)ee=p.neighborhood[O],ge=p.weights[O],D=p.belongings[ee],Re+=ge,d(I,D,ge);for(Se=p.fastDeltaWithOwnCommunity(K,Re,I.get(x)||0,x),W=x,ce=0;ce<I.size;ce++)D=I.dense[ce],D!==x&&(ae=I.vals[ce],Ye++,be=p.fastDelta(K,Re,ae,D),Ce=h(W,x,D,be,Se),Ce&&(Se=be,W=D));if(Se<0){if(W=p.isolate(K,Re),W===x)continue}else{if(W===x)continue;p.move(K,Re,W)}for(S=!0,X++,O=p.starts[K],w=p.starts[K+1];O<w;O++)ee=p.neighborhood[O],D=p.belongings[ee],D!==W&&j.enqueue(ee)}Ae.push(X)}else for(ve=[],Ae.push(ve);$;){for($=!1,X=0,L=v.randomWalk?E(M):0,_=0;_<M;_++,L++){for(K=L%M,ot++,Re=0,I.clear(),x=p.belongings[K],O=p.starts[K],w=p.starts[K+1];O<w;O++)ee=p.neighborhood[O],ge=p.weights[O],D=p.belongings[ee],Re+=ge,d(I,D,ge);for(Se=p.fastDeltaWithOwnCommunity(K,Re,I.get(x)||0,x),W=x,ce=0;ce<I.size;ce++)D=I.dense[ce],D!==x&&(ae=I.vals[ce],Ye++,be=p.fastDelta(K,Re,ae,D),Ce=h(W,x,D,be,Se),Ce&&(Se=be,W=D));if(Se<0){if(W=p.isolate(K,Re),W===x)continue}else{if(W===x)continue;p.move(K,Re,W)}$=!0,X++}ve.push(X),S=$||S}S&&p.zoomOut()}var me={index:p,deltaComputations:Ye,nodesVisited:ot,moves:Ae};return me}function y(m,A,v){var p=new c(A,{getEdgeWeight:v.getEdgeWeight,keepDendrogram:m,resolution:v.resolution}),E=o(v.rng),S=!0,$=!0,x,D,I=new n(Float64Array,p.C),j,O,w,ge,ce,L,_,K,ee,M,Re,ae,W,Se,Ce,be,Ye,ot,Ae,ve=0,X=0,me=[],et,J;for(v.fastLocalMoves&&(j=new i(p.C));S;){if(ae=p.C,S=!1,$=!0,v.fastLocalMoves){for(J=0,K=v.randomWalk?E(ae):0,ee=0;ee<ae;ee++,K++)M=K%ae,j.enqueue(M);for(;j.size!==0;){for(M=j.dequeue(),X++,W=0,Se=0,I.clear(),x=p.belongings[M],O=p.starts[M],w=p.starts[M+1],ge=p.offsets[M];O<w;O++)ce=O<ge,Re=p.neighborhood[O],L=p.weights[O],D=p.belongings[Re],ce?Se+=L:W+=L,d(I,D,L);for(Ye=p.deltaWithOwnCommunity(M,W,Se,I.get(x)||0,x),be=x,_=0;_<I.size;_++)D=I.dense[_],D!==x&&(Ce=I.vals[_],ve++,Ae=p.delta(M,W,Se,Ce,D),ot=h(be,x,D,Ae,Ye),ot&&(Ye=Ae,be=D));if(Ye<0){if(be=p.isolate(M,W,Se),be===x)continue}else{if(be===x)continue;p.move(M,W,Se,be)}for(S=!0,J++,O=p.starts[M],w=p.starts[M+1];O<w;O++)Re=p.neighborhood[O],D=p.belongings[Re],D!==be&&j.enqueue(Re)}me.push(J)}else for(et=[],me.push(et);$;){for($=!1,J=0,K=v.randomWalk?E(ae):0,ee=0;ee<ae;ee++,K++){for(M=K%ae,X++,W=0,Se=0,I.clear(),x=p.belongings[M],O=p.starts[M],w=p.starts[M+1],ge=p.offsets[M];O<w;O++)ce=O<ge,Re=p.neighborhood[O],L=p.weights[O],D=p.belongings[Re],ce?Se+=L:W+=L,d(I,D,L);for(Ye=p.deltaWithOwnCommunity(M,W,Se,I.get(x)||0,x),be=x,_=0;_<I.size;_++)D=I.dense[_],D!==x&&(Ce=I.vals[_],ve++,Ae=p.delta(M,W,Se,Ce,D),ot=h(be,x,D,Ae,Ye),ot&&(Ye=Ae,be=D));if(Ye<0){if(be=p.isolate(M,W,Se),be===x)continue}else{if(be===x)continue;p.move(M,W,Se,be)}$=!0,J++}et.push(J),S=$||S}S&&p.zoomOut()}var ne={index:p,deltaComputations:ve,nodesVisited:X,moves:me};return ne}function C(m,A,v,p){if(!e(v))throw new Error("graphology-communities-louvain: the given graph is not a valid graphology instance.");var E=t(v);if(E==="mixed")throw new Error("graphology-communities-louvain: cannot run the algorithm on a true mixed graph.");p=r(p,l);var S=0;if(v.size===0){if(m){v.forEachNode(function(O){v.setNodeAttribute(O,p.nodeCommunityAttribute,S++)});return}var $={};return v.forEachNode(function(O){$[O]=S++}),A?{communities:$,count:v.order,deltaComputations:0,dendrogram:null,level:0,modularity:NaN,moves:null,nodesVisited:0,resolution:p.resolution}:$}var x=E==="undirected"?g:y,D=x(A,v,p),I=D.index;if(!A){if(m){I.assign(p.nodeCommunityAttribute);return}return I.collect()}var j={count:I.C,deltaComputations:D.deltaComputations,dendrogram:I.dendrogram,level:I.level,modularity:I.modularity(),moves:D.moves,nodesVisited:D.nodesVisited,resolution:p.resolution};return m?(I.assign(p.nodeCommunityAttribute),j):(j.communities=I.collect(),j)}var b=C.bind(null,!1,!1);return b.assign=C.bind(null,!0,!1),b.detailed=C.bind(null,!1,!0),b.defaults=l,Zi=b,Zi}var zg=Og();const Mg=$o(zg);var Qi,sa;function Ng(){if(sa)return Qi;sa=1;var r=0,e=1,t=2,n=3,i=4,o=5,a=6,s=7,c=8,l=9,d=0,f=1,h=2,g=0,y=1,C=2,b=3,m=4,A=5,v=6,p=7,E=8,S=3,$=10,x=3,D=9,I=10;return Qi=function(O,w,ge){var ce,L,_,K,ee,M,Re,ae,W,Se,Ce=w.length,be=ge.length,Ye=O.adjustSizes,ot=O.barnesHutTheta*O.barnesHutTheta,Ae,ve,X,me,et,J,ne,G=[];for(_=0;_<Ce;_+=$)w[_+i]=w[_+t],w[_+o]=w[_+n],w[_+t]=0,w[_+n]=0;if(O.outboundAttractionDistribution){for(Ae=0,_=0;_<Ce;_+=$)Ae+=w[_+a];Ae/=Ce/$}if(O.barnesHutOptimize){var It=1/0,Rt=-1/0,Ot=1/0,Ht=-1/0,$t,_t,tt;for(_=0;_<Ce;_+=$)It=Math.min(It,w[_+r]),Rt=Math.max(Rt,w[_+r]),Ot=Math.min(Ot,w[_+e]),Ht=Math.max(Ht,w[_+e]);var Pt=Rt-It,nr=Ht-Ot;for(Pt>nr?(Ot-=(Pt-nr)/2,Ht=Ot+Pt):(It-=(nr-Pt)/2,Rt=It+nr),G[0+g]=-1,G[0+y]=(It+Rt)/2,G[0+C]=(Ot+Ht)/2,G[0+b]=Math.max(Rt-It,Ht-Ot),G[0+m]=-1,G[0+A]=-1,G[0+v]=0,G[0+p]=0,G[0+E]=0,ce=1,_=0;_<Ce;_+=$)for(L=0,tt=S;;)if(G[L+A]>=0){w[_+r]<G[L+y]?w[_+e]<G[L+C]?$t=G[L+A]:$t=G[L+A]+D:w[_+e]<G[L+C]?$t=G[L+A]+D*2:$t=G[L+A]+D*3,G[L+p]=(G[L+p]*G[L+v]+w[_+r]*w[_+a])/(G[L+v]+w[_+a]),G[L+E]=(G[L+E]*G[L+v]+w[_+e]*w[_+a])/(G[L+v]+w[_+a]),G[L+v]+=w[_+a],L=$t;continue}else if(G[L+g]<0){G[L+g]=_;break}else{if(G[L+A]=ce*D,ae=G[L+b]/2,W=G[L+A],G[W+g]=-1,G[W+y]=G[L+y]-ae,G[W+C]=G[L+C]-ae,G[W+b]=ae,G[W+m]=W+D,G[W+A]=-1,G[W+v]=0,G[W+p]=0,G[W+E]=0,W+=D,G[W+g]=-1,G[W+y]=G[L+y]-ae,G[W+C]=G[L+C]+ae,G[W+b]=ae,G[W+m]=W+D,G[W+A]=-1,G[W+v]=0,G[W+p]=0,G[W+E]=0,W+=D,G[W+g]=-1,G[W+y]=G[L+y]+ae,G[W+C]=G[L+C]-ae,G[W+b]=ae,G[W+m]=W+D,G[W+A]=-1,G[W+v]=0,G[W+p]=0,G[W+E]=0,W+=D,G[W+g]=-1,G[W+y]=G[L+y]+ae,G[W+C]=G[L+C]+ae,G[W+b]=ae,G[W+m]=G[L+m],G[W+A]=-1,G[W+v]=0,G[W+p]=0,G[W+E]=0,ce+=4,w[G[L+g]+r]<G[L+y]?w[G[L+g]+e]<G[L+C]?$t=G[L+A]:$t=G[L+A]+D:w[G[L+g]+e]<G[L+C]?$t=G[L+A]+D*2:$t=G[L+A]+D*3,G[L+v]=w[G[L+g]+a],G[L+p]=w[G[L+g]+r],G[L+E]=w[G[L+g]+e],G[$t+g]=G[L+g],G[L+g]=-1,w[_+r]<G[L+y]?w[_+e]<G[L+C]?_t=G[L+A]:_t=G[L+A]+D:w[_+e]<G[L+C]?_t=G[L+A]+D*2:_t=G[L+A]+D*3,$t===_t)if(tt--){L=$t;continue}else{tt=S;break}G[_t+g]=_;break}}if(O.barnesHutOptimize)for(ve=O.scalingRatio,_=0;_<Ce;_+=$)for(L=0;;)if(G[L+A]>=0)if(J=Math.pow(w[_+r]-G[L+p],2)+Math.pow(w[_+e]-G[L+E],2),Se=G[L+b],4*Se*Se/J<ot){if(X=w[_+r]-G[L+p],me=w[_+e]-G[L+E],Ye===!0?J>0?(ne=ve*w[_+a]*G[L+v]/J,w[_+t]+=X*ne,w[_+n]+=me*ne):J<0&&(ne=-ve*w[_+a]*G[L+v]/Math.sqrt(J),w[_+t]+=X*ne,w[_+n]+=me*ne):J>0&&(ne=ve*w[_+a]*G[L+v]/J,w[_+t]+=X*ne,w[_+n]+=me*ne),L=G[L+m],L<0)break;continue}else{L=G[L+A];continue}else{if(M=G[L+g],M>=0&&M!==_&&(X=w[_+r]-w[M+r],me=w[_+e]-w[M+e],J=X*X+me*me,Ye===!0?J>0?(ne=ve*w[_+a]*w[M+a]/J,w[_+t]+=X*ne,w[_+n]+=me*ne):J<0&&(ne=-ve*w[_+a]*w[M+a]/Math.sqrt(J),w[_+t]+=X*ne,w[_+n]+=me*ne):J>0&&(ne=ve*w[_+a]*w[M+a]/J,w[_+t]+=X*ne,w[_+n]+=me*ne)),L=G[L+m],L<0)break;continue}else for(ve=O.scalingRatio,K=0;K<Ce;K+=$)for(ee=0;ee<K;ee+=$)X=w[K+r]-w[ee+r],me=w[K+e]-w[ee+e],Ye===!0?(J=Math.sqrt(X*X+me*me)-w[K+c]-w[ee+c],J>0?(ne=ve*w[K+a]*w[ee+a]/J/J,w[K+t]+=X*ne,w[K+n]+=me*ne,w[ee+t]-=X*ne,w[ee+n]-=me*ne):J<0&&(ne=100*ve*w[K+a]*w[ee+a],w[K+t]+=X*ne,w[K+n]+=me*ne,w[ee+t]-=X*ne,w[ee+n]-=me*ne)):(J=Math.sqrt(X*X+me*me),J>0&&(ne=ve*w[K+a]*w[ee+a]/J/J,w[K+t]+=X*ne,w[K+n]+=me*ne,w[ee+t]-=X*ne,w[ee+n]-=me*ne));for(W=O.gravity/O.scalingRatio,ve=O.scalingRatio,_=0;_<Ce;_+=$)ne=0,X=w[_+r],me=w[_+e],J=Math.sqrt(Math.pow(X,2)+Math.pow(me,2)),O.strongGravityMode?J>0&&(ne=ve*w[_+a]*W):J>0&&(ne=ve*w[_+a]*W/J),w[_+t]-=X*ne,w[_+n]-=me*ne;for(ve=1*(O.outboundAttractionDistribution?Ae:1),Re=0;Re<be;Re+=x)K=ge[Re+d],ee=ge[Re+f],ae=ge[Re+h],et=Math.pow(ae,O.edgeWeightInfluence),X=w[K+r]-w[ee+r],me=w[K+e]-w[ee+e],Ye===!0?(J=Math.sqrt(X*X+me*me)-w[K+c]-w[ee+c],O.linLogMode?O.outboundAttractionDistribution?J>0&&(ne=-ve*et*Math.log(1+J)/J/w[K+a]):J>0&&(ne=-ve*et*Math.log(1+J)/J):O.outboundAttractionDistribution?J>0&&(ne=-ve*et/w[K+a]):J>0&&(ne=-ve*et)):(J=Math.sqrt(Math.pow(X,2)+Math.pow(me,2)),O.linLogMode?O.outboundAttractionDistribution?J>0&&(ne=-ve*et*Math.log(1+J)/J/w[K+a]):J>0&&(ne=-ve*et*Math.log(1+J)/J):O.outboundAttractionDistribution?(J=1,ne=-ve*et/w[K+a]):(J=1,ne=-ve*et)),J>0&&(w[K+t]+=X*ne,w[K+n]+=me*ne,w[ee+t]-=X*ne,w[ee+n]-=me*ne);var gr,ir,Er,Lt,Sr,or;if(Ye===!0)for(_=0;_<Ce;_+=$)w[_+l]!==1&&(gr=Math.sqrt(Math.pow(w[_+t],2)+Math.pow(w[_+n],2)),gr>I&&(w[_+t]=w[_+t]*I/gr,w[_+n]=w[_+n]*I/gr),ir=w[_+a]*Math.sqrt((w[_+i]-w[_+t])*(w[_+i]-w[_+t])+(w[_+o]-w[_+n])*(w[_+o]-w[_+n])),Er=Math.sqrt((w[_+i]+w[_+t])*(w[_+i]+w[_+t])+(w[_+o]+w[_+n])*(w[_+o]+w[_+n]))/2,Lt=.1*Math.log(1+Er)/(1+Math.sqrt(ir)),Sr=w[_+r]+w[_+t]*(Lt/O.slowDown),w[_+r]=Sr,or=w[_+e]+w[_+n]*(Lt/O.slowDown),w[_+e]=or);else for(_=0;_<Ce;_+=$)w[_+l]!==1&&(ir=w[_+a]*Math.sqrt((w[_+i]-w[_+t])*(w[_+i]-w[_+t])+(w[_+o]-w[_+n])*(w[_+o]-w[_+n])),Er=Math.sqrt((w[_+i]+w[_+t])*(w[_+i]+w[_+t])+(w[_+o]+w[_+n])*(w[_+o]+w[_+n]))/2,Lt=w[_+s]*Math.log(1+Er)/(1+Math.sqrt(ir)),w[_+s]=Math.min(1,Math.sqrt(Lt*(Math.pow(w[_+t],2)+Math.pow(w[_+n],2))/(1+Math.sqrt(ir)))),Sr=w[_+r]+w[_+t]*(Lt/O.slowDown),w[_+r]=Sr,or=w[_+e]+w[_+n]*(Lt/O.slowDown),w[_+e]=or);return{}},Qi}var Jt={},aa;function Pg(){if(aa)return Jt;aa=1;var r=10,e=3;return Jt.assign=function(t){t=t||{};var n=Array.prototype.slice.call(arguments).slice(1),i,o,a;for(i=0,a=n.length;i<a;i++)if(n[i])for(o in n[i])t[o]=n[i][o];return t},Jt.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},Jt.graphToByteArrays=function(t,n){var i=t.order,o=t.size,a={},s,c=new Float32Array(i*r),l=new Float32Array(o*e);return s=0,t.forEachNode(function(d,f){a[d]=s,c[s]=f.x,c[s+1]=f.y,c[s+2]=0,c[s+3]=0,c[s+4]=0,c[s+5]=0,c[s+6]=1,c[s+7]=1,c[s+8]=f.size||1,c[s+9]=f.fixed?1:0,s+=r}),s=0,t.forEachEdge(function(d,f,h,g,y,C,b){var m=a[h],A=a[g],v=n(d,f,h,g,y,C,b);c[m+6]+=v,c[A+6]+=v,l[s]=m,l[s+1]=A,l[s+2]=v,s+=e}),{nodes:c,edges:l}},Jt.assignLayoutChanges=function(t,n,i){var o=0;t.updateEachNodeAttributes(function(a,s){return s.x=n[o],s.y=n[o+1],o+=r,i?i(a,s):s})},Jt.readGraphPositions=function(t,n){var i=0;t.forEachNode(function(o,a){n[i]=a.x,n[i+1]=a.y,i+=r})},Jt.collectLayoutChanges=function(t,n,i){for(var o=t.nodes(),a={},s=0,c=0,l=n.length;s<l;s+=r){if(i){var d=Object.assign({},t.getNodeAttributes(o[c]));d.x=n[s],d.y=n[s+1],d=i(o[c],d),a[o[c]]={x:d.x,y:d.y}}else a[o[c]]={x:n[s],y:n[s+1]};c++}return a},Jt.createWorker=function(n){var i=window.URL||window.webkitURL,o=n.toString(),a=i.createObjectURL(new Blob(["("+o+").call(this);"],{type:"text/javascript"})),s=new Worker(a);return i.revokeObjectURL(a),s},Jt}var eo,ca;function Ug(){return ca||(ca=1,eo={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}),eo}var to,la;function Wg(){if(la)return to;la=1;var r=ai(),e=Wc().createEdgeWeightGetter,t=Ng(),n=Pg(),i=Ug();function o(c,l,d){if(!r(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=n.assign({},i,d.settings),C=n.validateSettings(y);if(C)throw new Error("graphology-layout-forceatlas2: "+C.message);var b=n.graphToByteArrays(l,h),m;for(m=0;m<f;m++)t(y,b.nodes,b.edges);if(c){n.assignLayoutChanges(l,b.nodes,g);return}return n.collectLayoutChanges(l,b.nodes)}function a(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 s=o.bind(null,!1);return s.assign=o.bind(null,!0),s.inferSettings=a,to=s,to}var jg=Wg();const ua=$o(jg),Bg=["centrality_score","centrality","pagerank","page_rank","betweenness","closeness","eigenvector","degree","score"];function Fg(r){return r==null?"":String(r)}function Vg(r){const e=typeof r=="number"?r:typeof r=="string"&&r.trim()?Number(r):NaN;return Number.isFinite(e)?e:null}function da(r){for(const e of Bg){const t=Vg(r.data[e]);if(t!==null)return t}return null}function fa(r,e){for(const t of e){const n=r[t];if(typeof n=="string"&&n.trim())return n}return null}function zo(r,e){const t=r[e];return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function ha(r){return Array.isArray(r)?r.filter(e=>typeof e=="string"||typeof e=="number").map(e=>String(e).trim()).filter(Boolean):[]}function Kg(r){const e=zo(r.data,"metadata");return fa(r.data,["description","summary","content"])??(e?fa(e,["description","summary","content"]):null)}function Hg(r){const e=ha(r.data.exports);if(e.length>0)return e;const t=zo(r.data,"metadata");return t?ha(t.exports):[]}function pa(r,e){for(const t of e){const n=r[t];if(typeof n=="boolean")return n;if(typeof n=="string"){const i=n.trim().toLowerCase();if(["true","yes","1"].includes(i))return!0;if(["false","no","0"].includes(i))return!1}}return null}function Bc(r,e){var i;const t=zo(r.data,"metadata"),n=pa(r.data,["orphan","is_orphan","isOrphan","dead_code","deadCode"])??(t?pa(t,["orphan","is_orphan","isOrphan","dead_code","deadCode"]):null);return n!==null?n:(((i=e==null?void 0:e.get(r.id))==null?void 0:i.inDegree)??1)===0}function qg(r){var n,i;const e=((n=r.data)==null?void 0:n.kind)??((i=r.data)==null?void 0:i.type)??r.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 Yg(r,e){return r==="imports"?e==="incoming"?"imported by":"imports":r==="defines"?e==="incoming"?"defined by":"defines":e==="incoming"?"referenced by":"references"}function Xg(r,e,t,n){const i=new Map(e.map(l=>[l.id,l])),o=[];for(const l of t){const d=l.source===r.id?"outgoing":l.target===r.id?"incoming":null;if(!d)continue;const f=d==="outgoing"?l.target:l.source,h=i.get(f),g=qg(l);o.push({id:l.id,kind:g,direction:d,label:Yg(g,d),edgeLabel:l.label,nodeId:f,nodeLabel:(h==null?void 0:h.label)??f})}const a=(l,d)=>l.kind.localeCompare(d.kind)||l.nodeLabel.localeCompare(d.nodeLabel)||l.nodeId.localeCompare(d.nodeId),s=o.filter(l=>l.direction==="incoming").sort(a),c=o.filter(l=>l.direction==="outgoing").sort(a);return{description:Kg(r),exports:Hg(r),orphan:Bc(r,n),incoming:s,outgoing:c,whereUsed:s}}function Jg(r,e){const t=new Map;for(const n of r)t.set(n.id,{degree:0,inDegree:0,outDegree:0,score:da(n)??0});for(const n of e){const i=t.get(n.source),o=t.get(n.target);i&&(i.outDegree+=1,i.degree+=1),o&&(o.inDegree+=1,o.degree+=1)}for(const n of r){const i=t.get(n.id);i&&(i.score=da(n)??i.degree)}return t}function Zg(r,e,t){const n=t.get(r.id),i=t.get(e.id),o=((i==null?void 0:i.score)??0)-((n==null?void 0:n.score)??0);if(o!==0)return o;const a=((i==null?void 0:i.degree)??0)-((n==null?void 0:n.degree)??0);if(a!==0)return a;const s=r.label.localeCompare(e.label);return s!==0?s:r.id.localeCompare(e.id)}function Qg(r,e){const t=r.map(o=>{var a;return((a=e.get(o.id))==null?void 0:a.inDegree)??0});return Math.max(0,...t)<=0?new Map(r.map(o=>[o.id,1])):[...new Set(t)].sort((o,a)=>o-a).length===1?new Map(r.map(o=>[o.id,1])):new Map(r.map(o=>{var c;const a=((c=e.get(o.id))==null?void 0:c.inDegree)??0;if(a<=0)return[o.id,1];const s=t.filter(l=>l<=a).length/t.length;return s>.95?[o.id,2]:s>.8?[o.id,1.5]:s>.5?[o.id,1.25]:[o.id,1]}))}function ga(r){const e=r.id??r.rid??r._id??r.uid;return e==null?null:String(e)}function ma(r,e){const t=r.label??r.name??r.title;return t!=null?String(t):e}function em(r){const e=r.source??r.from??r.src??r.start,t=r.target??r.to??r.dst??r.end;return e==null||t===null||t===void 0?null:{source:String(e),target:String(t)}}function tm(r){const e=new Map,t=new Map;for(const n of r.result.records){if(n.nodes)for(const o of Object.values(n.nodes)){if(!o||typeof o!="object")continue;const a=o,s=ga(a);s&&(e.has(s)||e.set(s,{id:s,label:ma(a,s),data:a}))}if(n.edges)for(const o of Object.values(n.edges)){if(!o||typeof o!="object")continue;const a=o,s=em(a);if(!s)continue;const c=a.label??a.type??a.rel,l=`${s.source}->${s.target}:${Fg(c)}`;t.has(l)||t.set(l,{id:l,source:s.source,target:s.target,label:c!==void 0?String(c):void 0,data:a})}const i=n.values;if(i&&typeof i=="object"){const o=i.kind;if(o==="node"){const a=ga(i);a&&!e.has(a)&&e.set(a,{id:a,label:ma(i,a),data:i})}else if(o==="edge"){const a=i.from_rid??i.from,s=i.to_rid??i.to;if(a!=null&&s!==void 0&&s!==null){const c=String(a),l=String(s),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 sy(r){var t;const e=(t=r.result)==null?void 0:t.records;return!e||e.length===0?!1:e.some(n=>{if(n.nodes&&Object.keys(n.nodes).length>0||n.edges&&Object.keys(n.edges).length>0)return!0;const i=n.values;return!!(i&&(i.kind==="node"||i.kind==="edge"))})}function rm(r){let e=r>>>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 nm(r,e,t=Rg){try{if(!t||typeof t.assign!="function")throw new Error("Leiden community detection unavailable");return t.assign(r,{attributes:{community:"community"},rng:e}),"leiden"}catch{return Mg.assign(r,{nodeCommunityAttribute:"community",rng:e}),"louvain"}}function im(r,e){const t=new Map;if(r.length===0)return t;if(r.length===1)return t.set(r[0].id,{x:50,y:50,community:0}),t;const n=new qe({type:"undirected",multi:!1,allowSelfLoops:!0}),i=rm(r.length*131+e.length),o=Math.PI*2;r.forEach((C,b)=>{const m=b/r.length*o+i()*.1;n.addNode(C.id,{x:Math.cos(m),y:Math.sin(m)})});for(const C of e)!n.hasNode(C.source)||!n.hasNode(C.target)||C.source!==C.target&&(n.hasEdge(C.source,C.target)||n.addEdge(C.source,C.target));if(n.size===0){const C=Math.ceil(Math.sqrt(r.length));return r.forEach((b,m)=>{const A=Math.floor(m/C),v=m%C;t.set(b.id,{x:10+v/Math.max(1,C-1)*80,y:10+A/Math.max(1,C-1)*80,community:m})}),t}nm(n,i);const a=ua.inferSettings(n);ua.assign(n,{iterations:r.length>200?120:200,settings:{...a,strongGravityMode:!0,gravity:1.2,scalingRatio:10,barnesHutOptimize:r.length>500}});let s=1/0,c=-1/0,l=1/0,d=-1/0;n.forEachNode((C,b)=>{b.x<s&&(s=b.x),b.x>c&&(c=b.x),b.y<l&&(l=b.y),b.y>d&&(d=b.y)});const f=c-s||1,h=d-l||1,g=5,y=100-g*2;return n.forEachNode((C,b)=>{t.set(C,{x:g+(b.x-s)/f*y,y:g+(b.y-l)/h*y,community:b.community??0})}),t}function Mo(r,e=!0){const t=[200,25,145,290,50,175,320,95,0,260,220,130],n=r<t.length?t[r]:(t[0]+r*137.508)%360,i=e?62:58,o=e?60:48;return`hsl(${n.toFixed(0)} ${i}% ${o}%)`}function Qn(r){switch(r){case"tale":return"#ff2056";case"character":return"#7dd3fc";case"location":return"#a3e635";case"object":return"#fbbf24";case"archetype":return"#a78bfa";default:return"#94a3b8"}}function om(r){return r==="tale"?8:r==="character"?5:r==="location"||r==="object"?4:3}function Fc(r,e){const t=Math.max(.35,Math.min(1.25,om(r)*.14));return Math.max(.35,Math.min(2.5,t*e))}const Vc=3.4;function sm(r,e){return Fc(r,e)*Vc}const am="#e2e8f0";function Kc(r){return Math.min(7,2.2+Math.sqrt(Math.max(1,r))*.7)}function cm(r){return Kc(r)*Vc}function lm(r,e,t){const n=e/100,i=t/100,o=(1-Math.abs(2*i-1))*n,a=(r%360+360)%360/60,s=o*(1-Math.abs(a%2-1));let c=0,l=0,d=0;a>=0&&a<1?[c,l,d]=[o,s,0]:a<2?[c,l,d]=[s,o,0]:a<3?[c,l,d]=[0,o,s]:a<4?[c,l,d]=[0,s,o]:a<5?[c,l,d]=[s,0,o]:[c,l,d]=[o,0,s];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 Hc(r){const e=r.match(/hsl\(\s*([\d.]+)\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%/i);return e?lm(Number(e[1]),Number(e[2]),Number(e[3])):null}function um({r,g:e,b:t}){return`rgb(${r}, ${e}, ${t})`}function dm(r,e=!0){const t=Mo(r,e),n=Hc(t);return n?um(n):t}function Ur(r,e){const t=Math.max(0,Math.min(1,e)),n=r.startsWith("hsl")?Hc(r):null;if(n)return`rgba(${n.r}, ${n.g}, ${n.b}, ${t})`;const i=r.match(/rgb\(\s*([\d.]+)[, ]+([\d.]+)[, ]+([\d.]+)/i);if(i)return`rgba(${i[1]}, ${i[2]}, ${i[3]}, ${t})`;const o=r.replace("#","");if(/^[0-9a-f]{6}$/i.test(o)){const a=parseInt(o.slice(0,2),16),s=parseInt(o.slice(2,4),16),c=parseInt(o.slice(4,6),16);return`rgba(${a}, ${s}, ${c}, ${t})`}return r}const fm="#d6a72c",hm="#f4c84a";function pm(r){var d,f,h,g;const{nodes:e,edges:t,layout:n,sizeScales:i,orphanIds:o,dark:a=!0,edgeColor:s="#3a424d",bundledCurvatures:c}=r,l=new qe({type:"directed",multi:!0,allowSelfLoops:!0});for(const y of e){if(l.hasNode(y.id))continue;const C=String(y.data.node_type??"node"),b=i.get(y.id)??1,m=n.get(y.id),A=y.data.__supernode===!0,v=typeof y.data.__memberCount=="number"?y.data.__memberCount:0,p=A?cm(v):sm(C,b),E=m?dm(m.community,a):Qn(C);l.addNode(y.id,{x:(m==null?void 0:m.x)??50,y:-((m==null?void 0:m.y)??50),size:p,baseSize:p,color:E,mutedColor:Ur(E,.14),borderColor:A?am:Qn(C),label:y.label,nodeType:C,community:(m==null?void 0:m.community)??-1,orphan:o.has(y.id),isSupernode:A,memberCount:v,type:"border"})}for(const y of t){if(!l.hasNode(y.source)||!l.hasNode(y.target)||l.hasEdge(y.id))continue;const C=((d=n.get(y.source))==null?void 0:d.community)??-1,b=((f=n.get(y.target))==null?void 0:f.community)??-1,m=((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:m?Math.min(6,1+Math.log2(A+1)):1,color:Ur(s,.34),edgeLabel:y.label??"",label:"",crossCommunity:C!==b,curvature:(c==null?void 0:c.get(y.id))??0,type:"line"})}return l}function gm(r,e,t={}){const{padding:n=2.5,dark:i=!0}=t,o=new Map;for(const a of r){const s=e.get(a.id);if(!s)continue;const c=o.get(s.community);c?(c.minX=Math.min(c.minX,s.x),c.minY=Math.min(c.minY,s.y),c.maxX=Math.max(c.maxX,s.x),c.maxY=Math.max(c.maxY,s.y),c.count+=1):o.set(s.community,{minX:s.x,minY:s.y,maxX:s.x,maxY:s.y,count:1})}return[...o.entries()].sort((a,s)=>a[0]-s[0]).map(([a,s])=>{const c=Mo(a,i);return{community:a,count:s.count,tint:c,fill:Ur(c,.08),stroke:Ur(c,.5),minX:s.minX-n,minY:s.minY-n,maxX:s.maxX+n,maxY:s.maxY+n,cx:(s.minX+s.maxX)/2,cy:(s.minY+s.maxY)/2}})}function va(r,e,t,n,i){const o=t-r,a=n-e;let s=1;return o>0?s=Math.min(s,(i.maxX-r)/o):o<0&&(s=Math.min(s,(i.minX-r)/o)),a>0?s=Math.min(s,(i.maxY-e)/a):a<0&&(s=Math.min(s,(i.minY-e)/a)),s=Math.max(0,Math.min(1,s)),{x:r+o*s,y:e+a*s}}function mm(r,e,t){const n=new Map(t.map(o=>[o.community,o])),i=[];for(const o of r){const a=e.get(o.source),s=e.get(o.target);if(!a||!s||a.community===s.community)continue;const c=n.get(a.community),l=n.get(s.community);if(!c||!l)continue;const d=va(a.x,a.y,s.x,s.y,c),f=va(s.x,s.y,a.x,a.y,l);i.push({id:o.id,source:o.source,target:o.target,label:o.label,sourceCommunity:a.community,targetCommunity:s.community,x1:d.x,y1:d.y,x2:f.x,y2:f.y})}return i}const vm=36,ym=28,bm=36;function wm(r,e,t){const{focus:n,focusId:i,selectedNodeId:o,pulse:a,colors:s}=t,c=i!==null,l=i===r,d=n.nodes.has(r),f=!c||d,h=c?l?2.2+a*.38:d?1.58:.9:1,g=l?s.focusNodeStroke:e.orphan?s.warn:o===r?s.selectedNodeStroke:e.borderColor,y=e.isSupernode||c&&(l||n.nodes.size<=bm&&d);return{size:e.baseSize*h,color:f?e.color:e.mutedColor,borderColor:g,label:y?e.label.slice(0,vm):"",forceLabel:y,zIndex:l?3:e.isSupernode||d?2:1,hidden:!1}}function _m(r,e,t){const{focus:n,focusId:i,colors:o,groupInBox:a,bundle:s}=t,c=i!==null,l=n.edges.has(r),d=e.curvature,f=s&&Math.abs(d)>1e-4?"curved":"line";return a&&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,ym):"",forceLabel:!!e.edgeLabel,zIndex:2,hidden:!1,type:f,curvature:d}:{size:e.size,color:Ur(o.edge,.055),label:"",forceLabel:!1,zIndex:0,hidden:!1,type:f,curvature:d}:{size:e.size,color:Ur(o.edge,.34),label:"",forceLabel:!1,zIndex:0,hidden:!1,type:f,curvature:d}}const xm={stiffness:.1,stepSize:.1,cycles:6,iterations:60,iterationRate:2/3,subdivisionRate:2,compatibilityThreshold:.6},ro=1500,Wr=1e-6;function ln(r,e){return Math.hypot(r.x-e.x,r.y-e.y)}function ei(r,e){return{x:(r.x+e.x)/2,y:(r.y+e.y)/2}}function ya(r,e){const t=e+2,n=[0];for(let s=1;s<r.length;s++)n.push(n[s-1]+ln(r[s],r[s-1]));const i=n[n.length-1];if(i<Wr)return Array.from({length:t},()=>({...r[0]}));const o=[];let a=1;for(let s=0;s<t;s++){const c=i*s/(t-1);for(;a<r.length-1&&n[a]<c;)a++;const l=n[a-1],d=n[a]-l||1,f=Math.max(0,Math.min(1,(c-l)/d));o.push({x:r[a-1].x+f*(r[a].x-r[a-1].x),y:r[a-1].y+f*(r[a].y-r[a-1].y)})}return o}function km(r,e){const t=(r.t.x-r.s.x)*(e.t.x-e.s.x)+(r.t.y-r.s.y)*(e.t.y-e.s.y);return Math.abs(t/(r.len*e.len))}function Em(r,e){const t=(r.len+e.len)/2;return 2/(t/Math.min(r.len,e.len)+Math.max(r.len,e.len)/t)}function Sm(r,e){const t=(r.len+e.len)/2;return t/(t+ln(ei(r.s,r.t),ei(e.s,e.t)))}function ba(r,e){const t=e.len*e.len,n=((e.s.y-r.y)*(e.s.y-e.t.y)-(e.s.x-r.x)*(e.t.x-e.s.x))/t;return{x:e.s.x+n*(e.t.x-e.s.x),y:e.s.y+n*(e.t.y-e.s.y)}}function wa(r,e){const t=ba(e.s,r),n=ba(e.t,r),i=ei(t,n),o=ln(t,n);return o<Wr?0:Math.max(0,1-2*ln(i,ei(e.s,e.t))/o)}function Cm(r,e){return Math.min(wa(r,e),wa(e,r))}function Am(r,e){return km(r,e)*Em(r,e)*Sm(r,e)*Cm(r,e)}function $m(r,e){const t=r.map(()=>[]);for(let n=0;n<r.length;n++)for(let i=n+1;i<r.length;i++)Am(r[n],r[i])>=e&&(t[n].push(i),t[i].push(n));return t}function Dm(r,e,t={}){const n={...xm,...t},i=new Map(r.map(h=>[h.id,{x:h.x,y:h.y}])),o=new Map,a=[];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 C=ln(g,y);C<Wr||a.push({id:h.id,s:{...g},t:{...y},len:C})}if(a.length<2)return o;const s=a.map(h=>[{...h.s},{...h.t}]),c=$m(a,n.compatibilityThreshold);let l=1,d=n.stepSize,f=n.iterations;for(let h=0;h<s.length;h++)s[h]=ya(s[h],l);for(let h=0;h<n.cycles;h++){const g=Math.max(1,Math.round(f));for(let y=0;y<g;y++){const C=a.map((b,m)=>Im(m,s,c,a[m].len,l,d,n.stiffness));for(let b=0;b<a.length;b++)for(let m=1;m<=l;m++)s[b][m].x+=C[b][m].x,s[b][m].y+=C[b][m].y}d*=.5,l*=n.subdivisionRate,f*=n.iterationRate;for(let y=0;y<s.length;y++)s[y]=ya(s[y],l)}for(let h=0;h<a.length;h++)o.set(a[h].id,s[h].map(g=>({x:g.x,y:g.y})));return o}function Im(r,e,t,n,i,o,a){const s=a/(n*(i+1)),c=e[r],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=s*(f.x-2*h.x+g.x),C=s*(f.y-2*h.y+g.y);for(const b of t[r]){const m=e[b][d],A=m.x-h.x,v=m.y-h.y;if(Math.abs(A)>Wr||Math.abs(v)>Wr){const p=Math.hypot(A,v);y+=A/p,C+=v/p}}l.push({x:o*y,y:o*C})}return l.push({x:0,y:0}),l}function Lm(r){if(r.length<3)return 0;const e=r[0],t=r[r.length-1],n=t.x-e.x,i=t.y-e.y,o=Math.hypot(n,i);if(o<Wr)return 0;let a=0;for(let c=1;c<r.length-1;c++){const l=r[c].x-e.x,d=r[c].y-e.y,f=(l*-i+d*n)/o;Math.abs(f)>Math.abs(a)&&(a=f)}const s=2*a/o;return Math.max(-1,Math.min(1,s))}const No="__cluster__:";function _a(r){return`${No}${r}`}function qc(r){return r.startsWith(No)}function Tm(r){if(!qc(r))return null;const e=Number(r.slice(No.length));return Number.isFinite(e)?e:null}function Yc(r,e){const t=new Map;for(const n of r){const i=e.get(n.id);if(!i)continue;const o=t.get(i.community);o?o.push(n.id):t.set(i.community,[n.id])}return t}const xa=(r,e,t)=>({nodes:r,edges:e,layout:t,supernodes:new Map,collapsedMembers:new Map});function Gm(r,e,t,n){if(n.size===0)return xa(r,e,t);const i=Yc(r,t),o=new Set;for(const g of n){const y=i.get(g);y&&y.length>0&&o.add(g)}if(o.size===0)return xa(r,e,t);const a=new Map,s=new Map,c=[],l=new Map;for(const g of r){const y=t.get(g.id);if(y&&o.has(y.community)){a.set(g.id,_a(y.community));continue}c.push(g),y&&l.set(g.id,y)}for(const g of o){const y=i.get(g),C=_a(g);let b=0,m=0,A=0;for(const v of y){const p=t.get(v);p&&(b+=p.x,m+=p.y,A+=1)}s.set(C,{community:g,memberIds:y,size:y.length}),c.push({id:C,label:`cluster ${g} · ${y.length}`,data:{node_type:"cluster",__supernode:!0,__community:g,__memberCount:y.length}}),l.set(C,{x:A?b/A:50,y:A?m/A:50,community:g})}const d=g=>a.get(g)??g,f=[],h=new Map;for(const g of e){const y=d(g.source),C=d(g.target);if(!(y!==g.source||C!==g.target)){f.push(g);continue}if(y===C)continue;const m=`${y} ${C}`,A=h.get(m);A?(A.weight+=1,A.members.push(g.id)):h.set(m,{source:y,target:C,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:s,collapsedMembers:a}}const Xc={name:"table-2",size:24,node:[["path",{d:"M3 9h18"}],["path",{d:"M9 3v18"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}]]};Xc.node;function Rm(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return Xc}}))}const Jc={name:"info",size:24,node:[["circle",{cx:"12",cy:"12",r:"10"}],["path",{d:"M12 16v-4"}],["path",{d:"M12 8h.01"}]]};Jc.node;function Om(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return Jc}}))}const Zc={name:"maximize-2",size:24,node:[["path",{d:"M15 3h6v6"}],["path",{d:"m21 3-7 7"}],["path",{d:"m3 21 7-7"}],["path",{d:"M9 21H3v-6"}]]};Zc.node;function zm(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return Zc}}))}const Qc={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4"}],["path",{d:"m6 8-4 4 4 4"}],["path",{d:"m14.5 4-5 16"}]],aliases:["code-2"]};Qc.node;function Mm(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return Qc}}))}const el={name:"route",size:24,node:[["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"}]]};el.node;function Nm(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return el}}))}const tl={name:"zoom-in",size:24,node:[["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"}]]};tl.node;function Pm(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return tl}}))}const rl={name:"zoom-out",size:24,node:[["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"}]]};rl.node;function Um(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return rl}}))}const nl={name:"group",size:24,node:[["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"}]]};nl.node;function ka(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return nl}}))}const il={name:"spline",size:24,node:[["circle",{cx:"19",cy:"5",r:"2"}],["circle",{cx:"5",cy:"19",r:"2"}],["path",{d:"M5 17A12 12 0 0 1 17 5"}]]};il.node;function Wm(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return il}}))}const ol={name:"boxes",size:24,node:[["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"}]]};ol.node;function Ea(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return ol}}))}var jm=he('<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>'),Bm=he('<button type="button" class="text-fg-3 hover:text-fg-1 cursor-pointer svelte-gt9p7f" aria-label="Clear filter"><!></button>'),Fm=he('<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),Vm=he('<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>'),Km=he('<span class="text-warn svelte-gt9p7f"> </span>'),Hm=he('<button type="button"><!> </button>'),qm=he('<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),Ym=he('<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>'),Xm=he('<span class="text-primary-text svelte-gt9p7f"> </span>'),Jm=he('<span class="text-warn svelte-gt9p7f" title="More nodes match — raise the limit or narrow the filter to see them"> </span>'),Zm=he('<span class="text-fg-2 svelte-gt9p7f"> </span>'),Qm=he('<div class="mt-1.5 text-warn svelte-gt9p7f"> </div>'),ev=he('<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-primary text-on-primary cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed hover:bg-primary-active svelte-gt9p7f"><!> run <span class="text-[9px] opacity-70 svelte-gt9p7f">⌘↵</span></button></div></div> <!></div>'),tv=he('<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>'),rv=At('<rect rx="6" stroke-width="1.5" class="svelte-gt9p7f"></rect>'),nv=At('<line stroke="var(--color-line-3)" stroke-width="1" stroke-dasharray="4 3" opacity="0.7" class="svelte-gt9p7f"></line>'),iv=At('<svg class="pointer-events-none absolute inset-0 h-full w-full svelte-gt9p7f" aria-hidden="true"><!><!></svg>'),ov=he('<div class="sigma-canvas absolute inset-0 h-full w-full bg-bg-0 svelte-gt9p7f" role="application" tabindex="0"></div> <!>',1),sv=At('<rect rx="1.5" stroke-width="0.18" vector-effect="non-scaling-stroke" class="svelte-gt9p7f"></rect>'),av=At('<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>'),cv=At('<g class="pointer-events-none svelte-gt9p7f"><!><!></g>'),lv=At('<polyline fill="none" stroke-linejoin="round" class="text-line-3 cursor-pointer hover:text-primary-text svelte-gt9p7f" vector-effect="non-scaling-stroke" role="button" tabindex="0"><title class="svelte-gt9p7f"> </title></polyline>'),uv=At('<line class="text-line-3 cursor-pointer hover:text-primary-text svelte-gt9p7f" vector-effect="non-scaling-stroke" role="button" tabindex="0"><title class="svelte-gt9p7f"> </title></line>'),dv=At('<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>'),fv=At("<!><!>",1),hv=At('<circle fill="none" stroke="var(--color-warn)" vector-effect="non-scaling-stroke" class="pointer-events-none svelte-gt9p7f"></circle>'),pv=At('<text font-family="JetBrains Mono Variable, monospace" paint-order="stroke" stroke="#020617" class="pointer-events-none select-none svelte-gt9p7f"> </text>'),gv=At('<!><circle vector-effect="non-scaling-stroke" role="button" tabindex="0"><title class="svelte-gt9p7f"> </title></circle><!>',1),mv=he('<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>'),vv=he('<span class="ml-2 text-warn svelte-gt9p7f">orphan</span>'),yv=he('<tr><td class="px-2 py-1 text-fg-3 svelte-gt9p7f">node</td><td class="px-2 py-1 text-primary-text 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>'),bv=he('<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>'),wv=he('<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>'),_v=he('<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>'),xv=he(`<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>`),kv=he('<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>'),Ev=he('<div class="flex flex-wrap gap-1 svelte-gt9p7f"></div>'),Sv=he('<div class="text-fg-3 svelte-gt9p7f">No exports recorded.</div>'),Cv=he('<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>'),Av=he('<div class="space-y-1 svelte-gt9p7f"></div>'),$v=he('<div class="text-fg-3 svelte-gt9p7f">No inbound uses.</div>'),Dv=he('<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>'),Iv=he('<div class="rounded border border-line-1 px-2 py-1 text-fg-3 svelte-gt9p7f">none</div>'),Lv=he('<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>'),Tv=he('<div class="rounded border border-line-1 px-2 py-1 text-fg-3 svelte-gt9p7f">none</div>'),Gv=he('<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-primary-text 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),Rv=he('<code class="svelte-gt9p7f"> </code>'),Ov=he('<code class="svelte-gt9p7f"> </code>'),zv=he('<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),Mv=he('<pre class="whitespace-pre-wrap text-[11px] svelte-gt9p7f"> </pre>'),Nv=he('<dt class="text-fg-3 truncate svelte-gt9p7f"> </dt> <dd class="text-fg-1 break-words svelte-gt9p7f"><!></dd>',1),Pv=he('<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>'),Uv=he('<button type="button"><span class="svelte-gt9p7f">●</span> <span class="svelte-gt9p7f"> </span> <span class="text-fg-3 svelte-gt9p7f"> </span></button>'),Wv=he('<span class="text-fg-3 svelte-gt9p7f">types:</span> <!>',1),jv=he('<span class="svelte-gt9p7f"><span class="text-fg-2 svelte-gt9p7f"> </span> <span class="text-fg-3 svelte-gt9p7f">·</span> </span>'),Bv=he('<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),Fv=he('<div class="flex h-full flex-col text-fg-1 svelte-gt9p7f"><!></div>');function ay(r,e){ri(e,!0);let t=Ee(null);const n=Q(()=>u(t)??e.result),i=Q(()=>tm(u(n))),o=Q(()=>Jg(u(i).nodes,u(i).edges)),a=Q(()=>Qg(u(i).nodes,u(o))),s=Q(()=>new Set(u(i).nodes.filter(k=>Bc(k,u(o))).map(k=>k.id)));let c=Ee("canvas"),l=Ee(25e3),d=Ee(""),f=Ee(null),h=Ee(null),g=Ee(null),y=Ee(350),C=Ee(1),b=Ee(!1),m=Ee(!1),A=Ee(Kt(new Set));const v=Q(()=>u(f)?Xg(u(f),u(i).nodes,u(i).edges,u(o)):null);Zt(()=>{e.subpage==="svg"&&u(c)!=="svg"?N(c,"svg"):e.subpage==="graph"&&u(c)!=="canvas"&&N(c,"canvas")});let p=Ee(null),E=Ee(null),S=Ee(!1),$=Ee(""),x=Ee(!1),D=Ee(null),I=Ee(""),j=Ee("");async function O(k){const U=Zn.client;if(!(!U||!k.trim())){N(x,!0),N(D,null);try{const F=await lr.track(`${e.collection??"graph"} · query (${k.slice(0,40).replace(/\s+/g," ")}…)`,()=>U.query(k));if(!F.ok){N(D,F.error??"query failed",!0);return}N(t,F,!0),N(f,null),N(h,null),tt()}catch(F){N(D,F.message,!0)}finally{N(x,!1)}}}function w(){N(t,null),N($,""),N(D,null),N(f,null),N(h,null),tt()}function ge(){u(f)&&(N($,`GRAPH NEIGHBORHOOD '${u(f).label}' DEPTH 1`),N(S,!0),O(u($)))}function ce(){N($,"GRAPH CENTRALITY LIMIT 50"),N(S,!0),O(u($))}function L(k){u(f)&&(k==="from"?N(I,u(f).label,!0):N(j,u(f).label,!0),N(S,!0))}function _(){!u(I).trim()||!u(j).trim()||(N($,`GRAPH SHORTEST_PATH '${u(I).trim()}' TO '${u(j).trim()}'`),N(S,!0),O(u($)))}const K=Q(()=>{const k=new Map;for(const U of u(i).nodes){const F=String(U.data.node_type??"node");k.set(F,(k.get(F)??0)+1)}return[...k.entries()].sort((U,F)=>F[1]-U[1])});let ee=Ee(Kt(new Set));const M=Q(()=>{const k=u(d).trim().toLowerCase();return u(i).nodes.filter(U=>{const F=String(U.data.node_type??"node");return u(ee).has(F)?!1:k?U.label.toLowerCase().includes(k)||U.id.toLowerCase().includes(k):!0}).sort((U,F)=>Zg(U,F,u(o)))}),Re=Q(()=>Math.min(u(M).length,u(l))),ae=Q(()=>u(M).slice(0,Math.min(u(Re),u(y)))),W=Q(()=>new Set(u(ae).map(k=>k.id))),Se=Q(()=>u(i).edges.filter(k=>u(W).has(k.source)&&u(W).has(k.target))),Ce=Q(()=>u(ae).length<u(Re)),be=Q(()=>u(M).length>u(l));Zt(()=>{const k=u(Re),U=u(c)==="canvas"?1e3:350,F=Math.min(k,U);if(N(y,F,!0),F>=k)return;let Oe=!1,Ke=0,vt=F;const rt=()=>{Oe||(vt=Math.min(k,vt+U),N(y,vt,!0),vt<k&&(Ke=requestAnimationFrame(rt)))};return Ke=requestAnimationFrame(rt),()=>{Oe=!0,cancelAnimationFrame(Ke)}});function Ye(k){const U=new Set(u(ee));U.has(k)?U.delete(k):U.add(k),N(ee,U,!0)}const ot=fm,Ae=hm;let ve=Ee(void 0),X=null,me=null,et=Ee(1),J=Ee(0),ne=0,G=Ee(0),It=Ee(Kt([])),Rt=Ee(Kt([]));function Ot(k,U){const F=X;return F?F.graphToViewport({x:k,y:-U}):null}function Ht(){if(!u(b)||!X||u(c)!=="canvas"){u(It).length&&N(It,[],!0),u(Rt).length&&N(Rt,[],!0);return}const k=[];for(const F of u(Cn)){const Oe=Ot(F.minX,F.minY),Ke=Ot(F.maxX,F.maxY);!Oe||!Ke||k.push({...F,vx:Math.min(Oe.x,Ke.x),vy:Math.min(Oe.y,Ke.y),vw:Math.abs(Ke.x-Oe.x),vh:Math.abs(Ke.y-Oe.y)})}const U=[];for(const F of u(An)){const Oe=Ot(F.x1,F.y1),Ke=Ot(F.x2,F.y2);!Oe||!Ke||U.push({id:F.id,vx1:Oe.x,vy1:Oe.y,vx2:Ke.x,vy2:Ke.y})}N(It,k,!0),N(Rt,U,!0)}function $t(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}gu(()=>{cancelAnimationFrame(ne),X&&(X.kill(),X=null)}),mu(()=>{const k=new MutationObserver(()=>{N(G,u(G)+1)});return k.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","data-color-scheme"]}),()=>k.disconnect()});function _t(){N(f,null),N(h,null)}function tt(){N(p,null),N(E,null)}function Pt(k){return u(i).nodes.find(U=>U.id===k)??null}function nr(k){const U=Pt(k.nodeId);U&&(ir(U),gr(U))}function gr(k){N(h,null),N(f,k,!0)}function ir(k){N(E,k.id,!0),N(p,k.id,!0)}function Er(k){if(u(E)){tt(),_t();return}ir(k),gr(k)}function Lt(k){N(f,null),N(h,k,!0)}function Sr(k){return["id","rid","label","name","title","description","summary","content","exports","orphan","is_orphan","isOrphan","dead_code","deadCode"].includes(k)}function or(k,U){k.key!=="Enter"&&k.key!==" "||(k.preventDefault(),U())}function Po(k){return Math.max(.5,Math.min(8,k))}const ll=Q(()=>u(c)==="canvas"?Math.round(100/(u(et)||1)):Math.round(u(C)*100));function Uo(k){if(u(c)==="canvas"){const F=X==null?void 0:X.getCamera();if(!F)return;k==="in"?F.animatedZoom(1.4):F.animatedUnzoom(1.4);return}const U=k==="in"?1.25:.8;N(C,Po(u(C)*U),!0)}function ul(){if(u(c)==="canvas"){X==null||X.getCamera().animatedReset();return}N(C,1)}function dl(k){k.preventDefault();const U=k.deltaY<0?1.25:.8;N(C,Po(u(C)*U),!0)}const Wo=Q(()=>{const k=new Map;for(const U of u(i).edges)U.label&&k.set(U.label,(k.get(U.label)??0)+1);return[...k.entries()].sort((U,F)=>F[1]-U[1]).slice(0,4)}),Cr=Q(()=>im(u(ae),u(Se))),fl=Q(()=>(u(G),typeof document>"u"?!0:document.documentElement.dataset.colorScheme!=="light")),Cn=Q(()=>u(b)?gm(u(ae),u(Cr),{dark:u(fl)}):[]),An=Q(()=>u(b)?mm(u(Se),u(Cr),u(Cn)):[]),hl=Q(()=>new Set(u(An).map(k=>k.id))),pl=Q(()=>u(m)&&u(Se).length>ro);function gl(k){return k>800?{cycles:4,iterations:45}:k>300?{cycles:5,iterations:55}:{}}const ci=Q(()=>{if(!u(m)||u(c)==="table"||u(Se).length===0||u(Se).length>ro)return null;const k=u(ae).map(U=>{const F=u(Cr).get(U.id);return{id:U.id,x:(F==null?void 0:F.x)??50,y:(F==null?void 0:F.y)??50}});return Dm(k,u(Se).map(U=>({id:U.id,source:U.source,target:U.target})),gl(u(Se).length))}),li=Q(()=>{if(!u(ci))return null;const k=new Map;for(const[U,F]of u(ci))k.set(U,-Lm(F));return k}),$n=Q(()=>Gm(u(ae),u(Se),u(Cr),u(A))),ui=Q(()=>u($n).nodes),Dn=Q(()=>u($n).edges),di=Q(()=>u($n).layout),fi=Q(()=>{const k=Yc(u(ae),u(Cr));return new Map([...k].map(([U,F])=>[U,F.length]))}),hi=Q(()=>[...u(fi)].filter(([,k])=>k>=2).map(([k])=>k)),Ar=Q(()=>u(A).size>0);function ml(k){const U=new Set(u(A));U.add(k),N(A,U,!0),tt()}function vl(k){const U=new Set(u(A));U.delete(k),N(A,U,!0),tt()}function yl(){N(A,u(Ar)?new Set:new Set(u(hi)),!0),tt(),_t()}const Vr=Q(()=>{var k;return u(f)?((k=u(Cr).get(u(f).id))==null?void 0:k.community)??null:null});Zt(()=>{u(f)&&u($n).collapsedMembers.has(u(f).id)&&_t()});const jo=Q(()=>u(ui).map(k=>{const U=String(k.data.node_type??"node"),F=u(a).get(k.id)??1,Oe=u(di).get(k.id),Ke=k.data.__supernode===!0,vt=typeof k.data.__memberCount=="number"?k.data.__memberCount:0,rt=Oe?Mo(Oe.community):Qn(U);return{...k,x:(Oe==null?void 0:Oe.x)??50,y:(Oe==null?void 0:Oe.y)??50,r:Ke?Kc(vt):Fc(U,F),color:rt}})),pi=Q(()=>new Map(u(jo).map(k=>[k.id,k]))),gi=Q(()=>{var U;const k=[];for(const F of u(Dn)){const Oe=u(pi).get(F.source),Ke=u(pi).get(F.target);if(!Oe||!Ke)continue;const vt=(U=u(ci))==null?void 0:U.get(F.id);let rt,jt=(Oe.x+Ke.x)/2,Ut=(Oe.y+Ke.y)/2;if(vt&&vt.length>2){rt=vt.map(Hr=>`${Hr.x},${Hr.y}`).join(" ");const Ln=vt[Math.floor(vt.length/2)];jt=Ln.x,Ut=Ln.y}k.push({...F,x1:Oe.x,y1:Oe.y,x2:Ke.x,y2:Ke.y,points:rt,mx:jt,my:Ut})}return k}),Fe=Q(()=>u(E)??u(p)),In=Q(()=>{const k=new Set;if(!u(Fe))return k;for(const U of u(gi))(U.source===u(Fe)||U.target===u(Fe))&&k.add(U.id);return k}),sr=Q(()=>{const k=new Set;if(!u(Fe))return k;k.add(u(Fe));for(const U of u(gi))U.source===u(Fe)&&k.add(U.target),U.target===u(Fe)&&k.add(U.source);return k});Zt(()=>{const k=u(Fe);if(!k){N(J,0);return}if(!u(pi).has(k)){tt();return}bl()});function bl(){if(cancelAnimationFrame(ne),$t()){N(J,0);return}const k=performance.now();N(J,1);const U=()=>{const F=Math.max(0,1-(performance.now()-k)/170);N(J,F,!0),F>0&&(ne=requestAnimationFrame(U))};ne=requestAnimationFrame(U)}const wl=Q(()=>`translate(50 50) scale(${u(C)}) translate(-50 -50)`);function Kr(k,U){return getComputedStyle(document.documentElement).getPropertyValue(k).trim()||U}function Bo(){const k=document.documentElement.dataset.colorScheme!=="light";return{background:Kr("--color-bg-0",k?"#050607":"#ffffff"),edge:Kr("--color-line-3",k?"#3a424d":"#c9cbd1"),focusEdge:ot,focusNodeStroke:Ae,selectedNodeStroke:k?"#0a0a0b":"#18181b",nodeStroke:k?"#ffffff":"#27272a",warn:Kr("--color-warn",k?"#fbbf24":"#b45309")}}function Fo(){var k;return{focusId:u(Fe),focus:{nodes:u(sr),edges:u(In)},selectedNodeId:((k=u(f))==null?void 0:k.id)??null,pulse:u(J),colors:Bo(),groupInBox:u(b),bundle:u(m)&&u(li)!==null}}function Vo(){return pm({nodes:u(ui),edges:u(Dn),layout:u(di),sizeScales:u(a),orphanIds:u(s),dark:document.documentElement.dataset.colorScheme!=="light",edgeColor:Bo().edge,bundledCurvatures:u(li)??void 0})}function _l(k){return u(Dn).find(U=>U.id===k)??null}function mi(k){if(qc(k)){const F=Tm(k);F!==null&&vl(F);return}const U=Pt(k);U&&Er(U)}function xl(k){k.on("clickNode",({node:F})=>{mi(F)}),k.on("enterNode",({node:F})=>{u(E)||N(p,F,!0),u(ve)&&(u(ve).style.cursor="pointer")}),k.on("leaveNode",()=>{u(E)||N(p,null),u(ve)&&(u(ve).style.cursor="")}),k.on("clickEdge",({edge:F})=>{const Oe=_l(F);Oe&&(tt(),Lt(Oe))}),k.on("clickStage",()=>{tt(),_t()});const U=k.getCamera();U.on("updated",()=>{N(et,U.ratio,!0)}),k.on("afterRender",()=>Ht())}Zt(()=>{if(u(c)!=="canvas")return;const k=u(ve);if(!k)return;let U=!1,F=null;return(async()=>{try{if(!me){const[rt,jt,Ut]=await Promise.all([fr(()=>import("./kA3Jql_0.js"),__vite__mapDeps([3,4]),import.meta.url),fr(()=>import("./CXNPJgv1.js"),__vite__mapDeps([5,4]),import.meta.url),fr(()=>import("./CDKIdLnm.js"),__vite__mapDeps([6,4]),import.meta.url)]);me={Sigma:rt.default,NodeBorderProgram:jt.NodeBorderProgram,EdgeCurveProgram:Ut.default}}if(U||!u(ve))return;const{Sigma:Oe,NodeBorderProgram:Ke,EdgeCurveProgram:vt}=me;F=new Oe(Vo(),k,{allowInvalidContainer:!0,defaultNodeType:"border",nodeProgramClasses:{border:Ke},edgeProgramClasses:{curved:vt},defaultEdgeType:"line",renderEdgeLabels:!0,labelFont:'"JetBrains Mono Variable", monospace',edgeLabelFont:'"JetBrains Mono Variable", monospace',labelSize:12,edgeLabelSize:10,labelWeight:"700",labelColor:{color:Kr("--color-fg-0","#ffffff")},edgeLabelColor:{color:"#f6d36b"},labelRenderedSizeThreshold:1/0,zIndex:!0,nodeReducer:(rt,jt)=>wm(rt,jt,Fo()),edgeReducer:(rt,jt)=>_m(rt,jt,Fo())}),xl(F),X=F,N(et,F.getCamera().ratio,!0),N(g,null)}catch(Oe){N(g,Oe.message,!0)}})(),()=>{U=!0,F&&F.kill(),X===F&&(X=null)}}),Zt(()=>{u(ui),u(Dn),u(di),u(a),u(s),u(G),u(li),u(m);const k=X;!k||u(c)!=="canvas"||(k.setSetting("labelColor",{color:Kr("--color-fg-0","#ffffff")}),k.setGraph(Vo()),k.refresh())}),Zt(()=>{u(Fe),u(sr),u(In),u(f),u(J);const k=X;!k||u(c)!=="canvas"||k.refresh({skipIndexation:!0})}),Zt(()=>{u(b),u(Cn),u(An);const k=X;!k||u(c)!=="canvas"||(k.refresh({skipIndexation:!0}),Ht())});function kl(k){u(E)||N(p,k.id,!0)}function El(k){!u(E)&&u(p)===k.id&&N(p,null)}function vi(k){return u(Fe)?u(Fe)===k.id?k.r*2.24:u(sr).has(k.id)?k.r*1.6:k.r*.92:k.r*1.14}function Sl(k){return u(Fe)?u(sr).has(k.id)?1:.12:1}function Cl(k){return k.data.__supernode===!0?!0:u(Fe)?u(Fe)===k.id?!0:u(sr).size<=36&&u(sr).has(k.id):!1}function Al(k){return!!(u(Fe)&&u(In).has(k.id)&&k.label)}var yi=Fv(),$l=R(yi);{var Dl=k=>{var U=jm();V(k,U)},Il=k=>{var U=Bv(),F=lt(U),Oe=R(F),Ke=R(Oe),vt=R(Ke);Us(vt,{class:"size-3"}),Bt(),T(Ke);var rt=P(Ke,2),jt=R(rt);Us(jt,{class:"size-3"}),Bt(),T(rt);var Ut=P(rt,2),Ln=R(Ut);Rm(Ln,{class:"size-3"}),Bt(),T(Ut),T(Oe);var Hr=P(Oe,2);{var Ll=te=>{var ie=Fm(),oe=lt(ie),ze=R(oe);wp(ze,{class:"size-3 text-fg-3"});var $e=P(ze,2);$i($e);var Ue=P($e,2);{var De=He=>{var Qe=Bm(),Tt=R(Qe);xs(Tt,{class:"size-3"}),T(Qe),Ne("click",Qe,()=>N(d,"")),V(He,Qe)};ke(Ue,He=>{u(d)&&He(De)})}T(oe);var Pe=P(oe,2),we=R(Pe);zm(we,{class:"size-3"});var z=P(we,4),se=R(z);se.value=se.__value=500;var re=P(se);re.value=re.__value=1e3;var Ie=P(re);Ie.value=Ie.__value=2e3;var le=P(Ie);le.value=le.__value=5e3;var ye=P(le);ye.value=ye.__value=1e4;var de=P(ye);de.value=de.__value=25e3;var We=P(de);We.value=We.__value=5e4,T(z);var Xe;Xu(z),T(Pe),pe(()=>{Xe!==(Xe=u(l))&&(z.value=(z.__value=u(l))??"",Ju(z,u(l)))}),Gn($e,()=>u(d),He=>N(d,He)),Ne("change",z,He=>N(l,Number(He.currentTarget.value),!0)),V(te,ie)};ke(Hr,te=>{u(c)!=="table"&&te(Ll)})}var Ko=P(Hr,2);{var Tl=te=>{var ie=Vm(),oe=R(ie),ze=R(oe);Um(ze,{class:"size-3.5"}),T(oe);var $e=P(oe,2),Ue=R($e);T($e);var De=P($e,2),Pe=R(De);Pm(Pe,{class:"size-3.5"}),T(De),T(ie),pe(()=>{oe.disabled=u(c)==="svg"&&u(C)<=.5,fe(Ue,`${u(ll)??""}%`),De.disabled=u(c)==="svg"&&u(C)>=8}),Ne("click",oe,()=>Uo("out")),Ne("click",$e,ul),Ne("click",De,()=>Uo("in")),V(te,ie)};ke(Ko,te=>{u(c)!=="table"&&te(Tl)})}var Ho=P(Ko,2);{var Gl=te=>{var ie=qm(),oe=lt(ie),ze=R(oe);ka(ze,{class:"size-3"}),Bt(),T(oe);var $e=P(oe,2),Ue=R($e);Wm(Ue,{class:"size-3"}),Bt(),T($e);var De=P($e,2);{var Pe=se=>{var re=Km(),Ie=R(re);T(re),pe((le,ye)=>{H(re,"title",le),fe(Ie,`bundling skipped (${ye??""} edges)`)},[()=>`Bundling is skipped above ${ro.toLocaleString()} drawn edges — narrow the filter or lower the limit`,()=>u(Se).length.toLocaleString()]),V(se,re)};ke(De,se=>{u(pl)&&se(Pe)})}var we=P(De,2);{var z=se=>{var re=Hm(),Ie=R(re);{var le=We=>{ka(We,{class:"size-3"})},ye=We=>{Ea(We,{class:"size-3"})};ke(Ie,We=>{u(Ar)?We(le):We(ye,-1)})}var de=P(Ie);T(re),pe(We=>{Et(re,1,We,"svelte-gt9p7f"),H(re,"aria-pressed",u(Ar)),H(re,"title",u(Ar)?"Expand all collapsed clusters back to their members":"Collapse each community into a single supernode"),fe(de,` ${u(Ar)?`expand (${u(A).size})`:`collapse ${u(hi).length} clusters`}`)},[()=>Dt(["inline-flex items-center gap-1 h-6 px-2 rounded border cursor-pointer transition-colors",u(Ar)?"border-accent/40 bg-accent/10 text-primary-text":"border-line-1 text-fg-3 hover:text-fg-1 hover:border-line-2"].join(" "))]),Ne("click",re,yl),V(se,re)};ke(we,se=>{u(hi).length>0&&se(z)})}pe((se,re)=>{Et(oe,1,se,"svelte-gt9p7f"),H(oe,"aria-pressed",u(b)),Et($e,1,re,"svelte-gt9p7f"),H($e,"aria-pressed",u(m))},[()=>Dt(["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-primary-text":"border-line-1 text-fg-3 hover:text-fg-1 hover:border-line-2"].join(" ")),()=>Dt(["inline-flex items-center gap-1 h-6 px-2 rounded border cursor-pointer transition-colors",u(m)?"border-accent/40 bg-accent/10 text-primary-text":"border-line-1 text-fg-3 hover:text-fg-1 hover:border-line-2"].join(" "))]),Ne("click",oe,()=>N(b,!u(b))),Ne("click",$e,()=>N(m,!u(m))),V(te,ie)};ke(Ho,te=>{u(c)!=="table"&&te(Gl)})}var $r=P(Ho,2),Rl=R($r);Mm(Rl,{class:"size-3"}),Bt(),T($r);var qo=P($r,2);{var Ol=te=>{var ie=Ym(),oe=R(ie);xp(oe,{class:"size-3"}),Bt(),T(ie),Ne("click",ie,w),V(te,ie)};ke(qo,te=>{u(t)&&te(Ol)})}var Yo=P(qo,2),bi=R(Yo),zl=R(bi);T(bi);var Xo=P(bi,2);{var Ml=te=>{var ie=Xm(),oe=R(ie);T(ie),pe((ze,$e)=>fe(oe,`rendering ${ze??""} / ${$e??""}`),[()=>u(ae).length.toLocaleString(),()=>u(Re).toLocaleString()]),V(te,ie)};ke(Xo,te=>{u(c)!=="table"&&u(Ce)&&te(Ml)})}var Jo=P(Xo,2);{var Nl=te=>{var ie=Jm(),oe=R(ie);T(ie),pe(ze=>fe(oe,`drawing ${ze??""}`),[()=>u(ae).length.toLocaleString()]),V(te,ie)};ke(Jo,te=>{u(c)!=="table"&&u(be)&&te(Nl)})}var Pl=P(Jo,2);{var Ul=te=>{var ie=Zm(),oe=R(ie,!0);T(ie),pe(()=>fe(oe,e.collection)),V(te,ie)};ke(Pl,te=>{e.collection&&te(Ul)})}T(Yo),T(F);var Zo=P(F,2);{var Wl=te=>{var ie=ev(),oe=R(ie),ze=P(R(oe),2),$e=P(ze,2),Ue=P($e,2),De=R(Ue);Nm(De,{class:"size-3"}),Bt(),T(Ue),T(oe);var Pe=P(oe,2),we=R(Pe);$i(we);var z=P(we,2);$i(z);var se=P(z,2),re=P(se,2);T(Pe);var Ie=P(Pe,2),le=R(Ie);Ku(le);var ye=P(le,2),de=R(ye),We=R(de);{var Xe=Be=>{bp(Be,{class:"size-3 animate-spin"})},He=Be=>{_p(Be,{class:"size-3"})};ke(We,Be=>{u(x)?Be(Xe):Be(He,-1)})}Bt(2),T(de),T(ye),T(Ie);var Qe=P(Ie,2);{var Tt=Be=>{var je=Qm(),Le=R(je,!0);T(je),pe(()=>fe(Le,u(D))),V(Be,je)};ke(Qe,Be=>{u(D)&&Be(Tt)})}T(ie),pe((Be,je)=>{ze.disabled=!u(f),H(ze,"title",u(f)?`neighborhood of ${u(f).label}`:"select a node first"),Ue.disabled=Be,se.disabled=!u(f),H(se,"title",u(f)?`Use ${u(f).label} as source`:"select a node first"),re.disabled=!u(f),H(re,"title",u(f)?`Use ${u(f).label} as target`:"select a node first"),H(le,"placeholder",e.collection?`GRAPH NEIGHBORHOOD '<label>' DEPTH 2
|
|
34
|
+
GRAPH SHORTEST_PATH '<from>' TO '<to>'
|
|
35
|
+
MATCH (n)-[r]->(m) RETURN n, r, m LIMIT 100`:"GRAPH NEIGHBORHOOD … / GRAPH SHORTEST_PATH … / MATCH …"),de.disabled=je},[()=>!u(I).trim()||!u(j).trim(),()=>u(x)||!u($).trim()]),Ne("click",ze,ge),Ne("click",$e,ce),Ne("click",Ue,_),Gn(we,()=>u(I),Be=>N(I,Be)),Gn(z,()=>u(j),Be=>N(j,Be)),Ne("click",se,()=>L("from")),Ne("click",re,()=>L("to")),Ne("keydown",le,Be=>{Be.key==="Enter"&&(Be.metaKey||Be.ctrlKey)&&(Be.preventDefault(),O(u($)))}),Gn(le,()=>u($),Be=>N($,Be)),Ne("click",de,()=>O(u($))),V(te,ie)};ke(Zo,te=>{u(S)&&te(Wl)})}var Qo=P(Zo,2);{var jl=te=>{var ie=tv(),oe=R(ie);Ws(oe,{class:"mt-0.5 size-3.5 shrink-0"});var ze=P(oe,2),$e=P(R(ze),2),Ue=R($e,!0);T($e),T(ze),T(ie),pe(()=>fe(Ue,u(g))),V(te,ie)};ke(Qo,te=>{u(g)&&te(jl)})}var wi=P(Qo,2),es=R(wi);{var Bl=te=>{var ie=ov(),oe=lt(ie);pu(oe,Ue=>N(ve,Ue),()=>u(ve));var ze=P(oe,2);{var $e=Ue=>{var De=iv(),Pe=R(De);bt(Pe,17,()=>u(It),z=>z.community,(z,se)=>{var re=rv();pe(()=>{H(re,"x",u(se).vx),H(re,"y",u(se).vy),H(re,"width",u(se).vw),H(re,"height",u(se).vh),H(re,"fill",u(se).fill),H(re,"stroke",u(se).stroke)}),V(z,re)});var we=P(Pe);bt(we,17,()=>u(Rt),z=>z.id,(z,se)=>{var re=nv();pe(()=>{H(re,"x1",u(se).vx1),H(re,"y1",u(se).vy1),H(re,"x2",u(se).vx2),H(re,"y2",u(se).vy2)}),V(z,re)}),T(De),V(Ue,De)};ke(ze,Ue=>{u(b)&&(u(It).length>0||u(Rt).length>0)&&Ue($e)})}pe(()=>H(oe,"aria-label",`${u(ae).length} graph nodes and ${u(Se).length} graph edges`)),Ne("keydown",oe,Ue=>{Ue.key==="Escape"&&(tt(),_t())}),V(te,ie)},Fl=te=>{var ie=mv(),oe=R(ie),ze=P(R(oe)),$e=R(ze);{var Ue=we=>{var z=cv(),se=R(z);bt(se,17,()=>u(Cn),Ie=>Ie.community,(Ie,le)=>{var ye=sv();pe(()=>{H(ye,"x",u(le).minX),H(ye,"y",u(le).minY),H(ye,"width",u(le).maxX-u(le).minX),H(ye,"height",u(le).maxY-u(le).minY),H(ye,"fill",u(le).fill),H(ye,"stroke",u(le).stroke)}),V(Ie,ye)});var re=P(se);bt(re,17,()=>u(An),Ie=>Ie.id,(Ie,le)=>{var ye=av();pe(()=>{H(ye,"x1",u(le).x1),H(ye,"y1",u(le).y1),H(ye,"x2",u(le).x2),H(ye,"y2",u(le).y2)}),V(Ie,ye)}),T(z),V(we,z)};ke($e,we=>{u(b)&&we(Ue)})}var De=P($e);bt(De,21,()=>u(gi),we=>we.id,(we,z)=>{var se=er(),re=lt(se);{var Ie=ye=>{const de=Q(()=>u(In).has(u(z).id));var We=fv(),Xe=lt(We);{var He=Le=>{var _e=lv(),st=R(_e),ht=R(st);T(st),T(_e),pe(()=>{H(_e,"points",u(z).points),H(_e,"stroke",u(Fe)&&u(de)?ot:"currentColor"),H(_e,"stroke-width",u(Fe)?u(de)?"0.27":"0.055":"0.105"),H(_e,"opacity",u(Fe)?u(de)?"0.98":"0.07":"0.4"),H(_e,"aria-label",`${u(z).label??"edge"} from ${u(z).source} to ${u(z).target}`),fe(ht,`${u(z).label??"edge"??""}: ${u(z).source??""} -> ${u(z).target??""}`)}),Ne("click",_e,xt=>{xt.stopPropagation(),tt(),Lt(u(z))}),Ne("keydown",_e,xt=>or(xt,()=>{tt(),Lt(u(z))})),V(Le,_e)},Qe=Le=>{var _e=uv(),st=R(_e),ht=R(st);T(st),T(_e),pe(()=>{H(_e,"x1",u(z).x1),H(_e,"y1",u(z).y1),H(_e,"x2",u(z).x2),H(_e,"y2",u(z).y2),H(_e,"stroke",u(Fe)&&u(de)?ot:"currentColor"),H(_e,"stroke-width",u(Fe)?u(de)?"0.27":"0.055":"0.105"),H(_e,"opacity",u(Fe)?u(de)?"0.98":"0.055":"0.36"),H(_e,"aria-label",`${u(z).label??"edge"} from ${u(z).source} to ${u(z).target}`),fe(ht,`${u(z).label??"edge"??""}: ${u(z).source??""} -> ${u(z).target??""}`)}),Ne("click",_e,xt=>{xt.stopPropagation(),tt(),Lt(u(z))}),Ne("keydown",_e,xt=>or(xt,()=>{tt(),Lt(u(z))})),V(Le,_e)};ke(Xe,Le=>{u(z).points?Le(He):Le(Qe,-1)})}var Tt=P(Xe);{var Be=Le=>{var _e=dv(),st=R(_e,!0);T(_e),pe(ht=>{H(_e,"x",u(z).mx+.45),H(_e,"y",u(z).my-.45),fe(st,ht)},[()=>{var ht;return(ht=u(z).label)==null?void 0:ht.slice(0,28)}]),V(Le,_e)},je=Q(()=>Al(u(z)));ke(Tt,Le=>{u(je)&&Le(Be)})}V(ye,We)},le=Q(()=>!(u(b)&&u(hl).has(u(z).id)));ke(re,ye=>{u(le)&&ye(Ie)})}V(we,se)}),T(De);var Pe=P(De);bt(Pe,21,()=>u(jo),we=>we.id,(we,z)=>{const se=Q(()=>u(s).has(u(z).id)),re=Q(()=>u(z).data.__supernode===!0);var Ie=gv(),le=lt(Ie);{var ye=je=>{var Le=hv();pe((_e,st)=>{H(Le,"cx",u(z).x),H(Le,"cy",u(z).y),H(Le,"r",_e),H(Le,"stroke-width",u(Fe)===u(z).id?"0.38":"0.24"),H(Le,"opacity",st)},[()=>vi(u(z))+.65,()=>u(Fe)&&!u(sr).has(u(z).id)?"0.16":"0.72"]),V(je,Le)};ke(le,je=>{u(se)&&je(ye)})}var de=P(le);let We;var Xe=R(de),He=R(Xe,!0);T(Xe),T(de);var Qe=P(de);{var Tt=je=>{var Le=pv(),_e=R(Le,!0);T(Le),pe((st,ht)=>{H(Le,"x",st),H(Le,"y",u(z).y+.15),H(Le,"fill",u(Fe)===u(z).id?"#f8fafc":"#cbd5e1"),H(Le,"opacity",u(Fe)===u(z).id?"1":"0.9"),H(Le,"font-size",u(Fe)===u(z).id?"1.35":"1.15"),H(Le,"font-weight",u(Fe)===u(z).id?"700":"600"),H(Le,"stroke-width",u(Fe)===u(z).id?"0.48":"0.38"),fe(_e,ht)},[()=>u(z).x+vi(u(z))+.85,()=>u(z).label.slice(0,36)]),V(je,Le)},Be=Q(()=>Cl(u(z)));ke(Qe,je=>{u(Be)&&je(Tt)})}pe((je,Le,_e)=>{var st;H(de,"cx",u(z).x),H(de,"cy",u(z).y),H(de,"r",je),H(de,"fill",u(z).color),H(de,"opacity",Le),H(de,"stroke",u(Fe)===u(z).id?Ae:u(re)?"#e2e8f0":((st=u(f))==null?void 0:st.id)===u(z).id?"#0a0a0b":u(se)?"var(--color-warn)":"#ffffff"),H(de,"stroke-width",_e),We=Et(de,0,"cursor-pointer graph-node svelte-gt9p7f",null,We,{"focus-primary":u(Fe)===u(z).id}),H(de,"aria-label",u(re)?`${u(z).label} — click to expand`:u(z).label),fe(He,u(re)?`${u(z).label} — click to expand`:u(z).label)},[()=>vi(u(z)),()=>Sl(u(z)),()=>{var je;return u(Fe)===u(z).id?"0.55":u(re)?"0.5":u(sr).has(u(z).id)?"0.22":((je=u(f))==null?void 0:je.id)===u(z).id||u(se)?"0.4":"0.14"}]),Ci("pointerenter",de,()=>kl(u(z))),Ci("pointerleave",de,()=>El(u(z))),Ne("click",de,je=>{je.stopPropagation(),mi(u(z).id)}),Ne("keydown",de,je=>or(je,()=>mi(u(z).id))),V(we,Ie)}),T(Pe),T(ze),T(oe),T(ie),pe(()=>{H(oe,"aria-label",`${u(ae).length} graph nodes and ${u(Se).length} graph edges`),H(ze,"transform",u(wl))}),Ci("wheel",oe,dl),Ne("click",oe,()=>{tt(),_t()}),Ne("keydown",oe,we=>{we.key==="Escape"&&(tt(),_t())}),V(te,ie)},Vl=te=>{var ie=wv(),oe=R(ie),ze=P(R(oe)),$e=R(ze);bt($e,17,()=>u(i).nodes,De=>De.id,(De,Pe)=>{const we=Q(()=>u(s).has(u(Pe).id));var z=yv(),se=P(R(z)),re=R(se,!0);T(se);var Ie=P(se),le=R(Ie,!0);T(Ie);var ye=P(Ie),de=R(ye),We=P(de);{var Xe=He=>{var Qe=vv();V(He,Qe)};ke(We,He=>{u(we)&&He(Xe)})}T(ye),T(z),pe((He,Qe)=>{Et(z,1,He,"svelte-gt9p7f"),fe(re,u(Pe).id),fe(le,u(Pe).label),fe(de,`${Qe??""} `)},[()=>Dt(["border-b border-line-1/60 hover:bg-bg-1/40 cursor-pointer",u(we)?"bg-warn/10":""].join(" ")),()=>String(u(Pe).data.node_type??"")]),Ne("click",z,()=>{N(h,null),N(f,u(Pe),!0)}),V(De,z)});var Ue=P($e);bt(Ue,17,()=>u(i).edges,De=>De.id,(De,Pe)=>{var we=bv(),z=P(R(we)),se=R(z,!0);T(z);var re=P(z),Ie=R(re,!0);T(re);var le=P(re),ye=R(le);T(le),T(we),pe(()=>{fe(se,u(Pe).id),fe(Ie,u(Pe).label??""),fe(ye,`${u(Pe).source??""} → ${u(Pe).target??""}`)}),Ne("click",we,()=>{N(f,null),N(h,u(Pe),!0)}),V(De,we)}),T(ze),T(oe),T(ie),V(te,ie)};ke(es,te=>{u(c)==="canvas"?te(Bl):u(c)==="svg"?te(Fl,1):te(Vl,-1)})}var Kl=P(es,2);{var Hl=te=>{var ie=Pv(),oe=R(ie),ze=R(oe);Om(ze,{class:"size-3.5 text-primary-text"});var $e=P(ze,2),Ue=R($e,!0);T($e);var De=P($e,4),Pe=R(De);xs(Pe,{class:"size-3.5"}),T(De),T(oe);var we=P(oe,2),z=R(we);{var se=le=>{var ye=Gv(),de=lt(ye),We=R(de),Xe=R(We),He=P(R(Xe),2),Qe=R(He,!0);T(He),T(Xe);var Tt=P(Xe,2);{var Be=Me=>{var Ve=_v(),yt=R(Ve);Ws(yt,{class:"size-3"}),Bt(),T(Ve),V(Me,Ve)};ke(Tt,Me=>{u(v).orphan&&Me(Be)})}T(We);var je=P(We,2),Le=R(je,!0);T(je);var _e=P(je,2);{var st=Me=>{var Ve=xv(),yt=R(Ve);Ea(yt,{class:"size-3"});var gt=P(yt);T(Ve),pe(ft=>fe(gt,` collapse cluster ${u(Vr)??""} · ${ft??""} nodes`),[()=>u(fi).get(u(Vr))]),Ne("click",Ve,()=>ml(u(Vr))),V(Me,Ve)},ht=Q(()=>u(Vr)!==null&&(u(fi).get(u(Vr))??0)>=2);ke(_e,Me=>{u(ht)&&Me(st)})}T(de);var xt=P(de,2),Dr=P(R(xt),2),pt=R(Dr,!0);T(Dr),T(xt);var Je=P(xt,2),dt=R(Je),Ir=P(R(dt),2),_i=R(Ir,!0);T(Ir),T(dt);var Jl=P(dt,2);{var Zl=Me=>{var Ve=Ev();bt(Ve,21,()=>u(v).exports,Vn,(yt,gt)=>{var ft=kv(),kt=R(ft,!0);T(ft),pe(()=>fe(kt,u(gt))),V(yt,ft)}),T(Ve),V(Me,Ve)},Ql=Me=>{var Ve=Sv();V(Me,Ve)};ke(Jl,Me=>{u(v).exports.length>0?Me(Zl):Me(Ql,-1)})}T(Je);var xi=P(Je,2),ki=R(xi),ns=P(R(ki),2),eu=R(ns);T(ns),T(ki);var tu=P(ki,2);{var ru=Me=>{var Ve=Av();bt(Ve,21,()=>u(v).whereUsed,yt=>yt.id,(yt,gt)=>{var ft=Cv(),kt=R(ft),qt=R(kt,!0);T(kt);var Lr=P(kt,2),Yt=R(Lr),qr=R(Yt,!0);T(Yt);var as=P(Yt,2),uu=R(as,!0);T(as),T(Lr),T(ft),pe(()=>{fe(qt,u(gt).label),fe(qr,u(gt).nodeLabel),fe(uu,u(gt).edgeLabel??u(gt).kind)}),Ne("click",ft,()=>nr(u(gt))),V(yt,ft)}),T(Ve),V(Me,Ve)},nu=Me=>{var Ve=$v();V(Me,Ve)};ke(tu,Me=>{u(v).whereUsed.length>0?Me(ru):Me(nu,-1)})}T(xi);var is=P(xi,2),os=P(R(is),2),Ei=R(os),iu=R(Ei);{var ou=Me=>{var Ve=er(),yt=lt(Ve);bt(yt,17,()=>u(v).incoming,gt=>gt.id,(gt,ft)=>{var kt=Dv(),qt=R(kt),Lr=R(qt,!0);T(qt);var Yt=P(qt,2),qr=R(Yt,!0);T(Yt),T(kt),pe(()=>{fe(Lr,u(ft).label),fe(qr,u(ft).nodeLabel)}),Ne("click",kt,()=>nr(u(ft))),V(gt,kt)}),V(Me,Ve)},su=Me=>{var Ve=Iv();V(Me,Ve)};ke(iu,Me=>{u(v).incoming.length>0?Me(ou):Me(su,-1)})}T(Ei);var ss=P(Ei,2),au=R(ss);{var cu=Me=>{var Ve=er(),yt=lt(Ve);bt(yt,17,()=>u(v).outgoing,gt=>gt.id,(gt,ft)=>{var kt=Lv(),qt=R(kt),Lr=R(qt,!0);T(qt);var Yt=P(qt,2),qr=R(Yt,!0);T(Yt),T(kt),pe(()=>{fe(Lr,u(ft).label),fe(qr,u(ft).nodeLabel)}),Ne("click",kt,()=>nr(u(ft))),V(gt,kt)}),V(Me,Ve)},lu=Me=>{var Ve=Tv();V(Me,Ve)};ke(au,Me=>{u(v).outgoing.length>0?Me(cu):Me(lu,-1)})}T(ss),T(os),T(is),pe((Me,Ve,yt)=>{fe(Qe,u(f).label),fe(Le,Me),fe(pt,u(v).description??"No description in graph contract."),fe(_i,Ve),fe(eu,`${yt??""} inbound`)},[()=>String(u(f).data.rid??u(f).id),()=>u(v).exports.length.toLocaleString(),()=>u(v).whereUsed.length.toLocaleString()]),V(le,ye)},re=le=>{var ye=zv(),de=lt(ye),We=P(R(de),2),Xe=R(We,!0);T(We),T(de);var He=P(de,2),Qe=P(R(He),2),Tt=R(Qe);{var Be=pt=>{var Je=Ai();pe(dt=>fe(Je,dt),[()=>Pt(u(h).source).label]),V(pt,Je)},je=Q(()=>Pt(u(h).source)),Le=pt=>{var Je=Rv(),dt=R(Je,!0);T(Je),pe(()=>fe(dt,u(h).source)),V(pt,Je)};ke(Tt,pt=>{u(je)?pt(Be):pt(Le,-1)})}T(Qe);var _e=P(Qe,4),st=R(_e);{var ht=pt=>{var Je=Ai();pe(dt=>fe(Je,dt),[()=>Pt(u(h).target).label]),V(pt,Je)},xt=Q(()=>Pt(u(h).target)),Dr=pt=>{var Je=Ov(),dt=R(Je,!0);T(Je),pe(()=>fe(dt,u(h).target)),V(pt,Je)};ke(st,pt=>{u(xt)?pt(ht):pt(Dr,-1)})}T(_e),T(He),pe(()=>fe(Xe,u(h).label??"(unlabelled)")),V(le,ye)};ke(z,le=>{u(f)&&u(v)?le(se):u(h)&&le(re,1)})}var Ie=P(z,4);bt(Ie,21,()=>{var le;return Object.entries((u(f)?u(f).data:(le=u(h))==null?void 0:le.data)??{})},Vn,(le,ye)=>{var de=Q(()=>an(u(ye),2));let We=()=>u(de)[0],Xe=()=>u(de)[1];var He=er(),Qe=lt(He);{var Tt=je=>{var Le=Nv(),_e=lt(Le),st=R(_e,!0);T(_e);var ht=P(_e,2),xt=R(ht);{var Dr=Je=>{var dt=Mv(),Ir=R(dt,!0);T(dt),pe(_i=>fe(Ir,_i),[()=>JSON.stringify(Xe(),null,2)]),V(Je,dt)},pt=Je=>{var dt=Ai();pe(Ir=>fe(dt,Ir),[()=>String(Xe())]),V(Je,dt)};ke(xt,Je=>{typeof Xe()=="object"?Je(Dr):Je(pt,-1)})}T(ht),pe(()=>fe(st,We())),V(je,Le)},Be=Q(()=>Xe()!==null&&Xe()!==void 0&&!(u(f)&&Sr(We()))&&!(u(h)&&We()==="label"));ke(Qe,je=>{u(Be)&&je(Tt)})}V(le,He)}),T(Ie),T(we),T(ie),pe(()=>fe(Ue,u(f)?"Node":"Edge")),Ne("click",De,()=>{tt(),_t()}),V(te,ie)};ke(Kl,te=>{(u(f)||u(h))&&te(Hl)})}T(wi);var ts=P(wi,2),rs=R(ts);{var ql=te=>{var ie=Wv(),oe=P(lt(ie),2);bt(oe,17,()=>u(K),([ze,$e])=>ze,(ze,$e)=>{var Ue=Q(()=>an(u($e),2));let De=()=>u(Ue)[0],Pe=()=>u(Ue)[1];const we=Q(()=>u(ee).has(De()));var z=Uv(),se=R(z);let re;var Ie=P(se,2),le=R(Ie,!0);T(Ie);var ye=P(Ie,2),de=R(ye,!0);T(ye),T(z),pe((We,Xe,He)=>{H(z,"title",u(we)?`Show ${De()}`:`Hide ${De()}`),Et(z,1,We,"svelte-gt9p7f"),re=Zu(se,"",re,Xe),fe(le,De()),fe(de,He)},[()=>Dt(["inline-flex items-center gap-1 px-1.5 py-0.5 rounded border transition-colors cursor-pointer",u(we)?"border-line-1 text-fg-3 line-through opacity-60":"border-line-2 text-fg-1 hover:border-accent"].join(" ")),()=>({color:u(we)?void 0:Qn(De())}),()=>Pe().toLocaleString()]),Ne("click",z,()=>Ye(De())),V(ze,z)}),V(te,ie)};ke(rs,te=>{u(K).length>1&&te(ql)})}var Yl=P(rs,4);{var Xl=te=>{var ie=er(),oe=lt(ie);bt(oe,17,()=>u(Wo),Vn,(ze,$e)=>{var Ue=Q(()=>an(u($e),2));let De=()=>u(Ue)[0],Pe=()=>u(Ue)[1];var we=jv(),z=R(we),se=R(z,!0);T(z);var re=P(z,3);T(we),pe(Ie=>{fe(se,De()),fe(re,` ${Ie??""}`)},[()=>Pe().toLocaleString()]),V(ze,we)}),V(te,ie)};ke(Yl,te=>{u(Wo).length>0&&te(Xl)})}T(ts),pe((te,ie,oe,ze,$e,Ue,De,Pe,we)=>{H(Ke,"href",te),Et(Ke,1,ie,"svelte-gt9p7f"),H(Ke,"aria-current",u(c)==="canvas"?"page":void 0),H(rt,"href",oe),Et(rt,1,ze,"svelte-gt9p7f"),H(rt,"aria-current",u(c)==="svg"?"page":void 0),H(Ut,"href",$e),Et(Ut,1,Ue,"svelte-gt9p7f"),H(Ut,"aria-current",u(c)==="table"?"page":void 0),Et($r,1,De,"svelte-gt9p7f"),H($r,"aria-pressed",u(S)),fe(zl,`${Pe??""} nodes · ${we??""} edges`)},[()=>e.collection?Pi(e.collection,"graph"):void 0,()=>Dt(["inline-flex items-center gap-1 px-2 py-1 text-[11px] cursor-pointer transition-colors",u(c)==="canvas"?"bg-primary text-on-primary":"bg-bg-1 text-fg-2 hover:text-fg-0"].join(" ")),()=>e.collection?Pi(e.collection,"svg"):void 0,()=>Dt(["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-primary text-on-primary":"bg-bg-1 text-fg-2 hover:text-fg-0"].join(" ")),()=>e.collection?Pi(e.collection,"table"):void 0,()=>Dt(["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-primary text-on-primary":"bg-bg-1 text-fg-2 hover:text-fg-0"].join(" ")),()=>Dt(["inline-flex items-center gap-1 h-6 px-2 rounded border cursor-pointer transition-colors",u(S)?"border-accent/40 bg-accent/10 text-primary-text":"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()]),Ne("click",Ke,()=>{e.collection||N(c,"canvas")}),Ne("click",rt,()=>{e.collection||N(c,"svg")}),Ne("click",Ut,()=>{e.collection||N(c,"table")}),Ne("click",$r,()=>N(S,!u(S))),V(k,U)};ke($l,k=>{u(i).nodes.length===0&&u(i).edges.length===0?k(Dl):k(Il,-1)})}T(yi),V(r,yi),ni()}Yu(["click","change","keydown"]);const sl={name:"layers",size:24,node:[["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"}]],aliases:["layers-3"]};sl.node;function cy(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return sl}}))}function ly(r,e){ep(r,{get title(){return e.title},get description(){return e.message},get hint(){return e.hint},get actions(){return e.actions},media:n=>{var i=er(),o=lt(i);{var a=s=>{Vh(s,{get icon(){return e.icon},size:"lg"})};ke(o,s=>{e.icon&&s(a)})}V(n,i)},$$slots:{media:!0}})}const al={name:"file-braces",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5"}],["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"}]],aliases:["file-json"]};al.node;function uy(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return al}}))}const cl={name:"link-2",size:24,node:[["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"}]]};cl.node;function dy(r,e){let t=Ze(e,["$$slots","$$events","$$legacy"]);at(r,it(()=>t,{get icon(){return cl}}))}export{cn as A,ry as B,so as C,oy as D,ly as E,uy as F,ay as G,Wh as H,at as I,yp as J,cy as L,Us as N,fc as P,bo as R,wp as S,Rm as T,xs as X,Vh as a,Om as b,dy as c,bp as d,_p as e,xp as f,Ws as g,lr as h,Pi as i,Mo as j,Zn as k,iy as l,Tr as m,bt as n,rd as o,Ep as p,Qv as q,$o as r,sy as s,Vn as t,Xr as u,on as v,ny as w,ty as x,ai as y,ey as z};
|