studiograph 1.3.44-next.2 → 1.3.44-next.3

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 (40) hide show
  1. package/dist/server/routes/insights-api.js +7 -1
  2. package/dist/server/routes/insights-api.js.map +1 -1
  3. package/dist/services/auth-service.d.ts +2 -0
  4. package/dist/services/auth-service.js +15 -1
  5. package/dist/services/auth-service.js.map +1 -1
  6. package/dist/web/_app/immutable/assets/{7.5LBMlZdT.css → 7.D55lTQ_F.css} +1 -1
  7. package/dist/web/_app/immutable/chunks/{DodWDTE5.js → B-PHzYeY.js} +1 -1
  8. package/dist/web/_app/immutable/chunks/{DQJwHeKh.js → BDTSG9D-.js} +1 -1
  9. package/dist/web/_app/immutable/chunks/{Diui_MO0.js → BEbZenUn.js} +1 -1
  10. package/dist/web/_app/immutable/chunks/{By_Wtb5J.js → BR3Oh1Lv.js} +1 -1
  11. package/dist/web/_app/immutable/chunks/{BUcIsKRk.js → BYKARDRw.js} +1 -1
  12. package/dist/web/_app/immutable/chunks/{Bs4ovbtO.js → BfEy5AjR.js} +2 -2
  13. package/dist/web/_app/immutable/chunks/{0rsp5-Up.js → Bolw6cIp.js} +1 -1
  14. package/dist/web/_app/immutable/chunks/{BAAbylyg.js → C0v9FrTH.js} +1 -1
  15. package/dist/web/_app/immutable/chunks/CB2-7g10.js +1 -0
  16. package/dist/web/_app/immutable/chunks/Cc0c675R.js +1 -0
  17. package/dist/web/_app/immutable/chunks/{0wBGAod7.js → D2C1YupD.js} +1 -1
  18. package/dist/web/_app/immutable/chunks/{BU2bHQbQ.js → DNldxAbC.js} +1 -1
  19. package/dist/web/_app/immutable/chunks/{DC9z5DEo.js → HVmKTSmh.js} +1 -1
  20. package/dist/web/_app/immutable/entry/{app.DA5OyPOi.js → app.BuNYNoxY.js} +2 -2
  21. package/dist/web/_app/immutable/entry/start.6840wwQK.js +1 -0
  22. package/dist/web/_app/immutable/nodes/0.Dowq8M1Z.js +2 -0
  23. package/dist/web/_app/immutable/nodes/{1.y3j9wcQE.js → 1.UNZ7IKS_.js} +1 -1
  24. package/dist/web/_app/immutable/nodes/{10.D03BZcr1.js → 10.7pt8gUOi.js} +1 -1
  25. package/dist/web/_app/immutable/nodes/{2.Du0xZVQg.js → 2.B5L8POz_.js} +2 -2
  26. package/dist/web/_app/immutable/nodes/{3.weQEi2lI.js → 3.B1Y1g0du.js} +1 -1
  27. package/dist/web/_app/immutable/nodes/{4.DJyhWznw.js → 4.BerDMn5m.js} +3 -3
  28. package/dist/web/_app/immutable/nodes/{5.CipwuwB3.js → 5.IM34i9-W.js} +1 -1
  29. package/dist/web/_app/immutable/nodes/{6.Daxwm3Lw.js → 6.DPwydXYm.js} +1 -1
  30. package/dist/web/_app/immutable/nodes/7.DpSO-I2k.js +2 -0
  31. package/dist/web/_app/immutable/nodes/{8.DWNdmB4l.js → 8.BVUyEEut.js} +1 -1
  32. package/dist/web/_app/immutable/nodes/{9.BuTZk7Le.js → 9.8nTMvuWx.js} +1 -1
  33. package/dist/web/_app/version.json +1 -1
  34. package/dist/web/index.html +6 -6
  35. package/package.json +1 -1
  36. package/dist/web/_app/immutable/chunks/DSkxw4Ss.js +0 -1
  37. package/dist/web/_app/immutable/chunks/DVx_0hnZ.js +0 -1
  38. package/dist/web/_app/immutable/entry/start.DTjSVtws.js +0 -1
  39. package/dist/web/_app/immutable/nodes/0.BIvpQ3Qk.js +0 -2
  40. package/dist/web/_app/immutable/nodes/7.TxeJDMtw.js +0 -2
@@ -1,5 +1,5 @@
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/DQJwHeKh.js","../chunks/CLFba8FK.js","../chunks/Bs4ovbtO.js","../chunks/PPVm8Dsz.js","../chunks/DSh-OF2y.js","../chunks/BAAbylyg.js","../chunks/DSkxw4Ss.js","../chunks/CFtRXHDP.js","../chunks/Sk0ODu4Y.js","../chunks/DC9z5DEo.js","../chunks/b0XUoOIH.js","../chunks/i9c_RUF6.js"])))=>i.map(i=>d[i]);
2
- import{h as Pa,w as Ft,k as Ra}from"../chunks/DSkxw4Ss.js";import{_ as Xe}from"../chunks/PPVm8Dsz.js";import{d as na,e as Qe,g as _t,a as p,c as Ye,t as pt,s as ue,b as I,f as rt}from"../chunks/b0XUoOIH.js";import{aA as Da,a7 as ma,p as it,e as De,f as gt,a2 as ht,aE as Ta,c as y,a3 as N,r as f,g as e,s as _,b as st,a0 as Ce,n as Ne,t as le,a4 as Oe,l as tt,d as qe,a as Et,m as at,bt as ya,aw as Mt,a1 as za,aD as Oa,aF as wa}from"../chunks/DSh-OF2y.js";import{i as be,b as Yt}from"../chunks/DT3KtxWU.js";import{e as We,i as Ze}from"../chunks/DHtLlmE0.js";import{c as Ue}from"../chunks/DCVmM0L5.js";import{s as Ct,c as La}from"../chunks/CFtRXHDP.js";import{p as Ve,l as nt,a as Ma,b as Fa}from"../chunks/D-yNNNdf.js";import{g as Ut,i as Ia}from"../chunks/BAAbylyg.js";import{A as Ht,p as ja}from"../chunks/DodWDTE5.js";import{V as Ka}from"../chunks/By_Wtb5J.js";import{r as It,a as St,b as et,d as aa,c as Ua}from"../chunks/CRnhIQbv.js";import{b as ba,B as Je}from"../chunks/DQ5NTKSo.js";import{e as $t,f as xt,A as Va}from"../chunks/CdeYcEuU.js";import{T as ia,P as sa,C as oa,I as ea,S as Na,a as Vt,R as la,p as ua,b as qa}from"../chunks/0rsp5-Up.js";import{i as At}from"../chunks/vZ2iBqLE.js";import{T as Wa}from"../chunks/azUmHUDT.js";import{W as ca,G as Ba}from"../chunks/DQYNi3YK.js";import{g as Ha}from"../chunks/CqkleIqs.js";import{C as da}from"../chunks/BPXdu_FX.js";import{n as ta}from"../chunks/DC9z5DEo.js";import{e as He,r as Ya}from"../chunks/Bs4ovbtO.js";import{chatStore as Za}from"../chunks/BU2bHQbQ.js";import{A as Ja,a as Qa,b as Ga,c as Xa,d as $a,e as en,g as tn,v as an,w as nn}from"../chunks/BHue2Ock.js";import{a as fa}from"../chunks/Sk0ODu4Y.js";function rn(W,t,s){Da(()=>{var i=ma(()=>t(W,s?.())||{});if(i?.destroy)return()=>i.destroy()})}const sn=async({params:W,fetch:t})=>{const{repo:s,type:i,id:d}=W,S=await Pa(s,i,d);return{repo:s,type:i,id:d,entity:S}},gi=Object.freeze(Object.defineProperty({__proto__:null,load:sn},Symbol.toStringTag,{value:"Module"}));var on=I('<span class="chip svelte-84vb17"> <!></span>'),ln=I('<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>'),un=I('<div class="dropdown svelte-84vb17"></div>'),cn=I('<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 dn(W,t){it(t,!0);let s=Ve(t,"multi",3,!1),i=De(""),d=De(0),S;const P=Oe(()=>Ft.repos.flatMap(x=>x.entities.map(k=>({id:k.id,title:k.title,entityType:k.entityType,repo:x.name})))),g=Oe(()=>()=>{const x=e(i).toLowerCase().trim();return x?e(P).filter(k=>k.title.toLowerCase().includes(x)||k.id.toLowerCase().includes(x)).slice(0,20):e(P).slice(0,20)}),w=Array.isArray(t.value)?[...t.value]:t.value?[t.value]:[];let u=De(gt(w));ht(()=>{Ta().then(()=>S?.focus())});function z(x){s()?(e(u).includes(x)||_(u,[...e(u),x],!0),_(i,""),_(d,0),S?.focus()):t.onselect(x)}function j(x){_(u,e(u).filter(k=>k!==x),!0)}function A(){e(u).length===w.length&&e(u).every((k,a)=>k===w[a])?t.oncancel():t.onselect(e(u))}function K(x){const k=e(g)();x.key==="ArrowDown"?(x.preventDefault(),_(d,Math.min(e(d)+1,k.length-1),!0)):x.key==="ArrowUp"?(x.preventDefault(),_(d,Math.max(e(d)-1,0),!0)):x.key==="Enter"?(x.preventDefault(),k.length>0?z(k[e(d)].id):s()&&A()):x.key==="Escape"?s()&&e(u).length>0?A():t.oncancel():x.key==="Backspace"&&!e(i)&&s()&&e(u).length>0&&_(u,e(u).slice(0,-1),!0)}var Ae=cn(),L=y(Ae),fe=y(L);{var Re=x=>{var k=Ye(),a=Ce(k);We(a,17,()=>e(u),Ze,(n,l)=>{var b=on(),C=y(b),q=N(C);Je(q,{variant:"ghost",size:"icon",class:"chip-remove",onclick:()=>j(e(l)),children:(ke,Te)=>{Ne();var E=pt("×");p(ke,E)},$$slots:{default:!0}}),f(b),le(()=>ue(C,`${e(l)??""} `)),p(n,b)}),p(x,k)};be(fe,x=>{s()&&x(Re)})}var Q=N(fe,2);It(Q),Yt(Q,x=>S=x,()=>S),f(L);var B=N(L,2);{var Ee=x=>{var k=un();We(k,21,()=>e(g)(),Ze,(a,n,l)=>{var b=ln();let C;var q=y(b),ke=y(q,!0);f(q);var Te=N(q,2),E=y(Te),v=y(E,!0);f(E);var h=N(E,2),O=y(h,!0);f(h),f(Te),f(b),le(()=>{C=Ct(b,1,"dropdown-item svelte-84vb17",null,C,{highlighted:l===e(d)}),ue(ke,e(n).title),ue(v,e(n).entityType),ue(O,e(n).repo)}),Qe("mousedown",b,ne=>{ne.preventDefault(),z(e(n).id)}),_t("mouseenter",b,()=>_(d,l,!0)),p(a,b)}),f(k),p(x,k)},ce=Oe(()=>e(g)().length>0);be(B,x=>{e(ce)&&x(Ee)})}f(Ae),Qe("keydown",Q,K),_t("blur",Q,()=>{setTimeout(()=>{s()&&e(u).length>0?A():s()||t.oncancel()},150)}),ba(Q,()=>e(i),x=>_(i,x)),p(W,Ae),st()}na(["keydown","mousedown"]);var fn=rt("<title> </title>"),vn=rt('<svg><!><path d="M26,4h-4V2h-2v2h-8V2h-2v2H6C4.9,4,4,4.9,4,6v20c0,1.1,0.9,2,2,2h20c1.1,0,2-0.9,2-2V6C28,4.9,27.1,4,26,4z M26,26H6V12h20 V26z M26,10H6V6h4v2h2V6h8v2h2V6h4V10z"></path></svg>');function Nt(W,t){const s=nt(t,["children","$$slots","$$events","$$legacy"]),i=nt(s,["size","title"]);it(t,!1);const d=at(),S=at();let P=Ve(t,"size",8,16),g=Ve(t,"title",8,void 0);tt(()=>(qe(s),qe(g())),()=>{_(d,s["aria-label"]||s["aria-labelledby"]||g())}),tt(()=>(e(d),qe(s)),()=>{_(S,{"aria-hidden":e(d)?void 0:!0,role:e(d)?"img":void 0,focusable:Number(s.tabindex)===0?!0:void 0})}),Et(),At();var w=vn();St(w,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:P(),height:P(),...e(S),...i}));var u=y(w);{var z=j=>{var A=fn(),K=y(A,!0);f(A),le(()=>ue(K,g())),p(j,A)};be(u,j=>{g()&&j(z)})}Ne(),f(w),p(W,w),st()}var hn=rt("<title> </title>"),pn=rt('<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 qt(W,t){const s=nt(t,["children","$$slots","$$events","$$legacy"]),i=nt(s,["size","title"]);it(t,!1);const d=at(),S=at();let P=Ve(t,"size",8,16),g=Ve(t,"title",8,void 0);tt(()=>(qe(s),qe(g())),()=>{_(d,s["aria-label"]||s["aria-labelledby"]||g())}),tt(()=>(e(d),qe(s)),()=>{_(S,{"aria-hidden":e(d)?void 0:!0,role:e(d)?"img":void 0,focusable:Number(s.tabindex)===0?!0:void 0})}),Et(),At();var w=pn();St(w,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:P(),height:P(),...e(S),...i}));var u=y(w);{var z=j=>{var A=hn(),K=y(A,!0);f(A),le(()=>ue(K,g())),p(j,A)};be(u,j=>{g()&&j(z)})}Ne(2),f(w),p(W,w),st()}var _n=rt("<title> </title>"),gn=rt('<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 Wt(W,t){const s=nt(t,["children","$$slots","$$events","$$legacy"]),i=nt(s,["size","title"]);it(t,!1);const d=at(),S=at();let P=Ve(t,"size",8,16),g=Ve(t,"title",8,void 0);tt(()=>(qe(s),qe(g())),()=>{_(d,s["aria-label"]||s["aria-labelledby"]||g())}),tt(()=>(e(d),qe(s)),()=>{_(S,{"aria-hidden":e(d)?void 0:!0,role:e(d)?"img":void 0,focusable:Number(s.tabindex)===0?!0:void 0})}),Et(),At();var w=gn();St(w,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:P(),height:P(),...e(S),...i}));var u=y(w);{var z=j=>{var A=_n(),K=y(A,!0);f(A),le(()=>ue(K,g())),p(j,A)};be(u,j=>{g()&&j(z)})}Ne(2),f(w),p(W,w),st()}var mn=rt("<title> </title>"),yn=rt('<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 ka(W,t){const s=nt(t,["children","$$slots","$$events","$$legacy"]),i=nt(s,["size","title"]);it(t,!1);const d=at(),S=at();let P=Ve(t,"size",8,16),g=Ve(t,"title",8,void 0);tt(()=>(qe(s),qe(g())),()=>{_(d,s["aria-label"]||s["aria-labelledby"]||g())}),tt(()=>(e(d),qe(s)),()=>{_(S,{"aria-hidden":e(d)?void 0:!0,role:e(d)?"img":void 0,focusable:Number(s.tabindex)===0?!0:void 0})}),Et(),At();var w=yn();St(w,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:P(),height:P(),...e(S),...i}));var u=y(w);{var z=j=>{var A=mn(),K=y(A,!0);f(A),le(()=>ue(K,g())),p(j,A)};be(u,j=>{g()&&j(z)})}Ne(2),f(w),p(W,w),st()}var wn=rt("<title> </title>"),bn=rt('<svg><!><path d="M10 16 20 6 21.4 7.4 12.8 16 21.4 24.6 20 26z"></path></svg>');function kn(W,t){const s=nt(t,["children","$$slots","$$events","$$legacy"]),i=nt(s,["size","title"]);it(t,!1);const d=at(),S=at();let P=Ve(t,"size",8,16),g=Ve(t,"title",8,void 0);tt(()=>(qe(s),qe(g())),()=>{_(d,s["aria-label"]||s["aria-labelledby"]||g())}),tt(()=>(e(d),qe(s)),()=>{_(S,{"aria-hidden":e(d)?void 0:!0,role:e(d)?"img":void 0,focusable:Number(s.tabindex)===0?!0:void 0})}),Et(),At();var w=bn();St(w,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:P(),height:P(),...e(S),...i}));var u=y(w);{var z=j=>{var A=wn(),K=y(A,!0);f(A),le(()=>ue(K,g())),p(j,A)};be(u,j=>{g()&&j(z)})}Ne(),f(w),p(W,w),st()}var xn=I('<span class="ip-type-dot svelte-x7sio8"></span>'),Cn=I('<span class="ip-menu-check svelte-x7sio8"><!></span>'),En=I('<span class="ip-menu-item-icon svelte-x7sio8"><!></span> <span> </span> <!>',1),Sn=I('<span class="ip-menu-item-icon svelte-x7sio8"><!></span> <span>Remove</span>',1),An=I("<!> <!> <!>",1),Pn=I("<!> <!>",1),Rn=I('<input class="ip-edit-input svelte-x7sio8" type="text"/>'),Dn=I('<span class="ip-status-dot svelte-x7sio8"></span> ',1),Tn=I('<div class="ip-status-wrap svelte-x7sio8"><div class="ip-status-value svelte-x7sio8"><span class="ip-status-dot svelte-x7sio8"></span> <span class="ip-status-text svelte-x7sio8"> </span></div> <div class="ip-status-dropdown svelte-x7sio8"></div></div>'),zn=I('<span class="ip-cal-wd svelte-x7sio8"> </span>'),On=I('<div class="ip-cal-week svelte-x7sio8"></div>'),Ln=I('<div class="ip-cal-wrap svelte-x7sio8"><span class="ip-date-text svelte-x7sio8"> </span> <div class="ip-cal-dropdown svelte-x7sio8"><div class="ip-cal-header svelte-x7sio8"><!> <span class="ip-cal-title svelte-x7sio8"> </span> <!></div> <div class="ip-cal-weekdays svelte-x7sio8"></div> <!></div></div>'),Mn=I('<span class="ip-type-dot svelte-x7sio8"></span> <span> </span>',1),Fn=I('<span class="ip-menu-check svelte-x7sio8"><!></span>'),In=I('<span class="ip-type-dot svelte-x7sio8"></span> <span> </span> <!>',1),jn=I("<!> <!>",1),Kn=I('<span class="ip-etype-display svelte-x7sio8"> </span>'),Un=I('<span class="ip-badge svelte-x7sio8"> </span>'),Vn=I('<div class="ip-wikilink-group svelte-x7sio8"></div>'),Nn=I('<div class="ip-status-value svelte-x7sio8"><span class="ip-status-dot svelte-x7sio8"></span> <span class="ip-status-text svelte-x7sio8"> </span></div>'),qn=I('<span class="ip-date-text svelte-x7sio8"> </span>'),Wn=I('<a class="ip-url-link svelte-x7sio8" target="_blank" rel="noopener noreferrer"> </a>'),Bn=I('<span class="ip-text-value svelte-x7sio8"> </span>'),Hn=I('<div><div class="ip-icon svelte-x7sio8"><!></div> <div class="ip-key svelte-x7sio8"> </div> <div class="ip-value svelte-x7sio8"><!></div></div>'),Yn=I('<div class="ip-row ip-add-row svelte-x7sio8"><div class="ip-icon svelte-x7sio8"><!></div> <div class="ip-key svelte-x7sio8"><input class="ip-add-key-input svelte-x7sio8" type="text" placeholder="Field name"/></div> <div class="ip-value svelte-x7sio8"></div></div>'),Zn=I("<!> <span>Add field</span>",1),Jn=I('<div class="inline-properties svelte-x7sio8"><!> <!></div>');function Qn(W,t){it(t,!0);let s=Ve(t,"editable",3,!1),i=Ve(t,"autofocusKey",3,null),d=Ve(t,"protectedKeys",19,()=>new Set);const S=[{type:"text",label:"Text"},{type:"date",label:"Date"},{type:"status",label:"Status"},{type:"wikilink",label:"Link"}],P=["active","inactive","in-progress","completed","draft","archived","current","former","won","lost","open","closed"];let g=De(null),w=De(!1),u=De(!1);ht(()=>{i()&&!e(u)&&t.properties.some(c=>c.key===i())&&(_(u,!0),requestAnimationFrame(()=>{_(g,i())})),i()||_(u,!1)});let z=De(""),j=De(void 0);function A(c){return c.replace(/[_-]/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function K(c){switch(c.toLowerCase()){case"active":case"current":case"won":return"#3ecf8e";case"in-progress":case"open":return"#f0c246";case"inactive":case"lost":case"closed":case"former":return"#e54d4d";default:return"#5c5c66"}}function Ae(c){for(const r of Ft.repos){const T=r.entities.find(ie=>ie.id===c);if(T){Ut(`/${r.name}/${T.entityType}/${T.id}`);return}}}function L(c){return typeof c.value=="string"?c.value:c.value[0]}function fe(c){return/^https?:\/\//.test(c)}function Re(c){try{return new Date(c).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return c}}let Q=De(gt(new Date().getFullYear())),B=De(gt(new Date().getMonth()));const Ee=["Su","Mo","Tu","We","Th","Fr","Sa"],ce=["January","February","March","April","May","June","July","August","September","October","November","December"];function x(c,r){const T=new Date(c,r,1).getDay(),ie=new Date(c,r+1,0).getDate(),R=new Date(c,r,0).getDate(),ee=[];let X=[];for(let $=T-1;$>=0;$--){const pe=R-$,ae=r===0?11:r-1,Ie=r===0?c-1:c;X.push({day:pe,month:ae,year:Ie,outside:!0})}for(let $=1;$<=ie;$++)X.push({day:$,month:r,year:c,outside:!1}),X.length===7&&(ee.push(X),X=[]);if(X.length>0){const $=r===11?0:r+1,pe=r===11?c+1:c;let ae=1;for(;X.length<7;)X.push({day:ae++,month:$,year:pe,outside:!0});ee.push(X)}return ee}function k(c){const r=new Date;return c.day===r.getDate()&&c.month===r.getMonth()&&c.year===r.getFullYear()}function a(c,r){const T=r.slice(0,10).split("-");return c.year===+T[0]&&c.month===+T[1]-1&&c.day===+T[2]}function n(){e(B)===0?(_(B,11),Mt(Q,-1)):Mt(B,-1)}function l(){e(B)===11?(_(B,0),Mt(Q)):Mt(B)}function b(c){try{const r=c.slice(0,10).split("-");_(Q,+r[0]),_(B,+r[1]-1)}catch{const r=new Date;_(Q,r.getFullYear(),!0),_(B,r.getMonth(),!0)}}function C(c){requestAnimationFrame(()=>{c.focus(),c.select()})}function q(c){!s()||c.type==="badge"||c.type==="entity-type"||(c.type==="date"&&b(L(c)),_(g,c.key,!0))}function ke(c,r){t.onedit&&t.onedit(c,r),_(g,null)}function Te(c,r){const T=`${r.year}-${String(r.month+1).padStart(2,"0")}-${String(r.day).padStart(2,"0")}`;t.onedit&&t.onedit(c,T),_(g,null)}function E(c,r){t.ontypechange&&t.ontypechange(c,r)}function v(c){_(g,null),t.onremove&&t.onremove(c)}function h(){_(w,!0),_(z,""),requestAnimationFrame(()=>e(j)?.focus())}function O(){const c=e(z).trim();c&&t.onadd&&t.onadd(c,""),_(w,!1),_(z,"")}function ne(){_(w,!1),_(z,"")}function V(c){c.key==="Enter"?(c.preventDefault(),O()):c.key==="Escape"&&ne()}var H=Jn();_t("click",ya,()=>{_(g,null)});var m=y(H);We(m,17,()=>t.properties,c=>c.key,(c,r)=>{const T=Oe(()=>e(g)===e(r).key);var ie=Hn();let R;var ee=y(ie),X=y(ee);{var $=M=>{var J=xn();let F;le(_e=>F=et(J,"",F,_e),[()=>({background:$t(L(e(r)))})]),p(M,J)},pe=M=>{var J=Ye(),F=Ce(J);Ue(F,()=>la,(_e,Se)=>{Se(_e,{children:(he,Pe)=>{var Le=Pn(),ye=Ce(Le);Ue(ye,()=>ia,(Fe,Be)=>{Be(Fe,{class:"ip-icon-trigger",children:(te,G)=>{var ge=Ye(),xe=Ce(ge);{var ze=je=>{Nt(je,{size:14})},$e=je=>{qt(je,{size:14})},ot=je=>{Wt(je,{size:14})},ct=je=>{Vt(je,{size:14})};be(xe,je=>{e(r).type==="date"?je(ze):e(r).type==="status"?je($e,1):e(r).type==="wikilink"?je(ot,2):je(ct,!1)})}p(te,ge)},$$slots:{default:!0}})});var Me=N(ye,2);Ue(Me,()=>sa,(Fe,Be)=>{Be(Fe,{children:(te,G)=>{var ge=Ye(),xe=Ce(ge);Ue(xe,()=>oa,(ze,$e)=>{$e(ze,{class:"ip-menu-content",sideOffset:4,align:"start",children:(ot,ct)=>{var je=An(),Pt=Ce(je);We(Pt,17,()=>S,Ze,(lt,Ge)=>{var ut=Ye(),mt=Ce(ut);Ue(mt,()=>ea,(ft,vt)=>{vt(ft,{class:"ip-menu-item",onSelect:()=>E(e(r).key,e(Ge).type),children:(yt,Zt)=>{var wt=En(),Dt=Ce(wt),Jt=y(Dt);{var bt=Ke=>{Vt(Ke,{size:13})},jt=Ke=>{Nt(Ke,{size:13})},Qt=Ke=>{qt(Ke,{size:13})},Gt=Ke=>{Wt(Ke,{size:13})};be(Jt,Ke=>{e(Ge).type==="text"?Ke(bt):e(Ge).type==="date"?Ke(jt,1):e(Ge).type==="status"?Ke(Qt,2):e(Ge).type==="wikilink"&&Ke(Gt,3)})}f(Dt);var Tt=N(Dt,2),Xt=y(Tt,!0);f(Tt);var ra=N(Tt,2);{var Kt=Ke=>{var kt=Cn(),zt=y(kt);ca(zt,{size:12}),f(kt),p(Ke,kt)};be(ra,Ke=>{e(r).type===e(Ge).type&&Ke(Kt)})}le(()=>ue(Xt,e(Ge).label)),p(yt,wt)},$$slots:{default:!0}})}),p(lt,ut)});var dt=N(Pt,2);Ue(dt,()=>Na,(lt,Ge)=>{Ge(lt,{class:"ip-menu-sep"})});var Rt=N(dt,2);Ue(Rt,()=>ea,(lt,Ge)=>{Ge(lt,{class:"ip-menu-item ip-menu-destructive",onSelect:()=>v(e(r).key),children:(ut,mt)=>{var ft=Sn(),vt=Ce(ft),yt=y(vt);Wa(yt,{size:13}),f(vt),Ne(2),p(ut,ft)},$$slots:{default:!0}})}),p(ot,je)},$$slots:{default:!0}})}),p(te,ge)},$$slots:{default:!0}})}),p(he,Le)},$$slots:{default:!0}})}),p(M,J)},ae=Oe(()=>s()&&e(r).type!=="badge"&&!d().has(e(r).key)),Ie=M=>{var J=Ye(),F=Ce(J);{var _e=ye=>{Nt(ye,{size:14})},Se=ye=>{qt(ye,{size:14})},he=ye=>{Wt(ye,{size:14})},Pe=ye=>{ka(ye,{size:14})},Le=ye=>{Vt(ye,{size:14})};be(F,ye=>{e(r).type==="date"?ye(_e):e(r).type==="status"?ye(Se,1):e(r).type==="wikilink"?ye(he,2):e(r).type==="badge"?ye(Pe,3):ye(Le,!1)})}p(M,J)};be(X,M=>{e(r).type==="entity-type"?M($):e(ae)?M(pe,1):e(r).type!=="entity-type"&&M(Ie,2)})}f(ee);var o=N(ee,2),D=y(o,!0);f(o);var se=N(o,2),Z=y(se);{var me=M=>{var J=Rn();It(J),rn(J,F=>C?.(F)),le(F=>aa(J,F),[()=>L(e(r))]),_t("blur",J,F=>{const _e=F.currentTarget.value;_e!==L(e(r))&&t.onedit?.(e(r).key,_e),_(g,null)}),Qe("keydown",J,F=>{if(F.key==="Enter"){const _e=F.currentTarget.value;_e!==L(e(r))&&t.onedit?.(e(r).key,_e);const Se=i()===e(r).key;_(g,null),F.preventDefault(),Se&&t.onfocuseditor?.()}else F.key==="Escape"&&(F.currentTarget.value=L(e(r)),_(g,null))}),p(M,J)},we=M=>{var J=Tn(),F=y(J),_e=y(F);let Se;var he=N(_e,2),Pe=y(he,!0);f(he),f(F);var Le=N(F,2);We(Le,21,()=>P,Ze,(ye,Me)=>{{let Fe=Oe(()=>L(e(r))===e(Me)?"selected":"");Je(ye,{variant:"ghost",get class(){return`ip-status-option ${e(Fe)??""}`},onclick:()=>ke(e(r).key,e(Me)),children:(Be,te)=>{var G=Dn(),ge=Ce(G);let xe;var ze=N(ge);le($e=>{xe=et(ge,"",xe,$e),ue(ze,` ${e(Me)??""}`)},[()=>({background:K(e(Me))})]),p(Be,G)},$$slots:{default:!0}})}}),f(Le),f(J),le((ye,Me)=>{Se=et(_e,"",Se,ye),ue(Pe,Me)},[()=>({background:K(L(e(r)))}),()=>L(e(r))]),Qe("click",J,ye=>ye.stopPropagation()),p(M,J)},de=M=>{var J=Ln(),F=y(J),_e=y(F,!0);f(F);var Se=N(F,2),he=y(Se),Pe=y(he);Je(Pe,{variant:"ghost",size:"icon",class:"ip-cal-nav",onclick:n,children:(te,G)=>{kn(te,{size:14})},$$slots:{default:!0}});var Le=N(Pe,2),ye=y(Le);f(Le);var Me=N(Le,2);Je(Me,{variant:"ghost",size:"icon",class:"ip-cal-nav",onclick:l,children:(te,G)=>{Ba(te,{size:14})},$$slots:{default:!0}}),f(he);var Fe=N(he,2);We(Fe,21,()=>Ee,Ze,(te,G)=>{var ge=zn(),xe=y(ge,!0);f(ge),le(()=>ue(xe,e(G))),p(te,ge)}),f(Fe);var Be=N(Fe,2);We(Be,17,()=>x(e(Q),e(B)),Ze,(te,G)=>{var ge=On();We(ge,21,()=>e(G),Ze,(xe,ze)=>{{let $e=Oe(()=>e(ze).outside?"outside":""),ot=Oe(()=>k(e(ze))?"today":""),ct=Oe(()=>a(e(ze),L(e(r)))?"selected":"");Je(xe,{variant:"ghost",get class(){return`ip-cal-day ${e($e)??""} ${e(ot)??""} ${e(ct)??""}`},onclick:()=>Te(e(r).key,e(ze)),children:(je,Pt)=>{Ne();var dt=pt();le(()=>ue(dt,e(ze).day)),p(je,dt)},$$slots:{default:!0}})}}),f(ge),p(te,ge)}),f(Se),f(J),le(te=>{ue(_e,te),ue(ye,`${ce[e(B)]??""} ${e(Q)??""}`)},[()=>Re(L(e(r)))]),Qe("click",J,te=>te.stopPropagation()),p(M,J)},re=M=>{{let J=Oe(()=>Array.isArray(e(r).value));dn(M,{get value(){return e(r).value},get multi(){return e(J)},onselect:F=>{t.onedit?.(e(r).key,F),_(g,null)},oncancel:()=>{_(g,null)}})}},oe=M=>{var J=Ye(),F=Ce(J);{var _e=te=>{var G=Ye(),ge=Ce(G);Ue(ge,()=>la,(xe,ze)=>{ze(xe,{children:($e,ot)=>{var ct=jn(),je=Ce(ct);Ue(je,()=>ia,(dt,Rt)=>{Rt(dt,{class:"ip-etype-trigger",onclick:lt=>lt.stopPropagation(),children:(lt,Ge)=>{var ut=Mn(),mt=Ce(ut);let ft;var vt=N(mt,2),yt=y(vt,!0);f(vt),le((Zt,wt)=>{ft=et(mt,"",ft,Zt),ue(yt,wt)},[()=>({background:$t(L(e(r)))}),()=>xt(L(e(r)))]),p(lt,ut)},$$slots:{default:!0}})});var Pt=N(je,2);Ue(Pt,()=>sa,(dt,Rt)=>{Rt(dt,{children:(lt,Ge)=>{var ut=Ye(),mt=Ce(ut);Ue(mt,()=>oa,(ft,vt)=>{vt(ft,{class:"ip-menu-content ip-etype-content",sideOffset:4,align:"start",children:(yt,Zt)=>{var wt=Ye(),Dt=Ce(wt);We(Dt,17,()=>Va,Ze,(Jt,bt)=>{var jt=Ye(),Qt=Ce(jt);Ue(Qt,()=>ea,(Gt,Tt)=>{Tt(Gt,{class:"ip-menu-item",onSelect:()=>{e(bt)!==L(e(r))&&t.onentitytypechange?.(e(bt))},children:(Xt,ra)=>{var Kt=In(),Ke=Ce(Kt);let kt;var zt=N(Ke,2),xa=y(zt,!0);f(zt);var Ca=N(zt,2);{var Ea=Ot=>{var Lt=Fn(),Aa=y(Lt);ca(Aa,{size:12}),f(Lt),p(Ot,Lt)},Sa=Oe(()=>L(e(r))===e(bt));be(Ca,Ot=>{e(Sa)&&Ot(Ea)})}le((Ot,Lt)=>{kt=et(Ke,"",kt,Ot),ue(xa,Lt)},[()=>({background:$t(e(bt))}),()=>xt(e(bt))]),p(Xt,Kt)},$$slots:{default:!0}})}),p(Jt,jt)}),p(yt,wt)},$$slots:{default:!0}})}),p(lt,ut)},$$slots:{default:!0}})}),p($e,ct)},$$slots:{default:!0}})}),p(te,G)},Se=te=>{var G=Kn(),ge=y(G,!0);f(G),le(xe=>ue(ge,xe),[()=>xt(L(e(r)))]),p(te,G)},he=te=>{var G=Un(),ge=y(G,!0);f(G),le(xe=>ue(ge,xe),[()=>L(e(r))]),p(te,G)},Pe=te=>{var G=Vn();We(G,21,()=>Array.isArray(e(r).value)?e(r).value:[e(r).value],Ze,(ge,xe)=>{Je(ge,{variant:"ghost",class:"ip-wikilink-chip",onclick:ze=>{ze.stopPropagation(),Ae(e(xe))},children:(ze,$e)=>{Ne();var ot=pt();le(()=>ue(ot,e(xe))),p(ze,ot)},$$slots:{default:!0}})}),f(G),p(te,G)},Le=te=>{var G=Nn(),ge=y(G);let xe;var ze=N(ge,2),$e=y(ze,!0);f(ze),f(G),le((ot,ct)=>{xe=et(ge,"",xe,ot),ue($e,ct)},[()=>({background:K(L(e(r)))}),()=>L(e(r))]),p(te,G)},ye=te=>{var G=qn(),ge=y(G,!0);f(G),le(xe=>ue(ge,xe),[()=>Re(L(e(r)))]),p(te,G)},Me=te=>{var G=Wn(),ge=y(G,!0);f(G),le((xe,ze)=>{Ua(G,"href",xe),ue(ge,ze)},[()=>L(e(r)),()=>L(e(r))]),Qe("click",G,xe=>xe.stopPropagation()),p(te,G)},Fe=Oe(()=>fe(L(e(r)))),Be=te=>{var G=Bn(),ge=y(G,!0);f(G),le(xe=>ue(ge,xe),[()=>L(e(r))]),p(te,G)};be(F,te=>{e(r).type==="entity-type"&&s()?te(_e):e(r).type==="entity-type"?te(Se,1):e(r).type==="badge"?te(he,2):e(r).type==="wikilink"?te(Pe,3):e(r).type==="status"?te(Le,4):e(r).type==="date"?te(ye,5):e(Fe)?te(Me,6):te(Be,!1)})}p(M,J)};be(Z,M=>{e(T)&&e(r).type==="text"?M(me):e(T)&&e(r).type==="status"?M(we,1):e(T)&&e(r).type==="date"?M(de,2):e(T)&&e(r).type==="wikilink"?M(re,3):M(oe,!1)})}f(se),f(ie),le(M=>{R=Ct(ie,1,"ip-row svelte-x7sio8",null,R,{"ip-focused":e(T)}),ue(D,M)},[()=>A(e(r).key)]),Qe("click",ee,M=>M.stopPropagation()),Qe("click",se,M=>{M.stopPropagation(),q(e(r))}),p(c,ie)});var U=N(m,2);{var ve=c=>{var r=Yn(),T=y(r),ie=y(T);Ht(ie,{size:14}),f(T);var R=N(T,2),ee=y(R);It(ee),Yt(ee,X=>_(j,X),()=>e(j)),f(R),Ne(2),f(r),Qe("keydown",ee,V),_t("blur",ee,ne),ba(ee,()=>e(z),X=>_(z,X)),p(c,r)},Y=c=>{Je(c,{variant:"ghost",class:"ip-add-btn",onclick:r=>{r.stopPropagation(),h()},children:(r,T)=>{var ie=Zn(),R=Ce(ie);Ht(R,{size:14}),Ne(2),p(r,ie)},$$slots:{default:!0}})};be(U,c=>{e(w)?c(ve):s()&&c(Y,1)})}f(H),p(W,H),st()}na(["click","keydown"]);var Gn=I('<div class="remote-cursor svelte-ok7wy5"><span class="remote-cursor-label svelte-ok7wy5"> </span></div>'),Xn=I('<div class="cursor-overlay svelte-ok7wy5"></div>'),$n=I('<div class="editor-wrap svelte-ok7wy5"><div class="cm-container svelte-ok7wy5"></div> <!></div>');function er(W,t){it(t,!0);let s=Ve(t,"readonly",3,!0),i=Ve(t,"resetKey",3,0);const d=za("theme");let S,P=null,g=null,w=De(""),u=null,z=De(gt([])),j=null,A=t.content;function K(B,Ee){return B.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:Ee?"rgba(110,110,232,0.2)":"rgba(110,110,232,0.15)"},"&.cm-focused .cm-selectionBackground":{backgroundColor:Ee?"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:Ee})}async function Ae(){P&&(P.destroy(),P=null),g&&(g.destroy(),g=null),_(z,[],!0);const{EditorState:B,Transaction:Ee}=await Xe(async()=>{const{EditorState:m,Transaction:U}=await import("../chunks/CX_61fY8.js");return{EditorState:m,Transaction:U}},[],import.meta.url);u=Ee;const{EditorView:ce,keymap:x,ViewPlugin:k}=await Xe(async()=>{const{EditorView:m,keymap:U,ViewPlugin:ve}=await import("../chunks/DnL9f0lc.js").then(Y=>Y.i);return{EditorView:m,keymap:U,ViewPlugin:ve}},__vite__mapDeps([0,1]),import.meta.url),{markdown:a}=await Xe(async()=>{const{markdown:m}=await import("../chunks/CscoF-YL.js");return{markdown:m}},__vite__mapDeps([2,1,0,3,4,5]),import.meta.url),{syntaxHighlighting:n,HighlightStyle:l}=await Xe(async()=>{const{syntaxHighlighting:m,HighlightStyle:U}=await import("../chunks/D7ZqAKi9.js");return{syntaxHighlighting:m,HighlightStyle:U}},__vite__mapDeps([3,4,1,0]),import.meta.url),{history:b,defaultKeymap:C,historyKeymap:q}=await Xe(async()=>{const{history:m,defaultKeymap:U,historyKeymap:ve}=await import("../chunks/CWQRQXxy.js");return{history:m,defaultKeymap:U,historyKeymap:ve}},__vite__mapDeps([6,1,0,3,4]),import.meta.url),{tags:ke}=await Xe(async()=>{const{tags:m}=await import("../chunks/C7VoTosa.js").then(U=>U.i);return{tags:m}},[],import.meta.url),{livePreviewPlugin:Te,livePreviewTheme:E}=await Xe(async()=>{const{livePreviewPlugin:m,livePreviewTheme:U}=await import("../chunks/B340SUKR.js");return{livePreviewPlugin:m,livePreviewTheme:U}},__vite__mapDeps([7,0,1,3,4]),import.meta.url),v=d.current==="dark",h=K(ce,v),O=l.define([{tag:ke.processingInstruction,color:"var(--color-text-tertiary)",opacity:"0.7"}]),ne=[a(),h,n(O),Te,E,ce.lineWrapping];s()&&ne.push(B.readOnly.of(!0));let V=!1;if(t.cursorDocName&&!s())try{let o=function(){if(!P||!R){_(z,[],!0);return}const Z=R.awareness,me=R.ytext,we=me.doc;if(!we){_(z,[],!0);return}const de=[],re=P.dom.getBoundingClientRect();Z.getStates().forEach((oe,M)=>{if(M===Ie)return;const J=oe.cursor;if(!J?.head)return;const{name:F="Anonymous",color:_e="#e05050"}=oe.user||{};let Se;try{Se=T.createRelativePositionFromJSON(J.head)}catch{return}const he=T.createAbsolutePositionFromRelativePosition(Se,we);if(!he||he.type!==me)return;const Pe=P.coordsAtPos(Math.min(he.index,P.state.doc.length));Pe&&de.push({id:M,name:F,color:_e,top:Pe.top-re.top,left:Pe.left-re.left,height:Pe.bottom-Pe.top})}),_(z,de,!0)},D=function(){j&&cancelAnimationFrame(j),j=requestAnimationFrame(()=>{j=null,o()})},se=function({added:Z,updated:me,removed:we}){[...Z,...me,...we].some(re=>re!==Ie)&&D()};const{createCollabSession:m}=await Xe(async()=>{const{createCollabSession:Z}=await import("../chunks/DQJwHeKh.js");return{createCollabSession:Z}},__vite__mapDeps([8,9,10,11,12,13,14,15,16,17,18]),import.meta.url),{ySync:U,ySyncFacet:ve,YSyncConfig:Y,yUndoManagerKeymap:c}=await Xe(async()=>{const{ySync:Z,ySyncFacet:me,YSyncConfig:we,yUndoManagerKeymap:de}=await import("../chunks/i9c_RUF6.js");return{ySync:Z,ySyncFacet:me,YSyncConfig:we,yUndoManagerKeymap:de}},__vite__mapDeps([19,9,0,1]),import.meta.url),{auth:r}=await Xe(async()=>{const{auth:Z}=await import("../chunks/Sk0ODu4Y.js").then(me=>me.b);return{auth:Z}},__vite__mapDeps([16,12,15]),import.meta.url),T=await Xe(()=>import("../chunks/CLFba8FK.js").then(Z=>Z.A),[],import.meta.url),ie=getComputedStyle(document.documentElement).getPropertyValue("--color-accent").trim()||"#e05050",R=m(t.cursorDocName,{name:r.user?.displayName??"Anonymous",color:ie,colorLight:ie+"33"}),ee=new T.UndoManager(R.ytext,{captureTimeout:500}),{yUndoManagerFacet:X,yUndoManager:$,YUndoManagerConfig:pe}=await Xe(async()=>{const{yUndoManagerFacet:Z,yUndoManager:me,YUndoManagerConfig:we}=await import("../chunks/i9c_RUF6.js");return{yUndoManagerFacet:Z,yUndoManager:me,YUndoManagerConfig:we}},__vite__mapDeps([19,9,0,1]),import.meta.url),ae=new Y(R.ytext,R.awareness);ne.push(ve.of(ae),U,X.of(new pe(ee)),$,x.of(c)),ne.push(k.define(Z=>{function me(){const we=Z.state.selection.main,de=R.ytext,re=T.createRelativePositionFromTypeIndex(de,we.anchor),oe=T.createRelativePositionFromTypeIndex(de,we.head);R.awareness.setLocalStateField("cursor",{anchor:T.relativePositionToJSON(re),head:T.relativePositionToJSON(oe)})}return me(),{update(we){(we.selectionSet||we.docChanged)&&me()}}}));const Ie=R.ydoc.clientID;R.awareness.on("change",se),ne.push(k.define(()=>({update(Z){(Z.docChanged||Z.geometryChanged||Z.viewportChanged)&&D()},destroy(){R.awareness.off("change",se)}}))),g=R,V=!0}catch(m){console.warn("Yjs collab setup failed, falling back to solo editing:",m)}if(!s()&&!V?(ne.push(b({newGroupDelay:500})),ne.push(x.of([...C,...q]))):!s()&&V&&ne.push(x.of(C)),t.onchange)if(V){const m=Date.now();ne.push(ce.updateListener.of(U=>{if(U.docChanged&&Date.now()-m>1e3&&U.transactions.some(Y=>Y.isUserEvent("input")||Y.isUserEvent("delete")||Y.isUserEvent("move")||Y.isUserEvent("undo")||Y.isUserEvent("redo"))){const Y=U.state.doc.toString();A=Y,t.onchange(Y)}}))}else ne.push(ce.updateListener.of(m=>{if(m.docChanged){const U=m.state.doc.toString();A=U,t.onchange(U)}}));ne.push(ce.domEventHandlers({click(m){const U=m.target;if(t.onwikilinkclick){const Y=U.closest(".cm-live-wikilink");if(Y){m.preventDefault();const c=Y.textContent?.replace(/^\[{1,2}|\]{1,2}$/g,"").trim();return c&&t.onwikilinkclick(c),!0}}const ve=U.closest(".cm-live-link");if(ve){const Y=ve.getAttribute("data-href");if(Y)return m.preventDefault(),window.open(Y,"_blank","noopener,noreferrer"),!0}return!1}})),t.onsave&&ne.push(x.of([{key:"Mod-s",run:()=>(t.onsave(),!0)}]));const H=B.create({doc:V?"":t.content,extensions:ne});P=new ce({state:H,parent:S}),A=V?"":t.content,_(w,t.cursorDocName??"",!0)}Oa(()=>{Ae()}),ht(()=>{t.cursorDocName&&e(w)&&t.cursorDocName!==e(w)&&Ae()}),ht(()=>{if(i(),P&&!g&&t.content!==A){A=t.content;const B=S.closest(".document-scroll"),Ee=B?.scrollTop??0;P.dispatch({changes:{from:0,to:P.state.doc.length,insert:t.content},...u?{annotations:u.addToHistory.of(!1)}:{}}),B&&requestAnimationFrame(()=>{B.scrollTop=Ee})}}),wa(()=>{j&&cancelAnimationFrame(j),g?.destroy(),g=null,P?.destroy()});var L=$n(),fe=y(L);Yt(fe,B=>S=B,()=>S);var Re=N(fe,2);{var Q=B=>{var Ee=Xn();We(Ee,21,()=>e(z),ce=>ce.id,(ce,x)=>{var k=Gn(),a=y(k),n=y(a,!0);f(a),f(k),le(()=>{et(k,`top: ${e(x).top??""}px; left: ${e(x).left??""}px; height: ${e(x).height??""}px; --cursor-color: ${e(x).color??""};`),et(a,`background-color: ${e(x).color??""};`),ue(n,e(x).name)}),p(ce,k)}),f(Ee),p(B,Ee)};be(Re,B=>{e(z).length>0&&B(Q)})}f(L),p(W,L),st()}var Bt={exports:{}};var tr=Bt.exports,va;function ar(){return va||(va=1,(function(W,t){((s,i)=>{W.exports=i()})(tr,function s(){var i=typeof self<"u"?self:typeof window<"u"?window:i!==void 0?i:{},d,S=!i.document&&!!i.postMessage,P=i.IS_PAPA_WORKER||!1,g={},w=0,u={};function z(a){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(n){var l=ce(n);l.chunkSize=parseInt(l.chunkSize),n.step||n.chunk||(l.chunkSize=null),this._handle=new L(l),(this._handle.streamer=this)._config=l}).call(this,a),this.parseChunk=function(n,l){var b=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<b){let q=this._config.newline;q||(C=this._config.quoteChar||'"',q=this._handle.guessLineEndings(n,C)),n=[...n.split(q).slice(b)].join(q)}this.isFirstChunk&&k(this._config.beforeFirstChunk)&&(C=this._config.beforeFirstChunk(n))!==void 0&&(n=C),this.isFirstChunk=!1,this._halted=!1;var b=this._partialLine+n,C=(this._partialLine="",this._handle.parse(b,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(n=C.meta.cursor,b=(this._finished||(this._partialLine=b.substring(n-this._baseIndex),this._baseIndex=n),C&&C.data&&(this._rowCount+=C.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),P)i.postMessage({results:C,workerId:u.WORKER_ID,finished:b});else if(k(this._config.chunk)&&!l){if(this._config.chunk(C,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=C=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(C.data),this._completeResults.errors=this._completeResults.errors.concat(C.errors),this._completeResults.meta=C.meta),this._completed||!b||!k(this._config.complete)||C&&C.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),b||C&&C.meta.paused||this._nextChunk(),C}this._halted=!0},this._sendError=function(n){k(this._config.error)?this._config.error(n):P&&this._config.error&&i.postMessage({workerId:u.WORKER_ID,error:n,finished:!1})}}function j(a){var n;(a=a||{}).chunkSize||(a.chunkSize=u.RemoteChunkSize),z.call(this,a),this._nextChunk=S?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(l){this._input=l,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(n=new XMLHttpRequest,this._config.withCredentials&&(n.withCredentials=this._config.withCredentials),S||(n.onload=x(this._chunkLoaded,this),n.onerror=x(this._chunkError,this)),n.open(this._config.downloadRequestBody?"POST":"GET",this._input,!S),this._config.downloadRequestHeaders){var l,b=this._config.downloadRequestHeaders;for(l in b)n.setRequestHeader(l,b[l])}var C;this._config.chunkSize&&(C=this._start+this._config.chunkSize-1,n.setRequestHeader("Range","bytes="+this._start+"-"+C));try{n.send(this._config.downloadRequestBody)}catch(q){this._chunkError(q.message)}S&&n.status===0&&this._chunkError()}},this._chunkLoaded=function(){n.readyState===4&&(n.status<200||400<=n.status?this._chunkError():(this._start+=this._config.chunkSize||n.responseText.length,this._finished=!this._config.chunkSize||this._start>=(l=>(l=l.getResponseHeader("Content-Range"))!==null?parseInt(l.substring(l.lastIndexOf("/")+1)):-1)(n),this.parseChunk(n.responseText)))},this._chunkError=function(l){l=n.statusText||l,this._sendError(new Error(l))}}function A(a){(a=a||{}).chunkSize||(a.chunkSize=u.LocalChunkSize),z.call(this,a);var n,l,b=typeof FileReader<"u";this.stream=function(C){this._input=C,l=C.slice||C.webkitSlice||C.mozSlice,b?((n=new FileReader).onload=x(this._chunkLoaded,this),n.onerror=x(this._chunkError,this)):n=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var C=this._input,q=(this._config.chunkSize&&(q=Math.min(this._start+this._config.chunkSize,this._input.size),C=l.call(C,this._start,q)),n.readAsText(C,this._config.encoding));b||this._chunkLoaded({target:{result:q}})},this._chunkLoaded=function(C){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(C.target.result)},this._chunkError=function(){this._sendError(n.error)}}function K(a){var n;z.call(this,a=a||{}),this.stream=function(l){return n=l,this._nextChunk()},this._nextChunk=function(){var l,b;if(!this._finished)return l=this._config.chunkSize,n=l?(b=n.substring(0,l),n.substring(l)):(b=n,""),this._finished=!n,this.parseChunk(b)}}function Ae(a){z.call(this,a=a||{});var n=[],l=!0,b=!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(C){this._input=C,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){b&&n.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),n.length?this.parseChunk(n.shift()):l=!0},this._streamData=x(function(C){try{n.push(typeof C=="string"?C:C.toString(this._config.encoding)),l&&(l=!1,this._checkIsFinished(),this.parseChunk(n.shift()))}catch(q){this._streamError(q)}},this),this._streamError=x(function(C){this._streamCleanUp(),this._sendError(C)},this),this._streamEnd=x(function(){this._streamCleanUp(),b=!0,this._streamData("")},this),this._streamCleanUp=x(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function L(a){var n,l,b,C,q=Math.pow(2,53),ke=-q,Te=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,E=/^((\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)))$/,v=this,h=0,O=0,ne=!1,V=!1,H=[],m={data:[],errors:[],meta:{}};function U(r){return a.skipEmptyLines==="greedy"?r.join("").trim()==="":r.length===1&&r[0].length===0}function ve(){if(m&&b&&(c("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+u.DefaultDelimiter+"'"),b=!1),a.skipEmptyLines&&(m.data=m.data.filter(function(R){return!U(R)})),Y()){let R=function(ee,X){k(a.transformHeader)&&(ee=a.transformHeader(ee,X)),H.push(ee)};if(m)if(Array.isArray(m.data[0])){for(var r=0;Y()&&r<m.data.length;r++)m.data[r].forEach(R);m.data.splice(0,1)}else m.data.forEach(R)}function T(R,ee){for(var X=a.header?{}:[],$=0;$<R.length;$++){var pe=$,ae=R[$],ae=((Ie,o)=>(D=>(a.dynamicTypingFunction&&a.dynamicTyping[D]===void 0&&(a.dynamicTyping[D]=a.dynamicTypingFunction(D)),(a.dynamicTyping[D]||a.dynamicTyping)===!0))(Ie)?o==="true"||o==="TRUE"||o!=="false"&&o!=="FALSE"&&((D=>{if(Te.test(D)&&(D=parseFloat(D),ke<D&&D<q))return 1})(o)?parseFloat(o):E.test(o)?new Date(o):o===""?null:o):o)(pe=a.header?$>=H.length?"__parsed_extra":H[$]:pe,ae=a.transform?a.transform(ae,pe):ae);pe==="__parsed_extra"?(X[pe]=X[pe]||[],X[pe].push(ae)):X[pe]=ae}return a.header&&($>H.length?c("FieldMismatch","TooManyFields","Too many fields: expected "+H.length+" fields but parsed "+$,O+ee):$<H.length&&c("FieldMismatch","TooFewFields","Too few fields: expected "+H.length+" fields but parsed "+$,O+ee)),X}var ie;m&&(a.header||a.dynamicTyping||a.transform)&&(ie=1,!m.data.length||Array.isArray(m.data[0])?(m.data=m.data.map(T),ie=m.data.length):m.data=T(m.data,0),a.header&&m.meta&&(m.meta.fields=H),O+=ie)}function Y(){return a.header&&H.length===0}function c(r,T,ie,R){r={type:r,code:T,message:ie},R!==void 0&&(r.row=R),m.errors.push(r)}k(a.step)&&(C=a.step,a.step=function(r){m=r,Y()?ve():(ve(),m.data.length!==0&&(h+=r.data.length,a.preview&&h>a.preview?l.abort():(m.data=m.data[0],C(m,v))))}),this.parse=function(r,T,ie){var R=a.quoteChar||'"',R=(a.newline||(a.newline=this.guessLineEndings(r,R)),b=!1,a.delimiter?k(a.delimiter)&&(a.delimiter=a.delimiter(r),m.meta.delimiter=a.delimiter):((R=((ee,X,$,pe,ae)=>{var Ie,o,D,se;ae=ae||[","," ","|",";",u.RECORD_SEP,u.UNIT_SEP];for(var Z=0;Z<ae.length;Z++){for(var me,we=ae[Z],de=0,re=0,oe=0,M=(D=void 0,new Re({comments:pe,delimiter:we,newline:X,preview:10}).parse(ee)),J=0;J<M.data.length;J++)$&&U(M.data[J])?oe++:(me=M.data[J].length,re+=me,D===void 0?D=me:0<me&&(de+=Math.abs(me-D),D=me));0<M.data.length&&(re/=M.data.length-oe),(o===void 0||de<=o)&&(se===void 0||se<re)&&1.99<re&&(o=de,Ie=we,se=re)}return{successful:!!(a.delimiter=Ie),bestDelimiter:Ie}})(r,a.newline,a.skipEmptyLines,a.comments,a.delimitersToGuess)).successful?a.delimiter=R.bestDelimiter:(b=!0,a.delimiter=u.DefaultDelimiter),m.meta.delimiter=a.delimiter),ce(a));return a.preview&&a.header&&R.preview++,n=r,l=new Re(R),m=l.parse(n,T,ie),ve(),ne?{meta:{paused:!0}}:m||{meta:{paused:!1}}},this.paused=function(){return ne},this.pause=function(){ne=!0,l.abort(),n=k(a.chunk)?"":n.substring(l.getCharIndex())},this.resume=function(){v.streamer._halted?(ne=!1,v.streamer.parseChunk(n,!0)):setTimeout(v.resume,3)},this.aborted=function(){return V},this.abort=function(){V=!0,l.abort(),m.meta.aborted=!0,k(a.complete)&&a.complete(m),n=""},this.guessLineEndings=function(ee,R){ee=ee.substring(0,1048576);var R=new RegExp(fe(R)+"([^]*?)"+fe(R),"gm"),ie=(ee=ee.replace(R,"")).split("\r"),R=ee.split(`
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/BDTSG9D-.js","../chunks/CLFba8FK.js","../chunks/BfEy5AjR.js","../chunks/PPVm8Dsz.js","../chunks/DSh-OF2y.js","../chunks/C0v9FrTH.js","../chunks/Cc0c675R.js","../chunks/CFtRXHDP.js","../chunks/Sk0ODu4Y.js","../chunks/HVmKTSmh.js","../chunks/b0XUoOIH.js","../chunks/i9c_RUF6.js"])))=>i.map(i=>d[i]);
2
+ import{h as Pa,w as Ft,k as Ra}from"../chunks/Cc0c675R.js";import{_ as Xe}from"../chunks/PPVm8Dsz.js";import{d as na,e as Qe,g as _t,a as p,c as Ye,t as pt,s as ue,b as I,f as rt}from"../chunks/b0XUoOIH.js";import{aA as Da,a7 as ma,p as it,e as De,f as gt,a2 as ht,aE as Ta,c as y,a3 as N,r as f,g as e,s as _,b as st,a0 as Ce,n as Ne,t as le,a4 as Oe,l as tt,d as qe,a as Et,m as at,bt as ya,aw as Mt,a1 as za,aD as Oa,aF as wa}from"../chunks/DSh-OF2y.js";import{i as be,b as Yt}from"../chunks/DT3KtxWU.js";import{e as We,i as Ze}from"../chunks/DHtLlmE0.js";import{c as Ue}from"../chunks/DCVmM0L5.js";import{s as Ct,c as La}from"../chunks/CFtRXHDP.js";import{p as Ve,l as nt,a as Ma,b as Fa}from"../chunks/D-yNNNdf.js";import{g as Ut,i as Ia}from"../chunks/C0v9FrTH.js";import{A as Ht,p as ja}from"../chunks/B-PHzYeY.js";import{V as Ka}from"../chunks/BR3Oh1Lv.js";import{r as It,a as St,b as et,d as aa,c as Ua}from"../chunks/CRnhIQbv.js";import{b as ba,B as Je}from"../chunks/DQ5NTKSo.js";import{e as $t,f as xt,A as Va}from"../chunks/CdeYcEuU.js";import{T as ia,P as sa,C as oa,I as ea,S as Na,a as Vt,R as la,p as ua,b as qa}from"../chunks/Bolw6cIp.js";import{i as At}from"../chunks/vZ2iBqLE.js";import{T as Wa}from"../chunks/azUmHUDT.js";import{W as ca,G as Ba}from"../chunks/DQYNi3YK.js";import{g as Ha}from"../chunks/CqkleIqs.js";import{C as da}from"../chunks/BPXdu_FX.js";import{n as ta}from"../chunks/HVmKTSmh.js";import{e as He,r as Ya}from"../chunks/BfEy5AjR.js";import{chatStore as Za}from"../chunks/DNldxAbC.js";import{A as Ja,a as Qa,b as Ga,c as Xa,d as $a,e as en,g as tn,v as an,w as nn}from"../chunks/BHue2Ock.js";import{a as fa}from"../chunks/Sk0ODu4Y.js";function rn(W,t,s){Da(()=>{var i=ma(()=>t(W,s?.())||{});if(i?.destroy)return()=>i.destroy()})}const sn=async({params:W,fetch:t})=>{const{repo:s,type:i,id:d}=W,S=await Pa(s,i,d);return{repo:s,type:i,id:d,entity:S}},gi=Object.freeze(Object.defineProperty({__proto__:null,load:sn},Symbol.toStringTag,{value:"Module"}));var on=I('<span class="chip svelte-84vb17"> <!></span>'),ln=I('<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>'),un=I('<div class="dropdown svelte-84vb17"></div>'),cn=I('<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 dn(W,t){it(t,!0);let s=Ve(t,"multi",3,!1),i=De(""),d=De(0),S;const P=Oe(()=>Ft.repos.flatMap(x=>x.entities.map(k=>({id:k.id,title:k.title,entityType:k.entityType,repo:x.name})))),g=Oe(()=>()=>{const x=e(i).toLowerCase().trim();return x?e(P).filter(k=>k.title.toLowerCase().includes(x)||k.id.toLowerCase().includes(x)).slice(0,20):e(P).slice(0,20)}),w=Array.isArray(t.value)?[...t.value]:t.value?[t.value]:[];let u=De(gt(w));ht(()=>{Ta().then(()=>S?.focus())});function z(x){s()?(e(u).includes(x)||_(u,[...e(u),x],!0),_(i,""),_(d,0),S?.focus()):t.onselect(x)}function j(x){_(u,e(u).filter(k=>k!==x),!0)}function A(){e(u).length===w.length&&e(u).every((k,a)=>k===w[a])?t.oncancel():t.onselect(e(u))}function K(x){const k=e(g)();x.key==="ArrowDown"?(x.preventDefault(),_(d,Math.min(e(d)+1,k.length-1),!0)):x.key==="ArrowUp"?(x.preventDefault(),_(d,Math.max(e(d)-1,0),!0)):x.key==="Enter"?(x.preventDefault(),k.length>0?z(k[e(d)].id):s()&&A()):x.key==="Escape"?s()&&e(u).length>0?A():t.oncancel():x.key==="Backspace"&&!e(i)&&s()&&e(u).length>0&&_(u,e(u).slice(0,-1),!0)}var Ae=cn(),L=y(Ae),fe=y(L);{var Re=x=>{var k=Ye(),a=Ce(k);We(a,17,()=>e(u),Ze,(n,l)=>{var b=on(),C=y(b),q=N(C);Je(q,{variant:"ghost",size:"icon",class:"chip-remove",onclick:()=>j(e(l)),children:(ke,Te)=>{Ne();var E=pt("×");p(ke,E)},$$slots:{default:!0}}),f(b),le(()=>ue(C,`${e(l)??""} `)),p(n,b)}),p(x,k)};be(fe,x=>{s()&&x(Re)})}var Q=N(fe,2);It(Q),Yt(Q,x=>S=x,()=>S),f(L);var B=N(L,2);{var Ee=x=>{var k=un();We(k,21,()=>e(g)(),Ze,(a,n,l)=>{var b=ln();let C;var q=y(b),ke=y(q,!0);f(q);var Te=N(q,2),E=y(Te),v=y(E,!0);f(E);var h=N(E,2),O=y(h,!0);f(h),f(Te),f(b),le(()=>{C=Ct(b,1,"dropdown-item svelte-84vb17",null,C,{highlighted:l===e(d)}),ue(ke,e(n).title),ue(v,e(n).entityType),ue(O,e(n).repo)}),Qe("mousedown",b,ne=>{ne.preventDefault(),z(e(n).id)}),_t("mouseenter",b,()=>_(d,l,!0)),p(a,b)}),f(k),p(x,k)},ce=Oe(()=>e(g)().length>0);be(B,x=>{e(ce)&&x(Ee)})}f(Ae),Qe("keydown",Q,K),_t("blur",Q,()=>{setTimeout(()=>{s()&&e(u).length>0?A():s()||t.oncancel()},150)}),ba(Q,()=>e(i),x=>_(i,x)),p(W,Ae),st()}na(["keydown","mousedown"]);var fn=rt("<title> </title>"),vn=rt('<svg><!><path d="M26,4h-4V2h-2v2h-8V2h-2v2H6C4.9,4,4,4.9,4,6v20c0,1.1,0.9,2,2,2h20c1.1,0,2-0.9,2-2V6C28,4.9,27.1,4,26,4z M26,26H6V12h20 V26z M26,10H6V6h4v2h2V6h8v2h2V6h4V10z"></path></svg>');function Nt(W,t){const s=nt(t,["children","$$slots","$$events","$$legacy"]),i=nt(s,["size","title"]);it(t,!1);const d=at(),S=at();let P=Ve(t,"size",8,16),g=Ve(t,"title",8,void 0);tt(()=>(qe(s),qe(g())),()=>{_(d,s["aria-label"]||s["aria-labelledby"]||g())}),tt(()=>(e(d),qe(s)),()=>{_(S,{"aria-hidden":e(d)?void 0:!0,role:e(d)?"img":void 0,focusable:Number(s.tabindex)===0?!0:void 0})}),Et(),At();var w=vn();St(w,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:P(),height:P(),...e(S),...i}));var u=y(w);{var z=j=>{var A=fn(),K=y(A,!0);f(A),le(()=>ue(K,g())),p(j,A)};be(u,j=>{g()&&j(z)})}Ne(),f(w),p(W,w),st()}var hn=rt("<title> </title>"),pn=rt('<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 qt(W,t){const s=nt(t,["children","$$slots","$$events","$$legacy"]),i=nt(s,["size","title"]);it(t,!1);const d=at(),S=at();let P=Ve(t,"size",8,16),g=Ve(t,"title",8,void 0);tt(()=>(qe(s),qe(g())),()=>{_(d,s["aria-label"]||s["aria-labelledby"]||g())}),tt(()=>(e(d),qe(s)),()=>{_(S,{"aria-hidden":e(d)?void 0:!0,role:e(d)?"img":void 0,focusable:Number(s.tabindex)===0?!0:void 0})}),Et(),At();var w=pn();St(w,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:P(),height:P(),...e(S),...i}));var u=y(w);{var z=j=>{var A=hn(),K=y(A,!0);f(A),le(()=>ue(K,g())),p(j,A)};be(u,j=>{g()&&j(z)})}Ne(2),f(w),p(W,w),st()}var _n=rt("<title> </title>"),gn=rt('<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 Wt(W,t){const s=nt(t,["children","$$slots","$$events","$$legacy"]),i=nt(s,["size","title"]);it(t,!1);const d=at(),S=at();let P=Ve(t,"size",8,16),g=Ve(t,"title",8,void 0);tt(()=>(qe(s),qe(g())),()=>{_(d,s["aria-label"]||s["aria-labelledby"]||g())}),tt(()=>(e(d),qe(s)),()=>{_(S,{"aria-hidden":e(d)?void 0:!0,role:e(d)?"img":void 0,focusable:Number(s.tabindex)===0?!0:void 0})}),Et(),At();var w=gn();St(w,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:P(),height:P(),...e(S),...i}));var u=y(w);{var z=j=>{var A=_n(),K=y(A,!0);f(A),le(()=>ue(K,g())),p(j,A)};be(u,j=>{g()&&j(z)})}Ne(2),f(w),p(W,w),st()}var mn=rt("<title> </title>"),yn=rt('<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 ka(W,t){const s=nt(t,["children","$$slots","$$events","$$legacy"]),i=nt(s,["size","title"]);it(t,!1);const d=at(),S=at();let P=Ve(t,"size",8,16),g=Ve(t,"title",8,void 0);tt(()=>(qe(s),qe(g())),()=>{_(d,s["aria-label"]||s["aria-labelledby"]||g())}),tt(()=>(e(d),qe(s)),()=>{_(S,{"aria-hidden":e(d)?void 0:!0,role:e(d)?"img":void 0,focusable:Number(s.tabindex)===0?!0:void 0})}),Et(),At();var w=yn();St(w,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:P(),height:P(),...e(S),...i}));var u=y(w);{var z=j=>{var A=mn(),K=y(A,!0);f(A),le(()=>ue(K,g())),p(j,A)};be(u,j=>{g()&&j(z)})}Ne(2),f(w),p(W,w),st()}var wn=rt("<title> </title>"),bn=rt('<svg><!><path d="M10 16 20 6 21.4 7.4 12.8 16 21.4 24.6 20 26z"></path></svg>');function kn(W,t){const s=nt(t,["children","$$slots","$$events","$$legacy"]),i=nt(s,["size","title"]);it(t,!1);const d=at(),S=at();let P=Ve(t,"size",8,16),g=Ve(t,"title",8,void 0);tt(()=>(qe(s),qe(g())),()=>{_(d,s["aria-label"]||s["aria-labelledby"]||g())}),tt(()=>(e(d),qe(s)),()=>{_(S,{"aria-hidden":e(d)?void 0:!0,role:e(d)?"img":void 0,focusable:Number(s.tabindex)===0?!0:void 0})}),Et(),At();var w=bn();St(w,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:P(),height:P(),...e(S),...i}));var u=y(w);{var z=j=>{var A=wn(),K=y(A,!0);f(A),le(()=>ue(K,g())),p(j,A)};be(u,j=>{g()&&j(z)})}Ne(),f(w),p(W,w),st()}var xn=I('<span class="ip-type-dot svelte-x7sio8"></span>'),Cn=I('<span class="ip-menu-check svelte-x7sio8"><!></span>'),En=I('<span class="ip-menu-item-icon svelte-x7sio8"><!></span> <span> </span> <!>',1),Sn=I('<span class="ip-menu-item-icon svelte-x7sio8"><!></span> <span>Remove</span>',1),An=I("<!> <!> <!>",1),Pn=I("<!> <!>",1),Rn=I('<input class="ip-edit-input svelte-x7sio8" type="text"/>'),Dn=I('<span class="ip-status-dot svelte-x7sio8"></span> ',1),Tn=I('<div class="ip-status-wrap svelte-x7sio8"><div class="ip-status-value svelte-x7sio8"><span class="ip-status-dot svelte-x7sio8"></span> <span class="ip-status-text svelte-x7sio8"> </span></div> <div class="ip-status-dropdown svelte-x7sio8"></div></div>'),zn=I('<span class="ip-cal-wd svelte-x7sio8"> </span>'),On=I('<div class="ip-cal-week svelte-x7sio8"></div>'),Ln=I('<div class="ip-cal-wrap svelte-x7sio8"><span class="ip-date-text svelte-x7sio8"> </span> <div class="ip-cal-dropdown svelte-x7sio8"><div class="ip-cal-header svelte-x7sio8"><!> <span class="ip-cal-title svelte-x7sio8"> </span> <!></div> <div class="ip-cal-weekdays svelte-x7sio8"></div> <!></div></div>'),Mn=I('<span class="ip-type-dot svelte-x7sio8"></span> <span> </span>',1),Fn=I('<span class="ip-menu-check svelte-x7sio8"><!></span>'),In=I('<span class="ip-type-dot svelte-x7sio8"></span> <span> </span> <!>',1),jn=I("<!> <!>",1),Kn=I('<span class="ip-etype-display svelte-x7sio8"> </span>'),Un=I('<span class="ip-badge svelte-x7sio8"> </span>'),Vn=I('<div class="ip-wikilink-group svelte-x7sio8"></div>'),Nn=I('<div class="ip-status-value svelte-x7sio8"><span class="ip-status-dot svelte-x7sio8"></span> <span class="ip-status-text svelte-x7sio8"> </span></div>'),qn=I('<span class="ip-date-text svelte-x7sio8"> </span>'),Wn=I('<a class="ip-url-link svelte-x7sio8" target="_blank" rel="noopener noreferrer"> </a>'),Bn=I('<span class="ip-text-value svelte-x7sio8"> </span>'),Hn=I('<div><div class="ip-icon svelte-x7sio8"><!></div> <div class="ip-key svelte-x7sio8"> </div> <div class="ip-value svelte-x7sio8"><!></div></div>'),Yn=I('<div class="ip-row ip-add-row svelte-x7sio8"><div class="ip-icon svelte-x7sio8"><!></div> <div class="ip-key svelte-x7sio8"><input class="ip-add-key-input svelte-x7sio8" type="text" placeholder="Field name"/></div> <div class="ip-value svelte-x7sio8"></div></div>'),Zn=I("<!> <span>Add field</span>",1),Jn=I('<div class="inline-properties svelte-x7sio8"><!> <!></div>');function Qn(W,t){it(t,!0);let s=Ve(t,"editable",3,!1),i=Ve(t,"autofocusKey",3,null),d=Ve(t,"protectedKeys",19,()=>new Set);const S=[{type:"text",label:"Text"},{type:"date",label:"Date"},{type:"status",label:"Status"},{type:"wikilink",label:"Link"}],P=["active","inactive","in-progress","completed","draft","archived","current","former","won","lost","open","closed"];let g=De(null),w=De(!1),u=De(!1);ht(()=>{i()&&!e(u)&&t.properties.some(c=>c.key===i())&&(_(u,!0),requestAnimationFrame(()=>{_(g,i())})),i()||_(u,!1)});let z=De(""),j=De(void 0);function A(c){return c.replace(/[_-]/g," ").replace(/\b\w/g,r=>r.toUpperCase())}function K(c){switch(c.toLowerCase()){case"active":case"current":case"won":return"#3ecf8e";case"in-progress":case"open":return"#f0c246";case"inactive":case"lost":case"closed":case"former":return"#e54d4d";default:return"#5c5c66"}}function Ae(c){for(const r of Ft.repos){const T=r.entities.find(ie=>ie.id===c);if(T){Ut(`/${r.name}/${T.entityType}/${T.id}`);return}}}function L(c){return typeof c.value=="string"?c.value:c.value[0]}function fe(c){return/^https?:\/\//.test(c)}function Re(c){try{return new Date(c).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return c}}let Q=De(gt(new Date().getFullYear())),B=De(gt(new Date().getMonth()));const Ee=["Su","Mo","Tu","We","Th","Fr","Sa"],ce=["January","February","March","April","May","June","July","August","September","October","November","December"];function x(c,r){const T=new Date(c,r,1).getDay(),ie=new Date(c,r+1,0).getDate(),R=new Date(c,r,0).getDate(),ee=[];let X=[];for(let $=T-1;$>=0;$--){const pe=R-$,ae=r===0?11:r-1,Ie=r===0?c-1:c;X.push({day:pe,month:ae,year:Ie,outside:!0})}for(let $=1;$<=ie;$++)X.push({day:$,month:r,year:c,outside:!1}),X.length===7&&(ee.push(X),X=[]);if(X.length>0){const $=r===11?0:r+1,pe=r===11?c+1:c;let ae=1;for(;X.length<7;)X.push({day:ae++,month:$,year:pe,outside:!0});ee.push(X)}return ee}function k(c){const r=new Date;return c.day===r.getDate()&&c.month===r.getMonth()&&c.year===r.getFullYear()}function a(c,r){const T=r.slice(0,10).split("-");return c.year===+T[0]&&c.month===+T[1]-1&&c.day===+T[2]}function n(){e(B)===0?(_(B,11),Mt(Q,-1)):Mt(B,-1)}function l(){e(B)===11?(_(B,0),Mt(Q)):Mt(B)}function b(c){try{const r=c.slice(0,10).split("-");_(Q,+r[0]),_(B,+r[1]-1)}catch{const r=new Date;_(Q,r.getFullYear(),!0),_(B,r.getMonth(),!0)}}function C(c){requestAnimationFrame(()=>{c.focus(),c.select()})}function q(c){!s()||c.type==="badge"||c.type==="entity-type"||(c.type==="date"&&b(L(c)),_(g,c.key,!0))}function ke(c,r){t.onedit&&t.onedit(c,r),_(g,null)}function Te(c,r){const T=`${r.year}-${String(r.month+1).padStart(2,"0")}-${String(r.day).padStart(2,"0")}`;t.onedit&&t.onedit(c,T),_(g,null)}function E(c,r){t.ontypechange&&t.ontypechange(c,r)}function v(c){_(g,null),t.onremove&&t.onremove(c)}function h(){_(w,!0),_(z,""),requestAnimationFrame(()=>e(j)?.focus())}function O(){const c=e(z).trim();c&&t.onadd&&t.onadd(c,""),_(w,!1),_(z,"")}function ne(){_(w,!1),_(z,"")}function V(c){c.key==="Enter"?(c.preventDefault(),O()):c.key==="Escape"&&ne()}var H=Jn();_t("click",ya,()=>{_(g,null)});var m=y(H);We(m,17,()=>t.properties,c=>c.key,(c,r)=>{const T=Oe(()=>e(g)===e(r).key);var ie=Hn();let R;var ee=y(ie),X=y(ee);{var $=M=>{var J=xn();let F;le(_e=>F=et(J,"",F,_e),[()=>({background:$t(L(e(r)))})]),p(M,J)},pe=M=>{var J=Ye(),F=Ce(J);Ue(F,()=>la,(_e,Se)=>{Se(_e,{children:(he,Pe)=>{var Le=Pn(),ye=Ce(Le);Ue(ye,()=>ia,(Fe,Be)=>{Be(Fe,{class:"ip-icon-trigger",children:(te,G)=>{var ge=Ye(),xe=Ce(ge);{var ze=je=>{Nt(je,{size:14})},$e=je=>{qt(je,{size:14})},ot=je=>{Wt(je,{size:14})},ct=je=>{Vt(je,{size:14})};be(xe,je=>{e(r).type==="date"?je(ze):e(r).type==="status"?je($e,1):e(r).type==="wikilink"?je(ot,2):je(ct,!1)})}p(te,ge)},$$slots:{default:!0}})});var Me=N(ye,2);Ue(Me,()=>sa,(Fe,Be)=>{Be(Fe,{children:(te,G)=>{var ge=Ye(),xe=Ce(ge);Ue(xe,()=>oa,(ze,$e)=>{$e(ze,{class:"ip-menu-content",sideOffset:4,align:"start",children:(ot,ct)=>{var je=An(),Pt=Ce(je);We(Pt,17,()=>S,Ze,(lt,Ge)=>{var ut=Ye(),mt=Ce(ut);Ue(mt,()=>ea,(ft,vt)=>{vt(ft,{class:"ip-menu-item",onSelect:()=>E(e(r).key,e(Ge).type),children:(yt,Zt)=>{var wt=En(),Dt=Ce(wt),Jt=y(Dt);{var bt=Ke=>{Vt(Ke,{size:13})},jt=Ke=>{Nt(Ke,{size:13})},Qt=Ke=>{qt(Ke,{size:13})},Gt=Ke=>{Wt(Ke,{size:13})};be(Jt,Ke=>{e(Ge).type==="text"?Ke(bt):e(Ge).type==="date"?Ke(jt,1):e(Ge).type==="status"?Ke(Qt,2):e(Ge).type==="wikilink"&&Ke(Gt,3)})}f(Dt);var Tt=N(Dt,2),Xt=y(Tt,!0);f(Tt);var ra=N(Tt,2);{var Kt=Ke=>{var kt=Cn(),zt=y(kt);ca(zt,{size:12}),f(kt),p(Ke,kt)};be(ra,Ke=>{e(r).type===e(Ge).type&&Ke(Kt)})}le(()=>ue(Xt,e(Ge).label)),p(yt,wt)},$$slots:{default:!0}})}),p(lt,ut)});var dt=N(Pt,2);Ue(dt,()=>Na,(lt,Ge)=>{Ge(lt,{class:"ip-menu-sep"})});var Rt=N(dt,2);Ue(Rt,()=>ea,(lt,Ge)=>{Ge(lt,{class:"ip-menu-item ip-menu-destructive",onSelect:()=>v(e(r).key),children:(ut,mt)=>{var ft=Sn(),vt=Ce(ft),yt=y(vt);Wa(yt,{size:13}),f(vt),Ne(2),p(ut,ft)},$$slots:{default:!0}})}),p(ot,je)},$$slots:{default:!0}})}),p(te,ge)},$$slots:{default:!0}})}),p(he,Le)},$$slots:{default:!0}})}),p(M,J)},ae=Oe(()=>s()&&e(r).type!=="badge"&&!d().has(e(r).key)),Ie=M=>{var J=Ye(),F=Ce(J);{var _e=ye=>{Nt(ye,{size:14})},Se=ye=>{qt(ye,{size:14})},he=ye=>{Wt(ye,{size:14})},Pe=ye=>{ka(ye,{size:14})},Le=ye=>{Vt(ye,{size:14})};be(F,ye=>{e(r).type==="date"?ye(_e):e(r).type==="status"?ye(Se,1):e(r).type==="wikilink"?ye(he,2):e(r).type==="badge"?ye(Pe,3):ye(Le,!1)})}p(M,J)};be(X,M=>{e(r).type==="entity-type"?M($):e(ae)?M(pe,1):e(r).type!=="entity-type"&&M(Ie,2)})}f(ee);var o=N(ee,2),D=y(o,!0);f(o);var se=N(o,2),Z=y(se);{var me=M=>{var J=Rn();It(J),rn(J,F=>C?.(F)),le(F=>aa(J,F),[()=>L(e(r))]),_t("blur",J,F=>{const _e=F.currentTarget.value;_e!==L(e(r))&&t.onedit?.(e(r).key,_e),_(g,null)}),Qe("keydown",J,F=>{if(F.key==="Enter"){const _e=F.currentTarget.value;_e!==L(e(r))&&t.onedit?.(e(r).key,_e);const Se=i()===e(r).key;_(g,null),F.preventDefault(),Se&&t.onfocuseditor?.()}else F.key==="Escape"&&(F.currentTarget.value=L(e(r)),_(g,null))}),p(M,J)},we=M=>{var J=Tn(),F=y(J),_e=y(F);let Se;var he=N(_e,2),Pe=y(he,!0);f(he),f(F);var Le=N(F,2);We(Le,21,()=>P,Ze,(ye,Me)=>{{let Fe=Oe(()=>L(e(r))===e(Me)?"selected":"");Je(ye,{variant:"ghost",get class(){return`ip-status-option ${e(Fe)??""}`},onclick:()=>ke(e(r).key,e(Me)),children:(Be,te)=>{var G=Dn(),ge=Ce(G);let xe;var ze=N(ge);le($e=>{xe=et(ge,"",xe,$e),ue(ze,` ${e(Me)??""}`)},[()=>({background:K(e(Me))})]),p(Be,G)},$$slots:{default:!0}})}}),f(Le),f(J),le((ye,Me)=>{Se=et(_e,"",Se,ye),ue(Pe,Me)},[()=>({background:K(L(e(r)))}),()=>L(e(r))]),Qe("click",J,ye=>ye.stopPropagation()),p(M,J)},de=M=>{var J=Ln(),F=y(J),_e=y(F,!0);f(F);var Se=N(F,2),he=y(Se),Pe=y(he);Je(Pe,{variant:"ghost",size:"icon",class:"ip-cal-nav",onclick:n,children:(te,G)=>{kn(te,{size:14})},$$slots:{default:!0}});var Le=N(Pe,2),ye=y(Le);f(Le);var Me=N(Le,2);Je(Me,{variant:"ghost",size:"icon",class:"ip-cal-nav",onclick:l,children:(te,G)=>{Ba(te,{size:14})},$$slots:{default:!0}}),f(he);var Fe=N(he,2);We(Fe,21,()=>Ee,Ze,(te,G)=>{var ge=zn(),xe=y(ge,!0);f(ge),le(()=>ue(xe,e(G))),p(te,ge)}),f(Fe);var Be=N(Fe,2);We(Be,17,()=>x(e(Q),e(B)),Ze,(te,G)=>{var ge=On();We(ge,21,()=>e(G),Ze,(xe,ze)=>{{let $e=Oe(()=>e(ze).outside?"outside":""),ot=Oe(()=>k(e(ze))?"today":""),ct=Oe(()=>a(e(ze),L(e(r)))?"selected":"");Je(xe,{variant:"ghost",get class(){return`ip-cal-day ${e($e)??""} ${e(ot)??""} ${e(ct)??""}`},onclick:()=>Te(e(r).key,e(ze)),children:(je,Pt)=>{Ne();var dt=pt();le(()=>ue(dt,e(ze).day)),p(je,dt)},$$slots:{default:!0}})}}),f(ge),p(te,ge)}),f(Se),f(J),le(te=>{ue(_e,te),ue(ye,`${ce[e(B)]??""} ${e(Q)??""}`)},[()=>Re(L(e(r)))]),Qe("click",J,te=>te.stopPropagation()),p(M,J)},re=M=>{{let J=Oe(()=>Array.isArray(e(r).value));dn(M,{get value(){return e(r).value},get multi(){return e(J)},onselect:F=>{t.onedit?.(e(r).key,F),_(g,null)},oncancel:()=>{_(g,null)}})}},oe=M=>{var J=Ye(),F=Ce(J);{var _e=te=>{var G=Ye(),ge=Ce(G);Ue(ge,()=>la,(xe,ze)=>{ze(xe,{children:($e,ot)=>{var ct=jn(),je=Ce(ct);Ue(je,()=>ia,(dt,Rt)=>{Rt(dt,{class:"ip-etype-trigger",onclick:lt=>lt.stopPropagation(),children:(lt,Ge)=>{var ut=Mn(),mt=Ce(ut);let ft;var vt=N(mt,2),yt=y(vt,!0);f(vt),le((Zt,wt)=>{ft=et(mt,"",ft,Zt),ue(yt,wt)},[()=>({background:$t(L(e(r)))}),()=>xt(L(e(r)))]),p(lt,ut)},$$slots:{default:!0}})});var Pt=N(je,2);Ue(Pt,()=>sa,(dt,Rt)=>{Rt(dt,{children:(lt,Ge)=>{var ut=Ye(),mt=Ce(ut);Ue(mt,()=>oa,(ft,vt)=>{vt(ft,{class:"ip-menu-content ip-etype-content",sideOffset:4,align:"start",children:(yt,Zt)=>{var wt=Ye(),Dt=Ce(wt);We(Dt,17,()=>Va,Ze,(Jt,bt)=>{var jt=Ye(),Qt=Ce(jt);Ue(Qt,()=>ea,(Gt,Tt)=>{Tt(Gt,{class:"ip-menu-item",onSelect:()=>{e(bt)!==L(e(r))&&t.onentitytypechange?.(e(bt))},children:(Xt,ra)=>{var Kt=In(),Ke=Ce(Kt);let kt;var zt=N(Ke,2),xa=y(zt,!0);f(zt);var Ca=N(zt,2);{var Ea=Ot=>{var Lt=Fn(),Aa=y(Lt);ca(Aa,{size:12}),f(Lt),p(Ot,Lt)},Sa=Oe(()=>L(e(r))===e(bt));be(Ca,Ot=>{e(Sa)&&Ot(Ea)})}le((Ot,Lt)=>{kt=et(Ke,"",kt,Ot),ue(xa,Lt)},[()=>({background:$t(e(bt))}),()=>xt(e(bt))]),p(Xt,Kt)},$$slots:{default:!0}})}),p(Jt,jt)}),p(yt,wt)},$$slots:{default:!0}})}),p(lt,ut)},$$slots:{default:!0}})}),p($e,ct)},$$slots:{default:!0}})}),p(te,G)},Se=te=>{var G=Kn(),ge=y(G,!0);f(G),le(xe=>ue(ge,xe),[()=>xt(L(e(r)))]),p(te,G)},he=te=>{var G=Un(),ge=y(G,!0);f(G),le(xe=>ue(ge,xe),[()=>L(e(r))]),p(te,G)},Pe=te=>{var G=Vn();We(G,21,()=>Array.isArray(e(r).value)?e(r).value:[e(r).value],Ze,(ge,xe)=>{Je(ge,{variant:"ghost",class:"ip-wikilink-chip",onclick:ze=>{ze.stopPropagation(),Ae(e(xe))},children:(ze,$e)=>{Ne();var ot=pt();le(()=>ue(ot,e(xe))),p(ze,ot)},$$slots:{default:!0}})}),f(G),p(te,G)},Le=te=>{var G=Nn(),ge=y(G);let xe;var ze=N(ge,2),$e=y(ze,!0);f(ze),f(G),le((ot,ct)=>{xe=et(ge,"",xe,ot),ue($e,ct)},[()=>({background:K(L(e(r)))}),()=>L(e(r))]),p(te,G)},ye=te=>{var G=qn(),ge=y(G,!0);f(G),le(xe=>ue(ge,xe),[()=>Re(L(e(r)))]),p(te,G)},Me=te=>{var G=Wn(),ge=y(G,!0);f(G),le((xe,ze)=>{Ua(G,"href",xe),ue(ge,ze)},[()=>L(e(r)),()=>L(e(r))]),Qe("click",G,xe=>xe.stopPropagation()),p(te,G)},Fe=Oe(()=>fe(L(e(r)))),Be=te=>{var G=Bn(),ge=y(G,!0);f(G),le(xe=>ue(ge,xe),[()=>L(e(r))]),p(te,G)};be(F,te=>{e(r).type==="entity-type"&&s()?te(_e):e(r).type==="entity-type"?te(Se,1):e(r).type==="badge"?te(he,2):e(r).type==="wikilink"?te(Pe,3):e(r).type==="status"?te(Le,4):e(r).type==="date"?te(ye,5):e(Fe)?te(Me,6):te(Be,!1)})}p(M,J)};be(Z,M=>{e(T)&&e(r).type==="text"?M(me):e(T)&&e(r).type==="status"?M(we,1):e(T)&&e(r).type==="date"?M(de,2):e(T)&&e(r).type==="wikilink"?M(re,3):M(oe,!1)})}f(se),f(ie),le(M=>{R=Ct(ie,1,"ip-row svelte-x7sio8",null,R,{"ip-focused":e(T)}),ue(D,M)},[()=>A(e(r).key)]),Qe("click",ee,M=>M.stopPropagation()),Qe("click",se,M=>{M.stopPropagation(),q(e(r))}),p(c,ie)});var U=N(m,2);{var ve=c=>{var r=Yn(),T=y(r),ie=y(T);Ht(ie,{size:14}),f(T);var R=N(T,2),ee=y(R);It(ee),Yt(ee,X=>_(j,X),()=>e(j)),f(R),Ne(2),f(r),Qe("keydown",ee,V),_t("blur",ee,ne),ba(ee,()=>e(z),X=>_(z,X)),p(c,r)},Y=c=>{Je(c,{variant:"ghost",class:"ip-add-btn",onclick:r=>{r.stopPropagation(),h()},children:(r,T)=>{var ie=Zn(),R=Ce(ie);Ht(R,{size:14}),Ne(2),p(r,ie)},$$slots:{default:!0}})};be(U,c=>{e(w)?c(ve):s()&&c(Y,1)})}f(H),p(W,H),st()}na(["click","keydown"]);var Gn=I('<div class="remote-cursor svelte-ok7wy5"><span class="remote-cursor-label svelte-ok7wy5"> </span></div>'),Xn=I('<div class="cursor-overlay svelte-ok7wy5"></div>'),$n=I('<div class="editor-wrap svelte-ok7wy5"><div class="cm-container svelte-ok7wy5"></div> <!></div>');function er(W,t){it(t,!0);let s=Ve(t,"readonly",3,!0),i=Ve(t,"resetKey",3,0);const d=za("theme");let S,P=null,g=null,w=De(""),u=null,z=De(gt([])),j=null,A=t.content;function K(B,Ee){return B.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:Ee?"rgba(110,110,232,0.2)":"rgba(110,110,232,0.15)"},"&.cm-focused .cm-selectionBackground":{backgroundColor:Ee?"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:Ee})}async function Ae(){P&&(P.destroy(),P=null),g&&(g.destroy(),g=null),_(z,[],!0);const{EditorState:B,Transaction:Ee}=await Xe(async()=>{const{EditorState:m,Transaction:U}=await import("../chunks/CX_61fY8.js");return{EditorState:m,Transaction:U}},[],import.meta.url);u=Ee;const{EditorView:ce,keymap:x,ViewPlugin:k}=await Xe(async()=>{const{EditorView:m,keymap:U,ViewPlugin:ve}=await import("../chunks/DnL9f0lc.js").then(Y=>Y.i);return{EditorView:m,keymap:U,ViewPlugin:ve}},__vite__mapDeps([0,1]),import.meta.url),{markdown:a}=await Xe(async()=>{const{markdown:m}=await import("../chunks/CscoF-YL.js");return{markdown:m}},__vite__mapDeps([2,1,0,3,4,5]),import.meta.url),{syntaxHighlighting:n,HighlightStyle:l}=await Xe(async()=>{const{syntaxHighlighting:m,HighlightStyle:U}=await import("../chunks/D7ZqAKi9.js");return{syntaxHighlighting:m,HighlightStyle:U}},__vite__mapDeps([3,4,1,0]),import.meta.url),{history:b,defaultKeymap:C,historyKeymap:q}=await Xe(async()=>{const{history:m,defaultKeymap:U,historyKeymap:ve}=await import("../chunks/CWQRQXxy.js");return{history:m,defaultKeymap:U,historyKeymap:ve}},__vite__mapDeps([6,1,0,3,4]),import.meta.url),{tags:ke}=await Xe(async()=>{const{tags:m}=await import("../chunks/C7VoTosa.js").then(U=>U.i);return{tags:m}},[],import.meta.url),{livePreviewPlugin:Te,livePreviewTheme:E}=await Xe(async()=>{const{livePreviewPlugin:m,livePreviewTheme:U}=await import("../chunks/B340SUKR.js");return{livePreviewPlugin:m,livePreviewTheme:U}},__vite__mapDeps([7,0,1,3,4]),import.meta.url),v=d.current==="dark",h=K(ce,v),O=l.define([{tag:ke.processingInstruction,color:"var(--color-text-tertiary)",opacity:"0.7"}]),ne=[a(),h,n(O),Te,E,ce.lineWrapping];s()&&ne.push(B.readOnly.of(!0));let V=!1;if(t.cursorDocName&&!s())try{let o=function(){if(!P||!R){_(z,[],!0);return}const Z=R.awareness,me=R.ytext,we=me.doc;if(!we){_(z,[],!0);return}const de=[],re=P.dom.getBoundingClientRect();Z.getStates().forEach((oe,M)=>{if(M===Ie)return;const J=oe.cursor;if(!J?.head)return;const{name:F="Anonymous",color:_e="#e05050"}=oe.user||{};let Se;try{Se=T.createRelativePositionFromJSON(J.head)}catch{return}const he=T.createAbsolutePositionFromRelativePosition(Se,we);if(!he||he.type!==me)return;const Pe=P.coordsAtPos(Math.min(he.index,P.state.doc.length));Pe&&de.push({id:M,name:F,color:_e,top:Pe.top-re.top,left:Pe.left-re.left,height:Pe.bottom-Pe.top})}),_(z,de,!0)},D=function(){j&&cancelAnimationFrame(j),j=requestAnimationFrame(()=>{j=null,o()})},se=function({added:Z,updated:me,removed:we}){[...Z,...me,...we].some(re=>re!==Ie)&&D()};const{createCollabSession:m}=await Xe(async()=>{const{createCollabSession:Z}=await import("../chunks/BDTSG9D-.js");return{createCollabSession:Z}},__vite__mapDeps([8,9,10,11,12,13,14,15,16,17,18]),import.meta.url),{ySync:U,ySyncFacet:ve,YSyncConfig:Y,yUndoManagerKeymap:c}=await Xe(async()=>{const{ySync:Z,ySyncFacet:me,YSyncConfig:we,yUndoManagerKeymap:de}=await import("../chunks/i9c_RUF6.js");return{ySync:Z,ySyncFacet:me,YSyncConfig:we,yUndoManagerKeymap:de}},__vite__mapDeps([19,9,0,1]),import.meta.url),{auth:r}=await Xe(async()=>{const{auth:Z}=await import("../chunks/Sk0ODu4Y.js").then(me=>me.b);return{auth:Z}},__vite__mapDeps([16,12,15]),import.meta.url),T=await Xe(()=>import("../chunks/CLFba8FK.js").then(Z=>Z.A),[],import.meta.url),ie=getComputedStyle(document.documentElement).getPropertyValue("--color-accent").trim()||"#e05050",R=m(t.cursorDocName,{name:r.user?.displayName??"Anonymous",color:ie,colorLight:ie+"33"}),ee=new T.UndoManager(R.ytext,{captureTimeout:500}),{yUndoManagerFacet:X,yUndoManager:$,YUndoManagerConfig:pe}=await Xe(async()=>{const{yUndoManagerFacet:Z,yUndoManager:me,YUndoManagerConfig:we}=await import("../chunks/i9c_RUF6.js");return{yUndoManagerFacet:Z,yUndoManager:me,YUndoManagerConfig:we}},__vite__mapDeps([19,9,0,1]),import.meta.url),ae=new Y(R.ytext,R.awareness);ne.push(ve.of(ae),U,X.of(new pe(ee)),$,x.of(c)),ne.push(k.define(Z=>{function me(){const we=Z.state.selection.main,de=R.ytext,re=T.createRelativePositionFromTypeIndex(de,we.anchor),oe=T.createRelativePositionFromTypeIndex(de,we.head);R.awareness.setLocalStateField("cursor",{anchor:T.relativePositionToJSON(re),head:T.relativePositionToJSON(oe)})}return me(),{update(we){(we.selectionSet||we.docChanged)&&me()}}}));const Ie=R.ydoc.clientID;R.awareness.on("change",se),ne.push(k.define(()=>({update(Z){(Z.docChanged||Z.geometryChanged||Z.viewportChanged)&&D()},destroy(){R.awareness.off("change",se)}}))),g=R,V=!0}catch(m){console.warn("Yjs collab setup failed, falling back to solo editing:",m)}if(!s()&&!V?(ne.push(b({newGroupDelay:500})),ne.push(x.of([...C,...q]))):!s()&&V&&ne.push(x.of(C)),t.onchange)if(V){const m=Date.now();ne.push(ce.updateListener.of(U=>{if(U.docChanged&&Date.now()-m>1e3&&U.transactions.some(Y=>Y.isUserEvent("input")||Y.isUserEvent("delete")||Y.isUserEvent("move")||Y.isUserEvent("undo")||Y.isUserEvent("redo"))){const Y=U.state.doc.toString();A=Y,t.onchange(Y)}}))}else ne.push(ce.updateListener.of(m=>{if(m.docChanged){const U=m.state.doc.toString();A=U,t.onchange(U)}}));ne.push(ce.domEventHandlers({click(m){const U=m.target;if(t.onwikilinkclick){const Y=U.closest(".cm-live-wikilink");if(Y){m.preventDefault();const c=Y.textContent?.replace(/^\[{1,2}|\]{1,2}$/g,"").trim();return c&&t.onwikilinkclick(c),!0}}const ve=U.closest(".cm-live-link");if(ve){const Y=ve.getAttribute("data-href");if(Y)return m.preventDefault(),window.open(Y,"_blank","noopener,noreferrer"),!0}return!1}})),t.onsave&&ne.push(x.of([{key:"Mod-s",run:()=>(t.onsave(),!0)}]));const H=B.create({doc:V?"":t.content,extensions:ne});P=new ce({state:H,parent:S}),A=V?"":t.content,_(w,t.cursorDocName??"",!0)}Oa(()=>{Ae()}),ht(()=>{t.cursorDocName&&e(w)&&t.cursorDocName!==e(w)&&Ae()}),ht(()=>{if(i(),P&&!g&&t.content!==A){A=t.content;const B=S.closest(".document-scroll"),Ee=B?.scrollTop??0;P.dispatch({changes:{from:0,to:P.state.doc.length,insert:t.content},...u?{annotations:u.addToHistory.of(!1)}:{}}),B&&requestAnimationFrame(()=>{B.scrollTop=Ee})}}),wa(()=>{j&&cancelAnimationFrame(j),g?.destroy(),g=null,P?.destroy()});var L=$n(),fe=y(L);Yt(fe,B=>S=B,()=>S);var Re=N(fe,2);{var Q=B=>{var Ee=Xn();We(Ee,21,()=>e(z),ce=>ce.id,(ce,x)=>{var k=Gn(),a=y(k),n=y(a,!0);f(a),f(k),le(()=>{et(k,`top: ${e(x).top??""}px; left: ${e(x).left??""}px; height: ${e(x).height??""}px; --cursor-color: ${e(x).color??""};`),et(a,`background-color: ${e(x).color??""};`),ue(n,e(x).name)}),p(ce,k)}),f(Ee),p(B,Ee)};be(Re,B=>{e(z).length>0&&B(Q)})}f(L),p(W,L),st()}var Bt={exports:{}};var tr=Bt.exports,va;function ar(){return va||(va=1,(function(W,t){((s,i)=>{W.exports=i()})(tr,function s(){var i=typeof self<"u"?self:typeof window<"u"?window:i!==void 0?i:{},d,S=!i.document&&!!i.postMessage,P=i.IS_PAPA_WORKER||!1,g={},w=0,u={};function z(a){this._handle=null,this._finished=!1,this._completed=!1,this._halted=!1,this._input=null,this._baseIndex=0,this._partialLine="",this._rowCount=0,this._start=0,this._nextChunk=null,this.isFirstChunk=!0,this._completeResults={data:[],errors:[],meta:{}},(function(n){var l=ce(n);l.chunkSize=parseInt(l.chunkSize),n.step||n.chunk||(l.chunkSize=null),this._handle=new L(l),(this._handle.streamer=this)._config=l}).call(this,a),this.parseChunk=function(n,l){var b=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<b){let q=this._config.newline;q||(C=this._config.quoteChar||'"',q=this._handle.guessLineEndings(n,C)),n=[...n.split(q).slice(b)].join(q)}this.isFirstChunk&&k(this._config.beforeFirstChunk)&&(C=this._config.beforeFirstChunk(n))!==void 0&&(n=C),this.isFirstChunk=!1,this._halted=!1;var b=this._partialLine+n,C=(this._partialLine="",this._handle.parse(b,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(n=C.meta.cursor,b=(this._finished||(this._partialLine=b.substring(n-this._baseIndex),this._baseIndex=n),C&&C.data&&(this._rowCount+=C.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),P)i.postMessage({results:C,workerId:u.WORKER_ID,finished:b});else if(k(this._config.chunk)&&!l){if(this._config.chunk(C,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=C=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(C.data),this._completeResults.errors=this._completeResults.errors.concat(C.errors),this._completeResults.meta=C.meta),this._completed||!b||!k(this._config.complete)||C&&C.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),b||C&&C.meta.paused||this._nextChunk(),C}this._halted=!0},this._sendError=function(n){k(this._config.error)?this._config.error(n):P&&this._config.error&&i.postMessage({workerId:u.WORKER_ID,error:n,finished:!1})}}function j(a){var n;(a=a||{}).chunkSize||(a.chunkSize=u.RemoteChunkSize),z.call(this,a),this._nextChunk=S?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(l){this._input=l,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(n=new XMLHttpRequest,this._config.withCredentials&&(n.withCredentials=this._config.withCredentials),S||(n.onload=x(this._chunkLoaded,this),n.onerror=x(this._chunkError,this)),n.open(this._config.downloadRequestBody?"POST":"GET",this._input,!S),this._config.downloadRequestHeaders){var l,b=this._config.downloadRequestHeaders;for(l in b)n.setRequestHeader(l,b[l])}var C;this._config.chunkSize&&(C=this._start+this._config.chunkSize-1,n.setRequestHeader("Range","bytes="+this._start+"-"+C));try{n.send(this._config.downloadRequestBody)}catch(q){this._chunkError(q.message)}S&&n.status===0&&this._chunkError()}},this._chunkLoaded=function(){n.readyState===4&&(n.status<200||400<=n.status?this._chunkError():(this._start+=this._config.chunkSize||n.responseText.length,this._finished=!this._config.chunkSize||this._start>=(l=>(l=l.getResponseHeader("Content-Range"))!==null?parseInt(l.substring(l.lastIndexOf("/")+1)):-1)(n),this.parseChunk(n.responseText)))},this._chunkError=function(l){l=n.statusText||l,this._sendError(new Error(l))}}function A(a){(a=a||{}).chunkSize||(a.chunkSize=u.LocalChunkSize),z.call(this,a);var n,l,b=typeof FileReader<"u";this.stream=function(C){this._input=C,l=C.slice||C.webkitSlice||C.mozSlice,b?((n=new FileReader).onload=x(this._chunkLoaded,this),n.onerror=x(this._chunkError,this)):n=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var C=this._input,q=(this._config.chunkSize&&(q=Math.min(this._start+this._config.chunkSize,this._input.size),C=l.call(C,this._start,q)),n.readAsText(C,this._config.encoding));b||this._chunkLoaded({target:{result:q}})},this._chunkLoaded=function(C){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(C.target.result)},this._chunkError=function(){this._sendError(n.error)}}function K(a){var n;z.call(this,a=a||{}),this.stream=function(l){return n=l,this._nextChunk()},this._nextChunk=function(){var l,b;if(!this._finished)return l=this._config.chunkSize,n=l?(b=n.substring(0,l),n.substring(l)):(b=n,""),this._finished=!n,this.parseChunk(b)}}function Ae(a){z.call(this,a=a||{});var n=[],l=!0,b=!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(C){this._input=C,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){b&&n.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),n.length?this.parseChunk(n.shift()):l=!0},this._streamData=x(function(C){try{n.push(typeof C=="string"?C:C.toString(this._config.encoding)),l&&(l=!1,this._checkIsFinished(),this.parseChunk(n.shift()))}catch(q){this._streamError(q)}},this),this._streamError=x(function(C){this._streamCleanUp(),this._sendError(C)},this),this._streamEnd=x(function(){this._streamCleanUp(),b=!0,this._streamData("")},this),this._streamCleanUp=x(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function L(a){var n,l,b,C,q=Math.pow(2,53),ke=-q,Te=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,E=/^((\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)))$/,v=this,h=0,O=0,ne=!1,V=!1,H=[],m={data:[],errors:[],meta:{}};function U(r){return a.skipEmptyLines==="greedy"?r.join("").trim()==="":r.length===1&&r[0].length===0}function ve(){if(m&&b&&(c("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+u.DefaultDelimiter+"'"),b=!1),a.skipEmptyLines&&(m.data=m.data.filter(function(R){return!U(R)})),Y()){let R=function(ee,X){k(a.transformHeader)&&(ee=a.transformHeader(ee,X)),H.push(ee)};if(m)if(Array.isArray(m.data[0])){for(var r=0;Y()&&r<m.data.length;r++)m.data[r].forEach(R);m.data.splice(0,1)}else m.data.forEach(R)}function T(R,ee){for(var X=a.header?{}:[],$=0;$<R.length;$++){var pe=$,ae=R[$],ae=((Ie,o)=>(D=>(a.dynamicTypingFunction&&a.dynamicTyping[D]===void 0&&(a.dynamicTyping[D]=a.dynamicTypingFunction(D)),(a.dynamicTyping[D]||a.dynamicTyping)===!0))(Ie)?o==="true"||o==="TRUE"||o!=="false"&&o!=="FALSE"&&((D=>{if(Te.test(D)&&(D=parseFloat(D),ke<D&&D<q))return 1})(o)?parseFloat(o):E.test(o)?new Date(o):o===""?null:o):o)(pe=a.header?$>=H.length?"__parsed_extra":H[$]:pe,ae=a.transform?a.transform(ae,pe):ae);pe==="__parsed_extra"?(X[pe]=X[pe]||[],X[pe].push(ae)):X[pe]=ae}return a.header&&($>H.length?c("FieldMismatch","TooManyFields","Too many fields: expected "+H.length+" fields but parsed "+$,O+ee):$<H.length&&c("FieldMismatch","TooFewFields","Too few fields: expected "+H.length+" fields but parsed "+$,O+ee)),X}var ie;m&&(a.header||a.dynamicTyping||a.transform)&&(ie=1,!m.data.length||Array.isArray(m.data[0])?(m.data=m.data.map(T),ie=m.data.length):m.data=T(m.data,0),a.header&&m.meta&&(m.meta.fields=H),O+=ie)}function Y(){return a.header&&H.length===0}function c(r,T,ie,R){r={type:r,code:T,message:ie},R!==void 0&&(r.row=R),m.errors.push(r)}k(a.step)&&(C=a.step,a.step=function(r){m=r,Y()?ve():(ve(),m.data.length!==0&&(h+=r.data.length,a.preview&&h>a.preview?l.abort():(m.data=m.data[0],C(m,v))))}),this.parse=function(r,T,ie){var R=a.quoteChar||'"',R=(a.newline||(a.newline=this.guessLineEndings(r,R)),b=!1,a.delimiter?k(a.delimiter)&&(a.delimiter=a.delimiter(r),m.meta.delimiter=a.delimiter):((R=((ee,X,$,pe,ae)=>{var Ie,o,D,se;ae=ae||[","," ","|",";",u.RECORD_SEP,u.UNIT_SEP];for(var Z=0;Z<ae.length;Z++){for(var me,we=ae[Z],de=0,re=0,oe=0,M=(D=void 0,new Re({comments:pe,delimiter:we,newline:X,preview:10}).parse(ee)),J=0;J<M.data.length;J++)$&&U(M.data[J])?oe++:(me=M.data[J].length,re+=me,D===void 0?D=me:0<me&&(de+=Math.abs(me-D),D=me));0<M.data.length&&(re/=M.data.length-oe),(o===void 0||de<=o)&&(se===void 0||se<re)&&1.99<re&&(o=de,Ie=we,se=re)}return{successful:!!(a.delimiter=Ie),bestDelimiter:Ie}})(r,a.newline,a.skipEmptyLines,a.comments,a.delimitersToGuess)).successful?a.delimiter=R.bestDelimiter:(b=!0,a.delimiter=u.DefaultDelimiter),m.meta.delimiter=a.delimiter),ce(a));return a.preview&&a.header&&R.preview++,n=r,l=new Re(R),m=l.parse(n,T,ie),ve(),ne?{meta:{paused:!0}}:m||{meta:{paused:!1}}},this.paused=function(){return ne},this.pause=function(){ne=!0,l.abort(),n=k(a.chunk)?"":n.substring(l.getCharIndex())},this.resume=function(){v.streamer._halted?(ne=!1,v.streamer.parseChunk(n,!0)):setTimeout(v.resume,3)},this.aborted=function(){return V},this.abort=function(){V=!0,l.abort(),m.meta.aborted=!0,k(a.complete)&&a.complete(m),n=""},this.guessLineEndings=function(ee,R){ee=ee.substring(0,1048576);var R=new RegExp(fe(R)+"([^]*?)"+fe(R),"gm"),ie=(ee=ee.replace(R,"")).split("\r"),R=ee.split(`
3
3
  `),ee=1<R.length&&R[0].length<ie[0].length;if(ie.length===1||ee)return`
4
4
  `;for(var X=0,$=0;$<ie.length;$++)ie[$][0]===`
5
5
  `&&X++;return X>=ie.length/2?`\r
@@ -8,4 +8,4 @@ import{h as Pa,w as Ft,k as Ra}from"../chunks/DSkxw4Ss.js";import{_ as Xe}from".
8
8
  `&&(l=`
9
9
  `);var O=0,ne=!1;this.parse=function(V,H,m){if(typeof V!="string")throw new Error("Input must be a string");var U=V.length,ve=n.length,Y=l.length,c=b.length,r=k(C),T=[],ie=[],R=[],ee=O=0;if(!V)return de();if(ke||ke!==!1&&V.indexOf(v)===-1){for(var X=V.split(l),$=0;$<X.length;$++){if(R=X[$],O+=R.length,$!==X.length-1)O+=l.length;else if(m)return de();if(!b||R.substring(0,c)!==b){if(r){if(T=[],se(R.split(n)),re(),ne)return de()}else se(R.split(n));if(q&&q<=$)return T=T.slice(0,q),de(!0)}}return de()}for(var pe=V.indexOf(n,O),ae=V.indexOf(l,O),Ie=new RegExp(fe(h)+fe(v),"g"),o=V.indexOf(v,O);;)if(V[O]===v)for(o=O,O++;;){if((o=V.indexOf(v,o+1))===-1)return m||ie.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:T.length,index:O}),me();if(o===U-1)return me(V.substring(O,o).replace(Ie,v));if(v===h&&V[o+1]===h)o++;else if(v===h||o===0||V[o-1]!==h){pe!==-1&&pe<o+1&&(pe=V.indexOf(n,o+1));var D=Z((ae=ae!==-1&&ae<o+1?V.indexOf(l,o+1):ae)===-1?pe:Math.min(pe,ae));if(V.substr(o+1+D,ve)===n){R.push(V.substring(O,o).replace(Ie,v)),V[O=o+1+D+ve]!==v&&(o=V.indexOf(v,O)),pe=V.indexOf(n,O),ae=V.indexOf(l,O);break}if(D=Z(ae),V.substring(o+1+D,o+1+D+Y)===l){if(R.push(V.substring(O,o).replace(Ie,v)),we(o+1+D+Y),pe=V.indexOf(n,O),o=V.indexOf(v,O),r&&(re(),ne))return de();if(q&&T.length>=q)return de(!0);break}ie.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:T.length,index:O}),o++}}else if(b&&R.length===0&&V.substring(O,O+c)===b){if(ae===-1)return de();O=ae+Y,ae=V.indexOf(l,O),pe=V.indexOf(n,O)}else if(pe!==-1&&(pe<ae||ae===-1))R.push(V.substring(O,pe)),O=pe+ve,pe=V.indexOf(n,O);else{if(ae===-1)break;if(R.push(V.substring(O,ae)),we(ae+Y),r&&(re(),ne))return de();if(q&&T.length>=q)return de(!0)}return me();function se(oe){T.push(oe),ee=O}function Z(oe){var M=0;return M=oe!==-1&&(oe=V.substring(o+1,oe))&&oe.trim()===""?oe.length:M}function me(oe){return m||(oe===void 0&&(oe=V.substring(O)),R.push(oe),O=U,se(R),r&&re()),de()}function we(oe){O=oe,se(R),R=[],ae=V.indexOf(l,O)}function de(oe){if(a.header&&!H&&T.length&&!E){var M=T[0],J=Object.create(null),F=new Set(M);let _e=!1;for(let Se=0;Se<M.length;Se++){let he=M[Se];if(J[he=k(a.transformHeader)?a.transformHeader(he,Se):he]){let Pe,Le=J[he];for(;Pe=he+"_"+Le,Le++,F.has(Pe););F.add(Pe),M[Se]=Pe,J[he]++,_e=!0,(Te=Te===null?{}:Te)[Pe]=he}else J[he]=1,M[Se]=he;F.add(he)}_e&&console.warn("Duplicate headers found and renamed."),E=!0}return{data:T,errors:ie,meta:{delimiter:n,linebreak:l,aborted:ne,truncated:!!oe,cursor:ee+(H||0),renamedHeaders:Te}}}function re(){C(de()),T=[],ie=[]}},this.abort=function(){ne=!0},this.getCharIndex=function(){return O}}function Q(a){var n=a.data,l=g[n.workerId],b=!1;if(n.error)l.userError(n.error,n.file);else if(n.results&&n.results.data){var C={abort:function(){b=!0,B(n.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:Ee,resume:Ee};if(k(l.userStep)){for(var q=0;q<n.results.data.length&&(l.userStep({data:n.results.data[q],errors:n.results.errors,meta:n.results.meta},C),!b);q++);delete n.results}else k(l.userChunk)&&(l.userChunk(n.results,C,n.file),delete n.results)}n.finished&&!b&&B(n.workerId,n.results)}function B(a,n){var l=g[a];k(l.userComplete)&&l.userComplete(n),l.terminate(),delete g[a]}function Ee(){throw new Error("Not implemented.")}function ce(a){if(typeof a!="object"||a===null)return a;var n,l=Array.isArray(a)?[]:{};for(n in a)l[n]=ce(a[n]);return l}function x(a,n){return function(){a.apply(n,arguments)}}function k(a){return typeof a=="function"}return u.parse=function(a,n){var l=(n=n||{}).dynamicTyping||!1;if(k(l)&&(n.dynamicTypingFunction=l,l={}),n.dynamicTyping=l,n.transform=!!k(n.transform)&&n.transform,!n.worker||!u.WORKERS_SUPPORTED)return l=null,u.NODE_STREAM_INPUT,typeof a=="string"?(a=(b=>b.charCodeAt(0)!==65279?b:b.slice(1))(a),l=new(n.download?j:K)(n)):a.readable===!0&&k(a.read)&&k(a.on)?l=new Ae(n):(i.File&&a instanceof File||a instanceof Object)&&(l=new A(n)),l.stream(a);(l=(()=>{var b;return!!u.WORKERS_SUPPORTED&&(b=(()=>{var C=i.URL||i.webkitURL||null,q=s.toString();return u.BLOB_URL||(u.BLOB_URL=C.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; ","(",q,")();"],{type:"text/javascript"})))})(),(b=new i.Worker(b)).onmessage=Q,b.id=w++,g[b.id]=b)})()).userStep=n.step,l.userChunk=n.chunk,l.userComplete=n.complete,l.userError=n.error,n.step=k(n.step),n.chunk=k(n.chunk),n.complete=k(n.complete),n.error=k(n.error),delete n.worker,l.postMessage({input:a,config:n,workerId:l.id})},u.unparse=function(a,n){var l=!1,b=!0,C=",",q=`\r
10
10
  `,ke='"',Te=ke+ke,E=!1,v=null,h=!1,O=((()=>{if(typeof n=="object"){if(typeof n.delimiter!="string"||u.BAD_DELIMITERS.filter(function(H){return n.delimiter.indexOf(H)!==-1}).length||(C=n.delimiter),typeof n.quotes!="boolean"&&typeof n.quotes!="function"&&!Array.isArray(n.quotes)||(l=n.quotes),typeof n.skipEmptyLines!="boolean"&&typeof n.skipEmptyLines!="string"||(E=n.skipEmptyLines),typeof n.newline=="string"&&(q=n.newline),typeof n.quoteChar=="string"&&(ke=n.quoteChar),typeof n.header=="boolean"&&(b=n.header),Array.isArray(n.columns)){if(n.columns.length===0)throw new Error("Option columns is empty");v=n.columns}n.escapeChar!==void 0&&(Te=n.escapeChar+ke),n.escapeFormulae instanceof RegExp?h=n.escapeFormulae:typeof n.escapeFormulae=="boolean"&&n.escapeFormulae&&(h=/^[=+\-@\t\r].*$/)}})(),new RegExp(fe(ke),"g"));if(typeof a=="string"&&(a=JSON.parse(a)),Array.isArray(a)){if(!a.length||Array.isArray(a[0]))return ne(null,a,E);if(typeof a[0]=="object")return ne(v||Object.keys(a[0]),a,E)}else if(typeof a=="object")return typeof a.data=="string"&&(a.data=JSON.parse(a.data)),Array.isArray(a.data)&&(a.fields||(a.fields=a.meta&&a.meta.fields||v),a.fields||(a.fields=Array.isArray(a.data[0])?a.fields:typeof a.data[0]=="object"?Object.keys(a.data[0]):[]),Array.isArray(a.data[0])||typeof a.data[0]=="object"||(a.data=[a.data])),ne(a.fields||[],a.data||[],E);throw new Error("Unable to serialize unrecognized input");function ne(H,m,U){var ve="",Y=(typeof H=="string"&&(H=JSON.parse(H)),typeof m=="string"&&(m=JSON.parse(m)),Array.isArray(H)&&0<H.length),c=!Array.isArray(m[0]);if(Y&&b){for(var r=0;r<H.length;r++)0<r&&(ve+=C),ve+=V(H[r],r);0<m.length&&(ve+=q)}for(var T=0;T<m.length;T++){var ie=(Y?H:m[T]).length,R=!1,ee=Y?Object.keys(m[T]).length===0:m[T].length===0;if(U&&!Y&&(R=U==="greedy"?m[T].join("").trim()==="":m[T].length===1&&m[T][0].length===0),U==="greedy"&&Y){for(var X=[],$=0;$<ie;$++){var pe=c?H[$]:$;X.push(m[T][pe])}R=X.join("").trim()===""}if(!R){for(var ae=0;ae<ie;ae++){0<ae&&!ee&&(ve+=C);var Ie=Y&&c?H[ae]:ae;ve+=V(m[T][Ie],ae)}T<m.length-1&&(!U||0<ie&&!ee)&&(ve+=q)}}return ve}function V(H,m){var U,ve;return H==null?"":H.constructor===Date?JSON.stringify(H).slice(1,25):(ve=!1,h&&typeof H=="string"&&h.test(H)&&(H="'"+H,ve=!0),U=H.toString().replace(O,Te),(ve=ve||l===!0||typeof l=="function"&&l(H,m)||Array.isArray(l)&&l[m]||((Y,c)=>{for(var r=0;r<c.length;r++)if(-1<Y.indexOf(c[r]))return!0;return!1})(U,u.BAD_DELIMITERS)||-1<U.indexOf(C)||U.charAt(0)===" "||U.charAt(U.length-1)===" ")?ke+U+ke:U)}},u.RECORD_SEP="",u.UNIT_SEP="",u.BYTE_ORDER_MARK="\uFEFF",u.BAD_DELIMITERS=["\r",`
11
- `,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!S&&!!i.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=Re,u.ParserHandle=L,u.NetworkStreamer=j,u.FileStreamer=A,u.StringStreamer=K,u.ReadableStreamStreamer=Ae,i.jQuery&&((d=i.jQuery).fn.parse=function(a){var n=a.config||{},l=[];return this.each(function(q){if(!(d(this).prop("tagName").toUpperCase()==="INPUT"&&d(this).attr("type").toLowerCase()==="file"&&i.FileReader)||!this.files||this.files.length===0)return!0;for(var ke=0;ke<this.files.length;ke++)l.push({file:this.files[ke],inputElem:this,instanceConfig:d.extend({},n)})}),b(),this;function b(){if(l.length===0)k(a.complete)&&a.complete();else{var q,ke,Te,E,v=l[0];if(k(a.before)){var h=a.before(v.file,v.inputElem);if(typeof h=="object"){if(h.action==="abort")return q="AbortError",ke=v.file,Te=v.inputElem,E=h.reason,void(k(a.error)&&a.error({name:q},ke,Te,E));if(h.action==="skip")return void C();typeof h.config=="object"&&(v.instanceConfig=d.extend(v.instanceConfig,h.config))}else if(h==="skip")return void C()}var O=v.instanceConfig.complete;v.instanceConfig.complete=function(ne){k(O)&&O(ne,v.file,v.inputElem),C()},u.parse(v.file,v.instanceConfig)}}function C(){l.splice(0,1),b()}}),P&&(i.onmessage=function(a){a=a.data,u.WORKER_ID===void 0&&a&&(u.WORKER_ID=a.workerId),typeof a.input=="string"?i.postMessage({workerId:u.WORKER_ID,results:u.parse(a.input,a.config),finished:!0}):(i.File&&a.input instanceof File||a.input instanceof Object)&&(a=u.parse(a.input,a.config))&&i.postMessage({workerId:u.WORKER_ID,results:a,finished:!0})}),(j.prototype=Object.create(z.prototype)).constructor=j,(A.prototype=Object.create(z.prototype)).constructor=A,(K.prototype=Object.create(K.prototype)).constructor=K,(Ae.prototype=Object.create(z.prototype)).constructor=Ae,u})})(Bt)),Bt.exports}var nr=ar();const ha=Ha(nr);var rr=I('<span class="remote-cell-label svelte-63hltt"> </span>'),ir=I('<th><!> <input class="cell-input header-input svelte-63hltt"/> <!></th>'),sr=I('<span class="remote-cell-label svelte-63hltt"> </span>'),or=I('<td><!> <input class="cell-input svelte-63hltt"/></td>'),lr=I('<tr class="svelte-63hltt"><td class="row-num svelte-63hltt"></td><!><td class="actions svelte-63hltt"><!></td></tr>'),ur=I("<!> <span>Add row</span>",1),cr=I('<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 dr(W,t){it(t,!0);let s=Ve(t,"remoteCursors",19,()=>[]),i=De(gt([])),d=De(gt([])),S=De(void 0);function P(E){const v=ha.parse(E.trim(),{header:!1,skipEmptyLines:!0});v.data.length>0?(_(i,v.data[0],!0),_(d,v.data.slice(1),!0)):(_(i,[],!0),_(d,[],!0))}P(t.content),ht(()=>{P(t.content)});function g(){return ha.unparse([e(i),...e(d)])}function w(){const E=g();t.onchange?.(E)}function u(E,v,h){e(d)[E][v]=h,_(d,[...e(d)],!0),w()}function z(E,v){e(i)[E]=v,_(i,[...e(i)],!0),w()}function j(){_(d,[...e(d),e(i).map(()=>"")],!0),w(),L(e(d).length-1,0)}function A(E){_(d,e(d).filter((v,h)=>h!==E),!0),w()}function K(){const E=`col${e(i).length+1}`;_(i,[...e(i),E],!0),_(d,e(d).map(v=>[...v,""]),!0),w(),requestAnimationFrame(()=>{const v=e(S)?.querySelector(`thead th:nth-child(${e(i).length+1}) input`);v&&(v.focus(),v.select())})}function Ae(E){e(i).length<=1||(_(i,e(i).filter((v,h)=>h!==E),!0),_(d,e(d).map(v=>v.filter((h,O)=>O!==E)),!0),w())}function L(E,v){requestAnimationFrame(()=>{if(!e(S))return;let h=null;E<0?h=e(S).querySelector(`thead th:nth-child(${v+2}) input`):h=e(S).querySelector(`tbody tr:nth-child(${E+1}) td:nth-child(${v+2}) input`),h&&(h.focus(),h.select())})}function fe(E,v,h){if(E.key==="Tab"){E.preventDefault(),E.shiftKey?h>0?L(v,h-1):v>0?L(v-1,e(i).length-1):v===0&&L(-1,e(i).length-1):h<e(i).length-1?L(v,h+1):v<e(d).length-1?L(v+1,0):v===e(d).length-1&&j();return}if(E.key==="Enter"){E.preventDefault(),E.shiftKey?v>0?L(v-1,h):L(-1,h):v<e(d).length-1?L(v+1,h):j();return}if(E.key==="Escape"){E.target.blur();return}}function Re(E,v){if(E.key==="Tab"){E.preventDefault(),E.shiftKey?v>0&&L(-1,v-1):v<e(i).length-1?L(-1,v+1):e(d).length>0&&L(0,0);return}if(E.key==="Enter"){E.preventDefault(),e(d).length>0?L(0,v):j();return}if(E.key==="Escape"){E.target.blur();return}}function Q(E,v){return s().find(h=>h.row===E&&h.col===v)}function B(E,v){t.oncellselect?.(E,v)}function Ee(E){(E.metaKey||E.ctrlKey)&&E.key==="s"&&(E.preventDefault(),t.onsave?.())}var ce=cr(),x=y(ce),k=y(x),a=y(k),n=y(a),l=N(y(n));We(l,17,()=>e(i),Ze,(E,v,h)=>{const O=Oe(()=>Q(-1,h));var ne=ir();let V;var H=y(ne);{var m=c=>{var r=rr(),T=y(r,!0);f(r),le(()=>{et(r,`background-color: ${e(O).color??""}`),ue(T,e(O).name)}),p(c,r)};be(H,c=>{e(O)&&c(m)})}var U=N(H,2);It(U);var ve=N(U,2);{var Y=c=>{Je(c,{variant:"ghost",size:"icon",class:"col-delete-btn",title:"Delete column",onclick:()=>Ae(h),children:(r,T)=>{da(r,{size:12})},$$slots:{default:!0}})};be(ve,c=>{e(i).length>1&&c(Y)})}f(ne),le(()=>{et(ne,e(O)?`--rc-color: ${e(O).color}`:""),V=Ct(ne,1,"svelte-63hltt",null,V,{"remote-active":!!e(O)}),aa(U,e(v))}),Qe("input",U,c=>z(h,c.currentTarget.value)),Qe("keydown",U,c=>Re(c,h)),_t("focus",U,()=>B(-1,h)),p(E,ne)});var b=N(l),C=y(b);Je(C,{variant:"ghost",size:"icon",class:"col-add-btn",title:"Add column",onclick:K,children:(E,v)=>{Ht(E,{size:14})},$$slots:{default:!0}}),f(b),f(n),f(a);var q=N(a);We(q,21,()=>e(d),Ze,(E,v,h)=>{var O=lr(),ne=y(O);ne.textContent=h+1;var V=N(ne);We(V,17,()=>e(v),Ze,(U,ve,Y)=>{const c=Oe(()=>Q(h,Y));var r=or();let T;var ie=y(r);{var R=X=>{var $=sr(),pe=y($,!0);f($),le(()=>{et($,`background-color: ${e(c).color??""}`),ue(pe,e(c).name)}),p(X,$)};be(ie,X=>{e(c)&&X(R)})}var ee=N(ie,2);It(ee),f(r),le(()=>{et(r,e(c)?`--rc-color: ${e(c).color}`:""),T=Ct(r,1,"svelte-63hltt",null,T,{"remote-active":!!e(c)}),aa(ee,e(ve))}),Qe("input",ee,X=>u(h,Y,X.currentTarget.value)),Qe("keydown",ee,X=>fe(X,h,Y)),_t("focus",ee,()=>B(h,Y)),p(U,r)});var H=N(V),m=y(H);Je(m,{variant:"ghost",size:"icon",class:"delete-btn",title:"Delete row",onclick:()=>A(h),children:(U,ve)=>{da(U,{size:12})},$$slots:{default:!0}}),f(H),f(O),p(E,O)}),f(q),f(k),Yt(k,E=>_(S,E),()=>e(S)),f(x);var ke=N(x,2),Te=y(ke);Je(Te,{variant:"ghost",class:"add-row-btn",onclick:j,children:(E,v)=>{var h=ur(),O=Ce(h);Ht(O,{size:14}),Ne(2),p(E,h)},$$slots:{default:!0}}),f(ke),f(ce),Qe("keydown",ce,Ee),p(W,ce),st()}na(["keydown","input"]);const fr=/^\d{4}-\d{2}-\d{2}/,vr=new Set(["active","inactive","in-progress","completed","draft","archived","current","former","contractor","client","partner","won","lost","open","closed"]),hr=new Set(["format"]),pr=new Set(["entity_id","created_at","updated_at","created_by","updated_by"]);function _r(W,t){const s=[];for(const[d,S]of Object.entries(W)){if(pr.has(d)||S==null)continue;const P=gr(d,S);P&&s.push(P)}const i=["entity_type","name","date"];return s.sort((d,S)=>{const P=i.indexOf(d.key),g=i.indexOf(S.key);return P!==-1&&g!==-1?P-g:P!==-1?-1:g!==-1?1:d.key.localeCompare(S.key)}),s}function gr(W,t){if(W==="entity_type")return{key:W,value:String(t),type:"entity-type"};if(hr.has(W))return{key:W,value:String(t).toUpperCase(),type:"badge"};if(W==="status")return{key:W,value:String(t),type:"status"};if(Array.isArray(t)){if(t.length>0&&typeof t[0]=="object"&&t[0]!==null){const g=t.map(w=>Object.entries(w).map(([z,j])=>`${z}: ${j}`).join(", "));return{key:W,value:g.join(" | "),type:"text"}}const d=t.map(String),S=d.some(g=>/^\[\[.+?\]\]$/.test(g)),P=d.map(g=>{const w=g.match(/^\[\[(.+?)\]\]$/);return w?w[1]:g});return S||P.every(g=>pa(g))?{key:W,value:P,type:"wikilink"}:{key:W,value:d.join(", "),type:"text"}}const s=String(t),i=s.match(/^\[\[(.+?)\]\]$/);return i?{key:W,value:i[1],type:"wikilink"}:fr.test(s)?{key:W,value:s,type:"date"}:vr.has(s.toLowerCase())?{key:W,value:s,type:"status"}:pa(s)&&!s.includes(" ")?{key:W,value:s,type:"wikilink"}:{key:W,value:s,type:"text"}}function pa(W){return/^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(W)&&W.includes("-")}var mr=rt("<title> </title>"),yr=rt('<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 _a(W,t){const s=nt(t,["children","$$slots","$$events","$$legacy"]),i=nt(s,["size","title"]);it(t,!1);const d=at(),S=at();let P=Ve(t,"size",8,16),g=Ve(t,"title",8,void 0);tt(()=>(qe(s),qe(g())),()=>{_(d,s["aria-label"]||s["aria-labelledby"]||g())}),tt(()=>(e(d),qe(s)),()=>{_(S,{"aria-hidden":e(d)?void 0:!0,role:e(d)?"img":void 0,focusable:Number(s.tabindex)===0?!0:void 0})}),Et(),At();var w=yr();St(w,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:P(),height:P(),...e(S),...i}));var u=y(w);{var z=j=>{var A=mr(),K=y(A,!0);f(A),le(()=>ue(K,g())),p(j,A)};be(u,j=>{g()&&j(z)})}Ne(),f(w),p(W,w),st()}class wr{diff(t,s,i={}){let d;typeof i=="function"?(d=i,i={}):"callback"in i&&(d=i.callback);const S=this.castInput(t,i),P=this.castInput(s,i),g=this.removeEmpty(this.tokenize(S,i)),w=this.removeEmpty(this.tokenize(P,i));return this.diffWithOptionsObj(g,w,i,d)}diffWithOptionsObj(t,s,i,d){var S;const P=Q=>{if(Q=this.postProcess(Q,i),d){setTimeout(function(){d(Q)},0);return}else return Q},g=s.length,w=t.length;let u=1,z=g+w;i.maxEditLength!=null&&(z=Math.min(z,i.maxEditLength));const j=(S=i.timeout)!==null&&S!==void 0?S:1/0,A=Date.now()+j,K=[{oldPos:-1,lastComponent:void 0}];let Ae=this.extractCommon(K[0],s,t,0,i);if(K[0].oldPos+1>=w&&Ae+1>=g)return P(this.buildValues(K[0].lastComponent,s,t));let L=-1/0,fe=1/0;const Re=()=>{for(let Q=Math.max(L,-u);Q<=Math.min(fe,u);Q+=2){let B;const Ee=K[Q-1],ce=K[Q+1];Ee&&(K[Q-1]=void 0);let x=!1;if(ce){const a=ce.oldPos-Q;x=ce&&0<=a&&a<g}const k=Ee&&Ee.oldPos+1<w;if(!x&&!k){K[Q]=void 0;continue}if(!k||x&&Ee.oldPos<ce.oldPos?B=this.addToPath(ce,!0,!1,0,i):B=this.addToPath(Ee,!1,!0,1,i),Ae=this.extractCommon(B,s,t,Q,i),B.oldPos+1>=w&&Ae+1>=g)return P(this.buildValues(B.lastComponent,s,t))||!0;K[Q]=B,B.oldPos+1>=w&&(fe=Math.min(fe,Q-1)),Ae+1>=g&&(L=Math.max(L,Q+1))}u++};if(d)(function Q(){setTimeout(function(){if(u>z||Date.now()>A)return d(void 0);Re()||Q()},0)})();else for(;u<=z&&Date.now()<=A;){const Q=Re();if(Q)return Q}}addToPath(t,s,i,d,S){const P=t.lastComponent;return P&&!S.oneChangePerToken&&P.added===s&&P.removed===i?{oldPos:t.oldPos+d,lastComponent:{count:P.count+1,added:s,removed:i,previousComponent:P.previousComponent}}:{oldPos:t.oldPos+d,lastComponent:{count:1,added:s,removed:i,previousComponent:P}}}extractCommon(t,s,i,d,S){const P=s.length,g=i.length;let w=t.oldPos,u=w-d,z=0;for(;u+1<P&&w+1<g&&this.equals(i[w+1],s[u+1],S);)u++,w++,z++,S.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return z&&!S.oneChangePerToken&&(t.lastComponent={count:z,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=w,u}equals(t,s,i){return i.comparator?i.comparator(t,s):t===s||!!i.ignoreCase&&t.toLowerCase()===s.toLowerCase()}removeEmpty(t){const s=[];for(let i=0;i<t.length;i++)t[i]&&s.push(t[i]);return s}castInput(t,s){return t}tokenize(t,s){return Array.from(t)}join(t){return t.join("")}postProcess(t,s){return t}get useLongestToken(){return!1}buildValues(t,s,i){const d=[];let S;for(;t;)d.push(t),S=t.previousComponent,delete t.previousComponent,t=S;d.reverse();const P=d.length;let g=0,w=0,u=0;for(;g<P;g++){const z=d[g];if(z.removed)z.value=this.join(i.slice(u,u+z.count)),u+=z.count;else{if(!z.added&&this.useLongestToken){let j=s.slice(w,w+z.count);j=j.map(function(A,K){const Ae=i[u+K];return Ae.length>A.length?Ae:A}),z.value=this.join(j)}else z.value=this.join(s.slice(w,w+z.count));w+=z.count,z.added||(u+=z.count)}}return d}}const ga="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 br extends wr{tokenize(t){const s=new RegExp(`(\\r?\\n)|[${ga}]+|[^\\S\\n\\r]+|[^${ga}]`,"ug");return t.match(s)||[]}}const kr=new br;function xr(W,t,s){return kr.diff(W,t,s)}var Cr=I('<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>'),Er=I('<div class="diff-properties svelte-1g4tvol"></div>'),Sr=I('<span class="db-added"> </span>'),Ar=I('<span class="db-removed"> </span>'),Pr=I("<span> </span>"),Rr=I("<span> </span>"),Dr=I('<div class="diff-view svelte-1g4tvol"><!> <div class="diff-body svelte-1g4tvol"><!></div></div>');function Tr(W,t){it(t,!0);function s(A){if(A==null)return"";if(typeof A!="object")return String(A);const K=A;return String(K.name??K.title??K.label??K.id??JSON.stringify(K))}function i(A){return A==null?"":Array.isArray(A)?A.map(s).join(", "):typeof A=="object"?s(A):String(A)}const d=Oe(()=>t.refreshResult.body_changed&&t.refreshResult.body_diff?xr(t.refreshResult.body_diff.old,t.refreshResult.body_diff.new):null);var S=Dr(),P=y(S);{var g=A=>{var K=Er();We(K,21,()=>t.refreshResult.diffs,Ze,(Ae,L)=>{const fe=Oe(()=>t.properties.find(h=>h.key===e(L).field));var Re=Cr(),Q=y(Re),B=y(Q);{var Ee=h=>{Nt(h,{size:14})},ce=h=>{qt(h,{size:14})},x=h=>{Wt(h,{size:14})},k=h=>{ka(h,{size:14})},a=h=>{Vt(h,{size:14})};be(B,h=>{e(fe)?.type==="date"?h(Ee):e(fe)?.type==="status"?h(ce,1):e(fe)?.type==="wikilink"?h(x,2):e(fe)?.type==="badge"?h(k,3):h(a,!1)})}f(Q);var n=N(Q,2),l=y(n,!0);f(n);var b=N(n,2),C=y(b),q=y(C),ke=y(q,!0);f(q),f(C);var Te=N(C,2),E=y(Te),v=y(E,!0);f(E),f(Te),f(b),f(Re),le((h,O)=>{ue(l,e(L).field),ue(ke,h),ue(v,O)},[()=>i(e(L).old_value),()=>i(e(L).new_value)]),p(Ae,Re)}),f(K),p(A,K)};be(P,A=>{t.refreshResult.diffs.length>0&&A(g)})}var w=N(P,2),u=y(w);{var z=A=>{var K=Ye(),Ae=Ce(K);We(Ae,17,()=>e(d),Ze,(L,fe)=>{var Re=Ye(),Q=Ce(Re);{var B=x=>{var k=Sr(),a=y(k,!0);f(k),le(()=>ue(a,e(fe).value)),p(x,k)},Ee=x=>{var k=Ar(),a=y(k,!0);f(k),le(()=>ue(a,e(fe).value)),p(x,k)},ce=x=>{var k=Pr(),a=y(k,!0);f(k),le(()=>ue(a,e(fe).value)),p(x,k)};be(Q,x=>{e(fe).added?x(B):e(fe).removed?x(Ee,1):x(ce,!1)})}p(L,Re)}),p(A,K)},j=A=>{var K=Rr(),Ae=y(K,!0);f(K),le(()=>ue(Ae,t.bodyContent)),p(A,K)};be(u,A=>{e(d)?A(z):A(j,!1)})}f(w),f(S),p(W,S),st()}var zr=I("<!> ",1),Or=I('<span class="diff-action-title svelte-udj3er">Changes from source</span> <div class="diff-action-buttons svelte-udj3er"><!> <!></div>',1),Lr=I('<span class="bc-sep svelte-udj3er">/</span>'),Mr=I("<!><span> </span>",1),Fr=I('<span class="status-text saving svelte-udj3er">Saving...</span>'),Ir=I('<span class="status-text error svelte-udj3er"> </span>'),jr=I("<!> ",1),Kr=I('<div class="breadcrumb-path svelte-udj3er"></div> <div class="editor-actions svelte-udj3er"><!> <!> <!></div>',1),Ur=I('<div class="refresh-panel svelte-udj3er"><div class="refresh-uptodate svelte-udj3er">Entity is up to date with source.</div></div>'),Vr=I('<div class="document-scroll svelte-udj3er"><div class="document-well svelte-udj3er"><!> <!></div></div>'),Nr=I("<!> <!>",1),qr=I("<!> <!>",1),Wr=I("<!> <div><!></div> <!> <!> <!> <!>",1);function mi(W,t){it(t,!0);const s=()=>Ma(ja,"$page",i),[i,d]=Fa(),S=Oe(()=>t.data.type==="dataset"||t.data.entity.document?.frontmatter?.entity_type==="dataset"),P=Oe(()=>Ft.getAppForEntityType(t.data.entity.document?.frontmatter?.entity_type??t.data.type)),g=Oe(()=>()=>{const o=t.data.entity.path;if(o){const D=o.lastIndexOf(`/${t.data.repo}/`);if(D>=0)return o.substring(D+1).split("/")}return[t.data.repo,t.data.id,"main.md"]});let w=De(""),u=De(gt({})),z=De(0);const j=Oe(()=>_r(e(u))),A=new Set(["name","date"]);let K=De(null);ht(()=>{if(s().url.searchParams.has("new")){_(K,"name");const o=new URL(s().url);o.searchParams.delete("new"),history.replaceState({},"",o.pathname)}else _(K,null)});const Ae=Oe(()=>!!t.data.entity.data?.source_ref);let L=De(!1),fe=De(null),Re=De(null);async function Q(){if(!e(L)){_(L,!0),_(fe,null),_(Re,null);try{const{result:o}=await nn(t.data.repo,t.data.type,t.data.id);_(fe,o,!0)}catch(o){_(Re,o.message||"Refresh failed",!0)}finally{_(L,!1)}}}let B=De(!1);async function Ee(){if(!e(B)){_(B,!0);try{await an(t.data.repo,t.data.type,t.data.id),_(fe,null),await Ia()}catch(o){_(Re,o.message||"Apply changes failed",!0)}finally{_(B,!1)}}}let ce=null,x=De(""),k=!1,a=De(gt([]));function n(o){l(),Xe(async()=>{const{createCollabSession:D}=await import("../chunks/DQJwHeKh.js");return{createCollabSession:D}},__vite__mapDeps([8,9,10,11,12,13,14,15,16,17,18]),import.meta.url).then(({createCollabSession:D})=>{const se=getComputedStyle(document.documentElement).getPropertyValue("--color-accent").trim()||"#e05050",Z=D(o,{name:fa.user?.displayName??"Anonymous",color:se,colorLight:se+"33"});Z.ytext.observe(()=>{const de=Z.ytext.toString();de!==e(w)&&(k=!0,_(w,de,!0),requestAnimationFrame(()=>{k=!1}))});const me=Z.ydoc.clientID;function we(){const de=[];Z.awareness.getStates().forEach((re,oe)=>{if(oe===me)return;const M=re.cell;if(M==null||M.row==null||M.col==null)return;const{name:J="Anonymous",color:F="#e05050"}=re.user||{};de.push({row:M.row,col:M.col,name:J,color:F})}),_(a,de,!0)}Z.awareness.on("change",we),ce=Z,_(x,o,!0)})}function l(){ce&&(ce.destroy(),ce=null,_(x,""),_(a,[],!0))}wa(()=>l());let b=De(""),C=De(0);ht(()=>{const o=`${t.data.repo}/${t.data.type}/${t.data.id}`,D=Za.mutationCount;if(o!==e(b)||D!==e(C)){e(b)&&o!==e(b)&&He.flush(),_(b,o),_(C,D,!0),_(w,t.data.entity.document?.content??"",!0),_(u,{...t.data.entity.document?.frontmatter??t.data.entity.data??{}},!0),Mt(z),He.reset();const se=`${t.data.repo}/${t.data.type}/${t.data.id}`;e(S)&&se!==e(x)?n(se):e(S)||l()}}),ht(()=>{const o=t.data.repo,D=t.data.type,se=t.data.id;ma(()=>{ta.select(o,D,se),ta.showEntity()})});function q(o){if(!k){if(_(w,o,!0),ce){const D=ce.ytext,se=D.toString();o!==se&&ce.ydoc.transact(()=>{D.delete(0,D.length),D.insert(0,o)})}He.scheduleAutoSave(t.data.repo,t.data.type,t.data.id,{content:o})}}function ke(o,D){_(u,{...e(u),[o]:D},!0),He.scheduleAutoSave(t.data.repo,t.data.type,t.data.id,{data:e(u)})}function Te(o){const{[o]:D,...se}=e(u);_(u,se,!0),He.scheduleAutoSave(t.data.repo,t.data.type,t.data.id,{data:e(u)})}function E(o,D){_(u,{...e(u),[o]:D},!0),He.scheduleAutoSave(t.data.repo,t.data.type,t.data.id,{data:e(u)})}function v(o,D){He.scheduleAutoSave(t.data.repo,t.data.type,t.data.id,{data:e(u)})}let h=De(null);function O(o){o!==t.data.type&&_(h,o,!0)}async function ne(){const o=e(h);if(_(h,null),!!o){He.reset();try{await Ra(t.data.repo,t.data.type,t.data.id,o),await Ft.refreshEntities(t.data.repo),await Ut(`/${t.data.repo}/${o}/${t.data.id}`,{invalidateAll:!0})}catch(D){console.error("Failed to change entity type:",D)}}}function V(o){for(const D of Ft.repos){const se=D.entities.find(Z=>Z.id===o);if(se){Ut(`/${D.name}/${se.entityType}/${se.id}`);return}}Ya.showToast(`"${o}" is in a collection you don't have access to`)}ht(()=>(ua.enter(t.data.repo,t.data.type,t.data.id),()=>ua.leave()));const H=Oe(()=>e(fe)!==null&&(e(fe).diffs.length>0||e(fe).body_changed));function m(o){(o.metaKey||o.ctrlKey)&&o.key==="s"&&(o.preventDefault(),He.flush()),o.key==="Escape"&&!(o.target instanceof HTMLInputElement||o.target instanceof HTMLTextAreaElement)&&(He.flush(),ta.deselect(),Ut("/"))}var U=Wr();_t("keydown",ya,m);var ve=Ce(U);Ka(ve,{activeView:"entity"});var Y=N(ve,2);let c;var r=y(Y);{var T=o=>{var D=Or(),se=N(Ce(D),2),Z=y(se);Je(Z,{variant:"outline",size:"default",onclick:()=>_(fe,null),get disabled(){return e(B)},children:(we,de)=>{Ne();var re=pt("Dismiss");p(we,re)},$$slots:{default:!0}});var me=N(Z,2);Je(me,{variant:"accent",size:"default",onclick:Ee,get disabled(){return e(B)},children:(we,de)=>{var re=zr(),oe=Ce(re);{var M=F=>{_a(F,{class:"size-3 animate-spin",style:"display:inline;vertical-align:middle;margin-right:4px"})};be(oe,F=>{e(B)&&F(M)})}var J=N(oe,1,!0);le(()=>ue(J,e(B)?"Applying...":"Apply changes")),p(we,re)},$$slots:{default:!0}}),f(se),p(o,D)},ie=o=>{var D=Kr(),se=Ce(D);We(se,21,()=>e(g)(),Ze,(F,_e,Se)=>{var he=Mr(),Pe=Ce(he);{var Le=Fe=>{var Be=Lr();p(Fe,Be)};be(Pe,Fe=>{Se>0&&Fe(Le)})}var ye=N(Pe),Me=y(ye,!0);f(ye),le(Fe=>{Ct(ye,1,Fe,"svelte-udj3er"),ue(Me,e(_e))},[()=>La(Se===e(g)().length-1?"bc-current":"bc-segment")]),p(F,he)}),f(se);var Z=N(se,2),me=y(Z);{var we=F=>{var _e=Fr();p(F,_e)},de=F=>{var _e=Ir(),Se=y(_e,!0);f(_e),le(()=>ue(Se,He.error)),p(F,_e)};be(me,F=>{He.saving?F(we):He.error&&F(de,1)})}var re=N(me,2);{var oe=F=>{Je(F,{variant:"outline",size:"sm",class:"refresh-btn",onclick:Q,get disabled(){return e(L)},children:(_e,Se)=>{var he=jr(),Pe=Ce(he);{var Le=Me=>{_a(Me,{class:"size-3 animate-spin",style:"display:inline;vertical-align:middle;margin-right:4px"})};be(Pe,Me=>{e(L)&&Me(Le)})}var ye=N(Pe,1,!0);le(()=>ue(ye,e(L)?"Refreshing...":"Refresh from source")),p(_e,he)},$$slots:{default:!0}})};be(re,F=>{e(Ae)&&fa.user?.role==="admin"&&F(oe)})}var M=N(re,2);{var J=F=>{Je(F,{variant:"link",size:"sm",class:"open-app",get href(){return`/${t.data.repo??""}/${t.data.type??""}/${t.data.id??""}/edit`},children:(_e,Se)=>{Ne();var he=pt();le(()=>ue(he,`Open in ${e(P).name??""} →`)),p(_e,he)},$$slots:{default:!0}})};be(M,F=>{e(P)&&F(J)})}f(Z),p(o,D)};be(r,o=>{e(H)?o(T):o(ie,!1)})}f(Y);var R=N(Y,2);{var ee=o=>{var D=Ur();p(o,D)};be(R,o=>{e(fe)&&!e(H)&&o(ee)})}var X=N(R,2);{var $=o=>{Tr(o,{get properties(){return e(j)},get refreshResult(){return e(fe)},get bodyContent(){return e(w)}})},pe=o=>{var D=Vr(),se=y(D),Z=y(se);Qn(Z,{get properties(){return e(j)},editable:!0,get autofocusKey(){return e(K)},get protectedKeys(){return A},onedit:ke,onremove:Te,onadd:E,ontypechange:v,onentitytypechange:O,onfocuseditor:()=>{requestAnimationFrame(()=>requestAnimationFrame(()=>{const re=document.querySelector(".cm-content");if(re){re.focus();const oe=window.getSelection();oe&&re.firstChild?oe.collapse(re.firstChild,0):oe&&oe.collapse(re,0)}}))}});var me=N(Z,2);{var we=re=>{dr(re,{get content(){return e(w)},onchange:q,onsave:()=>He.flush(),oncellselect:(oe,M)=>{ce?.awareness.setLocalStateField("cell",{row:oe,col:M})},get remoteCursors(){return e(a)}})},de=re=>{{let oe=Oe(()=>`${t.data.repo}/${t.data.type}/${t.data.id}`);er(re,{get content(){return e(w)},readonly:!1,onchange:q,onsave:()=>He.flush(),onwikilinkclick:V,get resetKey(){return e(z)},get cursorDocName(){return e(oe)}})}};be(me,re=>{e(S)?re(we):re(de,!1)})}f(se),f(D),p(o,D)};be(X,o=>{e(H)?o($):o(pe,!1)})}var ae=N(X,2);{let o=Oe(()=>!!e(Re));Ue(ae,()=>tn,(D,se)=>{se(D,{get open(){return e(o)},onOpenChange:Z=>{Z||_(Re,null)},children:(Z,me)=>{var we=Ye(),de=Ce(we);Ue(de,()=>Ja,(re,oe)=>{oe(re,{children:(M,J)=>{var F=qr(),_e=Ce(F);Ue(_e,()=>Qa,(he,Pe)=>{Pe(he,{children:(Le,ye)=>{var Me=Nr(),Fe=Ce(Me);Ue(Fe,()=>Ga,(te,G)=>{G(te,{children:(ge,xe)=>{Ne();var ze=pt("Refresh failed");p(ge,ze)},$$slots:{default:!0}})});var Be=N(Fe,2);Ue(Be,()=>Xa,(te,G)=>{G(te,{children:(ge,xe)=>{Ne();var ze=pt();le(()=>ue(ze,e(Re))),p(ge,ze)},$$slots:{default:!0}})}),p(Le,Me)},$$slots:{default:!0}})});var Se=N(_e,2);Ue(Se,()=>$a,(he,Pe)=>{Pe(he,{children:(Le,ye)=>{var Me=Ye(),Fe=Ce(Me);Ue(Fe,()=>en,(Be,te)=>{te(Be,{children:(G,ge)=>{Ne();var xe=pt("OK");p(G,xe)},$$slots:{default:!0}})}),p(Le,Me)},$$slots:{default:!0}})}),p(M,F)},$$slots:{default:!0}})}),p(Z,we)},$$slots:{default:!0}})})}var Ie=N(ae,2);{let o=Oe(()=>e(h)!==null),D=Oe(()=>`Change this entity from ${xt(t.data.type)} to ${xt(e(h)??"")}? Fields specific to ${xt(t.data.type)} will be removed.`);qa(Ie,{get open(){return e(o)},title:"Change entity type",get message(){return e(D)},confirmLabel:"Change type",onconfirm:ne,oncancel:()=>{_(h,null)}})}le(()=>c=Ct(Y,1,"editor-bar svelte-udj3er",null,c,{"editor-bar-diff":e(H)})),p(W,U),st(),d()}export{mi as component,gi as universal};
11
+ `,'"',u.BYTE_ORDER_MARK],u.WORKERS_SUPPORTED=!S&&!!i.Worker,u.NODE_STREAM_INPUT=1,u.LocalChunkSize=10485760,u.RemoteChunkSize=5242880,u.DefaultDelimiter=",",u.Parser=Re,u.ParserHandle=L,u.NetworkStreamer=j,u.FileStreamer=A,u.StringStreamer=K,u.ReadableStreamStreamer=Ae,i.jQuery&&((d=i.jQuery).fn.parse=function(a){var n=a.config||{},l=[];return this.each(function(q){if(!(d(this).prop("tagName").toUpperCase()==="INPUT"&&d(this).attr("type").toLowerCase()==="file"&&i.FileReader)||!this.files||this.files.length===0)return!0;for(var ke=0;ke<this.files.length;ke++)l.push({file:this.files[ke],inputElem:this,instanceConfig:d.extend({},n)})}),b(),this;function b(){if(l.length===0)k(a.complete)&&a.complete();else{var q,ke,Te,E,v=l[0];if(k(a.before)){var h=a.before(v.file,v.inputElem);if(typeof h=="object"){if(h.action==="abort")return q="AbortError",ke=v.file,Te=v.inputElem,E=h.reason,void(k(a.error)&&a.error({name:q},ke,Te,E));if(h.action==="skip")return void C();typeof h.config=="object"&&(v.instanceConfig=d.extend(v.instanceConfig,h.config))}else if(h==="skip")return void C()}var O=v.instanceConfig.complete;v.instanceConfig.complete=function(ne){k(O)&&O(ne,v.file,v.inputElem),C()},u.parse(v.file,v.instanceConfig)}}function C(){l.splice(0,1),b()}}),P&&(i.onmessage=function(a){a=a.data,u.WORKER_ID===void 0&&a&&(u.WORKER_ID=a.workerId),typeof a.input=="string"?i.postMessage({workerId:u.WORKER_ID,results:u.parse(a.input,a.config),finished:!0}):(i.File&&a.input instanceof File||a.input instanceof Object)&&(a=u.parse(a.input,a.config))&&i.postMessage({workerId:u.WORKER_ID,results:a,finished:!0})}),(j.prototype=Object.create(z.prototype)).constructor=j,(A.prototype=Object.create(z.prototype)).constructor=A,(K.prototype=Object.create(K.prototype)).constructor=K,(Ae.prototype=Object.create(z.prototype)).constructor=Ae,u})})(Bt)),Bt.exports}var nr=ar();const ha=Ha(nr);var rr=I('<span class="remote-cell-label svelte-63hltt"> </span>'),ir=I('<th><!> <input class="cell-input header-input svelte-63hltt"/> <!></th>'),sr=I('<span class="remote-cell-label svelte-63hltt"> </span>'),or=I('<td><!> <input class="cell-input svelte-63hltt"/></td>'),lr=I('<tr class="svelte-63hltt"><td class="row-num svelte-63hltt"></td><!><td class="actions svelte-63hltt"><!></td></tr>'),ur=I("<!> <span>Add row</span>",1),cr=I('<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 dr(W,t){it(t,!0);let s=Ve(t,"remoteCursors",19,()=>[]),i=De(gt([])),d=De(gt([])),S=De(void 0);function P(E){const v=ha.parse(E.trim(),{header:!1,skipEmptyLines:!0});v.data.length>0?(_(i,v.data[0],!0),_(d,v.data.slice(1),!0)):(_(i,[],!0),_(d,[],!0))}P(t.content),ht(()=>{P(t.content)});function g(){return ha.unparse([e(i),...e(d)])}function w(){const E=g();t.onchange?.(E)}function u(E,v,h){e(d)[E][v]=h,_(d,[...e(d)],!0),w()}function z(E,v){e(i)[E]=v,_(i,[...e(i)],!0),w()}function j(){_(d,[...e(d),e(i).map(()=>"")],!0),w(),L(e(d).length-1,0)}function A(E){_(d,e(d).filter((v,h)=>h!==E),!0),w()}function K(){const E=`col${e(i).length+1}`;_(i,[...e(i),E],!0),_(d,e(d).map(v=>[...v,""]),!0),w(),requestAnimationFrame(()=>{const v=e(S)?.querySelector(`thead th:nth-child(${e(i).length+1}) input`);v&&(v.focus(),v.select())})}function Ae(E){e(i).length<=1||(_(i,e(i).filter((v,h)=>h!==E),!0),_(d,e(d).map(v=>v.filter((h,O)=>O!==E)),!0),w())}function L(E,v){requestAnimationFrame(()=>{if(!e(S))return;let h=null;E<0?h=e(S).querySelector(`thead th:nth-child(${v+2}) input`):h=e(S).querySelector(`tbody tr:nth-child(${E+1}) td:nth-child(${v+2}) input`),h&&(h.focus(),h.select())})}function fe(E,v,h){if(E.key==="Tab"){E.preventDefault(),E.shiftKey?h>0?L(v,h-1):v>0?L(v-1,e(i).length-1):v===0&&L(-1,e(i).length-1):h<e(i).length-1?L(v,h+1):v<e(d).length-1?L(v+1,0):v===e(d).length-1&&j();return}if(E.key==="Enter"){E.preventDefault(),E.shiftKey?v>0?L(v-1,h):L(-1,h):v<e(d).length-1?L(v+1,h):j();return}if(E.key==="Escape"){E.target.blur();return}}function Re(E,v){if(E.key==="Tab"){E.preventDefault(),E.shiftKey?v>0&&L(-1,v-1):v<e(i).length-1?L(-1,v+1):e(d).length>0&&L(0,0);return}if(E.key==="Enter"){E.preventDefault(),e(d).length>0?L(0,v):j();return}if(E.key==="Escape"){E.target.blur();return}}function Q(E,v){return s().find(h=>h.row===E&&h.col===v)}function B(E,v){t.oncellselect?.(E,v)}function Ee(E){(E.metaKey||E.ctrlKey)&&E.key==="s"&&(E.preventDefault(),t.onsave?.())}var ce=cr(),x=y(ce),k=y(x),a=y(k),n=y(a),l=N(y(n));We(l,17,()=>e(i),Ze,(E,v,h)=>{const O=Oe(()=>Q(-1,h));var ne=ir();let V;var H=y(ne);{var m=c=>{var r=rr(),T=y(r,!0);f(r),le(()=>{et(r,`background-color: ${e(O).color??""}`),ue(T,e(O).name)}),p(c,r)};be(H,c=>{e(O)&&c(m)})}var U=N(H,2);It(U);var ve=N(U,2);{var Y=c=>{Je(c,{variant:"ghost",size:"icon",class:"col-delete-btn",title:"Delete column",onclick:()=>Ae(h),children:(r,T)=>{da(r,{size:12})},$$slots:{default:!0}})};be(ve,c=>{e(i).length>1&&c(Y)})}f(ne),le(()=>{et(ne,e(O)?`--rc-color: ${e(O).color}`:""),V=Ct(ne,1,"svelte-63hltt",null,V,{"remote-active":!!e(O)}),aa(U,e(v))}),Qe("input",U,c=>z(h,c.currentTarget.value)),Qe("keydown",U,c=>Re(c,h)),_t("focus",U,()=>B(-1,h)),p(E,ne)});var b=N(l),C=y(b);Je(C,{variant:"ghost",size:"icon",class:"col-add-btn",title:"Add column",onclick:K,children:(E,v)=>{Ht(E,{size:14})},$$slots:{default:!0}}),f(b),f(n),f(a);var q=N(a);We(q,21,()=>e(d),Ze,(E,v,h)=>{var O=lr(),ne=y(O);ne.textContent=h+1;var V=N(ne);We(V,17,()=>e(v),Ze,(U,ve,Y)=>{const c=Oe(()=>Q(h,Y));var r=or();let T;var ie=y(r);{var R=X=>{var $=sr(),pe=y($,!0);f($),le(()=>{et($,`background-color: ${e(c).color??""}`),ue(pe,e(c).name)}),p(X,$)};be(ie,X=>{e(c)&&X(R)})}var ee=N(ie,2);It(ee),f(r),le(()=>{et(r,e(c)?`--rc-color: ${e(c).color}`:""),T=Ct(r,1,"svelte-63hltt",null,T,{"remote-active":!!e(c)}),aa(ee,e(ve))}),Qe("input",ee,X=>u(h,Y,X.currentTarget.value)),Qe("keydown",ee,X=>fe(X,h,Y)),_t("focus",ee,()=>B(h,Y)),p(U,r)});var H=N(V),m=y(H);Je(m,{variant:"ghost",size:"icon",class:"delete-btn",title:"Delete row",onclick:()=>A(h),children:(U,ve)=>{da(U,{size:12})},$$slots:{default:!0}}),f(H),f(O),p(E,O)}),f(q),f(k),Yt(k,E=>_(S,E),()=>e(S)),f(x);var ke=N(x,2),Te=y(ke);Je(Te,{variant:"ghost",class:"add-row-btn",onclick:j,children:(E,v)=>{var h=ur(),O=Ce(h);Ht(O,{size:14}),Ne(2),p(E,h)},$$slots:{default:!0}}),f(ke),f(ce),Qe("keydown",ce,Ee),p(W,ce),st()}na(["keydown","input"]);const fr=/^\d{4}-\d{2}-\d{2}/,vr=new Set(["active","inactive","in-progress","completed","draft","archived","current","former","contractor","client","partner","won","lost","open","closed"]),hr=new Set(["format"]),pr=new Set(["entity_id","created_at","updated_at","created_by","updated_by"]);function _r(W,t){const s=[];for(const[d,S]of Object.entries(W)){if(pr.has(d)||S==null)continue;const P=gr(d,S);P&&s.push(P)}const i=["entity_type","name","date"];return s.sort((d,S)=>{const P=i.indexOf(d.key),g=i.indexOf(S.key);return P!==-1&&g!==-1?P-g:P!==-1?-1:g!==-1?1:d.key.localeCompare(S.key)}),s}function gr(W,t){if(W==="entity_type")return{key:W,value:String(t),type:"entity-type"};if(hr.has(W))return{key:W,value:String(t).toUpperCase(),type:"badge"};if(W==="status")return{key:W,value:String(t),type:"status"};if(Array.isArray(t)){if(t.length>0&&typeof t[0]=="object"&&t[0]!==null){const g=t.map(w=>Object.entries(w).map(([z,j])=>`${z}: ${j}`).join(", "));return{key:W,value:g.join(" | "),type:"text"}}const d=t.map(String),S=d.some(g=>/^\[\[.+?\]\]$/.test(g)),P=d.map(g=>{const w=g.match(/^\[\[(.+?)\]\]$/);return w?w[1]:g});return S||P.every(g=>pa(g))?{key:W,value:P,type:"wikilink"}:{key:W,value:d.join(", "),type:"text"}}const s=String(t),i=s.match(/^\[\[(.+?)\]\]$/);return i?{key:W,value:i[1],type:"wikilink"}:fr.test(s)?{key:W,value:s,type:"date"}:vr.has(s.toLowerCase())?{key:W,value:s,type:"status"}:pa(s)&&!s.includes(" ")?{key:W,value:s,type:"wikilink"}:{key:W,value:s,type:"text"}}function pa(W){return/^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(W)&&W.includes("-")}var mr=rt("<title> </title>"),yr=rt('<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 _a(W,t){const s=nt(t,["children","$$slots","$$events","$$legacy"]),i=nt(s,["size","title"]);it(t,!1);const d=at(),S=at();let P=Ve(t,"size",8,16),g=Ve(t,"title",8,void 0);tt(()=>(qe(s),qe(g())),()=>{_(d,s["aria-label"]||s["aria-labelledby"]||g())}),tt(()=>(e(d),qe(s)),()=>{_(S,{"aria-hidden":e(d)?void 0:!0,role:e(d)?"img":void 0,focusable:Number(s.tabindex)===0?!0:void 0})}),Et(),At();var w=yr();St(w,()=>({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",fill:"currentColor",preserveAspectRatio:"xMidYMid meet",width:P(),height:P(),...e(S),...i}));var u=y(w);{var z=j=>{var A=mr(),K=y(A,!0);f(A),le(()=>ue(K,g())),p(j,A)};be(u,j=>{g()&&j(z)})}Ne(),f(w),p(W,w),st()}class wr{diff(t,s,i={}){let d;typeof i=="function"?(d=i,i={}):"callback"in i&&(d=i.callback);const S=this.castInput(t,i),P=this.castInput(s,i),g=this.removeEmpty(this.tokenize(S,i)),w=this.removeEmpty(this.tokenize(P,i));return this.diffWithOptionsObj(g,w,i,d)}diffWithOptionsObj(t,s,i,d){var S;const P=Q=>{if(Q=this.postProcess(Q,i),d){setTimeout(function(){d(Q)},0);return}else return Q},g=s.length,w=t.length;let u=1,z=g+w;i.maxEditLength!=null&&(z=Math.min(z,i.maxEditLength));const j=(S=i.timeout)!==null&&S!==void 0?S:1/0,A=Date.now()+j,K=[{oldPos:-1,lastComponent:void 0}];let Ae=this.extractCommon(K[0],s,t,0,i);if(K[0].oldPos+1>=w&&Ae+1>=g)return P(this.buildValues(K[0].lastComponent,s,t));let L=-1/0,fe=1/0;const Re=()=>{for(let Q=Math.max(L,-u);Q<=Math.min(fe,u);Q+=2){let B;const Ee=K[Q-1],ce=K[Q+1];Ee&&(K[Q-1]=void 0);let x=!1;if(ce){const a=ce.oldPos-Q;x=ce&&0<=a&&a<g}const k=Ee&&Ee.oldPos+1<w;if(!x&&!k){K[Q]=void 0;continue}if(!k||x&&Ee.oldPos<ce.oldPos?B=this.addToPath(ce,!0,!1,0,i):B=this.addToPath(Ee,!1,!0,1,i),Ae=this.extractCommon(B,s,t,Q,i),B.oldPos+1>=w&&Ae+1>=g)return P(this.buildValues(B.lastComponent,s,t))||!0;K[Q]=B,B.oldPos+1>=w&&(fe=Math.min(fe,Q-1)),Ae+1>=g&&(L=Math.max(L,Q+1))}u++};if(d)(function Q(){setTimeout(function(){if(u>z||Date.now()>A)return d(void 0);Re()||Q()},0)})();else for(;u<=z&&Date.now()<=A;){const Q=Re();if(Q)return Q}}addToPath(t,s,i,d,S){const P=t.lastComponent;return P&&!S.oneChangePerToken&&P.added===s&&P.removed===i?{oldPos:t.oldPos+d,lastComponent:{count:P.count+1,added:s,removed:i,previousComponent:P.previousComponent}}:{oldPos:t.oldPos+d,lastComponent:{count:1,added:s,removed:i,previousComponent:P}}}extractCommon(t,s,i,d,S){const P=s.length,g=i.length;let w=t.oldPos,u=w-d,z=0;for(;u+1<P&&w+1<g&&this.equals(i[w+1],s[u+1],S);)u++,w++,z++,S.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return z&&!S.oneChangePerToken&&(t.lastComponent={count:z,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=w,u}equals(t,s,i){return i.comparator?i.comparator(t,s):t===s||!!i.ignoreCase&&t.toLowerCase()===s.toLowerCase()}removeEmpty(t){const s=[];for(let i=0;i<t.length;i++)t[i]&&s.push(t[i]);return s}castInput(t,s){return t}tokenize(t,s){return Array.from(t)}join(t){return t.join("")}postProcess(t,s){return t}get useLongestToken(){return!1}buildValues(t,s,i){const d=[];let S;for(;t;)d.push(t),S=t.previousComponent,delete t.previousComponent,t=S;d.reverse();const P=d.length;let g=0,w=0,u=0;for(;g<P;g++){const z=d[g];if(z.removed)z.value=this.join(i.slice(u,u+z.count)),u+=z.count;else{if(!z.added&&this.useLongestToken){let j=s.slice(w,w+z.count);j=j.map(function(A,K){const Ae=i[u+K];return Ae.length>A.length?Ae:A}),z.value=this.join(j)}else z.value=this.join(s.slice(w,w+z.count));w+=z.count,z.added||(u+=z.count)}}return d}}const ga="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 br extends wr{tokenize(t){const s=new RegExp(`(\\r?\\n)|[${ga}]+|[^\\S\\n\\r]+|[^${ga}]`,"ug");return t.match(s)||[]}}const kr=new br;function xr(W,t,s){return kr.diff(W,t,s)}var Cr=I('<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>'),Er=I('<div class="diff-properties svelte-1g4tvol"></div>'),Sr=I('<span class="db-added"> </span>'),Ar=I('<span class="db-removed"> </span>'),Pr=I("<span> </span>"),Rr=I("<span> </span>"),Dr=I('<div class="diff-view svelte-1g4tvol"><!> <div class="diff-body svelte-1g4tvol"><!></div></div>');function Tr(W,t){it(t,!0);function s(A){if(A==null)return"";if(typeof A!="object")return String(A);const K=A;return String(K.name??K.title??K.label??K.id??JSON.stringify(K))}function i(A){return A==null?"":Array.isArray(A)?A.map(s).join(", "):typeof A=="object"?s(A):String(A)}const d=Oe(()=>t.refreshResult.body_changed&&t.refreshResult.body_diff?xr(t.refreshResult.body_diff.old,t.refreshResult.body_diff.new):null);var S=Dr(),P=y(S);{var g=A=>{var K=Er();We(K,21,()=>t.refreshResult.diffs,Ze,(Ae,L)=>{const fe=Oe(()=>t.properties.find(h=>h.key===e(L).field));var Re=Cr(),Q=y(Re),B=y(Q);{var Ee=h=>{Nt(h,{size:14})},ce=h=>{qt(h,{size:14})},x=h=>{Wt(h,{size:14})},k=h=>{ka(h,{size:14})},a=h=>{Vt(h,{size:14})};be(B,h=>{e(fe)?.type==="date"?h(Ee):e(fe)?.type==="status"?h(ce,1):e(fe)?.type==="wikilink"?h(x,2):e(fe)?.type==="badge"?h(k,3):h(a,!1)})}f(Q);var n=N(Q,2),l=y(n,!0);f(n);var b=N(n,2),C=y(b),q=y(C),ke=y(q,!0);f(q),f(C);var Te=N(C,2),E=y(Te),v=y(E,!0);f(E),f(Te),f(b),f(Re),le((h,O)=>{ue(l,e(L).field),ue(ke,h),ue(v,O)},[()=>i(e(L).old_value),()=>i(e(L).new_value)]),p(Ae,Re)}),f(K),p(A,K)};be(P,A=>{t.refreshResult.diffs.length>0&&A(g)})}var w=N(P,2),u=y(w);{var z=A=>{var K=Ye(),Ae=Ce(K);We(Ae,17,()=>e(d),Ze,(L,fe)=>{var Re=Ye(),Q=Ce(Re);{var B=x=>{var k=Sr(),a=y(k,!0);f(k),le(()=>ue(a,e(fe).value)),p(x,k)},Ee=x=>{var k=Ar(),a=y(k,!0);f(k),le(()=>ue(a,e(fe).value)),p(x,k)},ce=x=>{var k=Pr(),a=y(k,!0);f(k),le(()=>ue(a,e(fe).value)),p(x,k)};be(Q,x=>{e(fe).added?x(B):e(fe).removed?x(Ee,1):x(ce,!1)})}p(L,Re)}),p(A,K)},j=A=>{var K=Rr(),Ae=y(K,!0);f(K),le(()=>ue(Ae,t.bodyContent)),p(A,K)};be(u,A=>{e(d)?A(z):A(j,!1)})}f(w),f(S),p(W,S),st()}var zr=I("<!> ",1),Or=I('<span class="diff-action-title svelte-udj3er">Changes from source</span> <div class="diff-action-buttons svelte-udj3er"><!> <!></div>',1),Lr=I('<span class="bc-sep svelte-udj3er">/</span>'),Mr=I("<!><span> </span>",1),Fr=I('<span class="status-text saving svelte-udj3er">Saving...</span>'),Ir=I('<span class="status-text error svelte-udj3er"> </span>'),jr=I("<!> ",1),Kr=I('<div class="breadcrumb-path svelte-udj3er"></div> <div class="editor-actions svelte-udj3er"><!> <!> <!></div>',1),Ur=I('<div class="refresh-panel svelte-udj3er"><div class="refresh-uptodate svelte-udj3er">Entity is up to date with source.</div></div>'),Vr=I('<div class="document-scroll svelte-udj3er"><div class="document-well svelte-udj3er"><!> <!></div></div>'),Nr=I("<!> <!>",1),qr=I("<!> <!>",1),Wr=I("<!> <div><!></div> <!> <!> <!> <!>",1);function mi(W,t){it(t,!0);const s=()=>Ma(ja,"$page",i),[i,d]=Fa(),S=Oe(()=>t.data.type==="dataset"||t.data.entity.document?.frontmatter?.entity_type==="dataset"),P=Oe(()=>Ft.getAppForEntityType(t.data.entity.document?.frontmatter?.entity_type??t.data.type)),g=Oe(()=>()=>{const o=t.data.entity.path;if(o){const D=o.lastIndexOf(`/${t.data.repo}/`);if(D>=0)return o.substring(D+1).split("/")}return[t.data.repo,t.data.id,"main.md"]});let w=De(""),u=De(gt({})),z=De(0);const j=Oe(()=>_r(e(u))),A=new Set(["name","date"]);let K=De(null);ht(()=>{if(s().url.searchParams.has("new")){_(K,"name");const o=new URL(s().url);o.searchParams.delete("new"),history.replaceState({},"",o.pathname)}else _(K,null)});const Ae=Oe(()=>!!t.data.entity.data?.source_ref);let L=De(!1),fe=De(null),Re=De(null);async function Q(){if(!e(L)){_(L,!0),_(fe,null),_(Re,null);try{const{result:o}=await nn(t.data.repo,t.data.type,t.data.id);_(fe,o,!0)}catch(o){_(Re,o.message||"Refresh failed",!0)}finally{_(L,!1)}}}let B=De(!1);async function Ee(){if(!e(B)){_(B,!0);try{await an(t.data.repo,t.data.type,t.data.id),_(fe,null),await Ia()}catch(o){_(Re,o.message||"Apply changes failed",!0)}finally{_(B,!1)}}}let ce=null,x=De(""),k=!1,a=De(gt([]));function n(o){l(),Xe(async()=>{const{createCollabSession:D}=await import("../chunks/BDTSG9D-.js");return{createCollabSession:D}},__vite__mapDeps([8,9,10,11,12,13,14,15,16,17,18]),import.meta.url).then(({createCollabSession:D})=>{const se=getComputedStyle(document.documentElement).getPropertyValue("--color-accent").trim()||"#e05050",Z=D(o,{name:fa.user?.displayName??"Anonymous",color:se,colorLight:se+"33"});Z.ytext.observe(()=>{const de=Z.ytext.toString();de!==e(w)&&(k=!0,_(w,de,!0),requestAnimationFrame(()=>{k=!1}))});const me=Z.ydoc.clientID;function we(){const de=[];Z.awareness.getStates().forEach((re,oe)=>{if(oe===me)return;const M=re.cell;if(M==null||M.row==null||M.col==null)return;const{name:J="Anonymous",color:F="#e05050"}=re.user||{};de.push({row:M.row,col:M.col,name:J,color:F})}),_(a,de,!0)}Z.awareness.on("change",we),ce=Z,_(x,o,!0)})}function l(){ce&&(ce.destroy(),ce=null,_(x,""),_(a,[],!0))}wa(()=>l());let b=De(""),C=De(0);ht(()=>{const o=`${t.data.repo}/${t.data.type}/${t.data.id}`,D=Za.mutationCount;if(o!==e(b)||D!==e(C)){e(b)&&o!==e(b)&&He.flush(),_(b,o),_(C,D,!0),_(w,t.data.entity.document?.content??"",!0),_(u,{...t.data.entity.document?.frontmatter??t.data.entity.data??{}},!0),Mt(z),He.reset();const se=`${t.data.repo}/${t.data.type}/${t.data.id}`;e(S)&&se!==e(x)?n(se):e(S)||l()}}),ht(()=>{const o=t.data.repo,D=t.data.type,se=t.data.id;ma(()=>{ta.select(o,D,se),ta.showEntity()})});function q(o){if(!k){if(_(w,o,!0),ce){const D=ce.ytext,se=D.toString();o!==se&&ce.ydoc.transact(()=>{D.delete(0,D.length),D.insert(0,o)})}He.scheduleAutoSave(t.data.repo,t.data.type,t.data.id,{content:o})}}function ke(o,D){_(u,{...e(u),[o]:D},!0),He.scheduleAutoSave(t.data.repo,t.data.type,t.data.id,{data:e(u)})}function Te(o){const{[o]:D,...se}=e(u);_(u,se,!0),He.scheduleAutoSave(t.data.repo,t.data.type,t.data.id,{data:e(u)})}function E(o,D){_(u,{...e(u),[o]:D},!0),He.scheduleAutoSave(t.data.repo,t.data.type,t.data.id,{data:e(u)})}function v(o,D){He.scheduleAutoSave(t.data.repo,t.data.type,t.data.id,{data:e(u)})}let h=De(null);function O(o){o!==t.data.type&&_(h,o,!0)}async function ne(){const o=e(h);if(_(h,null),!!o){He.reset();try{await Ra(t.data.repo,t.data.type,t.data.id,o),await Ft.refreshEntities(t.data.repo),await Ut(`/${t.data.repo}/${o}/${t.data.id}`,{invalidateAll:!0})}catch(D){console.error("Failed to change entity type:",D)}}}function V(o){for(const D of Ft.repos){const se=D.entities.find(Z=>Z.id===o);if(se){Ut(`/${D.name}/${se.entityType}/${se.id}`);return}}Ya.showToast(`"${o}" is in a collection you don't have access to`)}ht(()=>(ua.enter(t.data.repo,t.data.type,t.data.id),()=>ua.leave()));const H=Oe(()=>e(fe)!==null&&(e(fe).diffs.length>0||e(fe).body_changed));function m(o){(o.metaKey||o.ctrlKey)&&o.key==="s"&&(o.preventDefault(),He.flush()),o.key==="Escape"&&!(o.target instanceof HTMLInputElement||o.target instanceof HTMLTextAreaElement)&&(He.flush(),ta.deselect(),Ut("/"))}var U=Wr();_t("keydown",ya,m);var ve=Ce(U);Ka(ve,{activeView:"entity"});var Y=N(ve,2);let c;var r=y(Y);{var T=o=>{var D=Or(),se=N(Ce(D),2),Z=y(se);Je(Z,{variant:"outline",size:"default",onclick:()=>_(fe,null),get disabled(){return e(B)},children:(we,de)=>{Ne();var re=pt("Dismiss");p(we,re)},$$slots:{default:!0}});var me=N(Z,2);Je(me,{variant:"accent",size:"default",onclick:Ee,get disabled(){return e(B)},children:(we,de)=>{var re=zr(),oe=Ce(re);{var M=F=>{_a(F,{class:"size-3 animate-spin",style:"display:inline;vertical-align:middle;margin-right:4px"})};be(oe,F=>{e(B)&&F(M)})}var J=N(oe,1,!0);le(()=>ue(J,e(B)?"Applying...":"Apply changes")),p(we,re)},$$slots:{default:!0}}),f(se),p(o,D)},ie=o=>{var D=Kr(),se=Ce(D);We(se,21,()=>e(g)(),Ze,(F,_e,Se)=>{var he=Mr(),Pe=Ce(he);{var Le=Fe=>{var Be=Lr();p(Fe,Be)};be(Pe,Fe=>{Se>0&&Fe(Le)})}var ye=N(Pe),Me=y(ye,!0);f(ye),le(Fe=>{Ct(ye,1,Fe,"svelte-udj3er"),ue(Me,e(_e))},[()=>La(Se===e(g)().length-1?"bc-current":"bc-segment")]),p(F,he)}),f(se);var Z=N(se,2),me=y(Z);{var we=F=>{var _e=Fr();p(F,_e)},de=F=>{var _e=Ir(),Se=y(_e,!0);f(_e),le(()=>ue(Se,He.error)),p(F,_e)};be(me,F=>{He.saving?F(we):He.error&&F(de,1)})}var re=N(me,2);{var oe=F=>{Je(F,{variant:"outline",size:"sm",class:"refresh-btn",onclick:Q,get disabled(){return e(L)},children:(_e,Se)=>{var he=jr(),Pe=Ce(he);{var Le=Me=>{_a(Me,{class:"size-3 animate-spin",style:"display:inline;vertical-align:middle;margin-right:4px"})};be(Pe,Me=>{e(L)&&Me(Le)})}var ye=N(Pe,1,!0);le(()=>ue(ye,e(L)?"Refreshing...":"Refresh from source")),p(_e,he)},$$slots:{default:!0}})};be(re,F=>{e(Ae)&&fa.user?.role==="admin"&&F(oe)})}var M=N(re,2);{var J=F=>{Je(F,{variant:"link",size:"sm",class:"open-app",get href(){return`/${t.data.repo??""}/${t.data.type??""}/${t.data.id??""}/edit`},children:(_e,Se)=>{Ne();var he=pt();le(()=>ue(he,`Open in ${e(P).name??""} →`)),p(_e,he)},$$slots:{default:!0}})};be(M,F=>{e(P)&&F(J)})}f(Z),p(o,D)};be(r,o=>{e(H)?o(T):o(ie,!1)})}f(Y);var R=N(Y,2);{var ee=o=>{var D=Ur();p(o,D)};be(R,o=>{e(fe)&&!e(H)&&o(ee)})}var X=N(R,2);{var $=o=>{Tr(o,{get properties(){return e(j)},get refreshResult(){return e(fe)},get bodyContent(){return e(w)}})},pe=o=>{var D=Vr(),se=y(D),Z=y(se);Qn(Z,{get properties(){return e(j)},editable:!0,get autofocusKey(){return e(K)},get protectedKeys(){return A},onedit:ke,onremove:Te,onadd:E,ontypechange:v,onentitytypechange:O,onfocuseditor:()=>{requestAnimationFrame(()=>requestAnimationFrame(()=>{const re=document.querySelector(".cm-content");if(re){re.focus();const oe=window.getSelection();oe&&re.firstChild?oe.collapse(re.firstChild,0):oe&&oe.collapse(re,0)}}))}});var me=N(Z,2);{var we=re=>{dr(re,{get content(){return e(w)},onchange:q,onsave:()=>He.flush(),oncellselect:(oe,M)=>{ce?.awareness.setLocalStateField("cell",{row:oe,col:M})},get remoteCursors(){return e(a)}})},de=re=>{{let oe=Oe(()=>`${t.data.repo}/${t.data.type}/${t.data.id}`);er(re,{get content(){return e(w)},readonly:!1,onchange:q,onsave:()=>He.flush(),onwikilinkclick:V,get resetKey(){return e(z)},get cursorDocName(){return e(oe)}})}};be(me,re=>{e(S)?re(we):re(de,!1)})}f(se),f(D),p(o,D)};be(X,o=>{e(H)?o($):o(pe,!1)})}var ae=N(X,2);{let o=Oe(()=>!!e(Re));Ue(ae,()=>tn,(D,se)=>{se(D,{get open(){return e(o)},onOpenChange:Z=>{Z||_(Re,null)},children:(Z,me)=>{var we=Ye(),de=Ce(we);Ue(de,()=>Ja,(re,oe)=>{oe(re,{children:(M,J)=>{var F=qr(),_e=Ce(F);Ue(_e,()=>Qa,(he,Pe)=>{Pe(he,{children:(Le,ye)=>{var Me=Nr(),Fe=Ce(Me);Ue(Fe,()=>Ga,(te,G)=>{G(te,{children:(ge,xe)=>{Ne();var ze=pt("Refresh failed");p(ge,ze)},$$slots:{default:!0}})});var Be=N(Fe,2);Ue(Be,()=>Xa,(te,G)=>{G(te,{children:(ge,xe)=>{Ne();var ze=pt();le(()=>ue(ze,e(Re))),p(ge,ze)},$$slots:{default:!0}})}),p(Le,Me)},$$slots:{default:!0}})});var Se=N(_e,2);Ue(Se,()=>$a,(he,Pe)=>{Pe(he,{children:(Le,ye)=>{var Me=Ye(),Fe=Ce(Me);Ue(Fe,()=>en,(Be,te)=>{te(Be,{children:(G,ge)=>{Ne();var xe=pt("OK");p(G,xe)},$$slots:{default:!0}})}),p(Le,Me)},$$slots:{default:!0}})}),p(M,F)},$$slots:{default:!0}})}),p(Z,we)},$$slots:{default:!0}})})}var Ie=N(ae,2);{let o=Oe(()=>e(h)!==null),D=Oe(()=>`Change this entity from ${xt(t.data.type)} to ${xt(e(h)??"")}? Fields specific to ${xt(t.data.type)} will be removed.`);qa(Ie,{get open(){return e(o)},title:"Change entity type",get message(){return e(D)},confirmLabel:"Change type",onconfirm:ne,oncancel:()=>{_(h,null)}})}le(()=>c=Ct(Y,1,"editor-bar svelte-udj3er",null,c,{"editor-bar-diff":e(H)})),p(W,U),st(),d()}export{mi as component,gi as universal};
@@ -1,4 +1,4 @@
1
- import{h as lt,w as ut}from"../chunks/DSkxw4Ss.js";import{a as S,s as Z,b as M,c as ft}from"../chunks/b0XUoOIH.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/DSh-OF2y.js";import{b as X,i as j}from"../chunks/DT3KtxWU.js";import{s as Y}from"../chunks/CFtRXHDP.js";import{g as pt}from"../chunks/BAAbylyg.js";import{n as E}from"../chunks/DC9z5DEo.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/Cc0c675R.js";import{a as S,s as Z,b as M,c as ft}from"../chunks/b0XUoOIH.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/DSh-OF2y.js";import{b as X,i as j}from"../chunks/DT3KtxWU.js";import{s as Y}from"../chunks/CFtRXHDP.js";import{g as pt}from"../chunks/C0v9FrTH.js";import{n as E}from"../chunks/HVmKTSmh.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};