studiograph 1.3.3-next.21 → 1.3.3-next.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/cli/commands/serve.js +3 -0
  2. package/dist/cli/commands/serve.js.map +1 -1
  3. package/dist/cli/commands/sync.js +58 -17
  4. package/dist/cli/commands/sync.js.map +1 -1
  5. package/dist/core/workspace.d.ts +6 -0
  6. package/dist/core/workspace.js +47 -0
  7. package/dist/core/workspace.js.map +1 -1
  8. package/dist/server/chrome/chrome.js +23 -252
  9. package/dist/server/collab.d.ts +27 -0
  10. package/dist/server/collab.js +117 -0
  11. package/dist/server/collab.js.map +1 -0
  12. package/dist/server/index.js +11 -6
  13. package/dist/server/index.js.map +1 -1
  14. package/dist/server/routes/collab.d.ts +6 -0
  15. package/dist/server/routes/collab.js +10 -0
  16. package/dist/server/routes/collab.js.map +1 -0
  17. package/dist/server/routes/graph-api.d.ts +2 -2
  18. package/dist/server/routes/graph-api.js +27 -6
  19. package/dist/server/routes/graph-api.js.map +1 -1
  20. package/dist/server/routes/sync-api.d.ts +2 -1
  21. package/dist/server/routes/sync-api.js +13 -1
  22. package/dist/server/routes/sync-api.js.map +1 -1
  23. package/dist/server/routes/ws.js +38 -0
  24. package/dist/server/routes/ws.js.map +1 -1
  25. package/dist/server/session-manager.d.ts +40 -0
  26. package/dist/server/session-manager.js +130 -0
  27. package/dist/server/session-manager.js.map +1 -0
  28. package/dist/server/ws-hub.d.ts +60 -1
  29. package/dist/server/ws-hub.js +113 -2
  30. package/dist/server/ws-hub.js.map +1 -1
  31. package/dist/web/_app/immutable/assets/AppShell.EyPUoNrB.css +1 -0
  32. package/dist/web/_app/immutable/assets/{editor.CaaAjbLg.css → entity.Bjlko8oW.css} +1 -1
  33. package/dist/web/_app/immutable/chunks/1XQG_7uE.js +1 -0
  34. package/dist/web/_app/immutable/chunks/{BDskUnFZ.js → BIQoyk5V.js} +10 -10
  35. package/dist/web/_app/immutable/chunks/{DFSquWcI.js → BV_9Nfp2.js} +1 -1
  36. package/dist/web/_app/immutable/chunks/Bk7i2AGK.js +5 -0
  37. package/dist/web/_app/immutable/chunks/ByFfmBEu.js +2 -0
  38. package/dist/web/_app/immutable/chunks/{BzhnXU6Q.js → C5cMwwSn.js} +1 -1
  39. package/dist/web/_app/immutable/chunks/CICthOLY.js +27 -0
  40. package/dist/web/_app/immutable/chunks/CaITTL5o.js +2 -0
  41. package/dist/web/_app/immutable/chunks/{BfTJ6NzK.js → CjKjQEMp.js} +1 -1
  42. package/dist/web/_app/immutable/chunks/{GRkK54yd.js → D-tW7Byc.js} +1 -1
  43. package/dist/web/_app/immutable/chunks/{Ddy4RvyP.js → DCWeodCf.js} +1 -1
  44. package/dist/web/_app/immutable/chunks/DWSjaG46.js +1 -0
  45. package/dist/web/_app/immutable/chunks/{DRChbfXz.js → DiXzlxx7.js} +1 -1
  46. package/dist/web/_app/immutable/chunks/{BbLYZVsw.js → Dpn7ZAUg.js} +1 -1
  47. package/dist/web/_app/immutable/chunks/EhE2EcYu.js +1 -0
  48. package/dist/web/_app/immutable/chunks/dCvzTHAY.js +1 -0
  49. package/dist/web/_app/immutable/chunks/{BjnErSlK.js → eEhMI0BQ.js} +1 -1
  50. package/dist/web/_app/immutable/chunks/i6t46AUT.js +2 -0
  51. package/dist/web/_app/immutable/chunks/pwrC_shA.js +1 -0
  52. package/dist/web/_app/immutable/entry/app.DjA3G34a.js +2 -0
  53. package/dist/web/_app/immutable/entry/start.DLZQ1-hB.js +1 -0
  54. package/dist/web/_app/immutable/nodes/0.B3dFDaCX.js +2 -0
  55. package/dist/web/_app/immutable/nodes/{1.gy-UNDF3.js → 1.B7XWRWiG.js} +1 -1
  56. package/dist/web/_app/immutable/nodes/{2.CFmJZos9.js → 2.BEOcFuIE.js} +1 -1
  57. package/dist/web/_app/immutable/nodes/3.NxBZXoOo.js +1 -0
  58. package/dist/web/_app/immutable/nodes/4.DyI15z1O.js +17 -0
  59. package/dist/web/_app/immutable/nodes/{5.C7yLiq2I.js → 5.CLl1ihqQ.js} +1 -1
  60. package/dist/web/_app/immutable/nodes/{6.DKaTmAiw.js → 6.DcamPcH8.js} +1 -1
  61. package/dist/web/_app/immutable/nodes/{7.CA3sQ74A.js → 7.C8Ctaz0_.js} +1 -1
  62. package/dist/web/_app/immutable/nodes/8.B5PKapjV.js +2 -0
  63. package/dist/web/_app/immutable/nodes/{9.BVVyKTae.js → 9.CjhBf9vj.js} +1 -1
  64. package/dist/web/_app/version.json +1 -1
  65. package/dist/web/index.html +10 -10
  66. package/package.json +2 -1
  67. package/dist/web/_app/immutable/assets/AppShell.C00jH_aT.css +0 -1
  68. package/dist/web/_app/immutable/chunks/B3v6bkHV.js +0 -27
  69. package/dist/web/_app/immutable/chunks/BQlTvYWB.js +0 -1
  70. package/dist/web/_app/immutable/chunks/CRcLi9EQ.js +0 -1
  71. package/dist/web/_app/immutable/chunks/DL7u7dQi.js +0 -2
  72. package/dist/web/_app/immutable/chunks/m74CvwCG.js +0 -2
  73. package/dist/web/_app/immutable/chunks/trveDs8t.js +0 -1
  74. package/dist/web/_app/immutable/entry/app.3j3I-9SC.js +0 -2
  75. package/dist/web/_app/immutable/entry/start.CYScsHkx.js +0 -1
  76. package/dist/web/_app/immutable/nodes/0.CxCm4CPW.js +0 -2
  77. package/dist/web/_app/immutable/nodes/3.D1yvWsPv.js +0 -1
  78. package/dist/web/_app/immutable/nodes/4.LKUIo9Zg.js +0 -16
  79. package/dist/web/_app/immutable/nodes/8.DEuJARDO.js +0 -2
@@ -0,0 +1 @@
1
+ import{y as b,x as v,z as Pe}from"./D-tW7Byc.js";import{D as ue,e as Ee,a as Te,b as Oe}from"./Bk7i2AGK.js";const Me=Math.floor,xe=(t,e)=>t<e?t:e,Ie=(t,e)=>t>e?t:e,de=128,N=127,_e=Number.MAX_SAFE_INTEGER,Le=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,s=new Uint8Array(n);for(let i=0;i<n;i++)s[i]=e.codePointAt(i);return s},x=typeof TextEncoder<"u"?new TextEncoder:null,$e=t=>x.encode(t),Ne=x?$e:Le;let E=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});E&&E.decode(new Uint8Array).length===1&&(E=null);const H=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},B=(t,e)=>{for(;e>N;)H(t,de|N&e),e=Me(e/128);H(t,N&e)},q=new Uint8Array(3e4),Ve=q.length/3,He=(t,e)=>{if(e.length<Ve){const n=x.encodeInto(e,q).written||0;B(t,n);for(let s=0;s<n;s++)H(t,q[s])}else Fe(t,Ne(e))},Re=(t,e)=>{const n=unescape(encodeURIComponent(e)),s=n.length;B(t,s);for(let i=0;i<s;i++)H(t,n.codePointAt(i))},je=x&&x.encodeInto?He:Re,Be=(t,e)=>{const n=t.cbuf.length,s=t.cpos,i=xe(n-s,e.length),o=e.length-i;t.cbuf.set(e.subarray(0,i),s),t.cpos+=i,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(Ie(n*2,o)),t.cbuf.set(e.subarray(i)),t.cpos=o)},Fe=(t,e)=>{B(t,e.byteLength),Be(t,e)},fe=t=>new Error(t),We=fe("Unexpected end of array"),Qe=fe("Integer out of Range"),ze=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},qe=t=>ze(t,Z(t)),ie=t=>t.arr[t.pos++],Z=t=>{let e=0,n=1;const s=t.arr.length;for(;t.pos<s;){const i=t.arr[t.pos++];if(e=e+(i&N)*n,n*=128,i<de)return e;if(e>_e)throw Qe}throw We},Je=t=>{let e=Z(t);if(e===0)return"";{let n=String.fromCodePoint(ie(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(ie(t));else for(;e>0;){const s=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+s);t.pos+=s,n+=String.fromCodePoint.apply(null,i),e-=s}return decodeURIComponent(escape(n))}},Ye=t=>E.decode(qe(t)),oe=E?Ye:Je;var C;(function(t){t[t.Token=0]="Token",t[t.PermissionDenied=1]="PermissionDenied",t[t.Authenticated=2]="Authenticated"})(C||(C={}));const Ge=(t,e)=>{B(t,C.Token),je(t,e)},Xe=(t,e,n,s)=>{switch(Z(t)){case C.Token:{e();break}case C.PermissionDenied:{n(oe(t));break}case C.Authenticated:{s(oe(t));break}}},re=t=>Array.from(t.entries()).map(([e,n])=>({clientId:e,...n}));var J;(function(t){t[t.Connecting=0]="Connecting",t[t.Open=1]="Open",t[t.Closing=2]="Closing",t[t.Closed=3]="Closed"})(J||(J={}));function Ke(t){return t||(t={}),{delay:t.delay===void 0?200:t.delay,initialDelay:t.initialDelay===void 0?0:t.initialDelay,minDelay:t.minDelay===void 0?0:t.minDelay,maxDelay:t.maxDelay===void 0?0:t.maxDelay,factor:t.factor===void 0?0:t.factor,maxAttempts:t.maxAttempts===void 0?3:t.maxAttempts,timeout:t.timeout===void 0?0:t.timeout,jitter:t.jitter===!0,initialJitter:t.initialJitter===!0,handleError:t.handleError===void 0?null:t.handleError,handleTimeout:t.handleTimeout===void 0?null:t.handleTimeout,beforeAttempt:t.beforeAttempt===void 0?null:t.beforeAttempt,calculateDelay:t.calculateDelay===void 0?null:t.calculateDelay}}async function W(t){return new Promise(e=>setTimeout(e,t))}function Ze(t,e){let n=e.delay;if(n===0)return 0;if(e.factor&&(n*=Math.pow(e.factor,t.attemptNum-1),e.maxDelay!==0&&(n=Math.min(n,e.maxDelay))),e.jitter){const s=Math.ceil(e.minDelay),i=Math.floor(n);n=Math.floor(Math.random()*(i-s+1))+s}return Math.round(n)}async function et(t,e){const n=Ke(e);for(const h of["delay","initialDelay","minDelay","maxDelay","maxAttempts","timeout"]){const a=n[h];if(!Number.isInteger(a)||a<0)throw new Error(`Value for ${h} must be an integer greater than or equal to 0`)}if(n.factor.constructor!==Number||n.factor<0)throw new Error("Value for factor must be a number greater than or equal to 0");if(n.delay<n.minDelay)throw new Error(`delay cannot be less than minDelay (delay: ${n.delay}, minDelay: ${n.minDelay}`);const s={attemptNum:0,attemptsRemaining:n.maxAttempts?n.maxAttempts:-1,aborted:!1,abort(){s.aborted=!0}},i=n.calculateDelay||Ze;async function o(){if(n.beforeAttempt&&n.beforeAttempt(s,n),s.aborted){const a=new Error("Attempt aborted");throw a.code="ATTEMPT_ABORTED",a}const h=async a=>{if(n.handleError&&await n.handleError(a,s,n),s.aborted||s.attemptsRemaining===0)throw a;s.attemptNum++;const c=i(s,n);return c&&await W(c),o()};return s.attemptsRemaining>0&&s.attemptsRemaining--,n.timeout?new Promise((a,c)=>{const P=setTimeout(()=>{if(n.handleTimeout)try{a(n.handleTimeout(s,n))}catch(l){c(l)}else{const l=new Error(`Retry timeout (attemptNum: ${s.attemptNum}, timeout: ${n.timeout})`);l.code="ATTEMPT_TIMEOUT",c(l)}},n.timeout);t(s,n).then(l=>{clearTimeout(P),a(l)}).catch(l=>{clearTimeout(P),h(l).then(a).catch(c)})}):t(s,n).catch(h)}const r=n.calculateDelay?n.calculateDelay(s,n):n.initialDelay;if(r&&await W(r),s.attemptNum<1&&n.initialJitter){const h=i(s,n);h&&await W(h)}return o()}const ge=Math.floor,tt=(t,e)=>t<e?t:e,nt=(t,e)=>t>e?t:e,st=64,R=128,it=63,T=127,me=Number.MAX_SAFE_INTEGER,ot=()=>new Set,rt=Array.from,at=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,s=new Uint8Array(n);for(let i=0;i<n;i++)s[i]=e.codePointAt(i);return s},I=typeof TextEncoder<"u"?new TextEncoder:null,ct=t=>I.encode(t),lt=I?ct:at;let O=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});O&&O.decode(new Uint8Array).length===1&&(O=null);class ht{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const ee=()=>new ht,ye=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},te=t=>{const e=new Uint8Array(ye(t));let n=0;for(let s=0;s<t.bufs.length;s++){const i=t.bufs[s];e.set(i,n),n+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},j=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},d=(t,e)=>{for(;e>T;)j(t,R|T&e),e=ge(e/128);j(t,T&e)},Y=new Uint8Array(3e4),ut=Y.length/3,dt=(t,e)=>{if(e.length<ut){const n=I.encodeInto(e,Y).written||0;d(t,n);for(let s=0;s<n;s++)j(t,Y[s])}else D(t,lt(e))},ft=(t,e)=>{const n=unescape(encodeURIComponent(e)),s=n.length;d(t,s);for(let i=0;i<s;i++)j(t,n.codePointAt(i))},y=I&&I.encodeInto?dt:ft,gt=(t,e)=>{const n=t.cbuf.length,s=t.cpos,i=tt(n-s,e.length),o=e.length-i;t.cbuf.set(e.subarray(0,i),s),t.cpos+=i,o>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(nt(n*2,o)),t.cbuf.set(e.subarray(i)),t.cpos=o)},D=(t,e)=>{d(t,e.byteLength),gt(t,e)},we=t=>new Error(t),pe=we("Unexpected end of array"),be=we("Integer out of Range");class mt{constructor(e){this.arr=e,this.pos=0}}const Se=t=>new mt(t),yt=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},F=t=>yt(t,k(t)),ae=t=>t.arr[t.pos++],k=t=>{let e=0,n=1;const s=t.arr.length;for(;t.pos<s;){const i=t.arr[t.pos++];if(e=e+(i&T)*n,n*=128,i<R)return e;if(e>me)throw be}throw pe},wt=t=>{let e=t.arr[t.pos++],n=e&it,s=64;const i=(e&st)>0?-1:1;if((e&R)===0)return i*n;const o=t.arr.length;for(;t.pos<o;){if(e=t.arr[t.pos++],n=n+(e&T)*s,s*=128,e<R)return i*n;if(n>me)throw be}throw pe},pt=t=>{let e=k(t);if(e===0)return"";{let n=String.fromCodePoint(ae(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(ae(t));else for(;e>0;){const s=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+s);t.pos+=s,n+=String.fromCodePoint.apply(null,i),e-=s}return decodeURIComponent(escape(n))}},bt=t=>O.decode(F(t)),_=O?bt:pt,St=t=>{const e=t.pos,n=_(t);return t.pos=e,n},U=Date.now,Q=()=>new Map,kt=(t,e,n)=>{let s=t.get(e);return s===void 0&&t.set(e,s=n()),s};class At{constructor(){this._observers=Q()}on(e,n){kt(this._observers,e,ot).add(n)}once(e,n){const s=(...i)=>{this.off(e,s),n(...i)};this.on(e,s)}off(e,n){const s=this._observers.get(e);s!==void 0&&(s.delete(n),s.size===0&&this._observers.delete(e))}emit(e,n){return rt((this._observers.get(e)||Q()).values()).forEach(s=>s(...n))}destroy(){this._observers=Q()}}const vt=Object.keys,ce=t=>vt(t).length,Ct=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Ut=(t,e)=>t===e,M=(t,e)=>{if(t==null||e==null)return Ut(t,e);if(t.constructor!==e.constructor)return!1;if(t===e)return!0;switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!M(t.get(n),e.get(n)))return!1;break}case Object:if(ce(t)!==ce(e))return!1;for(const n in t)if(!Ct(t,n)||!M(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!M(t[n],e[n]))return!1;break;default:return!1}return!0},z=3e4;class Dt extends At{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{const n=U();this.getLocalState()!==null&&z/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());const s=[];this.meta.forEach((i,o)=>{o!==this.clientID&&z<=n-i.lastUpdated&&this.states.has(o)&&s.push(o)}),s.length>0&&V(this,s,"timeout")},ge(z/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){const n=this.clientID,s=this.meta.get(n),i=s===void 0?0:s.clock+1,o=this.states.get(n);e===null?this.states.delete(n):this.states.set(n,e),this.meta.set(n,{clock:i,lastUpdated:U()});const r=[],h=[],a=[],c=[];e===null?c.push(n):o==null?e!=null&&r.push(n):(h.push(n),M(o,e)||a.push(n)),(r.length>0||a.length>0||c.length>0)&&this.emit("change",[{added:r,updated:a,removed:c},"local"]),this.emit("update",[{added:r,updated:h,removed:c},"local"])}setLocalStateField(e,n){const s=this.getLocalState();s!==null&&this.setLocalState({...s,[e]:n})}getStates(){return this.states}}const V=(t,e,n)=>{const s=[];for(let i=0;i<e.length;i++){const o=e[i];if(t.states.has(o)){if(t.states.delete(o),o===t.clientID){const r=t.meta.get(o);t.meta.set(o,{clock:r.clock+1,lastUpdated:U()})}s.push(o)}}s.length>0&&(t.emit("change",[{added:[],updated:[],removed:s},n]),t.emit("update",[{added:[],updated:[],removed:s},n]))},G=(t,e,n=t.states)=>{const s=e.length,i=ee();d(i,s);for(let o=0;o<s;o++){const r=e[o],h=n.get(r)||null,a=t.meta.get(r).clock;d(i,r),d(i,a),y(i,JSON.stringify(h))}return te(i)},Pt=(t,e,n)=>{const s=Se(e),i=U(),o=[],r=[],h=[],a=[],c=k(s);for(let P=0;P<c;P++){const l=k(s);let L=k(s);const p=JSON.parse(_(s)),$=t.meta.get(l),De=t.states.get(l),se=$===void 0?0:$.clock;(se<L||se===L&&p===null&&t.states.has(l))&&(p===null?l===t.clientID&&t.getLocalState()!=null?L++:t.states.delete(l):t.states.set(l,p),t.meta.set(l,{clock:L,lastUpdated:i}),$===void 0&&p!==null?o.push(l):$!==void 0&&p===null?a.push(l):p!==null&&(M(p,De)||h.push(l),r.push(l)))}(o.length>0||h.length>0||a.length>0)&&t.emit("change",[{added:o,updated:h,removed:a},n]),(o.length>0||r.length>0||a.length>0)&&t.emit("update",[{added:o,updated:r,removed:a},n])};class ke{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const s=this.callbacks[e];return s&&s.forEach(i=>i.apply(this,n)),this}off(e,n){const s=this.callbacks[e];return s&&(n?this.callbacks[e]=s.filter(i=>i!==n):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}}class X{constructor(e){this.data=e,this.encoder=ee(),this.decoder=Se(new Uint8Array(this.data))}peekVarString(){return St(this.decoder)}readVarUint(){return k(this.decoder)}readVarString(){return _(this.decoder)}readVarUint8Array(){return F(this.decoder)}writeVarUint(e){return d(this.encoder,e)}writeVarString(e){return y(this.encoder,e)}writeVarUint8Array(e){return D(this.encoder,e)}length(){return ye(this.encoder)}}var u;(function(t){t[t.Sync=0]="Sync",t[t.Awareness=1]="Awareness",t[t.Auth=2]="Auth",t[t.QueryAwareness=3]="QueryAwareness",t[t.Stateless=5]="Stateless",t[t.CLOSE=7]="CLOSE",t[t.SyncStatus=8]="SyncStatus"})(u||(u={}));var f;(function(t){t.Connecting="connecting",t.Connected="connected",t.Disconnected="disconnected"})(f||(f={}));class A{constructor(){this.encoder=ee()}get(e){return e.encoder}toUint8Array(){return te(this.encoder)}}class Et extends A{constructor(){super(...arguments),this.type=u.CLOSE,this.description="Ask the server to close the connection"}get(e){return y(this.encoder,e.documentName),d(this.encoder,this.type),this.encoder}}class Tt extends ke{constructor(e){super(),this.messageQueue=[],this.configuration={url:"",autoConnect:!0,preserveTrailingSlash:!1,document:void 0,WebSocketPolyfill:void 0,messageReconnectTimeout:3e4,delay:1e3,initialDelay:0,factor:2,maxAttempts:0,minDelay:1e3,maxDelay:3e4,jitter:!0,timeout:0,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,handleTimeout:null,providerMap:new Map},this.webSocket=null,this.webSocketHandlers={},this.shouldConnect=!0,this.status=f.Disconnected,this.lastMessageReceived=0,this.identifier=0,this.intervals={connectionChecker:null},this.connectionAttempt=null,this.receivedOnOpenPayload=void 0,this.closeTries=0,this.setConfiguration(e),this.configuration.WebSocketPolyfill=e.WebSocketPolyfill?e.WebSocketPolyfill:WebSocket,this.on("open",this.configuration.onOpen),this.on("open",this.onOpen.bind(this)),this.on("connect",this.configuration.onConnect),this.on("message",this.configuration.onMessage),this.on("outgoingMessage",this.configuration.onOutgoingMessage),this.on("status",this.configuration.onStatus),this.on("disconnect",this.configuration.onDisconnect),this.on("close",this.configuration.onClose),this.on("destroy",this.configuration.onDestroy),this.on("awarenessUpdate",this.configuration.onAwarenessUpdate),this.on("awarenessChange",this.configuration.onAwarenessChange),this.on("close",this.onClose.bind(this)),this.on("message",this.onMessage.bind(this)),this.intervals.connectionChecker=setInterval(this.checkConnection.bind(this),this.configuration.messageReconnectTimeout/10),this.shouldConnect&&this.connect()}async onOpen(e){this.status=f.Connected,this.emit("status",{status:f.Connected}),this.cancelWebsocketRetry=void 0,this.receivedOnOpenPayload=e}attach(e){this.configuration.providerMap.set(e.configuration.name,e),this.status===f.Disconnected&&this.shouldConnect&&this.connect(),this.receivedOnOpenPayload&&this.status===f.Connected&&e.onOpen(this.receivedOnOpenPayload)}detach(e){this.configuration.providerMap.has(e.configuration.name)&&(e.send(Et,{documentName:e.configuration.name}),this.configuration.providerMap.delete(e.configuration.name))}setConfiguration(e={}){this.configuration={...this.configuration,...e},this.configuration.autoConnect||(this.shouldConnect=!1)}async connect(){if(this.status===f.Connected)return;this.cancelWebsocketRetry&&(this.cancelWebsocketRetry(),this.cancelWebsocketRetry=void 0),this.receivedOnOpenPayload=void 0,this.shouldConnect=!0;const e=()=>{let i=!1;return{retryPromise:et(this.createWebSocketConnection.bind(this),{delay:this.configuration.delay,initialDelay:this.configuration.initialDelay,factor:this.configuration.factor,maxAttempts:this.configuration.maxAttempts,minDelay:this.configuration.minDelay,maxDelay:this.configuration.maxDelay,jitter:this.configuration.jitter,timeout:this.configuration.timeout,handleTimeout:this.configuration.handleTimeout,beforeAttempt:r=>{(!this.shouldConnect||i)&&r.abort()}}).catch(r=>{if(r&&r.code!=="ATTEMPT_ABORTED")throw r}),cancelFunc:()=>{i=!0}}},{retryPromise:n,cancelFunc:s}=e();return this.cancelWebsocketRetry=s,n}attachWebSocketListeners(e,n){const{identifier:s}=e,i=c=>this.emit("message",c),o=c=>this.emit("close",{event:c}),r=c=>this.emit("open",c),h=c=>{n(c)};this.webSocketHandlers[s]={message:i,close:o,open:r,error:h};const a=this.webSocketHandlers[e.identifier];Object.keys(a).forEach(c=>{e.addEventListener(c,a[c])})}cleanupWebSocket(){if(!this.webSocket)return;const{identifier:e}=this.webSocket,n=this.webSocketHandlers[e];Object.keys(n).forEach(s=>{var i;(i=this.webSocket)===null||i===void 0||i.removeEventListener(s,n[s]),delete this.webSocketHandlers[e]}),this.webSocket.close(),this.webSocket=null}createWebSocketConnection(){return new Promise((e,n)=>{this.webSocket&&(this.messageQueue=[],this.cleanupWebSocket()),this.lastMessageReceived=0,this.identifier+=1;const s=new this.configuration.WebSocketPolyfill(this.url);s.binaryType="arraybuffer",s.identifier=this.identifier,this.attachWebSocketListeners(s,n),this.webSocket=s,this.status=f.Connecting,this.emit("status",{status:f.Connecting}),this.connectionAttempt={resolve:e,reject:n}})}onMessage(e){var n;this.resolveConnectionAttempt(),this.lastMessageReceived=U();const i=new X(e.data).peekVarString();(n=this.configuration.providerMap.get(i))===null||n===void 0||n.onMessage(e)}resolveConnectionAttempt(){this.connectionAttempt&&(this.connectionAttempt.resolve(),this.connectionAttempt=null,this.status=f.Connected,this.emit("status",{status:f.Connected}),this.emit("connect"),this.messageQueue.forEach(e=>this.send(e)),this.messageQueue=[])}stopConnectionAttempt(){this.connectionAttempt=null}rejectConnectionAttempt(){var e;(e=this.connectionAttempt)===null||e===void 0||e.reject(),this.connectionAttempt=null}checkConnection(){var e;this.status===f.Connected&&this.lastMessageReceived&&(this.configuration.messageReconnectTimeout>=U()-this.lastMessageReceived||(this.closeTries+=1,this.closeTries>2?(this.onClose({event:{code:4408,reason:"forced"}}),this.closeTries=0):((e=this.webSocket)===null||e===void 0||e.close(),this.messageQueue=[])))}get serverUrl(){if(this.configuration.preserveTrailingSlash)return this.configuration.url;let e=this.configuration.url;for(;e[e.length-1]==="/";)e=e.slice(0,e.length-1);return e}get url(){return this.serverUrl}disconnect(){if(this.shouldConnect=!1,this.webSocket!==null)try{this.webSocket.close(),this.messageQueue=[]}catch(e){console.error(e)}}send(e){var n;((n=this.webSocket)===null||n===void 0?void 0:n.readyState)===J.Open?this.webSocket.send(e):this.messageQueue.push(e)}onClose({event:e}){this.closeTries=0,this.cleanupWebSocket(),this.connectionAttempt&&this.rejectConnectionAttempt(),this.status=f.Disconnected,this.emit("status",{status:f.Disconnected}),this.emit("disconnect",{event:e}),!this.cancelWebsocketRetry&&this.shouldConnect&&setTimeout(()=>{this.connect()},this.configuration.delay)}destroy(){this.emit("destroy"),clearInterval(this.intervals.connectionChecker),this.stopConnectionAttempt(),this.disconnect(),this.removeAllListeners(),this.cleanupWebSocket()}}const Ae=0,ne=1,ve=2,Ot=(t,e)=>{d(t,Ae);const n=Ee(e);D(t,n)},Mt=(t,e,n)=>{d(t,ne),D(t,Oe(e,n))},xt=(t,e,n)=>Mt(e,n,F(t)),Ce=(t,e,n)=>{try{Te(e,F(t),n)}catch(s){console.error("Caught error while handling a Yjs update",s)}},It=(t,e)=>{d(t,ve),D(t,e)},_t=Ce,Lt=(t,e,n,s)=>{const i=k(t);switch(i){case Ae:xt(t,e,n);break;case ne:Ce(t,n,s);break;case ve:_t(t,n,s);break;default:throw new Error("Unknown message type")}return i};class $t{constructor(e){this.message=e}apply(e,n){const{message:s}=this,i=s.readVarUint(),o=s.length();switch(i){case u.Sync:this.applySyncMessage(e,n);break;case u.Awareness:this.applyAwarenessMessage(e);break;case u.Auth:this.applyAuthMessage(e);break;case u.QueryAwareness:this.applyQueryAwarenessMessage(e);break;case u.Stateless:e.receiveStateless(_(s.decoder));break;case u.SyncStatus:this.applySyncStatusMessage(e,wt(s.decoder)===1);break;case u.CLOSE:const r={code:1e3,reason:_(s.decoder),target:e.configuration.websocketProvider.webSocket,type:"close"};e.onClose(),e.configuration.onClose({event:r}),e.forwardClose({event:r});break;default:throw new Error(`Can’t apply message of unknown type: ${i}`)}s.length()>o+1&&e.send(A,{encoder:s.encoder})}applySyncMessage(e,n){const{message:s}=this;s.writeVarUint(u.Sync);const i=Lt(s.decoder,s.encoder,e.document,e);n&&i===ne&&(e.synced=!0)}applySyncStatusMessage(e,n){n&&e.decrementUnsyncedChanges()}applyAwarenessMessage(e){if(!e.awareness)return;const{message:n}=this;Pt(e.awareness,n.readVarUint8Array(),e)}applyAuthMessage(e){const{message:n}=this;Xe(n.decoder,e.sendToken.bind(e),e.permissionDeniedHandler.bind(e),e.authenticatedHandler.bind(e))}applyQueryAwarenessMessage(e){if(!e.awareness)return;const{message:n}=this;n.writeVarUint(u.Awareness),n.writeVarUint8Array(G(e.awareness,Array.from(e.awareness.getStates().keys())))}}class Nt{constructor(e,n={}){this.message=new e,this.encoder=this.message.get(n)}create(){return te(this.encoder)}send(e){e?.send(this.create())}}class Vt extends A{constructor(){super(...arguments),this.type=u.Auth,this.description="Authentication"}get(e){if(typeof e.token>"u")throw new Error("The authentication message requires `token` as an argument.");return y(this.encoder,e.documentName),d(this.encoder,this.type),Ge(this.encoder,e.token),this.encoder}}class le extends A{constructor(){super(...arguments),this.type=u.Awareness,this.description="Awareness states update"}get(e){if(typeof e.awareness>"u")throw new Error("The awareness message requires awareness as an argument");if(typeof e.clients>"u")throw new Error("The awareness message requires clients as an argument");y(this.encoder,e.documentName),d(this.encoder,this.type);let n;return e.states===void 0?n=G(e.awareness,e.clients):n=G(e.awareness,e.clients,e.states),D(this.encoder,n),this.encoder}}class Ht extends A{constructor(){super(...arguments),this.type=u.Stateless,this.description="A stateless message"}get(e){var n;return y(this.encoder,e.documentName),d(this.encoder,this.type),y(this.encoder,(n=e.payload)!==null&&n!==void 0?n:""),this.encoder}}class he extends A{constructor(){super(...arguments),this.type=u.Sync,this.description="First sync step"}get(e){if(typeof e.document>"u")throw new Error("The sync step one message requires document as an argument");return y(this.encoder,e.documentName),d(this.encoder,this.type),Ot(this.encoder,e.document),this.encoder}}class Rt extends A{constructor(){super(...arguments),this.type=u.Sync,this.description="A document update"}get(e){return y(this.encoder,e.documentName),d(this.encoder,this.type),It(this.encoder,e.update),this.encoder}}class jt extends Error{constructor(){super(...arguments),this.code=1001}}class Bt extends ke{constructor(e){var n,s,i;super(),this.configuration={name:"",document:void 0,awareness:void 0,token:null,forceSyncInterval:!1,onAuthenticated:()=>null,onAuthenticationFailed:()=>null,onOpen:()=>null,onConnect:()=>null,onMessage:()=>null,onOutgoingMessage:()=>null,onSynced:()=>null,onStatus:()=>null,onDisconnect:()=>null,onClose:()=>null,onDestroy:()=>null,onAwarenessUpdate:()=>null,onAwarenessChange:()=>null,onStateless:()=>null,onUnsyncedChanges:()=>null},this.isSynced=!1,this.unsyncedChanges=0,this.isAuthenticated=!1,this.authorizedScope=void 0,this.manageSocket=!1,this._isAttached=!1,this.intervals={forceSync:null},this.boundDocumentUpdateHandler=this.documentUpdateHandler.bind(this),this.boundAwarenessUpdateHandler=this.awarenessUpdateHandler.bind(this),this.boundPageHide=this.pageHide.bind(this),this.boundOnOpen=this.onOpen.bind(this),this.boundOnClose=this.onClose.bind(this),this.forwardConnect=()=>this.emit("connect"),this.forwardStatus=o=>this.emit("status",o),this.forwardClose=o=>this.emit("close",o),this.forwardDisconnect=o=>this.emit("disconnect",o),this.forwardDestroy=()=>this.emit("destroy"),this.setConfiguration(e),this.configuration.document=e.document?e.document:new ue,this.configuration.awareness=e.awareness!==void 0?e.awareness:new Dt(this.document),this.on("open",this.configuration.onOpen),this.on("message",this.configuration.onMessage),this.on("outgoingMessage",this.configuration.onOutgoingMessage),this.on("synced",this.configuration.onSynced),this.on("destroy",this.configuration.onDestroy),this.on("awarenessUpdate",this.configuration.onAwarenessUpdate),this.on("awarenessChange",this.configuration.onAwarenessChange),this.on("stateless",this.configuration.onStateless),this.on("unsyncedChanges",this.configuration.onUnsyncedChanges),this.on("authenticated",this.configuration.onAuthenticated),this.on("authenticationFailed",this.configuration.onAuthenticationFailed),(n=this.awareness)===null||n===void 0||n.on("update",()=>{this.emit("awarenessUpdate",{states:re(this.awareness.getStates())})}),(s=this.awareness)===null||s===void 0||s.on("change",()=>{this.emit("awarenessChange",{states:re(this.awareness.getStates())})}),this.document.on("update",this.boundDocumentUpdateHandler),(i=this.awareness)===null||i===void 0||i.on("update",this.boundAwarenessUpdateHandler),this.registerEventListeners(),this.configuration.forceSyncInterval&&typeof this.configuration.forceSyncInterval=="number"&&(this.intervals.forceSync=setInterval(this.forceSync.bind(this),this.configuration.forceSyncInterval)),this.manageSocket&&this.attach()}setConfiguration(e={}){e.websocketProvider||(this.manageSocket=!0,this.configuration.websocketProvider=new Tt(e)),this.configuration={...this.configuration,...e}}get document(){return this.configuration.document}get isAttached(){return this._isAttached}get awareness(){return this.configuration.awareness}get hasUnsyncedChanges(){return this.unsyncedChanges>0}resetUnsyncedChanges(){this.unsyncedChanges=1,this.emit("unsyncedChanges",{number:this.unsyncedChanges})}incrementUnsyncedChanges(){this.unsyncedChanges+=1,this.emit("unsyncedChanges",{number:this.unsyncedChanges})}decrementUnsyncedChanges(){this.unsyncedChanges>0&&(this.unsyncedChanges-=1),this.unsyncedChanges===0&&(this.synced=!0),this.emit("unsyncedChanges",{number:this.unsyncedChanges})}forceSync(){this.resetUnsyncedChanges(),this.send(he,{document:this.document,documentName:this.configuration.name})}pageHide(){this.awareness&&V(this.awareness,[this.document.clientID],"page hide")}registerEventListeners(){typeof window>"u"||!("addEventListener"in window)||window.addEventListener("pagehide",this.boundPageHide)}sendStateless(e){this.send(Ht,{documentName:this.configuration.name,payload:e})}async sendToken(){let e;try{e=await this.getToken()}catch(n){this.permissionDeniedHandler(`Failed to get token during sendToken(): ${n}`);return}this.send(Vt,{token:e??"",documentName:this.configuration.name})}documentUpdateHandler(e,n){n!==this&&(this.incrementUnsyncedChanges(),this.send(Rt,{update:e,documentName:this.configuration.name}))}awarenessUpdateHandler({added:e,updated:n,removed:s},i){const o=e.concat(n).concat(s);this.send(le,{awareness:this.awareness,clients:o,documentName:this.configuration.name})}get synced(){return this.isSynced}set synced(e){this.isSynced!==e&&(this.isSynced=e,e&&this.emit("synced",{state:e}))}receiveStateless(e){this.emit("stateless",{payload:e})}async connect(){if(this.manageSocket)return this.configuration.websocketProvider.connect();console.warn("HocuspocusProvider::connect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.")}disconnect(){if(this.manageSocket)return this.configuration.websocketProvider.disconnect();console.warn("HocuspocusProvider::disconnect() is deprecated and does not do anything. Please connect/disconnect on the websocketProvider, or attach/deattach providers.")}async onOpen(e){this.isAuthenticated=!1,this.emit("open",{event:e}),await this.sendToken(),this.startSync()}async getToken(){return typeof this.configuration.token=="function"?await this.configuration.token():this.configuration.token}startSync(){this.resetUnsyncedChanges(),this.send(he,{document:this.document,documentName:this.configuration.name}),this.awareness&&this.awareness.getLocalState()!==null&&this.send(le,{awareness:this.awareness,clients:[this.document.clientID],documentName:this.configuration.name})}send(e,n){if(!this._isAttached)return;const s=new Nt(e,n);this.emit("outgoingMessage",{message:s.message}),s.send(this.configuration.websocketProvider)}onMessage(e){const n=new X(e.data),s=n.readVarString();n.writeVarString(s),this.emit("message",{event:e,message:new X(e.data)}),new $t(n).apply(this,!0)}onClose(){this.isAuthenticated=!1,this.synced=!1,this.awareness&&V(this.awareness,Array.from(this.awareness.getStates().keys()).filter(e=>e!==this.document.clientID),this)}destroy(){this.emit("destroy"),this.intervals.forceSync&&clearInterval(this.intervals.forceSync),this.awareness&&(V(this.awareness,[this.document.clientID],"provider destroy"),this.awareness.off("update",this.boundAwarenessUpdateHandler),this.awareness.destroy()),this.document.off("update",this.boundDocumentUpdateHandler),this.removeAllListeners(),this.detach(),this.manageSocket&&this.configuration.websocketProvider.destroy(),!(typeof window>"u"||!("removeEventListener"in window))&&window.removeEventListener("pagehide",this.boundPageHide)}detach(){this.configuration.websocketProvider.off("connect",this.configuration.onConnect),this.configuration.websocketProvider.off("connect",this.forwardConnect),this.configuration.websocketProvider.off("status",this.forwardStatus),this.configuration.websocketProvider.off("status",this.configuration.onStatus),this.configuration.websocketProvider.off("open",this.boundOnOpen),this.configuration.websocketProvider.off("close",this.boundOnClose),this.configuration.websocketProvider.off("close",this.configuration.onClose),this.configuration.websocketProvider.off("close",this.forwardClose),this.configuration.websocketProvider.off("disconnect",this.configuration.onDisconnect),this.configuration.websocketProvider.off("disconnect",this.forwardDisconnect),this.configuration.websocketProvider.off("destroy",this.configuration.onDestroy),this.configuration.websocketProvider.off("destroy",this.forwardDestroy),this.configuration.websocketProvider.detach(this),this._isAttached=!1}attach(){this._isAttached||(this.configuration.websocketProvider.on("connect",this.configuration.onConnect),this.configuration.websocketProvider.on("connect",this.forwardConnect),this.configuration.websocketProvider.on("status",this.configuration.onStatus),this.configuration.websocketProvider.on("status",this.forwardStatus),this.configuration.websocketProvider.on("open",this.boundOnOpen),this.configuration.websocketProvider.on("close",this.boundOnClose),this.configuration.websocketProvider.on("close",this.configuration.onClose),this.configuration.websocketProvider.on("close",this.forwardClose),this.configuration.websocketProvider.on("disconnect",this.configuration.onDisconnect),this.configuration.websocketProvider.on("disconnect",this.forwardDisconnect),this.configuration.websocketProvider.on("destroy",this.configuration.onDestroy),this.configuration.websocketProvider.on("destroy",this.forwardDestroy),this.configuration.websocketProvider.attach(this),this._isAttached=!0)}permissionDeniedHandler(e){this.emit("authenticationFailed",{reason:e}),this.isAuthenticated=!1}authenticatedHandler(e){this.isAuthenticated=!0,this.authorizedScope=e,this.emit("authenticated",{scope:e})}setAwarenessField(e,n){if(!this.awareness)throw new jt(`Cannot set awareness field "${e}" to ${JSON.stringify(n)}. You have disabled Awareness for this provider by explicitly passing awareness: null in the provider configuration.`);this.awareness.setLocalStateField(e,n)}}const Ft=3e3;let g=Pe("idle"),K=null,m=null,S=null,w=null;function Wt(t){if(m&&K===t&&(b(g)==="connected"||b(g)==="connecting"))return{yText:S.getText("content"),awareness:m.awareness};Ue(),S=new ue,K=t,v(g,"connecting");const n=`${typeof window<"u"&&window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/collab`;return m=new Bt({url:n,name:t,document:S,onConnect:()=>{w&&(clearTimeout(w),w=null),v(g,"connected")},onStatus:({status:s})=>{s==="disconnected"&&b(g)==="connected"&&v(g,"disconnected")},onClose:()=>{b(g)!=="unavailable"&&v(g,"disconnected")}}),w=setTimeout(()=>{b(g)==="connecting"&&(v(g,"unavailable"),m?.destroy(),m=null),w=null},Ft),{yText:S.getText("content"),awareness:m.awareness}}function Ue(){w&&(clearTimeout(w),w=null),m&&(m.destroy(),m=null),S&&(S.destroy(),S=null),K=null,b(g)!=="unavailable"&&v(g,"idle")}const qt={get status(){return b(g)},connect:Wt,disconnect:Ue};export{qt as collab};
@@ -1 +1 @@
1
- import{c as p,a as i}from"./BfTJ6NzK.js";import"./BjnErSlK.js";import{f as l}from"./GRkK54yd.js";import{I as c,s as m}from"./CRcLi9EQ.js";import{l as d,s as f}from"./trveDs8t.js";function P(s,o){const t=d(o,["children","$$slots","$$events","$$legacy"]);const e=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}],["path",{d:"m15 5 4 4"}]];c(s,f({name:"pencil"},()=>t,{get iconNode(){return e},children:(r,$)=>{var a=p(),n=l(a);m(n,o,"default",{}),i(r,a)},$$slots:{default:!0}}))}export{P};
1
+ import{c as p,a as i}from"./CjKjQEMp.js";import"./eEhMI0BQ.js";import{f as l}from"./D-tW7Byc.js";import{I as c,s as m}from"./pwrC_shA.js";import{l as d,s as f}from"./EhE2EcYu.js";function P(s,o){const t=d(o,["children","$$slots","$$events","$$legacy"]);const e=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"}],["path",{d:"m15 5 4 4"}]];c(s,f({name:"pencil"},()=>t,{get iconNode(){return e},children:(r,$)=>{var a=p(),n=l(a);m(n,o,"default",{}),i(r,a)},$$slots:{default:!0}}))}export{P};
@@ -1 +1 @@
1
- import{b as v,h as o,a as y,E as f,r as l,s as m,c as p,d as i,H as T,e as A}from"./GRkK54yd.js";import{B as E}from"./trveDs8t.js";function g(d,_,e){var s;o&&(s=A,y());var r=new E(d);v(()=>{var a=_()??null;if(o){var h=l(s),c=h===T,u=a!==null;if(c!==u){var t=m();p(t),r.anchor=t,i(!1),r.ensure(a,a&&(n=>e(n,a))),i(!0);return}}r.ensure(a,a&&(n=>e(n,a)))},f)}export{g as c};
1
+ import{b as v,h as o,a as y,E as f,r as l,s as m,c as p,d as i,H as T,e as A}from"./D-tW7Byc.js";import{B as E}from"./EhE2EcYu.js";function g(d,_,e){var s;o&&(s=A,y());var r=new E(d);v(()=>{var a=_()??null;if(o){var h=l(s),c=h===T,u=a!==null;if(c!==u){var t=m();p(t),r.anchor=t,i(!1),r.ensure(a,a&&(n=>e(n,a))),i(!0);return}}r.ensure(a,a&&(n=>e(n,a)))},f)}export{g as c};
@@ -0,0 +1 @@
1
+ import{a0 as C,a1 as x,a2 as H,g as E,a3 as I,O as U,h as g,e as N,a4 as q,a5 as $,b as z,a as G,E as Q,r as W,H as Z,a6 as J,s as V,c as X,d as D,M as k,Q as ee,F as B,a7 as re,a8 as R,a9 as O,aa as se,ab as K,y as S,S as te,x as ie,ac as ne,ad as T,ae,af as fe,ag as ue,ah as ce,ai as oe,K as le,aj as de,ak as pe,W as Y,al as he,am as _,T as M,an as y}from"./D-tW7Byc.js";class _e{anchor;#r=new Map;#s=new Map;#e=new Map;#t=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#n=e=>{if(this.#r.has(e)){var t=this.#r.get(e),s=this.#s.get(t);if(s)C(s),this.#t.delete(t);else{var i=this.#e.get(t);i&&(this.#s.set(t,i.effect),this.#e.delete(t),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),s=i.effect)}for(const[n,f]of this.#r){if(this.#r.delete(n),n===e)break;const a=this.#e.get(f);a&&(x(a.effect),this.#e.delete(f))}for(const[n,f]of this.#s){if(n===t||this.#t.has(n))continue;const a=()=>{if(Array.from(this.#r.values()).includes(n)){var o=document.createDocumentFragment();q(f,o),o.append(E()),this.#e.set(n,{effect:f,fragment:o})}else x(f);this.#t.delete(n),this.#s.delete(n)};this.#i||!s?(this.#t.add(n),H(f,a,!1)):a()}}};#a=e=>{this.#r.delete(e);const t=Array.from(this.#r.values());for(const[s,i]of this.#e)t.includes(s)||(x(i.effect),this.#e.delete(s))};ensure(e,t){var s=U,i=$();if(t&&!this.#s.has(e)&&!this.#e.has(e))if(i){var n=document.createDocumentFragment(),f=E();n.append(f),this.#e.set(e,{effect:I(()=>t(f)),fragment:n})}else this.#s.set(e,I(()=>t(this.anchor)));if(this.#r.set(s,e),i){for(const[a,u]of this.#s)a===e?s.unskip_effect(u):s.skip_effect(u);for(const[a,u]of this.#e)a===e?s.unskip_effect(u.effect):s.skip_effect(u.effect);s.oncommit(this.#n),s.ondiscard(this.#a)}else g&&(this.anchor=N),this.#n(s)}}function ge(r,e,t=!1){var s;g&&(s=N,G());var i=new _e(r),n=t?Q:0;function f(a,u){if(g){var o=W(s),l;if(o===Z?l=0:o===J?l=!1:l=parseInt(o.substring(1)),a!==l){var v=V();X(v),i.anchor=v,D(!1),i.ensure(a,u),D(!0);return}}i.ensure(a,u)}z(()=>{var a=!1;e((u,o=0)=>{a=!0,f(o,u)}),a||f(!1,null)},n)}function L(r,e){return r===e||r?.[R]===e}function Oe(r={},e,t,s){return k(()=>{var i,n;return ee(()=>{i=n,n=[],B(()=>{r!==t(...n)&&(e(r,...n),i&&L(t(...i),r)&&e(null,...i))})}),()=>{re(()=>{n&&L(t(...n),r)&&e(null,...n)})}}),r}let P=!1;function ve(r){var e=P;try{return P=!1,[r(),P]}finally{P=e}}const be={get(r,e){if(!r.exclude.includes(e))return r.props[e]},set(r,e){return!1},getOwnPropertyDescriptor(r,e){if(!r.exclude.includes(e)&&e in r.props)return{enumerable:!0,configurable:!0,value:r.props[e]}},has(r,e){return r.exclude.includes(e)?!1:e in r.props},ownKeys(r){return Reflect.ownKeys(r.props).filter(e=>!r.exclude.includes(e))}};function Re(r,e,t){return new Proxy({props:r,exclude:e},be)}const Pe={get(r,e){if(!r.exclude.includes(e))return S(r.version),e in r.special?r.special[e]():r.props[e]},set(r,e,t){if(!(e in r.special)){var s=T;try{y(r.parent_effect),r.special[e]=we({get[e](){return r.props[e]}},e,K)}finally{y(s)}}return r.special[e](t),M(r.version),!0},getOwnPropertyDescriptor(r,e){if(!r.exclude.includes(e)&&e in r.props)return{enumerable:!0,configurable:!0,value:r.props[e]}},deleteProperty(r,e){return r.exclude.includes(e)||(r.exclude.push(e),M(r.version)),!0},has(r,e){return r.exclude.includes(e)?!1:e in r.props},ownKeys(r){return Reflect.ownKeys(r.props).filter(e=>!r.exclude.includes(e))}};function Te(r,e){return new Proxy({props:r,exclude:e,special:{},version:he(0),parent_effect:T},Pe)}const Se={get(r,e){let t=r.props.length;for(;t--;){let s=r.props[t];if(_(s)&&(s=s()),typeof s=="object"&&s!==null&&e in s)return s[e]}},set(r,e,t){let s=r.props.length;for(;s--;){let i=r.props[s];_(i)&&(i=i());const n=O(i,e);if(n&&n.set)return n.set(t),!0}return!1},getOwnPropertyDescriptor(r,e){let t=r.props.length;for(;t--;){let s=r.props[t];if(_(s)&&(s=s()),typeof s=="object"&&s!==null&&e in s){const i=O(s,e);return i&&!i.configurable&&(i.configurable=!0),i}}},has(r,e){if(e===R||e===Y)return!1;for(let t of r.props)if(_(t)&&(t=t()),t!=null&&e in t)return!0;return!1},ownKeys(r){const e=[];for(let t of r.props)if(_(t)&&(t=t()),!!t){for(const s in t)e.includes(s)||e.push(s);for(const s of Object.getOwnPropertySymbols(t))e.includes(s)||e.push(s)}return e}};function me(...r){return new Proxy({props:r},Se)}function we(r,e,t,s){var i=!ue||(t&ce)!==0,n=(t&fe)!==0,f=(t&pe)!==0,a=s,u=!0,o=()=>(u&&(u=!1,a=f?B(s):s),a),l;if(n){var v=R in r||Y in r;l=O(r,e)?.set??(v&&e in r?c=>r[e]=c:void 0)}var p,m=!1;n?[p,m]=ve(()=>r[e]):p=r[e],p===void 0&&s!==void 0&&(p=o(),l&&(i&&se(),l(p)));var d;if(i?d=()=>{var c=r[e];return c===void 0?o():(u=!0,c)}:d=()=>{var c=r[e];return c!==void 0&&(a=void 0),c===void 0?a:c},i&&(t&K)===0)return d;if(l){var F=r.$$legacy;return(function(c,b){return arguments.length>0?((!i||!b||F||m)&&l(b?d():c),c):d()})}var w=!1,h=((t&oe)!==0?le:de)(()=>(w=!1,d()));n&&S(h);var j=T;return(function(c,b){if(arguments.length>0){const A=b?S(h):i&&n?te(c):c;return ie(h,A),w=!0,a!==void 0&&(a=A),c}return ne&&w||(j.f&ae)!==0?h.v:S(h)})}export{_e as B,Oe as b,ge as i,Te as l,we as p,Re as r,me as s};
@@ -0,0 +1 @@
1
+ import{k as Oe,c as st,a as tt,f as Ae}from"./CjKjQEMp.js";import{V as A,y as g,z as N,S as Rt,D as G,x as C,p as dt,f as et,bd as ht,n as gt,_ as Se,q as Pe}from"./D-tW7Byc.js";import{e as mt}from"./ByFfmBEu.js";import{p as O,i as Lt,s as kt,r as St}from"./EhE2EcYu.js";import{d as Ce,s as $,C as It,c as Fe,e as Dt,u as ae,f as Ee,i as Re,g as De,w as jt,h as Be,j as R,m as ce,F as Te,S as qt,E as We,D as Me,T as Le}from"./CICthOLY.js";function ke(e){return typeof e=="function"}function Zt(e){return ke(e)?e():e}class Ie{#t={width:0,height:0};#n=!1;#i;#o;#e;#a=A(()=>(g(this.#r)?.(),this.getSize().width));#s=A(()=>(g(this.#r)?.(),this.getSize().height));#r=A(()=>{const t=Zt(this.#o);if(t)return Oe(n=>{if(!this.#e)return;const i=new this.#e.ResizeObserver(r=>{this.#n=!0;for(const s of r){const o=this.#i.box==="content-box"?s.contentBoxSize:s.borderBoxSize,a=Array.isArray(o)?o:[o];this.#t.width=a.reduce((c,l)=>Math.max(c,l.inlineSize),0),this.#t.height=a.reduce((c,l)=>Math.max(c,l.blockSize),0)}n()});return i.observe(t),()=>{this.#n=!1,i.disconnect()}})});constructor(t,n={box:"border-box"}){this.#e=n.window??Ce,this.#i=n,this.#o=t,this.#t={width:0,height:0}}calculateSize(){const t=Zt(this.#o);if(!t||!this.#e)return;const n=t.offsetWidth,i=t.offsetHeight;if(this.#i.box==="border-box")return{width:n,height:i};const r=this.#e.getComputedStyle(t),s=parseFloat(r.paddingLeft)+parseFloat(r.paddingRight),o=parseFloat(r.paddingTop)+parseFloat(r.paddingBottom),a=parseFloat(r.borderLeftWidth)+parseFloat(r.borderRightWidth),c=parseFloat(r.borderTopWidth)+parseFloat(r.borderBottomWidth),l=n-s-a,d=i-o-c;return{width:l,height:d}}getSize(){return this.#n?this.#t:this.calculateSize()??this.#t}get current(){return g(this.#r)?.(),this.getSize()}get width(){return g(this.#a)}get height(){return g(this.#s)}}const He=["top","right","bottom","left"],nt=Math.min,k=Math.max,pt=Math.round,yt=Math.floor,Y=e=>({x:e,y:e}),_e={left:"right",right:"left",bottom:"top",top:"bottom"},Ne={start:"end",end:"start"};function Tt(e,t,n){return k(e,nt(t,n))}function q(e,t){return typeof e=="function"?e(t):e}function Z(e){return e.split("-")[0]}function lt(e){return e.split("-")[1]}function Ht(e){return e==="x"?"y":"x"}function _t(e){return e==="y"?"height":"width"}const Ve=new Set(["top","bottom"]);function X(e){return Ve.has(Z(e))?"y":"x"}function Nt(e){return Ht(X(e))}function ze(e,t,n){n===void 0&&(n=!1);const i=lt(e),r=Nt(e),s=_t(r);let o=r==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=vt(o)),[o,vt(o)]}function Ke(e){const t=vt(e);return[Wt(e),t,Wt(t)]}function Wt(e){return e.replace(/start|end/g,t=>Ne[t])}const Jt=["left","right"],Qt=["right","left"],Xe=["top","bottom"],Ye=["bottom","top"];function Ue(e,t,n){switch(e){case"top":case"bottom":return n?t?Qt:Jt:t?Jt:Qt;case"left":case"right":return t?Xe:Ye;default:return[]}}function je(e,t,n,i){const r=lt(e);let s=Ue(Z(e),n==="start",i);return r&&(s=s.map(o=>o+"-"+r),t&&(s=s.concat(s.map(Wt)))),s}function vt(e){return e.replace(/left|right|bottom|top/g,t=>_e[t])}function qe(e){return{top:0,right:0,bottom:0,left:0,...e}}function le(e){return typeof e!="number"?qe(e):{top:e,right:e,bottom:e,left:e}}function xt(e){const{x:t,y:n,width:i,height:r}=e;return{width:i,height:r,top:n,left:t,right:t+i,bottom:n+r,x:t,y:n}}function Gt(e,t,n){let{reference:i,floating:r}=e;const s=X(t),o=Nt(t),a=_t(o),c=Z(t),l=s==="y",d=i.x+i.width/2-r.width/2,u=i.y+i.height/2-r.height/2,h=i[a]/2-r[a]/2;let f;switch(c){case"top":f={x:d,y:i.y-r.height};break;case"bottom":f={x:d,y:i.y+i.height};break;case"right":f={x:i.x+i.width,y:u};break;case"left":f={x:i.x-r.width,y:u};break;default:f={x:i.x,y:i.y}}switch(lt(t)){case"start":f[o]-=h*(n&&l?-1:1);break;case"end":f[o]+=h*(n&&l?-1:1);break}return f}async function Ze(e,t){var n;t===void 0&&(t={});const{x:i,y:r,platform:s,rects:o,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:h=!1,padding:f=0}=q(t,e),m=le(f),y=a[h?u==="floating"?"reference":"floating":u],p=xt(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:d,strategy:c})),b=u==="floating"?{x:i,y:r,width:o.floating.width,height:o.floating.height}:o.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),v=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},S=xt(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:x,strategy:c}):b);return{top:(p.top-S.top+m.top)/v.y,bottom:(S.bottom-p.bottom+m.bottom)/v.y,left:(p.left-S.left+m.left)/v.x,right:(S.right-p.right+m.right)/v.x}}const Je=async(e,t,n)=>{const{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let l=await o.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:u}=Gt(l,i,c),h=i,f={},m=0;for(let y=0;y<a.length;y++){var w;const{name:p,fn:b}=a[y],{x,y:v,data:S,reset:P}=await b({x:d,y:u,initialPlacement:i,placement:h,strategy:r,middlewareData:f,rects:l,platform:{...o,detectOverflow:(w=o.detectOverflow)!=null?w:Ze},elements:{reference:e,floating:t}});d=x??d,u=v??u,f={...f,[p]:{...f[p],...S}},P&&m<=50&&(m++,typeof P=="object"&&(P.placement&&(h=P.placement),P.rects&&(l=P.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:r}):P.rects),{x:d,y:u}=Gt(l,h,c)),y=-1)}return{x:d,y:u,placement:h,strategy:r,middlewareData:f}},Qe=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:i,placement:r,rects:s,platform:o,elements:a,middlewareData:c}=t,{element:l,padding:d=0}=q(e,t)||{};if(l==null)return{};const u=le(d),h={x:n,y:i},f=Nt(r),m=_t(f),w=await o.getDimensions(l),y=f==="y",p=y?"top":"left",b=y?"bottom":"right",x=y?"clientHeight":"clientWidth",v=s.reference[m]+s.reference[f]-h[f]-s.floating[m],S=h[f]-s.reference[f],P=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l));let F=P?P[x]:0;(!F||!await(o.isElement==null?void 0:o.isElement(P)))&&(F=a.floating[x]||s.floating[m]);const W=v/2-S/2,E=F/2-w[m]/2-1,D=nt(u[p],E),_=nt(u[b],E),T=D,K=F-w[m]-_,B=F/2-w[m]/2+W,J=Tt(T,B,K),H=!c.arrow&&lt(r)!=null&&B!==J&&s.reference[m]/2-(B<T?D:_)-w[m]/2<0,M=H?B<T?B-T:B-K:0;return{[f]:h[f]+M,data:{[f]:J,centerOffset:B-J-M,...H&&{alignmentOffset:M}},reset:H}}}),Ge=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,i;const{placement:r,middlewareData:s,rects:o,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:w=!0,...y}=q(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const p=Z(r),b=X(a),x=Z(a)===a,v=await(c.isRTL==null?void 0:c.isRTL(l.floating)),S=h||(x||!w?[vt(a)]:Ke(a)),P=m!=="none";!h&&P&&S.push(...je(a,w,m,v));const F=[a,...S],W=await c.detectOverflow(t,y),E=[];let D=((i=s.flip)==null?void 0:i.overflows)||[];if(d&&E.push(W[p]),u){const B=ze(r,o,v);E.push(W[B[0]],W[B[1]])}if(D=[...D,{placement:r,overflows:E}],!E.every(B=>B<=0)){var _,T;const B=(((_=s.flip)==null?void 0:_.index)||0)+1,J=F[B];if(J&&(!(u==="alignment"?b!==X(J):!1)||D.every(L=>X(L.placement)===b?L.overflows[0]>0:!0)))return{data:{index:B,overflows:D},reset:{placement:J}};let H=(T=D.filter(M=>M.overflows[0]<=0).sort((M,L)=>M.overflows[1]-L.overflows[1])[0])==null?void 0:T.placement;if(!H)switch(f){case"bestFit":{var K;const M=(K=D.filter(L=>{if(P){const Q=X(L.placement);return Q===b||Q==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(Q=>Q>0).reduce((Q,be)=>Q+be,0)]).sort((L,Q)=>L[1]-Q[1])[0])==null?void 0:K[0];M&&(H=M);break}case"initialPlacement":H=a;break}if(r!==H)return{reset:{placement:H}}}return{}}}};function $t(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function te(e){return He.some(t=>e[t]>=0)}const $e=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:i}=t,{strategy:r="referenceHidden",...s}=q(e,t);switch(r){case"referenceHidden":{const o=await i.detectOverflow(t,{...s,elementContext:"reference"}),a=$t(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:te(a)}}}case"escaped":{const o=await i.detectOverflow(t,{...s,altBoundary:!0}),a=$t(o,n.floating);return{data:{escapedOffsets:a,escaped:te(a)}}}default:return{}}}}},ue=new Set(["left","top"]);async function tn(e,t){const{placement:n,platform:i,elements:r}=e,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),o=Z(n),a=lt(n),c=X(n)==="y",l=ue.has(o)?-1:1,d=s&&c?-1:1,u=q(t,e);let{mainAxis:h,crossAxis:f,alignmentAxis:m}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof m=="number"&&(f=a==="end"?m*-1:m),c?{x:f*d,y:h*l}:{x:h*l,y:f*d}}const en=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,i;const{x:r,y:s,placement:o,middlewareData:a}=t,c=await tn(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+c.x,y:s+c.y,data:{...c,placement:o}}}}},nn=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:i,placement:r,platform:s}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:c={fn:p=>{let{x:b,y:x}=p;return{x:b,y:x}}},...l}=q(e,t),d={x:n,y:i},u=await s.detectOverflow(t,l),h=X(Z(r)),f=Ht(h);let m=d[f],w=d[h];if(o){const p=f==="y"?"top":"left",b=f==="y"?"bottom":"right",x=m+u[p],v=m-u[b];m=Tt(x,m,v)}if(a){const p=h==="y"?"top":"left",b=h==="y"?"bottom":"right",x=w+u[p],v=w-u[b];w=Tt(x,w,v)}const y=c.fn({...t,[f]:m,[h]:w});return{...y,data:{x:y.x-n,y:y.y-i,enabled:{[f]:o,[h]:a}}}}}},rn=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:i,placement:r,rects:s,middlewareData:o}=t,{offset:a=0,mainAxis:c=!0,crossAxis:l=!0}=q(e,t),d={x:n,y:i},u=X(r),h=Ht(u);let f=d[h],m=d[u];const w=q(a,t),y=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(c){const x=h==="y"?"height":"width",v=s.reference[h]-s.floating[x]+y.mainAxis,S=s.reference[h]+s.reference[x]-y.mainAxis;f<v?f=v:f>S&&(f=S)}if(l){var p,b;const x=h==="y"?"width":"height",v=ue.has(Z(r)),S=s.reference[u]-s.floating[x]+(v&&((p=o.offset)==null?void 0:p[u])||0)+(v?0:y.crossAxis),P=s.reference[u]+s.reference[x]+(v?0:((b=o.offset)==null?void 0:b[u])||0)-(v?y.crossAxis:0);m<S?m=S:m>P&&(m=P)}return{[h]:f,[u]:m}}}},on=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,i;const{placement:r,rects:s,platform:o,elements:a}=t,{apply:c=()=>{},...l}=q(e,t),d=await o.detectOverflow(t,l),u=Z(r),h=lt(r),f=X(r)==="y",{width:m,height:w}=s.floating;let y,p;u==="top"||u==="bottom"?(y=u,p=h===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(p=u,y=h==="end"?"top":"bottom");const b=w-d.top-d.bottom,x=m-d.left-d.right,v=nt(w-d[y],b),S=nt(m-d[p],x),P=!t.middlewareData.shift;let F=v,W=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(W=x),(i=t.middlewareData.shift)!=null&&i.enabled.y&&(F=b),P&&!h){const D=k(d.left,0),_=k(d.right,0),T=k(d.top,0),K=k(d.bottom,0);f?W=m-2*(D!==0||_!==0?D+_:k(d.left,d.right)):F=w-2*(T!==0||K!==0?T+K:k(d.top,d.bottom))}await c({...t,availableWidth:W,availableHeight:F});const E=await o.getDimensions(a.floating);return m!==E.width||w!==E.height?{reset:{rects:!0}}:{}}}};function Pt(){return typeof window<"u"}function ut(e){return fe(e)?(e.nodeName||"").toLowerCase():"#document"}function I(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function j(e){var t;return(t=(fe(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fe(e){return Pt()?e instanceof Node||e instanceof I(e).Node:!1}function V(e){return Pt()?e instanceof Element||e instanceof I(e).Element:!1}function U(e){return Pt()?e instanceof HTMLElement||e instanceof I(e).HTMLElement:!1}function ee(e){return!Pt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof I(e).ShadowRoot}const sn=new Set(["inline","contents"]);function wt(e){const{overflow:t,overflowX:n,overflowY:i,display:r}=z(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&!sn.has(r)}const an=new Set(["table","td","th"]);function cn(e){return an.has(ut(e))}const ln=[":popover-open",":modal"];function Ct(e){return ln.some(t=>{try{return e.matches(t)}catch{return!1}})}const un=["transform","translate","scale","rotate","perspective"],fn=["transform","translate","scale","rotate","perspective","filter"],dn=["paint","layout","strict","content"];function Vt(e){const t=zt(),n=V(e)?z(e):e;return un.some(i=>n[i]?n[i]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||fn.some(i=>(n.willChange||"").includes(i))||dn.some(i=>(n.contain||"").includes(i))}function hn(e){let t=it(e);for(;U(t)&&!ct(t);){if(Vt(t))return t;if(Ct(t))return null;t=it(t)}return null}function zt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const gn=new Set(["html","body","#document"]);function ct(e){return gn.has(ut(e))}function z(e){return I(e).getComputedStyle(e)}function Ft(e){return V(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function it(e){if(ut(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ee(e)&&e.host||j(e);return ee(t)?t.host:t}function de(e){const t=it(e);return ct(t)?e.ownerDocument?e.ownerDocument.body:e.body:U(t)&&wt(t)?t:de(t)}function ft(e,t,n){var i;t===void 0&&(t=[]),n===void 0&&(n=!0);const r=de(e),s=r===((i=e.ownerDocument)==null?void 0:i.body),o=I(r);if(s){const a=Mt(o);return t.concat(o,o.visualViewport||[],wt(r)?r:[],a&&n?ft(a):[])}return t.concat(r,ft(r,[],n))}function Mt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function he(e){const t=z(e);let n=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const r=U(e),s=r?e.offsetWidth:n,o=r?e.offsetHeight:i,a=pt(n)!==s||pt(i)!==o;return a&&(n=s,i=o),{width:n,height:i,$:a}}function Kt(e){return V(e)?e:e.contextElement}function at(e){const t=Kt(e);if(!U(t))return Y(1);const n=t.getBoundingClientRect(),{width:i,height:r,$:s}=he(t);let o=(s?pt(n.width):n.width)/i,a=(s?pt(n.height):n.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const mn=Y(0);function ge(e){const t=I(e);return!zt()||!t.visualViewport?mn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function wn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==I(e)?!1:t}function ot(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=Kt(e);let o=Y(1);t&&(i?V(i)&&(o=at(i)):o=at(e));const a=wn(s,n,i)?ge(s):Y(0);let c=(r.left+a.x)/o.x,l=(r.top+a.y)/o.y,d=r.width/o.x,u=r.height/o.y;if(s){const h=I(s),f=i&&V(i)?I(i):i;let m=h,w=Mt(m);for(;w&&i&&f!==m;){const y=at(w),p=w.getBoundingClientRect(),b=z(w),x=p.left+(w.clientLeft+parseFloat(b.paddingLeft))*y.x,v=p.top+(w.clientTop+parseFloat(b.paddingTop))*y.y;c*=y.x,l*=y.y,d*=y.x,u*=y.y,c+=x,l+=v,m=I(w),w=Mt(m)}}return xt({width:d,height:u,x:c,y:l})}function Et(e,t){const n=Ft(e).scrollLeft;return t?t.left+n:ot(j(e)).left+n}function me(e,t){const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-Et(e,n),r=n.top+t.scrollTop;return{x:i,y:r}}function yn(e){let{elements:t,rect:n,offsetParent:i,strategy:r}=e;const s=r==="fixed",o=j(i),a=t?Ct(t.floating):!1;if(i===o||a&&s)return n;let c={scrollLeft:0,scrollTop:0},l=Y(1);const d=Y(0),u=U(i);if((u||!u&&!s)&&((ut(i)!=="body"||wt(o))&&(c=Ft(i)),U(i))){const f=ot(i);l=at(i),d.x=f.x+i.clientLeft,d.y=f.y+i.clientTop}const h=o&&!u&&!s?me(o,c):Y(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+d.x+h.x,y:n.y*l.y-c.scrollTop*l.y+d.y+h.y}}function pn(e){return Array.from(e.getClientRects())}function vn(e){const t=j(e),n=Ft(e),i=e.ownerDocument.body,r=k(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),s=k(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let o=-n.scrollLeft+Et(e);const a=-n.scrollTop;return z(i).direction==="rtl"&&(o+=k(t.clientWidth,i.clientWidth)-r),{width:r,height:s,x:o,y:a}}const ne=25;function xn(e,t){const n=I(e),i=j(e),r=n.visualViewport;let s=i.clientWidth,o=i.clientHeight,a=0,c=0;if(r){s=r.width,o=r.height;const d=zt();(!d||d&&t==="fixed")&&(a=r.offsetLeft,c=r.offsetTop)}const l=Et(i);if(l<=0){const d=i.ownerDocument,u=d.body,h=getComputedStyle(u),f=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,m=Math.abs(i.clientWidth-u.clientWidth-f);m<=ne&&(s-=m)}else l<=ne&&(s+=l);return{width:s,height:o,x:a,y:c}}const bn=new Set(["absolute","fixed"]);function On(e,t){const n=ot(e,!0,t==="fixed"),i=n.top+e.clientTop,r=n.left+e.clientLeft,s=U(e)?at(e):Y(1),o=e.clientWidth*s.x,a=e.clientHeight*s.y,c=r*s.x,l=i*s.y;return{width:o,height:a,x:c,y:l}}function ie(e,t,n){let i;if(t==="viewport")i=xn(e,n);else if(t==="document")i=vn(j(e));else if(V(t))i=On(t,n);else{const r=ge(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return xt(i)}function we(e,t){const n=it(e);return n===t||!V(n)||ct(n)?!1:z(n).position==="fixed"||we(n,t)}function An(e,t){const n=t.get(e);if(n)return n;let i=ft(e,[],!1).filter(a=>V(a)&&ut(a)!=="body"),r=null;const s=z(e).position==="fixed";let o=s?it(e):e;for(;V(o)&&!ct(o);){const a=z(o),c=Vt(o);!c&&a.position==="fixed"&&(r=null),(s?!c&&!r:!c&&a.position==="static"&&!!r&&bn.has(r.position)||wt(o)&&!c&&we(e,o))?i=i.filter(d=>d!==o):r=a,o=it(o)}return t.set(e,i),i}function Sn(e){let{element:t,boundary:n,rootBoundary:i,strategy:r}=e;const o=[...n==="clippingAncestors"?Ct(t)?[]:An(t,this._c):[].concat(n),i],a=o[0],c=o.reduce((l,d)=>{const u=ie(t,d,r);return l.top=k(u.top,l.top),l.right=nt(u.right,l.right),l.bottom=nt(u.bottom,l.bottom),l.left=k(u.left,l.left),l},ie(t,a,r));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Pn(e){const{width:t,height:n}=he(e);return{width:t,height:n}}function Cn(e,t,n){const i=U(t),r=j(t),s=n==="fixed",o=ot(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=Y(0);function l(){c.x=Et(r)}if(i||!i&&!s)if((ut(t)!=="body"||wt(r))&&(a=Ft(t)),i){const f=ot(t,!0,s,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else r&&l();s&&!i&&r&&l();const d=r&&!i&&!s?me(r,a):Y(0),u=o.left+a.scrollLeft-c.x-d.x,h=o.top+a.scrollTop-c.y-d.y;return{x:u,y:h,width:o.width,height:o.height}}function Bt(e){return z(e).position==="static"}function re(e,t){if(!U(e)||z(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return j(e)===n&&(n=n.ownerDocument.body),n}function ye(e,t){const n=I(e);if(Ct(e))return n;if(!U(e)){let r=it(e);for(;r&&!ct(r);){if(V(r)&&!Bt(r))return r;r=it(r)}return n}let i=re(e,t);for(;i&&cn(i)&&Bt(i);)i=re(i,t);return i&&ct(i)&&Bt(i)&&!Vt(i)?n:i||hn(e)||n}const Fn=async function(e){const t=this.getOffsetParent||ye,n=this.getDimensions,i=await n(e.floating);return{reference:Cn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function En(e){return z(e).direction==="rtl"}const Rn={convertOffsetParentRelativeRectToViewportRelativeRect:yn,getDocumentElement:j,getClippingRect:Sn,getOffsetParent:ye,getElementRects:Fn,getClientRects:pn,getDimensions:Pn,getScale:at,isElement:V,isRTL:En};function pe(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Dn(e,t){let n=null,i;const r=j(e);function s(){var a;clearTimeout(i),(a=n)==null||a.disconnect(),n=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const l=e.getBoundingClientRect(),{left:d,top:u,width:h,height:f}=l;if(a||t(),!h||!f)return;const m=yt(u),w=yt(r.clientWidth-(d+h)),y=yt(r.clientHeight-(u+f)),p=yt(d),x={rootMargin:-m+"px "+-w+"px "+-y+"px "+-p+"px",threshold:k(0,nt(1,c))||1};let v=!0;function S(P){const F=P[0].intersectionRatio;if(F!==c){if(!v)return o();F?o(!1,F):i=setTimeout(()=>{o(!1,1e-7)},1e3)}F===1&&!pe(l,e.getBoundingClientRect())&&o(),v=!1}try{n=new IntersectionObserver(S,{...x,root:r.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(e)}return o(!0),s}function Bn(e,t,n,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=i,l=Kt(e),d=r||s?[...l?ft(l):[],...ft(t)]:[];d.forEach(p=>{r&&p.addEventListener("scroll",n,{passive:!0}),s&&p.addEventListener("resize",n)});const u=l&&a?Dn(l,n):null;let h=-1,f=null;o&&(f=new ResizeObserver(p=>{let[b]=p;b&&b.target===l&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=f)==null||x.observe(t)})),n()}),l&&!c&&f.observe(l),f.observe(t));let m,w=c?ot(e):null;c&&y();function y(){const p=ot(e);w&&!pe(w,p)&&n(),w=p,m=requestAnimationFrame(y)}return n(),()=>{var p;d.forEach(b=>{r&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),u?.(),(p=f)==null||p.disconnect(),f=null,c&&cancelAnimationFrame(m)}}const Tn=en,Wn=nn,Mn=Ge,Ln=on,kn=$e,In=Qe,Hn=rn,_n=(e,t,n)=>{const i=new Map,r={platform:Rn,...n},s={...r.platform,_c:i};return Je(e,t,{...r,platform:s})};function rt(e){return typeof e=="function"?e():e}function ve(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function oe(e,t){const n=ve(e);return Math.round(t*n)/n}function ei(e){return{[`--bits-${e}-content-transform-origin`]:"var(--bits-floating-transform-origin)",[`--bits-${e}-content-available-width`]:"var(--bits-floating-available-width)",[`--bits-${e}-content-available-height`]:"var(--bits-floating-available-height)",[`--bits-${e}-anchor-width`]:"var(--bits-floating-anchor-width)",[`--bits-${e}-anchor-height`]:"var(--bits-floating-anchor-height)"}}function Nn(e){const t=e.whileElementsMounted,n=A(()=>rt(e.open)??!0),i=A(()=>rt(e.middleware)),r=A(()=>rt(e.transform)??!0),s=A(()=>rt(e.placement)??"bottom"),o=A(()=>rt(e.strategy)??"absolute"),a=A(()=>rt(e.sideOffset)??0),c=A(()=>rt(e.alignOffset)??0),l=e.reference;let d=N(0),u=N(0);const h=$(null);let f=N(Rt(g(o))),m=N(Rt(g(s))),w=N(Rt({})),y=N(!1),p=!1;const b=A(()=>{const E=h.current?oe(h.current,g(d)):g(d),D=h.current?oe(h.current,g(u)):g(u);return g(r)?{position:g(f),left:"0",top:"0",transform:`translate(${E}px, ${D}px)`,...h.current&&ve(h.current)>=1.5&&{willChange:"transform"}}:{position:g(f),left:`${E}px`,top:`${D}px`}});let x;function v(){l.current===null||h.current===null||_n(l.current,h.current,{middleware:g(i),placement:g(s),strategy:g(o)}).then(E=>{const D=l.current;if(Vn(D)){C(w,{...g(w),hide:{...g(w).hide,referenceHidden:!0}},!0);return}if(!g(n)&&g(d)!==0&&g(u)!==0){const T=Math.max(Math.abs(g(a)),Math.abs(g(c)),15);if(E.x<=T&&E.y<=T)return}C(d,E.x,!0),C(u,E.y,!0),C(f,E.strategy,!0),C(m,E.placement,!0),C(w,E.middlewareData,!0),C(y,!0)})}function S(){typeof x=="function"&&(x(),x=void 0)}function P(){if(S(),t===void 0){v();return}g(n)&&(l.current===null||h.current===null||(x=t(l.current,h.current,v)))}function F(){g(n)||C(y,!1)}function W(){return[g(i),g(s),g(o),g(a),g(c),g(n)]}return G(()=>{t===void 0&&g(n)&&v()}),G(P),G(()=>{if(t!==void 0){if(W(),!g(n)){p=!1;return}if(!g(y)){p=!1;return}if(!p){p=!0;return}v()}}),G(F),G(()=>S),{floating:h,reference:l,get strategy(){return g(f)},get placement(){return g(m)},get middlewareData(){return g(w)},get isPositioned(){return g(y)},get floatingStyles(){return g(b)},get update(){return v}}}function Vn(e){return e instanceof Element?!e.isConnected||e instanceof HTMLElement&&e.hidden?!0:e.getClientRects().length===0:!1}const zn={top:"bottom",right:"left",bottom:"top",left:"right"},Xt=new It("Floating.Root"),se=new It("Floating.Content"),Yt=new It("Floating.Root");class bt{static create(t=!1){return t?Yt.set(new bt):Xt.set(new bt)}anchorNode=$(null);customAnchorNode=$(null);triggerNode=$(null);constructor(){G(()=>{this.customAnchorNode.current?typeof this.customAnchorNode.current=="string"?this.anchorNode.current=document.querySelector(this.customAnchorNode.current):this.anchorNode.current=this.customAnchorNode.current:this.anchorNode.current=this.triggerNode.current})}}class Ot{static create(t,n=!1){return n?se.set(new Ot(t,Yt.get())):se.set(new Ot(t,Xt.get()))}opts;root;contentRef=$(null);wrapperRef=$(null);arrowRef=$(null);contentAttachment=Dt(this.contentRef);wrapperAttachment=Dt(this.wrapperRef);arrowAttachment=Dt(this.arrowRef);arrowId=$(ae());#t=A(()=>{if(typeof this.opts.style=="string")return Ee(this.opts.style);if(!this.opts.style)return{}});#n=void 0;#i=new Ie(()=>this.arrowRef.current??void 0);#o=A(()=>this.#i?.width??0);#e=A(()=>this.#i?.height??0);#a=A(()=>this.opts.side?.current+(this.opts.align.current!=="center"?`-${this.opts.align.current}`:""));#s=A(()=>Array.isArray(this.opts.collisionBoundary.current)?this.opts.collisionBoundary.current:[this.opts.collisionBoundary.current]);#r=A(()=>g(this.#s).length>0);get hasExplicitBoundaries(){return g(this.#r)}set hasExplicitBoundaries(t){C(this.#r,t)}#c=A(()=>({padding:this.opts.collisionPadding.current,boundary:g(this.#s).filter(Re),altBoundary:this.hasExplicitBoundaries}));get detectOverflowOptions(){return g(this.#c)}set detectOverflowOptions(t){C(this.#c,t)}#l=N(void 0);#u=N(void 0);#f=N(void 0);#d=N(void 0);#h=A(()=>[Tn({mainAxis:this.opts.sideOffset.current+g(this.#e),alignmentAxis:this.opts.alignOffset.current}),this.opts.avoidCollisions.current&&Wn({mainAxis:!0,crossAxis:!1,limiter:this.opts.sticky.current==="partial"?Hn():void 0,...this.detectOverflowOptions}),this.opts.avoidCollisions.current&&Mn({...this.detectOverflowOptions}),Ln({...this.detectOverflowOptions,apply:({rects:t,availableWidth:n,availableHeight:i})=>{const{width:r,height:s}=t.reference;C(this.#l,n,!0),C(this.#u,i,!0),C(this.#f,r,!0),C(this.#d,s,!0)}}),this.arrowRef.current&&In({element:this.arrowRef.current,padding:this.opts.arrowPadding.current}),Kn({arrowWidth:g(this.#o),arrowHeight:g(this.#e)}),this.opts.hideWhenDetached.current&&kn({strategy:"referenceHidden",...this.detectOverflowOptions})].filter(Boolean));get middleware(){return g(this.#h)}set middleware(t){C(this.#h,t)}floating;#g=A(()=>Xn(this.floating.placement));get placedSide(){return g(this.#g)}set placedSide(t){C(this.#g,t)}#m=A(()=>Yn(this.floating.placement));get placedAlign(){return g(this.#m)}set placedAlign(t){C(this.#m,t)}#w=A(()=>this.floating.middlewareData.arrow?.x??0);get arrowX(){return g(this.#w)}set arrowX(t){C(this.#w,t)}#y=A(()=>this.floating.middlewareData.arrow?.y??0);get arrowY(){return g(this.#y)}set arrowY(t){C(this.#y,t)}#p=A(()=>this.floating.middlewareData.arrow?.centerOffset!==0);get cannotCenterArrow(){return g(this.#p)}set cannotCenterArrow(t){C(this.#p,t)}#v=N();get contentZIndex(){return g(this.#v)}set contentZIndex(t){C(this.#v,t,!0)}#x=A(()=>zn[this.placedSide]);get arrowBaseSide(){return g(this.#x)}set arrowBaseSide(t){C(this.#x,t)}#b=A(()=>({id:this.opts.wrapperId.current,"data-bits-floating-content-wrapper":"",style:{...this.floating.floatingStyles,transform:this.floating.isPositioned?this.floating.floatingStyles.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:this.contentZIndex,"--bits-floating-transform-origin":`${this.floating.middlewareData.transformOrigin?.x} ${this.floating.middlewareData.transformOrigin?.y}`,"--bits-floating-available-width":`${g(this.#l)}px`,"--bits-floating-available-height":`${g(this.#u)}px`,"--bits-floating-anchor-width":`${g(this.#f)}px`,"--bits-floating-anchor-height":`${g(this.#d)}px`,...this.floating.middlewareData.hide?.referenceHidden&&{visibility:"hidden","pointer-events":"none"},...g(this.#t)},dir:this.opts.dir.current,...this.wrapperAttachment}));get wrapperProps(){return g(this.#b)}set wrapperProps(t){C(this.#b,t)}#O=A(()=>({"data-side":this.placedSide,"data-align":this.placedAlign,style:De({...g(this.#t)}),...this.contentAttachment}));get props(){return g(this.#O)}set props(t){C(this.#O,t)}#A=A(()=>({position:"absolute",left:this.arrowX?`${this.arrowX}px`:void 0,top:this.arrowY?`${this.arrowY}px`:void 0,[this.arrowBaseSide]:0,"transform-origin":{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[this.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[this.placedSide],visibility:this.cannotCenterArrow?"hidden":void 0}));get arrowStyle(){return g(this.#A)}set arrowStyle(t){C(this.#A,t)}constructor(t,n){this.opts=t,this.root=n,this.#n=t.updatePositionStrategy,t.customAnchor&&(this.root.customAnchorNode.current=t.customAnchor.current),jt(()=>t.customAnchor.current,i=>{this.root.customAnchorNode.current=i}),this.floating=Nn({strategy:()=>this.opts.strategy.current,placement:()=>g(this.#a),middleware:()=>this.middleware,reference:this.root.anchorNode,whileElementsMounted:(...i)=>Bn(...i,{animationFrame:this.#n?.current==="always"}),open:()=>this.opts.enabled.current,sideOffset:()=>this.opts.sideOffset.current,alignOffset:()=>this.opts.alignOffset.current}),G(()=>{this.floating.isPositioned&&this.opts.onPlaced?.current()}),jt(()=>this.contentRef.current,i=>{if(!i||!this.opts.enabled.current)return;const r=Be(i),s=r.requestAnimationFrame(()=>{if(this.contentRef.current!==i||!this.opts.enabled.current)return;const o=r.getComputedStyle(i).zIndex;o!==this.contentZIndex&&(this.contentZIndex=o)});return()=>{r.cancelAnimationFrame(s)}}),G(()=>{this.floating.floating.current=this.wrapperRef.current})}}class At{static create(t,n=!1){return n?new At(t,Yt.get()):new At(t,Xt.get())}opts;root;constructor(t,n){this.opts=t,this.root=n,t.virtualEl&&t.virtualEl.current?n.triggerNode=Fe(t.virtualEl.current):n.triggerNode=t.ref}}function Kn(e){return{name:"transformOrigin",options:e,fn(t){const{placement:n,rects:i,middlewareData:r}=t,o=r.arrow?.centerOffset!==0,a=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[l,d]=Ut(n),u={start:"0%",center:"50%",end:"100%"}[d],h=(r.arrow?.x??0)+a/2,f=(r.arrow?.y??0)+c/2;let m="",w="";return l==="bottom"?(m=o?u:`${h}px`,w=`${-c}px`):l==="top"?(m=o?u:`${h}px`,w=`${i.floating.height+c}px`):l==="right"?(m=`${-c}px`,w=o?u:`${f}px`):l==="left"&&(m=`${i.floating.width+c}px`,w=o?u:`${f}px`),{data:{x:m,y:w}}}}}function Ut(e){const[t,n="center"]=e.split("-");return[t,n]}function Xn(e){return Ut(e)[0]}function Yn(e){return Ut(e)[1]}function ni(e,t){dt(t,!0);let n=O(t,"tooltip",3,!1);bt.create(n());var i=st(),r=et(i);mt(r,()=>t.children??ht),tt(e,i),gt()}function ii(e,t){dt(t,!0);let n=O(t,"tooltip",3,!1);At.create({id:R(()=>t.id),virtualEl:R(()=>t.virtualEl),ref:t.ref},n());var i=st(),r=et(i);mt(r,()=>t.children??ht),tt(e,i),gt()}function Un(e,t){dt(t,!0);let n=O(t,"side",3,"bottom"),i=O(t,"sideOffset",3,0),r=O(t,"align",3,"center"),s=O(t,"alignOffset",3,0),o=O(t,"arrowPadding",3,0),a=O(t,"avoidCollisions",3,!0),c=O(t,"collisionBoundary",19,()=>[]),l=O(t,"collisionPadding",3,0),d=O(t,"hideWhenDetached",3,!1),u=O(t,"onPlaced",3,()=>{}),h=O(t,"sticky",3,"partial"),f=O(t,"updatePositionStrategy",3,"optimized"),m=O(t,"strategy",3,"fixed"),w=O(t,"dir",3,"ltr"),y=O(t,"style",19,()=>({})),p=O(t,"wrapperId",19,ae),b=O(t,"customAnchor",3,null),x=O(t,"tooltip",3,!1);const v=Ot.create({side:R(()=>n()),sideOffset:R(()=>i()),align:R(()=>r()),alignOffset:R(()=>s()),id:R(()=>t.id),arrowPadding:R(()=>o()),avoidCollisions:R(()=>a()),collisionBoundary:R(()=>c()),collisionPadding:R(()=>l()),hideWhenDetached:R(()=>d()),onPlaced:R(()=>u()),sticky:R(()=>h()),updatePositionStrategy:R(()=>f()),strategy:R(()=>m()),dir:R(()=>w()),style:R(()=>y()),enabled:R(()=>t.enabled),wrapperId:R(()=>p()),customAnchor:R(()=>b())},x()),S=A(()=>ce(v.wrapperProps,{style:{pointerEvents:"auto"}}));var P=st(),F=et(P);mt(F,()=>t.content??ht,()=>({props:v.props,wrapperProps:g(S)})),tt(e,P),gt()}function jn(e,t){dt(t,!0),Se(()=>{t.onPlaced?.()});var n=st(),i=et(n);mt(i,()=>t.content??ht,()=>({props:{},wrapperProps:{}})),tt(e,n),gt()}function qn(e,t){let n=O(t,"isStatic",3,!1),i=St(t,["$$slots","$$events","$$legacy","content","isStatic","onPlaced"]);var r=st(),s=et(r);{var o=c=>{jn(c,{get content(){return t.content},get onPlaced(){return t.onPlaced}})},a=c=>{Un(c,kt({get content(){return t.content},get onPlaced(){return t.onPlaced}},()=>i))};Lt(s,c=>{n()?c(o):c(a,!1)})}tt(e,r)}var Zn=Ae("<!> <!>",1);function xe(e,t){dt(t,!0);let n=O(t,"interactOutsideBehavior",3,"close"),i=O(t,"trapFocus",3,!0),r=O(t,"isValidEvent",3,()=>!1),s=O(t,"customAnchor",3,null),o=O(t,"isStatic",3,!1),a=O(t,"tooltip",3,!1),c=O(t,"contentPointerEvents",3,"auto"),l=St(t,["$$slots","$$events","$$legacy","popper","onEscapeKeydown","escapeKeydownBehavior","preventOverflowTextSelection","id","onPointerDown","onPointerUp","side","sideOffset","align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","sticky","hideWhenDetached","updatePositionStrategy","strategy","dir","preventScroll","wrapperId","style","onPlaced","onInteractOutside","onCloseAutoFocus","onOpenAutoFocus","onFocusOutside","interactOutsideBehavior","loop","trapFocus","isValidEvent","customAnchor","isStatic","enabled","ref","tooltip","contentPointerEvents"]);qn(e,{get isStatic(){return o()},get id(){return t.id},get side(){return t.side},get sideOffset(){return t.sideOffset},get align(){return t.align},get alignOffset(){return t.alignOffset},get arrowPadding(){return t.arrowPadding},get avoidCollisions(){return t.avoidCollisions},get collisionBoundary(){return t.collisionBoundary},get collisionPadding(){return t.collisionPadding},get sticky(){return t.sticky},get hideWhenDetached(){return t.hideWhenDetached},get updatePositionStrategy(){return t.updatePositionStrategy},get strategy(){return t.strategy},get dir(){return t.dir},get wrapperId(){return t.wrapperId},get style(){return t.style},get onPlaced(){return t.onPlaced},get customAnchor(){return s()},get enabled(){return t.enabled},get tooltip(){return a()},content:(u,h)=>{let f=()=>h?.().props,m=()=>h?.().wrapperProps;var w=Zn(),y=et(w);{var p=v=>{qt(v,{get preventScroll(){return t.preventScroll}})},b=v=>{qt(v,{get preventScroll(){return t.preventScroll}})};Lt(y,v=>{t.forceMount&&t.enabled?v(p):t.forceMount||v(b,1)})}var x=Pe(y,2);Te(x,{get onOpenAutoFocus(){return t.onOpenAutoFocus},get onCloseAutoFocus(){return t.onCloseAutoFocus},get loop(){return t.loop},get enabled(){return t.enabled},get trapFocus(){return i()},get forceMount(){return t.forceMount},get ref(){return t.ref},focusScope:(S,P)=>{let F=()=>P?.().props;We(S,{get onEscapeKeydown(){return t.onEscapeKeydown},get escapeKeydownBehavior(){return t.escapeKeydownBehavior},get enabled(){return t.enabled},get ref(){return t.ref},children:(W,E)=>{Me(W,{get id(){return t.id},get onInteractOutside(){return t.onInteractOutside},get onFocusOutside(){return t.onFocusOutside},get interactOutsideBehavior(){return n()},get isValidEvent(){return r()},get enabled(){return t.enabled},get ref(){return t.ref},children:(_,T)=>{let K=()=>T?.().props;Le(_,{get id(){return t.id},get preventOverflowTextSelection(){return t.preventOverflowTextSelection},get onPointerDown(){return t.onPointerDown},get onPointerUp(){return t.onPointerUp},get enabled(){return t.enabled},get ref(){return t.ref},children:(B,J)=>{var H=st(),M=et(H);{let L=A(()=>({props:ce(l,f(),K(),F(),{style:{pointerEvents:c()}}),wrapperProps:m()}));mt(M,()=>t.popper??ht,()=>g(L))}tt(B,H)},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{focusScope:!0}}),tt(u,w)},$$slots:{content:!0}}),gt()}function ri(e,t){let n=O(t,"interactOutsideBehavior",3,"close"),i=O(t,"trapFocus",3,!0),r=O(t,"isValidEvent",3,()=>!1),s=O(t,"customAnchor",3,null),o=O(t,"isStatic",3,!1),a=St(t,["$$slots","$$events","$$legacy","popper","open","onEscapeKeydown","escapeKeydownBehavior","preventOverflowTextSelection","id","onPointerDown","onPointerUp","side","sideOffset","align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","sticky","hideWhenDetached","updatePositionStrategy","strategy","dir","preventScroll","wrapperId","style","onPlaced","onInteractOutside","onCloseAutoFocus","onOpenAutoFocus","onFocusOutside","interactOutsideBehavior","loop","trapFocus","isValidEvent","customAnchor","isStatic","ref","shouldRender"]);var c=st(),l=et(c);{var d=u=>{xe(u,kt({get popper(){return t.popper},get onEscapeKeydown(){return t.onEscapeKeydown},get escapeKeydownBehavior(){return t.escapeKeydownBehavior},get preventOverflowTextSelection(){return t.preventOverflowTextSelection},get id(){return t.id},get onPointerDown(){return t.onPointerDown},get onPointerUp(){return t.onPointerUp},get side(){return t.side},get sideOffset(){return t.sideOffset},get align(){return t.align},get alignOffset(){return t.alignOffset},get arrowPadding(){return t.arrowPadding},get avoidCollisions(){return t.avoidCollisions},get collisionBoundary(){return t.collisionBoundary},get collisionPadding(){return t.collisionPadding},get sticky(){return t.sticky},get hideWhenDetached(){return t.hideWhenDetached},get updatePositionStrategy(){return t.updatePositionStrategy},get strategy(){return t.strategy},get dir(){return t.dir},get preventScroll(){return t.preventScroll},get wrapperId(){return t.wrapperId},get style(){return t.style},get onPlaced(){return t.onPlaced},get customAnchor(){return s()},get isStatic(){return o()},get enabled(){return t.open},get onInteractOutside(){return t.onInteractOutside},get onCloseAutoFocus(){return t.onCloseAutoFocus},get onOpenAutoFocus(){return t.onOpenAutoFocus},get interactOutsideBehavior(){return n()},get loop(){return t.loop},get trapFocus(){return i()},get isValidEvent(){return r()},get onFocusOutside(){return t.onFocusOutside},forceMount:!1,get ref(){return t.ref}},()=>a))};Lt(l,u=>{t.shouldRender&&u(d)})}tt(e,c)}function oi(e,t){let n=O(t,"interactOutsideBehavior",3,"close"),i=O(t,"trapFocus",3,!0),r=O(t,"isValidEvent",3,()=>!1),s=O(t,"customAnchor",3,null),o=O(t,"isStatic",3,!1),a=St(t,["$$slots","$$events","$$legacy","popper","onEscapeKeydown","escapeKeydownBehavior","preventOverflowTextSelection","id","onPointerDown","onPointerUp","side","sideOffset","align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","sticky","hideWhenDetached","updatePositionStrategy","strategy","dir","preventScroll","wrapperId","style","onPlaced","onInteractOutside","onCloseAutoFocus","onOpenAutoFocus","onFocusOutside","interactOutsideBehavior","loop","trapFocus","isValidEvent","customAnchor","isStatic","enabled"]);xe(e,kt({get popper(){return t.popper},get onEscapeKeydown(){return t.onEscapeKeydown},get escapeKeydownBehavior(){return t.escapeKeydownBehavior},get preventOverflowTextSelection(){return t.preventOverflowTextSelection},get id(){return t.id},get onPointerDown(){return t.onPointerDown},get onPointerUp(){return t.onPointerUp},get side(){return t.side},get sideOffset(){return t.sideOffset},get align(){return t.align},get alignOffset(){return t.alignOffset},get arrowPadding(){return t.arrowPadding},get avoidCollisions(){return t.avoidCollisions},get collisionBoundary(){return t.collisionBoundary},get collisionPadding(){return t.collisionPadding},get sticky(){return t.sticky},get hideWhenDetached(){return t.hideWhenDetached},get updatePositionStrategy(){return t.updatePositionStrategy},get strategy(){return t.strategy},get dir(){return t.dir},get preventScroll(){return t.preventScroll},get wrapperId(){return t.wrapperId},get style(){return t.style},get onPlaced(){return t.onPlaced},get customAnchor(){return s()},get isStatic(){return o()},get enabled(){return t.enabled},get onInteractOutside(){return t.onInteractOutside},get onCloseAutoFocus(){return t.onCloseAutoFocus},get onOpenAutoFocus(){return t.onOpenAutoFocus},get interactOutsideBehavior(){return n()},get loop(){return t.loop},get trapFocus(){return i()},get isValidEvent(){return r()},get onFocusOutside(){return t.onFocusOutside}},()=>a,{forceMount:!0}))}export{ni as F,oi as P,ri as a,ii as b,ei as g};
@@ -1 +1 @@
1
- import{A as d,B as g,D as c,F as m,G as i,I as b,y as p,J as v,K as y,L as h}from"./GRkK54yd.js";function x(n=!1){const s=d,e=s.l.u;if(!e)return;let f=()=>v(s.s);if(n){let a=0,t={};const _=y(()=>{let l=!1;const r=s.s;for(const o in r)r[o]!==t[o]&&(t[o]=r[o],l=!0);return l&&a++,a});f=()=>p(_)}e.b.length&&g(()=>{u(s,f),i(e.b)}),c(()=>{const a=m(()=>e.m.map(b));return()=>{for(const t of a)typeof t=="function"&&t()}}),e.a.length&&c(()=>{u(s,f),i(e.a)})}function u(n,s){if(n.l.s)for(const e of n.l.s)p(e);s()}h();export{x as i};
1
+ import{A as d,B as g,D as c,F as m,G as i,I as b,y as p,J as v,K as y,L as h}from"./D-tW7Byc.js";function x(n=!1){const s=d,e=s.l.u;if(!e)return;let f=()=>v(s.s);if(n){let a=0,t={};const _=y(()=>{let l=!1;const r=s.s;for(const o in r)r[o]!==t[o]&&(t[o]=r[o],l=!0);return l&&a++,a});f=()=>p(_)}e.b.length&&g(()=>{u(s,f),i(e.b)}),c(()=>{const a=m(()=>e.m.map(b));return()=>{for(const t of a)typeof t=="function"&&t()}}),e.a.length&&c(()=>{u(s,f),i(e.a)})}function u(n,s){if(n.l.s)for(const e of n.l.s)p(e);s()}h();export{x as i};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BVBRzmeQ.js","./Cs5oz2oJ.js","./B1y7Wy5O.js","./D2aTbzFm.js","./BXuvR8Ks.js","./0oxpWEgM.js","./BPUy9_sS.js","./DWSjaG46.js","./D-tW7Byc.js","./Bk7i2AGK.js","./ByFfmBEu.js","./CjKjQEMp.js","./EhE2EcYu.js","./CaITTL5o.js"])))=>i.map(i=>d[i]);
2
+ import{q as nt,c as H,a as s,f as E,d as Dt,b as Ce,e as Xe,t as yt,s as G}from"./CjKjQEMp.js";import{M as Xt,F as Zt,p as Ae,f as C,n as ze,y as e,o as f,bd as He,u as o,V as Q,z as Me,S as ht,D as wt,P as $t,q as U,x as P,t as Re,v as ae,U as ea,T as at,m as ta,_ as aa,ap as na}from"./D-tW7Byc.js";import{p as I,i as ne,r as st,s as Te,b as xt,l as Ue}from"./EhE2EcYu.js";import{a as Ee,i as De,I as We,s as Be,T as sa,P as St}from"./pwrC_shA.js";import{c as Fe}from"./Dpn7ZAUg.js";import{e as we,b as Ve,r as kt,B as Le,s as Tt,w as At,i as ra,l as ft,g as oa}from"./ByFfmBEu.js";import{b as zt}from"./BV_9Nfp2.js";import{g as ia}from"./C5cMwwSn.js";import{k as rt,n as Ke,M as la,j as X,m as qe,l as ca,o as da,q as ua,t as va,v as fa,P as pa,x as _a}from"./CICthOLY.js";import{F as ma,P as ga,a as ya,g as Ct,b as ha}from"./dCvzTHAY.js";import"./eEhMI0BQ.js";import{C as wa}from"./1XQG_7uE.js";import{_ as Se}from"./PPVm8Dsz.js";function ka(l,t,r){Xt(()=>{var c=Zt(()=>t(l,r?.())||{});if(c?.destroy)return()=>c.destroy()})}var xa=E("<div><!></div>");function Pa(l,t){const r=nt();Ae(t,!0);let c=I(t,"ref",15,null),d=I(t,"id",19,()=>rt(r)),v=I(t,"disabled",3,!1),i=I(t,"onSelect",3,Ke),u=I(t,"closeOnSelect",3,!0),M=st(t,["$$slots","$$events","$$legacy","child","children","ref","id","disabled","onSelect","closeOnSelect"]);const h=la.create({id:X(()=>d()),disabled:X(()=>v()),onSelect:X(()=>i()),ref:X(()=>c(),g=>c(g)),closeOnSelect:X(()=>u())}),B=Q(()=>qe(M,h.props));var x=H(),_=C(x);{var Y=g=>{var T=H(),J=C(T);we(J,()=>t.child,()=>({props:e(B)})),s(g,T)},m=g=>{var T=xa();Ve(T,()=>({...e(B)}));var J=f(T);we(J,()=>t.children??He),o(T),s(g,T)};ne(_,g=>{t.child?g(Y):g(m,!1)})}s(l,x),ze()}var ba=E("<div><!></div>");function Sa(l,t){const r=nt();Ae(t,!0);let c=I(t,"ref",15,null),d=I(t,"id",19,()=>rt(r)),v=st(t,["$$slots","$$events","$$legacy","ref","id","child","children"]);const i=ca.create({id:X(()=>d()),ref:X(()=>c(),_=>c(_))}),u=Q(()=>qe(v,i.props));var M=H(),h=C(M);{var B=_=>{var Y=H(),m=C(Y);we(m,()=>t.child,()=>({props:e(u)})),s(_,Y)},x=_=>{var Y=ba();Ve(Y,()=>({...e(u)}));var m=f(Y);we(m,()=>t.children??He),o(Y),s(_,Y)};ne(h,_=>{t.child?_(B):_(x,!1)})}s(l,M),ze()}function Ca(l,t){Ae(t,!0);let r=I(t,"open",15,!1),c=I(t,"dir",3,"ltr"),d=I(t,"onOpenChange",3,Ke),v=I(t,"onOpenChangeComplete",3,Ke),i=I(t,"_internal_variant",3,"dropdown-menu");const u=da.create({variant:X(()=>i()),dir:X(()=>c()),onClose:()=>{r(!1),d()(!1)}});ua.create({open:X(()=>r(),M=>{r(M),d()(M)}),onOpenChangeComplete:X(()=>v())},u),ma(l,{children:(M,h)=>{var B=H(),x=C(B);we(x,()=>t.children??He),s(M,B)},$$slots:{default:!0}}),ze()}var Ea=E("<div><div><!></div></div>"),Ma=E("<div><div><!></div></div>");function Da(l,t){const r=nt();Ae(t,!0);let c=I(t,"id",19,()=>rt(r)),d=I(t,"ref",15,null),v=I(t,"loop",3,!0),i=I(t,"onInteractOutside",3,Ke),u=I(t,"onEscapeKeydown",3,Ke),M=I(t,"onCloseAutoFocus",3,Ke),h=I(t,"forceMount",3,!1),B=I(t,"trapFocus",3,!1),x=st(t,["$$slots","$$events","$$legacy","id","child","children","ref","loop","onInteractOutside","onEscapeKeydown","onCloseAutoFocus","forceMount","trapFocus","style"]);const _=va.create({id:X(()=>c()),loop:X(()=>v()),ref:X(()=>d(),R=>d(R)),onCloseAutoFocus:X(()=>M())}),Y=Q(()=>qe(x,_.props));function m(R){if(_.handleInteractOutside(R),!R.defaultPrevented&&(i()(R),!R.defaultPrevented)){if(R.target&&R.target instanceof Element){const ke=`[${_.parentMenu.root.getBitsAttr("sub-content")}]`;if(R.target.closest(ke))return}_.parentMenu.onClose()}}function g(R){u()(R),!R.defaultPrevented&&_.parentMenu.onClose()}var T=H(),J=C(T);{var se=R=>{ga(R,Te(()=>e(Y),()=>_.popperProps,{get ref(){return _.opts.ref},get enabled(){return _.parentMenu.opts.open.current},onInteractOutside:m,onEscapeKeydown:g,get trapFocus(){return B()},get loop(){return v()},forceMount:!0,get id(){return c()},get shouldRender(){return _.shouldRender},popper:(p,b)=>{let ce=()=>b?.().props,$=()=>b?.().wrapperProps;const re=Q(()=>qe(ce(),{style:Ct("dropdown-menu")},{style:t.style}));var K=H(),ie=C(K);{var de=y=>{var w=H(),O=C(w);{let j=Q(()=>({props:e(re),wrapperProps:$(),..._.snippetProps}));we(O,()=>t.child,()=>e(j))}s(y,w)},S=y=>{var w=Ea();Ve(w,()=>({...$()}));var O=f(w);Ve(O,()=>({...e(re)}));var j=f(O);we(j,()=>t.children??He),o(O),o(w),s(y,w)};ne(ie,y=>{t.child?y(de):y(S,!1)})}s(p,K)},$$slots:{popper:!0}}))},Ie=R=>{ya(R,Te(()=>e(Y),()=>_.popperProps,{get ref(){return _.opts.ref},get open(){return _.parentMenu.opts.open.current},onInteractOutside:m,onEscapeKeydown:g,get trapFocus(){return B()},get loop(){return v()},forceMount:!1,get id(){return c()},get shouldRender(){return _.shouldRender},popper:(p,b)=>{let ce=()=>b?.().props,$=()=>b?.().wrapperProps;const re=Q(()=>qe(ce(),{style:Ct("dropdown-menu")},{style:t.style}));var K=H(),ie=C(K);{var de=y=>{var w=H(),O=C(w);{let j=Q(()=>({props:e(re),wrapperProps:$(),..._.snippetProps}));we(O,()=>t.child,()=>e(j))}s(y,w)},S=y=>{var w=Ma();Ve(w,()=>({...$()}));var O=f(w);Ve(O,()=>({...e(re)}));var j=f(O);we(j,()=>t.children??He),o(O),o(w),s(y,w)};ne(ie,y=>{t.child?y(de):y(S,!1)})}s(p,K)},$$slots:{popper:!0}}))};ne(J,R=>{h()?R(se):h()||R(Ie,1)})}s(l,T),ze()}var Ta=E("<button><!></button>");function Aa(l,t){const r=nt();Ae(t,!0);let c=I(t,"id",19,()=>rt(r)),d=I(t,"ref",15,null),v=I(t,"disabled",3,!1),i=I(t,"type",3,"button"),u=st(t,["$$slots","$$events","$$legacy","id","ref","child","children","disabled","type"]);const M=fa.create({id:X(()=>c()),disabled:X(()=>v()??!1),ref:X(()=>d(),B=>d(B))}),h=Q(()=>qe(u,M.props,{type:i()}));ha(l,{get id(){return c()},get ref(){return M.opts.ref},children:(B,x)=>{var _=H(),Y=C(_);{var m=T=>{var J=H(),se=C(J);we(se,()=>t.child,()=>({props:e(h)})),s(T,J)},g=T=>{var J=Ta();Ve(J,()=>({...e(h)}));var se=f(J);we(se,()=>t.children??He),o(J),s(T,J)};ne(Y,T=>{t.child?T(m):T(g,!1)})}s(B,_)},$$slots:{default:!0}}),ze()}var za=E('<span class="chip svelte-84vb17"> <!></span>'),Ia=E('<div><span class="entity-title svelte-84vb17"> </span> <span class="entity-meta svelte-84vb17"><span class="entity-type-badge svelte-84vb17"> </span> <span class="entity-repo svelte-84vb17"> </span></span></div>'),Oa=E('<div class="dropdown svelte-84vb17"></div>'),Fa=E('<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 La(l,t){Ae(t,!0);let r=I(t,"multi",3,!1),c=Me(""),d=Me(0),v;const i=Q(()=>At.repos.flatMap(p=>p.entities.map(b=>({id:b.id,title:b.title,entityType:b.entityType,repo:p.name})))),u=Q(()=>()=>{const p=e(c).toLowerCase().trim();return p?e(i).filter(b=>b.title.toLowerCase().includes(p)||b.id.toLowerCase().includes(p)).slice(0,20):e(i).slice(0,20)}),M=Array.isArray(t.value)?[...t.value]:t.value?[t.value]:[];let h=Me(ht(M));wt(()=>{$t().then(()=>v?.focus())});function B(p){r()?(e(h).includes(p)||P(h,[...e(h),p],!0),P(c,""),P(d,0),v?.focus()):t.onselect(p)}function x(p){P(h,e(h).filter(b=>b!==p),!0)}function _(){e(h).length===M.length&&e(h).every((b,ce)=>b===M[ce])?t.oncancel():t.onselect(e(h))}function Y(p){const b=e(u)();p.key==="ArrowDown"?(p.preventDefault(),P(d,Math.min(e(d)+1,b.length-1),!0)):p.key==="ArrowUp"?(p.preventDefault(),P(d,Math.max(e(d)-1,0),!0)):p.key==="Enter"?(p.preventDefault(),b.length>0?B(b[e(d)].id):r()&&_()):p.key==="Escape"?r()&&e(h).length>0?_():t.oncancel():p.key==="Backspace"&&!e(c)&&r()&&e(h).length>0&&P(h,e(h).slice(0,-1),!0)}var m=Fa(),g=f(m),T=f(g);{var J=p=>{var b=H(),ce=C(b);Ee(ce,17,()=>e(h),De,($,re)=>{var K=za(),ie=f(K),de=U(ie);Le(de,{variant:"ghost",size:"icon",class:"chip-remove",onclick:()=>x(e(re)),children:(S,y)=>{Re();var w=yt("×");s(S,w)},$$slots:{default:!0}}),o(K),ae(()=>G(ie,`${e(re)??""} `)),s($,K)}),s(p,b)};ne(T,p=>{r()&&p(J)})}var se=U(T,2);kt(se),xt(se,p=>v=p,()=>v),o(g);var Ie=U(g,2);{var R=p=>{var b=Oa();Ee(b,21,()=>e(u)(),De,(ce,$,re)=>{var K=Ia();let ie;var de=f(K),S=f(de,!0);o(de);var y=U(de,2),w=f(y),O=f(w,!0);o(w);var j=U(w,2),Ne=f(j,!0);o(j),o(y),o(K),ae(()=>{ie=Tt(K,1,"dropdown-item svelte-84vb17",null,ie,{highlighted:re===e(d)}),G(S,e($).title),G(O,e($).entityType),G(Ne,e($).repo)}),Ce("mousedown",K,Ye=>{Ye.preventDefault(),B(e($).id)}),Xe("mouseenter",K,()=>P(d,re,!0)),s(ce,K)}),o(b),s(p,b)},ke=Q(()=>e(u)().length>0);ne(Ie,p=>{e(ke)&&p(R)})}o(m),Ce("keydown",se,Y),Xe("blur",se,()=>{setTimeout(()=>{r()&&e(h).length>0?_():r()||t.oncancel()},150)}),zt(se,()=>e(c),p=>P(c,p)),s(l,m),ze()}Dt(["keydown","mousedown"]);const Va=Ca,Na=Aa,Ra=pa,Ka=Da,Et=Pa,qa=Sa;function pt(l,t){const r=Ue(t,["children","$$slots","$$events","$$legacy"]);const c=[["path",{d:"M12 4v16"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}],["path",{d:"M9 20h6"}]];We(l,Te({name:"type"},()=>r,{get iconNode(){return c},children:(d,v)=>{var i=H(),u=C(i);Be(u,t,"default",{}),s(d,i)},$$slots:{default:!0}}))}function _t(l,t){const r=Ue(t,["children","$$slots","$$events","$$legacy"]);const c=[["path",{d:"M8 2v4"}],["path",{d:"M16 2v4"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}],["path",{d:"M3 10h18"}]];We(l,Te({name:"calendar"},()=>r,{get iconNode(){return c},children:(d,v)=>{var i=H(),u=C(i);Be(u,t,"default",{}),s(d,i)},$$slots:{default:!0}}))}function mt(l,t){const r=Ue(t,["children","$$slots","$$events","$$legacy"]);const c=[["circle",{cx:"12",cy:"12",r:"10"}],["circle",{cx:"12",cy:"12",r:"1"}]];We(l,Te({name:"circle-dot"},()=>r,{get iconNode(){return c},children:(d,v)=>{var i=H(),u=C(i);Be(u,t,"default",{}),s(d,i)},$$slots:{default:!0}}))}function gt(l,t){const r=Ue(t,["children","$$slots","$$events","$$legacy"]);const c=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"}]];We(l,Te({name:"link"},()=>r,{get iconNode(){return c},children:(d,v)=>{var i=H(),u=C(i);Be(u,t,"default",{}),s(d,i)},$$slots:{default:!0}}))}function Ha(l,t){const r=Ue(t,["children","$$slots","$$events","$$legacy"]);const c=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"}]];We(l,Te({name:"tag"},()=>r,{get iconNode(){return c},children:(d,v)=>{var i=H(),u=C(i);Be(u,t,"default",{}),s(d,i)},$$slots:{default:!0}}))}function Ua(l,t){const r=Ue(t,["children","$$slots","$$events","$$legacy"]);const c=[["path",{d:"m15 18-6-6 6-6"}]];We(l,Te({name:"chevron-left"},()=>r,{get iconNode(){return c},children:(d,v)=>{var i=H(),u=C(i);Be(u,t,"default",{}),s(d,i)},$$slots:{default:!0}}))}var Wa=E('<span class="ip-menu-check svelte-x7sio8"><!></span>'),Ba=E('<span class="ip-menu-item-icon svelte-x7sio8"><!></span> <span> </span> <!>',1),Ya=E('<span class="ip-menu-item-icon svelte-x7sio8"><!></span> <span>Remove</span>',1),ja=E("<!> <!> <!>",1),Ja=E("<!> <!>",1),Ga=E('<input class="ip-edit-input svelte-x7sio8" type="text"/>'),Qa=E('<span class="ip-status-dot svelte-x7sio8"></span> ',1),Xa=E('<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>'),Za=E('<span class="ip-cal-wd svelte-x7sio8"> </span>'),$a=E('<div class="ip-cal-week svelte-x7sio8"></div>'),en=E('<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>'),tn=E('<span class="ip-badge svelte-x7sio8"> </span>'),an=E('<div class="ip-wikilink-group svelte-x7sio8"></div>'),nn=E('<div class="ip-status-value svelte-x7sio8"><span class="ip-status-dot svelte-x7sio8"></span> <span class="ip-status-text svelte-x7sio8"> </span></div>'),sn=E('<span class="ip-date-text svelte-x7sio8"> </span>'),rn=E('<a class="ip-url-link svelte-x7sio8" target="_blank" rel="noopener noreferrer"> </a>'),on=E('<span class="ip-text-value svelte-x7sio8"> </span>'),ln=E('<div><div class="ip-icon svelte-x7sio8"><!></div> <div class="ip-key svelte-x7sio8"> </div> <div class="ip-value svelte-x7sio8"><!></div></div>'),cn=E('<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="Property name"/></div> <div class="ip-value svelte-x7sio8"></div></div>'),dn=E("<!> <span>Add property</span>",1),un=E('<div class="inline-properties svelte-x7sio8"><!> <!></div>');function zn(l,t){Ae(t,!0);let r=I(t,"editable",3,!1);const c=[{type:"text",label:"Text"},{type:"date",label:"Date"},{type:"status",label:"Status"},{type:"wikilink",label:"Link"}],d=["active","inactive","in-progress","completed","draft","archived","current","former","won","lost","open","closed"];let v=Me(null),i=Me(!1),u=Me(""),M=Me(void 0);function h(n){switch(n.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 B(n){for(const a of At.repos){const W=a.entities.find(ue=>ue.id===n);if(W){ia(`/${a.name}/${W.entityType}/${W.id}`);return}}}function x(n){return typeof n.value=="string"?n.value:n.value[0]}function _(n){return/^https?:\/\//.test(n)}function Y(n){try{return new Date(n).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})}catch{return n}}let m=Me(ht(new Date().getFullYear())),g=Me(ht(new Date().getMonth()));const T=["Su","Mo","Tu","We","Th","Fr","Sa"],J=["January","February","March","April","May","June","July","August","September","October","November","December"];function se(n,a){const W=new Date(n,a,1).getDay(),ue=new Date(n,a+1,0).getDate(),xe=new Date(n,a,0).getDate(),le=[];let oe=[];for(let ge=W-1;ge>=0;ge--){const je=xe-ge,Oe=a===0?11:a-1,ot=a===0?n-1:n;oe.push({day:je,month:Oe,year:ot,outside:!0})}for(let ge=1;ge<=ue;ge++)oe.push({day:ge,month:a,year:n,outside:!1}),oe.length===7&&(le.push(oe),oe=[]);if(oe.length>0){const ge=a===11?0:a+1,je=a===11?n+1:n;let Oe=1;for(;oe.length<7;)oe.push({day:Oe++,month:ge,year:je,outside:!0});le.push(oe)}return le}function Ie(n){const a=new Date;return n.day===a.getDate()&&n.month===a.getMonth()&&n.year===a.getFullYear()}function R(n,a){const W=a.slice(0,10).split("-");return n.year===+W[0]&&n.month===+W[1]-1&&n.day===+W[2]}function ke(){e(g)===0?(P(g,11),at(m,-1)):at(g,-1)}function p(){e(g)===11?(P(g,0),at(m)):at(g)}function b(n){try{const a=n.slice(0,10).split("-");P(m,+a[0]),P(g,+a[1]-1)}catch{const a=new Date;P(m,a.getFullYear(),!0),P(g,a.getMonth(),!0)}}function ce(n){requestAnimationFrame(()=>{n.focus(),n.select()})}function $(n){!r()||n.type==="badge"||(n.type==="date"&&b(x(n)),P(v,n.key,!0))}function re(n,a){t.onedit&&t.onedit(n,a),P(v,null)}function K(n,a){const W=`${a.year}-${String(a.month+1).padStart(2,"0")}-${String(a.day).padStart(2,"0")}`;t.onedit&&t.onedit(n,W),P(v,null)}function ie(n,a){t.ontypechange&&t.ontypechange(n,a)}function de(n){P(v,null),t.onremove&&t.onremove(n)}function S(){P(i,!0),P(u,""),requestAnimationFrame(()=>e(M)?.focus())}function y(){const n=e(u).trim();n&&t.onadd&&t.onadd(n,""),P(i,!1),P(u,"")}function w(){P(i,!1),P(u,"")}function O(n){n.key==="Enter"?(n.preventDefault(),y()):n.key==="Escape"&&w()}var j=un();Xe("click",ea,()=>{P(v,null)});var Ne=f(j);Ee(Ne,17,()=>t.properties,n=>n.key,(n,a)=>{const W=Q(()=>e(v)===e(a).key);var ue=ln();let xe;var le=f(ue),oe=f(le);{var ge=L=>{var F=H(),V=C(F);Fe(V,()=>Va,(ve,ye)=>{ye(ve,{children:(_e,Pe)=>{var fe=Ja(),A=C(fe);Fe(A,()=>Na,(z,k)=>{k(z,{class:"ip-icon-trigger",children:(D,N)=>{var q=H(),pe=C(q);{var ee=Z=>{_t(Z,{size:14})},be=Z=>{mt(Z,{size:14})},Je=Z=>{gt(Z,{size:14})},Ze=Z=>{pt(Z,{size:14})};ne(pe,Z=>{e(a).type==="date"?Z(ee):e(a).type==="status"?Z(be,1):e(a).type==="wikilink"?Z(Je,2):Z(Ze,!1)})}s(D,q)},$$slots:{default:!0}})});var me=U(A,2);Fe(me,()=>Ra,(z,k)=>{k(z,{children:(D,N)=>{var q=H(),pe=C(q);Fe(pe,()=>Ka,(ee,be)=>{be(ee,{class:"ip-menu-content",sideOffset:4,align:"start",children:(Je,Ze)=>{var Z=ja(),lt=C(Z);Ee(lt,17,()=>c,De,(Qe,he)=>{var $e=H(),Pt=C($e);Fe(Pt,()=>Et,(et,tt)=>{tt(et,{class:"ip-menu-item",onSelect:()=>ie(e(a).key,e(he).type),children:(ct,yn)=>{var bt=Ba(),dt=C(bt),Ht=f(dt);{var Ut=te=>{pt(te,{size:13})},Wt=te=>{_t(te,{size:13})},Bt=te=>{mt(te,{size:13})},Yt=te=>{gt(te,{size:13})};ne(Ht,te=>{e(he).type==="text"?te(Ut):e(he).type==="date"?te(Wt,1):e(he).type==="status"?te(Bt,2):e(he).type==="wikilink"&&te(Yt,3)})}o(dt);var ut=U(dt,2),jt=f(ut,!0);o(ut);var Jt=U(ut,2);{var Gt=te=>{var vt=Wa(),Qt=f(vt);wa(Qt,{size:12}),o(vt),s(te,vt)};ne(Jt,te=>{e(a).type===e(he).type&&te(Gt)})}ae(()=>G(jt,e(he).label)),s(ct,bt)},$$slots:{default:!0}})}),s(Qe,$e)});var Ge=U(lt,2);Fe(Ge,()=>qa,(Qe,he)=>{he(Qe,{class:"ip-menu-sep"})});var qt=U(Ge,2);Fe(qt,()=>Et,(Qe,he)=>{he(Qe,{class:"ip-menu-item ip-menu-destructive",onSelect:()=>de(e(a).key),children:($e,Pt)=>{var et=Ya(),tt=C(et),ct=f(tt);sa(ct,{size:13}),o(tt),Re(2),s($e,et)},$$slots:{default:!0}})}),s(Je,Z)},$$slots:{default:!0}})}),s(D,q)},$$slots:{default:!0}})}),s(_e,fe)},$$slots:{default:!0}})}),s(L,F)},je=L=>{var F=H(),V=C(F);{var ve=A=>{_t(A,{size:14})},ye=A=>{mt(A,{size:14})},_e=A=>{gt(A,{size:14})},Pe=A=>{Ha(A,{size:14})},fe=A=>{pt(A,{size:14})};ne(V,A=>{e(a).type==="date"?A(ve):e(a).type==="status"?A(ye,1):e(a).type==="wikilink"?A(_e,2):e(a).type==="badge"?A(Pe,3):A(fe,!1)})}s(L,F)};ne(oe,L=>{r()&&e(a).type!=="badge"?L(ge):L(je,!1)})}o(le);var Oe=U(le,2),ot=f(Oe,!0);o(Oe);var it=U(Oe,2),Ft=f(it);{var Lt=L=>{var F=Ga();kt(F),ka(F,V=>ce?.(V)),ae(V=>ra(F,V),[()=>x(e(a))]),Xe("blur",F,V=>{const ve=V.currentTarget.value;ve!==x(e(a))&&t.onedit?.(e(a).key,ve),P(v,null)}),Ce("keydown",F,V=>{V.key==="Enter"?V.currentTarget.blur():V.key==="Escape"&&(V.currentTarget.value=x(e(a)),P(v,null))}),s(L,F)},Vt=L=>{var F=Xa(),V=f(F),ve=f(V);let ye;var _e=U(ve,2),Pe=f(_e,!0);o(_e),o(V);var fe=U(V,2);Ee(fe,21,()=>d,De,(A,me)=>{{let z=Q(()=>x(e(a))===e(me)?"selected":"");Le(A,{variant:"ghost",get class(){return`ip-status-option ${e(z)??""}`},onclick:()=>re(e(a).key,e(me)),children:(k,D)=>{var N=Qa(),q=C(N);let pe;var ee=U(q);ae(be=>{pe=ft(q,"",pe,be),G(ee,` ${e(me)??""}`)},[()=>({background:h(e(me))})]),s(k,N)},$$slots:{default:!0}})}}),o(fe),o(F),ae((A,me)=>{ye=ft(ve,"",ye,A),G(Pe,me)},[()=>({background:h(x(e(a)))}),()=>x(e(a))]),Ce("click",F,A=>A.stopPropagation()),s(L,F)},Nt=L=>{var F=en(),V=f(F),ve=f(V,!0);o(V);var ye=U(V,2),_e=f(ye),Pe=f(_e);Le(Pe,{variant:"ghost",size:"icon",class:"ip-cal-nav",onclick:ke,children:(D,N)=>{Ua(D,{size:14})},$$slots:{default:!0}});var fe=U(Pe,2),A=f(fe);o(fe);var me=U(fe,2);Le(me,{variant:"ghost",size:"icon",class:"ip-cal-nav",onclick:p,children:(D,N)=>{_a(D,{size:14})},$$slots:{default:!0}}),o(_e);var z=U(_e,2);Ee(z,21,()=>T,De,(D,N)=>{var q=Za(),pe=f(q,!0);o(q),ae(()=>G(pe,e(N))),s(D,q)}),o(z);var k=U(z,2);Ee(k,17,()=>se(e(m),e(g)),De,(D,N)=>{var q=$a();Ee(q,21,()=>e(N),De,(pe,ee)=>{{let be=Q(()=>e(ee).outside?"outside":""),Je=Q(()=>Ie(e(ee))?"today":""),Ze=Q(()=>R(e(ee),x(e(a)))?"selected":"");Le(pe,{variant:"ghost",get class(){return`ip-cal-day ${e(be)??""} ${e(Je)??""} ${e(Ze)??""}`},onclick:()=>K(e(a).key,e(ee)),children:(Z,lt)=>{Re();var Ge=yt();ae(()=>G(Ge,e(ee).day)),s(Z,Ge)},$$slots:{default:!0}})}}),o(q),s(D,q)}),o(ye),o(F),ae(D=>{G(ve,D),G(A,`${J[e(g)]??""} ${e(m)??""}`)},[()=>Y(x(e(a)))]),Ce("click",F,D=>D.stopPropagation()),s(L,F)},Rt=L=>{{let F=Q(()=>Array.isArray(e(a).value));La(L,{get value(){return e(a).value},get multi(){return e(F)},onselect:V=>{t.onedit?.(e(a).key,V),P(v,null)},oncancel:()=>{P(v,null)}})}},Kt=L=>{var F=H(),V=C(F);{var ve=z=>{var k=tn(),D=f(k,!0);o(k),ae(N=>G(D,N),[()=>x(e(a))]),s(z,k)},ye=z=>{var k=an();Ee(k,21,()=>Array.isArray(e(a).value)?e(a).value:[e(a).value],De,(D,N)=>{Le(D,{variant:"ghost",class:"ip-wikilink-chip",onclick:q=>{q.stopPropagation(),B(e(N))},children:(q,pe)=>{Re();var ee=yt();ae(()=>G(ee,e(N))),s(q,ee)},$$slots:{default:!0}})}),o(k),s(z,k)},_e=z=>{var k=nn(),D=f(k);let N;var q=U(D,2),pe=f(q,!0);o(q),o(k),ae((ee,be)=>{N=ft(D,"",N,ee),G(pe,be)},[()=>({background:h(x(e(a)))}),()=>x(e(a))]),s(z,k)},Pe=z=>{var k=sn(),D=f(k,!0);o(k),ae(N=>G(D,N),[()=>Y(x(e(a)))]),s(z,k)},fe=z=>{var k=rn(),D=f(k,!0);o(k),ae((N,q)=>{oa(k,"href",N),G(D,q)},[()=>x(e(a)),()=>x(e(a))]),Ce("click",k,N=>N.stopPropagation()),s(z,k)},A=Q(()=>_(x(e(a)))),me=z=>{var k=on(),D=f(k,!0);o(k),ae(N=>G(D,N),[()=>x(e(a))]),s(z,k)};ne(V,z=>{e(a).type==="badge"?z(ve):e(a).type==="wikilink"?z(ye,1):e(a).type==="status"?z(_e,2):e(a).type==="date"?z(Pe,3):e(A)?z(fe,4):z(me,!1)})}s(L,F)};ne(Ft,L=>{e(W)&&e(a).type==="text"?L(Lt):e(W)&&e(a).type==="status"?L(Vt,1):e(W)&&e(a).type==="date"?L(Nt,2):e(W)&&e(a).type==="wikilink"?L(Rt,3):L(Kt,!1)})}o(it),o(ue),ae(()=>{xe=Tt(ue,1,"ip-row svelte-x7sio8",null,xe,{"ip-focused":e(W)}),G(ot,e(a).key)}),Ce("click",le,L=>L.stopPropagation()),Ce("click",it,L=>{L.stopPropagation(),$(e(a))}),s(n,ue)});var Ye=U(Ne,2);{var It=n=>{var a=cn(),W=f(a),ue=f(W);St(ue,{size:14}),o(W);var xe=U(W,2),le=f(xe);kt(le),xt(le,oe=>P(M,oe),()=>e(M)),o(xe),Re(2),o(a),Ce("keydown",le,O),Xe("blur",le,w),zt(le,()=>e(u),oe=>P(u,oe)),s(n,a)},Ot=n=>{Le(n,{variant:"ghost",class:"ip-add-btn",onclick:a=>{a.stopPropagation(),S()},children:(a,W)=>{var ue=dn(),xe=C(ue);St(xe,{size:14}),Re(2),s(a,ue)},$$slots:{default:!0}})};ne(Ye,n=>{e(i)?n(It):r()&&n(Ot,1)})}o(j),s(l,j),ze()}Dt(["click","keydown"]);var vn=E('<div class="editor-wrap svelte-ok7wy5"><div class="cm-container svelte-ok7wy5"></div></div>');function In(l,t){Ae(t,!0);let r=I(t,"readonly",3,!0),c=I(t,"resetKey",3,0);const d=ta("theme");let v,i=null,u=t.content,M=!1,h=null;function B(m,g){return m.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:g?"rgba(110,110,232,0.2)":"rgba(110,110,232,0.15)"},"&.cm-focused .cm-selectionBackground":{backgroundColor:g?"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:g})}async function x(m){h=m??null,i&&(i.destroy(),i=null);const{EditorState:g}=await Se(async()=>{const{EditorState:S}=await import("./Cs5oz2oJ.js");return{EditorState:S}},[],import.meta.url),{EditorView:T,keymap:J}=await Se(async()=>{const{EditorView:S,keymap:y}=await import("./BVBRzmeQ.js").then(w=>w.i);return{EditorView:S,keymap:y}},__vite__mapDeps([0,1]),import.meta.url),{markdown:se}=await Se(async()=>{const{markdown:S}=await import("./B1y7Wy5O.js");return{markdown:S}},__vite__mapDeps([2,1,0,3,4,5]),import.meta.url),{syntaxHighlighting:Ie,HighlightStyle:R}=await Se(async()=>{const{syntaxHighlighting:S,HighlightStyle:y}=await import("./D2aTbzFm.js");return{syntaxHighlighting:S,HighlightStyle:y}},__vite__mapDeps([3,4,1,0]),import.meta.url),{tags:ke}=await Se(async()=>{const{tags:S}=await import("./BXuvR8Ks.js").then(y=>y.i);return{tags:S}},[],import.meta.url),{livePreviewPlugin:p,livePreviewTheme:b}=await Se(async()=>{const{livePreviewPlugin:S,livePreviewTheme:y}=await import("./BPUy9_sS.js");return{livePreviewPlugin:S,livePreviewTheme:y}},__vite__mapDeps([6,0,1,3,4]),import.meta.url),ce=d.current==="dark",$=B(T,ce),re=R.define([{tag:ke.processingInstruction,color:"var(--color-text-tertiary)",opacity:"0.7"}]),K=[se(),$,Ie(re),p,b,T.lineWrapping];r()&&K.push(g.readOnly.of(!0));let ie=!1;if(m)try{const{collab:S}=await Se(async()=>{const{collab:O}=await import("./DWSjaG46.js");return{collab:O}},__vite__mapDeps([7,8,9]),import.meta.url),{auth:y}=await Se(async()=>{const{auth:O}=await import("./ByFfmBEu.js").then(j=>j.C);return{auth:O}},__vite__mapDeps([10,8,11,12]),import.meta.url),w=S.connect(m);if(w&&S.status!=="unavailable"){const O=y.user?.displayName??"Anonymous",j=getComputedStyle(document.documentElement).getPropertyValue("--color-accent").trim()||"#4f8ef7";w.awareness.setLocalStateField("user",{name:O,color:j});const{yCollab:Ne}=await Se(async()=>{const{yCollab:Ye}=await import("./CaITTL5o.js");return{yCollab:Ye}},__vite__mapDeps([13,9,0,1]),import.meta.url);K.push(Ne(w.yText,w.awareness)),h=m,ie=!0}}catch{}t.onchange&&!ie&&K.push(T.updateListener.of(S=>{if(S.docChanged&&!M){const y=S.state.doc.toString();u=y,t.onchange(y)}})),K.push(T.domEventHandlers({click(S){const y=S.target;if(t.onwikilinkclick){const O=y.closest(".cm-live-wikilink");if(O){S.preventDefault();const j=O.textContent?.replace(/^\[{1,2}|\]{1,2}$/g,"").trim();return j&&t.onwikilinkclick(j),!0}}const w=y.closest(".cm-live-link");if(w){const O=w.getAttribute("data-href");if(O)return S.preventDefault(),window.open(O,"_blank","noopener,noreferrer"),!0}return!1}})),t.onsave&&K.push(J.of([{key:"Mod-s",run:()=>(t.onsave(),!0)}]));const de=g.create({doc:t.content,extensions:K});i=new T({state:de,parent:v}),u=t.content}aa(()=>{x(t.collabDocName)}),wt(()=>{const m=t.collabDocName;m!==h&&v&&x(m)}),wt(()=>{if(c(),i&&!h&&t.content!==u){u=t.content;const m=v.closest(".document-scroll"),g=m?.scrollTop??0;M=!0,i.dispatch({changes:{from:0,to:i.state.doc.length,insert:t.content}}),M=!1,m&&requestAnimationFrame(()=>{m.scrollTop=g})}}),na(()=>{i?.destroy()});var _=vn(),Y=f(_);xt(Y,m=>v=m,()=>v),o(_),s(l,_),ze()}const fn=/^\d{4}-\d{2}-\d{2}/,pn=new Set(["active","inactive","in-progress","completed","draft","archived","current","former","contractor","client","partner","won","lost","open","closed"]),_n=new Set(["entity_type","format"]),mn=new Set(["entity_id","created_at","updated_at","created_by","updated_by"]);function On(l,t){const r=[];for(const[c,d]of Object.entries(l)){if(mn.has(c)||d==null)continue;const v=gn(c,d);v&&r.push(v)}return r}function gn(l,t){if(_n.has(l))return{key:l,value:String(t).toUpperCase(),type:"badge"};if(l==="status")return{key:l,value:String(t),type:"status"};if(Array.isArray(t)){const d=t.map(String),v=d.some(u=>/^\[\[.+?\]\]$/.test(u)),i=d.map(u=>{const M=u.match(/^\[\[(.+?)\]\]$/);return M?M[1]:u});return v||i.every(u=>Mt(u))?{key:l,value:i,type:"wikilink"}:{key:l,value:d.join(", "),type:"text"}}const r=String(t),c=r.match(/^\[\[(.+?)\]\]$/);return c?{key:l,value:c[1],type:"wikilink"}:fn.test(r)?{key:l,value:r,type:"date"}:pn.has(r.toLowerCase())?{key:l,value:r,type:"status"}:Mt(r)&&!r.includes(" ")?{key:l,value:r,type:"wikilink"}:{key:l,value:r,type:"text"}}function Mt(l){return/^[a-z0-9][a-z0-9-]*[a-z0-9]$/.test(l)&&l.includes("-")}export{In as C,zn as I,On as t};
@@ -0,0 +1 @@
1
+ import{g as Z,b as ye,y as p,aE as ue,O as Ae,a3 as ie,b1 as Me,a5 as Oe,b2 as $e,aj as xe,b3 as Pe,al as ce,b4 as Re,b5 as De,Z as ze,h as S,c as B,l as Ee,a as Q,b6 as Fe,aW as oe,r as He,a6 as We,s as fe,d as q,e as R,C as Be,aX as Ve,b7 as I,a0 as we,a2 as be,b8 as re,a7 as Le,b9 as Ue,ba as Ge,aU as qe,a1 as Je,k as Xe,bb as Ye,E as Ke,aK as Ze,a_ as je,ad as Qe,aI as et,x as c,z as C,S as tt,p as nt,J as H,F as de,o as rt,f as J,q as at,u as it,n as st,V as ot,bc as lt}from"./D-tW7Byc.js";import{i as ut}from"./C5cMwwSn.js";import{j as pe,u as he,w as x,k as ct,a as ft,b as ge}from"./ByFfmBEu.js";import{g as dt,i as pt,c as X,a as V,j as ht}from"./CjKjQEMp.js";import{i as gt}from"./eEhMI0BQ.js";import{B as mt,l as L,p as W,s as te}from"./EhE2EcYu.js";function vt(e,t){return t}function _t(e,t,n){for(var r=[],u=t.length,l,i=t.length,f=0;f<u;f++){let E=t[f];be(E,()=>{if(l){if(l.pending.delete(E),l.done.add(E),l.pending.size===0){var g=e.outrogroups;se(oe(l.done)),g.delete(l),g.size===0&&(e.outrogroups=null)}}else i-=1},!1)}if(i===0){var d=r.length===0&&n!==null;if(d){var m=n,s=m.parentNode;qe(s),s.append(m),e.items.clear()}se(t,!d)}else l={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(l)}function se(e,t=!0){for(var n=0;n<e.length;n++)Je(e[n],t)}var me;function yt(e,t,n,r,u,l=null){var i=e,f=new Map,d=(t&$e)!==0;if(d){var m=e;i=S?B(Ee(m)):m.appendChild(Z())}S&&Q();var s=null,E=xe(()=>{var o=n();return Fe(o)?o:o==null?[]:oe(o)}),g,v=!0;function y(){a.fallback=s,$t(a,g,i,t,r),s!==null&&(g.length===0?(s.f&I)===0?we(s):(s.f^=I,G(s,null,i)):be(s,()=>{s=null}))}var h=ye(()=>{g=p(E);var o=g.length;let _=!1;if(S){var $=He(i)===We;$!==(o===0)&&(i=fe(),B(i),q(!1),_=!0)}for(var w=new Set,k=Ae,z=Oe(),N=0;N<o;N+=1){S&&R.nodeType===Be&&R.data===Ve&&(i=R,_=!0,q(!1));var O=g[N],F=r(O,N),b=v?null:f.get(F);b?(b.v&&ue(b.v,O),b.i&&ue(b.i,N),z&&k.unskip_effect(b.e)):(b=Et(f,v?i:me??=Z(),O,F,N,u,t,n),v||(b.e.f|=I),f.set(F,b)),w.add(F)}if(o===0&&l&&!s&&(v?s=ie(()=>l(i)):(s=ie(()=>l(me??=Z())),s.f|=I)),o>w.size&&Me(),S&&o>0&&B(fe()),!v)if(z){for(const[ke,Ie]of f)w.has(ke)||k.skip_effect(Ie.e);k.oncommit(y),k.ondiscard(()=>{})}else y();_&&q(!0),p(E)}),a={effect:h,items:f,outrogroups:null,fallback:s};v=!1,S&&(i=R)}function U(e){for(;e!==null&&(e.f&Ue)===0;)e=e.next;return e}function $t(e,t,n,r,u){var l=(r&Ge)!==0,i=t.length,f=e.items,d=U(e.effect.first),m,s=null,E,g=[],v=[],y,h,a,o;if(l)for(o=0;o<i;o+=1)y=t[o],h=u(y,o),a=f.get(h).e,(a.f&I)===0&&(a.nodes?.a?.measure(),(E??=new Set).add(a));for(o=0;o<i;o+=1){if(y=t[o],h=u(y,o),a=f.get(h).e,e.outrogroups!==null)for(const b of e.outrogroups)b.pending.delete(a),b.done.delete(a);if((a.f&I)!==0)if(a.f^=I,a===d)G(a,null,n);else{var _=s?s.next:d;a===e.effect.last&&(e.effect.last=a.prev),a.prev&&(a.prev.next=a.next),a.next&&(a.next.prev=a.prev),A(e,s,a),A(e,a,_),G(a,_,n),s=a,g=[],v=[],d=U(s.next);continue}if((a.f&re)!==0&&(we(a),l&&(a.nodes?.a?.unfix(),(E??=new Set).delete(a))),a!==d){if(m!==void 0&&m.has(a)){if(g.length<v.length){var $=v[0],w;s=$.prev;var k=g[0],z=g[g.length-1];for(w=0;w<g.length;w+=1)G(g[w],$,n);for(w=0;w<v.length;w+=1)m.delete(v[w]);A(e,k.prev,z.next),A(e,s,k),A(e,z,$),d=$,s=z,o-=1,g=[],v=[]}else m.delete(a),G(a,d,n),A(e,a.prev,a.next),A(e,a,s===null?e.effect.first:s.next),A(e,s,a),s=a;continue}for(g=[],v=[];d!==null&&d!==a;)(m??=new Set).add(d),v.push(d),d=U(d.next);if(d===null)continue}(a.f&I)===0&&g.push(a),s=a,d=U(a.next)}if(e.outrogroups!==null){for(const b of e.outrogroups)b.pending.size===0&&(se(oe(b.done)),e.outrogroups?.delete(b));e.outrogroups.size===0&&(e.outrogroups=null)}if(d!==null||m!==void 0){var N=[];if(m!==void 0)for(a of m)(a.f&re)===0&&N.push(a);for(;d!==null;)(d.f&re)===0&&d!==e.fallback&&N.push(d),d=U(d.next);var O=N.length;if(O>0){var F=(r&$e)!==0&&i===0?n:null;if(l){for(o=0;o<O;o+=1)N[o].nodes?.a?.measure();for(o=0;o<O;o+=1)N[o].nodes?.a?.fix()}_t(e,N,F)}}l&&Le(()=>{if(E!==void 0)for(a of E)a.nodes?.a?.apply()})}function Et(e,t,n,r,u,l,i,f){var d=(i&Re)!==0?(i&De)===0?ze(n,!1,!1):ce(n):null,m=(i&Pe)!==0?ce(u):null;return{v:d,i:m,e:ie(()=>(l(t,d??n,m??u,f),()=>{e.delete(r)}))}}function G(e,t,n){if(e.nodes)for(var r=e.nodes.start,u=e.nodes.end,l=t&&(t.f&I)===0?t.nodes.start:n;r!==null;){var i=Xe(r);if(l.before(r),r===u)return;r=i}}function A(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Y(e,t,n,r,u){S&&Q();var l=t.$$slots?.[n],i=!1;l===!0&&(l=t.children,i=!0),l===void 0||l(e,i?()=>r:r)}function wt(e,t,n,r,u,l){let i=S;S&&Q();var f=null;S&&R.nodeType===Ye&&(f=R,Q());var d=S?R:e,m=new mt(d,!1);ye(()=>{const s=t()||null;var E=n||s==="svg"?je:void 0;if(s===null){m.ensure(null,null);return}return m.ensure(s,g=>{if(s){if(f=S?f:Ze(s,E),dt(f,f),r){S&&pt(s)&&f.append(document.createComment(""));var v=S?Ee(f):f.appendChild(Z());S&&(v===null?q(!1):B(v)),r(f,v)}Qe.nodes.end=f,g.before(f)}S&&B(g)}),()=>{}},Ke),et(()=>{}),i&&(q(!0),B(d))}function bt(){let e=C(null),t=C(null),n=C(null),r=C(null),u=C("entity"),l=C(null),i=C("general");function f(y,h){p(e)&&(p(e)!==y||p(n)!==h)&&pe(p(e)).catch(()=>{})}function d(y,h,a,o){f(y,a),c(e,y,!0),c(t,h,!0),c(n,a,!0),c(r,o??null,!0)}function m(){c(u,"entity")}function s(){c(u,"graph")}function E(){c(u,"settings")}function g(y,h,a){p(n)===a&&p(e)===y?(c(e,null),c(t,null),c(n,null)):(c(e,y,!0),c(t,h,!0),c(n,a,!0)),c(r,null)}function v(){p(e)&&pe(p(e)).catch(()=>{}),c(e,null),c(t,null),c(n,null),c(r,null)}return{get selectedRepo(){return p(e)},get selectedType(){return p(t)},get selectedId(){return p(n)},get selectedSubPath(){return p(r)},get activeView(){return p(u)},get entityPath(){return p(e)&&p(t)&&p(n)?`/${p(e)}/${p(t)}/${p(n)}`:null},get hoveredEntityId(){return p(l)},set hoveredEntityId(y){c(l,y,!0)},get settingsTab(){return p(i)},set settingsTab(y){c(i,y,!0)},select:d,deselect:v,selectOnGraph:g,showEntity:m,showGraph:s,showSettings:E}}const ae=bt(),St=800;function Tt(){let e=C(!1),t=C(null),n=C(null),r=null,u=null,l=null,i=!1;function f(h,a,o,_){r&&r.repo===h&&r.type===a&&r.id===o?(_.data!==void 0&&(r.payload.data=_.data),_.content!==void 0&&(r.payload.content=_.content)):r={repo:h,type:a,id:o,payload:{..._}},u=null,m()}function d(h,a,o,_,$){u={repo:h,type:a,id:o,filePath:_,content:$},r=null,m()}function m(){l&&clearTimeout(l),l=setTimeout(s,St)}async function s(){if(l=null,!i){if(r){const{repo:h,type:a,id:o,payload:_}=r;r=null,i=!0,c(e,!0),c(n,null);try{if(await he(h,a,o,_),c(t,new Date,!0),_.data?.name){const w=x.repos.find(k=>k.name===h)?.entities.find(k=>k.id===o);w&&(w.title=_.data.name)}}catch($){c(n,$.message??"Save failed",!0),r={repo:h,type:a,id:o,payload:_}}finally{c(e,!1),i=!1,(r||u)&&s()}}else if(u){const{repo:h,type:a,id:o,filePath:_,content:$}=u;u=null,i=!0,c(e,!0),c(n,null);try{await ct(h,a,o,_,$),c(t,new Date,!0)}catch(w){c(n,w.message??"Save failed",!0),u={repo:h,type:a,id:o,filePath:_,content:$}}finally{c(e,!1),i=!1,(r||u)&&s()}}}}function E(){}function g(){l&&(clearTimeout(l),l=null),(r||u)&&s()}async function v(h,a,o,_){c(e,!0),c(n,null);try{const $=await he(h,a,o,_);return c(t,new Date,!0),$}catch($){return c(n,$.message??"Save failed",!0),null}finally{c(e,!1)}}function y(){c(n,null),c(t,null),r=null,u=null,l&&(clearTimeout(l),l=null)}return{get saving(){return p(e)},get lastSaved(){return p(t)},get error(){return p(n)},get hasPending(){return!!(r||u||i)},scheduleAutoSave:f,scheduleContentFileSave:d,flush:g,saveEntity:v,reset:y}}const Nt=Tt();let M=C(tt([])),T=null,Se=null,j=null,K=1e3,ee=C(!1),Te=C(null),Ne=null;const D=new Map;function P(e,t){const n=crypto.randomUUID();c(M,[...p(M),{id:n,message:e,event:t,dismissed:!1}].slice(-3),!0),setTimeout(()=>le(n),5e3)}function ve(e,t){D.delete(e);const n=t.entities.length,r=n===1?`${e} updated ${t.entities[0]}`:`${e} updated ${n} entities`;P(r,{type:"entity_change",action:"updated",repo:t.repo,entityType:"",entityId:t.entities[0],actor:e,source:"api",timestamp:new Date().toISOString()})}function Ct(e){for(const[t,n]of D)n.repo===e&&(clearTimeout(n.timer),D.delete(t))}function kt(e){const t=ft.user?.displayName;if(e.type==="entity_change"){if(t&&e.actor===t&&e.source==="api"){x.refreshEntities(e.repo);return}x.refreshEntities(e.repo),ae.selectedRepo===e.repo&&ae.selectedType===e.entityType&&ae.selectedId===e.entityId&&(Nt.hasPending?P(`${e.actor} also saved changes to this entity`,e):ut());const r=D.get(e.actor);if(r)clearTimeout(r.timer),r.entities.push(e.entityId),r.timer=setTimeout(()=>ve(e.actor,r),5e3);else{const u={entities:[e.entityId],repo:e.repo,timer:setTimeout(()=>ve(e.actor,u),5e3)};D.set(e.actor,u)}return}if(e.type==="session_commit"){if(t&&e.actor===t){c(Te,e.timestamp,!0);return}const n=e.entities.length,r=n===1?`${e.actor} saved changes to ${e.entities[0]}`:`${e.actor} saved ${n} changes in ${e.repo}`;P(r,e),x.refreshEntities(e.repo);return}if(e.type==="sync_complete"){Ct(e.repo);const n=e.created+e.updated+e.deleted,r=n===0?`Sync complete · no changes in ${e.repo}`:`Sync complete · ${n} ${n===1?"entity":"entities"} from ${e.source}`;P(r,e),x.refreshEntities(e.repo);return}if(e.type==="collection_created"){P(`${e.actor} created collection ${e.repo}`,e),x.refreshEntities(e.repo);return}if(e.type==="collection_deleted"){P(`${e.actor} deleted collection ${e.repo}`,e);return}if(e.type==="repo_sync"){P(`${e.actor} pushed to ${e.repo}`,e),x.refreshEntities(e.repo);return}if(e.type==="presence"){Se?.(e);return}}function le(e){c(M,p(M).filter(t=>t.id!==e),!0)}function Ce(){if(typeof window>"u"||T&&(T.readyState===WebSocket.OPEN||T.readyState===WebSocket.CONNECTING))return;const t=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`;T=new WebSocket(t),T.onopen=()=>{c(ee,!0),K=1e3,Ne?.()},T.onmessage=n=>{try{const r=JSON.parse(n.data);r.type&&r.type!=="toast"&&kt(r)}catch{}},T.onclose=()=>{c(ee,!1),T=null,j=setTimeout(()=>{K=Math.min(K*2,3e4),Ce()},K)},T.onerror=()=>{}}function It(){j&&(clearTimeout(j),j=null),T&&(T.close(),T=null),c(ee,!1),c(M,[],!0);for(const[,e]of D)clearTimeout(e.timer);D.clear()}function At(e,t=4e3){const n=`toast-${Date.now()}`;c(M,[...p(M),{id:n,message:e,event:{type:"toast"},dismissed:!1}].slice(-3),!0),setTimeout(()=>le(n),t)}function Mt(e){Se=e}function Ot(e){Ne=e}function xt(e){T?.readyState===WebSocket.OPEN&&T.send(JSON.stringify(e))}const Lt={get notifications(){return p(M)},get connected(){return p(ee)},get lastAutoSaved(){return p(Te)},connect:Ce,disconnect:It,dismiss:le,showToast:At,send:xt,setPresenceHandler:Mt,setOnConnectCallback:Ot};const Pt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const Rt=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const _e=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();var Dt=ht("<svg><!><!></svg>");function ne(e,t){const n=L(t,["children","$$slots","$$events","$$legacy"]),r=L(n,["name","color","size","strokeWidth","absoluteStrokeWidth","iconNode"]);nt(t,!1);let u=W(t,"name",8,void 0),l=W(t,"color",8,"currentColor"),i=W(t,"size",8,24),f=W(t,"strokeWidth",8,2),d=W(t,"absoluteStrokeWidth",8,!1),m=W(t,"iconNode",24,()=>[]);gt();var s=Dt();ge(s,(v,y,h)=>({...Pt,...v,...r,width:i(),height:i(),stroke:l(),"stroke-width":y,class:h}),[()=>Rt(r)?void 0:{"aria-hidden":"true"},()=>(H(d()),H(f()),H(i()),de(()=>d()?Number(f())*24/Number(i()):f())),()=>(H(_e),H(u()),H(n),de(()=>_e("lucide-icon","lucide",u()?`lucide-${u()}`:"",n.class)))]);var E=rt(s);yt(E,1,m,vt,(v,y)=>{var h=ot(()=>lt(p(y),2));let a=()=>p(h)[0],o=()=>p(h)[1];var _=X(),$=J(_);wt($,a,!0,(w,k)=>{ge(w,()=>({...o()}))}),V(v,_)});var g=at(E);Y(g,t,"default",{}),it(s),V(e,s),st()}function Ut(e,t){const n=L(t,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];ne(e,te({name:"x"},()=>n,{get iconNode(){return r},children:(u,l)=>{var i=X(),f=J(i);Y(f,t,"default",{}),V(u,i)},$$slots:{default:!0}}))}function Gt(e,t){const n=L(t,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M5 12h14"}],["path",{d:"M12 5v14"}]];ne(e,te({name:"plus"},()=>n,{get iconNode(){return r},children:(u,l)=>{var i=X(),f=J(i);Y(f,t,"default",{}),V(u,i)},$$slots:{default:!0}}))}function qt(e,t){const n=L(t,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M10 11v6"}],["path",{d:"M14 11v6"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}],["path",{d:"M3 6h18"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}]];ne(e,te({name:"trash-2"},()=>n,{get iconNode(){return r},children:(u,l)=>{var i=X(),f=J(i);Y(f,t,"default",{}),V(u,i)},$$slots:{default:!0}}))}function Jt(e,t){const n=L(t,["children","$$slots","$$events","$$legacy"]);const r=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}],["path",{d:"M21 3v5h-5"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}],["path",{d:"M8 16H3v5"}]];ne(e,te({name:"refresh-cw"},()=>n,{get iconNode(){return r},children:(u,l)=>{var i=X(),f=J(i);Y(f,t,"default",{}),V(u,i)},$$slots:{default:!0}}))}export{ne as I,Gt as P,Jt as R,qt as T,Ut as X,yt as a,wt as b,Nt as e,vt as i,ae as n,Lt as r,Y as s};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.B3dFDaCX.js","../chunks/PPVm8Dsz.js","../chunks/CjKjQEMp.js","../chunks/D-tW7Byc.js","../chunks/ByFfmBEu.js","../chunks/EhE2EcYu.js","../chunks/DCWeodCf.js","../chunks/C5cMwwSn.js","../chunks/pwrC_shA.js","../chunks/eEhMI0BQ.js","../chunks/1XQG_7uE.js","../chunks/DiXzlxx7.js","../assets/0.DuOWufPh.css","../nodes/1.B7XWRWiG.js","../nodes/2.BEOcFuIE.js","../chunks/CICthOLY.js","../chunks/Dpn7ZAUg.js","../chunks/BV_9Nfp2.js","../assets/AppShell.EyPUoNrB.css","../chunks/BIQoyk5V.js","../assets/ChatPanel.CP-_8txt.css","../assets/2.DRHi7ABa.css","../nodes/3.NxBZXoOo.js","../chunks/i6t46AUT.js","../chunks/dCvzTHAY.js","../assets/entity.Bjlko8oW.css","../assets/3.CdwKLnx7.css","../nodes/4.DyI15z1O.js","../chunks/CqkleIqs.js","../assets/4.DbhUbfxr.css","../nodes/5.CLl1ihqQ.js","../assets/5.BhKgiXd2.css","../nodes/6.DcamPcH8.js","../assets/6.CydFyZSu.css","../nodes/7.C8Ctaz0_.js","../assets/7.kqeOo0OW.css","../nodes/8.B5PKapjV.js","../assets/8.8BKiM7li.css","../nodes/9.CjhBf9vj.js","../assets/9.BYpFDZHK.css"])))=>i.map(i=>d[i]);
2
+ import{_ as c}from"../chunks/PPVm8Dsz.js";import{x as p,W as B,y as u,X as G,Y as W,Z as X,p as Z,B as F,D as H,_ as J,P as K,f as E,q as N,n as Q,z as y,o as U,u as $,V as P,v as tt}from"../chunks/D-tW7Byc.js";import{h as et,m as rt,u as st,a as h,c as b,f as I,t as at,s as ot}from"../chunks/CjKjQEMp.js";import{p as O,i as R,b as x}from"../chunks/EhE2EcYu.js";import{c as A}from"../chunks/Dpn7ZAUg.js";function nt(a){return class extends it{constructor(t){super({component:a,...t})}}}class it{#e;#t;constructor(t){var s=new Map,n=(e,r)=>{var m=X(r,!1,!1);return s.set(e,m),m};const i=new Proxy({...t.props||{},$$events:{}},{get(e,r){return u(s.get(r)??n(r,Reflect.get(e,r)))},has(e,r){return r===B?!0:(u(s.get(r)??n(r,Reflect.get(e,r))),Reflect.has(e,r))},set(e,r,m){return p(s.get(r)??n(r,m),m),Reflect.set(e,r,m)}});this.#t=(t.hydrate?et:rt)(t.component,{target:t.target,anchor:t.anchor,props:i,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError}),(!t?.props?.$$host||t.sync===!1)&&G(),this.#e=i.$$events;for(const e of Object.keys(this.#t))e==="$set"||e==="$destroy"||e==="$on"||W(this,e,{get(){return this.#t[e]},set(r){this.#t[e]=r},enumerable:!0});this.#t.$set=e=>{Object.assign(i,e)},this.#t.$destroy=()=>{st(this.#t)}}$set(t){this.#t.$set(t)}$on(t,s){this.#e[t]=this.#e[t]||[];const n=(...i)=>s.call(this,...i);return this.#e[t].push(n),()=>{this.#e[t]=this.#e[t].filter(i=>i!==n)}}$destroy(){this.#t.$destroy()}}const Et={};var ct=I('<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>'),mt=I("<!> <!>",1);function ut(a,t){Z(t,!0);let s=O(t,"components",23,()=>[]),n=O(t,"data_0",3,null),i=O(t,"data_1",3,null);F(()=>t.stores.page.set(t.page)),H(()=>{t.stores,t.page,t.constructors,s(),t.form,n(),i(),t.stores.page.notify()});let e=y(!1),r=y(!1),m=y(null);J(()=>{const o=t.stores.page.subscribe(()=>{u(e)&&(p(r,!0),K().then(()=>{p(m,document.title||"untitled page",!0)}))});return p(e,!0),o});const j=P(()=>t.constructors[1]);var D=mt(),L=E(D);{var w=o=>{const _=P(()=>t.constructors[0]);var d=b(),v=E(d);A(v,()=>u(_),(l,f)=>{x(f(l,{get data(){return n()},get form(){return t.form},get params(){return t.page.params},children:(g,dt)=>{var V=b(),M=E(V);A(M,()=>u(j),(Y,q)=>{x(q(Y,{get data(){return i()},get form(){return t.form},get params(){return t.page.params}}),z=>s()[1]=z,()=>s()?.[1])}),h(g,V)},$$slots:{default:!0}}),g=>s()[0]=g,()=>s()?.[0])}),h(o,d)},k=o=>{const _=P(()=>t.constructors[0]);var d=b(),v=E(d);A(v,()=>u(_),(l,f)=>{x(f(l,{get data(){return n()},get form(){return t.form},get params(){return t.page.params}}),g=>s()[0]=g,()=>s()?.[0])}),h(o,d)};R(L,o=>{t.constructors[1]?o(w):o(k,!1)})}var C=N(L,2);{var S=o=>{var _=ct(),d=U(_);{var v=l=>{var f=at();tt(()=>ot(f,u(m))),h(l,f)};R(d,l=>{u(r)&&l(v)})}$(_),h(o,_)};R(C,o=>{u(e)&&o(S)})}h(a,D),Q()}const pt=nt(ut),yt=[()=>c(()=>import("../nodes/0.B3dFDaCX.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]),import.meta.url),()=>c(()=>import("../nodes/1.B7XWRWiG.js"),__vite__mapDeps([13,2,3,9,7]),import.meta.url),()=>c(()=>import("../nodes/2.BEOcFuIE.js"),__vite__mapDeps([14,2,3,9,5,15,4,8,7,16,17,18,19,20,21]),import.meta.url),()=>c(()=>import("../nodes/3.NxBZXoOo.js"),__vite__mapDeps([22,4,3,2,5,8,7,9,15,16,17,18,19,20,23,24,10,1,25,26]),import.meta.url),()=>c(()=>import("../nodes/4.DyI15z1O.js"),__vite__mapDeps([27,4,3,2,5,8,7,9,15,16,17,18,19,20,23,24,10,1,25,28,29]),import.meta.url),()=>c(()=>import("../nodes/5.CLl1ihqQ.js"),__vite__mapDeps([30,4,3,2,5,15,8,7,9,16,17,18,31]),import.meta.url),()=>c(()=>import("../nodes/6.DcamPcH8.js"),__vite__mapDeps([32,2,3,5,15,4,8,7,9,16,17,18,19,20,1,33]),import.meta.url),()=>c(()=>import("../nodes/7.C8Ctaz0_.js"),__vite__mapDeps([34,2,3,5,6,7,4,17,35]),import.meta.url),()=>c(()=>import("../nodes/8.B5PKapjV.js"),__vite__mapDeps([36,2,3,9,15,5,4,8,7,16,17,18,24,10,1,11,37]),import.meta.url),()=>c(()=>import("../nodes/9.CjhBf9vj.js"),__vite__mapDeps([38,2,3,5,6,7,4,17,39]),import.meta.url)],Pt=[],bt={"/":[2],"/graph":[6],"/login":[7],"/settings":[8],"/setup":[9],"/[repo]/[type]/[id]":[3],"/[repo]/[type]/[id]/edit":[5],"/[repo]/[type]/[id]/[...path]":[4]},T={handleError:(({error:a})=>{console.error(a)}),reroute:(()=>{}),transport:{}},_t=Object.fromEntries(Object.entries(T.transport).map(([a,t])=>[a,t.decode])),Ot=Object.fromEntries(Object.entries(T.transport).map(([a,t])=>[a,t.encode])),Rt=!1,xt=(a,t)=>_t[a](t);export{xt as decode,_t as decoders,bt as dictionary,Ot as encoders,Rt as hash,T as hooks,Et as matchers,yt as nodes,pt as root,Pt as server_loads};
@@ -0,0 +1 @@
1
+ import{l as o,a as r}from"../chunks/C5cMwwSn.js";export{o as load_css,r as start};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/BB_5th5W.js","../chunks/PPVm8Dsz.js","../chunks/CqkleIqs.js","../chunks/BVBRzmeQ.js","../chunks/Cs5oz2oJ.js","../chunks/B1y7Wy5O.js","../chunks/D2aTbzFm.js","../chunks/BXuvR8Ks.js","../chunks/0oxpWEgM.js"])))=>i.map(i=>d[i]);
2
+ import{_ as g}from"../chunks/PPVm8Dsz.js";import{c as S,a as m,s as ae,f as w}from"../chunks/CjKjQEMp.js";import{f as A,p as Z,n as G,o as V,y as e,q as D,u as z,v as U,z as x,S as se,ao as q,D as B,x as y,_ as oe,w as re,$ as ne}from"../chunks/D-tW7Byc.js";import{B as le,a as L,w as H,e as ie,g as ce}from"../chunks/ByFfmBEu.js";import{h as de}from"../chunks/DCWeodCf.js";import{g as R}from"../chunks/C5cMwwSn.js";import{I as M,s as b,r as I,a as me,X as pe,R as ue,P as _e,T as ve,n as he}from"../chunks/pwrC_shA.js";import{i as fe}from"../chunks/eEhMI0BQ.js";import{l as N,s as C,i as O}from"../chunks/EhE2EcYu.js";import{C as ge}from"../chunks/1XQG_7uE.js";import{P as ye}from"../chunks/DiXzlxx7.js";function $e(c,r){const l=N(r,["children","$$slots","$$events","$$legacy"]);const o=[["circle",{cx:"18",cy:"18",r:"3"}],["circle",{cx:"6",cy:"6",r:"3"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9"}]];M(c,C({name:"git-merge"},()=>l,{get iconNode(){return o},children:(p,u)=>{var t=S(),i=A(t);b(i,r,"default",{}),m(p,t)},$$slots:{default:!0}}))}function Pe(c,r){const l=N(r,["children","$$slots","$$events","$$legacy"]);const o=[["path",{d:"M12 10v6"}],["path",{d:"M9 13h6"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}]];M(c,C({name:"folder-plus"},()=>l,{get iconNode(){return o},children:(p,u)=>{var t=S(),i=A(t);b(i,r,"default",{}),m(p,t)},$$slots:{default:!0}}))}function Ee(c,r){const l=N(r,["children","$$slots","$$events","$$legacy"]);const o=[["path",{d:"M9 13h6"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"}]];M(c,C({name:"folder-minus"},()=>l,{get iconNode(){return o},children:(p,u)=>{var t=S(),i=A(t);b(i,r,"default",{}),m(p,t)},$$slots:{default:!0}}))}var ze=w('<span class="toast-icon svelte-16oeye1"><!></span>'),Ie=w('<div class="toast svelte-16oeye1" role="status"><!> <span class="toast-message svelte-16oeye1"> </span> <!></div>'),Se=w('<div class="toast-container svelte-16oeye1"></div>');function Ae(c,r){Z(r,!1),fe();var l=S(),o=A(l);{var p=u=>{var t=Se();me(t,5,()=>I.notifications,i=>i.id,(i,s)=>{var _=Ie(),$=V(_);{var T=v=>{var f=ze(),k=V(f);{var h=a=>{ue(a,{size:14})},X=a=>{ge(a,{size:14})},j=a=>{Pe(a,{size:14})},J=a=>{Ee(a,{size:14})},K=a=>{$e(a,{size:14})},Q=a=>{var F=S(),W=A(F);{var Y=d=>{_e(d,{size:14})},ee=d=>{ve(d,{size:14})},te=d=>{ye(d,{size:14})};O(W,d=>{e(s).event.action==="created"?d(Y):e(s).event.action==="deleted"?d(ee,1):d(te,!1)})}m(a,F)};O(k,a=>{e(s).event.type==="sync_complete"?a(h):e(s).event.type==="session_commit"?a(X,1):e(s).event.type==="collection_created"?a(j,2):e(s).event.type==="collection_deleted"?a(J,3):e(s).event.type==="repo_sync"?a(K,4):e(s).event.type==="entity_change"&&a(Q,5)})}z(f),m(v,f)};O($,v=>{e(s).event.type!=="toast"&&v(T)})}var n=D($,2),P=V(n,!0);z(n);var E=D(n,2);le(E,{variant:"ghost",size:"icon",class:"toast-dismiss",onclick:()=>I.dismiss(e(s).id),children:(v,f)=>{pe(v,{size:12})},$$slots:{default:!0}}),z(_),U(()=>ae(P,e(s).message)),m(i,_)}),z(t),m(u,t)};O(o,u=>{I.notifications.length>0&&u(p)})}m(c,l),G()}var Le=w('<div style="display: contents;"><!> <!></div>');function Ce(c,r){Z(r,!0);const l=typeof localStorage<"u"?localStorage.getItem("theme"):null;let o=x(se(l==="light"?"light":"dark"));q("theme",{get current(){return e(o)},toggle(){y(o,e(o)==="dark"?"light":"dark",!0),localStorage.setItem("theme",e(o))}});const u=typeof localStorage<"u"?localStorage.getItem("chatOpen"):null;let t=x(u==="true");q("chat",{get open(){return e(t)},toggle(){y(t,!e(t)),localStorage.setItem("chatOpen",String(e(t)))},close(){y(t,!1),localStorage.setItem("chatOpen","false")}}),B(()=>{document.documentElement.setAttribute("data-theme",e(o))});let s=x(null);B(()=>{if(L.loading)return;const n=L.user?.email??(L.authEnabled?null:"__open__");n&&n!==e(s)&&(e(s)!==null&&he.deselect(),y(s,n,!0),H.load(),I.connect()),!n&&e(s)&&(y(s,null),I.disconnect())}),oe(async()=>{const n=window.location.pathname,P=n==="/login",E=n==="/setup",{authenticated:v,authEnabled:f,needsSetup:k}=await L.checkAuth();if(k&&!E){R("/setup");return}if(f&&!v&&!P){R("/login");return}if(v&&(P||E)){R("/");return}P||E||(g(()=>import("../chunks/BB_5th5W.js"),__vite__mapDeps([0,1,2]),import.meta.url).catch(()=>{}),Promise.all([g(()=>import("../chunks/Cs5oz2oJ.js"),[],import.meta.url),g(()=>import("../chunks/BVBRzmeQ.js").then(h=>h.i),__vite__mapDeps([3,4]),import.meta.url),g(()=>import("../chunks/B1y7Wy5O.js"),__vite__mapDeps([5,4,3,6,7,8]),import.meta.url),g(()=>import("../chunks/D2aTbzFm.js"),__vite__mapDeps([6,7,4,3]),import.meta.url),g(()=>import("../chunks/BXuvR8Ks.js").then(h=>h.i),[],import.meta.url)]).catch(()=>{}),window.addEventListener("sg-theme-change",h=>{y(o,h.detail,!0)}))});var _=Le();de("12qhfyh",n=>{re(()=>{ne.title=(H.name||"Studiograph")??""})});var $=V(_);ie($,()=>r.children);var T=D($,2);Ae(T,{}),z(_),U(()=>ce(_,"data-theme",e(o))),m(c,_),G()}export{Ce as component};
@@ -1 +1 @@
1
- import{a as u,f as h,s as a}from"../chunks/BfTJ6NzK.js";import{i as g}from"../chunks/BjnErSlK.js";import{p as v,f as l,v as d,n as _,o as e,u as o,q as x}from"../chunks/GRkK54yd.js";import{s as $,p}from"../chunks/BzhnXU6Q.js";const k={get error(){return p.error},get status(){return p.status}};$.updated.check;const m=k;var b=h("<h1> </h1> <p> </p>",1);function y(f,i){v(i,!1),g();var t=b(),r=l(t),n=e(r,!0);o(r);var s=x(r,2),c=e(s,!0);o(s),d(()=>{a(n,m.status),a(c,m.error?.message)}),u(f,t),_()}export{y as component};
1
+ import{a as u,f as h,s as a}from"../chunks/CjKjQEMp.js";import{i as g}from"../chunks/eEhMI0BQ.js";import{p as v,f as l,v as d,n as _,o as e,u as o,q as x}from"../chunks/D-tW7Byc.js";import{s as $,p}from"../chunks/C5cMwwSn.js";const k={get error(){return p.error},get status(){return p.status}};$.updated.check;const m=k;var b=h("<h1> </h1> <p> </p>",1);function y(f,i){v(i,!1),g();var t=b(),r=l(t),n=e(r,!0);o(r);var s=x(r,2),c=e(s,!0);o(s),d(()=>{a(n,m.status),a(c,m.error?.message)}),u(f,t),_()}export{y as component};
@@ -1 +1 @@
1
- import{a as v,s as b,f as d}from"../chunks/BfTJ6NzK.js";import{i as y}from"../chunks/BjnErSlK.js";import{p as C,m as S,n as V,o as t,q as l,t as k,u as e,v as A}from"../chunks/GRkK54yd.js";import{i as m}from"../chunks/trveDs8t.js";import{A as P}from"../chunks/B3v6bkHV.js";import{V as q,C as E}from"../chunks/BDskUnFZ.js";import{w as p}from"../chunks/m74CvwCG.js";import{n as L}from"../chunks/CRcLi9EQ.js";var T=d('<h2 class="svelte-1uha8ag"> </h2>'),W=d('<div class="content-row svelte-1uha8ag"><div class="entity-area svelte-1uha8ag"><!> <div class="welcome svelte-1uha8ag"><!> <p class="svelte-1uha8ag">Select an entity from the sidebar to get started.</p></div></div> <!></div>');function K(c,f){C(f,!1);const h=S("chat");L.showEntity(),y(),P(c,{children:(g,j)=>{var o=W(),s=t(o),i=t(s);q(i,{activeView:"entity"});var n=l(i,2),u=t(n);{var _=a=>{var r=T(),$=t(r);e(r),A(()=>b($,`Welcome to ${(p.name||"Studiograph")??""}`)),v(a,r)};m(u,a=>{p.nameLoaded&&a(_)})}k(2),e(n),e(s);var w=l(s,2);{var x=a=>{E(a,{})};m(w,a=>{h.open&&a(x)})}e(o),v(g,o)},$$slots:{default:!0}}),V()}export{K as component};
1
+ import{a as v,s as b,f as d}from"../chunks/CjKjQEMp.js";import{i as y}from"../chunks/eEhMI0BQ.js";import{p as C,m as S,n as V,o as t,q as l,t as k,u as e,v as A}from"../chunks/D-tW7Byc.js";import{i as m}from"../chunks/EhE2EcYu.js";import{A as P}from"../chunks/CICthOLY.js";import{V as q,C as E}from"../chunks/BIQoyk5V.js";import{w as p}from"../chunks/ByFfmBEu.js";import{n as L}from"../chunks/pwrC_shA.js";var T=d('<h2 class="svelte-1uha8ag"> </h2>'),W=d('<div class="content-row svelte-1uha8ag"><div class="entity-area svelte-1uha8ag"><!> <div class="welcome svelte-1uha8ag"><!> <p class="svelte-1uha8ag">Select an entity from the sidebar to get started.</p></div></div> <!></div>');function K(c,f){C(f,!1);const h=S("chat");L.showEntity(),y(),P(c,{children:(g,j)=>{var o=W(),s=t(o),i=t(s);q(i,{activeView:"entity"});var n=l(i,2),u=t(n);{var _=a=>{var r=T(),$=t(r);e(r),A(()=>b($,`Welcome to ${(p.name||"Studiograph")??""}`)),v(a,r)};m(u,a=>{p.nameLoaded&&a(_)})}k(2),e(n),e(s);var w=l(s,2);{var x=a=>{E(a,{})};m(w,a=>{h.open&&a(x)})}e(o),v(g,o)},$$slots:{default:!0}}),V()}export{K as component};
@@ -0,0 +1 @@
1
+ import{f as qe,w as ie,d as Ue,s as We,B as L}from"../chunks/ByFfmBEu.js";import{e as Ge,a as i,f as _,s as b,t as N}from"../chunks/CjKjQEMp.js";import{p as Je,m as Qe,z as A,S as Xe,D as X,y as a,x as c,T as Ye,F as Ze,n as $e,U as et,o as s,q as n,V as q,f as ce,u as d,v as E,t as U}from"../chunks/D-tW7Byc.js";import{i as x}from"../chunks/EhE2EcYu.js";import{e as f,a as ve,r as tt,n as Y,i as fe}from"../chunks/pwrC_shA.js";import{g as ue}from"../chunks/C5cMwwSn.js";import{p as he,A as at,r as rt,a as dt}from"../chunks/CICthOLY.js";import{c as st,V as nt,C as ot}from"../chunks/BIQoyk5V.js";import{I as lt,C as it,t as ct}from"../chunks/i6t46AUT.js";const vt=async({params:W,fetch:e})=>{const{repo:B,type:T,id:R}=W,z=await qe(B,T,R);return{repo:B,type:T,id:R,entity:z}},Kt=Object.freeze(Object.defineProperty({__proto__:null,load:vt},Symbol.toStringTag,{value:"Module"}));var ft=_('<span class="bc-sep svelte-1dc9loe">/</span>'),ut=_("<!><span> </span>",1),ht=_('<span class="status-text saving svelte-1dc9loe">Saving...</span>'),yt=_('<span class="status-text error svelte-1dc9loe"> </span>'),_t=_('<div class="refresh-uptodate svelte-1dc9loe">Entity is up to date with source.</div>'),mt=_('<tr><td class="diff-field svelte-1dc9loe"> </td><td class="diff-old svelte-1dc9loe"> </td><td class="diff-new svelte-1dc9loe"> </td></tr>'),gt=_('<table class="diff-table svelte-1dc9loe"><thead><tr><th class="svelte-1dc9loe">Field</th><th class="svelte-1dc9loe">Current</th><th class="svelte-1dc9loe">New</th></tr></thead><tbody></tbody></table>'),pt=_('<div class="body-diff svelte-1dc9loe"><div class="body-diff-label svelte-1dc9loe">Body changed</div> <div class="body-diff-row svelte-1dc9loe"><pre class="diff-old svelte-1dc9loe"> </pre> <pre class="diff-new svelte-1dc9loe"> </pre></div></div>'),bt=_('<div class="refresh-header svelte-1dc9loe"><span class="refresh-title svelte-1dc9loe">Changes from source</span> <div class="refresh-actions svelte-1dc9loe"><!> <!></div></div> <!> <!>',1),xt=_('<div class="refresh-panel svelte-1dc9loe"><!></div>'),wt=_('<div class="content-row svelte-1dc9loe"><div class="entity-area svelte-1dc9loe"><!> <div class="editor-bar svelte-1dc9loe"><div class="breadcrumb-path svelte-1dc9loe"></div> <div class="editor-actions svelte-1dc9loe"><!> <!> <!></div></div> <!> <div class="document-scroll svelte-1dc9loe"><!> <!></div></div> <!></div>');function Dt(W,e){Je(e,!0);const B=Qe("chat"),T=q(()=>ie.getAppForEntityType(e.data.entity.document?.frontmatter?.entity_type??e.data.type)),R=q(()=>()=>{const t=e.data.entity.path;if(t){const o=t.lastIndexOf(`/${e.data.repo}/`);if(o>=0)return t.substring(o+1).split("/")}return[e.data.repo,e.data.id,"main.md"]});let z=A(""),u=A(Xe({})),Z=A(0);const ye=q(()=>ct(a(u))),_e=q(()=>!!e.data.entity.data?.source_ref);let K=A(!1),v=A(null);async function me(){if(!a(K)){c(K,!0),c(v,null);try{const{result:t}=await rt(e.data.repo,e.data.type,e.data.id);c(v,t,!0)}catch(t){console.error("Refresh failed:",t.message)}finally{c(K,!1)}}}async function ge(){try{await dt(e.data.repo,e.data.type,e.data.id),c(v,null),window.location.reload()}catch(t){console.error("Apply refresh failed:",t.message)}}let I=A(""),$=A(0);X(()=>{const t=`${e.data.repo}/${e.data.type}/${e.data.id}`,o=st.mutationCount;(t!==a(I)||o!==a($))&&(a(I)&&t!==a(I)&&f.flush(),c(I,t),c($,o,!0),c(z,(e.data.entity.document?.content??"").trim(),!0),c(u,{...e.data.entity.document?.frontmatter??e.data.entity.data??{}},!0),Ye(Z),f.reset())}),X(()=>{const t=e.data.repo,o=e.data.type,h=e.data.id;Ze(()=>{Y.select(t,o,h),Y.showEntity()})});function pe(t){c(z,t,!0),f.scheduleAutoSave(e.data.repo,e.data.type,e.data.id,{content:t})}function be(t,o){c(u,{...a(u),[t]:o},!0),f.scheduleAutoSave(e.data.repo,e.data.type,e.data.id,{data:a(u)})}function xe(t){const{[t]:o,...h}=a(u);c(u,h,!0),f.scheduleAutoSave(e.data.repo,e.data.type,e.data.id,{data:a(u)})}function we(t,o){c(u,{...a(u),[t]:o},!0),f.scheduleAutoSave(e.data.repo,e.data.type,e.data.id,{data:a(u)})}function ke(t,o){f.scheduleAutoSave(e.data.repo,e.data.type,e.data.id,{data:a(u)})}function Se(t){for(const o of ie.repos){const h=o.entities.find(D=>D.id===t);if(h){ue(`/${o.name}/${h.entityType}/${h.id}`);return}}tt.showToast(`"${t}" is in a collection you don't have access to`)}X(()=>(he.enter(e.data.repo,e.data.type,e.data.id),()=>he.leave()));function Ce(t){(t.metaKey||t.ctrlKey)&&t.key==="s"&&(t.preventDefault(),f.flush()),t.key==="Escape"&&!(t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement)&&(f.flush(),Y.deselect(),ue("/"))}Ge("keydown",et,Ce),at(W,{children:(t,o)=>{var h=wt(),D=s(h),ee=s(D);nt(ee,{activeView:"entity"});var G=n(ee,2),J=s(G);ve(J,21,()=>a(R)(),fe,(r,l,w)=>{var m=ut(),j=ce(m);{var k=C=>{var H=ft();i(C,H)};x(j,C=>{w>0&&C(k)})}var S=n(j),M=s(S,!0);d(S),E(C=>{We(S,1,C,"svelte-1dc9loe"),b(M,a(l))},[()=>Ue(w===a(R)().length-1?"bc-current":"bc-segment")]),i(r,m)}),d(J);var te=n(J,2),ae=s(te);{var Ae=r=>{var l=ht();i(r,l)},Pe=r=>{var l=yt(),w=s(l,!0);d(l),E(()=>b(w,f.error)),i(r,l)};x(ae,r=>{f.saving?r(Ae):f.error&&r(Pe,1)})}var re=n(ae,2);{var Ee=r=>{L(r,{variant:"outline",size:"sm",class:"refresh-btn",onclick:me,get disabled(){return a(K)},children:(l,w)=>{U();var m=N();E(()=>b(m,a(K)?"Refreshing...":"Refresh from source")),i(l,m)},$$slots:{default:!0}})};x(re,r=>{a(_e)&&r(Ee)})}var Te=n(re,2);{var Re=r=>{L(r,{variant:"link",size:"sm",class:"open-app",get href(){return`/${e.data.repo??""}/${e.data.type??""}/${e.data.id??""}/edit`},children:(l,w)=>{U();var m=N();E(()=>b(m,`Open in ${a(T).name??""} →`)),i(l,m)},$$slots:{default:!0}})};x(Te,r=>{a(T)&&r(Re)})}d(te),d(G);var de=n(G,2);{var ze=r=>{var l=xt(),w=s(l);{var m=k=>{var S=_t();i(k,S)},j=k=>{var S=bt(),M=ce(S),C=n(s(M),2),H=s(C);L(H,{variant:"accent",size:"sm",onclick:ge,children:(y,g)=>{U();var p=N("Apply changes");i(y,p)},$$slots:{default:!0}});var Fe=n(H,2);L(Fe,{variant:"ghost",size:"sm",onclick:()=>c(v,null),children:(y,g)=>{U();var p=N("Dismiss");i(y,p)},$$slots:{default:!0}}),d(C),d(M);var oe=n(M,2);{var Oe=y=>{var g=gt(),p=n(s(g));ve(p,21,()=>a(v).diffs,fe,(F,O)=>{var P=mt(),V=s(P),Ie=s(V,!0);d(V);var Q=n(V),je=s(Q,!0);d(Q);var le=n(Q),He=s(le,!0);d(le),d(P),E((Le,Ne)=>{b(Ie,a(O).field),b(je,Le),b(He,Ne)},[()=>String(a(O).old_value??""),()=>String(a(O).new_value??"")]),i(F,P)}),d(p),d(g),i(y,g)};x(oe,y=>{a(v).diffs.length>0&&y(Oe)})}var Ve=n(oe,2);{var Be=y=>{var g=pt(),p=n(s(g),2),F=s(p),O=s(F,!0);d(F);var P=n(F,2),V=s(P,!0);d(P),d(p),d(g),E(()=>{b(O,a(v).body_diff.old),b(V,a(v).body_diff.new)}),i(y,g)};x(Ve,y=>{a(v).body_changed&&a(v).body_diff&&y(Be)})}i(k,S)};x(w,k=>{a(v).diffs.length===0&&!a(v).body_changed?k(m):k(j,!1)})}d(l),i(r,l)};x(de,r=>{a(v)&&r(ze)})}var se=n(de,2),ne=s(se);lt(ne,{get properties(){return a(ye)},editable:!0,onedit:be,onremove:xe,onadd:we,ontypechange:ke});var Ke=n(ne,2);it(Ke,{get content(){return a(z)},readonly:!1,onchange:pe,onsave:()=>f.flush(),onwikilinkclick:Se,get resetKey(){return a(Z)},get collabDocName(){return`${e.data.repo??""}/${e.data.type??""}/${e.data.id??""}`}}),d(se),d(D);var De=n(D,2);{var Me=r=>{ot(r,{})};x(De,r=>{B.open&&r(Me)})}d(h),i(t,h)},$$slots:{default:!0}}),$e()}export{Dt as component,Kt as universal};
@@ -0,0 +1,17 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/DWSjaG46.js","../chunks/D-tW7Byc.js","../chunks/Bk7i2AGK.js"])))=>i.map(i=>d[i]);
2
+ import{h as Vt,r as jt,i as Mt,B as St,s as Zt,d as Yt,w as Gt}from"../chunks/ByFfmBEu.js";import{d as Xt,b as Ct,a as ot,f as lt,e as $t,s as qt}from"../chunks/CjKjQEMp.js";import{p as Bt,z as _t,S as Pt,D as Ft,_ as te,ap as ee,o as Q,q as G,y as h,u as N,v as At,x as I,f as Ht,t as re,n as Qt,m as ne,T as ie,F as se,V as Rt,U as ae}from"../chunks/D-tW7Byc.js";import{i as kt,b as oe}from"../chunks/EhE2EcYu.js";import{a as Ot,X as Kt,i as xt,P as It,e as dt,n as Ut,r as le}from"../chunks/pwrC_shA.js";import{g as ue}from"../chunks/C5cMwwSn.js";import{A as he}from"../chunks/CICthOLY.js";import{V as fe,C as de}from"../chunks/BIQoyk5V.js";import{I as ce,C as pe,t as _e}from"../chunks/i6t46AUT.js";import{_ as ge}from"../chunks/PPVm8Dsz.js";import{g as ve}from"../chunks/CqkleIqs.js";const me=async({params:O})=>{const{repo:c,type:w,id:l,path:F}=O,L=await Vt(c,w,l,F);return{repo:c,type:w,id:l,filePath:F,fileName:F.split("/").pop()??F,content:L}},Je=Object.freeze(Object.defineProperty({__proto__:null,load:me},Symbol.toStringTag,{value:"Module"}));var Tt={exports:{}};var ye=Tt.exports,Nt;function ke(){return Nt||(Nt=1,(function(O,c){((w,l)=>{O.exports=l()})(ye,function w(){var l=typeof self<"u"?self:typeof window<"u"?window:l!==void 0?l:{},F,L=!l.document&&!!l.postMessage,S=l.IS_PAPA_WORKER||!1,Z={},tt=0,d={};function W(t){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(e){var r=nt(e);r.chunkSize=parseInt(r.chunkSize),e.step||e.chunk||(r.chunkSize=null),this._handle=new pt(r),(this._handle.streamer=this)._config=r}).call(this,t),this.parseChunk=function(e,r){var s=parseInt(this._config.skipFirstNLines)||0;if(this.isFirstChunk&&0<s){let y=this._config.newline;y||(a=this._config.quoteChar||'"',y=this._handle.guessLineEndings(e,a)),e=[...e.split(y).slice(s)].join(y)}this.isFirstChunk&&p(this._config.beforeFirstChunk)&&(a=this._config.beforeFirstChunk(e))!==void 0&&(e=a),this.isFirstChunk=!1,this._halted=!1;var s=this._partialLine+e,a=(this._partialLine="",this._handle.parse(s,this._baseIndex,!this._finished));if(!this._handle.paused()&&!this._handle.aborted()){if(e=a.meta.cursor,s=(this._finished||(this._partialLine=s.substring(e-this._baseIndex),this._baseIndex=e),a&&a.data&&(this._rowCount+=a.data.length),this._finished||this._config.preview&&this._rowCount>=this._config.preview),S)l.postMessage({results:a,workerId:d.WORKER_ID,finished:s});else if(p(this._config.chunk)&&!r){if(this._config.chunk(a,this._handle),this._handle.paused()||this._handle.aborted())return void(this._halted=!0);this._completeResults=a=void 0}return this._config.step||this._config.chunk||(this._completeResults.data=this._completeResults.data.concat(a.data),this._completeResults.errors=this._completeResults.errors.concat(a.errors),this._completeResults.meta=a.meta),this._completed||!s||!p(this._config.complete)||a&&a.meta.aborted||(this._config.complete(this._completeResults,this._input),this._completed=!0),s||a&&a.meta.paused||this._nextChunk(),a}this._halted=!0},this._sendError=function(e){p(this._config.error)?this._config.error(e):S&&this._config.error&&l.postMessage({workerId:d.WORKER_ID,error:e,finished:!1})}}function rt(t){var e;(t=t||{}).chunkSize||(t.chunkSize=d.RemoteChunkSize),W.call(this,t),this._nextChunk=L?function(){this._readChunk(),this._chunkLoaded()}:function(){this._readChunk()},this.stream=function(r){this._input=r,this._nextChunk()},this._readChunk=function(){if(this._finished)this._chunkLoaded();else{if(e=new XMLHttpRequest,this._config.withCredentials&&(e.withCredentials=this._config.withCredentials),L||(e.onload=m(this._chunkLoaded,this),e.onerror=m(this._chunkError,this)),e.open(this._config.downloadRequestBody?"POST":"GET",this._input,!L),this._config.downloadRequestHeaders){var r,s=this._config.downloadRequestHeaders;for(r in s)e.setRequestHeader(r,s[r])}var a;this._config.chunkSize&&(a=this._start+this._config.chunkSize-1,e.setRequestHeader("Range","bytes="+this._start+"-"+a));try{e.send(this._config.downloadRequestBody)}catch(y){this._chunkError(y.message)}L&&e.status===0&&this._chunkError()}},this._chunkLoaded=function(){e.readyState===4&&(e.status<200||400<=e.status?this._chunkError():(this._start+=this._config.chunkSize||e.responseText.length,this._finished=!this._config.chunkSize||this._start>=(r=>(r=r.getResponseHeader("Content-Range"))!==null?parseInt(r.substring(r.lastIndexOf("/")+1)):-1)(e),this.parseChunk(e.responseText)))},this._chunkError=function(r){r=e.statusText||r,this._sendError(new Error(r))}}function ut(t){(t=t||{}).chunkSize||(t.chunkSize=d.LocalChunkSize),W.call(this,t);var e,r,s=typeof FileReader<"u";this.stream=function(a){this._input=a,r=a.slice||a.webkitSlice||a.mozSlice,s?((e=new FileReader).onload=m(this._chunkLoaded,this),e.onerror=m(this._chunkError,this)):e=new FileReaderSync,this._nextChunk()},this._nextChunk=function(){this._finished||this._config.preview&&!(this._rowCount<this._config.preview)||this._readChunk()},this._readChunk=function(){var a=this._input,y=(this._config.chunkSize&&(y=Math.min(this._start+this._config.chunkSize,this._input.size),a=r.call(a,this._start,y)),e.readAsText(a,this._config.encoding));s||this._chunkLoaded({target:{result:y}})},this._chunkLoaded=function(a){this._start+=this._config.chunkSize,this._finished=!this._config.chunkSize||this._start>=this._input.size,this.parseChunk(a.target.result)},this._chunkError=function(){this._sendError(e.error)}}function X(t){var e;W.call(this,t=t||{}),this.stream=function(r){return e=r,this._nextChunk()},this._nextChunk=function(){var r,s;if(!this._finished)return r=this._config.chunkSize,e=r?(s=e.substring(0,r),e.substring(r)):(s=e,""),this._finished=!e,this.parseChunk(s)}}function $(t){W.call(this,t=t||{});var e=[],r=!0,s=!1;this.pause=function(){W.prototype.pause.apply(this,arguments),this._input.pause()},this.resume=function(){W.prototype.resume.apply(this,arguments),this._input.resume()},this.stream=function(a){this._input=a,this._input.on("data",this._streamData),this._input.on("end",this._streamEnd),this._input.on("error",this._streamError)},this._checkIsFinished=function(){s&&e.length===1&&(this._finished=!0)},this._nextChunk=function(){this._checkIsFinished(),e.length?this.parseChunk(e.shift()):r=!0},this._streamData=m(function(a){try{e.push(typeof a=="string"?a:a.toString(this._config.encoding)),r&&(r=!1,this._checkIsFinished(),this.parseChunk(e.shift()))}catch(y){this._streamError(y)}},this),this._streamError=m(function(a){this._streamCleanUp(),this._sendError(a)},this),this._streamEnd=m(function(){this._streamCleanUp(),s=!0,this._streamData("")},this),this._streamCleanUp=m(function(){this._input.removeListener("data",this._streamData),this._input.removeListener("end",this._streamEnd),this._input.removeListener("error",this._streamError)},this)}function pt(t){var e,r,s,a,y=Math.pow(2,53),z=-y,J=/^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/,i=/^((\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)))$/,n=this,u=0,f=0,A=!1,v=!1,b=[],o={data:[],errors:[],meta:{}};function D(k){return t.skipEmptyLines==="greedy"?k.join("").trim()==="":k.length===1&&k[0].length===0}function _(){if(o&&s&&(U("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+d.DefaultDelimiter+"'"),s=!1),t.skipEmptyLines&&(o.data=o.data.filter(function(g){return!D(g)})),T()){let g=function(M,q){p(t.transformHeader)&&(M=t.transformHeader(M,q)),b.push(M)};if(o)if(Array.isArray(o.data[0])){for(var k=0;T()&&k<o.data.length;k++)o.data[k].forEach(g);o.data.splice(0,1)}else o.data.forEach(g)}function C(g,M){for(var q=t.header?{}:[],x=0;x<g.length;x++){var P=x,R=g[x],R=((et,E)=>(K=>(t.dynamicTypingFunction&&t.dynamicTyping[K]===void 0&&(t.dynamicTyping[K]=t.dynamicTypingFunction(K)),(t.dynamicTyping[K]||t.dynamicTyping)===!0))(et)?E==="true"||E==="TRUE"||E!=="false"&&E!=="FALSE"&&((K=>{if(J.test(K)&&(K=parseFloat(K),z<K&&K<y))return 1})(E)?parseFloat(E):i.test(E)?new Date(E):E===""?null:E):E)(P=t.header?x>=b.length?"__parsed_extra":b[x]:P,R=t.transform?t.transform(R,P):R);P==="__parsed_extra"?(q[P]=q[P]||[],q[P].push(R)):q[P]=R}return t.header&&(x>b.length?U("FieldMismatch","TooManyFields","Too many fields: expected "+b.length+" fields but parsed "+x,f+M):x<b.length&&U("FieldMismatch","TooFewFields","Too few fields: expected "+b.length+" fields but parsed "+x,f+M)),q}var j;o&&(t.header||t.dynamicTyping||t.transform)&&(j=1,!o.data.length||Array.isArray(o.data[0])?(o.data=o.data.map(C),j=o.data.length):o.data=C(o.data,0),t.header&&o.meta&&(o.meta.fields=b),f+=j)}function T(){return t.header&&b.length===0}function U(k,C,j,g){k={type:k,code:C,message:j},g!==void 0&&(k.row=g),o.errors.push(k)}p(t.step)&&(a=t.step,t.step=function(k){o=k,T()?_():(_(),o.data.length!==0&&(u+=k.data.length,t.preview&&u>t.preview?r.abort():(o.data=o.data[0],a(o,n))))}),this.parse=function(k,C,j){var g=t.quoteChar||'"',g=(t.newline||(t.newline=this.guessLineEndings(k,g)),s=!1,t.delimiter?p(t.delimiter)&&(t.delimiter=t.delimiter(k),o.meta.delimiter=t.delimiter):((g=((M,q,x,P,R)=>{var et,E,K,ct;R=R||[","," ","|",";",d.RECORD_SEP,d.UNIT_SEP];for(var mt=0;mt<R.length;mt++){for(var it,Et=R[mt],V=0,st=0,H=0,Y=(K=void 0,new B({comments:P,delimiter:Et,newline:q,preview:10}).parse(M)),ft=0;ft<Y.data.length;ft++)x&&D(Y.data[ft])?H++:(it=Y.data[ft].length,st+=it,K===void 0?K=it:0<it&&(V+=Math.abs(it-K),K=it));0<Y.data.length&&(st/=Y.data.length-H),(E===void 0||V<=E)&&(ct===void 0||ct<st)&&1.99<st&&(E=V,et=Et,ct=st)}return{successful:!!(t.delimiter=et),bestDelimiter:et}})(k,t.newline,t.skipEmptyLines,t.comments,t.delimitersToGuess)).successful?t.delimiter=g.bestDelimiter:(s=!0,t.delimiter=d.DefaultDelimiter),o.meta.delimiter=t.delimiter),nt(t));return t.preview&&t.header&&g.preview++,e=k,r=new B(g),o=r.parse(e,C,j),_(),A?{meta:{paused:!0}}:o||{meta:{paused:!1}}},this.paused=function(){return A},this.pause=function(){A=!0,r.abort(),e=p(t.chunk)?"":e.substring(r.getCharIndex())},this.resume=function(){n.streamer._halted?(A=!1,n.streamer.parseChunk(e,!0)):setTimeout(n.resume,3)},this.aborted=function(){return v},this.abort=function(){v=!0,r.abort(),o.meta.aborted=!0,p(t.complete)&&t.complete(o),e=""},this.guessLineEndings=function(M,g){M=M.substring(0,1048576);var g=new RegExp(ht(g)+"([^]*?)"+ht(g),"gm"),j=(M=M.replace(g,"")).split("\r"),g=M.split(`
3
+ `),M=1<g.length&&g[0].length<j[0].length;if(j.length===1||M)return`
4
+ `;for(var q=0,x=0;x<j.length;x++)j[x][0]===`
5
+ `&&q++;return q>=j.length/2?`\r
6
+ `:"\r"}}function ht(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function B(t){var e=(t=t||{}).delimiter,r=t.newline,s=t.comments,a=t.step,y=t.preview,z=t.fastMode,J=null,i=!1,n=t.quoteChar==null?'"':t.quoteChar,u=n;if(t.escapeChar!==void 0&&(u=t.escapeChar),(typeof e!="string"||-1<d.BAD_DELIMITERS.indexOf(e))&&(e=","),s===e)throw new Error("Comment character same as delimiter");s===!0?s="#":(typeof s!="string"||-1<d.BAD_DELIMITERS.indexOf(s))&&(s=!1),r!==`
7
+ `&&r!=="\r"&&r!==`\r
8
+ `&&(r=`
9
+ `);var f=0,A=!1;this.parse=function(v,b,o){if(typeof v!="string")throw new Error("Input must be a string");var D=v.length,_=e.length,T=r.length,U=s.length,k=p(a),C=[],j=[],g=[],M=f=0;if(!v)return V();if(z||z!==!1&&v.indexOf(n)===-1){for(var q=v.split(r),x=0;x<q.length;x++){if(g=q[x],f+=g.length,x!==q.length-1)f+=r.length;else if(o)return V();if(!s||g.substring(0,U)!==s){if(k){if(C=[],ct(g.split(e)),st(),A)return V()}else ct(g.split(e));if(y&&y<=x)return C=C.slice(0,y),V(!0)}}return V()}for(var P=v.indexOf(e,f),R=v.indexOf(r,f),et=new RegExp(ht(u)+ht(n),"g"),E=v.indexOf(n,f);;)if(v[f]===n)for(E=f,f++;;){if((E=v.indexOf(n,E+1))===-1)return o||j.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:C.length,index:f}),it();if(E===D-1)return it(v.substring(f,E).replace(et,n));if(n===u&&v[E+1]===u)E++;else if(n===u||E===0||v[E-1]!==u){P!==-1&&P<E+1&&(P=v.indexOf(e,E+1));var K=mt((R=R!==-1&&R<E+1?v.indexOf(r,E+1):R)===-1?P:Math.min(P,R));if(v.substr(E+1+K,_)===e){g.push(v.substring(f,E).replace(et,n)),v[f=E+1+K+_]!==n&&(E=v.indexOf(n,f)),P=v.indexOf(e,f),R=v.indexOf(r,f);break}if(K=mt(R),v.substring(E+1+K,E+1+K+T)===r){if(g.push(v.substring(f,E).replace(et,n)),Et(E+1+K+T),P=v.indexOf(e,f),E=v.indexOf(n,f),k&&(st(),A))return V();if(y&&C.length>=y)return V(!0);break}j.push({type:"Quotes",code:"InvalidQuotes",message:"Trailing quote on quoted field is malformed",row:C.length,index:f}),E++}}else if(s&&g.length===0&&v.substring(f,f+U)===s){if(R===-1)return V();f=R+T,R=v.indexOf(r,f),P=v.indexOf(e,f)}else if(P!==-1&&(P<R||R===-1))g.push(v.substring(f,P)),f=P+_,P=v.indexOf(e,f);else{if(R===-1)break;if(g.push(v.substring(f,R)),Et(R+T),k&&(st(),A))return V();if(y&&C.length>=y)return V(!0)}return it();function ct(H){C.push(H),M=f}function mt(H){var Y=0;return Y=H!==-1&&(H=v.substring(E+1,H))&&H.trim()===""?H.length:Y}function it(H){return o||(H===void 0&&(H=v.substring(f)),g.push(H),f=D,ct(g),k&&st()),V()}function Et(H){f=H,ct(g),g=[],R=v.indexOf(r,f)}function V(H){if(t.header&&!b&&C.length&&!i){var Y=C[0],ft=Object.create(null),Dt=new Set(Y);let Lt=!1;for(let yt=0;yt<Y.length;yt++){let at=Y[yt];if(ft[at=p(t.transformHeader)?t.transformHeader(at,yt):at]){let wt,zt=ft[at];for(;wt=at+"_"+zt,zt++,Dt.has(wt););Dt.add(wt),Y[yt]=wt,ft[at]++,Lt=!0,(J=J===null?{}:J)[wt]=at}else ft[at]=1,Y[yt]=at;Dt.add(at)}Lt&&console.warn("Duplicate headers found and renamed."),i=!0}return{data:C,errors:j,meta:{delimiter:e,linebreak:r,aborted:A,truncated:!!H,cursor:M+(b||0),renamedHeaders:J}}}function st(){a(V()),C=[],j=[]}},this.abort=function(){A=!0},this.getCharIndex=function(){return f}}function bt(t){var e=t.data,r=Z[e.workerId],s=!1;if(e.error)r.userError(e.error,e.file);else if(e.results&&e.results.data){var a={abort:function(){s=!0,gt(e.workerId,{data:[],errors:[],meta:{aborted:!0}})},pause:vt,resume:vt};if(p(r.userStep)){for(var y=0;y<e.results.data.length&&(r.userStep({data:e.results.data[y],errors:e.results.errors,meta:e.results.meta},a),!s);y++);delete e.results}else p(r.userChunk)&&(r.userChunk(e.results,a,e.file),delete e.results)}e.finished&&!s&&gt(e.workerId,e.results)}function gt(t,e){var r=Z[t];p(r.userComplete)&&r.userComplete(e),r.terminate(),delete Z[t]}function vt(){throw new Error("Not implemented.")}function nt(t){if(typeof t!="object"||t===null)return t;var e,r=Array.isArray(t)?[]:{};for(e in t)r[e]=nt(t[e]);return r}function m(t,e){return function(){t.apply(e,arguments)}}function p(t){return typeof t=="function"}return d.parse=function(t,e){var r=(e=e||{}).dynamicTyping||!1;if(p(r)&&(e.dynamicTypingFunction=r,r={}),e.dynamicTyping=r,e.transform=!!p(e.transform)&&e.transform,!e.worker||!d.WORKERS_SUPPORTED)return r=null,d.NODE_STREAM_INPUT,typeof t=="string"?(t=(s=>s.charCodeAt(0)!==65279?s:s.slice(1))(t),r=new(e.download?rt:X)(e)):t.readable===!0&&p(t.read)&&p(t.on)?r=new $(e):(l.File&&t instanceof File||t instanceof Object)&&(r=new ut(e)),r.stream(t);(r=(()=>{var s;return!!d.WORKERS_SUPPORTED&&(s=(()=>{var a=l.URL||l.webkitURL||null,y=w.toString();return d.BLOB_URL||(d.BLOB_URL=a.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; ","(",y,")();"],{type:"text/javascript"})))})(),(s=new l.Worker(s)).onmessage=bt,s.id=tt++,Z[s.id]=s)})()).userStep=e.step,r.userChunk=e.chunk,r.userComplete=e.complete,r.userError=e.error,e.step=p(e.step),e.chunk=p(e.chunk),e.complete=p(e.complete),e.error=p(e.error),delete e.worker,r.postMessage({input:t,config:e,workerId:r.id})},d.unparse=function(t,e){var r=!1,s=!0,a=",",y=`\r
10
+ `,z='"',J=z+z,i=!1,n=null,u=!1,f=((()=>{if(typeof e=="object"){if(typeof e.delimiter!="string"||d.BAD_DELIMITERS.filter(function(b){return e.delimiter.indexOf(b)!==-1}).length||(a=e.delimiter),typeof e.quotes!="boolean"&&typeof e.quotes!="function"&&!Array.isArray(e.quotes)||(r=e.quotes),typeof e.skipEmptyLines!="boolean"&&typeof e.skipEmptyLines!="string"||(i=e.skipEmptyLines),typeof e.newline=="string"&&(y=e.newline),typeof e.quoteChar=="string"&&(z=e.quoteChar),typeof e.header=="boolean"&&(s=e.header),Array.isArray(e.columns)){if(e.columns.length===0)throw new Error("Option columns is empty");n=e.columns}e.escapeChar!==void 0&&(J=e.escapeChar+z),e.escapeFormulae instanceof RegExp?u=e.escapeFormulae:typeof e.escapeFormulae=="boolean"&&e.escapeFormulae&&(u=/^[=+\-@\t\r].*$/)}})(),new RegExp(ht(z),"g"));if(typeof t=="string"&&(t=JSON.parse(t)),Array.isArray(t)){if(!t.length||Array.isArray(t[0]))return A(null,t,i);if(typeof t[0]=="object")return A(n||Object.keys(t[0]),t,i)}else if(typeof t=="object")return typeof t.data=="string"&&(t.data=JSON.parse(t.data)),Array.isArray(t.data)&&(t.fields||(t.fields=t.meta&&t.meta.fields||n),t.fields||(t.fields=Array.isArray(t.data[0])?t.fields:typeof t.data[0]=="object"?Object.keys(t.data[0]):[]),Array.isArray(t.data[0])||typeof t.data[0]=="object"||(t.data=[t.data])),A(t.fields||[],t.data||[],i);throw new Error("Unable to serialize unrecognized input");function A(b,o,D){var _="",T=(typeof b=="string"&&(b=JSON.parse(b)),typeof o=="string"&&(o=JSON.parse(o)),Array.isArray(b)&&0<b.length),U=!Array.isArray(o[0]);if(T&&s){for(var k=0;k<b.length;k++)0<k&&(_+=a),_+=v(b[k],k);0<o.length&&(_+=y)}for(var C=0;C<o.length;C++){var j=(T?b:o[C]).length,g=!1,M=T?Object.keys(o[C]).length===0:o[C].length===0;if(D&&!T&&(g=D==="greedy"?o[C].join("").trim()==="":o[C].length===1&&o[C][0].length===0),D==="greedy"&&T){for(var q=[],x=0;x<j;x++){var P=U?b[x]:x;q.push(o[C][P])}g=q.join("").trim()===""}if(!g){for(var R=0;R<j;R++){0<R&&!M&&(_+=a);var et=T&&U?b[R]:R;_+=v(o[C][et],R)}C<o.length-1&&(!D||0<j&&!M)&&(_+=y)}}return _}function v(b,o){var D,_;return b==null?"":b.constructor===Date?JSON.stringify(b).slice(1,25):(_=!1,u&&typeof b=="string"&&u.test(b)&&(b="'"+b,_=!0),D=b.toString().replace(f,J),(_=_||r===!0||typeof r=="function"&&r(b,o)||Array.isArray(r)&&r[o]||((T,U)=>{for(var k=0;k<U.length;k++)if(-1<T.indexOf(U[k]))return!0;return!1})(D,d.BAD_DELIMITERS)||-1<D.indexOf(a)||D.charAt(0)===" "||D.charAt(D.length-1)===" ")?z+D+z:D)}},d.RECORD_SEP="",d.UNIT_SEP="",d.BYTE_ORDER_MARK="\uFEFF",d.BAD_DELIMITERS=["\r",`
11
+ `,'"',d.BYTE_ORDER_MARK],d.WORKERS_SUPPORTED=!L&&!!l.Worker,d.NODE_STREAM_INPUT=1,d.LocalChunkSize=10485760,d.RemoteChunkSize=5242880,d.DefaultDelimiter=",",d.Parser=B,d.ParserHandle=pt,d.NetworkStreamer=rt,d.FileStreamer=ut,d.StringStreamer=X,d.ReadableStreamStreamer=$,l.jQuery&&((F=l.jQuery).fn.parse=function(t){var e=t.config||{},r=[];return this.each(function(y){if(!(F(this).prop("tagName").toUpperCase()==="INPUT"&&F(this).attr("type").toLowerCase()==="file"&&l.FileReader)||!this.files||this.files.length===0)return!0;for(var z=0;z<this.files.length;z++)r.push({file:this.files[z],inputElem:this,instanceConfig:F.extend({},e)})}),s(),this;function s(){if(r.length===0)p(t.complete)&&t.complete();else{var y,z,J,i,n=r[0];if(p(t.before)){var u=t.before(n.file,n.inputElem);if(typeof u=="object"){if(u.action==="abort")return y="AbortError",z=n.file,J=n.inputElem,i=u.reason,void(p(t.error)&&t.error({name:y},z,J,i));if(u.action==="skip")return void a();typeof u.config=="object"&&(n.instanceConfig=F.extend(n.instanceConfig,u.config))}else if(u==="skip")return void a()}var f=n.instanceConfig.complete;n.instanceConfig.complete=function(A){p(f)&&f(A,n.file,n.inputElem),a()},d.parse(n.file,n.instanceConfig)}}function a(){r.splice(0,1),s()}}),S&&(l.onmessage=function(t){t=t.data,d.WORKER_ID===void 0&&t&&(d.WORKER_ID=t.workerId),typeof t.input=="string"?l.postMessage({workerId:d.WORKER_ID,results:d.parse(t.input,t.config),finished:!0}):(l.File&&t.input instanceof File||t.input instanceof Object)&&(t=d.parse(t.input,t.config))&&l.postMessage({workerId:d.WORKER_ID,results:t,finished:!0})}),(rt.prototype=Object.create(W.prototype)).constructor=rt,(ut.prototype=Object.create(W.prototype)).constructor=ut,(X.prototype=Object.create(X.prototype)).constructor=X,($.prototype=Object.create(W.prototype)).constructor=$,d})})(Tt)),Tt.exports}var be=ke();const Wt=ve(be);var Ee=lt('<th class="svelte-63hltt"><input class="cell-input header-input svelte-63hltt"/> <!></th>'),we=lt('<td class="svelte-63hltt"><input class="cell-input svelte-63hltt"/></td>'),Ce=lt('<tr class="svelte-63hltt"><td class="row-num svelte-63hltt"></td><!><td class="actions svelte-63hltt"><!></td></tr>'),Re=lt("<!> <span>Add row</span>",1),Se=lt('<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 Oe(O,c){Bt(c,!0);let w=_t(Pt([])),l=_t(Pt([])),F=_t(void 0),L=!1,S=null,Z=!1;function tt(i){const n=Wt.parse(i.trim(),{header:!1,skipEmptyLines:!0});n.data.length>0?(I(w,n.data[0],!0),I(l,n.data.slice(1),!0)):(I(w,[],!0),I(l,[],!0))}tt(c.content),Ft(()=>{L||tt(c.content)}),te(async()=>{if(c.collabDocName)try{const{collab:i}=await ge(async()=>{const{collab:u}=await import("../chunks/DWSjaG46.js");return{collab:u}},__vite__mapDeps([0,1,2]),import.meta.url),n=i.connect(c.collabDocName);if(!n||i.status==="unavailable")return;S=n.yText,L=!0,S.length===0&&c.content?S.insert(0,c.content):S.length>0&&tt(S.toString()),S.observe(()=>{!Z&&S&&tt(S.toString())})}catch{}}),ee(()=>{S=null,L=!1});function d(){return Wt.unparse([h(w),...h(l)])}function W(){const i=d();L&&S?(Z=!0,S.doc?.transact(()=>{S.delete(0,S.length),S.insert(0,i)}),Z=!1):c.onchange?.(i)}function rt(i,n,u){h(l)[i][n]=u,I(l,[...h(l)],!0),W()}function ut(i,n){h(w)[i]=n,I(w,[...h(w)],!0),W()}function X(){I(l,[...h(l),h(w).map(()=>"")],!0),W(),B(h(l).length-1,0)}function $(i){I(l,h(l).filter((n,u)=>u!==i),!0),W()}function pt(){const i=`col${h(w).length+1}`;I(w,[...h(w),i],!0),I(l,h(l).map(n=>[...n,""]),!0),W(),requestAnimationFrame(()=>{const n=h(F)?.querySelector(`thead th:nth-child(${h(w).length+1}) input`);n&&(n.focus(),n.select())})}function ht(i){h(w).length<=1||(I(w,h(w).filter((n,u)=>u!==i),!0),I(l,h(l).map(n=>n.filter((u,f)=>f!==i)),!0),W())}function B(i,n){requestAnimationFrame(()=>{if(!h(F))return;let u=null;i<0?u=h(F).querySelector(`thead th:nth-child(${n+2}) input`):u=h(F).querySelector(`tbody tr:nth-child(${i+1}) td:nth-child(${n+2}) input`),u&&(u.focus(),u.select())})}function bt(i,n,u){if(i.key==="Tab"){i.preventDefault(),i.shiftKey?u>0?B(n,u-1):n>0?B(n-1,h(w).length-1):n===0&&B(-1,h(w).length-1):u<h(w).length-1?B(n,u+1):n<h(l).length-1?B(n+1,0):n===h(l).length-1&&X();return}if(i.key==="Enter"){i.preventDefault(),i.shiftKey?n>0?B(n-1,u):B(-1,u):n<h(l).length-1?B(n+1,u):X();return}if(i.key==="Escape"){i.target.blur();return}}function gt(i,n){if(i.key==="Tab"){i.preventDefault(),i.shiftKey?n>0&&B(-1,n-1):n<h(w).length-1?B(-1,n+1):h(l).length>0&&B(0,0);return}if(i.key==="Enter"){i.preventDefault(),h(l).length>0?B(0,n):X();return}if(i.key==="Escape"){i.target.blur();return}}function vt(i){(i.metaKey||i.ctrlKey)&&i.key==="s"&&(i.preventDefault(),c.onsave?.())}var nt=Se(),m=Q(nt),p=Q(m),t=Q(p),e=Q(t),r=G(Q(e));Ot(r,17,()=>h(w),xt,(i,n,u)=>{var f=Ee(),A=Q(f);jt(A);var v=G(A,2);{var b=o=>{St(o,{variant:"ghost",size:"icon",class:"col-delete-btn",title:"Delete column",onclick:()=>ht(u),children:(D,_)=>{Kt(D,{size:12})},$$slots:{default:!0}})};kt(v,o=>{h(w).length>1&&o(b)})}N(f),At(()=>Mt(A,h(n))),Ct("input",A,o=>ut(u,o.currentTarget.value)),Ct("keydown",A,o=>gt(o,u)),ot(i,f)});var s=G(r),a=Q(s);St(a,{variant:"ghost",size:"icon",class:"col-add-btn",title:"Add column",onclick:pt,children:(i,n)=>{It(i,{size:14})},$$slots:{default:!0}}),N(s),N(e),N(t);var y=G(t);Ot(y,21,()=>h(l),xt,(i,n,u)=>{var f=Ce(),A=Q(f);A.textContent=u+1;var v=G(A);Ot(v,17,()=>h(n),xt,(D,_,T)=>{var U=we(),k=Q(U);jt(k),N(U),At(()=>Mt(k,h(_))),Ct("input",k,C=>rt(u,T,C.currentTarget.value)),Ct("keydown",k,C=>bt(C,u,T)),ot(D,U)});var b=G(v),o=Q(b);St(o,{variant:"ghost",size:"icon",class:"delete-btn",title:"Delete row",onclick:()=>$(u),children:(D,_)=>{Kt(D,{size:12})},$$slots:{default:!0}}),N(b),N(f),ot(i,f)}),N(y),N(p),oe(p,i=>I(F,i),()=>h(F)),N(m);var z=G(m,2),J=Q(z);St(J,{variant:"ghost",class:"add-row-btn",onclick:X,children:(i,n)=>{var u=Re(),f=Ht(u);It(f,{size:14}),re(2),ot(i,u)},$$slots:{default:!0}}),N(z),N(nt),Ct("keydown",nt,vt),ot(O,nt),Qt()}Xt(["keydown","input"]);function xe(O){if(!O.startsWith("---"))return{frontmatter:{},content:O};const c=O.indexOf(`
12
+ ---`,3);if(c===-1)return{frontmatter:{},content:O};const w=O.slice(4,c),l=O.slice(c+4).replace(/^\n/,"");try{return{frontmatter:Te(w),content:l}}catch{return{frontmatter:{},content:O}}}function Te(O){const c={},w=O.split(`
13
+ `);let l=0;for(;l<w.length;){const F=w[l];if(!F.trim()||F.trim().startsWith("#")){l++;continue}const L=F.match(/^([a-zA-Z_][a-zA-Z0-9_-]*):\s*(.*)/);if(!L){l++;continue}const S=L[1],Z=L[2].trim();if(!Z&&l+1<w.length&&w[l+1]?.match(/^\s+-\s/)){const tt=[];for(l++;l<w.length&&w[l].match(/^\s+-\s/);){const d=w[l].match(/^\s+-\s+(.*)/);d&&tt.push(Jt(d[1].trim())),l++}c[S]=tt;continue}c[S]=Ae(Z),l++}return c}function Jt(O){return O.startsWith("'")&&O.endsWith("'")||O.startsWith('"')&&O.endsWith('"')?O.slice(1,-1):O}function Ae(O){if(!O)return"";const c=Jt(O);return c==="true"?!0:c==="false"?!1:c==="null"||c==="~"?null:O===c&&/^-?\d+(\.\d+)?$/.test(O)?Number(O):c}var De=lt('<span class="bc-sep svelte-xtfs5g">/</span>'),Pe=lt("<!><span> </span>",1),Fe=lt('<span class="status-text saving svelte-xtfs5g">Saving...</span>'),Le=lt('<span class="status-text error svelte-xtfs5g"> </span>'),ze=lt('<div class="content-row svelte-xtfs5g"><div class="entity-area svelte-xtfs5g"><!> <div class="editor-bar svelte-xtfs5g"><div class="breadcrumb-path svelte-xtfs5g"></div> <div class="editor-actions svelte-xtfs5g"><!></div></div> <div class="document-scroll svelte-xtfs5g"><!> <!></div></div> <!></div>');function Ve(O,c){Bt(c,!0);const w=ne("chat"),l=Rt(()=>c.data.fileName.endsWith(".csv")),F=Rt(()=>c.data.fileName.endsWith(".md"));let L=_t(""),S=_t(Pt({})),Z=_t(0);const tt=Rt(()=>_e(h(S))),d=Rt(()=>Object.keys(h(S)).length>0),W=Rt(()=>[c.data.repo,c.data.id,...c.data.filePath.split("/")]);let rt=_t("");Ft(()=>{const m=`${c.data.repo}/${c.data.type}/${c.data.id}/${c.data.filePath}`;if(m!==h(rt)){if(h(rt)&&dt.flush(),I(rt,m),h(F)||h(l)){const p=xe(c.data.content);I(S,{...p.frontmatter},!0),I(L,p.content,!0)}else I(S,{},!0),I(L,c.data.content,!0);ie(Z),dt.reset()}}),Ft(()=>{const m=c.data.repo,p=c.data.type,t=c.data.id,e=c.data.filePath;se(()=>{Ut.select(m,p,t,e),Ut.showEntity()})});function ut(m){return/[\[\]{}'":,#|>&*!?]/.test(m)||/^\s|\s$/.test(m)}function X(){if(h(d)){const m=[];for(const[p,t]of Object.entries(h(S)))if(Array.isArray(t)){m.push(`${p}:`);for(const e of t){const r=String(e);m.push(` - ${ut(r)?`'${r}'`:r}`)}}else{const e=String(t??"");m.push(`${p}: ${ut(e)?`'${e}'`:e}`)}return`---
14
+ ${m.join(`
15
+ `)}
16
+ ---
17
+ ${h(L)}`}return h(L)}function $(){const m=X();dt.scheduleContentFileSave(c.data.repo,c.data.type,c.data.id,c.data.filePath,m)}function pt(m){I(L,m,!0),$()}function ht(m,p){I(S,{...h(S),[m]:p},!0),$()}function B(m){const{[m]:p,...t}=h(S);I(S,t,!0),$()}function bt(m,p){I(S,{...h(S),[m]:p},!0),$()}function gt(m,p){$()}function vt(m){for(const p of Gt.repos){const t=p.entities.find(e=>e.id===m);if(t){ue(`/${p.name}/${t.entityType}/${t.id}`);return}}le.showToast(`"${m}" is in a collection you don't have access to`)}function nt(m){(m.metaKey||m.ctrlKey)&&m.key==="s"&&(m.preventDefault(),dt.flush())}$t("keydown",ae,nt),he(O,{children:(m,p)=>{var t=ze(),e=Q(t),r=Q(e);fe(r,{activeView:"entity"});var s=G(r,2),a=Q(s);Ot(a,21,()=>h(W),xt,(_,T,U)=>{var k=Pe(),C=Ht(k);{var j=q=>{var x=De();ot(q,x)};kt(C,q=>{U>0&&q(j)})}var g=G(C),M=Q(g,!0);N(g),At(()=>{Zt(g,1,Yt(U===h(W).length-1?"bc-current":"bc-segment"),"svelte-xtfs5g"),qt(M,h(T))}),ot(_,k)}),N(a);var y=G(a,2),z=Q(y);{var J=_=>{var T=Fe();ot(_,T)},i=_=>{var T=Le(),U=Q(T,!0);N(T),At(()=>qt(U,dt.error)),ot(_,T)};kt(z,_=>{dt.saving?_(J):dt.error&&_(i,1)})}N(y),N(s);var n=G(s,2),u=Q(n);{var f=_=>{ce(_,{get properties(){return h(tt)},editable:!0,onedit:ht,onremove:B,onadd:bt,ontypechange:gt})};kt(u,_=>{h(d)&&_(f)})}var A=G(u,2);{var v=_=>{Oe(_,{get content(){return h(L)},onchange:pt,onsave:()=>dt.flush()})},b=_=>{pe(_,{get content(){return h(L)},readonly:!1,onchange:pt,onsave:()=>dt.flush(),onwikilinkclick:vt,get resetKey(){return h(Z)}})};kt(A,_=>{h(l)?_(v):_(b,!1)})}N(n),N(e);var o=G(e,2);{var D=_=>{de(_,{})};kt(o,_=>{w.open&&_(D)})}N(t),ot(m,t)},$$slots:{default:!0}}),Qt()}export{Ve as component,Je as universal};
@@ -1,4 +1,4 @@
1
- import{f as dt,s as J,w as ut}from"../chunks/m74CvwCG.js";import{a as k,s as Z,f as M,c as ft}from"../chunks/BfTJ6NzK.js";import{p as $,D as tt,_ as mt,o as T,q as H,y as h,u as I,v as O,n as et,z as Q,x as S,f as vt,V as ht}from"../chunks/GRkK54yd.js";import{b as X,i as j}from"../chunks/trveDs8t.js";import{A as yt}from"../chunks/B3v6bkHV.js";import{g as pt}from"../chunks/BzhnXU6Q.js";import{n as Y}from"../chunks/CRcLi9EQ.js";const bt=async({params:g})=>{const{repo:o,type:l,id:c}=g,f=await dt(o,l,c);return{repo:o,type:l,id:c,entity:f}},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 At(g,o){$(o,!0);let l,c,f=Q(!0),m=Q(null),p=[],b=[],w=[],d={},y=[],v=null,_=null,A=0;function q(){const e=window.StudioChrome,i=document.querySelector(".sg-chrome-overflow-menu");if(i&&(i.innerHTML=""),e&&(e.clearViewAction(),e.clearSaveHandlers()),_&&(_.el.removeEventListener("click",_.handler,!0),_=null),e){e.unmountHeader();for(const{event:r,fn:s}of w)e.off(r,s)}w=[];for(const r of p)r.remove();p=[];for(const r of b)r.remove();b=[],v&&(v.remove(),v=null);for(const[r,s]of Object.entries(d))s===void 0?document.body.removeAttribute(r):document.body.setAttribute(r,s);d={};for(const r of y)document.body.classList.remove(r);y=[],c&&(c.innerHTML="")}async function F(){const e=++A;S(f,!0),S(m,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!==A)return;const s=await r.text(),P=new DOMParser().parseFromString(s,"text/html"),at=P.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),p.push(a)}const it=P.querySelectorAll("head style");for(const t of it){const n=document.createElement("style");n.textContent=t.textContent,document.head.appendChild(n),p.push(n)}v=document.createElement("style"),v.textContent=`
1
+ import{f as dt,s as J,w as ut}from"../chunks/ByFfmBEu.js";import{a as k,s as Z,f as M,c as ft}from"../chunks/CjKjQEMp.js";import{p as $,D as tt,_ as mt,o as T,q as H,y as h,u as I,v as O,n as et,z as Q,x as S,f as vt,V as ht}from"../chunks/D-tW7Byc.js";import{b as X,i as j}from"../chunks/EhE2EcYu.js";import{A as yt}from"../chunks/CICthOLY.js";import{g as pt}from"../chunks/C5cMwwSn.js";import{n as Y}from"../chunks/pwrC_shA.js";const bt=async({params:g})=>{const{repo:o,type:l,id:c}=g,f=await dt(o,l,c);return{repo:o,type:l,id:c,entity:f}},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 At(g,o){$(o,!0);let l,c,f=Q(!0),m=Q(null),p=[],b=[],w=[],d={},y=[],v=null,_=null,A=0;function q(){const e=window.StudioChrome,i=document.querySelector(".sg-chrome-overflow-menu");if(i&&(i.innerHTML=""),e&&(e.clearViewAction(),e.clearSaveHandlers()),_&&(_.el.removeEventListener("click",_.handler,!0),_=null),e){e.unmountHeader();for(const{event:r,fn:s}of w)e.off(r,s)}w=[];for(const r of p)r.remove();p=[];for(const r of b)r.remove();b=[],v&&(v.remove(),v=null);for(const[r,s]of Object.entries(d))s===void 0?document.body.removeAttribute(r):document.body.setAttribute(r,s);d={};for(const r of y)document.body.classList.remove(r);y=[],c&&(c.innerHTML="")}async function F(){const e=++A;S(f,!0),S(m,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!==A)return;const s=await r.text(),P=new DOMParser().parseFromString(s,"text/html"),at=P.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),p.push(a)}const it=P.querySelectorAll("head style");for(const t of it){const n=document.createElement("style");n.textContent=t.textContent,document.head.appendChild(n),p.push(n)}v=document.createElement("style"),v.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(v);const L=P.body;for(const t of Array.from(L.attributes))t.name.startsWith("data-")&&(d[t.name]=document.body.getAttribute(t.name)??void 0,document.body.setAttribute(t.name,t.value));const st=Array.from(L.classList);for(const t of st)t!=="sg-chrome-active"&&(document.body.classList.contains(t)||(document.body.classList.add(t),y.push(t)));const ct=L.querySelectorAll("script"),R=[],K=[];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}`),R.push(a)}else t.textContent&&K.push(t.textContent);t.remove()}c.innerHTML=L.innerHTML;const u=window.StudioChrome;if(u){u.updateBreadcrumb(o.repo,o.entityId),u.mountHeader(l);const t=document.body.dataset.sgViewUrl,n=document.body.dataset.sgViewLabel;t?u.setViewAction(t,n):u.clearViewAction();const a=l.querySelector(".sg-chrome-back");if(a){const N=G=>{G.preventDefault(),G.stopPropagation(),pt(`/${o.repo}/${o.entityType}/${o.entityId}`)};a.addEventListener("click",N,!0),_={el:a,handler:N}}}let E=null;u&&(E=u.on,u.on=function(t,n){w.push({event:t,fn:n}),E.call(this,t,n)});const lt=`?_v=${Date.now()}`;for(const t of R){if(e!==A)return;await ot(t+lt)}for(const t of K){if(e!==A)return;const n=document.createElement("script");n.textContent=t,document.body.appendChild(n),b.push(n)}u&&E&&(u.on=E),S(f,!1)}catch(i){if(e!==A)return;S(m,i.message||"Failed to load editor",!0),S(f,!1)}}function ot(e){return new Promise((i,r)=>{const s=document.createElement("script");s.src=e,s.onload=()=>i(),s.onerror=()=>r(new Error(`Failed to load script: ${e}`)),document.body.appendChild(s),b.push(s)})}let x="";tt(()=>{const e=`${o.appMountPath}|${o.repo}|${o.entityId}`;x&&x!==e&&c&&F(),x=e}),mt(()=>(F(),q));var C=_t();let V;var B=T(C);X(B,e=>l=e,()=>l);var W=H(B,2);{var nt=e=>{var i=gt();k(e,i)};j(W,e=>{h(f)&&e(nt)})}var D=H(W,2);{var rt=e=>{var i=wt(),r=T(i,!0);I(i),O(()=>Z(r,h(m))),k(e,i)};j(D,e=>{h(m)&&e(rt)})}var U=H(D,2);let z;X(U,e=>c=e,()=>c),I(C),O(()=>{V=J(C,1,"editor-frame svelte-1fltv0h",null,V,{loading:h(f)}),z=J(U,1,"editor-container svelte-1fltv0h",null,z,{hidden:h(f)||!!h(m)})}),k(g,C),et()}var St=M('<div class="no-editor svelte-bzivfp"> </div>');function It(g,o){$(o,!0);const l=ht(()=>ut.getAppForEntityType(o.data.type));tt(()=>{Y.select(o.data.repo,o.data.type,o.data.id),Y.showEntity()}),yt(g,{showSidebar:!1,children:(c,f)=>{var m=ft(),p=vt(m);{var b=d=>{At(d,{get appMountPath(){return h(l).mountPath},get repo(){return o.data.repo},get entityId(){return o.data.id},get entityType(){return o.data.type}})},w=d=>{var y=St(),v=T(y);I(y),O(()=>Z(v,`No app editor available for entity type "${o.data.type??""}"`)),k(d,y)};j(p,d=>{h(l)?d(b):d(w,!1)})}k(c,m)},$$slots:{default:!0}}),et()}export{It as component,Tt as universal};