@bigmistqke/whiteboard 0.0.0-stage → 0.2.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.
- package/LICENSE +21 -0
- package/README.md +628 -2
- package/bin/whiteboard.ts +488 -0
- package/dist/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/taggedTemplateLiteral.js +5 -0
- package/dist/bin/whiteboard.js +542 -0
- package/dist/client/runtime.js +544 -0
- package/dist/define.js +7 -0
- package/dist/plugins/callout/README.md +13 -0
- package/dist/plugins/callout/index.js +27 -0
- package/dist/plugins/callout/style.css +12 -0
- package/dist/plugins/chat/README.md +46 -0
- package/dist/plugins/chat/client.js +3 -0
- package/dist/plugins/chat/index.js +47 -0
- package/dist/plugins/chat/style.css +24 -0
- package/dist/plugins/claude-code/index.js +120 -0
- package/dist/plugins/code/README.md +42 -0
- package/dist/plugins/code/diff.js +65 -0
- package/dist/plugins/code/index.js +77 -0
- package/dist/plugins/code/style.css +29 -0
- package/dist/plugins/comments/client.js +10 -0
- package/dist/plugins/comments/index.js +54 -0
- package/dist/plugins/comments/style.css +40 -0
- package/dist/plugins/details/README.md +17 -0
- package/dist/plugins/details/index.js +17 -0
- package/dist/plugins/details/style.css +3 -0
- package/dist/plugins/forge/README.md +12 -0
- package/dist/plugins/forge/index.js +83 -0
- package/dist/plugins/form/README.md +111 -0
- package/dist/plugins/form/index.js +102 -0
- package/dist/plugins/form/style.css +41 -0
- package/dist/plugins/gallery/README.md +30 -0
- package/dist/plugins/gallery/client.js +1 -0
- package/dist/plugins/gallery/index.js +74 -0
- package/dist/plugins/gallery/style.css +27 -0
- package/dist/plugins/grid/README.md +33 -0
- package/dist/plugins/grid/index.js +33 -0
- package/dist/plugins/grid/style.css +25 -0
- package/dist/plugins/iframe/README.md +18 -0
- package/dist/plugins/iframe/client.js +1 -0
- package/dist/plugins/iframe/index.js +40 -0
- package/dist/plugins/iframe/style.css +29 -0
- package/dist/plugins/index.js +30 -0
- package/dist/plugins/mermaid/README.md +21 -0
- package/dist/plugins/mermaid/index.js +35 -0
- package/dist/plugins/mermaid/style.css +16 -0
- package/dist/plugins/quiet/README.md +26 -0
- package/dist/plugins/quiet/index.js +17 -0
- package/dist/plugins/terminal/client.js +41 -0
- package/dist/plugins/terminal/host.js +332 -0
- package/dist/plugins/terminal/index.js +171 -0
- package/dist/plugins/terminal/modes.js +32 -0
- package/dist/plugins/terminal/server.js +256 -0
- package/dist/plugins/terminal/sizes.js +57 -0
- package/dist/plugins/terminal/style.css +357 -0
- package/dist/solid/index.js +36 -0
- package/dist/src/auth.js +54 -0
- package/dist/src/client/page/base.css +295 -0
- package/dist/src/client/page/main.js +1228 -0
- package/dist/src/config.js +76 -0
- package/dist/src/events.js +183 -0
- package/dist/src/html.js +34 -0
- package/dist/src/icons.js +6 -0
- package/dist/src/load.js +77 -0
- package/dist/src/loader.js +126 -0
- package/dist/src/package.js +33 -0
- package/dist/src/pages/blocks.js +50 -0
- package/dist/src/pages/index.js +15 -0
- package/dist/src/pages/markdown.js +410 -0
- package/dist/src/pages/render.js +311 -0
- package/dist/src/plugins.js +238 -0
- package/dist/src/running.js +24 -0
- package/dist/src/serve.js +71 -0
- package/dist/src/server.js +725 -0
- package/dist/src/status.js +71 -0
- package/package.json +131 -4
- package/plugins/callout/README.md +13 -0
- package/plugins/callout/index.ts +25 -0
- package/plugins/callout/style.css +12 -0
- package/plugins/chat/README.md +46 -0
- package/plugins/chat/autosize.ts +101 -0
- package/plugins/chat/client.tsx +93 -0
- package/plugins/chat/index.ts +61 -0
- package/plugins/chat/style.css +24 -0
- package/plugins/claude-code/index.ts +136 -0
- package/plugins/code/README.md +42 -0
- package/plugins/code/diff.ts +64 -0
- package/plugins/code/index.ts +94 -0
- package/plugins/code/style.css +29 -0
- package/plugins/comments/client.ts +492 -0
- package/plugins/comments/index.ts +54 -0
- package/plugins/comments/style.css +40 -0
- package/plugins/details/README.md +17 -0
- package/plugins/details/index.ts +21 -0
- package/plugins/details/style.css +3 -0
- package/plugins/forge/README.md +12 -0
- package/plugins/forge/index.ts +71 -0
- package/plugins/form/README.md +111 -0
- package/plugins/form/index.ts +104 -0
- package/plugins/form/style.css +41 -0
- package/plugins/gallery/README.md +30 -0
- package/plugins/gallery/client.tsx +64 -0
- package/plugins/gallery/index.ts +67 -0
- package/plugins/gallery/style.css +27 -0
- package/plugins/grid/README.md +33 -0
- package/plugins/grid/index.ts +36 -0
- package/plugins/grid/style.css +25 -0
- package/plugins/iframe/README.md +18 -0
- package/plugins/iframe/client.ts +46 -0
- package/plugins/iframe/index.ts +54 -0
- package/plugins/iframe/style.css +29 -0
- package/plugins/index.ts +21 -0
- package/plugins/mermaid/README.md +21 -0
- package/plugins/mermaid/index.ts +40 -0
- package/plugins/mermaid/style.css +16 -0
- package/plugins/quiet/README.md +26 -0
- package/plugins/quiet/index.ts +27 -0
- package/plugins/terminal/client.ts +317 -0
- package/plugins/terminal/host.ts +326 -0
- package/plugins/terminal/index.ts +138 -0
- package/plugins/terminal/modes.ts +30 -0
- package/plugins/terminal/server.ts +215 -0
- package/plugins/terminal/sizes.ts +60 -0
- package/plugins/terminal/style.css +71 -0
- package/skills/whiteboard/SKILL.md +302 -0
- package/solid/index.tsx +59 -0
- package/src/auth.ts +66 -0
- package/src/client/forms.ts +185 -0
- package/src/client/markdown.ts +36 -0
- package/src/client/page/base.css +295 -0
- package/src/client/page/elsewhere.ts +70 -0
- package/src/client/page/fresh.ts +205 -0
- package/src/client/page/live.ts +30 -0
- package/src/client/page/main.ts +272 -0
- package/src/client/page/orphans.ts +46 -0
- package/src/client/page/sort.ts +38 -0
- package/src/client/page/theme.ts +32 -0
- package/src/client/page/view.ts +9 -0
- package/src/client/page/waiting.ts +182 -0
- package/src/client/read.ts +73 -0
- package/src/client/runtime.ts +183 -0
- package/src/client/toast.ts +25 -0
- package/src/config.ts +96 -0
- package/src/define.ts +612 -0
- package/src/events.ts +218 -0
- package/src/html.ts +40 -0
- package/src/icons.ts +8 -0
- package/src/load.ts +89 -0
- package/src/loader.ts +112 -0
- package/src/package.ts +39 -0
- package/src/pages/blocks.ts +70 -0
- package/src/pages/index.ts +42 -0
- package/src/pages/markdown.ts +364 -0
- package/src/pages/render.ts +233 -0
- package/src/plugins.ts +197 -0
- package/src/running.ts +22 -0
- package/src/serve.ts +52 -0
- package/src/server.ts +667 -0
- package/src/status.ts +113 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var e=class extends Error{constructor(e){let t=Error,n=t.stackTraceLimit;n!==void 0&&(t.stackTraceLimit=0),super(),n!==void 0&&(t.stackTraceLimit=n),this.source=e}},t=class extends Error{constructor(e,t){try{var n=String(t instanceof Error?t.message:t)}catch{}super(n,{cause:t}),this.source=e}};function n(e){return e instanceof t?e.cause:e}var r=class extends Error{constructor(){super(``)}},i=class extends Error{constructor(){super(``)}};const a=4096,o=1<<22,s=1<<21,c=16384,l=1<<23,u={},d={},f=Symbol(`refresh`),p=Set;function m(e){let t=e.pe;for(;t;)t.R|=32,m(t),t=t.Ge}function h(e){e.l&=-33,ht(e)}let g;function _(e){try{e()}catch(e){g||=[e],M()}}function v(e){let t=g;if(g=void 0,t&&!e)throw t[0]}function y(e,t=!1,n){let r=e.R;if(r&64)return;t&&(n||e.T===null||e.T.me===null&&e.T.Le===null||y(e,!1,!0),e.R=r|64,e.X&&(xt(e),(e.m&1&&e.T?.Re!=null||r&2048||F.length)&&M()));let i=n?e.T.me:e.pe;for(n?e.T.me=null:e.pe=null;i;){let e=i;e.l&=-33,R(e,A),ft(e),i.Me=i,y(i,!0),i=i.Ge}if(n||(e.be=0),t&&!n&&!(r&32)&&e._parent!==null&&!(e._parent.R&64)){let t=e.Me,n=e.Ge;t===null?e._parent.pe=n:t.Ge=n,n!==null&&(n.Me=t),e.Me=null}if(ee(e,n),t&&e.ze){let t=e.ze;e.ze=void 0,_(t)}}function b(e,t){let n=e.pe;t.Me=null,t.Ge=n,n!==null&&(n.Me=t),e.pe=t}function ee(e,t){let n=t?e.T.Le:e.ke;if(n){if(t?e.T.Le=null:e.ke=null,Array.isArray(n))for(let e=n.length-1;e>=0;e--)_(n[e]);else _(n)}}function te(e,t){let n=e;for(;n.l&4&&n._parent;)n=n._parent;if(n.id!=null)return ie(n.id,t?n.be++:n.be);throw Error()}function ne(e){return te(e,!0)}function re(e,t,n){return e?.id??(t?n?.id:n?.id==null?void 0:ne(n))}function ie(e,t){let n=t.toString(36),r=n.length-1;return e+(r?String.fromCharCode(64+r):``)+n}function x(){return H}function ae(e,t=H){return t&&(t.ke?Array.isArray(t.ke)?t.ke.push(e):t.ke=[t.ke,e]:t.ke=e),e}function oe(e=!0){y(this,e),g&&!I.Y&&v()}function se(e){let t=H,n=e?.transparent??!1,r={id:re(e,n,t),l:n?4:0,R:0,Qe:!0,Ke:t?.Qe?t.Ke:t,pe:null,Ge:null,Me:null,ke:null,A:t?.A||d,be:0,T:null,_parent:t,dispose:oe};return t&&b(t,r),r}function ce(e,t){let n=se(t);return q(n,()=>e(oe.bind(n,!0)))}let le=null,S=null,ue=null,de=null,fe=null;function pe(e,t,n,r,i){le=e,S=t,ue=n,de=r,fe=i}const C=[];function me(e,t=null){let n={ln:[],rn:[[],[]],fn:[],eo:null,_parent:t,P:e,Pe:null,tt:0,nt:!1,nn:null,Ue:!1,un:!1,I:null};return e||C.push(n),n}let w=null;function he(e){w=e}let T=null,E=null;function ge(e,t){if(I.Y&&!t||T!==null)return k(e);E===null?E=O(e):ve(O(e),E),M()}function D(e){return e.T.Re=O(e.T.Re)}function _e(e){return e=O(e),C.indexOf(e)===-1?null:e}function O(e){for(;e.eo!==null;)e=e.eo;return e}function k(e){let t=T;t===null?T=e===null?me(!1):O(e):e!==null&&ve(O(e),t),I.Y||M()}function ve(e,t){e=O(e),t=O(t),e===t||e.P||t.P||(e.eo=t,t.tt+=e.tt,t.nt||=e.nt,P(t.ln,e.ln),P(t.rn[0],e.rn[0]),P(t.rn[1],e.rn[1]),P(t.fn,e.fn),e.I!==null&&P(t.I??=[],e.I),C.splice(C.indexOf(e),1))}function ye(e){let t=be;be??=e;let n=e.tt!==0||Se(e.ln,e)||!1;return be=t,n}let be=null;function xe(e,t){let n=e.T?.se;if(n===void 0)return!0;for(let e of n){let n=e.T?.Re;if(n==null||O(n)===t)return!0}return!1}function Se(e,t,n=!1){for(let r=0;r<e.length;r++){let i=e[r];if(!(!(i.m&1)||i.R&64||i.l&8192||i.T.Re!==null&&D(i)!==t||n&&!xe(i,t))){if(i.i===1){if(Ce(i,be??t))return!0}else for(let e=i.o;e!==null;e=e.t){let n=e.u;if((n.i===1&&n.m&1||n.R&2048||n.l&16384&&n.m===1)&&(e.Ne===n.de||n.T?.U!=null)&&!(n.R&64)&&Ce(n,be??t))return!0}}}return!1}function Ce(e,t){return!(e.R&32&&we(e,t))&&!ue?.(e)}function we(e,t){let n=e;for(;n?.R&32;)n=n._parent;return n?.l&256&&n.T?.Re!=null&&D(n)===O(t)}const Te=[];function Ee(e){Te.push(e)}const De=[];function Oe(e){R(e,A),e.R&=-4,De.push(e)}function ke(e,t){e.l|=256,Ae(e,t)}function Ae(e,t){let n=G(e);n.Re!==t&&(n.Re=t,t.ln.push(e))}function je(e,t){for(let n=e.pe;n!==null;n=n.Ge)n.T?.Re?.P||(n.X!==void 0&&(n.l&256||ke(n,t),n.l|=1048576),je(n,t))}function Me(e,t,n){for(let r=e.pe;r!==null;r=r.Ge)(r.l&2304)==256&&D(r)!==t&&n(r),Me(r,t,n)}function Ne(e){e.T.Re=null,e.l&=-257}const A={et:Array(2e3).fill(void 0),p:!1,Fe:0,Et:0};let j=0,Pe=!1,Fe=!1,Ie=!1,Le=0;function M(){Fe?Ve():Pe||(Pe=!0,!Le&&!I.Y&&queueMicrotask(et))}const Re=Symbol.for(`solid-js/root-error-hook`),ze=`[REACTIVITY_HALTED]`;function Be(e){if(Fe)return;Fe=!0,v(!0);let t=ze,n=e!==void 0&&globalThis.reportError;n||e===void 0?console.error(t):console.error(t,e),n&&n(e)}function Ve(){Ie||(Ie=!0,console.error(ze))}var N=class e{rn=[[],[]];Y=!1;flush(){if(!this.Y){this.Y=!0,cn(),w=null,E=null;try{_t(),st(A,e._e),this.settle(),j++,Pe=A.Et>=A.Fe||F.length!==0,this.run(1),this.run(2)}finally{this.Y=!1,E=null}}}settle(){let e=T;T=null;let t=e!==null&&!e.P?O(e):null;if(t!==null){let e=F.length;for(let n=0;n<e;n++){let e=F[n];if(!(e.l&2304)&&(e.T===null||e.T.Re===null||!e.T.Re.P)){if(e.ue===u&&e.m&4&&e.i!==1)continue;if(e.ue!==u&&!(e.m&5)&&e.T?.me==null&&e.T?.Le==null&&hn(e,e.le,e.ue)){e.ue=u,e.l&=-129;continue}ke(e,t)}e.l&128&&je(e,t)}F.length=0,De.splice(0)}else{$e();for(let e=0;e<Te.length;e++){let t=Te[e];t.T?.U==null&&!t.Ae&&dt(t)}}Te.length&&=0;let n=this.rn;this.rn=[[],[]];for(let e=C.length-1;e>=0;e--){let t=C[e];ye(t)||(C.splice(e,1),Ue(t),e=C.length)}let r=t&&_e(t),i=r!==null;for(let e=0;e<2;e++)i&&P(r.rn[e],n[e]),this.rn[e]=i||this.rn[e].length?[].concat(i?[]:n[e],this.rn[e]):n[e];if(De.length!==0){let e=De.splice(0).sort((e,t)=>e.he-t.he);for(let t=0;t<e.length;t++)e[t].R&64||U(e[t])}de?.()}run(e){let t=this.rn[e-1];t.length&&(this.rn[e-1]=[],tt(t,e))}enqueue(e,t,n=w){e&&(n?.P?n:this).rn[e-1].push(t),M()}notify(e,t,n,r){return le?.(e,n&t,r)?!0:t&1?(n&1&&w===null&&k(null),!0):!1}};function He(e){let t;for(let n=0;n<e.fn.length;n++){let r=e.fn[n],i=r.T?.U?.source;if(!(r.R&64||r.m&2&&(r.i||!(r.l&8388608))&&i!==r&&(i?.m??2)&2)&&r.R&2048){t||=r.i||i===r||r.l&256,e.P||(r.R&=-2049),r.Ae=!1;for(let e=r.pe;e!==null;e=e.Ge)e.i&&(e.Ae=!1);L(r)}}return e.fn.length=0,t}function Ue(e){let t=He(e);for(let t=0;t<e.ln.length;t++){let n=e.ln[t];n.T.Re!==null&&D(n)===e&&(n.T.Re=null,Qe(n))}T===e&&(T=null),t?I.rn[1].push(()=>We(e)):We(e)}function We(e){for(let t=0;t<2;t++)P(I.rn[t],e.rn[t]),e.rn[t]=[]}function P(e,t){for(let n=0;n<t.length;n++)e.push(t[n])}const F=[];function Ge(e,t){e.R&2048||(e.R|=2048,t.fn.push(e))}function Ke(e){F.push(e),I.Y||nn()}let qe=0;function Je(){qe++}function Ye(e){e.we=qe;let t=!!(e.l&512)&&e.T?.De!==void 0;for(let n=e.o;n!==null;n=n.t){let e=n.u;e.R&4&&n.Ne===e.de&&n!==e._&&(e.R|=a),t&&e.l&8?e.R|=256:L(e)}}function Xe(e){e.Ae=!0,I.enqueue(e.i,e.W??=N.q.bind(null,e))}function Ze(e){return e.ue!==u&&(e.le=e.ue,e.ue=u)}function Qe(e){let t=e;if(!t.X){e.l&=-385,Ze(e);return}let n=e.ue===u&&!!(t.m&1),r=e.l&s;if(!n&&t.T&&(t.T.Te=null),e.l=n?e.l&-1048833|1024:e.l&-3147137,r){let n=e.ue;e.ue=u,e.ie=j+1,It(t,2,n)}else Ze(e)&&(t.m&=-5,t.T!=null&&(t.T.Ve=!1,t.T.je=u),e.i&&e.i!==3&&Xe(e));t.Ie=!1,t.R&=-1025,t.T?.U??dt(t),t.m&1||(t.m&=-5),n||t.T==null||t.T.me===null&&t.T.Le===null||N.Ce(t,!1,!0)}function $e(){for(let e=0;e<F.length;e++){let t=F[e];t.l&2304||Qe(t)}F.length=0}const I=new N;function et(e){if(e){Le++;try{return e()}finally{try{et()}finally{Le--}}}if(!I.Y&&!Fe){for(;Pe;)I.flush();v()}}function tt(e,t){for(let n=0;n<e.length;n++)e[n](t)}function L(e){A.Fe>e.he&&(A.Fe=e.he),rt(e,A)}function nt(e,t){let n=(e._parent?.Qe?e._parent.Ke?.he:e._parent?.he)??-1;n>=e.he&&(e.he=n+1);let r=e.he,i=t.et[r];if(i===void 0)t.et[r]=e;else{let t=i.We;t.ve=e,e.We=t,i.We=e}r>t.Et&&(t.Et=r)}function rt(e,t){let n=e.R;n&12||(n&1?e.R=n&-4|10:(e.R=n|8,t.p&&ot(e)),n&16||nt(e,t))}function it(e,t){let n=e.R;n&28||(e.R=n|16,nt(e,t))}function R(e,t){let n=e.R;if(!(n&24))return;e.R=n&-25;let r=e.he;if(e.We===e)t.et[r]=void 0;else{let n=e.ve,i=t.et[r],a=n??i;e===i?t.et[r]=n:e.We.ve=n,a.We=e.We}e.We=e,e.ve=void 0}function at(e){if(!e.p){e.p=!0;for(let t=0;t<=e.Et;t++)for(let n=e.et[t];n!==void 0;n=n.ve)n.R&8&&ot(n)}}function ot(e,t=2){let n=e.R;if(!((n&3)>=t)){e.R=n&-4|t;for(let t=e.o;t!==null;t=t.t)ot(t.u,1)}}function st(e,t){for(e.p=!1,e.Fe=0;e.Fe<=e.Et;e.Fe++){let n=e.et[e.Fe];for(;n!==void 0;)n.R&8?t(n):ct(n,e),n=e.et[e.Fe]}e.Et=0}function ct(e,t){R(e,t);let n=e.he;for(let t=e.C;t;t=t.G){let e=t.S;e.X&&e.he>=n&&(n=e.he+1)}if(e.he!==n){e.he=n;for(let n=e.o;n!==null;n=n.t)it(n.u,t)}}let lt;function ut(e){let t=e.S,n=e.G,r=e.t,i=e.en;if(r===null?t.Ze=i:r.en=i,i!==null)i.t=r;else if(t.o=r,r===null){t.l&4096?lt(t):t.T?.Ye&&_(t.T.Ye);let e=t;e.X&&e.l&32&&!(e.R&32)&&!(e.m&1)&&(pt?pt.push(e):ht(e))}return n}function dt(e){let t=e._,n=t===null?e.C:t.G;if(n!==null){do n=ut(n);while(n!==null);t===null?e.C=null:t.G=null}}function ft(e){e.C&&(e._=null,dt(e))}let pt=null;const mt=e=>pt=e;function ht(e){R(e,A),ft(e),y(e,!0)}const gt=new p;function _t(){if(gt.size!==0){for(let e of gt)!e.o&&e.l&32&&!(e.m&1)&&!(e.R&96)&&ht(e);gt.clear()}}function vt(e,t){let n=t._;if(n!==null&&n.S===e)return;let r=null,i=t.R&4;if(i&&(r=n===null?t.C:n.G,r!==null&&r.S===e)){r.Ne=t.de,t._=r;return}let a=e.Ze;if(a!==null&&a.u===t&&(!i||a.Ne===t.de))return;let o=t._=e.Ze={S:e,u:t,G:r,en:a,t:null,Ne:t.de};n===null?t.C=o:n.G=o,a===null?e.o=o:a.t=o,Je()}function yt(e,t){return!e.T?.se?.has(t)&&((G(e).se??=new p).add(t),!0)}function bt(e,t){let n=e.T?.se;return n?.delete(t)?(n.size||(e.T.se=void 0),!0):!1}function xt(e){e.T!==null&&(e.T.Ee=null)}function St(e){e.T!==null&&(e.T.se=void 0)}function Ct(e,t){for(let n=e.C;n;n=n.G){let e=n.S;if(e===t||e.T?.se?.has(t))return!0}return!1}function wt(e,t){G(e).fe=!0,t.source&&yt(e,t.source),e.m&2||z(e,t.source,t)}function z(t,n,r){if(!n){t.T!==null&&(t.T.U=null);return}let i=r instanceof e&&r.source===n?r:t.T?.U;G(t).U=i instanceof e&&i.source===n?i:new e(n)}function Tt(e,t){for(let n=e.o;n!==null;n=n.t)t(n.u,n)}function Et(e,t){let n=new p,r=e=>{let i=n.has(e);t(e,i)!==!1&&!i&&(n.add(e),Tt(e,r))};Tt(e,r)}function Dt(e){e.X&&e.l&32&&!e.o&&!(e.R&32)&&!(e.m&1)&&(e.R&8?e.R|=o:ht(e))}function Ot(e){let t;if(Et(e,(e,n)=>{!n&&!e.o&&e.l&32&&(t??=[]).push(e)}),t)for(let e of t)Dt(e)}function kt(e,n,r){return!(e.l&256||r&&e.R&16384&&I.Y&&!e.rr)||w?!1:(St(e),e.T&&(e.T.fe=!1),(e.m&=6)&2||z(e),e.ue=n instanceof t?n:new t(e,n),e.l|=2097280,B(e),M(),!0)}function At(e,t){let n=!1;Et(e,(e,r)=>{!r&&e.T?.U===t&&(L(e),n=!0)}),n&&M()}function B(e,t=e){bt(e,t);let n=!1,r;if(Et(e,(i,a)=>{if(a||t!==e&&Ct(i,t)||!bt(i,t))return!1;i.ie=j;let o=i.T?.se?.values().next().value,s=i.m&2;o?s||z(i,o):(i.m&=-2,s||z(i),i.l&256&&k(D(i)),i.T?.fe&&(L(i),n=!0),i.T!==null&&(i.T.fe=!1),!i.o&&i.l&32&&(r??=[]).push(i))}),r)for(let e of r)Dt(e);n&&M()}function jt(e){return typeof e==`object`&&!!e&&typeof e.then==`function`}function Mt(e){let t=e.T?.Se;t!=null&&(e.T.Se=null,t())}function Nt(t,n,r,i){let a=!1,o=!1;if(typeof n==`object`&&n&&Qt(()=>{a=n[Symbol.asyncIterator],o=!a&&jt(n)}),!o&&!a)return t.T!==null&&(t.T.Ee=null),t.Ie=!1,n;G(t).Ee=n,t.T.ce=2147483647,t.T.se=void 0;let s,c=r=>{if(t.T?.Ee!==n)return;let a=r instanceof e;a&&t.Ie?(xt(t),wt(t,r),t.ie=j):((a||!kt(t,r))&&(It(t,a?1:2,r),a||y(t,!1,!0)),a&&B(t),t.ie=j,a||Ot(t),i?.(r,a))},l=(e,i)=>{if(t.T?.Ee!==n||t.R&2)return;let a=t.m&4;if(Ft(t),r){try{r(e)}catch(e){c(e);return}t.l&256||(t.T.Te=null,t.l&=-1025),a&&Ft(t,!0)}else K(t,()=>e);t.ue===u&&(t.Ie=!1,dt(t)),B(t),M(),et(),i?.()},d=()=>t.l&32&&!t.o&&!(t.m&1)?(ht(t),!0):!1,f=(e,r)=>{let i=e[Symbol.asyncIterator](),a=!1,o=!1,u=!r,f=()=>{if(!o){o=!0;try{let e=i.return?.();jt(e)&&e.then(void 0,()=>{})}catch{}}};ae(f,r),G(t).Se=f;let p=()=>{try{d()||m()}catch(e){c(e)}},m=()=>{let e,r,f=!1,h=!1,g=!0,_=i.next();if((jt(_)?_:{then:e=>void e(_)}).then(r=>{if(g&&u)e=r,f=!0,r.done&&(o=!0);else if(t.T?.Ee!==n)return;else r.done?(o=!0,a?(M(),et()):l(void 0),d()):(a=!0,l(r.value,p))},e=>{g&&u?(r=e,h=!0):t.T?.Ee===n&&(o=!0,c(e),d())}),g=!1,h){if(o=!0,c(r),u)throw r;return!0}return f&&!e.done?(s=e.value,a=!0,m()):f&&e.done},h=m();return u=!1,a||h},p=null,m=(e,t)=>{let n=!1;if(typeof e==`object`&&e&&Qt(()=>{n=e[Symbol.asyncIterator]}),!n)return!1;s=void 0;let r=f(e,t);return t||(p=r),!0};if(o){let e=!1,r=!1,i,a=!0;if(n.then(r=>{if(a)s=r,e=!0;else{try{if(t.T?.Ee===n&&!(t.R&64)&&m(r,t))return;l(r)}catch(e){c(e)}d()}},e=>{a?(i=e,r=!0):(c(e),d())}),a=!1,r)throw c(i),i;e?m(s)||(t.Ie=!1):p=!1}if(a&&m(n),p!==null){if(!p){if(t.Ie)return t.le;throw new e(H)}t.Ie=!1}return s}function Pt(e,t=!1){e.T?.se&&St(e),e.T?.fe&&(e.T.fe=!1),e.m=t?0:e.m&4,e.T?.U&&z(e);let n=qt(e);n&&n.call(e)}function Ft(e,t=!1){let n=e.T?.se;n&&(n.delete(e),n.size)?(e.T.fe=!1,t&&(e.m=1),z(e,n.values().next().value)):Pt(e,t)}function It(n,r,i){r===2&&!(i instanceof t)&&!(i instanceof e)&&(i=new t(n,i));let a=r===1&&i instanceof e&&i.source;a?(n.m&2&&(n.T.Te=n.T.U),yt(n,a)):St(n),n.m=r|(r===2?n.m&12?8:0:r===1&&n.m&8?4:n.m&4),a?z(n,a,i):G(n).U=i;let o=qt(n);o?o.call(n):Lt(n,r,i)}function Lt(t,n,r){let i=n===1&&r instanceof e&&r.source;Tt(t,(e,a)=>{e.ie=j,e.l&16384||n===1&&a.Ne!==e.de?(n!==1&&bt(e,t),L(e),M()):i&&e.T?.se?.has(i)?w===null&&(e.l&2304)==256&&I.Y&&!S?.(e,i.ie===j)&&k(D(e)):(i||n!==1&&(e.T?.U!==r||e.T?.se))&&(Ke(e),n===1&&(e.l&2304)==256&&!e.i&&k(D(e)),It(e,n,r),e.rr?.st(n,r))})}N._e=e=>{e.i===3?(R(e,A),e.Ae=!0,I.enqueue(2,e.Z)):e.R&32&&!(e.R&65536)?Oe(e):U(e)},N.Ce=y;let V=!1,H=null;function U(t,n=!1){Je();let r=t.i,i,c=t.l&s;if(!n){if(R(t,A),t.T!==null&&(t.T.Ee=null,Mt(t)),t.l&256){let e=D(t);e.P||t.l&524288||(t.l&8421376?e!==T&&!(t.m&4||t.l&1048576)&&(t.ue!==u&&Ye(t),t.ue=u,t.l&=-257):ge(e,S?.(t,t.m&4)))}if(r===3||t.l&128){let e=pt;mt(i=[]),y(t),mt(e)}else(t.pe!==null||t.ke!==null)&&Ut(t);t.l&2097152&&(t.ue=u,t.l^=s)}let l=t.m&4,d=t.m&2&&t.T?.U,f=!!(t.m&1)&&t.T?.se,p=t.T?.se?.has(t),m=!1,h=!!(t.R&8192)&&!(t.m&1&&t.T!==null&&!t.T.Ve),g=H;H=t,t._=null,t.de++;let _=t.R&o;t.R=4|t.R&8224,t.ie=j;let v=t.ue===u?t.l&2048&&t.T.P!==u?t.T.P:t.le:t.ue,b=t.he,ee=!1,te=!1,ne=V;V=!0;try{if(t.l&64)v=t.X(v),t.T!==null&&(t.T.Ee=null),t.Ie=!1;else{let e=t.T?.Ee,n=t.X(v),r=typeof n==`object`&&!!n,i=t.T?.Ee!==e;v=i||!r?n:Nt(t,n),!i&&!r&&(t.T!==null&&(t.T.Ee=null),t.Ie=!1)}(t.m!==0||t.T!==null)&&Pt(t,n)}catch(n){let r=n instanceof e;if(r&&t.Ie)wt(t,n);else if((r||!(m=kt(t,n,!0)))&&(r&&(G(t).fe=!0),It(t,r?1:2,n),r&&p&&!t.T?.Ee&&B(t)),(r||m)&&f)for(let e of f)e!==t&&!(t.T?.se?.has(e)&&(e.m&1||Ct(t,e)))&&B(t,e)}finally{if(V=ne,ee=!!(t.R&a),te=!!(t.R&128),t.R=t.R&936032|(n?t.R&256:0),H=g,i)for(let e of i)Dt(e);t.T!==null&&(t.T.Ve=h&&!!(t.m&1))}if(t.R&64){ft(t),xt(t);return}let re=!!t.T?.U||m;if(!re){let e=t.ue===u,i=e?t.l&2048&&t.T.P!==u?t.T.P:t.le:t.ue,a=e&&l&&!r||!!t.T?.Te||!!c||!hn(t,i,v);if(r&&a&&!(t.R&262144&&!t.Ae&&Object.is(t.ge,v))&&e&&(t.Ae=!t.T?.U,n||I.enqueue(r,t.W??=N.q.bind(null,t),null)),!re){if(a)(n?!((T!==null||E!==null)&&(te||Ht(g)?.R&128)):r&&t.ue===u)?t.le=v:(t.ue=v,d&&(t.T.Te=d),n&&(ke(t,T??E),t.m|=4,S?.(t,T))),t.o!==null&&Ye(t);else if(t.he!=b)for(let e=t.o;e!==null;e=e.t)it(e.u,A)}if(!a&&!t.T?.U&&(d&&At(t,d),f))for(let e of f)e!==t&&B(t,e);p&&!(t.m&5)&&B(t)}if(n&&te&&t.m&1){let e=T??E;e&&!e.P&&(r&&S?.(t)===2||ke(t,e))}!t.T?.U&&t.ue===u&&!(r&&t.Ae)&&(n||r===3?dt(t):Ee(t)),(t.ue!==u||t.T!==null&&(t.T.me!==null||t.T.Le!==null)||t.m&5&&(!n||t.m&1))&&(t.l|=128,Ke(t)),ee&&(L(t),M()),_&&Dt(t)}function Rt(e){if(!(e.R&68)){if(e.R&1)for(let t=e.C;t;t=t.G){let n=t.S;if(n.X&&Rt(n),e.R&2)break}(e.R&2||e.T?.U&&e.ie<j&&!e.T?.Ee)&&U(e),e.R&=937336}}function W(e,t){let n=t?.transparent??!1,r=typeof t==`object`&&!!t&&`loadingValue`in t,i={id:re(t,n,H),l:(n?4:0)|!!t?.ownedWrite|(!H||t?.lazy?32:0)|(t?.sync?64:0)|(t?.ae?2:0)|(t?.xe??0),ye:t?.equals??Zt,ke:null,A:H?.A??d,be:0,X:e,le:r?t.loadingValue:void 0,he:0,ve:void 0,We:null,C:null,_:null,de:0,o:null,Ze:null,_parent:H,Ge:null,Me:null,pe:null,R:t?.lazy?512:0,m:r?0:4,ie:j,ue:u,we:-1,Ie:r,T:null};return t?.unobserved&&(G(i).Ye=t.unobserved),Yt(i,t),i}function G(e){return e.T??={Ee:null,Se:null,U:void 0,fe:void 0,se:void 0,Ye:void 0,De:void 0,me:null,Le:null,Re:null,Ve:!1,je:u,Be:-1,ce:0,P:u,I:0,Te:null}}function zt(e,t){e.R|=128,(t.m&4||e.i!==1)&&ge(D(t),!e.i&&e.m&4||S?.(e))}function Bt(e,t){if(!(!(e.l&1<<23)||t.l&1024)){let n=D(t);if(!(n===T||Vt(e,n)))return Ge(e,n),!0}return zt(e,t),!1}function Vt(e,t){return(e.m&4||e.l&1048576)&&e.l&256&&D(e)===t}function Ht(e){return e!==null&&e.Qe?e.Ke:e}function Ut(e){m(e);let t=G(e);t.Le=e.ke,t.me=e.pe,e.ke=null,e.pe=null,e.be=0}function Wt(e,t,n,r,i){let a=i?.transparent??!1,o={id:re(i,a,H),l:r<<23|(a?4:0)|!!i?.ownedWrite|(i?.sync?64:0)|(i?.xe??0),ye:!1,ke:null,A:H?.A??d,be:0,X:e,le:void 0,he:0,ve:void 0,We:null,C:null,_:null,de:0,o:null,Ze:null,_parent:H,Ge:null,Me:null,pe:null,R:512,m:4,ie:j,ue:u,we:-1,Ie:!1,Ae:!1,ge:void 0,qe:t,Je:n,ze:void 0,i:r,T:null};return i?.unobserved&&(G(o).Ye=i.unobserved),Yt(o,Jt),o}let Gt=null;function Kt(e){Gt=e}function qt(e){return e.i?Gt:null}const Jt={lazy:!0};function Yt(e,t){e.We=e;let n=H?.Qe?H.Ke:H;H&&b(H,e),n&&(e.he=n.he+1),!t?.lazy&&U(e,!0)}function Xt(e,t){let n={ye:t?.equals??Zt,l:+!!t?.ownedWrite|(t?.ae?2:0),le:e,o:null,Ze:null,ie:j,ue:u,we:-1,T:null};return t?.unobserved&&(G(n).Ye=t.unobserved),n}function Zt(e,t){return e===t}function Qt(e,t){let n=V;V=!1;try{return e()}finally{V=n}}function $t(e,t){if(e.R&512)e.R&=-513,U(e,!0);else if(e.R&64&&e.l&32){let t=e._parent;if(t!==null){if(t.R&64){e.l&=-33;return}e.R&32||b(t,e)}U(e,!0)}}function en(e,t){return!t||e.ue===u||t.l&16}let tn=!1;function nn(){tn=!0}function rn(e){return I.Y||e.ue===u||e.l&4194304?u:e.l&256?e.T.Be===j?e.T.je:u:e.le}function an(e){let t=e.T;t.Be!==j&&(t.je=e.ue,t.Be=j,tn=!0)}const on=[];function sn(e){return e.R|=a,!0}function cn(){if(tn=!1,on.length!==0){for(let e of on)e.l&=-4194305;on.length=0}}function ln(e,t){e.he>=A.Fe?(ot(t),at(A),Rt(e)):t.l&65536&&Rt(e);let n=e.he;n>=t.he&&e._parent!==t&&(t.he=n+1)}function un(e){let t=H;t?.Qe&&(t=t.Ke);let n=e,r=e;if(typeof n.X==`function`&&$t(e),!n.X&&e.T?.De===void 0&&(!tn||e.ue===u)&&!(e.l&2048))return t&&(V&&vt(e,t),e.l&256&&!(t.l&16)&&Bt(t,e))||!t||e.ue===u||t.l&16||e.ue===e.le&&Object.is(e.ue,e.le)?e.le:(pn(t),e.ue);let i=!1;if(t&&(V&&(vt(e,t),r.X&&ln(r,t)),e.l&256&&!(e.l&2048)&&!(t.l&16)&&(r.m&4?zt(t,e):i=Bt(t,e))),r.m&1&&!i){if(t){if(!(t.l&16)||r.m&4)throw!V&&e!==t&&vt(e,t),r.T?.U}else if(r.m&4)throw r.T?.U}if(r.X&&r.m&2){if(V&&r.ie<j)return U(r),un(e);throw!i&&e.l&2097152&&fn(e,t),r.T?.U}(i||!t)&&dn(e);let a=fn(e,i?null:t);return!t&&typeof n.X==`function`&&e.l&32&&!(r.m&1)&&!e.o&&(gt.add(e),M()),a}function dn(e){if(e.T?.Te)throw e.T.Te}function fn(t,n){if(t.ue!==u&&t.m&4&&(!n||n.l&16))throw new e(null);let r=n&&tn?rn(t):u;if(r!==u)return sn(n),r;if(en(t,n))return t.le;if(pn(n,t),t.l&2097152)throw t.ue;return t.ue}function pn(e,t){t?.m&4||(e.R|=16384)}function mn(e){I.Y||e.l&4194304||(e.l|=4194304,on.push(e))}function hn(t,n,r){if(t.ye===Zt)return n===r;try{return t.ye&&t.ye(n,r)}catch(n){if(!(n instanceof e))return It(t,2,n),!0}}function K(e,t){let n=e.ue===u?e.le:e.ue;if(typeof t==`function`&&(t=t(n)),e.l&256&&k(D(e)),!(e.m&4||e.T?.Te||!hn(e,n,t)))return t;let r=e.ue!==u;return r?e.l&256&&!I.Y&&an(e):Ke(e),e.ue=t,H!==null&&mn(e),e.X!==void 0&&(e.ie=j),r&&e.we===qe||(Ye(e),M()),t}function gn(e,t){let n=e.l&256&&!(e.R&1024)&&D(e)!==T;if(n&&typeof t==`function`){let n=t(e.le);t=()=>n}return e.m&2&&(e.T.Te=e.T.U,It(e,0)),t=K(e,t),e.l&=-2097153,n?(e.R=e.R&-2|2,rt(e,A),M()):e.ue!==u&&(e.R|=1024),t}function q(e,t){let n=H,r=V;H=e,V=!1;try{return t()}finally{H=n,V=r}}function _n(e,t=!0){try{return e()}finally{}}function vn(e,t=x()){let n;if(t&&(n=t.A[e.id]),n===void 0&&(n=e.defaultValue),n===void 0)throw new i;return n}function yn(e,t,n=x()){if(!n)throw new r;n.A={...n.A,[e.id]:t===void 0?e.defaultValue:t}}function bn(e,t,n,r){let i=Wt(e,t,n,r?.user?2:1,r);U(i,!0),r?.defer?Ze(i):i.ue===u&&(i.T?.Re?.P||i.i===2||r?.schedule?I.enqueue(i.i,Cn.bind(null,i),i.T?.Re):Cn(i,0))}function xn(){let e=this.m,t=this.T?.U;if(e&2){if(I.notify(this,1,0),this.i===2){this.m&2&&Xe(this);return}Sn(this,n(t))}else this.i===1&&I.notify(this,3,e,t)}function Sn(e,t,n){if(!I.notify(e,2,2))throw Be(t),t}function Cn(e,r){if(!e.Ae||e.R&64||r&&fe?.(e))return;if(e.m&2&&e.i===2){let t=n(e.T?.U);e.ge=e.le,e.Ae=!1;try{e.Je?e.Je(t,()=>{let t=e.ze;e.ze=void 0,t?.()}):console.error(t)}catch(t){Sn(e,t)}return}let i=e.T?.U==null,a=e.ze;e.ze=void 0;try{a?.(),e.ze=e.qe(e.le,e.ge)}catch(n){G(e).U=new t(e,n),e.m|=2,Sn(e,n)}finally{e.ge=e.le,e.Ae=!1,i&&dt(e)}}N.q=Cn;function wn(e,t){let n=!1,r,i=()=>{if(!a.Ae||a.R&64||fe?.(a))return;let e=qe;n=!1;try{a.Ae=!1,U(a)}finally{}for(let t=a.C;t!==null;t=t.G){let o=t.S;if(o.ue!==u&&!(o.l&2048)&&(o.ue!==o.le||!Object.is(o.ue,o.le))){if(o.l&256)n||(n=!0,D(o).rn[1].push(r||=()=>{n&&(a.Ae=!0,i())}));else if(o.we<=e||o.X){L(a),M();break}}}},a=W(()=>{let t=a.ze;a.ze=void 0,t?.();let n=_n(e);a.ze=n},{...t,lazy:!0});a.ze=void 0,a.l=a.l&-33|16,a.Ae=!0,a.i=3,a.Z=i,L(a),M()}Kt(xn);const Tn=/* @__PURE__ */ new WeakSet;function En(e){for(let t=e;t;t=t._parent){let e=t[Re];if(e!==void 0)return e}}function Dn(e){let t=[];for(let n=e;n;n=n._parent){let e=n._name;typeof e==`string`&&e.length&&t.push(e)}return t.length?t.reverse():void 0}function On(e,t,n){if(e!==null&&(typeof e==`object`||typeof e==`function`)){if(Tn.has(e))return;Tn.add(e)}let r=En(t);if(r===void 0)return;let i={},a=Dn(t),o=Dn(n)??a;o!==void 0&&(i.ownerPath=o),a!==void 0&&(i.boundaryPath=a);try{r(e,i)}catch(e){console.error(e)}}const kn=Symbol(0);function J(e){let t=un.bind(null,e);return t[f]=e,t}function An(e,t){if(typeof e==`function`){let n=W(e,t);return n.l&=-33,[J(n),gn.bind(null,n)]}let n=Xt(e,t);return[J(n),K.bind(null,n)]}function jn(e,t){return J(W(e,t))}function Mn(e,t,n){bn(e,t,void 0,n)}function Nn(e){let t=x();t&&!(t.l&16)?wn(()=>Qt(e),void 0):I.enqueue(2,function t(){if(A.Et>=A.Fe)return I.enqueue(2,t);e()})}function Pn(e,t,n){let r=typeof n?.keyed==`function`?n.keyed:void 0,i=t.length>1,a=t,o={H:se(),it:0,st:e,ot:[],ft:a,ht:[],ln:[],Xe:r,ct:r||n?.keyed===!1?[]:void 0,lt:i&&n?.keyed!==!1?[]:void 0,ut:n?.keyed===!1,L:n?.fallback},s=W(Vn.bind(o),void 0);return s.l&=-33,J(s)}const Fn={ownedWrite:!0};function In(e,t,n,r){let i=e.ot,a=e.it-1,o=[],s=[],c=[],l=256,u=r,d=r,f=!1;for(;u<=a&&d<=n-1;){let e=i[u],r=t[d];if(e===r){f||=(c.push(u,d,0),!0),c[c.length-1]++,u++,d++;continue}f=!1;let p=-1,m=Math.min(32-o.length,a-u,l);for(let e=1;e<=m;e++)if(i[u+e]===r){p=e;break}l-=p===-1?m:p;let h=-1;m=Math.min(32-s.length,n-1-d,l);for(let n=1;n<=m;n++)if(t[d+n]===e){h=n;break}if(l-=h===-1?m:h,p!==-1&&(h===-1||p<=h))for(;p-->0;)o.push(u++);else if(h!==-1)for(;h-->0;)s.push(d++);else{if(l<=0||o.length===32||s.length===32)return!1;o.push(u++),s.push(d++)}}for(;u<=a;u++){if(o.length===32)return!1;o.push(u)}for(;d<=n-1;d++){if(s.length===32)return!1;s.push(d)}return Ln(e,t,n,o,s,c)}function Ln(e,t,n,r,i,a){let o=e.ot,s,c,l;if(i.length!==0)for(l=Array(r.length),c=0;c<i.length;c++){let e=-1;for(s=0;s<r.length;s++)if(!l[s]&&o[r[s]]===t[i[c]]){e=s;break}if(e===-1)return!1;l[e]=!0,i[c]=i[c]<<6|e}if(r.length!==0||i.length!==0){let e=/* @__PURE__ */ new Set;for(s=0;s<r.length;s++)e.add(o[r[s]]);for(c=0;c<i.length;c++)e.add(t[i[c]>>6]);for(let t=0;t<a.length;t+=3){let n=a[t];for(let r=0,i=a[t+2];r<i;r++)if(e.has(o[n+r]))return!1}}let u=e.ht,d=e.ln,f=u.slice(0,n),p=d.slice(0,n);for(let e=0;e<a.length;e+=3){let t=a[e],n=a[e+1];if(t!==n)for(let r=0;r<a[e+2];r++)f[n+r]=u[t+r],p[n+r]=d[t+r]}for(c=0;c<i.length;c++){let e=i[c]>>6,t=r[i[c]&63];f[e]=u[t],p[e]=d[t]}for(e.ht=f,e.ln=p,e.it=n,e.ot=t.slice(0),s=0;s<r.length;s++)l!==void 0&&l[s]||d[r[s]].dispose();return!0}function Rn(e,t,n,r,i,a,o,s,c){let l=e.Xe,u=e.ot,d=e.ln,f=[],p=n;for(let m=n;m<=i;p++,m++){let i=l?l(t[m]):t[m];for(;p<=r&&(l?l(u[p]):u[p])!==i;)f.push(d[p++]);if(p>r)return o.fill(void 0),null;a[m]=e.ht[p],o[m-n]=d[p],s&&(s[m-n]=e.ct[p]),c&&(c[m-n]=e.lt[p])}for(;p<=r;p++)f.push(d[p]);return f}function zn(e,t,n,r,i,a,o,s,c){let l=e.ln,u=e.ct,d=e.lt,f=e.it,p=n-f,m,h;if(p>0)for(l.length=n,u&&(u.length=n),d&&(d.length=n),m=f-1,h=n-1;m>i;m--,h--)l[h]=l[m],u&&(u[h]=u[m]),d&&(d[h]=d[m]);else if(p<0){for(m=i+1,h=a+1;m<f;m++,h++)l[h]=l[m],u&&(u[h]=u[m]),d&&(d[h]=d[m]);l.length=n,u&&(u.length=n),d&&(d.length=n)}for(h=r;h<=a;h++)l[h]=o[h-r],u&&Bn(u[h]=s[h-r],t[h]),d&&K(d[h]=c[h-r],h);for(h=a+1;h<n;h++)u&&Bn(u[h],t[h]),d&&p!==0&&K(d[h],h)}const Bn=(e,t)=>e.le===t&&e.ue===u||K(e,t);function Vn(){this.H.Ke=x();let e=this.st()||[];e[kn],e=e;let t=e.length;return q(this.H,()=>{let n,r,i,a,o,s=this.ct?this.ut?()=>(a[i]=Xt(e[r],Fn),this.ft(J(a[i]),r)):()=>(a[i]=Xt(e[r],Fn),o&&(o[i]=Xt(r,Fn)),this.ft(J(a[i]),o?J(o[i]):void 0)):this.lt?()=>{let t=e[r];return o[i]=Xt(r,Fn),this.ft(t,J(o[i]))}:()=>{let t=e[r];return this.ft(t)};if(t===0)this.it!==0&&(this.H.dispose(!1),this.ln=[],this.ot=[],this.ht=[],this.it=0,this.ct&&=[],this.lt&&=[]),this.L&&!this.ht.length&&(this.ln[0]?.dispose(),this.ht[0]=q(this.ln[0]=se(),this.L));else if(this.it===0){let c=Array(t),l=Array(t);a=this.ct&&Array(t),o=this.lt&&Array(t);try{for(r=0;r<t;r++)i=r,c[r]=q(l[r]=se(),s)}catch(e){for(n=0;n<=r;n++)l[n]?.dispose();throw e}this.ln[0]&&this.ln[0].dispose(),this.ht=c,this.ln=l,a&&(this.ct=a),o&&(this.lt=o),this.ot=e.slice(0),this.it=t}else{let c,l,u,d,f,p,m,h,g;for(c=0,l=Math.min(this.it,t);c<l&&(this.ot[c]===e[c]||this.ct&&Hn(this.Xe,this.ot[c],e[c]));c++)this.ct&&Bn(this.ct[c],e[c]);for(l=this.it-1,u=t-1;l>=c&&u>=c&&(this.ot[l]===e[u]||this.ct&&Hn(this.Xe,this.ot[l],e[u]));l--,u--);if(c===t&&this.it===t){this.ot=e.slice(0);return}if(t<=this.it&&l-c>64&&this.ct===void 0&&this.lt===void 0){let n=c+(u-c>>1),r=e[n],i=Math.min(l,n+32),a=Math.max(c,n-32);for(;a<=i&&this.ot[a]!==r;)a++;if(a<=i&&In(this,e,t,c))return}let _=t-this.it,v=u-c+1,y=Array(t),b=Array(v);a=this.ct?Array(v):void 0,o=this.lt?Array(v):void 0;let ee=_<0?Rn(this,e,c,l,u,y,b,a,o):null;if(ee!==null)ee.length!==0&&(h=ee);else{for(p=/* @__PURE__ */ new Map,m=Array(v),r=u;r>=c;r--)d=e[r],f=this.Xe?this.Xe(d):d,n=p.get(f),m[r-c]=n===void 0?-1:n,p.set(f,r);for(n=c;n<=l;n++)d=this.ot[n],f=this.Xe?this.Xe(d):d,r=p.get(f),r!==void 0&&r!==-1?(y[r]=this.ht[n],b[r-c]=this.ln[n],a&&(a[r-c]=this.ct[n]),o&&(o[r-c]=this.lt[n]),r=m[r-c],p.set(f,r)):(h??=[]).push(this.ln[n]);try{for(r=c;r<=u;r++)b[r-c]===void 0&&((g??=[]).push(b[r-c]=se()),i=r-c,y[r]=q(b[r-c],s))}catch(e){if(g)for(n=0;n<g.length;n++)g[n].dispose();throw e}}for(n=0;n<c;n++)y[n]=this.ht[n];for(r=u+1;r<t;r++)y[r]=this.ht[r-_];if(zn(this,e,t,c,l,u,b,a,o),this.ht=y,this.it=t,this.ot=e.slice(0),h)for(n=0;n<h.length;n++)h[n].dispose()}}),this.ht}function Hn(e,t,n){return!e||e(t)===e(n)}function Un(e,t){if(typeof e==`function`&&!e.length){if(t?.doNotUnwrap)return e;do e=e();while(typeof e==`function`&&!e.length)}if(!t?.skipNonRendered||e!=null&&e!==!0&&e!==!1&&e!==``){if(Array.isArray(e)){let n=[];return Wn(e,n,t)?()=>{let e=[];return Wn(n,e,{...t,doNotUnwrap:!1}),e}:n}return e}}function Wn(t,n=[],r){let i=null,a=!1;for(let o=0;o<t.length;o++)try{let e=t[o];if(typeof e==`function`&&!e.length){if(r?.doNotUnwrap){n.push(e),a=!0;continue}do e=e();while(typeof e==`function`&&!e.length)}Array.isArray(e)?a=Wn(e,n,r)||a:r?.skipNonRendered&&(e==null||e===!0||e===!1||e===``)||n.push(e)}catch(t){if(!(t instanceof e))throw t;i=t}if(i)throw i;return a}const Gn=Symbol(``),Kn=Symbol(``),Y=/* @__PURE__ */ new Set,qn=e=>e.A[Gn],Jn=e=>!!e&&(e.i===2&&e.L||Jn(e._parent)),X=e=>e.i===2||!e.D||e.h||Jn(e._parent);function Z(e,t,n=t){e.F.set(t,n),Y.add(e)}function Yn(e,t,r,i=t){if(e.i===2){r??=t.T?.U,i=r?.source??t,i.R&64&&(i=t);let a=n(r);K(e.U,a),On(a,e.H,i)}else e.D=!1;Z(e,t,i),e.h&&Xn(e),e.L||Zn(e)}function Xn(e){e.D=!1,e.P=e.B;let t=e.j;!e.P&&t.l&256&&D(t)!==T&&Ne(t)}function Zn(e){e.j!==null&&!(e.j.R&96)&&(L(e.j),M())}function Qn(e,t,n){if(t===0){if(Y.size)for(let t=qn(e);t;t=t._parent)!(t.F.get(e)?.m&(t.i|1))&&t.F.delete(e)&&!ar(t,0)&&t.L&&Zn(t);return!1}for(let r=qn(e);r;r=r._parent)if(!(r.i&t))r.L&&r.i>t&&Z(r,e);else{if(X(r))return Yn(r,e,n),!r.h||2;Z(r,e)}return!1}function $n(e){for(let t=qn(e);t;t=t._parent)if(t.i&1&&X(t))return t.h}function er(e,t){for(let t=qn(e);t;t=t._parent)if(t.L)return t;let n,r=e.o;if(t||e.l&16384)for(t||=/* @__PURE__ */ new Set,n=e.i!=1;r&&(n=t.size==t.add(r.u).size||er(r.u,t));)r=r.t;return n}function tr(e){let t=er(e);return t!==void 0&&((t.M??=/* @__PURE__ */ new Set).add(e),!0)}function nr(e){if(e.M!==null){for(let t of e.M){let e=t.i;I.enqueue(e===3?2:e,e===3?t.Z:t.W??=N.q.bind(null,t))}e.M=null}}function rr(e,t,n){if(!(n.m&3||t.m&2)){for(let n=qn(t);n&&n!==e;n=n._parent)if(n.i&1&&X(n))return!(n.j.l&256)}return!1}function ir(e,t,n){for(let r=e.C,i;r;r=r.G)if((i=r.S)===t||(n||=/* @__PURE__ */ new Set).size<n.add(i).size&&ir(i,t,n))return 1}function ar(e,t){let n=e.i|1;for(let[r,i]of e.F){if(!((r.R|i.R)&64)){if((r.m&n||i.m&n&&ir(r,i))&&!(n&2&&rr(e,r,i))||n&2&&i.l&2097152||r.l&32768&&r.R&8){if(t===0)break;continue}if((i!==e.K||e.h)&&(i.l&2304)==256){if(!t||!e.D)continue;k(D(i))}}e.F.delete(r)}return e.F.size}function or(){for(let e of Y){let t=e.j.R;if(t&64){Y.delete(e);continue}if(t&32)continue;if(!e.D){for(let[t]of e.F)for(let n of t.m&1?t.T?.se||[]:[t])if(!(n.l&256))for(let r=n.C;r;r=r.G){let i=r.S;i.l&256&&(n===t||!D(i).tt)&&Z(e,i)}}ar(e);let n=e.j;e.i&1&&!e.D&&n.l&256&&[...e.F].every(([,e])=>!(e.m&1)&&e.l&256&&D(e)===D(n))&&(e.F.clear(),e.D=!0),e.h=!1,e.F.size===0&&(Y.delete(e),e.L&&Zn(e))}}function sr(e){if(!e.D){e.L&&e.P===null&&e.B===null&&w!==null&&(e.B=w,Xn(e),Zn(e));return}e.h=!0,e.j.l&=-8388609;let t=w;t===null&&I.Y&&x().l&32768&&(k(null),t=N.J(T)),e.B=t,Y.add(e);let n=e.F.size;Me(e.H,T,t=>Z(e,t));for(let[t]of e.F)if(e.F.size!==n||t.m&1&&!(t.R&64)){for(let t=e._parent;t!==null;t=t._parent)if(t.i&1)for(let[n]of e.F)t.F.delete(n);Xn(e),Zn(e);return}}function cr(t,n,r,i){let a=se(),o={i:t,_parent:qn(a)??null,H:a,K:null,j:null,F:/* @__PURE__ */ new Map,D:t===2,h:!1,B:null,P:null,L:!1,M:null,v:null,$:!1,ee:!1,U:t===2?Xt(void 0,ur):null,ne:r,re:null};if(t===1&&a.A[Kn],x()&&ae(()=>{Y.delete(o)}),i){let t=!1;q(a,()=>W(()=>{try{i()}catch(t){if(!(t instanceof e)){if(!I.notify(x(),2,2,t))throw Be(t),t;return}}t?sr(o):t=!0})).l|=c}a.A={...a.A,[Gn]:o};let s=q(a,()=>{let e=W(n);return W(()=>Un(un(e)))});o.K=s;let u=W(()=>{let n=x();if(!o.h&&!(n.l&256)&&(n.l|=l),o.$&&(vt(s,n),o.$)){if(o.ee){o.L=!0;return}return lr(o)}let r=s.m&3;if(r!==0){if(vt(s,n),r&t){if(X(o))return Yn(o,s,void 0),lr(o);Z(o,s)}throw s.T.U}if(X(o)&&(o.F.size!==0&&n.m&4&&!(n.l&256)||ar(o,!0)!==0))return lr(o);let i;try{i=un(s)}catch(n){if(n instanceof e?t===1:t===2){if(X(o))return Yn(o,s,n),lr(o);Z(o,s)}throw n}if(X(o)&&o.F.size!==0)return lr(o);o.D=!0,o.L=!1;let a=o.re,c=()=>{!o.L&&o.re===a&&(a.m&2&&M(),h(a),o.re=null)};return a!==null&&(o.j.le===a.le?I.enqueue(1,c):c()),nr(o),i},{ae:!0});return u.l|=c,s.l|=l,o.j=u,J(u)}function lr(e){let t=x();e.P!==null&&(he(e.P),t.R|=131072,e.P=null),e.L=!0,e.re===null&&(e.re=q(t._parent,()=>W(()=>e.ne(e),{id:t.id,lazy:1})));let n=w,r=t.R,i=un(e.re);return he(n),t.R^=(t.R^r)&163840,i}const ur={ownedWrite:!0,ae:!0};function dr(e,t,n){return cr(1,e,()=>t(),n?.on)}pe(Qn,(e,t)=>!t&&(e.m&4?Qn(e,1):$n(e)),er,or,tr);function fr(e,t){let n=Symbol(t&&t.name||``);function r(e){return ce(()=>(yn(r,e.value),mr(()=>e.children)))}return r.id=n,r.defaultValue=e,r}function pr(e){return vn(e)}function mr(e){let t=jn(e,{lazy:!0}),n=jn(()=>Un(t()),{lazy:!0,sync:!0});return n.toArray=()=>{let e=n();return Array.isArray(e)?e:e==null?[]:[e]},n}const hr={hydrating:!1,registry:void 0,done:!1},gr=(...e)=>jn(...e),_r=(...e)=>An(...e),vr=(...e)=>ce(...e),yr=(...e)=>Mn(...e),br=(e,t,n)=>dr(e,t,n);function xr(e,t,n,r){return Qt(()=>e(t||{}))}function Sr(e){let t=`fallback`in e?{keyed:e.keyed,fallback:()=>e.fallback}:{keyed:e.keyed},n=x(),r,i=()=>q(n,()=>Pn(()=>e.each,e.children,t));return hr.hydrating&&(r=i()),()=>(r??=i())()}function Cr(e){let t=`on`in e?{on:()=>e.on}:void 0;return br(()=>e.children,()=>e.fallback,t)}const wr=hr,Q=/*#__PURE__*/ Symbol(`slot`),Tr=/*#__PURE__*/ Symbol(`host`),Er={transparent:!0,sync:!0};function Dr(e,t,n){let r=n?{sync:!0,...n,transparent:!n.scope}:Er;yr(e,t,r)}function Or(e,t,n,r){let i=e.moveBefore&&e.isConnected&&document.activeElement;i===document.body&&(i=null);let a=r||e,o=(t,n)=>{i&&t.isConnected&&t.contains(i)?e.moveBefore(t,n):e.insertBefore(t,n),(r||t[Q])&&(t[Q]=a)};if(!t.length){for(let e of n)o(e,r);return}let s=t=>{if(!t)return!1;let n=t[Q];return t.parentNode===e&&(!n||n===a)},c=n.length,l=t.length,u=c,d=0,f=0,p=t[l-1],m=s(p)?p.nextSibling:r||null,h=null,g,_;for(;d<l||f<u;)if(t[d]===n[f])d++,f++;else{for(;l>d&&u>f&&t[l-1]===n[u-1];)l--,u--;if(l===d){let e=u;for(;e<c&&!s(n[e]);)e++;let t=e<c?n[e]:m;for(;f<u;)o(n[f++],t)}else if(u===f)for(;d<l;){let e=t[d++];h&&h.has(e)||!s(e)||e.remove()}else if((g=t[d])===n[u-1]&&n[f]===t[l-1]&&g.parentNode===e&&(!(_=g[Q])||_===a))do if(o(t[--l],g),f++,d>=l-1||f>=u)break;while(t[d]===n[u-1]&&n[f]===t[l-1]);else{if(!s(t[d])){d++;continue}if(!h){h=/* @__PURE__ */ new Map;let e=f;for(;e<u;)h.set(n[e],e++)}let c=h.get(t[d]);if(c!=null){if(f<c&&c<u){let s=d,p=1,m;for(;++s<l&&s<u&&(m=h.get(t[s]))!=null&&m===c+p;)p++;if(p>c-f){let e=t[d];for(;f<c;)o(n[f++],e)}else{let s=n[f++],c=t[d++];i&&e.contains(i)?o(s,c):e.replaceChild(s,c),(r||s[Q])&&(s[Q]=a)}}else d++}else t[d++].remove()}}}const kr=`_$SOLID_EVENT_OWNER`,Ar={},jr=/* @__PURE__ */ new Set,Mr=/* @__PURE__ */ new Map;function Nr(e,t,n,r={}){let i;Lr(t);try{vr(a=>{i=a,r.onError&&(x()[Re]=r.onError);let o=e();t===document?Dr(()=>Un(o),()=>{}):Jr(t,()=>o,t.firstChild?null:void 0,n,{...r.insertOptions,schedule:!0})},{id:r.renderId}),et()}catch(e){throw i&&i(),Rr(t),e}return()=>{i(),Rr(t),t.textContent=``}}function Pr(e,t,n){let r=document.createElement(`template`);r.innerHTML=e;let i=r.content.firstChild;return n===2?i.firstChild:i}function Fr(e,t){let n;return t===1?r=>document.importNode(n||=Pr(e,r,t),!0):r=>(n||=Pr(e,r,t)).cloneNode(!0)}function Ir(e){for(let t of e)jr.has(t)||(jr.add(t),Mr.forEach((e,n)=>Vr(t,n,e)))}function Lr(e){let t=zr(e,e);t&&(t.roots=(t.roots||0)+1)}function Rr(e){let t=Mr.get(e);t&&(t.roots>1?t.roots--:delete t.roots),Br(e,e)}function zr(e,t=e){if(!e||!t)return;let n=Mr.get(e);return n||Mr.set(e,n={owners:/* @__PURE__ */ new Map,handlers:/* @__PURE__ */ new Map}),n.owners.set(t,(n.owners.get(t)||0)+1),jr.forEach(t=>Vr(t,e,n)),n}function Br(e,t=e){let n=Mr.get(e);if(!n)return;let r=n.owners.get(t);r>1?n.owners.set(t,r-1):n.owners.delete(t),n.owners.size||(n.handlers.forEach((t,n)=>e.removeEventListener(n,t)),Mr.delete(e))}function Vr(e,t,n){if(n.handlers.has(e))return;let r=e=>Zr(e,t,n);n.handlers.set(e,r),t.addEventListener(e,r)}const Hr=e=>e._$host||e.parentNode||e.host;function Ur(e,t){let n=e,r=0;for(;n;){if(t.owners.has(n))return{owner:n,distance:r};r++,n=Hr(n)}}function Wr(e,t,n){if(Yr(e))return;let r=t===`multiple`&&e.localName===`select`;if(n==null||n===!1)e.removeAttribute(t);else if(e.setAttribute(t,n===!0?``:n),r&&!e._$multiple){let t=e.options;for(let e=0;e<t.length;e++)t[e].defaultSelected&&(t[e].selected=!0)}r&&(e._$multiple=!0)}function Gr(e,t){Array.isArray(e)?e.flat(1/0).forEach(e=>e&&e(t)):e(t)}function Kr(e,t){let n=Qt(e);q(null,()=>Gr(n,t))}const qr={scope:!0};function Jr(e,t,n,r,i){let a=n!==void 0,o=i&&i.host;if(a&&!r&&(r=[]),typeof t!=`function`&&(t=$r(t,r,a,!0),typeof t!=`function`)){Qr(e,t,r,n),o&&ei(t,o);return}if(a&&r.length===0){let t=document.createTextNode(``);e.insertBefore(t,n),r=[t]}let s=r,c=!1;Dr(()=>{let r=$r(t(),s,a,!0),l=c;return c=!0,typeof r==`function`?(Dr(()=>$r(r,s,a),t=>{s=Qr(e,t,s,n),o&&ei(s,o)},l&&!(i&&i.schedule)?{...i,schedule:!0}:i),Ar):r},t=>{t!==Ar&&(s=Qr(e,t,s,n),o&&ei(s,o))},t.$s?i?{...i,scope:!0}:qr:i)}function Yr(e){return!wr.hydrating||wr.isClaiming&&!wr.isClaiming()?!1:!e||e.isConnected?!0:Xr!==null&&Xr.claimed(e)}let Xr=null;function Zr(e,t,n){let r=e[kr],i;if(r){if(r===!0||r===t||!t.contains(r))return;i=r}let a=n.owners.size===1&&n.owners.has(t)?t:Ur(e.target,n)?.owner;if(!a||a===i)return;e[kr]=a;let o=i||e.target,s=`_$$`+e.type,c=t=>Object.defineProperty(e,"target",{configurable:!0,value:t}),l=()=>{let t=o[s];if(t&&!o.disabled){let n=o[`${s}Data`];if(n===void 0?typeof t==`function`?t.call(o,e):t.handleEvent(e):t.call(o,n,e),e.cancelBubble)return}return o.host&&typeof o.host!=`string`&&!o.host._$host&&o.contains(e.target)&&c(o.host),!0},u=()=>o===a||o.parentNode===a,d=()=>{for(;o&&l()&&!u();)o=Hr(o)};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return o||a}}),i)i===e.target&&(o=Hr(i)),o&&o!==a&&d();else if(e.composedPath){let t=e.composedPath();if(t.length){c(t[0]);for(let e=0;e<t.length&&(o=t[e],l());e++){if(o._$host){o=o._$host,d();break}if(u())break}}else d()}else d();delete e.target,delete e.currentTarget}function Qr(e,t,n,r){if(t===n)return t;let i=typeof t,a=r!==void 0;if(i===`string`||i===`number`){let r=typeof n;r===`string`||r===`number`?e.firstChild.data=t:ti(e,n)?e.textContent=t:(ni(e,n),e.insertBefore(document.createTextNode(t),e.firstChild))}else if(t===void 0)ri(e,n,r);else if(t.nodeType)Array.isArray(n)?ri(e,n,a?r:null,t):n!=null&&n.nodeType?n.parentNode===e?e.replaceChild(t,n):e.appendChild(t):n!=null&&e.firstChild?e.replaceChild(t,e.firstChild):e.appendChild(t),(r||t[Q])&&(t[Q]=r||e);else if(Array.isArray(t)){let i=Array.isArray(n);for(let e=0,r=t.length;e<r;e++){let r=t[e],a=typeof r;if(a===`string`||a===`number`){let a=i?n[e]:void 0;a&&a.nodeType===3?(a.data!==``+r&&(a.data=r),t[e]=a):t[e]=document.createTextNode(r)}}t.length===0?ri(e,n,r):i?Or(e,n,t,r):(n!=null&&ri(e,n),Or(e,[],t))}return t}function $r(e,t,n,r){return e=Un(e,{skipNonRendered:!0,doNotUnwrap:r}),r&&typeof e==`function`||n&&!Array.isArray(e)&&(e=[e??``]),e}function ei(e,t){if(Array.isArray(e))for(let n=0,r=e.length;n<r;n++)ei(e[n],t);else e&&e.nodeType&&e[Tr]!==t&&(e[Tr]=t,Object.defineProperty(e,"_$host",{get:t,configurable:!0}))}function ti(e,t){if(t==null)return!0;if(Array.isArray(t))return t.length?e.firstChild===t[0]&&e.lastChild===t[t.length-1]:e.firstChild===null;if(t===``)return e.firstChild===null;if(t.nodeType)return e.firstChild===t&&e.lastChild===t;let n=e.firstChild;return n!==null&&n.nodeType===3&&e.lastChild===n}function ni(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++){let r=t[n];r.parentNode===e&&r.remove()}else if(t.nodeType)t.parentNode===e&&t.remove();else{let t=e.firstChild;t&&t.nodeType===3&&t.remove()}}function ri(e,t,n,r){if(n===void 0)return ti(e,t)?e.textContent=``:ni(e,t);if(t.length){let i=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(r!==o){let t=o[Q],s=o.parentNode===e&&(!t||t===(n||e));r&&!i&&!a?s?e.replaceChild(r,o):e.insertBefore(r,n):s&&o.remove()}else i=!0}}else r&&e.insertBefore(r,n);r&&(n||r[Q])&&(r[Q]=n||e)}const ii=fr(),ai=()=>pr(ii);function oi(e){return(t,n,r)=>Nr(()=>{let[t,i]=_r(r.events()),[a,o]=_r(r.theme());Nn(()=>{let e=r.onEvents(e=>i(()=>e)),t=r.onTheme(o);return()=>{e(),t()}});let s={page:r.page,events:t,last:e=>t().findLast(t=>t.type===e),append:r.append,theme:a,markdown:r.markdown};return xr(ii,{value:s,get children(){return xr(e,n)}})},t)}const si=[`border-bottom-width`,`border-left-width`,`border-right-width`,`border-top-width`,`box-sizing`,`font-family`,`font-size`,`font-style`,`font-weight`,`letter-spacing`,`line-height`,`padding-bottom`,`padding-left`,`padding-right`,`padding-top`,`tab-size`,`text-indent`,`text-rendering`,`text-transform`,`width`,`word-break`],ci={"min-height":`0`,"max-height":`none`,"min-width":`0`,"max-width":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`};function li(e){let t=getComputedStyle(e),n={};for(let e of si)n[e]=t.getPropertyValue(e);return n[`box-sizing`]?{style:n,padding:parseFloat(n[`padding-bottom`])+parseFloat(n[`padding-top`]),border:parseFloat(n[`border-bottom-width`])+parseFloat(n[`border-top-width`])}:null}let $=null;function ui(e,t,n,r){$||($=document.createElement(`textarea`),$.setAttribute(`tabindex`,`-1`),$.setAttribute(`aria-hidden`,`true`)),$.isConnected||document.body.append($);for(let[t,n]of Object.entries(e.style))$.style.setProperty(t,n);for(let[e,t]of Object.entries(ci))$.style.setProperty(e,t,`important`);let i=e.style[`box-sizing`]===`border-box`,a=t=>i?t+e.padding+e.border:t;$.value=t;let o=i?$.scrollHeight+e.border:$.scrollHeight-e.padding;$.value=`x`;let s=$.scrollHeight-e.padding;return Math.min(a(s*r),Math.max(a(s*n),o))}function di(e={}){let t,n=0,r=()=>{if(!t)return;let r=li(t);if(!r)return;let i=ui(r,t.value||t.placeholder||`x`,e.minRows??1,e.maxRows??1/0);i!==n&&(n=i,t.style.setProperty(`height`,`${i}px`,`important`))};return Nn(()=>{let e=t;if(!e)return;r(),e.addEventListener(`input`,r);let n=new ResizeObserver(()=>r());return n.observe(e),()=>{e.removeEventListener(`input`,r),n.disconnect()}}),e=>{t=e}}var fi=/* @__PURE__ */ Fr(`<div class=wb-chat><div class=wb-chat-new><textarea rows=1></textarea><button type=button>`),pi=/* @__PURE__ */ Fr(`<div class=wb-chat-message><span class=wb-chat-who>`),mi=/* @__PURE__ */ Fr(`<div class=wb-chat-bubble data-md>`),hi=/* @__PURE__ */ Fr(`<div class=wb-chat-bubble>`);const gi=`chat:message`;function _i(e,t){let n=new Set(t);return Object.entries(e.data).filter(([e,t])=>!n.has(e)&&typeof t==`string`&&t.trim()).map(([,e])=>String(e).trim()).join(`
|
|
2
|
+
|
|
3
|
+
`)}function vi(e){let t=ai(),n=gr(()=>{let n=t.events(),r=n.filter(t=>t.type===gi&&t.data.chat===e.chat),i=new Set(r.map(e=>e.data.replaces).filter(Boolean).map(String)),a=[];for(let t of r){if(i.has(t.id))continue;let r=e.form&&t.data.replyTo?n.find(n=>n.id===t.data.replyTo&&n.type===e.form):void 0,o=r?_i(r,e.choices):``;r&&o&&!a.some(e=>e.id===r.id)&&a.push({id:r.id,from:`you`,text:o}),a.push({id:t.id,from:t.from===`cli`?`agent`:`you`,text:String(t.data.text??``)})}return a}),r,i=async()=>{let n=r?.value.trim();n&&(await t.append(gi,{chat:e.chat,text:n}),r.value=``,r.dispatchEvent(new Event(`input`)))};var a=fi(),o=a.firstChild,s=o.firstChild,c=s.nextSibling;return Jr(a,xr(Sr,{get each(){return n()},children:e=>(()=>{var t=pi(),n=t.firstChild;return Jr(n,()=>e.from),Jr(t,xr(yi,{get text(){return e.text}}),null),Dr(()=>({e:e.from,t:e.from===`agent`?e.id:void 0}),({e,t:n},r)=>{e!==r?.e&&Wr(t,`data-from`,e),n!==r?.t&&Wr(t,`data-wb-message`,n)}),t})()}),o),s._$$keydown=e=>{e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),i())},Kr(()=>[e=>r=e,di({maxRows:10})],s),c._$$click=i,Jr(c,()=>e.form?`Ask`:`Send`),Dr(()=>({e:e.form?``:void 0,t:e.form?`Ask about this question (doesn't choose anything)`:`Write a message`}),({e,t},n)=>{e!==n?.e&&Wr(a,`data-under-form`,e),t!==n?.t&&Wr(s,`placeholder`,t)}),a}function yi(e){let t=ai(),n=gr(()=>t.markdown(e.text));return xr(Cr,{get fallback(){var t=hi();return Jr(t,()=>e.text),t},get children(){var e=mi();return Dr(()=>n(),t=>{e.innerHTML=t}),e}})}var bi=oi(vi);Ir([`keydown`,`click`]);export{bi as default};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { builtFile } from "../../src/package.js";
|
|
2
|
+
import { isQuestionName } from "../../src/status.js";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import { definePlugin, html, raw } from "@bigmistqke/whiteboard";
|
|
5
|
+
// plugins/chat/index.ts
|
|
6
|
+
const style = new URL("./style.css", import.meta.url);
|
|
7
|
+
/** The chat itself: a client island, so the server renders nothing for it. */
|
|
8
|
+
const thread = {
|
|
9
|
+
style,
|
|
10
|
+
props: (ctx) => ({
|
|
11
|
+
chat: ctx.attrs.chat ?? "",
|
|
12
|
+
form: ctx.attrs.form || null,
|
|
13
|
+
choices: (ctx.attrs.choices ?? "").split(" ").filter(Boolean)
|
|
14
|
+
}),
|
|
15
|
+
html: () => "",
|
|
16
|
+
client: builtFile(import.meta.url, "client.js")
|
|
17
|
+
};
|
|
18
|
+
const quote = (s) => s.replace(/"/g, """);
|
|
19
|
+
/** The chat thread for `chat`, as markup: for the chat block, and for the form plugin under a form. */
|
|
20
|
+
const chatThread = (c, chat, form) => c.markdown(`::chat-thread{chat="${quote(chat)}"${form ? ` form="${quote(chat)}" choices="${form.choices.join(" ")}"` : ""}}`);
|
|
21
|
+
/** `:::chat{name=…}`: a chat on its own, after whatever the block says above it. */
|
|
22
|
+
const chat = {
|
|
23
|
+
style,
|
|
24
|
+
async html(ctx) {
|
|
25
|
+
const c = ctx;
|
|
26
|
+
const name = c.attrs.name || c.attrs.id || "chat";
|
|
27
|
+
if (!isQuestionName(name)) throw new Error(`chat name "${name}" has a colon: those names are reserved for events of whiteboard and plugins`);
|
|
28
|
+
const body = c.children.length ? await c.toHtml(c.children) : "";
|
|
29
|
+
return html`<section class="wb-chat-block" data-chat="${name}">${raw(body)}${raw(await chatThread(c, name))}</section>`;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
function chatPlugin() {
|
|
33
|
+
return definePlugin({
|
|
34
|
+
name: "chat",
|
|
35
|
+
blocks: {
|
|
36
|
+
chat,
|
|
37
|
+
"chat-thread": thread
|
|
38
|
+
},
|
|
39
|
+
events: { "chat:message": {
|
|
40
|
+
handOut: true,
|
|
41
|
+
forReader: true,
|
|
42
|
+
description: "a message in a chat: `{ chat, text }`, and `replaces` or `replyTo` (see below)"
|
|
43
|
+
} },
|
|
44
|
+
docs: () => fs.readFileSync(new URL("./README.md", import.meta.url), "utf8")
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
export { chatThread, chatPlugin as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* A chat: the reader's messages on the right, the agent's on the left; never part of an answer. */
|
|
2
|
+
.wb-chat { display: flex; flex-direction: column; gap: 10px; font: .92rem/1.45 var(--sans); }
|
|
3
|
+
/* under a form: set off from the question by a dashed rule */
|
|
4
|
+
.wb-chat[data-under-form] { margin-top: 4px; padding-top: 12px; border-top: 1px dashed var(--border); }
|
|
5
|
+
.wb-chat-message { display: flex; flex-direction: column; gap: 3px; max-width: 85%; align-self: flex-start; align-items: flex-start; }
|
|
6
|
+
.wb-chat-message[data-from=you] { align-self: flex-end; align-items: flex-end; }
|
|
7
|
+
.wb-chat-who { font: 600 .68rem/1.3 var(--sans); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 0 4px; }
|
|
8
|
+
.wb-chat-message[data-from=agent] .wb-chat-who { color: var(--accent); }
|
|
9
|
+
.wb-chat-bubble { white-space: pre-wrap; padding: 8px 12px; border-radius: 14px 14px 14px 4px; background: var(--tint); border: 1px solid var(--border); }
|
|
10
|
+
/* rendered from markdown: its paragraphs and code carry the spacing */
|
|
11
|
+
.wb-chat-bubble[data-md] { white-space: normal; overflow-wrap: anywhere; }
|
|
12
|
+
.wb-chat-bubble[data-md] > :first-child { margin-top: 0; }
|
|
13
|
+
.wb-chat-bubble[data-md] > :last-child { margin-bottom: 0; }
|
|
14
|
+
.wb-chat-bubble[data-md] :is(p, ul, ol, pre, blockquote) { margin: 0 0 .5em; }
|
|
15
|
+
.wb-chat-bubble[data-md] pre { font-size: .8rem; padding: 8px 10px; border-radius: 6px; overflow-x: auto; max-width: 100%; }
|
|
16
|
+
.wb-chat-message[data-from=you] .wb-chat-bubble[data-md] a { color: inherit; }
|
|
17
|
+
.wb-chat-message[data-from=you] .wb-chat-bubble { border-radius: 14px 14px 4px 14px; background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
|
|
18
|
+
.wb-chat-new { display: flex; gap: 8px; align-items: flex-start; }
|
|
19
|
+
.wb-chat-new textarea { flex: 1; resize: none; font: inherit; }
|
|
20
|
+
|
|
21
|
+
/* :::chat on its own: set off from the article like a form, hairlines above and below */
|
|
22
|
+
.wb-chat-block { margin: 3.6em 0; padding: 1.6em 0 1.7em; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); display: grid; gap: 16px; }
|
|
23
|
+
.wb-chat-block > :first-child { margin-top: 0; }
|
|
24
|
+
.wb-chat-block > :is(p, ul, ol) { margin: 0; }
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { statusLines, whose } from "../../src/status.js";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { spawnSync } from "node:child_process";
|
|
5
|
+
// plugins/claude-code/index.ts
|
|
6
|
+
/** What is open on a page, in short phrases; the command that picks it up comes last, once. */
|
|
7
|
+
const openOn = (p, options) => statusLines(p, relFile(p.file), options);
|
|
8
|
+
const MODES = {
|
|
9
|
+
stop: "Stop",
|
|
10
|
+
prompt: "UserPromptSubmit",
|
|
11
|
+
session: "SessionStart"
|
|
12
|
+
};
|
|
13
|
+
/** A hook command this plugin installs. */
|
|
14
|
+
const OURS = /\bwhiteboard claude-code hook\b/;
|
|
15
|
+
function claudeCode() {
|
|
16
|
+
return {
|
|
17
|
+
name: "claude-code",
|
|
18
|
+
session: () => process.env.CLAUDE_CODE_SESSION_ID || null,
|
|
19
|
+
commands: {
|
|
20
|
+
hook: {
|
|
21
|
+
description: "what Claude Code runs on an event (stop, prompt or session): report what is open on the session's pages; never blocks",
|
|
22
|
+
args: "<stop|prompt|session>",
|
|
23
|
+
async run(ctx) {
|
|
24
|
+
const mode = ctx.positionals[0];
|
|
25
|
+
if (!mode || !(mode in MODES)) throw new Error(`usage: whiteboard claude-code hook <${Object.keys(MODES).join("|")}>`);
|
|
26
|
+
try {
|
|
27
|
+
await hook(ctx, mode);
|
|
28
|
+
} catch (err) {
|
|
29
|
+
console.error(`whiteboard claude-code hook ${mode}: ${err.message}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
install: {
|
|
34
|
+
description: "add the hooks to this project's .claude/settings.json",
|
|
35
|
+
run: (ctx) => install(ctx.project.dir)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** The JSON Claude Code passes a hook on its standard input, or nothing. */
|
|
41
|
+
function hookInput() {
|
|
42
|
+
if (process.stdin.isTTY) return {};
|
|
43
|
+
try {
|
|
44
|
+
return JSON.parse(fs.readFileSync(0, "utf8") || "{}");
|
|
45
|
+
} catch {
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const relFile = (file) => path.relative(process.cwd(), file) || file;
|
|
50
|
+
async function hook(ctx, mode) {
|
|
51
|
+
const session = hookInput().session_id ?? process.env.CLAUDE_CODE_SESSION_ID ?? null;
|
|
52
|
+
const busy = (await ctx.status()).filter((p) => p.unpicked.length || p.open.length);
|
|
53
|
+
const mine = busy.filter((p) => session && p.owner === session);
|
|
54
|
+
if (mode === "stop") {
|
|
55
|
+
const loose = mine.filter((p) => p.unheard.length || p.unpicked.length);
|
|
56
|
+
if (!loose.length) return;
|
|
57
|
+
const said = (p) => {
|
|
58
|
+
const l = openOn(p, { waiting: false });
|
|
59
|
+
return `${l.slice(0, -1).join("; ")} ${l.at(-1)}`;
|
|
60
|
+
};
|
|
61
|
+
console.log(JSON.stringify({ systemMessage: `whiteboard: ${loose.map((p) => `${p.page}: ${said(p)}`).join(" · ")}` }));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const out = [];
|
|
65
|
+
for (const p of mine) {
|
|
66
|
+
const handed = [];
|
|
67
|
+
await ctx.handOut({
|
|
68
|
+
page: p.page,
|
|
69
|
+
exact: true
|
|
70
|
+
}, (e) => handed.push(e), { follow: false });
|
|
71
|
+
if (handed.length) {
|
|
72
|
+
out.push(`Answers on your page ${p.page} (${relFile(p.file)}) that no wait picked up; they count as picked up now:`);
|
|
73
|
+
for (const e of handed) out.push(JSON.stringify(e));
|
|
74
|
+
}
|
|
75
|
+
if (p.unheard.length) out.push(`Nobody listens for ${p.unheard.join(", ")} on your page ${p.page}: run \`whiteboard wait --page ${relFile(p.file)}\` in the background.`);
|
|
76
|
+
}
|
|
77
|
+
if (mode === "session") {
|
|
78
|
+
const others = busy.filter((p) => !mine.includes(p));
|
|
79
|
+
if (others.length) {
|
|
80
|
+
out.push("Other pages in this whiteboard project with something open (not this session's; their answers stay for whoever waits on them):");
|
|
81
|
+
for (const p of others) out.push(`- ${p.page} (${whose(p, session)}): ${openOn(p).join(" ")}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (out.length) console.log(out.join("\n"));
|
|
85
|
+
}
|
|
86
|
+
/** Add the hooks to the project's .claude/settings.json, replacing ours that run another command. */
|
|
87
|
+
function install(dir) {
|
|
88
|
+
const file = path.join(dir, ".claude", "settings.json");
|
|
89
|
+
let settings = {};
|
|
90
|
+
if (fs.existsSync(file)) try {
|
|
91
|
+
settings = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
92
|
+
} catch {
|
|
93
|
+
throw new Error(`${file} is not valid JSON; fix it first`);
|
|
94
|
+
}
|
|
95
|
+
const bin = spawnSync("sh", ["-c", "command -v whiteboard"], { encoding: "utf8" }).status === 0 ? "whiteboard" : "npx whiteboard";
|
|
96
|
+
const changed = [];
|
|
97
|
+
const hooks = settings.hooks ??= {};
|
|
98
|
+
for (const [mode, event] of Object.entries(MODES)) {
|
|
99
|
+
const command = `${bin} claude-code hook ${mode}`;
|
|
100
|
+
const groups = hooks[event] ?? [];
|
|
101
|
+
if (groups.some((g) => g.hooks?.some((h) => h.command === command))) continue;
|
|
102
|
+
hooks[event] = [...groups.map((g) => ({
|
|
103
|
+
...g,
|
|
104
|
+
hooks: (g.hooks ?? []).filter((h) => !OURS.test(h.command ?? ""))
|
|
105
|
+
})).filter((g) => g.hooks.length), { hooks: [{
|
|
106
|
+
type: "command",
|
|
107
|
+
command
|
|
108
|
+
}] }];
|
|
109
|
+
changed.push(event);
|
|
110
|
+
}
|
|
111
|
+
if (!changed.length) {
|
|
112
|
+
console.log(`hooks already installed: ${file}`);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
116
|
+
fs.writeFileSync(`${file}.tmp`, JSON.stringify(settings, null, 2) + "\n");
|
|
117
|
+
fs.renameSync(`${file}.tmp`, file);
|
|
118
|
+
console.log(`hooks added to ${file}: ${changed.join(", ")}`);
|
|
119
|
+
}
|
|
120
|
+
export { claudeCode as default };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Syntax highlighting for code blocks. [Shiki](https://shiki.style) runs on the server, so no script
|
|
2
|
+
runs on the page, and the colours follow the page theme. It applies to every
|
|
3
|
+
fence that no other block claims by name, and to the code view of
|
|
4
|
+
repository files. Write an ordinary fence with a language:
|
|
5
|
+
|
|
6
|
+
````markdown
|
|
7
|
+
```ts
|
|
8
|
+
const page = await whiteboard.show('plan')
|
|
9
|
+
```
|
|
10
|
+
````
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
const page = await whiteboard.show('plan')
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
A `diff` fence (what `git diff` or `diff -u` prints) is shown for reading:
|
|
17
|
+
each file's headers become its name, a hunk's `@@ … @@` line becomes a `⋯`
|
|
18
|
+
where lines are skipped, lines have their numbers in a gutter and are tinted
|
|
19
|
+
when added or removed. Each line in a hunk also says where it is from
|
|
20
|
+
(`src/a.ts:12`), and a comment on it records that. Use four
|
|
21
|
+
backticks around it, since a diff can hold three.
|
|
22
|
+
|
|
23
|
+
A missing or unknown language renders as plain text. Fences named after
|
|
24
|
+
another block, such as `mermaid`, still go to that block.
|
|
25
|
+
|
|
26
|
+
It's a built-in plugin. For options, replace it in the config with your own
|
|
27
|
+
`code(…)`:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import code from '@bigmistqke/whiteboard/code'
|
|
31
|
+
|
|
32
|
+
export default defineConfig({
|
|
33
|
+
plugins: [code({
|
|
34
|
+
themes: { light: 'github-light', dark: 'github-dark' }, // any Shiki theme names
|
|
35
|
+
colorReplacements: { 'github-light': { '#e36209': '#0f766e' } }, // per theme
|
|
36
|
+
})],
|
|
37
|
+
})
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Without options it uses the GitHub themes, with their oranges swapped for a
|
|
41
|
+
teal that fits the default palette. If you pass `themes`, nothing is swapped
|
|
42
|
+
unless you also pass `colorReplacements`.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// plugins/code/diff.ts
|
|
2
|
+
const unprefix = (p) => p.replace(/\t.*$/, "").replace(/^"|"$/g, "").replace(/^[ab]\//, "");
|
|
3
|
+
function diffLines(text) {
|
|
4
|
+
if (!/^(@@ -\d|diff --git )/m.test(text)) return text.split("\n").map((line) => ({ kind: line[0] === "+" ? "add" : line[0] === "-" ? "del" : "context" }));
|
|
5
|
+
let file = "", oldFile = "", oldN = 0, newN = 0, inHunk = false;
|
|
6
|
+
let status = "", renamedFrom = "";
|
|
7
|
+
return text.split("\n").map((line) => {
|
|
8
|
+
const at = /^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(line);
|
|
9
|
+
if (at) {
|
|
10
|
+
oldN = Number(at[1]);
|
|
11
|
+
newN = Number(at[2]);
|
|
12
|
+
inHunk = true;
|
|
13
|
+
return {
|
|
14
|
+
kind: "hunk",
|
|
15
|
+
label: ""
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
if (inHunk) {
|
|
19
|
+
const sign = line[0];
|
|
20
|
+
const where = (side, n) => {
|
|
21
|
+
const name = side === "old" ? oldFile || file : file || oldFile;
|
|
22
|
+
return name ? {
|
|
23
|
+
n,
|
|
24
|
+
at: side === "old" ? `${name} (old):${n}` : `${name}:${n}`
|
|
25
|
+
} : { n };
|
|
26
|
+
};
|
|
27
|
+
if (sign === "+") return {
|
|
28
|
+
kind: "add",
|
|
29
|
+
...where("new", newN++)
|
|
30
|
+
};
|
|
31
|
+
if (sign === "-") return {
|
|
32
|
+
kind: "del",
|
|
33
|
+
...where("old", oldN++)
|
|
34
|
+
};
|
|
35
|
+
if (sign === " ") {
|
|
36
|
+
oldN++;
|
|
37
|
+
return {
|
|
38
|
+
kind: "context",
|
|
39
|
+
...where("new", newN++)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (sign === "\\") return { kind: "meta" };
|
|
43
|
+
inHunk = false;
|
|
44
|
+
}
|
|
45
|
+
if (line.startsWith("diff --git ")) {
|
|
46
|
+
file = "";
|
|
47
|
+
oldFile = "";
|
|
48
|
+
status = "";
|
|
49
|
+
renamedFrom = "";
|
|
50
|
+
} else if (line.startsWith("new file mode")) status = "new";
|
|
51
|
+
else if (line.startsWith("deleted file mode")) status = "deleted";
|
|
52
|
+
else if (line.startsWith("rename from ")) renamedFrom = line.slice(12);
|
|
53
|
+
else if (line.startsWith("--- ")) oldFile = line === "--- /dev/null" ? "" : unprefix(line.slice(4));
|
|
54
|
+
else if (line.startsWith("+++ ")) {
|
|
55
|
+
file = line === "+++ /dev/null" ? "" : unprefix(line.slice(4));
|
|
56
|
+
const name = renamedFrom ? `${renamedFrom} → ${file}` : file || oldFile;
|
|
57
|
+
return {
|
|
58
|
+
kind: "file",
|
|
59
|
+
label: status ? `${name} (${status})` : name
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return { kind: "meta" };
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export { diffLines };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { diffLines } from "./diff.js";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { definePlugin } from "@bigmistqke/whiteboard";
|
|
4
|
+
// plugins/code/index.ts
|
|
5
|
+
const DEFAULT_THEMES = {
|
|
6
|
+
light: "github-light",
|
|
7
|
+
dark: "github-dark"
|
|
8
|
+
};
|
|
9
|
+
const DEFAULT_REPLACEMENTS = {
|
|
10
|
+
"github-light": {
|
|
11
|
+
"#e36209": "#0f766e",
|
|
12
|
+
"#b08800": "#0f766e"
|
|
13
|
+
},
|
|
14
|
+
"github-dark": {
|
|
15
|
+
"#ffab70": "#5eead4",
|
|
16
|
+
"#c24e00": "#2dd4bf"
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
function code(options = {}) {
|
|
20
|
+
const themes = options.themes ?? DEFAULT_THEMES;
|
|
21
|
+
const colorReplacements = options.colorReplacements ?? (options.themes ? {} : DEFAULT_REPLACEMENTS);
|
|
22
|
+
let highlighter;
|
|
23
|
+
let shiki;
|
|
24
|
+
const loaded = /* @__PURE__ */ new Set();
|
|
25
|
+
/** Highlight `code` as `lang`; an unknown or missing language renders as plain text. */
|
|
26
|
+
async function highlight(code, lang) {
|
|
27
|
+
shiki ??= await import("shiki");
|
|
28
|
+
highlighter ??= shiki.createHighlighter({
|
|
29
|
+
themes: Object.values(themes),
|
|
30
|
+
langs: []
|
|
31
|
+
});
|
|
32
|
+
const h = await highlighter;
|
|
33
|
+
let language = String(lang ?? "").toLowerCase();
|
|
34
|
+
if (language in shiki.bundledLanguages) {
|
|
35
|
+
if (!loaded.has(language)) {
|
|
36
|
+
await h.loadLanguage(language);
|
|
37
|
+
loaded.add(language);
|
|
38
|
+
}
|
|
39
|
+
} else language = "text";
|
|
40
|
+
const diff = language === "diff" ? diffLines(code) : null;
|
|
41
|
+
return h.codeToHtml(code, {
|
|
42
|
+
lang: language,
|
|
43
|
+
themes,
|
|
44
|
+
defaultColor: false,
|
|
45
|
+
colorReplacements,
|
|
46
|
+
transformers: diff ? [{
|
|
47
|
+
line(node, n) {
|
|
48
|
+
const info = diff[n - 1];
|
|
49
|
+
if (!info) return;
|
|
50
|
+
node.properties["data-diff"] = info.kind;
|
|
51
|
+
if (info.n != null) node.properties["data-n"] = String(info.n);
|
|
52
|
+
if (info.at) node.properties["data-wb-at"] = info.at;
|
|
53
|
+
if (info.label != null) node.children = [{
|
|
54
|
+
type: "text",
|
|
55
|
+
value: info.label
|
|
56
|
+
}];
|
|
57
|
+
},
|
|
58
|
+
code(node) {
|
|
59
|
+
node.children = node.children.filter((child, i, all) => {
|
|
60
|
+
const isMeta = (c) => c?.type === "element" && c.properties["data-diff"] === "meta";
|
|
61
|
+
return !isMeta(child) && !(child.type === "text" && isMeta(all[i - 1]));
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}] : []
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return definePlugin({
|
|
68
|
+
name: "code",
|
|
69
|
+
blocks: { code: {
|
|
70
|
+
fence: "any",
|
|
71
|
+
html: (ctx) => highlight(ctx.text, ctx.lang),
|
|
72
|
+
style: new URL("./style.css", import.meta.url)
|
|
73
|
+
} },
|
|
74
|
+
docs: () => fs.readFileSync(new URL("./README.md", import.meta.url), "utf8")
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
export { code as default };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* Code blocks highlighted by Shiki: tokens carry both colours; pick the one for the current theme.
|
|
2
|
+
The block keeps the page's own code background. */
|
|
3
|
+
pre.shiki { background: var(--code-bg); }
|
|
4
|
+
.shiki span {
|
|
5
|
+
color: var(--shiki-light); font-style: var(--shiki-light-font-style);
|
|
6
|
+
font-weight: var(--shiki-light-font-weight); text-decoration: var(--shiki-light-text-decoration);
|
|
7
|
+
}
|
|
8
|
+
@media (prefers-color-scheme: dark) {
|
|
9
|
+
:root:not([data-theme="light"]) .shiki span {
|
|
10
|
+
color: var(--shiki-dark); font-style: var(--shiki-dark-font-style);
|
|
11
|
+
font-weight: var(--shiki-dark-font-weight); text-decoration: var(--shiki-dark-text-decoration);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
:root[data-theme="dark"] .shiki span {
|
|
15
|
+
color: var(--shiki-dark); font-style: var(--shiki-dark-font-style);
|
|
16
|
+
font-weight: var(--shiki-dark-font-weight); text-decoration: var(--shiki-dark-text-decoration);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* a diff: one row per line, as wide as the longest (a grid leaves out the line breaks between them,
|
|
20
|
+
which stay in the text), tinted by what it is, with its number in a gutter */
|
|
21
|
+
.shiki code:has(> .line[data-diff]) { display: grid; width: max-content; min-width: 100%; }
|
|
22
|
+
.shiki .line[data-diff=add] { background: color-mix(in srgb, #16a34a 14%, transparent); }
|
|
23
|
+
.shiki .line[data-diff=del] { background: color-mix(in srgb, #dc2626 14%, transparent); }
|
|
24
|
+
.shiki .line[data-diff]::before { content: attr(data-n); display: inline-block; width: 4ch; margin-right: 1.5ch; text-align: right; color: var(--muted, #696e76); opacity: .7; user-select: none; }
|
|
25
|
+
:root .shiki .line[data-diff=hunk] { color: var(--muted, #696e76); line-height: 1.2; margin: 2px 0; }
|
|
26
|
+
.shiki .line[data-diff=hunk]::before { content: '⋯'; text-align: center; }
|
|
27
|
+
.shiki .line[data-diff=file] { font-weight: 600; margin-bottom: 8px; }
|
|
28
|
+
.shiki .line[data-diff=file]::before { content: none; }
|
|
29
|
+
.shiki .line[data-diff=file] + .line[data-diff=hunk] { margin-top: 0; }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var e=class{value;constructor(e){this.value=e}toString(){return this.value}};const t={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},n=e=>String(e).replace(/[&<>"']/g,e=>t[e]),r=t=>new e(String(t??``));function i(t){return t==null||t===!1?``:t instanceof e?t.value:Array.isArray(t)?t.map(i).join(``):n(t)}function a(t,...n){let r=t[0];for(let e=0;e<n.length;e++)r+=i(n[e])+t[e+1];return new e(r)}const o=`comments:new`,s=`comments:reply`,c=`comments:resolve`;let l,u,d,f=[],p=null;const m=document.createElement(`div`);m.className=`wb-comments`;const h=document.createElement(`button`);h.type=`button`,h.className=`wb-comment-start`,h.textContent=`Comment`,h.hidden=!0;const g=document.createElement(`div`);g.className=`wb-thread`,g.hidden=!0;function _(){let e=[],t=``,n=document.createTreeWalker(d,NodeFilter.SHOW_TEXT,{acceptNode:e=>e.parentElement?.closest(`script, style, textarea`)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});for(let r=n.nextNode();r;r=n.nextNode())e.push({node:r,start:t.length}),t+=r.data;return{text:t,nodes:e}}function v(e,t,n){for(let r=0;r<e.nodes.length;r++){let{node:i,start:a}=e.nodes[r],o=a+i.data.length;if(t<o||n&&t===o||r===e.nodes.length-1)return{node:i,offset:Math.min(Math.max(t-a,0),i.data.length)}}return null}function y(e,t){let n=(t,n)=>{if(t.nodeType===Node.TEXT_NODE){let r=e.nodes.find(e=>e.node===t);return r?r.start+n:null}let r=document.createRange();r.setStart(d,0),r.setEnd(t,n);let i=0;for(let{node:t,start:n}of e.nodes)r.intersectsNode(t)&&(i=n+t.data.length);return i},r=n(t.startContainer,t.startOffset),i=n(t.endContainer,t.endOffset);return r==null||i==null?null:{start:r,end:i}}function b(e,t){let n=String(t.quote??``);if(!n)return null;let r=String(t.before??``),i=String(t.after??``),a=-1,o=-1;for(let t=e.text.indexOf(n);t>=0;t=e.text.indexOf(n,t+1)){let s=e.text.slice(Math.max(0,t-r.length),t),c=e.text.slice(t+n.length,t+n.length+i.length),l=0;for(;l<s.length&&s[s.length-1-l]===r[r.length-1-l];)l++;let u=0;for(;u<c.length&&c[u]===i[u];)u++;l+u>o&&(a=t,o=l+u)}if(a<0)return null;let s=v(e,a,!1),c=v(e,a+n.length,!0);if(!s||!c)return null;let l=document.createRange();return l.setStart(s.node,s.offset),l.setEnd(c.node,c.offset),l}function x(){let e=u.events(),t=new Set(e.filter(e=>e.type===c).map(e=>String(e.data.replyTo))),n=_();return e.filter(e=>e.type===o&&!t.has(e.id)).map(t=>({id:t.id,comment:t,replies:e.filter(e=>e.type===s&&e.data.replyTo===t.id),range:b(n,t.data)}))}const S=e=>e.replies.at(-1)?.from===`cli`;function C(){let e=CSS.highlights,t=window.Highlight;if(e&&t){e.set(`wb-comment`,new t(...f.filter(e=>e.range&&e.id!==p).map(e=>e.range)));let n=f.find(e=>e.id===p)?.range;n?e.set(`wb-comment-active`,new t(n)):e.delete(`wb-comment-active`)}let n=d.getBoundingClientRect(),r=new Set(u.unread().map(e=>e.id));m.replaceChildren(...f.map((e,t)=>{let i=document.createElement(`button`);i.type=`button`,i.className=`wb-comment-badge`,i.dataset.thread=e.id,i.toggleAttribute(`data-agent`,S(e)),i.dataset.wbHolds=e.replies.map(e=>e.id).join(` `);let a=e.replies.some(e=>r.has(e.id));i.toggleAttribute(`data-unread`,a),i.title=a?`the agent replied: unread`:S(e)?`the agent replied`:`comment`,i.textContent=String(1+e.replies.length);let o=e.range?.getClientRects()[0],s=o?o.top+scrollY:n.top+scrollY+t*30,c=Math.min(n.right+8+scrollX,document.documentElement.clientWidth-36+scrollX);return i.style.top=`${s}px`,i.style.left=`${c}px`,o||(i.dataset.detached=``),i})),p&&D()}function w(){l&&(d=l.querySelector(`main`)??l,f=x(),p&&!f.some(e=>e.id===p)?k():p&&E(),C())}const T=/* @__PURE__ */ new Map;function E(){let e=f.find(e=>e.id===p);if(!e)return;let t=e=>e.from===`cli`?`agent`:`you`,n=e=>{let n=String(e.data.text??``),i=T.get(n);return a`<div class="wb-thread-message" data-from="${t(e)}" data-wb-message="${e.id}"><span class="wb-thread-who">${t(e)}</span><div class="wb-thread-text"${i==null?``:r(` data-md`)}>${i==null?n:r(i)}</div></div>`},i=g.querySelector(`textarea`)?.value??``;g.innerHTML=String(a`
|
|
2
|
+
<blockquote class="wb-thread-quote">${e.comment.data.quote??``}</blockquote>
|
|
3
|
+
${e.comment.data.at&&a`<p class="wb-thread-at">${e.comment.data.at}</p>`}
|
|
4
|
+
${!e.range&&a`<p class="wb-thread-detached">This passage is no longer on the page.</p>`}
|
|
5
|
+
${[e.comment,...e.replies].map(n)}
|
|
6
|
+
<form class="wb-thread-reply">
|
|
7
|
+
<textarea rows="2" placeholder="Reply (Shift+Enter for a new line)"></textarea>
|
|
8
|
+
<div class="wb-thread-actions"><button type="submit" class="wb-comment-button wb-comment-primary">Reply</button><button type="button" class="wb-comment-button" data-close>Close thread</button></div>
|
|
9
|
+
</form>`),g.querySelector(`textarea`).value=i;for(let t of[e.comment,...e.replies]){let e=String(t.data.text??``);T.has(e)||u.markdown(e).then(n=>{T.set(e,n);let r=g.querySelector(`[data-wb-message="${CSS.escape(t.id)}"] .wb-thread-text`);r&&!r.hasAttribute(`data-md`)&&(r.innerHTML=n,r.setAttribute(`data-md`,``))},e=>console.error(`comments:`,e))}}function D(){let e=m.querySelector(`[data-thread="${p}"]`);if(!e)return;let t=parseFloat(e.style.top)+28,n=Math.min(360,document.documentElement.clientWidth-32),r=Math.max(16+scrollX,Math.min(parseFloat(e.style.left)+28-n,document.documentElement.clientWidth-n-16+scrollX));g.style.top=`${t}px`,g.style.left=`${r}px`,g.style.width=`${n}px`}function O(e){p=e,g.hidden=!1,g.querySelector(`textarea`)?.replaceWith(document.createElement(`textarea`)),E(),C(),g.querySelector(`textarea`)?.focus({preventScroll:!0})}function k(){p=null,g.hidden=!0,C()}let A=null;function j(){d=l.querySelector(`main`)??l;let e=getSelection();if(!e||e.isCollapsed||!e.rangeCount){h.matches(`:focus`)||(h.hidden=!0);return}let t=e.getRangeAt(0),n=e=>d.contains(e)&&!(e instanceof Element?e:e.parentElement)?.closest(`form, input, textarea, select, button`);!n(t.startContainer)||!n(t.endContainer)?h.hidden=!0:h.hidden=!M(t)}function M(e){let t=e.toString().trim();if(!t)return!1;let n=_(),r=y(n,e);if(!r)return!1;let i=n.text.indexOf(t,r.start),a=i>=0&&i<=r.end?i:r.start,o=e.startContainer instanceof Element?e.startContainer:e.startContainer.parentElement;for(;o&&o.parentElement!==d;)o=o.parentElement;A={quote:t,before:n.text.slice(Math.max(0,a-32),a),after:n.text.slice(a+t.length,a+t.length+32),block:o?[...d.children].indexOf(o):-1};let s=[...d.querySelectorAll(`[data-wb-at]`)].filter(t=>e.intersectsNode(t)&&t.textContent).map(e=>e.dataset.wbAt);s.length&&(A.at=s.length>1&&s.at(-1)!==s[0]?`${s[0]} – ${s.at(-1)}`:s[0]);let c=e.getClientRects(),l=c[c.length-1]??e.getBoundingClientRect();return h.style.top=`${l.bottom+scrollY+6}px`,h.style.left=`${Math.min(l.right+scrollX-40,document.documentElement.clientWidth-110+scrollX)}px`,!0}const N=document.createElement(`button`);N.type=`button`,N.className=`wb-line-comment`,N.textContent=`+`,N.title=`Comment on this line (drag for several)`,N.hidden=!0;let P=null,F=null;const I=e=>{let t=e instanceof Element?e.closest(`pre .line`):null;return t&&d.contains(t)&&!t.closest(`form`)?t:null};function L(e,t){let[n,r]=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING?[t,e]:[e,t],i=document.createRange();return i.setStart(n,0),i.setEnd(r,r.childNodes.length),i}function R(e){P=e;let t=e.getBoundingClientRect(),n=e.closest(`pre`).getBoundingClientRect();N.style.top=`${t.top+scrollY+t.height/2-10}px`,N.style.left=`${Math.max(scrollX+2,n.left+scrollX-24)}px`,N.hidden=!1}function z(e){if(F){let t=F.pre.getBoundingClientRect(),n=F.from.getBoundingClientRect().left+4,r=I(document.elementFromPoint(n,Math.min(Math.max(e.clientY,t.top+1),t.bottom-1)));if(r&&F.pre.contains(r)&&r!==F.to){F.to=r;let e=CSS.highlights,t=window.Highlight;e&&t&&e.set(`wb-comment-active`,new t(L(F.from,F.to)))}return}if(e.target===N)return;let t=I(e.target);if(t)return R(t);if(N.hidden||!P)return;let n=P.closest(`pre`),r=n.getBoundingClientRect(),i=N.getBoundingClientRect(),a=e.clientX>=i.left-4&&e.clientX<=r.right&&e.clientY>=r.top&&e.clientY<=r.bottom,o=a?I(document.elementFromPoint(P.getBoundingClientRect().left+4,e.clientY)):null;o&&n.contains(o)?R(o):a&&e.clientY>=i.top-4&&e.clientY<=i.bottom+4||(N.hidden=!0,P=null)}const B=document.createElement(`form`);B.className=`wb-thread wb-comment-new`,B.hidden=!0,B.innerHTML=String(a`<blockquote class="wb-thread-quote"></blockquote><textarea rows="3" placeholder="Your comment (Shift+Enter for a new line)"></textarea>
|
|
10
|
+
<div class="wb-thread-actions"><button type="submit" class="wb-comment-button wb-comment-primary">Comment</button><button type="button" class="wb-comment-button" data-cancel>Cancel</button></div>`);function V(){if(!A)return;B.querySelector(`blockquote`).textContent=A.at?`${A.at}\n${A.quote}`:A.quote,B.style.top=h.style.top;let e=Math.min(360,document.documentElement.clientWidth-32);B.style.width=`${e}px`,B.style.left=`${Math.max(16+scrollX,Math.min(parseFloat(h.style.left),document.documentElement.clientWidth-e-16+scrollX))}px`,B.hidden=!1,h.hidden=!0,B.querySelector(`textarea`).focus({preventScroll:!0})}const H=(e,t,n)=>{if(t.kind!==`page`&&t.kind!==`file`)return;l=e,d=l.querySelector(`main`)??l,u=n,document.body.append(m,h,N,g,B),document.addEventListener(`mousemove`,z),document.documentElement.addEventListener(`mouseleave`,()=>{F||(N.hidden=!0,P=null)}),N.addEventListener(`mousedown`,e=>{if(!P||e.button!==0)return;e.preventDefault();let t=CSS.highlights,n=window.Highlight;t&&n&&t.set(`wb-comment-active`,new n(L(P,P))),F={pre:P.closest(`pre`),from:P,to:P}}),document.addEventListener(`mouseup`,()=>{if(!F)return;let{from:e,to:t}=F;F=null,N.hidden=!0,M(L(e,t))?V():C()});let r=0;document.addEventListener(`selectionchange`,()=>{clearTimeout(r),r=window.setTimeout(j,150)}),h.addEventListener(`mousedown`,e=>e.preventDefault()),h.addEventListener(`click`,V);for(let e of[B,g])e.addEventListener(`keydown`,e=>{let t=e.target;t.tagName!==`TEXTAREA`||e.key!==`Enter`||e.shiftKey||e.isComposing||(e.preventDefault(),t.closest(`form`)?.requestSubmit())});B.addEventListener(`submit`,async e=>{e.preventDefault();let t=B.querySelector(`textarea`).value.trim();if(!t||!A)return;let n=await u.append(o,{...A,text:t});B.querySelector(`textarea`).value=``,B.hidden=!0,A=null,getSelection()?.removeAllRanges(),w(),O(n.id)}),B.querySelector(`[data-cancel]`).addEventListener(`click`,()=>{B.hidden=!0,A=null}),m.addEventListener(`click`,e=>{let t=e.target.closest(`[data-thread]`)?.dataset.thread;t&&(p===t?k():O(t))}),g.addEventListener(`submit`,async e=>{e.preventDefault();let t=g.querySelector(`textarea`),n=t.value.trim();n&&p&&(await u.append(s,{replyTo:p,text:n}),t.value=``,w())}),g.addEventListener(`click`,async e=>{if(!e.target.closest(`[data-close]`)||!p)return;let t=p;k(),u.markRead(f.find(e=>e.id===t)?.replies.map(e=>e.id)??[]),await u.append(c,{replyTo:t}),w()}),m.addEventListener(`wb-reveal`,e=>{let t=e.target.closest(`[data-thread]`)?.dataset.thread;t&&p!==t&&O(t)}),document.addEventListener(`dblclick`,e=>{let t=e.target;!p||g.contains(t)||m.contains(t)||k()}),document.addEventListener(`keydown`,e=>{e.key===`Escape`&&(B.hidden?p&&k():(B.hidden=!0,A=null))}),u.onEvents(w),u.onRendered(w),new ResizeObserver(()=>C()).observe(l),addEventListener(`resize`,()=>C()),w()};export{H as default};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { packagePath } from "../../src/package.js";
|
|
2
|
+
// plugins/comments/index.ts
|
|
3
|
+
const CLIENT = packagePath("dist/plugins/comments/client.js");
|
|
4
|
+
const STYLE = packagePath("dist/plugins/comments/style.css");
|
|
5
|
+
const DOCS = `## Comments
|
|
6
|
+
|
|
7
|
+
The reader can select text on any page and comment on it, or comment on
|
|
8
|
+
whole lines of a code block (a "+" beside each line; dragging it takes
|
|
9
|
+
several). Each comment comes to you as an event on the page, like a form
|
|
10
|
+
answer:
|
|
11
|
+
|
|
12
|
+
\`\`\`json
|
|
13
|
+
{"id":"…","page":"plan","type":"comments:new","data":{"quote":"the selected text","before":"…","after":"…","block":3,"text":"their comment"}}
|
|
14
|
+
\`\`\`
|
|
15
|
+
|
|
16
|
+
On lines that say where they are from, \`data.at\` says it too: in a
|
|
17
|
+
\`diff\` fence, \`"src/a.ts:12"\` (a line of the new file), \`"src/a.ts (old):9"\`
|
|
18
|
+
(a removed line), or \`"src/a.ts:12 – src/a.ts:15"\` for several. Any block
|
|
19
|
+
can say where its parts are from with a \`data-wb-at\` attribute.
|
|
20
|
+
|
|
21
|
+
Replies to a thread come as \`comments:reply\` (\`data.replyTo\` is the comment's
|
|
22
|
+
id), and \`comments:resolve\` when the reader closed it. A thread stays on the
|
|
23
|
+
page until the reader closes it. Answer a comment the way it asks:
|
|
24
|
+
|
|
25
|
+
- **It asks for a change:** edit the page. The thread stays, so say what you
|
|
26
|
+
changed in a reply if it is not obvious.
|
|
27
|
+
- **It asks a question:** reply in the thread:
|
|
28
|
+
\`whiteboard append --page <file> --type comments:reply --data '{"replyTo":"<comment id>","text":"…"}'\`
|
|
29
|
+
|
|
30
|
+
Your replies show as the agent's, and \`wait\` and \`watch\` skip what you
|
|
31
|
+
append, so you don't hear your own replies. Comments and replies are
|
|
32
|
+
markdown: code in backticks or fences, lists, links, \`#12\`; raw HTML and
|
|
33
|
+
blocks (\`:::…\`, \`:button\`) show as written.`;
|
|
34
|
+
function comments() {
|
|
35
|
+
return {
|
|
36
|
+
name: "comments",
|
|
37
|
+
docs: () => DOCS,
|
|
38
|
+
events: {
|
|
39
|
+
"comments:new": {
|
|
40
|
+
handOut: true,
|
|
41
|
+
description: "a comment on a passage or lines of code: `{ quote, before, after, block, at?, text }`; its id is the thread's"
|
|
42
|
+
},
|
|
43
|
+
"comments:reply": {
|
|
44
|
+
handOut: true,
|
|
45
|
+
forReader: true,
|
|
46
|
+
description: "a reply in a thread: `{ replyTo, text }`"
|
|
47
|
+
},
|
|
48
|
+
"comments:resolve": { description: "the reader closed a thread: `{ replyTo }`" }
|
|
49
|
+
},
|
|
50
|
+
style: STYLE,
|
|
51
|
+
setup: () => ({ client: CLIENT })
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export { comments as default };
|