@reddb-io/ui 0.3.2 → 0.3.4
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/assets/0.BR-GggVq.css +1 -0
- package/build/_app/immutable/chunks/BspmDMQv.js +404 -0
- package/build/_app/immutable/chunks/{Bgb6fHGb.js → CAWnp6XP.js} +1 -1
- package/build/_app/immutable/chunks/{B-yl15ta.js → C_WxkIDp.js} +1 -1
- package/build/_app/immutable/chunks/CgQYykwo.js +1164 -0
- package/build/_app/immutable/chunks/D4Buwe3n.js +1 -0
- package/build/_app/immutable/chunks/{C7kf23SQ.js → DpZOD-db.js} +1 -1
- package/build/_app/immutable/entry/{app.BeX4Tmu5.js → app.A4vKpDuk.js} +2 -2
- package/build/_app/immutable/entry/start.CPPUYn3g.js +1 -0
- package/build/_app/immutable/nodes/{0.C0e5KQVb.js → 0.CNfy1rZt.js} +2 -2
- package/build/_app/immutable/nodes/{1.ceiVuZbB.js → 1.DyKCxpV1.js} +1 -1
- package/build/_app/immutable/nodes/{10.DeFqKRR2.js → 10.tDyQ2Z5A.js} +2 -2
- package/build/_app/immutable/nodes/15.CZWDD8kn.js +60 -0
- package/build/_app/version.json +1 -1
- package/build/index.html +11 -11
- package/dist/embed/{AnalyticsView-SKyGxeAx.js → AnalyticsView-b7oALOd5.js} +2 -2
- package/dist/embed/{AnalyticsView-SKyGxeAx.js.map → AnalyticsView-b7oALOd5.js.map} +1 -1
- package/dist/embed/RedUiEmbedRoot-Bngci7ez.js +35616 -0
- package/dist/embed/RedUiEmbedRoot-Bngci7ez.js.map +1 -0
- package/dist/embed/index-C0FJgu3h.js +881 -0
- package/dist/embed/index-C0FJgu3h.js.map +1 -0
- package/dist/embed/index.js +1 -1
- package/dist/embed/{sigma.esm-BawyGZ3s.js → sigma.esm-CvtUChKS.js} +2 -2
- package/dist/embed/{sigma.esm-BawyGZ3s.js.map → sigma.esm-CvtUChKS.js.map} +1 -1
- package/package.json +3 -3
- package/src/app.css +5 -0
- package/src/lib/ConnectDropdown.svelte +36 -7
- package/src/lib/Workspace.svelte +6 -2
- package/src/lib/connections.svelte.ts +31 -0
- package/src/lib/reddb/client.ts +59 -3
- package/build/_app/immutable/assets/0.BWZTMKZW.css +0 -1
- package/build/_app/immutable/chunks/CO7K4bD2.js +0 -1164
- package/build/_app/immutable/chunks/CP65IkJc.js +0 -1
- package/build/_app/immutable/chunks/CxnvJShw.js +0 -404
- package/build/_app/immutable/entry/start.D7y1MZex.js +0 -1
- package/build/_app/immutable/nodes/15.CRDBqbiH.js +0 -60
- package/dist/embed/RedUiEmbedRoot-BzVzGAFK.js +0 -31960
- package/dist/embed/RedUiEmbedRoot-BzVzGAFK.js.map +0 -1
- package/dist/embed/index-BY6fc1oQ.js +0 -856
- package/dist/embed/index-BY6fc1oQ.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var ee=t=>{throw TypeError(t)};var De=(t,e,n)=>e.has(t)||ee("Cannot "+n);var y=(t,e,n)=>(De(t,e,"read from private field"),n?n.call(t):e.get(t)),A=(t,e,n)=>e.has(t)?ee("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n);import{bR as qt,bz as T,at as I,bm as P,bH as _t,bt as Ve}from"./CGFL56WJ.js";import{a as ne}from"./Btd6PFkC.js";class Bt{constructor(e,n){this.status=e,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${e}`}}toString(){return JSON.stringify(this.body)}}class Kt{constructor(e,n){try{new Headers({location:n})}catch{throw new Error(`Invalid redirect location ${JSON.stringify(n)}: this string contains characters that cannot be used in HTTP headers`)}this.status=e,this.location=n}}class Mt extends Error{constructor(e,n,r){super(r),this.status=e,this.text=n}}new URL("sveltekit-internal://");function qe(t,e){return t==="/"||e==="ignore"?t:e==="never"?t.endsWith("/")?t.slice(0,-1):t:e==="always"&&!t.endsWith("/")?t+"/":t}function Be(t){return t.split("%25").map(decodeURI).join("%25")}function Ke(t){for(const e in t)t[e]=decodeURIComponent(t[e]);return t}function Pt({href:t}){return t.split("#")[0]}function C(){}function Me(...t){let e=5381;for(const n of t)if(typeof n=="string"){let r=n.length;for(;r;)e=e*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)e=e*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(e>>>0).toString(36)}new TextEncoder;function He(t){const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}const Fe=window.fetch;window.fetch=(t,e)=>((t instanceof Request?t.method:(e==null?void 0:e.method)||"GET")!=="GET"&&Y.delete(Ht(t)),Fe(t,e));const Y=new Map;function Ge(t,e){const n=Ht(t,e),r=document.querySelector(n);if(r!=null&&r.textContent){r.remove();let{body:a,...o}=JSON.parse(r.textContent);const s=r.getAttribute("data-ttl");return s&&Y.set(n,{body:a,init:o,ttl:1e3*Number(s)}),r.getAttribute("data-b64")!==null&&(a=He(a)),Promise.resolve(new Response(a,o))}return window.fetch(t,e)}function We(t,e,n){if(Y.size>0){const r=Ht(t,n),a=Y.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(n==null?void 0:n.cache))return new Response(a.body,a.init);Y.delete(r)}}return window.fetch(e,n)}function Ht(t,e){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(t instanceof Request?t.url:t)}]`;if(e!=null&&e.headers||e!=null&&e.body){const a=[];e.headers&&a.push([...new Headers(e.headers)].join(",")),e.body&&(typeof e.body=="string"||ArrayBuffer.isView(e.body))&&a.push(e.body),r+=`[data-hash="${Me(...a)}"]`}return r}const ze=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/,Je=/^\/\((?:[^)]+)\)$/;function Ye(t){const e=[];return{pattern:t==="/"||Je.test(t)?/^\/$/:new RegExp(`^${Qe(t).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return e.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const o=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(o)return e.push({name:o[1],matcher:o[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const s=r.split(/\[(.+?)\](?!\])/);return"/"+s.map((l,c)=>{if(c%2){if(l.startsWith("x+"))return jt(String.fromCharCode(parseInt(l.slice(2),16)));if(l.startsWith("u+"))return jt(String.fromCharCode(...l.slice(2).split("-").map(m=>parseInt(m,16))));const u=ze.exec(l),[,h,_,p,f]=u;return e.push({name:p,matcher:f,optional:!!h,rest:!!_,chained:_?c===1&&s[0]==="":!1}),_?"([^]*?)":h?"([^/]*)?":"([^/]+?)"}return jt(l)}).join("")}).join("")}/?$`),params:e}}function Xe(t){return t!==""&&!/^\([^)]+\)$/.test(t)}function Qe(t){return t.slice(1).split("/").filter(Xe)}function Ze(t,e,n){const r={},a=t.slice(1),o=a.filter(i=>i!==void 0);let s=0;for(let i=0;i<e.length;i+=1){const l=e[i];let c=a[i-s];if(l.chained&&l.rest&&s&&(c=a.slice(i-s,i+1).filter(u=>u).join("/"),s=0),c===void 0)if(l.rest)c="";else continue;if(!l.matcher||n[l.matcher](c)){r[l.name]=c;const u=e[i+1],h=a[i+1];u&&!u.rest&&u.optional&&h&&l.chained&&(s=0),!u&&!h&&Object.keys(r).length===o.length&&(s=0);continue}if(l.optional&&l.chained){s++;continue}return}if(!s)return r}function jt(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function tn({nodes:t,server_loads:e,dictionary:n,matchers:r}){const a=new Set(e);return Object.entries(n).map(([i,[l,c,u]])=>{const{pattern:h,params:_}=Ye(i),p={id:i,exec:f=>{const m=h.exec(f);if(m)return Ze(m,_,r)},errors:[1,...u||[]].map(f=>t[f]),layouts:[0,...c||[]].map(s),leaf:o(l)};return p.errors.length=p.layouts.length=Math.max(p.errors.length,p.layouts.length),p});function o(i){const l=i<0;return l&&(i=~i),[l,t[i]]}function s(i){return i===void 0?i:[a.has(i),t[i]]}}function me(t,e=JSON.parse){try{return e(sessionStorage[t])}catch{}}function re(t,e,n=JSON.stringify){const r=n(e);try{sessionStorage[t]=r}catch{}}var ue;const U=((ue=globalThis.__sveltekit_11cwm0j)==null?void 0:ue.base)??"";var de;const en=((de=globalThis.__sveltekit_11cwm0j)==null?void 0:de.assets)??U??"",nn="1792060194436",_e="sveltekit:snapshot",we="sveltekit:scroll",ve="sveltekit:states",rn="sveltekit:pageurl",H="sveltekit:history",Q="sveltekit:navigation",q={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},Lt=location.origin;function Ft(t){if(t instanceof URL)return t;let e=document.baseURI;if(!e){const n=document.getElementsByTagName("base");e=n.length?n[0].href:document.URL}return new URL(t,e)}function B(){return{x:pageXOffset,y:pageYOffset}}function M(t,e){return t.getAttribute(`data-sveltekit-${e}`)}const ae={...q,"":q.hover};function ye(t){let e=t.assignedSlot??t.parentNode;return(e==null?void 0:e.nodeType)===11&&(e=e.host),e}function be(t,e){for(;t&&t!==e;){if(t.nodeName.toUpperCase()==="A"&&t.hasAttribute("href"))return t;t=ye(t)}}function Ct(t,e,n){let r;try{if(r=new URL(t instanceof SVGAElement?t.href.baseVal:t.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const i=location.hash.split("#")[1]||"/";r.hash=`#${i}${r.hash}`}}catch{}const a=t instanceof SVGAElement?t.target.baseVal:t.target,o=!r||!!a||Ut(r,e,n)||(t.getAttribute("rel")||"").split(/\s+/).includes("external"),s=(r==null?void 0:r.origin)===Lt&&t.hasAttribute("download");return{url:r,external:o,target:a,download:s}}function wt(t){let e=null,n=null,r=null,a=null,o=null,s=null,i=t;for(;i&&i!==document.documentElement;)r===null&&(r=M(i,"preload-code")),a===null&&(a=M(i,"preload-data")),e===null&&(e=M(i,"keepfocus")),n===null&&(n=M(i,"noscroll")),o===null&&(o=M(i,"reload")),s===null&&(s=M(i,"replacestate")),i=ye(i);function l(c){switch(c){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:ae[r??"off"],preload_data:ae[a??"off"],keepfocus:l(e),noscroll:l(n),reload:l(o),replace_state:l(s)}}function oe(t){const e=qt(t);let n=!0;function r(){n=!0,e.update(s=>s)}function a(s){n=!1,e.set(s)}function o(s){let i;return e.subscribe(l=>{(i===void 0||n&&l!==i)&&s(i=l)})}return{notify:r,set:a,subscribe:o}}const ke={v:C};function an(){const{set:t,subscribe:e}=qt(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${en}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const s=(await a.json()).version!==nn;return s&&(t(!0),ke.v(),clearTimeout(n)),s}catch{return!1}}return{subscribe:e,check:r}}function Ut(t,e,n){return t.origin!==Lt||!t.pathname.startsWith(e)?!0:n?t.pathname!==location.pathname:!1}function Pn(t){}const Ee=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...Ee];const on=new Set([...Ee]);[...on];function sn(t){return t.filter(e=>e!=null)}function gt(t,e){return t+"/"+e}function Gt(t){return t instanceof Bt||t instanceof Mt?t.status:500}function ln(t){return t instanceof Mt?t.text:"Internal Error"}let x,Z,Ot;const cn=ne.toString().includes("$$")||/function \w+\(\) \{\}/.test(ne.toString()),se="a:";var at,ot,st,it,lt,ct,ft,ut,he,dt,pe,ht,ge;cn?(x={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL(se)},Z={current:null},Ot={current:!1}):(x=new(he=class{constructor(){A(this,at,T({}));A(this,ot,T(null));A(this,st,T(null));A(this,it,T({}));A(this,lt,T({id:null}));A(this,ct,T({}));A(this,ft,T(-1));A(this,ut,T(new URL(se)))}get data(){return I(y(this,at))}set data(e){P(y(this,at),e)}get form(){return I(y(this,ot))}set form(e){P(y(this,ot),e)}get error(){return I(y(this,st))}set error(e){P(y(this,st),e)}get params(){return I(y(this,it))}set params(e){P(y(this,it),e)}get route(){return I(y(this,lt))}set route(e){P(y(this,lt),e)}get state(){return I(y(this,ct))}set state(e){P(y(this,ct),e)}get status(){return I(y(this,ft))}set status(e){P(y(this,ft),e)}get url(){return I(y(this,ut))}set url(e){P(y(this,ut),e)}},at=new WeakMap,ot=new WeakMap,st=new WeakMap,it=new WeakMap,lt=new WeakMap,ct=new WeakMap,ft=new WeakMap,ut=new WeakMap,he),Z=new(pe=class{constructor(){A(this,dt,T(null))}get current(){return I(y(this,dt))}set current(e){P(y(this,dt),e)}},dt=new WeakMap,pe),Ot=new(ge=class{constructor(){A(this,ht,T(!1))}get current(){return I(y(this,ht))}set current(e){P(y(this,ht),e)}},ht=new WeakMap,ge),ke.v=()=>Ot.current=!0);function Se(t){Object.assign(x,t)}const fn=new Set(["icon","shortcut icon","apple-touch-icon"]);let z=null;const D=me(we)??{},tt=me(_e)??{},N={url:oe({}),page:oe({}),navigating:qt(null),updated:an()};function Wt(t){D[t]=B()}function un(t,e){let n=t+1;for(;D[n];)delete D[n],n+=1;for(n=e+1;tt[n];)delete tt[n],n+=1}function et(t,e=!1){return e?location.replace(t.href):location.href=t.href,new Promise(C)}async function Re(){if("serviceWorker"in navigator){const t=await navigator.serviceWorker.getRegistration(U||"/");t&&await t.update()}}let zt,Nt,vt,j,Dt,E;const yt=[],bt=[];let v=null;function kt(){var t;(t=v==null?void 0:v.fork)==null||t.then(e=>e==null?void 0:e.discard()),v=null}const mt=new Map,xe=new Set,dn=new Set,X=new Set;let w={branch:[],error:null,url:null},Le=!1,Et=!1,ie=!0,nt=!1,J=!1,Ue=!1,Jt=!1,Ae,k,L,$;const St=new Set,le=new Map,ce=new Map;async function Cn(t,e,n){var o,s,i,l;globalThis.__sveltekit_11cwm0j&&(globalThis.__sveltekit_11cwm0j.query,globalThis.__sveltekit_11cwm0j.prerender),document.URL!==location.href&&(location.href=location.href),E=t,await((s=(o=t.hooks).init)==null?void 0:s.call(o)),zt=tn(t),j=document.documentElement,Dt=e,Nt=t.nodes[0],vt=t.nodes[1],Nt(),vt(),k=(i=history.state)==null?void 0:i[H],L=(l=history.state)==null?void 0:l[Q],k||(k=L=Date.now(),history.replaceState({...history.state,[H]:k,[Q]:L},""));const r=D[k];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await Rn(Dt,n)):(await F({type:"enter",url:Ft(E.hash?Un(new URL(location.href)):location.href),replace_state:!0}),a()),Sn()}function hn(){yt.length=0,Jt=!1}function Te(t){bt.some(e=>e==null?void 0:e.snapshot)&&(tt[t]=bt.map(e=>{var n;return(n=e==null?void 0:e.snapshot)==null?void 0:n.capture()}))}function Ie(t){var e;(e=tt[t])==null||e.forEach((n,r)=>{var a,o;(o=(a=bt[r])==null?void 0:a.snapshot)==null||o.restore(n)})}function fe(){Wt(k),re(we,D),Te(L),re(_e,tt)}async function Pe(t,e,n,r){let a,o;e.invalidateAll&&kt(),await F({type:"goto",url:Ft(t),keepfocus:e.keepFocus,noscroll:e.noScroll,replace_state:e.replaceState,state:e.state,redirect_count:n,nav_token:r,accept:()=>{if(e.invalidateAll){Jt=!0,a=new Set;for(const[s,i]of le)for(const l of i.keys())a.add(gt(s,l));o=new Set;for(const[s,i]of ce)for(const l of i.keys())o.add(gt(s,l))}e.invalidate&&e.invalidate.forEach(En)}}),e.invalidateAll&&_t().then(_t).then(()=>{for(const[s,i]of le)for(const[l,{resource:c}]of i)a!=null&&a.has(gt(s,l))&&c.refresh();for(const[s,i]of ce)for(const[l,{resource:c}]of i)o!=null&&o.has(gt(s,l))&&c.reconnect()})}async function pn(t){if(t.id!==(v==null?void 0:v.id)){kt();const e={};St.add(e),v={id:t.id,token:e,promise:Oe({...t,preload:e}).then(n=>(St.delete(e),n.type==="loaded"&&n.state.error&&kt(),n)),fork:null}}return v.promise}async function $t(t){var n;const e=(n=await At(t,!1))==null?void 0:n.route;e&&await Promise.all([...e.layouts,e.leaf].filter(Boolean).map(r=>r[1]()))}async function je(t,e,n){var a;const r={params:w.params,route:{id:((a=w.route)==null?void 0:a.id)??null},url:new URL(location.href)};if(w={...t.state,nav:r},Se(t.props.page),Ae=new E.root({target:e,props:{...t.props,stores:N,components:bt},hydrate:n,sync:!1,transformError:void 0}),await Promise.resolve(),Ie(L),n){const o={from:null,to:{...r,scroll:D[k]??B()},willUnload:!1,type:"enter",complete:Promise.resolve()};X.forEach(s=>s(o))}Et=!0}async function Rt({url:t,params:e,branch:n,errors:r,status:a,error:o,route:s,form:i}){let l="never";if(U&&(t.pathname===U||t.pathname===U+"/"))l="always";else for(const f of n)(f==null?void 0:f.slash)!==void 0&&(l=f.slash);t.pathname=qe(t.pathname,l),t.search=t.search;const c={type:"loaded",state:{url:t,params:e,branch:n,error:o,route:s},props:{constructors:sn(n).map(f=>f.node.component),page:te(x)}};i!==void 0&&(c.props.form=i);let u={},h=!x,_=0;for(let f=0;f<Math.max(n.length,w.branch.length);f+=1){const m=n[f],d=w.branch[f];(m==null?void 0:m.data)!==(d==null?void 0:d.data)&&(h=!0),m&&(u={...u,...m.data},h&&(c.props[`data_${_}`]=u),_+=1)}return(!w.url||t.href!==w.url.href||w.error!==o||i!==void 0&&i!==x.form||h)&&(c.props.page={error:o,params:e,route:{id:(s==null?void 0:s.id)??null},state:{},status:a,url:new URL(t),form:i??null,data:h?u:x.data}),c}async function Yt({loader:t,parent:e,url:n,params:r,route:a,server_data_node:o}){var c,u;let s=null;const i={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await t();return{node:l,loader:t,server:o,universal:(c=l.universal)!=null&&c.load?{type:"data",data:s,uses:i}:null,data:s??(o==null?void 0:o.data)??null,slash:((u=l.universal)==null?void 0:u.trailingSlash)??(o==null?void 0:o.slash)}}function gn(t,e,n){let r=t instanceof Request?t.url:t;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const o=Et?We(r,a.href,e):Ge(r,e);return{resolved:a,promise:o}}function mn(t,e,n,r,a,o){if(Jt)return!0;if(!a)return!1;if(a.parent&&t||a.route&&e||a.url&&n)return!0;for(const s of a.search_params)if(r.has(s))return!0;for(const s of a.params)if(o[s]!==w.params[s])return!0;for(const s of a.dependencies)if(yt.some(i=>i(new URL(s))))return!0;return!1}function Xt(t,e){return(t==null?void 0:t.type)==="data"?t:(t==null?void 0:t.type)==="skip"?e??null:null}function _n(t,e){if(!t)return new Set(e.searchParams.keys());const n=new Set([...t.searchParams.keys(),...e.searchParams.keys()]);for(const r of n){const a=t.searchParams.getAll(r),o=e.searchParams.getAll(r);a.every(s=>o.includes(s))&&o.every(s=>a.includes(s))&&n.delete(r)}return n}function wn({error:t,url:e,route:n,params:r}){return{type:"loaded",state:{error:t,url:e,route:n,params:r,branch:[]},props:{page:te(x),constructors:[]}}}async function Oe({id:t,invalidating:e,url:n,params:r,route:a,preload:o}){if((v==null?void 0:v.id)===t)return St.delete(v.token),v.promise;const{errors:s,layouts:i,leaf:l}=a,c=[...i,l];s.forEach(d=>d==null?void 0:d().catch(C)),c.forEach(d=>d==null?void 0:d[1]().catch(C));const u=w.url?t!==xt(w.url):!1,h=w.route?a.id!==w.route.id:!1,_=_n(w.url,n);let p=!1;const f=c.map(async(d,g)=>{var O;if(!d)return;const b=w.branch[g];return d[1]===(b==null?void 0:b.loader)&&!mn(p,h,u,_,(O=b.universal)==null?void 0:O.uses,r)?b:(p=!0,Yt({loader:d[1],url:n,params:r,route:a,parent:async()=>{var pt;const V={};for(let K=0;K<g;K+=1)Object.assign(V,(pt=await f[K])==null?void 0:pt.data);return V},server_data_node:Xt(d[0]?{type:"skip"}:null,d[0]?b==null?void 0:b.server:void 0)}))});for(const d of f)d.catch(C);const m=[];for(let d=0;d<c.length;d+=1)if(c[d])try{m.push(await f[d])}catch(g){if(g instanceof Kt)return{type:"redirect",location:g.location};if(St.has(o))return wn({error:await rt(g,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let b=Gt(g),R;if(g instanceof Bt)R=g.body;else{if(await N.updated.check())return await Re(),await et(n);R=await rt(g,{params:r,url:n,route:{id:a.id}})}const O=await vn(d,m,s);return O?Rt({url:n,params:r,branch:m.slice(0,O.idx).concat(O.node),errors:s,status:b,error:R,route:a}):await Ce(n,{id:a.id},R,b)}else m.push(void 0);return Rt({url:n,params:r,branch:m,errors:s,status:200,error:null,route:a,form:e?void 0:null})}async function vn(t,e,n){for(;t--;)if(n[t]){let r=t;for(;!e[r];)r-=1;try{return{idx:r+1,node:{node:await n[t](),loader:n[t],data:{},server:null,universal:null}}}catch{continue}}}async function Qt({status:t,error:e,url:n,route:r}){const a={};let o=null;try{const s=await Yt({loader:Nt,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:Xt(o)}),i={node:await vt(),loader:vt,universal:null,server:null,data:null};return Rt({url:n,params:a,branch:[s,i],status:t,error:e,errors:[],route:null})}catch(s){if(s instanceof Kt)return Pe(new URL(s.location,location.href),{},0);throw s}}async function yn(t){const e=t.href;if(mt.has(e))return mt.get(e);let n;try{const r=(async()=>{let a=await E.hooks.reroute({url:new URL(t),fetch:async(o,s)=>gn(o,s,t).promise})??t;if(typeof a=="string"){const o=new URL(t);E.hash?o.hash=a:o.pathname=a,a=o}return a})();mt.set(e,r),n=await r}catch{mt.delete(e);return}return n}async function At(t,e){if(t&&!Ut(t,U,E.hash)){const n=await yn(t);if(!n)return;const r=bn(n);for(const a of zt){const o=a.exec(r);if(o)return{id:xt(t),invalidating:e,route:a,params:Ke(o),url:t}}}}function bn(t){return Be(E.hash?t.hash.replace(/^#/,"").replace(/[?#].+/,""):t.pathname.slice(U.length))||"/"}function xt(t){return(E.hash?t.hash.replace(/^#/,""):t.pathname)+t.search}function $e({url:t,type:e,intent:n,delta:r,event:a,scroll:o}){let s=!1;const i=Zt(w,n,t,e,o??null);r!==void 0&&(i.navigation.delta=r),a!==void 0&&(i.navigation.event=a);const l={...i.navigation,cancel:()=>{s=!0,i.reject(new Error("navigation cancelled"))}};return nt||xe.forEach(c=>c(l)),s?null:i}async function F({type:t,url:e,popped:n,keepfocus:r,noscroll:a,replace_state:o,state:s={},redirect_count:i=0,nav_token:l={},accept:c=C,block:u=C,event:h}){var K;const _=$;$=l;const p=await At(e,!1),f=t==="enter"?Zt(w,p,e,t):$e({url:e,type:t,delta:n==null?void 0:n.delta,intent:p,scroll:n==null?void 0:n.scroll,event:h});if(!f){u(),$===l&&($=_);return}const m=k,d=L;c(),nt=!0,Et&&f.navigation.type!=="enter"&&N.navigating.set(Z.current=f.navigation);let g=p&&await Oe(p);if(!g){if(Ut(e,U,E.hash))return await et(e,o);g=await Ce(e,{id:null},await rt(new Mt(404,"Not Found",`Not found: ${e.pathname}`),{url:e,params:{},route:{id:null}}),404,o)}if(e=(p==null?void 0:p.url)||e,$!==l)return f.reject(new Error("navigation aborted")),!1;if(g.type==="redirect"){if(i<20){await F({type:t,url:new URL(g.location,e),popped:n,keepfocus:r,noscroll:a,replace_state:o,state:s,redirect_count:i+1,nav_token:l}),f.fulfil(void 0);return}g=await Qt({status:500,error:await rt(new Error("Redirect loop"),{url:e,params:{},route:{id:null}}),url:e,route:{id:null}})}else g.props.page.status>=400&&await N.updated.check()&&(await Re(),await et(e,o));if(hn(),Wt(m),Te(d),g.props.page.url.pathname!==e.pathname&&(e.pathname=g.props.page.url.pathname),s=n?n.state:s,!n){const S=o?0:1,G={[H]:k+=S,[Q]:L+=S,[ve]:s};(o?history.replaceState:history.pushState).call(history,G,"",e),o||un(k,L)}const b=p&&(v==null?void 0:v.id)===p.id?v.fork:null;v!=null&&v.fork&&!b&&kt(),v=null,g.props.page.state=s;let R;if(Et){const S=(await Promise.all(Array.from(dn,W=>W(f.navigation)))).filter(W=>typeof W=="function");if(S.length>0){let W=function(){S.forEach(It=>{X.delete(It)})};S.push(W),S.forEach(It=>{X.add(It)})}const G=f.navigation.to;w={...g.state,nav:{params:G.params,route:G.route,url:G.url}},g.props.page&&(g.props.page.url=e);const Tt=b&&await b;Tt?R=Tt.commit():(z=null,Ae.$set(g.props),z&&Object.assign(g.props.page,z),Se(g.props.page),R=(K=Ve)==null?void 0:K()),Ue=!0}else await je(g,Dt,!1);const{activeElement:O}=document;if(await R,await _t(),await _t(),$!==l)return f.reject(new Error("navigation aborted")),!1;g.props.page&&z&&Object.assign(g.props.page,z);let V=null;if(ie){const S=n?n.scroll:a?B():null;S?scrollTo(S.x,S.y):(V=e.hash&&document.getElementById(Ne(e)))?V.scrollIntoView():scrollTo(0,0)}const pt=document.activeElement!==O&&document.activeElement!==document.body;!r&&!pt&&Ln(e,!V),ie=!0,nt=!1,t==="popstate"&&Ie(L),f.fulfil(void 0),f.navigation.to&&(f.navigation.to.scroll=B()),X.forEach(S=>S(f.navigation)),N.navigating.set(Z.current=null)}async function Ce(t,e,n,r,a){return t.origin===Lt&&t.pathname===location.pathname&&!Le?await Qt({status:r,error:n,url:t,route:e}):await et(t,a)}function kn(){let t,e={element:void 0,href:void 0},n;j.addEventListener("mousemove",i=>{const l=i.target;clearTimeout(t),t=setTimeout(()=>{o(l,q.hover)},20)});function r(i){i.defaultPrevented||o(i.composedPath()[0],q.tap)}j.addEventListener("mousedown",r),j.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(i=>{for(const l of i)l.isIntersecting&&($t(new URL(l.target.href)),a.unobserve(l.target))},{threshold:0});async function o(i,l){const c=be(i,j),u=c===e.element&&(c==null?void 0:c.href)===e.href&&l>=n;if(!c||u)return;const{url:h,external:_,download:p}=Ct(c,U,E.hash);if(_||p)return;const f=wt(c),m=h&&xt(w.url)===xt(h);if(!(f.reload||m))if(l<=f.preload_data){e={element:c,href:c.href},n=q.tap;const d=await At(h,!1);if(!d)return;pn(d)}else l<=f.preload_code&&(e={element:c,href:c.href},n=l,$t(h))}function s(){a.disconnect();for(const i of j.querySelectorAll("a")){const{url:l,external:c,download:u}=Ct(i,U,E.hash);if(c||u)continue;const h=wt(i);h.reload||(h.preload_code===q.viewport&&a.observe(i),h.preload_code===q.eager&&$t(l))}}X.add(s),s()}function rt(t,e){if(t instanceof Bt)return t.body;const n=Gt(t),r=ln(t);return E.hooks.handleError({error:t,event:e,status:n,message:r})??{message:r}}function Nn(t,e={}){return t=new URL(Ft(t)),t.origin!==Lt?Promise.reject(new Error("goto: invalid URL")):Pe(t,e,0)}function En(t){if(typeof t=="function")yt.push(t);else{const{href:e}=new URL(t,location.href);yt.push(n=>n.href===e)}}function Sn(){var e,n;history.scrollRestoration="manual",addEventListener("beforeunload",r=>{let a=!1;if(fe(),!nt){const o=Zt(w,void 0,null,"leave"),s={...o.navigation,cancel:()=>{a=!0,o.reject(new Error("navigation cancelled"))}};xe.forEach(i=>i(s))}a?(r.preventDefault(),r.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&fe()}),!((e=navigator.connection)!=null&&e.saveData)&&!/2g/.test((n=navigator.connection)==null?void 0:n.effectiveType)&&kn(),j.addEventListener("click",async r=>{if(r.button||r.which!==1||r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||r.defaultPrevented)return;const a=be(r.composedPath()[0],j);if(!a)return;const{url:o,external:s,target:i,download:l}=Ct(a,U,E.hash);if(!o)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const c=wt(a);if(!(a instanceof SVGAElement)&&o.protocol!==location.protocol&&!(o.protocol==="https:"||o.protocol==="http:")||l)return;const[h,_]=(E.hash?o.hash.replace(/^#/,""):o.href).split("#"),p=h===Pt(location);if(s||c.reload&&(!p||!_)){$e({url:o,type:"link",event:r})?nt=!0:r.preventDefault();return}if(_!==void 0&&p){const[,f]=w.url.href.split("#");if(f===_){if(r.preventDefault(),_===""||_==="top"&&a.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const m=a.ownerDocument.getElementById(decodeURIComponent(_));m&&(m.scrollIntoView(),m.focus())}return}if(J=!0,Wt(k),t(o),!c.replace_state)return;J=!1}r.preventDefault(),await new Promise(f=>{requestAnimationFrame(()=>{setTimeout(f,0)}),setTimeout(f,100)}),await F({type:"link",url:o,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??o.href===location.href,event:r})}),j.addEventListener("submit",r=>{if(r.defaultPrevented)return;const a=HTMLFormElement.prototype.cloneNode.call(r.target),o=r.submitter;if(((o==null?void 0:o.formTarget)||a.target)==="_blank"||((o==null?void 0:o.formMethod)||a.method)!=="get")return;const l=new URL((o==null?void 0:o.hasAttribute("formaction"))&&(o==null?void 0:o.formAction)||a.action);if(Ut(l,U,!1))return;const c=r.target,u=wt(c);if(u.reload)return;r.preventDefault(),r.stopPropagation();const h=new FormData(c,o);l.search=new URLSearchParams(h).toString(),F({type:"form",url:l,keepfocus:u.keepfocus,noscroll:u.noscroll,replace_state:u.replace_state??l.href===location.href,event:r})}),addEventListener("popstate",async r=>{var a;if(!Vt){if((a=r.state)!=null&&a[H]){const o=r.state[H];if($={},o===k)return;const s=D[o],i=r.state[ve]??{},l=new URL(r.state[rn]??location.href),c=r.state[Q],u=w.url?Pt(location)===Pt(w.url):!1;if(c===L&&(Ue||u)){i!==x.state&&(x.state=i),t(l),D[k]=B(),s&&scrollTo(s.x,s.y),k=o;return}const _=o-k;await F({type:"popstate",url:l,popped:{state:i,scroll:s,delta:_},accept:()=>{k=o,L=c},block:()=>{history.go(-_)},nav_token:$,event:r})}else if(!J){const o=new URL(location.href);t(o),E.hash&&location.reload()}}}),addEventListener("hashchange",()=>{J&&(J=!1,history.replaceState({...history.state,[H]:++k,[Q]:L},"",location.href))});for(const r of document.querySelectorAll("link"))fn.has(r.rel)&&(r.href=r.href);addEventListener("pageshow",r=>{r.persisted&&N.navigating.set(Z.current=null)});function t(r){w.url=x.url=r,N.page.set(te(x)),N.page.notify()}}async function Rn(t,{status:e=200,error:n,node_ids:r,params:a,route:o,server_route:s,data:i,form:l}){Le=!0;const c=new URL(location.href);let u;({params:a={},route:o={id:null}}=await At(c,!1)||{}),u=zt.find(({id:p})=>p===o.id);let h,_=!0;try{const p=r.map(async(m,d)=>{const g=i[d];return g!=null&&g.uses&&(g.uses=xn(g.uses)),Yt({loader:E.nodes[m],url:c,params:a,route:o,parent:async()=>{const b={};for(let R=0;R<d;R+=1)Object.assign(b,(await p[R]).data);return b},server_data_node:Xt(g)})}),f=await Promise.all(p);if(u){const m=u.layouts;for(let d=0;d<m.length;d++)m[d]||f.splice(d,0,void 0)}h=await Rt({url:c,params:a,branch:f,status:e,error:n,errors:u==null?void 0:u.errors,form:l,route:u??null})}catch(p){if(p instanceof Kt){await et(new URL(p.location,location.href));return}h=await Qt({status:Gt(p),error:await rt(p,{url:c,params:a,route:o}),url:c,route:o}),t.textContent="",_=!1}finally{}h.props.page&&(h.props.page.state={}),await je(h,t,_)}function xn(t){return{dependencies:new Set((t==null?void 0:t.dependencies)??[]),params:new Set((t==null?void 0:t.params)??[]),parent:!!(t!=null&&t.parent),route:!!(t!=null&&t.route),url:!!(t!=null&&t.url),search_params:new Set((t==null?void 0:t.search_params)??[])}}let Vt=!1;function Ln(t,e=!0){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const r=Ne(t);if(r&&document.getElementById(r)){const{x:o,y:s}=B();setTimeout(()=>{const i=history.state;Vt=!0,location.replace(new URL(`#${r}`,location.href)),history.replaceState(i,"",t),e&&scrollTo(o,s),Vt=!1})}else{const o=document.body,s=o.getAttribute("tabindex");o.tabIndex=-1,o.focus({preventScroll:!0,focusVisible:!1}),s!==null?o.setAttribute("tabindex",s):o.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const o=[];for(let s=0;s<a.rangeCount;s+=1)o.push(a.getRangeAt(s));setTimeout(()=>{if(a.rangeCount===o.length){for(let s=0;s<a.rangeCount;s+=1){const i=o[s],l=a.getRangeAt(s);if(i.commonAncestorContainer!==l.commonAncestorContainer||i.startContainer!==l.startContainer||i.endContainer!==l.endContainer||i.startOffset!==l.startOffset||i.endOffset!==l.endOffset)return}a.removeAllRanges()}})}}}function Zt(t,e,n,r,a=null){var c,u;let o,s;const i=new Promise((h,_)=>{o=h,s=_});return i.catch(C),{navigation:{from:{params:t.params,route:{id:((c=t.route)==null?void 0:c.id)??null},url:t.url,scroll:B()},to:n&&{params:(e==null?void 0:e.params)??null,route:{id:((u=e==null?void 0:e.route)==null?void 0:u.id)??null},url:n,scroll:a},willUnload:!e,type:r,complete:i},fulfil:o,reject:s}}function te(t){return{data:t.data,error:t.error,form:t.form,params:t.params,route:t.route,state:t.state,status:t.status,url:t.url}}function Un(t){const e=new URL(t);return e.hash=decodeURIComponent(t.hash),e}function Ne(t){let e;if(E.hash){const[,,n]=t.hash.split("#",3);e=n??""}else e=t.hash.slice(1);return decodeURIComponent(e)}export{N as a,U as b,Nn as g,Pn as l,x as p,Cn as s};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{h as Y,f as O,e as Z,d as j,j as Q,o as Re,p as Ne,q as Me,N as Ge,b as Ie,E as Fe,i as v,g as c,k as ne,s as ge,n as ve,l as ze,_ as Ae}from"./DqvWKbSc.js";import{n as Ue,w as He,p as Be}from"./CxnvJShw.js";var ue=(function(s){function n(){var i;return Z(this,n),i=j(this,n),i.rawEmitter=i,i}return Y(n,s),O(n)})(Ue.EventEmitter),We=He();const Oe=Be(We);var Ze=function(n){return n},_e=function(n){return n*n},Ve=function(n){return n*(2-n)},qe=function(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)},Ye=function(n){return n*n*n},je=function(n){return--n*n*n+1},Xe=function(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)},Ke={linear:Ze,quadraticIn:_e,quadraticOut:Ve,quadraticInOut:qe,cubicIn:Ye,cubicOut:je,cubicInOut:Xe},Je={easing:"quadraticInOut",duration:150};function N(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function ee(s,n,i){return s[0]=n,s[4]=typeof i=="number"?i:n,s}function fe(s,n){var i=Math.sin(n),e=Math.cos(n);return s[0]=e,s[1]=i,s[3]=-i,s[4]=e,s}function me(s,n,i){return s[6]=n,s[7]=i,s}function W(s,n){var i=s[0],e=s[1],t=s[2],a=s[3],r=s[4],o=s[5],h=s[6],d=s[7],l=s[8],u=n[0],g=n[1],f=n[2],m=n[3],p=n[4],y=n[5],E=n[6],b=n[7],x=n[8];return s[0]=u*i+g*a+f*h,s[1]=u*e+g*r+f*d,s[2]=u*t+g*o+f*l,s[3]=m*i+p*a+y*h,s[4]=m*e+p*r+y*d,s[5]=m*t+p*o+y*l,s[6]=E*i+b*a+x*h,s[7]=E*e+b*r+x*d,s[8]=E*t+b*o+x*l,s}function de(s,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,e=s[0],t=s[1],a=s[3],r=s[4],o=s[6],h=s[7],d=n.x,l=n.y;return{x:d*e+l*a+o*i,y:d*t+l*r+h*i}}function Qe(s,n){var i=s.height/s.width,e=n.height/n.width;return i<1&&e>1||i>1&&e<1?1:Math.min(Math.max(e,1/e),Math.max(1/i,i))}function X(s,n,i,e,t){var a=s.angle,r=s.ratio,o=s.x,h=s.y,d=n.width,l=n.height,u=N(),g=Math.min(d,l)-2*e,f=Qe(n,i);return t?(W(u,me(N(),o,h)),W(u,ee(N(),r)),W(u,fe(N(),a)),W(u,ee(N(),d/g/2/f,l/g/2/f))):(W(u,ee(N(),2*(g/d)*f,2*(g/l)*f)),W(u,fe(N(),-a)),W(u,ee(N(),1/r)),W(u,me(N(),-o,-h))),u}function $e(s,n,i){var e=de(s,{x:Math.cos(n.angle),y:Math.sin(n.angle)},0),t=e.x,a=e.y;return 1/Math.sqrt(Math.pow(t,2)+Math.pow(a,2))/i.width}function et(s){if(!s.order)return{x:[0,1],y:[0,1]};var n=1/0,i=-1/0,e=1/0,t=-1/0;return s.forEachNode(function(a,r){var o=r.x,h=r.y;o<n&&(n=o),o>i&&(i=o),h<e&&(e=h),h>t&&(t=h)}),{x:[n,i],y:[e,t]}}function tt(s){if(!Oe(s))throw new Error("Sigma: invalid graph instance.");s.forEachNode(function(n,i){if(!Number.isFinite(i.x)||!Number.isFinite(i.y))throw new Error("Sigma: Coordinates of node ".concat(n," are invalid. A node must have a numeric 'x' and 'y' attribute."))})}function it(s,n,i){var e=document.createElement(s);if(n)for(var t in n)e.style[t]=n[t];if(i)for(var a in i)e.setAttribute(a,i[a]);return e}function pe(){return typeof window.devicePixelRatio<"u"?window.devicePixelRatio:1}function ye(s,n,i){return i.sort(function(e,t){var a=n(e)||0,r=n(t)||0;return a<r?-1:a>r?1:0})}function be(s){var n=Q(s.x,2),i=n[0],e=n[1],t=Q(s.y,2),a=t[0],r=t[1],o=Math.max(e-i,r-a),h=(e+i)/2,d=(r+a)/2;(o===0||Math.abs(o)===1/0||isNaN(o))&&(o=1),isNaN(h)&&(h=0),isNaN(d)&&(d=0);var l=function(g){return{x:.5+(g.x-h)/o,y:.5+(g.y-d)/o}};return l.applyTo=function(u){u.x=.5+(u.x-h)/o,u.y=.5+(u.y-d)/o},l.inverse=function(u){return{x:h+o*(u.x-.5),y:d+o*(u.y-.5)}},l.ratio=o,l}function le(s){"@babel/helpers - typeof";return le=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},le(s)}function xe(s,n){var i=n.size;if(i!==0){var e=s.length;s.length+=i;var t=0;n.forEach(function(a){s[e+t]=a,t++})}}function se(s){s=s||{};for(var n=0,i=arguments.length<=1?0:arguments.length-1;n<i;n++){var e=n+1<1||arguments.length<=n+1?void 0:arguments[n+1];e&&Object.assign(s,e)}return s}var ce={hideEdgesOnMove:!1,hideLabelsOnMove:!1,renderLabels:!0,renderEdgeLabels:!1,enableEdgeEvents:!1,defaultNodeColor:"#999",defaultNodeType:"circle",defaultEdgeColor:"#ccc",defaultEdgeType:"line",labelFont:"Arial",labelSize:14,labelWeight:"normal",labelColor:{color:"#000"},edgeLabelFont:"Arial",edgeLabelSize:14,edgeLabelWeight:"normal",edgeLabelColor:{attribute:"color"},stagePadding:30,defaultDrawEdgeLabel:Me,defaultDrawNodeLabel:Ne,defaultDrawNodeHover:Re,minEdgeThickness:1.7,antiAliasingFeather:1,dragTimeout:100,draggedEventsTolerance:3,inertiaDuration:200,inertiaRatio:3,zoomDuration:250,zoomingRatio:1.7,doubleClickTimeout:300,doubleClickZoomingRatio:2.2,doubleClickZoomingDuration:200,tapMoveTolerance:10,zoomToSizeRatioFunction:Math.sqrt,itemSizesReference:"screen",autoRescale:!0,autoCenter:!0,labelDensity:1,labelGridCellSize:100,labelRenderedSizeThreshold:6,nodeReducer:null,edgeReducer:null,zIndex:!1,minCameraRatio:null,maxCameraRatio:null,enableCameraZooming:!0,enableCameraPanning:!0,enableCameraRotation:!0,cameraPanBoundaries:null,allowInvalidContainer:!1,nodeProgramClasses:{},nodeHoverProgramClasses:{},edgeProgramClasses:{}},at={circle:Ge},rt={arrow:Fe,line:Ie};function oe(s){if(typeof s.labelDensity!="number"||s.labelDensity<0)throw new Error("Settings: invalid `labelDensity`. Expecting a positive number.");var n=s.minCameraRatio,i=s.maxCameraRatio;if(typeof n=="number"&&typeof i=="number"&&i<n)throw new Error("Settings: invalid camera ratio boundaries. Expecting `maxCameraRatio` to be greater than `minCameraRatio`.")}function nt(s){var n=se({},ce,s);return n.nodeProgramClasses=se({},at,n.nodeProgramClasses),n.edgeProgramClasses=se({},rt,n.edgeProgramClasses),n}var te=1.5,Ce=(function(s){function n(){var i;return Z(this,n),i=j(this,n),c(i,"x",.5),c(i,"y",.5),c(i,"angle",0),c(i,"ratio",1),c(i,"minRatio",null),c(i,"maxRatio",null),c(i,"enabledZooming",!0),c(i,"enabledPanning",!0),c(i,"enabledRotation",!0),c(i,"clean",null),c(i,"nextFrame",null),c(i,"previousState",null),c(i,"enabled",!0),i.previousState=i.getState(),i}return Y(n,s),O(n,[{key:"enable",value:function(){return this.enabled=!0,this}},{key:"disable",value:function(){return this.enabled=!1,this}},{key:"getState",value:function(){return{x:this.x,y:this.y,angle:this.angle,ratio:this.ratio}}},{key:"hasState",value:function(e){return this.x===e.x&&this.y===e.y&&this.ratio===e.ratio&&this.angle===e.angle}},{key:"getPreviousState",value:function(){var e=this.previousState;return e?{x:e.x,y:e.y,angle:e.angle,ratio:e.ratio}:null}},{key:"getBoundedRatio",value:function(e){var t=e;return typeof this.minRatio=="number"&&(t=Math.max(t,this.minRatio)),typeof this.maxRatio=="number"&&(t=Math.min(t,this.maxRatio)),t}},{key:"validateState",value:function(e){var t={};return this.enabledPanning&&typeof e.x=="number"&&(t.x=e.x),this.enabledPanning&&typeof e.y=="number"&&(t.y=e.y),this.enabledZooming&&typeof e.ratio=="number"&&(t.ratio=this.getBoundedRatio(e.ratio)),this.enabledRotation&&typeof e.angle=="number"&&(t.angle=e.angle),this.clean?this.clean(v(v({},this.getState()),t)):t}},{key:"isAnimated",value:function(){return!!this.nextFrame}},{key:"setState",value:function(e){if(!this.enabled)return this;this.previousState=this.getState();var t=this.validateState(e);return typeof t.x=="number"&&(this.x=t.x),typeof t.y=="number"&&(this.y=t.y),typeof t.ratio=="number"&&(this.ratio=t.ratio),typeof t.angle=="number"&&(this.angle=t.angle),this.hasState(this.previousState)||this.emit("updated",this.getState()),this}},{key:"updateState",value:function(e){return this.setState(e(this.getState())),this}},{key:"animate",value:function(e){var t=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(!r)return new Promise(function(f){return t.animate(e,a,f)});if(this.enabled){var o=v(v({},Je),a),h=this.validateState(e),d=typeof o.easing=="function"?o.easing:Ke[o.easing],l=Date.now(),u=this.getState(),g=function(){var m=(Date.now()-l)/o.duration;if(m>=1){t.nextFrame=null,t.setState(h),t.animationCallback&&(t.animationCallback.call(null),t.animationCallback=void 0);return}var p=d(m),y={};typeof h.x=="number"&&(y.x=u.x+(h.x-u.x)*p),typeof h.y=="number"&&(y.y=u.y+(h.y-u.y)*p),t.enabledRotation&&typeof h.angle=="number"&&(y.angle=u.angle+(h.angle-u.angle)*p),typeof h.ratio=="number"&&(y.ratio=u.ratio+(h.ratio-u.ratio)*p),t.setState(y),t.nextFrame=requestAnimationFrame(g)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.animationCallback&&this.animationCallback.call(null),this.nextFrame=requestAnimationFrame(g)):g(),this.animationCallback=r}}},{key:"animatedZoom",value:function(e){return e?typeof e=="number"?this.animate({ratio:this.ratio/e}):this.animate({ratio:this.ratio/(e.factor||te)},e):this.animate({ratio:this.ratio/te})}},{key:"animatedUnzoom",value:function(e){return e?typeof e=="number"?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||te)},e):this.animate({ratio:this.ratio*te})}},{key:"animatedReset",value:function(e){return this.animate({x:.5,y:.5,ratio:1,angle:0},e)}},{key:"copy",value:function(){return n.from(this.getState())}}],[{key:"from",value:function(e){var t=new n;return t.setState(e)}}])})(ue);function M(s,n){var i=n.getBoundingClientRect();return{x:s.clientX-i.left,y:s.clientY-i.top}}function F(s,n){var i=v(v({},M(s,n)),{},{sigmaDefaultPrevented:!1,preventSigmaDefault:function(){i.sigmaDefaultPrevented=!0},original:s});return i}function K(s){var n="x"in s?s:v(v({},s.touches[0]||s.previousTouches[0]),{},{original:s.original,sigmaDefaultPrevented:s.sigmaDefaultPrevented,preventSigmaDefault:function(){s.sigmaDefaultPrevented=!0,n.sigmaDefaultPrevented=!0}});return n}function st(s,n){return v(v({},F(s,n)),{},{delta:Te(s)})}var ot=2;function ie(s){for(var n=[],i=0,e=Math.min(s.length,ot);i<e;i++)n.push(s[i]);return n}function J(s,n,i){var e={touches:ie(s.touches).map(function(t){return M(t,i)}),previousTouches:n.map(function(t){return M(t,i)}),sigmaDefaultPrevented:!1,preventSigmaDefault:function(){e.sigmaDefaultPrevented=!0},original:s};return e}function Te(s){if(typeof s.deltaY<"u")return s.deltaY*-3/360;if(typeof s.detail<"u")return s.detail/-9;throw new Error("Captor: could not extract delta from event.")}var De=(function(s){function n(i,e){var t;return Z(this,n),t=j(this,n),t.container=i,t.renderer=e,t}return Y(n,s),O(n)})(ue),ht=["doubleClickTimeout","doubleClickZoomingDuration","doubleClickZoomingRatio","dragTimeout","draggedEventsTolerance","inertiaDuration","inertiaRatio","zoomDuration","zoomingRatio"],dt=ht.reduce(function(s,n){return v(v({},s),{},c({},n,ce[n]))},{}),lt=(function(s){function n(i,e){var t;return Z(this,n),t=j(this,n,[i,e]),c(t,"enabled",!0),c(t,"draggedEvents",0),c(t,"downStartTime",null),c(t,"lastMouseX",null),c(t,"lastMouseY",null),c(t,"isMouseDown",!1),c(t,"isMoving",!1),c(t,"movingTimeout",null),c(t,"startCameraState",null),c(t,"clicks",0),c(t,"doubleClickTimeout",null),c(t,"currentWheelDirection",0),c(t,"settings",dt),t.handleClick=t.handleClick.bind(t),t.handleRightClick=t.handleRightClick.bind(t),t.handleDown=t.handleDown.bind(t),t.handleUp=t.handleUp.bind(t),t.handleMove=t.handleMove.bind(t),t.handleWheel=t.handleWheel.bind(t),t.handleLeave=t.handleLeave.bind(t),t.handleEnter=t.handleEnter.bind(t),i.addEventListener("click",t.handleClick,{capture:!1}),i.addEventListener("contextmenu",t.handleRightClick,{capture:!1}),i.addEventListener("mousedown",t.handleDown,{capture:!1}),i.addEventListener("wheel",t.handleWheel,{capture:!1}),i.addEventListener("mouseleave",t.handleLeave,{capture:!1}),i.addEventListener("mouseenter",t.handleEnter,{capture:!1}),document.addEventListener("mousemove",t.handleMove,{capture:!1}),document.addEventListener("mouseup",t.handleUp,{capture:!1}),t}return Y(n,s),O(n,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("click",this.handleClick),e.removeEventListener("contextmenu",this.handleRightClick),e.removeEventListener("mousedown",this.handleDown),e.removeEventListener("wheel",this.handleWheel),e.removeEventListener("mouseleave",this.handleLeave),e.removeEventListener("mouseenter",this.handleEnter),document.removeEventListener("mousemove",this.handleMove),document.removeEventListener("mouseup",this.handleUp)}},{key:"handleClick",value:function(e){var t=this;if(this.enabled){if(this.clicks++,this.clicks===2)return this.clicks=0,typeof this.doubleClickTimeout=="number"&&(clearTimeout(this.doubleClickTimeout),this.doubleClickTimeout=null),this.handleDoubleClick(e);setTimeout(function(){t.clicks=0,t.doubleClickTimeout=null},this.settings.doubleClickTimeout),this.draggedEvents<this.settings.draggedEventsTolerance&&this.emit("click",F(e,this.container))}}},{key:"handleRightClick",value:function(e){this.enabled&&this.emit("rightClick",F(e,this.container))}},{key:"handleDoubleClick",value:function(e){if(this.enabled){e.preventDefault(),e.stopPropagation();var t=F(e,this.container);if(this.emit("doubleClick",t),!t.sigmaDefaultPrevented){var a=this.renderer.getCamera(),r=a.getBoundedRatio(a.getState().ratio/this.settings.doubleClickZoomingRatio);a.animate(this.renderer.getViewportZoomedState(M(e,this.container),r),{easing:"quadraticInOut",duration:this.settings.doubleClickZoomingDuration})}}}},{key:"handleDown",value:function(e){if(this.enabled){if(e.button===0){this.startCameraState=this.renderer.getCamera().getState();var t=M(e,this.container),a=t.x,r=t.y;this.lastMouseX=a,this.lastMouseY=r,this.draggedEvents=0,this.downStartTime=Date.now(),this.isMouseDown=!0}this.emit("mousedown",F(e,this.container))}}},{key:"handleUp",value:function(e){var t=this;if(!(!this.enabled||!this.isMouseDown)){var a=this.renderer.getCamera();this.isMouseDown=!1,typeof this.movingTimeout=="number"&&(clearTimeout(this.movingTimeout),this.movingTimeout=null);var r=M(e,this.container),o=r.x,h=r.y,d=a.getState(),l=a.getPreviousState()||{x:0,y:0};this.isMoving?a.animate({x:d.x+this.settings.inertiaRatio*(d.x-l.x),y:d.y+this.settings.inertiaRatio*(d.y-l.y)},{duration:this.settings.inertiaDuration,easing:"quadraticOut"}):(this.lastMouseX!==o||this.lastMouseY!==h)&&a.setState({x:d.x,y:d.y}),this.isMoving=!1,setTimeout(function(){var u=t.draggedEvents>0;t.draggedEvents=0,u&&t.renderer.getSetting("hideEdgesOnMove")&&t.renderer.refresh()},0),this.emit("mouseup",F(e,this.container))}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled){var a=F(e,this.container);if(this.emit("mousemovebody",a),(e.target===this.container||e.composedPath()[0]===this.container)&&this.emit("mousemove",a),!a.sigmaDefaultPrevented&&this.isMouseDown){this.isMoving=!0,this.draggedEvents++,typeof this.movingTimeout=="number"&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){t.movingTimeout=null,t.isMoving=!1},this.settings.dragTimeout);var r=this.renderer.getCamera(),o=M(e,this.container),h=o.x,d=o.y,l=this.renderer.viewportToFramedGraph({x:this.lastMouseX,y:this.lastMouseY}),u=this.renderer.viewportToFramedGraph({x:h,y:d}),g=l.x-u.x,f=l.y-u.y,m=r.getState(),p=m.x+g,y=m.y+f;r.setState({x:p,y}),this.lastMouseX=h,this.lastMouseY=d,e.preventDefault(),e.stopPropagation()}}}},{key:"handleLeave",value:function(e){this.emit("mouseleave",F(e,this.container))}},{key:"handleEnter",value:function(e){this.emit("mouseenter",F(e,this.container))}},{key:"handleWheel",value:function(e){var t=this,a=this.renderer.getCamera();if(!(!this.enabled||!a.enabledZooming)){var r=Te(e);if(r){var o=st(e,this.container);if(this.emit("wheel",o),o.sigmaDefaultPrevented){e.preventDefault(),e.stopPropagation();return}var h=a.getState().ratio,d=r>0?1/this.settings.zoomingRatio:this.settings.zoomingRatio,l=a.getBoundedRatio(h*d),u=r>0?1:-1,g=Date.now();h!==l&&(e.preventDefault(),e.stopPropagation(),!(this.currentWheelDirection===u&&this.lastWheelTriggerTime&&g-this.lastWheelTriggerTime<this.settings.zoomDuration/5)&&(a.animate(this.renderer.getViewportZoomedState(M(e,this.container),l),{easing:"quadraticOut",duration:this.settings.zoomDuration},function(){t.currentWheelDirection=0}),this.currentWheelDirection=u,this.lastWheelTriggerTime=g))}}}},{key:"setSettings",value:function(e){this.settings=e}}])})(De),ut=["dragTimeout","inertiaDuration","inertiaRatio","doubleClickTimeout","doubleClickZoomingRatio","doubleClickZoomingDuration","tapMoveTolerance"],ct=ut.reduce(function(s,n){return v(v({},s),{},c({},n,ce[n]))},{}),gt=(function(s){function n(i,e){var t;return Z(this,n),t=j(this,n,[i,e]),c(t,"enabled",!0),c(t,"isMoving",!1),c(t,"hasMoved",!1),c(t,"touchMode",0),c(t,"startTouchesPositions",[]),c(t,"lastTouches",[]),c(t,"lastTap",null),c(t,"settings",ct),t.handleStart=t.handleStart.bind(t),t.handleLeave=t.handleLeave.bind(t),t.handleMove=t.handleMove.bind(t),i.addEventListener("touchstart",t.handleStart,{capture:!1}),i.addEventListener("touchcancel",t.handleLeave,{capture:!1}),document.addEventListener("touchend",t.handleLeave,{capture:!1,passive:!1}),document.addEventListener("touchmove",t.handleMove,{capture:!1,passive:!1}),t}return Y(n,s),O(n,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("touchstart",this.handleStart),e.removeEventListener("touchcancel",this.handleLeave),document.removeEventListener("touchend",this.handleLeave),document.removeEventListener("touchmove",this.handleMove)}},{key:"getDimensions",value:function(){return{width:this.container.offsetWidth,height:this.container.offsetHeight}}},{key:"handleStart",value:function(e){var t=this;if(this.enabled){e.preventDefault();var a=ie(e.touches);if(this.touchMode=a.length,this.startCameraState=this.renderer.getCamera().getState(),this.startTouchesPositions=a.map(function(f){return M(f,t.container)}),this.touchMode===2){var r=Q(this.startTouchesPositions,2),o=r[0],h=o.x,d=o.y,l=r[1],u=l.x,g=l.y;this.startTouchesAngle=Math.atan2(g-d,u-h),this.startTouchesDistance=Math.sqrt(Math.pow(u-h,2)+Math.pow(g-d,2))}this.emit("touchdown",J(e,this.lastTouches,this.container)),this.lastTouches=a,this.lastTouchesPositions=this.startTouchesPositions}}},{key:"handleLeave",value:function(e){if(!(!this.enabled||!this.startTouchesPositions.length)){switch(e.cancelable&&e.preventDefault(),this.movingTimeout&&(this.isMoving=!1,clearTimeout(this.movingTimeout)),this.touchMode){case 2:if(e.touches.length===1){this.handleStart(e),e.preventDefault();break}case 1:if(this.isMoving){var t=this.renderer.getCamera(),a=t.getState(),r=t.getPreviousState()||{x:0,y:0};t.animate({x:a.x+this.settings.inertiaRatio*(a.x-r.x),y:a.y+this.settings.inertiaRatio*(a.y-r.y)},{duration:this.settings.inertiaDuration,easing:"quadraticOut"})}this.hasMoved=!1,this.isMoving=!1,this.touchMode=0;break}if(this.emit("touchup",J(e,this.lastTouches,this.container)),!e.touches.length){var o=M(this.lastTouches[0],this.container),h=this.startTouchesPositions[0],d=Math.pow(o.x-h.x,2)+Math.pow(o.y-h.y,2);if(!e.touches.length&&d<Math.pow(this.settings.tapMoveTolerance,2))if(this.lastTap&&Date.now()-this.lastTap.time<this.settings.doubleClickTimeout){var l=J(e,this.lastTouches,this.container);if(this.emit("doubletap",l),this.lastTap=null,!l.sigmaDefaultPrevented){var u=this.renderer.getCamera(),g=u.getBoundedRatio(u.getState().ratio/this.settings.doubleClickZoomingRatio);u.animate(this.renderer.getViewportZoomedState(o,g),{easing:"quadraticInOut",duration:this.settings.doubleClickZoomingDuration})}}else{var f=J(e,this.lastTouches,this.container);this.emit("tap",f),this.lastTap={time:Date.now(),position:f.touches[0]||f.previousTouches[0]}}}this.lastTouches=ie(e.touches),this.startTouchesPositions=[]}}},{key:"handleMove",value:function(e){var t=this;if(!(!this.enabled||!this.startTouchesPositions.length)){e.preventDefault();var a=ie(e.touches),r=a.map(function(B){return M(B,t.container)}),o=this.lastTouches;this.lastTouches=a,this.lastTouchesPositions=r;var h=J(e,o,this.container);if(this.emit("touchmove",h),!h.sigmaDefaultPrevented&&(this.hasMoved||(this.hasMoved=r.some(function(B,ae){var G=t.startTouchesPositions[ae];return G&&(B.x!==G.x||B.y!==G.y)})),!!this.hasMoved)){this.isMoving=!0,this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){t.isMoving=!1},this.settings.dragTimeout);var d=this.renderer.getCamera(),l=this.startCameraState,u=this.renderer.getSetting("stagePadding");switch(this.touchMode){case 1:{var g=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0]),f=g.x,m=g.y,p=this.renderer.viewportToFramedGraph(r[0]),y=p.x,E=p.y;d.setState({x:l.x+f-y,y:l.y+m-E});break}case 2:{var b={x:.5,y:.5,angle:0,ratio:1},x=r[0],C=x.x,I=x.y,A=r[1],w=A.x,k=A.y,T=Math.atan2(k-I,w-C)-this.startTouchesAngle,L=Math.hypot(k-I,w-C)/this.startTouchesDistance,D=d.getBoundedRatio(l.ratio/L);b.ratio=D,b.angle=l.angle+T;var S=this.getDimensions(),_=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0],{cameraState:l}),P=Math.min(S.width,S.height)-2*u,R=P/S.width,U=P/S.height,$=D/P,q=C-P/2/R,V=I-P/2/U,H=[q*Math.cos(-b.angle)-V*Math.sin(-b.angle),V*Math.cos(-b.angle)+q*Math.sin(-b.angle)];q=H[0],V=H[1],b.x=_.x-q*$,b.y=_.y+V*$,d.setState(b);break}}}}}},{key:"setSettings",value:function(e){this.settings=e}}])})(De);function vt(s){if(Array.isArray(s))return Ae(s)}function ft(s){if(typeof Symbol<"u"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}function mt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
1
|
+
import{h as Y,f as O,e as Z,d as j,j as Q,o as Re,p as Ne,q as Me,N as Ge,b as Ie,E as Fe,i as v,g as c,k as ne,s as ge,n as ve,l as ze,_ as Ae}from"./DqvWKbSc.js";import{o as Ue,x as He,q as Be}from"./BspmDMQv.js";var ue=(function(s){function n(){var i;return Z(this,n),i=j(this,n),i.rawEmitter=i,i}return Y(n,s),O(n)})(Ue.EventEmitter),We=He();const Oe=Be(We);var Ze=function(n){return n},_e=function(n){return n*n},Ve=function(n){return n*(2-n)},qe=function(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)},Ye=function(n){return n*n*n},je=function(n){return--n*n*n+1},Xe=function(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)},Ke={linear:Ze,quadraticIn:_e,quadraticOut:Ve,quadraticInOut:qe,cubicIn:Ye,cubicOut:je,cubicInOut:Xe},Je={easing:"quadraticInOut",duration:150};function N(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function ee(s,n,i){return s[0]=n,s[4]=typeof i=="number"?i:n,s}function fe(s,n){var i=Math.sin(n),e=Math.cos(n);return s[0]=e,s[1]=i,s[3]=-i,s[4]=e,s}function me(s,n,i){return s[6]=n,s[7]=i,s}function W(s,n){var i=s[0],e=s[1],t=s[2],a=s[3],r=s[4],o=s[5],h=s[6],d=s[7],l=s[8],u=n[0],g=n[1],f=n[2],m=n[3],p=n[4],y=n[5],E=n[6],b=n[7],x=n[8];return s[0]=u*i+g*a+f*h,s[1]=u*e+g*r+f*d,s[2]=u*t+g*o+f*l,s[3]=m*i+p*a+y*h,s[4]=m*e+p*r+y*d,s[5]=m*t+p*o+y*l,s[6]=E*i+b*a+x*h,s[7]=E*e+b*r+x*d,s[8]=E*t+b*o+x*l,s}function de(s,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,e=s[0],t=s[1],a=s[3],r=s[4],o=s[6],h=s[7],d=n.x,l=n.y;return{x:d*e+l*a+o*i,y:d*t+l*r+h*i}}function Qe(s,n){var i=s.height/s.width,e=n.height/n.width;return i<1&&e>1||i>1&&e<1?1:Math.min(Math.max(e,1/e),Math.max(1/i,i))}function X(s,n,i,e,t){var a=s.angle,r=s.ratio,o=s.x,h=s.y,d=n.width,l=n.height,u=N(),g=Math.min(d,l)-2*e,f=Qe(n,i);return t?(W(u,me(N(),o,h)),W(u,ee(N(),r)),W(u,fe(N(),a)),W(u,ee(N(),d/g/2/f,l/g/2/f))):(W(u,ee(N(),2*(g/d)*f,2*(g/l)*f)),W(u,fe(N(),-a)),W(u,ee(N(),1/r)),W(u,me(N(),-o,-h))),u}function $e(s,n,i){var e=de(s,{x:Math.cos(n.angle),y:Math.sin(n.angle)},0),t=e.x,a=e.y;return 1/Math.sqrt(Math.pow(t,2)+Math.pow(a,2))/i.width}function et(s){if(!s.order)return{x:[0,1],y:[0,1]};var n=1/0,i=-1/0,e=1/0,t=-1/0;return s.forEachNode(function(a,r){var o=r.x,h=r.y;o<n&&(n=o),o>i&&(i=o),h<e&&(e=h),h>t&&(t=h)}),{x:[n,i],y:[e,t]}}function tt(s){if(!Oe(s))throw new Error("Sigma: invalid graph instance.");s.forEachNode(function(n,i){if(!Number.isFinite(i.x)||!Number.isFinite(i.y))throw new Error("Sigma: Coordinates of node ".concat(n," are invalid. A node must have a numeric 'x' and 'y' attribute."))})}function it(s,n,i){var e=document.createElement(s);if(n)for(var t in n)e.style[t]=n[t];if(i)for(var a in i)e.setAttribute(a,i[a]);return e}function pe(){return typeof window.devicePixelRatio<"u"?window.devicePixelRatio:1}function ye(s,n,i){return i.sort(function(e,t){var a=n(e)||0,r=n(t)||0;return a<r?-1:a>r?1:0})}function be(s){var n=Q(s.x,2),i=n[0],e=n[1],t=Q(s.y,2),a=t[0],r=t[1],o=Math.max(e-i,r-a),h=(e+i)/2,d=(r+a)/2;(o===0||Math.abs(o)===1/0||isNaN(o))&&(o=1),isNaN(h)&&(h=0),isNaN(d)&&(d=0);var l=function(g){return{x:.5+(g.x-h)/o,y:.5+(g.y-d)/o}};return l.applyTo=function(u){u.x=.5+(u.x-h)/o,u.y=.5+(u.y-d)/o},l.inverse=function(u){return{x:h+o*(u.x-.5),y:d+o*(u.y-.5)}},l.ratio=o,l}function le(s){"@babel/helpers - typeof";return le=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},le(s)}function xe(s,n){var i=n.size;if(i!==0){var e=s.length;s.length+=i;var t=0;n.forEach(function(a){s[e+t]=a,t++})}}function se(s){s=s||{};for(var n=0,i=arguments.length<=1?0:arguments.length-1;n<i;n++){var e=n+1<1||arguments.length<=n+1?void 0:arguments[n+1];e&&Object.assign(s,e)}return s}var ce={hideEdgesOnMove:!1,hideLabelsOnMove:!1,renderLabels:!0,renderEdgeLabels:!1,enableEdgeEvents:!1,defaultNodeColor:"#999",defaultNodeType:"circle",defaultEdgeColor:"#ccc",defaultEdgeType:"line",labelFont:"Arial",labelSize:14,labelWeight:"normal",labelColor:{color:"#000"},edgeLabelFont:"Arial",edgeLabelSize:14,edgeLabelWeight:"normal",edgeLabelColor:{attribute:"color"},stagePadding:30,defaultDrawEdgeLabel:Me,defaultDrawNodeLabel:Ne,defaultDrawNodeHover:Re,minEdgeThickness:1.7,antiAliasingFeather:1,dragTimeout:100,draggedEventsTolerance:3,inertiaDuration:200,inertiaRatio:3,zoomDuration:250,zoomingRatio:1.7,doubleClickTimeout:300,doubleClickZoomingRatio:2.2,doubleClickZoomingDuration:200,tapMoveTolerance:10,zoomToSizeRatioFunction:Math.sqrt,itemSizesReference:"screen",autoRescale:!0,autoCenter:!0,labelDensity:1,labelGridCellSize:100,labelRenderedSizeThreshold:6,nodeReducer:null,edgeReducer:null,zIndex:!1,minCameraRatio:null,maxCameraRatio:null,enableCameraZooming:!0,enableCameraPanning:!0,enableCameraRotation:!0,cameraPanBoundaries:null,allowInvalidContainer:!1,nodeProgramClasses:{},nodeHoverProgramClasses:{},edgeProgramClasses:{}},at={circle:Ge},rt={arrow:Fe,line:Ie};function oe(s){if(typeof s.labelDensity!="number"||s.labelDensity<0)throw new Error("Settings: invalid `labelDensity`. Expecting a positive number.");var n=s.minCameraRatio,i=s.maxCameraRatio;if(typeof n=="number"&&typeof i=="number"&&i<n)throw new Error("Settings: invalid camera ratio boundaries. Expecting `maxCameraRatio` to be greater than `minCameraRatio`.")}function nt(s){var n=se({},ce,s);return n.nodeProgramClasses=se({},at,n.nodeProgramClasses),n.edgeProgramClasses=se({},rt,n.edgeProgramClasses),n}var te=1.5,Ce=(function(s){function n(){var i;return Z(this,n),i=j(this,n),c(i,"x",.5),c(i,"y",.5),c(i,"angle",0),c(i,"ratio",1),c(i,"minRatio",null),c(i,"maxRatio",null),c(i,"enabledZooming",!0),c(i,"enabledPanning",!0),c(i,"enabledRotation",!0),c(i,"clean",null),c(i,"nextFrame",null),c(i,"previousState",null),c(i,"enabled",!0),i.previousState=i.getState(),i}return Y(n,s),O(n,[{key:"enable",value:function(){return this.enabled=!0,this}},{key:"disable",value:function(){return this.enabled=!1,this}},{key:"getState",value:function(){return{x:this.x,y:this.y,angle:this.angle,ratio:this.ratio}}},{key:"hasState",value:function(e){return this.x===e.x&&this.y===e.y&&this.ratio===e.ratio&&this.angle===e.angle}},{key:"getPreviousState",value:function(){var e=this.previousState;return e?{x:e.x,y:e.y,angle:e.angle,ratio:e.ratio}:null}},{key:"getBoundedRatio",value:function(e){var t=e;return typeof this.minRatio=="number"&&(t=Math.max(t,this.minRatio)),typeof this.maxRatio=="number"&&(t=Math.min(t,this.maxRatio)),t}},{key:"validateState",value:function(e){var t={};return this.enabledPanning&&typeof e.x=="number"&&(t.x=e.x),this.enabledPanning&&typeof e.y=="number"&&(t.y=e.y),this.enabledZooming&&typeof e.ratio=="number"&&(t.ratio=this.getBoundedRatio(e.ratio)),this.enabledRotation&&typeof e.angle=="number"&&(t.angle=e.angle),this.clean?this.clean(v(v({},this.getState()),t)):t}},{key:"isAnimated",value:function(){return!!this.nextFrame}},{key:"setState",value:function(e){if(!this.enabled)return this;this.previousState=this.getState();var t=this.validateState(e);return typeof t.x=="number"&&(this.x=t.x),typeof t.y=="number"&&(this.y=t.y),typeof t.ratio=="number"&&(this.ratio=t.ratio),typeof t.angle=="number"&&(this.angle=t.angle),this.hasState(this.previousState)||this.emit("updated",this.getState()),this}},{key:"updateState",value:function(e){return this.setState(e(this.getState())),this}},{key:"animate",value:function(e){var t=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(!r)return new Promise(function(f){return t.animate(e,a,f)});if(this.enabled){var o=v(v({},Je),a),h=this.validateState(e),d=typeof o.easing=="function"?o.easing:Ke[o.easing],l=Date.now(),u=this.getState(),g=function(){var m=(Date.now()-l)/o.duration;if(m>=1){t.nextFrame=null,t.setState(h),t.animationCallback&&(t.animationCallback.call(null),t.animationCallback=void 0);return}var p=d(m),y={};typeof h.x=="number"&&(y.x=u.x+(h.x-u.x)*p),typeof h.y=="number"&&(y.y=u.y+(h.y-u.y)*p),t.enabledRotation&&typeof h.angle=="number"&&(y.angle=u.angle+(h.angle-u.angle)*p),typeof h.ratio=="number"&&(y.ratio=u.ratio+(h.ratio-u.ratio)*p),t.setState(y),t.nextFrame=requestAnimationFrame(g)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.animationCallback&&this.animationCallback.call(null),this.nextFrame=requestAnimationFrame(g)):g(),this.animationCallback=r}}},{key:"animatedZoom",value:function(e){return e?typeof e=="number"?this.animate({ratio:this.ratio/e}):this.animate({ratio:this.ratio/(e.factor||te)},e):this.animate({ratio:this.ratio/te})}},{key:"animatedUnzoom",value:function(e){return e?typeof e=="number"?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||te)},e):this.animate({ratio:this.ratio*te})}},{key:"animatedReset",value:function(e){return this.animate({x:.5,y:.5,ratio:1,angle:0},e)}},{key:"copy",value:function(){return n.from(this.getState())}}],[{key:"from",value:function(e){var t=new n;return t.setState(e)}}])})(ue);function M(s,n){var i=n.getBoundingClientRect();return{x:s.clientX-i.left,y:s.clientY-i.top}}function F(s,n){var i=v(v({},M(s,n)),{},{sigmaDefaultPrevented:!1,preventSigmaDefault:function(){i.sigmaDefaultPrevented=!0},original:s});return i}function K(s){var n="x"in s?s:v(v({},s.touches[0]||s.previousTouches[0]),{},{original:s.original,sigmaDefaultPrevented:s.sigmaDefaultPrevented,preventSigmaDefault:function(){s.sigmaDefaultPrevented=!0,n.sigmaDefaultPrevented=!0}});return n}function st(s,n){return v(v({},F(s,n)),{},{delta:Te(s)})}var ot=2;function ie(s){for(var n=[],i=0,e=Math.min(s.length,ot);i<e;i++)n.push(s[i]);return n}function J(s,n,i){var e={touches:ie(s.touches).map(function(t){return M(t,i)}),previousTouches:n.map(function(t){return M(t,i)}),sigmaDefaultPrevented:!1,preventSigmaDefault:function(){e.sigmaDefaultPrevented=!0},original:s};return e}function Te(s){if(typeof s.deltaY<"u")return s.deltaY*-3/360;if(typeof s.detail<"u")return s.detail/-9;throw new Error("Captor: could not extract delta from event.")}var De=(function(s){function n(i,e){var t;return Z(this,n),t=j(this,n),t.container=i,t.renderer=e,t}return Y(n,s),O(n)})(ue),ht=["doubleClickTimeout","doubleClickZoomingDuration","doubleClickZoomingRatio","dragTimeout","draggedEventsTolerance","inertiaDuration","inertiaRatio","zoomDuration","zoomingRatio"],dt=ht.reduce(function(s,n){return v(v({},s),{},c({},n,ce[n]))},{}),lt=(function(s){function n(i,e){var t;return Z(this,n),t=j(this,n,[i,e]),c(t,"enabled",!0),c(t,"draggedEvents",0),c(t,"downStartTime",null),c(t,"lastMouseX",null),c(t,"lastMouseY",null),c(t,"isMouseDown",!1),c(t,"isMoving",!1),c(t,"movingTimeout",null),c(t,"startCameraState",null),c(t,"clicks",0),c(t,"doubleClickTimeout",null),c(t,"currentWheelDirection",0),c(t,"settings",dt),t.handleClick=t.handleClick.bind(t),t.handleRightClick=t.handleRightClick.bind(t),t.handleDown=t.handleDown.bind(t),t.handleUp=t.handleUp.bind(t),t.handleMove=t.handleMove.bind(t),t.handleWheel=t.handleWheel.bind(t),t.handleLeave=t.handleLeave.bind(t),t.handleEnter=t.handleEnter.bind(t),i.addEventListener("click",t.handleClick,{capture:!1}),i.addEventListener("contextmenu",t.handleRightClick,{capture:!1}),i.addEventListener("mousedown",t.handleDown,{capture:!1}),i.addEventListener("wheel",t.handleWheel,{capture:!1}),i.addEventListener("mouseleave",t.handleLeave,{capture:!1}),i.addEventListener("mouseenter",t.handleEnter,{capture:!1}),document.addEventListener("mousemove",t.handleMove,{capture:!1}),document.addEventListener("mouseup",t.handleUp,{capture:!1}),t}return Y(n,s),O(n,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("click",this.handleClick),e.removeEventListener("contextmenu",this.handleRightClick),e.removeEventListener("mousedown",this.handleDown),e.removeEventListener("wheel",this.handleWheel),e.removeEventListener("mouseleave",this.handleLeave),e.removeEventListener("mouseenter",this.handleEnter),document.removeEventListener("mousemove",this.handleMove),document.removeEventListener("mouseup",this.handleUp)}},{key:"handleClick",value:function(e){var t=this;if(this.enabled){if(this.clicks++,this.clicks===2)return this.clicks=0,typeof this.doubleClickTimeout=="number"&&(clearTimeout(this.doubleClickTimeout),this.doubleClickTimeout=null),this.handleDoubleClick(e);setTimeout(function(){t.clicks=0,t.doubleClickTimeout=null},this.settings.doubleClickTimeout),this.draggedEvents<this.settings.draggedEventsTolerance&&this.emit("click",F(e,this.container))}}},{key:"handleRightClick",value:function(e){this.enabled&&this.emit("rightClick",F(e,this.container))}},{key:"handleDoubleClick",value:function(e){if(this.enabled){e.preventDefault(),e.stopPropagation();var t=F(e,this.container);if(this.emit("doubleClick",t),!t.sigmaDefaultPrevented){var a=this.renderer.getCamera(),r=a.getBoundedRatio(a.getState().ratio/this.settings.doubleClickZoomingRatio);a.animate(this.renderer.getViewportZoomedState(M(e,this.container),r),{easing:"quadraticInOut",duration:this.settings.doubleClickZoomingDuration})}}}},{key:"handleDown",value:function(e){if(this.enabled){if(e.button===0){this.startCameraState=this.renderer.getCamera().getState();var t=M(e,this.container),a=t.x,r=t.y;this.lastMouseX=a,this.lastMouseY=r,this.draggedEvents=0,this.downStartTime=Date.now(),this.isMouseDown=!0}this.emit("mousedown",F(e,this.container))}}},{key:"handleUp",value:function(e){var t=this;if(!(!this.enabled||!this.isMouseDown)){var a=this.renderer.getCamera();this.isMouseDown=!1,typeof this.movingTimeout=="number"&&(clearTimeout(this.movingTimeout),this.movingTimeout=null);var r=M(e,this.container),o=r.x,h=r.y,d=a.getState(),l=a.getPreviousState()||{x:0,y:0};this.isMoving?a.animate({x:d.x+this.settings.inertiaRatio*(d.x-l.x),y:d.y+this.settings.inertiaRatio*(d.y-l.y)},{duration:this.settings.inertiaDuration,easing:"quadraticOut"}):(this.lastMouseX!==o||this.lastMouseY!==h)&&a.setState({x:d.x,y:d.y}),this.isMoving=!1,setTimeout(function(){var u=t.draggedEvents>0;t.draggedEvents=0,u&&t.renderer.getSetting("hideEdgesOnMove")&&t.renderer.refresh()},0),this.emit("mouseup",F(e,this.container))}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled){var a=F(e,this.container);if(this.emit("mousemovebody",a),(e.target===this.container||e.composedPath()[0]===this.container)&&this.emit("mousemove",a),!a.sigmaDefaultPrevented&&this.isMouseDown){this.isMoving=!0,this.draggedEvents++,typeof this.movingTimeout=="number"&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){t.movingTimeout=null,t.isMoving=!1},this.settings.dragTimeout);var r=this.renderer.getCamera(),o=M(e,this.container),h=o.x,d=o.y,l=this.renderer.viewportToFramedGraph({x:this.lastMouseX,y:this.lastMouseY}),u=this.renderer.viewportToFramedGraph({x:h,y:d}),g=l.x-u.x,f=l.y-u.y,m=r.getState(),p=m.x+g,y=m.y+f;r.setState({x:p,y}),this.lastMouseX=h,this.lastMouseY=d,e.preventDefault(),e.stopPropagation()}}}},{key:"handleLeave",value:function(e){this.emit("mouseleave",F(e,this.container))}},{key:"handleEnter",value:function(e){this.emit("mouseenter",F(e,this.container))}},{key:"handleWheel",value:function(e){var t=this,a=this.renderer.getCamera();if(!(!this.enabled||!a.enabledZooming)){var r=Te(e);if(r){var o=st(e,this.container);if(this.emit("wheel",o),o.sigmaDefaultPrevented){e.preventDefault(),e.stopPropagation();return}var h=a.getState().ratio,d=r>0?1/this.settings.zoomingRatio:this.settings.zoomingRatio,l=a.getBoundedRatio(h*d),u=r>0?1:-1,g=Date.now();h!==l&&(e.preventDefault(),e.stopPropagation(),!(this.currentWheelDirection===u&&this.lastWheelTriggerTime&&g-this.lastWheelTriggerTime<this.settings.zoomDuration/5)&&(a.animate(this.renderer.getViewportZoomedState(M(e,this.container),l),{easing:"quadraticOut",duration:this.settings.zoomDuration},function(){t.currentWheelDirection=0}),this.currentWheelDirection=u,this.lastWheelTriggerTime=g))}}}},{key:"setSettings",value:function(e){this.settings=e}}])})(De),ut=["dragTimeout","inertiaDuration","inertiaRatio","doubleClickTimeout","doubleClickZoomingRatio","doubleClickZoomingDuration","tapMoveTolerance"],ct=ut.reduce(function(s,n){return v(v({},s),{},c({},n,ce[n]))},{}),gt=(function(s){function n(i,e){var t;return Z(this,n),t=j(this,n,[i,e]),c(t,"enabled",!0),c(t,"isMoving",!1),c(t,"hasMoved",!1),c(t,"touchMode",0),c(t,"startTouchesPositions",[]),c(t,"lastTouches",[]),c(t,"lastTap",null),c(t,"settings",ct),t.handleStart=t.handleStart.bind(t),t.handleLeave=t.handleLeave.bind(t),t.handleMove=t.handleMove.bind(t),i.addEventListener("touchstart",t.handleStart,{capture:!1}),i.addEventListener("touchcancel",t.handleLeave,{capture:!1}),document.addEventListener("touchend",t.handleLeave,{capture:!1,passive:!1}),document.addEventListener("touchmove",t.handleMove,{capture:!1,passive:!1}),t}return Y(n,s),O(n,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("touchstart",this.handleStart),e.removeEventListener("touchcancel",this.handleLeave),document.removeEventListener("touchend",this.handleLeave),document.removeEventListener("touchmove",this.handleMove)}},{key:"getDimensions",value:function(){return{width:this.container.offsetWidth,height:this.container.offsetHeight}}},{key:"handleStart",value:function(e){var t=this;if(this.enabled){e.preventDefault();var a=ie(e.touches);if(this.touchMode=a.length,this.startCameraState=this.renderer.getCamera().getState(),this.startTouchesPositions=a.map(function(f){return M(f,t.container)}),this.touchMode===2){var r=Q(this.startTouchesPositions,2),o=r[0],h=o.x,d=o.y,l=r[1],u=l.x,g=l.y;this.startTouchesAngle=Math.atan2(g-d,u-h),this.startTouchesDistance=Math.sqrt(Math.pow(u-h,2)+Math.pow(g-d,2))}this.emit("touchdown",J(e,this.lastTouches,this.container)),this.lastTouches=a,this.lastTouchesPositions=this.startTouchesPositions}}},{key:"handleLeave",value:function(e){if(!(!this.enabled||!this.startTouchesPositions.length)){switch(e.cancelable&&e.preventDefault(),this.movingTimeout&&(this.isMoving=!1,clearTimeout(this.movingTimeout)),this.touchMode){case 2:if(e.touches.length===1){this.handleStart(e),e.preventDefault();break}case 1:if(this.isMoving){var t=this.renderer.getCamera(),a=t.getState(),r=t.getPreviousState()||{x:0,y:0};t.animate({x:a.x+this.settings.inertiaRatio*(a.x-r.x),y:a.y+this.settings.inertiaRatio*(a.y-r.y)},{duration:this.settings.inertiaDuration,easing:"quadraticOut"})}this.hasMoved=!1,this.isMoving=!1,this.touchMode=0;break}if(this.emit("touchup",J(e,this.lastTouches,this.container)),!e.touches.length){var o=M(this.lastTouches[0],this.container),h=this.startTouchesPositions[0],d=Math.pow(o.x-h.x,2)+Math.pow(o.y-h.y,2);if(!e.touches.length&&d<Math.pow(this.settings.tapMoveTolerance,2))if(this.lastTap&&Date.now()-this.lastTap.time<this.settings.doubleClickTimeout){var l=J(e,this.lastTouches,this.container);if(this.emit("doubletap",l),this.lastTap=null,!l.sigmaDefaultPrevented){var u=this.renderer.getCamera(),g=u.getBoundedRatio(u.getState().ratio/this.settings.doubleClickZoomingRatio);u.animate(this.renderer.getViewportZoomedState(o,g),{easing:"quadraticInOut",duration:this.settings.doubleClickZoomingDuration})}}else{var f=J(e,this.lastTouches,this.container);this.emit("tap",f),this.lastTap={time:Date.now(),position:f.touches[0]||f.previousTouches[0]}}}this.lastTouches=ie(e.touches),this.startTouchesPositions=[]}}},{key:"handleMove",value:function(e){var t=this;if(!(!this.enabled||!this.startTouchesPositions.length)){e.preventDefault();var a=ie(e.touches),r=a.map(function(B){return M(B,t.container)}),o=this.lastTouches;this.lastTouches=a,this.lastTouchesPositions=r;var h=J(e,o,this.container);if(this.emit("touchmove",h),!h.sigmaDefaultPrevented&&(this.hasMoved||(this.hasMoved=r.some(function(B,ae){var G=t.startTouchesPositions[ae];return G&&(B.x!==G.x||B.y!==G.y)})),!!this.hasMoved)){this.isMoving=!0,this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){t.isMoving=!1},this.settings.dragTimeout);var d=this.renderer.getCamera(),l=this.startCameraState,u=this.renderer.getSetting("stagePadding");switch(this.touchMode){case 1:{var g=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0]),f=g.x,m=g.y,p=this.renderer.viewportToFramedGraph(r[0]),y=p.x,E=p.y;d.setState({x:l.x+f-y,y:l.y+m-E});break}case 2:{var b={x:.5,y:.5,angle:0,ratio:1},x=r[0],C=x.x,I=x.y,A=r[1],w=A.x,k=A.y,T=Math.atan2(k-I,w-C)-this.startTouchesAngle,L=Math.hypot(k-I,w-C)/this.startTouchesDistance,D=d.getBoundedRatio(l.ratio/L);b.ratio=D,b.angle=l.angle+T;var S=this.getDimensions(),_=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0],{cameraState:l}),P=Math.min(S.width,S.height)-2*u,R=P/S.width,U=P/S.height,$=D/P,q=C-P/2/R,V=I-P/2/U,H=[q*Math.cos(-b.angle)-V*Math.sin(-b.angle),V*Math.cos(-b.angle)+q*Math.sin(-b.angle)];q=H[0],V=H[1],b.x=_.x-q*$,b.y=_.y+V*$,d.setState(b);break}}}}}},{key:"setSettings",value:function(e){this.settings=e}}])})(De);function vt(s){if(Array.isArray(s))return Ae(s)}function ft(s){if(typeof Symbol<"u"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}function mt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ee(s){return vt(s)||ft(s)||ze(s)||mt()}function pt(s,n){if(s==null)return{};var i={};for(var e in s)if({}.hasOwnProperty.call(s,e)){if(n.indexOf(e)!==-1)continue;i[e]=s[e]}return i}function he(s,n){if(s==null)return{};var i,e,t=pt(s,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(s);for(e=0;e<a.length;e++)i=a[e],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(s,i)&&(t[i]=s[i])}return t}var we=(function(){function s(n,i){Z(this,s),this.key=n,this.size=i}return O(s,null,[{key:"compare",value:function(i,e){return i.size>e.size?-1:i.size<e.size||i.key>e.key?1:-1}}])})(),Le=(function(){function s(){Z(this,s),c(this,"width",0),c(this,"height",0),c(this,"cellSize",0),c(this,"columns",0),c(this,"rows",0),c(this,"cells",{})}return O(s,[{key:"resizeAndClear",value:function(i,e){this.width=i.width,this.height=i.height,this.cellSize=e,this.columns=Math.ceil(i.width/e),this.rows=Math.ceil(i.height/e),this.cells={}}},{key:"getIndex",value:function(i){var e=Math.floor(i.x/this.cellSize),t=Math.floor(i.y/this.cellSize);return t*this.columns+e}},{key:"add",value:function(i,e,t){var a=new we(i,e),r=this.getIndex(t),o=this.cells[r];o||(o=[],this.cells[r]=o),o.push(a)}},{key:"organize",value:function(){for(var i in this.cells){var e=this.cells[i];e.sort(we.compare)}}},{key:"getLabelsToDisplay",value:function(i,e){var t=this.cellSize*this.cellSize,a=t/i/i,r=a*e/t,o=Math.ceil(r),h=[];for(var d in this.cells)for(var l=this.cells[d],u=0;u<Math.min(o,l.length);u++)h.push(l[u].key);return h}}])})();function yt(s){var n=s.graph,i=s.hoveredNode,e=s.highlightedNodes,t=s.displayedNodeLabels,a=[];return n.forEachEdge(function(r,o,h,d){(h===i||d===i||e.has(h)||e.has(d)||t.has(h)&&t.has(d))&&a.push(r)}),a}var Se=150,Pe=50,z=Object.prototype.hasOwnProperty;function bt(s,n,i){if(!z.call(i,"x")||!z.call(i,"y"))throw new Error('Sigma: could not find a valid position (x, y) for node "'.concat(n,'". All your nodes must have a number "x" and "y". Maybe your forgot to apply a layout or your "nodeReducer" is not returning the correct data?'));return i.color||(i.color=s.defaultNodeColor),!i.label&&i.label!==""&&(i.label=null),i.label!==void 0&&i.label!==null?i.label=""+i.label:i.label=null,i.size||(i.size=2),z.call(i,"hidden")||(i.hidden=!1),z.call(i,"highlighted")||(i.highlighted=!1),z.call(i,"forceLabel")||(i.forceLabel=!1),(!i.type||i.type==="")&&(i.type=s.defaultNodeType),i.zIndex||(i.zIndex=0),i}function xt(s,n,i){return i.color||(i.color=s.defaultEdgeColor),i.label||(i.label=""),i.size||(i.size=.5),z.call(i,"hidden")||(i.hidden=!1),z.call(i,"forceLabel")||(i.forceLabel=!1),(!i.type||i.type==="")&&(i.type=s.defaultEdgeType),i.zIndex||(i.zIndex=0),i}var Ct=(function(s){function n(i,e){var t,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(Z(this,n),t=j(this,n),c(t,"elements",{}),c(t,"canvasContexts",{}),c(t,"webGLContexts",{}),c(t,"pickingLayers",new Set),c(t,"textures",{}),c(t,"frameBuffers",{}),c(t,"activeListeners",{}),c(t,"labelGrid",new Le),c(t,"nodeDataCache",{}),c(t,"edgeDataCache",{}),c(t,"nodeProgramIndex",{}),c(t,"edgeProgramIndex",{}),c(t,"nodesWithForcedLabels",new Set),c(t,"edgesWithForcedLabels",new Set),c(t,"nodeExtent",{x:[0,1],y:[0,1]}),c(t,"nodeZExtent",[1/0,-1/0]),c(t,"edgeZExtent",[1/0,-1/0]),c(t,"matrix",N()),c(t,"invMatrix",N()),c(t,"correctionRatio",1),c(t,"customBBox",null),c(t,"normalizationFunction",be({x:[0,1],y:[0,1]})),c(t,"graphToViewportRatio",1),c(t,"itemIDsIndex",{}),c(t,"nodeIndices",{}),c(t,"edgeIndices",{}),c(t,"width",0),c(t,"height",0),c(t,"pixelRatio",pe()),c(t,"pickingDownSizingRatio",2*t.pixelRatio),c(t,"displayedNodeLabels",new Set),c(t,"displayedEdgeLabels",new Set),c(t,"highlightedNodes",new Set),c(t,"hoveredNode",null),c(t,"hoveredEdge",null),c(t,"renderFrame",null),c(t,"renderHighlightedNodesFrame",null),c(t,"needToProcess",!1),c(t,"checkEdgesEventsFrame",null),c(t,"nodePrograms",{}),c(t,"nodeHoverPrograms",{}),c(t,"edgePrograms",{}),t.settings=nt(a),oe(t.settings),tt(i),!(e instanceof HTMLElement))throw new Error("Sigma: container should be an html element.");t.graph=i,t.container=e,t.createWebGLContext("edges",{picking:a.enableEdgeEvents}),t.createCanvasContext("edgeLabels"),t.createWebGLContext("nodes",{picking:!0}),t.createCanvasContext("labels"),t.createCanvasContext("hovers"),t.createWebGLContext("hoverNodes"),t.createCanvasContext("mouse",{style:{touchAction:"none",userSelect:"none"}}),t.resize();for(var r in t.settings.nodeProgramClasses)t.registerNodeProgram(r,t.settings.nodeProgramClasses[r],t.settings.nodeHoverProgramClasses[r]);for(var o in t.settings.edgeProgramClasses)t.registerEdgeProgram(o,t.settings.edgeProgramClasses[o]);return t.camera=new Ce,t.bindCameraHandlers(),t.mouseCaptor=new lt(t.elements.mouse,t),t.mouseCaptor.setSettings(t.settings),t.touchCaptor=new gt(t.elements.mouse,t),t.touchCaptor.setSettings(t.settings),t.bindEventHandlers(),t.bindGraphHandlers(),t.handleSettingsUpdate(),t.refresh(),t}return Y(n,s),O(n,[{key:"registerNodeProgram",value:function(e,t,a){return this.nodePrograms[e]&&this.nodePrograms[e].kill(),this.nodeHoverPrograms[e]&&this.nodeHoverPrograms[e].kill(),this.nodePrograms[e]=new t(this.webGLContexts.nodes,this.frameBuffers.nodes,this),this.nodeHoverPrograms[e]=new(a||t)(this.webGLContexts.hoverNodes,null,this),this}},{key:"registerEdgeProgram",value:function(e,t){return this.edgePrograms[e]&&this.edgePrograms[e].kill(),this.edgePrograms[e]=new t(this.webGLContexts.edges,this.frameBuffers.edges,this),this}},{key:"unregisterNodeProgram",value:function(e){if(this.nodePrograms[e]){var t=this.nodePrograms,a=t[e],r=he(t,[e].map(ne));a.kill(),this.nodePrograms=r}if(this.nodeHoverPrograms[e]){var o=this.nodeHoverPrograms,h=o[e],d=he(o,[e].map(ne));h.kill(),this.nodePrograms=d}return this}},{key:"unregisterEdgeProgram",value:function(e){if(this.edgePrograms[e]){var t=this.edgePrograms,a=t[e],r=he(t,[e].map(ne));a.kill(),this.edgePrograms=r}return this}},{key:"resetWebGLTexture",value:function(e){var t=this.webGLContexts[e],a=this.frameBuffers[e],r=this.textures[e];r&&t.deleteTexture(r);var o=t.createTexture();return t.bindFramebuffer(t.FRAMEBUFFER,a),t.bindTexture(t.TEXTURE_2D,o),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,null),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,o,0),this.textures[e]=o,this}},{key:"bindCameraHandlers",value:function(){var e=this;return this.activeListeners.camera=function(){e.scheduleRender()},this.camera.on("updated",this.activeListeners.camera),this}},{key:"unbindCameraHandlers",value:function(){return this.camera.removeListener("updated",this.activeListeners.camera),this}},{key:"getNodeAtPosition",value:function(e){var t=e.x,a=e.y,r=ge(this.webGLContexts.nodes,this.frameBuffers.nodes,t,a,this.pixelRatio,this.pickingDownSizingRatio),o=ve.apply(void 0,Ee(r)),h=this.itemIDsIndex[o];return h&&h.type==="node"?h.id:null}},{key:"bindEventHandlers",value:function(){var e=this;this.activeListeners.handleResize=function(){e.scheduleRefresh()},window.addEventListener("resize",this.activeListeners.handleResize),this.activeListeners.handleMove=function(a){var r=K(a),o={event:r,preventSigmaDefault:function(){r.preventSigmaDefault()}},h=e.getNodeAtPosition(r);if(h&&e.hoveredNode!==h&&!e.nodeDataCache[h].hidden){e.hoveredNode&&e.emit("leaveNode",v(v({},o),{},{node:e.hoveredNode})),e.hoveredNode=h,e.emit("enterNode",v(v({},o),{},{node:h})),e.scheduleHighlightedNodesRender();return}if(e.hoveredNode&&e.getNodeAtPosition(r)!==e.hoveredNode){var d=e.hoveredNode;e.hoveredNode=null,e.emit("leaveNode",v(v({},o),{},{node:d})),e.scheduleHighlightedNodesRender();return}if(e.settings.enableEdgeEvents){var l=e.hoveredNode?null:e.getEdgeAtPoint(o.event.x,o.event.y);l!==e.hoveredEdge&&(e.hoveredEdge&&e.emit("leaveEdge",v(v({},o),{},{edge:e.hoveredEdge})),l&&e.emit("enterEdge",v(v({},o),{},{edge:l})),e.hoveredEdge=l)}},this.activeListeners.handleMoveBody=function(a){var r=K(a);e.emit("moveBody",{event:r,preventSigmaDefault:function(){r.preventSigmaDefault()}})},this.activeListeners.handleLeave=function(a){var r=K(a),o={event:r,preventSigmaDefault:function(){r.preventSigmaDefault()}};e.hoveredNode&&(e.emit("leaveNode",v(v({},o),{},{node:e.hoveredNode})),e.scheduleHighlightedNodesRender()),e.settings.enableEdgeEvents&&e.hoveredEdge&&(e.emit("leaveEdge",v(v({},o),{},{edge:e.hoveredEdge})),e.scheduleHighlightedNodesRender()),e.emit("leaveStage",v({},o))},this.activeListeners.handleEnter=function(a){var r=K(a),o={event:r,preventSigmaDefault:function(){r.preventSigmaDefault()}};e.emit("enterStage",v({},o))};var t=function(r){return function(o){var h=K(o),d={event:h,preventSigmaDefault:function(){h.preventSigmaDefault()}},l=e.getNodeAtPosition(h);if(l)return e.emit("".concat(r,"Node"),v(v({},d),{},{node:l}));if(e.settings.enableEdgeEvents){var u=e.getEdgeAtPoint(h.x,h.y);if(u)return e.emit("".concat(r,"Edge"),v(v({},d),{},{edge:u}))}return e.emit("".concat(r,"Stage"),d)}};return this.activeListeners.handleClick=t("click"),this.activeListeners.handleRightClick=t("rightClick"),this.activeListeners.handleDoubleClick=t("doubleClick"),this.activeListeners.handleWheel=t("wheel"),this.activeListeners.handleDown=t("down"),this.activeListeners.handleUp=t("up"),this.mouseCaptor.on("mousemove",this.activeListeners.handleMove),this.mouseCaptor.on("mousemovebody",this.activeListeners.handleMoveBody),this.mouseCaptor.on("click",this.activeListeners.handleClick),this.mouseCaptor.on("rightClick",this.activeListeners.handleRightClick),this.mouseCaptor.on("doubleClick",this.activeListeners.handleDoubleClick),this.mouseCaptor.on("wheel",this.activeListeners.handleWheel),this.mouseCaptor.on("mousedown",this.activeListeners.handleDown),this.mouseCaptor.on("mouseup",this.activeListeners.handleUp),this.mouseCaptor.on("mouseleave",this.activeListeners.handleLeave),this.mouseCaptor.on("mouseenter",this.activeListeners.handleEnter),this.touchCaptor.on("touchdown",this.activeListeners.handleDown),this.touchCaptor.on("touchdown",this.activeListeners.handleMove),this.touchCaptor.on("touchup",this.activeListeners.handleUp),this.touchCaptor.on("touchmove",this.activeListeners.handleMove),this.touchCaptor.on("tap",this.activeListeners.handleClick),this.touchCaptor.on("doubletap",this.activeListeners.handleDoubleClick),this.touchCaptor.on("touchmove",this.activeListeners.handleMoveBody),this}},{key:"bindGraphHandlers",value:function(){var e=this,t=this.graph,a=new Set(["x","y","zIndex","type"]);return this.activeListeners.eachNodeAttributesUpdatedGraphUpdate=function(r){var o,h=(o=r.hints)===null||o===void 0?void 0:o.attributes;e.graph.forEachNode(function(l){return e.updateNode(l)});var d=!h||h.some(function(l){return a.has(l)});e.refresh({partialGraph:{nodes:t.nodes()},skipIndexation:!d,schedule:!0})},this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate=function(r){var o,h=(o=r.hints)===null||o===void 0?void 0:o.attributes;e.graph.forEachEdge(function(l){return e.updateEdge(l)});var d=h&&["zIndex","type"].some(function(l){return h==null?void 0:h.includes(l)});e.refresh({partialGraph:{edges:t.edges()},skipIndexation:!d,schedule:!0})},this.activeListeners.addNodeGraphUpdate=function(r){var o=r.key;e.addNode(o),e.refresh({partialGraph:{nodes:[o]},skipIndexation:!1,schedule:!0})},this.activeListeners.updateNodeGraphUpdate=function(r){var o=r.key;e.refresh({partialGraph:{nodes:[o]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropNodeGraphUpdate=function(r){var o=r.key;e.removeNode(o),e.refresh({schedule:!0})},this.activeListeners.addEdgeGraphUpdate=function(r){var o=r.key;e.addEdge(o),e.refresh({partialGraph:{edges:[o]},schedule:!0})},this.activeListeners.updateEdgeGraphUpdate=function(r){var o=r.key;e.refresh({partialGraph:{edges:[o]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropEdgeGraphUpdate=function(r){var o=r.key;e.removeEdge(o),e.refresh({schedule:!0})},this.activeListeners.clearEdgesGraphUpdate=function(){e.clearEdgeState(),e.clearEdgeIndices(),e.refresh({schedule:!0})},this.activeListeners.clearGraphUpdate=function(){e.clearEdgeState(),e.clearNodeState(),e.clearEdgeIndices(),e.clearNodeIndices(),e.refresh({schedule:!0})},t.on("nodeAdded",this.activeListeners.addNodeGraphUpdate),t.on("nodeDropped",this.activeListeners.dropNodeGraphUpdate),t.on("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),t.on("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),t.on("edgeAdded",this.activeListeners.addEdgeGraphUpdate),t.on("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),t.on("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),t.on("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),t.on("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),t.on("cleared",this.activeListeners.clearGraphUpdate),this}},{key:"unbindGraphHandlers",value:function(){var e=this.graph;e.removeListener("nodeAdded",this.activeListeners.addNodeGraphUpdate),e.removeListener("nodeDropped",this.activeListeners.dropNodeGraphUpdate),e.removeListener("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),e.removeListener("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),e.removeListener("edgeAdded",this.activeListeners.addEdgeGraphUpdate),e.removeListener("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),e.removeListener("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),e.removeListener("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),e.removeListener("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),e.removeListener("cleared",this.activeListeners.clearGraphUpdate)}},{key:"getEdgeAtPoint",value:function(e,t){var a=ge(this.webGLContexts.edges,this.frameBuffers.edges,e,t,this.pixelRatio,this.pickingDownSizingRatio),r=ve.apply(void 0,Ee(a)),o=this.itemIDsIndex[r];return o&&o.type==="edge"?o.id:null}},{key:"process",value:function(){var e=this;this.emit("beforeProcess");var t=this.graph,a=this.settings,r=this.getDimensions();if(this.nodeExtent=et(this.graph),!this.settings.autoRescale){var o=r.width,h=r.height,d=this.nodeExtent,l=d.x,u=d.y;this.nodeExtent={x:[(l[0]+l[1])/2-o/2,(l[0]+l[1])/2+o/2],y:[(u[0]+u[1])/2-h/2,(u[0]+u[1])/2+h/2]}}this.normalizationFunction=be(this.customBBox||this.nodeExtent);var g=new Ce,f=X(g.getState(),r,this.getGraphDimensions(),this.getStagePadding());this.labelGrid.resizeAndClear(r,a.labelGridCellSize);for(var m={},p={},y={},E={},b=1,x=t.nodes(),C=0,I=x.length;C<I;C++){var A=x[C],w=this.nodeDataCache[A],k=t.getNodeAttributes(A);w.x=k.x,w.y=k.y,this.normalizationFunction.applyTo(w),typeof w.label=="string"&&!w.hidden&&this.labelGrid.add(A,w.size,this.framedGraphToViewport(w,{matrix:f})),m[w.type]=(m[w.type]||0)+1}this.labelGrid.organize();for(var T in this.nodePrograms){if(!z.call(this.nodePrograms,T))throw new Error('Sigma: could not find a suitable program for node type "'.concat(T,'"!'));this.nodePrograms[T].reallocate(m[T]||0),m[T]=0}this.settings.zIndex&&this.nodeZExtent[0]!==this.nodeZExtent[1]&&(x=ye(this.nodeZExtent,function(re){return e.nodeDataCache[re].zIndex},x));for(var L=0,D=x.length;L<D;L++){var S=x[L];p[S]=b,E[p[S]]={type:"node",id:S},b++;var _=this.nodeDataCache[S];this.addNodeToProgram(S,p[S],m[_.type]++)}for(var P={},R=t.edges(),U=0,$=R.length;U<$;U++){var q=R[U],V=this.edgeDataCache[q];P[V.type]=(P[V.type]||0)+1}this.settings.zIndex&&this.edgeZExtent[0]!==this.edgeZExtent[1]&&(R=ye(this.edgeZExtent,function(re){return e.edgeDataCache[re].zIndex},R));for(var H in this.edgePrograms){if(!z.call(this.edgePrograms,H))throw new Error('Sigma: could not find a suitable program for edge type "'.concat(H,'"!'));this.edgePrograms[H].reallocate(P[H]||0),P[H]=0}for(var B=0,ae=R.length;B<ae;B++){var G=R[B];y[G]=b,E[y[G]]={type:"edge",id:G},b++;var ke=this.edgeDataCache[G];this.addEdgeToProgram(G,y[G],P[ke.type]++)}return this.itemIDsIndex=E,this.nodeIndices=p,this.edgeIndices=y,this.emit("afterProcess"),this}},{key:"handleSettingsUpdate",value:function(e){var t=this,a=this.settings;if(this.camera.minRatio=a.minCameraRatio,this.camera.maxRatio=a.maxCameraRatio,this.camera.enabledZooming=a.enableCameraZooming,this.camera.enabledPanning=a.enableCameraPanning,this.camera.enabledRotation=a.enableCameraRotation,a.cameraPanBoundaries?this.camera.clean=function(l){return t.cleanCameraState(l,a.cameraPanBoundaries&&le(a.cameraPanBoundaries)==="object"?a.cameraPanBoundaries:{})}:this.camera.clean=null,this.camera.setState(this.camera.validateState(this.camera.getState())),e){if(e.edgeProgramClasses!==a.edgeProgramClasses){for(var r in a.edgeProgramClasses)a.edgeProgramClasses[r]!==e.edgeProgramClasses[r]&&this.registerEdgeProgram(r,a.edgeProgramClasses[r]);for(var o in e.edgeProgramClasses)a.edgeProgramClasses[o]||this.unregisterEdgeProgram(o)}if(e.nodeProgramClasses!==a.nodeProgramClasses||e.nodeHoverProgramClasses!==a.nodeHoverProgramClasses){for(var h in a.nodeProgramClasses)(a.nodeProgramClasses[h]!==e.nodeProgramClasses[h]||a.nodeHoverProgramClasses[h]!==e.nodeHoverProgramClasses[h])&&this.registerNodeProgram(h,a.nodeProgramClasses[h],a.nodeHoverProgramClasses[h]);for(var d in e.nodeProgramClasses)a.nodeProgramClasses[d]||this.unregisterNodeProgram(d)}}return this.mouseCaptor.setSettings(this.settings),this.touchCaptor.setSettings(this.settings),this}},{key:"cleanCameraState",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=t.tolerance,r=a===void 0?0:a,o=t.boundaries,h=v({},e),d=o||this.nodeExtent,l=Q(d.x,2),u=l[0],g=l[1],f=Q(d.y,2),m=f[0],p=f[1],y=[this.graphToViewport({x:u,y:m},{cameraState:e}),this.graphToViewport({x:g,y:m},{cameraState:e}),this.graphToViewport({x:u,y:p},{cameraState:e}),this.graphToViewport({x:g,y:p},{cameraState:e})],E=1/0,b=-1/0,x=1/0,C=-1/0;y.forEach(function(P){var R=P.x,U=P.y;E=Math.min(E,R),b=Math.max(b,R),x=Math.min(x,U),C=Math.max(C,U)});var I=b-E,A=C-x,w=this.getDimensions(),k=w.width,T=w.height,L=0,D=0;if(I>=k?b<k-r?L=b-(k-r):E>r&&(L=E-r):b>k+r?L=b-(k+r):E<-r&&(L=E+r),A>=T?C<T-r?D=C-(T-r):x>r&&(D=x-r):C>T+r?D=C-(T+r):x<-r&&(D=x+r),L||D){var S=this.viewportToFramedGraph({x:0,y:0},{cameraState:e}),_=this.viewportToFramedGraph({x:L,y:D},{cameraState:e});L=_.x-S.x,D=_.y-S.y,h.x+=L,h.y+=D}return h}},{key:"renderLabels",value:function(){if(!this.settings.renderLabels)return this;var e=this.camera.getState(),t=this.labelGrid.getLabelsToDisplay(e.ratio,this.settings.labelDensity);xe(t,this.nodesWithForcedLabels),this.displayedNodeLabels=new Set;for(var a=this.canvasContexts.labels,r=0,o=t.length;r<o;r++){var h=t[r],d=this.nodeDataCache[h];if(!this.displayedNodeLabels.has(h)&&!d.hidden){var l=this.framedGraphToViewport(d),u=l.x,g=l.y,f=this.scaleSize(d.size);if(!(!d.forceLabel&&f<this.settings.labelRenderedSizeThreshold)&&!(u<-Se||u>this.width+Se||g<-Pe||g>this.height+Pe)){this.displayedNodeLabels.add(h);var m=this.settings.defaultDrawNodeLabel,p=this.nodePrograms[d.type],y=(p==null?void 0:p.drawLabel)||m;y(a,v(v({key:h},d),{},{size:f,x:u,y:g}),this.settings)}}}return this}},{key:"renderEdgeLabels",value:function(){if(!this.settings.renderEdgeLabels)return this;var e=this.canvasContexts.edgeLabels;e.clearRect(0,0,this.width,this.height);var t=yt({graph:this.graph,hoveredNode:this.hoveredNode,displayedNodeLabels:this.displayedNodeLabels,highlightedNodes:this.highlightedNodes});xe(t,this.edgesWithForcedLabels);for(var a=new Set,r=0,o=t.length;r<o;r++){var h=t[r],d=this.graph.extremities(h),l=this.nodeDataCache[d[0]],u=this.nodeDataCache[d[1]],g=this.edgeDataCache[h];if(!a.has(h)&&!(g.hidden||l.hidden||u.hidden)){var f=this.settings.defaultDrawEdgeLabel,m=this.edgePrograms[g.type],p=(m==null?void 0:m.drawLabel)||f;p(e,v(v({key:h},g),{},{size:this.scaleSize(g.size)}),v(v(v({key:d[0]},l),this.framedGraphToViewport(l)),{},{size:this.scaleSize(l.size)}),v(v(v({key:d[1]},u),this.framedGraphToViewport(u)),{},{size:this.scaleSize(u.size)}),this.settings),a.add(h)}}return this.displayedEdgeLabels=a,this}},{key:"renderHighlightedNodes",value:function(){var e=this,t=this.canvasContexts.hovers;t.clearRect(0,0,this.width,this.height);var a=function(f){var m=e.nodeDataCache[f],p=e.framedGraphToViewport(m),y=p.x,E=p.y,b=e.scaleSize(m.size),x=e.settings.defaultDrawNodeHover,C=e.nodePrograms[m.type],I=(C==null?void 0:C.drawHover)||x;I(t,v(v({key:f},m),{},{size:b,x:y,y:E}),e.settings)},r=[];this.hoveredNode&&!this.nodeDataCache[this.hoveredNode].hidden&&r.push(this.hoveredNode),this.highlightedNodes.forEach(function(g){g!==e.hoveredNode&&r.push(g)}),r.forEach(function(g){return a(g)});var o={};r.forEach(function(g){var f=e.nodeDataCache[g].type;o[f]=(o[f]||0)+1});for(var h in this.nodeHoverPrograms)this.nodeHoverPrograms[h].reallocate(o[h]||0),o[h]=0;r.forEach(function(g){var f=e.nodeDataCache[g];e.nodeHoverPrograms[f.type].process(0,o[f.type]++,f)}),this.webGLContexts.hoverNodes.clear(this.webGLContexts.hoverNodes.COLOR_BUFFER_BIT);var d=this.getRenderParams();for(var l in this.nodeHoverPrograms){var u=this.nodeHoverPrograms[l];u.render(d)}}},{key:"scheduleHighlightedNodesRender",value:function(){var e=this;this.renderHighlightedNodesFrame||this.renderFrame||(this.renderHighlightedNodesFrame=requestAnimationFrame(function(){e.renderHighlightedNodesFrame=null,e.renderHighlightedNodes(),e.renderEdgeLabels()}))}},{key:"render",value:function(){var e=this;this.emit("beforeRender");var t=function(){return e.emit("afterRender"),e};if(this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.resize(),this.needToProcess&&this.process(),this.needToProcess=!1,this.clear(),this.pickingLayers.forEach(function(y){return e.resetWebGLTexture(y)}),!this.graph.order)return t();var a=this.mouseCaptor,r=this.camera.isAnimated()||a.isMoving||a.draggedEvents||a.currentWheelDirection,o=this.camera.getState(),h=this.getDimensions(),d=this.getGraphDimensions(),l=this.getStagePadding();this.matrix=X(o,h,d,l),this.invMatrix=X(o,h,d,l,!0),this.correctionRatio=$e(this.matrix,o,h),this.graphToViewportRatio=this.getGraphToViewportRatio();var u=this.getRenderParams();for(var g in this.nodePrograms){var f=this.nodePrograms[g];f.render(u)}if(!this.settings.hideEdgesOnMove||!r)for(var m in this.edgePrograms){var p=this.edgePrograms[m];p.render(u)}return this.settings.hideLabelsOnMove&&r||(this.renderLabels(),this.renderEdgeLabels(),this.renderHighlightedNodes()),t()}},{key:"addNode",value:function(e){var t=Object.assign({},this.graph.getNodeAttributes(e));this.settings.nodeReducer&&(t=this.settings.nodeReducer(e,t));var a=bt(this.settings,e,t);this.nodeDataCache[e]=a,this.nodesWithForcedLabels.delete(e),a.forceLabel&&!a.hidden&&this.nodesWithForcedLabels.add(e),this.highlightedNodes.delete(e),a.highlighted&&!a.hidden&&this.highlightedNodes.add(e),this.settings.zIndex&&(a.zIndex<this.nodeZExtent[0]&&(this.nodeZExtent[0]=a.zIndex),a.zIndex>this.nodeZExtent[1]&&(this.nodeZExtent[1]=a.zIndex))}},{key:"updateNode",value:function(e){this.addNode(e);var t=this.nodeDataCache[e];this.normalizationFunction.applyTo(t)}},{key:"removeNode",value:function(e){delete this.nodeDataCache[e],delete this.nodeProgramIndex[e],this.highlightedNodes.delete(e),this.hoveredNode===e&&(this.hoveredNode=null),this.nodesWithForcedLabels.delete(e)}},{key:"addEdge",value:function(e){var t=Object.assign({},this.graph.getEdgeAttributes(e));this.settings.edgeReducer&&(t=this.settings.edgeReducer(e,t));var a=xt(this.settings,e,t);this.edgeDataCache[e]=a,this.edgesWithForcedLabels.delete(e),a.forceLabel&&!a.hidden&&this.edgesWithForcedLabels.add(e),this.settings.zIndex&&(a.zIndex<this.edgeZExtent[0]&&(this.edgeZExtent[0]=a.zIndex),a.zIndex>this.edgeZExtent[1]&&(this.edgeZExtent[1]=a.zIndex))}},{key:"updateEdge",value:function(e){this.addEdge(e)}},{key:"removeEdge",value:function(e){delete this.edgeDataCache[e],delete this.edgeProgramIndex[e],this.hoveredEdge===e&&(this.hoveredEdge=null),this.edgesWithForcedLabels.delete(e)}},{key:"clearNodeIndices",value:function(){this.labelGrid=new Le,this.nodeExtent={x:[0,1],y:[0,1]},this.nodeDataCache={},this.edgeProgramIndex={},this.nodesWithForcedLabels=new Set,this.nodeZExtent=[1/0,-1/0],this.highlightedNodes=new Set}},{key:"clearEdgeIndices",value:function(){this.edgeDataCache={},this.edgeProgramIndex={},this.edgesWithForcedLabels=new Set,this.edgeZExtent=[1/0,-1/0]}},{key:"clearIndices",value:function(){this.clearEdgeIndices(),this.clearNodeIndices()}},{key:"clearNodeState",value:function(){this.displayedNodeLabels=new Set,this.highlightedNodes=new Set,this.hoveredNode=null}},{key:"clearEdgeState",value:function(){this.displayedEdgeLabels=new Set,this.highlightedNodes=new Set,this.hoveredEdge=null}},{key:"clearState",value:function(){this.clearEdgeState(),this.clearNodeState()}},{key:"addNodeToProgram",value:function(e,t,a){var r=this.nodeDataCache[e],o=this.nodePrograms[r.type];if(!o)throw new Error('Sigma: could not find a suitable program for node type "'.concat(r.type,'"!'));o.process(t,a,r),this.nodeProgramIndex[e]=a}},{key:"addEdgeToProgram",value:function(e,t,a){var r=this.edgeDataCache[e],o=this.edgePrograms[r.type];if(!o)throw new Error('Sigma: could not find a suitable program for edge type "'.concat(r.type,'"!'));var h=this.graph.extremities(e),d=this.nodeDataCache[h[0]],l=this.nodeDataCache[h[1]];o.process(t,a,d,l,r),this.edgeProgramIndex[e]=a}},{key:"getRenderParams",value:function(){return{matrix:this.matrix,invMatrix:this.invMatrix,width:this.width,height:this.height,pixelRatio:this.pixelRatio,zoomRatio:this.camera.ratio,cameraAngle:this.camera.angle,sizeRatio:1/this.scaleSize(),correctionRatio:this.correctionRatio,downSizingRatio:this.pickingDownSizingRatio,minEdgeThickness:this.settings.minEdgeThickness,antiAliasingFeather:this.settings.antiAliasingFeather}}},{key:"getStagePadding",value:function(){var e=this.settings,t=e.stagePadding,a=e.autoRescale;return a&&t||0}},{key:"createLayer",value:function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.elements[e])throw new Error('Sigma: a layer named "'.concat(e,'" already exists'));var r=it(t,{position:"absolute"},{class:"sigma-".concat(e)});return a.style&&Object.assign(r.style,a.style),this.elements[e]=r,"beforeLayer"in a&&a.beforeLayer?this.elements[a.beforeLayer].before(r):"afterLayer"in a&&a.afterLayer?this.elements[a.afterLayer].after(r):this.container.appendChild(r),r}},{key:"createCanvas",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.createLayer(e,"canvas",t)}},{key:"createCanvasContext",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=this.createCanvas(e,t),r={preserveDrawingBuffer:!1,antialias:!1};return this.canvasContexts[e]=a.getContext("2d",r),this}},{key:"createWebGLContext",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=(t==null?void 0:t.canvas)||this.createCanvas(e,t);t.hidden&&a.remove();var r=v({preserveDrawingBuffer:!1,antialias:!1},t),o;o=a.getContext("webgl2",r),o||(o=a.getContext("webgl",r)),o||(o=a.getContext("experimental-webgl",r));var h=o;if(this.webGLContexts[e]=h,h.blendFunc(h.ONE,h.ONE_MINUS_SRC_ALPHA),t.picking){this.pickingLayers.add(e);var d=h.createFramebuffer();if(!d)throw new Error("Sigma: cannot create a new frame buffer for layer ".concat(e));this.frameBuffers[e]=d}return h}},{key:"killLayer",value:function(e){var t=this.elements[e];if(!t)throw new Error("Sigma: cannot kill layer ".concat(e,", which does not exist"));if(this.webGLContexts[e]){var a,r=this.webGLContexts[e];(a=r.getExtension("WEBGL_lose_context"))===null||a===void 0||a.loseContext(),delete this.webGLContexts[e]}else this.canvasContexts[e]&&delete this.canvasContexts[e];return t.remove(),delete this.elements[e],this}},{key:"getCamera",value:function(){return this.camera}},{key:"setCamera",value:function(e){this.unbindCameraHandlers(),this.camera=e,this.bindCameraHandlers()}},{key:"getContainer",value:function(){return this.container}},{key:"getGraph",value:function(){return this.graph}},{key:"setGraph",value:function(e){e!==this.graph&&(this.hoveredNode&&!e.hasNode(this.hoveredNode)&&(this.hoveredNode=null),this.hoveredEdge&&!e.hasEdge(this.hoveredEdge)&&(this.hoveredEdge=null),this.unbindGraphHandlers(),this.checkEdgesEventsFrame!==null&&(cancelAnimationFrame(this.checkEdgesEventsFrame),this.checkEdgesEventsFrame=null),this.graph=e,this.bindGraphHandlers(),this.refresh())}},{key:"getMouseCaptor",value:function(){return this.mouseCaptor}},{key:"getTouchCaptor",value:function(){return this.touchCaptor}},{key:"getDimensions",value:function(){return{width:this.width,height:this.height}}},{key:"getGraphDimensions",value:function(){var e=this.customBBox||this.nodeExtent;return{width:e.x[1]-e.x[0]||1,height:e.y[1]-e.y[0]||1}}},{key:"getNodeDisplayData",value:function(e){var t=this.nodeDataCache[e];return t?Object.assign({},t):void 0}},{key:"getEdgeDisplayData",value:function(e){var t=this.edgeDataCache[e];return t?Object.assign({},t):void 0}},{key:"getNodeDisplayedLabels",value:function(){return new Set(this.displayedNodeLabels)}},{key:"getEdgeDisplayedLabels",value:function(){return new Set(this.displayedEdgeLabels)}},{key:"getSettings",value:function(){return v({},this.settings)}},{key:"getSetting",value:function(e){return this.settings[e]}},{key:"setSetting",value:function(e,t){var a=v({},this.settings);return this.settings[e]=t,oe(this.settings),this.handleSettingsUpdate(a),this.scheduleRefresh(),this}},{key:"updateSetting",value:function(e,t){return this.setSetting(e,t(this.settings[e])),this}},{key:"setSettings",value:function(e){var t=v({},this.settings);return this.settings=v(v({},this.settings),e),oe(this.settings),this.handleSettingsUpdate(t),this.scheduleRefresh(),this}},{key:"resize",value:function(e){var t=this.width,a=this.height;if(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,this.pixelRatio=pe(),this.width===0)if(this.settings.allowInvalidContainer)this.width=1;else throw new Error("Sigma: Container has no width. You can set the allowInvalidContainer setting to true to stop seeing this error.");if(this.height===0)if(this.settings.allowInvalidContainer)this.height=1;else throw new Error("Sigma: Container has no height. You can set the allowInvalidContainer setting to true to stop seeing this error.");if(!e&&t===this.width&&a===this.height)return this;for(var r in this.elements){var o=this.elements[r];o.style.width=this.width+"px",o.style.height=this.height+"px"}for(var h in this.canvasContexts)this.elements[h].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[h].setAttribute("height",this.height*this.pixelRatio+"px"),this.pixelRatio!==1&&this.canvasContexts[h].scale(this.pixelRatio,this.pixelRatio);for(var d in this.webGLContexts){this.elements[d].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[d].setAttribute("height",this.height*this.pixelRatio+"px");var l=this.webGLContexts[d];if(l.viewport(0,0,this.width*this.pixelRatio,this.height*this.pixelRatio),this.pickingLayers.has(d)){var u=this.textures[d];u&&l.deleteTexture(u)}}return this.emit("resize"),this}},{key:"clear",value:function(){return this.emit("beforeClear"),this.webGLContexts.nodes.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.nodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.edges.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.edges.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.hoverNodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.canvasContexts.labels.clearRect(0,0,this.width,this.height),this.canvasContexts.hovers.clearRect(0,0,this.width,this.height),this.canvasContexts.edgeLabels.clearRect(0,0,this.width,this.height),this.emit("afterClear"),this}},{key:"refresh",value:function(e){var t=this,a=(e==null?void 0:e.skipIndexation)!==void 0?e==null?void 0:e.skipIndexation:!1,r=(e==null?void 0:e.schedule)!==void 0?e.schedule:!1,o=!e||!e.partialGraph;if(o)this.clearEdgeIndices(),this.clearNodeIndices(),this.graph.forEachNode(function(C){return t.addNode(C)}),this.graph.forEachEdge(function(C){return t.addEdge(C)});else{for(var h,d,l=((h=e.partialGraph)===null||h===void 0?void 0:h.nodes)||[],u=0,g=(l==null?void 0:l.length)||0;u<g;u++){var f=l[u];if(this.updateNode(f),a){var m=this.nodeProgramIndex[f];if(m===void 0)throw new Error('Sigma: node "'.concat(f,`" can't be repaint`));this.addNodeToProgram(f,this.nodeIndices[f],m)}}for(var p=(e==null||(d=e.partialGraph)===null||d===void 0?void 0:d.edges)||[],y=0,E=p.length;y<E;y++){var b=p[y];if(this.updateEdge(b),a){var x=this.edgeProgramIndex[b];if(x===void 0)throw new Error('Sigma: edge "'.concat(b,`" can't be repaint`));this.addEdgeToProgram(b,this.edgeIndices[b],x)}}}return(o||!a)&&(this.needToProcess=!0),r?this.scheduleRender():this.render(),this}},{key:"scheduleRender",value:function(){var e=this;return this.renderFrame||(this.renderFrame=requestAnimationFrame(function(){e.render()})),this}},{key:"scheduleRefresh",value:function(e){return this.refresh(v(v({},e),{},{schedule:!0}))}},{key:"getViewportZoomedState",value:function(e,t){var a=this.camera.getState(),r=a.ratio,o=a.angle,h=a.x,d=a.y,l=this.settings,u=l.minCameraRatio,g=l.maxCameraRatio;typeof g=="number"&&(t=Math.min(t,g)),typeof u=="number"&&(t=Math.max(t,u));var f=t/r,m={x:this.width/2,y:this.height/2},p=this.viewportToFramedGraph(e),y=this.viewportToFramedGraph(m);return{angle:o,x:(p.x-y.x)*(1-f)+h,y:(p.y-y.y)*(1-f)+d,ratio:t}}},{key:"viewRectangle",value:function(){var e=this.viewportToFramedGraph({x:0,y:0}),t=this.viewportToFramedGraph({x:this.width,y:0}),a=this.viewportToFramedGraph({x:0,y:this.height});return{x1:e.x,y1:e.y,x2:t.x,y2:t.y,height:t.y-a.y}}},{key:"framedGraphToViewport",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=!!t.cameraState||!!t.viewportDimensions||!!t.graphDimensions,r=t.matrix?t.matrix:a?X(t.cameraState||this.camera.getState(),t.viewportDimensions||this.getDimensions(),t.graphDimensions||this.getGraphDimensions(),t.padding||this.getStagePadding()):this.matrix,o=de(r,e);return{x:(1+o.x)*this.width/2,y:(1-o.y)*this.height/2}}},{key:"viewportToFramedGraph",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=!!t.cameraState||!!t.viewportDimensions||!t.graphDimensions,r=t.matrix?t.matrix:a?X(t.cameraState||this.camera.getState(),t.viewportDimensions||this.getDimensions(),t.graphDimensions||this.getGraphDimensions(),t.padding||this.getStagePadding(),!0):this.invMatrix,o=de(r,{x:e.x/this.width*2-1,y:1-e.y/this.height*2});return isNaN(o.x)&&(o.x=0),isNaN(o.y)&&(o.y=0),o}},{key:"viewportToGraph",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.normalizationFunction.inverse(this.viewportToFramedGraph(e,t))}},{key:"graphToViewport",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.framedGraphToViewport(this.normalizationFunction(e),t)}},{key:"getGraphToViewportRatio",value:function(){var e={x:0,y:0},t={x:1,y:1},a=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),r=this.graphToViewport(e),o=this.graphToViewport(t),h=Math.sqrt(Math.pow(r.x-o.x,2)+Math.pow(r.y-o.y,2));return h/a}},{key:"getBBox",value:function(){return this.nodeExtent}},{key:"getCustomBBox",value:function(){return this.customBBox}},{key:"setCustomBBox",value:function(e){return this.customBBox=e,this.scheduleRender(),this}},{key:"kill",value:function(){this.emit("kill"),this.removeAllListeners(),this.unbindCameraHandlers(),window.removeEventListener("resize",this.activeListeners.handleResize),this.mouseCaptor.kill(),this.touchCaptor.kill(),this.unbindGraphHandlers(),this.clearIndices(),this.clearState(),this.nodeDataCache={},this.edgeDataCache={},this.highlightedNodes.clear(),this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.renderHighlightedNodesFrame&&(cancelAnimationFrame(this.renderHighlightedNodesFrame),this.renderHighlightedNodesFrame=null);for(var e=this.container;e.firstChild;)e.removeChild(e.firstChild);for(var t in this.nodePrograms)this.nodePrograms[t].kill();for(var a in this.nodeHoverPrograms)this.nodeHoverPrograms[a].kill();for(var r in this.edgePrograms)this.edgePrograms[r].kill();this.nodePrograms={},this.nodeHoverPrograms={},this.edgePrograms={};for(var o in this.elements)this.killLayer(o);this.canvasContexts={},this.webGLContexts={},this.elements={}}},{key:"scaleSize",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.camera.ratio;return e/this.settings.zoomToSizeRatioFunction(t)*(this.getSetting("itemSizesReference")==="positions"?t*this.graphToViewportRatio:1)}},{key:"getCanvases",value:function(){var e={};for(var t in this.elements)this.elements[t]instanceof HTMLCanvasElement&&(e[t]=this.elements[t]);return e}}])})(ue),Lt=Ct;export{Ce as Camera,lt as MouseCaptor,Ct as Sigma,gt as TouchCaptor,Lt as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.
|
|
2
|
-
var q=e=>{throw TypeError(e)};var G=(e,t,r)=>t.has(e)||q("Cannot "+r);var i=(e,t,r)=>(G(e,t,"read from private field"),r?r.call(e):t.get(e)),L=(e,t,r)=>t.has(e)?q("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),A=(e,t,r,n)=>(G(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);import{p as D,c as I,b as T,_ as o}from"../chunks/BRIMmWzq.js";import{bm as y,L as Q,at as l,as as U,af as W,b0 as X,b9 as Z,bP as $,bO as tt,bH as et,aq as R,bw as rt,b6 as at,bz as V,a6 as st,bg as ot,bG as it,bN as w}from"../chunks/CGFL56WJ.js";import{m as nt,p as _t,x as mt,a as b,e as x,k as M,w as ct,u as ut}from"../chunks/DN7v3Tar.js";import"../chunks/Bzak7iHL.js";import{a as lt}from"../chunks/Btd6PFkC.js";import{i as k}from"../chunks/DCJ0QyYH.js";function dt(e){return class extends ft{constructor(t){super({component:e,...t})}}}var d,m;class ft{constructor(t){L(this,d);L(this,m);var E;var r=new Map,n=(a,s)=>{var f=X(s,!1,!1);return r.set(a,f),f};const u=new Proxy({...t.props||{},$$events:{}},{get(a,s){return l(r.get(s)??n(s,Reflect.get(a,s)))},has(a,s){return s===Q?!0:(l(r.get(s)??n(s,Reflect.get(a,s))),Reflect.has(a,s))},set(a,s,f){return y(r.get(s)??n(s,f),f),Reflect.set(a,s,f)}});A(this,m,(t.hydrate?nt:_t)(t.component,{target:t.target,anchor:t.anchor,props:u,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError})),(!((E=t==null?void 0:t.props)!=null&&E.$$host)||t.sync===!1)&&U(),A(this,d,u.$$events);for(const a of Object.keys(i(this,m)))a==="$set"||a==="$destroy"||a==="$on"||W(this,a,{get(){return i(this,m)[a]},set(s){i(this,m)[a]=s},enumerable:!0});i(this,m).$set=a=>{Object.assign(u,a)},i(this,m).$destroy=()=>{mt(i(this,m))}}$set(t){i(this,m).$set(t)}$on(t,r){i(this,d)[t]=i(this,d)[t]||[];const n=(...u)=>r.call(this,...u);return i(this,d)[t].push(n),()=>{i(this,d)[t]=i(this,d)[t].filter(u=>u!==n)}}$destroy(){i(this,m).$destroy()}}d=new WeakMap,m=new WeakMap;const Dt={};var vt=M('<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>'),ht=M("<!> <!>",1);function gt(e,t){Z(t,!0);let r=D(t,"components",23,()=>[]),n=D(t,"data_0",3,null),u=D(t,"data_1",3,null);$(()=>t.stores.page.set(t.page)),tt(()=>{t.stores,t.page,t.constructors,r(),t.form,n(),u(),t.stores.page.notify()});let E=V(!1),a=V(!1),s=V(null);lt(()=>{const _=t.stores.page.subscribe(()=>{l(E)&&(y(a,!0),et().then(()=>{y(s,document.title||"untitled page",!0)}))});return y(E,!0),_});const f=w(()=>t.constructors[1]);var j=ht(),C=R(j);{var H=_=>{const v=w(()=>t.constructors[0]);var h=x(),P=R(h);I(P,()=>l(v),(g,p)=>{T(p(g,{get data(){return n()},get form(){return t.form},get params(){return t.page.params},children:(c,pt)=>{var S=x(),F=R(S);I(F,()=>l(f),(J,K)=>{T(K(J,{get data(){return u()},get form(){return t.form},get params(){return t.page.params}}),O=>r()[1]=O,()=>{var O;return(O=r())==null?void 0:O[1]})}),b(c,S)},$$slots:{default:!0}}),c=>r()[0]=c,()=>{var c;return(c=r())==null?void 0:c[0]})}),b(_,h)},N=_=>{const v=w(()=>t.constructors[0]);var h=x(),P=R(h);I(P,()=>l(v),(g,p)=>{T(p(g,{get data(){return n()},get form(){return t.form},get params(){return t.page.params}}),c=>r()[0]=c,()=>{var c;return(c=r())==null?void 0:c[0]})}),b(_,h)};k(C,_=>{t.constructors[1]?_(H):_(N,-1)})}var Y=rt(C,2);{var B=_=>{var v=vt(),h=st(v);{var P=g=>{var p=ct();it(()=>ut(p,l(s))),b(g,p)};k(h,g=>{l(a)&&g(P)})}ot(v),b(_,v)};k(Y,_=>{l(E)&&_(B)})}b(e,j),at()}const It=dt(gt),Tt=[()=>o(()=>import("../nodes/0.
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.CNfy1rZt.js","../chunks/Bzak7iHL.js","../chunks/CGFL56WJ.js","../chunks/DIeogL5L.js","../chunks/DN7v3Tar.js","../chunks/BspmDMQv.js","../chunks/69_IOA4Y.js","../chunks/BRIMmWzq.js","../chunks/DCJ0QyYH.js","../chunks/Btd6PFkC.js","../chunks/C3SGj6Qd.js","../assets/EmptyState.RXcH7ryE.css","../chunks/D4Buwe3n.js","../chunks/C_WxkIDp.js","../chunks/CgQYykwo.js","../assets/Workspace.DM2E1WiF.css","../assets/0.BR-GggVq.css","../nodes/1.DyKCxpV1.js","../nodes/2.CAG5_cGP.js","../nodes/3.CAG5_cGP.js","../nodes/4.CAG5_cGP.js","../nodes/5.CAG5_cGP.js","../nodes/6.CAG5_cGP.js","../nodes/7.CAG5_cGP.js","../nodes/8.CAG5_cGP.js","../nodes/9.CAG5_cGP.js","../nodes/10.tDyQ2Z5A.js","../chunks/DRlh90Cv.js","../chunks/BgOTHNR5.js","../nodes/11.CAG5_cGP.js","../nodes/12.CzMvqoYS.js","../nodes/13.CAG5_cGP.js","../nodes/14.CAG5_cGP.js","../nodes/15.CZWDD8kn.js","../assets/15.Dblyk0Kr.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var q=e=>{throw TypeError(e)};var G=(e,t,r)=>t.has(e)||q("Cannot "+r);var i=(e,t,r)=>(G(e,t,"read from private field"),r?r.call(e):t.get(e)),L=(e,t,r)=>t.has(e)?q("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),A=(e,t,r,n)=>(G(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);import{p as D,c as I,b as T,_ as o}from"../chunks/BRIMmWzq.js";import{bm as y,L as Q,at as l,as as U,af as W,b0 as X,b9 as Z,bP as $,bO as tt,bH as et,aq as R,bw as rt,b6 as at,bz as V,a6 as st,bg as ot,bG as it,bN as w}from"../chunks/CGFL56WJ.js";import{m as nt,p as _t,x as mt,a as b,e as x,k as M,w as ct,u as ut}from"../chunks/DN7v3Tar.js";import"../chunks/Bzak7iHL.js";import{a as lt}from"../chunks/Btd6PFkC.js";import{i as k}from"../chunks/DCJ0QyYH.js";function dt(e){return class extends ft{constructor(t){super({component:e,...t})}}}var d,m;class ft{constructor(t){L(this,d);L(this,m);var E;var r=new Map,n=(a,s)=>{var f=X(s,!1,!1);return r.set(a,f),f};const u=new Proxy({...t.props||{},$$events:{}},{get(a,s){return l(r.get(s)??n(s,Reflect.get(a,s)))},has(a,s){return s===Q?!0:(l(r.get(s)??n(s,Reflect.get(a,s))),Reflect.has(a,s))},set(a,s,f){return y(r.get(s)??n(s,f),f),Reflect.set(a,s,f)}});A(this,m,(t.hydrate?nt:_t)(t.component,{target:t.target,anchor:t.anchor,props:u,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError})),(!((E=t==null?void 0:t.props)!=null&&E.$$host)||t.sync===!1)&&U(),A(this,d,u.$$events);for(const a of Object.keys(i(this,m)))a==="$set"||a==="$destroy"||a==="$on"||W(this,a,{get(){return i(this,m)[a]},set(s){i(this,m)[a]=s},enumerable:!0});i(this,m).$set=a=>{Object.assign(u,a)},i(this,m).$destroy=()=>{mt(i(this,m))}}$set(t){i(this,m).$set(t)}$on(t,r){i(this,d)[t]=i(this,d)[t]||[];const n=(...u)=>r.call(this,...u);return i(this,d)[t].push(n),()=>{i(this,d)[t]=i(this,d)[t].filter(u=>u!==n)}}$destroy(){i(this,m).$destroy()}}d=new WeakMap,m=new WeakMap;const Dt={};var vt=M('<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>'),ht=M("<!> <!>",1);function gt(e,t){Z(t,!0);let r=D(t,"components",23,()=>[]),n=D(t,"data_0",3,null),u=D(t,"data_1",3,null);$(()=>t.stores.page.set(t.page)),tt(()=>{t.stores,t.page,t.constructors,r(),t.form,n(),u(),t.stores.page.notify()});let E=V(!1),a=V(!1),s=V(null);lt(()=>{const _=t.stores.page.subscribe(()=>{l(E)&&(y(a,!0),et().then(()=>{y(s,document.title||"untitled page",!0)}))});return y(E,!0),_});const f=w(()=>t.constructors[1]);var j=ht(),C=R(j);{var H=_=>{const v=w(()=>t.constructors[0]);var h=x(),P=R(h);I(P,()=>l(v),(g,p)=>{T(p(g,{get data(){return n()},get form(){return t.form},get params(){return t.page.params},children:(c,pt)=>{var S=x(),F=R(S);I(F,()=>l(f),(J,K)=>{T(K(J,{get data(){return u()},get form(){return t.form},get params(){return t.page.params}}),O=>r()[1]=O,()=>{var O;return(O=r())==null?void 0:O[1]})}),b(c,S)},$$slots:{default:!0}}),c=>r()[0]=c,()=>{var c;return(c=r())==null?void 0:c[0]})}),b(_,h)},N=_=>{const v=w(()=>t.constructors[0]);var h=x(),P=R(h);I(P,()=>l(v),(g,p)=>{T(p(g,{get data(){return n()},get form(){return t.form},get params(){return t.page.params}}),c=>r()[0]=c,()=>{var c;return(c=r())==null?void 0:c[0]})}),b(_,h)};k(C,_=>{t.constructors[1]?_(H):_(N,-1)})}var Y=rt(C,2);{var B=_=>{var v=vt(),h=st(v);{var P=g=>{var p=ct();it(()=>ut(p,l(s))),b(g,p)};k(h,g=>{l(a)&&g(P)})}ot(v),b(_,v)};k(Y,_=>{l(E)&&_(B)})}b(e,j),at()}const It=dt(gt),Tt=[()=>o(()=>import("../nodes/0.CNfy1rZt.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url),()=>o(()=>import("../nodes/1.DyKCxpV1.js"),__vite__mapDeps([17,1,2,3,4,13,12,9]),import.meta.url),()=>o(()=>import("../nodes/2.CAG5_cGP.js"),__vite__mapDeps([18,1,6,3]),import.meta.url),()=>o(()=>import("../nodes/3.CAG5_cGP.js"),__vite__mapDeps([19,1,6,3]),import.meta.url),()=>o(()=>import("../nodes/4.CAG5_cGP.js"),__vite__mapDeps([20,1,6,3]),import.meta.url),()=>o(()=>import("../nodes/5.CAG5_cGP.js"),__vite__mapDeps([21,1,6,3]),import.meta.url),()=>o(()=>import("../nodes/6.CAG5_cGP.js"),__vite__mapDeps([22,1,6,3]),import.meta.url),()=>o(()=>import("../nodes/7.CAG5_cGP.js"),__vite__mapDeps([23,1,6,3]),import.meta.url),()=>o(()=>import("../nodes/8.CAG5_cGP.js"),__vite__mapDeps([24,1,6,3]),import.meta.url),()=>o(()=>import("../nodes/9.CAG5_cGP.js"),__vite__mapDeps([25,1,6,3]),import.meta.url),()=>o(()=>import("../nodes/10.tDyQ2Z5A.js"),__vite__mapDeps([26,1,9,2,3,4,8,27,5,6,7,10,11,28,13,12]),import.meta.url),()=>o(()=>import("../nodes/11.CAG5_cGP.js"),__vite__mapDeps([29,1,6,3]),import.meta.url),()=>o(()=>import("../nodes/12.CzMvqoYS.js"),__vite__mapDeps([30,1,2,3,4,8,28,10]),import.meta.url),()=>o(()=>import("../nodes/13.CAG5_cGP.js"),__vite__mapDeps([31,1,6,3]),import.meta.url),()=>o(()=>import("../nodes/14.CAG5_cGP.js"),__vite__mapDeps([32,1,6,3]),import.meta.url),()=>o(()=>import("../nodes/15.CZWDD8kn.js"),__vite__mapDeps([33,1,6,3,9,2,4,28,7,8,5,10,11,14,15,27,34]),import.meta.url)],Vt=[],wt={"/":[2],"/analytics":[3],"/appearance":[4],"/ask":[5],"/cluster":[8],"/collections":[9],"/c/[collection]":[6],"/c/[collection]/p/[subpage]":[7],"/graph":[10],"/query":[11],"/redwire-ws-spike":[12],"/security":[13],"/settings":[14],"/shadow-dom-spike":[15]},z={handleError:(({error:e})=>{console.error(e)}),reroute:(()=>{}),transport:{}},Et=Object.fromEntries(Object.entries(z.transport).map(([e,t])=>[e,t.decode])),xt=Object.fromEntries(Object.entries(z.transport).map(([e,t])=>[e,t.encode])),kt=!1,jt=(e,t)=>Et[e](t);export{jt as decode,Et as decoders,wt as dictionary,xt as encoders,kt as hash,z as hooks,Dt as matchers,Tt as nodes,It as root,Vt as server_loads};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as o,s as r}from"../chunks/D4Buwe3n.js";export{o as load_css,r as start};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"../chunks/Bzak7iHL.js";import{aq as w,b3 as T,a6 as c,b2 as K,bg as d,bw as x,at as s,bG as j,bN as _,b9 as Q,b6 as U}from"../chunks/CGFL56WJ.js";import{h as V,e as y,c as X,a as p,u as
|
|
2
|
-
retry the render, or reload the window to start clean.</p></div> <p class="m-0 max-w-lg break-words font-mono text-[12px] text-accent"> </p> <!> <div class="flex items-center gap-2"><button type="button" class="inline-flex h-9 items-center gap-1.5 rounded-lg bg-accent px-3 text-[12px] font-medium text-white hover:bg-accent/90"><!> Retry render</button> <button type="button" class="inline-flex h-9 items-center gap-1.5 rounded-lg border border-line-1 bg-bg-1 px-3 text-[12px] font-medium text-fg-1 hover:bg-bg-2"><!> Reload window</button></div></div>`);function ie(e,r){function o(){typeof window<"u"&&window.location.reload()}function i(a){return a instanceof Error?a.message||a.name:String(a)}function h(a){return a instanceof Error&&a.stack?a.stack:null}var g=y(),k=w(g);X(k,{failed:(m,t=T,n=T)=>{var f=se(),R=c(f),H=c(R);
|
|
1
|
+
import"../chunks/Bzak7iHL.js";import{aq as w,b3 as T,a6 as c,b2 as K,bg as d,bw as x,at as s,bG as j,bN as _,b9 as Q,b6 as U}from"../chunks/CGFL56WJ.js";import{h as V,e as y,c as X,a as p,u as M,i as P,k as q}from"../chunks/DN7v3Tar.js";import{D as B,e as C}from"../chunks/BspmDMQv.js";import{i as G}from"../chunks/DCJ0QyYH.js";import{g as Z,b as v}from"../chunks/D4Buwe3n.js";import{p as z}from"../chunks/C_WxkIDp.js";import{R as $,t as D,p as ee,W as te}from"../chunks/CgQYykwo.js";const ae=!1,re=!1,oe="never",xe=Object.freeze(Object.defineProperty({__proto__:null,prerender:ae,ssr:re,trailingSlash:oe},Symbol.toStringTag,{value:"Module"}));var ne=q('<pre class="m-0 max-h-52 w-full max-w-2xl overflow-auto rounded-lg border border-line-1 bg-bg-1 p-3 text-left font-mono text-[11px] leading-relaxed text-fg-3"> </pre>'),se=q(`<div role="alert" class="flex h-full w-full flex-col items-center justify-center gap-5 overflow-auto bg-bg-0 px-6 py-10 text-center"><div class="flex flex-col items-center gap-2"><!> <h1 class="type-h2 m-0 text-fg-0">Something crashed while rendering</h1> <p class="m-0 max-w-lg text-[13px] leading-relaxed text-fg-2">The workspace hit an unexpected error. Your connection is untouched —
|
|
2
|
+
retry the render, or reload the window to start clean.</p></div> <p class="m-0 max-w-lg break-words font-mono text-[12px] text-accent"> </p> <!> <div class="flex items-center gap-2"><button type="button" class="inline-flex h-9 items-center gap-1.5 rounded-lg bg-accent px-3 text-[12px] font-medium text-white hover:bg-accent/90"><!> Retry render</button> <button type="button" class="inline-flex h-9 items-center gap-1.5 rounded-lg border border-line-1 bg-bg-1 px-3 text-[12px] font-medium text-fg-1 hover:bg-bg-2"><!> Reload window</button></div></div>`);function ie(e,r){function o(){typeof window<"u"&&window.location.reload()}function i(a){return a instanceof Error?a.message||a.name:String(a)}function h(a){return a instanceof Error&&a.stack?a.stack:null}var g=y(),k=w(g);X(k,{failed:(m,t=T,n=T)=>{var f=se(),R=c(f),H=c(R);C(H,{class:"size-8 text-fg-3",strokeWidth:1.4}),K(4),d(R);var S=x(R,2),L=c(S,!0);d(S);var E=x(S,2);{var N=l=>{var u=ne(),I=c(u,!0);d(u),j(J=>M(I,J),[()=>h(t())]),p(l,u)},Y=_(()=>h(t()));G(E,l=>{s(Y)&&l(N)})}var O=x(E,2),b=c(O),A=c(b);C(A,{class:"size-3.5",strokeWidth:2}),K(),d(b);var W=x(b,2),F=c(W);$(F,{class:"size-3.5",strokeWidth:2}),K(),d(W),d(O),d(f),j(l=>M(L,l),[()=>i(t())]),P("click",b,function(...l){var u;(u=n())==null||u.apply(this,l)}),P("click",W,o),p(m,f)}},m=>{var t=y(),n=w(t);B(n,()=>r.children),p(m,t)}),p(e,g)}V(["click"]);function le(e){return e instanceof MouseEvent?e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey:!1}function ce(){const e=_(()=>ee(z.url.pathname.slice(v.length)||"/"));return{get view(){return s(e).view},get collection(){return s(e).collection},get subpage(){return s(e).subpage},get path(){return z.url.pathname},href:r=>v+D(r),go:(r,o,i)=>{le(o)||(o==null||o.preventDefault(),Z(v+D(r),{replaceState:i??!1}))}}}function ve(e,r){Q(r,!0);const o=ce(),i=_(()=>z.url.pathname.slice(v.length)||"/"),h=_(()=>s(i)==="/graph"||s(i)==="/shadow-dom-spike"||s(i)==="/redwire-ws-spike");var g=y(),k=w(g);{var a=t=>{var n=y(),f=w(n);B(f,()=>r.children),p(t,n)},m=t=>{ie(t,{children:(n,f)=>{te(n,{get router(){return o}})}})};G(k,t=>{s(h)?t(a):t(m,-1)})}p(e,g),U()}export{ve as component,xe as universal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/Bzak7iHL.js";import{b9 as u,aq as b,bw as v,bG as c,b6 as g,a6 as s,bg as o}from"../chunks/CGFL56WJ.js";import{a as l,k as _,u as p}from"../chunks/DN7v3Tar.js";import{p as m}from"../chunks/
|
|
1
|
+
import"../chunks/Bzak7iHL.js";import{b9 as u,aq as b,bw as v,bG as c,b6 as g,a6 as s,bg as o}from"../chunks/CGFL56WJ.js";import{a as l,k as _,u as p}from"../chunks/DN7v3Tar.js";import{p as m}from"../chunks/C_WxkIDp.js";var x=_("<h1> </h1> <p> </p>",1);function E(i,f){u(f,!0);var a=x(),r=b(a),h=s(r,!0);o(r);var t=v(r,2),n=s(t,!0);o(t),c(()=>{var e;p(h,m.status),p(n,(e=m.error)==null?void 0:e.message)}),l(i,a),g()}export{E as component};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../chunks/Bzak7iHL.js";import{a as Lt}from"../chunks/Btd6PFkC.js";import{aq as j,b9 as Nt,b6 as zt,bm as g,al as It,$ as jt,a6 as i,at as n,bg as s,bz as V,bw as m,b2 as Ve,bG as I,bN as re}from"../chunks/CGFL56WJ.js";import{e as ae,a as x,h as Et,k as S,u as y,i as Y,j as Gt,w as Le}from"../chunks/DN7v3Tar.js";import{i as T}from"../chunks/DCJ0QyYH.js";import{k as At}from"../chunks/DRlh90Cv.js";import{I as he,
|
|
1
|
+
import"../chunks/Bzak7iHL.js";import{a as Lt}from"../chunks/Btd6PFkC.js";import{aq as j,b9 as Nt,b6 as zt,bm as g,al as It,$ as jt,a6 as i,at as n,bg as s,bz as V,bw as m,b2 as Ve,bG as I,bN as re}from"../chunks/CGFL56WJ.js";import{e as ae,a as x,h as Et,k as S,u as y,i as Y,j as Gt,w as Le}from"../chunks/DN7v3Tar.js";import{i as T}from"../chunks/DCJ0QyYH.js";import{k as At}from"../chunks/DRlh90Cv.js";import{I as he,C as _e,i as Ft,F as Ye,e as Mt,E as Rt,b as Tt,L as Pt,G as Ot,m as Pe,s as Oe}from"../chunks/BspmDMQv.js";import{h as Dt}from"../chunks/BgOTHNR5.js";import{e as Ke,j as Qe,r as Ut,d as qt,k as Bt}from"../chunks/C3SGj6Qd.js";import{l as ye,s as $e,b as Jt}from"../chunks/BRIMmWzq.js";import{p as Ht}from"../chunks/C_WxkIDp.js";import"../chunks/69_IOA4Y.js";function Vt(e,t){const o=ye(t,["children","$$slots","$$events","$$legacy"]);/**
|
|
2
2
|
* @license lucide-svelte v0.475.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* ISC License
|
|
@@ -93,4 +93,4 @@ import"../chunks/Bzak7iHL.js";import{a as Lt}from"../chunks/Btd6PFkC.js";import{
|
|
|
93
93
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
94
94
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
95
95
|
*
|
|
96
|
-
*/const r=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["polyline",{points:"17 8 12 3 7 8"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15"}]];he(e,$e({name:"upload"},()=>o,{get iconNode(){return r},children:(a,u)=>{var l=ae(),f=j(l);_e(f,t,"default",{},null),x(a,l)},$$slots:{default:!0}}))}const ze=1;class $ extends Error{constructor(t){super(t),this.name="GraphContractError"}}function ee(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function K(e,t){for(const o of t){const r=e[o];if(r!=null&&r!=="")return r}}function Zt(e){const t=K(e,["version","schema_version","schemaVersion"]);if(typeof t!="string"||t.trim()==="")throw new $(`Graph export is missing a "version" string. This viewer supports the version ${ze}.x contract.`);const o=Number.parseInt(t.split(".")[0]??"",10);if(!Number.isFinite(o))throw new $(`Graph export declares an unparseable version "${t}". This viewer supports version ${ze}.x.`);if(o!==ze)throw new $(`Unsupported graph export version "${t}". This viewer supports version ${ze}.x.`);return t}function Wt(e,t){if(!ee(e))throw new $(`Graph node at index ${t} is not an object.`);const o=K(e,["id","rid","_id","uid"]);if(o===void 0)throw new $(`Graph node at index ${t} is missing the required "id" field.`);const r=String(o),a=K(e,["label","name","title"]),u=K(e,["type","node_type","kind"]),l=e.community;return{id:r,label:a!==void 0?String(a):r,type:u!==void 0?String(u):void 0,community:typeof l=="number"?l:void 0,data:e}}function Xt(e,t){if(!ee(e))throw new $(`Graph edge at index ${t} is not an object.`);const o=K(e,["source","from","src","start","from_rid"]);if(o===void 0)throw new $(`Graph edge at index ${t} is missing the required "source" field.`);const r=K(e,["target","to","dst","end","to_rid"]);if(r===void 0)throw new $(`Graph edge at index ${t} is missing the required "target" field.`);const a=K(e,["kind","type","label","rel"]),u=String(o),l=String(r),f=K(e,["id","rid"]);return{id:f!==void 0?String(f):`${u}->${l}:${a??""}#${t}`,source:u,target:l,type:a!==void 0?String(a):void 0,data:e}}function en(e){if(e==null)return[];if(!Array.isArray(e))throw new $('Graph export "communities" must be an array when present.');return e.map((t,o)=>{if(!ee(t))throw new $(`Community at index ${o} is not an object.`);if(typeof t.id!="number")throw new $(`Community at index ${o} is missing a numeric "id".`);const r=t.id;return{id:r,label:typeof t.label=="string"?t.label:`Community ${r}`,color:typeof t.color=="string"?t.color:Ft(r),size:typeof t.size=="number"?t.size:0}})}function tn(e,t){const o={};for(const a of e)o[a.id]={...a.data,id:a.id,label:a.label,...a.type!==void 0?{node_type:a.type}:{}};const r={};for(const a of t)r[a.id]={...a.data,source:a.source,target:a.target,...a.type!==void 0?{type:a.type}:{}};return{ok:!0,query:"",capability:"graph",record_count:e.length+t.length,result:{columns:["nodes","edges"],records:[{values:{},nodes:o,edges:r}]}}}function nn(e){if(!ee(e))throw new $('Graph export must be a JSON object with "version" and graph data.');const t=ee(e.contract)?e.contract:null,o=Zt(t??e),r=t??(ee(e.graph)?e.graph:e),a=r.nodes,u=r.edges;if(!Array.isArray(a))throw new $('Graph export "nodes" must be an array.');if(!Array.isArray(u))throw new $('Graph export "edges" must be an array.');const l=a.map(Wt),f=u.map(Xt),p=en(e.communities??r.communities);return{version:o,model:{nodes:l,edges:f,communities:p},result:tn(l,f),meta:ee(e.meta)?e.meta:{}}}function Xe(e){let t;try{t=JSON.parse(e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new $(`Graph export is not valid JSON: ${r}`)}return nn(t)}async function on(e,t={}){const o=t.fetch??globalThis.fetch;if(typeof o!="function")throw new $("No fetch implementation available to load the graph.");let r;try{r=await o(e)}catch(u){const l=u instanceof Error?u.message:String(u);throw new $(`Failed to fetch graph from "${e}": ${l}`)}if(!r.ok)throw new $(`Failed to load graph from "${e}": HTTP ${r.status} ${r.statusText}`.trim());const a=await r.text();return Xe(a)}const rn=["layer","layer_name","layerName","layer_id","layerId","domain","namespace"],an=["community","community_name","communityName","community_id","communityId"],sn=["component","component_name","componentName","component_id","componentId","package","module","service","collection","file","path"],et={id:"unassigned",label:"Unassigned",color:"#94a3b8"},ln=/^(#[0-9a-f]{3,8}|rgba?\([\d\s.,%+-]+\)|hsla?\([\d\s.,%+-]+\)|oklch\([\d\s.%+-]+(?:\/\s*[\d.]+%?)?\))$/i;function cn(e){const t=e.trim();return ln.test(t)?t:et.color}function xe(e,t){for(const o of t){const r=e[o];if(!(r==null||r==="")&&(typeof r=="string"||typeof r=="number"))return String(r)}return null}function Ie(e,t){return`${e}:${t.toLowerCase().replace(/[^a-z0-9._:/-]+/g,"-")}`}function dn(e){return new Map(e.communities.map(t=>[t.id,{label:t.label,color:cn(t.color)}]))}function un(e,t){const o=xe(e.data,rn);if(o)return{id:Ie("layer",o),label:o,color:"#94a3b8"};if(typeof e.community=="number"){const a=t.get(e.community);return{id:`community:${e.community}`,label:(a==null?void 0:a.label)??`Community ${e.community}`,color:(a==null?void 0:a.color)??"#94a3b8"}}const r=xe(e.data,an);return r?{id:Ie("community",r),label:r,color:"#94a3b8"}:et}function pn(e){const t=xe(e.data,sn);if(t)return{id:Ie("component",t),label:t};const o=e.type??xe(e.data,["node_type","kind"]);return o?{id:Ie("type",o),label:`${o} nodes`}:{id:"component:unassigned",label:"Unassigned"}}function Ze(e,t){let o=0,r=0,a=0;for(const u of t){const l=e.has(u.source),f=e.has(u.target);!l&&!f||(o+=1,l&&f?r+=1:a+=1)}return{connectionCount:o,internalConnectionCount:r,externalConnectionCount:a}}function fn(e,t){let o=0,r=0;for(const a of t)a.source===e.id&&(r+=1),a.target===e.id&&(o+=1);return{id:e.id,label:e.label,type:e.type??xe(e.data,["node_type","kind"])??"node",degree:o+r,incoming:o,outgoing:r}}function We(e,t){const o=t.nodeCount-e.nodeCount;if(o!==0)return o;const r=t.connectionCount-e.connectionCount;if(r!==0)return r;const a=e.label.localeCompare(t.label);return a!==0?a:e.id.localeCompare(t.id)}function vn(e){const t=dn(e),o=new Map;for(const a of e.nodes){const u=un(a,t),l=o.get(u.id);l?l.nodes.push(a):o.set(u.id,{...u,nodes:[a]})}return{layers:[...o.values()].map(a=>{const u=a.nodes.map(w=>w.id),l=new Set(u),f=Ze(l,e.edges),p=new Map;for(const w of a.nodes){const _=pn(w),k=p.get(_.id);k?k.nodes.push(w):p.set(_.id,{..._,nodes:[w]})}const D=[...p.values()].map(w=>{const _=w.nodes.map(U=>U.id),k=Ze(new Set(_),e.edges);return{id:w.id,label:w.label,nodeCount:w.nodes.length,nodeIds:_,nodes:w.nodes.map(U=>fn(U,e.edges)).sort((U,se)=>se.degree-U.degree||U.label.localeCompare(se.label)),...k}}).sort(We);return{id:a.id,label:a.label,color:a.color,nodeCount:a.nodes.length,componentCount:D.length,nodeIds:u,components:D,...f}}).sort(We)}}function mn(e,t){const o=t===null?null:new Set(t),r=o?e.nodes.filter(p=>o.has(p.id)):e.nodes,a=new Set(r.map(p=>p.id)),u=e.edges.filter(p=>a.has(p.source)&&a.has(p.target)),l={};for(const p of r)l[p.id]={...p.data,id:p.id,label:p.label,...p.type!==void 0?{node_type:p.type}:{}};const f={};for(const p of u)f[p.id]={...p.data,source:p.source,target:p.target,...p.type!==void 0?{type:p.type}:{}};return{ok:!0,query:"",capability:"graph",record_count:r.length+u.length,result:{columns:["nodes","edges"],records:[{values:{},nodes:l,edges:f}]}}}var gn=S('<button type="button" aria-label="Back" class="inline-flex size-6 items-center justify-center rounded border border-line-1 text-fg-3 hover:border-line-2 hover:text-fg-1"><!></button>'),bn=S('<span class="inline-flex size-6 items-center justify-center rounded border border-line-1 text-fg-3"><!></span>'),xn=S('<!> <button type="button"> </button>',1),hn=S('<!> <span class="truncate rounded bg-bg-2 px-1.5 py-0.5 text-fg-0"> </span>',1),_n=S('<button type="button" class="w-full px-3 py-2.5 text-left hover:bg-bg-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"><div class="flex items-start gap-2.5"><span class="mt-1.5 size-2 rounded-full shrink-0"></span> <span class="min-w-0 flex-1"><span class="flex items-center gap-2"><span class="truncate text-[13px] font-medium text-fg-0"> </span> <span class="font-mono text-[10px] text-fg-3"> </span></span> <span class="mt-1 block font-mono text-[11px] text-fg-3"> </span></span> <!></div></button>'),yn=S('<div class="px-3 py-2 text-[11px] font-mono text-fg-3 border-b border-line-1"> </div> <div class="divide-y divide-line-1"></div>',1),$n=S('<button type="button" class="w-full px-3 py-2.5 text-left hover:bg-bg-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"><div class="flex items-start gap-2.5"><span class="mt-1 text-fg-3"><!></span> <span class="min-w-0 flex-1"><span class="block truncate text-[13px] font-medium text-fg-0"> </span> <span class="mt-1 block font-mono text-[11px] text-fg-3"> </span></span> <!></div></button>'),wn=S('<div class="px-3 py-2 text-[11px] font-mono text-fg-3 border-b border-line-1"> </div> <div class="divide-y divide-line-1"></div>',1),kn=S('<div class="px-3 py-2.5"><div class="flex items-start gap-2.5"><span class="mt-1 text-fg-3"><!></span> <span class="min-w-0 flex-1"><span class="block truncate text-[13px] font-medium text-fg-0"> </span> <span class="mt-1 block truncate font-mono text-[11px] text-fg-3"> </span></span></div></div>'),Cn=S('<div class="px-3 py-2 text-[11px] font-mono text-fg-3 border-b border-line-1"> </div> <div class="divide-y divide-line-1"></div>',1),Sn=S('<div class="flex-1 min-h-0 overflow-auto"><!></div>'),Ln=S('<div class="flex items-center justify-between gap-4 px-3 py-2 border-b border-line-1 bg-bg-1 shrink-0"><span class="flex items-center gap-2 min-w-0 text-fg-2 text-[13px]"><!> <span class="font-mono text-fg-1 truncate max-w-[38vw]"> </span> <span class="text-fg-3 whitespace-nowrap"> <!></span></span> <button type="button" class="flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-line-1 text-fg-2 text-[12px] hover:border-fg-3 hover:text-fg-1"><!> Load another</button></div> <div class="flex-1 min-h-0 flex"><aside class="w-[min(320px,48vw)] shrink-0 border-r border-line-1 bg-bg-1/80 flex flex-col min-h-0"><div class="px-3 py-2 border-b border-line-1"><div class="flex items-center gap-2 text-fg-1"><!> <div class="min-w-0"><div class="type-label"><!></div> <div class="truncate text-[12px] font-medium text-fg-0"> </div></div></div> <nav class="mt-2 flex min-w-0 items-center gap-1 text-[11px] font-mono text-fg-3"><button type="button">overview</button> <!> <!></nav></div> <!></aside> <div class="flex-1 min-w-0"><!></div></div>',1),Nn=S('<p class="m-0 px-3 py-2 rounded-md text-accent text-[12px] leading-relaxed border border-accent/35 bg-accent/10"> </p>'),zn=S('<div class="flex flex-col gap-3 w-[min(34rem,90vw)] text-left"><form class="flex gap-2"><div class="relative flex-1 flex items-center"><!> <input class="w-full pl-8 pr-2.5 py-2 bg-bg-2 border border-line-1 rounded-md text-fg-1 text-[13px] font-mono focus:outline-none focus:border-accent" type="text" placeholder="https://host/graph.json or /exports/memory.json" spellcheck="false" autocapitalize="off" autocorrect="off"/></div> <button class="px-4 py-2 bg-accent text-white rounded-md text-[13px] font-medium whitespace-nowrap disabled:opacity-50" type="submit"> </button></form> <div class="flex items-center gap-2 text-fg-3 text-[11px] uppercase tracking-wide"><span class="flex-1 h-px bg-line-1"></span> or <span class="flex-1 h-px bg-line-1"></span></div> <button type="button" class="flex items-center justify-center gap-2 px-3 py-2 bg-bg-2 border border-line-1 rounded-md text-fg-1 text-[13px] hover:border-fg-3 disabled:opacity-50"><!> Choose a local graph.json</button> <input type="file" accept="application/json,.json" class="hidden"/> <!></div>'),In=S('<div class="flex items-center justify-center h-full w-full p-8"><!></div>'),jn=S('<div class="flex h-screen w-full flex-col"><!></div>');function Bn(e,t){Nt(t,!0);let o=V(null),r=V(!1),a=V(null),u=V(null),l=V(null),f=V(null),p=V(""),D=V(null);const w=re(()=>n(o)?vn(n(o).model):null),_=re(()=>{var d;return n(l)?(d=n(w))==null?void 0:d.layers.find(b=>b.id===n(l)):void 0}),k=re(()=>{var d;return n(f)?(d=n(_))==null?void 0:d.components.find(b=>b.id===n(f)):void 0}),U=re(()=>n(k)?n(k).nodeIds:n(_)?n(_).nodeIds:null),se=re(()=>n(o)?mn(n(o).model,n(U)):null),tt=re(()=>`${n(u)??"graph"}:${n(l)??"overview"}:${n(f)??"all"}`);async function De(d){const b=d.trim();if(b){g(r,!0),g(a,null);try{g(o,await on(b,{fetch}),!0),g(u,b,!0),we()}catch(z){g(o,null),g(a,z instanceof Error?z.message:String(z),!0)}finally{g(r,!1)}}}async function nt(d){g(r,!0),g(a,null);try{g(o,Xe(await d.text()),!0),g(u,d.name,!0),we()}catch(b){g(o,null),g(a,b instanceof Error?b.message:String(b),!0)}finally{g(r,!1)}}function ot(d){d.preventDefault(),De(n(p))}function rt(d){var z;const b=(z=d.target.files)==null?void 0:z[0];b&&nt(b)}function at(){g(o,null),g(a,null),g(u,null),g(p,""),we(),n(D)&&(n(D).value="")}function we(){g(l,null),g(f,null)}function st(d){g(l,d.id,!0),g(f,null)}function it(d){g(f,d.id,!0)}function lt(){if(n(f)){g(f,null);return}g(l,null)}function P(d,b){return`${d.toLocaleString()} ${b}${d===1?"":"s"}`}function je(d){const b=P(d.connectionCount,"connection");return d.externalConnectionCount===0?b:`${b} · ${d.externalConnectionCount.toLocaleString()} external`}Lt(()=>{const d=Ht.url.searchParams.get("src");d&&(g(p,d,!0),De(d))});var Ee=jn();Dt("315y67",d=>{It(()=>{jt.title="Load graph · red-ui"})});var ct=i(Ee);{var dt=d=>{var b=Ln(),z=j(b),ke=i(z),Ce=i(ke);Ye(Ce,{size:14});var Q=m(Ce,2),te=i(Q,!0);s(Q);var ne=m(Q,2),ie=i(ne),le=m(ie);{var ce=c=>{var v=Le();I(()=>y(v,`· ${n(o).model.communities.length??""} communities`)),x(c,v)};T(le,c=>{n(o).model.communities.length&&c(ce)})}s(ne),s(ke);var de=m(ke,2),Z=i(de);Mt(Z,{size:13}),Ve(),s(de),s(z);var Se=m(z,2),W=i(Se),ue=i(W),pe=i(ue),L=i(pe);{var fe=c=>{var v=gn(),C=i(v);Vt(C,{size:13}),s(v),Y("click",v,lt),x(c,v)},Ge=c=>{var v=bn(),C=i(v);Pt(C,{size:13}),s(v),x(c,v)};T(L,c=>{n(_)?c(fe):c(Ge,-1)})}var Ue=m(L,2),Ae=i(Ue),pt=i(Ae);{var ft=c=>{var v=Le("nodes");x(c,v)},vt=c=>{var v=Le("components");x(c,v)},mt=c=>{var v=Le("overview");x(c,v)};T(pt,c=>{n(k)?c(ft):n(_)?c(vt,1):c(mt,-1)})}s(Ae);var qe=m(Ae,2),gt=i(qe,!0);s(qe),s(Ue),s(pe);var Be=m(pe,2),Fe=i(Be),Je=m(Fe,2);{var bt=c=>{var v=xn(),C=j(v);Ne(C,{size:12,class:"shrink-0"});var E=m(C,2),ve=i(E,!0);s(E),I(Me=>{Qe(E,1,Me),y(ve,n(_).label)},[()=>Ke(["truncate rounded px-1.5 py-0.5 hover:bg-bg-2 hover:text-fg-1",n(_)&&!n(k)?"text-fg-0 bg-bg-2":""].join(" "))]),Y("click",E,()=>g(f,null)),x(c,v)};T(Je,c=>{n(_)&&c(bt)})}var xt=m(Je,2);{var ht=c=>{var v=hn(),C=j(v);Ne(C,{size:12,class:"shrink-0"});var E=m(C,2),ve=i(E,!0);s(E),I(()=>y(ve,n(k).label)),x(c,v)};T(xt,c=>{n(k)&&c(ht)})}s(Be),s(ue);var _t=m(ue,2);{var yt=c=>{var v=Sn(),C=i(v);{var E=O=>{var q=yn(),G=j(q),me=i(G);s(G);var B=m(G,2);Pe(B,21,()=>n(w).layers,Oe,(A,h)=>{var N=_n(),J=i(N),M=i(J),X=m(M,2),R=i(X),F=i(R),ge=i(F,!0);s(F);var H=m(F,2),be=i(H,!0);s(H),s(R);var oe=m(R,2),Re=i(oe);s(oe),s(X);var Te=m(X,2);Ne(Te,{size:14,class:"mt-1 shrink-0 text-fg-3"}),s(J),s(N),I((kt,Ct,St)=>{Bt(M,`background:${n(h).color};box-shadow:0 0 8px ${n(h).color}`),y(ge,n(h).label),y(be,kt),y(Re,`${Ct??""} · ${St??""}`)},[()=>P(n(h).componentCount,"component"),()=>P(n(h).nodeCount,"node"),()=>je(n(h))]),Y("click",N,()=>st(n(h))),x(A,N)}),s(B),I((A,h)=>y(me,`${A??""} · ${h??""}`),[()=>P(n(w).layers.length,"group"),()=>P(n(o).model.nodes.length,"node")]),x(O,q)},ve=O=>{var q=wn(),G=j(q),me=i(G);s(G);var B=m(G,2);Pe(B,21,()=>n(_).components,Oe,(A,h)=>{var N=$n(),J=i(N),M=i(J),X=i(M);Yt(X,{size:14}),s(M);var R=m(M,2),F=i(R),ge=i(F,!0);s(F);var H=m(F,2),be=i(H);s(H),s(R);var oe=m(R,2);Ne(oe,{size:14,class:"mt-1 shrink-0 text-fg-3"}),s(J),s(N),I((Re,Te)=>{y(ge,n(h).label),y(be,`${Re??""} · ${Te??""}`)},[()=>P(n(h).nodeCount,"node"),()=>je(n(h))]),Y("click",N,()=>it(n(h))),x(A,N)}),s(B),I((A,h)=>y(me,`${A??""} · ${h??""}`),[()=>P(n(_).components.length,"component"),()=>P(n(_).nodeCount,"node")]),x(O,q)},Me=O=>{var q=Cn(),G=j(q),me=i(G);s(G);var B=m(G,2);Pe(B,21,()=>n(k).nodes,Oe,(A,h)=>{var N=kn(),J=i(N),M=i(J),X=i(M);Kt(X,{size:13}),s(M);var R=m(M,2),F=i(R),ge=i(F,!0);s(F);var H=m(F,2),be=i(H);s(H),s(R),s(J),s(N),I(oe=>{y(ge,n(h).label),y(be,`${n(h).type??""} · degree ${oe??""} · ${n(h).id??""}`)},[()=>n(h).degree.toLocaleString()]),x(A,N)}),s(B),I((A,h)=>y(me,`${A??""} · ${h??""}`),[()=>P(n(k).nodes.length,"node"),()=>je(n(k))]),x(O,q)};T(C,O=>{n(_)?n(k)?O(Me,-1):O(ve,1):O(E)})}s(v),x(c,v)};T(_t,c=>{n(w)&&c(yt)})}s(W);var He=m(W,2),$t=i(He);{var wt=c=>{var v=ae(),C=j(v);At(C,()=>n(tt),E=>{Ot(E,{get result(){return n(se)}})}),x(c,v)};T($t,c=>{n(se)&&c(wt)})}s(He),s(Se),I(c=>{var v,C;y(te,n(u)),y(ie,`${n(o).model.nodes.length??""} nodes · ${n(o).model.edges.length??""} edges`),y(gt,((v=n(k))==null?void 0:v.label)??((C=n(_))==null?void 0:C.label)??"Layers and communities"),Qe(Fe,1,c)},[()=>Ke(["truncate rounded px-1.5 py-0.5 hover:bg-bg-2 hover:text-fg-1",n(_)?"":"text-fg-0 bg-bg-2"].join(" "))]),Y("click",de,at),Y("click",Fe,we),x(d,b)},ut=d=>{var b=In(),z=i(b);Rt(z,{title:"Load a graph",message:"Render any contract-conformant graph.json — memory exports, codebase graphs, or graphify output — from a URL, a path, or a local file. No connection required.",get icon(){return Ye},actions:Ce=>{var Q=zn(),te=i(Q),ne=i(te),ie=i(ne);Tt(ie,{size:15,class:"absolute left-2.5 text-fg-3 pointer-events-none"});var le=m(ie,2);Ut(le),s(ne);var ce=m(ne,2),de=i(ce,!0);s(ce),s(te);var Z=m(te,4),Se=i(Z);Qt(Se,{size:15}),Ve(),s(Z);var W=m(Z,2);Jt(W,L=>g(D,L),()=>n(D));var ue=m(W,2);{var pe=L=>{var fe=Nn(),Ge=i(fe,!0);s(fe),I(()=>y(Ge,n(a))),x(L,fe)};T(ue,L=>{n(a)&&L(pe)})}s(Q),I(L=>{le.disabled=n(r),ce.disabled=L,y(de,n(r)?"Loading…":"Load"),Z.disabled=n(r)},[()=>n(r)||!n(p).trim()]),Gt("submit",te,ot),qt(le,()=>n(p),L=>g(p,L)),Y("click",Z,()=>{var L;return(L=n(D))==null?void 0:L.click()}),Y("change",W,rt),x(Ce,Q)}}),s(b),x(d,b)};T(ct,d=>{n(o)?d(dt):d(ut,-1)})}s(Ee),x(e,Ee),zt()}Et(["click","change"]);export{Bn as component};
|
|
96
|
+
*/const r=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["polyline",{points:"17 8 12 3 7 8"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15"}]];he(e,$e({name:"upload"},()=>o,{get iconNode(){return r},children:(a,u)=>{var l=ae(),f=j(l);_e(f,t,"default",{},null),x(a,l)},$$slots:{default:!0}}))}const ze=1;class $ extends Error{constructor(t){super(t),this.name="GraphContractError"}}function ee(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function K(e,t){for(const o of t){const r=e[o];if(r!=null&&r!=="")return r}}function Zt(e){const t=K(e,["version","schema_version","schemaVersion"]);if(typeof t!="string"||t.trim()==="")throw new $(`Graph export is missing a "version" string. This viewer supports the version ${ze}.x contract.`);const o=Number.parseInt(t.split(".")[0]??"",10);if(!Number.isFinite(o))throw new $(`Graph export declares an unparseable version "${t}". This viewer supports version ${ze}.x.`);if(o!==ze)throw new $(`Unsupported graph export version "${t}". This viewer supports version ${ze}.x.`);return t}function Wt(e,t){if(!ee(e))throw new $(`Graph node at index ${t} is not an object.`);const o=K(e,["id","rid","_id","uid"]);if(o===void 0)throw new $(`Graph node at index ${t} is missing the required "id" field.`);const r=String(o),a=K(e,["label","name","title"]),u=K(e,["type","node_type","kind"]),l=e.community;return{id:r,label:a!==void 0?String(a):r,type:u!==void 0?String(u):void 0,community:typeof l=="number"?l:void 0,data:e}}function Xt(e,t){if(!ee(e))throw new $(`Graph edge at index ${t} is not an object.`);const o=K(e,["source","from","src","start","from_rid"]);if(o===void 0)throw new $(`Graph edge at index ${t} is missing the required "source" field.`);const r=K(e,["target","to","dst","end","to_rid"]);if(r===void 0)throw new $(`Graph edge at index ${t} is missing the required "target" field.`);const a=K(e,["kind","type","label","rel"]),u=String(o),l=String(r),f=K(e,["id","rid"]);return{id:f!==void 0?String(f):`${u}->${l}:${a??""}#${t}`,source:u,target:l,type:a!==void 0?String(a):void 0,data:e}}function en(e){if(e==null)return[];if(!Array.isArray(e))throw new $('Graph export "communities" must be an array when present.');return e.map((t,o)=>{if(!ee(t))throw new $(`Community at index ${o} is not an object.`);if(typeof t.id!="number")throw new $(`Community at index ${o} is missing a numeric "id".`);const r=t.id;return{id:r,label:typeof t.label=="string"?t.label:`Community ${r}`,color:typeof t.color=="string"?t.color:Ft(r),size:typeof t.size=="number"?t.size:0}})}function tn(e,t){const o={};for(const a of e)o[a.id]={...a.data,id:a.id,label:a.label,...a.type!==void 0?{node_type:a.type}:{}};const r={};for(const a of t)r[a.id]={...a.data,source:a.source,target:a.target,...a.type!==void 0?{type:a.type}:{}};return{ok:!0,query:"",capability:"graph",record_count:e.length+t.length,result:{columns:["nodes","edges"],records:[{values:{},nodes:o,edges:r}]}}}function nn(e){if(!ee(e))throw new $('Graph export must be a JSON object with "version" and graph data.');const t=ee(e.contract)?e.contract:null,o=Zt(t??e),r=t??(ee(e.graph)?e.graph:e),a=r.nodes,u=r.edges;if(!Array.isArray(a))throw new $('Graph export "nodes" must be an array.');if(!Array.isArray(u))throw new $('Graph export "edges" must be an array.');const l=a.map(Wt),f=u.map(Xt),p=en(e.communities??r.communities);return{version:o,model:{nodes:l,edges:f,communities:p},result:tn(l,f),meta:ee(e.meta)?e.meta:{}}}function Xe(e){let t;try{t=JSON.parse(e)}catch(o){const r=o instanceof Error?o.message:String(o);throw new $(`Graph export is not valid JSON: ${r}`)}return nn(t)}async function on(e,t={}){const o=t.fetch??globalThis.fetch;if(typeof o!="function")throw new $("No fetch implementation available to load the graph.");let r;try{r=await o(e)}catch(u){const l=u instanceof Error?u.message:String(u);throw new $(`Failed to fetch graph from "${e}": ${l}`)}if(!r.ok)throw new $(`Failed to load graph from "${e}": HTTP ${r.status} ${r.statusText}`.trim());const a=await r.text();return Xe(a)}const rn=["layer","layer_name","layerName","layer_id","layerId","domain","namespace"],an=["community","community_name","communityName","community_id","communityId"],sn=["component","component_name","componentName","component_id","componentId","package","module","service","collection","file","path"],et={id:"unassigned",label:"Unassigned",color:"#94a3b8"},ln=/^(#[0-9a-f]{3,8}|rgba?\([\d\s.,%+-]+\)|hsla?\([\d\s.,%+-]+\)|oklch\([\d\s.%+-]+(?:\/\s*[\d.]+%?)?\))$/i;function cn(e){const t=e.trim();return ln.test(t)?t:et.color}function xe(e,t){for(const o of t){const r=e[o];if(!(r==null||r==="")&&(typeof r=="string"||typeof r=="number"))return String(r)}return null}function Ie(e,t){return`${e}:${t.toLowerCase().replace(/[^a-z0-9._:/-]+/g,"-")}`}function dn(e){return new Map(e.communities.map(t=>[t.id,{label:t.label,color:cn(t.color)}]))}function un(e,t){const o=xe(e.data,rn);if(o)return{id:Ie("layer",o),label:o,color:"#94a3b8"};if(typeof e.community=="number"){const a=t.get(e.community);return{id:`community:${e.community}`,label:(a==null?void 0:a.label)??`Community ${e.community}`,color:(a==null?void 0:a.color)??"#94a3b8"}}const r=xe(e.data,an);return r?{id:Ie("community",r),label:r,color:"#94a3b8"}:et}function pn(e){const t=xe(e.data,sn);if(t)return{id:Ie("component",t),label:t};const o=e.type??xe(e.data,["node_type","kind"]);return o?{id:Ie("type",o),label:`${o} nodes`}:{id:"component:unassigned",label:"Unassigned"}}function Ze(e,t){let o=0,r=0,a=0;for(const u of t){const l=e.has(u.source),f=e.has(u.target);!l&&!f||(o+=1,l&&f?r+=1:a+=1)}return{connectionCount:o,internalConnectionCount:r,externalConnectionCount:a}}function fn(e,t){let o=0,r=0;for(const a of t)a.source===e.id&&(r+=1),a.target===e.id&&(o+=1);return{id:e.id,label:e.label,type:e.type??xe(e.data,["node_type","kind"])??"node",degree:o+r,incoming:o,outgoing:r}}function We(e,t){const o=t.nodeCount-e.nodeCount;if(o!==0)return o;const r=t.connectionCount-e.connectionCount;if(r!==0)return r;const a=e.label.localeCompare(t.label);return a!==0?a:e.id.localeCompare(t.id)}function vn(e){const t=dn(e),o=new Map;for(const a of e.nodes){const u=un(a,t),l=o.get(u.id);l?l.nodes.push(a):o.set(u.id,{...u,nodes:[a]})}return{layers:[...o.values()].map(a=>{const u=a.nodes.map(w=>w.id),l=new Set(u),f=Ze(l,e.edges),p=new Map;for(const w of a.nodes){const _=pn(w),C=p.get(_.id);C?C.nodes.push(w):p.set(_.id,{..._,nodes:[w]})}const D=[...p.values()].map(w=>{const _=w.nodes.map(U=>U.id),C=Ze(new Set(_),e.edges);return{id:w.id,label:w.label,nodeCount:w.nodes.length,nodeIds:_,nodes:w.nodes.map(U=>fn(U,e.edges)).sort((U,se)=>se.degree-U.degree||U.label.localeCompare(se.label)),...C}}).sort(We);return{id:a.id,label:a.label,color:a.color,nodeCount:a.nodes.length,componentCount:D.length,nodeIds:u,components:D,...f}}).sort(We)}}function mn(e,t){const o=t===null?null:new Set(t),r=o?e.nodes.filter(p=>o.has(p.id)):e.nodes,a=new Set(r.map(p=>p.id)),u=e.edges.filter(p=>a.has(p.source)&&a.has(p.target)),l={};for(const p of r)l[p.id]={...p.data,id:p.id,label:p.label,...p.type!==void 0?{node_type:p.type}:{}};const f={};for(const p of u)f[p.id]={...p.data,source:p.source,target:p.target,...p.type!==void 0?{type:p.type}:{}};return{ok:!0,query:"",capability:"graph",record_count:r.length+u.length,result:{columns:["nodes","edges"],records:[{values:{},nodes:l,edges:f}]}}}var gn=S('<button type="button" aria-label="Back" class="inline-flex size-6 items-center justify-center rounded border border-line-1 text-fg-3 hover:border-line-2 hover:text-fg-1"><!></button>'),bn=S('<span class="inline-flex size-6 items-center justify-center rounded border border-line-1 text-fg-3"><!></span>'),xn=S('<!> <button type="button"> </button>',1),hn=S('<!> <span class="truncate rounded bg-bg-2 px-1.5 py-0.5 text-fg-0"> </span>',1),_n=S('<button type="button" class="w-full px-3 py-2.5 text-left hover:bg-bg-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"><div class="flex items-start gap-2.5"><span class="mt-1.5 size-2 rounded-full shrink-0"></span> <span class="min-w-0 flex-1"><span class="flex items-center gap-2"><span class="truncate text-[13px] font-medium text-fg-0"> </span> <span class="font-mono text-[10px] text-fg-3"> </span></span> <span class="mt-1 block font-mono text-[11px] text-fg-3"> </span></span> <!></div></button>'),yn=S('<div class="px-3 py-2 text-[11px] font-mono text-fg-3 border-b border-line-1"> </div> <div class="divide-y divide-line-1"></div>',1),$n=S('<button type="button" class="w-full px-3 py-2.5 text-left hover:bg-bg-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40"><div class="flex items-start gap-2.5"><span class="mt-1 text-fg-3"><!></span> <span class="min-w-0 flex-1"><span class="block truncate text-[13px] font-medium text-fg-0"> </span> <span class="mt-1 block font-mono text-[11px] text-fg-3"> </span></span> <!></div></button>'),wn=S('<div class="px-3 py-2 text-[11px] font-mono text-fg-3 border-b border-line-1"> </div> <div class="divide-y divide-line-1"></div>',1),Cn=S('<div class="px-3 py-2.5"><div class="flex items-start gap-2.5"><span class="mt-1 text-fg-3"><!></span> <span class="min-w-0 flex-1"><span class="block truncate text-[13px] font-medium text-fg-0"> </span> <span class="mt-1 block truncate font-mono text-[11px] text-fg-3"> </span></span></div></div>'),kn=S('<div class="px-3 py-2 text-[11px] font-mono text-fg-3 border-b border-line-1"> </div> <div class="divide-y divide-line-1"></div>',1),Sn=S('<div class="flex-1 min-h-0 overflow-auto"><!></div>'),Ln=S('<div class="flex items-center justify-between gap-4 px-3 py-2 border-b border-line-1 bg-bg-1 shrink-0"><span class="flex items-center gap-2 min-w-0 text-fg-2 text-[13px]"><!> <span class="font-mono text-fg-1 truncate max-w-[38vw]"> </span> <span class="text-fg-3 whitespace-nowrap"> <!></span></span> <button type="button" class="flex items-center gap-1.5 px-3 py-1.5 rounded-md border border-line-1 text-fg-2 text-[12px] hover:border-fg-3 hover:text-fg-1"><!> Load another</button></div> <div class="flex-1 min-h-0 flex"><aside class="w-[min(320px,48vw)] shrink-0 border-r border-line-1 bg-bg-1/80 flex flex-col min-h-0"><div class="px-3 py-2 border-b border-line-1"><div class="flex items-center gap-2 text-fg-1"><!> <div class="min-w-0"><div class="type-label"><!></div> <div class="truncate text-[12px] font-medium text-fg-0"> </div></div></div> <nav class="mt-2 flex min-w-0 items-center gap-1 text-[11px] font-mono text-fg-3"><button type="button">overview</button> <!> <!></nav></div> <!></aside> <div class="flex-1 min-w-0"><!></div></div>',1),Nn=S('<p class="m-0 px-3 py-2 rounded-md text-accent text-[12px] leading-relaxed border border-accent/35 bg-accent/10"> </p>'),zn=S('<div class="flex flex-col gap-3 w-[min(34rem,90vw)] text-left"><form class="flex gap-2"><div class="relative flex-1 flex items-center"><!> <input class="w-full pl-8 pr-2.5 py-2 bg-bg-2 border border-line-1 rounded-md text-fg-1 text-[13px] font-mono focus:outline-none focus:border-accent" type="text" placeholder="https://host/graph.json or /exports/memory.json" spellcheck="false" autocapitalize="off" autocorrect="off"/></div> <button class="px-4 py-2 bg-accent text-white rounded-md text-[13px] font-medium whitespace-nowrap disabled:opacity-50" type="submit"> </button></form> <div class="flex items-center gap-2 text-fg-3 text-[11px] uppercase tracking-wide"><span class="flex-1 h-px bg-line-1"></span> or <span class="flex-1 h-px bg-line-1"></span></div> <button type="button" class="flex items-center justify-center gap-2 px-3 py-2 bg-bg-2 border border-line-1 rounded-md text-fg-1 text-[13px] hover:border-fg-3 disabled:opacity-50"><!> Choose a local graph.json</button> <input type="file" accept="application/json,.json" class="hidden"/> <!></div>'),In=S('<div class="flex items-center justify-center h-full w-full p-8"><!></div>'),jn=S('<div class="flex h-screen w-full flex-col"><!></div>');function Bn(e,t){Nt(t,!0);let o=V(null),r=V(!1),a=V(null),u=V(null),l=V(null),f=V(null),p=V(""),D=V(null);const w=re(()=>n(o)?vn(n(o).model):null),_=re(()=>{var d;return n(l)?(d=n(w))==null?void 0:d.layers.find(b=>b.id===n(l)):void 0}),C=re(()=>{var d;return n(f)?(d=n(_))==null?void 0:d.components.find(b=>b.id===n(f)):void 0}),U=re(()=>n(C)?n(C).nodeIds:n(_)?n(_).nodeIds:null),se=re(()=>n(o)?mn(n(o).model,n(U)):null),tt=re(()=>`${n(u)??"graph"}:${n(l)??"overview"}:${n(f)??"all"}`);async function De(d){const b=d.trim();if(b){g(r,!0),g(a,null);try{g(o,await on(b,{fetch}),!0),g(u,b,!0),we()}catch(z){g(o,null),g(a,z instanceof Error?z.message:String(z),!0)}finally{g(r,!1)}}}async function nt(d){g(r,!0),g(a,null);try{g(o,Xe(await d.text()),!0),g(u,d.name,!0),we()}catch(b){g(o,null),g(a,b instanceof Error?b.message:String(b),!0)}finally{g(r,!1)}}function ot(d){d.preventDefault(),De(n(p))}function rt(d){var z;const b=(z=d.target.files)==null?void 0:z[0];b&&nt(b)}function at(){g(o,null),g(a,null),g(u,null),g(p,""),we(),n(D)&&(n(D).value="")}function we(){g(l,null),g(f,null)}function st(d){g(l,d.id,!0),g(f,null)}function it(d){g(f,d.id,!0)}function lt(){if(n(f)){g(f,null);return}g(l,null)}function P(d,b){return`${d.toLocaleString()} ${b}${d===1?"":"s"}`}function je(d){const b=P(d.connectionCount,"connection");return d.externalConnectionCount===0?b:`${b} · ${d.externalConnectionCount.toLocaleString()} external`}Lt(()=>{const d=Ht.url.searchParams.get("src");d&&(g(p,d,!0),De(d))});var Ee=jn();Dt("315y67",d=>{It(()=>{jt.title="Load graph · red-ui"})});var ct=i(Ee);{var dt=d=>{var b=Ln(),z=j(b),Ce=i(z),ke=i(Ce);Ye(ke,{size:14});var Q=m(ke,2),te=i(Q,!0);s(Q);var ne=m(Q,2),ie=i(ne),le=m(ie);{var ce=c=>{var v=Le();I(()=>y(v,`· ${n(o).model.communities.length??""} communities`)),x(c,v)};T(le,c=>{n(o).model.communities.length&&c(ce)})}s(ne),s(Ce);var de=m(Ce,2),Z=i(de);Mt(Z,{size:13}),Ve(),s(de),s(z);var Se=m(z,2),W=i(Se),ue=i(W),pe=i(ue),L=i(pe);{var fe=c=>{var v=gn(),k=i(v);Vt(k,{size:13}),s(v),Y("click",v,lt),x(c,v)},Ge=c=>{var v=bn(),k=i(v);Pt(k,{size:13}),s(v),x(c,v)};T(L,c=>{n(_)?c(fe):c(Ge,-1)})}var Ue=m(L,2),Ae=i(Ue),pt=i(Ae);{var ft=c=>{var v=Le("nodes");x(c,v)},vt=c=>{var v=Le("components");x(c,v)},mt=c=>{var v=Le("overview");x(c,v)};T(pt,c=>{n(C)?c(ft):n(_)?c(vt,1):c(mt,-1)})}s(Ae);var qe=m(Ae,2),gt=i(qe,!0);s(qe),s(Ue),s(pe);var Be=m(pe,2),Fe=i(Be),Je=m(Fe,2);{var bt=c=>{var v=xn(),k=j(v);Ne(k,{size:12,class:"shrink-0"});var E=m(k,2),ve=i(E,!0);s(E),I(Me=>{Qe(E,1,Me),y(ve,n(_).label)},[()=>Ke(["truncate rounded px-1.5 py-0.5 hover:bg-bg-2 hover:text-fg-1",n(_)&&!n(C)?"text-fg-0 bg-bg-2":""].join(" "))]),Y("click",E,()=>g(f,null)),x(c,v)};T(Je,c=>{n(_)&&c(bt)})}var xt=m(Je,2);{var ht=c=>{var v=hn(),k=j(v);Ne(k,{size:12,class:"shrink-0"});var E=m(k,2),ve=i(E,!0);s(E),I(()=>y(ve,n(C).label)),x(c,v)};T(xt,c=>{n(C)&&c(ht)})}s(Be),s(ue);var _t=m(ue,2);{var yt=c=>{var v=Sn(),k=i(v);{var E=O=>{var q=yn(),G=j(q),me=i(G);s(G);var B=m(G,2);Pe(B,21,()=>n(w).layers,Oe,(A,h)=>{var N=_n(),J=i(N),M=i(J),X=m(M,2),R=i(X),F=i(R),ge=i(F,!0);s(F);var H=m(F,2),be=i(H,!0);s(H),s(R);var oe=m(R,2),Re=i(oe);s(oe),s(X);var Te=m(X,2);Ne(Te,{size:14,class:"mt-1 shrink-0 text-fg-3"}),s(J),s(N),I((Ct,kt,St)=>{Bt(M,`background:${n(h).color};box-shadow:0 0 8px ${n(h).color}`),y(ge,n(h).label),y(be,Ct),y(Re,`${kt??""} · ${St??""}`)},[()=>P(n(h).componentCount,"component"),()=>P(n(h).nodeCount,"node"),()=>je(n(h))]),Y("click",N,()=>st(n(h))),x(A,N)}),s(B),I((A,h)=>y(me,`${A??""} · ${h??""}`),[()=>P(n(w).layers.length,"group"),()=>P(n(o).model.nodes.length,"node")]),x(O,q)},ve=O=>{var q=wn(),G=j(q),me=i(G);s(G);var B=m(G,2);Pe(B,21,()=>n(_).components,Oe,(A,h)=>{var N=$n(),J=i(N),M=i(J),X=i(M);Yt(X,{size:14}),s(M);var R=m(M,2),F=i(R),ge=i(F,!0);s(F);var H=m(F,2),be=i(H);s(H),s(R);var oe=m(R,2);Ne(oe,{size:14,class:"mt-1 shrink-0 text-fg-3"}),s(J),s(N),I((Re,Te)=>{y(ge,n(h).label),y(be,`${Re??""} · ${Te??""}`)},[()=>P(n(h).nodeCount,"node"),()=>je(n(h))]),Y("click",N,()=>it(n(h))),x(A,N)}),s(B),I((A,h)=>y(me,`${A??""} · ${h??""}`),[()=>P(n(_).components.length,"component"),()=>P(n(_).nodeCount,"node")]),x(O,q)},Me=O=>{var q=kn(),G=j(q),me=i(G);s(G);var B=m(G,2);Pe(B,21,()=>n(C).nodes,Oe,(A,h)=>{var N=Cn(),J=i(N),M=i(J),X=i(M);Kt(X,{size:13}),s(M);var R=m(M,2),F=i(R),ge=i(F,!0);s(F);var H=m(F,2),be=i(H);s(H),s(R),s(J),s(N),I(oe=>{y(ge,n(h).label),y(be,`${n(h).type??""} · degree ${oe??""} · ${n(h).id??""}`)},[()=>n(h).degree.toLocaleString()]),x(A,N)}),s(B),I((A,h)=>y(me,`${A??""} · ${h??""}`),[()=>P(n(C).nodes.length,"node"),()=>je(n(C))]),x(O,q)};T(k,O=>{n(_)?n(C)?O(Me,-1):O(ve,1):O(E)})}s(v),x(c,v)};T(_t,c=>{n(w)&&c(yt)})}s(W);var He=m(W,2),$t=i(He);{var wt=c=>{var v=ae(),k=j(v);At(k,()=>n(tt),E=>{Ot(E,{get result(){return n(se)}})}),x(c,v)};T($t,c=>{n(se)&&c(wt)})}s(He),s(Se),I(c=>{var v,k;y(te,n(u)),y(ie,`${n(o).model.nodes.length??""} nodes · ${n(o).model.edges.length??""} edges`),y(gt,((v=n(C))==null?void 0:v.label)??((k=n(_))==null?void 0:k.label)??"Layers and communities"),Qe(Fe,1,c)},[()=>Ke(["truncate rounded px-1.5 py-0.5 hover:bg-bg-2 hover:text-fg-1",n(_)?"":"text-fg-0 bg-bg-2"].join(" "))]),Y("click",de,at),Y("click",Fe,we),x(d,b)},ut=d=>{var b=In(),z=i(b);Rt(z,{title:"Load a graph",message:"Render any contract-conformant graph.json — memory exports, codebase graphs, or graphify output — from a URL, a path, or a local file. No connection required.",get icon(){return Ye},actions:ke=>{var Q=zn(),te=i(Q),ne=i(te),ie=i(ne);Tt(ie,{size:15,class:"absolute left-2.5 text-fg-3 pointer-events-none"});var le=m(ie,2);Ut(le),s(ne);var ce=m(ne,2),de=i(ce,!0);s(ce),s(te);var Z=m(te,4),Se=i(Z);Qt(Se,{size:15}),Ve(),s(Z);var W=m(Z,2);Jt(W,L=>g(D,L),()=>n(D));var ue=m(W,2);{var pe=L=>{var fe=Nn(),Ge=i(fe,!0);s(fe),I(()=>y(Ge,n(a))),x(L,fe)};T(ue,L=>{n(a)&&L(pe)})}s(Q),I(L=>{le.disabled=n(r),ce.disabled=L,y(de,n(r)?"Loading…":"Load"),Z.disabled=n(r)},[()=>n(r)||!n(p).trim()]),Gt("submit",te,ot),qt(le,()=>n(p),L=>g(p,L)),Y("click",Z,()=>{var L;return(L=n(D))==null?void 0:L.click()}),Y("change",W,rt),x(ke,Q)}}),s(b),x(d,b)};T(ct,d=>{n(o)?d(dt):d(ut,-1)})}s(Ee),x(e,Ee),zt()}Et(["click","change"]);export{Bn as component};
|