studiograph 1.3.9 → 1.3.10

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 (34) hide show
  1. package/dist/web/_app/immutable/chunks/{Bi-t3yHN.js → AWihU6Ne.js} +1 -1
  2. package/dist/web/_app/immutable/chunks/B1Cz8BMn.js +1 -0
  3. package/dist/web/_app/immutable/chunks/{BmPhvzn5.js → BqzGUHtY.js} +1 -1
  4. package/dist/web/_app/immutable/chunks/{BXuvR8Ks.js → C7VoTosa.js} +1 -1
  5. package/dist/web/_app/immutable/chunks/{BBLgaWN8.js → CTRxNfZk.js} +1 -1
  6. package/dist/web/_app/immutable/chunks/CWQRQXxy.js +1 -0
  7. package/dist/web/_app/immutable/chunks/{Cs5oz2oJ.js → CX_61fY8.js} +1 -1
  8. package/dist/web/_app/immutable/chunks/{BiuVYCkU.js → CfTe44NH.js} +1 -1
  9. package/dist/web/_app/immutable/chunks/{0oxpWEgM.js → CrdV0ttd.js} +1 -1
  10. package/dist/web/_app/immutable/chunks/{B1y7Wy5O.js → CscoF-YL.js} +1 -1
  11. package/dist/web/_app/immutable/chunks/{D2aTbzFm.js → D7ZqAKi9.js} +1 -1
  12. package/dist/web/_app/immutable/chunks/{7pRCkuF5.js → D9er1L5a.js} +1 -1
  13. package/dist/web/_app/immutable/chunks/DKQjBKyp.js +1 -0
  14. package/dist/web/_app/immutable/chunks/{CMFOFkXK.js → Dkz6p8Jo.js} +1 -1
  15. package/dist/web/_app/immutable/chunks/{BVBRzmeQ.js → DnL9f0lc.js} +2 -2
  16. package/dist/web/_app/immutable/chunks/{BCB5cYCz.js → i9c_RUF6.js} +2 -2
  17. package/dist/web/_app/immutable/entry/{app.CFW5bplI.js → app.mJ5Araew.js} +2 -2
  18. package/dist/web/_app/immutable/entry/start.DF_0_BfK.js +1 -0
  19. package/dist/web/_app/immutable/nodes/{0.DzgYLVo-.js → 0.BvuYB1gx.js} +3 -3
  20. package/dist/web/_app/immutable/nodes/{1.DGm1MhwK.js → 1.DJ_l-bGr.js} +1 -1
  21. package/dist/web/_app/immutable/nodes/{2.CzXC4v8x.js → 2.BGwKASX5.js} +1 -1
  22. package/dist/web/_app/immutable/nodes/3.xRAvlc2o.js +11 -0
  23. package/dist/web/_app/immutable/nodes/{4.BSv65LtF.js → 4.B0ynwCv_.js} +1 -1
  24. package/dist/web/_app/immutable/nodes/{5.DcKJMtC8.js → 5.BfU_Rt3A.js} +1 -1
  25. package/dist/web/_app/immutable/nodes/{6.koFgxtvt.js → 6.9tzx4cb2.js} +1 -1
  26. package/dist/web/_app/immutable/nodes/{7.Baev0HTo.js → 7.DExKUmUV.js} +2 -2
  27. package/dist/web/_app/immutable/nodes/{8.wJRie-EF.js → 8.BfIZOncu.js} +1 -1
  28. package/dist/web/_app/version.json +1 -1
  29. package/dist/web/index.html +6 -6
  30. package/package.json +1 -1
  31. package/dist/web/_app/immutable/chunks/B-2G7IOL.js +0 -1
  32. package/dist/web/_app/immutable/chunks/BPUy9_sS.js +0 -1
  33. package/dist/web/_app/immutable/entry/start.7s9ZYPwM.js +0 -1
  34. package/dist/web/_app/immutable/nodes/3.DuaI9dSH.js +0 -11
@@ -1 +1 @@
1
- import{q as G,b as fe,m as p,al as te,Y as we,X as K,am as be,_ as Ie,af as $e,an as Ae,ai as ne,ao as xe,ap as Ce,Q as Ne,h as w,c as F,x as de,a as Q,aq as Oe,ar as ee,r as ke,a0 as He,s as se,d as z,e as R,C as Re,as as De,at as N,U as he,W as pe,au as X,av as Me,aw as Pe,V as Be,a2 as Fe,w as Ue,ax as ge,ay as Le,az as Ve,E as ze,aA as We,aB as qe,a9 as Ge,aC as Ye,K as d,L as b,a7 as re,k as ie,T as Je}from"./BeBar3OL.js";import{b as Xe,i as Ke}from"./Cs_ROD7H.js";import{B as Qe}from"./xBRYfpah.js";import{i as Ze}from"./B-2G7IOL.js";import{b as oe,u as ae,w as C,a as je}from"./DP09rP34.js";function Ct(e,t){return t}function et(e,t,n){for(var s=[],i=t.length,a,o=t.length,c=0;c<i;c++){let T=t[c];pe(T,()=>{if(a){if(a.pending.delete(T),a.done.add(T),a.pending.size===0){var h=e.outrogroups;Z(ee(a.done)),h.delete(a),h.size===0&&(e.outrogroups=null)}}else o-=1},!1)}if(o===0){var u=s.length===0&&n!==null;if(u){var E=n,l=E.parentNode;Pe(l),l.append(E),e.items.clear()}Z(t,!u)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function Z(e,t=!0){for(var n=0;n<e.length;n++)Be(e[n],t)}var le;function Nt(e,t,n,s,i,a=null){var o=e,c=new Map,u=(t&ge)!==0;if(u){var E=e;o=w?F(de(E)):E.appendChild(G())}w&&Q();var l=null,T=$e(()=>{var f=n();return Oe(f)?f:f==null?[]:ee(f)}),h,g=!0;function m(){r.fallback=l,tt(r,h,o,t,s),l!==null&&(h.length===0?(l.f&N)===0?he(l):(l.f^=N,V(l,null,o)):pe(l,()=>{l=null}))}var y=fe(()=>{h=p(T);var f=h.length;let x=!1;if(w){var M=ke(o)===He;M!==(f===0)&&(o=se(),F(o),z(!1),x=!0)}for(var $=new Set,k=we,P=Ie(),I=0;I<f;I+=1){w&&R.nodeType===Re&&R.data===De&&(o=R,x=!0,z(!1));var H=h[I],B=s(H,I),v=g?null:c.get(B);v?(v.v&&te(v.v,H),v.i&&te(v.i,I),P&&k.unskip_effect(v.e)):(v=nt(c,g?o:le??=G(),H,B,I,i,t,n),g||(v.e.f|=N),c.set(B,v)),$.add(B)}if(f===0&&a&&!l&&(g?l=K(()=>a(o)):(l=K(()=>a(le??=G())),l.f|=N)),f>$.size&&be(),w&&f>0&&F(se()),!g)if(P){for(const[Se,ve]of c)$.has(Se)||k.skip_effect(ve.e);k.oncommit(m),k.ondiscard(()=>{})}else m();x&&z(!0),p(T)}),r={effect:y,items:c,outrogroups:null,fallback:l};g=!1,w&&(o=R)}function U(e){for(;e!==null&&(e.f&Me)===0;)e=e.next;return e}function tt(e,t,n,s,i){var a=(s&Le)!==0,o=t.length,c=e.items,u=U(e.effect.first),E,l=null,T,h=[],g=[],m,y,r,f;if(a)for(f=0;f<o;f+=1)m=t[f],y=i(m,f),r=c.get(y).e,(r.f&N)===0&&(r.nodes?.a?.measure(),(T??=new Set).add(r));for(f=0;f<o;f+=1){if(m=t[f],y=i(m,f),r=c.get(y).e,e.outrogroups!==null)for(const v of e.outrogroups)v.pending.delete(r),v.done.delete(r);if((r.f&N)!==0)if(r.f^=N,r===u)V(r,null,n);else{var x=l?l.next:u;r===e.effect.last&&(e.effect.last=r.prev),r.prev&&(r.prev.next=r.next),r.next&&(r.next.prev=r.prev),O(e,l,r),O(e,r,x),V(r,x,n),l=r,h=[],g=[],u=U(l.next);continue}if((r.f&X)!==0&&(he(r),a&&(r.nodes?.a?.unfix(),(T??=new Set).delete(r))),r!==u){if(E!==void 0&&E.has(r)){if(h.length<g.length){var M=g[0],$;l=M.prev;var k=h[0],P=h[h.length-1];for($=0;$<h.length;$+=1)V(h[$],M,n);for($=0;$<g.length;$+=1)E.delete(g[$]);O(e,k.prev,P.next),O(e,l,k),O(e,P,M),u=M,l=P,f-=1,h=[],g=[]}else E.delete(r),V(r,u,n),O(e,r.prev,r.next),O(e,r,l===null?e.effect.first:l.next),O(e,l,r),l=r;continue}for(h=[],g=[];u!==null&&u!==r;)(E??=new Set).add(u),g.push(u),u=U(u.next);if(u===null)continue}(r.f&N)===0&&h.push(r),l=r,u=U(r.next)}if(e.outrogroups!==null){for(const v of e.outrogroups)v.pending.size===0&&(Z(ee(v.done)),e.outrogroups?.delete(v));e.outrogroups.size===0&&(e.outrogroups=null)}if(u!==null||E!==void 0){var I=[];if(E!==void 0)for(r of E)(r.f&X)===0&&I.push(r);for(;u!==null;)(u.f&X)===0&&u!==e.fallback&&I.push(u),u=U(u.next);var H=I.length;if(H>0){var B=(s&ge)!==0&&o===0?n:null;if(a){for(f=0;f<H;f+=1)I[f].nodes?.a?.measure();for(f=0;f<H;f+=1)I[f].nodes?.a?.fix()}et(e,I,B)}}a&&Fe(()=>{if(T!==void 0)for(r of T)r.nodes?.a?.apply()})}function nt(e,t,n,s,i,a,o,c){var u=(o&xe)!==0?(o&Ce)===0?Ne(n,!1,!1):ne(n):null,E=(o&Ae)!==0?ne(i):null;return{v:u,i:E,e:K(()=>(a(t,u??n,E??i,c),()=>{e.delete(s)}))}}function V(e,t,n){if(e.nodes)for(var s=e.nodes.start,i=e.nodes.end,a=t&&(t.f&N)===0?t.nodes.start:n;s!==null;){var o=Ue(s);if(a.before(s),s===i)return;s=o}}function O(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Ot(e,t,n,s,i,a){let o=w;w&&Q();var c=null;w&&R.nodeType===Ve&&(c=R,Q());var u=w?R:e,E=new Qe(u,!1);fe(()=>{const l=t()||null;var T=n||l==="svg"?qe:void 0;if(l===null){E.ensure(null,null);return}return E.ensure(l,h=>{if(l){if(c=w?c:We(l,T),Xe(c,c),s){w&&Ke(l)&&c.append(document.createComment(""));var g=w?de(c):c.appendChild(G());w&&(g===null?z(!1):F(g)),s(c,g)}Ge.nodes.end=c,h.before(c)}w&&F(h)}),()=>{}},ze),Ye(()=>{}),o&&(z(!0),F(u))}function st(){let e=b(null),t=b(null),n=b(null),s=b(null),i=b("entity"),a=b(null),o=b("general");function c(m,y){p(e)&&(p(e)!==m||p(n)!==y)&&oe(p(e)).catch(()=>{})}function u(m,y,r,f){c(m,r),d(e,m,!0),d(t,y,!0),d(n,r,!0),d(s,f??null,!0)}function E(){d(i,"entity")}function l(){d(i,"graph")}function T(){d(i,"settings")}function h(m,y,r){p(n)===r&&p(e)===m?(d(e,null),d(t,null),d(n,null)):(d(e,m,!0),d(t,y,!0),d(n,r,!0)),d(s,null)}function g(){p(e)&&oe(p(e)).catch(()=>{}),d(e,null),d(t,null),d(n,null),d(s,null)}return{get selectedRepo(){return p(e)},get selectedType(){return p(t)},get selectedId(){return p(n)},get selectedSubPath(){return p(s)},get activeView(){return p(i)},get entityPath(){return p(e)&&p(t)&&p(n)?`/${p(e)}/${p(t)}/${p(n)}`:null},get hoveredEntityId(){return p(a)},set hoveredEntityId(m){d(a,m,!0)},get settingsTab(){return p(o)},set settingsTab(m){d(o,m,!0)},select:u,deselect:g,selectOnGraph:h,showEntity:E,showGraph:l,showSettings:T}}const L=st();function kt(...e){return e.filter(Boolean).join(" ")}const rt=typeof document<"u";let ue=0;class it{#e=b(re([]));get toasts(){return p(this.#e)}set toasts(t){d(this.#e,t,!0)}#t=b(re([]));get heights(){return p(this.#t)}set heights(t){d(this.#t,t,!0)}#n=t=>{const n=this.toasts.findIndex(s=>s.id===t);return n===-1?null:n};addToast=t=>{rt&&this.toasts.unshift(t)};updateToast=({id:t,data:n,type:s,message:i})=>{const a=this.toasts.findIndex(c=>c.id===t),o=this.toasts[a];this.toasts[a]={...o,...n,id:t,title:i,type:s,updated:!0}};create=t=>{const{message:n,...s}=t,i=typeof t?.id=="number"||t.id&&t.id?.length>0?t.id:ue++,a=t.dismissible!==void 0?t.dismissible:t.dismissable!==void 0?t.dismissable:!0,o=t.type===void 0?"default":t.type;return ie(()=>{this.toasts.find(u=>u.id===i)?this.updateToast({id:i,data:t,type:o,message:n,dismissible:a}):this.addToast({...s,id:i,title:n,dismissible:a,type:o})}),i};dismiss=t=>(ie(()=>{if(t===void 0){this.toasts=this.toasts.map(s=>({...s,dismiss:!0}));return}const n=this.toasts.findIndex(s=>s.id===t);this.toasts[n]&&(this.toasts[n]={...this.toasts[n],dismiss:!0})}),t);remove=t=>{if(t===void 0){this.toasts=[];return}const n=this.#n(t);if(n!==null)return this.toasts.splice(n,1),t};message=(t,n)=>this.create({...n,type:"default",message:t});error=(t,n)=>this.create({...n,type:"error",message:t});success=(t,n)=>this.create({...n,type:"success",message:t});info=(t,n)=>this.create({...n,type:"info",message:t});warning=(t,n)=>this.create({...n,type:"warning",message:t});loading=(t,n)=>this.create({...n,type:"loading",message:t});promise=(t,n)=>{if(!n)return;let s;n.loading!==void 0&&(s=this.create({...n,promise:t,type:"loading",message:typeof n.loading=="string"?n.loading:n.loading()}));const i=t instanceof Promise?t:t();let a=s!==void 0;return i.then(o=>{if(typeof o=="object"&&o&&"ok"in o&&typeof o.ok=="boolean"&&!o.ok){a=!1;const c=ot(o);this.create({id:s,type:"error",message:c})}else if(n.success!==void 0){a=!1;const c=typeof n.success=="function"?n.success(o):n.success;this.create({id:s,type:"success",message:c})}}).catch(o=>{if(n.error!==void 0){a=!1;const c=typeof n.error=="function"?n.error(o):n.error;this.create({id:s,type:"error",message:c})}}).finally(()=>{a&&(this.dismiss(s),s=void 0),n.finally?.()}),s};custom=(t,n)=>{const s=n?.id||ue++;return this.create({component:t,id:s,...n}),s};removeHeight=t=>{this.heights=this.heights.filter(n=>n.toastId!==t)};setHeight=t=>{const n=this.#n(t.toastId);if(n===null){this.heights.push(t);return}this.heights[n]=t};reset=()=>{this.toasts=[],this.heights=[]}}function ot(e){return e&&typeof e=="object"&&"status"in e?`HTTP error! Status: ${e.status}`:`Error! ${e}`}const A=new it;function at(e,t){return A.create({message:e,...t})}class Ht{#e=Je(()=>A.toasts.filter(t=>!t.dismiss));get toasts(){return p(this.#e)}}const lt=at,S=Object.assign(lt,{success:A.success,info:A.info,warning:A.warning,error:A.error,custom:A.custom,message:A.message,promise:A.promise,dismiss:A.dismiss,loading:A.loading,getActiveToasts:()=>A.toasts.filter(e=>!e.dismiss)}),ut=800;function ct(){let e=b(!1),t=b(null),n=b(null),s=null,i=null,a=!1;function o(h,g,m,y){s&&s.repo===h&&s.type===g&&s.id===m?(y.data!==void 0&&(s.payload.data=y.data),y.content!==void 0&&(s.payload.content=y.content)):s={repo:h,type:g,id:m,payload:{...y}},c()}function c(){i&&clearTimeout(i),i=setTimeout(u,ut)}async function u(){if(i=null,!a&&s){const{repo:h,type:g,id:m,payload:y}=s;s=null,a=!0,d(e,!0),d(n,null);try{if(await ae(h,g,m,y),d(t,new Date,!0),y.data?.name){const f=C.repos.find(x=>x.name===h)?.entities.find(x=>x.id===m);f&&(f.title=y.data.name)}}catch(r){d(n,r.message??"Save failed",!0);const f=r.status??r.statusCode;(!f||f>=500)&&(s={repo:h,type:g,id:m,payload:y})}finally{d(e,!1),a=!1,s&&u()}}}function E(){i&&(clearTimeout(i),i=null),s&&u()}async function l(h,g,m,y){d(e,!0),d(n,null);try{const r=await ae(h,g,m,y);return d(t,new Date,!0),r}catch(r){return d(n,r.message??"Save failed",!0),null}finally{d(e,!1)}}function T(){d(n,null),d(t,null),s=null,i&&(clearTimeout(i),i=null)}return{get saving(){return p(e)},get lastSaved(){return p(t)},get error(){return p(n)},get hasPending(){return!!(s||a)},scheduleAutoSave:o,flush:E,saveEntity:l,reset:T}}const ft=ct();let _=null,me=null,ye=null,Ee=[],Y=null,q=1e3,J=b(!1),Te=b(null);const D=new Map,W={},j={};function ce(e,t){D.delete(e);const n=t.entities.length,s=n===1?`${e} updated ${t.entities[0]}`:`${e} updated ${n} entities`;S(s)}function dt(e){for(const[t,n]of D)n.repo===e&&(clearTimeout(n.timer),D.delete(t))}function ht(e){const t=je.user?.displayName;if(e.type==="sync_progress"){const n=W[e.repo];if(n){const s=e.message.trim(),i=s.match(/^Syncing from source:\s*(.+)$/i);i&&(j[e.repo]=`Syncing ${i[1].trim()}…`);const a=j[e.repo]??`Syncing ${e.repo}…`;S.loading(a,{id:n,description:s,duration:36e5})}return}if(e.type==="entity_change"){if(t&&e.actor===t&&e.source==="api"){C.refreshEntities(e.repo);return}if(C.refreshEntities(e.repo),L.selectedRepo===e.repo&&L.selectedType===e.entityType&&L.selectedId===e.entityId){ft.hasPending?S(`${e.actor} also saved changes to this entity`):Ze();return}const s=D.get(e.actor);if(s)clearTimeout(s.timer),s.entities.includes(e.entityId)||s.entities.push(e.entityId),s.timer=setTimeout(()=>ce(e.actor,s),1e4);else{const i={entities:[e.entityId],repo:e.repo,timer:setTimeout(()=>ce(e.actor,i),1e4)};D.set(e.actor,i)}return}if(e.type==="session_commit"){if(t&&e.actor===t){d(Te,e.timestamp,!0);return}const n=e.entities.length,s=n===1?`${e.actor} saved changes to ${e.entities[0]}`:`${e.actor} saved ${n} changes in ${e.repo}`;S(s),C.refreshEntities(e.repo);return}if(e.type==="sync_complete"){if(dt(e.repo),!W[e.repo]){const n=e.created+e.updated+e.deleted,s=n===0?`Sync complete · no changes in ${e.repo}`:`Sync complete · ${n} ${n===1?"entity":"entities"} from ${e.source}`;S.success(s)}C.refreshEntities(e.repo);return}if(e.type==="collection_created"){S(`${e.actor} created collection ${e.repo}`),C.refreshEntities(e.repo);return}if(e.type==="collection_deleted"){S(`${e.actor} deleted collection ${e.repo}`);return}if(e.type==="repo_sync"){S(`${e.actor} pushed to ${e.repo}`),C.refreshEntities(e.repo);return}if(e.type==="presence"){me?.(e);return}if(e.type==="online"){ye?.(e);return}if(e.type==="access_granted"||e.type==="access_revoked"){e.type==="access_revoked"&&L.selectedRepo===e.repo&&L.deselect(),C.load();return}}function _e(){if(typeof window>"u"||_&&(_.readyState===WebSocket.OPEN||_.readyState===WebSocket.CONNECTING))return;const t=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;_=new WebSocket(t),_.binaryType="arraybuffer",_.onopen=()=>{d(J,!0),q=1e3,C.refreshAll();for(const n of Ee)n()},_.onmessage=n=>{if(!(n.data instanceof ArrayBuffer))try{const s=JSON.parse(n.data);if(s?.type==="ping"){_?.send(JSON.stringify({type:"pong"}));return}const i=s;i.type&&i.type!=="toast"&&ht(i)}catch{}},_.onclose=()=>{d(J,!1),_=null,Y=setTimeout(()=>{q=Math.min(q*2,1e4),_e()},q)},_.onerror=()=>{}}function pt(){Y&&(clearTimeout(Y),Y=null),_&&(_.close(),_=null),d(J,!1);for(const[,e]of D)clearTimeout(e.timer);D.clear()}function gt(e,t=4e3){S(e,{duration:t})}function mt(e,t){const n=crypto.randomUUID();return t?.loading?S.loading(e,{id:n,duration:36e5}):S(e,{id:n}),n}function yt(e,t,n){if(n?.loading){S.loading(t,{id:e});return}/failed|error/i.test(t)?S.error(t,{id:e,duration:n?.duration??6e3}):S.success(t,{id:e,duration:n?.duration??4e3})}function Et(e){const t=crypto.randomUUID();W[e]=t,S.loading(`Syncing ${e}…`,{id:t,duration:36e5})}function Tt(e,t,n){const s=W[e];s&&(delete W[e],delete j[e],n?S.error(t,{id:s,duration:6e3}):S.success(t,{id:s,duration:4e3}))}function _t(e){me=e}function St(e){ye=e}function vt(e){Ee.push(e)}function wt(e){_?.readyState===WebSocket.OPEN&&_.send(JSON.stringify(e))}const Rt={get connected(){return p(J)},get lastAutoSaved(){return p(Te)},get ws(){return _},connect:_e,disconnect:pt,showToast:gt,showPersistentToast:mt,updateToast:yt,startSyncToast:Et,finishSyncToast:Tt,send:wt,setPresenceHandler:_t,setOnlineHandler:St,addConnectHandler:vt};export{Ht as S,ft as a,Ot as b,kt as c,Nt as e,Ct as i,L as n,Rt as r,A as t};
1
+ import{q as G,b as fe,m as p,al as te,Y as we,X as K,am as be,_ as Ie,af as $e,an as Ae,ai as ne,ao as xe,ap as Ce,Q as Ne,h as w,c as F,x as de,a as Q,aq as Oe,ar as ee,r as ke,a0 as He,s as se,d as z,e as R,C as Re,as as De,at as N,U as he,W as pe,au as X,av as Me,aw as Pe,V as Be,a2 as Fe,w as Ue,ax as ge,ay as Le,az as Ve,E as ze,aA as We,aB as qe,a9 as Ge,aC as Ye,K as d,L as b,a7 as re,k as ie,T as Je}from"./BeBar3OL.js";import{b as Xe,i as Ke}from"./Cs_ROD7H.js";import{B as Qe}from"./xBRYfpah.js";import{i as Ze}from"./B1Cz8BMn.js";import{b as oe,u as ae,w as C,a as je}from"./DP09rP34.js";function Ct(e,t){return t}function et(e,t,n){for(var s=[],i=t.length,a,o=t.length,c=0;c<i;c++){let T=t[c];pe(T,()=>{if(a){if(a.pending.delete(T),a.done.add(T),a.pending.size===0){var h=e.outrogroups;Z(ee(a.done)),h.delete(a),h.size===0&&(e.outrogroups=null)}}else o-=1},!1)}if(o===0){var u=s.length===0&&n!==null;if(u){var E=n,l=E.parentNode;Pe(l),l.append(E),e.items.clear()}Z(t,!u)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function Z(e,t=!0){for(var n=0;n<e.length;n++)Be(e[n],t)}var le;function Nt(e,t,n,s,i,a=null){var o=e,c=new Map,u=(t&ge)!==0;if(u){var E=e;o=w?F(de(E)):E.appendChild(G())}w&&Q();var l=null,T=$e(()=>{var f=n();return Oe(f)?f:f==null?[]:ee(f)}),h,g=!0;function m(){r.fallback=l,tt(r,h,o,t,s),l!==null&&(h.length===0?(l.f&N)===0?he(l):(l.f^=N,V(l,null,o)):pe(l,()=>{l=null}))}var y=fe(()=>{h=p(T);var f=h.length;let x=!1;if(w){var M=ke(o)===He;M!==(f===0)&&(o=se(),F(o),z(!1),x=!0)}for(var $=new Set,k=we,P=Ie(),I=0;I<f;I+=1){w&&R.nodeType===Re&&R.data===De&&(o=R,x=!0,z(!1));var H=h[I],B=s(H,I),v=g?null:c.get(B);v?(v.v&&te(v.v,H),v.i&&te(v.i,I),P&&k.unskip_effect(v.e)):(v=nt(c,g?o:le??=G(),H,B,I,i,t,n),g||(v.e.f|=N),c.set(B,v)),$.add(B)}if(f===0&&a&&!l&&(g?l=K(()=>a(o)):(l=K(()=>a(le??=G())),l.f|=N)),f>$.size&&be(),w&&f>0&&F(se()),!g)if(P){for(const[Se,ve]of c)$.has(Se)||k.skip_effect(ve.e);k.oncommit(m),k.ondiscard(()=>{})}else m();x&&z(!0),p(T)}),r={effect:y,items:c,outrogroups:null,fallback:l};g=!1,w&&(o=R)}function U(e){for(;e!==null&&(e.f&Me)===0;)e=e.next;return e}function tt(e,t,n,s,i){var a=(s&Le)!==0,o=t.length,c=e.items,u=U(e.effect.first),E,l=null,T,h=[],g=[],m,y,r,f;if(a)for(f=0;f<o;f+=1)m=t[f],y=i(m,f),r=c.get(y).e,(r.f&N)===0&&(r.nodes?.a?.measure(),(T??=new Set).add(r));for(f=0;f<o;f+=1){if(m=t[f],y=i(m,f),r=c.get(y).e,e.outrogroups!==null)for(const v of e.outrogroups)v.pending.delete(r),v.done.delete(r);if((r.f&N)!==0)if(r.f^=N,r===u)V(r,null,n);else{var x=l?l.next:u;r===e.effect.last&&(e.effect.last=r.prev),r.prev&&(r.prev.next=r.next),r.next&&(r.next.prev=r.prev),O(e,l,r),O(e,r,x),V(r,x,n),l=r,h=[],g=[],u=U(l.next);continue}if((r.f&X)!==0&&(he(r),a&&(r.nodes?.a?.unfix(),(T??=new Set).delete(r))),r!==u){if(E!==void 0&&E.has(r)){if(h.length<g.length){var M=g[0],$;l=M.prev;var k=h[0],P=h[h.length-1];for($=0;$<h.length;$+=1)V(h[$],M,n);for($=0;$<g.length;$+=1)E.delete(g[$]);O(e,k.prev,P.next),O(e,l,k),O(e,P,M),u=M,l=P,f-=1,h=[],g=[]}else E.delete(r),V(r,u,n),O(e,r.prev,r.next),O(e,r,l===null?e.effect.first:l.next),O(e,l,r),l=r;continue}for(h=[],g=[];u!==null&&u!==r;)(E??=new Set).add(u),g.push(u),u=U(u.next);if(u===null)continue}(r.f&N)===0&&h.push(r),l=r,u=U(r.next)}if(e.outrogroups!==null){for(const v of e.outrogroups)v.pending.size===0&&(Z(ee(v.done)),e.outrogroups?.delete(v));e.outrogroups.size===0&&(e.outrogroups=null)}if(u!==null||E!==void 0){var I=[];if(E!==void 0)for(r of E)(r.f&X)===0&&I.push(r);for(;u!==null;)(u.f&X)===0&&u!==e.fallback&&I.push(u),u=U(u.next);var H=I.length;if(H>0){var B=(s&ge)!==0&&o===0?n:null;if(a){for(f=0;f<H;f+=1)I[f].nodes?.a?.measure();for(f=0;f<H;f+=1)I[f].nodes?.a?.fix()}et(e,I,B)}}a&&Fe(()=>{if(T!==void 0)for(r of T)r.nodes?.a?.apply()})}function nt(e,t,n,s,i,a,o,c){var u=(o&xe)!==0?(o&Ce)===0?Ne(n,!1,!1):ne(n):null,E=(o&Ae)!==0?ne(i):null;return{v:u,i:E,e:K(()=>(a(t,u??n,E??i,c),()=>{e.delete(s)}))}}function V(e,t,n){if(e.nodes)for(var s=e.nodes.start,i=e.nodes.end,a=t&&(t.f&N)===0?t.nodes.start:n;s!==null;){var o=Ue(s);if(a.before(s),s===i)return;s=o}}function O(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Ot(e,t,n,s,i,a){let o=w;w&&Q();var c=null;w&&R.nodeType===Ve&&(c=R,Q());var u=w?R:e,E=new Qe(u,!1);fe(()=>{const l=t()||null;var T=n||l==="svg"?qe:void 0;if(l===null){E.ensure(null,null);return}return E.ensure(l,h=>{if(l){if(c=w?c:We(l,T),Xe(c,c),s){w&&Ke(l)&&c.append(document.createComment(""));var g=w?de(c):c.appendChild(G());w&&(g===null?z(!1):F(g)),s(c,g)}Ge.nodes.end=c,h.before(c)}w&&F(h)}),()=>{}},ze),Ye(()=>{}),o&&(z(!0),F(u))}function st(){let e=b(null),t=b(null),n=b(null),s=b(null),i=b("entity"),a=b(null),o=b("general");function c(m,y){p(e)&&(p(e)!==m||p(n)!==y)&&oe(p(e)).catch(()=>{})}function u(m,y,r,f){c(m,r),d(e,m,!0),d(t,y,!0),d(n,r,!0),d(s,f??null,!0)}function E(){d(i,"entity")}function l(){d(i,"graph")}function T(){d(i,"settings")}function h(m,y,r){p(n)===r&&p(e)===m?(d(e,null),d(t,null),d(n,null)):(d(e,m,!0),d(t,y,!0),d(n,r,!0)),d(s,null)}function g(){p(e)&&oe(p(e)).catch(()=>{}),d(e,null),d(t,null),d(n,null),d(s,null)}return{get selectedRepo(){return p(e)},get selectedType(){return p(t)},get selectedId(){return p(n)},get selectedSubPath(){return p(s)},get activeView(){return p(i)},get entityPath(){return p(e)&&p(t)&&p(n)?`/${p(e)}/${p(t)}/${p(n)}`:null},get hoveredEntityId(){return p(a)},set hoveredEntityId(m){d(a,m,!0)},get settingsTab(){return p(o)},set settingsTab(m){d(o,m,!0)},select:u,deselect:g,selectOnGraph:h,showEntity:E,showGraph:l,showSettings:T}}const L=st();function kt(...e){return e.filter(Boolean).join(" ")}const rt=typeof document<"u";let ue=0;class it{#e=b(re([]));get toasts(){return p(this.#e)}set toasts(t){d(this.#e,t,!0)}#t=b(re([]));get heights(){return p(this.#t)}set heights(t){d(this.#t,t,!0)}#n=t=>{const n=this.toasts.findIndex(s=>s.id===t);return n===-1?null:n};addToast=t=>{rt&&this.toasts.unshift(t)};updateToast=({id:t,data:n,type:s,message:i})=>{const a=this.toasts.findIndex(c=>c.id===t),o=this.toasts[a];this.toasts[a]={...o,...n,id:t,title:i,type:s,updated:!0}};create=t=>{const{message:n,...s}=t,i=typeof t?.id=="number"||t.id&&t.id?.length>0?t.id:ue++,a=t.dismissible!==void 0?t.dismissible:t.dismissable!==void 0?t.dismissable:!0,o=t.type===void 0?"default":t.type;return ie(()=>{this.toasts.find(u=>u.id===i)?this.updateToast({id:i,data:t,type:o,message:n,dismissible:a}):this.addToast({...s,id:i,title:n,dismissible:a,type:o})}),i};dismiss=t=>(ie(()=>{if(t===void 0){this.toasts=this.toasts.map(s=>({...s,dismiss:!0}));return}const n=this.toasts.findIndex(s=>s.id===t);this.toasts[n]&&(this.toasts[n]={...this.toasts[n],dismiss:!0})}),t);remove=t=>{if(t===void 0){this.toasts=[];return}const n=this.#n(t);if(n!==null)return this.toasts.splice(n,1),t};message=(t,n)=>this.create({...n,type:"default",message:t});error=(t,n)=>this.create({...n,type:"error",message:t});success=(t,n)=>this.create({...n,type:"success",message:t});info=(t,n)=>this.create({...n,type:"info",message:t});warning=(t,n)=>this.create({...n,type:"warning",message:t});loading=(t,n)=>this.create({...n,type:"loading",message:t});promise=(t,n)=>{if(!n)return;let s;n.loading!==void 0&&(s=this.create({...n,promise:t,type:"loading",message:typeof n.loading=="string"?n.loading:n.loading()}));const i=t instanceof Promise?t:t();let a=s!==void 0;return i.then(o=>{if(typeof o=="object"&&o&&"ok"in o&&typeof o.ok=="boolean"&&!o.ok){a=!1;const c=ot(o);this.create({id:s,type:"error",message:c})}else if(n.success!==void 0){a=!1;const c=typeof n.success=="function"?n.success(o):n.success;this.create({id:s,type:"success",message:c})}}).catch(o=>{if(n.error!==void 0){a=!1;const c=typeof n.error=="function"?n.error(o):n.error;this.create({id:s,type:"error",message:c})}}).finally(()=>{a&&(this.dismiss(s),s=void 0),n.finally?.()}),s};custom=(t,n)=>{const s=n?.id||ue++;return this.create({component:t,id:s,...n}),s};removeHeight=t=>{this.heights=this.heights.filter(n=>n.toastId!==t)};setHeight=t=>{const n=this.#n(t.toastId);if(n===null){this.heights.push(t);return}this.heights[n]=t};reset=()=>{this.toasts=[],this.heights=[]}}function ot(e){return e&&typeof e=="object"&&"status"in e?`HTTP error! Status: ${e.status}`:`Error! ${e}`}const A=new it;function at(e,t){return A.create({message:e,...t})}class Ht{#e=Je(()=>A.toasts.filter(t=>!t.dismiss));get toasts(){return p(this.#e)}}const lt=at,S=Object.assign(lt,{success:A.success,info:A.info,warning:A.warning,error:A.error,custom:A.custom,message:A.message,promise:A.promise,dismiss:A.dismiss,loading:A.loading,getActiveToasts:()=>A.toasts.filter(e=>!e.dismiss)}),ut=800;function ct(){let e=b(!1),t=b(null),n=b(null),s=null,i=null,a=!1;function o(h,g,m,y){s&&s.repo===h&&s.type===g&&s.id===m?(y.data!==void 0&&(s.payload.data=y.data),y.content!==void 0&&(s.payload.content=y.content)):s={repo:h,type:g,id:m,payload:{...y}},c()}function c(){i&&clearTimeout(i),i=setTimeout(u,ut)}async function u(){if(i=null,!a&&s){const{repo:h,type:g,id:m,payload:y}=s;s=null,a=!0,d(e,!0),d(n,null);try{if(await ae(h,g,m,y),d(t,new Date,!0),y.data?.name){const f=C.repos.find(x=>x.name===h)?.entities.find(x=>x.id===m);f&&(f.title=y.data.name)}}catch(r){d(n,r.message??"Save failed",!0);const f=r.status??r.statusCode;(!f||f>=500)&&(s={repo:h,type:g,id:m,payload:y})}finally{d(e,!1),a=!1,s&&u()}}}function E(){i&&(clearTimeout(i),i=null),s&&u()}async function l(h,g,m,y){d(e,!0),d(n,null);try{const r=await ae(h,g,m,y);return d(t,new Date,!0),r}catch(r){return d(n,r.message??"Save failed",!0),null}finally{d(e,!1)}}function T(){d(n,null),d(t,null),s=null,i&&(clearTimeout(i),i=null)}return{get saving(){return p(e)},get lastSaved(){return p(t)},get error(){return p(n)},get hasPending(){return!!(s||a)},scheduleAutoSave:o,flush:E,saveEntity:l,reset:T}}const ft=ct();let _=null,me=null,ye=null,Ee=[],Y=null,q=1e3,J=b(!1),Te=b(null);const D=new Map,W={},j={};function ce(e,t){D.delete(e);const n=t.entities.length,s=n===1?`${e} updated ${t.entities[0]}`:`${e} updated ${n} entities`;S(s)}function dt(e){for(const[t,n]of D)n.repo===e&&(clearTimeout(n.timer),D.delete(t))}function ht(e){const t=je.user?.displayName;if(e.type==="sync_progress"){const n=W[e.repo];if(n){const s=e.message.trim(),i=s.match(/^Syncing from source:\s*(.+)$/i);i&&(j[e.repo]=`Syncing ${i[1].trim()}…`);const a=j[e.repo]??`Syncing ${e.repo}…`;S.loading(a,{id:n,description:s,duration:36e5})}return}if(e.type==="entity_change"){if(t&&e.actor===t&&e.source==="api"){C.refreshEntities(e.repo);return}if(C.refreshEntities(e.repo),L.selectedRepo===e.repo&&L.selectedType===e.entityType&&L.selectedId===e.entityId){ft.hasPending?S(`${e.actor} also saved changes to this entity`):Ze();return}const s=D.get(e.actor);if(s)clearTimeout(s.timer),s.entities.includes(e.entityId)||s.entities.push(e.entityId),s.timer=setTimeout(()=>ce(e.actor,s),1e4);else{const i={entities:[e.entityId],repo:e.repo,timer:setTimeout(()=>ce(e.actor,i),1e4)};D.set(e.actor,i)}return}if(e.type==="session_commit"){if(t&&e.actor===t){d(Te,e.timestamp,!0);return}const n=e.entities.length,s=n===1?`${e.actor} saved changes to ${e.entities[0]}`:`${e.actor} saved ${n} changes in ${e.repo}`;S(s),C.refreshEntities(e.repo);return}if(e.type==="sync_complete"){if(dt(e.repo),!W[e.repo]){const n=e.created+e.updated+e.deleted,s=n===0?`Sync complete · no changes in ${e.repo}`:`Sync complete · ${n} ${n===1?"entity":"entities"} from ${e.source}`;S.success(s)}C.refreshEntities(e.repo);return}if(e.type==="collection_created"){S(`${e.actor} created collection ${e.repo}`),C.refreshEntities(e.repo);return}if(e.type==="collection_deleted"){S(`${e.actor} deleted collection ${e.repo}`);return}if(e.type==="repo_sync"){S(`${e.actor} pushed to ${e.repo}`),C.refreshEntities(e.repo);return}if(e.type==="presence"){me?.(e);return}if(e.type==="online"){ye?.(e);return}if(e.type==="access_granted"||e.type==="access_revoked"){e.type==="access_revoked"&&L.selectedRepo===e.repo&&L.deselect(),C.load();return}}function _e(){if(typeof window>"u"||_&&(_.readyState===WebSocket.OPEN||_.readyState===WebSocket.CONNECTING))return;const t=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;_=new WebSocket(t),_.binaryType="arraybuffer",_.onopen=()=>{d(J,!0),q=1e3,C.refreshAll();for(const n of Ee)n()},_.onmessage=n=>{if(!(n.data instanceof ArrayBuffer))try{const s=JSON.parse(n.data);if(s?.type==="ping"){_?.send(JSON.stringify({type:"pong"}));return}const i=s;i.type&&i.type!=="toast"&&ht(i)}catch{}},_.onclose=()=>{d(J,!1),_=null,Y=setTimeout(()=>{q=Math.min(q*2,1e4),_e()},q)},_.onerror=()=>{}}function pt(){Y&&(clearTimeout(Y),Y=null),_&&(_.close(),_=null),d(J,!1);for(const[,e]of D)clearTimeout(e.timer);D.clear()}function gt(e,t=4e3){S(e,{duration:t})}function mt(e,t){const n=crypto.randomUUID();return t?.loading?S.loading(e,{id:n,duration:36e5}):S(e,{id:n}),n}function yt(e,t,n){if(n?.loading){S.loading(t,{id:e});return}/failed|error/i.test(t)?S.error(t,{id:e,duration:n?.duration??6e3}):S.success(t,{id:e,duration:n?.duration??4e3})}function Et(e){const t=crypto.randomUUID();W[e]=t,S.loading(`Syncing ${e}…`,{id:t,duration:36e5})}function Tt(e,t,n){const s=W[e];s&&(delete W[e],delete j[e],n?S.error(t,{id:s,duration:6e3}):S.success(t,{id:s,duration:4e3}))}function _t(e){me=e}function St(e){ye=e}function vt(e){Ee.push(e)}function wt(e){_?.readyState===WebSocket.OPEN&&_.send(JSON.stringify(e))}const Rt={get connected(){return p(J)},get lastAutoSaved(){return p(Te)},get ws(){return _},connect:_e,disconnect:pt,showToast:gt,showPersistentToast:mt,updateToast:yt,startSyncToast:Et,finishSyncToast:Tt,send:wt,setPresenceHandler:_t,setOnlineHandler:St,addConnectHandler:vt};export{Ht as S,ft as a,Ot as b,kt as c,Nt as e,Ct as i,L as n,Rt as r,A as t};