@vite-hub/comments 0.8.0 → 0.9.0

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 (51) hide show
  1. package/dist/anchor.d.ts +2 -2
  2. package/dist/anchor.js +0 -1
  3. package/dist/{client-files-lC6X7XyS.js → client-files-CMPJEd21.js} +0 -1
  4. package/dist/client.d.ts +2 -2
  5. package/dist/client.js +2 -5
  6. package/dist/database.js +1 -1
  7. package/dist/{define-C-LUOouq.js → define-hs9Z38io.js} +0 -1
  8. package/dist/hosted/hosted-comments/frame.js +4 -4
  9. package/dist/hosted/hosted-comments/tools.js +59 -56
  10. package/dist/{index-d6NsDxu9.d.ts → index-CbXek64X.d.ts} +2 -2
  11. package/dist/index.d.ts +4 -4
  12. package/dist/index.js +3 -6
  13. package/dist/{install-BueV_fJY.js → install--HecUN5c.js} +2 -19
  14. package/dist/{install-F-_O7zDr.d.ts → install-C3CW6Vvw.d.ts} +4 -4
  15. package/dist/{migrate-oseJAYbm.js → migrate-cxoJK4JQ.js} +0 -18
  16. package/dist/{operations-jaihyWw2.d.ts → operations-D0EO1pzL.d.ts} +3 -7
  17. package/dist/{operations-0llC5kKO.js → operations-DHXmbtb3.js} +3 -30
  18. package/dist/operations.d.ts +2 -2
  19. package/dist/operations.js +2 -2
  20. package/dist/overlay/client-BszZKIf8.js +4 -0
  21. package/dist/overlay/overlay.js +38 -35
  22. package/dist/page/loader.js +14 -11
  23. package/dist/{page-CDhmXO-y.js → page-CJz1K67L.js} +1 -1
  24. package/dist/{page-BgvzzsJb.d.ts → page-DRM1j84-.d.ts} +1 -1
  25. package/dist/{path-8yqMd8zR.js → path-sv8kjq3i.js} +0 -4
  26. package/dist/{plugin-DGUqlc3C.js → plugin-DczA2K-y.js} +3 -3
  27. package/dist/realtime.d.ts +5 -5
  28. package/dist/realtime.js +2 -2
  29. package/dist/{rpc-kkxzQ3Qy.js → rpc-51X1TWKb.js} +1 -1
  30. package/dist/{rpc-D-eqtyfh.d.ts → rpc-DZB3yU0z.d.ts} +1 -1
  31. package/dist/rpc.d.ts +1 -1
  32. package/dist/rpc.js +1 -1
  33. package/dist/runtime/auth.d.ts +1 -1
  34. package/dist/runtime/console.js +2 -2
  35. package/dist/runtime/index.d.ts +6 -6
  36. package/dist/runtime/index.js +8 -30
  37. package/dist/server.d.ts +7 -7
  38. package/dist/server.js +6 -6
  39. package/dist/{service-DaMq8TBw.js → service-DFMwCr60.js} +2 -12
  40. package/dist/{service-CMVA_Ryv.d.ts → service-qaMuJ7UX.d.ts} +2 -2
  41. package/dist/{session-B7GDrqsK.js → session-1SI3_wLJ.js} +11 -30
  42. package/dist/{session-EzQqBeE8.d.ts → session-CK3Rnjto.d.ts} +2 -2
  43. package/dist/testing.d.ts +1 -1
  44. package/dist/testing.js +0 -1
  45. package/dist/{tokens-Bx4lZ0yt.js → tokens-WRh__ppm.js} +0 -1
  46. package/dist/{types-BX3vH18p.d.ts → types-BmzTyGt-.d.ts} +4 -0
  47. package/dist/{types-qzJKgWYS.d.ts → types-VSVs4jIw.d.ts} +1 -1
  48. package/dist/vite.d.ts +3 -3
  49. package/dist/vite.js +2 -33
  50. package/package.json +7 -7
  51. package/dist/overlay/client-ZBsUybIe.js +0 -4
@@ -5,7 +5,7 @@ button[aria-pressed=true],button[aria-expanded=true]{background:var(--vitehub-pi
5
5
  button:focus-visible{outline:2px solid var(--vitehub-pill-on);outline-offset:1px}
6
6
  button svg{width:14px;height:14px;flex:none}
7
7
  @media(any-pointer:coarse){button{min-width:44px;height:44px}}
8
- @media(prefers-reduced-motion:reduce){button{transition:none}}`;`${JSON.stringify([Zt,...Qt])}`;function rn(e){let t=new URL(e,`http://localhost`).pathname,n=t.lastIndexOf(`/_vitehub/page/assets/`);return n===-1?tn:`${t.slice(0,n)}${tn}`}function q(e){return typeof e==`string`&&e?e:void 0}function an(e){if(typeof e!=`object`||!e)return;let t=q(Reflect.get(e,`id`)),n=q(Reflect.get(e,`script`));if(!t||!n)return;let r={id:t,label:q(Reflect.get(e,`label`))??t,icon:q(Reflect.get(e,`icon`))??``,script:n};Reflect.get(e,`lazy`)===!0&&(r.lazy=!0);let i=q(Reflect.get(e,`hotkey`));i&&(r.hotkey=i);let a=q(Reflect.get(e,`param`));return a&&(r.param=a),r}function on(e){if(typeof e!=`object`||!e)return;let t=q(Reflect.get(e,`name`)),n=q(Reflect.get(e,`signOut`));if(!t||!n?.startsWith(`/`)||n.startsWith(`//`)||n.includes(`\\`))return;let r={name:t,signOut:n},i=q(Reflect.get(e,`email`));i&&(r.email=i);let a=q(Reflect.get(e,`image`));return a&&/^https?:\/\//i.test(a)&&(r.image=a),Reflect.get(e,`via`)===`console`&&(r.via=`console`),Reflect.get(e,`guest`)===!0&&(r.guest=!0),r}function sn(e){let t=typeof e==`object`&&e?Reflect.get(e,`tools`):void 0,n={tools:Array.isArray(t)?t.map(an).filter(e=>!!e):[]},r=typeof e==`object`&&e?on(Reflect.get(e,`account`)):void 0;return r&&(n.account=r),n}const J=/* @__PURE__ */ new Map;let cn;function ln(e,t){let n=e.parentElement;n&&!t.aborted&&(J.set(e,n),t.addEventListener(`abort`,()=>{J.delete(e),pn(e),J.size||(cn?.stop(),cn=void 0)},{once:!0}),cn??=un(),cn.refresh())}function un(){let e=new AbortController,t=/* @__PURE__ */ new Set([document]),n=/* @__PURE__ */ new Set,r=document.createElement(`div`);r.popover=`manual`,r.style.cssText=`all:initial!important;display:block!important;position:fixed!important;inset:0 auto auto 0!important;width:2px!important;height:2px!important;opacity:0!important`;let i=(e=!1)=>{let t=dn(n,r)??fn();for(let[n,r]of J){if(!n.parentElement)continue;let i=t??r;i.isConnected&&(n.parentElement!==i&&(pn(n),i.append(n)),t?typeof n.showPopover==`function`&&(e||!n.matches(`:popover-open`))&&(pn(n),n.popover=`manual`,n.showPopover()):pn(n))}},a=new MutationObserver(e=>{let c=!1,l=!1;for(let t of e){t.target instanceof HTMLDialogElement&&t.type===`attributes`&&(c=!0,t.target.matches(`:modal`)&&(l=!0));for(let e of t.addedNodes)e instanceof Element&&e.isConnected&&e!==r&&!(e instanceof HTMLElement&&J.has(e))&&s(e)&&(c=!0)}for(let e of n)e.isConnected||(n.delete(e),c=!0);let u=!1;for(let e of t)e instanceof ShadowRoot&&!e.host.isConnected&&(t.delete(e),u=!0);if(u){a.disconnect();for(let e of t)o(e)}(c||[...J.keys()].some(e=>!e.isConnected&&e.parentElement))&&i(l)});function o(e){a.observe(e,{attributes:!0,attributeFilter:[`open`],childList:!0,subtree:!0})}function s(e){let t=!1,r=e=>{e instanceof HTMLDialogElement&&!n.has(e)&&(n.add(e),t=!0),e.shadowRoot&&c(e.shadowRoot)&&(t=!0)};e instanceof Element&&r(e);for(let t of e.querySelectorAll(`*`))r(t);return t}function c(e){return!t.has(e)&&(t.add(e),o(e),s(e))}return o(document),document.addEventListener(`focusin`,t=>{let n=!1;for(let e of t.composedPath())e instanceof ShadowRoot&&e.mode===`open`&&c(e)&&(n=!0);n&&queueMicrotask(()=>{e.signal.aborted||i()})},{signal:e.signal}),document.addEventListener(`fullscreenchange`,()=>i(!0),{signal:e.signal}),{refresh(){s(document.documentElement),i()},stop(){a.disconnect(),e.abort()}}}function dn(e,t){let n=[...e].filter(e=>e.isConnected&&e.matches(`:modal`));return n.length<2||typeof t.showPopover!=`function`?n[0]:n.find(e=>{let n=e.getRootNode();e.append(t),t.showPopover();let r=(n instanceof ShadowRoot?n:document).elementFromPoint(1,1);return t.hidePopover(),t.remove(),r===t})}function fn(){let e=document.fullscreenElement;for(;e?.shadowRoot?.fullscreenElement&&e.shadowRoot.fullscreenElement!==e;)e=e.shadowRoot.fullscreenElement;return e}function pn(e){e.hasAttribute(`popover`)&&(e.matches(`:popover-open`)&&e.hidePopover(),e.removeAttribute(`popover`))}const Y={effects:[Ge]},mn=[[`0px`,`6px`],[`6px`,`0px`],[`calc(100% - 6px)`,`0px`],[`100%`,`6px`],[`100%`,`50%`],[`100%`,`50%`],[`100%`,`calc(100% - 6px)`],[`calc(100% - 6px)`,`100%`],[`6px`,`100%`],[`0px`,`calc(100% - 6px)`],[`0px`,`50%`],[`0px`,`50%`]],hn=e=>e.map(([e,t])=>[`calc(50% + var(--vitehub-hex-w) * ${e})`,`calc(50% + var(--vitehub-hex-h) * ${t})`]),gn=hn([[-.28,-.453],[-.208,-.5],[.208,-.5],[.28,-.453],[.488,-.047],[.488,.047],[.28,.453],[.208,.5],[-.208,.5],[-.28,.453],[-.488,.047],[-.488,-.047]]),_n=hn([[-.5,-.5],[-.5,-.5],[.5,-.5],[.5,-.5],[.5,0],[.5,0],[.5,.5],[.5,.5],[-.5,.5],[-.5,.5],[-.5,0],[-.5,0]]),vn=e=>`polygon(${e.map(([e,t])=>`${e} ${t}`).join(`,`)})`;function yn(e,t,n){let r=(1-n).toFixed(4),i=n.toFixed(4);return vn(e.map(([e,n],a)=>[`calc(${e} * ${r} + ${t[a][0]} * ${i})`,`calc(${n} * ${r} + ${t[a][1]} * ${i})`]))}const bn=`M19.734 8.156 15.576.844A1.66 1.66 0 0 0 14.135 0H5.819C5.226 0 4.677.32 4.38.844L.222 8.156a1.71 1.71 0 0 0 0 1.688l4.158 7.312c.297.523.846.844 1.439.844h8.316c.593 0 1.142-.32 1.438-.844l4.158-7.312c.3-.523.3-1.165.003-1.688Z`,xn=vn(mn),Sn=vn(gn),Cn=vn(_n),wn=e=>`calc(var(--start) + ${e} / 2 + (100% - var(--start) - var(--end) - ${e}) * var(--at) / 100)`,Tn=`:host{all:initial;position:fixed;z-index:2147483001;pointer-events:none;filter:drop-shadow(0 8px 24px rgb(0 0 0/25%));color-scheme:dark;font:500 12px/1 ui-sans-serif,system-ui,sans-serif;color:#d4d4d4;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;--vitehub-pill-text:#d4d4d4;--vitehub-pill-strong:#fafafa;--vitehub-pill-muted:#a3a3a3;--vitehub-pill-hover:rgb(255 255 255/8%);--vitehub-pill-on:#fafafa;--vitehub-pill-on-text:#0a0a0a;--vitehub-pill-line:rgb(255 255 255/12%);--vitehub-pill-surface:#111;--vitehub-pill-flow:row;--vitehub-hex-h:24px;--vitehub-hex-w:calc(var(--vitehub-hex-h) * 10 / 9);--vitehub-pill-fade:opacity 160ms ease-out 80ms,visibility 0s;--vitehub-pill-fade-end:opacity 160ms ease-out 120ms,visibility 0s;--at:50;--margin:16px;--safe-top:env(safe-area-inset-top,0px);--safe-right:env(safe-area-inset-right,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px)}
8
+ @media(prefers-reduced-motion:reduce){button{transition:none}}`;`${JSON.stringify([Zt,...Qt])}`;function rn(e){let t=new URL(e,`http://localhost`).pathname,n=t.lastIndexOf(`/_vitehub/page/assets/`);return n===-1?tn:`${t.slice(0,n)}${tn}`}function q(e){return typeof e==`string`&&e?e:void 0}function an(e){if(typeof e!=`object`||!e)return;let t=q(Reflect.get(e,`id`)),n=q(Reflect.get(e,`script`));if(!t||!n)return;let r={id:t,label:q(Reflect.get(e,`label`))??t,icon:q(Reflect.get(e,`icon`))??``,script:n};Reflect.get(e,`lazy`)===!0&&(r.lazy=!0);let i=q(Reflect.get(e,`hotkey`));i&&(r.hotkey=i);let a=q(Reflect.get(e,`param`));return a&&(r.param=a),r}function on(e){if(typeof e!=`object`||!e)return;let t=q(Reflect.get(e,`name`)),n=q(Reflect.get(e,`signOut`));if(!t||!n?.startsWith(`/`)||n.startsWith(`//`)||n.includes(`\\`))return;let r={name:t,signOut:n},i=q(Reflect.get(e,`email`));i&&(r.email=i);let a=q(Reflect.get(e,`image`));return a&&/^https?:\/\//i.test(a)&&(r.image=a),Reflect.get(e,`via`)===`console`&&(r.via=`console`),Reflect.get(e,`guest`)===!0&&(r.guest=!0),r}function sn(e){let t=typeof e==`object`&&e?Reflect.get(e,`tools`):void 0,n={tools:Array.isArray(t)?t.map(an).filter(e=>!!e):[]},r=typeof e==`object`&&e?on(Reflect.get(e,`account`)):void 0;return r&&(n.account=r),n}const J=/* @__PURE__ */ new Map;let cn;function ln(e,t){let n=e.parentElement;n&&!t.aborted&&(J.set(e,n),t.addEventListener(`abort`,()=>{J.delete(e),pn(e),J.size||(cn?.stop(),cn=void 0)},{once:!0}),cn??=un(),cn.refresh())}function un(){let e=new AbortController,t=/* @__PURE__ */ new Set([document]),n=/* @__PURE__ */ new Set,r=document.createElement(`div`);r.popover=`manual`,r.style.cssText=`all:initial!important;display:block!important;position:fixed!important;inset:0 auto auto 0!important;width:2px!important;height:2px!important;opacity:0!important`;let i=(e=!1)=>{let t=dn(n,r)??fn();for(let[n,r]of J){if(!n.parentElement)continue;let i=t??r;i.isConnected&&(n.parentElement!==i&&(pn(n),i.append(n)),t?typeof n.showPopover==`function`&&(e||!n.matches(`:popover-open`))&&(pn(n),n.popover=`manual`,n.showPopover()):pn(n))}},a=new MutationObserver(e=>{let c=!1,l=!1;for(let t of e){t.target instanceof HTMLDialogElement&&t.type===`attributes`&&(c=!0,t.target.matches(`:modal`)&&(l=!0));for(let e of t.addedNodes)e instanceof Element&&e.isConnected&&e!==r&&!(e instanceof HTMLElement&&J.has(e))&&s(e)&&(c=!0)}for(let e of n)e.isConnected||(n.delete(e),c=!0);let u=!1;for(let e of t)e instanceof ShadowRoot&&!e.host.isConnected&&(t.delete(e),u=!0);if(u){a.disconnect();for(let e of t)o(e)}(c||[...J.keys()].some(e=>!e.isConnected&&e.parentElement))&&i(l)});function o(e){a.observe(e,{attributes:!0,attributeFilter:[`open`],childList:!0,subtree:!0})}function s(e){let t=!1,r=e=>{e instanceof HTMLDialogElement&&!n.has(e)&&(n.add(e),t=!0),e.shadowRoot&&c(e.shadowRoot)&&(t=!0)};e instanceof Element&&r(e);for(let t of e.querySelectorAll(`*`))r(t);return t}function c(e){return!t.has(e)&&(t.add(e),o(e),s(e))}return o(document),document.addEventListener(`focusin`,t=>{let n=!1;for(let e of t.composedPath())e instanceof ShadowRoot&&e.mode===`open`&&c(e)&&(n=!0);n&&queueMicrotask(()=>{e.signal.aborted||i()})},{signal:e.signal}),document.addEventListener(`fullscreenchange`,()=>i(!0),{signal:e.signal}),{refresh(){s(document.documentElement),i()},stop(){a.disconnect(),e.abort()}}}function dn(e,t){let n=[...e].filter(e=>e.isConnected&&e.matches(`:modal`));return n.length<2||typeof t.showPopover!=`function`?n[0]:n.find(e=>{let n=e.getRootNode();e.append(t),t.showPopover();let r=(n instanceof ShadowRoot?n:document).elementFromPoint(1,1);return t.hidePopover(),t.remove(),r===t})}function fn(){let e=document.fullscreenElement;for(;e?.shadowRoot?.fullscreenElement&&e.shadowRoot.fullscreenElement!==e;)e=e.shadowRoot.fullscreenElement;return e}function pn(e){e.hasAttribute(`popover`)&&(e.matches(`:popover-open`)&&e.hidePopover(),e.removeAttribute(`popover`))}const Y={effects:[Ge]},mn=[[`0px`,`6px`],[`6px`,`0px`],[`calc(100% - 6px)`,`0px`],[`100%`,`6px`],[`100%`,`50%`],[`100%`,`50%`],[`100%`,`calc(100% - 6px)`],[`calc(100% - 6px)`,`100%`],[`6px`,`100%`],[`0px`,`calc(100% - 6px)`],[`0px`,`50%`],[`0px`,`50%`]],hn=e=>e.map(([e,t])=>[`calc(50% + var(--vitehub-hex-w) * ${e})`,`calc(50% + var(--vitehub-hex-h) * ${t})`]),gn=hn([[-.28,-.453],[-.208,-.5],[.208,-.5],[.28,-.453],[.488,-.047],[.488,.047],[.28,.453],[.208,.5],[-.208,.5],[-.28,.453],[-.488,.047],[-.488,-.047]]),_n=hn([[-.5,-.5],[-.5,-.5],[.5,-.5],[.5,-.5],[.5,0],[.5,0],[.5,.5],[.5,.5],[-.5,.5],[-.5,.5],[-.5,0],[-.5,0]]),vn=e=>`polygon(${e.map(([e,t])=>`${e} ${t}`).join(`,`)})`;function yn(e,t,n){let r=(1-n).toFixed(4),i=n.toFixed(4);return vn(e.map(([e,n],a)=>[`calc(${e} * ${r} + ${t[a][0]} * ${i})`,`calc(${n} * ${r} + ${t[a][1]} * ${i})`]))}const bn=`M19.734 8.156 15.576.844A1.66 1.66 0 0 0 14.135 0H5.819C5.226 0 4.677.32 4.38.844L.222 8.156a1.71 1.71 0 0 0 0 1.688l4.158 7.312c.297.523.846.844 1.439.844h8.316c.593 0 1.142-.32 1.438-.844l4.158-7.312c.3-.523.3-1.165.003-1.688Z`,xn=vn(mn),Sn=vn(gn),Cn=vn(_n),wn=e=>`calc(var(--start) + ${e} / 2 + (100% - var(--start) - var(--end) - ${e}) * var(--at) / 100)`,Tn=`:host{all:initial;position:fixed;z-index:2147483001;pointer-events:none;filter:drop-shadow(0 8px 24px rgb(0 0 0/25%));color-scheme:dark;font:500 12px/1 ui-sans-serif,system-ui,sans-serif;color:#d4d4d4;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;--vitehub-pill-text:#d4d4d4;--vitehub-pill-strong:#fafafa;--vitehub-pill-muted:#a3a3a3;--vitehub-pill-hover:rgb(255 255 255/8%);--vitehub-pill-on:#fafafa;--vitehub-pill-on-text:#0a0a0a;--vitehub-pill-line:rgb(255 255 255/12%);--vitehub-pill-surface:#111;--vitehub-pill-flow:row;--vitehub-hex-h:20px;--vitehub-hex-w:calc(var(--vitehub-hex-h) * 10 / 9);--vitehub-pill-fade:opacity 160ms ease-out 80ms,visibility 0s;--vitehub-pill-fade-end:opacity 160ms ease-out 120ms,visibility 0s;--at:50;--margin:16px;--safe-top:env(safe-area-inset-top,0px);--safe-right:env(safe-area-inset-right,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px)}
9
9
  :host([collapsed]){--margin:2px;--vitehub-pill-fade:opacity 80ms ease-out,visibility 0s 80ms;--vitehub-pill-fade-end:opacity 40ms ease-out,visibility 0s 40ms}
10
10
  :host(:is([edge=top],[edge=bottom])){left:${wn(`0px`)};width:max-content;--start:max(var(--margin),var(--safe-left));--end:max(var(--margin),var(--safe-right));--x:calc(var(--at) * -1%)}
11
11
  :host(:is([edge=left],[edge=right])){top:${wn(`0px`)};--start:max(var(--margin),var(--safe-top));--end:max(var(--margin),var(--safe-bottom));--y:calc(var(--at) * -1%);--vitehub-pill-flow:column;--vitehub-pill-justify:flex-start}
@@ -71,17 +71,20 @@ button{flex-shrink:0;padding:0;justify-content:center}
71
71
  :host([fold=mark]) .mark svg{transition:none}
72
72
  :host([fold=mark][collapsed]) .mark svg{opacity:1;transform:scale(1.5)}
73
73
  @media(any-pointer:coarse){:host{--vitehub-hex-h:40px}:host([fold=mark][collapsed]) .mark svg{transform:scale(2.5)}}
74
- @media(prefers-reduced-motion:reduce){:host,div,::slotted(*),.exit,.mark svg,:host([fold=mark]) :is(div,.mark){transition:none}}`;function X(e,t,n){let r=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);for(let[t,i]of Object.entries({viewBox:e,"aria-hidden":`true`,...n}))r.setAttribute(t,i);let i=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);return i.setAttribute(`d`,t),r.append(i),r}function En(){let e=X(`0 0 20 18`,bn,{class:`pill-hexagon`}),t=e.querySelector(`path`);return t.setAttribute(`stroke-width`,`2`),t.setAttribute(`vector-effect`,`non-scaling-stroke`),e}const Dn=[`top`,`right`,`bottom`,`left`];function On(e){return Dn.some(t=>t===e)}function kn(e){let t=typeof e==`object`&&e?Reflect.get(e,`edge`):void 0,n=typeof e==`object`&&e?Reflect.get(e,`at`):void 0;return On(t)&&typeof n==`number`&&n>=0&&n<=100?{edge:t,at:n}:void 0}function An(e){try{return kn(JSON.parse(localStorage.getItem(e)??`null`))}catch{return}}function jn(e,t,n,r){let i=Math.min(70,r/4),a=Math.atan2(t-r/2,e-n/2),o=Math.atan2(i-r/2,-n/2),s=Math.atan2(i-r/2,n/2),c=Math.atan2(r/2-i,n/2),l=Math.atan2(r/2-i,-n/2);return a>=o&&a<=s?`top`:a>s&&a<c?`right`:a>=c&&a<=l?`bottom`:`left`}function Mn(e,t,n,r,i){let a=i-n-r-t,o=a>0?Math.min(100,Math.max(0,(e-n-t/2)/a*100)):50;return o<2?0:o>98?100:Math.abs(o-50)<3?50:Math.round(o*10)/10}function Nn(e,t,n,r={top:0,right:0,bottom:0,left:0},i=0){let a=e.width-Math.max(16,r.left)-Math.max(16,r.right),o=e.width>640?Math.max(12,r.top)+40:r.top,s=t=>e.height-o-Math.max(Math.max(16,r.bottom)+t,i)-8;return a-t.width-8>=300?{fit:`beside`,width:a-t.width-8,height:s(n?54:38)}:s(t.height)>=240?{fit:`above`,width:a,height:s(t.height)}:{fit:`fold`,width:a,height:s(n?54:38)}}const Pn=/* @__PURE__ */ new WeakMap;function Fn(e){let t=e?getComputedStyle(e).transform:`none`,n=/^matrix\(([^,]+)/.exec(t)?.[1];return n&&Number.parseFloat(n)||1}function In(e,t,n,r,i){let a=()=>e.getAttribute(`fold`)===`mark`?_n:gn,s=()=>n.querySelector(`svg`),l={x:0,y:0},u=1,d=!1,f,p=[],m=()=>{if(e.toggleAttribute(`folding`,d||g.active),!d&&!g.active&&!_.active&&!v.active){P(t,{"clip-path":null}),P(e,{translate:null}),P(n,{translate:null});let r=s();r&&P(r,{scale:null});for(let e of p)e();p=[],i();return}let r=e.hasAttribute(`collapsed`),o=g.value;P(t,{"clip-path":d||g.active?yn(mn,a(),o):null}),P(e,{translate:`${_.value.toFixed(2)}px ${v.value.toFixed(2)}px`});let c=r?l:{x:0,y:0};P(n,{translate:`${(l.x*o-c.x).toFixed(2)}px ${(l.y*o-c.y).toFixed(2)}px`});let f=s();f&&P(f,{scale:((1+(u-1)*o)/(r?u:1)).toFixed(4)})},g=x(0,m,c.snappy),_=x(0,m,c.snappy),v=x(0,m,c.snappy),y=()=>{let e=t.getBoundingClientRect();return{x:e.left+e.width/2-_.value,y:e.top+e.height/2-v.value}},b=()=>{l={x:Number.parseFloat(n.style.getPropertyValue(`--vitehub-mark-x`))||0,y:Number.parseFloat(n.style.getPropertyValue(`--vitehub-mark-y`))||0},e.hasAttribute(`collapsed`)&&(u=Fn(s()))};return{get moving(){return d||g.active||_.active||v.active},move(t,n=0){r();let i=new Promise(e=>p.push(e)),a=y(),s=e.hasAttribute(`collapsed`);b(),t(),b();let l=y(),u=e.hasAttribute(`collapsed`);clearTimeout(f),d=!0;for(let[e,t]of[[_,a.x-l.x+_.value],[v,a.y-l.y+v.value]]){let n=e.velocity;e.set(t),n&&e.to(t,{velocity:n})}g.active||g.set(+!!s);let m=()=>{d=!1,_.to(0,{preset:c.snappy}),v.to(0,{preset:c.snappy}),g.to(+!!u,{preset:c.snappy})};return n>0&&!o()?f=setTimeout(m,n*h()):m(),i}}}function Ln(e){let{signal:t}=e,n=document.createElement(e.name);n.style.viewTransitionName=e.name,e.fold===`mark`&&n.setAttribute(`fold`,`mark`);let r=n.attachShadow({mode:`open`}),i=document.createElement(`style`);i.textContent=Tn;let a=document.createElement(`div`);a.setAttribute(`role`,`toolbar`),a.setAttribute(`aria-label`,e.label),e.fold!==`mark`&&a.append(En());let o=document.createElement(`button`);o.className=`mark`,o.dataset.motionPress=``,o.append(e.mark);let s=e.initial?.collapsed===!0,l=t=>{t&&a.scrollTo(0,0),n.toggleAttribute(`collapsed`,t),t&&e.fold!==`mark`?o.dataset.motionPressTarget=`[role=toolbar]`:delete o.dataset.motionPressTarget,o.setAttribute(`aria-expanded`,String(!t)),o.setAttribute(`aria-label`,`${t?`Show`:`Hide`} ${e.label}`),o.title=`${o.getAttribute(`aria-label`)}. Drag to move.`},u=()=>e.markOnly?.active()===!0,d=e.markOnly?.opened===!0,f=()=>u()?!d:Bn(e.storage.collapsed)??s;l(f());let p=e=>{let t=y,r=e&&n.contains(document.activeElement);b=void 0,e&&t.edge!==`bottom`&&S(v)&&(b=t),I.move(()=>{l(e),A(v)},e&&!n.hasAttribute(`collapsed`)?40:0).then(()=>{b&&(b=void 0,n.hasAttribute(`collapsed`)&&A(v))}),r&&o.focus({preventScroll:!0})};o.addEventListener(`click`,()=>{if(ee())return;let t=!n.hasAttribute(`collapsed`);if(E=!1,p(t),!t&&O()&&e.windows?.hide(),u())d=!t;else try{t===s?localStorage.removeItem(e.storage.collapsed):localStorage.setItem(e.storage.collapsed,t?`1`:`0`)}catch{}});let m=e.exit,h;m&&(h=document.createElement(`button`),h.className=`exit`,h.dataset.motionPress=``,h.setAttribute(`aria-label`,m.label),h.title=m.label,h.append(X(`0 0 24 24`,`M18 6 6 18M6 6l12 12`,{width:`15`,height:`15`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`})),m.menu||h.addEventListener(`click`,e=>m.press(e.detail===0))),a.append(o,...h?[h]:[]);let g=document.createElement(`slot`);g.name=`tab`,g.className=`tabs`;let _=document.createElement(`span`);_.className=`page-bar`,r.append(i,g,a,_),h&&m?.menu&&r.append(...m.menu(h));for(let t of e.slots){let e=document.createElement(`slot`);e.name=t,a.insertBefore(e,h??null)}let v=An(e.storage.dock)??e.initial?.dock??{edge:`bottom`,at:50},y=v,b,S=e=>u()&&!n.hasAttribute(`dragging`)&&e.edge===`bottom`?{edge:`bottom`,at:e.at<50?0:100}:void 0,C=()=>y.edge===`left`||y.edge===`right`,w=matchMedia(`(any-pointer: coarse)`),T={width:0,height:0},E=!1,D=()=>{let e=getComputedStyle(n),t=t=>Number.parseFloat(e.getPropertyValue(`--safe-${t}`))||0,r=Number.parseFloat(getComputedStyle(_).height)||0;return Nn({width:innerWidth,height:innerHeight},T,w.matches,{top:t(`top`),right:t(`right`),bottom:t(`bottom`),left:t(`left`)},r)},O=()=>e.windows?.shown()===!0&&S(v)!==void 0&&D().fit===`fold`,k=()=>{let e=!f()&&O();e===E||n.hasAttribute(`dragging`)||(E=e,p(f()||E))},A=t=>{v=t;let r=n.hasAttribute(`collapsed`),i=S(t);y=i?r?b??i:{edge:i.at===0?`left`:`right`,at:100}:t,n.setAttribute(`edge`,y.edge),a.setAttribute(`aria-orientation`,y.edge===`left`||y.edge===`right`?`vertical`:`horizontal`),n.style.setProperty(`--at`,String(y.at));let s=Z(n),c=r?C()?s.width:s.height:C()?a.offsetWidth:a.offsetHeight;i&&!r&&(T={width:a.offsetWidth,height:a.offsetHeight});let l=i&&!r&&D().fit===`beside`?{beside:T.width+8}:{thickness:a.offsetHeight};e.onPlace?.(i?{...i,collapsed:!1,...l}:{...y,collapsed:r,thickness:c}),o.style.setProperty(`--vitehub-mark-x`,`${a.clientWidth/2-o.offsetLeft-o.offsetWidth/2}px`),o.style.setProperty(`--vitehub-mark-y`,`${a.clientHeight/2-o.offsetTop-o.offsetHeight/2}px`)},ee=zn({host:n,handle:o,dock:()=>v,shape:e=>{let t=n.hasAttribute(`collapsed`),r=t?e?n.offsetHeight:n.offsetWidth:e?a.offsetHeight:a.offsetWidth;return{size:r,lead:t?r/2:e?o.offsetTop+o.offsetHeight/2:o.offsetLeft+o.offsetWidth/2,part:t?e?Z(n).height:Z(n).width:r,margin:t?2:16}},place:A,drop:()=>{I.move(()=>A(v)).then(k);try{localStorage.setItem(e.storage.dock,JSON.stringify({edge:v.edge,at:v.at}))}catch{}},signal:t}),j=Xt(a,{items:()=>[o,...[...n.children].filter(e=>e instanceof HTMLElement&&e.slot!==`tab`),...h?[h]:[]],movesOnly:!0}),M={width:0,height:0},N={top:0,right:0,bottom:0,left:0},F=x(0,(e,t)=>{P(a,{"clip-path":t===0&&e===0?null:`inset(${[N.top,N.right,N.bottom,N.left].map(t=>`${(t*e).toFixed(2)}px`).join(` `)} round 12px)`})},c.snappy),I=In(n,a,o,()=>F.stop(),()=>j.measure());Pn.set(n,I);let L=[B(n,Y),B(r,Y)];if(t.aborted){for(let e of L)e();return n}let R=new ResizeObserver(e=>{if(A(v),k(),!e.some(e=>e.target===a))return;let t=M;if(M={width:a.offsetWidth,height:a.offsetHeight},n.hasAttribute(`collapsed`)||n.hasAttribute(`dragging`)||I.moving)return;if(!t.width)return j.measure();j.play(),j.measure();let r={x:M.width-t.width,y:M.height-t.height},i={x:C()?y.edge===`right`?r.x:0:r.x*y.at/100,y:C()?r.y*y.at/100:y.edge===`bottom`?r.y:0};N={top:Math.max(0,i.y),right:Math.max(0,r.x-i.x),bottom:Math.max(0,r.y-i.y),left:Math.max(0,i.x)},(N.top||N.right||N.bottom||N.left)&&(F.set(1),F.to(0,{preset:c.snappy}))});return t.addEventListener(`abort`,()=>{n.remove(),R.disconnect(),F.stop(),j.destroy();for(let e of L)e()},{once:!0}),(e.parent??document.documentElement).append(n),ln(n,t),A(v),t.aborted||(R.observe(a),R.observe(_),addEventListener(`resize`,()=>{A(v),k()},{signal:t}),e.windows?.watch(k,t),e.markOnly?.watch(()=>{d=!1,E=!1,p(f())},t)),n}async function Rn(e){if(e.inert=!0,e.hasAttribute(`collapsed`)||matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=e.shadowRoot?.querySelector(`div`),n=Pn.get(e);if(!t?.offsetWidth||!n){e.setAttribute(`collapsed`,``);return}Object.assign(t.style,{width:`${t.offsetWidth}px`,height:`${t.offsetHeight}px`});let r=n.move(()=>e.setAttribute(`collapsed`,``),40);await Promise.race([r,new Promise(e=>setTimeout(e,600*h()))])}function zn(e){let{host:t,handle:n}=e,r,i=!1;return n.style.touchAction=`none`,n.addEventListener(`pointerdown`,a=>{if(a.button!==0||r!==void 0)return;r=a.pointerId,i=!1;let o=n.getBoundingClientRect(),s={x:a.clientX-o.left-o.width/2,y:a.clientY-o.top-o.height/2};n.setPointerCapture(a.pointerId);let c=n=>{if(n.pointerId!==a.pointerId||!i&&Math.hypot(n.clientX-a.clientX,n.clientY-a.clientY)<4)return;i=!0,t.setAttribute(`dragging`,``);let r=document.documentElement.clientWidth,o=document.documentElement.clientHeight,c=n.clientX-s.x,l=n.clientY-s.y,u=jn(c,l,r,o);u!==t.getAttribute(`edge`)&&e.place({edge:u,at:e.dock().at});let d=u===`left`||u===`right`,{size:f,lead:p,part:m,margin:h}=e.shape(d),g=(d?l:c)-p+f/2,_=getComputedStyle(t),v=Math.max(h,Number.parseFloat(_.getPropertyValue(d?`--safe-top`:`--safe-left`))||0),y=Math.max(h,Number.parseFloat(_.getPropertyValue(d?`--safe-bottom`:`--safe-right`))||0);e.place({edge:u,at:Mn(g,m,v,y,d?o:r)})};n.addEventListener(`pointermove`,c);let l=o=>{o.pointerId===a.pointerId&&(n.removeEventListener(`pointermove`,c),n.removeEventListener(`lostpointercapture`,l),r=void 0,i&&(t.removeAttribute(`dragging`),e.drop(),setTimeout(()=>{i=!1})))};n.addEventListener(`lostpointercapture`,l)},{signal:e.signal}),()=>i}function Z(e){let t=Number.parseFloat(getComputedStyle(e).getPropertyValue(`--vitehub-hex-h`))||24;return{width:t*10/9,height:t}}function Bn(e){try{let t=localStorage.getItem(e);return t===`1`||t!==`0`&&void 0}catch{return}}const Vn=`[role=menu]{position:fixed;inset:auto;box-sizing:border-box;width:max-content;min-width:min(220px,var(--menu-width));max-width:min(300px,var(--menu-width));margin:0;padding:6px;overflow:auto;overscroll-behavior:contain;border:1px solid var(--vitehub-pill-line);border-radius:12px;background:#171717;color:var(--vitehub-pill-text);font:500 13px/1.3 ui-sans-serif,system-ui,sans-serif;box-shadow:0 16px 40px rgb(0 0 0/30%);color-scheme:dark;pointer-events:auto}
75
- [role=menuitem]{display:flex;width:100%;height:32px;justify-content:flex-start;gap:8px;font-size:13px}
76
- [role=menuitem] svg{width:15px;height:15px;flex:none;color:var(--vitehub-pill-muted)}
77
- [role=menuitem] span{overflow:hidden;text-overflow:ellipsis}
78
- [role=menuitem][hidden]{display:none}
79
- [role=menuitem][aria-disabled=true]{cursor:progress}
80
- [role=menuitem] kbd{margin-left:auto;padding-left:16px;font:inherit;font-size:11px;color:var(--vitehub-pill-muted)}
74
+ @media(prefers-reduced-motion:reduce){:host,div,::slotted(*),.exit,.mark svg,:host([fold=mark]) :is(div,.mark){transition:none}}`;function X(e,t,n){let r=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);for(let[t,i]of Object.entries({viewBox:e,"aria-hidden":`true`,...n}))r.setAttribute(t,i);let i=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);return i.setAttribute(`d`,t),r.append(i),r}function En(){let e=X(`0 0 20 18`,bn,{class:`pill-hexagon`}),t=e.querySelector(`path`);return t.setAttribute(`stroke-width`,`2`),t.setAttribute(`vector-effect`,`non-scaling-stroke`),e}const Dn=[`top`,`right`,`bottom`,`left`];function On(e){return Dn.some(t=>t===e)}function kn(e){let t=typeof e==`object`&&e?Reflect.get(e,`edge`):void 0,n=typeof e==`object`&&e?Reflect.get(e,`at`):void 0;return On(t)&&typeof n==`number`&&n>=0&&n<=100?{edge:t,at:n}:void 0}function An(e){try{return kn(JSON.parse(localStorage.getItem(e)??`null`))}catch{return}}function jn(e,t,n,r){let i=Math.min(70,r/4),a=Math.atan2(t-r/2,e-n/2),o=Math.atan2(i-r/2,-n/2),s=Math.atan2(i-r/2,n/2),c=Math.atan2(r/2-i,n/2),l=Math.atan2(r/2-i,-n/2);return a>=o&&a<=s?`top`:a>s&&a<c?`right`:a>=c&&a<=l?`bottom`:`left`}function Mn(e,t,n,r,i){let a=i-n-r-t,o=a>0?Math.min(100,Math.max(0,(e-n-t/2)/a*100)):50;return o<2?0:o>98?100:Math.abs(o-50)<3?50:Math.round(o*10)/10}function Nn(e,t,n,r={top:0,right:0,bottom:0,left:0},i=0){let a=e.width-Math.max(16,r.left)-Math.max(16,r.right),o=e.width>640?Math.max(12,r.top)+40:r.top,s=t=>e.height-o-Math.max(Math.max(16,r.bottom)+t,i)-8;return a-t.width-8>=300?{fit:`beside`,width:a-t.width-8,height:s(n?54:38)}:s(t.height)>=240?{fit:`above`,width:a,height:s(t.height)}:{fit:`fold`,width:a,height:s(n?54:38)}}const Pn=/* @__PURE__ */ new WeakMap;function Fn(e){let t=e?getComputedStyle(e).transform:`none`,n=/^matrix\(([^,]+)/.exec(t)?.[1];return n&&Number.parseFloat(n)||1}function In(e,t,n,r,i){let a=()=>e.getAttribute(`fold`)===`mark`?_n:gn,s=()=>n.querySelector(`svg`),l={x:0,y:0},u=1,d=!1,f,p=[],m=()=>{if(e.toggleAttribute(`folding`,d||g.active),!d&&!g.active&&!_.active&&!v.active){P(t,{"clip-path":null}),P(e,{translate:null}),P(n,{translate:null});let r=s();r&&P(r,{scale:null});for(let e of p)e();p=[],i();return}let r=e.hasAttribute(`collapsed`),o=g.value;P(t,{"clip-path":d||g.active?yn(mn,a(),o):null}),P(e,{translate:`${_.value.toFixed(2)}px ${v.value.toFixed(2)}px`});let c=r?l:{x:0,y:0};P(n,{translate:`${(l.x*o-c.x).toFixed(2)}px ${(l.y*o-c.y).toFixed(2)}px`});let f=s();f&&P(f,{scale:((1+(u-1)*o)/(r?u:1)).toFixed(4)})},g=x(0,m,c.snappy),_=x(0,m,c.snappy),v=x(0,m,c.snappy),y=()=>{let e=t.getBoundingClientRect();return{x:e.left+e.width/2-_.value,y:e.top+e.height/2-v.value}},b=()=>{l={x:Number.parseFloat(n.style.getPropertyValue(`--vitehub-mark-x`))||0,y:Number.parseFloat(n.style.getPropertyValue(`--vitehub-mark-y`))||0},e.hasAttribute(`collapsed`)&&(u=Fn(s()))};return{get moving(){return d||g.active||_.active||v.active},move(t,n=0){r();let i=new Promise(e=>p.push(e)),a=y(),s=e.hasAttribute(`collapsed`);b(),t(),b();let l=y(),u=e.hasAttribute(`collapsed`);clearTimeout(f),d=!0;for(let[e,t]of[[_,a.x-l.x+_.value],[v,a.y-l.y+v.value]]){let n=e.velocity;e.set(t),n&&e.to(t,{velocity:n})}g.active||g.set(+!!s);let m=()=>{d=!1,_.to(0,{preset:c.snappy}),v.to(0,{preset:c.snappy}),g.to(+!!u,{preset:c.snappy})};return n>0&&!o()?f=setTimeout(m,n*h()):m(),i}}}function Ln(e){let{signal:t}=e,n=document.createElement(e.name);n.style.viewTransitionName=e.name,e.fold===`mark`&&n.setAttribute(`fold`,`mark`);let r=n.attachShadow({mode:`open`}),i=document.createElement(`style`);i.textContent=Tn;let a=document.createElement(`div`);a.setAttribute(`role`,`toolbar`),a.setAttribute(`aria-label`,e.label),e.fold!==`mark`&&a.append(En());let o=document.createElement(`button`);o.className=`mark`,o.dataset.motionPress=``,o.append(e.mark);let s=e.initial?.collapsed===!0,l=t=>{t&&a.scrollTo(0,0),n.toggleAttribute(`collapsed`,t),t&&e.fold!==`mark`?o.dataset.motionPressTarget=`[role=toolbar]`:delete o.dataset.motionPressTarget,o.setAttribute(`aria-expanded`,String(!t)),o.setAttribute(`aria-label`,`${t?`Show`:`Hide`} ${e.label}`),o.title=`${o.getAttribute(`aria-label`)}. Drag to move.`},u=()=>e.markOnly?.active()===!0,d=e.markOnly?.opened===!0,f=()=>u()?!d:Bn(e.storage.collapsed)??s;l(f());let p=e=>{let t=y,r=e&&n.contains(document.activeElement);b=void 0,e&&t.edge!==`bottom`&&S(v)&&(b=t),I.move(()=>{l(e),A(v)},e&&!n.hasAttribute(`collapsed`)?40:0).then(()=>{b&&(b=void 0,n.hasAttribute(`collapsed`)&&A(v))}),r&&o.focus({preventScroll:!0})};o.addEventListener(`click`,()=>{if(ee())return;let t=!n.hasAttribute(`collapsed`);if(E=!1,p(t),!t&&O()&&e.windows?.hide(),u())d=!t;else try{t===s?localStorage.removeItem(e.storage.collapsed):localStorage.setItem(e.storage.collapsed,t?`1`:`0`)}catch{}});let m=e.exit,h;m&&(h=document.createElement(`button`),h.className=`exit`,h.dataset.motionPress=``,h.setAttribute(`aria-label`,m.label),h.title=m.label,h.append(X(`0 0 24 24`,`M18 6 6 18M6 6l12 12`,{width:`15`,height:`15`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`})),m.menu||h.addEventListener(`click`,e=>m.press(e.detail===0))),a.append(o,...h?[h]:[]);let g=document.createElement(`slot`);g.name=`tab`,g.className=`tabs`;let _=document.createElement(`span`);_.className=`page-bar`,r.append(i,g,a,_),h&&m?.menu&&r.append(...m.menu(h));for(let t of e.slots){let e=document.createElement(`slot`);e.name=t,a.insertBefore(e,h??null)}let v=An(e.storage.dock)??e.initial?.dock??{edge:`bottom`,at:50},y=v,b,S=e=>u()&&!n.hasAttribute(`dragging`)&&e.edge===`bottom`?{edge:`bottom`,at:e.at<50?0:100}:void 0,C=()=>y.edge===`left`||y.edge===`right`,w=matchMedia(`(any-pointer: coarse)`),T={width:0,height:0},E=!1,D=()=>{let e=getComputedStyle(n),t=t=>Number.parseFloat(e.getPropertyValue(`--safe-${t}`))||0,r=Number.parseFloat(getComputedStyle(_).height)||0;return Nn({width:innerWidth,height:innerHeight},T,w.matches,{top:t(`top`),right:t(`right`),bottom:t(`bottom`),left:t(`left`)},r)},O=()=>e.windows?.shown()===!0&&S(v)!==void 0&&D().fit===`fold`,k=()=>{let e=!f()&&O();e===E||n.hasAttribute(`dragging`)||(E=e,p(f()||E))},A=t=>{v=t;let r=n.hasAttribute(`collapsed`),i=S(t);y=i?r?b??i:{edge:i.at===0?`left`:`right`,at:100}:t,n.setAttribute(`edge`,y.edge),a.setAttribute(`aria-orientation`,y.edge===`left`||y.edge===`right`?`vertical`:`horizontal`),n.style.setProperty(`--at`,String(y.at));let s=Z(n),c=r?C()?s.width:s.height:C()?a.offsetWidth:a.offsetHeight;i&&!r&&(T={width:a.offsetWidth,height:a.offsetHeight});let l=i&&!r&&D().fit===`beside`?{beside:T.width+8}:{thickness:a.offsetHeight};e.onPlace?.(i?{...i,collapsed:!1,...l}:{...y,collapsed:r,thickness:c}),o.style.setProperty(`--vitehub-mark-x`,`${a.clientWidth/2-o.offsetLeft-o.offsetWidth/2}px`),o.style.setProperty(`--vitehub-mark-y`,`${a.clientHeight/2-o.offsetTop-o.offsetHeight/2}px`)},ee=zn({host:n,handle:o,dock:()=>v,shape:e=>{let t=n.hasAttribute(`collapsed`),r=t?e?n.offsetHeight:n.offsetWidth:e?a.offsetHeight:a.offsetWidth;return{size:r,lead:t?r/2:e?o.offsetTop+o.offsetHeight/2:o.offsetLeft+o.offsetWidth/2,part:t?e?Z(n).height:Z(n).width:r,margin:t?2:16}},place:A,drop:()=>{I.move(()=>A(v)).then(k);try{localStorage.setItem(e.storage.dock,JSON.stringify({edge:v.edge,at:v.at}))}catch{}},signal:t}),j=Xt(a,{items:()=>[o,...[...n.children].filter(e=>e instanceof HTMLElement&&e.slot!==`tab`),...h?[h]:[]],movesOnly:!0}),M={width:0,height:0},N={top:0,right:0,bottom:0,left:0},F=x(0,(e,t)=>{P(a,{"clip-path":t===0&&e===0?null:`inset(${[N.top,N.right,N.bottom,N.left].map(t=>`${(t*e).toFixed(2)}px`).join(` `)} round 12px)`})},c.snappy),I=In(n,a,o,()=>F.stop(),()=>j.measure());Pn.set(n,I);let L=[B(n,Y),B(r,Y)];if(t.aborted){for(let e of L)e();return n}let R=new ResizeObserver(e=>{if(A(v),k(),!e.some(e=>e.target===a))return;let t=M;if(M={width:a.offsetWidth,height:a.offsetHeight},n.hasAttribute(`collapsed`)||n.hasAttribute(`dragging`)||I.moving)return;if(!t.width)return j.measure();j.play(),j.measure();let r={x:M.width-t.width,y:M.height-t.height},i={x:C()?y.edge===`right`?r.x:0:r.x*y.at/100,y:C()?r.y*y.at/100:y.edge===`bottom`?r.y:0};N={top:Math.max(0,i.y),right:Math.max(0,r.x-i.x),bottom:Math.max(0,r.y-i.y),left:Math.max(0,i.x)},(N.top||N.right||N.bottom||N.left)&&(F.set(1),F.to(0,{preset:c.snappy}))});return t.addEventListener(`abort`,()=>{n.remove(),R.disconnect(),F.stop(),j.destroy();for(let e of L)e()},{once:!0}),(e.parent??document.documentElement).append(n),ln(n,t),A(v),t.aborted||(R.observe(a),R.observe(_),addEventListener(`resize`,()=>{A(v),k()},{signal:t}),e.windows?.watch(k,t),e.markOnly?.watch(()=>{d=!1,E=!1,p(f())},t)),n}async function Rn(e){if(e.inert=!0,e.hasAttribute(`collapsed`)||matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let t=e.shadowRoot?.querySelector(`div`),n=Pn.get(e);if(!t?.offsetWidth||!n){e.setAttribute(`collapsed`,``);return}Object.assign(t.style,{width:`${t.offsetWidth}px`,height:`${t.offsetHeight}px`});let r=n.move(()=>e.setAttribute(`collapsed`,``),40);await Promise.race([r,new Promise(e=>setTimeout(e,600*h()))])}function zn(e){let{host:t,handle:n}=e,r,i=!1;return n.style.touchAction=`none`,n.addEventListener(`pointerdown`,a=>{if(a.button!==0||r!==void 0)return;r=a.pointerId,i=!1;let o=n.getBoundingClientRect(),s={x:a.clientX-o.left-o.width/2,y:a.clientY-o.top-o.height/2};n.setPointerCapture(a.pointerId);let c=n=>{if(n.pointerId!==a.pointerId||!i&&Math.hypot(n.clientX-a.clientX,n.clientY-a.clientY)<4)return;i=!0,t.setAttribute(`dragging`,``);let r=document.documentElement.clientWidth,o=document.documentElement.clientHeight,c=n.clientX-s.x,l=n.clientY-s.y,u=jn(c,l,r,o);u!==t.getAttribute(`edge`)&&e.place({edge:u,at:e.dock().at});let d=u===`left`||u===`right`,{size:f,lead:p,part:m,margin:h}=e.shape(d),g=(d?l:c)-p+f/2,_=getComputedStyle(t),v=Math.max(h,Number.parseFloat(_.getPropertyValue(d?`--safe-top`:`--safe-left`))||0),y=Math.max(h,Number.parseFloat(_.getPropertyValue(d?`--safe-bottom`:`--safe-right`))||0);e.place({edge:u,at:Mn(g,m,v,y,d?o:r)})};n.addEventListener(`pointermove`,c);let l=o=>{o.pointerId===a.pointerId&&(n.removeEventListener(`pointermove`,c),n.removeEventListener(`lostpointercapture`,l),r=void 0,i&&(t.removeAttribute(`dragging`),e.drop(),setTimeout(()=>{i=!1})))};n.addEventListener(`lostpointercapture`,l)},{signal:e.signal}),()=>i}function Z(e){let t=Number.parseFloat(getComputedStyle(e).getPropertyValue(`--vitehub-hex-h`))||20;return{width:t*10/9,height:t}}function Bn(e){try{let t=localStorage.getItem(e);return t===`1`||t!==`0`&&void 0}catch{return}}const Vn=`[role=menu]{position:fixed;inset:auto;box-sizing:border-box;width:max-content;min-width:min(220px,var(--menu-width));max-width:min(300px,var(--menu-width));margin:0;padding:6px;overflow:auto;overscroll-behavior:contain;border:1px solid var(--vitehub-pill-line);border-radius:12px;background:#171717;color:var(--vitehub-pill-text);font:500 13px/1.3 ui-sans-serif,system-ui,sans-serif;box-shadow:0 16px 40px rgb(0 0 0/30%);color-scheme:dark;pointer-events:auto}
75
+ [role^=menuitem]{display:flex;width:100%;height:32px;justify-content:flex-start;gap:8px;font-size:13px}
76
+ [role^=menuitem] svg{width:15px;height:15px;flex:none;color:var(--vitehub-pill-muted)}
77
+ [role^=menuitem] span{overflow:hidden;text-overflow:ellipsis}
78
+ [role^=menuitem][hidden]{display:none}
79
+ [role^=menuitem][aria-disabled=true]{cursor:progress}
80
+ [role^=menuitem] .end{display:flex;align-items:center;gap:6px;margin-left:auto;padding-left:16px}
81
+ [role^=menuitem] .end svg{color:var(--vitehub-pill-strong)}
82
+ [role^=menuitem] kbd{box-sizing:border-box;display:inline-grid;place-items:center;min-width:18px;height:18px;padding:0 4px;border-radius:4px;background:rgb(255 255 255/8%);font:500 11px/1 ui-sans-serif,system-ui,sans-serif;color:var(--vitehub-pill-muted)}
81
83
  [role=menu] hr{height:1px;margin:4px 0;border:0;background:var(--vitehub-pill-line)}
82
- @media(any-pointer:coarse){[role=menuitem]{height:44px}}`,Hn=`${nn}
84
+ @media(any-pointer:coarse){[role^=menuitem]{height:44px}}`,Hn=`${nn}
83
85
  ${Vn}
84
- .who{align-self:flex-start;width:28px;padding:0;justify-content:center}
86
+ .who{position:relative;align-self:flex-start;width:28px;padding:0;justify-content:center}
87
+ .who[data-on]::after{content:"";position:absolute;top:4px;right:4px;width:6px;height:6px;border-radius:50%;background:var(--vitehub-pill-strong)}
85
88
  .avatar{box-sizing:border-box;display:grid;place-items:center;width:32px;height:32px;flex:none;overflow:hidden;border-radius:50%;background:#404040;color:var(--vitehub-pill-strong);font-size:12px;font-weight:600;line-height:1}
86
89
  .avatar img{display:block;width:100%;height:100%;object-fit:cover}
87
90
  .me{display:flex;align-items:center;gap:10px;margin-bottom:4px;padding:8px 8px 10px;border-bottom:1px solid var(--vitehub-pill-line)}
@@ -89,7 +92,7 @@ ${Vn}
89
92
  .me b,.me small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
90
93
  .me b{color:var(--vitehub-pill-strong);font-weight:500}
91
94
  .me small{margin-top:2px;color:var(--vitehub-pill-muted);font-size:12px}
92
- `,Un=e=>X(`0 0 24 24`,e,{fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),Wn=`<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m16 17 5-5-5-5M21 12H9M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/></svg>`;function Gn(e){return e.trim().split(/\s+/).slice(0,2).map(e=>[...e][0]??``).join(``).toLocaleUpperCase()}function Kn(e){let t=document.createElement(`span`);if(t.className=`avatar`,t.setAttribute(`aria-hidden`,`true`),t.textContent=Gn(e.name),e.image){let n=document.createElement(`img`);n.alt=``,n.referrerPolicy=`no-referrer`,n.src=e.image,n.addEventListener(`load`,()=>t.replaceChildren(n),{once:!0})}return t}function qn(e,t){let n=document.createElement(`button`);n.type=`button`,n.setAttribute(`role`,`menuitem`),n.tabIndex=-1,e&&n.insertAdjacentHTML(`beforeend`,e);let r=document.createElement(`span`);return r.textContent=t,n.append(r),{item:n,label:r}}function Jn(){let e=new URL(location.href);for(let t of[Zt,...Qt])e.searchParams.delete(t);return e}function Yn(e){let{account:t,bar:n,pill:r=n.parentElement,signal:i}=e,a=n.attachShadow({mode:`open`});i.addEventListener(`abort`,B(a,Y),{once:!0});let o=document.createElement(`style`);o.textContent=Hn;let s=document.createElement(`div`);s.id=`account-menu`,s.setAttribute(`popover`,`auto`),s.setAttribute(`role`,`menu`),s.setAttribute(`aria-label`,t?.name??`More`);let c=document.createElement(`button`);c.type=`button`,c.className=`who`,c.dataset.motionPress=``,c.title=t?`More. Signed in as ${t.email?`${t.name} (${t.email})`:t.name}`:`More`,c.setAttribute(`aria-label`,t?`More. Signed in as ${t.name}`:`More`),c.setAttribute(`aria-haspopup`,`menu`),c.setAttribute(`aria-expanded`,`false`),c.setAttribute(`aria-controls`,s.id),c.setAttribute(`popovertarget`,s.id),c.append(Un(`M5 12h.01M12 12h.01M19 12h.01`));let l=[];if(t){let e=document.createElement(`div`);e.className=`me`,e.setAttribute(`role`,`none`);let n=document.createElement(`div`),r=document.createElement(`b`);if(r.textContent=t.name,n.append(r),t.email){let e=document.createElement(`small`);e.textContent=t.email,n.append(e)}e.append(Kn(t),n),l.push(e)}let u=t?qn(Wn,`Sign out of ${location.host}`):void 0;a.append(o,c,s);let d=()=>{let r=e.items().filter(e=>e.length>0);n.hidden=!t&&r.length===0;let a=[...l];for(let[e,t]of r.entries()){e>0&&a.push(Object.assign(document.createElement(`hr`),{role:`separator`}));for(let e of t){let{item:t}=qn(``,e.label);e.icon&&t.prepend(Un(e.icon)),t.dataset.item=e.id,e.keys&&t.append(Object.assign(document.createElement(`kbd`),{textContent:e.keys})),t.addEventListener(`click`,()=>{c.getAttribute(`aria-expanded`)===`true`&&s.hidePopover(),e.press()},{signal:i}),a.push(t)}}u&&a.push(u.item),s.replaceChildren(...a)};return d(),Zn({menu:s,button:c,pill:r,beforeOpen:d,signal:i}),t&&u&&Qn(t,u,i),{update:()=>{c.getAttribute(`aria-expanded`)!==`true`&&d()}}}function Xn(e){let{account:t,button:n,turnOff:r,canExit:i,signal:a}=e,o=document.createElement(`style`);o.textContent=Vn;let s=document.createElement(`vitehub-menu`);s.id=`exit-menu`,s.setAttribute(`popover`,`auto`),s.setAttribute(`role`,`menu`),s.setAttribute(`aria-label`,`Turn off tools or sign out`);let c=qn(`<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49M14.084 14.158a3 3 0 0 1-4.242-4.242M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143M2 2l20 20"/></svg>`,r.label),l=qn(Wn,`Sign out of ${location.host}`);s.append(c.item,l.item);let u=`Turn off tools or sign out`;n.setAttribute(`aria-label`,u),n.title=u,n.setAttribute(`aria-haspopup`,`menu`),n.setAttribute(`aria-expanded`,`false`),n.setAttribute(`aria-controls`,s.id),n.setAttribute(`popovertarget`,s.id);let d=n.getRootNode();return Zn({menu:s,button:n,pill:d instanceof ShadowRoot&&d.host instanceof HTMLElement?d.host:null,signal:a}),c.item.addEventListener(`click`,e=>{s.hidePopover(),r.press(e.detail===0)},{signal:a}),Qn(t,l,a,i),[o,s]}function Zn(e){let{menu:t,button:n,pill:r,signal:i}=e,a=()=>{n.getAttribute(`aria-expanded`)===`true`&&t.hidePopover()},o=()=>{let e=t.getRootNode();return e instanceof ShadowRoot||e instanceof Document?e.activeElement:null},s=()=>[...t.querySelectorAll(`[role=menuitem]`)].filter(e=>!e.hidden),c=()=>r?.getAttribute(`edge`)??`bottom`,l=e=>{let i=document.documentElement.clientWidth,a=document.documentElement.clientHeight,o=(r??n).getBoundingClientRect(),s=n.getBoundingClientRect(),c={top:`auto`,right:`auto`,bottom:`auto`,left:`auto`},l,u=i-16;if(e===`bottom`||e===`top`)c.right=`${Math.max(8,i-s.right)}px`,l=e===`bottom`?a-o.top+8:o.bottom+8,c[e]=`${l}px`;else{let t=s.top<a/2?`top`:`bottom`;l=Math.max(8,t===`top`?s.top:a-s.bottom),c[t]=`${l}px`;let n=e===`left`?`left`:`right`,r=n===`left`?o.right+8:i-o.left+8;c[n]=`${r}px`,u=i-r-8}Object.assign(t.style,c),t.style.maxHeight=`${Math.max(0,a-l-8)}px`,t.style.setProperty(`--menu-width`,`${Math.max(0,u)}px`)},u=e=>{if(e!==`bottom`&&e!==`top`)return;let r=document.documentElement.clientWidth,i=n.getBoundingClientRect(),a=t.getBoundingClientRect().width;t.style.right=`auto`,t.style.left=`${Math.max(8,Math.min(i.right-a,r-a-8))}px`};if(t.addEventListener(`beforetoggle`,r=>{if(r.newState===`closed`){t.contains(o())&&n.focus({preventScroll:!0});return}e.beforeOpen?.();let i=c();l(i),requestAnimationFrame(()=>u(i))},{signal:i}),t.addEventListener(`toggle`,e=>{let r=e.newState===`open`;n.setAttribute(`aria-expanded`,String(r)),r&&(t.scrollTop=0,s()[0]?.focus({preventScroll:!0}))},{signal:i}),window.addEventListener(`resize`,()=>{if(n.getAttribute(`aria-expanded`)!==`true`)return;let e=c();l(e),u(e)},{signal:i}),t.addEventListener(`keydown`,e=>{let t=s(),n=t.findIndex(e=>e===o()),r=e.key===`ArrowDown`?n+1:e.key===`ArrowUp`?n-1:e.key===`Home`?0:e.key===`End`?t.length-1:void 0;r===void 0?e.key===`Escape`?e.stopPropagation():e.key===`Tab`&&a():(e.preventDefault(),t[(r+t.length)%t.length]?.focus())},{signal:i}),r){let e=new MutationObserver(e=>{e.some(e=>e.oldValue!==r.getAttribute(e.attributeName??``))&&a()});e.observe(r,{attributes:!0,attributeOldValue:!0,attributeFilter:[`collapsed`,`dragging`,`edge`]}),i.addEventListener(`abort`,()=>e.disconnect(),{once:!0})}i.addEventListener(`abort`,a,{once:!0})}function Qn(e,t,n,r){t.item.addEventListener(`click`,async()=>{if(t.item.getAttribute(`aria-disabled`)===`true`||r?.()===!1)return;t.item.setAttribute(`aria-disabled`,`true`),t.label.textContent=`Signing out…`;let n=await fetch(e.signOut,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:`{}`}).catch(e=>e);if(!(n instanceof Response)||!n.ok){console.error(`[vitehub] The sign-out failed. The session stays.`,n instanceof Response?`The sign-out answered ${n.status}.`:n),t.item.removeAttribute(`aria-disabled`),t.label.textContent=`Could not sign out. Try again`;return}let i=Jn();i.href===location.href?location.reload():location.replace(i)},{signal:n})}function $n(e,...t){return typeof e==`function`?e(...t):e}const er=Error.captureStackTrace;var tr=class e extends Error{get why(){return this.message}constructor(t,n=e){super(t.why,{cause:t.cause}),this.code=this.name=t.code,this.docs=t.docs,this.fix=t.fix,this.sources=t.sources,this.data=t.data,er?.(this,n)}toJSON(){return{name:this.name,why:this.why,fix:this.fix,docs:this.docs,sources:this.sources,cause:this.cause,data:this.data,stack:this.stack}}};function nr(e,t){return typeof e==`string`?`${e}/${t.toLowerCase()}`:e?.(t)}const rr=e=>t=>t instanceof tr&&e in t;/* @__NO_SIDE_EFFECTS__ */
95
+ `,Un=e=>X(`0 0 24 24`,e,{fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),Wn=`<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m16 17 5-5-5-5M21 12H9M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/></svg>`;function Gn(e){return e.trim().split(/\s+/).slice(0,2).map(e=>[...e][0]??``).join(``).toLocaleUpperCase()}function Kn(e){let t=document.createElement(`span`);if(t.className=`avatar`,t.setAttribute(`aria-hidden`,`true`),t.textContent=Gn(e.name),e.image){let n=document.createElement(`img`);n.alt=``,n.referrerPolicy=`no-referrer`,n.src=e.image,n.addEventListener(`load`,()=>t.replaceChildren(n),{once:!0})}return t}function qn(e,t){let n=document.createElement(`button`);n.type=`button`,n.setAttribute(`role`,`menuitem`),n.tabIndex=-1,e&&n.insertAdjacentHTML(`beforeend`,e);let r=document.createElement(`span`);return r.textContent=t,n.append(r),{item:n,label:r}}function Jn(){let e=new URL(location.href);for(let t of[Zt,...Qt])e.searchParams.delete(t);return e}function Yn(e){let{account:t,bar:n,pill:r=n.parentElement,signal:i}=e,a=n.attachShadow({mode:`open`});i.addEventListener(`abort`,B(a,Y),{once:!0});let o=document.createElement(`style`);o.textContent=Hn;let s=document.createElement(`div`);s.id=`account-menu`,s.setAttribute(`popover`,`auto`),s.setAttribute(`role`,`menu`),s.setAttribute(`aria-label`,t?.name??`More`);let c=document.createElement(`button`);c.type=`button`,c.className=`who`,c.dataset.motionPress=``,c.title=t?`More. Signed in as ${t.email?`${t.name} (${t.email})`:t.name}`:`More`,c.setAttribute(`aria-label`,t?`More. Signed in as ${t.name}`:`More`),c.setAttribute(`aria-haspopup`,`menu`),c.setAttribute(`aria-expanded`,`false`),c.setAttribute(`aria-controls`,s.id),c.setAttribute(`popovertarget`,s.id),c.append(Un(`M5 12h.01M12 12h.01M19 12h.01`));let l=[];if(t){let e=document.createElement(`div`);e.className=`me`,e.setAttribute(`role`,`none`);let n=document.createElement(`div`),r=document.createElement(`b`);if(r.textContent=t.name,n.append(r),t.email){let e=document.createElement(`small`);e.textContent=t.email,n.append(e)}e.append(Kn(t),n),l.push(e)}let u=t?qn(Wn,`Sign out of ${location.host}`):void 0;a.append(o,c,s);let d=!1,f=!1,p=()=>{f=!1;let r=e.items().filter(e=>e.length>0);n.hidden=!t&&r.length===0;let a=[...l];for(let[e,t]of r.entries()){e>0&&a.push(Object.assign(document.createElement(`hr`),{role:`separator`}));for(let e of t){let{item:t}=qn(``,e.label);if(e.icon&&t.prepend(Un(e.icon)),t.dataset.item=e.id,e.keys&&t.setAttribute(`aria-keyshortcuts`,e.keys),e.checked!==void 0&&(t.setAttribute(`role`,`menuitemcheckbox`),t.setAttribute(`aria-checked`,String(e.checked))),e.checked||e.keys){let n=document.createElement(`span`);n.className=`end`,e.checked&&n.append(Un(`M20 6 9 17l-5-5`)),e.keys&&n.append(Object.assign(document.createElement(`kbd`),{textContent:e.keys})),t.append(n)}t.addEventListener(`click`,()=>{d&&s.hidePopover(),e.press()},{signal:i}),a.push(t)}}u&&a.push(u.item),s.replaceChildren(...a),c.toggleAttribute(`data-on`,r.some(e=>e.some(e=>e.checked)))};return p(),Zn({menu:s,button:c,pill:r,beforeOpen:p,signal:i}),t&&u&&Qn(t,u,i),s.addEventListener(`beforetoggle`,e=>{d=e.newState===`open`,!d&&f&&p()},{signal:i}),{update:()=>{d?f=!0:p()}}}function Xn(e){let{account:t,button:n,turnOff:r,canExit:i,signal:a}=e,o=document.createElement(`style`);o.textContent=Vn;let s=document.createElement(`vitehub-menu`);s.id=`exit-menu`,s.setAttribute(`popover`,`auto`),s.setAttribute(`role`,`menu`),s.setAttribute(`aria-label`,`Turn off tools or sign out`);let c=qn(`<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49M14.084 14.158a3 3 0 0 1-4.242-4.242M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143M2 2l20 20"/></svg>`,r.label),l=qn(Wn,`Sign out of ${location.host}`);s.append(c.item,l.item);let u=`Turn off tools or sign out`;n.setAttribute(`aria-label`,u),n.title=u,n.setAttribute(`aria-haspopup`,`menu`),n.setAttribute(`aria-expanded`,`false`),n.setAttribute(`aria-controls`,s.id),n.setAttribute(`popovertarget`,s.id);let d=n.getRootNode();return Zn({menu:s,button:n,pill:d instanceof ShadowRoot&&d.host instanceof HTMLElement?d.host:null,signal:a}),c.item.addEventListener(`click`,e=>{s.hidePopover(),r.press(e.detail===0)},{signal:a}),Qn(t,l,a,i),[o,s]}function Zn(e){let{menu:t,button:n,pill:r,signal:i}=e,a=()=>{n.getAttribute(`aria-expanded`)===`true`&&t.hidePopover()},o=()=>{let e=t.getRootNode();return e instanceof ShadowRoot||e instanceof Document?e.activeElement:null},s=()=>[...t.querySelectorAll(`[role^=menuitem]`)].filter(e=>!e.hidden),c=()=>r?.getAttribute(`edge`)??`bottom`,l=e=>{let i=document.documentElement.clientWidth,a=document.documentElement.clientHeight,o=(r??n).getBoundingClientRect(),s=n.getBoundingClientRect(),c={top:`auto`,right:`auto`,bottom:`auto`,left:`auto`},l,u=i-16;if(e===`bottom`||e===`top`)c.right=`${Math.max(8,i-s.right)}px`,l=e===`bottom`?a-o.top+8:o.bottom+8,c[e]=`${l}px`;else{let t=s.top<a/2?`top`:`bottom`;l=Math.max(8,t===`top`?s.top:a-s.bottom),c[t]=`${l}px`;let n=e===`left`?`left`:`right`,r=n===`left`?o.right+8:i-o.left+8;c[n]=`${r}px`,u=i-r-8}Object.assign(t.style,c),t.style.maxHeight=`${Math.max(0,a-l-8)}px`,t.style.setProperty(`--menu-width`,`${Math.max(0,u)}px`)},u=e=>{if(e!==`bottom`&&e!==`top`)return;let r=document.documentElement.clientWidth,i=n.getBoundingClientRect(),a=t.getBoundingClientRect().width;t.style.right=`auto`,t.style.left=`${Math.max(8,Math.min(i.right-a,r-a-8))}px`};if(t.addEventListener(`beforetoggle`,r=>{if(r.newState===`closed`){t.contains(o())&&n.focus({preventScroll:!0});return}e.beforeOpen?.();let i=c();l(i),requestAnimationFrame(()=>u(i))},{signal:i}),t.addEventListener(`toggle`,e=>{let r=e.newState===`open`;n.setAttribute(`aria-expanded`,String(r)),r&&(t.scrollTop=0,s()[0]?.focus({preventScroll:!0}))},{signal:i}),window.addEventListener(`resize`,()=>{if(n.getAttribute(`aria-expanded`)!==`true`)return;let e=c();l(e),u(e)},{signal:i}),t.addEventListener(`keydown`,e=>{let t=s(),n=t.findIndex(e=>e===o()),r=e.key===`ArrowDown`?n+1:e.key===`ArrowUp`?n-1:e.key===`Home`?0:e.key===`End`?t.length-1:void 0;r===void 0?e.key===`Escape`?e.stopPropagation():e.key===`Tab`&&a():(e.preventDefault(),t[(r+t.length)%t.length]?.focus())},{signal:i}),r){let e=new MutationObserver(e=>{e.some(e=>e.oldValue!==r.getAttribute(e.attributeName??``))&&a()});e.observe(r,{attributes:!0,attributeOldValue:!0,attributeFilter:[`collapsed`,`dragging`,`edge`]}),i.addEventListener(`abort`,()=>e.disconnect(),{once:!0})}i.addEventListener(`abort`,a,{once:!0})}function Qn(e,t,n,r){t.item.addEventListener(`click`,async()=>{if(t.item.getAttribute(`aria-disabled`)===`true`||r?.()===!1)return;t.item.setAttribute(`aria-disabled`,`true`),t.label.textContent=`Signing out…`;let n=await fetch(e.signOut,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:`{}`}).catch(e=>e);if(!(n instanceof Response)||!n.ok){console.error(`[vitehub] The sign-out failed. The session stays.`,n instanceof Response?`The sign-out answered ${n.status}.`:n),t.item.removeAttribute(`aria-disabled`),t.label.textContent=`Could not sign out. Try again`;return}let i=Jn();i.href===location.href?location.reload():location.replace(i)},{signal:n})}function $n(e,...t){return typeof e==`function`?e(...t):e}const er=Error.captureStackTrace;var tr=class e extends Error{get why(){return this.message}constructor(t,n=e){super(t.why,{cause:t.cause}),this.code=this.name=t.code,this.docs=t.docs,this.fix=t.fix,this.sources=t.sources,this.data=t.data,er?.(this,n)}toJSON(){return{name:this.name,why:this.why,fix:this.fix,docs:this.docs,sources:this.sources,cause:this.cause,data:this.data,stack:this.stack}}};function nr(e,t){return typeof e==`string`?`${e}/${t.toLowerCase()}`:e?.(t)}const rr=e=>t=>t instanceof tr&&e in t;/* @__NO_SIDE_EFFECTS__ */
93
96
  function ir(e){let t=e.reporters??[],n=Symbol(),r=Object.defineProperty({},"is",{value:rr(n)}),{docsBase:i}=e;for(let a of Object.keys(e.codes)){let o=e.codes[a],s=o.docs===!1?void 0:o.docs||nr(i,a),c=(e={},r={})=>{let i=new tr({code:a,why:$n(o.why,e),fix:$n(o.fix,e),docs:s,cause:e.cause,sources:e.sources,data:$n(o.data,e)},c);i[n]=1;for(let e of t)e(i,r);return i};c.is=e=>r.is(e)&&e.code===a,r[a]=c}return r}const ar=/*#__PURE__*/ ir({docsBase:`https://vitehub.dev/docs/development/diagnostics`,codes:{INTERNAL_INVARIANT_FAILED:{why:({what:e})=>`ViteHub reached a state that it does not expect: ${e}`,fix:`This is a ViteHub bug. Open an issue at https://github.com/vite-hub/vitehub/issues with this error message and its stack trace.`}}});function or(e){return ar.INTERNAL_INVARIANT_FAILED({what:e})}function sr(e,t){if(!e)throw or(t)}let Q={edge:`bottom`,at:50};const cr=/* @__PURE__ */ new Map,lr=/* @__PURE__ */ new Set;let ur=!1,dr=0;function fr(){ur||(ur=!0,queueMicrotask(()=>{ur=!1;for(let e of lr)e()}))}function pr(){return[...cr.keys()].some(e=>!e.hidden)}function mr(){for(let[e,t]of cr)e.hidden||t()}function hr(e,t){lr.add(e),t.addEventListener(`abort`,()=>lr.delete(e),{once:!0})}function gr(e){e.setAttribute(`edge`,Q.edge),e.toggleAttribute(`collapsed`,!!Q.collapsed),e.style.setProperty(`--at`,String(Q.at)),Q.thickness?e.style.setProperty(`--thickness`,`${Q.thickness}px`):e.style.removeProperty(`--thickness`);for(let[t,n]of[[`start`,0],[`end`,100]])Q.beside&&Q.at===n?e.style.setProperty(`--beside-${t}`,`${Q.beside}px`):e.style.removeProperty(`--beside-${t}`);for(let t of[`top`,`right`,`bottom`,`left`])e.shadowRoot.querySelector(`.grip.${t}`).hidden=_r(t)===0}function _r(e){return(e===`top`||e===`bottom`)==(Q.edge===`top`||Q.edge===`bottom`)?1:e===`top`||e===`left`?Q.at/100:1-Q.at/100}function vr(e){Q=e;for(let e of cr.keys())gr(e)}function yr(e){let t=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);for(let[e,n]of Object.entries({width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.75`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`}))t.setAttribute(e,n);let n=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);return n.setAttribute(`d`,e),t.append(n),t}function br(e){let t=document.createElement(`vitehub-window`);t.hidden=!0;let n=t.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=`
94
97
  :host{all:initial;--surface:light-dark(#fff,#0a0a0a);--text:light-dark(#18181b,#fafafa);--muted:light-dark(#71717a,#a1a1aa);--line:light-dark(rgb(0 0 0/8%),rgb(255 255 255/9%));--hover:light-dark(rgb(0 0 0/5%),rgb(255 255 255/7%));--focus:light-dark(#18181b,#fafafa);--safe-top:env(safe-area-inset-top,0px);--safe-right:env(safe-area-inset-right,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px);--at:50;--margin:16px;--start:calc(max(var(--margin),var(--safe-left)) + var(--beside-start,0px));--end:calc(max(var(--margin),var(--safe-right)) + var(--beside-end,0px));--far:calc(max(12px,var(--safe-top)) + 40px);--along:calc(var(--start) + (100% - var(--start) - var(--end)) * var(--at) / 100);--shift:calc(var(--at) * -1%);--dock:calc(max(max(var(--margin),var(--safe-bottom)) + var(--thickness,38px),var(--vitehub-page-bar,0px)) + 8px);--width:calc(100vw - var(--start) - var(--end));--height:calc(100dvh - var(--dock) - var(--far));position:fixed;inset:0;z-index:2147483000;pointer-events:none;color:var(--text);font:400 .875rem/1.5 system-ui,sans-serif;color-scheme:light dark}
95
98
  :host([collapsed]){--margin:2px}
@@ -1,4 +1,4 @@
1
- import { n as pagePathOf } from "./path-8yqMd8zR.js";
1
+ import { n as pagePathOf } from "./path-sv8kjq3i.js";
2
2
  // src/page.ts
3
3
  /**
4
4
  * The numbering scope of page threads: subjects of kind `page`, which the overlay pins on the app's pages. Threads on
@@ -1,4 +1,4 @@
1
- import { w as CommentSubject } from "./types-BX3vH18p.js";
1
+ import { w as CommentSubject } from "./types-BmzTyGt-.js";
2
2
  /** Mount Comments under the application path, ignoring Vite asset URLs such as a CDN origin. */
3
3
  declare function mountedCommentsRoute(base?: string): string;
4
4
  /**
@@ -1,7 +1,3 @@
1
- /**
2
- * An app path: one slash, then no second slash or backslash (`//host` and `/\host` leave the site), no whitespace,
3
- * and no `?` or `#`, which a link adds itself.
4
- */
5
1
  const pagePath = /^\/(?![/\\])[^\s\\?#]*$/;
6
2
  function isPagePath(value) {
7
3
  return value.length <= 500 && pagePath.test(value) && !new URL(value, "https://comments.invalid").pathname.startsWith("//");
@@ -1,5 +1,5 @@
1
- import { a as registerViteHubPageTool, i as installViteHubSiteVisitor, n as resolveCommentsPage, r as installViteHubPageTools, t as resolveCommentsIdentity } from "./session-B7GDrqsK.js";
2
- import { r as commentsRoleGrants } from "./define-C-LUOouq.js";
1
+ import { a as registerViteHubPageTool, i as installViteHubSiteVisitor, n as resolveCommentsPage, r as installViteHubPageTools, t as resolveCommentsIdentity } from "./session-1SI3_wLJ.js";
2
+ import { r as commentsRoleGrants } from "./define-hs9Z38io.js";
3
3
  import { t as commentsErrorDiagnostics } from "./errors-DeSEHzRf.js";
4
4
  import { i as installCommentsRuntime } from "./server-CAMs6viR.js";
5
5
  import { r as runtimeBuilds } from "./installed-BqQKo6WC.js";
@@ -38,7 +38,7 @@ function defineCommentsPlugin(options) {
38
38
  warned = true;
39
39
  throw Object.assign(commentsErrorDiagnostics.COMMENTS_R0010(), { status: 503 });
40
40
  }
41
- const { installComments } = await import("./install-BueV_fJY.js").then((n) => n.n);
41
+ const { installComments } = await import("./install--HecUN5c.js").then((n) => n.n);
42
42
  return installComments(options.comments, {
43
43
  database,
44
44
  development: options.development === true,
@@ -1,8 +1,8 @@
1
- import { T as CommentThread } from "./types-BX3vH18p.js";
2
- import { n as commentsChangeNotice } from "./page-BgvzzsJb.js";
3
- import { t as Comments } from "./index-d6NsDxu9.js";
4
- import { t as CommentsSessionOptions } from "./session-EzQqBeE8.js";
5
- import "./types-qzJKgWYS.js";
1
+ import { T as CommentThread } from "./types-BmzTyGt-.js";
2
+ import { n as commentsChangeNotice } from "./page-DRM1j84-.js";
3
+ import { t as Comments } from "./index-CbXek64X.js";
4
+ import { t as CommentsSessionOptions } from "./session-CK3Rnjto.js";
5
+ import "./types-VSVs4jIw.js";
6
6
  import { RealtimeDefinition } from "@vite-hub/realtime";
7
7
  /**
8
8
  * The Realtime Definition of the page presence rooms: who is on a page and where their cursor is. Rooms hold no
package/dist/realtime.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { i as text } from "./identity-CT7-UGmS.js";
2
- import { i as commentsNoticeDefinition, n as commentRoom, p as normalizeCommentPage, r as commentsChangeNotice, t as commentNoticeRoom } from "./page-CDhmXO-y.js";
3
- import { n as resolveCommentsPage, t as resolveCommentsIdentity } from "./session-B7GDrqsK.js";
2
+ import { i as commentsNoticeDefinition, n as commentRoom, p as normalizeCommentPage, r as commentsChangeNotice, t as commentNoticeRoom } from "./page-CJz1K67L.js";
3
+ import { n as resolveCommentsPage, t as resolveCommentsIdentity } from "./session-1SI3_wLJ.js";
4
4
  // src/realtime.ts
5
5
  function toRealtimeUser(user) {
6
6
  const result = { id: user.id };
@@ -1,6 +1,6 @@
1
1
  import { n as isRecordOrFunction, t as isRecord } from "./object-CAK6UYR5.js";
2
2
  import { i as commentsUnansweredError, t as commentsAnswerError } from "./client-diagnostics-DoXqdnBd.js";
3
- import { i as withCommentFiles, n as outboxAccountHeader, r as retryAfterOf } from "./client-files-lC6X7XyS.js";
3
+ import { i as withCommentFiles, n as outboxAccountHeader, r as retryAfterOf } from "./client-files-CMPJEd21.js";
4
4
  import { createBirpc } from "birpc";
5
5
  // ../internal/src/operation-rpc.ts
6
6
  /** Path of the operation RPC under the app. Dev servers and deployed apps serve it the same way, one birpc call per POST. */
@@ -1,4 +1,4 @@
1
- import { k as CommentsTransport } from "./types-BX3vH18p.js";
1
+ import { k as CommentsTransport } from "./types-BmzTyGt-.js";
2
2
  interface RpcTransportOptions {
3
3
  /** The app origin and mount, such as `https://app.example.com` or `/portal`. Defaults to the page origin. */
4
4
  base?: string;
package/dist/rpc.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { n as createRpcTransport, t as RpcTransportOptions } from "./rpc-D-eqtyfh.js";
1
+ import { n as createRpcTransport, t as RpcTransportOptions } from "./rpc-DZB3yU0z.js";
2
2
  export { RpcTransportOptions, createRpcTransport };
package/dist/rpc.js CHANGED
@@ -1 +1 @@
1
- export { t as createRpcTransport } from "./rpc-kkxzQ3Qy.js";
1
+ export { t as createRpcTransport } from "./rpc-51X1TWKb.js";
@@ -1,4 +1,4 @@
1
- import { T as CommentsPeople, j as CommentsUser, s as CommentsRequestEvent } from "../types-qzJKgWYS.js";
1
+ import { T as CommentsPeople, j as CommentsUser, s as CommentsRequestEvent } from "../types-VSVs4jIw.js";
2
2
  /** The ViteHub Auth user of a request, or null. Generated Comments files pass it as `session` when the app has Auth. */
3
3
  export declare function commentsAuthSession(event: CommentsRequestEvent): Promise<CommentsUser | null>;
4
4
  /** The users of ViteHub Auth, for `@` suggestions. Generated Comments files pass it as `users` when the app has Auth. */
@@ -1,6 +1,6 @@
1
1
  import { t as describeCommentContext } from "../context-DbkBjITZ.js";
2
- import { a as commentsPageScope } from "../page-CDhmXO-y.js";
3
- import { n as installedComments } from "../plugin-DGUqlc3C.js";
2
+ import { a as commentsPageScope } from "../page-CJz1K67L.js";
3
+ import { n as installedComments } from "../plugin-DczA2K-y.js";
4
4
  // src/runtime/console.ts
5
5
  function excerpt(text) {
6
6
  const line = text.replace(/\s+/g, " ").trim();
@@ -1,9 +1,9 @@
1
- import { s as CommentContext } from "../types-BX3vH18p.js";
2
- import { t as Comments } from "../index-d6NsDxu9.js";
3
- import { j as CommentsUser, s as CommentsRequestEvent } from "../types-qzJKgWYS.js";
4
- import { t as CommentsSessionOptions } from "../session-EzQqBeE8.js";
5
- import { t as InstallCommentsOptions } from "../install-F-_O7zDr.js";
6
- import { o as CommentsDatabase } from "../service-CMVA_Ryv.js";
1
+ import { s as CommentContext } from "../types-BmzTyGt-.js";
2
+ import { t as Comments } from "../index-CbXek64X.js";
3
+ import { j as CommentsUser, s as CommentsRequestEvent } from "../types-VSVs4jIw.js";
4
+ import { t as CommentsSessionOptions } from "../session-CK3Rnjto.js";
5
+ import { t as InstallCommentsOptions } from "../install-C3CW6Vvw.js";
6
+ import { o as CommentsDatabase } from "../service-qaMuJ7UX.js";
7
7
  /**
8
8
  * A person that Site access in the ViteHub Console signed in to the app: a Console member, or a guest, with their roles,
9
9
  * such as `console` and `comments-write`. The Console signs them in a Site access token, which the app keeps in its
@@ -1,14 +1,14 @@
1
- import { a as runWithActiveCloudflareEnv, i as getActiveCloudflareBinding, r as rememberGitHubToken, t as forgetGitHubToken } from "../tokens-Bx4lZ0yt.js";
2
- import { n as resolveCommentsPage, o as viteHubPageSessionHandler, s as applicationRequestOrigin, t as resolveCommentsIdentity } from "../session-B7GDrqsK.js";
3
- import "../client-files-lC6X7XyS.js";
1
+ import { a as runWithActiveCloudflareEnv, i as getActiveCloudflareBinding, r as rememberGitHubToken, t as forgetGitHubToken } from "../tokens-WRh__ppm.js";
2
+ import { n as resolveCommentsPage, o as viteHubPageSessionHandler, s as applicationRequestOrigin, t as resolveCommentsIdentity } from "../session-1SI3_wLJ.js";
3
+ import "../client-files-CMPJEd21.js";
4
4
  import { t as commentsErrors } from "../errors-C5utwZ5H.js";
5
5
  import { i as text, n as guestFromHeaders, t as authorOf } from "../identity-CT7-UGmS.js";
6
6
  import { i as runtimeOf, n as resolveCommentsRuntime } from "../installed-BqQKo6WC.js";
7
- import { a as commentThreadSummary, c as hiddenThreadsNote, n as commentAnchorSchema, o as commentThreadsText, r as commentInputSchemas, s as describeCommentThread, t as commentActions } from "../operations-0llC5kKO.js";
8
- import { c as validateCommentsDefinition, o as deniedForMissingPolicy } from "../define-C-LUOouq.js";
9
- import { h as readAttachment, i as contextSchema, n as base64, o as deniedError, p as mentionedPeople, r as can } from "../service-DaMq8TBw.js";
10
- import { a as commentsPageScope, p as normalizeCommentPage, s as commentsRoute } from "../page-CDhmXO-y.js";
11
- import { n as installedComments, t as defineCommentsPlugin } from "../plugin-DGUqlc3C.js";
7
+ import { a as commentThreadSummary, c as hiddenThreadsNote, n as commentAnchorSchema, o as commentThreadsText, r as commentInputSchemas, s as describeCommentThread, t as commentActions } from "../operations-DHXmbtb3.js";
8
+ import { c as validateCommentsDefinition, o as deniedForMissingPolicy } from "../define-hs9Z38io.js";
9
+ import { h as readAttachment, i as contextSchema, n as base64, o as deniedError, p as mentionedPeople, r as can } from "../service-DFMwCr60.js";
10
+ import { a as commentsPageScope, p as normalizeCommentPage, s as commentsRoute } from "../page-CJz1K67L.js";
11
+ import { n as installedComments, t as defineCommentsPlugin } from "../plugin-DczA2K-y.js";
12
12
  import { t as invariant } from "../invariant-CmdvZ3vp.js";
13
13
  import { t as commentsErrorDiagnostics } from "../errors-DeSEHzRf.js";
14
14
  import { t as clientRequest } from "../client-request-B1DCz3a9.js";
@@ -22,7 +22,6 @@ import { stateless } from "@vite-hub/auth/presets";
22
22
  // src/runtime/handler.ts
23
23
  const fieldEditGrant = defineGrant("vitehub.comments.field-edit", (input) => input);
24
24
  const pageSchema = v.pipe(v.string(), v.startsWith("/", "A page starts with `/`."), v.maxLength(1024));
25
- /** `POST /threads`: the input of `comments.create`, or a `page` instead of the subject, and the page context of the overlay. */
26
25
  const createBody = v.object({
27
26
  ...commentInputSchemas.create.entries,
28
27
  subject: v.optional(commentInputSchemas.create.entries.subject),
@@ -40,7 +39,6 @@ const editBody = v.object({
40
39
  body: commentInputSchemas.edit.entries.body,
41
40
  mentions: commentInputSchemas.edit.entries.mentions
42
41
  });
43
- /** The first issue as one sentence, for `COMMENTS_INVALID_INPUT`. */
44
42
  function describeIssue(issues) {
45
43
  const issue = issues[0];
46
44
  if (!issue) return "unknown issue.";
@@ -79,7 +77,6 @@ function json(value, init = {}) {
79
77
  function failure$1(error) {
80
78
  return json({ error }, { status: status(error.code) });
81
79
  }
82
- /** A thrown Comments diagnostic, such as `COMMENTS_R0019` for tables that need a migration, as the API's error object. */
83
80
  function diagnosticResponse(error) {
84
81
  const code = Reflect.get(Object(error), "code");
85
82
  const status = Reflect.get(Object(error), "status");
@@ -95,7 +92,6 @@ function diagnosticResponse(error) {
95
92
  ...typeof retryAfter === "number" ? { headers: { "retry-after": String(Math.ceil(retryAfter)) } } : {}
96
93
  });
97
94
  }
98
- /** The REST code of a diagnostic of the comment actions. Codes without one, such as `COMMENTS_R0019`, stay as they are. */
99
95
  const restCodes = {
100
96
  COMMENTS_R0002: "COMMENTS_NOT_FOUND",
101
97
  COMMENTS_R0003: "COMMENTS_NOT_FOUND",
@@ -110,7 +106,6 @@ const restCodes = {
110
106
  COMMENTS_R0017: "COMMENTS_INVALID_INPUT",
111
107
  COMMENTS_R0018: "COMMENTS_INVALID_INPUT"
112
108
  };
113
- /** A failure of a comment action as the API's error object: the REST code, and the status of the diagnostic. */
114
109
  function actionFailure(error, action) {
115
110
  const code = Reflect.get(Object(error), "code");
116
111
  const mapped = typeof code === "string" ? restCodes[code] : void 0;
@@ -123,7 +118,6 @@ function actionFailure(error, action) {
123
118
  why
124
119
  } : result }, { status: mapped === "COMMENTS_INVALID_INPUT" && typeof statusOf === "number" ? statusOf : status(mapped) });
125
120
  }
126
- /** Response headers for a stored file: its checked type, a file name, and no way for the browser to run it. */
127
121
  function attachmentHeaders(file) {
128
122
  return new Headers({
129
123
  "cache-control": "private, max-age=300",
@@ -349,7 +343,6 @@ function createCommentsHandler(options) {
349
343
  ...subject ? { subject } : {}
350
344
  }, who.gate)) throw deniedError(who.runtime, "read", who.user, who.gate);
351
345
  }
352
- /** The list query of `GET /threads`: the filters of `comments.list` as search parameters. */
353
346
  /** `page`: the subject that `page` of `defineComments()` gives for the `?page=` path, as the overlay sees it. */
354
347
  function listQuery(url, page) {
355
348
  const params = url.searchParams;
@@ -658,7 +651,6 @@ function commentsDefinitionOf(module, file) {
658
651
  return validateCommentsDefinition(module.comments ?? module.default, file);
659
652
  }
660
653
  // src/runtime/mcp.ts
661
- /** A user supplied by an app's own MCP server. Missing identities remain anonymous. */
662
654
  function commentsUser(user) {
663
655
  const id = text(user?.id) ?? text(user?.email);
664
656
  return user && id ? {
@@ -675,23 +667,16 @@ function failure(why) {
675
667
  isError: true
676
668
  };
677
669
  }
678
- /** The catalog's COMMENTS_FORBIDDEN, as the overlay API answers it. */
679
670
  function forbidden(action) {
680
671
  const error = commentsErrors.COMMENTS_FORBIDDEN({ action });
681
672
  return failure(`${error.why} ${error.fix}`);
682
673
  }
683
- /** Issued after `authorize` allows a tool's action on a thread. The reply and resolve writes need it. */
684
674
  const toolGrant = defineGrant("vitehub.comments.mcp-action", (input) => Object.freeze({ ...input }));
685
675
  function spend(grant, action, threadId) {
686
676
  const allowed = toolGrant.consume(grant);
687
677
  invariant(allowed.action === action && allowed.threadId === threadId, "each Comments tool spends the grant that it issued for the same action and thread");
688
678
  }
689
- /** The bytes of images that one `comments_get_thread` answer carries, before Base64. */
690
679
  const maximumThreadImageBytes = 4194304;
691
- /**
692
- * The image attachments of a thread, in message order, for a reader who may read it, until they reach
693
- * `maximumThreadImageBytes`. `notes` says which files the Agent does not see, and why.
694
- */
695
680
  async function threadImages(comments, thread, user) {
696
681
  const runtime = await runtimeOf(comments);
697
682
  if (!runtime) return {
@@ -1016,9 +1001,7 @@ const githubLoginEnv = {
1016
1001
  };
1017
1002
  /** Where Better Auth serves the GitHub sign-in of Comments. */
1018
1003
  const githubLoginPath = `${commentsRoute}/auth`;
1019
- /** How long a sign-in lasts. The session is in an encrypted cookie, so it cannot be revoked before then. */
1020
1004
  const sessionLifetime = "7d";
1021
- /** How long Comments trusts the repository access that GitHub reported for a person. */
1022
1005
  const accessLifetime = 3e5;
1023
1006
  const userResponse = v.object({ login: v.string() });
1024
1007
  const repositoryResponse = v.object({ permissions: v.optional(v.object({ push: v.optional(v.boolean()) })) });
@@ -1026,11 +1009,6 @@ function serverEnv(name) {
1026
1009
  const value = getActiveCloudflareBinding(name) ?? globalThis.process?.env?.[name];
1027
1010
  return typeof value === "string" && value ? value : void 0;
1028
1011
  }
1029
- /**
1030
- * The secret of the session cookies: derived from `VITEHUB_SECRET` for Comments alone, so the app's own Auth cookies
1031
- * and these never open each other. Without a root secret, Better Auth uses its development secret, and fails in
1032
- * production.
1033
- */
1034
1012
  function sessionSecret() {
1035
1013
  const root = readViteHubSecret({ VITEHUB_SECRET: serverEnv("VITEHUB_SECRET") });
1036
1014
  if (!root) return;
package/dist/server.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { F as validateCommentsDefinition, T as CommentsPeople } from "./types-qzJKgWYS.js";
2
- import { a as maximumCommentBodyLength, c as CommentsTables, i as CommentsRuntime, l as createCommentsStore, n as CommentsAttachmentStore, o as CommentsDatabase, r as CommentsForgeHooks, s as CommentsStore } from "./service-CMVA_Ryv.js";
3
- import { D as CommentUser } from "./types-BX3vH18p.js";
4
- import { a as commentInputSchemas, i as commentAnchorSchema, n as CommentsCaller, o as commentsOperations, r as commentActions, t as CommentThreadsPage } from "./operations-jaihyWw2.js";
5
- import { n as createRpcTransport, t as RpcTransportOptions } from "./rpc-D-eqtyfh.js";
6
- import { n as installComments, t as InstallCommentsOptions } from "./install-F-_O7zDr.js";
7
- import { a as hostedCommentsEndedNotice, i as hostedCommentsChangeNotice, o as hostedCommentsNoticeDefinition, r as hostedCommentNoticeRoom } from "./page-BgvzzsJb.js";
1
+ import { F as validateCommentsDefinition, T as CommentsPeople } from "./types-VSVs4jIw.js";
2
+ import { a as maximumCommentBodyLength, c as CommentsTables, i as CommentsRuntime, l as createCommentsStore, n as CommentsAttachmentStore, o as CommentsDatabase, r as CommentsForgeHooks, s as CommentsStore } from "./service-qaMuJ7UX.js";
3
+ import { D as CommentUser } from "./types-BmzTyGt-.js";
4
+ import { a as commentInputSchemas, i as commentAnchorSchema, n as CommentsCaller, o as commentsOperations, r as commentActions, t as CommentThreadsPage } from "./operations-D0EO1pzL.js";
5
+ import { n as createRpcTransport, t as RpcTransportOptions } from "./rpc-DZB3yU0z.js";
6
+ import { n as installComments, t as InstallCommentsOptions } from "./install-C3CW6Vvw.js";
7
+ import { a as hostedCommentsEndedNotice, i as hostedCommentsChangeNotice, o as hostedCommentsNoticeDefinition, r as hostedCommentNoticeRoom } from "./page-DRM1j84-.js";
8
8
  /** Where mentions find people. The same shape as `defineComments({ people })`. */
9
9
  export type CommentsUsers = CommentsPeople;
10
10
  /**
package/dist/server.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { i as installCommentsRuntime, n as createAuthUsers, r as hasCommentsRuntime, t as commentsRuntime } from "./server-CAMs6viR.js";
2
- import { i as commentsOperations, n as commentAnchorSchema, r as commentInputSchemas, t as commentActions } from "./operations-0llC5kKO.js";
3
- import { t as createRpcTransport } from "./rpc-kkxzQ3Qy.js";
4
- import { r as createCommentsStore, t as installComments } from "./install-BueV_fJY.js";
5
- import { f as maximumCommentBodyLength } from "./service-DaMq8TBw.js";
6
- import { c as validateCommentsDefinition } from "./define-C-LUOouq.js";
7
- import { c as hostedCommentNoticeRoom, d as hostedCommentsNoticeDefinition, l as hostedCommentsChangeNotice, u as hostedCommentsEndedNotice } from "./page-CDhmXO-y.js";
2
+ import { i as commentsOperations, n as commentAnchorSchema, r as commentInputSchemas, t as commentActions } from "./operations-DHXmbtb3.js";
3
+ import { t as createRpcTransport } from "./rpc-51X1TWKb.js";
4
+ import { r as createCommentsStore, t as installComments } from "./install--HecUN5c.js";
5
+ import { f as maximumCommentBodyLength } from "./service-DFMwCr60.js";
6
+ import { c as validateCommentsDefinition } from "./define-hs9Z38io.js";
7
+ import { c as hostedCommentNoticeRoom, d as hostedCommentsNoticeDefinition, l as hostedCommentsChangeNotice, u as hostedCommentsEndedNotice } from "./page-CJz1K67L.js";
8
8
  export { commentActions, commentAnchorSchema, commentInputSchemas, commentsOperations, commentsRuntime, createAuthUsers, createCommentsStore, createRpcTransport, hasCommentsRuntime, hostedCommentNoticeRoom, hostedCommentsChangeNotice, hostedCommentsEndedNotice, hostedCommentsNoticeDefinition, installComments, installCommentsRuntime, maximumCommentBodyLength, validateCommentsDefinition };
@@ -1,9 +1,9 @@
1
1
  import { t as replyMessageId } from "./reply-id-Cm9FGOBs.js";
2
- import { t as isPagePath } from "./path-8yqMd8zR.js";
2
+ import { t as isPagePath } from "./path-sv8kjq3i.js";
3
3
  import { t as commentsErrorDiagnostics } from "./errors-DeSEHzRf.js";
4
4
  import { t as foldName } from "./fold-name-g-xg0mQk.js";
5
5
  import { r as guestIdPrefix } from "./identity-CT7-UGmS.js";
6
- import { i as defaultPolicy, o as deniedForMissingPolicy, t as builtinCommentSubjects } from "./define-C-LUOouq.js";
6
+ import { i as defaultPolicy, o as deniedForMissingPolicy, t as builtinCommentSubjects } from "./define-hs9Z38io.js";
7
7
  import { t as logFailure } from "./request-log-DllKQXj7.js";
8
8
  import * as v from "valibot";
9
9
  // ../internal/src/runtime/client-rate-limit.ts
@@ -105,7 +105,6 @@ const attachmentTypes = [
105
105
  "application/pdf",
106
106
  "text/plain"
107
107
  ];
108
- /** The media types that a browser may show inline. Every other file downloads. */
109
108
  const inlineTypes = [
110
109
  "image/png",
111
110
  "image/jpeg",
@@ -173,7 +172,6 @@ async function can(runtime, context, gate = {}) {
173
172
  return false;
174
173
  }
175
174
  let warned = false;
176
- /** Says once per process, in the server log, that signed-in people wait for an `authorize` policy. */
177
175
  function warnMissingPolicy() {
178
176
  if (warned) return;
179
177
  warned = true;
@@ -189,7 +187,6 @@ function deniedError(runtime, action, user, gate = {}) {
189
187
  if (deniedForMissingPolicy(runtime.definition, user, checked)) return fail(commentsErrorDiagnostics.COMMENTS_R0006(), 403);
190
188
  return fail(commentsErrorDiagnostics.COMMENTS_R0009({ action }), 403);
191
189
  }
192
- /** Whether `user` may mention `person`: `canMention`, else whether `person` may read the thread. */
193
190
  async function mayMention(runtime, user, found, target) {
194
191
  const subject = target.subject ?? target.thread?.subject;
195
192
  const person = { ...found };
@@ -211,7 +208,6 @@ async function mayMention(runtime, user, found, target) {
211
208
  return false;
212
209
  }
213
210
  }
214
- /** Where `@` finds people: `people`, else Auth, else the authors of threads that `reader` may read. */
215
211
  function peopleOf(runtime, reader, gate, console) {
216
212
  const explicit = runtime.definition.people ?? runtime.users;
217
213
  if (explicit) return explicit;
@@ -327,7 +323,6 @@ function check(schema, value, field) {
327
323
  if (!parsed.success) throw invalid(parsed.issues, field);
328
324
  return parsed.output;
329
325
  }
330
- /** The trimmed text. Empty only with attachments, or on a subject that allows it. */
331
326
  function cleanBody(runtime, input) {
332
327
  if (input.body.length > 1e4) throw fail(commentsErrorDiagnostics.COMMENTS_R0018({ message: `body: Keep a message under ${maximumCommentBodyLength.toLocaleString("en")} characters.` }), 400);
333
328
  const trimmed = input.body.trim();
@@ -343,10 +338,6 @@ function attachmentsOf(list) {
343
338
  function newId(prefix) {
344
339
  return `${prefix}_${crypto.randomUUID()}`;
345
340
  }
346
- /**
347
- * Runs `onComment` before the answer and `onMention` after it, for one saved message. Work that `onComment` gives to
348
- * `waitUntil` also runs after the answer. A failure is logged and never fails the comment.
349
- */
350
341
  async function announce(runtime, thread, message, mentions, fresh, options) {
351
342
  if (!message) return;
352
343
  const { onComment, onMention } = runtime.definition;
@@ -568,7 +559,6 @@ function decodeBase64(data) {
568
559
  for (let index = 0; index < binary.length; index++) bytes[index] = binary.charCodeAt(index);
569
560
  return bytes;
570
561
  }
571
- /** Binds an upload to its exact key and bytes, including after a process restart or an app Blob replacement. */
572
562
  async function attachmentRecord(key, data) {
573
563
  const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", new Uint8Array(data)));
574
564
  const sha256 = Array.from(digest, (byte) => byte.toString(16).padStart(2, "0")).join("");
@@ -1,6 +1,6 @@
1
- import { C as CommentsDefinition, T as CommentsPeople, j as CommentsUser } from "./types-qzJKgWYS.js";
1
+ import { C as CommentsDefinition, T as CommentsPeople, j as CommentsUser } from "./types-VSVs4jIw.js";
2
2
  import { a as commentThreads, i as commentMessages, n as commentCounters } from "./database-DUs3c2al.js";
3
- import { D as CommentUser, S as CommentStatus, T as CommentThread, b as CommentMetadata, n as CommentActor, r as CommentAnchor, s as CommentContext, v as CommentListQuery, w as CommentSubject } from "./types-BX3vH18p.js";
3
+ import { D as CommentUser, S as CommentStatus, T as CommentThread, b as CommentMetadata, n as CommentActor, r as CommentAnchor, s as CommentContext, v as CommentListQuery, w as CommentSubject } from "./types-BmzTyGt-.js";
4
4
  import "valibot";
5
5
  import { LibSQLDatabase } from "drizzle-orm/libsql";
6
6
  /** The part of `checkRateLimit()` from `vite-hub/rate-limit` that a public write calls. */