studiograph 1.3.44-next.2 → 1.3.44-next.20
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/dist/server/routes/insights-api.js +7 -1
- package/dist/server/routes/insights-api.js.map +1 -1
- package/dist/services/auth-service.d.ts +2 -0
- package/dist/services/auth-service.js +15 -1
- package/dist/services/auth-service.js.map +1 -1
- package/dist/services/insights.js +52 -24
- package/dist/services/insights.js.map +1 -1
- package/dist/services/sync/model-factory.d.ts +6 -3
- package/dist/services/sync/model-factory.js +19 -5
- package/dist/services/sync/model-factory.js.map +1 -1
- package/dist/web/_app/immutable/assets/2.usgqms6b.css +1 -0
- package/dist/web/_app/immutable/assets/4.BZP82sm4.css +1 -0
- package/dist/web/_app/immutable/assets/{7.5LBMlZdT.css → 7.D55lTQ_F.css} +1 -1
- package/dist/web/_app/immutable/assets/8.DKYjn_lM.css +1 -0
- package/dist/web/_app/immutable/assets/ViewToolbar.CnlOM0gQ.css +1 -0
- package/dist/web/_app/immutable/chunks/{Sk0ODu4Y.js → B0qTqRR8.js} +1 -1
- package/dist/web/_app/immutable/chunks/B17cx9Sm.js +1 -0
- package/dist/web/_app/immutable/chunks/BC12QVnT.js +1 -0
- package/dist/web/_app/immutable/chunks/{vZ2iBqLE.js → BSBiehHY.js} +1 -1
- package/dist/web/_app/immutable/chunks/{APIqItee.js → BasUgd5N.js} +1 -1
- package/dist/web/_app/immutable/chunks/{DSh-OF2y.js → BenpwI6m.js} +1 -1
- package/dist/web/_app/immutable/chunks/BjAmYrTY.js +1 -0
- package/dist/web/_app/immutable/chunks/{BUcIsKRk.js → Bm1eIWxg.js} +1 -1
- package/dist/web/_app/immutable/chunks/{Bs4ovbtO.js → BoQu2xcr.js} +2 -2
- package/dist/web/_app/immutable/chunks/{DQJwHeKh.js → C3RWu-3l.js} +1 -1
- package/dist/web/_app/immutable/chunks/{DC9z5DEo.js → CDFdgZ9U.js} +1 -1
- package/dist/web/_app/immutable/chunks/CJdAJOAi.js +1 -0
- package/dist/web/_app/immutable/chunks/CLw5zKi0.js +1 -0
- package/dist/web/_app/immutable/chunks/{b0XUoOIH.js → COik51fd.js} +2 -2
- package/dist/web/_app/immutable/chunks/{CRnhIQbv.js → CStpN6HQ.js} +1 -1
- package/dist/web/_app/immutable/chunks/CbwDFpOn.js +1 -0
- package/dist/web/_app/immutable/chunks/{CFtRXHDP.js → CieeblIr.js} +1 -1
- package/dist/web/_app/immutable/chunks/{DiWKchgv.js → CyzLSh3b.js} +1 -1
- package/dist/web/_app/immutable/chunks/D4U_ZqJF.js +1 -0
- package/dist/web/_app/immutable/chunks/{BU2bHQbQ.js → D9gozPE-.js} +1 -1
- package/dist/web/_app/immutable/chunks/{DQ5NTKSo.js → DAD7hf2c.js} +1 -1
- package/dist/web/_app/immutable/chunks/DC1nGnOD.js +1 -0
- package/dist/web/_app/immutable/chunks/DN_2uSjw.js +1 -0
- package/dist/web/_app/immutable/chunks/DUemNi3j.js +1 -0
- package/dist/web/_app/immutable/chunks/{DodWDTE5.js → DgjlIhdd.js} +1 -1
- package/dist/web/_app/immutable/chunks/DkilSMcP.js +5 -0
- package/dist/web/_app/immutable/chunks/DkyV2KO_.js +1 -0
- package/dist/web/_app/immutable/chunks/DtsqpIgr.js +1 -0
- package/dist/web/_app/immutable/chunks/{DT3KtxWU.js → Dvv4bkXH.js} +1 -1
- package/dist/web/_app/immutable/chunks/{CSzKZPD4.js → DwG0Us6L.js} +1 -1
- package/dist/web/_app/immutable/chunks/{Diui_MO0.js → DxO4848T.js} +1 -1
- package/dist/web/_app/immutable/chunks/OFOivmhv.js +1 -0
- package/dist/web/_app/immutable/chunks/h2NtTN7K.js +1 -0
- package/dist/web/_app/immutable/chunks/owhS8Kw_.js +1 -0
- package/dist/web/_app/immutable/chunks/ujukzxos.js +1 -0
- package/dist/web/_app/immutable/chunks/{D-yNNNdf.js → wWaI7EIw.js} +1 -1
- package/dist/web/_app/immutable/entry/{app.DA5OyPOi.js → app.CU7TLhrM.js} +2 -2
- package/dist/web/_app/immutable/entry/start.DgZDAZcw.js +1 -0
- package/dist/web/_app/immutable/nodes/0.BDvk9PGI.js +2 -0
- package/dist/web/_app/immutable/nodes/{1.y3j9wcQE.js → 1.BIyCV821.js} +1 -1
- package/dist/web/_app/immutable/nodes/{10.D03BZcr1.js → 10.B1u2MAJO.js} +1 -1
- package/dist/web/_app/immutable/nodes/2.BTUKEVj1.js +84 -0
- package/dist/web/_app/immutable/nodes/3.B_Uwqq0c.js +1 -0
- package/dist/web/_app/immutable/nodes/4.BvQu9TFK.js +11 -0
- package/dist/web/_app/immutable/nodes/{5.CipwuwB3.js → 5.CexWzcG1.js} +1 -1
- package/dist/web/_app/immutable/nodes/{6.Daxwm3Lw.js → 6.BzUiTkSF.js} +1 -1
- package/dist/web/_app/immutable/nodes/7.CGDU7sfE.js +2 -0
- package/dist/web/_app/immutable/nodes/8.Cd-elUzW.js +1 -0
- package/dist/web/_app/immutable/nodes/{9.BuTZk7Le.js → 9.5wb2zwiT.js} +1 -1
- package/dist/web/_app/version.json +1 -1
- package/dist/web/index.html +11 -11
- package/package.json +1 -1
- package/dist/web/_app/immutable/assets/2.DNpjFx0k.css +0 -1
- package/dist/web/_app/immutable/assets/4.CjSyz-ka.css +0 -1
- package/dist/web/_app/immutable/assets/8.DfcI2i9H.css +0 -1
- package/dist/web/_app/immutable/assets/ViewToolbar.BX74Ki7U.css +0 -1
- package/dist/web/_app/immutable/chunks/0rsp5-Up.js +0 -1
- package/dist/web/_app/immutable/chunks/0wBGAod7.js +0 -1
- package/dist/web/_app/immutable/chunks/B3NI-DOv.js +0 -1
- package/dist/web/_app/immutable/chunks/BAAbylyg.js +0 -1
- package/dist/web/_app/immutable/chunks/BHue2Ock.js +0 -1
- package/dist/web/_app/immutable/chunks/BPXdu_FX.js +0 -1
- package/dist/web/_app/immutable/chunks/BgBJ0u3M.js +0 -1
- package/dist/web/_app/immutable/chunks/Bnl5ADsW.js +0 -1
- package/dist/web/_app/immutable/chunks/Bt5_mycY.js +0 -1
- package/dist/web/_app/immutable/chunks/By_Wtb5J.js +0 -1
- package/dist/web/_app/immutable/chunks/DCVmM0L5.js +0 -1
- package/dist/web/_app/immutable/chunks/DHtLlmE0.js +0 -1
- package/dist/web/_app/immutable/chunks/DQYNi3YK.js +0 -5
- package/dist/web/_app/immutable/chunks/DSkxw4Ss.js +0 -1
- package/dist/web/_app/immutable/chunks/DVx_0hnZ.js +0 -1
- package/dist/web/_app/immutable/chunks/KHKAD2Ng.js +0 -1
- package/dist/web/_app/immutable/chunks/azUmHUDT.js +0 -1
- package/dist/web/_app/immutable/chunks/lsAKkphT.js +0 -1
- package/dist/web/_app/immutable/entry/start.DTjSVtws.js +0 -1
- package/dist/web/_app/immutable/nodes/0.BIvpQ3Qk.js +0 -2
- package/dist/web/_app/immutable/nodes/2.Du0xZVQg.js +0 -84
- package/dist/web/_app/immutable/nodes/3.weQEi2lI.js +0 -1
- package/dist/web/_app/immutable/nodes/4.DJyhWznw.js +0 -11
- package/dist/web/_app/immutable/nodes/7.TxeJDMtw.js +0 -2
- package/dist/web/_app/immutable/nodes/8.DWNdmB4l.js +0 -1
- /package/dist/web/_app/immutable/assets/{checkbox.D6tMDJWk.css → index.D6tMDJWk.css} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/DnL9f0lc.js","../chunks/CX_61fY8.js","../chunks/CscoF-YL.js","../chunks/D7ZqAKi9.js","../chunks/C7VoTosa.js","../chunks/CrdV0ttd.js","../chunks/CWQRQXxy.js","../chunks/B340SUKR.js","../chunks/C3RWu-3l.js","../chunks/CLFba8FK.js","../chunks/BoQu2xcr.js","../chunks/PPVm8Dsz.js","../chunks/BenpwI6m.js","../chunks/CJdAJOAi.js","../chunks/BjAmYrTY.js","../chunks/CieeblIr.js","../chunks/B0qTqRR8.js","../chunks/CDFdgZ9U.js","../chunks/COik51fd.js","../chunks/i9c_RUF6.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{h as Bt,w as ut,k as Ht}from"../chunks/BjAmYrTY.js";import{_ as qe}from"../chunks/PPVm8Dsz.js";import{d as vt,e as ze,g as Ze,a as h,c as Re,t as ot,s as pe,b as j,f as $e}from"../chunks/COik51fd.js";import{p as He,e as Ee,f as it,a2 as rt,aE as Yt,c as A,a3 as W,r as w,g as t,s as E,b as Ye,a0 as he,n as je,t as de,a4 as ke,l as Ge,d as Ne,a as ht,m as Qe,a1 as Zt,aD as Jt,aF as Vt,ax as Gt,a7 as Qt,bt as Xt}from"../chunks/BenpwI6m.js";import{i as ce,b as ct}from"../chunks/Dvv4bkXH.js";import{e as Ue,i as Be}from"../chunks/h2NtTN7K.js";import{c as Te}from"../chunks/CbwDFpOn.js";import{s as lt,c as $t}from"../chunks/CieeblIr.js";import{p as Oe,l as Xe,a as ea,b as ta}from"../chunks/wWaI7EIw.js";import{g as ft,i as aa}from"../chunks/CJdAJOAi.js";import{A as St,p as ra}from"../chunks/DgjlIhdd.js";import{a as xt,V as na}from"../chunks/ujukzxos.js";import{r as nt,a as pt,c as We,d as dt,b as At}from"../chunks/CStpN6HQ.js";import{b as qt,B as Je}from"../chunks/DAD7hf2c.js";import{e as mt,f as at,A as ia}from"../chunks/CdeYcEuU.js";import{a as Pt,b as Rt,S as Tt,R as Dt}from"../chunks/B17cx9Sm.js";import{T as sa,P as oa,C as la,I as zt,S as ua,a as Et,R as da,p as Lt,b as ca}from"../chunks/D4U_ZqJF.js";import{i as _t}from"../chunks/BSBiehHY.js";import{T as fa,j as va,r as ha}from"../chunks/BC12QVnT.js";import{C as wt,a as Wt}from"../chunks/DtsqpIgr.js";import{A as pa,C as Ot}from"../chunks/CLw5zKi0.js";import{g as _a}from"../chunks/CqkleIqs.js";import{n as kt}from"../chunks/CDFdgZ9U.js";import{e as Ke,r as ga}from"../chunks/BoQu2xcr.js";import{chatStore as ma}from"../chunks/D9gozPE-.js";import{A as ya,u as ba,v as wa,x as ka,y as xa,z as Ea,G as Ca}from"../chunks/DkilSMcP.js";import{a as Ft}from"../chunks/B0qTqRR8.js";const Sa=async({params:J,fetch:e})=>{const{repo:i,type:s,id:p}=J,R=await Bt(i,s,p);return{repo:i,type:s,id:p,entity:R}},Zn=Object.freeze(Object.defineProperty({__proto__:null,load:Sa},Symbol.toStringTag,{value:"Module"}));var Aa=j('<span class="chip svelte-84vb17"> <!></span>'),Pa=j('<div><span class="entity-title svelte-84vb17"> </span> <span class="entity-meta svelte-84vb17"><span class="entity-type-badge svelte-84vb17"> </span> <span class="entity-repo svelte-84vb17"> </span></span></div>'),Ra=j('<div class="dropdown svelte-84vb17"></div>'),Ta=j('<div class="autocomplete svelte-84vb17"><div class="input-row svelte-84vb17"><!> <input class="ac-input svelte-84vb17" type="text" placeholder="Search entities..."/></div> <!></div>');function Da(J,e){He(e,!0);let i=Oe(e,"multi",3,!1),s=Ee(""),p=Ee(0),R;const _=ke(()=>ut.repos.flatMap(P=>P.entities.map(k=>({id:k.id,title:k.title,entityType:k.entityType,repo:P.name})))),C=ke(()=>()=>{const P=t(s).toLowerCase().trim();return P?t(_).filter(k=>k.title.toLowerCase().includes(P)||k.id.toLowerCase().includes(P)).slice(0,20):t(_).slice(0,20)}),x=Array.isArray(e.value)?[...e.value]:e.value?[e.value]:[];let c=Ee(it(x));rt(()=>{Yt().then(()=>R?.focus())});function L(P){i()?(t(c).includes(P)||E(c,[...t(c),P],!0),E(s,""),E(p,0),R?.focus()):e.onselect(P)}function N(P){E(c,t(c).filter(k=>k!==P),!0)}function S(){t(c).length===x.length&&t(c).every((k,a)=>k===x[a])?e.oncancel():e.onselect(t(c))}function M(P){const k=t(C)();P.key==="ArrowDown"?(P.preventDefault(),E(p,Math.min(t(p)+1,k.length-1),!0)):P.key==="ArrowUp"?(P.preventDefault(),E(p,Math.max(t(p)-1,0),!0)):P.key==="Enter"?(P.preventDefault(),k.length>0?L(k[t(p)].id):i()&&S()):P.key==="Escape"?i()&&t(c).length>0?S():e.oncancel():P.key==="Backspace"&&!t(s)&&i()&&t(c).length>0&&E(c,t(c).slice(0,-1),!0)}var me=Ta(),G=A(me),ne=A(G);{var ye=P=>{var k=Re(),a=he(k);Ue(a,17,()=>t(c),Be,(r,o)=>{var f=Aa(),g=A(f),K=W(g);Je(K,{variant:"ghost",size:"icon",class:"chip-remove",onclick:()=>N(t(o)),children:(ve,be)=>{je();var b=ot("×");h(ve,b)},$$slots:{default:!0}}),w(f),de(()=>pe(g,`${t(o)??""} `)),h(r,f)}),h(P,k)};ce(ne,P=>{i()&&P(ye)})}var oe=W(ne,2);nt(oe),ct(oe,P=>R=P,()=>R),w(G);var le=W(G,2);{var _e=P=>{var k=Ra();Ue(k,21,()=>t(C)(),Be,(a,r,o)=>{var f=Pa();let g;var K=A(f),ve=A(K,!0);w(K);var be=W(K,2),b=A(be),l=A(b,!0);w(b);var d=W(b,2),F=A(d,!0);w(d),w(be),w(f),de(()=>{g=lt(f,1,"dropdown-item svelte-84vb17",null,g,{highlighted:o===t(p)}),pe(ve,t(r).title),pe(l,t(r).entityType),pe(F,t(r).repo)}),ze("mousedown",f,X=>{X.preventDefault(),L(t(r).id)}),Ze("mouseenter",f,()=>E(p,o,!0)),h(a,f)}),w(k),h(P,k)},se=ke(()=>t(C)().length>0);ce(le,P=>{t(se)&&P(_e)})}w(me),ze("keydown",oe,M),Ze("blur",oe,()=>{setTimeout(()=>{i()&&t(c).length>0?S():i()||e.oncancel()},150)}),qt(oe,()=>t(s),P=>E(s,P)),h(J,me),Ye()}vt(["keydown","mousedown"]);var za=$e("<title> </title>"),La=$e('<svg><!><circle cx="16" cy="16" r="10"></circle><path d="M16,30A14,14,0,1,1,30,16,14.0158,14.0158,0,0,1,16,30ZM16,4A12,12,0,1,0,28,16,12.0137,12.0137,0,0,0,16,4Z"></path></svg>');function yt(J,e){const i=Xe(e,["children","$$slots","$$events","$$legacy"]),s=Xe(i,["size","title"]);He(e,!1);const p=Qe(),R=Qe();let _=Oe(e,"size",8,16),C=Oe(e,"title",8,void 0);Ge(()=>(Ne(i),Ne(C())),()=>{E(p,i["aria-label"]||i["aria-labelledby"]||C())}),Ge(()=>(t(p),Ne(i)),()=>{E(R,{"aria-hidden":t(p)?void 0:!0,role:t(p)?"img":void 0,focusable:Number(i.tabindex)===0?!0:void 0})}),ht(),_t();var x=La();pt(x,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:_(),height:_(),...t(R),...s}));var c=A(x);{var L=N=>{var S=za(),M=A(S,!0);w(S),de(()=>pe(M,C())),h(N,S)};ce(c,N=>{C()&&N(L)})}je(2),w(x),h(J,x),Ye()}var Oa=$e("<title> </title>"),Fa=$e('<svg><!><path d="M29.25,6.76a6,6,0,0,0-8.5,0l1.42,1.42a4,4,0,1,1,5.67,5.67l-8,8a4,4,0,1,1-5.67-5.66l1.41-1.42-1.41-1.42-1.42,1.42a6,6,0,0,0,0,8.5A6,6,0,0,0,17,25a6,6,0,0,0,4.27-1.76l8-8A6,6,0,0,0,29.25,6.76Z"></path><path d="M4.19,24.82a4,4,0,0,1,0-5.67l8-8a4,4,0,0,1,5.67,0A3.94,3.94,0,0,1,19,14a4,4,0,0,1-1.17,2.85L15.71,19l1.42,1.42,2.12-2.12a6,6,0,0,0-8.51-8.51l-8,8a6,6,0,0,0,0,8.51A6,6,0,0,0,7,28a6.07,6.07,0,0,0,4.28-1.76L9.86,24.82A4,4,0,0,1,4.19,24.82Z"></path></svg>');function Ct(J,e){const i=Xe(e,["children","$$slots","$$events","$$legacy"]),s=Xe(i,["size","title"]);He(e,!1);const p=Qe(),R=Qe();let _=Oe(e,"size",8,16),C=Oe(e,"title",8,void 0);Ge(()=>(Ne(i),Ne(C())),()=>{E(p,i["aria-label"]||i["aria-labelledby"]||C())}),Ge(()=>(t(p),Ne(i)),()=>{E(R,{"aria-hidden":t(p)?void 0:!0,role:t(p)?"img":void 0,focusable:Number(i.tabindex)===0?!0:void 0})}),ht(),_t();var x=Fa();pt(x,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:_(),height:_(),...t(R),...s}));var c=A(x);{var L=N=>{var S=Oa(),M=A(S,!0);w(S),de(()=>pe(M,C())),h(N,S)};ce(c,N=>{C()&&N(L)})}je(2),w(x),h(J,x),Ye()}var Ma=$e("<title> </title>"),Ia=$e('<svg><!><path d="M26,28H6a2.0027,2.0027,0,0,1-2-2V6A2.0027,2.0027,0,0,1,6,4H16V6H6V26H26V16h2V26A2.0027,2.0027,0,0,1,26,28Z"></path><path d="M20 2 20 4 26.586 4 18 12.586 19.414 14 28 5.414 28 12 30 12 30 2 20 2z"></path></svg>');function Mt(J,e){const i=Xe(e,["children","$$slots","$$events","$$legacy"]),s=Xe(i,["size","title"]);He(e,!1);const p=Qe(),R=Qe();let _=Oe(e,"size",8,16),C=Oe(e,"title",8,void 0);Ge(()=>(Ne(i),Ne(C())),()=>{E(p,i["aria-label"]||i["aria-labelledby"]||C())}),Ge(()=>(t(p),Ne(i)),()=>{E(R,{"aria-hidden":t(p)?void 0:!0,role:t(p)?"img":void 0,focusable:Number(i.tabindex)===0?!0:void 0})}),ht(),_t();var x=Ia();pt(x,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:_(),height:_(),...t(R),...s}));var c=A(x);{var L=N=>{var S=Ma(),M=A(S,!0);w(S),de(()=>pe(M,C())),h(N,S)};ce(c,N=>{C()&&N(L)})}je(2),w(x),h(J,x),Ye()}var ja=j(" <!>",1),Ka=j("<!> Remove",1),Ua=j("<!> <!> <!>",1),Na=j("<!> <!>",1),Va=j('<span class="dot svelte-eh8ho9"></span> <span> </span>',1),qa=j('<span class="dot svelte-eh8ho9"></span> <span> </span> <!>',1),Wa=j("<!> <!>",1),Ba=j('<span class="dot svelte-eh8ho9"></span> ',1),Ha=j('<span class="dot svelte-eh8ho9"></span> <span> </span>',1),Ya=j('<span class="dot svelte-eh8ho9"></span> <span> </span> <!>',1),Za=j("<!> <!>",1),Ja=j('<span class="dot svelte-eh8ho9"></span> ',1),Ga=j('<span class="date-display svelte-eh8ho9"> </span>'),Qa=j('<div class="date-edit svelte-eh8ho9"><input class="edit-input date-input svelte-eh8ho9" type="date"/> <!></div>'),Xa=j('<span class="date-value svelte-eh8ho9"> </span>'),$a=j('<input class="wikilink-input svelte-eh8ho9" type="text" readonly=""/>'),er=j('<div class="wikilink-display svelte-eh8ho9"><!> <!></div>'),tr=j('<input class="edit-input svelte-eh8ho9" type="url" placeholder="https://..."/>'),ar=j('<a class="url-link svelte-eh8ho9" target="_blank" rel="noopener noreferrer"> </a>'),rr=j('<span class="empty-hint svelte-eh8ho9">Empty</span>'),nr=j('<span class="url-display svelte-eh8ho9"><!></span>'),ir=j('<span class="badge-value svelte-eh8ho9"> </span>'),sr=j('<input class="edit-input svelte-eh8ho9" type="text" placeholder="Empty"/>'),or=j('<span class="text-value svelte-eh8ho9"> </span>'),lr=j('<div class="property-row svelte-eh8ho9"><div class="prop-icon svelte-eh8ho9"><!></div> <span class="prop-key svelte-eh8ho9"> </span> <div class="prop-value svelte-eh8ho9"><!></div></div>');function ur(J,e){He(e,!0);let i=Oe(e,"editable",3,!1),s=Oe(e,"protectedKeys",19,()=>new Set);const p=[{type:"text",label:"Text"},{type:"date",label:"Date"},{type:"status",label:"Status"},{type:"wikilink",label:"Link"},{type:"url",label:"URL"}],R=["open","in-progress","done","cancelled","active","inactive","completed","draft","archived","current","former","won","lost","closed"];function _(){return typeof e.prop.value=="string"?e.prop.value:e.prop.value[0]??""}function C(v){switch(v.toLowerCase()){case"active":case"current":case"won":case"done":case"completed":return"#3ecf8e";case"in-progress":case"open":case"draft":return"#f0c246";case"inactive":case"lost":case"closed":case"former":case"cancelled":return"#e54d4d";default:return"#5c5c66"}}function x(v){return v.replace(/[-_]/g," ").replace(/\b\w/g,u=>u.toUpperCase())}function c(v){return v.replace(/_/g," ").replace(/\b\w/g,u=>u.toUpperCase())}function L(v){if(!v)return"";try{return new Date(v).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return v}}function N(v){for(const u of ut.repos){const O=u.entities.find(Q=>Q.id===v);if(O){ft(`/${u.name}/${O.entityType}/${O.id}`);return}}}let S=Ee(!1),M=Ee(null);function me(v){v!==_()&&e.onedit?.(e.prop.key,v),E(S,!1)}let G=Ee(!1);var ne=lr(),ye=A(ne),oe=A(ye);{var le=v=>{yt(v,{size:14})},_e=v=>{var u=Re(),O=he(u);Te(O,()=>da,(Q,V)=>{V(Q,{children:(T,m)=>{var y=Na(),te=he(y);Te(te,()=>sa,($,I)=>{I($,{class:"icon-trigger",children:(H,fe)=>{var B=Re(),Ae=he(B);{var n=q=>{xt(q,{size:14})},D=q=>{yt(q,{size:14})},ie=q=>{Ct(q,{size:14})},Y=q=>{Mt(q,{size:14})},ue=q=>{Et(q,{size:14})};ce(Ae,q=>{e.prop.type==="date"?q(n):e.prop.type==="status"?q(D,1):e.prop.type==="wikilink"?q(ie,2):e.prop.type==="url"?q(Y,3):q(ue,!1)})}h(H,B)},$$slots:{default:!0}})});var z=W(te,2);Te(z,()=>oa,($,I)=>{I($,{children:(H,fe)=>{var B=Re(),Ae=he(B);Te(Ae,()=>la,(n,D)=>{D(n,{class:"type-menu-content",sideOffset:4,align:"start",children:(ie,Y)=>{var ue=Ua(),q=he(ue);Ue(q,17,()=>p,Be,(U,ee)=>{var we=Re(),ge=he(we);Te(ge,()=>zt,(Ce,Pe)=>{Pe(Ce,{class:"type-menu-item",onSelect:()=>e.ontypechange?.(e.prop.key,t(ee).type),children:(xe,Se)=>{je();var Le=ja(),Fe=he(Le),De=W(Fe);{var Me=Ve=>{wt(Ve,{size:12})};ce(De,Ve=>{e.prop.type===t(ee).type&&Ve(Me)})}de(()=>pe(Fe,`${t(ee).label??""} `)),h(xe,Le)},$$slots:{default:!0}})}),h(U,we)});var ae=W(q,2);Te(ae,()=>ua,(U,ee)=>{ee(U,{})});var re=W(ae,2);Te(re,()=>zt,(U,ee)=>{ee(U,{class:"type-menu-item type-menu-danger",onSelect:()=>e.onremove?.(e.prop.key),children:(we,ge)=>{var Ce=Ka(),Pe=he(Ce);fa(Pe,{size:12}),je(),h(we,Ce)},$$slots:{default:!0}})}),h(ie,ue)},$$slots:{default:!0}})}),h(H,B)},$$slots:{default:!0}})}),h(T,y)},$$slots:{default:!0}})}),h(v,u)},se=ke(()=>i()&&e.prop.type!=="badge"&&!s().has(e.prop.key)),P=v=>{xt(v,{size:14})},k=v=>{yt(v,{size:14})},a=v=>{Ct(v,{size:14})},r=v=>{Mt(v,{size:14})},o=v=>{Et(v,{size:14})};ce(oe,v=>{e.prop.type==="entity-type"?v(le):t(se)?v(_e,1):e.prop.type==="date"?v(P,2):e.prop.type==="status"?v(k,3):e.prop.type==="wikilink"?v(a,4):e.prop.type==="url"?v(r,5):v(o,!1)})}w(ye);var f=W(ye,2),g=A(f,!0);w(f);var K=W(f,2),ve=A(K);{var be=v=>{var u=Re(),O=he(u);{var Q=T=>{var m=Re(),y=he(m);{let te=ke(_);Te(y,()=>Dt,(z,$)=>{$(z,{type:"single",get value(){return t(te)},onValueChange:I=>{I&&I!==_()&&e.onentitytypechange?.(I)},children:(I,H)=>{var fe=Wa(),B=he(fe);{let n=ke(()=>at(_()));Te(B,()=>Pt,(D,ie)=>{ie(D,{class:"status-trigger",get value(){return t(n)},children:(Y,ue)=>{var q=Va(),ae=he(q);let re;var U=W(ae,2),ee=A(U,!0);w(U),de((we,ge)=>{re=We(ae,"",re,we),pe(ee,ge)},[()=>({background:mt(_())}),()=>at(_())]),h(Y,q)},$$slots:{default:!0}})})}var Ae=W(B,2);Te(Ae,()=>Rt,(n,D)=>{D(n,{children:(ie,Y)=>{var ue=Re(),q=he(ue);Ue(q,17,()=>ia,Be,(ae,re)=>{var U=Re(),ee=he(U);{let we=ke(()=>at(t(re)));Te(ee,()=>Tt,(ge,Ce)=>{Ce(ge,{get value(){return t(re)},get label(){return t(we)},class:"dotted-item",children:(Pe,xe)=>{var Se=qa(),Le=he(Se);let Fe;var De=W(Le,2),Me=A(De,!0);w(De);var Ve=W(De,2);{var et=Ie=>{wt(Ie,{size:12,class:"item-check"})},tt=ke(()=>_()===t(re));ce(Ve,Ie=>{t(tt)&&Ie(et)})}de((Ie,st)=>{Fe=We(Le,"",Fe,Ie),pe(Me,st)},[()=>({background:mt(t(re))}),()=>at(t(re))]),h(Pe,Se)},$$slots:{default:!0}})})}h(ae,U)}),h(ie,ue)},$$slots:{default:!0}})}),h(I,fe)},$$slots:{default:!0}})})}h(T,m)},V=T=>{var m=Ba(),y=he(m);let te;var z=W(y);de(($,I)=>{te=We(y,"",te,$),pe(z,` ${I??""}`)},[()=>({background:mt(_())}),()=>at(_())]),h(T,m)};ce(O,T=>{i()?T(Q):T(V,!1)})}h(v,u)},b=v=>{var u=Re(),O=he(u);{var Q=T=>{var m=Re(),y=he(m);{let te=ke(_);Te(y,()=>Dt,(z,$)=>{$(z,{type:"single",get value(){return t(te)},onValueChange:I=>{I&&e.onedit?.(e.prop.key,I)},children:(I,H)=>{var fe=Za(),B=he(fe);{let n=ke(()=>x(_()));Te(B,()=>Pt,(D,ie)=>{ie(D,{class:"status-trigger",get value(){return t(n)},children:(Y,ue)=>{var q=Ha(),ae=he(q);let re;var U=W(ae,2),ee=A(U,!0);w(U),de((we,ge)=>{re=We(ae,"",re,we),pe(ee,ge)},[()=>({background:C(_())}),()=>x(_())]),h(Y,q)},$$slots:{default:!0}})})}var Ae=W(B,2);Te(Ae,()=>Rt,(n,D)=>{D(n,{children:(ie,Y)=>{var ue=Re(),q=he(ue);Ue(q,17,()=>R,Be,(ae,re)=>{var U=Re(),ee=he(U);{let we=ke(()=>x(t(re)));Te(ee,()=>Tt,(ge,Ce)=>{Ce(ge,{get value(){return t(re)},get label(){return t(we)},class:"dotted-item",children:(Pe,xe)=>{var Se=Ya(),Le=he(Se);let Fe;var De=W(Le,2),Me=A(De,!0);w(De);var Ve=W(De,2);{var et=Ie=>{wt(Ie,{size:12,class:"item-check"})},tt=ke(()=>_()===t(re));ce(Ve,Ie=>{t(tt)&&Ie(et)})}de((Ie,st)=>{Fe=We(Le,"",Fe,Ie),pe(Me,st)},[()=>({background:C(t(re))}),()=>x(t(re))]),h(Pe,Se)},$$slots:{default:!0}})})}h(ae,U)}),h(ie,ue)},$$slots:{default:!0}})}),h(I,fe)},$$slots:{default:!0}})})}h(T,m)},V=T=>{var m=Ja(),y=he(m);let te;var z=W(y);de(($,I)=>{te=We(y,"",te,$),pe(z,` ${I??""}`)},[()=>({background:C(_())}),()=>x(_())]),h(T,m)};ce(O,T=>{i()?T(Q):T(V,!1)})}h(v,u)},l=v=>{var u=Re(),O=he(u);{var Q=T=>{var m=Qa(),y=A(m);nt(y);var te=W(y,2);{var z=I=>{var H=Ga(),fe=A(H,!0);w(H),de(B=>pe(fe,B),[()=>L(_())]),h(I,H)},$=ke(()=>_());ce(te,I=>{t($)&&I(z)})}w(m),de(I=>dt(y,I),[_]),ze("change",y,I=>{e.onedit?.(e.prop.key,I.currentTarget.value)}),h(T,m)},V=T=>{var m=Xa(),y=A(m,!0);w(m),de(te=>pe(y,te),[()=>L(_())||"No date"]),h(T,m)};ce(O,T=>{i()?T(Q):T(V,!1)})}h(v,u)},d=v=>{var u=Re(),O=he(u);{var Q=T=>{{let m=ke(()=>Array.isArray(e.prop.value));Da(T,{get value(){return e.prop.value},get multi(){return t(m)},onselect:y=>{e.onedit?.(e.prop.key,y),E(G,!1)},oncancel:()=>{E(G,!1)}})}},V=T=>{var m=er(),y=A(m);Ue(y,17,()=>(Array.isArray(e.prop.value)?e.prop.value:[e.prop.value]).filter(Boolean),Be,($,I)=>{Je($,{variant:"ghost",class:"wikilink-chip",onclick:H=>{H.stopPropagation(),N(t(I))},children:(H,fe)=>{je();var B=ot();de(()=>pe(B,t(I))),h(H,B)},$$slots:{default:!0}})});var te=W(y,2);{var z=$=>{var I=$a();de(H=>At(I,"placeholder",H),[()=>_()?"":"Empty"]),Ze("focus",I,()=>{E(G,!0)}),h($,I)};ce(te,$=>{i()&&$(z)})}w(m),h(T,m)};ce(O,T=>{t(G)&&i()?T(Q):T(V,!1)})}h(v,u)},F=v=>{var u=Re(),O=he(u);{var Q=T=>{var m=tr();nt(m),ct(m,y=>E(M,y),()=>t(M)),de(y=>dt(m,y),[_]),Ze("blur",m,y=>{me(y.currentTarget.value)}),ze("keydown",m,y=>{y.key==="Enter"&&y.currentTarget.blur(),y.key==="Escape"&&E(S,!1)}),h(T,m)},V=T=>{var m=nr(),y=A(m);{var te=I=>{var H=ar(),fe=A(H,!0);w(H),de((B,Ae)=>{At(H,"href",B),pe(fe,Ae)},[_,_]),ze("click",H,B=>B.stopPropagation()),h(I,H)},z=ke(()=>_()),$=I=>{var H=rr();h(I,H)};ce(y,I=>{t(z)?I(te):i()&&I($,1)})}w(m),ze("click",m,()=>{i()&&(E(S,!0),requestAnimationFrame(()=>t(M)?.focus()))}),h(T,m)};ce(O,T=>{t(S)&&i()?T(Q):T(V,!1)})}h(v,u)},X=v=>{var u=ir(),O=A(u,!0);w(u),de(Q=>pe(O,Q),[_]),h(v,u)},Z=v=>{var u=Re(),O=he(u);{var Q=T=>{var m=sr();nt(m),de(y=>dt(m,y),[_]),Ze("focus",m,()=>{E(S,!0)}),Ze("blur",m,y=>{me(y.currentTarget.value)}),ze("keydown",m,y=>{y.key==="Enter"&&y.currentTarget.blur(),y.key==="Escape"&&(y.currentTarget.value=_(),y.currentTarget.blur())}),h(T,m)},V=T=>{var m=or(),y=A(m,!0);w(m),de(te=>pe(y,te),[_]),h(T,m)};ce(O,T=>{i()?T(Q):T(V,!1)})}h(v,u)};ce(ve,v=>{e.prop.type==="entity-type"?v(be):e.prop.type==="status"?v(b,1):e.prop.type==="date"?v(l,2):e.prop.type==="wikilink"?v(d,3):e.prop.type==="url"?v(F,4):e.prop.type==="badge"?v(X,5):v(Z,!1)})}w(K),w(ne),de(v=>pe(g,v),[()=>c(e.prop.key)]),ze("click",ye,v=>v.stopPropagation()),h(J,ne),Ye()}vt(["click","change","keydown"]);var dr=j('<input class="name-input svelte-1a2lez6" type="text"/>'),cr=j('<span class="name-text svelte-1a2lez6"> </span>'),fr=j('<div class="name-headline svelte-1a2lez6"><!></div>'),vr=j('<button class="fields-toggle svelte-1a2lez6"><span><!></span> <span class="fields-label svelte-1a2lez6">Fields</span> <span class="fields-count svelte-1a2lez6"> </span></button>'),hr=j('<div class="add-field-row svelte-1a2lez6"><input class="add-field-input svelte-1a2lez6" type="text" placeholder="Field name"/></div>'),pr=j("<!> <span>Add field</span>",1),_r=j('<div class="fields-list svelte-1a2lez6"><!> <!></div>'),gr=j('<div class="entity-properties svelte-1a2lez6"><!> <!> <!></div>');function mr(J,e){He(e,!0);let i=Oe(e,"editable",3,!1),s=Oe(e,"autofocusKey",3,null),p=Oe(e,"protectedKeys",19,()=>new Set);const R=ke(()=>e.properties.find(f=>f.key==="name")),_=ke(()=>e.properties.filter(f=>f.key!=="name"));let C=Ee(!1),x=Ee(null);const c=ke(()=>t(R)?typeof t(R).value=="string"?t(R).value:t(R).value[0]:"");function L(){i()&&(E(C,!0),requestAnimationFrame(()=>t(x)?.focus()))}function N(f){f!==t(c)&&e.onedit?.("name",f),E(C,!1)}rt(()=>{s()==="name"&&!t(C)&&L()});const S="sg-properties-expanded";let M=Ee(it(typeof localStorage<"u"?localStorage.getItem(S)==="true":!1));function me(){E(M,!t(M)),localStorage.setItem(S,t(M)?"true":"false")}let G=Ee(!1),ne=Ee(""),ye=Ee(null);function oe(){E(G,!0),E(ne,""),requestAnimationFrame(()=>t(ye)?.focus())}function le(){const f=t(ne).trim().toLowerCase().replace(/\s+/g,"_");f&&!e.properties.some(g=>g.key===f)&&e.onadd?.(f,""),E(G,!1),E(ne,"")}var _e=gr(),se=A(_e);{var P=f=>{var g=fr(),K=A(g);{var ve=b=>{var l=dr();nt(l),ct(l,d=>E(x,d),()=>t(x)),de(()=>dt(l,t(c))),Ze("blur",l,d=>N(d.currentTarget.value)),ze("keydown",l,d=>{d.key==="Enter"&&(N(d.currentTarget.value),e.onfocuseditor?.()),d.key==="Escape"&&E(C,!1)}),h(b,l)},be=b=>{var l=cr(),d=A(l,!0);w(l),de(()=>pe(d,t(c)||"Untitled")),h(b,l)};ce(K,b=>{t(C)?b(ve):b(be,!1)})}w(g),ze("click",g,L),h(f,g)};ce(se,f=>{t(R)&&f(P)})}var k=W(se,2);{var a=f=>{var g=vr(),K=A(g);let ve;var be=A(K);Wt(be,{size:14}),w(K);var b=W(K,4),l=A(b,!0);w(b),w(g),de(()=>{ve=lt(K,1,"fields-chevron svelte-1a2lez6",null,ve,{expanded:t(M)}),pe(l,t(_).length)}),ze("mousedown",g,d=>d.preventDefault()),ze("click",g,me),h(f,g)};ce(k,f=>{t(_).length>0&&f(a)})}var r=W(k,2);{var o=f=>{var g=_r(),K=A(g);Ue(K,17,()=>t(_),l=>l.key,(l,d)=>{ur(l,{get prop(){return t(d)},get editable(){return i()},get protectedKeys(){return p()},get onedit(){return e.onedit},get onremove(){return e.onremove},get ontypechange(){return e.ontypechange},get onentitytypechange(){return e.onentitytypechange}})});var ve=W(K,2);{var be=l=>{var d=hr(),F=A(d);nt(F),ct(F,X=>E(ye,X),()=>t(ye)),w(d),ze("keydown",F,X=>{X.key==="Enter"&&le(),X.key==="Escape"&&E(G,!1)}),Ze("blur",F,()=>{E(G,!1)}),qt(F,()=>t(ne),X=>E(ne,X)),h(l,d)},b=l=>{Je(l,{variant:"ghost",class:"add-field-btn",onclick:d=>{d.stopPropagation(),oe()},children:(d,F)=>{var X=pr(),Z=he(X);pa(Z,{size:16}),je(2),h(d,X)},$$slots:{default:!0}})};ce(ve,l=>{t(G)?l(be):i()&&l(b,1)})}w(g),h(f,g)};ce(r,f=>{t(M)&&f(o)})}w(_e),h(J,_e),Ye()}vt(["click","keydown","mousedown"]);var yr=j('<button class="connection-chip svelte-16xienp"><span class="chip-dot svelte-16xienp"></span> <span class="chip-name svelte-16xienp"> </span> <span class="chip-type svelte-16xienp"> </span></button>'),br=j('<div class="connections-body svelte-16xienp"></div>'),wr=j('<div class="connections-panel svelte-16xienp"><button class="connections-header svelte-16xienp"><span><!></span> <span class="header-label svelte-16xienp">Linked entities</span> <span class="header-count svelte-16xienp"> </span></button> <!></div>');function kr(J,e){He(e,!0);const i="sg-linked-entities-expanded";let s=Ee(it(typeof localStorage<"u"?localStorage.getItem(i)!=="true":!0));function p(){E(s,!t(s)),localStorage.setItem(i,t(s)?"false":"true")}const R=ke(()=>{const L=[],N=e.entityId.toLowerCase();for(const S of ut.repos)for(const M of S.entities)if(!(M.id===e.entityId&&M.repo===e.entityRepo)){for(const me of M.wikilinks)if(me.replace(/\[\[|\]\]/g,"").trim().toLowerCase()===N){L.push(M);break}}return L});function _(L){ft(`/${L.repo}/${L.entityType}/${L.id}`)}var C=Re(),x=he(C);{var c=L=>{var N=wr(),S=A(N),M=A(S);let me;var G=A(M);Wt(G,{size:14}),w(M);var ne=W(M,4),ye=A(ne,!0);w(ne),w(S);var oe=W(S,2);{var le=_e=>{var se=br();Ue(se,21,()=>t(R),Be,(P,k)=>{const a=ke(()=>mt(t(k).entityType));var r=yr(),o=A(r);let f;var g=W(o,2),K=A(g,!0);w(g);var ve=W(g,2),be=A(ve,!0);w(ve),w(r),de(b=>{f=We(o,"",f,{background:t(a)}),pe(K,t(k).title),pe(be,b)},[()=>at(t(k).entityType)]),ze("click",r,()=>_(t(k))),h(P,r)}),w(se),h(_e,se)};ce(oe,_e=>{t(s)||_e(le)})}w(N),de(()=>{me=lt(M,1,"header-chevron svelte-16xienp",null,me,{collapsed:t(s)}),pe(ye,t(R).length)}),ze("mousedown",S,_e=>_e.preventDefault()),ze("click",S,p),h(L,N)};ce(x,L=>{t(R).length>0&&L(c)})}h(J,C),Ye()}vt(["mousedown","click"]);var xr=j('<div class="remote-cursor svelte-ok7wy5"><span class="remote-cursor-label svelte-ok7wy5"> </span></div>'),Er=j('<div class="cursor-overlay svelte-ok7wy5"></div>'),Cr=j('<div class="editor-wrap svelte-ok7wy5"><div class="cm-container svelte-ok7wy5"></div> <!></div>');function Sr(J,e){He(e,!0);let i=Oe(e,"readonly",3,!0),s=Oe(e,"resetKey",3,0);const p=Zt("theme");let R,_=null,C=null,x=Ee(""),c=null,L=Ee(it([])),N=null,S=e.content;function M(le,_e){return le.theme({"&":{backgroundColor:"transparent",color:"var(--color-text-primary)",fontSize:"15px",fontFamily:"var(--font-sans)"},".cm-content":{padding:"32px 40px",fontFamily:"var(--font-sans)",caretColor:"var(--color-accent)",lineHeight:"1.6"},".cm-cursor":{borderLeftColor:"var(--color-accent)"},".cm-selectionBackground":{backgroundColor:_e?"rgba(110,110,232,0.2)":"rgba(110,110,232,0.15)"},"&.cm-focused .cm-selectionBackground":{backgroundColor:_e?"rgba(110,110,232,0.3)":"rgba(110,110,232,0.2)"},".cm-gutters":{display:"none"},".cm-activeLine":{backgroundColor:"transparent"},".cm-line":{padding:"0"},".cm-header-1":{fontSize:"22px",fontWeight:"600"},".cm-header-2":{fontSize:"16px",fontWeight:"600"},".cm-header-3":{fontSize:"15px",fontWeight:"600"},".cm-formatting":{color:"var(--color-text-tertiary)",opacity:"0.5"},".cm-link":{color:"var(--color-link)",textDecoration:"none"}},{dark:_e})}async function me(){_&&(_.destroy(),_=null),C&&(C.destroy(),C=null),E(L,[],!0);const{EditorState:le,Transaction:_e}=await qe(async()=>{const{EditorState:u,Transaction:O}=await import("../chunks/CX_61fY8.js");return{EditorState:u,Transaction:O}},[],import.meta.url);c=_e;const{EditorView:se,keymap:P,ViewPlugin:k}=await qe(async()=>{const{EditorView:u,keymap:O,ViewPlugin:Q}=await import("../chunks/DnL9f0lc.js").then(V=>V.i);return{EditorView:u,keymap:O,ViewPlugin:Q}},__vite__mapDeps([0,1]),import.meta.url),{markdown:a}=await qe(async()=>{const{markdown:u}=await import("../chunks/CscoF-YL.js");return{markdown:u}},__vite__mapDeps([2,1,0,3,4,5]),import.meta.url),{syntaxHighlighting:r,HighlightStyle:o}=await qe(async()=>{const{syntaxHighlighting:u,HighlightStyle:O}=await import("../chunks/D7ZqAKi9.js");return{syntaxHighlighting:u,HighlightStyle:O}},__vite__mapDeps([3,4,1,0]),import.meta.url),{history:f,defaultKeymap:g,historyKeymap:K}=await qe(async()=>{const{history:u,defaultKeymap:O,historyKeymap:Q}=await import("../chunks/CWQRQXxy.js");return{history:u,defaultKeymap:O,historyKeymap:Q}},__vite__mapDeps([6,1,0,3,4]),import.meta.url),{tags:ve}=await qe(async()=>{const{tags:u}=await import("../chunks/C7VoTosa.js").then(O=>O.i);return{tags:u}},[],import.meta.url),{livePreviewPlugin:be,livePreviewTheme:b}=await qe(async()=>{const{livePreviewPlugin:u,livePreviewTheme:O}=await import("../chunks/B340SUKR.js");return{livePreviewPlugin:u,livePreviewTheme:O}},__vite__mapDeps([7,0,1,3,4]),import.meta.url),l=p.current==="dark",d=M(se,l),F=o.define([{tag:ve.processingInstruction,color:"var(--color-text-tertiary)",opacity:"0.7"}]),X=[a(),d,r(F),be,b,se.lineWrapping];i()&&X.push(le.readOnly.of(!0));let Z=!1;if(e.cursorDocName&&!i())try{let n=function(){if(!_||!z){E(L,[],!0);return}const Y=z.awareness,ue=z.ytext,q=ue.doc;if(!q){E(L,[],!0);return}const ae=[],re=_.dom.getBoundingClientRect();Y.getStates().forEach((U,ee)=>{if(ee===Ae)return;const we=U.cursor;if(!we?.head)return;const{name:ge="Anonymous",color:Ce="#e05050"}=U.user||{};let Pe;try{Pe=y.createRelativePositionFromJSON(we.head)}catch{return}const xe=y.createAbsolutePositionFromRelativePosition(Pe,q);if(!xe||xe.type!==ue)return;const Se=_.coordsAtPos(Math.min(xe.index,_.state.doc.length));Se&&ae.push({id:ee,name:ge,color:Ce,top:Se.top-re.top,left:Se.left-re.left,height:Se.bottom-Se.top})}),E(L,ae,!0)},D=function(){N&&cancelAnimationFrame(N),N=requestAnimationFrame(()=>{N=null,n()})},ie=function({added:Y,updated:ue,removed:q}){[...Y,...ue,...q].some(re=>re!==Ae)&&D()};const{createCollabSession:u}=await qe(async()=>{const{createCollabSession:Y}=await import("../chunks/C3RWu-3l.js");return{createCollabSession:Y}},__vite__mapDeps([8,9,10,11,12,13,14,15,16,17,18]),import.meta.url),{ySync:O,ySyncFacet:Q,YSyncConfig:V,yUndoManagerKeymap:T}=await qe(async()=>{const{ySync:Y,ySyncFacet:ue,YSyncConfig:q,yUndoManagerKeymap:ae}=await import("../chunks/i9c_RUF6.js");return{ySync:Y,ySyncFacet:ue,YSyncConfig:q,yUndoManagerKeymap:ae}},__vite__mapDeps([19,9,0,1]),import.meta.url),{auth:m}=await qe(async()=>{const{auth:Y}=await import("../chunks/B0qTqRR8.js").then(ue=>ue.b);return{auth:Y}},__vite__mapDeps([16,12,15]),import.meta.url),y=await qe(()=>import("../chunks/CLFba8FK.js").then(Y=>Y.A),[],import.meta.url),te=getComputedStyle(document.documentElement).getPropertyValue("--color-accent").trim()||"#e05050",z=u(e.cursorDocName,{name:m.user?.displayName??"Anonymous",color:te,colorLight:te+"33"}),$=new y.UndoManager(z.ytext,{captureTimeout:500}),{yUndoManagerFacet:I,yUndoManager:H,YUndoManagerConfig:fe}=await qe(async()=>{const{yUndoManagerFacet:Y,yUndoManager:ue,YUndoManagerConfig:q}=await import("../chunks/i9c_RUF6.js");return{yUndoManagerFacet:Y,yUndoManager:ue,YUndoManagerConfig:q}},__vite__mapDeps([19,9,0,1]),import.meta.url),B=new V(z.ytext,z.awareness);X.push(Q.of(B),O,I.of(new fe($)),H,P.of(T)),X.push(k.define(Y=>{function ue(){const q=Y.state.selection.main,ae=z.ytext,re=y.createRelativePositionFromTypeIndex(ae,q.anchor),U=y.createRelativePositionFromTypeIndex(ae,q.head);z.awareness.setLocalStateField("cursor",{anchor:y.relativePositionToJSON(re),head:y.relativePositionToJSON(U)})}return ue(),{update(q){(q.selectionSet||q.docChanged)&&ue()}}}));const Ae=z.ydoc.clientID;z.awareness.on("change",ie),X.push(k.define(()=>({update(Y){(Y.docChanged||Y.geometryChanged||Y.viewportChanged)&&D()},destroy(){z.awareness.off("change",ie)}}))),C=z,Z=!0}catch(u){console.warn("Yjs collab setup failed, falling back to solo editing:",u)}if(!i()&&!Z?(X.push(f({newGroupDelay:500})),X.push(P.of([...g,...K]))):!i()&&Z&&X.push(P.of(g)),e.onchange)if(Z){const u=Date.now();X.push(se.updateListener.of(O=>{if(O.docChanged&&Date.now()-u>1e3&&O.transactions.some(V=>V.isUserEvent("input")||V.isUserEvent("delete")||V.isUserEvent("move")||V.isUserEvent("undo")||V.isUserEvent("redo"))){const V=O.state.doc.toString();S=V,e.onchange(V)}}))}else X.push(se.updateListener.of(u=>{if(u.docChanged){const O=u.state.doc.toString();S=O,e.onchange(O)}}));X.push(se.domEventHandlers({click(u){const O=u.target;if(e.onwikilinkclick){const V=O.closest(".cm-live-wikilink");if(V){u.preventDefault();const T=V.textContent?.replace(/^\[{1,2}|\]{1,2}$/g,"").trim();return T&&e.onwikilinkclick(T),!0}}const Q=O.closest(".cm-live-link");if(Q){const V=Q.getAttribute("data-href");if(V)return u.preventDefault(),window.open(V,"_blank","noopener,noreferrer"),!0}return!1}})),e.onsave&&X.push(P.of([{key:"Mod-s",run:()=>(e.onsave(),!0)}]));const v=le.create({doc:Z?"":e.content,extensions:X});_=new se({state:v,parent:R}),S=Z?"":e.content,E(x,e.cursorDocName??"",!0)}Jt(()=>{me()}),rt(()=>{e.cursorDocName&&t(x)&&e.cursorDocName!==t(x)&&me()}),rt(()=>{if(s(),_&&!C&&e.content!==S){S=e.content;const le=R.closest(".document-scroll"),_e=le?.scrollTop??0;_.dispatch({changes:{from:0,to:_.state.doc.length,insert:e.content},...c?{annotations:c.addToHistory.of(!1)}:{}}),le&&requestAnimationFrame(()=>{le.scrollTop=_e})}}),Vt(()=>{N&&cancelAnimationFrame(N),C?.destroy(),C=null,_?.destroy()});var G=Cr(),ne=A(G);ct(ne,le=>R=le,()=>R);var ye=W(ne,2);{var oe=le=>{var _e=Er();Ue(_e,21,()=>t(L),se=>se.id,(se,P)=>{var k=xr(),a=A(k),r=A(a,!0);w(a),w(k),de(()=>{We(k,`top: ${t(P).top??""}px; left: ${t(P).left??""}px; height: ${t(P).height??""}px; --cursor-color: ${t(P).color??""};`),We(a,`background-color: ${t(P).color??""};`),pe(r,t(P).name)}),h(se,k)}),w(_e),h(le,_e)};ce(ye,le=>{t(L).length>0&&le(oe)})}w(G),h(J,G),Ye()}var bt={exports:{}};var Ar=bt.exports,It;function Pr(){return It||(It=1,(function(J,e){((i,s)=>{J.exports=s()})(Ar,function i(){var s=typeof self<"u"?self:typeof window<"u"?window:s!==void 0?s:{},p,R=!s.document&&!!s.postMessage,_=s.IS_PAPA_WORKER||!1,C={},x=0,c={};function L(a){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(r){var o=se(r);o.chunkSize=parseInt(o.chunkSize),r.step||r.chunk||(o.chunkSize=null),this._handle=new G(o),(this._handle.streamer=this)._config=o}).call(this,a),this.parseChunk=function(r,o){var f=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<f){let K=this._config.newline;K||(g=this._config.quoteChar||'"',K=this._handle.guessLineEndings(r,g)),r=[...r.split(K).slice(f)].join(K)}this.isFirstChunk&&k(this._config.beforeFirstChunk)&&(g=this._config.beforeFirstChunk(r))!==void 0&&(r=g),this.isFirstChunk=!1,this._halted=!1;var f=this._partialLine+r,g=(this._partialLine="",this._handle.parse(f,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(r=g.meta.cursor,f=(this._finished||(this._partialLine=f.substring(r-this._baseIndex),this._baseIndex=r),g&&g.data&&(this._rowCount+=g.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),_)s.postMessage({results:g,workerId:c.WORKER_ID,finished:f});else if(k(this._config.chunk)&&!o){if(this._config.chunk(g,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=g=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(g.data),this._completeResults.errors=this._completeResults.errors.concat(g.errors),this._completeResults.meta=g.meta),this._completed||!f||!k(this._config.complete)||g&&g.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),f||g&&g.meta.paused||this._nextChunk(),g}this._halted=!0},this._sendError=function(r){k(this._config.error)?this._config.error(r):_&&this._config.error&&s.postMessage({workerId:c.WORKER_ID,error:r,finished:!1})}}function N(a){var r;(a=a||{}).chunkSize||(a.chunkSize=c.RemoteChunkSize),L.call(this,a),this._nextChunk=R?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(o){this._input=o,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(r=new XMLHttpRequest,this._config.withCredentials&&(r.withCredentials=this._config.withCredentials),R||(r.onload=P(this._chunkLoaded,this),r.onerror=P(this._chunkError,this)),r.open(this._config.downloadRequestBody?"POST":"GET",this._input,!R),this._config.downloadRequestHeaders){var o,f=this._config.downloadRequestHeaders;for(o in f)r.setRequestHeader(o,f[o])}var g;this._config.chunkSize&&(g=this._start+this._config.chunkSize-1,r.setRequestHeader("Range","bytes="+this._start+"-"+g));try{r.send(this._config.downloadRequestBody)}catch(K){this._chunkError(K.message)}R&&r.status===0&&this._chunkError()}},this._chunkLoaded=function(){r.readyState===4&&(r.status<200||400<=r.status?this._chunkError():(this._start+=this._config.chunkSize||r.responseText.length,this._finished=!this._config.chunkSize||this._start>=(o=>(o=o.getResponseHeader("Content-Range"))!==null?parseInt(o.substring(o.lastIndexOf("/")+1)):-1)(r),this.parseChunk(r.responseText)))},this._chunkError=function(o){o=r.statusText||o,this._sendError(new Error(o))}}function S(a){(a=a||{}).chunkSize||(a.chunkSize=c.LocalChunkSize),L.call(this,a);var r,o,f=typeof FileReader<"u";this.stream=function(g){this._input=g,o=g.slice||g.webkitSlice||g.mozSlice,f?((r=new FileReader).onload=P(this._chunkLoaded,this),r.onerror=P(this._chunkError,this)):r=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var g=this._input,K=(this._config.chunkSize&&(K=Math.min(this._start+this._config.chunkSize,this._input.size),g=o.call(g,this._start,K)),r.readAsText(g,this._config.encoding));f||this._chunkLoaded({target:{result:K}})},this._chunkLoaded=function(g){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(g.target.result)},this._chunkError=function(){this._sendError(r.error)}}function M(a){var r;L.call(this,a=a||{}),this.stream=function(o){return r=o,this._nextChunk()},this._nextChunk=function(){var o,f;if(!this._finished)return o=this._config.chunkSize,r=o?(f=r.substring(0,o),r.substring(o)):(f=r,""),this._finished=!r,this.parseChunk(f)}}function me(a){L.call(this,a=a||{});var r=[],o=!0,f=!1;this.pause=function(){L.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){L.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(g){this._input=g,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){f&&r.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),r.length?this.parseChunk(r.shift()):o=!0},this._streamData=P(function(g){try{r.push(typeof g=="string"?g:g.toString(this._config.encoding)),o&&(o=!1,this._checkIsFinished(),this.parseChunk(r.shift()))}catch(K){this._streamError(K)}},this),this._streamError=P(function(g){this._streamCleanUp(),this._sendError(g)},this),this._streamEnd=P(function(){this._streamCleanUp(),f=!0,this._streamData("")},this),this._streamCleanUp=P(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function G(a){var r,o,f,g,K=Math.pow(2,53),ve=-K,be=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,b=/^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/,l=this,d=0,F=0,X=!1,Z=!1,v=[],u={data:[],errors:[],meta:{}};function O(m){return a.skipEmptyLines==="greedy"?m.join("").trim()==="":m.length===1&&m[0].length===0}function Q(){if(u&&f&&(T("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+c.DefaultDelimiter+"'"),f=!1),a.skipEmptyLines&&(u.data=u.data.filter(function(z){return!O(z)})),V()){let z=function($,I){k(a.transformHeader)&&($=a.transformHeader($,I)),v.push($)};if(u)if(Array.isArray(u.data[0])){for(var m=0;V()&&m<u.data.length;m++)u.data[m].forEach(z);u.data.splice(0,1)}else u.data.forEach(z)}function y(z,$){for(var I=a.header?{}:[],H=0;H<z.length;H++){var fe=H,B=z[H],B=((Ae,n)=>(D=>(a.dynamicTypingFunction&&a.dynamicTyping[D]===void 0&&(a.dynamicTyping[D]=a.dynamicTypingFunction(D)),(a.dynamicTyping[D]||a.dynamicTyping)===!0))(Ae)?n==="true"||n==="TRUE"||n!=="false"&&n!=="FALSE"&&((D=>{if(be.test(D)&&(D=parseFloat(D),ve<D&&D<K))return 1})(n)?parseFloat(n):b.test(n)?new Date(n):n===""?null:n):n)(fe=a.header?H>=v.length?"__parsed_extra":v[H]:fe,B=a.transform?a.transform(B,fe):B);fe==="__parsed_extra"?(I[fe]=I[fe]||[],I[fe].push(B)):I[fe]=B}return a.header&&(H>v.length?T("FieldMismatch","TooManyFields","Too many fields: expected "+v.length+" fields but parsed "+H,F+$):H<v.length&&T("FieldMismatch","TooFewFields","Too few fields: expected "+v.length+" fields but parsed "+H,F+$)),I}var te;u&&(a.header||a.dynamicTyping||a.transform)&&(te=1,!u.data.length||Array.isArray(u.data[0])?(u.data=u.data.map(y),te=u.data.length):u.data=y(u.data,0),a.header&&u.meta&&(u.meta.fields=v),F+=te)}function V(){return a.header&&v.length===0}function T(m,y,te,z){m={type:m,code:y,message:te},z!==void 0&&(m.row=z),u.errors.push(m)}k(a.step)&&(g=a.step,a.step=function(m){u=m,V()?Q():(Q(),u.data.length!==0&&(d+=m.data.length,a.preview&&d>a.preview?o.abort():(u.data=u.data[0],g(u,l))))}),this.parse=function(m,y,te){var z=a.quoteChar||'"',z=(a.newline||(a.newline=this.guessLineEndings(m,z)),f=!1,a.delimiter?k(a.delimiter)&&(a.delimiter=a.delimiter(m),u.meta.delimiter=a.delimiter):((z=(($,I,H,fe,B)=>{var Ae,n,D,ie;B=B||[","," ","|",";",c.RECORD_SEP,c.UNIT_SEP];for(var Y=0;Y<B.length;Y++){for(var ue,q=B[Y],ae=0,re=0,U=0,ee=(D=void 0,new ye({comments:fe,delimiter:q,newline:I,preview:10}).parse($)),we=0;we<ee.data.length;we++)H&&O(ee.data[we])?U++:(ue=ee.data[we].length,re+=ue,D===void 0?D=ue:0<ue&&(ae+=Math.abs(ue-D),D=ue));0<ee.data.length&&(re/=ee.data.length-U),(n===void 0||ae<=n)&&(ie===void 0||ie<re)&&1.99<re&&(n=ae,Ae=q,ie=re)}return{successful:!!(a.delimiter=Ae),bestDelimiter:Ae}})(m,a.newline,a.skipEmptyLines,a.comments,a.delimitersToGuess)).successful?a.delimiter=z.bestDelimiter:(f=!0,a.delimiter=c.DefaultDelimiter),u.meta.delimiter=a.delimiter),se(a));return a.preview&&a.header&&z.preview++,r=m,o=new ye(z),u=o.parse(r,y,te),Q(),X?{meta:{paused:!0}}:u||{meta:{paused:!1}}},this.paused=function(){return X},this.pause=function(){X=!0,o.abort(),r=k(a.chunk)?"":r.substring(o.getCharIndex())},this.resume=function(){l.streamer._halted?(X=!1,l.streamer.parseChunk(r,!0)):setTimeout(l.resume,3)},this.aborted=function(){return Z},this.abort=function(){Z=!0,o.abort(),u.meta.aborted=!0,k(a.complete)&&a.complete(u),r=""},this.guessLineEndings=function($,z){$=$.substring(0,1048576);var z=new RegExp(ne(z)+"([^]*?)"+ne(z),"gm"),te=($=$.replace(z,"")).split("\r"),z=$.split(`
|
|
3
|
+
`),$=1<z.length&&z[0].length<te[0].length;if(te.length===1||$)return`
|
|
4
|
+
`;for(var I=0,H=0;H<te.length;H++)te[H][0]===`
|
|
5
|
+
`&&I++;return I>=te.length/2?`\r
|
|
6
|
+
`:"\r"}}function ne(a){return a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ye(a){var r=(a=a||{}).delimiter,o=a.newline,f=a.comments,g=a.step,K=a.preview,ve=a.fastMode,be=null,b=!1,l=a.quoteChar==null?'"':a.quoteChar,d=l;if(a.escapeChar!==void 0&&(d=a.escapeChar),(typeof r!="string"||-1<c.BAD_DELIMITERS.indexOf(r))&&(r=","),f===r)throw new Error("Comment character same as delimiter");f===!0?f="#":(typeof f!="string"||-1<c.BAD_DELIMITERS.indexOf(f))&&(f=!1),o!==`
|
|
7
|
+
`&&o!=="\r"&&o!==`\r
|
|
8
|
+
`&&(o=`
|
|
9
|
+
`);var F=0,X=!1;this.parse=function(Z,v,u){if(typeof Z!="string")throw new Error("Input must be a string");var O=Z.length,Q=r.length,V=o.length,T=f.length,m=k(g),y=[],te=[],z=[],$=F=0;if(!Z)return ae();if(ve||ve!==!1&&Z.indexOf(l)===-1){for(var I=Z.split(o),H=0;H<I.length;H++){if(z=I[H],F+=z.length,H!==I.length-1)F+=o.length;else if(u)return ae();if(!f||z.substring(0,T)!==f){if(m){if(y=[],ie(z.split(r)),re(),X)return ae()}else ie(z.split(r));if(K&&K<=H)return y=y.slice(0,K),ae(!0)}}return ae()}for(var fe=Z.indexOf(r,F),B=Z.indexOf(o,F),Ae=new RegExp(ne(d)+ne(l),"g"),n=Z.indexOf(l,F);;)if(Z[F]===l)for(n=F,F++;;){if((n=Z.indexOf(l,n+1))===-1)return u||te.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:y.length,index:F}),ue();if(n===O-1)return ue(Z.substring(F,n).replace(Ae,l));if(l===d&&Z[n+1]===d)n++;else if(l===d||n===0||Z[n-1]!==d){fe!==-1&&fe<n+1&&(fe=Z.indexOf(r,n+1));var D=Y((B=B!==-1&&B<n+1?Z.indexOf(o,n+1):B)===-1?fe:Math.min(fe,B));if(Z.substr(n+1+D,Q)===r){z.push(Z.substring(F,n).replace(Ae,l)),Z[F=n+1+D+Q]!==l&&(n=Z.indexOf(l,F)),fe=Z.indexOf(r,F),B=Z.indexOf(o,F);break}if(D=Y(B),Z.substring(n+1+D,n+1+D+V)===o){if(z.push(Z.substring(F,n).replace(Ae,l)),q(n+1+D+V),fe=Z.indexOf(r,F),n=Z.indexOf(l,F),m&&(re(),X))return ae();if(K&&y.length>=K)return ae(!0);break}te.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:y.length,index:F}),n++}}else if(f&&z.length===0&&Z.substring(F,F+T)===f){if(B===-1)return ae();F=B+V,B=Z.indexOf(o,F),fe=Z.indexOf(r,F)}else if(fe!==-1&&(fe<B||B===-1))z.push(Z.substring(F,fe)),F=fe+Q,fe=Z.indexOf(r,F);else{if(B===-1)break;if(z.push(Z.substring(F,B)),q(B+V),m&&(re(),X))return ae();if(K&&y.length>=K)return ae(!0)}return ue();function ie(U){y.push(U),$=F}function Y(U){var ee=0;return ee=U!==-1&&(U=Z.substring(n+1,U))&&U.trim()===""?U.length:ee}function ue(U){return u||(U===void 0&&(U=Z.substring(F)),z.push(U),F=O,ie(z),m&&re()),ae()}function q(U){F=U,ie(z),z=[],B=Z.indexOf(o,F)}function ae(U){if(a.header&&!v&&y.length&&!b){var ee=y[0],we=Object.create(null),ge=new Set(ee);let Ce=!1;for(let Pe=0;Pe<ee.length;Pe++){let xe=ee[Pe];if(we[xe=k(a.transformHeader)?a.transformHeader(xe,Pe):xe]){let Se,Le=we[xe];for(;Se=xe+"_"+Le,Le++,ge.has(Se););ge.add(Se),ee[Pe]=Se,we[xe]++,Ce=!0,(be=be===null?{}:be)[Se]=xe}else we[xe]=1,ee[Pe]=xe;ge.add(xe)}Ce&&console.warn("Duplicate headers found and renamed."),b=!0}return{data:y,errors:te,meta:{delimiter:r,linebreak:o,aborted:X,truncated:!!U,cursor:$+(v||0),renamedHeaders:be}}}function re(){g(ae()),y=[],te=[]}},this.abort=function(){X=!0},this.getCharIndex=function(){return F}}function oe(a){var r=a.data,o=C[r.workerId],f=!1;if(r.error)o.userError(r.error,r.file);else if(r.results&&r.results.data){var g={abort:function(){f=!0,le(r.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:_e,resume:_e};if(k(o.userStep)){for(var K=0;K<r.results.data.length&&(o.userStep({data:r.results.data[K],errors:r.results.errors,meta:r.results.meta},g),!f);K++);delete r.results}else k(o.userChunk)&&(o.userChunk(r.results,g,r.file),delete r.results)}r.finished&&!f&&le(r.workerId,r.results)}function le(a,r){var o=C[a];k(o.userComplete)&&o.userComplete(r),o.terminate(),delete C[a]}function _e(){throw new Error("Not implemented.")}function se(a){if(typeof a!="object"||a===null)return a;var r,o=Array.isArray(a)?[]:{};for(r in a)o[r]=se(a[r]);return o}function P(a,r){return function(){a.apply(r,arguments)}}function k(a){return typeof a=="function"}return c.parse=function(a,r){var o=(r=r||{}).dynamicTyping||!1;if(k(o)&&(r.dynamicTypingFunction=o,o={}),r.dynamicTyping=o,r.transform=!!k(r.transform)&&r.transform,!r.worker||!c.WORKERS_SUPPORTED)return o=null,c.NODE_STREAM_INPUT,typeof a=="string"?(a=(f=>f.charCodeAt(0)!==65279?f:f.slice(1))(a),o=new(r.download?N:M)(r)):a.readable===!0&&k(a.read)&&k(a.on)?o=new me(r):(s.File&&a instanceof File||a instanceof Object)&&(o=new S(r)),o.stream(a);(o=(()=>{var f;return!!c.WORKERS_SUPPORTED&&(f=(()=>{var g=s.URL||s.webkitURL||null,K=i.toString();return c.BLOB_URL||(c.BLOB_URL=g.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ","(",K,")();"],{type:"text/javascript"})))})(),(f=new s.Worker(f)).onmessage=oe,f.id=x++,C[f.id]=f)})()).userStep=r.step,o.userChunk=r.chunk,o.userComplete=r.complete,o.userError=r.error,r.step=k(r.step),r.chunk=k(r.chunk),r.complete=k(r.complete),r.error=k(r.error),delete r.worker,o.postMessage({input:a,config:r,workerId:o.id})},c.unparse=function(a,r){var o=!1,f=!0,g=",",K=`\r
|
|
10
|
+
`,ve='"',be=ve+ve,b=!1,l=null,d=!1,F=((()=>{if(typeof r=="object"){if(typeof r.delimiter!="string"||c.BAD_DELIMITERS.filter(function(v){return r.delimiter.indexOf(v)!==-1}).length||(g=r.delimiter),typeof r.quotes!="boolean"&&typeof r.quotes!="function"&&!Array.isArray(r.quotes)||(o=r.quotes),typeof r.skipEmptyLines!="boolean"&&typeof r.skipEmptyLines!="string"||(b=r.skipEmptyLines),typeof r.newline=="string"&&(K=r.newline),typeof r.quoteChar=="string"&&(ve=r.quoteChar),typeof r.header=="boolean"&&(f=r.header),Array.isArray(r.columns)){if(r.columns.length===0)throw new Error("Option columns is empty");l=r.columns}r.escapeChar!==void 0&&(be=r.escapeChar+ve),r.escapeFormulae instanceof RegExp?d=r.escapeFormulae:typeof r.escapeFormulae=="boolean"&&r.escapeFormulae&&(d=/^[=+\-@\t\r].*$/)}})(),new RegExp(ne(ve),"g"));if(typeof a=="string"&&(a=JSON.parse(a)),Array.isArray(a)){if(!a.length||Array.isArray(a[0]))return X(null,a,b);if(typeof a[0]=="object")return X(l||Object.keys(a[0]),a,b)}else if(typeof a=="object")return typeof a.data=="string"&&(a.data=JSON.parse(a.data)),Array.isArray(a.data)&&(a.fields||(a.fields=a.meta&&a.meta.fields||l),a.fields||(a.fields=Array.isArray(a.data[0])?a.fields:typeof a.data[0]=="object"?Object.keys(a.data[0]):[]),Array.isArray(a.data[0])||typeof a.data[0]=="object"||(a.data=[a.data])),X(a.fields||[],a.data||[],b);throw new Error("Unable to serialize unrecognized input");function X(v,u,O){var Q="",V=(typeof v=="string"&&(v=JSON.parse(v)),typeof u=="string"&&(u=JSON.parse(u)),Array.isArray(v)&&0<v.length),T=!Array.isArray(u[0]);if(V&&f){for(var m=0;m<v.length;m++)0<m&&(Q+=g),Q+=Z(v[m],m);0<u.length&&(Q+=K)}for(var y=0;y<u.length;y++){var te=(V?v:u[y]).length,z=!1,$=V?Object.keys(u[y]).length===0:u[y].length===0;if(O&&!V&&(z=O==="greedy"?u[y].join("").trim()==="":u[y].length===1&&u[y][0].length===0),O==="greedy"&&V){for(var I=[],H=0;H<te;H++){var fe=T?v[H]:H;I.push(u[y][fe])}z=I.join("").trim()===""}if(!z){for(var B=0;B<te;B++){0<B&&!$&&(Q+=g);var Ae=V&&T?v[B]:B;Q+=Z(u[y][Ae],B)}y<u.length-1&&(!O||0<te&&!$)&&(Q+=K)}}return Q}function Z(v,u){var O,Q;return v==null?"":v.constructor===Date?JSON.stringify(v).slice(1,25):(Q=!1,d&&typeof v=="string"&&d.test(v)&&(v="'"+v,Q=!0),O=v.toString().replace(F,be),(Q=Q||o===!0||typeof o=="function"&&o(v,u)||Array.isArray(o)&&o[u]||((V,T)=>{for(var m=0;m<T.length;m++)if(-1<V.indexOf(T[m]))return!0;return!1})(O,c.BAD_DELIMITERS)||-1<O.indexOf(g)||O.charAt(0)===" "||O.charAt(O.length-1)===" ")?ve+O+ve:O)}},c.RECORD_SEP="",c.UNIT_SEP="",c.BYTE_ORDER_MARK="\uFEFF",c.BAD_DELIMITERS=["\r",`
|
|
11
|
+
`,'"',c.BYTE_ORDER_MARK],c.WORKERS_SUPPORTED=!R&&!!s.Worker,c.NODE_STREAM_INPUT=1,c.LocalChunkSize=10485760,c.RemoteChunkSize=5242880,c.DefaultDelimiter=",",c.Parser=ye,c.ParserHandle=G,c.NetworkStreamer=N,c.FileStreamer=S,c.StringStreamer=M,c.ReadableStreamStreamer=me,s.jQuery&&((p=s.jQuery).fn.parse=function(a){var r=a.config||{},o=[];return this.each(function(K){if(!(p(this).prop("tagName").toUpperCase()==="INPUT"&&p(this).attr("type").toLowerCase()==="file"&&s.FileReader)||!this.files||this.files.length===0)return!0;for(var ve=0;ve<this.files.length;ve++)o.push({file:this.files[ve],inputElem:this,instanceConfig:p.extend({},r)})}),f(),this;function f(){if(o.length===0)k(a.complete)&&a.complete();else{var K,ve,be,b,l=o[0];if(k(a.before)){var d=a.before(l.file,l.inputElem);if(typeof d=="object"){if(d.action==="abort")return K="AbortError",ve=l.file,be=l.inputElem,b=d.reason,void(k(a.error)&&a.error({name:K},ve,be,b));if(d.action==="skip")return void g();typeof d.config=="object"&&(l.instanceConfig=p.extend(l.instanceConfig,d.config))}else if(d==="skip")return void g()}var F=l.instanceConfig.complete;l.instanceConfig.complete=function(X){k(F)&&F(X,l.file,l.inputElem),g()},c.parse(l.file,l.instanceConfig)}}function g(){o.splice(0,1),f()}}),_&&(s.onmessage=function(a){a=a.data,c.WORKER_ID===void 0&&a&&(c.WORKER_ID=a.workerId),typeof a.input=="string"?s.postMessage({workerId:c.WORKER_ID,results:c.parse(a.input,a.config),finished:!0}):(s.File&&a.input instanceof File||a.input instanceof Object)&&(a=c.parse(a.input,a.config))&&s.postMessage({workerId:c.WORKER_ID,results:a,finished:!0})}),(N.prototype=Object.create(L.prototype)).constructor=N,(S.prototype=Object.create(L.prototype)).constructor=S,(M.prototype=Object.create(M.prototype)).constructor=M,(me.prototype=Object.create(L.prototype)).constructor=me,c})})(bt)),bt.exports}var Rr=Pr();const jt=_a(Rr);var Tr=j('<span class="remote-cell-label svelte-63hltt"> </span>'),Dr=j('<th><!> <input class="cell-input header-input svelte-63hltt"/> <!></th>'),zr=j('<span class="remote-cell-label svelte-63hltt"> </span>'),Lr=j('<td><!> <input class="cell-input svelte-63hltt"/></td>'),Or=j('<tr class="svelte-63hltt"><td class="row-num svelte-63hltt"></td><!><td class="actions svelte-63hltt"><!></td></tr>'),Fr=j("<!> <span>Add row</span>",1),Mr=j('<div class="csv-editor svelte-63hltt"><div class="table-scroll svelte-63hltt"><table class="svelte-63hltt"><thead><tr class="svelte-63hltt"><th class="row-num svelte-63hltt"></th><!><th class="col-add svelte-63hltt"><!></th></tr></thead><tbody></tbody></table></div> <div class="csv-footer svelte-63hltt"><!></div></div>');function Ir(J,e){He(e,!0);let i=Oe(e,"remoteCursors",19,()=>[]),s=Ee(it([])),p=Ee(it([])),R=Ee(void 0);function _(b){const l=jt.parse(b.trim(),{header:!1,skipEmptyLines:!0});l.data.length>0?(E(s,l.data[0],!0),E(p,l.data.slice(1),!0)):(E(s,[],!0),E(p,[],!0))}_(e.content),rt(()=>{_(e.content)});function C(){return jt.unparse([t(s),...t(p)])}function x(){const b=C();e.onchange?.(b)}function c(b,l,d){t(p)[b][l]=d,E(p,[...t(p)],!0),x()}function L(b,l){t(s)[b]=l,E(s,[...t(s)],!0),x()}function N(){E(p,[...t(p),t(s).map(()=>"")],!0),x(),G(t(p).length-1,0)}function S(b){E(p,t(p).filter((l,d)=>d!==b),!0),x()}function M(){const b=`col${t(s).length+1}`;E(s,[...t(s),b],!0),E(p,t(p).map(l=>[...l,""]),!0),x(),requestAnimationFrame(()=>{const l=t(R)?.querySelector(`thead th:nth-child(${t(s).length+1}) input`);l&&(l.focus(),l.select())})}function me(b){t(s).length<=1||(E(s,t(s).filter((l,d)=>d!==b),!0),E(p,t(p).map(l=>l.filter((d,F)=>F!==b)),!0),x())}function G(b,l){requestAnimationFrame(()=>{if(!t(R))return;let d=null;b<0?d=t(R).querySelector(`thead th:nth-child(${l+2}) input`):d=t(R).querySelector(`tbody tr:nth-child(${b+1}) td:nth-child(${l+2}) input`),d&&(d.focus(),d.select())})}function ne(b,l,d){if(b.key==="Tab"){b.preventDefault(),b.shiftKey?d>0?G(l,d-1):l>0?G(l-1,t(s).length-1):l===0&&G(-1,t(s).length-1):d<t(s).length-1?G(l,d+1):l<t(p).length-1?G(l+1,0):l===t(p).length-1&&N();return}if(b.key==="Enter"){b.preventDefault(),b.shiftKey?l>0?G(l-1,d):G(-1,d):l<t(p).length-1?G(l+1,d):N();return}if(b.key==="Escape"){b.target.blur();return}}function ye(b,l){if(b.key==="Tab"){b.preventDefault(),b.shiftKey?l>0&&G(-1,l-1):l<t(s).length-1?G(-1,l+1):t(p).length>0&&G(0,0);return}if(b.key==="Enter"){b.preventDefault(),t(p).length>0?G(0,l):N();return}if(b.key==="Escape"){b.target.blur();return}}function oe(b,l){return i().find(d=>d.row===b&&d.col===l)}function le(b,l){e.oncellselect?.(b,l)}function _e(b){(b.metaKey||b.ctrlKey)&&b.key==="s"&&(b.preventDefault(),e.onsave?.())}var se=Mr(),P=A(se),k=A(P),a=A(k),r=A(a),o=W(A(r));Ue(o,17,()=>t(s),Be,(b,l,d)=>{const F=ke(()=>oe(-1,d));var X=Dr();let Z;var v=A(X);{var u=T=>{var m=Tr(),y=A(m,!0);w(m),de(()=>{We(m,`background-color: ${t(F).color??""}`),pe(y,t(F).name)}),h(T,m)};ce(v,T=>{t(F)&&T(u)})}var O=W(v,2);nt(O);var Q=W(O,2);{var V=T=>{Je(T,{variant:"ghost",size:"icon",class:"col-delete-btn",title:"Delete column",onclick:()=>me(d),children:(m,y)=>{Ot(m,{size:12})},$$slots:{default:!0}})};ce(Q,T=>{t(s).length>1&&T(V)})}w(X),de(()=>{We(X,t(F)?`--rc-color: ${t(F).color}`:""),Z=lt(X,1,"svelte-63hltt",null,Z,{"remote-active":!!t(F)}),dt(O,t(l))}),ze("input",O,T=>L(d,T.currentTarget.value)),ze("keydown",O,T=>ye(T,d)),Ze("focus",O,()=>le(-1,d)),h(b,X)});var f=W(o),g=A(f);Je(g,{variant:"ghost",size:"icon",class:"col-add-btn",title:"Add column",onclick:M,children:(b,l)=>{St(b,{size:14})},$$slots:{default:!0}}),w(f),w(r),w(a);var K=W(a);Ue(K,21,()=>t(p),Be,(b,l,d)=>{var F=Or(),X=A(F);X.textContent=d+1;var Z=W(X);Ue(Z,17,()=>t(l),Be,(O,Q,V)=>{const T=ke(()=>oe(d,V));var m=Lr();let y;var te=A(m);{var z=I=>{var H=zr(),fe=A(H,!0);w(H),de(()=>{We(H,`background-color: ${t(T).color??""}`),pe(fe,t(T).name)}),h(I,H)};ce(te,I=>{t(T)&&I(z)})}var $=W(te,2);nt($),w(m),de(()=>{We(m,t(T)?`--rc-color: ${t(T).color}`:""),y=lt(m,1,"svelte-63hltt",null,y,{"remote-active":!!t(T)}),dt($,t(Q))}),ze("input",$,I=>c(d,V,I.currentTarget.value)),ze("keydown",$,I=>ne(I,d,V)),Ze("focus",$,()=>le(d,V)),h(O,m)});var v=W(Z),u=A(v);Je(u,{variant:"ghost",size:"icon",class:"delete-btn",title:"Delete row",onclick:()=>S(d),children:(O,Q)=>{Ot(O,{size:12})},$$slots:{default:!0}}),w(v),w(F),h(b,F)}),w(K),w(k),ct(k,b=>E(R,b),()=>t(R)),w(P);var ve=W(P,2),be=A(ve);Je(be,{variant:"ghost",class:"add-row-btn",onclick:N,children:(b,l)=>{var d=Fr(),F=he(d);St(F,{size:14}),je(2),h(b,d)},$$slots:{default:!0}}),w(ve),w(se),ze("keydown",se,_e),h(J,se),Ye()}vt(["keydown","input"]);const jr=/^\d{4}-\d{2}-\d{2}/,Kr=new Set(["active","inactive","in-progress","completed","done","cancelled","draft","archived","current","former","contractor","client","partner","won","lost","open","closed"]),Ur=new Set(["format"]),Nr=new Set(["entity_id","created_at","updated_at","created_by","updated_by"]);function Vr(J,e){const i=[];for(const[p,R]of Object.entries(J)){if(Nr.has(p)||R==null)continue;const _=qr(p,R);_&&i.push(_)}const s=["entity_type","name","date"];return i.sort((p,R)=>{const _=s.indexOf(p.key),C=s.indexOf(R.key);return _!==-1&&C!==-1?_-C:_!==-1?-1:C!==-1?1:p.key.localeCompare(R.key)}),i}function qr(J,e){if(J==="entity_type")return{key:J,value:String(e),type:"entity-type"};if(Ur.has(J))return{key:J,value:String(e).toUpperCase(),type:"badge"};if(J==="status")return{key:J,value:String(e),type:"status"};if(Array.isArray(e)){if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){const C=e.map(x=>Object.entries(x).map(([L,N])=>`${L}: ${N}`).join(", "));return{key:J,value:C.join(" | "),type:"text"}}const p=e.map(String),R=p.some(C=>/^\[\[.+?\]\]$/.test(C)),_=p.map(C=>{const x=C.match(/^\[\[(.+?)\]\]$/);return x?x[1]:C});return R||_.every(C=>Kt(C))?{key:J,value:_,type:"wikilink"}:{key:J,value:p.join(", "),type:"text"}}const i=String(e),s=i.match(/^\[\[(.+?)\]\]$/);return s?{key:J,value:s[1],type:"wikilink"}:jr.test(i)?{key:J,value:i,type:"date"}:Kr.has(i.toLowerCase())?{key:J,value:i,type:"status"}:/^https?:\/\//.test(i)||J==="url"||J==="website"?{key:J,value:i,type:"url"}:Kt(i)&&!i.includes(" ")?{key:J,value:i,type:"wikilink"}:{key:J,value:i,type:"text"}}function Kt(J){return/^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(J)&&J.includes("-")}var Wr=$e("<title> </title>"),Br=$e('<svg><!><path d="M16,2A14,14,0,1,0,30,16,14.0158,14.0158,0,0,0,16,2Zm0,26A12,12,0,0,1,16,4V16l8.4812,8.4814A11.9625,11.9625,0,0,1,16,28Z"></path></svg>');function Ut(J,e){const i=Xe(e,["children","$$slots","$$events","$$legacy"]),s=Xe(i,["size","title"]);He(e,!1);const p=Qe(),R=Qe();let _=Oe(e,"size",8,16),C=Oe(e,"title",8,void 0);Ge(()=>(Ne(i),Ne(C())),()=>{E(p,i["aria-label"]||i["aria-labelledby"]||C())}),Ge(()=>(t(p),Ne(i)),()=>{E(R,{"aria-hidden":t(p)?void 0:!0,role:t(p)?"img":void 0,focusable:Number(i.tabindex)===0?!0:void 0})}),ht(),_t();var x=Br();pt(x,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:_(),height:_(),...t(R),...s}));var c=A(x);{var L=N=>{var S=Wr(),M=A(S,!0);w(S),de(()=>pe(M,C())),h(N,S)};ce(c,N=>{C()&&N(L)})}je(),w(x),h(J,x),Ye()}class Hr{diff(e,i,s={}){let p;typeof s=="function"?(p=s,s={}):"callback"in s&&(p=s.callback);const R=this.castInput(e,s),_=this.castInput(i,s),C=this.removeEmpty(this.tokenize(R,s)),x=this.removeEmpty(this.tokenize(_,s));return this.diffWithOptionsObj(C,x,s,p)}diffWithOptionsObj(e,i,s,p){var R;const _=oe=>{if(oe=this.postProcess(oe,s),p){setTimeout(function(){p(oe)},0);return}else return oe},C=i.length,x=e.length;let c=1,L=C+x;s.maxEditLength!=null&&(L=Math.min(L,s.maxEditLength));const N=(R=s.timeout)!==null&&R!==void 0?R:1/0,S=Date.now()+N,M=[{oldPos:-1,lastComponent:void 0}];let me=this.extractCommon(M[0],i,e,0,s);if(M[0].oldPos+1>=x&&me+1>=C)return _(this.buildValues(M[0].lastComponent,i,e));let G=-1/0,ne=1/0;const ye=()=>{for(let oe=Math.max(G,-c);oe<=Math.min(ne,c);oe+=2){let le;const _e=M[oe-1],se=M[oe+1];_e&&(M[oe-1]=void 0);let P=!1;if(se){const a=se.oldPos-oe;P=se&&0<=a&&a<C}const k=_e&&_e.oldPos+1<x;if(!P&&!k){M[oe]=void 0;continue}if(!k||P&&_e.oldPos<se.oldPos?le=this.addToPath(se,!0,!1,0,s):le=this.addToPath(_e,!1,!0,1,s),me=this.extractCommon(le,i,e,oe,s),le.oldPos+1>=x&&me+1>=C)return _(this.buildValues(le.lastComponent,i,e))||!0;M[oe]=le,le.oldPos+1>=x&&(ne=Math.min(ne,oe-1)),me+1>=C&&(G=Math.max(G,oe+1))}c++};if(p)(function oe(){setTimeout(function(){if(c>L||Date.now()>S)return p(void 0);ye()||oe()},0)})();else for(;c<=L&&Date.now()<=S;){const oe=ye();if(oe)return oe}}addToPath(e,i,s,p,R){const _=e.lastComponent;return _&&!R.oneChangePerToken&&_.added===i&&_.removed===s?{oldPos:e.oldPos+p,lastComponent:{count:_.count+1,added:i,removed:s,previousComponent:_.previousComponent}}:{oldPos:e.oldPos+p,lastComponent:{count:1,added:i,removed:s,previousComponent:_}}}extractCommon(e,i,s,p,R){const _=i.length,C=s.length;let x=e.oldPos,c=x-p,L=0;for(;c+1<_&&x+1<C&&this.equals(s[x+1],i[c+1],R);)c++,x++,L++,R.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return L&&!R.oneChangePerToken&&(e.lastComponent={count:L,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=x,c}equals(e,i,s){return s.comparator?s.comparator(e,i):e===i||!!s.ignoreCase&&e.toLowerCase()===i.toLowerCase()}removeEmpty(e){const i=[];for(let s=0;s<e.length;s++)e[s]&&i.push(e[s]);return i}castInput(e,i){return e}tokenize(e,i){return Array.from(e)}join(e){return e.join("")}postProcess(e,i){return e}get useLongestToken(){return!1}buildValues(e,i,s){const p=[];let R;for(;e;)p.push(e),R=e.previousComponent,delete e.previousComponent,e=R;p.reverse();const _=p.length;let C=0,x=0,c=0;for(;C<_;C++){const L=p[C];if(L.removed)L.value=this.join(s.slice(c,c+L.count)),c+=L.count;else{if(!L.added&&this.useLongestToken){let N=i.slice(x,x+L.count);N=N.map(function(S,M){const me=s[c+M];return me.length>S.length?me:S}),L.value=this.join(N)}else L.value=this.join(i.slice(x,x+L.count));x+=L.count,L.added||(c+=L.count)}}return p}}const Nt="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class Yr extends Hr{tokenize(e){const i=new RegExp(`(\\r?\\n)|[${Nt}]+|[^\\S\\n\\r]+|[^${Nt}]`,"ug");return e.match(i)||[]}}const Zr=new Yr;function Jr(J,e,i){return Zr.diff(J,e,i)}var Gr=$e("<title> </title>"),Qr=$e('<svg><!><path d="M10,14a4,4,0,1,1,4-4A4.0045,4.0045,0,0,1,10,14Zm0-6a2,2,0,1,0,1.998,2.0044A2.002,2.002,0,0,0,10,8Z"></path><path d="M16.6436,29.4145,2.5858,15.3555A2,2,0,0,1,2,13.9414V4A2,2,0,0,1,4,2h9.9413a2,2,0,0,1,1.4142.5858L29.4144,16.6436a2.0005,2.0005,0,0,1,0,2.8285l-9.9424,9.9425a2.0008,2.0008,0,0,1-2.8285,0ZM4,4v9.9417L18.0578,28,28,18.0579,13.9416,4Z"></path></svg>');function Xr(J,e){const i=Xe(e,["children","$$slots","$$events","$$legacy"]),s=Xe(i,["size","title"]);He(e,!1);const p=Qe(),R=Qe();let _=Oe(e,"size",8,16),C=Oe(e,"title",8,void 0);Ge(()=>(Ne(i),Ne(C())),()=>{E(p,i["aria-label"]||i["aria-labelledby"]||C())}),Ge(()=>(t(p),Ne(i)),()=>{E(R,{"aria-hidden":t(p)?void 0:!0,role:t(p)?"img":void 0,focusable:Number(i.tabindex)===0?!0:void 0})}),ht(),_t();var x=Qr();pt(x,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:_(),height:_(),...t(R),...s}));var c=A(x);{var L=N=>{var S=Gr(),M=A(S,!0);w(S),de(()=>pe(M,C())),h(N,S)};ce(c,N=>{C()&&N(L)})}je(2),w(x),h(J,x),Ye()}var $r=j('<div class="dp-row svelte-1g4tvol"><div class="dp-icon svelte-1g4tvol"><!></div> <div class="dp-key svelte-1g4tvol"> </div> <div class="dp-value svelte-1g4tvol"><div class="dp-diff-old svelte-1g4tvol"><span> </span></div> <div class="dp-diff-new svelte-1g4tvol"><span> </span></div></div></div>'),en=j('<div class="diff-properties svelte-1g4tvol"></div>'),tn=j('<span class="db-added"> </span>'),an=j('<span class="db-removed"> </span>'),rn=j("<span> </span>"),nn=j("<span> </span>"),sn=j('<div class="diff-view svelte-1g4tvol"><!> <div class="diff-body svelte-1g4tvol"><!></div></div>');function on(J,e){He(e,!0);function i(S){if(S==null)return"";if(typeof S!="object")return String(S);const M=S;return String(M.name??M.title??M.label??M.id??JSON.stringify(M))}function s(S){return S==null?"":Array.isArray(S)?S.map(i).join(", "):typeof S=="object"?i(S):String(S)}const p=ke(()=>e.refreshResult.body_changed&&e.refreshResult.body_diff?Jr(e.refreshResult.body_diff.old,e.refreshResult.body_diff.new):null);var R=sn(),_=A(R);{var C=S=>{var M=en();Ue(M,21,()=>e.refreshResult.diffs,Be,(me,G)=>{const ne=ke(()=>e.properties.find(d=>d.key===t(G).field));var ye=$r(),oe=A(ye),le=A(oe);{var _e=d=>{xt(d,{size:14})},se=d=>{yt(d,{size:14})},P=d=>{Ct(d,{size:14})},k=d=>{Xr(d,{size:14})},a=d=>{Et(d,{size:14})};ce(le,d=>{t(ne)?.type==="date"?d(_e):t(ne)?.type==="status"?d(se,1):t(ne)?.type==="wikilink"?d(P,2):t(ne)?.type==="badge"?d(k,3):d(a,!1)})}w(oe);var r=W(oe,2),o=A(r,!0);w(r);var f=W(r,2),g=A(f),K=A(g),ve=A(K,!0);w(K),w(g);var be=W(g,2),b=A(be),l=A(b,!0);w(b),w(be),w(f),w(ye),de((d,F)=>{pe(o,t(G).field),pe(ve,d),pe(l,F)},[()=>s(t(G).old_value),()=>s(t(G).new_value)]),h(me,ye)}),w(M),h(S,M)};ce(_,S=>{e.refreshResult.diffs.length>0&&S(C)})}var x=W(_,2),c=A(x);{var L=S=>{var M=Re(),me=he(M);Ue(me,17,()=>t(p),Be,(G,ne)=>{var ye=Re(),oe=he(ye);{var le=P=>{var k=tn(),a=A(k,!0);w(k),de(()=>pe(a,t(ne).value)),h(P,k)},_e=P=>{var k=an(),a=A(k,!0);w(k),de(()=>pe(a,t(ne).value)),h(P,k)},se=P=>{var k=rn(),a=A(k,!0);w(k),de(()=>pe(a,t(ne).value)),h(P,k)};ce(oe,P=>{t(ne).added?P(le):t(ne).removed?P(_e,1):P(se,!1)})}h(G,ye)}),h(S,M)},N=S=>{var M=nn(),me=A(M,!0);w(M),de(()=>pe(me,e.bodyContent)),h(S,M)};ce(c,S=>{t(p)?S(L):S(N,!1)})}w(x),w(R),h(J,R),Ye()}var ln=j("<!> ",1),un=j('<span class="diff-action-title svelte-udj3er">Changes from source</span> <div class="diff-action-buttons svelte-udj3er"><!> <!></div>',1),dn=j('<span class="bc-sep svelte-udj3er">/</span>'),cn=j("<!><span> </span>",1),fn=j('<span class="status-text saving svelte-udj3er">Saving...</span>'),vn=j('<span class="status-text error svelte-udj3er"> </span>'),hn=j("<!> ",1),pn=j('<div class="breadcrumb-path svelte-udj3er"></div> <div class="editor-actions svelte-udj3er"><!> <!> <!></div>',1),_n=j('<div class="refresh-panel svelte-udj3er"><div class="refresh-uptodate svelte-udj3er">Entity is up to date with source.</div></div>'),gn=j('<div class="document-scroll svelte-udj3er"><div class="document-well svelte-udj3er"><!> <!> <!></div></div>'),mn=j("<!> <!>",1),yn=j("<!> <!>",1),bn=j("<!> <div><!></div> <!> <!> <!> <!>",1);function Jn(J,e){He(e,!0);const i=()=>ea(ra,"$page",s),[s,p]=ta(),R=ke(()=>e.data.type==="dataset"||e.data.entity.document?.frontmatter?.entity_type==="dataset"),_=ke(()=>ut.getAppForEntityType(e.data.entity.document?.frontmatter?.entity_type??e.data.type)),C=ke(()=>()=>{const n=e.data.entity.path;if(n){const D=n.lastIndexOf(`/${e.data.repo}/`);if(D>=0)return n.substring(D+1).split("/")}return[e.data.repo,e.data.id,"main.md"]});let x=Ee(""),c=Ee(it({})),L=Ee(0);const N=ke(()=>Vr(t(c))),S=new Set(["name","date"]);let M=Ee(null);rt(()=>{if(i().url.searchParams.has("new")){E(M,"name");const n=new URL(i().url);n.searchParams.delete("new"),history.replaceState({},"",n.pathname)}else E(M,null)});const me=ke(()=>!!e.data.entity.data?.source_ref);let G=Ee(!1),ne=Ee(null),ye=Ee(null);async function oe(){if(!t(G)){E(G,!0),E(ne,null),E(ye,null);try{const{result:n}=await ha(e.data.repo,e.data.type,e.data.id);E(ne,n,!0)}catch(n){E(ye,n.message||"Refresh failed",!0)}finally{E(G,!1)}}}let le=Ee(!1);async function _e(){if(!t(le)){E(le,!0);try{await va(e.data.repo,e.data.type,e.data.id),E(ne,null),await aa()}catch(n){E(ye,n.message||"Apply changes failed",!0)}finally{E(le,!1)}}}let se=null,P=Ee(""),k=!1,a=Ee(it([]));function r(n){o(),qe(async()=>{const{createCollabSession:D}=await import("../chunks/C3RWu-3l.js");return{createCollabSession:D}},__vite__mapDeps([8,9,10,11,12,13,14,15,16,17,18]),import.meta.url).then(({createCollabSession:D})=>{const ie=getComputedStyle(document.documentElement).getPropertyValue("--color-accent").trim()||"#e05050",Y=D(n,{name:Ft.user?.displayName??"Anonymous",color:ie,colorLight:ie+"33"});Y.ytext.observe(()=>{const ae=Y.ytext.toString();ae!==t(x)&&(k=!0,E(x,ae,!0),requestAnimationFrame(()=>{k=!1}))});const ue=Y.ydoc.clientID;function q(){const ae=[];Y.awareness.getStates().forEach((re,U)=>{if(U===ue)return;const ee=re.cell;if(ee==null||ee.row==null||ee.col==null)return;const{name:we="Anonymous",color:ge="#e05050"}=re.user||{};ae.push({row:ee.row,col:ee.col,name:we,color:ge})}),E(a,ae,!0)}Y.awareness.on("change",q),se=Y,E(P,n,!0)})}function o(){se&&(se.destroy(),se=null,E(P,""),E(a,[],!0))}Vt(()=>o());let f=Ee(""),g=Ee(0);rt(()=>{const n=`${e.data.repo}/${e.data.type}/${e.data.id}`,D=ma.mutationCount;if(n!==t(f)||D!==t(g)){t(f)&&n!==t(f)&&Ke.flush(),E(f,n),E(g,D,!0);const ie=e.data.entity.document?.content??"";E(x,ie.trim()===""?"":ie,!0),E(c,{...e.data.entity.document?.frontmatter??e.data.entity.data??{}},!0),Gt(L),Ke.reset();const Y=`${e.data.repo}/${e.data.type}/${e.data.id}`;t(R)&&Y!==t(P)?r(Y):t(R)||o()}}),rt(()=>{const n=e.data.repo,D=e.data.type,ie=e.data.id;Qt(()=>{kt.select(n,D,ie),kt.showEntity()})});function K(n){if(!k){if(E(x,n,!0),se){const D=se.ytext,ie=D.toString();n!==ie&&se.ydoc.transact(()=>{D.delete(0,D.length),D.insert(0,n)})}Ke.scheduleAutoSave(e.data.repo,e.data.type,e.data.id,{content:n})}}function ve(n,D){E(c,{...t(c),[n]:D},!0),Ke.scheduleAutoSave(e.data.repo,e.data.type,e.data.id,{data:t(c)})}function be(n){const{[n]:D,...ie}=t(c);E(c,ie,!0),Ke.scheduleAutoSave(e.data.repo,e.data.type,e.data.id,{data:t(c)})}function b(n,D){E(c,{...t(c),[n]:D},!0),Ke.scheduleAutoSave(e.data.repo,e.data.type,e.data.id,{data:t(c)})}function l(n,D){Ke.scheduleAutoSave(e.data.repo,e.data.type,e.data.id,{data:t(c)})}let d=Ee(null);function F(n){n!==e.data.type&&E(d,n,!0)}async function X(){const n=t(d);if(E(d,null),!!n){Ke.reset();try{await Ht(e.data.repo,e.data.type,e.data.id,n),await ut.refreshEntities(e.data.repo),await ft(`/${e.data.repo}/${n}/${e.data.id}`,{invalidateAll:!0})}catch(D){console.error("Failed to change entity type:",D)}}}function Z(n){for(const D of ut.repos){const ie=D.entities.find(Y=>Y.id===n);if(ie){ft(`/${D.name}/${ie.entityType}/${ie.id}`);return}}ga.showToast(`"${n}" is in a collection you don't have access to`)}rt(()=>(Lt.enter(e.data.repo,e.data.type,e.data.id),()=>Lt.leave()));const v=ke(()=>t(ne)!==null&&(t(ne).diffs.length>0||t(ne).body_changed));function u(n){(n.metaKey||n.ctrlKey)&&n.key==="s"&&(n.preventDefault(),Ke.flush()),n.key==="Escape"&&!(n.target instanceof HTMLInputElement||n.target instanceof HTMLTextAreaElement)&&(Ke.flush(),kt.deselect(),ft("/"))}var O=bn();Ze("keydown",Xt,u);var Q=he(O);na(Q,{activeView:"entity"});var V=W(Q,2);let T;var m=A(V);{var y=n=>{var D=un(),ie=W(he(D),2),Y=A(ie);Je(Y,{variant:"outline",size:"default",onclick:()=>E(ne,null),get disabled(){return t(le)},children:(q,ae)=>{je();var re=ot("Dismiss");h(q,re)},$$slots:{default:!0}});var ue=W(Y,2);Je(ue,{variant:"accent",size:"default",onclick:_e,get disabled(){return t(le)},children:(q,ae)=>{var re=ln(),U=he(re);{var ee=ge=>{Ut(ge,{class:"size-3 animate-spin",style:"display:inline;vertical-align:middle;margin-right:4px"})};ce(U,ge=>{t(le)&&ge(ee)})}var we=W(U,1,!0);de(()=>pe(we,t(le)?"Applying...":"Apply changes")),h(q,re)},$$slots:{default:!0}}),w(ie),h(n,D)},te=n=>{var D=pn(),ie=he(D);Ue(ie,21,()=>t(C)(),Be,(ge,Ce,Pe)=>{var xe=cn(),Se=he(xe);{var Le=Me=>{var Ve=dn();h(Me,Ve)};ce(Se,Me=>{Pe>0&&Me(Le)})}var Fe=W(Se),De=A(Fe,!0);w(Fe),de(Me=>{lt(Fe,1,Me,"svelte-udj3er"),pe(De,t(Ce))},[()=>$t(Pe===t(C)().length-1?"bc-current":"bc-segment")]),h(ge,xe)}),w(ie);var Y=W(ie,2),ue=A(Y);{var q=ge=>{var Ce=fn();h(ge,Ce)},ae=ge=>{var Ce=vn(),Pe=A(Ce,!0);w(Ce),de(()=>pe(Pe,Ke.error)),h(ge,Ce)};ce(ue,ge=>{Ke.saving?ge(q):Ke.error&&ge(ae,1)})}var re=W(ue,2);{var U=ge=>{Je(ge,{variant:"outline",size:"sm",class:"refresh-btn",onclick:oe,get disabled(){return t(G)},children:(Ce,Pe)=>{var xe=hn(),Se=he(xe);{var Le=De=>{Ut(De,{class:"size-3 animate-spin",style:"display:inline;vertical-align:middle;margin-right:4px"})};ce(Se,De=>{t(G)&&De(Le)})}var Fe=W(Se,1,!0);de(()=>pe(Fe,t(G)?"Refreshing...":"Refresh from source")),h(Ce,xe)},$$slots:{default:!0}})};ce(re,ge=>{t(me)&&Ft.user?.role==="admin"&&ge(U)})}var ee=W(re,2);{var we=ge=>{Je(ge,{variant:"link",size:"sm",class:"open-app",get href(){return`/${e.data.repo??""}/${e.data.type??""}/${e.data.id??""}/edit`},children:(Ce,Pe)=>{je();var xe=ot();de(()=>pe(xe,`Open in ${t(_).name??""} →`)),h(Ce,xe)},$$slots:{default:!0}})};ce(ee,ge=>{t(_)&&ge(we)})}w(Y),h(n,D)};ce(m,n=>{t(v)?n(y):n(te,!1)})}w(V);var z=W(V,2);{var $=n=>{var D=_n();h(n,D)};ce(z,n=>{t(ne)&&!t(v)&&n($)})}var I=W(z,2);{var H=n=>{on(n,{get properties(){return t(N)},get refreshResult(){return t(ne)},get bodyContent(){return t(x)}})},fe=n=>{var D=gn(),ie=A(D),Y=A(ie);mr(Y,{get properties(){return t(N)},editable:!0,get autofocusKey(){return t(M)},get protectedKeys(){return S},onedit:ve,onremove:be,onadd:b,ontypechange:l,onentitytypechange:F,onfocuseditor:()=>{requestAnimationFrame(()=>requestAnimationFrame(()=>{const U=document.querySelector(".cm-content");if(U){U.focus();const ee=window.getSelection();ee&&U.firstChild?ee.collapse(U.firstChild,0):ee&&ee.collapse(U,0)}}))}});var ue=W(Y,2);{var q=U=>{Ir(U,{get content(){return t(x)},onchange:K,onsave:()=>Ke.flush(),oncellselect:(ee,we)=>{se?.awareness.setLocalStateField("cell",{row:ee,col:we})},get remoteCursors(){return t(a)}})},ae=U=>{{let ee=ke(()=>`${e.data.repo}/${e.data.type}/${e.data.id}`);Sr(U,{get content(){return t(x)},readonly:!1,onchange:K,onsave:()=>Ke.flush(),onwikilinkclick:Z,get resetKey(){return t(L)},get cursorDocName(){return t(ee)}})}};ce(ue,U=>{t(R)?U(q):U(ae,!1)})}var re=W(ue,2);kr(re,{get entityId(){return e.data.id},get entityRepo(){return e.data.repo}}),w(ie),w(D),h(n,D)};ce(I,n=>{t(v)?n(H):n(fe,!1)})}var B=W(I,2);{let n=ke(()=>!!t(ye));Te(B,()=>Ca,(D,ie)=>{ie(D,{get open(){return t(n)},onOpenChange:Y=>{Y||E(ye,null)},children:(Y,ue)=>{var q=Re(),ae=he(q);Te(ae,()=>ya,(re,U)=>{U(re,{children:(ee,we)=>{var ge=yn(),Ce=he(ge);Te(Ce,()=>ba,(xe,Se)=>{Se(xe,{children:(Le,Fe)=>{var De=mn(),Me=he(De);Te(Me,()=>wa,(et,tt)=>{tt(et,{children:(Ie,st)=>{je();var gt=ot("Refresh failed");h(Ie,gt)},$$slots:{default:!0}})});var Ve=W(Me,2);Te(Ve,()=>ka,(et,tt)=>{tt(et,{children:(Ie,st)=>{je();var gt=ot();de(()=>pe(gt,t(ye))),h(Ie,gt)},$$slots:{default:!0}})}),h(Le,De)},$$slots:{default:!0}})});var Pe=W(Ce,2);Te(Pe,()=>xa,(xe,Se)=>{Se(xe,{children:(Le,Fe)=>{var De=Re(),Me=he(De);Te(Me,()=>Ea,(Ve,et)=>{et(Ve,{children:(tt,Ie)=>{je();var st=ot("OK");h(tt,st)},$$slots:{default:!0}})}),h(Le,De)},$$slots:{default:!0}})}),h(ee,ge)},$$slots:{default:!0}})}),h(Y,q)},$$slots:{default:!0}})})}var Ae=W(B,2);{let n=ke(()=>t(d)!==null),D=ke(()=>`Change this entity from ${at(e.data.type)} to ${at(t(d)??"")}? Fields specific to ${at(e.data.type)} will be removed.`);ca(Ae,{get open(){return t(n)},title:"Change entity type",get message(){return t(D)},confirmLabel:"Change type",onconfirm:X,oncancel:()=>{E(d,null)}})}de(()=>T=lt(V,1,"editor-bar svelte-udj3er",null,T,{"editor-bar-diff":t(v)})),h(J,O),Ye(),p()}export{Jn as component,Zn as universal};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as lt,w as ut}from"../chunks/
|
|
1
|
+
import{h as lt,w as ut}from"../chunks/BjAmYrTY.js";import{a as S,s as Z,b as M,c as ft}from"../chunks/COik51fd.js";import{p as $,a2 as tt,aD as mt,c as F,a3 as T,g as m,r as I,t as O,b as et,e as Q,s as k,aF as ht,a0 as vt,a4 as yt}from"../chunks/BenpwI6m.js";import{b as X,i as j}from"../chunks/Dvv4bkXH.js";import{s as Y}from"../chunks/CieeblIr.js";import{g as pt}from"../chunks/CJdAJOAi.js";import{n as E}from"../chunks/CDFdgZ9U.js";const bt=async({params:b})=>{const{repo:o,type:l,id:s}=b,u=await lt(o,l,s);return{repo:o,type:l,id:s,entity:u}},Tt=Object.freeze(Object.defineProperty({__proto__:null,load:bt},Symbol.toStringTag,{value:"Module"}));var gt=M('<div class="loading-indicator svelte-1fltv0h">Loading editor...</div>'),wt=M('<div class="error-indicator svelte-1fltv0h"> </div>'),_t=M('<div><div class="header-mount svelte-1fltv0h"></div> <!> <!> <div></div></div>');function kt(b,o){$(o,!0);let l,s,u=Q(!0),h=Q(null),y=[],d=[],v=[],g={},x=[],p=null,w=null,_=0;function q(){const e=window.StudioChrome,i=document.querySelector(".sg-chrome-overflow-menu");if(i&&(i.innerHTML=""),e&&(e.clearViewAction(),e.clearSaveHandlers()),w&&(w.el.removeEventListener("click",w.handler,!0),w=null),e){e.unmountHeader();for(const{event:r,fn:c}of v)e.off(r,c)}v=[];for(const r of y)r.remove();y=[];for(const r of d)r.remove();d=[],p&&(p.remove(),p=null);for(const[r,c]of Object.entries(g))c===void 0?document.body.removeAttribute(r):document.body.setAttribute(r,c);g={};for(const r of x)document.body.classList.remove(r);x=[],s&&(s.innerHTML="")}async function B(){const e=++_;k(u,!0),k(h,null),q();try{const i=`${o.appMountPath}/edit/${encodeURIComponent(o.repo)}/${encodeURIComponent(o.entityId)}`,r=await fetch(i);if(!r.ok)throw new Error(`Failed to load editor: ${r.status}`);if(e!==_)return;const c=await r.text(),H=new DOMParser().parseFromString(c,"text/html"),at=H.querySelectorAll('link[rel="stylesheet"]');for(const t of at){if(t.href.includes("chrome.css"))continue;let n=t.getAttribute("href")||"";n&&!n.startsWith("http")&&!n.startsWith("/")&&(n=`${o.appMountPath}/${n}`);const a=document.createElement("link");a.rel="stylesheet",a.href=n,document.head.appendChild(a),y.push(a)}const it=H.querySelectorAll("head style");for(const t of it){const n=document.createElement("style");n.textContent=t.textContent,document.head.appendChild(n),y.push(n)}p=document.createElement("style"),p.textContent=`
|
|
2
2
|
body.sg-chrome-active { height: auto !important; }
|
|
3
3
|
body.sg-chrome-active > :not(.sg-chrome-header):not(.sg-chrome-footer) { overflow: visible !important; }
|
|
4
4
|
`,document.head.appendChild(p);const C=H.body;for(const t of Array.from(C.attributes))t.name.startsWith("data-")&&(g[t.name]=document.body.getAttribute(t.name)??void 0,document.body.setAttribute(t.name,t.value));const st=Array.from(C.classList);for(const t of st)t!=="sg-chrome-active"&&(document.body.classList.contains(t)||(document.body.classList.add(t),x.push(t)));const ct=C.querySelectorAll("script"),K=[],N=[];for(const t of ct){if(t.src){const n=t.getAttribute("src")||"";if(n.includes("chrome.js"))continue;let a=n;a&&!a.startsWith("http")&&!a.startsWith("/")&&(a=`${o.appMountPath}/${a}`),K.push(a)}else t.textContent&&N.push(t.textContent);t.remove()}s.innerHTML=C.innerHTML;const f=window.StudioChrome;if(f){f.updateBreadcrumb(o.repo,o.entityId),f.mountHeader(l);const t=document.body.dataset.sgViewUrl,n=document.body.dataset.sgViewLabel;t?f.setViewAction(t,n):f.clearViewAction();const a=l.querySelector(".sg-chrome-back");if(a){const G=J=>{J.preventDefault(),J.stopPropagation(),pt(`/${o.repo}/${o.entityType}/${o.entityId}`)};a.addEventListener("click",G,!0),w={el:a,handler:G}}}let L=null;f&&(L=f.on,f.on=function(t,n){v.push({event:t,fn:n}),L.call(this,t,n)});const dt=`?_v=${Date.now()}`;for(const t of K){if(e!==_)return;await ot(t+dt)}for(const t of N){if(e!==_)return;const n=document.createElement("script");n.textContent=t,document.body.appendChild(n),d.push(n)}f&&L&&(f.on=L),k(u,!1)}catch(i){if(e!==_)return;k(h,i.message||"Failed to load editor",!0),k(u,!1)}}function ot(e){return new Promise((i,r)=>{const c=document.createElement("script");c.src=e,c.onload=()=>i(),c.onerror=()=>r(new Error(`Failed to load script: ${e}`)),document.body.appendChild(c),d.push(c)})}let P="";tt(()=>{const e=`${o.appMountPath}|${o.repo}|${o.entityId}`;P&&P!==e&&s&&B(),P=e}),mt(()=>(B(),q));var A=_t();let D;var V=F(A);X(V,e=>l=e,()=>l);var W=T(V,2);{var nt=e=>{var i=gt();S(e,i)};j(W,e=>{m(u)&&e(nt)})}var U=T(W,2);{var rt=e=>{var i=wt(),r=F(i,!0);I(i),O(()=>Z(r,m(h))),S(e,i)};j(U,e=>{m(h)&&e(rt)})}var R=T(U,2);let z;X(R,e=>s=e,()=>s),I(A),O(()=>{D=Y(A,1,"editor-frame svelte-1fltv0h",null,D,{loading:m(u)}),z=Y(R,1,"editor-container svelte-1fltv0h",null,z,{hidden:m(u)||!!m(h)})}),S(b,A),et()}var St=M('<div class="no-editor svelte-1406f3k"> </div>');function Ft(b,o){$(o,!0);const l=yt(()=>ut.getAppForEntityType(o.data.type));tt(()=>{E.select(o.data.repo,o.data.type,o.data.id),E.showEntity(),E.hideSidebar=!0}),ht(()=>{E.hideSidebar=!1});var s=ft(),u=vt(s);{var h=d=>{kt(d,{get appMountPath(){return m(l).mountPath},get repo(){return o.data.repo},get entityId(){return o.data.id},get entityType(){return o.data.type}})},y=d=>{var v=St(),g=F(v);I(v),O(()=>Z(g,`No app editor available for entity type "${o.data.type??""}"`)),S(d,v)};j(u,d=>{m(l)?d(h):d(y,!1)})}S(b,s),et()}export{Ft as component,Tt as universal};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/BB_5th5W.js","../chunks/PPVm8Dsz.js","../chunks/CqkleIqs.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{d as Ae,e as Tt,a as ht,b as Dt,s as It,g as le,f as $t,c as Qe}from"../chunks/b0XUoOIH.js";import{p as Ft,a1 as Je,a2 as St,g,a4 as nt,aD as Ne,aF as qe,t as yt,b as Bt,c as at,s as q,e as pt,r as it,a3 as gt,l as Ut,d as Pt,a as ze,n as Se,m as Zt,a0 as ke,bu as $e}from"../chunks/DSh-OF2y.js";import{V as tn}from"../chunks/By_Wtb5J.js";import{_ as en}from"../chunks/PPVm8Dsz.js";import{e as ce,i as fe}from"../chunks/DHtLlmE0.js";import{s as nn}from"../chunks/CFtRXHDP.js";import{b as kt,a as Pe}from"../chunks/CRnhIQbv.js";import{b as Ee,i as Kt}from"../chunks/DT3KtxWU.js";import{p as mt,l as Qt}from"../chunks/D-yNNNdf.js";import{g as rn}from"../chunks/BAAbylyg.js";import{e as Mt}from"../chunks/CdeYcEuU.js";import{B as on}from"../chunks/DQ5NTKSo.js";import{i as Re}from"../chunks/vZ2iBqLE.js";import{n as se}from"../chunks/DC9z5DEo.js";import{w as Wt}from"../chunks/DSkxw4Ss.js";import{chatStore as an}from"../chunks/BU2bHQbQ.js";function sn(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return Le(this.cover(e,n),e,n,t)}function Le(t,e,n,i){if(isNaN(e)||isNaN(n))return t;var r,a=t._root,c={data:i},o=t._x0,u=t._y0,l=t._x1,f=t._y1,C,d,v,b,p,s,h,x;if(!a)return t._root=c,t;for(;a.length;)if((p=e>=(C=(o+l)/2))?o=C:l=C,(s=n>=(d=(u+f)/2))?u=d:f=d,r=a,!(a=a[h=s<<1|p]))return r[h]=c,t;if(v=+t._x.call(null,a.data),b=+t._y.call(null,a.data),e===v&&n===b)return c.next=a,r?r[h]=c:t._root=c,t;do r=r?r[h]=new Array(4):t._root=new Array(4),(p=e>=(C=(o+l)/2))?o=C:l=C,(s=n>=(d=(u+f)/2))?u=d:f=d;while((h=s<<1|p)===(x=(b>=d)<<1|v>=C));return r[x]=a,r[h]=c,t}function ln(t){var e,n,i=t.length,r,a,c=new Array(i),o=new Array(i),u=1/0,l=1/0,f=-1/0,C=-1/0;for(n=0;n<i;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(a=+this._y.call(null,e))||(c[n]=r,o[n]=a,r<u&&(u=r),r>f&&(f=r),a<l&&(l=a),a>C&&(C=a));if(u>f||l>C)return this;for(this.cover(u,l).cover(f,C),n=0;n<i;++n)Le(this,c[n],o[n],t[n]);return this}function cn(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,i=this._y0,r=this._x1,a=this._y1;if(isNaN(n))r=(n=Math.floor(t))+1,a=(i=Math.floor(e))+1;else{for(var c=r-n||1,o=this._root,u,l;n>t||t>=r||i>e||e>=a;)switch(l=(e<i)<<1|t<n,u=new Array(4),u[l]=o,o=u,c*=2,l){case 0:r=n+c,a=i+c;break;case 1:n=r-c,a=i+c;break;case 2:r=n+c,i=a-c;break;case 3:n=r-c,i=a-c;break}this._root&&this._root.length&&(this._root=o)}return this._x0=n,this._y0=i,this._x1=r,this._y1=a,this}function fn(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function un(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function st(t,e,n,i,r){this.node=t,this.x0=e,this.y0=n,this.x1=i,this.y1=r}function hn(t,e,n){var i,r=this._x0,a=this._y0,c,o,u,l,f=this._x1,C=this._y1,d=[],v=this._root,b,p;for(v&&d.push(new st(v,r,a,f,C)),n==null?n=1/0:(r=t-n,a=e-n,f=t+n,C=e+n,n*=n);b=d.pop();)if(!(!(v=b.node)||(c=b.x0)>f||(o=b.y0)>C||(u=b.x1)<r||(l=b.y1)<a))if(v.length){var s=(c+u)/2,h=(o+l)/2;d.push(new st(v[3],s,h,u,l),new st(v[2],c,h,s,l),new st(v[1],s,o,u,h),new st(v[0],c,o,s,h)),(p=(e>=h)<<1|t>=s)&&(b=d[d.length-1],d[d.length-1]=d[d.length-1-p],d[d.length-1-p]=b)}else{var x=t-+this._x.call(null,v.data),D=e-+this._y.call(null,v.data),m=x*x+D*D;if(m<n){var N=Math.sqrt(n=m);r=t-N,a=e-N,f=t+N,C=e+N,i=v.data}}return i}function dn(t){if(isNaN(f=+this._x.call(null,t))||isNaN(C=+this._y.call(null,t)))return this;var e,n=this._root,i,r,a,c=this._x0,o=this._y0,u=this._x1,l=this._y1,f,C,d,v,b,p,s,h;if(!n)return this;if(n.length)for(;;){if((b=f>=(d=(c+u)/2))?c=d:u=d,(p=C>=(v=(o+l)/2))?o=v:l=v,e=n,!(n=n[s=p<<1|b]))return this;if(!n.length)break;(e[s+1&3]||e[s+2&3]||e[s+3&3])&&(i=e,h=s)}for(;n.data!==t;)if(r=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,r?(a?r.next=a:delete r.next,this):e?(a?e[s]=a:delete e[s],(n=e[0]||e[1]||e[2]||e[3])&&n===(e[3]||e[2]||e[1]||e[0])&&!n.length&&(i?i[h]=n:this._root=n),this):(this._root=a,this)}function gn(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function vn(){return this._root}function pn(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function yn(t){var e=[],n,i=this._root,r,a,c,o,u;for(i&&e.push(new st(i,this._x0,this._y0,this._x1,this._y1));n=e.pop();)if(!t(i=n.node,a=n.x0,c=n.y0,o=n.x1,u=n.y1)&&i.length){var l=(a+o)/2,f=(c+u)/2;(r=i[3])&&e.push(new st(r,l,f,o,u)),(r=i[2])&&e.push(new st(r,a,f,l,u)),(r=i[1])&&e.push(new st(r,l,c,o,f)),(r=i[0])&&e.push(new st(r,a,c,l,f))}return this}function mn(t){var e=[],n=[],i;for(this._root&&e.push(new st(this._root,this._x0,this._y0,this._x1,this._y1));i=e.pop();){var r=i.node;if(r.length){var a,c=i.x0,o=i.y0,u=i.x1,l=i.y1,f=(c+u)/2,C=(o+l)/2;(a=r[0])&&e.push(new st(a,c,o,f,C)),(a=r[1])&&e.push(new st(a,f,o,u,C)),(a=r[2])&&e.push(new st(a,c,C,f,l)),(a=r[3])&&e.push(new st(a,f,C,u,l))}n.push(i)}for(;i=n.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function xn(t){return t[0]}function wn(t){return arguments.length?(this._x=t,this):this._x}function _n(t){return t[1]}function bn(t){return arguments.length?(this._y=t,this):this._y}function de(t,e,n){var i=new ge(e??xn,n??_n,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function ge(t,e,n,i,r,a){this._x=t,this._y=e,this._x0=n,this._y0=i,this._x1=r,this._y1=a,this._root=void 0}function ye(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var ct=de.prototype=ge.prototype;ct.copy=function(){var t=new ge(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,n,i;if(!e)return t;if(!e.length)return t._root=ye(e),t;for(n=[{source:e,target:t._root=new Array(4)}];e=n.pop();)for(var r=0;r<4;++r)(i=e.source[r])&&(i.length?n.push({source:i,target:e.target[r]=new Array(4)}):e.target[r]=ye(i));return t};ct.add=sn;ct.addAll=ln;ct.cover=cn;ct.data=fn;ct.extent=un;ct.find=hn;ct.remove=dn;ct.removeAll=gn;ct.root=vn;ct.size=pn;ct.visit=yn;ct.visitAfter=mn;ct.x=wn;ct.y=bn;function lt(t){return function(){return t}}function xt(t){return(t()-.5)*1e-6}function Mn(t){return t.x+t.vx}function Tn(t){return t.y+t.vy}function me(t){var e,n,i,r=1,a=1;typeof t!="function"&&(t=lt(t==null?1:+t));function c(){for(var l,f=e.length,C,d,v,b,p,s,h=0;h<a;++h)for(C=de(e,Mn,Tn).visitAfter(o),l=0;l<f;++l)d=e[l],p=n[d.index],s=p*p,v=d.x+d.vx,b=d.y+d.vy,C.visit(x);function x(D,m,N,S,W){var B=D.data,$=D.r,G=p+$;if(B){if(B.index>d.index){var ft=v-B.x-B.vx,Q=b-B.y-B.vy,ot=ft*ft+Q*Q;ot<G*G&&(ft===0&&(ft=xt(i),ot+=ft*ft),Q===0&&(Q=xt(i),ot+=Q*Q),ot=(G-(ot=Math.sqrt(ot)))/ot*r,d.vx+=(ft*=ot)*(G=($*=$)/(s+$)),d.vy+=(Q*=ot)*G,B.vx-=ft*(G=1-G),B.vy-=Q*G)}return}return m>v+G||S<v-G||N>b+G||W<b-G}}function o(l){if(l.data)return l.r=n[l.data.index];for(var f=l.r=0;f<4;++f)l[f]&&l[f].r>l.r&&(l.r=l[f].r)}function u(){if(e){var l,f=e.length,C;for(n=new Array(f),l=0;l<f;++l)C=e[l],n[C.index]=+t(C,l,e)}}return c.initialize=function(l,f){e=l,i=f,u()},c.iterations=function(l){return arguments.length?(a=+l,c):a},c.strength=function(l){return arguments.length?(r=+l,c):r},c.radius=function(l){return arguments.length?(t=typeof l=="function"?l:lt(+l),u(),c):t},c}function In(t){return t.index}function xe(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function we(t){var e=In,n=C,i,r=lt(30),a,c,o,u,l,f=1;t==null&&(t=[]);function C(s){return 1/Math.min(o[s.source.index],o[s.target.index])}function d(s){for(var h=0,x=t.length;h<f;++h)for(var D=0,m,N,S,W,B,$,G;D<x;++D)m=t[D],N=m.source,S=m.target,W=S.x+S.vx-N.x-N.vx||xt(l),B=S.y+S.vy-N.y-N.vy||xt(l),$=Math.sqrt(W*W+B*B),$=($-a[D])/$*s*i[D],W*=$,B*=$,S.vx-=W*(G=u[D]),S.vy-=B*G,N.vx+=W*(G=1-G),N.vy+=B*G}function v(){if(c){var s,h=c.length,x=t.length,D=new Map(c.map((N,S)=>[e(N,S,c),N])),m;for(s=0,o=new Array(h);s<x;++s)m=t[s],m.index=s,typeof m.source!="object"&&(m.source=xe(D,m.source)),typeof m.target!="object"&&(m.target=xe(D,m.target)),o[m.source.index]=(o[m.source.index]||0)+1,o[m.target.index]=(o[m.target.index]||0)+1;for(s=0,u=new Array(x);s<x;++s)m=t[s],u[s]=o[m.source.index]/(o[m.source.index]+o[m.target.index]);i=new Array(x),b(),a=new Array(x),p()}}function b(){if(c)for(var s=0,h=t.length;s<h;++s)i[s]=+n(t[s],s,t)}function p(){if(c)for(var s=0,h=t.length;s<h;++s)a[s]=+r(t[s],s,t)}return d.initialize=function(s,h){c=s,l=h,v()},d.links=function(s){return arguments.length?(t=s,v(),d):t},d.id=function(s){return arguments.length?(e=s,d):e},d.iterations=function(s){return arguments.length?(f=+s,d):f},d.strength=function(s){return arguments.length?(n=typeof s=="function"?s:lt(+s),b(),d):n},d.distance=function(s){return arguments.length?(r=typeof s=="function"?s:lt(+s),p(),d):r},d}var Cn={value:()=>{}};function Ve(){for(var t=0,e=arguments.length,n={},i;t<e;++t){if(!(i=arguments[t]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new jt(n)}function jt(t){this._=t}function Dn(t,e){return t.trim().split(/^|\s+/).map(function(n){var i="",r=n.indexOf(".");if(r>=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}jt.prototype=Ve.prototype={constructor:jt,on:function(t,e){var n=this._,i=Dn(t+"",n),r,a=-1,c=i.length;if(arguments.length<2){for(;++a<c;)if((r=(t=i[a]).type)&&(r=An(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++a<c;)if(r=(t=i[a]).type)n[r]=_e(n[r],t.name,e);else if(e==null)for(r in n)n[r]=_e(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new jt(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),i=0,r,a;i<r;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=this._[t],i=0,r=a.length;i<r;++i)a[i].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,a=i.length;r<a;++r)i[r].value.apply(e,n)}};function An(t,e){for(var n=0,i=t.length,r;n<i;++n)if((r=t[n]).name===e)return r.value}function _e(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=Cn,t=t.slice(0,i).concat(t.slice(i+1));break}return n!=null&&t.push({name:e,value:n}),t}var Et=0,Lt=0,Rt=0,Xe=1e3,Jt,Vt,qt=0,Ct=0,te=0,Xt=typeof performance=="object"&&performance.now?performance:Date,Fe=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Be(){return Ct||(Fe(Nn),Ct=Xt.now()+te)}function Nn(){Ct=0}function ue(){this._call=this._time=this._next=null}ue.prototype=Oe.prototype={constructor:ue,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Be():+n)+(e==null?0:+e),!this._next&&Vt!==this&&(Vt?Vt._next=this:Jt=this,Vt=this),this._call=t,this._time=n,he()},stop:function(){this._call&&(this._call=null,this._time=1/0,he())}};function Oe(t,e,n){var i=new ue;return i.restart(t,e,n),i}function zn(){Be(),++Et;for(var t=Jt,e;t;)(e=Ct-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Et}function be(){Ct=(qt=Xt.now())+te,Et=Lt=0;try{zn()}finally{Et=0,kn(),Ct=0}}function Sn(){var t=Xt.now(),e=t-qt;e>Xe&&(te-=e,qt=t)}function kn(){for(var t,e=Jt,n,i=1/0;e;)e._call?(i>e._time&&(i=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Jt=n);Vt=t,he(i)}function he(t){if(!Et){Lt&&(Lt=clearTimeout(Lt));var e=t-Ct;e>24?(t<1/0&&(Lt=setTimeout(be,t-Xt.now()-te)),Rt&&(Rt=clearInterval(Rt))):(Rt||(qt=Xt.now(),Rt=setInterval(Sn,Xe)),Et=1,Fe(be))}}const Pn=1664525,En=1013904223,Me=4294967296;function Rn(){let t=1;return()=>(t=(Pn*t+En)%Me)/Me}function Ln(t){return t.x}function Vn(t){return t.y}var Xn=10,Fn=Math.PI*(3-Math.sqrt(5));function Te(t){var e,n=1,i=.001,r=1-Math.pow(i,1/300),a=0,c=.6,o=new Map,u=Oe(C),l=Ve("tick","end"),f=Rn();t==null&&(t=[]);function C(){d(),l.call("tick",e),n<i&&(u.stop(),l.call("end",e))}function d(p){var s,h=t.length,x;p===void 0&&(p=1);for(var D=0;D<p;++D)for(n+=(a-n)*r,o.forEach(function(m){m(n)}),s=0;s<h;++s)x=t[s],x.fx==null?x.x+=x.vx*=c:(x.x=x.fx,x.vx=0),x.fy==null?x.y+=x.vy*=c:(x.y=x.fy,x.vy=0);return e}function v(){for(var p=0,s=t.length,h;p<s;++p){if(h=t[p],h.index=p,h.fx!=null&&(h.x=h.fx),h.fy!=null&&(h.y=h.fy),isNaN(h.x)||isNaN(h.y)){var x=Xn*Math.sqrt(.5+p),D=p*Fn;h.x=x*Math.cos(D),h.y=x*Math.sin(D)}(isNaN(h.vx)||isNaN(h.vy))&&(h.vx=h.vy=0)}}function b(p){return p.initialize&&p.initialize(t,f),p}return v(),e={tick:d,restart:function(){return u.restart(C),e},stop:function(){return u.stop(),e},nodes:function(p){return arguments.length?(t=p,v(),o.forEach(b),e):t},alpha:function(p){return arguments.length?(n=+p,e):n},alphaMin:function(p){return arguments.length?(i=+p,e):i},alphaDecay:function(p){return arguments.length?(r=+p,e):+r},alphaTarget:function(p){return arguments.length?(a=+p,e):a},velocityDecay:function(p){return arguments.length?(c=1-p,e):1-c},randomSource:function(p){return arguments.length?(f=p,o.forEach(b),e):f},force:function(p,s){return arguments.length>1?(s==null?o.delete(p):o.set(p,b(s)),e):o.get(p)},find:function(p,s,h){var x=0,D=t.length,m,N,S,W,B;for(h==null?h=1/0:h*=h,x=0;x<D;++x)W=t[x],m=p-W.x,N=s-W.y,S=m*m+N*N,S<h&&(B=W,h=S);return B},on:function(p,s){return arguments.length>1?(l.on(p,s),e):l.on(p)}}}function Ie(){var t,e,n,i,r=lt(-30),a,c=1,o=1/0,u=.81;function l(v){var b,p=t.length,s=de(t,Ln,Vn).visitAfter(C);for(i=v,b=0;b<p;++b)e=t[b],s.visit(d)}function f(){if(t){var v,b=t.length,p;for(a=new Array(b),v=0;v<b;++v)p=t[v],a[p.index]=+r(p,v,t)}}function C(v){var b=0,p,s,h=0,x,D,m;if(v.length){for(x=D=m=0;m<4;++m)(p=v[m])&&(s=Math.abs(p.value))&&(b+=p.value,h+=s,x+=s*p.x,D+=s*p.y);v.x=x/h,v.y=D/h}else{p=v,p.x=p.data.x,p.y=p.data.y;do b+=a[p.data.index];while(p=p.next)}v.value=b}function d(v,b,p,s){if(!v.value)return!0;var h=v.x-e.x,x=v.y-e.y,D=s-b,m=h*h+x*x;if(D*D/u<m)return m<o&&(h===0&&(h=xt(n),m+=h*h),x===0&&(x=xt(n),m+=x*x),m<c&&(m=Math.sqrt(c*m)),e.vx+=h*v.value*i/m,e.vy+=x*v.value*i/m),!0;if(v.length||m>=o)return;(v.data!==e||v.next)&&(h===0&&(h=xt(n),m+=h*h),x===0&&(x=xt(n),m+=x*x),m<c&&(m=Math.sqrt(c*m)));do v.data!==e&&(D=a[v.data.index]*i/m,e.vx+=h*D,e.vy+=x*D);while(v=v.next)}return l.initialize=function(v,b){t=v,n=b,f()},l.strength=function(v){return arguments.length?(r=typeof v=="function"?v:lt(+v),f(),l):r},l.distanceMin=function(v){return arguments.length?(c=v*v,l):Math.sqrt(c)},l.distanceMax=function(v){return arguments.length?(o=v*v,l):Math.sqrt(o)},l.theta=function(v){return arguments.length?(u=v*v,l):Math.sqrt(u)},l}function Ce(t){var e=lt(.1),n,i,r;typeof t!="function"&&(t=lt(t==null?0:+t));function a(o){for(var u=0,l=n.length,f;u<l;++u)f=n[u],f.vx+=(r[u]-f.x)*i[u]*o}function c(){if(n){var o,u=n.length;for(i=new Array(u),r=new Array(u),o=0;o<u;++o)i[o]=isNaN(r[o]=+t(n[o],o,n))?0:+e(n[o],o,n)}}return a.initialize=function(o){n=o,c()},a.strength=function(o){return arguments.length?(e=typeof o=="function"?o:lt(+o),c(),a):e},a.x=function(o){return arguments.length?(t=typeof o=="function"?o:lt(+o),c(),a):t},a}function De(t){var e=lt(.1),n,i,r;typeof t!="function"&&(t=lt(t==null?0:+t));function a(o){for(var u=0,l=n.length,f;u<l;++u)f=n[u],f.vy+=(r[u]-f.y)*i[u]*o}function c(){if(n){var o,u=n.length;for(i=new Array(u),r=new Array(u),o=0;o<u;++o)i[o]=isNaN(r[o]=+t(n[o],o,n))?0:+e(n[o],o,n)}}return a.initialize=function(o){n=o,c()},a.strength=function(o){return arguments.length?(e=typeof o=="function"?o:lt(+o),c(),a):e},a.y=function(o){return arguments.length?(t=typeof o=="function"?o:lt(+o),c(),a):t},a}var Bn=Dt('<div><span class="legend-dot svelte-1i33fky"></span> <span class="legend-label svelte-1i33fky"> </span> <span class="legend-count svelte-1i33fky"> </span></div>'),On=Dt('<div class="graph-view svelte-1i33fky"><div class="canvas-wrap svelte-1i33fky"><div class="legend-panel svelte-1i33fky"></div></div></div>');function Yn(t,e){Ft(e,!0);let n=mt(e,"selectedEntityId",3,null),i=mt(e,"filteredIds",3,null),r=mt(e,"sidebarHoveredId",3,null),a=mt(e,"highlightedIds",3,null);function c(y){return e.nameMap?.get(y)??y.replace(/-/g," ").replace(/\b\w/g,w=>w.toUpperCase())}const o=Je("theme"),u=nt(()=>o.current==="light"?{default:14211288,dim:15263976,conn:12632256,labelText:1710623}:{default:2763306,dim:1315860,conn:4210752,labelText:15592943}),l=nt(()=>o.current==="light"?16316666:592139),f=.75;St(()=>{o.current,K&&(K.style.fill=g(u).labelText);const y=g(Gt);for(const w of b)Mt(w.type)===Nt&&(w.color=y);et()}),St(()=>{i(),et()}),St(()=>{a(),et()}),St(()=>{n(),et()});let C=!1;St(()=>{const y=e.graphData;if(!tt||!A||!R)return;if(!C){C=!0;return}const w=new Map;for(const T of y.edges)w.set(T.source,(w.get(T.source)??0)+1),w.set(T.target,(w.get(T.target)??0)+1);const _=new Map;for(const T of b)_.set(T.id,{x:T.x,y:T.y});const O=3600*y.nodes.length,Y=Math.sqrt(O),F=y.nodes.map(T=>{const H=w.get(T.id)??0,dt=_.get(T.id);return{id:T.id,type:T.type,repo:T.repo,color:Mt(T.type)===Nt?g(Gt):Mt(T.type),weight:H,x:dt?.x??(Math.random()-.5)*Y,y:dt?.y??(Math.random()-.5)*Y,vx:0,vy:0,r:At(H)}}),Z=new Map;for(const T of F)Z.set(T.id,T);const rt=new Set(L.keys()),ut=new Set(y.nodes.map(T=>T.id));for(const T of rt)if(!ut.has(T)){const H=L.get(T);H&&(R.removeChild(H),H.destroy()),L.delete(T)}let X=null;if(L.size>0&&(X=L.values().next().value?.texture),!X){const T=document.createElement("canvas");T.width=100,T.height=100;const H=T.getContext("2d");H.beginPath(),H.arc(50,50,48,0,Math.PI*2),H.fillStyle="#ffffff",H.fill(),X=tt.Texture.from(T)}for(const T of F){let H=L.get(T.id);H||(H=new tt.Sprite(X),H.anchor.set(.5),R.addChild(H),L.set(T.id,H)),H.tint=Yt(T.color)}b=F,v?.stop();const vt=y.edges.map(T=>({source:T.source,target:T.target})),V=we(vt).id(T=>T.id).distance(250);v=Te(b).force("link",V).force("charge",Ie().strength(-1e3).distanceMin(30)).force("x",Ce(0).strength(.1)).force("y",De(0).strength(.1)).force("collide",me().radius(60).strength(.5)).velocityDecay(.4).alpha(.3).on("tick",()=>{ot||ne(),et()}),p=V.links(),N=null,Ot(),et()}),St(()=>{const y=r();if(y){const w=b.find(_=>_.id===y)??null;N=w,Ot(),M=w?1:0}else S||(M=0);et()});let d,v=null,b=[],p=[],s=!1,h=0,x=0,D=0,m=1,N=null,S=null,W=pt(!1),B=0,$=0,G=0,ft=0,Q=new Set,ot=!1,wt=pt(null),I=0,M=0;const E=4;let A=null,k=null,j=null,R=null,L=new Map,U=null,K=null,tt=null;function At(y){return Math.max(3,Math.min(Math.sqrt(y+1)+2,10))}function ee(y,w){const _=d.getBoundingClientRect();return{x:(y-_.left-x)/m,y:(w-_.top-D)/m}}function ve(y,w){for(let _=b.length-1;_>=0;_--){const P=b[_],O=y-P.x,Y=w-P.y,F=(P.r*1.5+4)/m;if(O*O+Y*Y<=F*F)return P}return null}function Ot(){const y=N??null;if(Q.clear(),!!y){Q.add(y.id);for(const w of p)w.source.id===y.id&&Q.add(w.target.id),w.target.id===y.id&&Q.add(w.source.id);if(R){const w=L.get(y.id);w&&R.setChildIndex(w,R.children.length-1)}}}function ne(){if(b.length===0||!d)return;let y=1/0,w=-1/0,_=1/0,P=-1/0,O=0;for(const X of b)X.x<y&&(y=X.x),X.x>w&&(w=X.x),X.y<_&&(_=X.y),X.y>P&&(P=X.y),X.r>O&&(O=X.r);const Y=d.clientWidth,F=d.clientHeight,Z=w-y,rt=P-_;if(Z===0||rt===0)return;const ut=(60+O)*2;m=Math.min((Y-ut)/Z,(F-ut)/rt,3),x=Y/2-(y+w)/2*m,D=F/2-(_+P)/2*m,et()}function et(){s=!0,h=0}function Yt(y){return parseInt(y.replace("#",""),16)}function _t(y,w,_){const P=(y>>16&255)+_*((w>>16&255)-(y>>16&255)),O=(y>>8&255)+_*((w>>8&255)-(y>>8&255)),Y=(y&255)+_*((w&255)-(y&255));return Math.round(P)<<16|Math.round(O)<<8|Math.round(Y)}function Ye(){if(!tt||!k||!j)return;k.clear(),j.clear();const w=N!==null,_=I,P=g(wt),O=a(),Y=i(),F=g(u).default,Z=g(u).dim,rt=g(u).conn;for(let ut=0;ut<p.length;ut++){const X=p[ut],vt=X.source.x*m+x,V=X.source.y*m+D,T=X.target.x*m+x,H=X.target.y*m+D,dt=w&&_>.01&&Q.has(X.source.id)&&Q.has(X.target.id);let z=F;w&&_>.01?z=dt?_t(F,rt,_):_t(F,Z,_):(P!==null||O!==null||Y!==null)&&(z=Z);const J=dt?j:k,zt=dt?1:.2;J.setStrokeStyle({width:1,color:z,alpha:zt}),J.moveTo(vt,V),J.lineTo(T,H),J.stroke()}}function He(){if(!tt)return;const y=N,w=y!==null,_=I,P=g(wt),O=a(),Y=i(),F=!y&&n()?b.find(V=>V.id===n())??null:null,Z=new Set;if(F){Z.add(F.id);for(const V of p)V.source.id===F.id&&Z.add(V.target.id),V.target.id===F.id&&Z.add(V.source.id)}for(const V of b){const T=L.get(V.id);if(!T)continue;const H=V.x*m+x,dt=V.y*m+D;T.position.set(H,dt),T.scale.set(V.r/50),T.alpha=1;const z=Yt(V.color);if(F&&!y){const J=Z.has(V.id);T.tint=J?z:_t(z,g(l),f)}else{const J=V===y,zt=w&&Q.has(V.id),Ze=P!==null&&(P==="other"?Mt(V.type)===Nt:V.type===P);if(J&&_>.01)T.tint=z,T.scale.set(V.r*(1+_*.4)/50);else if(zt)T.tint=z;else if(P!==null)T.tint=Ze?z:_t(z,g(l),f);else if(O!==null){const ae=O.has(V.id)?_*f:f;T.tint=_t(z,g(l),ae)}else if(Y!==null){const ae=Y.has(V.id)?_*f:f;T.tint=_t(z,g(l),ae)}else T.tint=_t(z,g(l),_*f)}}const rt=y??F,ut=y?_>.01:!!F;if(rt&&ut&&U){U.visible=!0;const V=rt.x*m+x,T=rt.y*m+D;U.position.set(V,T),U.scale.set(rt.r*5/64),U.alpha=y?_*.25:.25,U.tint=Yt(rt.color)}else U&&(U.visible=!1);const X=y??F,vt=y?_>.01:!!F;if(X&&vt&&K){const V=X.x*m+x,T=X.y*m+D;K.text=c(X.id),K.style.fontSize=12,K.position.set(V,T+X.r+8),K.alpha=y?_:1,K.visible=!0}else K&&(K.visible=!1)}let Ht=!1;function Ge(y){if(y.button!==0)return;Ht=!1;const w=ee(y.clientX,y.clientY),_=ve(w.x,w.y);_?(S=_,ot=!0,_.fx=_.x,_.fy=_.y,v?.alphaTarget(.3).restart(),et()):(q(W,!0),B=y.clientX,$=y.clientY,G=x,ft=D),d.setPointerCapture(y.pointerId),window.addEventListener("pointerup",ie,{once:!0})}function We(y){if(S){Ht=!0;const w=ee(y.clientX,y.clientY);S.fx=w.x,S.fy=w.y,et()}else if(g(W))Ht=!0,x=G+(y.clientX-B),D=ft+(y.clientY-$),et();else{const w=ee(y.clientX,y.clientY),_=ve(w.x,w.y);_?_!==N?(N&&(I=.15),N=_,Ot(),M=1,d.style.cursor="pointer",et()):M!==1&&(M=1,d.style.cursor="pointer",et()):M!==0&&(M=0,d.style.cursor="grab",et())}}function ie(y){if(!S&&!g(W))return;window.removeEventListener("pointerup",ie);const w=Ht;if(S){const _=S;S.fx=null,S.fy=null,v?.alphaTarget(0),S=null,M=0,et(),w||rn(`/${_.repo}/${_.type}/${_.id}`)}else g(W)&&q(W,!1);try{d.releasePointerCapture(y.pointerId)}catch{}}const Nt="#5c5c66",je="#b0b0b8",Gt=nt(()=>o.current==="light"?je:Nt),Ue=nt(()=>{const y=new Map;for(const P of e.graphData.nodes)y.set(P.type,(y.get(P.type)??0)+1);const w=[];let _=0;for(const[P,O]of y){const Y=Mt(P);Y===Nt?_+=O:w.push({name:P,color:Y,count:O})}return w.sort((P,O)=>O.count-P.count),_>0&&w.push({name:"other",color:g(Gt),count:_}),w});Ne(async()=>{tt=await en(()=>import("../chunks/BB_5th5W.js"),__vite__mapDeps([0,1,2]),import.meta.url),A=new tt.Application,await A.init({antialias:!0,resolution:window.devicePixelRatio||1,autoDensity:!0,backgroundAlpha:0,resizeTo:d}),d.insertBefore(A.canvas,d.firstChild),A.canvas.style.position="absolute",A.canvas.style.inset="0",k=new tt.Graphics,A.stage.addChild(k),j=new tt.Graphics,A.stage.addChild(j),R=new tt.Container,A.stage.addChild(R);const y=document.createElement("canvas");y.width=128,y.height=128;const w=y.getContext("2d"),_=w.createRadialGradient(64,64,0,64,64,64);_.addColorStop(0,"rgba(255,255,255,0.5)"),_.addColorStop(1,"rgba(255,255,255,0)"),w.fillStyle=_,w.fillRect(0,0,128,128);const P=tt.Texture.from(y);U=new tt.Sprite(P),U.anchor.set(.5),U.visible=!1,A.stage.addChild(U);const O=document.createElement("canvas");O.width=100,O.height=100;const Y=O.getContext("2d");Y.beginPath(),Y.arc(50,50,48,0,Math.PI*2),Y.fillStyle="#ffffff",Y.fill();const F=tt.Texture.from(O),Z=new Map;for(const z of e.graphData.edges)Z.set(z.source,(Z.get(z.source)??0)+1),Z.set(z.target,(Z.get(z.target)??0)+1);const rt=new Map,X=3600*e.graphData.nodes.length,vt=Math.sqrt(X);b=e.graphData.nodes.map(z=>{const J=Z.get(z.id)??0,zt={id:z.id,type:z.type,repo:z.repo,color:Mt(z.type)===Nt?g(Gt):Mt(z.type),weight:J,x:(Math.random()-.5)*vt,y:(Math.random()-.5)*vt,vx:0,vy:0,r:At(J)};return rt.set(z.id,zt),zt});for(const z of b){const J=new tt.Sprite(F);J.anchor.set(.5),J.tint=Yt(z.color),R.addChild(J),L.set(z.id,J)}K=new tt.Text({text:"",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"500",fontSize:12,fill:g(u).labelText,align:"center"}}),K.anchor.set(.5,0),K.visible=!1,A.stage.addChild(K);const V=e.graphData.edges.map(z=>({source:z.source,target:z.target})),T=we(V).id(z=>z.id).distance(250);v=Te(b).force("link",T).force("charge",Ie().strength(-1e3).distanceMin(30)).force("x",Ce(0).strength(.1)).force("y",De(0).strength(.1)).force("collide",me().radius(60).strength(.5)).velocityDecay(.4).alpha(1).on("tick",()=>{ot||ne(),et()}),p=T.links();let H=0;A.ticker.add(()=>{const z=performance.now(),J=H?Math.min((z-H)/1e3,.05):.016;H=z,I<M?(I=Math.min(M,I+E*J),s=!0):I>M&&(I=Math.max(M,I-E*J),s=!0),I===0&&M===0&&N&&!S&&(N=null,Ot(),s=!0),(s||h<120)&&(Ye(),He(),s=!1,h++)});const dt=new ResizeObserver(()=>{A.renderer.resize(d.clientWidth,d.clientHeight),ne()});return dt.observe(d),()=>{dt.disconnect()}}),qe(()=>{v?.stop(),A&&(A.destroy(!0,{children:!0}),A=null)});var re=On(),bt=at(re);let pe;var oe=at(bt);ce(oe,21,()=>g(Ue),fe,(y,w)=>{var _=Bn();let P;var O=at(_);let Y;var F=gt(O,2),Z=at(F,!0);it(F);var rt=gt(F,2),ut=at(rt,!0);it(rt),it(_),yt(()=>{P=nn(_,1,"legend-item svelte-1i33fky",null,P,{"legend-item-active":g(wt)===g(w).name}),Y=kt(O,"",Y,{background:g(w).color}),It(Z,g(w).name),It(ut,g(w).count)}),le("mouseenter",_,()=>{q(wt,g(w).name,!0),et()}),le("mouseleave",_,()=>{q(wt,null),et()}),ht(y,_)}),it(oe),it(bt),Ee(bt,y=>d=y,()=>d),it(re),yt(()=>pe=kt(bt,"",pe,{cursor:g(W)?"grabbing":"grab"})),Tt("pointerdown",bt,Ge),Tt("pointermove",bt,We),Tt("pointerup",bt,ie),Tt("pointerdown",oe,y=>y.stopPropagation()),ht(t,re),Bt()}Ae(["pointerdown","pointermove","pointerup"]);var Hn=$t("<title> </title>"),Gn=$t('<svg><!><path d="M7,28a1,1,0,0,1-1-1V5a1,1,0,0,1,1.4819-.8763l20,11a1,1,0,0,1,0,1.7525l-20,11A1.0005,1.0005,0,0,1,7,28ZM8,6.6909V25.3088L24.9248,16Z"></path></svg>');function Wn(t,e){const n=Qt(e,["children","$$slots","$$events","$$legacy"]),i=Qt(n,["size","title"]);Ft(e,!1);const r=Zt(),a=Zt();let c=mt(e,"size",8,16),o=mt(e,"title",8,void 0);Ut(()=>(Pt(n),Pt(o())),()=>{q(r,n["aria-label"]||n["aria-labelledby"]||o())}),Ut(()=>(g(r),Pt(n)),()=>{q(a,{"aria-hidden":g(r)?void 0:!0,role:g(r)?"img":void 0,focusable:Number(n.tabindex)===0?!0:void 0})}),ze(),Re();var u=Gn();Pe(u,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:c(),height:c(),...g(a),...i}));var l=at(u);{var f=C=>{var d=Hn(),v=at(d,!0);it(d),yt(()=>It(v,o())),ht(C,d)};Kt(l,C=>{o()&&C(f)})}Se(),it(u),ht(t,u),Bt()}var jn=$t("<title> </title>"),Un=$t('<svg><!><path d="M12,8V24H8V8h4m0-2H8A2,2,0,0,0,6,8V24a2,2,0,0,0,2,2h4a2,2,0,0,0,2-2V8a2,2,0,0,0-2-2Z"></path><path d="M24,8V24H20V8h4m0-2H20a2,2,0,0,0-2,2V24a2,2,0,0,0,2,2h4a2,2,0,0,0,2-2V8a2,2,0,0,0-2-2Z"></path></svg>');function Zn(t,e){const n=Qt(e,["children","$$slots","$$events","$$legacy"]),i=Qt(n,["size","title"]);Ft(e,!1);const r=Zt(),a=Zt();let c=mt(e,"size",8,16),o=mt(e,"title",8,void 0);Ut(()=>(Pt(n),Pt(o())),()=>{q(r,n["aria-label"]||n["aria-labelledby"]||o())}),Ut(()=>(g(r),Pt(n)),()=>{q(a,{"aria-hidden":g(r)?void 0:!0,role:g(r)?"img":void 0,focusable:Number(n.tabindex)===0?!0:void 0})}),ze(),Re();var u=Un();Pe(u,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:c(),height:c(),...g(a),...i}));var l=at(u);{var f=C=>{var d=jn(),v=at(d,!0);it(d),yt(()=>It(v,o())),ht(C,d)};Kt(l,C=>{o()&&C(f)})}Se(2),it(u),ht(t,u),Bt()}var Kn=Dt('<div class="density-bar svelte-lzvab"></div>'),Qn=Dt('<span class="date-label svelte-lzvab"> </span>'),Jn=Dt('<div class="timeline-tooltip svelte-lzvab"><div class="tooltip-date svelte-lzvab"> </div> <div class="tooltip-count svelte-lzvab"> </div></div>'),qn=Dt('<div class="timeline-bar svelte-lzvab"><!> <div class="timeline-track svelte-lzvab"><div class="track-line svelte-lzvab"></div> <div class="density-bars svelte-lzvab"></div> <div class="playhead svelte-lzvab"></div> <div class="date-labels svelte-lzvab"></div> <!></div></div>');function $n(t,e){Ft(e,!0);let n=pt(null),i=pt(0),r=pt(!1),a=pt(!1),c=pt(null),o=null;const u=nt(()=>{let I=1/0,M=-1/0;for(const E of e.entities){const A=E.createdAt?new Date(E.createdAt).getTime():0;A>0&&A<I&&(I=A),A>M&&(M=A)}return I===1/0&&(I=Date.now()),M===-1/0&&(M=Date.now()),{min:I,max:M}}),l=nt(()=>{let{min:I,max:M}=g(u);return M-I<864e5&&(I-=864e5*15,M+=864e5*15),{min:new Date(I),max:new Date(M)}}),f=nt(()=>{const M=g(l).min.getTime(),E=g(l).max.getTime(),A=new Map;for(const k of e.entities){const j=k.createdAt?new Date(k.createdAt).getTime():0;if(j<=0)continue;const R=Math.floor((j-M)/864e5),L=M+R*864e5,U=A.get(L)??[];U.push(k),A.set(L,U)}return{map:A,minTime:M,maxTime:E,dayMs:864e5}}),C=nt(()=>{let I=0;for(const M of g(f).map.values())M.length>I&&(I=M.length);return Math.max(1,I)}),d=nt(()=>{const{minTime:I,maxTime:M}=g(f),E=M-I,A=[],k=Math.max(4,Math.min(8,Math.floor(g(i)/100))),j=E/k;for(let R=0;R<=k;R++){const L=I+R*j,K=new Date(L).toLocaleDateString("en-US",{month:"short",day:"numeric"});A.push({label:K,x:R/k})}return A}),v=nt(()=>{const{minTime:I,maxTime:M}=g(f),E=M-I;if(E<=0)return .5;const A=e.currentDate?e.currentDate.getTime():g(u).max,k=Math.max(g(u).min,Math.min(g(u).max,A));return Math.max(0,Math.min(1,(k-I)/E))});function b(I){if(!g(n))return new Date;const M=g(n).getBoundingClientRect(),E=40,k=M.width-E-12,j=Math.max(0,Math.min(1,(I-M.left-E)/k)),{minTime:R,maxTime:L}=g(f),U=R+j*(L-R);return new Date(Math.max(g(u).min,Math.min(g(u).max,U)))}function p(I){q(r,!0),N();const M=b(I.clientX);e.onDateChange(M),I.target.setPointerCapture(I.pointerId)}function s(I){if(g(r)&&e.onDateChange(b(I.clientX)),!g(n))return;const M=g(n).getBoundingClientRect(),E=40,k=M.width-E-12,j=(I.clientX-M.left-E)/k;if(j<0||j>1){q(c,null);return}const{minTime:R,dayMs:L,map:U}=g(f),K=R+j*(g(f).maxTime-R),tt=R+Math.floor((K-R)/L)*L,At=U.get(tt);At&&At.length>0?q(c,{date:new Date(tt),count:At.length,x:I.clientX-M.left},!0):q(c,null)}function h(){q(r,!1)}function x(){q(c,null)}function D(){g(a)?N():m()}function m(){q(a,!0);const{min:I,max:M}=g(u),A=(M-I)/200;let k=e.currentDate?.getTime()??I;k>=M&&(k=I),o=setInterval(()=>{if(k+=A,k>=M){e.onDateChange(null),N();return}e.onDateChange(new Date(k))},50)}function N(){q(a,!1),o&&(clearInterval(o),o=null)}Ne(()=>{if(g(n)){const I=new ResizeObserver(M=>{q(i,M[0]?.contentRect.width??0,!0)});return I.observe(g(n)),()=>I.disconnect()}});var S=qn(),W=at(S);{let I=nt(()=>g(a)?"Pause":"Play");on(W,{variant:"ghost",size:"icon",class:"play-btn",onclick:D,get title(){return g(I)},children:(M,E)=>{var A=Qe(),k=ke(A);{var j=L=>{Zn(L,{size:14})},R=L=>{Wn(L,{size:14})};Kt(k,L=>{g(a)?L(j):L(R,!1)})}ht(M,A)},$$slots:{default:!0}})}var B=gt(W,2),$=gt(at(B),2);ce($,21,()=>Array.from(g(f).map.entries()),fe,(I,M)=>{var E=nt(()=>$e(g(M),2));let A=()=>g(E)[0],k=()=>g(E)[1];const j=nt(()=>(A()-g(f).minTime)/(g(f).maxTime-g(f).minTime)),R=nt(()=>k().length/g(C)),L=nt(()=>.05+.95*g(R)*g(R));var U=Kn();let K;yt(()=>K=kt(U,"",K,{left:`${g(j)*100}%`,opacity:g(L)})),ht(I,U)}),it($);var G=gt($,2);let ft;var Q=gt(G,2);ce(Q,21,()=>g(d),fe,(I,M)=>{var E=Qn();let A;var k=at(E,!0);it(E),yt(()=>{A=kt(E,"",A,{left:`${g(M).x*100}%`}),It(k,g(M).label)}),ht(I,E)}),it(Q);var ot=gt(Q,2);{var wt=I=>{var M=Jn();let E;var A=at(M),k=at(A,!0);it(A);var j=gt(A,2),R=at(j);it(j),it(M),yt(L=>{E=kt(M,"",E,{left:`${g(c).x??""}px`}),It(k,L),It(R,`${g(c).count??""} ${g(c).count===1?"entity":"entities"}`)},[()=>g(c).date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})]),ht(I,M)};Kt(ot,I=>{g(c)&&!g(r)&&I(wt)})}it(B),it(S),Ee(S,I=>q(n,I),()=>g(n)),yt(()=>ft=kt(G,"",ft,{left:`${g(v)*100}%`})),Tt("pointerdown",B,p),Tt("pointermove",B,s),Tt("pointerup",B,h),le("pointerleave",B,x),ht(t,S),Bt()}Ae(["pointerdown","pointermove","pointerup"]);var ti=Dt("<!> <!> <!>",1);function yi(t,e){Ft(e,!0),se.showGraph();let n=pt(null);const i=nt(()=>{const f=new Map;for(const C of Wt.repos)for(const d of C.entities)f.set(d.id,d.title);return f}),r=nt(()=>{const f=[];for(const C of Wt.repos)for(const d of C.entities)d.id.toLowerCase().startsWith("readme")||f.push(d);return f}),a=nt(()=>{const f=[],C=[],d=new Set,v=new Set,b=g(n)?.getTime()??1/0;for(const s of Wt.repos)for(const h of s.entities){if(h.id.toLowerCase().startsWith("readme")||d.has(h.id)||(h.createdAt?new Date(h.createdAt).getTime():0)>b)continue;d.add(h.id),f.push({id:h.id,type:h.entityType,repo:s.name});const D=h.wikilinks??[];for(const m of D){const N=h.id<m?`${h.id}|${m}`:`${m}|${h.id}`;!v.has(N)&&h.id!==m&&(v.add(N),C.push({source:h.id,target:m}))}}const p=C.filter(s=>d.has(s.source)&&d.has(s.target));return{nodes:f,edges:p}});var c=ti(),o=ke(c);tn(o,{activeView:"graph"});var u=gt(o,2);Yn(u,{get graphData(){return g(a)},get selectedEntityId(){return se.selectedId},get nameMap(){return g(i)},get filteredIds(){return Wt.filteredIds},get sidebarHoveredId(){return se.hoveredEntityId},get highlightedIds(){return an.highlightedIds}});var l=gt(u,2);$n(l,{get entities(){return g(r)},get currentDate(){return g(n)},onDateChange:f=>{q(n,f,!0)}}),ht(t,c),Bt()}export{yi as component};
|
|
2
|
+
import{d as Ae,e as Tt,a as ht,b as Dt,s as It,g as le,f as $t,c as Qe}from"../chunks/COik51fd.js";import{p as Ft,a1 as Je,a2 as St,g,a4 as nt,aD as Ne,aF as qe,t as yt,b as Bt,c as at,s as q,e as pt,r as it,a3 as gt,l as Ut,d as Pt,a as ze,n as Se,m as Zt,a0 as ke,bu as $e}from"../chunks/BenpwI6m.js";import{V as tn}from"../chunks/ujukzxos.js";import{_ as en}from"../chunks/PPVm8Dsz.js";import{e as ce,i as fe}from"../chunks/h2NtTN7K.js";import{s as nn}from"../chunks/CieeblIr.js";import{c as kt,a as Pe}from"../chunks/CStpN6HQ.js";import{b as Ee,i as Kt}from"../chunks/Dvv4bkXH.js";import{p as mt,l as Qt}from"../chunks/wWaI7EIw.js";import{g as rn}from"../chunks/CJdAJOAi.js";import{e as Mt}from"../chunks/CdeYcEuU.js";import{B as on}from"../chunks/DAD7hf2c.js";import{i as Re}from"../chunks/BSBiehHY.js";import{n as se}from"../chunks/CDFdgZ9U.js";import{w as Wt}from"../chunks/BjAmYrTY.js";import{chatStore as an}from"../chunks/D9gozPE-.js";function sn(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return Le(this.cover(e,n),e,n,t)}function Le(t,e,n,i){if(isNaN(e)||isNaN(n))return t;var r,a=t._root,c={data:i},o=t._x0,u=t._y0,l=t._x1,f=t._y1,C,d,v,b,p,s,h,x;if(!a)return t._root=c,t;for(;a.length;)if((p=e>=(C=(o+l)/2))?o=C:l=C,(s=n>=(d=(u+f)/2))?u=d:f=d,r=a,!(a=a[h=s<<1|p]))return r[h]=c,t;if(v=+t._x.call(null,a.data),b=+t._y.call(null,a.data),e===v&&n===b)return c.next=a,r?r[h]=c:t._root=c,t;do r=r?r[h]=new Array(4):t._root=new Array(4),(p=e>=(C=(o+l)/2))?o=C:l=C,(s=n>=(d=(u+f)/2))?u=d:f=d;while((h=s<<1|p)===(x=(b>=d)<<1|v>=C));return r[x]=a,r[h]=c,t}function ln(t){var e,n,i=t.length,r,a,c=new Array(i),o=new Array(i),u=1/0,l=1/0,f=-1/0,C=-1/0;for(n=0;n<i;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(a=+this._y.call(null,e))||(c[n]=r,o[n]=a,r<u&&(u=r),r>f&&(f=r),a<l&&(l=a),a>C&&(C=a));if(u>f||l>C)return this;for(this.cover(u,l).cover(f,C),n=0;n<i;++n)Le(this,c[n],o[n],t[n]);return this}function cn(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,i=this._y0,r=this._x1,a=this._y1;if(isNaN(n))r=(n=Math.floor(t))+1,a=(i=Math.floor(e))+1;else{for(var c=r-n||1,o=this._root,u,l;n>t||t>=r||i>e||e>=a;)switch(l=(e<i)<<1|t<n,u=new Array(4),u[l]=o,o=u,c*=2,l){case 0:r=n+c,a=i+c;break;case 1:n=r-c,a=i+c;break;case 2:r=n+c,i=a-c;break;case 3:n=r-c,i=a-c;break}this._root&&this._root.length&&(this._root=o)}return this._x0=n,this._y0=i,this._x1=r,this._y1=a,this}function fn(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function un(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function st(t,e,n,i,r){this.node=t,this.x0=e,this.y0=n,this.x1=i,this.y1=r}function hn(t,e,n){var i,r=this._x0,a=this._y0,c,o,u,l,f=this._x1,C=this._y1,d=[],v=this._root,b,p;for(v&&d.push(new st(v,r,a,f,C)),n==null?n=1/0:(r=t-n,a=e-n,f=t+n,C=e+n,n*=n);b=d.pop();)if(!(!(v=b.node)||(c=b.x0)>f||(o=b.y0)>C||(u=b.x1)<r||(l=b.y1)<a))if(v.length){var s=(c+u)/2,h=(o+l)/2;d.push(new st(v[3],s,h,u,l),new st(v[2],c,h,s,l),new st(v[1],s,o,u,h),new st(v[0],c,o,s,h)),(p=(e>=h)<<1|t>=s)&&(b=d[d.length-1],d[d.length-1]=d[d.length-1-p],d[d.length-1-p]=b)}else{var x=t-+this._x.call(null,v.data),D=e-+this._y.call(null,v.data),m=x*x+D*D;if(m<n){var N=Math.sqrt(n=m);r=t-N,a=e-N,f=t+N,C=e+N,i=v.data}}return i}function dn(t){if(isNaN(f=+this._x.call(null,t))||isNaN(C=+this._y.call(null,t)))return this;var e,n=this._root,i,r,a,c=this._x0,o=this._y0,u=this._x1,l=this._y1,f,C,d,v,b,p,s,h;if(!n)return this;if(n.length)for(;;){if((b=f>=(d=(c+u)/2))?c=d:u=d,(p=C>=(v=(o+l)/2))?o=v:l=v,e=n,!(n=n[s=p<<1|b]))return this;if(!n.length)break;(e[s+1&3]||e[s+2&3]||e[s+3&3])&&(i=e,h=s)}for(;n.data!==t;)if(r=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,r?(a?r.next=a:delete r.next,this):e?(a?e[s]=a:delete e[s],(n=e[0]||e[1]||e[2]||e[3])&&n===(e[3]||e[2]||e[1]||e[0])&&!n.length&&(i?i[h]=n:this._root=n),this):(this._root=a,this)}function gn(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function vn(){return this._root}function pn(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function yn(t){var e=[],n,i=this._root,r,a,c,o,u;for(i&&e.push(new st(i,this._x0,this._y0,this._x1,this._y1));n=e.pop();)if(!t(i=n.node,a=n.x0,c=n.y0,o=n.x1,u=n.y1)&&i.length){var l=(a+o)/2,f=(c+u)/2;(r=i[3])&&e.push(new st(r,l,f,o,u)),(r=i[2])&&e.push(new st(r,a,f,l,u)),(r=i[1])&&e.push(new st(r,l,c,o,f)),(r=i[0])&&e.push(new st(r,a,c,l,f))}return this}function mn(t){var e=[],n=[],i;for(this._root&&e.push(new st(this._root,this._x0,this._y0,this._x1,this._y1));i=e.pop();){var r=i.node;if(r.length){var a,c=i.x0,o=i.y0,u=i.x1,l=i.y1,f=(c+u)/2,C=(o+l)/2;(a=r[0])&&e.push(new st(a,c,o,f,C)),(a=r[1])&&e.push(new st(a,f,o,u,C)),(a=r[2])&&e.push(new st(a,c,C,f,l)),(a=r[3])&&e.push(new st(a,f,C,u,l))}n.push(i)}for(;i=n.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function xn(t){return t[0]}function wn(t){return arguments.length?(this._x=t,this):this._x}function _n(t){return t[1]}function bn(t){return arguments.length?(this._y=t,this):this._y}function de(t,e,n){var i=new ge(e??xn,n??_n,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function ge(t,e,n,i,r,a){this._x=t,this._y=e,this._x0=n,this._y0=i,this._x1=r,this._y1=a,this._root=void 0}function ye(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var ct=de.prototype=ge.prototype;ct.copy=function(){var t=new ge(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,n,i;if(!e)return t;if(!e.length)return t._root=ye(e),t;for(n=[{source:e,target:t._root=new Array(4)}];e=n.pop();)for(var r=0;r<4;++r)(i=e.source[r])&&(i.length?n.push({source:i,target:e.target[r]=new Array(4)}):e.target[r]=ye(i));return t};ct.add=sn;ct.addAll=ln;ct.cover=cn;ct.data=fn;ct.extent=un;ct.find=hn;ct.remove=dn;ct.removeAll=gn;ct.root=vn;ct.size=pn;ct.visit=yn;ct.visitAfter=mn;ct.x=wn;ct.y=bn;function lt(t){return function(){return t}}function xt(t){return(t()-.5)*1e-6}function Mn(t){return t.x+t.vx}function Tn(t){return t.y+t.vy}function me(t){var e,n,i,r=1,a=1;typeof t!="function"&&(t=lt(t==null?1:+t));function c(){for(var l,f=e.length,C,d,v,b,p,s,h=0;h<a;++h)for(C=de(e,Mn,Tn).visitAfter(o),l=0;l<f;++l)d=e[l],p=n[d.index],s=p*p,v=d.x+d.vx,b=d.y+d.vy,C.visit(x);function x(D,m,N,S,W){var B=D.data,$=D.r,G=p+$;if(B){if(B.index>d.index){var ft=v-B.x-B.vx,Q=b-B.y-B.vy,ot=ft*ft+Q*Q;ot<G*G&&(ft===0&&(ft=xt(i),ot+=ft*ft),Q===0&&(Q=xt(i),ot+=Q*Q),ot=(G-(ot=Math.sqrt(ot)))/ot*r,d.vx+=(ft*=ot)*(G=($*=$)/(s+$)),d.vy+=(Q*=ot)*G,B.vx-=ft*(G=1-G),B.vy-=Q*G)}return}return m>v+G||S<v-G||N>b+G||W<b-G}}function o(l){if(l.data)return l.r=n[l.data.index];for(var f=l.r=0;f<4;++f)l[f]&&l[f].r>l.r&&(l.r=l[f].r)}function u(){if(e){var l,f=e.length,C;for(n=new Array(f),l=0;l<f;++l)C=e[l],n[C.index]=+t(C,l,e)}}return c.initialize=function(l,f){e=l,i=f,u()},c.iterations=function(l){return arguments.length?(a=+l,c):a},c.strength=function(l){return arguments.length?(r=+l,c):r},c.radius=function(l){return arguments.length?(t=typeof l=="function"?l:lt(+l),u(),c):t},c}function In(t){return t.index}function xe(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function we(t){var e=In,n=C,i,r=lt(30),a,c,o,u,l,f=1;t==null&&(t=[]);function C(s){return 1/Math.min(o[s.source.index],o[s.target.index])}function d(s){for(var h=0,x=t.length;h<f;++h)for(var D=0,m,N,S,W,B,$,G;D<x;++D)m=t[D],N=m.source,S=m.target,W=S.x+S.vx-N.x-N.vx||xt(l),B=S.y+S.vy-N.y-N.vy||xt(l),$=Math.sqrt(W*W+B*B),$=($-a[D])/$*s*i[D],W*=$,B*=$,S.vx-=W*(G=u[D]),S.vy-=B*G,N.vx+=W*(G=1-G),N.vy+=B*G}function v(){if(c){var s,h=c.length,x=t.length,D=new Map(c.map((N,S)=>[e(N,S,c),N])),m;for(s=0,o=new Array(h);s<x;++s)m=t[s],m.index=s,typeof m.source!="object"&&(m.source=xe(D,m.source)),typeof m.target!="object"&&(m.target=xe(D,m.target)),o[m.source.index]=(o[m.source.index]||0)+1,o[m.target.index]=(o[m.target.index]||0)+1;for(s=0,u=new Array(x);s<x;++s)m=t[s],u[s]=o[m.source.index]/(o[m.source.index]+o[m.target.index]);i=new Array(x),b(),a=new Array(x),p()}}function b(){if(c)for(var s=0,h=t.length;s<h;++s)i[s]=+n(t[s],s,t)}function p(){if(c)for(var s=0,h=t.length;s<h;++s)a[s]=+r(t[s],s,t)}return d.initialize=function(s,h){c=s,l=h,v()},d.links=function(s){return arguments.length?(t=s,v(),d):t},d.id=function(s){return arguments.length?(e=s,d):e},d.iterations=function(s){return arguments.length?(f=+s,d):f},d.strength=function(s){return arguments.length?(n=typeof s=="function"?s:lt(+s),b(),d):n},d.distance=function(s){return arguments.length?(r=typeof s=="function"?s:lt(+s),p(),d):r},d}var Cn={value:()=>{}};function Ve(){for(var t=0,e=arguments.length,n={},i;t<e;++t){if(!(i=arguments[t]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new jt(n)}function jt(t){this._=t}function Dn(t,e){return t.trim().split(/^|\s+/).map(function(n){var i="",r=n.indexOf(".");if(r>=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}jt.prototype=Ve.prototype={constructor:jt,on:function(t,e){var n=this._,i=Dn(t+"",n),r,a=-1,c=i.length;if(arguments.length<2){for(;++a<c;)if((r=(t=i[a]).type)&&(r=An(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++a<c;)if(r=(t=i[a]).type)n[r]=_e(n[r],t.name,e);else if(e==null)for(r in n)n[r]=_e(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new jt(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),i=0,r,a;i<r;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=this._[t],i=0,r=a.length;i<r;++i)a[i].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,a=i.length;r<a;++r)i[r].value.apply(e,n)}};function An(t,e){for(var n=0,i=t.length,r;n<i;++n)if((r=t[n]).name===e)return r.value}function _e(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=Cn,t=t.slice(0,i).concat(t.slice(i+1));break}return n!=null&&t.push({name:e,value:n}),t}var Et=0,Lt=0,Rt=0,Xe=1e3,Jt,Vt,qt=0,Ct=0,te=0,Xt=typeof performance=="object"&&performance.now?performance:Date,Fe=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Be(){return Ct||(Fe(Nn),Ct=Xt.now()+te)}function Nn(){Ct=0}function ue(){this._call=this._time=this._next=null}ue.prototype=Oe.prototype={constructor:ue,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Be():+n)+(e==null?0:+e),!this._next&&Vt!==this&&(Vt?Vt._next=this:Jt=this,Vt=this),this._call=t,this._time=n,he()},stop:function(){this._call&&(this._call=null,this._time=1/0,he())}};function Oe(t,e,n){var i=new ue;return i.restart(t,e,n),i}function zn(){Be(),++Et;for(var t=Jt,e;t;)(e=Ct-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Et}function be(){Ct=(qt=Xt.now())+te,Et=Lt=0;try{zn()}finally{Et=0,kn(),Ct=0}}function Sn(){var t=Xt.now(),e=t-qt;e>Xe&&(te-=e,qt=t)}function kn(){for(var t,e=Jt,n,i=1/0;e;)e._call?(i>e._time&&(i=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Jt=n);Vt=t,he(i)}function he(t){if(!Et){Lt&&(Lt=clearTimeout(Lt));var e=t-Ct;e>24?(t<1/0&&(Lt=setTimeout(be,t-Xt.now()-te)),Rt&&(Rt=clearInterval(Rt))):(Rt||(qt=Xt.now(),Rt=setInterval(Sn,Xe)),Et=1,Fe(be))}}const Pn=1664525,En=1013904223,Me=4294967296;function Rn(){let t=1;return()=>(t=(Pn*t+En)%Me)/Me}function Ln(t){return t.x}function Vn(t){return t.y}var Xn=10,Fn=Math.PI*(3-Math.sqrt(5));function Te(t){var e,n=1,i=.001,r=1-Math.pow(i,1/300),a=0,c=.6,o=new Map,u=Oe(C),l=Ve("tick","end"),f=Rn();t==null&&(t=[]);function C(){d(),l.call("tick",e),n<i&&(u.stop(),l.call("end",e))}function d(p){var s,h=t.length,x;p===void 0&&(p=1);for(var D=0;D<p;++D)for(n+=(a-n)*r,o.forEach(function(m){m(n)}),s=0;s<h;++s)x=t[s],x.fx==null?x.x+=x.vx*=c:(x.x=x.fx,x.vx=0),x.fy==null?x.y+=x.vy*=c:(x.y=x.fy,x.vy=0);return e}function v(){for(var p=0,s=t.length,h;p<s;++p){if(h=t[p],h.index=p,h.fx!=null&&(h.x=h.fx),h.fy!=null&&(h.y=h.fy),isNaN(h.x)||isNaN(h.y)){var x=Xn*Math.sqrt(.5+p),D=p*Fn;h.x=x*Math.cos(D),h.y=x*Math.sin(D)}(isNaN(h.vx)||isNaN(h.vy))&&(h.vx=h.vy=0)}}function b(p){return p.initialize&&p.initialize(t,f),p}return v(),e={tick:d,restart:function(){return u.restart(C),e},stop:function(){return u.stop(),e},nodes:function(p){return arguments.length?(t=p,v(),o.forEach(b),e):t},alpha:function(p){return arguments.length?(n=+p,e):n},alphaMin:function(p){return arguments.length?(i=+p,e):i},alphaDecay:function(p){return arguments.length?(r=+p,e):+r},alphaTarget:function(p){return arguments.length?(a=+p,e):a},velocityDecay:function(p){return arguments.length?(c=1-p,e):1-c},randomSource:function(p){return arguments.length?(f=p,o.forEach(b),e):f},force:function(p,s){return arguments.length>1?(s==null?o.delete(p):o.set(p,b(s)),e):o.get(p)},find:function(p,s,h){var x=0,D=t.length,m,N,S,W,B;for(h==null?h=1/0:h*=h,x=0;x<D;++x)W=t[x],m=p-W.x,N=s-W.y,S=m*m+N*N,S<h&&(B=W,h=S);return B},on:function(p,s){return arguments.length>1?(l.on(p,s),e):l.on(p)}}}function Ie(){var t,e,n,i,r=lt(-30),a,c=1,o=1/0,u=.81;function l(v){var b,p=t.length,s=de(t,Ln,Vn).visitAfter(C);for(i=v,b=0;b<p;++b)e=t[b],s.visit(d)}function f(){if(t){var v,b=t.length,p;for(a=new Array(b),v=0;v<b;++v)p=t[v],a[p.index]=+r(p,v,t)}}function C(v){var b=0,p,s,h=0,x,D,m;if(v.length){for(x=D=m=0;m<4;++m)(p=v[m])&&(s=Math.abs(p.value))&&(b+=p.value,h+=s,x+=s*p.x,D+=s*p.y);v.x=x/h,v.y=D/h}else{p=v,p.x=p.data.x,p.y=p.data.y;do b+=a[p.data.index];while(p=p.next)}v.value=b}function d(v,b,p,s){if(!v.value)return!0;var h=v.x-e.x,x=v.y-e.y,D=s-b,m=h*h+x*x;if(D*D/u<m)return m<o&&(h===0&&(h=xt(n),m+=h*h),x===0&&(x=xt(n),m+=x*x),m<c&&(m=Math.sqrt(c*m)),e.vx+=h*v.value*i/m,e.vy+=x*v.value*i/m),!0;if(v.length||m>=o)return;(v.data!==e||v.next)&&(h===0&&(h=xt(n),m+=h*h),x===0&&(x=xt(n),m+=x*x),m<c&&(m=Math.sqrt(c*m)));do v.data!==e&&(D=a[v.data.index]*i/m,e.vx+=h*D,e.vy+=x*D);while(v=v.next)}return l.initialize=function(v,b){t=v,n=b,f()},l.strength=function(v){return arguments.length?(r=typeof v=="function"?v:lt(+v),f(),l):r},l.distanceMin=function(v){return arguments.length?(c=v*v,l):Math.sqrt(c)},l.distanceMax=function(v){return arguments.length?(o=v*v,l):Math.sqrt(o)},l.theta=function(v){return arguments.length?(u=v*v,l):Math.sqrt(u)},l}function Ce(t){var e=lt(.1),n,i,r;typeof t!="function"&&(t=lt(t==null?0:+t));function a(o){for(var u=0,l=n.length,f;u<l;++u)f=n[u],f.vx+=(r[u]-f.x)*i[u]*o}function c(){if(n){var o,u=n.length;for(i=new Array(u),r=new Array(u),o=0;o<u;++o)i[o]=isNaN(r[o]=+t(n[o],o,n))?0:+e(n[o],o,n)}}return a.initialize=function(o){n=o,c()},a.strength=function(o){return arguments.length?(e=typeof o=="function"?o:lt(+o),c(),a):e},a.x=function(o){return arguments.length?(t=typeof o=="function"?o:lt(+o),c(),a):t},a}function De(t){var e=lt(.1),n,i,r;typeof t!="function"&&(t=lt(t==null?0:+t));function a(o){for(var u=0,l=n.length,f;u<l;++u)f=n[u],f.vy+=(r[u]-f.y)*i[u]*o}function c(){if(n){var o,u=n.length;for(i=new Array(u),r=new Array(u),o=0;o<u;++o)i[o]=isNaN(r[o]=+t(n[o],o,n))?0:+e(n[o],o,n)}}return a.initialize=function(o){n=o,c()},a.strength=function(o){return arguments.length?(e=typeof o=="function"?o:lt(+o),c(),a):e},a.y=function(o){return arguments.length?(t=typeof o=="function"?o:lt(+o),c(),a):t},a}var Bn=Dt('<div><span class="legend-dot svelte-1i33fky"></span> <span class="legend-label svelte-1i33fky"> </span> <span class="legend-count svelte-1i33fky"> </span></div>'),On=Dt('<div class="graph-view svelte-1i33fky"><div class="canvas-wrap svelte-1i33fky"><div class="legend-panel svelte-1i33fky"></div></div></div>');function Yn(t,e){Ft(e,!0);let n=mt(e,"selectedEntityId",3,null),i=mt(e,"filteredIds",3,null),r=mt(e,"sidebarHoveredId",3,null),a=mt(e,"highlightedIds",3,null);function c(y){return e.nameMap?.get(y)??y.replace(/-/g," ").replace(/\b\w/g,w=>w.toUpperCase())}const o=Je("theme"),u=nt(()=>o.current==="light"?{default:14211288,dim:15263976,conn:12632256,labelText:1710623}:{default:2763306,dim:1315860,conn:4210752,labelText:15592943}),l=nt(()=>o.current==="light"?16316666:592139),f=.75;St(()=>{o.current,K&&(K.style.fill=g(u).labelText);const y=g(Gt);for(const w of b)Mt(w.type)===Nt&&(w.color=y);et()}),St(()=>{i(),et()}),St(()=>{a(),et()}),St(()=>{n(),et()});let C=!1;St(()=>{const y=e.graphData;if(!tt||!A||!R)return;if(!C){C=!0;return}const w=new Map;for(const T of y.edges)w.set(T.source,(w.get(T.source)??0)+1),w.set(T.target,(w.get(T.target)??0)+1);const _=new Map;for(const T of b)_.set(T.id,{x:T.x,y:T.y});const O=3600*y.nodes.length,Y=Math.sqrt(O),F=y.nodes.map(T=>{const H=w.get(T.id)??0,dt=_.get(T.id);return{id:T.id,type:T.type,repo:T.repo,color:Mt(T.type)===Nt?g(Gt):Mt(T.type),weight:H,x:dt?.x??(Math.random()-.5)*Y,y:dt?.y??(Math.random()-.5)*Y,vx:0,vy:0,r:At(H)}}),Z=new Map;for(const T of F)Z.set(T.id,T);const rt=new Set(L.keys()),ut=new Set(y.nodes.map(T=>T.id));for(const T of rt)if(!ut.has(T)){const H=L.get(T);H&&(R.removeChild(H),H.destroy()),L.delete(T)}let X=null;if(L.size>0&&(X=L.values().next().value?.texture),!X){const T=document.createElement("canvas");T.width=100,T.height=100;const H=T.getContext("2d");H.beginPath(),H.arc(50,50,48,0,Math.PI*2),H.fillStyle="#ffffff",H.fill(),X=tt.Texture.from(T)}for(const T of F){let H=L.get(T.id);H||(H=new tt.Sprite(X),H.anchor.set(.5),R.addChild(H),L.set(T.id,H)),H.tint=Yt(T.color)}b=F,v?.stop();const vt=y.edges.map(T=>({source:T.source,target:T.target})),V=we(vt).id(T=>T.id).distance(250);v=Te(b).force("link",V).force("charge",Ie().strength(-1e3).distanceMin(30)).force("x",Ce(0).strength(.1)).force("y",De(0).strength(.1)).force("collide",me().radius(60).strength(.5)).velocityDecay(.4).alpha(.3).on("tick",()=>{ot||ne(),et()}),p=V.links(),N=null,Ot(),et()}),St(()=>{const y=r();if(y){const w=b.find(_=>_.id===y)??null;N=w,Ot(),M=w?1:0}else S||(M=0);et()});let d,v=null,b=[],p=[],s=!1,h=0,x=0,D=0,m=1,N=null,S=null,W=pt(!1),B=0,$=0,G=0,ft=0,Q=new Set,ot=!1,wt=pt(null),I=0,M=0;const E=4;let A=null,k=null,j=null,R=null,L=new Map,U=null,K=null,tt=null;function At(y){return Math.max(3,Math.min(Math.sqrt(y+1)+2,10))}function ee(y,w){const _=d.getBoundingClientRect();return{x:(y-_.left-x)/m,y:(w-_.top-D)/m}}function ve(y,w){for(let _=b.length-1;_>=0;_--){const P=b[_],O=y-P.x,Y=w-P.y,F=(P.r*1.5+4)/m;if(O*O+Y*Y<=F*F)return P}return null}function Ot(){const y=N??null;if(Q.clear(),!!y){Q.add(y.id);for(const w of p)w.source.id===y.id&&Q.add(w.target.id),w.target.id===y.id&&Q.add(w.source.id);if(R){const w=L.get(y.id);w&&R.setChildIndex(w,R.children.length-1)}}}function ne(){if(b.length===0||!d)return;let y=1/0,w=-1/0,_=1/0,P=-1/0,O=0;for(const X of b)X.x<y&&(y=X.x),X.x>w&&(w=X.x),X.y<_&&(_=X.y),X.y>P&&(P=X.y),X.r>O&&(O=X.r);const Y=d.clientWidth,F=d.clientHeight,Z=w-y,rt=P-_;if(Z===0||rt===0)return;const ut=(60+O)*2;m=Math.min((Y-ut)/Z,(F-ut)/rt,3),x=Y/2-(y+w)/2*m,D=F/2-(_+P)/2*m,et()}function et(){s=!0,h=0}function Yt(y){return parseInt(y.replace("#",""),16)}function _t(y,w,_){const P=(y>>16&255)+_*((w>>16&255)-(y>>16&255)),O=(y>>8&255)+_*((w>>8&255)-(y>>8&255)),Y=(y&255)+_*((w&255)-(y&255));return Math.round(P)<<16|Math.round(O)<<8|Math.round(Y)}function Ye(){if(!tt||!k||!j)return;k.clear(),j.clear();const w=N!==null,_=I,P=g(wt),O=a(),Y=i(),F=g(u).default,Z=g(u).dim,rt=g(u).conn;for(let ut=0;ut<p.length;ut++){const X=p[ut],vt=X.source.x*m+x,V=X.source.y*m+D,T=X.target.x*m+x,H=X.target.y*m+D,dt=w&&_>.01&&Q.has(X.source.id)&&Q.has(X.target.id);let z=F;w&&_>.01?z=dt?_t(F,rt,_):_t(F,Z,_):(P!==null||O!==null||Y!==null)&&(z=Z);const J=dt?j:k,zt=dt?1:.2;J.setStrokeStyle({width:1,color:z,alpha:zt}),J.moveTo(vt,V),J.lineTo(T,H),J.stroke()}}function He(){if(!tt)return;const y=N,w=y!==null,_=I,P=g(wt),O=a(),Y=i(),F=!y&&n()?b.find(V=>V.id===n())??null:null,Z=new Set;if(F){Z.add(F.id);for(const V of p)V.source.id===F.id&&Z.add(V.target.id),V.target.id===F.id&&Z.add(V.source.id)}for(const V of b){const T=L.get(V.id);if(!T)continue;const H=V.x*m+x,dt=V.y*m+D;T.position.set(H,dt),T.scale.set(V.r/50),T.alpha=1;const z=Yt(V.color);if(F&&!y){const J=Z.has(V.id);T.tint=J?z:_t(z,g(l),f)}else{const J=V===y,zt=w&&Q.has(V.id),Ze=P!==null&&(P==="other"?Mt(V.type)===Nt:V.type===P);if(J&&_>.01)T.tint=z,T.scale.set(V.r*(1+_*.4)/50);else if(zt)T.tint=z;else if(P!==null)T.tint=Ze?z:_t(z,g(l),f);else if(O!==null){const ae=O.has(V.id)?_*f:f;T.tint=_t(z,g(l),ae)}else if(Y!==null){const ae=Y.has(V.id)?_*f:f;T.tint=_t(z,g(l),ae)}else T.tint=_t(z,g(l),_*f)}}const rt=y??F,ut=y?_>.01:!!F;if(rt&&ut&&U){U.visible=!0;const V=rt.x*m+x,T=rt.y*m+D;U.position.set(V,T),U.scale.set(rt.r*5/64),U.alpha=y?_*.25:.25,U.tint=Yt(rt.color)}else U&&(U.visible=!1);const X=y??F,vt=y?_>.01:!!F;if(X&&vt&&K){const V=X.x*m+x,T=X.y*m+D;K.text=c(X.id),K.style.fontSize=12,K.position.set(V,T+X.r+8),K.alpha=y?_:1,K.visible=!0}else K&&(K.visible=!1)}let Ht=!1;function Ge(y){if(y.button!==0)return;Ht=!1;const w=ee(y.clientX,y.clientY),_=ve(w.x,w.y);_?(S=_,ot=!0,_.fx=_.x,_.fy=_.y,v?.alphaTarget(.3).restart(),et()):(q(W,!0),B=y.clientX,$=y.clientY,G=x,ft=D),d.setPointerCapture(y.pointerId),window.addEventListener("pointerup",ie,{once:!0})}function We(y){if(S){Ht=!0;const w=ee(y.clientX,y.clientY);S.fx=w.x,S.fy=w.y,et()}else if(g(W))Ht=!0,x=G+(y.clientX-B),D=ft+(y.clientY-$),et();else{const w=ee(y.clientX,y.clientY),_=ve(w.x,w.y);_?_!==N?(N&&(I=.15),N=_,Ot(),M=1,d.style.cursor="pointer",et()):M!==1&&(M=1,d.style.cursor="pointer",et()):M!==0&&(M=0,d.style.cursor="grab",et())}}function ie(y){if(!S&&!g(W))return;window.removeEventListener("pointerup",ie);const w=Ht;if(S){const _=S;S.fx=null,S.fy=null,v?.alphaTarget(0),S=null,M=0,et(),w||rn(`/${_.repo}/${_.type}/${_.id}`)}else g(W)&&q(W,!1);try{d.releasePointerCapture(y.pointerId)}catch{}}const Nt="#5c5c66",je="#b0b0b8",Gt=nt(()=>o.current==="light"?je:Nt),Ue=nt(()=>{const y=new Map;for(const P of e.graphData.nodes)y.set(P.type,(y.get(P.type)??0)+1);const w=[];let _=0;for(const[P,O]of y){const Y=Mt(P);Y===Nt?_+=O:w.push({name:P,color:Y,count:O})}return w.sort((P,O)=>O.count-P.count),_>0&&w.push({name:"other",color:g(Gt),count:_}),w});Ne(async()=>{tt=await en(()=>import("../chunks/BB_5th5W.js"),__vite__mapDeps([0,1,2]),import.meta.url),A=new tt.Application,await A.init({antialias:!0,resolution:window.devicePixelRatio||1,autoDensity:!0,backgroundAlpha:0,resizeTo:d}),d.insertBefore(A.canvas,d.firstChild),A.canvas.style.position="absolute",A.canvas.style.inset="0",k=new tt.Graphics,A.stage.addChild(k),j=new tt.Graphics,A.stage.addChild(j),R=new tt.Container,A.stage.addChild(R);const y=document.createElement("canvas");y.width=128,y.height=128;const w=y.getContext("2d"),_=w.createRadialGradient(64,64,0,64,64,64);_.addColorStop(0,"rgba(255,255,255,0.5)"),_.addColorStop(1,"rgba(255,255,255,0)"),w.fillStyle=_,w.fillRect(0,0,128,128);const P=tt.Texture.from(y);U=new tt.Sprite(P),U.anchor.set(.5),U.visible=!1,A.stage.addChild(U);const O=document.createElement("canvas");O.width=100,O.height=100;const Y=O.getContext("2d");Y.beginPath(),Y.arc(50,50,48,0,Math.PI*2),Y.fillStyle="#ffffff",Y.fill();const F=tt.Texture.from(O),Z=new Map;for(const z of e.graphData.edges)Z.set(z.source,(Z.get(z.source)??0)+1),Z.set(z.target,(Z.get(z.target)??0)+1);const rt=new Map,X=3600*e.graphData.nodes.length,vt=Math.sqrt(X);b=e.graphData.nodes.map(z=>{const J=Z.get(z.id)??0,zt={id:z.id,type:z.type,repo:z.repo,color:Mt(z.type)===Nt?g(Gt):Mt(z.type),weight:J,x:(Math.random()-.5)*vt,y:(Math.random()-.5)*vt,vx:0,vy:0,r:At(J)};return rt.set(z.id,zt),zt});for(const z of b){const J=new tt.Sprite(F);J.anchor.set(.5),J.tint=Yt(z.color),R.addChild(J),L.set(z.id,J)}K=new tt.Text({text:"",style:{fontFamily:"Inter, system-ui, sans-serif",fontWeight:"500",fontSize:12,fill:g(u).labelText,align:"center"}}),K.anchor.set(.5,0),K.visible=!1,A.stage.addChild(K);const V=e.graphData.edges.map(z=>({source:z.source,target:z.target})),T=we(V).id(z=>z.id).distance(250);v=Te(b).force("link",T).force("charge",Ie().strength(-1e3).distanceMin(30)).force("x",Ce(0).strength(.1)).force("y",De(0).strength(.1)).force("collide",me().radius(60).strength(.5)).velocityDecay(.4).alpha(1).on("tick",()=>{ot||ne(),et()}),p=T.links();let H=0;A.ticker.add(()=>{const z=performance.now(),J=H?Math.min((z-H)/1e3,.05):.016;H=z,I<M?(I=Math.min(M,I+E*J),s=!0):I>M&&(I=Math.max(M,I-E*J),s=!0),I===0&&M===0&&N&&!S&&(N=null,Ot(),s=!0),(s||h<120)&&(Ye(),He(),s=!1,h++)});const dt=new ResizeObserver(()=>{A.renderer.resize(d.clientWidth,d.clientHeight),ne()});return dt.observe(d),()=>{dt.disconnect()}}),qe(()=>{v?.stop(),A&&(A.destroy(!0,{children:!0}),A=null)});var re=On(),bt=at(re);let pe;var oe=at(bt);ce(oe,21,()=>g(Ue),fe,(y,w)=>{var _=Bn();let P;var O=at(_);let Y;var F=gt(O,2),Z=at(F,!0);it(F);var rt=gt(F,2),ut=at(rt,!0);it(rt),it(_),yt(()=>{P=nn(_,1,"legend-item svelte-1i33fky",null,P,{"legend-item-active":g(wt)===g(w).name}),Y=kt(O,"",Y,{background:g(w).color}),It(Z,g(w).name),It(ut,g(w).count)}),le("mouseenter",_,()=>{q(wt,g(w).name,!0),et()}),le("mouseleave",_,()=>{q(wt,null),et()}),ht(y,_)}),it(oe),it(bt),Ee(bt,y=>d=y,()=>d),it(re),yt(()=>pe=kt(bt,"",pe,{cursor:g(W)?"grabbing":"grab"})),Tt("pointerdown",bt,Ge),Tt("pointermove",bt,We),Tt("pointerup",bt,ie),Tt("pointerdown",oe,y=>y.stopPropagation()),ht(t,re),Bt()}Ae(["pointerdown","pointermove","pointerup"]);var Hn=$t("<title> </title>"),Gn=$t('<svg><!><path d="M7,28a1,1,0,0,1-1-1V5a1,1,0,0,1,1.4819-.8763l20,11a1,1,0,0,1,0,1.7525l-20,11A1.0005,1.0005,0,0,1,7,28ZM8,6.6909V25.3088L24.9248,16Z"></path></svg>');function Wn(t,e){const n=Qt(e,["children","$$slots","$$events","$$legacy"]),i=Qt(n,["size","title"]);Ft(e,!1);const r=Zt(),a=Zt();let c=mt(e,"size",8,16),o=mt(e,"title",8,void 0);Ut(()=>(Pt(n),Pt(o())),()=>{q(r,n["aria-label"]||n["aria-labelledby"]||o())}),Ut(()=>(g(r),Pt(n)),()=>{q(a,{"aria-hidden":g(r)?void 0:!0,role:g(r)?"img":void 0,focusable:Number(n.tabindex)===0?!0:void 0})}),ze(),Re();var u=Gn();Pe(u,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:c(),height:c(),...g(a),...i}));var l=at(u);{var f=C=>{var d=Hn(),v=at(d,!0);it(d),yt(()=>It(v,o())),ht(C,d)};Kt(l,C=>{o()&&C(f)})}Se(),it(u),ht(t,u),Bt()}var jn=$t("<title> </title>"),Un=$t('<svg><!><path d="M12,8V24H8V8h4m0-2H8A2,2,0,0,0,6,8V24a2,2,0,0,0,2,2h4a2,2,0,0,0,2-2V8a2,2,0,0,0-2-2Z"></path><path d="M24,8V24H20V8h4m0-2H20a2,2,0,0,0-2,2V24a2,2,0,0,0,2,2h4a2,2,0,0,0,2-2V8a2,2,0,0,0-2-2Z"></path></svg>');function Zn(t,e){const n=Qt(e,["children","$$slots","$$events","$$legacy"]),i=Qt(n,["size","title"]);Ft(e,!1);const r=Zt(),a=Zt();let c=mt(e,"size",8,16),o=mt(e,"title",8,void 0);Ut(()=>(Pt(n),Pt(o())),()=>{q(r,n["aria-label"]||n["aria-labelledby"]||o())}),Ut(()=>(g(r),Pt(n)),()=>{q(a,{"aria-hidden":g(r)?void 0:!0,role:g(r)?"img":void 0,focusable:Number(n.tabindex)===0?!0:void 0})}),ze(),Re();var u=Un();Pe(u,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:c(),height:c(),...g(a),...i}));var l=at(u);{var f=C=>{var d=jn(),v=at(d,!0);it(d),yt(()=>It(v,o())),ht(C,d)};Kt(l,C=>{o()&&C(f)})}Se(2),it(u),ht(t,u),Bt()}var Kn=Dt('<div class="density-bar svelte-lzvab"></div>'),Qn=Dt('<span class="date-label svelte-lzvab"> </span>'),Jn=Dt('<div class="timeline-tooltip svelte-lzvab"><div class="tooltip-date svelte-lzvab"> </div> <div class="tooltip-count svelte-lzvab"> </div></div>'),qn=Dt('<div class="timeline-bar svelte-lzvab"><!> <div class="timeline-track svelte-lzvab"><div class="track-line svelte-lzvab"></div> <div class="density-bars svelte-lzvab"></div> <div class="playhead svelte-lzvab"></div> <div class="date-labels svelte-lzvab"></div> <!></div></div>');function $n(t,e){Ft(e,!0);let n=pt(null),i=pt(0),r=pt(!1),a=pt(!1),c=pt(null),o=null;const u=nt(()=>{let I=1/0,M=-1/0;for(const E of e.entities){const A=E.createdAt?new Date(E.createdAt).getTime():0;A>0&&A<I&&(I=A),A>M&&(M=A)}return I===1/0&&(I=Date.now()),M===-1/0&&(M=Date.now()),{min:I,max:M}}),l=nt(()=>{let{min:I,max:M}=g(u);return M-I<864e5&&(I-=864e5*15,M+=864e5*15),{min:new Date(I),max:new Date(M)}}),f=nt(()=>{const M=g(l).min.getTime(),E=g(l).max.getTime(),A=new Map;for(const k of e.entities){const j=k.createdAt?new Date(k.createdAt).getTime():0;if(j<=0)continue;const R=Math.floor((j-M)/864e5),L=M+R*864e5,U=A.get(L)??[];U.push(k),A.set(L,U)}return{map:A,minTime:M,maxTime:E,dayMs:864e5}}),C=nt(()=>{let I=0;for(const M of g(f).map.values())M.length>I&&(I=M.length);return Math.max(1,I)}),d=nt(()=>{const{minTime:I,maxTime:M}=g(f),E=M-I,A=[],k=Math.max(4,Math.min(8,Math.floor(g(i)/100))),j=E/k;for(let R=0;R<=k;R++){const L=I+R*j,K=new Date(L).toLocaleDateString("en-US",{month:"short",day:"numeric"});A.push({label:K,x:R/k})}return A}),v=nt(()=>{const{minTime:I,maxTime:M}=g(f),E=M-I;if(E<=0)return .5;const A=e.currentDate?e.currentDate.getTime():g(u).max,k=Math.max(g(u).min,Math.min(g(u).max,A));return Math.max(0,Math.min(1,(k-I)/E))});function b(I){if(!g(n))return new Date;const M=g(n).getBoundingClientRect(),E=40,k=M.width-E-12,j=Math.max(0,Math.min(1,(I-M.left-E)/k)),{minTime:R,maxTime:L}=g(f),U=R+j*(L-R);return new Date(Math.max(g(u).min,Math.min(g(u).max,U)))}function p(I){q(r,!0),N();const M=b(I.clientX);e.onDateChange(M),I.target.setPointerCapture(I.pointerId)}function s(I){if(g(r)&&e.onDateChange(b(I.clientX)),!g(n))return;const M=g(n).getBoundingClientRect(),E=40,k=M.width-E-12,j=(I.clientX-M.left-E)/k;if(j<0||j>1){q(c,null);return}const{minTime:R,dayMs:L,map:U}=g(f),K=R+j*(g(f).maxTime-R),tt=R+Math.floor((K-R)/L)*L,At=U.get(tt);At&&At.length>0?q(c,{date:new Date(tt),count:At.length,x:I.clientX-M.left},!0):q(c,null)}function h(){q(r,!1)}function x(){q(c,null)}function D(){g(a)?N():m()}function m(){q(a,!0);const{min:I,max:M}=g(u),A=(M-I)/200;let k=e.currentDate?.getTime()??I;k>=M&&(k=I),o=setInterval(()=>{if(k+=A,k>=M){e.onDateChange(null),N();return}e.onDateChange(new Date(k))},50)}function N(){q(a,!1),o&&(clearInterval(o),o=null)}Ne(()=>{if(g(n)){const I=new ResizeObserver(M=>{q(i,M[0]?.contentRect.width??0,!0)});return I.observe(g(n)),()=>I.disconnect()}});var S=qn(),W=at(S);{let I=nt(()=>g(a)?"Pause":"Play");on(W,{variant:"ghost",size:"icon",class:"play-btn",onclick:D,get title(){return g(I)},children:(M,E)=>{var A=Qe(),k=ke(A);{var j=L=>{Zn(L,{size:14})},R=L=>{Wn(L,{size:14})};Kt(k,L=>{g(a)?L(j):L(R,!1)})}ht(M,A)},$$slots:{default:!0}})}var B=gt(W,2),$=gt(at(B),2);ce($,21,()=>Array.from(g(f).map.entries()),fe,(I,M)=>{var E=nt(()=>$e(g(M),2));let A=()=>g(E)[0],k=()=>g(E)[1];const j=nt(()=>(A()-g(f).minTime)/(g(f).maxTime-g(f).minTime)),R=nt(()=>k().length/g(C)),L=nt(()=>.05+.95*g(R)*g(R));var U=Kn();let K;yt(()=>K=kt(U,"",K,{left:`${g(j)*100}%`,opacity:g(L)})),ht(I,U)}),it($);var G=gt($,2);let ft;var Q=gt(G,2);ce(Q,21,()=>g(d),fe,(I,M)=>{var E=Qn();let A;var k=at(E,!0);it(E),yt(()=>{A=kt(E,"",A,{left:`${g(M).x*100}%`}),It(k,g(M).label)}),ht(I,E)}),it(Q);var ot=gt(Q,2);{var wt=I=>{var M=Jn();let E;var A=at(M),k=at(A,!0);it(A);var j=gt(A,2),R=at(j);it(j),it(M),yt(L=>{E=kt(M,"",E,{left:`${g(c).x??""}px`}),It(k,L),It(R,`${g(c).count??""} ${g(c).count===1?"entity":"entities"}`)},[()=>g(c).date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})]),ht(I,M)};Kt(ot,I=>{g(c)&&!g(r)&&I(wt)})}it(B),it(S),Ee(S,I=>q(n,I),()=>g(n)),yt(()=>ft=kt(G,"",ft,{left:`${g(v)*100}%`})),Tt("pointerdown",B,p),Tt("pointermove",B,s),Tt("pointerup",B,h),le("pointerleave",B,x),ht(t,S),Bt()}Ae(["pointerdown","pointermove","pointerup"]);var ti=Dt("<!> <!> <!>",1);function yi(t,e){Ft(e,!0),se.showGraph();let n=pt(null);const i=nt(()=>{const f=new Map;for(const C of Wt.repos)for(const d of C.entities)f.set(d.id,d.title);return f}),r=nt(()=>{const f=[];for(const C of Wt.repos)for(const d of C.entities)d.id.toLowerCase().startsWith("readme")||f.push(d);return f}),a=nt(()=>{const f=[],C=[],d=new Set,v=new Set,b=g(n)?.getTime()??1/0;for(const s of Wt.repos)for(const h of s.entities){if(h.id.toLowerCase().startsWith("readme")||d.has(h.id)||(h.createdAt?new Date(h.createdAt).getTime():0)>b)continue;d.add(h.id),f.push({id:h.id,type:h.entityType,repo:s.name});const D=h.wikilinks??[];for(const m of D){const N=h.id<m?`${h.id}|${m}`:`${m}|${h.id}`;!v.has(N)&&h.id!==m&&(v.add(N),C.push({source:h.id,target:m}))}}const p=C.filter(s=>d.has(s.source)&&d.has(s.target));return{nodes:f,edges:p}});var c=ti(),o=ke(c);tn(o,{activeView:"graph"});var u=gt(o,2);Yn(u,{get graphData(){return g(a)},get selectedEntityId(){return se.selectedId},get nameMap(){return g(i)},get filteredIds(){return Wt.filteredIds},get sidebarHoveredId(){return se.hoveredEntityId},get highlightedIds(){return an.highlightedIds}});var l=gt(u,2);$n(l,{get entities(){return g(r)},get currentDate(){return g(n)},onDateChange:f=>{q(n,f,!0)}}),ht(t,c),Bt()}export{yi as component};
|