studiograph 1.3.44-next.21 → 1.3.44-next.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/web/_app/immutable/assets/4.DfrppcF_.css +1 -0
  2. package/dist/web/_app/immutable/assets/{8.DKYjn_lM.css → 8.BrXOeHJA.css} +1 -1
  3. package/dist/web/_app/immutable/chunks/{C1S8fyYX.js → -2EMa1ML.js} +1 -1
  4. package/dist/web/_app/immutable/chunks/{B1c_qzmY.js → B0qTqRR8.js} +1 -1
  5. package/dist/web/_app/immutable/chunks/{DO03XMS-.js → B17cx9Sm.js} +1 -1
  6. package/dist/web/_app/immutable/chunks/{DIBaaeCL.js → BSBiehHY.js} +1 -1
  7. package/dist/web/_app/immutable/chunks/{CwnWYvfz.js → BasUgd5N.js} +1 -1
  8. package/dist/web/_app/immutable/chunks/{CCA2E2CK.js → BenpwI6m.js} +1 -1
  9. package/dist/web/_app/immutable/chunks/{BgRr0V7g.js → BjAmYrTY.js} +1 -1
  10. package/dist/web/_app/immutable/chunks/{csGnu8Rb.js → BvwzgaXa.js} +1 -1
  11. package/dist/web/_app/immutable/chunks/{BN6gr1HX.js → BzfUn14C.js} +1 -1
  12. package/dist/web/_app/immutable/chunks/{BVhp5b7F.js → CDFdgZ9U.js} +1 -1
  13. package/dist/web/_app/immutable/chunks/{Dgs7g6Xf.js → CLw5zKi0.js} +1 -1
  14. package/dist/web/_app/immutable/chunks/{usxM-xOh.js → COik51fd.js} +1 -1
  15. package/dist/web/_app/immutable/chunks/{DkuxRPZv.js → CStpN6HQ.js} +1 -1
  16. package/dist/web/_app/immutable/chunks/CX_fJaNF.js +1 -0
  17. package/dist/web/_app/immutable/chunks/{NuvuAeCX.js → CbwDFpOn.js} +1 -1
  18. package/dist/web/_app/immutable/chunks/{BKHfe9E-.js → CieeblIr.js} +1 -1
  19. package/dist/web/_app/immutable/chunks/{BzjUB_Ym.js → CoAsXxNb.js} +1 -1
  20. package/dist/web/_app/immutable/chunks/CvAezToa.js +1 -0
  21. package/dist/web/_app/immutable/chunks/{pQmxOXKv.js → CyzLSh3b.js} +1 -1
  22. package/dist/web/_app/immutable/chunks/{D8mTIH9Y.js → DAD7hf2c.js} +1 -1
  23. package/dist/web/_app/immutable/chunks/{CwUXqlAx.js → DC1nGnOD.js} +1 -1
  24. package/dist/web/_app/immutable/chunks/{Ca2kuiZq.js → DLe_R6S0.js} +1 -1
  25. package/dist/web/_app/immutable/chunks/{DD3_vCgV.js → DN_2uSjw.js} +1 -1
  26. package/dist/web/_app/immutable/chunks/DQmnydAv.js +1 -0
  27. package/dist/web/_app/immutable/chunks/DkilSMcP.js +5 -0
  28. package/dist/web/_app/immutable/chunks/{D-H9HeD_.js → DkoZfYJt.js} +1 -1
  29. package/dist/web/_app/immutable/chunks/{DYLAPjKD.js → DkyV2KO_.js} +1 -1
  30. package/dist/web/_app/immutable/chunks/{DeyUjeaz.js → Dt6bIUGm.js} +1 -1
  31. package/dist/web/_app/immutable/chunks/{BZ2Q53D5.js → DtsqpIgr.js} +1 -1
  32. package/dist/web/_app/immutable/chunks/{yUs562n0.js → Dvv4bkXH.js} +1 -1
  33. package/dist/web/_app/immutable/chunks/{C74mA5aC.js → DwG0Us6L.js} +1 -1
  34. package/dist/web/_app/immutable/chunks/{y7AXCX7T.js → FQq1g0yX.js} +1 -1
  35. package/dist/web/_app/immutable/chunks/{BdNoKWAr.js → fgXuQcv7.js} +2 -2
  36. package/dist/web/_app/immutable/chunks/{BpdrS9kL.js → h2NtTN7K.js} +1 -1
  37. package/dist/web/_app/immutable/chunks/{DLZAjAct.js → owhS8Kw_.js} +1 -1
  38. package/dist/web/_app/immutable/chunks/{DHholpIc.js → wWaI7EIw.js} +1 -1
  39. package/dist/web/_app/immutable/entry/{app.Ci1ytk_v.js → app.CfPTwl0D.js} +2 -2
  40. package/dist/web/_app/immutable/entry/start.CzvcbWLa.js +1 -0
  41. package/dist/web/_app/immutable/nodes/{0.D4NmzO9T.js → 0.4O4jT99H.js} +2 -2
  42. package/dist/web/_app/immutable/nodes/{1.B49NrV3g.js → 1.YWRiTXrL.js} +1 -1
  43. package/dist/web/_app/immutable/nodes/{10.OXZpT8w9.js → 10.D-El_Hsa.js} +1 -1
  44. package/dist/web/_app/immutable/nodes/{2.DaqdIYKU.js → 2.ViGoUIc6.js} +4 -4
  45. package/dist/web/_app/immutable/nodes/{3.Q_RC4D9P.js → 3.BbexcpeM.js} +1 -1
  46. package/dist/web/_app/immutable/nodes/4.C2H0fLm7.js +11 -0
  47. package/dist/web/_app/immutable/nodes/{5.U-zEu0Mw.js → 5.BQEbSnbz.js} +1 -1
  48. package/dist/web/_app/immutable/nodes/{6.SYsyu9GD.js → 6.ChylSlHg.js} +1 -1
  49. package/dist/web/_app/immutable/nodes/{7.BLgQGI-C.js → 7.DxQsYoNz.js} +1 -1
  50. package/dist/web/_app/immutable/nodes/8.C6L2M9te.js +1 -0
  51. package/dist/web/_app/immutable/nodes/{9.D0aRCiZD.js → 9.BzQNdaYi.js} +1 -1
  52. package/dist/web/_app/version.json +1 -1
  53. package/dist/web/index.html +11 -11
  54. package/package.json +1 -1
  55. package/dist/web/_app/immutable/assets/4.B3dbj90y.css +0 -1
  56. package/dist/web/_app/immutable/chunks/1BE_eYuA.js +0 -1
  57. package/dist/web/_app/immutable/chunks/Mtmwulo1.js +0 -1
  58. package/dist/web/_app/immutable/chunks/e8QVPHqJ.js +0 -5
  59. package/dist/web/_app/immutable/chunks/oz3vOf3Y.js +0 -1
  60. package/dist/web/_app/immutable/entry/start.DNk71wbw.js +0 -1
  61. package/dist/web/_app/immutable/nodes/4.CIDSQYhF.js +0 -11
  62. package/dist/web/_app/immutable/nodes/8.67Laxdj-.js +0 -1
@@ -1 +1 @@
1
- import{d as we,a as i,b as o,s as k,e as T}from"../chunks/usxM-xOh.js";import{p as xe,a1 as ze,a2 as Be,a0 as K,b as Ae,a3 as u,c as a,g as r,r as e,a4 as I,t as C,s as Re,n as P,e as Se}from"../chunks/CCA2E2CK.js";import{i as w}from"../chunks/yUs562n0.js";import{e as j,i as N}from"../chunks/BpdrS9kL.js";import{r as Ce}from"../chunks/DkuxRPZv.js";import{b as We,B as X}from"../chunks/D8mTIH9Y.js";import{g as Z}from"../chunks/csGnu8Rb.js";import{V as Ee}from"../chunks/Mtmwulo1.js";import{w as U}from"../chunks/BgRr0V7g.js";import{n as Le}from"../chunks/BVhp5b7F.js";import{insightsStore as s}from"../chunks/CwUXqlAx.js";import{R as q}from"../chunks/DLZAjAct.js";import{S as Te,A as $e}from"../chunks/C74mA5aC.js";var Ie=o('<h2 class="svelte-h7bcrl"> </h2>'),Pe=o('<div class="home-center svelte-h7bcrl"><!></div>'),Ge=o('<button class="suggestion-chip svelte-h7bcrl"> </button>'),Me=o(`<div class="home-center onboarding svelte-h7bcrl"><h2 class="svelte-h7bcrl">What matters most to you?</h2> <p class="onboarding-subtitle svelte-h7bcrl">Tell us what you'd like to see on your home screen, and we'll generate personalized insights from your knowledge graph.</p> <div class="suggestions svelte-h7bcrl"></div> <div class="custom-brief svelte-h7bcrl"><input class="brief-input svelte-h7bcrl" type="text" placeholder="Or describe your own focus..."/> <!></div></div>`),Oe=o('<div class="home-center svelte-h7bcrl"><div class="generating svelte-h7bcrl"><!> <p>Analyzing your knowledge graph...</p></div></div>'),Ve=o('<span class="insights-meta svelte-h7bcrl"> </span>'),je=o("<!> Refresh",1),Ne=o('<button class="action-btn svelte-h7bcrl"> </button>'),Ue=o('<button class="entity-chip svelte-h7bcrl"> </button>'),qe=o('<div class="insight-entities svelte-h7bcrl"></div>'),De=o('<div class="insight-card svelte-h7bcrl"><div class="insight-top svelte-h7bcrl"><span class="pattern-tag svelte-h7bcrl"> </span></div> <h3 class="insight-headline svelte-h7bcrl"> </h3> <p class="insight-detail svelte-h7bcrl"> </p> <!> <!></div>'),Fe=o('<div class="insights-grid svelte-h7bcrl"></div>'),He=o("<p>Failed to generate insights. Check your AI provider configuration.</p>"),Qe=o('<div class="generating svelte-h7bcrl"><!> <p>Analyzing your knowledge graph...</p></div>'),Ye=o("<p>No insights yet. Click Refresh to generate them.</p>"),Je=o('<div class="no-insights svelte-h7bcrl"><!></div>'),Ke=o('<div class="home-insights svelte-h7bcrl"><div class="insights-header svelte-h7bcrl"><div class="insights-title svelte-h7bcrl"><h2 class="svelte-h7bcrl">Your Briefing</h2> <!></div> <div class="insights-actions svelte-h7bcrl"><button class="edit-focus-link svelte-h7bcrl"><!> Edit focus</button> <!></div></div> <!></div>'),Xe=o('<!> <div class="home svelte-h7bcrl"><!></div>',1);function ht(ee,te){xe(te,!0);const ae=ze("chat");Le.showEntity(),Be(()=>{U.nameLoaded&&!s.loaded&&s.load()});const re=I(()=>s.briefLoaded&&s.homeBrief.length>0),D=I(()=>s.insights.length>0),se=["What's at risk across my projects","Which clients need attention","What's due this week for my team","Pipeline and deal progress","What's new since I last checked in","Help me stay on top of decisions and tasks"];let W=Se("");async function ie(t){s.saveBrief(t),await s.generate()}async function F(){r(W).trim()&&(s.saveBrief(r(W).trim()),await s.generate())}function oe(){s.generate()}function ne(t){switch(t){case"risk":return"Risk";case"relationship":return"Relationship";case"opportunity":return"Opportunity";case"quality":return"Graph Quality";case"trend":return"Trend"}}function le(t){if(!t)return"";const n=Date.now()-new Date(t).getTime(),l=Math.floor(n/6e4);if(l<1)return"just now";if(l<60)return`${l}m ago`;const v=Math.floor(l/60);return v<24?`${v}h ago`:`${Math.floor(v/24)}d ago`}function ve(t){Z(`/${t.repo}/${t.type}/${t.id}`)}var H=Xe(),Q=K(H);Ee(Q,{activeView:"entity"});var Y=u(Q,2),ce=a(Y);{var de=t=>{var n=Pe(),l=a(n);{var v=f=>{var x=Ie(),A=a(x);e(x),C(()=>k(A,`Welcome to ${(U.name||"Studiograph")??""}`)),i(f,x)};w(l,f=>{U.nameLoaded&&f(v)})}e(n),i(t,n)},he=t=>{var n=Me(),l=u(a(n),4);j(l,21,()=>se,N,(g,S)=>{var z=Ge(),G=a(z,!0);e(z),C(()=>k(G,r(S))),T("click",z,()=>ie(r(S))),i(g,z)}),e(l);var v=u(l,2),f=a(v);Ce(f);var x=u(f,2);{var A=g=>{X(g,{onclick:F,children:(S,z)=>{$e(S,{size:14})},$$slots:{default:!0}})},R=I(()=>r(W).trim());w(x,g=>{r(R)&&g(A)})}e(v),e(n),T("keydown",f,g=>g.key==="Enter"&&F()),We(f,()=>r(W),g=>Re(W,g)),i(t,n)},pe=t=>{var n=Oe(),l=a(n),v=a(l);q(v,{size:20,class:"animate-spin"}),P(2),e(l),e(n),i(t,n)},ue=t=>{var n=Ke(),l=a(n),v=a(l),f=u(a(v),2);{var x=d=>{var h=Ve(),b=a(h);e(h),C(c=>k(b,`Updated ${c??""}`),[()=>le(s.generatedAt)]),i(d,h)};w(f,d=>{s.generatedAt&&d(x)})}e(v);var A=u(v,2),R=a(A),g=a(R);Te(g,{size:12}),P(),e(R);var S=u(R,2);X(S,{variant:"ghost",size:"sm",onclick:oe,get disabled(){return s.loading},children:(d,h)=>{var b=je(),c=K(b);{let B=I(()=>s.loading?"animate-spin":"");q(c,{size:14,get class(){return r(B)}})}P(),i(d,b)},$$slots:{default:!0}}),e(A),e(l);var z=u(l,2);{var G=d=>{var h=Fe();j(h,21,()=>s.insights,N,(b,c)=>{var B=De(),E=a(B),p=a(E),_=a(p,!0);e(p),e(E);var L=u(E,2),ge=a(L,!0);e(L);var M=u(L,2),_e=a(M,!0);e(M);var J=u(M,2);{var me=m=>{var y=Ne(),O=a(y,!0);e(y),C(()=>k(O,r(c).actions[0])),T("click",y,()=>ae.sendPrompt(r(c).actions[0])),i(m,y)};w(J,m=>{r(c).actions?.[0]&&m(me)})}var be=u(J,2);{var ye=m=>{var y=qe();j(y,21,()=>r(c).entities,N,(O,V)=>{var $=Ue(),ke=a($,!0);e($),C(()=>k(ke,r(V).name||r(V).id)),T("click",$,()=>ve(r(V))),i(O,$)}),e(y),i(m,y)};w(be,m=>{r(c).entities.length>0&&m(ye)})}e(B),C(m=>{k(_,m),k(ge,r(c).headline),k(_e,r(c).detail)},[()=>ne(r(c).pattern)]),i(b,B)}),e(h),i(d,h)},fe=d=>{var h=Je(),b=a(h);{var c=p=>{var _=He();i(p,_)},B=p=>{var _=Qe(),L=a(_);q(L,{size:20,class:"animate-spin"}),P(2),e(_),i(p,_)},E=p=>{var _=Ye();i(p,_)};w(b,p=>{s.error?p(c):s.loading?p(B,1):p(E,!1)})}e(h),i(d,h)};w(z,d=>{r(D)?d(G):d(fe,!1)})}e(n),T("click",R,()=>Z("/settings?tab=preferences")),i(t,n)};w(ce,t=>{s.briefLoaded?r(re)?s.loading&&!r(D)?t(pe,2):t(ue,!1):t(he,1):t(de)})}e(Y),i(ee,H),Ae()}we(["click","keydown"]);export{ht as component};
1
+ import{d as we,a as i,b as o,s as y,e as T}from"../chunks/COik51fd.js";import{p as xe,a1 as ze,a2 as Be,a0 as K,b as Ae,a3 as u,c as a,g as r,r as e,a4 as I,t as C,s as Re,n as P,e as Se}from"../chunks/BenpwI6m.js";import{i as w}from"../chunks/Dvv4bkXH.js";import{e as j,i as N}from"../chunks/h2NtTN7K.js";import{r as Ce}from"../chunks/CStpN6HQ.js";import{b as We,B as X}from"../chunks/DAD7hf2c.js";import{g as Z}from"../chunks/BvwzgaXa.js";import{V as Ee}from"../chunks/CvAezToa.js";import{w as U}from"../chunks/BjAmYrTY.js";import{n as Le}from"../chunks/CDFdgZ9U.js";import{insightsStore as s}from"../chunks/DC1nGnOD.js";import{R as q}from"../chunks/owhS8Kw_.js";import{S as Te,A as $e}from"../chunks/DwG0Us6L.js";var Ie=o('<h2 class="svelte-h7bcrl"> </h2>'),Pe=o('<div class="home-center svelte-h7bcrl"><!></div>'),Ge=o('<button class="suggestion-chip svelte-h7bcrl"> </button>'),Me=o(`<div class="home-center onboarding svelte-h7bcrl"><h2 class="svelte-h7bcrl">What matters most to you?</h2> <p class="onboarding-subtitle svelte-h7bcrl">Tell us what you'd like to see on your home screen, and we'll generate personalized insights from your knowledge graph.</p> <div class="suggestions svelte-h7bcrl"></div> <div class="custom-brief svelte-h7bcrl"><input class="brief-input svelte-h7bcrl" type="text" placeholder="Or describe your own focus..."/> <!></div></div>`),Oe=o('<div class="home-center svelte-h7bcrl"><div class="generating svelte-h7bcrl"><!> <p>Analyzing your knowledge graph...</p></div></div>'),Ve=o('<span class="insights-meta svelte-h7bcrl"> </span>'),je=o("<!> Refresh",1),Ne=o('<button class="action-btn svelte-h7bcrl"> </button>'),Ue=o('<button class="entity-chip svelte-h7bcrl"> </button>'),qe=o('<div class="insight-entities svelte-h7bcrl"></div>'),De=o('<div class="insight-card svelte-h7bcrl"><div class="insight-top svelte-h7bcrl"><span class="pattern-tag svelte-h7bcrl"> </span></div> <h3 class="insight-headline svelte-h7bcrl"> </h3> <p class="insight-detail svelte-h7bcrl"> </p> <!> <!></div>'),Fe=o('<div class="insights-grid svelte-h7bcrl"></div>'),He=o("<p>Failed to generate insights. Check your AI provider configuration.</p>"),Qe=o('<div class="generating svelte-h7bcrl"><!> <p>Analyzing your knowledge graph...</p></div>'),Ye=o("<p>No insights yet. Click Refresh to generate them.</p>"),Je=o('<div class="no-insights svelte-h7bcrl"><!></div>'),Ke=o('<div class="home-insights svelte-h7bcrl"><div class="insights-header svelte-h7bcrl"><div class="insights-title svelte-h7bcrl"><h2 class="svelte-h7bcrl">Your Briefing</h2> <!></div> <div class="insights-actions svelte-h7bcrl"><button class="edit-focus-link svelte-h7bcrl"><!> Edit focus</button> <!></div></div> <!></div>'),Xe=o('<!> <div class="home svelte-h7bcrl"><!></div>',1);function ht(ee,te){xe(te,!0);const ae=ze("chat");Le.showEntity(),Be(()=>{U.nameLoaded&&!s.loaded&&s.load()});const re=I(()=>s.briefLoaded&&s.homeBrief.length>0),D=I(()=>s.insights.length>0),se=["What's at risk across my projects","Which clients need attention","What's due this week for my team","Pipeline and deal progress","What's new since I last checked in","Help me stay on top of decisions and tasks"];let W=Se("");async function ie(t){s.saveBrief(t),await s.generate()}async function F(){r(W).trim()&&(s.saveBrief(r(W).trim()),await s.generate())}function oe(){s.generate()}function ne(t){switch(t){case"risk":return"Risk";case"relationship":return"Relationship";case"opportunity":return"Opportunity";case"quality":return"Graph Quality";case"trend":return"Trend"}}function le(t){if(!t)return"";const n=Date.now()-new Date(t).getTime(),l=Math.floor(n/6e4);if(l<1)return"just now";if(l<60)return`${l}m ago`;const v=Math.floor(l/60);return v<24?`${v}h ago`:`${Math.floor(v/24)}d ago`}function ve(t){Z(`/${t.repo}/${t.type}/${t.id}`)}var H=Xe(),Q=K(H);Ee(Q,{activeView:"home"});var Y=u(Q,2),ce=a(Y);{var de=t=>{var n=Pe(),l=a(n);{var v=f=>{var x=Ie(),A=a(x);e(x),C(()=>y(A,`Welcome to ${(U.name||"Studiograph")??""}`)),i(f,x)};w(l,f=>{U.nameLoaded&&f(v)})}e(n),i(t,n)},he=t=>{var n=Me(),l=u(a(n),4);j(l,21,()=>se,N,(g,S)=>{var z=Ge(),G=a(z,!0);e(z),C(()=>y(G,r(S))),T("click",z,()=>ie(r(S))),i(g,z)}),e(l);var v=u(l,2),f=a(v);Ce(f);var x=u(f,2);{var A=g=>{X(g,{onclick:F,children:(S,z)=>{$e(S,{size:14})},$$slots:{default:!0}})},R=I(()=>r(W).trim());w(x,g=>{r(R)&&g(A)})}e(v),e(n),T("keydown",f,g=>g.key==="Enter"&&F()),We(f,()=>r(W),g=>Re(W,g)),i(t,n)},pe=t=>{var n=Oe(),l=a(n),v=a(l);q(v,{size:20,class:"animate-spin"}),P(2),e(l),e(n),i(t,n)},ue=t=>{var n=Ke(),l=a(n),v=a(l),f=u(a(v),2);{var x=d=>{var h=Ve(),b=a(h);e(h),C(c=>y(b,`Updated ${c??""}`),[()=>le(s.generatedAt)]),i(d,h)};w(f,d=>{s.generatedAt&&d(x)})}e(v);var A=u(v,2),R=a(A),g=a(R);Te(g,{size:12}),P(),e(R);var S=u(R,2);X(S,{variant:"ghost",size:"sm",onclick:oe,get disabled(){return s.loading},children:(d,h)=>{var b=je(),c=K(b);{let B=I(()=>s.loading?"animate-spin":"");q(c,{size:14,get class(){return r(B)}})}P(),i(d,b)},$$slots:{default:!0}}),e(A),e(l);var z=u(l,2);{var G=d=>{var h=Fe();j(h,21,()=>s.insights,N,(b,c)=>{var B=De(),E=a(B),p=a(E),_=a(p,!0);e(p),e(E);var L=u(E,2),ge=a(L,!0);e(L);var M=u(L,2),_e=a(M,!0);e(M);var J=u(M,2);{var me=m=>{var k=Ne(),O=a(k,!0);e(k),C(()=>y(O,r(c).actions[0])),T("click",k,()=>ae.sendPrompt(r(c).actions[0])),i(m,k)};w(J,m=>{r(c).actions?.[0]&&m(me)})}var be=u(J,2);{var ke=m=>{var k=qe();j(k,21,()=>r(c).entities,N,(O,V)=>{var $=Ue(),ye=a($,!0);e($),C(()=>y(ye,r(V).name||r(V).id)),T("click",$,()=>ve(r(V))),i(O,$)}),e(k),i(m,k)};w(be,m=>{r(c).entities.length>0&&m(ke)})}e(B),C(m=>{y(_,m),y(ge,r(c).headline),y(_e,r(c).detail)},[()=>ne(r(c).pattern)]),i(b,B)}),e(h),i(d,h)},fe=d=>{var h=Je(),b=a(h);{var c=p=>{var _=He();i(p,_)},B=p=>{var _=Qe(),L=a(_);q(L,{size:20,class:"animate-spin"}),P(2),e(_),i(p,_)},E=p=>{var _=Ye();i(p,_)};w(b,p=>{s.error?p(c):s.loading?p(B,1):p(E,!1)})}e(h),i(d,h)};w(z,d=>{r(D)?d(G):d(fe,!1)})}e(n),T("click",R,()=>Z("/settings?tab=preferences")),i(t,n)};w(ce,t=>{s.briefLoaded?r(re)?s.loading&&!r(D)?t(pe,2):t(ue,!1):t(he,1):t(de)})}e(Y),i(ee,H),Ae()}we(["click","keydown"]);export{ht as component};
@@ -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/CoAsXxNb.js","../chunks/CLFba8FK.js","../chunks/fgXuQcv7.js","../chunks/PPVm8Dsz.js","../chunks/BenpwI6m.js","../chunks/BvwzgaXa.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 Yt,w as ct,k as Zt}from"../chunks/BjAmYrTY.js";import{_ as qe}from"../chunks/PPVm8Dsz.js";import{d as _t,e as Re,g as Qe,a as h,c as Te,s as pe,b as M,f as tt,t as vt}from"../chunks/COik51fd.js";import{p as He,e as Ee,f as ot,a2 as nt,aE as Jt,c as S,a3 as N,r as w,g as t,s as k,b as Ye,a0 as he,t as fe,a4 as ke,l as Xe,d as Ne,a as gt,n as We,m as $e,a1 as Gt,aD as Qt,aF as Vt,ax as Xt,a7 as $t,bt as ea}from"../chunks/BenpwI6m.js";import{i as ce,b as ft}from"../chunks/Dvv4bkXH.js";import{e as Ue,i as Be}from"../chunks/h2NtTN7K.js";import{c as De}from"../chunks/CbwDFpOn.js";import{s as lt,c as ta}from"../chunks/CieeblIr.js";import{p as Le,l as et,a as aa,b as ra}from"../chunks/wWaI7EIw.js";import{g as pt,i as na}from"../chunks/BvwzgaXa.js";import{A as Pt,p as sa}from"../chunks/DLe_R6S0.js";import{a as bt,V as ia}from"../chunks/CvAezToa.js";import{r as it,a as mt,c as Ve,d as dt,b as Rt}from"../chunks/CStpN6HQ.js";import{b as Wt,B as st}from"../chunks/DAD7hf2c.js";import{e as wt,f as rt,A as oa}from"../chunks/CdeYcEuU.js";import{a as Tt,b as Dt,S as zt,R as Ot}from"../chunks/B17cx9Sm.js";import{T as la,P as ua,C as ca,I as Lt,a as kt,S as da,R as fa,p as Ft,b as va}from"../chunks/Dt6bIUGm.js";import{i as yt}from"../chunks/BSBiehHY.js";import{T as ha,E as pa,j as _a,r as ga}from"../chunks/CX_fJaNF.js";import{C as Ct,a as Bt}from"../chunks/DtsqpIgr.js";import{A as ma,C as Mt}from"../chunks/CLw5zKi0.js";import{g as ya}from"../chunks/CqkleIqs.js";import{n as St}from"../chunks/CDFdgZ9U.js";import{e as Ke,r as ba}from"../chunks/fgXuQcv7.js";import{chatStore as wa}from"../chunks/-2EMa1ML.js";import{A as ka,u as xa,v as Ea,x as Ca,y as Sa,z as Aa,G as Pa}from"../chunks/DkilSMcP.js";import{a as It}from"../chunks/B0qTqRR8.js";const Ra=async({params:H,fetch:e})=>{const{repo:i,type:u,id:m}=H,P=await Yt(i,u,m);return{repo:i,type:u,id:m,entity:P}},$n=Object.freeze(Object.defineProperty({__proto__:null,load:Ra},Symbol.toStringTag,{value:"Module"}));var Ta=M('<span class="chip svelte-84vb17"> <button class="chip-remove svelte-84vb17">&times;</button></span>'),Da=M('<span class="chip svelte-84vb17"> </span>'),za=M('<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>'),Oa=M('<div class="dropdown svelte-84vb17"></div>'),La=M('<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 Fa(H,e){He(e,!0);let i=Le(e,"multi",3,!1),u=Le(e,"showCurrent",3,!1);const m=typeof e.value=="string"?e.value:"";let P=Ee(""),f=Ee(0),x;const E=ke(()=>ct.repos.flatMap(a=>a.entities.map(n=>({id:n.id,title:n.title,entityType:n.entityType,repo:a.name})))),p=ke(()=>()=>{const a=t(P).toLowerCase().trim();return a?t(E).filter(n=>n.title.toLowerCase().includes(a)||n.id.toLowerCase().includes(a)).slice(0,20):t(E).slice(0,20)}),z=Array.isArray(e.value)?[...e.value]:e.value?[e.value]:[];let L=Ee(ot(z));nt(()=>{Jt().then(()=>x?.focus())});function A(a){i()?(t(L).includes(a)||k(L,[...t(L),a],!0),k(P,""),k(f,0),x?.focus()):e.onselect(a)}function F(a){k(L,t(L).filter(n=>n!==a),!0)}function me(){t(L).length===z.length&&t(L).every((n,v)=>n===z[v])?e.oncancel():e.onselect(t(L))}function $(a){const n=t(p)();a.key==="ArrowDown"?(a.preventDefault(),k(f,Math.min(t(f)+1,n.length-1),!0)):a.key==="ArrowUp"?(a.preventDefault(),k(f,Math.max(t(f)-1,0),!0)):a.key==="Enter"?(a.preventDefault(),n.length>0?A(n[t(f)].id):i()&&me()):a.key==="Escape"?i()&&t(L).length>0?me():e.oncancel():a.key==="Backspace"&&!t(P)&&i()&&t(L).length>0&&k(L,t(L).slice(0,-1),!0)}var ae=La(),ye=S(ae),ve=S(ye);{var le=a=>{var n=Te(),v=he(n);Ue(v,17,()=>t(L),Be,(_,j)=>{var oe=Ta(),be=S(oe),y=N(be);w(oe),fe(()=>pe(be,`${t(j)??""} `)),Re("click",y,()=>F(t(j))),h(_,oe)}),h(a,n)},_e=a=>{var n=Da(),v=S(n,!0);w(n),fe(()=>pe(v,m)),h(a,n)};ce(ve,a=>{i()?a(le):u()&&m&&a(_e,1)})}var te=N(ve,2);it(te),ft(te,a=>x=a,()=>x),w(ye);var re=N(ye,2);{var I=a=>{var n=Oa();Ue(n,21,()=>t(p)(),Be,(v,_,j)=>{var oe=za();let be;var y=S(oe),l=S(y,!0);w(y);var c=N(y,2),T=S(c),ee=S(T,!0);w(T);var q=N(T,2),d=S(q,!0);w(q),w(c),w(oe),fe(()=>{be=lt(oe,1,"dropdown-item svelte-84vb17",null,be,{highlighted:j===t(f)}),pe(l,t(_).title),pe(ee,t(_).entityType),pe(d,t(_).repo)}),Re("mousedown",oe,o=>{o.preventDefault(),A(t(_).id)}),Qe("mouseenter",oe,()=>k(f,j,!0)),h(v,oe)}),w(n),h(a,n)},r=ke(()=>t(p)().length>0);ce(re,a=>{t(r)&&a(I)})}w(ae),Re("keydown",te,$),Qe("blur",te,()=>{setTimeout(()=>{i()?me():e.oncancel()},150)}),Wt(te,()=>t(P),a=>k(P,a)),h(H,ae),Ye()}_t(["click","keydown","mousedown"]);var Ma=tt("<title> </title>"),Ia=tt('<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 ht(H,e){const i=et(e,["children","$$slots","$$events","$$legacy"]),u=et(i,["size","title"]);He(e,!1);const m=$e(),P=$e();let f=Le(e,"size",8,16),x=Le(e,"title",8,void 0);Xe(()=>(Ne(i),Ne(x())),()=>{k(m,i["aria-label"]||i["aria-labelledby"]||x())}),Xe(()=>(t(m),Ne(i)),()=>{k(P,{"aria-hidden":t(m)?void 0:!0,role:t(m)?"img":void 0,focusable:Number(i.tabindex)===0?!0:void 0})}),gt(),yt();var E=Ia();mt(E,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:f(),height:f(),...t(P),...u}));var p=S(E);{var z=L=>{var A=Ma(),F=S(A,!0);w(A),fe(()=>pe(F,x())),h(L,A)};ce(p,L=>{x()&&L(z)})}We(2),w(E),h(H,E),Ye()}var ja=tt("<title> </title>"),Ka=tt('<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 xt(H,e){const i=et(e,["children","$$slots","$$events","$$legacy"]),u=et(i,["size","title"]);He(e,!1);const m=$e(),P=$e();let f=Le(e,"size",8,16),x=Le(e,"title",8,void 0);Xe(()=>(Ne(i),Ne(x())),()=>{k(m,i["aria-label"]||i["aria-labelledby"]||x())}),Xe(()=>(t(m),Ne(i)),()=>{k(P,{"aria-hidden":t(m)?void 0:!0,role:t(m)?"img":void 0,focusable:Number(i.tabindex)===0?!0:void 0})}),gt(),yt();var E=Ka();mt(E,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:f(),height:f(),...t(P),...u}));var p=S(E);{var z=L=>{var A=ja(),F=S(A,!0);w(A),fe(()=>pe(F,x())),h(L,A)};ce(p,L=>{x()&&L(z)})}We(2),w(E),h(H,E),Ye()}var Ua=tt("<title> </title>"),Na=tt('<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 At(H,e){const i=et(e,["children","$$slots","$$events","$$legacy"]),u=et(i,["size","title"]);He(e,!1);const m=$e(),P=$e();let f=Le(e,"size",8,16),x=Le(e,"title",8,void 0);Xe(()=>(Ne(i),Ne(x())),()=>{k(m,i["aria-label"]||i["aria-labelledby"]||x())}),Xe(()=>(t(m),Ne(i)),()=>{k(P,{"aria-hidden":t(m)?void 0:!0,role:t(m)?"img":void 0,focusable:Number(i.tabindex)===0?!0:void 0})}),gt(),yt();var E=Na();mt(E,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:f(),height:f(),...t(P),...u}));var p=S(E);{var z=L=>{var A=Ua(),F=S(A,!0);w(A),fe(()=>pe(F,x())),h(L,A)};ce(p,L=>{x()&&L(z)})}We(2),w(E),h(H,E),Ye()}var qa=M('<!> <span class="menu-label svelte-eh8ho9"> </span> <!>',1),Va=M('<!> <span class="menu-label svelte-eh8ho9">Remove</span>',1),Wa=M("<!> <!> <!>",1),Ba=M("<!> <!>",1),Ha=M('<span class="dot svelte-eh8ho9"></span> <span> </span>',1),Ya=M('<span class="dot svelte-eh8ho9"></span> <span> </span> <!>',1),Za=M("<!> <!>",1),Ja=M('<span class="dot svelte-eh8ho9"></span> ',1),Ga=M('<span class="dot svelte-eh8ho9"></span> <span> </span>',1),Qa=M('<span class="dot svelte-eh8ho9"></span> <span> </span> <!>',1),Xa=M("<!> <!>",1),$a=M('<span class="dot svelte-eh8ho9"></span> ',1),er=M('<input type="date"/>'),tr=M('<span class="date-value svelte-eh8ho9"> </span>'),ar=M('<span class="wikilink-chip svelte-eh8ho9"> </span>'),rr=M('<input class="wikilink-input svelte-eh8ho9" type="text" readonly=""/>'),nr=M('<div class="wikilink-display svelte-eh8ho9"><!> <!></div>'),sr=M('<input class="edit-input svelte-eh8ho9" type="url" placeholder="https://..."/>'),ir=M('<span class="url-edit-btn svelte-eh8ho9"><!></span>'),or=M('<a class="url-link svelte-eh8ho9" target="_blank" rel="noopener noreferrer"> </a> <!>',1),lr=M('<span class="empty-hint svelte-eh8ho9">Empty</span>'),ur=M('<span class="url-display svelte-eh8ho9"><!></span>'),cr=M('<span class="badge-value svelte-eh8ho9"> </span>'),dr=M('<input class="edit-input svelte-eh8ho9" type="text" placeholder="Empty"/>'),fr=M('<span class="text-value svelte-eh8ho9"> </span>'),vr=M('<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 hr(H,e){He(e,!0);let i=Le(e,"editable",3,!1),u=Le(e,"protectedKeys",19,()=>new Set);const m=[{type:"text",label:"Text"},{type:"date",label:"Date"},{type:"status",label:"Status"},{type:"wikilink",label:"Connection"},{type:"url",label:"Link"}],P=["open","in-progress","done","cancelled","active","inactive","completed","draft","archived","current","former","won","lost","closed"];function f(){return typeof e.prop.value=="string"?e.prop.value:e.prop.value[0]??""}function x(d){switch(d.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 E(d){return d.replace(/[-_]/g," ").replace(/\b\w/g,o=>o.toUpperCase())}function p(d){return d.replace(/_/g," ").replace(/\b\w/g,o=>o.toUpperCase())}function z(d){if(!d)return"";try{return new Date(d).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return d}}function L(d){for(const o of ct.repos){const O=o.entities.find(J=>J.id===d);if(O){pt(`/${o.name}/${O.entityType}/${O.id}`);return}}}let A=Ee(!1),F=Ee(null);function me(d){d!==f()&&e.onedit?.(e.prop.key,d),k(A,!1)}let $=Ee(!1);var ae=vr(),ye=S(ae),ve=S(ye);{var le=d=>{ht(d,{size:14})},_e=d=>{var o=Te(),O=he(o);De(O,()=>fa,(J,V)=>{V(J,{children:(R,g)=>{var b=Ba(),Q=he(b);De(Q,()=>la,(ne,K)=>{K(ne,{class:"icon-trigger",children:(X,de)=>{var G=Te(),Ae=he(G);{var s=B=>{bt(B,{size:14})},C=B=>{ht(B,{size:14})},Z=B=>{xt(B,{size:14})},W=B=>{At(B,{size:14})},ue=B=>{kt(B,{size:14})};ce(Ae,B=>{e.prop.type==="date"?B(s):e.prop.type==="status"?B(C,1):e.prop.type==="wikilink"?B(Z,2):e.prop.type==="url"?B(W,3):B(ue,!1)})}h(X,G)},$$slots:{default:!0}})});var D=N(Q,2);De(D,()=>ua,(ne,K)=>{K(ne,{children:(X,de)=>{var G=Te(),Ae=he(G);De(Ae,()=>ca,(s,C)=>{C(s,{class:"type-menu-content",sideOffset:4,align:"start",children:(Z,W)=>{var ue=Wa(),B=he(ue);Ue(B,17,()=>m,Be,(U,Y)=>{var we=Te(),ge=he(we);De(ge,()=>Lt,(Ce,Pe)=>{Pe(Ce,{class:"type-menu-item",onSelect:()=>e.ontypechange?.(e.prop.key,t(Y).type),children:(xe,Se)=>{var Fe=qa(),Ie=he(Fe);{var ze=Me=>{kt(Me,{size:12})},je=Me=>{bt(Me,{size:12})},Ze=Me=>{ht(Me,{size:12})},Je=Me=>{xt(Me,{size:12})},Ge=Me=>{At(Me,{size:12})};ce(Ie,Me=>{t(Y).type==="text"?Me(ze):t(Y).type==="date"?Me(je,1):t(Y).type==="status"?Me(Ze,2):t(Y).type==="wikilink"?Me(Je,3):t(Y).type==="url"&&Me(Ge,4)})}var Oe=N(Ie,2),at=S(Oe,!0);w(Oe);var ut=N(Oe,2);{var Ht=Me=>{Ct(Me,{size:12})};ce(ut,Me=>{e.prop.type===t(Y).type&&Me(Ht)})}fe(()=>pe(at,t(Y).label)),h(xe,Fe)},$$slots:{default:!0}})}),h(U,we)});var se=N(B,2);De(se,()=>da,(U,Y)=>{Y(U,{})});var ie=N(se,2);De(ie,()=>Lt,(U,Y)=>{Y(U,{class:"type-menu-item type-menu-danger",onSelect:()=>e.onremove?.(e.prop.key),children:(we,ge)=>{var Ce=Va(),Pe=he(Ce);ha(Pe,{size:12}),We(2),h(we,Ce)},$$slots:{default:!0}})}),h(Z,ue)},$$slots:{default:!0}})}),h(X,G)},$$slots:{default:!0}})}),h(R,b)},$$slots:{default:!0}})}),h(d,o)},te=ke(()=>i()&&e.prop.type!=="badge"&&!u().has(e.prop.key)),re=d=>{bt(d,{size:14})},I=d=>{ht(d,{size:14})},r=d=>{xt(d,{size:14})},a=d=>{At(d,{size:14})},n=d=>{kt(d,{size:14})};ce(ve,d=>{e.prop.type==="entity-type"?d(le):t(te)?d(_e,1):e.prop.type==="date"?d(re,2):e.prop.type==="status"?d(I,3):e.prop.type==="wikilink"?d(r,4):e.prop.type==="url"?d(a,5):d(n,!1)})}w(ye);var v=N(ye,2),_=S(v,!0);w(v);var j=N(v,2),oe=S(j);{var be=d=>{var o=Te(),O=he(o);{var J=R=>{var g=Te(),b=he(g);{let Q=ke(f);De(b,()=>Ot,(D,ne)=>{ne(D,{type:"single",get value(){return t(Q)},onValueChange:K=>{K&&K!==f()&&e.onentitytypechange?.(K)},children:(K,X)=>{var de=Za(),G=he(de);{let s=ke(()=>rt(f()));De(G,()=>Tt,(C,Z)=>{Z(C,{class:"status-trigger",get value(){return t(s)},children:(W,ue)=>{var B=Ha(),se=he(B);let ie;var U=N(se,2),Y=S(U,!0);w(U),fe((we,ge)=>{ie=Ve(se,"",ie,we),pe(Y,ge)},[()=>({background:wt(f())}),()=>rt(f())]),h(W,B)},$$slots:{default:!0}})})}var Ae=N(G,2);De(Ae,()=>Dt,(s,C)=>{C(s,{align:"start",children:(Z,W)=>{var ue=Te(),B=he(ue);Ue(B,17,()=>oa,Be,(se,ie)=>{var U=Te(),Y=he(U);{let we=ke(()=>rt(t(ie)));De(Y,()=>zt,(ge,Ce)=>{Ce(ge,{get value(){return t(ie)},get label(){return t(we)},class:"dotted-item",children:(Pe,xe)=>{var Se=Ya(),Fe=he(Se);let Ie;var ze=N(Fe,2),je=S(ze,!0);w(ze);var Ze=N(ze,2);{var Je=Oe=>{Ct(Oe,{size:12,class:"item-check"})},Ge=ke(()=>f()===t(ie));ce(Ze,Oe=>{t(Ge)&&Oe(Je)})}fe((Oe,at)=>{Ie=Ve(Fe,"",Ie,Oe),pe(je,at)},[()=>({background:wt(t(ie))}),()=>rt(t(ie))]),h(Pe,Se)},$$slots:{default:!0}})})}h(se,U)}),h(Z,ue)},$$slots:{default:!0}})}),h(K,de)},$$slots:{default:!0}})})}h(R,g)},V=R=>{var g=Ja(),b=he(g);let Q;var D=N(b);fe((ne,K)=>{Q=Ve(b,"",Q,ne),pe(D,` ${K??""}`)},[()=>({background:wt(f())}),()=>rt(f())]),h(R,g)};ce(O,R=>{i()?R(J):R(V,!1)})}h(d,o)},y=d=>{var o=Te(),O=he(o);{var J=R=>{var g=Te(),b=he(g);{let Q=ke(f);De(b,()=>Ot,(D,ne)=>{ne(D,{type:"single",get value(){return t(Q)},onValueChange:K=>{K&&e.onedit?.(e.prop.key,K)},children:(K,X)=>{var de=Xa(),G=he(de);{let s=ke(()=>E(f()));De(G,()=>Tt,(C,Z)=>{Z(C,{class:"status-trigger",get value(){return t(s)},children:(W,ue)=>{var B=Ga(),se=he(B);let ie;var U=N(se,2),Y=S(U,!0);w(U),fe((we,ge)=>{ie=Ve(se,"",ie,we),pe(Y,ge)},[()=>({background:x(f())}),()=>E(f())]),h(W,B)},$$slots:{default:!0}})})}var Ae=N(G,2);De(Ae,()=>Dt,(s,C)=>{C(s,{align:"start",children:(Z,W)=>{var ue=Te(),B=he(ue);Ue(B,17,()=>P,Be,(se,ie)=>{var U=Te(),Y=he(U);{let we=ke(()=>E(t(ie)));De(Y,()=>zt,(ge,Ce)=>{Ce(ge,{get value(){return t(ie)},get label(){return t(we)},class:"dotted-item",children:(Pe,xe)=>{var Se=Qa(),Fe=he(Se);let Ie;var ze=N(Fe,2),je=S(ze,!0);w(ze);var Ze=N(ze,2);{var Je=Oe=>{Ct(Oe,{size:12,class:"item-check"})},Ge=ke(()=>f()===t(ie));ce(Ze,Oe=>{t(Ge)&&Oe(Je)})}fe((Oe,at)=>{Ie=Ve(Fe,"",Ie,Oe),pe(je,at)},[()=>({background:x(t(ie))}),()=>E(t(ie))]),h(Pe,Se)},$$slots:{default:!0}})})}h(se,U)}),h(Z,ue)},$$slots:{default:!0}})}),h(K,de)},$$slots:{default:!0}})})}h(R,g)},V=R=>{var g=$a(),b=he(g);let Q;var D=N(b);fe((ne,K)=>{Q=Ve(b,"",Q,ne),pe(D,` ${K??""}`)},[()=>({background:x(f())}),()=>E(f())]),h(R,g)};ce(O,R=>{i()?R(J):R(V,!1)})}h(d,o)},l=d=>{var o=Te(),O=he(o);{var J=R=>{var g=er();it(g);let b;fe((Q,D)=>{b=lt(g,1,"edit-input date-input svelte-eh8ho9",null,b,Q),dt(g,D)},[()=>({"date-empty":!f()?.trim()||!/^\d{4}-\d{2}-\d{2}/.test(f())}),()=>/^\d{4}-\d{2}-\d{2}/.test(f())?f().slice(0,10):""]),Re("change",g,Q=>{e.onedit?.(e.prop.key,Q.currentTarget.value)}),h(R,g)},V=R=>{var g=tr(),b=S(g,!0);w(g),fe(Q=>pe(b,Q),[()=>z(f())||"No date"]),h(R,g)};ce(O,R=>{i()?R(J):R(V,!1)})}h(d,o)},c=d=>{var o=Te(),O=he(o);{var J=R=>{{let g=ke(()=>Array.isArray(e.prop.value));Fa(R,{get value(){return e.prop.value},get multi(){return t(g)},onselect:b=>{e.onedit?.(e.prop.key,b),k($,!1)},oncancel:()=>{k($,!1)}})}},V=R=>{var g=nr(),b=S(g);Ue(b,17,()=>(Array.isArray(e.prop.value)?e.prop.value:[e.prop.value]).filter(Boolean),Be,(ne,K)=>{var X=ar(),de=S(X,!0);w(X),fe(()=>pe(de,t(K))),Re("click",X,G=>{G.stopPropagation(),L(t(K))}),h(ne,X)});var Q=N(b,2);{var D=ne=>{var K=rr();fe(X=>Rt(K,"placeholder",X),[()=>f()?"":"Empty"]),Qe("focus",K,()=>{k($,!0)}),h(ne,K)};ce(Q,ne=>{i()&&ne(D)})}w(g),h(R,g)};ce(O,R=>{t($)&&i()?R(J):R(V,!1)})}h(d,o)},T=d=>{var o=Te(),O=he(o);{var J=R=>{var g=sr();it(g),ft(g,b=>k(F,b),()=>t(F)),fe(b=>dt(g,b),[f]),Qe("blur",g,b=>{me(b.currentTarget.value)}),Re("keydown",g,b=>{b.key==="Enter"&&b.currentTarget.blur(),b.key==="Escape"&&k(A,!1)}),h(R,g)},V=R=>{var g=ur(),b=S(g);{var Q=K=>{var X=or(),de=he(X),G=S(de,!0);w(de);var Ae=N(de,2);{var s=C=>{var Z=ir(),W=S(Z);pa(W,{size:12}),w(Z),Re("click",Z,()=>{k(A,!0),requestAnimationFrame(()=>t(F)?.focus())}),h(C,Z)};ce(Ae,C=>{i()&&C(s)})}fe((C,Z)=>{Rt(de,"href",C),pe(G,Z)},[f,f]),h(K,X)},D=ke(()=>f()),ne=K=>{var X=lr();Re("click",X,()=>{k(A,!0),requestAnimationFrame(()=>t(F)?.focus())}),h(K,X)};ce(b,K=>{t(D)?K(Q):i()&&K(ne,1)})}w(g),h(R,g)};ce(O,R=>{t(A)&&i()?R(J):R(V,!1)})}h(d,o)},ee=d=>{var o=cr(),O=S(o,!0);w(o),fe(J=>pe(O,J),[f]),h(d,o)},q=d=>{var o=Te(),O=he(o);{var J=R=>{var g=dr();it(g),fe(b=>dt(g,b),[f]),Qe("focus",g,()=>{k(A,!0)}),Qe("blur",g,b=>{me(b.currentTarget.value)}),Re("keydown",g,b=>{b.key==="Enter"&&b.currentTarget.blur(),b.key==="Escape"&&(b.currentTarget.value=f(),b.currentTarget.blur())}),h(R,g)},V=R=>{var g=fr(),b=S(g,!0);w(g),fe(Q=>pe(b,Q),[f]),h(R,g)};ce(O,R=>{i()?R(J):R(V,!1)})}h(d,o)};ce(oe,d=>{e.prop.type==="entity-type"?d(be):e.prop.type==="status"?d(y,1):e.prop.type==="date"?d(l,2):e.prop.type==="wikilink"?d(c,3):e.prop.type==="url"?d(T,4):e.prop.type==="badge"?d(ee,5):d(q,!1)})}w(j),w(ae),fe(d=>pe(_,d),[()=>p(e.prop.key)]),Re("click",ye,d=>d.stopPropagation()),h(H,ae),Ye()}_t(["click","change","keydown"]);var pr=M('<input class="name-input svelte-1a2lez6" type="text"/>'),_r=M('<span class="name-text svelte-1a2lez6"> </span>'),gr=M('<div class="name-headline svelte-1a2lez6"><!></div>'),mr=M('<button class="fields-toggle svelte-1a2lez6"><span><!></span> <span class="fields-label svelte-1a2lez6">Fields</span> <span class="fields-count svelte-1a2lez6"> </span></button>'),yr=M('<div class="add-field-row svelte-1a2lez6"><input class="add-field-input svelte-1a2lez6" type="text" placeholder="Field name"/></div>'),br=M("<!> <span>Add field</span>",1),wr=M('<div class="fields-list svelte-1a2lez6"><!> <!></div>'),kr=M('<div class="entity-properties svelte-1a2lez6"><!> <!> <!></div>');function xr(H,e){He(e,!0);let i=Le(e,"editable",3,!1),u=Le(e,"autofocusKey",3,null),m=Le(e,"protectedKeys",19,()=>new Set);const P=ke(()=>e.properties.find(v=>v.key==="name")),f=ke(()=>e.properties.filter(v=>v.key!=="name"));let x=Ee(!1),E=Ee(null);const p=ke(()=>t(P)?typeof t(P).value=="string"?t(P).value:t(P).value[0]:"");function z(){i()&&(k(x,!0),requestAnimationFrame(()=>t(E)?.focus()))}function L(v){v!==t(p)&&e.onedit?.("name",v),k(x,!1)}nt(()=>{u()==="name"&&!t(x)&&z()});const A="sg-properties-expanded";let F=Ee(ot(typeof localStorage<"u"?localStorage.getItem(A)==="true":!1));function me(){k(F,!t(F)),localStorage.setItem(A,t(F)?"true":"false")}let $=Ee(!1),ae=Ee(""),ye=Ee(null);function ve(){k($,!0),k(ae,""),requestAnimationFrame(()=>t(ye)?.focus())}function le(){const v=t(ae).trim().toLowerCase().replace(/\s+/g,"_");v&&!e.properties.some(_=>_.key===v)&&e.onadd?.(v,""),k($,!1),k(ae,"")}var _e=kr(),te=S(_e);{var re=v=>{var _=gr(),j=S(_);{var oe=y=>{var l=pr();it(l),ft(l,c=>k(E,c),()=>t(E)),fe(()=>dt(l,t(p))),Qe("blur",l,c=>L(c.currentTarget.value)),Re("keydown",l,c=>{c.key==="Enter"&&(L(c.currentTarget.value),e.onfocuseditor?.()),c.key==="Escape"&&k(x,!1)}),h(y,l)},be=y=>{var l=_r(),c=S(l,!0);w(l),fe(()=>pe(c,t(p)||"Untitled")),h(y,l)};ce(j,y=>{t(x)?y(oe):y(be,!1)})}w(_),Re("click",_,z),h(v,_)};ce(te,v=>{t(P)&&v(re)})}var I=N(te,2);{var r=v=>{var _=mr(),j=S(_);let oe;var be=S(j);Bt(be,{size:14}),w(j);var y=N(j,4),l=S(y,!0);w(y),w(_),fe(()=>{oe=lt(j,1,"fields-chevron svelte-1a2lez6",null,oe,{expanded:t(F)}),pe(l,t(f).length)}),Re("mousedown",_,c=>c.preventDefault()),Re("click",_,me),h(v,_)};ce(I,v=>{t(f).length>0&&v(r)})}var a=N(I,2);{var n=v=>{var _=wr(),j=S(_);Ue(j,17,()=>t(f),l=>l.key,(l,c)=>{hr(l,{get prop(){return t(c)},get editable(){return i()},get protectedKeys(){return m()},get onedit(){return e.onedit},get onremove(){return e.onremove},get ontypechange(){return e.ontypechange},get onentitytypechange(){return e.onentitytypechange}})});var oe=N(j,2);{var be=l=>{var c=yr(),T=S(c);it(T),ft(T,ee=>k(ye,ee),()=>t(ye)),w(c),Re("keydown",T,ee=>{ee.key==="Enter"&&le(),ee.key==="Escape"&&k($,!1)}),Qe("blur",T,()=>{k($,!1)}),Wt(T,()=>t(ae),ee=>k(ae,ee)),h(l,c)},y=l=>{st(l,{variant:"ghost",class:"add-field-btn",onclick:c=>{c.stopPropagation(),ve()},children:(c,T)=>{var ee=br(),q=he(ee);ma(q,{size:16}),We(2),h(c,ee)},$$slots:{default:!0}})};ce(oe,l=>{t($)?l(be):i()&&l(y,1)})}w(_),h(v,_)};ce(a,v=>{t(F)&&v(n)})}w(_e),h(H,_e),Ye()}_t(["click","keydown","mousedown"]);var Er=M('<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>'),Cr=M('<div class="connections-body svelte-16xienp"></div>'),Sr=M('<div class="connections-panel svelte-16xienp"><button class="connections-header svelte-16xienp"><span><!></span> <span class="header-label svelte-16xienp">Connections</span> <span class="header-count svelte-16xienp"> </span></button> <!></div>');function Ar(H,e){He(e,!0);const i="sg-linked-entities-expanded";let u=Ee(ot(typeof localStorage<"u"?localStorage.getItem(i)!=="true":!0));function m(){k(u,!t(u)),localStorage.setItem(i,t(u)?"false":"true")}const P=ke(()=>{const z=[],L=e.entityId.toLowerCase();for(const A of ct.repos)for(const F of A.entities)if(!(F.id===e.entityId&&F.repo===e.entityRepo)){for(const me of F.wikilinks)if(me.replace(/\[\[|\]\]/g,"").trim().toLowerCase()===L){z.push(F);break}}return z});function f(z){pt(`/${z.repo}/${z.entityType}/${z.id}`)}var x=Te(),E=he(x);{var p=z=>{var L=Sr(),A=S(L),F=S(A);let me;var $=S(F);Bt($,{size:14}),w(F);var ae=N(F,4),ye=S(ae,!0);w(ae),w(A);var ve=N(A,2);{var le=_e=>{var te=Cr();Ue(te,21,()=>t(P),Be,(re,I)=>{const r=ke(()=>wt(t(I).entityType));var a=Er(),n=S(a);let v;var _=N(n,2),j=S(_,!0);w(_);var oe=N(_,2),be=S(oe,!0);w(oe),w(a),fe(y=>{v=Ve(n,"",v,{background:t(r)}),pe(j,t(I).title),pe(be,y)},[()=>rt(t(I).entityType)]),Re("click",a,()=>f(t(I))),h(re,a)}),w(te),h(_e,te)};ce(ve,_e=>{t(u)||_e(le)})}w(L),fe(()=>{me=lt(F,1,"header-chevron svelte-16xienp",null,me,{collapsed:t(u)}),pe(ye,t(P).length)}),Re("mousedown",A,_e=>_e.preventDefault()),Re("click",A,m),h(z,L)};ce(E,z=>{t(P).length>0&&z(p)})}h(H,x),Ye()}_t(["mousedown","click"]);var Pr=M('<div class="remote-cursor svelte-ok7wy5"><span class="remote-cursor-label svelte-ok7wy5"> </span></div>'),Rr=M('<div class="cursor-overlay svelte-ok7wy5"></div>'),Tr=M('<div class="editor-wrap svelte-ok7wy5"><div class="cm-container svelte-ok7wy5"></div> <!></div>');function Dr(H,e){He(e,!0);let i=Le(e,"readonly",3,!0),u=Le(e,"resetKey",3,0);const m=Gt("theme");let P,f=null,x=null,E=Ee(""),p=null,z=Ee(ot([])),L=null,A=e.content;function F(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(){f&&(f.destroy(),f=null),x&&(x.destroy(),x=null),k(z,[],!0);const{EditorState:le,Transaction:_e}=await qe(async()=>{const{EditorState:o,Transaction:O}=await import("../chunks/CX_61fY8.js");return{EditorState:o,Transaction:O}},[],import.meta.url);p=_e;const{EditorView:te,keymap:re,ViewPlugin:I}=await qe(async()=>{const{EditorView:o,keymap:O,ViewPlugin:J}=await import("../chunks/DnL9f0lc.js").then(V=>V.i);return{EditorView:o,keymap:O,ViewPlugin:J}},__vite__mapDeps([0,1]),import.meta.url),{markdown:r}=await qe(async()=>{const{markdown:o}=await import("../chunks/CscoF-YL.js");return{markdown:o}},__vite__mapDeps([2,1,0,3,4,5]),import.meta.url),{syntaxHighlighting:a,HighlightStyle:n}=await qe(async()=>{const{syntaxHighlighting:o,HighlightStyle:O}=await import("../chunks/D7ZqAKi9.js");return{syntaxHighlighting:o,HighlightStyle:O}},__vite__mapDeps([3,4,1,0]),import.meta.url),{history:v,defaultKeymap:_,historyKeymap:j}=await qe(async()=>{const{history:o,defaultKeymap:O,historyKeymap:J}=await import("../chunks/CWQRQXxy.js");return{history:o,defaultKeymap:O,historyKeymap:J}},__vite__mapDeps([6,1,0,3,4]),import.meta.url),{tags:oe}=await qe(async()=>{const{tags:o}=await import("../chunks/C7VoTosa.js").then(O=>O.i);return{tags:o}},[],import.meta.url),{livePreviewPlugin:be,livePreviewTheme:y}=await qe(async()=>{const{livePreviewPlugin:o,livePreviewTheme:O}=await import("../chunks/B340SUKR.js");return{livePreviewPlugin:o,livePreviewTheme:O}},__vite__mapDeps([7,0,1,3,4]),import.meta.url),l=m.current==="dark",c=F(te,l),T=n.define([{tag:oe.processingInstruction,color:"var(--color-text-tertiary)",opacity:"0.7"}]),ee=[r(),c,a(T),be,y,te.lineWrapping];i()&&ee.push(le.readOnly.of(!0));let q=!1;if(e.cursorDocName&&!i())try{let s=function(){if(!f||!D){k(z,[],!0);return}const W=D.awareness,ue=D.ytext,B=ue.doc;if(!B){k(z,[],!0);return}const se=[],ie=f.dom.getBoundingClientRect();W.getStates().forEach((U,Y)=>{if(Y===Ae)return;const we=U.cursor;if(!we?.head)return;const{name:ge="Anonymous",color:Ce="#e05050"}=U.user||{};let Pe;try{Pe=b.createRelativePositionFromJSON(we.head)}catch{return}const xe=b.createAbsolutePositionFromRelativePosition(Pe,B);if(!xe||xe.type!==ue)return;const Se=f.coordsAtPos(Math.min(xe.index,f.state.doc.length));Se&&se.push({id:Y,name:ge,color:Ce,top:Se.top-ie.top,left:Se.left-ie.left,height:Se.bottom-Se.top})}),k(z,se,!0)},C=function(){L&&cancelAnimationFrame(L),L=requestAnimationFrame(()=>{L=null,s()})},Z=function({added:W,updated:ue,removed:B}){[...W,...ue,...B].some(ie=>ie!==Ae)&&C()};const{createCollabSession:o}=await qe(async()=>{const{createCollabSession:W}=await import("../chunks/CoAsXxNb.js");return{createCollabSession:W}},__vite__mapDeps([8,9,10,11,12,13,14,15,16,17,18]),import.meta.url),{ySync:O,ySyncFacet:J,YSyncConfig:V,yUndoManagerKeymap:R}=await qe(async()=>{const{ySync:W,ySyncFacet:ue,YSyncConfig:B,yUndoManagerKeymap:se}=await import("../chunks/i9c_RUF6.js");return{ySync:W,ySyncFacet:ue,YSyncConfig:B,yUndoManagerKeymap:se}},__vite__mapDeps([19,9,0,1]),import.meta.url),{auth:g}=await qe(async()=>{const{auth:W}=await import("../chunks/B0qTqRR8.js").then(ue=>ue.b);return{auth:W}},__vite__mapDeps([16,12,15]),import.meta.url),b=await qe(()=>import("../chunks/CLFba8FK.js").then(W=>W.A),[],import.meta.url),Q=getComputedStyle(document.documentElement).getPropertyValue("--color-accent").trim()||"#e05050",D=o(e.cursorDocName,{name:g.user?.displayName??"Anonymous",color:Q,colorLight:Q+"33"}),ne=new b.UndoManager(D.ytext,{captureTimeout:500}),{yUndoManagerFacet:K,yUndoManager:X,YUndoManagerConfig:de}=await qe(async()=>{const{yUndoManagerFacet:W,yUndoManager:ue,YUndoManagerConfig:B}=await import("../chunks/i9c_RUF6.js");return{yUndoManagerFacet:W,yUndoManager:ue,YUndoManagerConfig:B}},__vite__mapDeps([19,9,0,1]),import.meta.url),G=new V(D.ytext,D.awareness);ee.push(J.of(G),O,K.of(new de(ne)),X,re.of(R)),ee.push(I.define(W=>{function ue(){const B=W.state.selection.main,se=D.ytext,ie=b.createRelativePositionFromTypeIndex(se,B.anchor),U=b.createRelativePositionFromTypeIndex(se,B.head);D.awareness.setLocalStateField("cursor",{anchor:b.relativePositionToJSON(ie),head:b.relativePositionToJSON(U)})}return ue(),{update(B){(B.selectionSet||B.docChanged)&&ue()}}}));const Ae=D.ydoc.clientID;D.awareness.on("change",Z),ee.push(I.define(()=>({update(W){(W.docChanged||W.geometryChanged||W.viewportChanged)&&C()},destroy(){D.awareness.off("change",Z)}}))),x=D,q=!0}catch(o){console.warn("Yjs collab setup failed, falling back to solo editing:",o)}if(!i()&&!q?(ee.push(v({newGroupDelay:500})),ee.push(re.of([..._,...j]))):!i()&&q&&ee.push(re.of(_)),e.onchange)if(q){const o=Date.now();ee.push(te.updateListener.of(O=>{if(O.docChanged&&Date.now()-o>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();A=V,e.onchange(V)}}))}else ee.push(te.updateListener.of(o=>{if(o.docChanged){const O=o.state.doc.toString();A=O,e.onchange(O)}}));ee.push(te.domEventHandlers({click(o){const O=o.target;if(e.onwikilinkclick){const V=O.closest(".cm-live-wikilink");if(V){o.preventDefault();const R=V.textContent?.replace(/^\[{1,2}|\]{1,2}$/g,"").trim();return R&&e.onwikilinkclick(R),!0}}const J=O.closest(".cm-live-link");if(J){const V=J.getAttribute("data-href");if(V)return o.preventDefault(),window.open(V,"_blank","noopener,noreferrer"),!0}return!1}})),e.onsave&&ee.push(re.of([{key:"Mod-s",run:()=>(e.onsave(),!0)}]));const d=le.create({doc:q?"":e.content,extensions:ee});f=new te({state:d,parent:P}),A=q?"":e.content,k(E,e.cursorDocName??"",!0)}Qt(()=>{me()}),nt(()=>{e.cursorDocName&&t(E)&&e.cursorDocName!==t(E)&&me()}),nt(()=>{if(u(),f&&!x&&e.content!==A){A=e.content;const le=P.closest(".document-scroll"),_e=le?.scrollTop??0;f.dispatch({changes:{from:0,to:f.state.doc.length,insert:e.content},...p?{annotations:p.addToHistory.of(!1)}:{}}),le&&requestAnimationFrame(()=>{le.scrollTop=_e})}}),Vt(()=>{L&&cancelAnimationFrame(L),x?.destroy(),x=null,f?.destroy()});var $=Tr(),ae=S($);ft(ae,le=>P=le,()=>P);var ye=N(ae,2);{var ve=le=>{var _e=Rr();Ue(_e,21,()=>t(z),te=>te.id,(te,re)=>{var I=Pr(),r=S(I),a=S(r,!0);w(r),w(I),fe(()=>{Ve(I,`top: ${t(re).top??""}px; left: ${t(re).left??""}px; height: ${t(re).height??""}px; --cursor-color: ${t(re).color??""};`),Ve(r,`background-color: ${t(re).color??""};`),pe(a,t(re).name)}),h(te,I)}),w(_e),h(le,_e)};ce(ye,le=>{t(z).length>0&&le(ve)})}w($),h(H,$),Ye()}var Et={exports:{}};var zr=Et.exports,jt;function Or(){return jt||(jt=1,(function(H,e){((i,u)=>{H.exports=u()})(zr,function i(){var u=typeof self<"u"?self:typeof window<"u"?window:u!==void 0?u:{},m,P=!u.document&&!!u.postMessage,f=u.IS_PAPA_WORKER||!1,x={},E=0,p={};function z(r){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(a){var n=te(a);n.chunkSize=parseInt(n.chunkSize),a.step||a.chunk||(n.chunkSize=null),this._handle=new $(n),(this._handle.streamer=this)._config=n}).call(this,r),this.parseChunk=function(a,n){var v=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<v){let j=this._config.newline;j||(_=this._config.quoteChar||'"',j=this._handle.guessLineEndings(a,_)),a=[...a.split(j).slice(v)].join(j)}this.isFirstChunk&&I(this._config.beforeFirstChunk)&&(_=this._config.beforeFirstChunk(a))!==void 0&&(a=_),this.isFirstChunk=!1,this._halted=!1;var v=this._partialLine+a,_=(this._partialLine="",this._handle.parse(v,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(a=_.meta.cursor,v=(this._finished||(this._partialLine=v.substring(a-this._baseIndex),this._baseIndex=a),_&&_.data&&(this._rowCount+=_.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),f)u.postMessage({results:_,workerId:p.WORKER_ID,finished:v});else if(I(this._config.chunk)&&!n){if(this._config.chunk(_,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=_=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(_.data),this._completeResults.errors=this._completeResults.errors.concat(_.errors),this._completeResults.meta=_.meta),this._completed||!v||!I(this._config.complete)||_&&_.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),v||_&&_.meta.paused||this._nextChunk(),_}this._halted=!0},this._sendError=function(a){I(this._config.error)?this._config.error(a):f&&this._config.error&&u.postMessage({workerId:p.WORKER_ID,error:a,finished:!1})}}function L(r){var a;(r=r||{}).chunkSize||(r.chunkSize=p.RemoteChunkSize),z.call(this,r),this._nextChunk=P?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(n){this._input=n,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(a=new XMLHttpRequest,this._config.withCredentials&&(a.withCredentials=this._config.withCredentials),P||(a.onload=re(this._chunkLoaded,this),a.onerror=re(this._chunkError,this)),a.open(this._config.downloadRequestBody?"POST":"GET",this._input,!P),this._config.downloadRequestHeaders){var n,v=this._config.downloadRequestHeaders;for(n in v)a.setRequestHeader(n,v[n])}var _;this._config.chunkSize&&(_=this._start+this._config.chunkSize-1,a.setRequestHeader("Range","bytes="+this._start+"-"+_));try{a.send(this._config.downloadRequestBody)}catch(j){this._chunkError(j.message)}P&&a.status===0&&this._chunkError()}},this._chunkLoaded=function(){a.readyState===4&&(a.status<200||400<=a.status?this._chunkError():(this._start+=this._config.chunkSize||a.responseText.length,this._finished=!this._config.chunkSize||this._start>=(n=>(n=n.getResponseHeader("Content-Range"))!==null?parseInt(n.substring(n.lastIndexOf("/")+1)):-1)(a),this.parseChunk(a.responseText)))},this._chunkError=function(n){n=a.statusText||n,this._sendError(new Error(n))}}function A(r){(r=r||{}).chunkSize||(r.chunkSize=p.LocalChunkSize),z.call(this,r);var a,n,v=typeof FileReader<"u";this.stream=function(_){this._input=_,n=_.slice||_.webkitSlice||_.mozSlice,v?((a=new FileReader).onload=re(this._chunkLoaded,this),a.onerror=re(this._chunkError,this)):a=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var _=this._input,j=(this._config.chunkSize&&(j=Math.min(this._start+this._config.chunkSize,this._input.size),_=n.call(_,this._start,j)),a.readAsText(_,this._config.encoding));v||this._chunkLoaded({target:{result:j}})},this._chunkLoaded=function(_){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(_.target.result)},this._chunkError=function(){this._sendError(a.error)}}function F(r){var a;z.call(this,r=r||{}),this.stream=function(n){return a=n,this._nextChunk()},this._nextChunk=function(){var n,v;if(!this._finished)return n=this._config.chunkSize,a=n?(v=a.substring(0,n),a.substring(n)):(v=a,""),this._finished=!a,this.parseChunk(v)}}function me(r){z.call(this,r=r||{});var a=[],n=!0,v=!1;this.pause=function(){z.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){z.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(_){this._input=_,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){v&&a.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),a.length?this.parseChunk(a.shift()):n=!0},this._streamData=re(function(_){try{a.push(typeof _=="string"?_:_.toString(this._config.encoding)),n&&(n=!1,this._checkIsFinished(),this.parseChunk(a.shift()))}catch(j){this._streamError(j)}},this),this._streamError=re(function(_){this._streamCleanUp(),this._sendError(_)},this),this._streamEnd=re(function(){this._streamCleanUp(),v=!0,this._streamData("")},this),this._streamCleanUp=re(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function $(r){var a,n,v,_,j=Math.pow(2,53),oe=-j,be=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,y=/^((\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,c=0,T=0,ee=!1,q=!1,d=[],o={data:[],errors:[],meta:{}};function O(g){return r.skipEmptyLines==="greedy"?g.join("").trim()==="":g.length===1&&g[0].length===0}function J(){if(o&&v&&(R("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+p.DefaultDelimiter+"'"),v=!1),r.skipEmptyLines&&(o.data=o.data.filter(function(D){return!O(D)})),V()){let D=function(ne,K){I(r.transformHeader)&&(ne=r.transformHeader(ne,K)),d.push(ne)};if(o)if(Array.isArray(o.data[0])){for(var g=0;V()&&g<o.data.length;g++)o.data[g].forEach(D);o.data.splice(0,1)}else o.data.forEach(D)}function b(D,ne){for(var K=r.header?{}:[],X=0;X<D.length;X++){var de=X,G=D[X],G=((Ae,s)=>(C=>(r.dynamicTypingFunction&&r.dynamicTyping[C]===void 0&&(r.dynamicTyping[C]=r.dynamicTypingFunction(C)),(r.dynamicTyping[C]||r.dynamicTyping)===!0))(Ae)?s==="true"||s==="TRUE"||s!=="false"&&s!=="FALSE"&&((C=>{if(be.test(C)&&(C=parseFloat(C),oe<C&&C<j))return 1})(s)?parseFloat(s):y.test(s)?new Date(s):s===""?null:s):s)(de=r.header?X>=d.length?"__parsed_extra":d[X]:de,G=r.transform?r.transform(G,de):G);de==="__parsed_extra"?(K[de]=K[de]||[],K[de].push(G)):K[de]=G}return r.header&&(X>d.length?R("FieldMismatch","TooManyFields","Too many fields: expected "+d.length+" fields but parsed "+X,T+ne):X<d.length&&R("FieldMismatch","TooFewFields","Too few fields: expected "+d.length+" fields but parsed "+X,T+ne)),K}var Q;o&&(r.header||r.dynamicTyping||r.transform)&&(Q=1,!o.data.length||Array.isArray(o.data[0])?(o.data=o.data.map(b),Q=o.data.length):o.data=b(o.data,0),r.header&&o.meta&&(o.meta.fields=d),T+=Q)}function V(){return r.header&&d.length===0}function R(g,b,Q,D){g={type:g,code:b,message:Q},D!==void 0&&(g.row=D),o.errors.push(g)}I(r.step)&&(_=r.step,r.step=function(g){o=g,V()?J():(J(),o.data.length!==0&&(c+=g.data.length,r.preview&&c>r.preview?n.abort():(o.data=o.data[0],_(o,l))))}),this.parse=function(g,b,Q){var D=r.quoteChar||'"',D=(r.newline||(r.newline=this.guessLineEndings(g,D)),v=!1,r.delimiter?I(r.delimiter)&&(r.delimiter=r.delimiter(g),o.meta.delimiter=r.delimiter):((D=((ne,K,X,de,G)=>{var Ae,s,C,Z;G=G||[","," ","|",";",p.RECORD_SEP,p.UNIT_SEP];for(var W=0;W<G.length;W++){for(var ue,B=G[W],se=0,ie=0,U=0,Y=(C=void 0,new ye({comments:de,delimiter:B,newline:K,preview:10}).parse(ne)),we=0;we<Y.data.length;we++)X&&O(Y.data[we])?U++:(ue=Y.data[we].length,ie+=ue,C===void 0?C=ue:0<ue&&(se+=Math.abs(ue-C),C=ue));0<Y.data.length&&(ie/=Y.data.length-U),(s===void 0||se<=s)&&(Z===void 0||Z<ie)&&1.99<ie&&(s=se,Ae=B,Z=ie)}return{successful:!!(r.delimiter=Ae),bestDelimiter:Ae}})(g,r.newline,r.skipEmptyLines,r.comments,r.delimitersToGuess)).successful?r.delimiter=D.bestDelimiter:(v=!0,r.delimiter=p.DefaultDelimiter),o.meta.delimiter=r.delimiter),te(r));return r.preview&&r.header&&D.preview++,a=g,n=new ye(D),o=n.parse(a,b,Q),J(),ee?{meta:{paused:!0}}:o||{meta:{paused:!1}}},this.paused=function(){return ee},this.pause=function(){ee=!0,n.abort(),a=I(r.chunk)?"":a.substring(n.getCharIndex())},this.resume=function(){l.streamer._halted?(ee=!1,l.streamer.parseChunk(a,!0)):setTimeout(l.resume,3)},this.aborted=function(){return q},this.abort=function(){q=!0,n.abort(),o.meta.aborted=!0,I(r.complete)&&r.complete(o),a=""},this.guessLineEndings=function(ne,D){ne=ne.substring(0,1048576);var D=new RegExp(ae(D)+"([^]*?)"+ae(D),"gm"),Q=(ne=ne.replace(D,"")).split("\r"),D=ne.split(`
3
+ `),ne=1<D.length&&D[0].length<Q[0].length;if(Q.length===1||ne)return`
4
+ `;for(var K=0,X=0;X<Q.length;X++)Q[X][0]===`
5
+ `&&K++;return K>=Q.length/2?`\r
6
+ `:"\r"}}function ae(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ye(r){var a=(r=r||{}).delimiter,n=r.newline,v=r.comments,_=r.step,j=r.preview,oe=r.fastMode,be=null,y=!1,l=r.quoteChar==null?'"':r.quoteChar,c=l;if(r.escapeChar!==void 0&&(c=r.escapeChar),(typeof a!="string"||-1<p.BAD_DELIMITERS.indexOf(a))&&(a=","),v===a)throw new Error("Comment character same as delimiter");v===!0?v="#":(typeof v!="string"||-1<p.BAD_DELIMITERS.indexOf(v))&&(v=!1),n!==`
7
+ `&&n!=="\r"&&n!==`\r
8
+ `&&(n=`
9
+ `);var T=0,ee=!1;this.parse=function(q,d,o){if(typeof q!="string")throw new Error("Input must be a string");var O=q.length,J=a.length,V=n.length,R=v.length,g=I(_),b=[],Q=[],D=[],ne=T=0;if(!q)return se();if(oe||oe!==!1&&q.indexOf(l)===-1){for(var K=q.split(n),X=0;X<K.length;X++){if(D=K[X],T+=D.length,X!==K.length-1)T+=n.length;else if(o)return se();if(!v||D.substring(0,R)!==v){if(g){if(b=[],Z(D.split(a)),ie(),ee)return se()}else Z(D.split(a));if(j&&j<=X)return b=b.slice(0,j),se(!0)}}return se()}for(var de=q.indexOf(a,T),G=q.indexOf(n,T),Ae=new RegExp(ae(c)+ae(l),"g"),s=q.indexOf(l,T);;)if(q[T]===l)for(s=T,T++;;){if((s=q.indexOf(l,s+1))===-1)return o||Q.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:b.length,index:T}),ue();if(s===O-1)return ue(q.substring(T,s).replace(Ae,l));if(l===c&&q[s+1]===c)s++;else if(l===c||s===0||q[s-1]!==c){de!==-1&&de<s+1&&(de=q.indexOf(a,s+1));var C=W((G=G!==-1&&G<s+1?q.indexOf(n,s+1):G)===-1?de:Math.min(de,G));if(q.substr(s+1+C,J)===a){D.push(q.substring(T,s).replace(Ae,l)),q[T=s+1+C+J]!==l&&(s=q.indexOf(l,T)),de=q.indexOf(a,T),G=q.indexOf(n,T);break}if(C=W(G),q.substring(s+1+C,s+1+C+V)===n){if(D.push(q.substring(T,s).replace(Ae,l)),B(s+1+C+V),de=q.indexOf(a,T),s=q.indexOf(l,T),g&&(ie(),ee))return se();if(j&&b.length>=j)return se(!0);break}Q.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:b.length,index:T}),s++}}else if(v&&D.length===0&&q.substring(T,T+R)===v){if(G===-1)return se();T=G+V,G=q.indexOf(n,T),de=q.indexOf(a,T)}else if(de!==-1&&(de<G||G===-1))D.push(q.substring(T,de)),T=de+J,de=q.indexOf(a,T);else{if(G===-1)break;if(D.push(q.substring(T,G)),B(G+V),g&&(ie(),ee))return se();if(j&&b.length>=j)return se(!0)}return ue();function Z(U){b.push(U),ne=T}function W(U){var Y=0;return Y=U!==-1&&(U=q.substring(s+1,U))&&U.trim()===""?U.length:Y}function ue(U){return o||(U===void 0&&(U=q.substring(T)),D.push(U),T=O,Z(D),g&&ie()),se()}function B(U){T=U,Z(D),D=[],G=q.indexOf(n,T)}function se(U){if(r.header&&!d&&b.length&&!y){var Y=b[0],we=Object.create(null),ge=new Set(Y);let Ce=!1;for(let Pe=0;Pe<Y.length;Pe++){let xe=Y[Pe];if(we[xe=I(r.transformHeader)?r.transformHeader(xe,Pe):xe]){let Se,Fe=we[xe];for(;Se=xe+"_"+Fe,Fe++,ge.has(Se););ge.add(Se),Y[Pe]=Se,we[xe]++,Ce=!0,(be=be===null?{}:be)[Se]=xe}else we[xe]=1,Y[Pe]=xe;ge.add(xe)}Ce&&console.warn("Duplicate headers found and renamed."),y=!0}return{data:b,errors:Q,meta:{delimiter:a,linebreak:n,aborted:ee,truncated:!!U,cursor:ne+(d||0),renamedHeaders:be}}}function ie(){_(se()),b=[],Q=[]}},this.abort=function(){ee=!0},this.getCharIndex=function(){return T}}function ve(r){var a=r.data,n=x[a.workerId],v=!1;if(a.error)n.userError(a.error,a.file);else if(a.results&&a.results.data){var _={abort:function(){v=!0,le(a.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:_e,resume:_e};if(I(n.userStep)){for(var j=0;j<a.results.data.length&&(n.userStep({data:a.results.data[j],errors:a.results.errors,meta:a.results.meta},_),!v);j++);delete a.results}else I(n.userChunk)&&(n.userChunk(a.results,_,a.file),delete a.results)}a.finished&&!v&&le(a.workerId,a.results)}function le(r,a){var n=x[r];I(n.userComplete)&&n.userComplete(a),n.terminate(),delete x[r]}function _e(){throw new Error("Not implemented.")}function te(r){if(typeof r!="object"||r===null)return r;var a,n=Array.isArray(r)?[]:{};for(a in r)n[a]=te(r[a]);return n}function re(r,a){return function(){r.apply(a,arguments)}}function I(r){return typeof r=="function"}return p.parse=function(r,a){var n=(a=a||{}).dynamicTyping||!1;if(I(n)&&(a.dynamicTypingFunction=n,n={}),a.dynamicTyping=n,a.transform=!!I(a.transform)&&a.transform,!a.worker||!p.WORKERS_SUPPORTED)return n=null,p.NODE_STREAM_INPUT,typeof r=="string"?(r=(v=>v.charCodeAt(0)!==65279?v:v.slice(1))(r),n=new(a.download?L:F)(a)):r.readable===!0&&I(r.read)&&I(r.on)?n=new me(a):(u.File&&r instanceof File||r instanceof Object)&&(n=new A(a)),n.stream(r);(n=(()=>{var v;return!!p.WORKERS_SUPPORTED&&(v=(()=>{var _=u.URL||u.webkitURL||null,j=i.toString();return p.BLOB_URL||(p.BLOB_URL=_.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; ","(",j,")();"],{type:"text/javascript"})))})(),(v=new u.Worker(v)).onmessage=ve,v.id=E++,x[v.id]=v)})()).userStep=a.step,n.userChunk=a.chunk,n.userComplete=a.complete,n.userError=a.error,a.step=I(a.step),a.chunk=I(a.chunk),a.complete=I(a.complete),a.error=I(a.error),delete a.worker,n.postMessage({input:r,config:a,workerId:n.id})},p.unparse=function(r,a){var n=!1,v=!0,_=",",j=`\r
10
+ `,oe='"',be=oe+oe,y=!1,l=null,c=!1,T=((()=>{if(typeof a=="object"){if(typeof a.delimiter!="string"||p.BAD_DELIMITERS.filter(function(d){return a.delimiter.indexOf(d)!==-1}).length||(_=a.delimiter),typeof a.quotes!="boolean"&&typeof a.quotes!="function"&&!Array.isArray(a.quotes)||(n=a.quotes),typeof a.skipEmptyLines!="boolean"&&typeof a.skipEmptyLines!="string"||(y=a.skipEmptyLines),typeof a.newline=="string"&&(j=a.newline),typeof a.quoteChar=="string"&&(oe=a.quoteChar),typeof a.header=="boolean"&&(v=a.header),Array.isArray(a.columns)){if(a.columns.length===0)throw new Error("Option columns is empty");l=a.columns}a.escapeChar!==void 0&&(be=a.escapeChar+oe),a.escapeFormulae instanceof RegExp?c=a.escapeFormulae:typeof a.escapeFormulae=="boolean"&&a.escapeFormulae&&(c=/^[=+\-@\t\r].*$/)}})(),new RegExp(ae(oe),"g"));if(typeof r=="string"&&(r=JSON.parse(r)),Array.isArray(r)){if(!r.length||Array.isArray(r[0]))return ee(null,r,y);if(typeof r[0]=="object")return ee(l||Object.keys(r[0]),r,y)}else if(typeof r=="object")return typeof r.data=="string"&&(r.data=JSON.parse(r.data)),Array.isArray(r.data)&&(r.fields||(r.fields=r.meta&&r.meta.fields||l),r.fields||(r.fields=Array.isArray(r.data[0])?r.fields:typeof r.data[0]=="object"?Object.keys(r.data[0]):[]),Array.isArray(r.data[0])||typeof r.data[0]=="object"||(r.data=[r.data])),ee(r.fields||[],r.data||[],y);throw new Error("Unable to serialize unrecognized input");function ee(d,o,O){var J="",V=(typeof d=="string"&&(d=JSON.parse(d)),typeof o=="string"&&(o=JSON.parse(o)),Array.isArray(d)&&0<d.length),R=!Array.isArray(o[0]);if(V&&v){for(var g=0;g<d.length;g++)0<g&&(J+=_),J+=q(d[g],g);0<o.length&&(J+=j)}for(var b=0;b<o.length;b++){var Q=(V?d:o[b]).length,D=!1,ne=V?Object.keys(o[b]).length===0:o[b].length===0;if(O&&!V&&(D=O==="greedy"?o[b].join("").trim()==="":o[b].length===1&&o[b][0].length===0),O==="greedy"&&V){for(var K=[],X=0;X<Q;X++){var de=R?d[X]:X;K.push(o[b][de])}D=K.join("").trim()===""}if(!D){for(var G=0;G<Q;G++){0<G&&!ne&&(J+=_);var Ae=V&&R?d[G]:G;J+=q(o[b][Ae],G)}b<o.length-1&&(!O||0<Q&&!ne)&&(J+=j)}}return J}function q(d,o){var O,J;return d==null?"":d.constructor===Date?JSON.stringify(d).slice(1,25):(J=!1,c&&typeof d=="string"&&c.test(d)&&(d="'"+d,J=!0),O=d.toString().replace(T,be),(J=J||n===!0||typeof n=="function"&&n(d,o)||Array.isArray(n)&&n[o]||((V,R)=>{for(var g=0;g<R.length;g++)if(-1<V.indexOf(R[g]))return!0;return!1})(O,p.BAD_DELIMITERS)||-1<O.indexOf(_)||O.charAt(0)===" "||O.charAt(O.length-1)===" ")?oe+O+oe:O)}},p.RECORD_SEP="",p.UNIT_SEP="",p.BYTE_ORDER_MARK="\uFEFF",p.BAD_DELIMITERS=["\r",`
11
+ `,'"',p.BYTE_ORDER_MARK],p.WORKERS_SUPPORTED=!P&&!!u.Worker,p.NODE_STREAM_INPUT=1,p.LocalChunkSize=10485760,p.RemoteChunkSize=5242880,p.DefaultDelimiter=",",p.Parser=ye,p.ParserHandle=$,p.NetworkStreamer=L,p.FileStreamer=A,p.StringStreamer=F,p.ReadableStreamStreamer=me,u.jQuery&&((m=u.jQuery).fn.parse=function(r){var a=r.config||{},n=[];return this.each(function(j){if(!(m(this).prop("tagName").toUpperCase()==="INPUT"&&m(this).attr("type").toLowerCase()==="file"&&u.FileReader)||!this.files||this.files.length===0)return!0;for(var oe=0;oe<this.files.length;oe++)n.push({file:this.files[oe],inputElem:this,instanceConfig:m.extend({},a)})}),v(),this;function v(){if(n.length===0)I(r.complete)&&r.complete();else{var j,oe,be,y,l=n[0];if(I(r.before)){var c=r.before(l.file,l.inputElem);if(typeof c=="object"){if(c.action==="abort")return j="AbortError",oe=l.file,be=l.inputElem,y=c.reason,void(I(r.error)&&r.error({name:j},oe,be,y));if(c.action==="skip")return void _();typeof c.config=="object"&&(l.instanceConfig=m.extend(l.instanceConfig,c.config))}else if(c==="skip")return void _()}var T=l.instanceConfig.complete;l.instanceConfig.complete=function(ee){I(T)&&T(ee,l.file,l.inputElem),_()},p.parse(l.file,l.instanceConfig)}}function _(){n.splice(0,1),v()}}),f&&(u.onmessage=function(r){r=r.data,p.WORKER_ID===void 0&&r&&(p.WORKER_ID=r.workerId),typeof r.input=="string"?u.postMessage({workerId:p.WORKER_ID,results:p.parse(r.input,r.config),finished:!0}):(u.File&&r.input instanceof File||r.input instanceof Object)&&(r=p.parse(r.input,r.config))&&u.postMessage({workerId:p.WORKER_ID,results:r,finished:!0})}),(L.prototype=Object.create(z.prototype)).constructor=L,(A.prototype=Object.create(z.prototype)).constructor=A,(F.prototype=Object.create(F.prototype)).constructor=F,(me.prototype=Object.create(z.prototype)).constructor=me,p})})(Et)),Et.exports}var Lr=Or();const Kt=ya(Lr);var Fr=M('<span class="remote-cell-label svelte-63hltt"> </span>'),Mr=M('<th><!> <input class="cell-input header-input svelte-63hltt"/> <!></th>'),Ir=M('<span class="remote-cell-label svelte-63hltt"> </span>'),jr=M('<td><!> <input class="cell-input svelte-63hltt"/></td>'),Kr=M('<tr class="svelte-63hltt"><td class="row-num svelte-63hltt"></td><!><td class="actions svelte-63hltt"><!></td></tr>'),Ur=M("<!> <span>Add row</span>",1),Nr=M('<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 qr(H,e){He(e,!0);let i=Le(e,"remoteCursors",19,()=>[]),u=Ee(ot([])),m=Ee(ot([])),P=Ee(void 0);function f(y){const l=Kt.parse(y.trim(),{header:!1,skipEmptyLines:!0});l.data.length>0?(k(u,l.data[0],!0),k(m,l.data.slice(1),!0)):(k(u,[],!0),k(m,[],!0))}f(e.content),nt(()=>{f(e.content)});function x(){return Kt.unparse([t(u),...t(m)])}function E(){const y=x();e.onchange?.(y)}function p(y,l,c){t(m)[y][l]=c,k(m,[...t(m)],!0),E()}function z(y,l){t(u)[y]=l,k(u,[...t(u)],!0),E()}function L(){k(m,[...t(m),t(u).map(()=>"")],!0),E(),$(t(m).length-1,0)}function A(y){k(m,t(m).filter((l,c)=>c!==y),!0),E()}function F(){const y=`col${t(u).length+1}`;k(u,[...t(u),y],!0),k(m,t(m).map(l=>[...l,""]),!0),E(),requestAnimationFrame(()=>{const l=t(P)?.querySelector(`thead th:nth-child(${t(u).length+1}) input`);l&&(l.focus(),l.select())})}function me(y){t(u).length<=1||(k(u,t(u).filter((l,c)=>c!==y),!0),k(m,t(m).map(l=>l.filter((c,T)=>T!==y)),!0),E())}function $(y,l){requestAnimationFrame(()=>{if(!t(P))return;let c=null;y<0?c=t(P).querySelector(`thead th:nth-child(${l+2}) input`):c=t(P).querySelector(`tbody tr:nth-child(${y+1}) td:nth-child(${l+2}) input`),c&&(c.focus(),c.select())})}function ae(y,l,c){if(y.key==="Tab"){y.preventDefault(),y.shiftKey?c>0?$(l,c-1):l>0?$(l-1,t(u).length-1):l===0&&$(-1,t(u).length-1):c<t(u).length-1?$(l,c+1):l<t(m).length-1?$(l+1,0):l===t(m).length-1&&L();return}if(y.key==="Enter"){y.preventDefault(),y.shiftKey?l>0?$(l-1,c):$(-1,c):l<t(m).length-1?$(l+1,c):L();return}if(y.key==="Escape"){y.target.blur();return}}function ye(y,l){if(y.key==="Tab"){y.preventDefault(),y.shiftKey?l>0&&$(-1,l-1):l<t(u).length-1?$(-1,l+1):t(m).length>0&&$(0,0);return}if(y.key==="Enter"){y.preventDefault(),t(m).length>0?$(0,l):L();return}if(y.key==="Escape"){y.target.blur();return}}function ve(y,l){return i().find(c=>c.row===y&&c.col===l)}function le(y,l){e.oncellselect?.(y,l)}function _e(y){(y.metaKey||y.ctrlKey)&&y.key==="s"&&(y.preventDefault(),e.onsave?.())}var te=Nr(),re=S(te),I=S(re),r=S(I),a=S(r),n=N(S(a));Ue(n,17,()=>t(u),Be,(y,l,c)=>{const T=ke(()=>ve(-1,c));var ee=Mr();let q;var d=S(ee);{var o=R=>{var g=Fr(),b=S(g,!0);w(g),fe(()=>{Ve(g,`background-color: ${t(T).color??""}`),pe(b,t(T).name)}),h(R,g)};ce(d,R=>{t(T)&&R(o)})}var O=N(d,2);it(O);var J=N(O,2);{var V=R=>{st(R,{variant:"ghost",size:"icon",class:"col-delete-btn",title:"Delete column",onclick:()=>me(c),children:(g,b)=>{Mt(g,{size:12})},$$slots:{default:!0}})};ce(J,R=>{t(u).length>1&&R(V)})}w(ee),fe(()=>{Ve(ee,t(T)?`--rc-color: ${t(T).color}`:""),q=lt(ee,1,"svelte-63hltt",null,q,{"remote-active":!!t(T)}),dt(O,t(l))}),Re("input",O,R=>z(c,R.currentTarget.value)),Re("keydown",O,R=>ye(R,c)),Qe("focus",O,()=>le(-1,c)),h(y,ee)});var v=N(n),_=S(v);st(_,{variant:"ghost",size:"icon",class:"col-add-btn",title:"Add column",onclick:F,children:(y,l)=>{Pt(y,{size:14})},$$slots:{default:!0}}),w(v),w(a),w(r);var j=N(r);Ue(j,21,()=>t(m),Be,(y,l,c)=>{var T=Kr(),ee=S(T);ee.textContent=c+1;var q=N(ee);Ue(q,17,()=>t(l),Be,(O,J,V)=>{const R=ke(()=>ve(c,V));var g=jr();let b;var Q=S(g);{var D=K=>{var X=Ir(),de=S(X,!0);w(X),fe(()=>{Ve(X,`background-color: ${t(R).color??""}`),pe(de,t(R).name)}),h(K,X)};ce(Q,K=>{t(R)&&K(D)})}var ne=N(Q,2);it(ne),w(g),fe(()=>{Ve(g,t(R)?`--rc-color: ${t(R).color}`:""),b=lt(g,1,"svelte-63hltt",null,b,{"remote-active":!!t(R)}),dt(ne,t(J))}),Re("input",ne,K=>p(c,V,K.currentTarget.value)),Re("keydown",ne,K=>ae(K,c,V)),Qe("focus",ne,()=>le(c,V)),h(O,g)});var d=N(q),o=S(d);st(o,{variant:"ghost",size:"icon",class:"delete-btn",title:"Delete row",onclick:()=>A(c),children:(O,J)=>{Mt(O,{size:12})},$$slots:{default:!0}}),w(d),w(T),h(y,T)}),w(j),w(I),ft(I,y=>k(P,y),()=>t(P)),w(re);var oe=N(re,2),be=S(oe);st(be,{variant:"ghost",class:"add-row-btn",onclick:L,children:(y,l)=>{var c=Ur(),T=he(c);Pt(T,{size:14}),We(2),h(y,c)},$$slots:{default:!0}}),w(oe),w(te),Re("keydown",te,_e),h(H,te),Ye()}_t(["keydown","input"]);const Vr=/^\d{4}-\d{2}-\d{2}/,Wr=new Set(["active","inactive","in-progress","completed","done","cancelled","draft","archived","current","former","contractor","client","partner","won","lost","open","closed"]),Br=new Set(["format"]),Hr=new Set(["entity_id","created_at","updated_at","created_by","updated_by"]);function Yr(H,e){const i=[];for(const[m,P]of Object.entries(H)){if(Hr.has(m)||P==null)continue;const f=Zr(m,P);f&&i.push(f)}const u=["entity_type","name","date"];return i.sort((m,P)=>{const f=u.indexOf(m.key),x=u.indexOf(P.key);return f!==-1&&x!==-1?f-x:f!==-1?-1:x!==-1?1:m.key.localeCompare(P.key)}),i}function Zr(H,e){if(H==="entity_type")return{key:H,value:String(e),type:"entity-type"};if(Br.has(H))return{key:H,value:String(e).toUpperCase(),type:"badge"};if(H==="status")return{key:H,value:String(e),type:"status"};if(Array.isArray(e)){if(e.length>0&&typeof e[0]=="object"&&e[0]!==null){const x=e.map(E=>Object.entries(E).map(([z,L])=>`${z}: ${L}`).join(", "));return{key:H,value:x.join(" | "),type:"text"}}const m=e.map(String),P=m.some(x=>/^\[\[.+?\]\]$/.test(x)),f=m.map(x=>{const E=x.match(/^\[\[(.+?)\]\]$/);return E?E[1]:x});return P||f.every(x=>Ut(x))?{key:H,value:f,type:"wikilink"}:{key:H,value:m.join(", "),type:"text"}}const i=String(e),u=i.match(/^\[\[(.+?)\]\]$/);return u?{key:H,value:u[1],type:"wikilink"}:Vr.test(i)||H==="date"||H.endsWith("_date")||H.endsWith("_at")?{key:H,value:i,type:"date"}:Wr.has(i.toLowerCase())?{key:H,value:i,type:"status"}:/^https?:\/\//.test(i)||H==="url"||H==="website"?{key:H,value:i,type:"url"}:Ut(i)&&!i.includes(" ")?{key:H,value:i,type:"wikilink"}:{key:H,value:i,type:"text"}}function Ut(H){return/^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(H)&&H.includes("-")}var Jr=tt("<title> </title>"),Gr=tt('<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 Nt(H,e){const i=et(e,["children","$$slots","$$events","$$legacy"]),u=et(i,["size","title"]);He(e,!1);const m=$e(),P=$e();let f=Le(e,"size",8,16),x=Le(e,"title",8,void 0);Xe(()=>(Ne(i),Ne(x())),()=>{k(m,i["aria-label"]||i["aria-labelledby"]||x())}),Xe(()=>(t(m),Ne(i)),()=>{k(P,{"aria-hidden":t(m)?void 0:!0,role:t(m)?"img":void 0,focusable:Number(i.tabindex)===0?!0:void 0})}),gt(),yt();var E=Gr();mt(E,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:f(),height:f(),...t(P),...u}));var p=S(E);{var z=L=>{var A=Jr(),F=S(A,!0);w(A),fe(()=>pe(F,x())),h(L,A)};ce(p,L=>{x()&&L(z)})}We(),w(E),h(H,E),Ye()}class Qr{diff(e,i,u={}){let m;typeof u=="function"?(m=u,u={}):"callback"in u&&(m=u.callback);const P=this.castInput(e,u),f=this.castInput(i,u),x=this.removeEmpty(this.tokenize(P,u)),E=this.removeEmpty(this.tokenize(f,u));return this.diffWithOptionsObj(x,E,u,m)}diffWithOptionsObj(e,i,u,m){var P;const f=ve=>{if(ve=this.postProcess(ve,u),m){setTimeout(function(){m(ve)},0);return}else return ve},x=i.length,E=e.length;let p=1,z=x+E;u.maxEditLength!=null&&(z=Math.min(z,u.maxEditLength));const L=(P=u.timeout)!==null&&P!==void 0?P:1/0,A=Date.now()+L,F=[{oldPos:-1,lastComponent:void 0}];let me=this.extractCommon(F[0],i,e,0,u);if(F[0].oldPos+1>=E&&me+1>=x)return f(this.buildValues(F[0].lastComponent,i,e));let $=-1/0,ae=1/0;const ye=()=>{for(let ve=Math.max($,-p);ve<=Math.min(ae,p);ve+=2){let le;const _e=F[ve-1],te=F[ve+1];_e&&(F[ve-1]=void 0);let re=!1;if(te){const r=te.oldPos-ve;re=te&&0<=r&&r<x}const I=_e&&_e.oldPos+1<E;if(!re&&!I){F[ve]=void 0;continue}if(!I||re&&_e.oldPos<te.oldPos?le=this.addToPath(te,!0,!1,0,u):le=this.addToPath(_e,!1,!0,1,u),me=this.extractCommon(le,i,e,ve,u),le.oldPos+1>=E&&me+1>=x)return f(this.buildValues(le.lastComponent,i,e))||!0;F[ve]=le,le.oldPos+1>=E&&(ae=Math.min(ae,ve-1)),me+1>=x&&($=Math.max($,ve+1))}p++};if(m)(function ve(){setTimeout(function(){if(p>z||Date.now()>A)return m(void 0);ye()||ve()},0)})();else for(;p<=z&&Date.now()<=A;){const ve=ye();if(ve)return ve}}addToPath(e,i,u,m,P){const f=e.lastComponent;return f&&!P.oneChangePerToken&&f.added===i&&f.removed===u?{oldPos:e.oldPos+m,lastComponent:{count:f.count+1,added:i,removed:u,previousComponent:f.previousComponent}}:{oldPos:e.oldPos+m,lastComponent:{count:1,added:i,removed:u,previousComponent:f}}}extractCommon(e,i,u,m,P){const f=i.length,x=u.length;let E=e.oldPos,p=E-m,z=0;for(;p+1<f&&E+1<x&&this.equals(u[E+1],i[p+1],P);)p++,E++,z++,P.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return z&&!P.oneChangePerToken&&(e.lastComponent={count:z,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=E,p}equals(e,i,u){return u.comparator?u.comparator(e,i):e===i||!!u.ignoreCase&&e.toLowerCase()===i.toLowerCase()}removeEmpty(e){const i=[];for(let u=0;u<e.length;u++)e[u]&&i.push(e[u]);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,u){const m=[];let P;for(;e;)m.push(e),P=e.previousComponent,delete e.previousComponent,e=P;m.reverse();const f=m.length;let x=0,E=0,p=0;for(;x<f;x++){const z=m[x];if(z.removed)z.value=this.join(u.slice(p,p+z.count)),p+=z.count;else{if(!z.added&&this.useLongestToken){let L=i.slice(E,E+z.count);L=L.map(function(A,F){const me=u[p+F];return me.length>A.length?me:A}),z.value=this.join(L)}else z.value=this.join(i.slice(E,E+z.count));E+=z.count,z.added||(p+=z.count)}}return m}}const qt="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 Xr extends Qr{tokenize(e){const i=new RegExp(`(\\r?\\n)|[${qt}]+|[^\\S\\n\\r]+|[^${qt}]`,"ug");return e.match(i)||[]}}const $r=new Xr;function en(H,e,i){return $r.diff(H,e,i)}var tn=tt("<title> </title>"),an=tt('<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 rn(H,e){const i=et(e,["children","$$slots","$$events","$$legacy"]),u=et(i,["size","title"]);He(e,!1);const m=$e(),P=$e();let f=Le(e,"size",8,16),x=Le(e,"title",8,void 0);Xe(()=>(Ne(i),Ne(x())),()=>{k(m,i["aria-label"]||i["aria-labelledby"]||x())}),Xe(()=>(t(m),Ne(i)),()=>{k(P,{"aria-hidden":t(m)?void 0:!0,role:t(m)?"img":void 0,focusable:Number(i.tabindex)===0?!0:void 0})}),gt(),yt();var E=an();mt(E,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:f(),height:f(),...t(P),...u}));var p=S(E);{var z=L=>{var A=tn(),F=S(A,!0);w(A),fe(()=>pe(F,x())),h(L,A)};ce(p,L=>{x()&&L(z)})}We(2),w(E),h(H,E),Ye()}var nn=M('<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>'),sn=M('<div class="diff-properties svelte-1g4tvol"></div>'),on=M('<span class="db-added"> </span>'),ln=M('<span class="db-removed"> </span>'),un=M("<span> </span>"),cn=M("<span> </span>"),dn=M('<div class="diff-view svelte-1g4tvol"><!> <div class="diff-body svelte-1g4tvol"><!></div></div>');function fn(H,e){He(e,!0);function i(A){if(A==null)return"";if(typeof A!="object")return String(A);const F=A;return String(F.name??F.title??F.label??F.id??JSON.stringify(F))}function u(A){return A==null?"":Array.isArray(A)?A.map(i).join(", "):typeof A=="object"?i(A):String(A)}const m=ke(()=>e.refreshResult.body_changed&&e.refreshResult.body_diff?en(e.refreshResult.body_diff.old,e.refreshResult.body_diff.new):null);var P=dn(),f=S(P);{var x=A=>{var F=sn();Ue(F,21,()=>e.refreshResult.diffs,Be,(me,$)=>{const ae=ke(()=>e.properties.find(c=>c.key===t($).field));var ye=nn(),ve=S(ye),le=S(ve);{var _e=c=>{bt(c,{size:14})},te=c=>{ht(c,{size:14})},re=c=>{xt(c,{size:14})},I=c=>{rn(c,{size:14})},r=c=>{kt(c,{size:14})};ce(le,c=>{t(ae)?.type==="date"?c(_e):t(ae)?.type==="status"?c(te,1):t(ae)?.type==="wikilink"?c(re,2):t(ae)?.type==="badge"?c(I,3):c(r,!1)})}w(ve);var a=N(ve,2),n=S(a,!0);w(a);var v=N(a,2),_=S(v),j=S(_),oe=S(j,!0);w(j),w(_);var be=N(_,2),y=S(be),l=S(y,!0);w(y),w(be),w(v),w(ye),fe((c,T)=>{pe(n,t($).field),pe(oe,c),pe(l,T)},[()=>u(t($).old_value),()=>u(t($).new_value)]),h(me,ye)}),w(F),h(A,F)};ce(f,A=>{e.refreshResult.diffs.length>0&&A(x)})}var E=N(f,2),p=S(E);{var z=A=>{var F=Te(),me=he(F);Ue(me,17,()=>t(m),Be,($,ae)=>{var ye=Te(),ve=he(ye);{var le=re=>{var I=on(),r=S(I,!0);w(I),fe(()=>pe(r,t(ae).value)),h(re,I)},_e=re=>{var I=ln(),r=S(I,!0);w(I),fe(()=>pe(r,t(ae).value)),h(re,I)},te=re=>{var I=un(),r=S(I,!0);w(I),fe(()=>pe(r,t(ae).value)),h(re,I)};ce(ve,re=>{t(ae).added?re(le):t(ae).removed?re(_e,1):re(te,!1)})}h($,ye)}),h(A,F)},L=A=>{var F=cn(),me=S(F,!0);w(F),fe(()=>pe(me,e.bodyContent)),h(A,F)};ce(p,A=>{t(m)?A(z):A(L,!1)})}w(E),w(P),h(H,P),Ye()}var vn=M("<!> ",1),hn=M('<span class="diff-action-title svelte-udj3er">Changes from source</span> <div class="diff-action-buttons svelte-udj3er"><!> <!></div>',1),pn=M('<span class="bc-sep svelte-udj3er">/</span>'),_n=M("<!><span> </span>",1),gn=M('<span class="status-text saving svelte-udj3er">Saving...</span>'),mn=M('<span class="status-text error svelte-udj3er"> </span>'),yn=M("<!> ",1),bn=M('<div class="breadcrumb-path svelte-udj3er"></div> <div class="editor-actions svelte-udj3er"><!> <!> <!></div>',1),wn=M('<div class="refresh-panel svelte-udj3er"><div class="refresh-uptodate svelte-udj3er">Entity is up to date with source.</div></div>'),kn=M('<div class="document-scroll svelte-udj3er"><div class="document-well svelte-udj3er"><!> <!> <!></div></div>'),xn=M("<!> <!>",1),En=M("<!> <!>",1),Cn=M("<!> <div><!></div> <!> <!> <!> <!>",1);function es(H,e){He(e,!0);const i=()=>aa(sa,"$page",u),[u,m]=ra(),P=ke(()=>e.data.type==="dataset"||e.data.entity.document?.frontmatter?.entity_type==="dataset"),f=ke(()=>ct.getAppForEntityType(e.data.entity.document?.frontmatter?.entity_type??e.data.type)),x=ke(()=>()=>{const s=e.data.entity.path;if(s){const C=s.lastIndexOf(`/${e.data.repo}/`);if(C>=0)return s.substring(C+1).split("/")}return[e.data.repo,e.data.id,"main.md"]});let E=Ee(""),p=Ee(ot({})),z=Ee(0);const L=ke(()=>Yr(t(p))),A=new Set(["name","date"]);let F=Ee(null);nt(()=>{if(i().url.searchParams.has("new")){k(F,"name");const s=new URL(i().url);s.searchParams.delete("new"),history.replaceState({},"",s.pathname)}else k(F,null)});const me=ke(()=>!!e.data.entity.data?.source_ref);let $=Ee(!1),ae=Ee(null),ye=Ee(null);async function ve(){if(!t($)){k($,!0),k(ae,null),k(ye,null);try{const{result:s}=await ga(e.data.repo,e.data.type,e.data.id);k(ae,s,!0)}catch(s){k(ye,s.message||"Refresh failed",!0)}finally{k($,!1)}}}let le=Ee(!1);async function _e(){if(!t(le)){k(le,!0);try{await _a(e.data.repo,e.data.type,e.data.id),k(ae,null),await na()}catch(s){k(ye,s.message||"Apply changes failed",!0)}finally{k(le,!1)}}}let te=null,re=Ee(""),I=!1,r=Ee(ot([]));function a(s){n(),qe(async()=>{const{createCollabSession:C}=await import("../chunks/CoAsXxNb.js");return{createCollabSession:C}},__vite__mapDeps([8,9,10,11,12,13,14,15,16,17,18]),import.meta.url).then(({createCollabSession:C})=>{const Z=getComputedStyle(document.documentElement).getPropertyValue("--color-accent").trim()||"#e05050",W=C(s,{name:It.user?.displayName??"Anonymous",color:Z,colorLight:Z+"33"});W.ytext.observe(()=>{const se=W.ytext.toString();se!==t(E)&&(I=!0,k(E,se,!0),requestAnimationFrame(()=>{I=!1}))});const ue=W.ydoc.clientID;function B(){const se=[];W.awareness.getStates().forEach((ie,U)=>{if(U===ue)return;const Y=ie.cell;if(Y==null||Y.row==null||Y.col==null)return;const{name:we="Anonymous",color:ge="#e05050"}=ie.user||{};se.push({row:Y.row,col:Y.col,name:we,color:ge})}),k(r,se,!0)}W.awareness.on("change",B),te=W,k(re,s,!0)})}function n(){te&&(te.destroy(),te=null,k(re,""),k(r,[],!0))}Vt(()=>n());let v=Ee(""),_=Ee(0);nt(()=>{const s=`${e.data.repo}/${e.data.type}/${e.data.id}`,C=wa.mutationCount;if(s!==t(v)||C!==t(_)){t(v)&&s!==t(v)&&Ke.flush(),k(v,s),k(_,C,!0);const Z=e.data.entity.document?.content??"";k(E,Z.trim()===""?"":Z,!0),k(p,{...e.data.entity.document?.frontmatter??e.data.entity.data??{}},!0),Xt(z),Ke.reset();const W=`${e.data.repo}/${e.data.type}/${e.data.id}`;t(P)&&W!==t(re)?a(W):t(P)||n()}}),nt(()=>{const s=e.data.repo,C=e.data.type,Z=e.data.id;$t(()=>{St.select(s,C,Z),St.showEntity()})});function j(s){if(!I){if(k(E,s,!0),te){const C=te.ytext,Z=C.toString();s!==Z&&te.ydoc.transact(()=>{C.delete(0,C.length),C.insert(0,s)})}Ke.scheduleAutoSave(e.data.repo,e.data.type,e.data.id,{content:s})}}function oe(s,C){k(p,{...t(p),[s]:C},!0),Ke.scheduleAutoSave(e.data.repo,e.data.type,e.data.id,{data:t(p)})}function be(s){const{[s]:C,...Z}=t(p);k(p,Z,!0),Ke.scheduleAutoSave(e.data.repo,e.data.type,e.data.id,{data:t(p)})}function y(s,C){k(p,{...t(p),[s]:C},!0),Ke.scheduleAutoSave(e.data.repo,e.data.type,e.data.id,{data:t(p)})}function l(s,C){Ke.scheduleAutoSave(e.data.repo,e.data.type,e.data.id,{data:t(p)})}let c=Ee(null);function T(s){s!==e.data.type&&k(c,s,!0)}async function ee(){const s=t(c);if(k(c,null),!!s){Ke.reset();try{await Zt(e.data.repo,e.data.type,e.data.id,s),await ct.refreshEntities(e.data.repo),await pt(`/${e.data.repo}/${s}/${e.data.id}`,{invalidateAll:!0})}catch(C){console.error("Failed to change entity type:",C)}}}function q(s){for(const C of ct.repos){const Z=C.entities.find(W=>W.id===s);if(Z){pt(`/${C.name}/${Z.entityType}/${Z.id}`);return}}ba.showToast(`"${s}" is in a collection you don't have access to`)}nt(()=>(Ft.enter(e.data.repo,e.data.type,e.data.id),()=>Ft.leave()));const d=ke(()=>t(ae)!==null&&(t(ae).diffs.length>0||t(ae).body_changed));function o(s){(s.metaKey||s.ctrlKey)&&s.key==="s"&&(s.preventDefault(),Ke.flush()),s.key==="Escape"&&!(s.target instanceof HTMLInputElement||s.target instanceof HTMLTextAreaElement)&&(Ke.flush(),St.deselect(),pt("/"))}var O=Cn();Qe("keydown",ea,o);var J=he(O);ia(J,{activeView:"entity"});var V=N(J,2);let R;var g=S(V);{var b=s=>{var C=hn(),Z=N(he(C),2),W=S(Z);st(W,{variant:"outline",size:"default",onclick:()=>k(ae,null),get disabled(){return t(le)},children:(B,se)=>{We();var ie=vt("Dismiss");h(B,ie)},$$slots:{default:!0}});var ue=N(W,2);st(ue,{variant:"accent",size:"default",onclick:_e,get disabled(){return t(le)},children:(B,se)=>{var ie=vn(),U=he(ie);{var Y=ge=>{Nt(ge,{class:"size-3 animate-spin",style:"display:inline;vertical-align:middle;margin-right:4px"})};ce(U,ge=>{t(le)&&ge(Y)})}var we=N(U,1,!0);fe(()=>pe(we,t(le)?"Applying...":"Apply changes")),h(B,ie)},$$slots:{default:!0}}),w(Z),h(s,C)},Q=s=>{var C=bn(),Z=he(C);Ue(Z,21,()=>t(x)(),Be,(ge,Ce,Pe)=>{var xe=_n(),Se=he(xe);{var Fe=je=>{var Ze=pn();h(je,Ze)};ce(Se,je=>{Pe>0&&je(Fe)})}var Ie=N(Se),ze=S(Ie,!0);w(Ie),fe(je=>{lt(Ie,1,je,"svelte-udj3er"),pe(ze,t(Ce))},[()=>ta(Pe===t(x)().length-1?"bc-current":"bc-segment")]),h(ge,xe)}),w(Z);var W=N(Z,2),ue=S(W);{var B=ge=>{var Ce=gn();h(ge,Ce)},se=ge=>{var Ce=mn(),Pe=S(Ce,!0);w(Ce),fe(()=>pe(Pe,Ke.error)),h(ge,Ce)};ce(ue,ge=>{Ke.saving?ge(B):Ke.error&&ge(se,1)})}var ie=N(ue,2);{var U=ge=>{st(ge,{variant:"outline",size:"sm",class:"refresh-btn",onclick:ve,get disabled(){return t($)},children:(Ce,Pe)=>{var xe=yn(),Se=he(xe);{var Fe=ze=>{Nt(ze,{class:"size-3 animate-spin",style:"display:inline;vertical-align:middle;margin-right:4px"})};ce(Se,ze=>{t($)&&ze(Fe)})}var Ie=N(Se,1,!0);fe(()=>pe(Ie,t($)?"Refreshing...":"Refresh from source")),h(Ce,xe)},$$slots:{default:!0}})};ce(ie,ge=>{t(me)&&It.user?.role==="admin"&&ge(U)})}var Y=N(ie,2);{var we=ge=>{st(ge,{variant:"link",size:"sm",class:"open-app",get href(){return`/${e.data.repo??""}/${e.data.type??""}/${e.data.id??""}/edit`},children:(Ce,Pe)=>{We();var xe=vt();fe(()=>pe(xe,`Open in ${t(f).name??""} →`)),h(Ce,xe)},$$slots:{default:!0}})};ce(Y,ge=>{t(f)&&ge(we)})}w(W),h(s,C)};ce(g,s=>{t(d)?s(b):s(Q,!1)})}w(V);var D=N(V,2);{var ne=s=>{var C=wn();h(s,C)};ce(D,s=>{t(ae)&&!t(d)&&s(ne)})}var K=N(D,2);{var X=s=>{fn(s,{get properties(){return t(L)},get refreshResult(){return t(ae)},get bodyContent(){return t(E)}})},de=s=>{var C=kn(),Z=S(C),W=S(Z);xr(W,{get properties(){return t(L)},editable:!0,get autofocusKey(){return t(F)},get protectedKeys(){return A},onedit:oe,onremove:be,onadd:y,ontypechange:l,onentitytypechange:T,onfocuseditor:()=>{requestAnimationFrame(()=>requestAnimationFrame(()=>{const U=document.querySelector(".cm-content");if(U){U.focus();const Y=window.getSelection();Y&&U.firstChild?Y.collapse(U.firstChild,0):Y&&Y.collapse(U,0)}}))}});var ue=N(W,2);{var B=U=>{qr(U,{get content(){return t(E)},onchange:j,onsave:()=>Ke.flush(),oncellselect:(Y,we)=>{te?.awareness.setLocalStateField("cell",{row:Y,col:we})},get remoteCursors(){return t(r)}})},se=U=>{{let Y=ke(()=>`${e.data.repo}/${e.data.type}/${e.data.id}`);Dr(U,{get content(){return t(E)},readonly:!1,onchange:j,onsave:()=>Ke.flush(),onwikilinkclick:q,get resetKey(){return t(z)},get cursorDocName(){return t(Y)}})}};ce(ue,U=>{t(P)?U(B):U(se,!1)})}var ie=N(ue,2);Ar(ie,{get entityId(){return e.data.id},get entityRepo(){return e.data.repo}}),w(Z),w(C),h(s,C)};ce(K,s=>{t(d)?s(X):s(de,!1)})}var G=N(K,2);{let s=ke(()=>!!t(ye));De(G,()=>Pa,(C,Z)=>{Z(C,{get open(){return t(s)},onOpenChange:W=>{W||k(ye,null)},children:(W,ue)=>{var B=Te(),se=he(B);De(se,()=>ka,(ie,U)=>{U(ie,{children:(Y,we)=>{var ge=En(),Ce=he(ge);De(Ce,()=>xa,(xe,Se)=>{Se(xe,{children:(Fe,Ie)=>{var ze=xn(),je=he(ze);De(je,()=>Ea,(Je,Ge)=>{Ge(Je,{children:(Oe,at)=>{We();var ut=vt("Refresh failed");h(Oe,ut)},$$slots:{default:!0}})});var Ze=N(je,2);De(Ze,()=>Ca,(Je,Ge)=>{Ge(Je,{children:(Oe,at)=>{We();var ut=vt();fe(()=>pe(ut,t(ye))),h(Oe,ut)},$$slots:{default:!0}})}),h(Fe,ze)},$$slots:{default:!0}})});var Pe=N(Ce,2);De(Pe,()=>Sa,(xe,Se)=>{Se(xe,{children:(Fe,Ie)=>{var ze=Te(),je=he(ze);De(je,()=>Aa,(Ze,Je)=>{Je(Ze,{children:(Ge,Oe)=>{We();var at=vt("OK");h(Ge,at)},$$slots:{default:!0}})}),h(Fe,ze)},$$slots:{default:!0}})}),h(Y,ge)},$$slots:{default:!0}})}),h(W,B)},$$slots:{default:!0}})})}var Ae=N(G,2);{let s=ke(()=>t(c)!==null),C=ke(()=>`Change this entity from ${rt(e.data.type)} to ${rt(t(c)??"")}? Fields specific to ${rt(e.data.type)} will be removed.`);va(Ae,{get open(){return t(s)},title:"Change entity type",get message(){return t(C)},confirmLabel:"Change type",onconfirm:ee,oncancel:()=>{k(c,null)}})}fe(()=>R=lt(V,1,"editor-bar svelte-udj3er",null,R,{"editor-bar-diff":t(d)})),h(H,O),Ye(),m()}export{es as component,$n as universal};
@@ -1,4 +1,4 @@
1
- import{h as lt,w as ut}from"../chunks/BgRr0V7g.js";import{a as S,s as Z,b as M,c as ft}from"../chunks/usxM-xOh.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/CCA2E2CK.js";import{b as X,i as j}from"../chunks/yUs562n0.js";import{s as Y}from"../chunks/BKHfe9E-.js";import{g as pt}from"../chunks/csGnu8Rb.js";import{n as E}from"../chunks/BVhp5b7F.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=`
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/BvwzgaXa.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/usxM-xOh.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,bt as $e}from"../chunks/CCA2E2CK.js";import{V as tn}from"../chunks/Mtmwulo1.js";import{_ as en}from"../chunks/PPVm8Dsz.js";import{e as ce,i as fe}from"../chunks/BpdrS9kL.js";import{s as nn}from"../chunks/BKHfe9E-.js";import{c as kt,a as Pe}from"../chunks/DkuxRPZv.js";import{b as Ee,i as Kt}from"../chunks/yUs562n0.js";import{p as mt,l as Qt}from"../chunks/DHholpIc.js";import{g as rn}from"../chunks/csGnu8Rb.js";import{e as Mt}from"../chunks/CdeYcEuU.js";import{B as on}from"../chunks/D8mTIH9Y.js";import{i as Re}from"../chunks/DIBaaeCL.js";import{n as se}from"../chunks/BVhp5b7F.js";import{w as Wt}from"../chunks/BgRr0V7g.js";import{chatStore as an}from"../chunks/C1S8fyYX.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/CvAezToa.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/BvwzgaXa.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/-2EMa1ML.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};